effect 4.0.0-beta.83 → 4.0.0-beta.85

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.
Files changed (235) hide show
  1. package/dist/Array.d.ts +64 -64
  2. package/dist/Array.js +26 -26
  3. package/dist/Cache.d.ts +1 -1
  4. package/dist/Cache.js +1 -1
  5. package/dist/Cause.d.ts +68 -68
  6. package/dist/Cause.js +47 -47
  7. package/dist/Channel.d.ts +5 -5
  8. package/dist/Channel.js +3 -3
  9. package/dist/Clock.d.ts +1 -1
  10. package/dist/Clock.js +1 -1
  11. package/dist/Combiner.d.ts +9 -9
  12. package/dist/Combiner.js +8 -8
  13. package/dist/Config.d.ts +15 -94
  14. package/dist/Config.d.ts.map +1 -1
  15. package/dist/Config.js +22 -70
  16. package/dist/Config.js.map +1 -1
  17. package/dist/ConfigProvider.d.ts +58 -74
  18. package/dist/ConfigProvider.d.ts.map +1 -1
  19. package/dist/ConfigProvider.js +66 -41
  20. package/dist/ConfigProvider.js.map +1 -1
  21. package/dist/Console.d.ts +1 -1
  22. package/dist/Console.js +1 -1
  23. package/dist/Context.d.ts.map +1 -1
  24. package/dist/Context.js +4 -3
  25. package/dist/Context.js.map +1 -1
  26. package/dist/Data.d.ts +15 -15
  27. package/dist/Data.js +3 -3
  28. package/dist/DateTime.d.ts +6 -6
  29. package/dist/DateTime.js +2 -2
  30. package/dist/Duration.d.ts +3 -3
  31. package/dist/Duration.js +3 -3
  32. package/dist/Effect.d.ts +84 -45
  33. package/dist/Effect.d.ts.map +1 -1
  34. package/dist/Effect.js +72 -33
  35. package/dist/Effect.js.map +1 -1
  36. package/dist/Equal.d.ts +7 -7
  37. package/dist/Equal.js +5 -5
  38. package/dist/Equivalence.d.ts +17 -17
  39. package/dist/Equivalence.js +13 -13
  40. package/dist/Exit.d.ts +3 -3
  41. package/dist/Exit.js +3 -3
  42. package/dist/Formatter.d.ts +5 -5
  43. package/dist/Formatter.js +4 -4
  44. package/dist/Function.d.ts +10 -10
  45. package/dist/Function.js +3 -3
  46. package/dist/HashMap.d.ts +3 -3
  47. package/dist/HashMap.js +1 -1
  48. package/dist/Iterable.d.ts +6 -6
  49. package/dist/Iterable.js +2 -2
  50. package/dist/JsonPatch.d.ts +2 -2
  51. package/dist/Layer.d.ts +1 -1
  52. package/dist/Layer.js +5 -4
  53. package/dist/Layer.js.map +1 -1
  54. package/dist/LayerMap.d.ts.map +1 -1
  55. package/dist/LayerMap.js +4 -3
  56. package/dist/LayerMap.js.map +1 -1
  57. package/dist/Logger.d.ts +1 -1
  58. package/dist/Logger.js +1 -1
  59. package/dist/Match.d.ts +8 -8
  60. package/dist/Match.js +8 -8
  61. package/dist/Metric.d.ts +3 -3
  62. package/dist/Metric.js +3 -3
  63. package/dist/Optic.d.ts +30 -30
  64. package/dist/Optic.js +12 -12
  65. package/dist/Option.d.ts +7 -7
  66. package/dist/Option.js +7 -7
  67. package/dist/Order.d.ts +23 -23
  68. package/dist/Order.js +20 -20
  69. package/dist/Pool.d.ts +1 -1
  70. package/dist/Pool.js +1 -1
  71. package/dist/Predicate.d.ts +88 -88
  72. package/dist/Predicate.js +47 -47
  73. package/dist/PubSub.d.ts +3 -3
  74. package/dist/PubSub.js +3 -3
  75. package/dist/Random.d.ts +31 -0
  76. package/dist/Random.d.ts.map +1 -1
  77. package/dist/Random.js +32 -0
  78. package/dist/Random.js.map +1 -1
  79. package/dist/Reducer.d.ts +1 -1
  80. package/dist/Reducer.js +1 -1
  81. package/dist/Result.d.ts +18 -18
  82. package/dist/Result.js +8 -8
  83. package/dist/Runtime.d.ts +1 -1
  84. package/dist/Runtime.js +1 -1
  85. package/dist/Schema.d.ts +313 -126
  86. package/dist/Schema.d.ts.map +1 -1
  87. package/dist/Schema.js +316 -127
  88. package/dist/Schema.js.map +1 -1
  89. package/dist/SchemaAST.d.ts +9 -8
  90. package/dist/SchemaAST.d.ts.map +1 -1
  91. package/dist/SchemaAST.js +203 -140
  92. package/dist/SchemaAST.js.map +1 -1
  93. package/dist/SchemaGetter.d.ts +48 -48
  94. package/dist/SchemaGetter.js +44 -44
  95. package/dist/SchemaIssue.d.ts +3 -3
  96. package/dist/SchemaIssue.js +3 -3
  97. package/dist/SchemaParser.d.ts +122 -22
  98. package/dist/SchemaParser.d.ts.map +1 -1
  99. package/dist/SchemaParser.js +186 -50
  100. package/dist/SchemaParser.js.map +1 -1
  101. package/dist/SchemaRepresentation.d.ts +1 -1
  102. package/dist/SchemaRepresentation.d.ts.map +1 -1
  103. package/dist/SchemaRepresentation.js +96 -2
  104. package/dist/SchemaRepresentation.js.map +1 -1
  105. package/dist/SchemaTransformation.d.ts +20 -20
  106. package/dist/SchemaTransformation.js +18 -18
  107. package/dist/Stream.d.ts +3 -3
  108. package/dist/Stream.js +2 -2
  109. package/dist/Stream.js.map +1 -1
  110. package/dist/String.d.ts +1 -1
  111. package/dist/String.js +1 -1
  112. package/dist/Struct.d.ts +1 -1
  113. package/dist/Struct.js +1 -1
  114. package/dist/Types.d.ts +13 -13
  115. package/dist/internal/effect.js +33 -20
  116. package/dist/internal/effect.js.map +1 -1
  117. package/dist/internal/schema/arbitrary.js +17 -1
  118. package/dist/internal/schema/arbitrary.js.map +1 -1
  119. package/dist/internal/schema/cause.d.ts +2 -0
  120. package/dist/internal/schema/cause.d.ts.map +1 -0
  121. package/dist/internal/schema/cause.js +24 -0
  122. package/dist/internal/schema/cause.js.map +1 -0
  123. package/dist/internal/schema/schema.d.ts +8 -4
  124. package/dist/internal/schema/schema.d.ts.map +1 -1
  125. package/dist/internal/schema/schema.js +21 -8
  126. package/dist/internal/schema/schema.js.map +1 -1
  127. package/dist/internal/stackTraceLimit.d.ts +2 -0
  128. package/dist/internal/stackTraceLimit.d.ts.map +1 -0
  129. package/dist/internal/stackTraceLimit.js +40 -0
  130. package/dist/internal/stackTraceLimit.js.map +1 -0
  131. package/dist/internal/tracer.d.ts.map +1 -1
  132. package/dist/internal/tracer.js +4 -3
  133. package/dist/internal/tracer.js.map +1 -1
  134. package/dist/testing/TestSchema.d.ts +3 -3
  135. package/dist/testing/TestSchema.js +1 -1
  136. package/dist/unstable/ai/AiError.d.ts +1 -1
  137. package/dist/unstable/ai/AiError.js +1 -1
  138. package/dist/unstable/ai/Chat.d.ts +1 -1
  139. package/dist/unstable/ai/Chat.js +1 -1
  140. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  141. package/dist/unstable/ai/Tool.js +4 -5
  142. package/dist/unstable/ai/Tool.js.map +1 -1
  143. package/dist/unstable/cli/Prompt.js +2 -2
  144. package/dist/unstable/cli/Prompt.js.map +1 -1
  145. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  146. package/dist/unstable/httpapi/HttpApiMiddleware.js +4 -3
  147. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  148. package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
  149. package/dist/unstable/persistence/PersistedQueue.js +1 -1
  150. package/dist/unstable/rpc/Rpc.d.ts +1 -1
  151. package/dist/unstable/rpc/Rpc.js +1 -1
  152. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  153. package/dist/unstable/rpc/RpcGroup.js +3 -4
  154. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  155. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  156. package/dist/unstable/rpc/RpcMiddleware.js +4 -3
  157. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  158. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  159. package/dist/unstable/sql/SqlResolver.js +15 -2
  160. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  161. package/dist/unstable/workflow/Activity.d.ts +1 -0
  162. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  163. package/dist/unstable/workflow/Activity.js +1 -0
  164. package/dist/unstable/workflow/Activity.js.map +1 -1
  165. package/dist/unstable/workflow/WorkflowEngine.js +1 -1
  166. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  167. package/package.json +1 -1
  168. package/src/Array.ts +65 -65
  169. package/src/Cache.ts +1 -1
  170. package/src/Cause.ts +68 -68
  171. package/src/Channel.ts +5 -5
  172. package/src/Clock.ts +1 -1
  173. package/src/Combiner.ts +9 -9
  174. package/src/Config.ts +40 -108
  175. package/src/ConfigProvider.ts +139 -100
  176. package/src/Console.ts +1 -1
  177. package/src/Context.ts +4 -5
  178. package/src/Data.ts +15 -15
  179. package/src/DateTime.ts +6 -6
  180. package/src/Duration.ts +3 -3
  181. package/src/Effect.ts +89 -45
  182. package/src/Equal.ts +7 -7
  183. package/src/Equivalence.ts +17 -17
  184. package/src/Exit.ts +3 -3
  185. package/src/Formatter.ts +5 -5
  186. package/src/Function.ts +10 -10
  187. package/src/HashMap.ts +3 -3
  188. package/src/Iterable.ts +6 -6
  189. package/src/JsonPatch.ts +2 -2
  190. package/src/Layer.ts +5 -5
  191. package/src/LayerMap.ts +4 -3
  192. package/src/Logger.ts +1 -1
  193. package/src/Match.ts +8 -8
  194. package/src/Metric.ts +3 -3
  195. package/src/Optic.ts +30 -30
  196. package/src/Option.ts +7 -7
  197. package/src/Order.ts +23 -23
  198. package/src/Pool.ts +1 -1
  199. package/src/Predicate.ts +88 -88
  200. package/src/PubSub.ts +3 -3
  201. package/src/Random.ts +42 -0
  202. package/src/Reducer.ts +1 -1
  203. package/src/Result.ts +20 -20
  204. package/src/Runtime.ts +1 -1
  205. package/src/Schema.ts +389 -153
  206. package/src/SchemaAST.ts +237 -148
  207. package/src/SchemaGetter.ts +48 -48
  208. package/src/SchemaIssue.ts +3 -3
  209. package/src/SchemaParser.ts +197 -58
  210. package/src/SchemaRepresentation.ts +73 -3
  211. package/src/SchemaTransformation.ts +20 -20
  212. package/src/Stream.ts +4 -4
  213. package/src/String.ts +1 -1
  214. package/src/Struct.ts +1 -1
  215. package/src/Types.ts +13 -13
  216. package/src/internal/effect.ts +40 -21
  217. package/src/internal/schema/arbitrary.ts +23 -2
  218. package/src/internal/schema/cause.ts +26 -0
  219. package/src/internal/schema/schema.ts +36 -10
  220. package/src/internal/stackTraceLimit.ts +63 -0
  221. package/src/internal/tracer.ts +4 -3
  222. package/src/testing/TestSchema.ts +3 -3
  223. package/src/unstable/ai/AiError.ts +1 -1
  224. package/src/unstable/ai/Chat.ts +1 -1
  225. package/src/unstable/ai/Tool.ts +4 -3
  226. package/src/unstable/cli/Prompt.ts +1 -1
  227. package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -3
  228. package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
  229. package/src/unstable/persistence/PersistedQueue.ts +1 -1
  230. package/src/unstable/rpc/Rpc.ts +1 -1
  231. package/src/unstable/rpc/RpcGroup.ts +3 -4
  232. package/src/unstable/rpc/RpcMiddleware.ts +4 -3
  233. package/src/unstable/sql/SqlResolver.ts +15 -2
  234. package/src/unstable/workflow/Activity.ts +2 -0
  235. package/src/unstable/workflow/WorkflowEngine.ts +1 -1
package/dist/Types.d.ts CHANGED
@@ -27,7 +27,7 @@ type TupleOf_<T, N extends number, R extends Array<unknown>> = `${N}` extends `-
27
27
  * - If `N` is the general `number` type (non-literal), degrades to `Array<T>`.
28
28
  * - Negative numbers produce `never`.
29
29
  *
30
- * **Example** (Fixed-length tuple)
30
+ * **Example** (Checking fixed-length tuples)
31
31
  *
32
32
  * ```ts
33
33
  * import type { Types } from "effect"
@@ -61,7 +61,7 @@ export type TupleOf<N extends number, T> = N extends N ? number extends N ? Arra
61
61
  *
62
62
  * Produces a tuple with `N` fixed positions followed by `...Array<T>`.
63
63
  *
64
- * **Example** (Minimum-length tuple)
64
+ * **Example** (Checking minimum-length tuples)
65
65
  *
66
66
  * ```ts
67
67
  * import type { Types } from "effect"
@@ -198,7 +198,7 @@ export type ExtractTag<E, K extends string> = E extends {
198
198
  * - If the union members are incompatible (e.g. `string | number`), the
199
199
  * result is `never`.
200
200
  *
201
- * **Example** (Union to intersection)
201
+ * **Example** (Converting a union to an intersection)
202
202
  *
203
203
  * ```ts
