@foldkit/devtools-mcp 0.21.0 → 0.22.0

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 (2) hide show
  1. package/dist/server.js +447 -344
  2. package/package.json +4 -4
package/dist/server.js CHANGED
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  }) : target, mod));
28
28
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
29
29
  //#endregion
30
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Pipeable.js
30
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Pipeable.js
31
31
  /**
32
32
  * The `Pipeable` module defines the shared interface and implementation helpers
33
33
  * for values that support Effect-style method chaining with `.pipe(...)`.
@@ -129,7 +129,7 @@ const Class$1 = /*#__PURE__*/ function() {
129
129
  return PipeableBase;
130
130
  }();
131
131
  //#endregion
132
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Function.js
132
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Function.js
133
133
  /**
134
134
  * Creates a function that can be called in data-first style or data-last
135
135
  * (`pipe`-friendly) style.
@@ -415,7 +415,7 @@ function memoizeIdempotent(f) {
415
415
  };
416
416
  }
417
417
  //#endregion
418
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/equal.js
418
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/equal.js
419
419
  /** @internal */
420
420
  const getAllObjectKeys = (obj) => {
421
421
  const keys = new Set(Reflect.ownKeys(obj));
@@ -434,7 +434,7 @@ const getAllObjectKeys = (obj) => {
434
434
  /** @internal */
435
435
  const byReferenceInstances = /*#__PURE__*/ new WeakSet();
436
436
  //#endregion
437
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Predicate.js
437
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Predicate.js
438
438
  /**
439
439
  * Defines runtime checks for values.
440
440
  *
@@ -813,7 +813,7 @@ function isObjectKeyword(input) {
813
813
  */
814
814
  const hasProperty = /*#__PURE__*/ dual(2, (self, property) => isObjectKeyword(self) && property in self);
815
815
  //#endregion
816
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Hash.js
816
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Hash.js
817
817
  /**
818
818
  * Computes Effect hash values and defines the interface for objects that want
819
819
  * to provide their own hash implementation. Hashes are small numeric
@@ -1222,7 +1222,7 @@ function withVisitedTracking$1(obj, fn) {
1222
1222
  return result;
1223
1223
  }
1224
1224
  //#endregion
1225
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Equal.js
1225
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Equal.js
1226
1226
  /**
1227
1227
  * Defines the unique string identifier for the `Equal` interface.
1228
1228
  *
@@ -1448,7 +1448,7 @@ const compareSets = /*#__PURE__*/ makeCompareSet(compareBoth);
1448
1448
  */
1449
1449
  const isEqual = (u) => hasProperty(u, symbol);
1450
1450
  //#endregion
1451
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Equivalence.js
1451
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Equivalence.js
1452
1452
  /**
1453
1453
  * Creates a custom equivalence relation with an optimized reference equality check.
1454
1454
  *
@@ -1497,16 +1497,16 @@ const isEqual = (u) => hasProperty(u, symbol);
1497
1497
  * @category constructors
1498
1498
  * @since 2.0.0
1499
1499
  */
1500
- const make$14 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
1500
+ const make$13 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
1501
1501
  //#endregion
1502
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/array.js
1502
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/array.js
1503
1503
  /**
1504
1504
  * @since 2.0.0
1505
1505
  */
1506
1506
  /** @internal */
1507
1507
  const isArrayNonEmpty$1 = (self) => self.length > 0;
1508
1508
  //#endregion
1509
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/record.js
1509
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/record.js
1510
1510
  /** @internal */
1511
1511
  function assignProperty(self, key, value) {
1512
1512
  if (key === "__proto__") Object.defineProperty(self, key, {
@@ -1522,7 +1522,7 @@ function assignProperties(self, source) {
1522
1522
  for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProperty(self, key, source[key]);
1523
1523
  }
1524
1524
  //#endregion
1525
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Redactable.js
1525
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Redactable.js
1526
1526
  /**
1527
1527
  * Defines the symbol used to identify objects that implement the {@link Redactable}
1528
1528
  * protocol.
@@ -1641,7 +1641,7 @@ const emptyContext$1 = {
1641
1641
  }
1642
1642
  };
1643
1643
  //#endregion
1644
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Formatter.js
1644
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Formatter.js
1645
1645
  /**
1646
1646
  * Formats JavaScript values into readable strings.
1647
1647
  *
@@ -1816,7 +1816,7 @@ function safeGet(input, key) {
1816
1816
  }
1817
1817
  }
1818
1818
  //#endregion
1819
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Inspectable.js
1819
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Inspectable.js
1820
1820
  /**
1821
1821
  * Controls how values appear in logs and debugging output.
1822
1822
  *
@@ -1941,7 +1941,7 @@ const BaseProto = {
1941
1941
  }
1942
1942
  };
1943
1943
  //#endregion
1944
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/stackTraceLimit.js
1944
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/stackTraceLimit.js
1945
1945
  /**
1946
1946
  * Check if `Error.stackTraceLimit` is writable.
1947
1947
  * Returns `false` if the property is frozen, non-writable, or `Error` is non-extensible.
@@ -1973,7 +1973,7 @@ const setStackTraceLimit = (value) => {
1973
1973
  if (canWriteStackTraceLimit) Error.stackTraceLimit = value;
1974
1974
  };
1975
1975
  //#endregion
1976
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Utils.js
1976
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Utils.js
1977
1977
  /**
1978
1978
  * Yields its wrapped value exactly once through an `IterableIterator`.
1979
1979
  *
@@ -2060,7 +2060,7 @@ const pickInternalCall = () => {
2060
2060
  /** @internal */
2061
2061
  const internalCall = /*#__PURE__*/ pickInternalCall();
2062
2062
  //#endregion
2063
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/core.js
2063
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/core.js
2064
2064
  /** @internal */
2065
2065
  const EffectTypeId = `~effect/Effect`;
2066
2066
  /** @internal */
@@ -2421,7 +2421,7 @@ const done$2 = (value) => {
2421
2421
  return exitFail(Done(value));
2422
2422
  };
2423
2423
  //#endregion
2424
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/option.js
2424
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/option.js
2425
2425
  /**
2426
2426
  * @since 2.0.0
2427
2427
  */
@@ -2492,7 +2492,7 @@ SomeImpl.prototype = SomeProto;
2492
2492
  /** @internal */
2493
2493
  const some$1 = (value) => new SomeImpl(value);
2494
2494
  //#endregion
2495
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/result.js
2495
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/result.js
2496
2496
  const TypeId$15 = "~effect/Result";
2497
2497
  const CommonProto = {
2498
2498
  [TypeId$15]: {
@@ -2566,7 +2566,7 @@ SuccessImpl.prototype = SuccessProto;
2566
2566
  /** @internal */
2567
2567
  const succeed$6 = (success) => new SuccessImpl(success);
2568
2568
  //#endregion
2569
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Order.js
2569
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Order.js
2570
2570
  /**
2571
2571
  * Defines comparison functions for ordered values.
2572
2572
  *
@@ -2614,7 +2614,7 @@ const succeed$6 = (success) => new SuccessImpl(success);
2614
2614
  * @category constructors
2615
2615
  * @since 2.0.0
2616
2616
  */
2617
- function make$13(compare) {
2617
+ function make$12(compare) {
2618
2618
  return (self, that) => self === that ? 0 : compare(self, that);
2619
2619
  }
2620
2620
  /**
@@ -2648,7 +2648,7 @@ function make$13(compare) {
2648
2648
  * @category instances
2649
2649
  * @since 4.0.0
2650
2650
  */
2651
- const Number$4 = /*#__PURE__*/ make$13((self, that) => {
2651
+ const Number$4 = /*#__PURE__*/ make$12((self, that) => {
2652
2652
  if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
2653
2653
  if (globalThis.Number.isNaN(self)) return -1;
2654
2654
  if (globalThis.Number.isNaN(that)) return 1;
@@ -2807,7 +2807,7 @@ const isGreaterThanOrEqualTo$1 = (O) => dual(2, (self, that) => O(self, that) !=
2807
2807
  */
2808
2808
  const min$1 = (O) => dual(2, (self, that) => self === that || O(self, that) < 1 ? self : that);
2809
2809
  //#endregion
2810
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Option.js
2810
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Option.js
2811
2811
  /**
2812
2812
  * Creates an `Option` representing the absence of a value.
2813
2813
  *
@@ -3101,36 +3101,6 @@ const fromNullOr = (a) => a === null ? none() : some(a);
3101
3101
  */
3102
3102
  const getOrNull = /*#__PURE__*/ getOrElse(constNull);
3103
3103
  /**
3104
- * Transforms the value inside a `Some` using the provided function, leaving
3105
- * `None` unchanged.
3106
- *
3107
- * **When to use**
3108
- *
3109
- * Use to apply a pure transformation to an `Option`'s present value, especially
3110
- * when chaining transformations in a pipeline.
3111
- *
3112
- * **Details**
3113
- *
3114
- * - `Some` → applies `f` and wraps the result in a new `Some`
3115
- * - `None` → returns `None` unchanged
3116
- *
3117
- * **Example** (Mapping over an Option)
3118
- *
3119
- * ```ts import.meta.vitest
3120
- * import { Option } from "effect"
3121
- *
3122
- * Option.map(Option.some(2), (n) => n * 2) // => Option.some(4)
3123
- * Option.map(Option.none(), (n: number) => n * 2) // => Option.none()
3124
- * ```
3125
- *
3126
- * @see {@link flatMap} when `f` returns an `Option`
3127
- * @see {@link as} to replace the value with a constant
3128
- *
3129
- * @category mapping
3130
- * @since 2.0.0
3131
- */
3132
- const map$4 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
3133
- /**
3134
3104
  * Filters an `Option` using a predicate. Returns `None` if the predicate is
3135
3105
  * not satisfied or the input is `None`.
3136
3106
  *
@@ -3167,7 +3137,7 @@ const map$4 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(
3167
3137
  */
3168
3138
  const filter$1 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some(self.value) : none());
3169
3139
  //#endregion
3170
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Result.js
3140
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Result.js
3171
3141
  /**
3172
3142
  * Creates a `Result` holding a `Success` value.
3173
3143
  *
@@ -3308,7 +3278,7 @@ const isFailure = isFailure$1;
3308
3278
  */
3309
3279
  const isSuccess$1 = isSuccess$2;
3310
3280
  //#endregion
3311
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Array.js
3281
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Array.js
3312
3282
  /**
3313
3283
  * Exposes the global array constructor.
3314
3284
  *
@@ -3560,7 +3530,7 @@ const filter = /*#__PURE__*/ dual(2, (self, predicate) => {
3560
3530
  return out;
3561
3531
  });
3562
3532
  //#endregion
3563
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/BigDecimal.js
3533
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/BigDecimal.js
3564
3534
  /**
3565
3535
  * Decimal numbers and arithmetic for cases where JavaScript `number` rounding
3566
3536
  * is not precise enough. A `BigDecimal` stores digits as a `bigint` plus a
@@ -3651,7 +3621,7 @@ const isBigDecimal = (u) => hasProperty(u, TypeId$14);
3651
3621
  * @category constructors
3652
3622
  * @since 2.0.0
3653
3623
  */
3654
- const make$12 = (value, scale) => {
3624
+ const make$11 = (value, scale) => {
3655
3625
  if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
3656
3626
  const o = Object.create(BigDecimalProto);
3657
3627
  o.value = value;
@@ -3665,7 +3635,7 @@ const make$12 = (value, scale) => {
3665
3635
  */
3666
3636
  const makeNormalizedUnsafe = (value, scale) => {
3667
3637
  if (value !== bigint0$1 && value % bigint10$1 === bigint0$1) throw new RangeError("Value must be normalized");
3668
- const o = make$12(value, scale);
3638
+ const o = make$11(value, scale);
3669
3639
  o.normalized = o;
3670
3640
  return o;
3671
3641
  };
@@ -3783,7 +3753,7 @@ const sign = (n) => n.value === bigint0$1 ? 0 : n.value < bigint0$1 ? -1 : 1;
3783
3753
  * @category math
3784
3754
  * @since 2.0.0
3785
3755
  */
3786
- const abs$1 = (n) => n.value < bigint0$1 ? make$12(-n.value, n.scale) : n;
3756
+ const abs$1 = (n) => n.value < bigint0$1 ? make$11(-n.value, n.scale) : n;
3787
3757
  /**
3788
3758
  * Provides an `Equivalence` instance for `BigDecimal` that determines equality between BigDecimal values.
3789
3759
  *
@@ -3808,7 +3778,7 @@ const abs$1 = (n) => n.value < bigint0$1 ? make$12(-n.value, n.scale) : n;
3808
3778
  * @category instances
3809
3779
  * @since 2.0.0
3810
3780
  */
3811
- const Equivalence$2 = /*#__PURE__*/ make$14((self, that) => compare(self, that) === 0);
3781
+ const Equivalence$2 = /*#__PURE__*/ make$13((self, that) => compare(self, that) === 0);
3812
3782
  /**
3813
3783
  * Checks whether two `BigDecimal`s are equal.
3814
3784
  *
@@ -3960,7 +3930,7 @@ const isZero$1 = (n) => n.value === bigint0$1;
3960
3930
  */
3961
3931
  const isNegative$1 = (n) => n.value < bigint0$1;
3962
3932
  //#endregion
3963
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Effectable.js
3933
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Effectable.js
3964
3934
  /**
3965
3935
  * Create a low-level `Effect` prototype.
3966
3936
  *
@@ -3985,7 +3955,7 @@ const Prototype = (options) => makePrimitiveProto({
3985
3955
  [evaluate]: options.evaluate
3986
3956
  });
3987
3957
  //#endregion
3988
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Context.js
3958
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Context.js
3989
3959
  /**
3990
3960
  * Runtime type identifier attached to `Context` service keys and used by
3991
3961
  * `isKey` to recognize them.
@@ -4078,7 +4048,7 @@ const ServiceProto = {
4078
4048
  return self;
4079
4049
  },
4080
4050
  context(self) {
4081
- return make$11(this, self);
4051
+ return make$10(this, self);
4082
4052
  },
4083
4053
  use(f) {
4084
4054
  return withFiber((fiber) => f(get$3(fiber.context, this)));
@@ -4278,7 +4248,7 @@ const emptyContext = /*#__PURE__*/ makeUnsafe$4(/*#__PURE__*/ new Map());
4278
4248
  * @category constructors
4279
4249
  * @since 2.0.0
4280
4250
  */
4281
- const make$11 = (key, service) => makeUnsafe$4(/* @__PURE__ */ new Map([[key.key, service]]));
4251
+ const make$10 = (key, service) => makeUnsafe$4(/* @__PURE__ */ new Map([[key.key, service]]));
4282
4252
  /**
4283
4253
  * Adds a service to a given `Context`.
4284
4254
  *
@@ -4480,7 +4450,7 @@ const merge$1 = /*#__PURE__*/ dual(2, (self, that) => {
4480
4450
  */
4481
4451
  const Reference = Service;
4482
4452
  //#endregion
4483
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Duration.js
4453
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Duration.js
4484
4454
  const TypeId$12 = "~effect/Duration";
4485
4455
  const bigint0 = /*#__PURE__*/ BigInt(0);
4486
4456
  const bigint1 = /*#__PURE__*/ BigInt(1);
@@ -4562,11 +4532,11 @@ const fromInputUnsafe = (input) => {
4562
4532
  if (input === null) break;
4563
4533
  if (TypeId$12 in input) return input;
4564
4534
  if (Array.isArray(input)) {
4565
- if (input.length !== 2 || !input.every(isNumber)) return invalid(input);
4535
+ if (input.length !== 2 || !input.every(isNumber)) return invalid$1(input);
4566
4536
  if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero;
4567
4537
  if (input[0] === -Infinity || input[1] === -Infinity) return negativeInfinity;
4568
4538
  if (input[0] === Infinity || input[1] === Infinity) return infinity;
4569
- return make$10(roundTiesAwayFromZero(input[0] * 1e9 + input[1]));
4539
+ return make$9(roundTiesAwayFromZero(input[0] * 1e9 + input[1]));
4570
4540
  }
4571
4541
  const obj = input;
4572
4542
  let millis = 0;
@@ -4576,13 +4546,13 @@ const fromInputUnsafe = (input) => {
4576
4546
  if (obj.minutes) millis += obj.minutes * 6e4;
4577
4547
  if (obj.seconds) millis += obj.seconds * 1e3;
4578
4548
  if (obj.milliseconds) millis += obj.milliseconds;
4579
- if (!obj.microseconds && !obj.nanoseconds) return make$10(millis);
4580
- return make$10(roundTiesAwayFromZero(millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0)));
4549
+ if (!obj.microseconds && !obj.nanoseconds) return make$9(millis);
4550
+ return make$9(roundTiesAwayFromZero(millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0)));
4581
4551
  }
4582
4552
  }
4583
- return invalid(input);
4553
+ return invalid$1(input);
4584
4554
  };
4585
- const invalid = (input) => {
4555
+ const invalid$1 = (input) => {
4586
4556
  throw new Error(`Invalid Input: ${input}`);
4587
4557
  };
4588
4558
  const zeroDurationValue = {
@@ -4643,7 +4613,7 @@ const DurationProto = {
4643
4613
  return pipeArguments(this, arguments);
4644
4614
  }
4645
4615
  };
4646
- const make$10 = (input) => {
4616
+ const make$9 = (input) => {
4647
4617
  const duration = Object.create(DurationProto);
4648
4618
  if (typeof input === "number") {
4649
4619
  if (isNaN(input) || input === 0 || Object.is(input, -0)) duration.value = zeroDurationValue;
@@ -4745,8 +4715,8 @@ const abs = (self) => {
4745
4715
  switch (self.value._tag) {
4746
4716
  case "Infinity":
4747
4717
  case "NegativeInfinity": return infinity;
4748
- case "Millis": return self.value.millis < 0 ? make$10(-self.value.millis) : self;
4749
- case "Nanos": return self.value.nanos < bigint0 ? make$10(-self.value.nanos) : self;
4718
+ case "Millis": return self.value.millis < 0 ? make$9(-self.value.millis) : self;
4719
+ case "Nanos": return self.value.nanos < bigint0 ? make$9(-self.value.nanos) : self;
4750
4720
  }
4751
4721
  };
4752
4722
  /**
@@ -4763,7 +4733,7 @@ const abs = (self) => {
4763
4733
  * @category constructors
4764
4734
  * @since 2.0.0
4765
4735
  */
4766
- const zero = /*#__PURE__*/ make$10(0);
4736
+ const zero = /*#__PURE__*/ make$9(0);
4767
4737
  /**
4768
4738
  * A Duration representing infinite time.
4769
4739
  *
@@ -4778,7 +4748,7 @@ const zero = /*#__PURE__*/ make$10(0);
4778
4748
  * @category constructors
4779
4749
  * @since 2.0.0
4780
4750
  */
4781
- const infinity = /*#__PURE__*/ make$10(Infinity);
4751
+ const infinity = /*#__PURE__*/ make$9(Infinity);
4782
4752
  /**
4783
4753
  * A Duration representing negative infinite time.
4784
4754
  *
@@ -4793,7 +4763,7 @@ const infinity = /*#__PURE__*/ make$10(Infinity);
4793
4763
  * @category constructors
4794
4764
  * @since 4.0.0
4795
4765
  */
4796
- const negativeInfinity = /*#__PURE__*/ make$10(-Infinity);
4766
+ const negativeInfinity = /*#__PURE__*/ make$9(-Infinity);
4797
4767
  /**
4798
4768
  * Creates a Duration from nanoseconds.
4799
4769
  *
@@ -4808,7 +4778,7 @@ const negativeInfinity = /*#__PURE__*/ make$10(-Infinity);
4808
4778
  * @category constructors
4809
4779
  * @since 2.0.0
4810
4780
  */
4811
- const nanos = (nanos) => make$10(nanos);
4781
+ const nanos = (nanos) => make$9(nanos);
4812
4782
  /**
4813
4783
  * Creates a Duration from milliseconds.
4814
4784
  *
@@ -4823,7 +4793,7 @@ const nanos = (nanos) => make$10(nanos);
4823
4793
  * @category constructors
4824
4794
  * @since 2.0.0
4825
4795
  */
4826
- const millis = (millis) => make$10(millis);
4796
+ const millis = (millis) => make$9(millis);
4827
4797
  /**
4828
4798
  * Creates a Duration from seconds.
4829
4799
  *
@@ -4838,7 +4808,7 @@ const millis = (millis) => make$10(millis);
4838
4808
  * @category constructors
4839
4809
  * @since 2.0.0
4840
4810
  */
4841
- const seconds = (seconds) => make$10(seconds * 1e3);
4811
+ const seconds = (seconds) => make$9(seconds * 1e3);
4842
4812
  /**
4843
4813
  * Creates a Duration from minutes.
4844
4814
  *
@@ -4853,7 +4823,7 @@ const seconds = (seconds) => make$10(seconds * 1e3);
4853
4823
  * @category constructors
4854
4824
  * @since 2.0.0
4855
4825
  */
4856
- const minutes = (minutes) => make$10(minutes * 6e4);
4826
+ const minutes = (minutes) => make$9(minutes * 6e4);
4857
4827
  /**
4858
4828
  * Creates a Duration from hours.
4859
4829
  *
@@ -4868,7 +4838,7 @@ const minutes = (minutes) => make$10(minutes * 6e4);
4868
4838
  * @category constructors
4869
4839
  * @since 2.0.0
4870
4840
  */
4871
- const hours = (hours) => make$10(hours * 36e5);
4841
+ const hours = (hours) => make$9(hours * 36e5);
4872
4842
  /**
4873
4843
  * Creates a Duration from days.
4874
4844
  *
@@ -4883,7 +4853,7 @@ const hours = (hours) => make$10(hours * 36e5);
4883
4853
  * @category constructors
4884
4854
  * @since 2.0.0
4885
4855
  */
4886
- const days = (days) => make$10(days * 864e5);
4856
+ const days = (days) => make$9(days * 864e5);
4887
4857
  /**
4888
4858
  * Creates a Duration from weeks.
4889
4859
  *
@@ -4898,7 +4868,7 @@ const days = (days) => make$10(days * 864e5);
4898
4868
  * @category constructors
4899
4869
  * @since 2.0.0
4900
4870
  */
4901
- const weeks = (weeks) => make$10(weeks * 6048e5);
4871
+ const weeks = (weeks) => make$9(weeks * 6048e5);
4902
4872
  /**
4903
4873
  * Converts a Duration to milliseconds.
4904
4874
  *
@@ -5038,7 +5008,7 @@ const matchPair = /*#__PURE__*/ dual(3, (self, that, options) => {
5038
5008
  * @category instances
5039
5009
  * @since 2.0.0
5040
5010
  */
5041
- const Order = /*#__PURE__*/ make$13((self, that) => matchPair(self, that, {
5011
+ const Order = /*#__PURE__*/ make$12((self, that) => matchPair(self, that, {
5042
5012
  onMillis: (self, that) => self < that ? -1 : self > that ? 1 : 0,
5043
5013
  onNanos: (self, that) => self < that ? -1 : self > that ? 1 : 0,
5044
5014
  onInfinity: (self, that) => {
@@ -5195,7 +5165,7 @@ const format = (self) => {
5195
5165
  return pieces.join(" ");
5196
5166
  };
5197
5167
  //#endregion
5198
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Scheduler.js
5168
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Scheduler.js
5199
5169
  /**
5200
5170
  * Controls how runnable Effect fiber tasks are dispatched.
5201
5171
  *
@@ -5465,7 +5435,7 @@ const PreventSchedulerYield = /*#__PURE__*/ Reference("effect/Scheduler/PreventS
5465
5435
  const TaggedError = TaggedError$1;
5466
5436
  TaggedError("EncodingError");
5467
5437
  //#endregion
5468
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Tracer.js
5438
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Tracer.js
5469
5439
  /**
5470
5440
  * Defines the low-level tracing model used by Effect.
5471
5441
  *
@@ -5512,11 +5482,11 @@ Service()(ParentSpanKey, { fiberCached: true });
5512
5482
  */
5513
5483
  const TracerKey = "effect/Tracer";
5514
5484
  //#endregion
5515
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/metric.js
5485
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/metric.js
5516
5486
  /** @internal */
5517
5487
  const FiberRuntimeMetricsKey = "effect/Metric/FiberRuntimeMetrics";
5518
5488
  //#endregion
5519
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/references.js
5489
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/references.js
5520
5490
  /** @internal */
5521
5491
  const CurrentStackFrame = /*#__PURE__*/ Reference("effect/References/CurrentStackFrame", {
5522
5492
  fiberCached: true,
@@ -5538,7 +5508,7 @@ const MinimumLogLevel = /*#__PURE__*/ Reference("effect/References/MinimumLogLev
5538
5508
  defaultValue: () => "Info"
5539
5509
  });
5540
5510
  //#endregion
5541
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/effect.js
5511
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/effect.js
5542
5512
  /** @internal */
5543
5513
  var Interrupt = class extends ReasonBase {
5544
5514
  constructor(fiberId, annotations = constEmptyAnnotations) {
@@ -5689,7 +5659,7 @@ var FiberImpl = class {
5689
5659
  interruptUnsafe(fiberId, annotations) {
5690
5660
  if (this._exit) return;
5691
5661
  let cause = causeInterrupt(fiberId);
5692
- if (this.cache.stackFrame) cause = causeAnnotate(cause, make$11(StackTraceKey, this.cache.stackFrame));
5662
+ if (this.cache.stackFrame) cause = causeAnnotate(cause, make$10(StackTraceKey, this.cache.stackFrame));
5693
5663
  if (annotations) cause = causeAnnotate(cause, annotations);
5694
5664
  this._interruptedCause = this._interruptedCause ? causeCombine(this._interruptedCause, cause) : cause;
5695
5665
  if (this.interruptible) {
@@ -6656,7 +6626,7 @@ const colors = {
6656
6626
  };
6657
6627
  colors.gray, colors.blue, colors.green, colors.yellow, colors.red, colors.bgBrightRed, colors.black;
6658
6628
  //#endregion
6659
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Cause.js
6629
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Cause.js
6660
6630
  /**
6661
6631
  * Records the full reason an `Effect` failed.
6662
6632
  *
@@ -6829,7 +6799,7 @@ const done$1 = done$2;
6829
6799
  Service()("effect/Cause/StackTrace");
6830
6800
  Service()("effect/Cause/InterruptorStackTrace");
6831
6801
  //#endregion
6832
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Exit.js
6802
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Exit.js
6833
6803
  /**
6834
6804
  * Creates a successful Exit containing the given value.
6835
6805
  *
@@ -7032,7 +7002,7 @@ const makeUnsafe$3 = () => new DeferredImpl();
7032
7002
  * @category constructors
7033
7003
  * @since 2.0.0
7034
7004
  */
7035
- const make$9 = () => sync$1(() => makeUnsafe$3());
7005
+ const make$8 = () => sync$1(() => makeUnsafe$3());
7036
7006
  const _await = (self) => callback$1((resume) => {
7037
7007
  if (self.effect) return resume(self.effect);
7038
7008
  self.resumes ??= [];
@@ -7150,7 +7120,7 @@ const doneUnsafe = (self, effect) => {
7150
7120
  return true;
7151
7121
  };
7152
7122
  //#endregion
7153
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/dateTime.js
7123
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/dateTime.js
7154
7124
  /** @internal */
7155
7125
  const TypeId$10 = "~effect/DateTime";
7156
7126
  /** @internal */
@@ -7180,7 +7150,7 @@ const ProtoTimeZone = {
7180
7150
  /** @internal */
7181
7151
  const toDateUtc$1 = (self) => new Date(self.epochMilliseconds);
7182
7152
  //#endregion
7183
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Pull.js
7153
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Pull.js
7184
7154
  /**
7185
7155
  * Models one low-level pull step for stream-like consumers.
7186
7156
  *
@@ -7308,7 +7278,7 @@ const matchEffect = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect(se
7308
7278
  }
7309
7279
  }));
7310
7280
  //#endregion
7311
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Schedule.js
7281
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Schedule.js
7312
7282
  const TypeId$9 = "~effect/Schedule";
7313
7283
  /**
7314
7284
  * Context reference containing metadata for the currently running schedule step.
@@ -7673,7 +7643,7 @@ const while_ = /*#__PURE__*/ dual(2, (self, predicate) => fromStep(map$1(toStep(
7673
7643
  */
7674
7644
  const forever = /*#__PURE__*/ spaced(zero);
7675
7645
  //#endregion
7676
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schedule.js
7646
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schedule.js
7677
7647
  /** @internal */
7678
7648
  const retryOrElse = /*#__PURE__*/ dual(3, (self, policy, orElse) => flatMap$1(toStepWithMetadata(policy), (step) => {
7679
7649
  let meta = CurrentMetadata.defaultValue();
@@ -7708,7 +7678,7 @@ const buildFromOptions = (options) => {
7708
7678
  return schedule;
7709
7679
  };
7710
7680
  //#endregion
7711
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Effect.js
7681
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Effect.js
7712
7682
  /**
7713
7683
  * Creates an `Effect` from an asynchronous computation that may throw or
7714
7684
  * reject, mapping failures into the error channel.
@@ -8315,7 +8285,7 @@ const orDie = orDie$1;
8315
8285
  * output // => ["expected error: NetworkError", Exit.fail("NetworkError")]
8316
8286
  * ```
8317
8287
  *
8318
- * @category sequencing
8288
+ * @category error handling
8319
8289
  * @since 2.0.0
8320
8290
  */
8321
8291
  const tapError = tapError$1;
@@ -8814,14 +8784,14 @@ const flatMapEager = flatMapEager$1;
8814
8784
  */
8815
8785
  const fnUntracedEager = fnUntracedEager$1;
8816
8786
  //#endregion
8817
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/annotations.js
8787
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/annotations.js
8818
8788
  /** @internal */
8819
- function resolve(ast) {
8789
+ function resolve$1(ast) {
8820
8790
  return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
8821
8791
  }
8822
8792
  /** @internal */
8823
8793
  function resolveAt(key) {
8824
- return (ast) => resolve(ast)?.[key];
8794
+ return (ast) => resolve$1(ast)?.[key];
8825
8795
  }
8826
8796
  /** @internal */
8827
8797
  const STRUCTURAL_ANNOTATION_KEY = "~structural";
@@ -8850,7 +8820,7 @@ const resolveIdentifier = /*#__PURE__*/ resolveAt("identifier");
8850
8820
  const resolveIdentifierFallback = /*#__PURE__*/ resolveAt(IDENTIFIER_FALLBACK_KEY);
8851
8821
  /** @internal */
8852
8822
  const getExpected = /*#__PURE__*/ memoize((ast) => {
8853
- const identifier = resolve(ast)?.identifier;
8823
+ const identifier = resolve$1(ast)?.identifier;
8854
8824
  if (typeof identifier === "string") return identifier;
8855
8825
  return ast.getExpected(getExpected);
8856
8826
  });
@@ -8872,7 +8842,7 @@ const annotationExcludedKeys = /*#__PURE__*/ new Set([
8872
8842
  "toCodecArbitrary"
8873
8843
  ]);
8874
8844
  //#endregion
8875
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/parser.js
8845
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/parser.js
8876
8846
  /** @internal */
8877
8847
  const missing = /*#__PURE__*/ Symbol();
8878
8848
  /** @internal */
@@ -8886,7 +8856,7 @@ const toOption = (value) => value === missing ? none() : some(value);
8886
8856
  /** @internal */
8887
8857
  const fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(option.value);
8888
8858
  //#endregion
8889
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaIssue.js
8859
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/SchemaIssue.js
8890
8860
  /**
8891
8861
  * Describes problems found while decoding, encoding, or checking data with
8892
8862
  * schemas.
@@ -9371,7 +9341,7 @@ function findMessage(issue) {
9371
9341
  if (typeof message === "string") return message;
9372
9342
  }
9373
9343
  //#endregion
9374
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/cause.js
9344
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/cause.js
9375
9345
  /** @internal */
9376
9346
  function getSchemaIssue(cause) {
9377
9347
  let issue;
@@ -9389,72 +9359,13 @@ function getSchemaIssueOrThrow(cause, message) {
9389
9359
  }
9390
9360
  Service()("effect/DateTime/CurrentTimeZone");
9391
9361
  //#endregion
9392
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaGetter.js
9393
- /**
9394
- * Constructs a composable schema getter.
9395
- *
9396
- * @category constructors
9397
- * @since 4.0.0
9398
- */
9399
- const Getter = class extends Class$1 {
9400
- run;
9401
- constructor(run) {
9402
- super();
9403
- this.run = run;
9404
- }
9405
- map(f) {
9406
- return new Getter((oe, options) => this.run(oe, options).pipe(mapEager(map$4(f))));
9407
- }
9408
- compose(other) {
9409
- if (isPassthrough(this)) return other;
9410
- if (isPassthrough(other)) return this;
9411
- return new Getter((oe, options) => this.run(oe, options).pipe(flatMapEager((ot) => other.run(ot, options))));
9412
- }
9413
- };
9414
- const passthrough_$1 = /*#__PURE__*/ new Getter(succeed$1);
9415
- function isPassthrough(getter) {
9416
- return getter.run === passthrough_$1.run;
9417
- }
9362
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/SchemaGetter.js
9363
+ const makeGetter = (fields) => Object.assign(Object.create(Prototype$1), fields);
9364
+ const passthrough_$1 = /*#__PURE__*/ makeGetter({ _tag: "Passthrough" });
9418
9365
  function passthrough$1() {
9419
9366
  return passthrough_$1;
9420
9367
  }
9421
9368
  /**
9422
- * Creates a getter that handles present values (`Option.Some`), passing `None` through.
9423
- *
9424
- * **When to use**
9425
- *
9426
- * Use when you need a schema getter to transform or validate only when a field
9427
- * value is present.
9428
- * - Missing keys should remain absent in the output.
9429
- *
9430
- * **Details**
9431
- *
9432
- * - When input is `None`, returns `None` (no-op).
9433
- * - When input is `Some(e)`, calls `f(e, options)` to produce the result.
9434
- * - `f` may return `None` to omit the value, or fail with an `Issue`.
9435
- *
9436
- * **Example** (Transforming only present values)
9437
- *
9438
- * ```ts import.meta.vitest
9439
- * import { Effect, Option, SchemaGetter } from "effect"
9440
- *
9441
- * const parseIfPresent = SchemaGetter.onSome<number, string>(
9442
- * (s) => Effect.succeed(Option.some(Number(s)))
9443
- * )
9444
- * await Effect.runPromise(parseIfPresent.run(Option.some("42"), {})) // => Option.some(42)
9445
- * ```
9446
- *
9447
- * @see {@link onNone} to handle only absent values
9448
- * @see {@link transform} for a simpler pure transformation of present values
9449
- * @see {@link transformEffect} for effectful transformation of present values
9450
- *
9451
- * @category transforming
9452
- * @since 4.0.0
9453
- */
9454
- function onSome(f) {
9455
- return new Getter((oe, options) => isNone(oe) ? succeedNone : f(oe.value, options));
9456
- }
9457
- /**
9458
9369
  * Creates a getter that applies a pure function to present values.
9459
9370
  *
9460
9371
  * **When to use**
@@ -9492,7 +9403,52 @@ function onSome(f) {
9492
9403
  * @since 4.0.0
9493
9404
  */
9494
9405
  function transform$2(f) {
9495
- return transformOptional(map$4(f));
9406
+ return makeGetter({
9407
+ _tag: "Transform",
9408
+ transform: f
9409
+ });
9410
+ }
9411
+ /**
9412
+ * Creates a getter that applies an effectful transformation to present values.
9413
+ *
9414
+ * **When to use**
9415
+ *
9416
+ * Use when you need a schema getter for a transformation that may fail, require
9417
+ * Effect services, or run asynchronously.
9418
+ *
9419
+ * **Details**
9420
+ *
9421
+ * - Skips `None` inputs — only called when a value is present.
9422
+ * - On success, wraps the result in `Some`.
9423
+ * - On failure, propagates the `Issue`.
9424
+ *
9425
+ * **Example** (Parsing with failure)
9426
+ *
9427
+ * ```ts import.meta.vitest
9428
+ * import { Effect, Option, SchemaGetter, SchemaIssue } from "effect"
9429
+ *
9430
+ * const safeParseInt = SchemaGetter.transformEffect<number, string>(
9431
+ * (s, options) => {
9432
+ * const n = parseInt(s, 10)
9433
+ * return isNaN(n)
9434
+ * ? Effect.fail(new SchemaIssue.InvalidValue({ message: "not an integer" }, s, options))
9435
+ * : Effect.succeed(n)
9436
+ * }
9437
+ * )
9438
+ * await Effect.runPromise(SchemaGetter.run(safeParseInt, Option.some("42"), {})) // => Option.some(42)
9439
+ * ```
9440
+ *
9441
+ * @see {@link transform} when transformation cannot fail
9442
+ * @see {@link transformOptionalEffect} when you need full `Option` control over the output
9443
+ *
9444
+ * @category transforming
9445
+ * @since 4.0.0
9446
+ */
9447
+ function transformEffect$1(f) {
9448
+ return makeGetter({
9449
+ _tag: "TransformEffect",
9450
+ transform: f
9451
+ });
9496
9452
  }
9497
9453
  /**
9498
9454
  * Creates a getter that transforms the full `Option` — both present and absent values.
@@ -9515,7 +9471,7 @@ function transform$2(f) {
9515
9471
  * const skipEmpty = SchemaGetter.transformOptional<string, string>((o) =>
9516
9472
  * Option.filter(o, (s) => s.length > 0)
9517
9473
  * )
9518
- * await Effect.runPromise(skipEmpty.run(Option.some(""), {})) // => Option.none()
9474
+ * Effect.runSync(SchemaGetter.run(skipEmpty, Option.some(""), {})) // => Option.none()
9519
9475
  * ```
9520
9476
  *
9521
9477
  * @see {@link transform} when you only need to transform present values
@@ -9525,7 +9481,22 @@ function transform$2(f) {
9525
9481
  * @since 4.0.0
9526
9482
  */
9527
9483
  function transformOptional(f) {
9528
- return new Getter((oe) => succeed$1(f(oe)));
9484
+ return makeGetter({
9485
+ _tag: "TransformOptional",
9486
+ transform: f
9487
+ });
9488
+ }
9489
+ /**
9490
+ * Creates a getter that effectfully transforms the full `Option`.
9491
+ *
9492
+ * @category transforming
9493
+ * @since 4.0.0
9494
+ */
9495
+ function transformOptionalEffect(f) {
9496
+ return makeGetter({
9497
+ _tag: "TransformOptionalEffect",
9498
+ transform: f
9499
+ });
9529
9500
  }
9530
9501
  /**
9531
9502
  * Creates a getter that always returns `None`, effectively omitting the value from output.
@@ -9546,7 +9517,7 @@ function transformOptional(f) {
9546
9517
  * import { Effect, Option, SchemaGetter } from "effect"
9547
9518
  *
9548
9519
  * const omitField = SchemaGetter.omit<string>()
9549
- * await Effect.runPromise(omitField.run(Option.some("hidden"), {})) // => Option.none()
9520
+ * Effect.runSync(SchemaGetter.run(omitField, Option.some("hidden"), {})) // => Option.none()
9550
9521
  * ```
9551
9522
  *
9552
9523
  * @see {@link transformOptional} when you want conditional omission
@@ -9556,7 +9527,7 @@ function transformOptional(f) {
9556
9527
  * @since 4.0.0
9557
9528
  */
9558
9529
  function omit$1() {
9559
- return new Getter(() => succeedNone);
9530
+ return transformOptional(() => none());
9560
9531
  }
9561
9532
  /**
9562
9533
  * Creates a getter that replaces `undefined` values with a default.
@@ -9578,17 +9549,17 @@ function omit$1() {
9578
9549
  * import { Effect, Option, SchemaGetter } from "effect"
9579
9550
  *
9580
9551
  * const withZero = SchemaGetter.withDefault(Effect.succeed(0))
9581
- * await Effect.runPromise(withZero.run(Option.some(undefined), {})) // => Option.some(0)
9552
+ * await Effect.runPromise(SchemaGetter.run(withZero, Option.some(undefined), {})) // => Option.some(0)
9582
9553
  * ```
9583
9554
  *
9584
- * @see {@link onNone} to handle only absent keys (not `undefined` values)
9555
+ * @see {@link transformOptionalEffect} for custom effectful missing-key handling
9585
9556
  * @see {@link required} when absent input should fail instead of using a default
9586
9557
  *
9587
9558
  * @category transforming
9588
9559
  * @since 4.0.0
9589
9560
  */
9590
- function withDefault(defaultValue) {
9591
- return new Getter((o) => {
9561
+ function withDefault$1(defaultValue) {
9562
+ return transformOptionalEffect((o) => {
9592
9563
  const filtered = filter$1(o, isNotUndefined);
9593
9564
  return isSome(filtered) ? succeed$1(filtered) : mapEager(defaultValue, some);
9594
9565
  });
@@ -9611,7 +9582,7 @@ function withDefault(defaultValue) {
9611
9582
  * import { Effect, Option, SchemaGetter } from "effect"
9612
9583
  *
9613
9584
  * const toString = SchemaGetter.String<number>()
9614
- * await Effect.runPromise(toString.run(Option.some(42), {})) // => Option.some("42")
9585
+ * Effect.runSync(SchemaGetter.run(toString, Option.some(42), {})) // => Option.some("42")
9615
9586
  * ```
9616
9587
  *
9617
9588
  * @see {@link transform} for custom string conversions
@@ -9641,7 +9612,7 @@ function String$3() {
9641
9612
  * import { Effect, Option, SchemaGetter } from "effect"
9642
9613
  *
9643
9614
  * const toNumber = SchemaGetter.Number<string>()
9644
- * await Effect.runPromise(toNumber.run(Option.some("42"), {})) // => Option.some(42)
9615
+ * Effect.runSync(SchemaGetter.run(toNumber, Option.some("42"), {})) // => Option.some(42)
9645
9616
  * ```
9646
9617
  *
9647
9618
  * @see {@link transformEffect} for effectful or validated number parsing
@@ -9653,8 +9624,8 @@ function Number$3() {
9653
9624
  return transform$2(globalThis.Number);
9654
9625
  }
9655
9626
  function parseJson(options) {
9656
- return onSome((input, parseOptions) => try_({
9657
- try: () => some(JSON.parse(input, options?.reviver)),
9627
+ return transformEffect$1((input, parseOptions) => try_({
9628
+ try: () => JSON.parse(input, options?.reviver),
9658
9629
  catch: () => new InvalidValue({ expected: "a valid JSON string" }, input, parseOptions)
9659
9630
  }));
9660
9631
  }
@@ -9680,7 +9651,8 @@ function parseJson(options) {
9680
9651
  * import { Effect, Option, SchemaGetter } from "effect"
9681
9652
  *
9682
9653
  * const stringify = SchemaGetter.stringifyJson()
9683
- * await Effect.runPromise(stringify.run(Option.some({ a: 1 }), {})) // => Option.some("{\"a\":1}")
9654
+ * const result = await Effect.runPromise(SchemaGetter.run(stringify, Option.some({ a: 1 }), {}))
9655
+ * result // => Option.some("{\"a\":1}")
9684
9656
  * ```
9685
9657
  *
9686
9658
  * @see {@link parseJson} for the inverse operation
@@ -9689,17 +9661,36 @@ function parseJson(options) {
9689
9661
  * @since 4.0.0
9690
9662
  */
9691
9663
  function stringifyJson(options) {
9692
- return onSome((input, parseOptions) => try_({
9664
+ return transformEffect$1((input, parseOptions) => try_({
9693
9665
  try: () => {
9694
9666
  const output = JSON.stringify(input, options?.replacer, options?.space);
9695
9667
  if (output === void 0) throw new TypeError("Value cannot be represented as JSON");
9696
- return some(output);
9668
+ return output;
9697
9669
  },
9698
9670
  catch: () => new InvalidValue({ expected: "a JSON-serializable value" }, input, parseOptions)
9699
9671
  }));
9700
9672
  }
9701
9673
  //#endregion
9702
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaTransformation.js
9674
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/SchemaTransformation.js
9675
+ /**
9676
+ * Constructs schema middleware from its decode and encode functions.
9677
+ *
9678
+ * @category constructors
9679
+ * @since 4.0.0
9680
+ */
9681
+ const Middleware = class extends Class$1 {
9682
+ _tag = "Middleware";
9683
+ decode;
9684
+ encode;
9685
+ constructor(decode, encode) {
9686
+ super();
9687
+ this.decode = decode;
9688
+ this.encode = encode;
9689
+ }
9690
+ flip() {
9691
+ return new Middleware(this.encode, this.decode);
9692
+ }
9693
+ };
9703
9694
  const TypeId$7 = "~effect/SchemaTransformation/Transformation";
9704
9695
  /**
9705
9696
  * Constructs a bidirectional schema transformation from its decode and encode getters.
@@ -9707,21 +9698,19 @@ const TypeId$7 = "~effect/SchemaTransformation/Transformation";
9707
9698
  * @category constructors
9708
9699
  * @since 4.0.0
9709
9700
  */
9710
- const Transformation = class {
9701
+ const Transformation = class extends Class$1 {
9711
9702
  [TypeId$7] = TypeId$7;
9712
9703
  _tag = "Transformation";
9713
9704
  decode;
9714
9705
  encode;
9715
9706
  constructor(decode, encode) {
9707
+ super();
9716
9708
  this.decode = decode;
9717
9709
  this.encode = encode;
9718
9710
  }
9719
9711
  flip() {
9720
9712
  return new Transformation(this.encode, this.decode);
9721
9713
  }
9722
- compose(other) {
9723
- return new Transformation(this.decode.compose(other.decode), other.encode.compose(this.encode));
9724
- }
9725
9714
  };
9726
9715
  /**
9727
9716
  * Returns `true` if `u` is a `Transformation` instance.
@@ -9746,7 +9735,7 @@ const Transformation = class {
9746
9735
  * ```
9747
9736
  *
9748
9737
  * @see {@link Transformation}
9749
- * @see {@link make}
9738
+ * @see {@link makeTransformation}
9750
9739
  *
9751
9740
  * @category guards
9752
9741
  * @since 4.0.0
@@ -9773,7 +9762,7 @@ function isTransformation(u) {
9773
9762
  * ```ts import.meta.vitest
9774
9763
  * import { SchemaGetter, SchemaTransformation } from "effect"
9775
9764
  *
9776
- * const t = SchemaTransformation.make({
9765
+ * const t = SchemaTransformation.makeTransformation({
9777
9766
  * decode: SchemaGetter.transform<number, string>((s) => Number(s)),
9778
9767
  * encode: SchemaGetter.transform<string, number>((n) => String(n))
9779
9768
  * })
@@ -9787,7 +9776,7 @@ function isTransformation(u) {
9787
9776
  * @category constructors
9788
9777
  * @since 3.10.0
9789
9778
  */
9790
- const make$6 = (options) => {
9779
+ const makeTransformation = (options) => {
9791
9780
  if (isTransformation(options)) return options;
9792
9781
  return new Transformation(options.decode, options.encode);
9793
9782
  };
@@ -9949,7 +9938,7 @@ function fromJsonString$1(options) {
9949
9938
  return new Transformation(parseJson(options ?? {}), stringifyJson(options));
9950
9939
  }
9951
9940
  //#endregion
9952
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaAST.js
9941
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/SchemaAST.js
9953
9942
  /**
9954
9943
  * Represents Effect schemas as runtime trees.
9955
9944
  *
@@ -10415,7 +10404,7 @@ const Arrays = class extends ASTNodeImpl {
10415
10404
  for (let i = 1; i < rest.length; i++) if (isOptional(rest[i])) throw new Error("An optional element cannot follow a rest element. ts(1266)");
10416
10405
  }
10417
10406
  /** @internal */
10418
- getParser(compile, compileConstructorDefault = compile) {
10407
+ getParser(compile, compileField = compile) {
10419
10408
  const ast = this;
10420
10409
  let elements;
10421
10410
  let rest;
@@ -10432,11 +10421,11 @@ const Arrays = class extends ASTNodeImpl {
10432
10421
  if (!elements) {
10433
10422
  elements = ast.elements.map((ast) => ({
10434
10423
  ast,
10435
- parser: compileConstructorDefault(ast)
10424
+ parser: compileField(ast)
10436
10425
  }));
10437
10426
  rest = ast.rest.map((ast) => ({
10438
10427
  ast,
10439
- parser: compileConstructorDefault(ast)
10428
+ parser: compileField(ast)
10440
10429
  }));
10441
10430
  }
10442
10431
  const len = input.length;
@@ -10487,26 +10476,29 @@ const Arrays = class extends ASTNodeImpl {
10487
10476
  return "array";
10488
10477
  }
10489
10478
  };
10479
+ /** @internal */
10480
+ function stepArray(s, item, exit, i) {
10481
+ if (exit._tag === "Failure") return wrapPropertyKeyIssue(s, s.ast, i, exit);
10482
+ const value = exit === sameExit ? item : exit[args];
10483
+ if (value !== missing) s.output[i] = value;
10484
+ else {
10485
+ const p = s.getParser(s.tailThreshold, i);
10486
+ if (isOptional(p.ast)) return;
10487
+ const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
10488
+ if (s.options.errors === "all") {
10489
+ if (s.issues) s.issues.push(issue);
10490
+ else s.issues = [issue];
10491
+ } else return fail$2(new Composite(s.ast, [issue], s.input, s.options));
10492
+ }
10493
+ }
10490
10494
  const parseArrayOptions = {
10491
10495
  onItem(s, item, i) {
10492
10496
  const value = i < s.len ? item : missing;
10493
10497
  return s.getParser(s.tailThreshold, i).parser(value, s.options);
10494
10498
  },
10495
- step(s, item, exit, i) {
10496
- if (exit._tag === "Failure") return wrapPropertyKeyIssue(s, s.ast, i, exit);
10497
- const value = exit === sameExit ? item : exit[args];
10498
- if (value !== missing) s.output[i] = value;
10499
- else {
10500
- const p = s.getParser(s.tailThreshold, i);
10501
- if (isOptional(p.ast)) return;
10502
- const issue = new Pointer([i], new MissingKey(p.ast.context?.annotations));
10503
- if (s.options.errors === "all") {
10504
- if (s.issues) s.issues.push(issue);
10505
- else s.issues = [issue];
10506
- } else return fail$2(new Composite(s.ast, [issue], s.input, s.options));
10507
- }
10508
- }
10499
+ step: stepArray
10509
10500
  };
10501
+ /** @internal */
10510
10502
  const parseArray = /*#__PURE__*/ iterateEager()(parseArrayOptions);
10511
10503
  const parseArrayConcurrent = /*#__PURE__*/ iterateConcurrent()(parseArrayOptions);
10512
10504
  const wrapPropertyKeyIssue = (s, ast, key, exit) => {
@@ -10623,7 +10615,7 @@ const Objects = class extends ASTNodeImpl {
10623
10615
  if (duplicates.length > 0) throw new Error(`Duplicate identifiers: ${JSON.stringify(duplicates)}. ts(2300)`);
10624
10616
  }
10625
10617
  /** @internal */
10626
- getParser(compile, compileConstructorDefault = compile) {
10618
+ getParser(compile, compileField = compile) {
10627
10619
  const ast = this;
10628
10620
  const expectedKeys = [];
10629
10621
  for (const ps of ast.propertySignatures) expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
@@ -10666,14 +10658,14 @@ const Objects = class extends ASTNodeImpl {
10666
10658
  const compileMembers = () => {
10667
10659
  if (!properties) {
10668
10660
  properties = ast.propertySignatures.map((ps) => ({
10669
- parser: compileConstructorDefault(ps.type),
10661
+ parser: compileField(ps.type),
10670
10662
  name: ps.name,
10671
10663
  type: ps.type
10672
10664
  }));
10673
10665
  indexes = indexCount ? ast.indexSignatures.map((is) => ({
10674
10666
  is,
10675
10667
  parserKey: compile(parameterFromPropertyKey(is.parameter)),
10676
- parserValue: compileConstructorDefault(is.type)
10668
+ parserValue: compileField(is.type)
10677
10669
  })) : void 0;
10678
10670
  }
10679
10671
  return properties;
@@ -10812,6 +10804,7 @@ const Objects = class extends ASTNodeImpl {
10812
10804
  return "object";
10813
10805
  }
10814
10806
  };
10807
+ /** @internal */
10815
10808
  function stepProperty(s, p, exit) {
10816
10809
  if (exit._tag === "Failure") return wrapPropertyKeyIssue(s, s.ast, p.name, exit);
10817
10810
  if (exit === sameExit) return;
@@ -10839,6 +10832,7 @@ const parsePropertiesOptions = {
10839
10832
  },
10840
10833
  step: stepProperty
10841
10834
  };
10835
+ /** @internal */
10842
10836
  const parseProperties = /*#__PURE__*/ iterateEager()(parsePropertiesOptions);
10843
10837
  const parsePropertiesConcurrent = /*#__PURE__*/ iterateConcurrent()(parsePropertiesOptions);
10844
10838
  function combineChecks(a, b) {
@@ -11090,11 +11084,11 @@ const Union$1 = class extends ASTNodeImpl {
11090
11084
  this.encodingChecks = encodingChecks;
11091
11085
  }
11092
11086
  /** @internal */
11093
- getParser(compile, compileConstructorDefault) {
11087
+ getParser(compile, compileField) {
11094
11088
  const ast = this;
11095
11089
  return (input, options) => {
11096
11090
  if (input === missing) return missingExit;
11097
- const candidates = getCandidates(input, ast.types, compileConstructorDefault !== void 0);
11091
+ const candidates = getCandidates(input, ast.types, compileField !== void 0);
11098
11092
  if (candidates.length === 0) return fail$1(new AnyOf(ast, [], input, options));
11099
11093
  if (candidates.length === 1) {
11100
11094
  const result = compile(candidates[0])(input, options);
@@ -11461,9 +11455,7 @@ const optionalKeyLastLink = /*#__PURE__*/ applyToLastLink(optionalKey);
11461
11455
  const optional$2 = /*#__PURE__*/ memoize((ast) => optionalKey(new Union$1([ast, undefined_])));
11462
11456
  /** @internal */
11463
11457
  function withConstructorDefault$1(ast, defaultValue) {
11464
- const transformation = new Transformation(withDefault(defaultValue), passthrough$1());
11465
- const constructorDefault = new Link(unknown$1, transformation);
11466
- return replaceContext(ast, ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) : new Context(false, false, constructorDefault));
11458
+ return replaceContext(ast, ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, defaultValue, ast.context.annotations) : new Context(false, false, defaultValue));
11467
11459
  }
11468
11460
  /**
11469
11461
  * Attaches a `Transformation` to the `to` AST, making it decode from the
@@ -11668,6 +11660,7 @@ function fromRefinement(ast, refinement) {
11668
11660
  return fail$1(new InvalidType(ast, input, options));
11669
11661
  };
11670
11662
  }
11663
+ /** @internal */
11671
11664
  const parameterFromPropertyKey = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
11672
11665
  switch (ast._tag) {
11673
11666
  default: return ast;
@@ -11819,7 +11812,7 @@ const unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declarati
11819
11812
  toCodecStringTree: () => void 0
11820
11813
  }), /*#__PURE__*/ passthrough());
11821
11814
  //#endregion
11822
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Fiber.js
11815
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Fiber.js
11823
11816
  /**
11824
11817
  * Interrupts a fiber, causing it to stop executing and clean up any
11825
11818
  * acquired resources.
@@ -11861,7 +11854,7 @@ const unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declarati
11861
11854
  */
11862
11855
  const interrupt = fiberInterrupt;
11863
11856
  //#endregion
11864
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/MutableRef.js
11857
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/MutableRef.js
11865
11858
  const TypeId$5 = "~effect/MutableRef";
11866
11859
  const MutableRefProto = {
11867
11860
  [TypeId$5]: TypeId$5,
@@ -11965,7 +11958,7 @@ const set$3 = /*#__PURE__*/ dual(2, (self, value) => {
11965
11958
  return self;
11966
11959
  });
11967
11960
  //#endregion
11968
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/hashMap.js
11961
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/hashMap.js
11969
11962
  /**
11970
11963
  * @since 2.0.0
11971
11964
  */
@@ -12508,7 +12501,7 @@ const remove$1 = /*#__PURE__*/ dual(2, (self, key) => {
12508
12501
  return removeHash(self, key, hash(key));
12509
12502
  });
12510
12503
  //#endregion
12511
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/HashMap.js
12504
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/HashMap.js
12512
12505
  /**
12513
12506
  * Stores key/value entries in an immutable hash map.
12514
12507
  *
@@ -12613,7 +12606,173 @@ const set$1 = set$2;
12613
12606
  */
12614
12607
  const remove = remove$1;
12615
12608
  //#endregion
12616
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/SchemaParser.js
12609
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/interpreter.js
12610
+ const flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager(result, f);
12611
+ function compileTransformation(transformation) {
12612
+ if (transformation._tag === "Middleware") return (result, current, options) => {
12613
+ const transformed = result === sameExit ? transformation.decode(succeed(toOption(current)), options) : transformation.decode(mapEager(result, toOption), options);
12614
+ return fromOptionalEffect(transformed);
12615
+ };
12616
+ const getter = transformation.decode;
12617
+ switch (getter._tag) {
12618
+ case "Passthrough": return (result, current) => result === sameExit ? succeed(current) : result;
12619
+ case "Transform": {
12620
+ const transform = (value) => value === missing ? missingExit : succeed(getter.transform(value));
12621
+ return (result, current) => flatMapTransformation(result, current, transform);
12622
+ }
12623
+ case "TransformOptional": {
12624
+ const transform = (value) => fromOptionExit(getter.transform(toOption(value)));
12625
+ return (result, current) => flatMapTransformation(result, current, transform);
12626
+ }
12627
+ case "TransformEffect": return (result, current, options) => flatMapTransformation(result, current, (value) => value === missing ? missingExit : getter.transform(value, options));
12628
+ case "TransformOptionalEffect": return (result, current, options) => flatMapTransformation(result, current, (value) => fromOptionalEffect(getter.transform(toOption(value), options)));
12629
+ }
12630
+ }
12631
+ const fromOptionalEffect = (effect) => flatMapEager(effect, fromOptionExit);
12632
+ /** @internal */
12633
+ const wrapEncoding = (ast, input, options, effect) => catchCause(effect, (cause) => failCauseSync(() => map(cause, (issue) => new Encoding(ast, issue, input, options))));
12634
+ function makeConstructorParser(descriptor, compile) {
12635
+ const transform = compileTransformation(descriptor.link.transformation);
12636
+ let sourceParser;
12637
+ return (input, options) => {
12638
+ if (input === missing) return missingExit;
12639
+ if (descriptor.isConstructed(input)) return sameExit;
12640
+ const result = (sourceParser ??= compile(descriptor.link.to))(input, options);
12641
+ return transform(result, input, options);
12642
+ };
12643
+ }
12644
+ function withDefault(ast, parser) {
12645
+ const defaultValue = ast.context.constructorDefault;
12646
+ return (input, options) => {
12647
+ if (input !== missing && input !== void 0) return parser(input, options);
12648
+ const result = defaultValue;
12649
+ if (effectIsExit(result) && result._tag === "Success") {
12650
+ const local = parser(result[args], options);
12651
+ return local === sameExit ? result : local;
12652
+ }
12653
+ return flatMapEager(wrapEncoding(ast, input, options, result), (value) => {
12654
+ const local = parser(value, options);
12655
+ return local === sameExit ? succeed(value) : local;
12656
+ });
12657
+ };
12658
+ }
12659
+ /** @internal */
12660
+ function compileField(ast, compile) {
12661
+ const parser = compile(ast);
12662
+ return ast.context?.constructorDefault === void 0 ? parser : withDefault(ast, parser);
12663
+ }
12664
+ /** @internal */
12665
+ function compile(ast, compile, compileField, base, specialize) {
12666
+ if (ast._tag === "Declaration") for (const parameter of ast.typeParameters) compile(parameter);
12667
+ const descriptor = compileField ? getConstructorDescriptor(ast) : void 0;
12668
+ const parser = descriptor ? makeConstructorParser(descriptor, compile) : base ?? ast.getParser(compile, compileField);
12669
+ const checks = ast.checks;
12670
+ const links = ast.encoding;
12671
+ const transformations = links?.map((link) => compileTransformation(link.transformation));
12672
+ const encodingChecks = ast.encodingChecks;
12673
+ if (!links && !checks && !encodingChecks) return parser;
12674
+ let encodingParsers;
12675
+ const parseChecks = (input, options) => {
12676
+ let result = parser(input, options);
12677
+ if (encodingChecks && !options.disableChecks) {
12678
+ if (effectIsExit(result)) {
12679
+ if (result._tag === "Success") {
12680
+ const output = result === sameExit ? input : result[args];
12681
+ if (input !== missing && output !== missing) {
12682
+ const issues = collectIssues(encodingChecks, input, void 0, ast, options);
12683
+ if (issues) result = fail$1(new Composite(ast, issues, input, options));
12684
+ }
12685
+ }
12686
+ } else result = flatMap(result, (value) => {
12687
+ if (input !== missing && value !== missing) {
12688
+ const issues = collectIssues(encodingChecks, input, void 0, ast, options);
12689
+ if (issues) return fail$1(new Composite(ast, issues, input, options));
12690
+ }
12691
+ return succeed$1(value);
12692
+ });
12693
+ }
12694
+ if (checks && !options.disableChecks) {
12695
+ if (effectIsExit(result)) {
12696
+ if (result._tag === "Success") {
12697
+ const value = result === sameExit ? input : result[args];
12698
+ if (value === missing) return result;
12699
+ const issues = collectIssues(checks, value, void 0, ast, options);
12700
+ if (issues) result = fail$1(new Composite(ast, issues, value, options));
12701
+ }
12702
+ } else result = flatMap(result, (value) => {
12703
+ if (value !== missing) {
12704
+ const issues = collectIssues(checks, value, void 0, ast, options);
12705
+ if (issues) return fail$1(new Composite(ast, issues, value, options));
12706
+ }
12707
+ return succeed$1(value);
12708
+ });
12709
+ }
12710
+ return result;
12711
+ };
12712
+ const parseLocal = specialize === void 0 ? parseChecks : specialize(parseChecks);
12713
+ if (!links) return parseLocal;
12714
+ return (input, options) => {
12715
+ const parsers = encodingParsers ??= links.map((link) => compile(link.to));
12716
+ let current = input;
12717
+ let result = parsers[parsers.length - 1](input, options);
12718
+ for (let i = links.length - 1; i >= 0; i--) {
12719
+ result = transformations[i](result, current, options);
12720
+ if (i !== 0) {
12721
+ const next = parsers[i - 1];
12722
+ if (result._tag === "Success") {
12723
+ current = result[args];
12724
+ result = next(current, options);
12725
+ } else result = flatMapEager(result, (value) => {
12726
+ const nextResult = next(value, options);
12727
+ return nextResult === sameExit ? succeed(value) : nextResult;
12728
+ });
12729
+ }
12730
+ }
12731
+ if (result._tag === "Success") {
12732
+ const value = result[args];
12733
+ const local = parseLocal(value, options);
12734
+ return local === sameExit ? result : local;
12735
+ }
12736
+ result = wrapEncoding(ast, input, options, result);
12737
+ return flatMapEager(result, (value) => {
12738
+ const local = parseLocal(value, options);
12739
+ return local === sameExit ? succeed(value) : local;
12740
+ });
12741
+ };
12742
+ }
12743
+ //#endregion
12744
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/compilerRegistry.js
12745
+ /** @internal */
12746
+ const invalid = /*#__PURE__*/ Symbol();
12747
+ const cache = /*#__PURE__*/ new WeakMap();
12748
+ const decodeChild = (ast) => resolve(ast).parser;
12749
+ const makeChild = (ast) => resolve(ast).makeEffect;
12750
+ const makeField = (ast) => compileField(ast, makeChild);
12751
+ var InterpretedEntry = class {
12752
+ ast;
12753
+ constructor(ast) {
12754
+ this.ast = ast;
12755
+ }
12756
+ get decodeEffect() {
12757
+ return this.cachedDecodeEffect ??= compile(this.ast, decodeChild);
12758
+ }
12759
+ get parser() {
12760
+ return this.decodeEffect;
12761
+ }
12762
+ get makeEffect() {
12763
+ return this.cachedMakeEffect ??= compile(this.ast, makeChild, makeField);
12764
+ }
12765
+ };
12766
+ /** @internal */
12767
+ function resolve(ast) {
12768
+ const cached = cache.get(ast);
12769
+ if (cached !== void 0) return cached;
12770
+ const entry = new InterpretedEntry(ast);
12771
+ cache.set(ast, entry);
12772
+ return entry;
12773
+ }
12774
+ //#endregion
12775
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/SchemaParser.js
12617
12776
  /**
12618
12777
  * Runs schemas against real values.
12619
12778
  *
@@ -12706,13 +12865,7 @@ function makeOption(schema) {
12706
12865
  * @since 4.0.0
12707
12866
  */
12708
12867
  function make$4(schema) {
12709
- const parser = makeEffect(schema);
12710
- return (input, options) => {
12711
- const exit = runSyncExit(parser(input, options));
12712
- if (isSuccess(exit)) return exit.value;
12713
- const issue = getSchemaIssueOrThrow(exit.cause, "Constructor adapter can only throw schema issues");
12714
- throw new Error("Schema validation failed", { cause: issue });
12715
- };
12868
+ return makeConstructorSync(toType$1(schema.ast));
12716
12869
  }
12717
12870
  /**
12718
12871
  * Creates a type guard that checks whether an input satisfies the schema's decoded
@@ -12740,14 +12893,26 @@ function make$4(schema) {
12740
12893
  function is(schema) {
12741
12894
  return _is(schema.ast);
12742
12895
  }
12896
+ function makeIs(ast) {
12897
+ {
12898
+ const parser = asExit(run(ast));
12899
+ return (input) => {
12900
+ const exit = parser(input, defaultParseOptions);
12901
+ if (isSuccess(exit)) return true;
12902
+ getSchemaIssueOrThrow(exit.cause, "Type guard adapter can only return false for schema issues");
12903
+ return false;
12904
+ };
12905
+ }
12906
+ }
12743
12907
  /** @internal */
12744
12908
  function _is(ast) {
12745
- const parser = asExit(run(toType$1(ast)));
12909
+ const typeAST = toType$1(ast);
12910
+ let guard = (input) => {
12911
+ guard = makeIs(typeAST);
12912
+ return guard(input);
12913
+ };
12746
12914
  return (input) => {
12747
- const exit = parser(input, defaultParseOptions);
12748
- if (isSuccess(exit)) return true;
12749
- getSchemaIssueOrThrow(exit.cause, "Type guard adapter can only return false for schema issues");
12750
- return false;
12915
+ return guard(input);
12751
12916
  };
12752
12917
  }
12753
12918
  /**
@@ -12844,6 +13009,11 @@ const getValue = (value) => {
12844
13009
  function run(ast) {
12845
13010
  return runWithCompiler(normalCompiler, ast);
12846
13011
  }
13012
+ function parserResult(result, input) {
13013
+ if (result === sameExit) return succeed$1(input);
13014
+ if (!effectIsExit(result)) return flatMapEager(result, getValue);
13015
+ return result[args] === missing ? getValue(missing) : result;
13016
+ }
12847
13017
  function runWithCompiler(compiler, ast) {
12848
13018
  let parser;
12849
13019
  return (input, options) => {
@@ -12856,106 +13026,39 @@ function runWithCompiler(compiler, ast) {
12856
13026
  function asExit(parser) {
12857
13027
  return (input, options) => runSyncExit(parser(input, options));
12858
13028
  }
12859
- const normalCompiler = /*#__PURE__*/ memoize((ast) => makeParser(ast, normalCompiler));
12860
- const constructorCompiler = /*#__PURE__*/ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault));
12861
- const compileDefaulted = /*#__PURE__*/ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault));
12862
- function compileConstructorDefault(ast) {
12863
- return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast);
12864
- }
12865
- function applyTransformation(result, current, transformation, options) {
12866
- let transformed;
12867
- if (effectIsExit(result) && result._tag === "Success") {
12868
- const optional = toOption(result === sameExit ? current : result[args]);
12869
- transformed = transformation._tag === "Transformation" ? transformation.decode.run(optional, options) : transformation.decode(succeed(optional), options);
12870
- } else if (transformation._tag === "Transformation") transformed = flatMapEager(result, (value) => transformation.decode.run(toOption(value), options));
12871
- else transformed = transformation.decode(mapEager(result, toOption), options);
12872
- return effectIsExit(transformed) && transformed._tag === "Success" ? fromOptionExit(transformed[args]) : flatMapEager(transformed, fromOptionExit);
12873
- }
12874
- function makeConstructorParser(descriptor, compile) {
12875
- let sourceParser;
12876
- return (input, options) => {
12877
- if (input === missing) return missingExit;
12878
- if (descriptor.isConstructed(input)) return sameExit;
12879
- return applyTransformation((sourceParser ??= compile(descriptor.link.to))(input, options), input, descriptor.link.transformation, options);
12880
- };
13029
+ function runSync(effect, message) {
13030
+ const exit = runSyncExit(effect);
13031
+ if (isSuccess(exit)) return exit.value;
13032
+ const issue = getSchemaIssueOrThrow(exit.cause, message);
13033
+ throw new Error("Schema validation failed", { cause: issue });
12881
13034
  }
12882
- function makeParser(ast, compile, compileConstructorDefault, constructorDefault) {
12883
- const descriptor = compileConstructorDefault ? getConstructorDescriptor(ast) : void 0;
12884
- const parser = descriptor ? makeConstructorParser(descriptor, compile) : ast.getParser(compile, compileConstructorDefault);
12885
- const checks = ast.checks;
12886
- const links = constructorDefault ? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault] : ast.encoding;
12887
- const encodingChecks = ast.encodingChecks;
12888
- if (!links && !checks && !encodingChecks) return parser;
12889
- let encodingParsers;
12890
- const parseLocal = (input, options) => {
12891
- let result = parser(input, options);
12892
- if (encodingChecks && !options.disableChecks) {
12893
- if (effectIsExit(result)) {
12894
- if (result._tag === "Success") {
12895
- const output = result === sameExit ? input : result[args];
12896
- if (input !== missing && output !== missing) {
12897
- const issues = collectIssues(encodingChecks, input, void 0, ast, options);
12898
- if (issues) result = fail$1(new Composite(ast, issues, input, options));
12899
- }
12900
- }
12901
- } else result = flatMap(result, (value) => {
12902
- if (input !== missing && value !== missing) {
12903
- const issues = collectIssues(encodingChecks, input, void 0, ast, options);
12904
- if (issues) return fail$1(new Composite(ast, issues, input, options));
12905
- }
12906
- return succeed$1(value);
12907
- });
12908
- }
12909
- if (checks && !options.disableChecks) {
12910
- if (effectIsExit(result)) {
12911
- if (result._tag === "Success") {
12912
- const value = result === sameExit ? input : result[args];
12913
- if (value === missing) return result;
12914
- const issues = collectIssues(checks, value, void 0, ast, options);
12915
- if (issues) result = fail$1(new Composite(ast, issues, value, options));
12916
- }
12917
- } else result = flatMap(result, (value) => {
12918
- if (value !== missing) {
12919
- const issues = collectIssues(checks, value, void 0, ast, options);
12920
- if (issues) return fail$1(new Composite(ast, issues, value, options));
12921
- }
12922
- return succeed$1(value);
12923
- });
12924
- }
12925
- return result;
12926
- };
12927
- if (!links) return parseLocal;
13035
+ function makeConstructorSync(ast) {
13036
+ let entry;
13037
+ let parser;
12928
13038
  return (input, options) => {
12929
- const parsers = encodingParsers ??= links.map((link) => compile(link.to));
12930
- let current = input;
12931
- let result = parsers[parsers.length - 1](input, options);
12932
- for (let i = links.length - 1; i >= 0; i--) {
12933
- result = applyTransformation(result, current, links[i].transformation, options);
12934
- if (i !== 0) {
12935
- const next = parsers[i - 1];
12936
- if (result._tag === "Success") {
12937
- current = result[args];
12938
- result = next(current, options);
12939
- } else result = flatMapEager(result, (value) => {
12940
- const nextResult = next(value, options);
12941
- return nextResult === sameExit ? succeed(value) : nextResult;
12942
- });
13039
+ entry ??= resolve(ast);
13040
+ const parseOptions = options?.disableChecks ? options.parseOptions ? {
13041
+ ...options.parseOptions,
13042
+ disableChecks: true
13043
+ } : { disableChecks: true } : options?.parseOptions ?? defaultParseOptions;
13044
+ const make = entry.make;
13045
+ if (make !== void 0 && input !== missing) {
13046
+ let output;
13047
+ try {
13048
+ output = make(input, parseOptions);
13049
+ } catch (error) {
13050
+ getSchemaIssueOrThrow(die$1(error), "Constructor adapter can only throw schema issues");
13051
+ throw error;
12943
13052
  }
13053
+ if (output !== invalid && output !== missing) return output;
12944
13054
  }
12945
- if (result._tag === "Success") {
12946
- const value = result[args];
12947
- const local = parseLocal(value, options);
12948
- return local === sameExit ? result : local;
12949
- }
12950
- result = catchCause(result, (cause) => failCauseSync(() => map(cause, (issue) => new Encoding(ast, issue, input, options))));
12951
- return flatMapEager(result, (value) => {
12952
- const local = parseLocal(value, options);
12953
- return local === sameExit ? succeed(value) : local;
12954
- });
13055
+ return runSync(parserResult((parser ??= entry.makeEffect)(input, parseOptions), input), "Constructor adapter can only throw schema issues");
12955
13056
  };
12956
13057
  }
13058
+ const normalCompiler = (ast) => resolve(ast).parser;
13059
+ const constructorCompiler = (ast) => resolve(ast).makeEffect;
12957
13060
  //#endregion
12958
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/make.js
13061
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/make.js
12959
13062
  /** @internal */
12960
13063
  const TypeId$4 = "~effect/Schema/Schema";
12961
13064
  const SchemaProto = {
@@ -12987,7 +13090,7 @@ function make$3(ast, options) {
12987
13090
  return self;
12988
13091
  }
12989
13092
  //#endregion
12990
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/JsonPointer.js
13093
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/JsonPointer.js
12991
13094
  /**
12992
13095
  * Helpers for escaping JSON Pointer path segments and converting JSON Pointer
12993
13096
  * URI fragments. JSON Pointer uses `/` to separate path tokens inside a JSON
@@ -13084,7 +13187,7 @@ function decodeUriFragment(fragment) {
13084
13187
  }
13085
13188
  }
13086
13189
  //#endregion
13087
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/JsonSchema.js
13190
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/JsonSchema.js
13088
13191
  /**
13089
13192
  * Helpers for normalizing and converting JSON Schema and OpenAPI schema
13090
13193
  * documents. Supported inputs include JSON Schema Draft-07, Draft 2020-12,
@@ -13172,7 +13275,7 @@ const PRE_2020_TO_2020_COLLISIONS = [
13172
13275
  [...PRE_2020_TO_2020_COLLISIONS];
13173
13276
  [...PRE_2020_TO_2020_COLLISIONS];
13174
13277
  //#endregion
13175
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toCodec.js
13278
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/toCodec.js
13176
13279
  /** @internal */
13177
13280
  const toCodecJsonAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
13178
13281
  const out = toCodecJsonASTStep(ast, toCodecJsonAST);
@@ -13261,14 +13364,14 @@ globalThis.RegExp;
13261
13364
  */
13262
13365
  const escape$1 = (string) => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
13263
13366
  //#endregion
13264
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/errors.js
13367
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/errors.js
13265
13368
  /** @internal */
13266
13369
  function errorWithPath(message, path) {
13267
13370
  if (path.length > 0) message += `\n at ${formatPath(path)}`;
13268
13371
  return new Error(message);
13269
13372
  }
13270
13373
  //#endregion
13271
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
13374
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
13272
13375
  function formatDefinitionReference(key) {
13273
13376
  return `#/$defs/${formatUriFragmentToken(key)}`;
13274
13377
  }
@@ -13776,7 +13879,7 @@ function toJsonSchemaDocument$1(document, options) {
13776
13879
  };
13777
13880
  }
13778
13881
  //#endregion
13779
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schema/toRepresentation.js
13882
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schema/toRepresentation.js
13780
13883
  const defaultReferencePolicy = ({ identifier }) => identifier;
13781
13884
  function annotationsField(annotations) {
13782
13885
  return annotations === void 0 ? void 0 : { annotations };
@@ -14042,7 +14145,7 @@ function toRepresentations(asts, options) {
14042
14145
  }
14043
14146
  }
14044
14147
  //#endregion
14045
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Struct.js
14148
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Struct.js
14046
14149
  /**
14047
14150
  * Wraps a plain function as a {@link Lambda} value so it can be used with
14048
14151
  * {@link map}, {@link mapPick}, and {@link mapOmit}.
@@ -14081,7 +14184,7 @@ function toRepresentations(asts, options) {
14081
14184
  */
14082
14185
  const lambda = (f) => f;
14083
14186
  //#endregion
14084
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/internal/schemaError.js
14187
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/internal/schemaError.js
14085
14188
  const SchemaErrorTypeId = "~effect/Schema/SchemaError";
14086
14189
  function isSchemaError$1(u) {
14087
14190
  return hasProperty(u, "~effect/Schema/SchemaError") && u["~effect/Schema/SchemaError"] === "~effect/Schema/SchemaError";
@@ -14091,7 +14194,7 @@ TaggedError("CookiesError");
14091
14194
  ({ ...BaseProto });
14092
14195
  ({ ...PipeInspectableProto });
14093
14196
  //#endregion
14094
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Schema.js
14197
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Schema.js
14095
14198
  const TypeId$1 = TypeId$4;
14096
14199
  /**
14097
14200
  * Creates a schema for a **parametric** type (a generic container such as
@@ -14695,7 +14798,7 @@ const NullOr = /*#__PURE__*/ lambda((self) => Union([self, Null]));
14695
14798
  const UndefinedOr = /*#__PURE__*/ lambda((self) => Union([self, Undefined]));
14696
14799
  function decodeTo(to, transformation) {
14697
14800
  return (from) => {
14698
- return make$1(decodeTo$1(from.ast, to.ast, transformation ? make$6(transformation) : passthrough()), {
14801
+ return make$1(decodeTo$1(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough()), {
14699
14802
  from,
14700
14803
  to
14701
14804
  });
@@ -14775,7 +14878,7 @@ function withDecodingDefault(defaultValue, options) {
14775
14878
  const encode = options?.encodingStrategy === "omit" ? omit$1() : passthrough$1();
14776
14879
  return (self) => {
14777
14880
  return optional$1(toEncoded(self)).pipe(decodeTo(self, {
14778
- decode: withDefault(toIssueEffect(defaultValue)),
14881
+ decode: withDefault$1(toIssueEffect(defaultValue)),
14779
14882
  encode
14780
14883
  }));
14781
14884
  };
@@ -15006,7 +15109,7 @@ function TaggedUnion(casesByTag) {
15006
15109
  */
15007
15110
  function link() {
15008
15111
  return (encodeTo, transformation) => {
15009
- return new Link(encodeTo.ast, make$6(transformation));
15112
+ return new Link(encodeTo.ast, makeTransformation(transformation));
15010
15113
  };
15011
15114
  }
15012
15115
  /**
@@ -15432,7 +15535,7 @@ function toJsonSchemaDocument(schema, options) {
15432
15535
  return toJsonSchemaDocument$1(toRepresentation(toCodecJsonAST(schema.ast), options), options);
15433
15536
  }
15434
15537
  //#endregion
15435
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Console.js
15538
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Console.js
15436
15539
  /**
15437
15540
  * Context reference for the current console service in the Effect system, allowing access to the active console implementation from within the Effect context.
15438
15541
  *
@@ -15635,7 +15738,7 @@ const exhaustive = (self) => {
15635
15738
  };
15636
15739
  };
15637
15740
  //#endregion
15638
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Match.js
15741
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Match.js
15639
15742
  /**
15640
15743
  * Builds pattern matchers for TypeScript values.
15641
15744
  *
@@ -15846,7 +15949,7 @@ const tagsExhaustive = tagsExhaustive$1;
15846
15949
  */
15847
15950
  const orElse = orElse$1;
15848
15951
  //#endregion
15849
- //#region ../../node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Ref.js
15952
+ //#region ../../node_modules/.pnpm/effect@4.0.0-rc.116/node_modules/effect/dist/Ref.js
15850
15953
  /**
15851
15954
  * Stores fiber-safe mutable state inside Effect programs.
15852
15955
  *
@@ -34828,7 +34931,7 @@ const connectWebSocketClient = (url) => gen(function* () {
34828
34931
  onSome: (candidate) => candidate.readyState === import_websocket.default.OPEN ? succeed$1(candidate) : fail$1(/* @__PURE__ */ new Error("Foldkit dev server connection is reconnecting. Retry the tool call in a moment."))
34829
34932
  });
34830
34933
  const id = generateRequestId();
34831
- const deferred = yield* make$9();
34934
+ const deferred = yield* make$8();
34832
34935
  yield* update(pendingResponsesRef, set$1(id, deferred));
34833
34936
  const frame = {
34834
34937
  id,