@clayroach/effect 3.19.14-source-capture.1 → 3.19.14-source-capture.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1969,20 +1969,31 @@ export const all = <
1969
1969
  arg: Arg,
1970
1970
  options?: O
1971
1971
  ): Effect.All.Return<Arg, O> => {
1972
+ // Capture stack trace early (while user code is on stack)
1973
+ const rawStack = new Error().stack ?? ""
1974
+
1972
1975
  const [effects, reconcile] = allResolveInput(arg)
1976
+ const count = Array.isArray(effects) ? effects.length : undefined
1977
+
1978
+ let result: Effect.Effect<any, any, any>
1973
1979
 
1974
1980
  if (options?.mode === "validate") {
1975
- return allValidate(effects, reconcile, options) as any
1981
+ result = allValidate(effects, reconcile, options) as any
1976
1982
  } else if (options?.mode === "either") {
1977
- return allEither(effects, reconcile, options) as any
1983
+ result = allEither(effects, reconcile, options) as any
1984
+ } else {
1985
+ result = options?.discard !== true && reconcile._tag === "Some"
1986
+ ? core.map(
1987
+ forEach(effects, identity, options as any),
1988
+ reconcile.value
1989
+ ) as any
1990
+ : forEach(effects, identity, options as any) as any
1978
1991
  }
1979
1992
 
1980
- return options?.discard !== true && reconcile._tag === "Some"
1981
- ? core.map(
1982
- forEach(effects, identity, options as any),
1983
- reconcile.value
1984
- ) as any
1985
- : forEach(effects, identity, options as any) as any
1993
+ // Set operation metadata in trace field for OpSupervision
1994
+ ;(result as any).trace = core.makeOperationMeta("all", rawStack, count)
1995
+
1996
+ return result as Effect.All.Return<Arg, O>
1986
1997
  }
1987
1998
 
1988
1999
  /* @internal */
@@ -2125,8 +2136,12 @@ export const forEach: {
2125
2136
  readonly discard?: boolean | undefined
2126
2137
  readonly concurrentFinalizers?: boolean | undefined
2127
2138
  }
2128
- ) =>
2129
- core.withFiberRuntime<A | void, E, R>((r) => {
2139
+ ) => {
2140
+ // Capture stack trace early (while user code is on stack)
2141
+ const rawStack = new Error().stack ?? ""
2142
+ const count = Array.isArray(self) ? self.length : undefined
2143
+
2144
+ const result = core.withFiberRuntime<A | void, E, R>((r) => {
2130
2145
  const isRequestBatchingEnabled = options?.batching === true ||
2131
2146
  (options?.batching === "inherit" && r.getFiberRef(core.currentRequestBatching))
2132
2147
 
@@ -2167,7 +2182,13 @@ export const forEach: {
2167
2182
  forEachParN(self, n, (a, i) => restore(f(a, i)), isRequestBatchingEnabled)
2168
2183
  )
2169
2184
  )
2170
- }))
2185
+ })
2186
+
2187
+ // Set operation metadata in trace field for OpSupervision
2188
+ ;(result as any).trace = core.makeOperationMeta("forEach", rawStack, count)
2189
+
2190
+ return result
2191
+ })
2171
2192
 
2172
2193
  /* @internal */
2173
2194
  export const forEachParUnbounded = <A, B, E, R>(