204
204
  * import type { Types } from "effect"
@@ -258,7 +258,7 @@ export type Simplify<A> = {
258
258
  * distinguishing between `any`, `unknown`, `never`, and other types.
259
259
  * - Resolves to `true` if `X` and `Y` are identical, `false` otherwise.
260
260
  *
261
- * **Example** (Type equality check)
261
+ * **Example** (Checking type equality)
262
262
  *
263
263
  * ```ts
264
264
  * import type { Types } from "effect"
@@ -285,7 +285,7 @@ export type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T ext
285
285
  *
286
286
  * Returns `Y` when `A` and `B` are equal, `N` otherwise.
287
287
  *
288
- * **Example** (Conditional type based on equality)
288
+ * **Example** (Choosing a conditional type based on equality)
289
289
  *
290
290
  * ```ts
291
291
  * import type { Types } from "effect"
@@ -313,7 +313,7 @@ export type EqualsWith<A, B, Y, N> = (<T>() => T extends A ? 1 : 2) extends (<T>
313
313
  * Returns `true` if at least one key from `Key` exists in `A`, `false`
314
314
  * otherwise.
315
315
  *
316
- * **Example** (Key presence check)
316
+ * **Example** (Checking key presence)
317
317
  *
318
318
  * ```ts
319
319
  * import type { Types } from "effect"
@@ -338,7 +338,7 @@ export type Has<A, Key extends string> = (Key extends infer K ? K extends keyof
338
338
  *
339
339
  * Implemented as `MergeRight<Target, Source>`.
340
340
  *
341
- * **Example** (Left-biased merge)
341
+ * **Example** (Merging with left bias)
342
342
  *
343
343
  * ```ts
344
344
  * import type { Types } from "effect"
@@ -404,7 +404,7 @@ export type MergeRight<Target, Source> = Simplify<Source & {
404
404
  * - `"unbounded"` — run all effects concurrently with no limit.
405
405
  * - `"inherit"` — inherit the concurrency from the surrounding context.
406
406
  *
407
- * **Example** (Concurrency values)
407
+ * **Example** (Setting concurrency values)
408
408
  *
409
409
  * ```ts
410
410
  * import type { Types } from "effect"
@@ -431,7 +431,7 @@ export type Concurrency = number | "unbounded" | "inherit";
431
431
  *
432
432
  * Only affects the top level; nested properties remain readonly.
433
433
  *
434
- * **Example** (Shallow mutable conversion)
434
+ * **Example** (Converting shallowly to mutable types)
435
435
  *
436
436
  * ```ts
437
437
  * import type { Types } from "effect"
@@ -471,7 +471,7 @@ export type Mutable<T> = {
471
471
  * Recursion stops at primitives (`string`, `number`, `boolean`, `bigint`,
472
472
  * `symbol`) and functions.
473
473
  *
474
- * **Example** (Deep mutable conversion)
474
+ * **Example** (Converting deeply to mutable types)
475
475
  *
476
476
  * ```ts
477
477
  * import type { Types } from "effect"
@@ -533,7 +533,7 @@ export type NoInfer<A> = [A][A extends any ? 0 : never];
533
533
  * A value of type `Invariant<A>` cannot be assigned to `Invariant<B>` unless
534
534
  * `A` and `B` are the same type.
535
535
  *
536
- * **Example** (Invariant phantom type)
536
+ * **Example** (Defining an invariant phantom type)
537
537
  *
538
538
  * ```ts
539
539
  * import type { Types } from "effect"
@@ -599,7 +599,7 @@ export declare namespace Invariant {
599
599
  * `Covariant<A>` is assignable to `Covariant<B>` when `A extends B`, following
600
600
  * the subtype direction.
601
601
  *
602
- * **Example** (Covariant phantom type)
602
+ * **Example** (Defining a covariant phantom type)
603
603
  *
604
604
  * ```ts
605
605
  * import type { Types } from "effect"
@@ -665,7 +665,7 @@ export declare namespace Covariant {
665
665
  * `Contravariant<A>` is assignable to `Contravariant<B>` when `B extends A`,
666
666
  * following the supertype direction.
667
667
  *
668
- * **Example** (Contravariant phantom type)
668
+ * **Example** (Defining a contravariant phantom type)
669
669
  *
670
670
  * ```ts
671
671
  * import type { Types } from "effect"
@@ -21,6 +21,7 @@ import { args, causeAnnotate, causeEmpty, causeFromReasons, CauseImpl, constEmpt
21
21
  import * as doNotation from "./doNotation.js";
22
22
  import * as InternalMetric from "./metric.js";
23
23
  import { CurrentConcurrency, CurrentErrorReporters, CurrentLogAnnotations, CurrentLogLevel, CurrentLogSpans, CurrentStackFrame, MinimumLogLevel, TracerEnabled, TracerSpanAnnotations, TracerSpanLinks, TracerTimingEnabled } from "./references.js";
24
+ import { getStackTraceLimit, setStackTraceLimit } from "./stackTraceLimit.js";
24
25
  import { addSpanStackTrace, makeStackCleaner } from "./tracer.js";
25
26
  import { version } from "./version.js";
26
27
  // ----------------------------------------------------------------------------
@@ -177,8 +178,8 @@ export const causePrettyErrors = self => {
177
178
  const errors = [];
178
179
  const interrupts = [];
179
180
  if (self.reasons.length === 0) return errors;
180
- const prevStackLimit = Error.stackTraceLimit;
181
- Error.stackTraceLimit = 1;
181
+ const prevStackLimit = getStackTraceLimit();
182
+ setStackTraceLimit(1);
182
183
  for (const failure of self.reasons) {
183
184
  if (failure._tag === "Interrupt") {
184
185
  interrupts.push(failure);
@@ -197,8 +198,7 @@ export const causePrettyErrors = self => {
197
198
  error.stack = `${error.name}: ${error.message}`;
198
199
  errors.push(causePrettyError(error, interrupts[0].annotations));
199
200
  }
200
- ;
201
- Error.stackTraceLimit = prevStackLimit;
201
+ setStackTraceLimit(prevStackLimit);
202
202
  return errors;
203
203
  };
204
204
  /** @internal */
@@ -667,6 +667,8 @@ export const succeedSome = a => succeed(Option.some(a));
667
667
  /** @internal */
668
668
  export const succeedNone = /*#__PURE__*/succeed(/*#__PURE__*/Option.none());
669
669
  /** @internal */
670
+ export const transposeOption = self => Option.isNone(self) ? succeedNone : map(self.value, Option.some);
671
+ /** @internal */
670
672
  export const failCauseSync = evaluate => suspend(() => failCause(internalCall(evaluate)));
671
673
  /** @internal */
672
674
  export const die = defect => exitDie(defect);
@@ -677,13 +679,17 @@ const void_ = /*#__PURE__*/succeed(void 0);
677
679
  /** @internal */
678
680
  export { void_ as void };
679
681
  /** @internal */
680
- const try_ = options => suspend(() => {
681
- try {
682
- return succeed(internalCall(options.try));
683
- } catch (err) {
684
- return fail(internalCall(() => options.catch(err)));
685
- }
686
- });
682
+ const try_ = options => {
683
+ const evaluate = typeof options === "function" ? options : options.try;
684
+ const catcher = typeof options === "function" ? cause => new UnknownError(cause, "An error occurred in Effect.try") : options.catch;
685
+ return suspend(() => {
686
+ try {
687
+ return succeed(internalCall(evaluate));
688
+ } catch (err) {
689
+ return fail(internalCall(() => catcher(err)));
690
+ }
691
+ });
692
+ };
687
693
  /** @internal */
688
694
  export { try_ as try };
689
695
  /** @internal */
@@ -695,12 +701,19 @@ export const tryPromise = options => {
695
701
  const f = typeof options === "function" ? options : options.try;
696
702
  const catcher = typeof options === "function" ? cause => new UnknownError(cause, "An error occurred in Effect.tryPromise") : options.catch;
697
703
  return callbackOptions(function (resume, signal) {
704
+ const failWithCatch = cause => {
705
+ try {
706
+ resume(fail(internalCall(() => catcher(cause))));
707
+ } catch (err) {
708
+ resume(die(err));
709
+ }
710
+ };
698
711
  try {
699
- internalCall(() => f(signal)).then(a => resume(succeed(a)), e => resume(fail(internalCall(() => catcher(e)))));
712
+ internalCall(() => f(signal)).then(a => resume(succeed(a)), failWithCatch);
700
713
  } catch (err) {
701
- resume(fail(internalCall(() => catcher(err))));
714
+ failWithCatch(err);
702
715
  }
703
- }, eval.length !== 0);
716
+ }, f.length !== 0);
704
717
  };
705
718
  /** @internal */
706
719
  export const withFiberId = f => withFiber(fiber => f(fiber.id));
@@ -782,10 +795,10 @@ export const fn = function () {
782
795
  const nameFirst = typeof arguments[0] === "string";
783
796
  const name = nameFirst ? arguments[0] : "Effect.fn";
784
797
  const spanOptions = nameFirst ? arguments[1] : undefined;
785
- const prevLimit = globalThis.Error.stackTraceLimit;
786
- globalThis.Error.stackTraceLimit = 2;
798
+ const prevLimit = getStackTraceLimit();
799
+ setStackTraceLimit(2);
787
800
  const defError = new globalThis.Error();
788
- globalThis.Error.stackTraceLimit = prevLimit;
801
+ setStackTraceLimit(prevLimit);
789
802
  if (nameFirst) {
790
803
  return (body, ...pipeables) => makeFn(name, body, defError, pipeables, nameFirst, spanOptions);
791
804
  }
@@ -804,10 +817,10 @@ const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions)
804
817
  if (!isEffect(result)) {
805
818
  return result;
806
819
  }
807
- const prevLimit = globalThis.Error.stackTraceLimit;
808
- globalThis.Error.stackTraceLimit = 2;
820
+ const prevLimit = getStackTraceLimit();
821
+ setStackTraceLimit(2);
809
822
  const callError = new globalThis.Error();
810
- globalThis.Error.stackTraceLimit = prevLimit;
823
+ setStackTraceLimit(prevLimit);
811
824
  return updateService(addSpan ? useSpan(name, spanOptions, span => provideParentSpan(result, span)) : result, CurrentStackFrame, prev => ({
812
825
  name,
813
826
  stack: fnStackCleaner(() => callError.stack),