MCPcopy Create free account
hub / github.com/Effect-TS/effect / mergeAllEffect

Function mergeAllEffect

packages/effect/src/Layer.ts:1181–1196  ·  view source on GitHub ↗
(
  layers: Layers,
  memoMap: MemoMap,
  scope: Scope.Scope
)

Source from the content-addressed store, hash-verified

1179}
1180
1181const mergeAllEffect = <Layers extends [Layer<never, any, any>, ...Array<Layer<never, any, any>>]>(
1182 layers: Layers,
1183 memoMap: MemoMap,
1184 scope: Scope.Scope
1185): Effect<
1186 Context.Context<{ [k in keyof Layers]: Success<Layers[k]> }[number]>,
1187 { [k in keyof Layers]: Error<Layers[k]> }[number],
1188 { [k in keyof Layers]: Services<Layers[k]> }[number]
1189> => {
1190 const parentScope = Scope.forkUnsafe(scope, "parallel")
1191 return internalEffect.forEach(layers, (layer) => layer.build(memoMap, Scope.forkUnsafe(parentScope, "sequential")), {
1192 concurrency: layers.length
1193 }).pipe(
1194 internalEffect.map((context) => Context.mergeAll(...(context as any)))
1195 )
1196}
1197
1198/**
1199 * Combines all the provided layers concurrently, creating a new layer with

Callers 2

mergeAllFunction · 0.85
provideWithFunction · 0.85

Calls 4

buildMethod · 0.80
pipeMethod · 0.65
forEachMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected