@deslop/stash 0.1.1066 → 0.1.1067
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.
- package/README.md +1 -1
- package/dist/cli.js +2 -2
- package/dist/{contracts-CoHsVor4.mjs → contracts-D4AmBpkn.mjs} +2244 -204
- package/dist/server.js +11296 -390
- package/package.json +2 -1
|
@@ -561,7 +561,7 @@ const addBackEdge = () => {
|
|
|
561
561
|
* @category guards
|
|
562
562
|
* @since 2.0.0
|
|
563
563
|
*/
|
|
564
|
-
function isString(input) {
|
|
564
|
+
function isString$1(input) {
|
|
565
565
|
return typeof input === "string";
|
|
566
566
|
}
|
|
567
567
|
/**
|
|
@@ -631,6 +631,38 @@ function isBoolean(input) {
|
|
|
631
631
|
return typeof input === "boolean";
|
|
632
632
|
}
|
|
633
633
|
/**
|
|
634
|
+
* Checks whether a value is a `bigint`.
|
|
635
|
+
*
|
|
636
|
+
* **When to use**
|
|
637
|
+
*
|
|
638
|
+
* Use when you need a `Predicate` guard to narrow an `unknown` value to a
|
|
639
|
+
* bigint.
|
|
640
|
+
*
|
|
641
|
+
* **Details**
|
|
642
|
+
*
|
|
643
|
+
* Uses `typeof input === "bigint"`.
|
|
644
|
+
*
|
|
645
|
+
* **Example** (Guarding bigints)
|
|
646
|
+
*
|
|
647
|
+
* ```ts import.meta.vitest
|
|
648
|
+
* import { Predicate } from "effect"
|
|
649
|
+
*
|
|
650
|
+
* const data: unknown = 1n
|
|
651
|
+
*
|
|
652
|
+
* if (Predicate.isBigInt(data)) {
|
|
653
|
+
* data + 2n // => 3n
|
|
654
|
+
* }
|
|
655
|
+
* ```
|
|
656
|
+
*
|
|
657
|
+
* @see {@link isNumber}
|
|
658
|
+
* @stability stable
|
|
659
|
+
* @category guards
|
|
660
|
+
* @since 2.0.0
|
|
661
|
+
*/
|
|
662
|
+
function isBigInt(input) {
|
|
663
|
+
return typeof input === "bigint";
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
634
666
|
* Checks whether a value is a `symbol`.
|
|
635
667
|
*
|
|
636
668
|
* **When to use**
|
|
@@ -695,7 +727,7 @@ function isSymbol(input) {
|
|
|
695
727
|
* @since 4.0.0
|
|
696
728
|
*/
|
|
697
729
|
function isPropertyKey(u) {
|
|
698
|
-
return isString(u) || isNumber(u) || isSymbol(u);
|
|
730
|
+
return isString$1(u) || isNumber(u) || isSymbol(u);
|
|
699
731
|
}
|
|
700
732
|
/**
|
|
701
733
|
* Checks whether a value is a `function`.
|
|
@@ -1136,7 +1168,7 @@ function isError(input) {
|
|
|
1136
1168
|
* @since 2.0.0
|
|
1137
1169
|
*/
|
|
1138
1170
|
function isIterable(input) {
|
|
1139
|
-
return hasProperty(input, Symbol.iterator) || isString(input);
|
|
1171
|
+
return hasProperty(input, Symbol.iterator) || isString$1(input);
|
|
1140
1172
|
}
|
|
1141
1173
|
//#endregion
|
|
1142
1174
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Hash.js
|
|
@@ -3937,6 +3969,35 @@ const getOrElse$1 = /*#__PURE__*/ dual(2, (self, onNone) => isNone(self) ? onNon
|
|
|
3937
3969
|
*/
|
|
3938
3970
|
const orElse = /*#__PURE__*/ dual(2, (self, that) => isNone(self) ? that() : self);
|
|
3939
3971
|
/**
|
|
3972
|
+
* Returns `Some` of the fallback value if `self` is `None`; otherwise returns
|
|
3973
|
+
* `self`.
|
|
3974
|
+
*
|
|
3975
|
+
* **When to use**
|
|
3976
|
+
*
|
|
3977
|
+
* Use when providing a default plain value (not an `Option`) as fallback
|
|
3978
|
+
*
|
|
3979
|
+
* **Details**
|
|
3980
|
+
*
|
|
3981
|
+
* - `Some` → returns `self` unchanged
|
|
3982
|
+
* - `None` → calls `onNone()`, wraps result in `Some`, and returns it
|
|
3983
|
+
*
|
|
3984
|
+
* **Example** (Providing a fallback value)
|
|
3985
|
+
*
|
|
3986
|
+
* ```ts import.meta.vitest
|
|
3987
|
+
* import { Option } from "effect"
|
|
3988
|
+
*
|
|
3989
|
+
* Option.none().pipe(Option.orElseSome(() => "b")) // => Option.some("b")
|
|
3990
|
+
* Option.some("a").pipe(Option.orElseSome(() => "b")) // => Option.some("a")
|
|
3991
|
+
* ```
|
|
3992
|
+
*
|
|
3993
|
+
* @see {@link orElse} when the fallback is itself an `Option`
|
|
3994
|
+
*
|
|
3995
|
+
* @stability stable
|
|
3996
|
+
* @category error handling
|
|
3997
|
+
* @since 2.0.0
|
|
3998
|
+
*/
|
|
3999
|
+
const orElseSome = /*#__PURE__*/ dual(2, (self, onNone) => isNone(self) ? some$1(onNone()) : self);
|
|
4000
|
+
/**
|
|
3940
4001
|
* Converts a nullable value (`null` or `undefined`) into an `Option`.
|
|
3941
4002
|
*
|
|
3942
4003
|
* **When to use**
|
|
@@ -4270,7 +4331,7 @@ const flatMapNullishOr = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none(
|
|
|
4270
4331
|
* @category sequencing
|
|
4271
4332
|
* @since 2.0.0
|
|
4272
4333
|
*/
|
|
4273
|
-
const flatten$
|
|
4334
|
+
const flatten$5 = /*#__PURE__*/ flatMap$7(identity);
|
|
4274
4335
|
/**
|
|
4275
4336
|
* Combines a structure of `Option`s (tuple, struct, or iterable) into a single
|
|
4276
4337
|
* `Option` containing the unwrapped structure.
|
|
@@ -4393,7 +4454,7 @@ const toArray = (self) => isNone(self) ? [] : [self.value];
|
|
|
4393
4454
|
* @category filtering
|
|
4394
4455
|
* @since 2.0.0
|
|
4395
4456
|
*/
|
|
4396
|
-
const filter$
|
|
4457
|
+
const filter$3 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some$1(self.value) : none());
|
|
4397
4458
|
/**
|
|
4398
4459
|
* Lifts a `Predicate` or `Refinement` into the `Option` context: returns
|
|
4399
4460
|
* `Some(value)` when the predicate holds, `None` otherwise.
|
|
@@ -5162,31 +5223,10 @@ const constEmptyIterator = { next() {
|
|
|
5162
5223
|
* @category constructors
|
|
5163
5224
|
* @since 2.0.0
|
|
5164
5225
|
*/
|
|
5165
|
-
const empty$
|
|
5226
|
+
const empty$10 = () => constEmpty;
|
|
5166
5227
|
//#endregion
|
|
5167
5228
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Record.js
|
|
5168
5229
|
/**
|
|
5169
|
-
* Creates a new, empty record.
|
|
5170
|
-
*
|
|
5171
|
-
* **Example** (Creating an empty record)
|
|
5172
|
-
*
|
|
5173
|
-
* ```ts import.meta.vitest
|
|
5174
|
-
* import { Record } from "effect"
|
|
5175
|
-
*
|
|
5176
|
-
* // Create an empty record
|
|
5177
|
-
* const emptyRecord = Record.empty<string, number>()
|
|
5178
|
-
* emptyRecord // => {}
|
|
5179
|
-
*
|
|
5180
|
-
* // The type ensures type safety for future operations
|
|
5181
|
-
* Record.set(emptyRecord, "count", 42) // => { count: 42 }
|
|
5182
|
-
* ```
|
|
5183
|
-
*
|
|
5184
|
-
* @stability stable
|
|
5185
|
-
* @category constructors
|
|
5186
|
-
* @since 2.0.0
|
|
5187
|
-
*/
|
|
5188
|
-
const empty$10 = () => ({});
|
|
5189
|
-
/**
|
|
5190
5230
|
* Determines if a mutable record is empty.
|
|
5191
5231
|
*
|
|
5192
5232
|
* **Example** (Checking for an empty record)
|
|
@@ -5287,27 +5327,6 @@ const map$7 = /*#__PURE__*/ dual(2, (self, f) => {
|
|
|
5287
5327
|
return out;
|
|
5288
5328
|
});
|
|
5289
5329
|
/**
|
|
5290
|
-
* Selects properties from a record whose values match the given predicate.
|
|
5291
|
-
*
|
|
5292
|
-
* **Example** (Filtering record values)
|
|
5293
|
-
*
|
|
5294
|
-
* ```ts import.meta.vitest
|
|
5295
|
-
* import { Record } from "effect"
|
|
5296
|
-
*
|
|
5297
|
-
* const x = { a: 1, b: 2, c: 3, d: 4 }
|
|
5298
|
-
* Record.filter(x, (n) => n > 2) // => { c: 3, d: 4 }
|
|
5299
|
-
* ```
|
|
5300
|
-
*
|
|
5301
|
-
* @stability stable
|
|
5302
|
-
* @category filtering
|
|
5303
|
-
* @since 2.0.0
|
|
5304
|
-
*/
|
|
5305
|
-
const filter$3 = /*#__PURE__*/ dual(2, (self, predicate) => {
|
|
5306
|
-
const out = empty$10();
|
|
5307
|
-
for (const key of keys$1(self)) if (predicate(self[key], key)) assignProperty$1(out, key, self[key]);
|
|
5308
|
-
return out;
|
|
5309
|
-
});
|
|
5310
|
-
/**
|
|
5311
5330
|
* Retrieves the keys of a given record as an array.
|
|
5312
5331
|
*
|
|
5313
5332
|
* **Example** (Getting record keys)
|
|
@@ -5620,6 +5639,34 @@ const prepend$1 = /*#__PURE__*/ dual(2, (self, head) => [head, ...self]);
|
|
|
5620
5639
|
*/
|
|
5621
5640
|
const append$1 = /*#__PURE__*/ dual(2, (self, last) => [...self, last]);
|
|
5622
5641
|
/**
|
|
5642
|
+
* Concatenates two iterables into a single array.
|
|
5643
|
+
*
|
|
5644
|
+
* **When to use**
|
|
5645
|
+
*
|
|
5646
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
5647
|
+
* elements after the first.
|
|
5648
|
+
*
|
|
5649
|
+
* **Details**
|
|
5650
|
+
*
|
|
5651
|
+
* If either input is non-empty, the result is a `NonEmptyArray`.
|
|
5652
|
+
*
|
|
5653
|
+
* **Example** (Concatenating arrays)
|
|
5654
|
+
*
|
|
5655
|
+
* ```ts import.meta.vitest
|
|
5656
|
+
* import { Array } from "effect"
|
|
5657
|
+
*
|
|
5658
|
+
* Array.appendAll([1, 2], [3, 4]) // => [1, 2, 3, 4]
|
|
5659
|
+
* ```
|
|
5660
|
+
*
|
|
5661
|
+
* @see {@link append} — add a single element to the end
|
|
5662
|
+
* @see {@link prependAll} — add elements to the front
|
|
5663
|
+
*
|
|
5664
|
+
* @stability stable
|
|
5665
|
+
* @category combining
|
|
5666
|
+
* @since 2.0.0
|
|
5667
|
+
*/
|
|
5668
|
+
const appendAll$1 = /*#__PURE__*/ dual(2, (self, that) => fromIterable$6(self).concat(fromIterable$6(that)));
|
|
5669
|
+
/**
|
|
5623
5670
|
* Checks whether a value is an `Array`.
|
|
5624
5671
|
*
|
|
5625
5672
|
* **When to use**
|
|
@@ -5895,7 +5942,7 @@ const headNonEmpty = /*#__PURE__*/ getUnsafe$1(0);
|
|
|
5895
5942
|
* @category getters
|
|
5896
5943
|
* @since 2.0.0
|
|
5897
5944
|
*/
|
|
5898
|
-
const last = (self) => isReadonlyArrayNonEmpty(self) ? some$1(lastNonEmpty(self)) : none();
|
|
5945
|
+
const last$1 = (self) => isReadonlyArrayNonEmpty(self) ? some$1(lastNonEmpty(self)) : none();
|
|
5899
5946
|
/**
|
|
5900
5947
|
* Returns the last element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
5901
5948
|
* wrapper).
|
|
@@ -6828,7 +6875,7 @@ const applyOverlays = (map, overlay) => {
|
|
|
6828
6875
|
applyOverlays(map, overlay.parent);
|
|
6829
6876
|
map.set(overlay.key, overlay.value);
|
|
6830
6877
|
};
|
|
6831
|
-
const flatten$
|
|
6878
|
+
const flatten$4 = (self) => {
|
|
6832
6879
|
if (self._flat) return self._flat;
|
|
6833
6880
|
if (!self.overlay) return self._flat = self.base;
|
|
6834
6881
|
const map = new Map(self.base);
|
|
@@ -6847,7 +6894,7 @@ const lookup = (self, key) => {
|
|
|
6847
6894
|
const value = impl.base.get(key);
|
|
6848
6895
|
if (value === void 0 && !impl.base.has(key)) return notFound;
|
|
6849
6896
|
if (impl.overlay && ++impl.baseHits >= impl.base.size && impl.baseHits >= FlattenAfterBaseHits) {
|
|
6850
|
-
impl.base = flatten$
|
|
6897
|
+
impl.base = flatten$4(impl);
|
|
6851
6898
|
impl.overlay = void 0;
|
|
6852
6899
|
impl.depth = 0;
|
|
6853
6900
|
}
|
|
@@ -6888,7 +6935,7 @@ const lookup = (self, key) => {
|
|
|
6888
6935
|
const makeUnsafe$6 = (mapUnsafe) => makeImpl$1(void 0, mapUnsafe, void 0, 0);
|
|
6889
6936
|
const Proto$9 = {
|
|
6890
6937
|
get mapUnsafe() {
|
|
6891
|
-
return flatten$
|
|
6938
|
+
return flatten$4(this);
|
|
6892
6939
|
},
|
|
6893
6940
|
...PipeInspectableProto,
|
|
6894
6941
|
[TypeId$35]: { _Services: (_) => _ },
|
|
@@ -7299,7 +7346,7 @@ const merge$4 = /*#__PURE__*/ dual(2, (self, that) => {
|
|
|
7299
7346
|
* @category combining
|
|
7300
7347
|
* @since 3.12.0
|
|
7301
7348
|
*/
|
|
7302
|
-
const mergeAll$
|
|
7349
|
+
const mergeAll$3 = (...ctxs) => {
|
|
7303
7350
|
const map = /* @__PURE__ */ new Map();
|
|
7304
7351
|
for (let i = 0; i < ctxs.length; i++) ctxs[i].mapUnsafe.forEach((value, key) => {
|
|
7305
7352
|
map.set(key, value);
|
|
@@ -8400,6 +8447,42 @@ const Class$1 = class extends Class$3 {
|
|
|
8400
8447
|
}
|
|
8401
8448
|
};
|
|
8402
8449
|
/**
|
|
8450
|
+
* Provides a base class for immutable data types with a `_tag` discriminator.
|
|
8451
|
+
*
|
|
8452
|
+
* **When to use**
|
|
8453
|
+
*
|
|
8454
|
+
* Use when you need a single-variant tagged type or an ad-hoc discriminator.
|
|
8455
|
+
*
|
|
8456
|
+
* **Details**
|
|
8457
|
+
*
|
|
8458
|
+
* Like {@link Class}, but the resulting instances also carry a
|
|
8459
|
+
* `readonly _tag: Tag` property. The `_tag` is excluded from the constructor
|
|
8460
|
+
* argument.
|
|
8461
|
+
*
|
|
8462
|
+
* **Example** (Defining a tagged class)
|
|
8463
|
+
*
|
|
8464
|
+
* ```ts import.meta.vitest
|
|
8465
|
+
* import { Data } from "effect"
|
|
8466
|
+
*
|
|
8467
|
+
* class Person extends Data.TaggedClass("Person")<{
|
|
8468
|
+
* readonly name: string
|
|
8469
|
+
* }> {}
|
|
8470
|
+
*
|
|
8471
|
+
* new Person({ name: "Mike" })._tag // => "Person"
|
|
8472
|
+
* ```
|
|
8473
|
+
*
|
|
8474
|
+
* @see {@link Class} — without a `_tag`
|
|
8475
|
+
* @see {@link TaggedError} — tagged error variant
|
|
8476
|
+
* @see {@link TaggedEnum} — multi-variant unions
|
|
8477
|
+
*
|
|
8478
|
+
* @stability stable
|
|
8479
|
+
* @category constructors
|
|
8480
|
+
* @since 2.0.0
|
|
8481
|
+
*/
|
|
8482
|
+
const TaggedClass = (tag) => class extends Class$1 {
|
|
8483
|
+
_tag = tag;
|
|
8484
|
+
};
|
|
8485
|
+
/**
|
|
8403
8486
|
* Creates constructors and matchers for a `TaggedEnum` type.
|
|
8404
8487
|
*
|
|
8405
8488
|
* **When to use**
|
|
@@ -9373,7 +9456,7 @@ var FiberImpl = class {
|
|
|
9373
9456
|
this._interruptedCause = this._interruptedCause ? causeCombine(this._interruptedCause, cause) : cause;
|
|
9374
9457
|
if (this.interruptible) {
|
|
9375
9458
|
if (this._running) this._deferredInterrupt = true;
|
|
9376
|
-
else this.evaluate(failCause$
|
|
9459
|
+
else this.evaluate(failCause$6(this._interruptedCause));
|
|
9377
9460
|
}
|
|
9378
9461
|
}
|
|
9379
9462
|
pollUnsafe() {
|
|
@@ -9424,7 +9507,7 @@ var FiberImpl = class {
|
|
|
9424
9507
|
while (true) try {
|
|
9425
9508
|
if (this._deferredInterrupt) {
|
|
9426
9509
|
this._deferredInterrupt = false;
|
|
9427
|
-
current = failCause$
|
|
9510
|
+
current = failCause$6(this._interruptedCause);
|
|
9428
9511
|
}
|
|
9429
9512
|
this.currentOpCount++;
|
|
9430
9513
|
const cache = this.cache;
|
|
@@ -9522,10 +9605,10 @@ const makeFiberContextCache = (context) => {
|
|
|
9522
9605
|
};
|
|
9523
9606
|
const deferredInterruptCont = {
|
|
9524
9607
|
[contA](_value, fiber) {
|
|
9525
|
-
return failCause$
|
|
9608
|
+
return failCause$6(fiber._interruptedCause);
|
|
9526
9609
|
},
|
|
9527
9610
|
[contE](_cause, fiber) {
|
|
9528
|
-
return failCause$
|
|
9611
|
+
return failCause$6(fiber._interruptedCause);
|
|
9529
9612
|
}
|
|
9530
9613
|
};
|
|
9531
9614
|
const maxInlineSteps = 32;
|
|
@@ -9602,9 +9685,19 @@ const fiberInterruptAll = (fibers) => withFiber$1((parent) => {
|
|
|
9602
9685
|
return asVoid$1(fiberAwaitAll(fiberArr));
|
|
9603
9686
|
});
|
|
9604
9687
|
/** @internal */
|
|
9688
|
+
const fiberInterruptAllAs = /*#__PURE__*/ dual(2, (fibers, fiberId) => withFiber$1((parent) => {
|
|
9689
|
+
const annotations = fiberStackAnnotations(parent);
|
|
9690
|
+
const fiberArr = empty$9();
|
|
9691
|
+
for (const fiber of fibers) {
|
|
9692
|
+
fiber.interruptUnsafe(fiberId, annotations);
|
|
9693
|
+
fiberArr.push(fiber);
|
|
9694
|
+
}
|
|
9695
|
+
return asVoid$1(fiberAwaitAll(fiberArr));
|
|
9696
|
+
}));
|
|
9697
|
+
/** @internal */
|
|
9605
9698
|
const succeed$7 = exitSucceed;
|
|
9606
9699
|
/** @internal */
|
|
9607
|
-
const failCause$
|
|
9700
|
+
const failCause$6 = exitFailCause;
|
|
9608
9701
|
/** @internal */
|
|
9609
9702
|
const fail$6 = exitFail;
|
|
9610
9703
|
/** @internal */
|
|
@@ -9651,9 +9744,9 @@ const succeedNone$1 = /*#__PURE__*/ succeed$7(/*#__PURE__*/ none());
|
|
|
9651
9744
|
/** @internal */
|
|
9652
9745
|
const transposeOption$1 = (self) => isNone(self) ? succeedNone$1 : map$5(self.value, some$1);
|
|
9653
9746
|
/** @internal */
|
|
9654
|
-
const failCauseSync$1 = (evaluate) => suspend$3(() => failCause$
|
|
9747
|
+
const failCauseSync$1 = (evaluate) => suspend$3(() => failCause$6(evaluate()));
|
|
9655
9748
|
/** @internal */
|
|
9656
|
-
const die$
|
|
9749
|
+
const die$5 = (defect) => exitDie(defect);
|
|
9657
9750
|
/** @internal */
|
|
9658
9751
|
const failSync = (error) => suspend$3(() => fail$6(error()));
|
|
9659
9752
|
/** @internal */
|
|
@@ -9672,7 +9765,7 @@ const try_$1 = (options) => {
|
|
|
9672
9765
|
};
|
|
9673
9766
|
/** @internal */
|
|
9674
9767
|
const promise$1 = (evaluate) => callbackOptions(function(resume, signal) {
|
|
9675
|
-
evaluate(signal).then((a) => resume(succeed$7(a)), (e) => resume(die$
|
|
9768
|
+
evaluate(signal).then((a) => resume(succeed$7(a)), (e) => resume(die$5(e)));
|
|
9676
9769
|
}, evaluate.length !== 0);
|
|
9677
9770
|
/** @internal */
|
|
9678
9771
|
const tryPromise$1 = (options) => {
|
|
@@ -9683,7 +9776,7 @@ const tryPromise$1 = (options) => {
|
|
|
9683
9776
|
try {
|
|
9684
9777
|
return fail$6(internalCall(() => catcher(cause)));
|
|
9685
9778
|
} catch (err) {
|
|
9686
|
-
return die$
|
|
9779
|
+
return die$5(err);
|
|
9687
9780
|
}
|
|
9688
9781
|
});
|
|
9689
9782
|
try {
|
|
@@ -9740,7 +9833,7 @@ const asyncFinalizer = /*#__PURE__*/ makePrimitive({
|
|
|
9740
9833
|
}
|
|
9741
9834
|
},
|
|
9742
9835
|
[contE](cause, _fiber) {
|
|
9743
|
-
return hasInterrupts$1(cause) ? flatMap$4(combineFinalizerCause(exitFailCause(cause), this[args]()), () => failCause$
|
|
9836
|
+
return hasInterrupts$1(cause) ? flatMap$4(combineFinalizerCause(exitFailCause(cause), this[args]()), () => failCause$6(cause)) : failCause$6(cause);
|
|
9744
9837
|
}
|
|
9745
9838
|
});
|
|
9746
9839
|
/** @internal */
|
|
@@ -9805,7 +9898,7 @@ const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions)
|
|
|
9805
9898
|
callError = new globalThis.Error();
|
|
9806
9899
|
setStackTraceLimit(prevLimit);
|
|
9807
9900
|
}
|
|
9808
|
-
return updateService(addSpan ? useSpan$1(name, spanOptions, (span) => provideParentSpan(result, span)) : result, CurrentStackFrame, (prev) => ({
|
|
9901
|
+
return updateService$1(addSpan ? useSpan$1(name, spanOptions, (span) => provideParentSpan(result, span)) : result, CurrentStackFrame, (prev) => ({
|
|
9809
9902
|
name,
|
|
9810
9903
|
stack: callError ? fnStackCleaner(() => callError.stack) : constUndefined,
|
|
9811
9904
|
parent: {
|
|
@@ -9847,7 +9940,7 @@ const fromIteratorEagerUnsafe = (evaluate) => {
|
|
|
9847
9940
|
}
|
|
9848
9941
|
}
|
|
9849
9942
|
} catch (error) {
|
|
9850
|
-
return die$
|
|
9943
|
+
return die$5(error);
|
|
9851
9944
|
}
|
|
9852
9945
|
};
|
|
9853
9946
|
const fromIteratorUnsafe = /*#__PURE__*/ function() {
|
|
@@ -9926,7 +10019,7 @@ const asSome$1 = (self) => map$5(self, some$1);
|
|
|
9926
10019
|
/** @internal */
|
|
9927
10020
|
const andThen$1 = /*#__PURE__*/ dual(2, (self, f) => new ContImpl(self, isEffect$1(f) ? returnPayload : andThenCont, f));
|
|
9928
10021
|
/** @internal */
|
|
9929
|
-
const tap$
|
|
10022
|
+
const tap$2 = /*#__PURE__*/ dual(2, (self, f) => new ContImpl(self, isEffect$1(f) ? tapEffectCont : tapCont, f));
|
|
9930
10023
|
/** @internal */
|
|
9931
10024
|
const asVoid$1 = (self) => new ContImpl(self, returnPayload, exitVoid);
|
|
9932
10025
|
/** @internal */
|
|
@@ -9972,6 +10065,8 @@ const flatMapEager$1 = /*#__PURE__*/ dual(2, (self, f) => {
|
|
|
9972
10065
|
return flatMap$4(self, f);
|
|
9973
10066
|
});
|
|
9974
10067
|
/** @internal */
|
|
10068
|
+
const flatten$3 = (self) => flatMap$4(self, identity);
|
|
10069
|
+
/** @internal */
|
|
9975
10070
|
const map$5 = /*#__PURE__*/ dual(2, (self, f) => new ContImpl(self, mapCont, f));
|
|
9976
10071
|
/** @internal */
|
|
9977
10072
|
const mapEager$1 = /*#__PURE__*/ dual(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map$5(self, f));
|
|
@@ -9987,7 +10082,7 @@ const catchEager$1 = /*#__PURE__*/ dual(2, (self, f) => {
|
|
|
9987
10082
|
if (isFailure$1(error)) return self;
|
|
9988
10083
|
return f(error.success);
|
|
9989
10084
|
}
|
|
9990
|
-
return catch_$
|
|
10085
|
+
return catch_$3(self, f);
|
|
9991
10086
|
});
|
|
9992
10087
|
/** @internal */
|
|
9993
10088
|
const exitInterrupt$1 = (fiberId) => exitFailCause(causeInterrupt(fiberId));
|
|
@@ -10041,7 +10136,7 @@ const updateContext$1 = /*#__PURE__*/ dual(2, (self, f) => withFiber$1((fiber) =
|
|
|
10041
10136
|
return self;
|
|
10042
10137
|
}));
|
|
10043
10138
|
/** @internal */
|
|
10044
|
-
const updateService = /*#__PURE__*/ dual(3, (self, service, f) => updateContext$1(self, (s) => {
|
|
10139
|
+
const updateService$1 = /*#__PURE__*/ dual(3, (self, service, f) => updateContext$1(self, (s) => {
|
|
10045
10140
|
const prev = getUnsafe(s, service);
|
|
10046
10141
|
const next = f(prev);
|
|
10047
10142
|
if (prev === next) return s;
|
|
@@ -10058,12 +10153,14 @@ const provideContext$3 = /*#__PURE__*/ dual(2, (self, context) => {
|
|
|
10058
10153
|
return updateContext$1(self, merge$4(context));
|
|
10059
10154
|
});
|
|
10060
10155
|
/** @internal */
|
|
10061
|
-
const provideService$
|
|
10156
|
+
const provideService$3 = function() {
|
|
10062
10157
|
if (arguments.length === 1) return dual(2, (self, impl) => provideServiceImpl(self, arguments[0], impl));
|
|
10063
10158
|
return dual(3, (self, service, impl) => provideServiceImpl(self, service, impl)).apply(this, arguments);
|
|
10064
10159
|
};
|
|
10065
10160
|
const provideServiceImpl = (self, service, implementation) => updateContext$1(self, add(service, implementation));
|
|
10066
10161
|
/** @internal */
|
|
10162
|
+
const provideServiceEffect$1 = /*#__PURE__*/ dual(3, (self, service, acquire) => flatMap$4(acquire, (implementation) => provideService$3(self, service, implementation)));
|
|
10163
|
+
/** @internal */
|
|
10067
10164
|
const zipWith$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[1]), (self, that, f, options) => options?.concurrent ? map$5(all$2([self, that], { concurrency: 2 }), ([a, a2]) => f(a, a2)) : flatMap$4(self, (a) => map$5(that, (a2) => f(a, a2))));
|
|
10068
10165
|
/** @internal */
|
|
10069
10166
|
const filterOrFail$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, orFailWith) => filterOrElse(self, predicate, orFailWith ? (a) => fail$6(orFailWith(a)) : () => fail$6(new NoSuchElementError())));
|
|
@@ -10088,41 +10185,41 @@ const OnFailureImpl = function(self, f) {
|
|
|
10088
10185
|
OnFailureImpl.prototype = OnFailureProto;
|
|
10089
10186
|
/** @internal */
|
|
10090
10187
|
const catchCauseIf$1 = /*#__PURE__*/ dual(3, (self, predicate, f) => catchCause$2(self, (cause) => {
|
|
10091
|
-
if (!predicate(cause)) return failCause$
|
|
10188
|
+
if (!predicate(cause)) return failCause$6(cause);
|
|
10092
10189
|
return f(cause);
|
|
10093
10190
|
}));
|
|
10094
10191
|
/** @internal */
|
|
10095
10192
|
const catchCauseFilter$1 = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$2(self, (cause) => {
|
|
10096
10193
|
const eb = filter(cause);
|
|
10097
|
-
return isFailure$1(eb) ? failCause$
|
|
10194
|
+
return isFailure$1(eb) ? failCause$6(eb.failure) : f(eb.success, cause);
|
|
10098
10195
|
}));
|
|
10099
10196
|
/** @internal */
|
|
10100
|
-
const catch_$
|
|
10197
|
+
const catch_$3 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter$1(self, findError$1, (e) => f(e)));
|
|
10101
10198
|
/** @internal */
|
|
10102
10199
|
const catchDefect$1 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter$1(self, findDefect, f));
|
|
10103
10200
|
/** @internal */
|
|
10104
|
-
const tapCause$1 = /*#__PURE__*/ dual(2, (self, f) => catchCause$2(self, (cause) => andThen$1(f(cause), failCause$
|
|
10201
|
+
const tapCause$1 = /*#__PURE__*/ dual(2, (self, f) => catchCause$2(self, (cause) => andThen$1(f(cause), failCause$6(cause))));
|
|
10105
10202
|
/** @internal */
|
|
10106
10203
|
const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$2(self, (cause) => {
|
|
10107
10204
|
const result = filter(cause);
|
|
10108
|
-
if (isFailure$1(result)) return failCause$
|
|
10109
|
-
return andThen$1(f(result.success, cause), failCause$
|
|
10205
|
+
if (isFailure$1(result)) return failCause$6(cause);
|
|
10206
|
+
return andThen$1(f(result.success, cause), failCause$6(cause));
|
|
10110
10207
|
}));
|
|
10111
10208
|
/** @internal */
|
|
10112
10209
|
const tapError$1 = /*#__PURE__*/ dual(2, (self, f) => tapCauseFilter(self, findError$1, (e) => f(e)));
|
|
10113
10210
|
/** @internal */
|
|
10114
10211
|
const catchIf$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$2(self, (cause) => {
|
|
10115
10212
|
const error = findError$1(cause);
|
|
10116
|
-
if (isFailure$1(error)) return failCause$
|
|
10117
|
-
if (!predicate(error.success)) return orElse ? orElse(error.success) : failCause$
|
|
10213
|
+
if (isFailure$1(error)) return failCause$6(error.failure);
|
|
10214
|
+
if (!predicate(error.success)) return orElse ? orElse(error.success) : failCause$6(cause);
|
|
10118
10215
|
return f(error.success);
|
|
10119
10216
|
}));
|
|
10120
10217
|
/** @internal */
|
|
10121
|
-
const catchFilter$
|
|
10218
|
+
const catchFilter$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, filter, f, orElse) => catchCause$2(self, (cause) => {
|
|
10122
10219
|
const error = findError$1(cause);
|
|
10123
|
-
if (isFailure$1(error)) return failCause$
|
|
10220
|
+
if (isFailure$1(error)) return failCause$6(error.failure);
|
|
10124
10221
|
const result = filter(error.success);
|
|
10125
|
-
if (isFailure$1(result)) return orElse ? orElse(result.failure) : failCause$
|
|
10222
|
+
if (isFailure$1(result)) return orElse ? orElse(result.failure) : failCause$6(cause);
|
|
10126
10223
|
return f(result.success);
|
|
10127
10224
|
}));
|
|
10128
10225
|
/** @internal */
|
|
@@ -10131,30 +10228,30 @@ const catchTag$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, k, f
|
|
|
10131
10228
|
return catchIf$1(self, pred, f, orElse);
|
|
10132
10229
|
});
|
|
10133
10230
|
/** @internal */
|
|
10134
|
-
const catchTags$
|
|
10231
|
+
const catchTags$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, cases, orElse) => {
|
|
10135
10232
|
let keys;
|
|
10136
|
-
return catchFilter$
|
|
10233
|
+
return catchFilter$3(self, (e) => {
|
|
10137
10234
|
keys ??= Object.keys(cases);
|
|
10138
|
-
return hasProperty(e, "_tag") && isString(e["_tag"]) && keys.includes(e["_tag"]) ? succeed$8(e) : fail$7(e);
|
|
10235
|
+
return hasProperty(e, "_tag") && isString$1(e["_tag"]) && keys.includes(e["_tag"]) ? succeed$8(e) : fail$7(e);
|
|
10139
10236
|
}, (e) => cases[e["_tag"]](e), orElse);
|
|
10140
10237
|
});
|
|
10141
10238
|
/** @internal */
|
|
10142
|
-
const catchReason$
|
|
10239
|
+
const catchReason$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf$1(self, (e) => isTagged(e, errorTag) && hasProperty(e, "reason") && (orElse !== void 0 || isTagged(e.reason, reasonTag)), (e) => {
|
|
10143
10240
|
const reason = e.reason;
|
|
10144
10241
|
if (isTagged(reason, reasonTag)) return f(reason, e);
|
|
10145
10242
|
return orElse ? orElse(reason, e) : fail$6(e);
|
|
10146
10243
|
}));
|
|
10147
10244
|
/** @internal */
|
|
10148
|
-
const mapError$3 = /*#__PURE__*/ dual(2, (self, f) => catch_$
|
|
10245
|
+
const mapError$3 = /*#__PURE__*/ dual(2, (self, f) => catch_$3(self, (error) => failSync(() => f(error))));
|
|
10149
10246
|
/** @internal */
|
|
10150
10247
|
const mapBoth = /*#__PURE__*/ dual(2, (self, options) => matchEffect$2(self, {
|
|
10151
10248
|
onFailure: (e) => failSync(() => options.onFailure(e)),
|
|
10152
10249
|
onSuccess: (a) => sync$2(() => options.onSuccess(a))
|
|
10153
10250
|
}));
|
|
10154
10251
|
/** @internal */
|
|
10155
|
-
const orDie$3 = (self) => catch_$
|
|
10252
|
+
const orDie$3 = (self) => catch_$3(self, die$5);
|
|
10156
10253
|
/** @internal */
|
|
10157
|
-
const orElseSucceed$1 = /*#__PURE__*/ dual(2, (self, f) => catch_$
|
|
10254
|
+
const orElseSucceed$1 = /*#__PURE__*/ dual(2, (self, f) => catch_$3(self, (error) => sync$2(() => f(error))));
|
|
10158
10255
|
/** @internal */
|
|
10159
10256
|
const ignore$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, options) => {
|
|
10160
10257
|
if (!options?.log) return matchEffect$2(self, {
|
|
@@ -10165,7 +10262,7 @@ const ignore$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, option
|
|
|
10165
10262
|
return matchCauseEffect$1(self, {
|
|
10166
10263
|
onFailure(cause) {
|
|
10167
10264
|
const failure = findFail(cause);
|
|
10168
|
-
return isFailure$1(failure) ? failCause$
|
|
10265
|
+
return isFailure$1(failure) ? failCause$6(failure.failure) : options.message === void 0 ? logEffect(cause) : logEffect(options.message, cause);
|
|
10169
10266
|
},
|
|
10170
10267
|
onSuccess: (_) => void_$3
|
|
10171
10268
|
});
|
|
@@ -10224,7 +10321,7 @@ const makeMatch = (op, onFailure) => {
|
|
|
10224
10321
|
};
|
|
10225
10322
|
const MatchImpl = /*#__PURE__*/ makeMatch("Match", function(cause, fiber) {
|
|
10226
10323
|
const fail = cause.reasons.find(isFailReason$1);
|
|
10227
|
-
if (fail === void 0) return failCause$
|
|
10324
|
+
if (fail === void 0) return failCause$6(cause);
|
|
10228
10325
|
const handlers = this.payload;
|
|
10229
10326
|
return fiber.succeedWith(continuationMarksStack ? handlers.onFailure(fail.error) : internalCall(() => handlers.onFailure(fail.error)));
|
|
10230
10327
|
});
|
|
@@ -10232,7 +10329,7 @@ const MatchImpl = /*#__PURE__*/ makeMatch("Match", function(cause, fiber) {
|
|
|
10232
10329
|
const matchEffect$2 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$1(self, {
|
|
10233
10330
|
onFailure: (cause) => {
|
|
10234
10331
|
const fail = cause.reasons.find(isFailReason$1);
|
|
10235
|
-
return fail ? options.onFailure(fail.error) : failCause$
|
|
10332
|
+
return fail ? options.onFailure(fail.error) : failCause$6(cause);
|
|
10236
10333
|
},
|
|
10237
10334
|
onSuccess: options.onSuccess
|
|
10238
10335
|
}));
|
|
@@ -10312,7 +10409,7 @@ const runFinalizer = (finalizer, exit_) => {
|
|
|
10312
10409
|
return exitDie(defect);
|
|
10313
10410
|
}
|
|
10314
10411
|
};
|
|
10315
|
-
const combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause$2(finalizer, (cause) => failCause$
|
|
10412
|
+
const combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause$2(finalizer, (cause) => failCause$6(causeCombine(exit_.cause, cause)));
|
|
10316
10413
|
const scopeCloseFinalizers = /*#__PURE__*/ fnUntraced$1(function* (self, finalizers, exit_) {
|
|
10317
10414
|
let exits = [];
|
|
10318
10415
|
const fibers = [];
|
|
@@ -10389,7 +10486,7 @@ const scopeMake = (finalizerStrategy) => sync$2(() => scopeMakeUnsafe(finalizerS
|
|
|
10389
10486
|
/** @internal */
|
|
10390
10487
|
const scope$1 = scopeTag;
|
|
10391
10488
|
/** @internal */
|
|
10392
|
-
const provideScope = /*#__PURE__*/ provideService$
|
|
10489
|
+
const provideScope = /*#__PURE__*/ provideService$3(scopeTag);
|
|
10393
10490
|
/** @internal */
|
|
10394
10491
|
const scoped$1 = (self) => withFiber$1((fiber) => {
|
|
10395
10492
|
const prev = fiber.context;
|
|
@@ -10407,7 +10504,7 @@ const scopedWith$1 = (f) => suspend$3(() => {
|
|
|
10407
10504
|
return onExit$2(f(scope), (exit) => suspend$3(() => scopeCloseUnsafe(scope, exit) ?? void_$3));
|
|
10408
10505
|
});
|
|
10409
10506
|
/** @internal */
|
|
10410
|
-
const acquireRelease$1 = (acquire, release, options) => contextWith$1((context) => uninterruptibleMask$1((restore) => flatMap$4(scope$1, (scope) => tap$
|
|
10507
|
+
const acquireRelease$1 = (acquire, release, options) => contextWith$1((context) => uninterruptibleMask$1((restore) => flatMap$4(scope$1, (scope) => tap$2(options?.interruptible ? restore(acquire) : acquire, (a) => scopeAddFinalizerExit(scope, (exit) => provideContext$3(release(a, exit), context))))));
|
|
10411
10508
|
/** @internal */
|
|
10412
10509
|
const addFinalizer$2 = (finalizer) => flatMap$4(scope$1, (scope) => contextWith$1((context) => scopeAddFinalizerExit(scope, (exit) => provideContext$3(finalizer(exit), context))));
|
|
10413
10510
|
const OnExitImpl = /*#__PURE__*/ function() {
|
|
@@ -10520,7 +10617,7 @@ const makeCachedUnsafe = (self, ttlMillis) => {
|
|
|
10520
10617
|
/** @internal */
|
|
10521
10618
|
const cached$1 = (self) => sync$2(() => makeCachedUnsafe(self, infiniteTTL)[0]);
|
|
10522
10619
|
/** @internal */
|
|
10523
|
-
const interrupt$3 = /*#__PURE__*/ withFiber$1((fiber) => failCause$
|
|
10620
|
+
const interrupt$3 = /*#__PURE__*/ withFiber$1((fiber) => failCause$6(causeInterrupt(fiber.id)));
|
|
10524
10621
|
/** @internal */
|
|
10525
10622
|
const uninterruptible$1 = (self) => withFiber$1((fiber) => {
|
|
10526
10623
|
if (!fiber.interruptible) return self;
|
|
@@ -10532,7 +10629,7 @@ const setInterruptible = /*#__PURE__*/ makePrimitive({
|
|
|
10532
10629
|
op: "SetInterruptible",
|
|
10533
10630
|
[contAll](fiber) {
|
|
10534
10631
|
fiber.interruptible = this[args];
|
|
10535
|
-
if (fiber._interruptedCause && fiber.interruptible) return () => failCause$
|
|
10632
|
+
if (fiber._interruptedCause && fiber.interruptible) return () => failCause$6(fiber._interruptedCause);
|
|
10536
10633
|
}
|
|
10537
10634
|
});
|
|
10538
10635
|
const setInterruptibleTrue = /*#__PURE__*/ setInterruptible(true);
|
|
@@ -10540,7 +10637,7 @@ const setInterruptibleFalse = /*#__PURE__*/ setInterruptible(false);
|
|
|
10540
10637
|
const setFiberInterruptible = (fiber) => {
|
|
10541
10638
|
fiber.interruptible = true;
|
|
10542
10639
|
fiber._stack.push(setInterruptibleFalse);
|
|
10543
|
-
if (fiber._interruptedCause) return failCause$
|
|
10640
|
+
if (fiber._interruptedCause) return failCause$6(fiber._interruptedCause);
|
|
10544
10641
|
};
|
|
10545
10642
|
/**
|
|
10546
10643
|
* Makes the current fiber uninterruptible for the returned effect without an
|
|
@@ -11020,7 +11117,7 @@ const makeSpanScoped$1 = (name, options) => uninterruptible$1(withFiber$1((fiber
|
|
|
11020
11117
|
}));
|
|
11021
11118
|
const provideSpanStackFrame = (name, stack) => {
|
|
11022
11119
|
stack = typeof stack === "function" ? stack : constUndefined;
|
|
11023
|
-
return updateService(CurrentStackFrame, (parent) => ({
|
|
11120
|
+
return updateService$1(CurrentStackFrame, (parent) => ({
|
|
11024
11121
|
name,
|
|
11025
11122
|
stack,
|
|
11026
11123
|
parent
|
|
@@ -11043,7 +11140,7 @@ const useSpan$1 = (name, ...args) => {
|
|
|
11043
11140
|
return evaluate(span);
|
|
11044
11141
|
});
|
|
11045
11142
|
};
|
|
11046
|
-
const provideParentSpan = /*#__PURE__*/ provideService$
|
|
11143
|
+
const provideParentSpan = /*#__PURE__*/ provideService$3(ParentSpan);
|
|
11047
11144
|
/** @internal */
|
|
11048
11145
|
const withParentSpan$1 = function() {
|
|
11049
11146
|
const dataFirst = isEffect$1(arguments[0]);
|
|
@@ -11071,6 +11168,15 @@ const withSpan$1 = function() {
|
|
|
11071
11168
|
return (self, ...args) => useSpan$1(name, fnArg ? fnArg(...args) : options, (span) => withParentSpan$1(self, span, traceOptions));
|
|
11072
11169
|
};
|
|
11073
11170
|
/** @internal */
|
|
11171
|
+
const annotateCurrentSpan$1 = (...args) => withFiber$1((fiber) => {
|
|
11172
|
+
const span = fiber.currentSpanLocal;
|
|
11173
|
+
if (span) {
|
|
11174
|
+
if (args.length === 1) for (const [key, value] of Object.entries(args[0])) span.attribute(key, value);
|
|
11175
|
+
else span.attribute(args[0], args[1]);
|
|
11176
|
+
}
|
|
11177
|
+
return void_$3;
|
|
11178
|
+
});
|
|
11179
|
+
/** @internal */
|
|
11074
11180
|
const ClockRef = /*#__PURE__*/ Reference("effect/Clock", { defaultValue: () => new ClockImpl() });
|
|
11075
11181
|
const MAX_TIMER_MILLIS = 2 ** 31 - 1;
|
|
11076
11182
|
var ClockImpl = class {
|
|
@@ -11445,7 +11551,7 @@ const done$1 = /* @__PURE__ */ dual(2, (self, effect) => sync$2(() => doneUnsafe
|
|
|
11445
11551
|
* @category completion
|
|
11446
11552
|
* @since 2.0.0
|
|
11447
11553
|
*/
|
|
11448
|
-
const failCause$
|
|
11554
|
+
const failCause$5 = /*#__PURE__*/ dual(2, (self, cause) => done$1(self, exitFailCause(cause)));
|
|
11449
11555
|
/**
|
|
11450
11556
|
* Attempts to complete the `Deferred` with interruption by the specified
|
|
11451
11557
|
* `FiberId`.
|
|
@@ -11479,7 +11585,7 @@ const failCause$4 = /*#__PURE__*/ dual(2, (self, cause) => done$1(self, exitFail
|
|
|
11479
11585
|
* @category completion
|
|
11480
11586
|
* @since 2.0.0
|
|
11481
11587
|
*/
|
|
11482
|
-
const interruptWith = /*#__PURE__*/ dual(2, (self, fiberId) => failCause$
|
|
11588
|
+
const interruptWith = /*#__PURE__*/ dual(2, (self, fiberId) => failCause$5(self, causeInterrupt(fiberId)));
|
|
11483
11589
|
/**
|
|
11484
11590
|
* Returns `true` if this `Deferred` has already been completed with a value or
|
|
11485
11591
|
* an error, `false` otherwise.
|
|
@@ -11691,7 +11797,7 @@ const succeed$6 = exitSucceed;
|
|
|
11691
11797
|
* @category constructors
|
|
11692
11798
|
* @since 2.0.0
|
|
11693
11799
|
*/
|
|
11694
|
-
const failCause$
|
|
11800
|
+
const failCause$4 = exitFailCause;
|
|
11695
11801
|
/**
|
|
11696
11802
|
* Creates a failed Exit from a typed error value.
|
|
11697
11803
|
*
|
|
@@ -11752,7 +11858,7 @@ const fail$5 = exitFail;
|
|
|
11752
11858
|
* @category constructors
|
|
11753
11859
|
* @since 2.0.0
|
|
11754
11860
|
*/
|
|
11755
|
-
const die$
|
|
11861
|
+
const die$4 = exitDie;
|
|
11756
11862
|
/**
|
|
11757
11863
|
* Creates a failed Exit representing fiber interruption.
|
|
11758
11864
|
*
|
|
@@ -12663,7 +12769,7 @@ var CurrentMemoMap = class CurrentMemoMap extends (/*#__PURE__*/ Service()("effe
|
|
|
12663
12769
|
* @category destructors
|
|
12664
12770
|
* @since 2.0.0
|
|
12665
12771
|
*/
|
|
12666
|
-
const buildWithMemoMap = /*#__PURE__*/ dual(3, (self, memoMap, scope) => provideService$
|
|
12772
|
+
const buildWithMemoMap = /*#__PURE__*/ dual(3, (self, memoMap, scope) => provideService$3(map$5(suspend$3(() => self.build(memoMap, scope)), add(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
|
|
12667
12773
|
/**
|
|
12668
12774
|
* Builds a layer into a scoped value.
|
|
12669
12775
|
*
|
|
@@ -13094,7 +13200,7 @@ const unwrapKey = /*#__PURE__*/ Service("effect/Layer/unwrap");
|
|
|
13094
13200
|
const unwrap$4 = (self) => flatMap$3(effect(unwrapKey)(self), get$4(unwrapKey));
|
|
13095
13201
|
const mergeAllEffect = (layers, memoMap, scope) => {
|
|
13096
13202
|
const parentScope = forkUnsafe(scope, "parallel");
|
|
13097
|
-
return forEach$2(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$5((context) => mergeAll$
|
|
13203
|
+
return forEach$2(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$5((context) => mergeAll$3(...context)));
|
|
13098
13204
|
};
|
|
13099
13205
|
/**
|
|
13100
13206
|
* Combines all the provided layers concurrently, creating a new layer with
|
|
@@ -13145,7 +13251,7 @@ const mergeAllEffect = (layers, memoMap, scope) => {
|
|
|
13145
13251
|
* @category zipping
|
|
13146
13252
|
* @since 2.0.0
|
|
13147
13253
|
*/
|
|
13148
|
-
const mergeAll$
|
|
13254
|
+
const mergeAll$2 = (...layers) => fromBuild((memoMap, scope) => mergeAllEffect(layers, memoMap, scope));
|
|
13149
13255
|
/**
|
|
13150
13256
|
* Merges this layer with another layer concurrently, producing a new layer with
|
|
13151
13257
|
* combined input, error, and output types.
|
|
@@ -13192,7 +13298,7 @@ const mergeAll$1 = (...layers) => fromBuild((memoMap, scope) => mergeAllEffect(l
|
|
|
13192
13298
|
* @category zipping
|
|
13193
13299
|
* @since 2.0.0
|
|
13194
13300
|
*/
|
|
13195
|
-
const merge$3 = /*#__PURE__*/ dual(2, (self, that) => mergeAll$
|
|
13301
|
+
const merge$3 = /*#__PURE__*/ dual(2, (self, that) => mergeAll$2(self, ...Array.isArray(that) ? that : [that]));
|
|
13196
13302
|
const provideWith = (self, that, f) => fromBuild((memoMap, scope) => flatMap$4(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), (context) => self.build(memoMap, scope).pipe(provideContext$3(context), map$5((merged) => f(merged, context)))));
|
|
13197
13303
|
/**
|
|
13198
13304
|
* Feeds the output services of the dependency layer into the requirements of
|
|
@@ -13673,7 +13779,7 @@ const fail$4 = causeFail;
|
|
|
13673
13779
|
* @category constructors
|
|
13674
13780
|
* @since 2.0.0
|
|
13675
13781
|
*/
|
|
13676
|
-
const die$
|
|
13782
|
+
const die$3 = causeDie;
|
|
13677
13783
|
/**
|
|
13678
13784
|
* Creates a standalone `Fail` reason (not wrapped in a `Cause`).
|
|
13679
13785
|
*
|
|
@@ -14163,6 +14269,42 @@ const IllegalArgumentError = IllegalArgumentError$1;
|
|
|
14163
14269
|
*/
|
|
14164
14270
|
const UnknownError = UnknownError$1;
|
|
14165
14271
|
/**
|
|
14272
|
+
* Attaches metadata to every reason in a `Cause`.
|
|
14273
|
+
*
|
|
14274
|
+
* **When to use**
|
|
14275
|
+
*
|
|
14276
|
+
* Use to attach diagnostic metadata to every reason in a cause.
|
|
14277
|
+
*
|
|
14278
|
+
* **Details**
|
|
14279
|
+
*
|
|
14280
|
+
* Annotations are stored as a `Context` on each reason and can be
|
|
14281
|
+
* retrieved later via {@link reasonAnnotations} or {@link annotations}.
|
|
14282
|
+
* The runtime uses this to attach stack traces and spans.
|
|
14283
|
+
*
|
|
14284
|
+
* - Returns a new `Cause`.
|
|
14285
|
+
* - By default, existing keys are preserved. Pass `{ overwrite: true }` to
|
|
14286
|
+
* replace them.
|
|
14287
|
+
*
|
|
14288
|
+
* **Example** (Annotating a cause)
|
|
14289
|
+
*
|
|
14290
|
+
* ```ts import.meta.vitest
|
|
14291
|
+
* import { Cause, Context } from "effect"
|
|
14292
|
+
*
|
|
14293
|
+
* class RequestId extends Context.Service<RequestId, string>()("RequestId") {}
|
|
14294
|
+
*
|
|
14295
|
+
* const annotated = Cause.annotate(Cause.fail("error"), Context.make(RequestId, "req-1"))
|
|
14296
|
+
* Context.getOrUndefined(Cause.annotations(annotated), RequestId) // => "req-1"
|
|
14297
|
+
* ```
|
|
14298
|
+
*
|
|
14299
|
+
* @see {@link annotations} for reading merged annotations from a cause
|
|
14300
|
+
* @see {@link reasonAnnotations} for reading annotations from a single reason
|
|
14301
|
+
*
|
|
14302
|
+
* @stability stable
|
|
14303
|
+
* @category annotations
|
|
14304
|
+
* @since 4.0.0
|
|
14305
|
+
*/
|
|
14306
|
+
const annotate$1 = causeAnnotate;
|
|
14307
|
+
/**
|
|
14166
14308
|
* Reads the annotations from a single `Reason` as a `Context`.
|
|
14167
14309
|
*
|
|
14168
14310
|
* **When to use**
|
|
@@ -14412,6 +14554,8 @@ const isDateTime$1 = (u) => hasProperty(u, TypeId$31);
|
|
|
14412
14554
|
/** @internal */
|
|
14413
14555
|
const isTimeZone = (u) => hasProperty(u, TimeZoneTypeId);
|
|
14414
14556
|
/** @internal */
|
|
14557
|
+
const isUtc$1 = (self) => self._tag === "Utc";
|
|
14558
|
+
/** @internal */
|
|
14415
14559
|
const isZoned = (self) => self._tag === "Zoned";
|
|
14416
14560
|
const makeUtc = (epochMillis) => {
|
|
14417
14561
|
const self = Object.create(ProtoUtc);
|
|
@@ -14473,7 +14617,11 @@ const makeZonedUnsafe$1 = (input, options) => {
|
|
|
14473
14617
|
return makeZonedFromAdjusted(self.epochMilliseconds, zone, options?.disambiguation ?? "compatible");
|
|
14474
14618
|
};
|
|
14475
14619
|
/** @internal */
|
|
14620
|
+
const make$32 = /*#__PURE__*/ liftThrowable(makeUnsafe$3);
|
|
14621
|
+
/** @internal */
|
|
14476
14622
|
const now$1 = /*#__PURE__*/ map$5(currentTimeMillis, makeUtc);
|
|
14623
|
+
/** @internal */
|
|
14624
|
+
const toUtc$1 = (self) => makeUtc(self.epochMilliseconds);
|
|
14477
14625
|
const validZoneCache = /*#__PURE__*/ new Map();
|
|
14478
14626
|
const formatOptions = {
|
|
14479
14627
|
day: "numeric",
|
|
@@ -14618,6 +14766,8 @@ const calculateNamedOffset = (utcMillis, adjustedMillis, zone) => {
|
|
|
14618
14766
|
return result;
|
|
14619
14767
|
};
|
|
14620
14768
|
/** @internal */
|
|
14769
|
+
const formatIso$1 = (self) => toDateUtc$1(self).toISOString();
|
|
14770
|
+
/** @internal */
|
|
14621
14771
|
const formatIsoOffset = (self) => {
|
|
14622
14772
|
const date = toDate(self);
|
|
14623
14773
|
return self._tag === "Utc" ? date.toISOString() : `${date.toISOString().slice(0, -1)}${zonedOffsetIso(self)}`;
|
|
@@ -14738,6 +14888,23 @@ const round = /*#__PURE__*/ dual(2, (self, precision) => {
|
|
|
14738
14888
|
});
|
|
14739
14889
|
globalThis.String;
|
|
14740
14890
|
/**
|
|
14891
|
+
* Checks whether a value is a `string`.
|
|
14892
|
+
*
|
|
14893
|
+
* **Example** (Checking for strings)
|
|
14894
|
+
*
|
|
14895
|
+
* ```ts import.meta.vitest
|
|
14896
|
+
* import { String } from "effect"
|
|
14897
|
+
*
|
|
14898
|
+
* String.isString("a") // => true
|
|
14899
|
+
* String.isString(1) // => false
|
|
14900
|
+
* ```
|
|
14901
|
+
*
|
|
14902
|
+
* @stability stable
|
|
14903
|
+
* @category guards
|
|
14904
|
+
* @since 2.0.0
|
|
14905
|
+
*/
|
|
14906
|
+
const isString = isString$1;
|
|
14907
|
+
/**
|
|
14741
14908
|
* Converts a string to lowercase.
|
|
14742
14909
|
*
|
|
14743
14910
|
* **Example** (Converting strings to lowercase)
|
|
@@ -15027,6 +15194,23 @@ const repeat$2 = (count) => (self) => self.repeat(normalize$1(count));
|
|
|
15027
15194
|
* @since 2.0.0
|
|
15028
15195
|
*/
|
|
15029
15196
|
const replaceAll = (searchValue, replaceValue) => (self) => self.replaceAll(searchValue, replaceValue);
|
|
15197
|
+
/**
|
|
15198
|
+
* Converts a camelCase string to snake_case.
|
|
15199
|
+
*
|
|
15200
|
+
* **Example** (Converting camelCase to snake_case)
|
|
15201
|
+
*
|
|
15202
|
+
* ```ts import.meta.vitest
|
|
15203
|
+
* import { String } from "effect"
|
|
15204
|
+
*
|
|
15205
|
+
* String.camelToSnake("helloWorld") // => "hello_world"
|
|
15206
|
+
* String.camelToSnake("fooBarBaz") // => "foo_bar_baz"
|
|
15207
|
+
* ```
|
|
15208
|
+
*
|
|
15209
|
+
* @stability stable
|
|
15210
|
+
* @category transforming
|
|
15211
|
+
* @since 2.0.0
|
|
15212
|
+
*/
|
|
15213
|
+
const camelToSnake = (self) => self.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
15030
15214
|
//#endregion
|
|
15031
15215
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/random.js
|
|
15032
15216
|
/** @internal */
|
|
@@ -15191,7 +15375,7 @@ const filterDoneLeftover = (cause) => {
|
|
|
15191
15375
|
*/
|
|
15192
15376
|
const doneExitFromCause = (cause) => {
|
|
15193
15377
|
const halt = filterDone(cause);
|
|
15194
|
-
return !isFailure$1(halt) ? succeed$6(halt.success.value) : failCause$
|
|
15378
|
+
return !isFailure$1(halt) ? succeed$6(halt.success.value) : failCause$4(halt.failure);
|
|
15195
15379
|
};
|
|
15196
15380
|
/**
|
|
15197
15381
|
* Pattern matches on a Pull, handling success, failure, and done cases.
|
|
@@ -15405,7 +15589,7 @@ const fromStepWithMetadata = (step) => fromStep(map$5(step, (f) => {
|
|
|
15405
15589
|
* @category destructors
|
|
15406
15590
|
* @since 4.0.0
|
|
15407
15591
|
*/
|
|
15408
|
-
const toStep = (schedule) => catchCause$2(schedule.step, (cause) => succeed$7(() => failCause$
|
|
15592
|
+
const toStep = (schedule) => catchCause$2(schedule.step, (cause) => succeed$7(() => failCause$6(cause)));
|
|
15409
15593
|
/**
|
|
15410
15594
|
* Extracts a step function from a `Schedule` that sleeps for each computed
|
|
15411
15595
|
* delay and returns metadata for the completed step.
|
|
@@ -15465,7 +15649,7 @@ const toStepWithMetadata = (schedule) => clockWith$1((clock) => map$5(toStep(sch
|
|
|
15465
15649
|
const min = (schedules) => fromStep(map$5(all$2(schedules.map(toStep)), (steps) => (now, input) => flatMap$4(forEach$2(steps, (step) => matchEffect$1(step(now, input), {
|
|
15466
15650
|
onSuccess: (result) => succeed$7(result[1]),
|
|
15467
15651
|
onDone: () => undefined_$1,
|
|
15468
|
-
onFailure: failCause$
|
|
15652
|
+
onFailure: failCause$6
|
|
15469
15653
|
})), (results) => {
|
|
15470
15654
|
const duration = minDuration(results);
|
|
15471
15655
|
if (duration === void 0) return done(zero$2);
|
|
@@ -15534,7 +15718,7 @@ const exponential = (base, factor = 2) => {
|
|
|
15534
15718
|
*/
|
|
15535
15719
|
const passthrough$2 = (self) => fromStep(map$5(toStep(self), (step) => (now, input) => matchEffect$1(step(now, input), {
|
|
15536
15720
|
onSuccess: (result) => succeed$7([input, result[1]]),
|
|
15537
|
-
onFailure: failCause$
|
|
15721
|
+
onFailure: failCause$6,
|
|
15538
15722
|
onDone: () => done(input)
|
|
15539
15723
|
})));
|
|
15540
15724
|
/**
|
|
@@ -15613,14 +15797,14 @@ const forever$1 = /*#__PURE__*/ spaced(zero$2);
|
|
|
15613
15797
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/layer.js
|
|
15614
15798
|
const provideLayer = (self, layer, options) => scopedWith$1((scope) => flatMap$4(options?.local ? buildWithMemoMap(layer, makeMemoMapUnsafe(), scope) : buildWithScope(layer, scope), (context) => provideContext$3(self, context)));
|
|
15615
15799
|
/** @internal */
|
|
15616
|
-
const provide$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, source, options) => isContext(source) ? provideContext$3(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll$
|
|
15800
|
+
const provide$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, source, options) => isContext(source) ? provideContext$3(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll$2(...source) : source, options));
|
|
15617
15801
|
//#endregion
|
|
15618
15802
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schedule.js
|
|
15619
15803
|
const findErrorOnly = (cause) => cause.reasons.every(isFailReason$1) ? findError$1(cause) : fail$7(cause);
|
|
15620
15804
|
/** @internal */
|
|
15621
15805
|
const repeatOrElse = /*#__PURE__*/ dual(3, (self, schedule, orElse) => flatMap$4(toStepWithMetadata(schedule), (step) => {
|
|
15622
15806
|
let meta = CurrentMetadata.defaultValue();
|
|
15623
|
-
return catchCauseFilter$1(catchDone(forever$2(tap$
|
|
15807
|
+
return catchCauseFilter$1(catchDone(forever$2(tap$2(flatMap$4(suspend$3(() => provideService$3(self, CurrentMetadata, meta)), step), (meta_) => sync$2(() => {
|
|
15624
15808
|
meta = meta_;
|
|
15625
15809
|
})), { disableYield: true }), (out) => succeed$7(out)), findErrorOnly, (error) => orElse(error, meta.attempt === 0 ? none() : some$1(meta)));
|
|
15626
15810
|
}));
|
|
@@ -15628,7 +15812,7 @@ const repeatOrElse = /*#__PURE__*/ dual(3, (self, schedule, orElse) => flatMap$4
|
|
|
15628
15812
|
const retryOrElse$1 = /*#__PURE__*/ dual(3, (self, policy, orElse) => flatMap$4(toStepWithMetadata(policy), (step) => {
|
|
15629
15813
|
let meta = CurrentMetadata.defaultValue();
|
|
15630
15814
|
let lastError;
|
|
15631
|
-
const loop = catchCauseFilter$1(suspend$3(() => provideService$
|
|
15815
|
+
const loop = catchCauseFilter$1(suspend$3(() => provideService$3(self, CurrentMetadata, meta)), findErrorOnly, (error) => {
|
|
15632
15816
|
lastError = error;
|
|
15633
15817
|
return flatMap$4(step(error), (meta_) => {
|
|
15634
15818
|
meta = meta_;
|
|
@@ -16370,7 +16554,7 @@ const fail$3 = fail$6;
|
|
|
16370
16554
|
* @category constructors
|
|
16371
16555
|
* @since 2.0.0
|
|
16372
16556
|
*/
|
|
16373
|
-
const failCause$
|
|
16557
|
+
const failCause$3 = failCause$6;
|
|
16374
16558
|
/**
|
|
16375
16559
|
* Creates an `Effect` that represents a failure with a `Cause` computed lazily.
|
|
16376
16560
|
*
|
|
@@ -16438,7 +16622,7 @@ const failCauseSync = failCauseSync$1;
|
|
|
16438
16622
|
* @category constructors
|
|
16439
16623
|
* @since 2.0.0
|
|
16440
16624
|
*/
|
|
16441
|
-
const die$
|
|
16625
|
+
const die$2 = die$5;
|
|
16442
16626
|
const try_ = try_$1;
|
|
16443
16627
|
/**
|
|
16444
16628
|
* Yields control back to the Effect runtime, allowing other fibers to execute.
|
|
@@ -16673,6 +16857,31 @@ const transposeOption = transposeOption$1;
|
|
|
16673
16857
|
*/
|
|
16674
16858
|
const flatMap$2 = flatMap$4;
|
|
16675
16859
|
/**
|
|
16860
|
+
* Flattens an `Effect` that produces another `Effect` into a single effect.
|
|
16861
|
+
*
|
|
16862
|
+
* **Example** (Flattening nested effects)
|
|
16863
|
+
*
|
|
16864
|
+
* ```ts import.meta.vitest
|
|
16865
|
+
* import { Effect } from "effect"
|
|
16866
|
+
* const output: Array<unknown> = []
|
|
16867
|
+
*
|
|
16868
|
+
* const nested = Effect.succeed(Effect.succeed("hello"))
|
|
16869
|
+
*
|
|
16870
|
+
* const program = Effect.gen(function*() {
|
|
16871
|
+
* const value = yield* Effect.flatten(nested)
|
|
16872
|
+
* yield* Effect.sync(() => { output.push(value) })
|
|
16873
|
+
* })
|
|
16874
|
+
*
|
|
16875
|
+
* Effect.runSync(program)
|
|
16876
|
+
* output // => ["hello"]
|
|
16877
|
+
* ```
|
|
16878
|
+
*
|
|
16879
|
+
* @stability stable
|
|
16880
|
+
* @category sequencing
|
|
16881
|
+
* @since 2.0.0
|
|
16882
|
+
*/
|
|
16883
|
+
const flatten$2 = flatten$3;
|
|
16884
|
+
/**
|
|
16676
16885
|
* Runs this effect and then runs another effect, optionally using the first
|
|
16677
16886
|
* effect's success value to choose the next effect.
|
|
16678
16887
|
*
|
|
@@ -16807,7 +17016,7 @@ const andThen = andThen$1;
|
|
|
16807
17016
|
* @category sequencing
|
|
16808
17017
|
* @since 2.0.0
|
|
16809
17018
|
*/
|
|
16810
|
-
const tap = tap$
|
|
17019
|
+
const tap$1 = tap$2;
|
|
16811
17020
|
/**
|
|
16812
17021
|
* Converts both success and failure of an `Effect` into a `Result` type.
|
|
16813
17022
|
*
|
|
@@ -17117,7 +17326,7 @@ const asVoid = asVoid$1;
|
|
|
17117
17326
|
* @since 2.0.0
|
|
17118
17327
|
*/
|
|
17119
17328
|
const zipWith = zipWith$1;
|
|
17120
|
-
const catch_$
|
|
17329
|
+
const catch_$2 = catch_$3;
|
|
17121
17330
|
/**
|
|
17122
17331
|
* Catches and handles specific errors by their `_tag` field, which is used as a
|
|
17123
17332
|
* discriminator.
|
|
@@ -17215,7 +17424,7 @@ const catchTag = catchTag$1;
|
|
|
17215
17424
|
* @category error handling
|
|
17216
17425
|
* @since 2.0.0
|
|
17217
17426
|
*/
|
|
17218
|
-
const catchTags = catchTags$
|
|
17427
|
+
const catchTags$1 = catchTags$2;
|
|
17219
17428
|
/**
|
|
17220
17429
|
* Catches a specific reason within a tagged error.
|
|
17221
17430
|
*
|
|
@@ -17266,7 +17475,7 @@ const catchTags = catchTags$1;
|
|
|
17266
17475
|
* @category error handling
|
|
17267
17476
|
* @since 4.0.0
|
|
17268
17477
|
*/
|
|
17269
|
-
const catchReason = catchReason$
|
|
17478
|
+
const catchReason$2 = catchReason$3;
|
|
17270
17479
|
/**
|
|
17271
17480
|
* Handles both recoverable and unrecoverable errors by providing a recovery
|
|
17272
17481
|
* effect.
|
|
@@ -17429,7 +17638,7 @@ const catchIf = catchIf$1;
|
|
|
17429
17638
|
* @category error handling
|
|
17430
17639
|
* @since 4.0.0
|
|
17431
17640
|
*/
|
|
17432
|
-
const catchFilter = catchFilter$
|
|
17641
|
+
const catchFilter$2 = catchFilter$3;
|
|
17433
17642
|
/**
|
|
17434
17643
|
* Recovers from specific failures based on a predicate.
|
|
17435
17644
|
*
|
|
@@ -18592,6 +18801,43 @@ const serviceOption = serviceOption$1;
|
|
|
18592
18801
|
*/
|
|
18593
18802
|
const updateContext = updateContext$1;
|
|
18594
18803
|
/**
|
|
18804
|
+
* Runs an effect with a service implementation transformed by the provided
|
|
18805
|
+
* function.
|
|
18806
|
+
*
|
|
18807
|
+
* **Details**
|
|
18808
|
+
*
|
|
18809
|
+
* The service must be available in the effect's context; `updateService`
|
|
18810
|
+
* replaces it for the wrapped effect with the value returned by the updater.
|
|
18811
|
+
*
|
|
18812
|
+
* **Example** (Replacing a service for one effect)
|
|
18813
|
+
*
|
|
18814
|
+
* ```ts import.meta.vitest
|
|
18815
|
+
* import { Context, Effect } from "effect"
|
|
18816
|
+
* const output: Array<unknown> = []
|
|
18817
|
+
*
|
|
18818
|
+
* // Define a counter service
|
|
18819
|
+
* const Counter = Context.Service<{ count: number }>("Counter")
|
|
18820
|
+
*
|
|
18821
|
+
* const program = Effect.gen(function*() {
|
|
18822
|
+
* const updatedCounter = yield* Effect.service(Counter)
|
|
18823
|
+
* yield* Effect.sync(() => { output.push(`Updated count: ${updatedCounter.count}`) })
|
|
18824
|
+
* return updatedCounter.count
|
|
18825
|
+
* }).pipe(
|
|
18826
|
+
* Effect.updateService(Counter, (counter) => ({ count: counter.count + 1 }))
|
|
18827
|
+
* )
|
|
18828
|
+
*
|
|
18829
|
+
* // Provide initial service and run
|
|
18830
|
+
* const result = Effect.provideService(program, Counter, { count: 0 })
|
|
18831
|
+
* void output.push(Effect.runSync(result))
|
|
18832
|
+
* output // => ["Updated count: 1", 1]
|
|
18833
|
+
* ```
|
|
18834
|
+
*
|
|
18835
|
+
* @stability stable
|
|
18836
|
+
* @category providing services
|
|
18837
|
+
* @since 2.0.0
|
|
18838
|
+
*/
|
|
18839
|
+
const updateService = updateService$1;
|
|
18840
|
+
/**
|
|
18595
18841
|
* Provides one concrete service implementation to an effect.
|
|
18596
18842
|
*
|
|
18597
18843
|
* **When to use**
|
|
@@ -18639,7 +18885,64 @@ const updateContext = updateContext$1;
|
|
|
18639
18885
|
* @category providing services
|
|
18640
18886
|
* @since 2.0.0
|
|
18641
18887
|
*/
|
|
18642
|
-
const provideService = provideService$
|
|
18888
|
+
const provideService$2 = provideService$3;
|
|
18889
|
+
/**
|
|
18890
|
+
* Provides one service to an effect using an effectful acquisition.
|
|
18891
|
+
*
|
|
18892
|
+
* **When to use**
|
|
18893
|
+
*
|
|
18894
|
+
* Use when the service implementation must be created by an effect and its
|
|
18895
|
+
* acquisition failure should remain in the returned effect.
|
|
18896
|
+
*
|
|
18897
|
+
* **Details**
|
|
18898
|
+
*
|
|
18899
|
+
* `provideServiceEffect` runs the acquisition effect to produce the service
|
|
18900
|
+
* implementation, removes that service from the wrapped effect's requirements,
|
|
18901
|
+
* and leaves any other requirements to be provided later. Acquisition failures
|
|
18902
|
+
* are included in the returned effect's error channel.
|
|
18903
|
+
*
|
|
18904
|
+
* **Example** (Providing a service with an effect)
|
|
18905
|
+
*
|
|
18906
|
+
* ```ts import.meta.vitest
|
|
18907
|
+
* import { Context, Effect } from "effect"
|
|
18908
|
+
* const output: Array<unknown> = []
|
|
18909
|
+
*
|
|
18910
|
+
* // Define a database connection service
|
|
18911
|
+
* interface DatabaseConnection {
|
|
18912
|
+
* readonly query: (sql: string) => Effect.Effect<string>
|
|
18913
|
+
* }
|
|
18914
|
+
* const Database = Context.Service<DatabaseConnection>("Database")
|
|
18915
|
+
*
|
|
18916
|
+
* // Effect that creates a database connection
|
|
18917
|
+
* const createConnection = Effect.gen(function*() {
|
|
18918
|
+
* yield* Effect.sync(() => { output.push("Establishing database connection...") })
|
|
18919
|
+
* yield* Effect.sync(() => { output.push("Database connected!") })
|
|
18920
|
+
* return {
|
|
18921
|
+
* query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
|
|
18922
|
+
* }
|
|
18923
|
+
* })
|
|
18924
|
+
*
|
|
18925
|
+
* const program = Effect.gen(function*() {
|
|
18926
|
+
* const db = yield* Effect.service(Database)
|
|
18927
|
+
* return yield* db.query("SELECT * FROM users")
|
|
18928
|
+
* })
|
|
18929
|
+
*
|
|
18930
|
+
* // Provide the service through an effect
|
|
18931
|
+
* const withDatabase = Effect.provideServiceEffect(
|
|
18932
|
+
* program,
|
|
18933
|
+
* Database,
|
|
18934
|
+
* createConnection
|
|
18935
|
+
* )
|
|
18936
|
+
*
|
|
18937
|
+
* void output.push(await Effect.runPromise(withDatabase))
|
|
18938
|
+
* output // => ["Establishing database connection...", "Database connected!", "Result for: SELECT * FROM users"]
|
|
18939
|
+
* ```
|
|
18940
|
+
*
|
|
18941
|
+
* @stability stable
|
|
18942
|
+
* @category providing services
|
|
18943
|
+
* @since 2.0.0
|
|
18944
|
+
*/
|
|
18945
|
+
const provideServiceEffect = provideServiceEffect$1;
|
|
18643
18946
|
/**
|
|
18644
18947
|
* Returns the current scope for resource management.
|
|
18645
18948
|
*
|
|
@@ -19273,6 +19576,31 @@ const forever = forever$2;
|
|
|
19273
19576
|
*/
|
|
19274
19577
|
const repeat = repeat$1;
|
|
19275
19578
|
/**
|
|
19579
|
+
* Adds an annotation to the current span if available.
|
|
19580
|
+
*
|
|
19581
|
+
* **Example** (Annotating the current span)
|
|
19582
|
+
*
|
|
19583
|
+
* ```ts import.meta.vitest
|
|
19584
|
+
* import { Effect } from "effect"
|
|
19585
|
+
*
|
|
19586
|
+
* const program = Effect.gen(function*() {
|
|
19587
|
+
* yield* Effect.annotateCurrentSpan("userId", "123")
|
|
19588
|
+
* yield* Effect.annotateCurrentSpan({
|
|
19589
|
+
* operation: "user-lookup"
|
|
19590
|
+
* })
|
|
19591
|
+
* return "success"
|
|
19592
|
+
* })
|
|
19593
|
+
*
|
|
19594
|
+
* const traced = Effect.withSpan(program, "user-operation")
|
|
19595
|
+
* Effect.runSync(traced) // => "success"
|
|
19596
|
+
* ```
|
|
19597
|
+
*
|
|
19598
|
+
* @stability stable
|
|
19599
|
+
* @category tracing
|
|
19600
|
+
* @since 2.0.0
|
|
19601
|
+
*/
|
|
19602
|
+
const annotateCurrentSpan = annotateCurrentSpan$1;
|
|
19603
|
+
/**
|
|
19276
19604
|
* Create a new span for tracing, and automatically close it when the Scope
|
|
19277
19605
|
* finalizes.
|
|
19278
19606
|
*
|
|
@@ -20124,7 +20452,7 @@ const logDebug = /*#__PURE__*/ logWithLevel("Debug");
|
|
|
20124
20452
|
* @category logging
|
|
20125
20453
|
* @since 2.0.0
|
|
20126
20454
|
*/
|
|
20127
|
-
const annotateLogs = /*#__PURE__*/ dual((args) => isEffect(args[0]), (effect, ...args) => updateService(effect, CurrentLogAnnotations, (annotations) => {
|
|
20455
|
+
const annotateLogs = /*#__PURE__*/ dual((args) => isEffect(args[0]), (effect, ...args) => updateService$1(effect, CurrentLogAnnotations, (annotations) => {
|
|
20128
20456
|
const newAnnotations = args.length === 1 ? {
|
|
20129
20457
|
...annotations,
|
|
20130
20458
|
...args[0]
|
|
@@ -20169,7 +20497,7 @@ const annotateLogs = /*#__PURE__*/ dual((args) => isEffect(args[0]), (effect, ..
|
|
|
20169
20497
|
* @category logging
|
|
20170
20498
|
* @since 2.0.0
|
|
20171
20499
|
*/
|
|
20172
|
-
const withLogSpan = /*#__PURE__*/ dual(2, (effect, label) => flatMap$4(currentTimeMillis$1, (now) => updateService(effect, CurrentLogSpans, (spans) => {
|
|
20500
|
+
const withLogSpan = /*#__PURE__*/ dual(2, (effect, label) => flatMap$4(currentTimeMillis$1, (now) => updateService$1(effect, CurrentLogSpans, (spans) => {
|
|
20173
20501
|
return [[label, now], ...spans];
|
|
20174
20502
|
})));
|
|
20175
20503
|
/**
|
|
@@ -20232,7 +20560,7 @@ const effectify = (fn, onError, onSyncError) => (...args) => callback$1((resume)
|
|
|
20232
20560
|
else resume(succeed$4(result));
|
|
20233
20561
|
});
|
|
20234
20562
|
} catch (err) {
|
|
20235
|
-
resume(onSyncError ? fail$3(onSyncError(err, args)) : die$
|
|
20563
|
+
resume(onSyncError ? fail$3(onSyncError(err, args)) : die$2(err));
|
|
20236
20564
|
}
|
|
20237
20565
|
});
|
|
20238
20566
|
/**
|
|
@@ -20507,7 +20835,7 @@ const fnUntracedEager = fnUntracedEager$1;
|
|
|
20507
20835
|
* @category constructors
|
|
20508
20836
|
* @since 4.0.0
|
|
20509
20837
|
*/
|
|
20510
|
-
const BigInt$
|
|
20838
|
+
const BigInt$4 = globalThis.BigInt;
|
|
20511
20839
|
/**
|
|
20512
20840
|
* Converts a `bigint` to a `number` safely.
|
|
20513
20841
|
*
|
|
@@ -20538,7 +20866,7 @@ const BigInt$2 = globalThis.BigInt;
|
|
|
20538
20866
|
* @since 2.0.0
|
|
20539
20867
|
*/
|
|
20540
20868
|
const toNumber = (b) => {
|
|
20541
|
-
if (b > BigInt$
|
|
20869
|
+
if (b > BigInt$4(Number.MAX_SAFE_INTEGER) || b < BigInt$4(Number.MIN_SAFE_INTEGER)) return none();
|
|
20542
20870
|
return some$1(Number(b));
|
|
20543
20871
|
};
|
|
20544
20872
|
//#endregion
|
|
@@ -21173,6 +21501,7 @@ const toReadonlyArray_ = (self) => {
|
|
|
21173
21501
|
const toReadonlyArray = toReadonlyArray_;
|
|
21174
21502
|
//#endregion
|
|
21175
21503
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Fiber.js
|
|
21504
|
+
const await_ = fiberAwait;
|
|
21176
21505
|
/**
|
|
21177
21506
|
* Joins a fiber, blocking until it completes. If the fiber succeeds,
|
|
21178
21507
|
* returns its value. If it fails, the error is propagated.
|
|
@@ -21333,6 +21662,51 @@ const interruptAs = fiberInterruptAs;
|
|
|
21333
21662
|
*/
|
|
21334
21663
|
const interruptAll = fiberInterruptAll;
|
|
21335
21664
|
/**
|
|
21665
|
+
* Interrupts all fibers in the provided iterable using the specified fiber ID as the
|
|
21666
|
+
* interrupting fiber. This allows you to control which fiber is considered the source
|
|
21667
|
+
* of the interruption, which can be useful for debugging and tracing.
|
|
21668
|
+
*
|
|
21669
|
+
* **When to use**
|
|
21670
|
+
*
|
|
21671
|
+
* Use to interrupt several fibers while recording a specific fiber ID as the
|
|
21672
|
+
* interruptor.
|
|
21673
|
+
*
|
|
21674
|
+
* **Details**
|
|
21675
|
+
*
|
|
21676
|
+
* The returned Effect completes only after all interrupted fibers have
|
|
21677
|
+
* completed.
|
|
21678
|
+
*
|
|
21679
|
+
* **Gotchas**
|
|
21680
|
+
*
|
|
21681
|
+
* The supplied ID affects the recorded interruptor. It does not make
|
|
21682
|
+
* interruption synchronous or force uninterruptible regions to stop early.
|
|
21683
|
+
*
|
|
21684
|
+
* **Example** (Interrupting multiple fibers as another fiber)
|
|
21685
|
+
*
|
|
21686
|
+
* ```ts import.meta.vitest
|
|
21687
|
+
* import { Effect, Fiber } from "effect"
|
|
21688
|
+
*
|
|
21689
|
+
* const program = Effect.gen(function*() {
|
|
21690
|
+
* // Create a controlling fiber
|
|
21691
|
+
* const controllerFiber = yield* Effect.forkChild(Effect.succeed("controller"))
|
|
21692
|
+
*
|
|
21693
|
+
* const worker1 = yield* Effect.forkChild(Effect.never)
|
|
21694
|
+
* const worker2 = yield* Effect.forkChild(Effect.never)
|
|
21695
|
+
*
|
|
21696
|
+
* yield* Fiber.interruptAllAs([worker1, worker2], controllerFiber.id)
|
|
21697
|
+
* })
|
|
21698
|
+
*
|
|
21699
|
+
* await Effect.runPromise(program)
|
|
21700
|
+
* ```
|
|
21701
|
+
*
|
|
21702
|
+
* @see {@link interruptAll} for using the current fiber as the interruptor
|
|
21703
|
+
*
|
|
21704
|
+
* @stability stable
|
|
21705
|
+
* @category interruption
|
|
21706
|
+
* @since 2.0.0
|
|
21707
|
+
*/
|
|
21708
|
+
const interruptAllAs = fiberInterruptAllAs;
|
|
21709
|
+
/**
|
|
21336
21710
|
* Returns the current fiber if called from within a fiber context,
|
|
21337
21711
|
* otherwise returns `undefined`.
|
|
21338
21712
|
*
|
|
@@ -22205,7 +22579,7 @@ const unsubscribe = (self) => uninterruptible(withFiber((state) => {
|
|
|
22205
22579
|
return forEach$1(takeAll$2(self.pollers), (d) => interruptWith(d, state.id), {
|
|
22206
22580
|
discard: true,
|
|
22207
22581
|
concurrency: "unbounded"
|
|
22208
|
-
}).pipe(tap(() => sync(() => {
|
|
22582
|
+
}).pipe(tap$1(() => sync(() => {
|
|
22209
22583
|
self.subscribers.delete(self.subscription);
|
|
22210
22584
|
self.subscription.unsubscribe();
|
|
22211
22585
|
self.replayWindow.close();
|
|
@@ -23014,7 +23388,7 @@ const offerAllUnsafe = (self, messages) => {
|
|
|
23014
23388
|
* @category completion
|
|
23015
23389
|
* @since 4.0.0
|
|
23016
23390
|
*/
|
|
23017
|
-
const failCause$
|
|
23391
|
+
const failCause$2 = /*#__PURE__*/ dual(2, (self, cause) => sync$2(() => failCauseUnsafe(self, cause)));
|
|
23018
23392
|
/**
|
|
23019
23393
|
* Fails the queue with a cause synchronously. If the queue is already done, `false` is
|
|
23020
23394
|
* returned.
|
|
@@ -23110,7 +23484,7 @@ const failCauseUnsafe = (self, cause) => {
|
|
|
23110
23484
|
* @category completion
|
|
23111
23485
|
* @since 4.0.0
|
|
23112
23486
|
*/
|
|
23113
|
-
const end = (self) => failCause$
|
|
23487
|
+
const end = (self) => failCause$2(self, causeFail(Done$1()));
|
|
23114
23488
|
/**
|
|
23115
23489
|
* Signals queue completion synchronously.
|
|
23116
23490
|
*
|
|
@@ -23898,7 +24272,7 @@ const ChannelProto = {
|
|
|
23898
24272
|
*/
|
|
23899
24273
|
const fromTransform$1 = (transform) => {
|
|
23900
24274
|
const self = Object.create(ChannelProto);
|
|
23901
|
-
self.transform = (upstream, scope) => catchCause$1(transform(upstream, scope), (cause) => succeed$4(failCause$
|
|
24275
|
+
self.transform = (upstream, scope) => catchCause$1(transform(upstream, scope), (cause) => succeed$4(failCause$3(cause)));
|
|
23902
24276
|
return self;
|
|
23903
24277
|
};
|
|
23904
24278
|
/**
|
|
@@ -24011,7 +24385,7 @@ const DefaultChunkSize = 4096;
|
|
|
24011
24385
|
const asyncQueue = (scope, f, options) => make$26({
|
|
24012
24386
|
capacity: options?.bufferSize,
|
|
24013
24387
|
strategy: options?.strategy
|
|
24014
|
-
}).pipe(tap((queue) => addFinalizer$1(scope, shutdown(queue))), tap((queue) => provide$3(f(queue), scope).pipe(catchCause$1((cause) => failCause$
|
|
24388
|
+
}).pipe(tap$1((queue) => addFinalizer$1(scope, shutdown(queue))), tap$1((queue) => provide$3(f(queue), scope).pipe(catchCause$1((cause) => failCause$2(queue, cause)), forkIn(scope))));
|
|
24015
24389
|
/**
|
|
24016
24390
|
* Creates a `Channel` that interacts with a callback function using a queue, emitting arrays.
|
|
24017
24391
|
*
|
|
@@ -24186,7 +24560,7 @@ const fromIterableArray = (iterable, chunkSize = DefaultChunkSize) => fromIterat
|
|
|
24186
24560
|
* @category constructors
|
|
24187
24561
|
* @since 2.0.0
|
|
24188
24562
|
*/
|
|
24189
|
-
const succeed$3 = (value) => fromEffect(succeed$4(value));
|
|
24563
|
+
const succeed$3 = (value) => fromEffect$1(succeed$4(value));
|
|
24190
24564
|
/**
|
|
24191
24565
|
* Represents a `Channel` that emits no elements.
|
|
24192
24566
|
*
|
|
@@ -24253,7 +24627,7 @@ const fail$2 = (error) => fromPull$1(succeed$4(fail$3(error)));
|
|
|
24253
24627
|
* @category constructors
|
|
24254
24628
|
* @since 2.0.0
|
|
24255
24629
|
*/
|
|
24256
|
-
const failCause = (cause) => fromPull$1(failCause$
|
|
24630
|
+
const failCause$1 = (cause) => fromPull$1(failCause$3(cause));
|
|
24257
24631
|
/**
|
|
24258
24632
|
* Constructs a channel that fails immediately with the specified defect.
|
|
24259
24633
|
*
|
|
@@ -24271,7 +24645,7 @@ const failCause = (cause) => fromPull$1(failCause$2(cause));
|
|
|
24271
24645
|
* @category constructors
|
|
24272
24646
|
* @since 4.0.0
|
|
24273
24647
|
*/
|
|
24274
|
-
const die = (defect) => failCause(die$
|
|
24648
|
+
const die$1 = (defect) => failCause$1(die$3(defect));
|
|
24275
24649
|
/**
|
|
24276
24650
|
* Uses an effect to write a single value to the channel.
|
|
24277
24651
|
*
|
|
@@ -24290,7 +24664,7 @@ const die = (defect) => failCause(die$2(defect));
|
|
|
24290
24664
|
* @category constructors
|
|
24291
24665
|
* @since 2.0.0
|
|
24292
24666
|
*/
|
|
24293
|
-
const fromEffect = (effect) => fromPull$1(sync(() => {
|
|
24667
|
+
const fromEffect$1 = (effect) => fromPull$1(sync(() => {
|
|
24294
24668
|
let done$19 = false;
|
|
24295
24669
|
return suspend$2(() => {
|
|
24296
24670
|
if (done$19) return done();
|
|
@@ -24613,7 +24987,7 @@ const readableStreamToPullUnsafe = (options) => {
|
|
|
24613
24987
|
try: () => reader.read(),
|
|
24614
24988
|
catch: options.onError
|
|
24615
24989
|
}), {
|
|
24616
|
-
onFailure: (cause) => exit.current ?? failCause$
|
|
24990
|
+
onFailure: (cause) => exit.current ?? failCause$3(cause),
|
|
24617
24991
|
onSuccess: ({ done: done$13, value }) => {
|
|
24618
24992
|
if (exit.current) return exit.current;
|
|
24619
24993
|
return done$13 ? done() : succeed$4(of(value));
|
|
@@ -24690,6 +25064,85 @@ const mapDone = /*#__PURE__*/ dual(2, (self, f) => mapDoneEffect(self, (o) => su
|
|
|
24690
25064
|
const mapDoneEffect = /*#__PURE__*/ dual(2, (self, f) => transformPull$1(self, (pull) => succeed$4(catchDone(pull, (done$15) => flatMap$2(f(done$15), done)))));
|
|
24691
25065
|
const concurrencyIsSequential = (concurrency) => concurrency === void 0 || concurrency !== "unbounded" && concurrency <= 1;
|
|
24692
25066
|
/**
|
|
25067
|
+
* Maps each output element with an effectful function, preserving the source
|
|
25068
|
+
* channel's done value.
|
|
25069
|
+
*
|
|
25070
|
+
* **When to use**
|
|
25071
|
+
*
|
|
25072
|
+
* Use when transforming each channel output needs an Effect, service
|
|
25073
|
+
* dependency, failure channel, or configured concurrency.
|
|
25074
|
+
*
|
|
25075
|
+
* **Details**
|
|
25076
|
+
*
|
|
25077
|
+
* The mapping function receives the output element and its zero-based index.
|
|
25078
|
+
* By default elements are mapped sequentially. Use `options.concurrency` to
|
|
25079
|
+
* map multiple elements concurrently, and `options.unordered` to allow
|
|
25080
|
+
* concurrently mapped outputs to be emitted as soon as they complete.
|
|
25081
|
+
*
|
|
25082
|
+
* **Example** (Mapping channel output with effects)
|
|
25083
|
+
*
|
|
25084
|
+
* ```ts import.meta.vitest
|
|
25085
|
+
* import { Channel, Effect } from "effect"
|
|
25086
|
+
*
|
|
25087
|
+
* const numbersChannel = Channel.fromIterable([1, 2, 3, 4, 5])
|
|
25088
|
+
* const processedChannel = Channel.mapEffect(
|
|
25089
|
+
* numbersChannel,
|
|
25090
|
+
* (n) => Effect.succeed(n * n)
|
|
25091
|
+
* )
|
|
25092
|
+
* await Effect.runPromise(Channel.runCollect(processedChannel)) // => [1, 4, 9, 16, 25]
|
|
25093
|
+
* ```
|
|
25094
|
+
*
|
|
25095
|
+
* @stability stable
|
|
25096
|
+
* @category sequencing
|
|
25097
|
+
* @since 2.0.0
|
|
25098
|
+
*/
|
|
25099
|
+
const mapEffect$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]), (self, f, options) => concurrencyIsSequential(options?.concurrency) ? mapEffectSequential(self, f) : mapEffectConcurrent(self, f, options));
|
|
25100
|
+
const mapEffectSequential = (self, f) => fromTransform$1((upstream, scope) => {
|
|
25101
|
+
let i = 0;
|
|
25102
|
+
return map$3(toTransform(self)(upstream, scope), flatMap$2((o) => f(o, i++)));
|
|
25103
|
+
});
|
|
25104
|
+
const mapEffectConcurrent = (self, f, options) => fromTransformBracket(fnUntraced(function* (upstream, scope, forkedScope) {
|
|
25105
|
+
let i = 0;
|
|
25106
|
+
const pull = yield* toTransform(self)(upstream, scope);
|
|
25107
|
+
const concurrencyN = options.concurrency === "unbounded" ? Number.MAX_SAFE_INTEGER : options.concurrency;
|
|
25108
|
+
const queue = yield* bounded(0);
|
|
25109
|
+
yield* addFinalizer$1(forkedScope, shutdown(queue));
|
|
25110
|
+
const runFork = runForkWith(yield* context());
|
|
25111
|
+
const trackFiber = runIn(forkedScope);
|
|
25112
|
+
if (options.unordered) {
|
|
25113
|
+
const semaphore = makeUnsafe$1(concurrencyN);
|
|
25114
|
+
const release = constant(semaphore.release(1));
|
|
25115
|
+
const handle = matchCauseEffect({
|
|
25116
|
+
onFailure: (cause) => flatMap$2(failCause$2(queue, cause), release),
|
|
25117
|
+
onSuccess: (value) => flatMap$2(offer(queue, value), release)
|
|
25118
|
+
});
|
|
25119
|
+
yield* semaphore.take(1).pipe(flatMap$2(() => pull), flatMap$2((value) => {
|
|
25120
|
+
const index = i++;
|
|
25121
|
+
trackFiber(runFork(handle(suspend$2(() => f(value, index)))));
|
|
25122
|
+
return void_$1;
|
|
25123
|
+
}), forever({ disableYield: true }), catchCause$1((cause) => semaphore.withPermits(concurrencyN - 1)(failCause$2(queue, cause))), forkIn(forkedScope));
|
|
25124
|
+
} else {
|
|
25125
|
+
const effects = yield* bounded(concurrencyN - 2);
|
|
25126
|
+
yield* addFinalizer$1(forkedScope, shutdown(effects));
|
|
25127
|
+
yield* take$1(effects).pipe(flatten$2, flatMap$2((value) => offer(queue, value)), forever({ disableYield: true }), catchCause$1((cause) => failCause$2(queue, cause)), forkIn(forkedScope));
|
|
25128
|
+
let errorCause;
|
|
25129
|
+
const onExit = (exit) => {
|
|
25130
|
+
if (exit._tag === "Success") return;
|
|
25131
|
+
errorCause = exit.cause;
|
|
25132
|
+
failCauseUnsafe(queue, exit.cause);
|
|
25133
|
+
};
|
|
25134
|
+
yield* pull.pipe(flatMap$2((value) => {
|
|
25135
|
+
if (errorCause) return failCause$3(errorCause);
|
|
25136
|
+
const index = i++;
|
|
25137
|
+
const fiber = runFork(suspend$2(() => f(value, index)));
|
|
25138
|
+
trackFiber(fiber);
|
|
25139
|
+
fiber.addObserver(onExit);
|
|
25140
|
+
return offer(effects, join(fiber));
|
|
25141
|
+
}), forever({ disableYield: true }), catchCause$1((cause) => offer(effects, failCause$4(cause)).pipe(andThen(failCause$2(effects, cause)))), forkIn(forkedScope));
|
|
25142
|
+
}
|
|
25143
|
+
return take$1(queue);
|
|
25144
|
+
}));
|
|
25145
|
+
/**
|
|
24693
25146
|
* Maps each output element to a channel and flattens the child channel
|
|
24694
25147
|
* outputs.
|
|
24695
25148
|
*
|
|
@@ -24746,7 +25199,7 @@ const flatMapSequential = (self, f) => fromTransform$1((upstream, scope) => map$
|
|
|
24746
25199
|
});
|
|
24747
25200
|
return suspend$2(() => childPull ?? makePull);
|
|
24748
25201
|
}));
|
|
24749
|
-
const flatMapConcurrent = (self, f, options) => self.pipe(map$2(f), mergeAll(options));
|
|
25202
|
+
const flatMapConcurrent = (self, f, options) => self.pipe(map$2(f), mergeAll$1(options));
|
|
24750
25203
|
/**
|
|
24751
25204
|
* Flattens a channel of channels.
|
|
24752
25205
|
*
|
|
@@ -24776,7 +25229,7 @@ const flatMapConcurrent = (self, f, options) => self.pipe(map$2(f), mergeAll(opt
|
|
|
24776
25229
|
* @category constructors
|
|
24777
25230
|
* @since 2.0.0
|
|
24778
25231
|
*/
|
|
24779
|
-
const flatten = (channels) => flatMap$1(channels, identity);
|
|
25232
|
+
const flatten$1 = (channels) => flatMap$1(channels, identity);
|
|
24780
25233
|
/**
|
|
24781
25234
|
* Flattens a channel that outputs arrays into a channel that outputs individual elements.
|
|
24782
25235
|
*
|
|
@@ -24918,7 +25371,7 @@ const mapAccum$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]), (self, initi
|
|
|
24918
25371
|
onFailure(cause_) {
|
|
24919
25372
|
cause = cause_;
|
|
24920
25373
|
const b = options?.onHalt && options.onHalt(state);
|
|
24921
|
-
return b && b.length > 0 ? succeed$4([state, b]) : failCause$
|
|
25374
|
+
return b && b.length > 0 ? succeed$4([state, b]) : failCause$3(cause_);
|
|
24922
25375
|
},
|
|
24923
25376
|
onSuccess(a) {
|
|
24924
25377
|
const b = f(state, a);
|
|
@@ -24927,7 +25380,7 @@ const mapAccum$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]), (self, initi
|
|
|
24927
25380
|
});
|
|
24928
25381
|
return suspend$2(function loop() {
|
|
24929
25382
|
if (current === void 0) {
|
|
24930
|
-
if (cause) return failCause$
|
|
25383
|
+
if (cause) return failCause$3(cause);
|
|
24931
25384
|
return flatMap$2(pullNext, ([newState, values]) => {
|
|
24932
25385
|
state = newState;
|
|
24933
25386
|
if (values.length === 0) return loop();
|
|
@@ -24985,10 +25438,10 @@ const catchCause = /*#__PURE__*/ dual(2, (self, f) => fromTransform$1((upstream,
|
|
|
24985
25438
|
let forkedScope = forkUnsafe(scope);
|
|
24986
25439
|
return map$3(toTransform(self)(upstream, forkedScope), (pull) => {
|
|
24987
25440
|
let currentPull = pull.pipe(catchCause$1((cause) => {
|
|
24988
|
-
if (isDoneCause(cause)) return failCause$
|
|
25441
|
+
if (isDoneCause(cause)) return failCause$3(cause);
|
|
24989
25442
|
const toClose = forkedScope;
|
|
24990
25443
|
forkedScope = forkUnsafe(scope);
|
|
24991
|
-
return close(toClose, failCause$
|
|
25444
|
+
return close(toClose, failCause$4(cause)).pipe(andThen(toTransform(f(cause))(upstream, forkedScope)), flatMap$2((childPull) => {
|
|
24992
25445
|
currentPull = childPull;
|
|
24993
25446
|
return childPull;
|
|
24994
25447
|
}));
|
|
@@ -25021,9 +25474,78 @@ const catchCause = /*#__PURE__*/ dual(2, (self, f) => fromTransform$1((upstream,
|
|
|
25021
25474
|
*/
|
|
25022
25475
|
const catchCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause(self, (cause) => {
|
|
25023
25476
|
const result = filter(cause);
|
|
25024
|
-
return isFailure$1(result) ? failCause(result.failure) : f(result.success, cause);
|
|
25477
|
+
return isFailure$1(result) ? failCause$1(result.failure) : f(result.success, cause);
|
|
25478
|
+
}));
|
|
25479
|
+
const catch_$1 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findError, (e) => f(e)));
|
|
25480
|
+
/**
|
|
25481
|
+
* Recovers from typed channel errors selected by a `Filter`.
|
|
25482
|
+
*
|
|
25483
|
+
* **When to use**
|
|
25484
|
+
*
|
|
25485
|
+
* Use to recover from channel errors with a reusable `Filter` when matching
|
|
25486
|
+
* can also narrow or transform the error before choosing the recovery channel.
|
|
25487
|
+
*
|
|
25488
|
+
* **Details**
|
|
25489
|
+
*
|
|
25490
|
+
* Successful filter results are handled by the recovery function. Failed
|
|
25491
|
+
* filter results are handled by `orElse` when provided. Without `orElse`,
|
|
25492
|
+
* failed filter results are re-failed.
|
|
25493
|
+
*
|
|
25494
|
+
* @see {@link catchIf} for selecting typed errors with a predicate
|
|
25495
|
+
* @see {@link catchTag} for selecting tagged typed errors
|
|
25496
|
+
* @see {@link catchCauseFilter} for selecting full causes with a `Filter`
|
|
25497
|
+
*
|
|
25498
|
+
* @stability stable
|
|
25499
|
+
* @category error handling
|
|
25500
|
+
* @since 4.0.0
|
|
25501
|
+
*/
|
|
25502
|
+
const catchFilter$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]), (self, filter, f, orElse) => catch_$1(self, (err) => {
|
|
25503
|
+
const result = filter(err);
|
|
25504
|
+
return isFailure$1(result) ? orElse ? orElse(result.failure) : fail$2(result.failure) : f(result.success);
|
|
25505
|
+
}));
|
|
25506
|
+
/**
|
|
25507
|
+
* Catches a specific reason within a tagged error.
|
|
25508
|
+
*
|
|
25509
|
+
* **Example** (Recovering from nested reasons)
|
|
25510
|
+
*
|
|
25511
|
+
* ```ts import.meta.vitest
|
|
25512
|
+
* import { Channel, Data, Effect } from "effect"
|
|
25513
|
+
*
|
|
25514
|
+
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
25515
|
+
* retryAfter: number
|
|
25516
|
+
* }> {}
|
|
25517
|
+
*
|
|
25518
|
+
* class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{
|
|
25519
|
+
* limit: number
|
|
25520
|
+
* }> {}
|
|
25521
|
+
*
|
|
25522
|
+
* class AiError extends Data.TaggedError("AiError")<{
|
|
25523
|
+
* reason: RateLimitError | QuotaExceededError
|
|
25524
|
+
* }> {}
|
|
25525
|
+
*
|
|
25526
|
+
* const reason = new RateLimitError({ retryAfter: 60 })
|
|
25527
|
+
* const channel = Channel.fail(new AiError({ reason }))
|
|
25528
|
+
*
|
|
25529
|
+
* const recovered = channel.pipe(
|
|
25530
|
+
* Channel.catchReason("AiError", "RateLimitError", (reason) =>
|
|
25531
|
+
* Channel.succeed(`retry: ${reason.retryAfter}`)
|
|
25532
|
+
* )
|
|
25533
|
+
* )
|
|
25534
|
+
* Effect.runSync(Channel.runCollect(recovered)) // => ["retry: 60"]
|
|
25535
|
+
* ```
|
|
25536
|
+
*
|
|
25537
|
+
* @stability stable
|
|
25538
|
+
* @category error handling
|
|
25539
|
+
* @since 4.0.0
|
|
25540
|
+
*/
|
|
25541
|
+
const catchReason$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]), (self, errorTag, reasonTag, f, orElse) => catch_$1(self, (error) => {
|
|
25542
|
+
if (isTagged(error, errorTag) && hasProperty(error, "reason")) {
|
|
25543
|
+
const reason = error.reason;
|
|
25544
|
+
if (isTagged(reason, reasonTag)) return f(reason, error);
|
|
25545
|
+
return orElse ? orElse(reason, error) : fail$2(error);
|
|
25546
|
+
}
|
|
25547
|
+
return fail$2(error);
|
|
25025
25548
|
}));
|
|
25026
|
-
const catch_ = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findError, (e) => f(e)));
|
|
25027
25549
|
/**
|
|
25028
25550
|
* Returns a new channel, which is the same as this one, except the failure
|
|
25029
25551
|
* value of the returned channel is created by applying the specified function
|
|
@@ -25033,7 +25555,7 @@ const catch_ = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findErr
|
|
|
25033
25555
|
* @category error handling
|
|
25034
25556
|
* @since 2.0.0
|
|
25035
25557
|
*/
|
|
25036
|
-
const mapError$1 = /*#__PURE__*/ dual(2, (self, f) => catch_(self, (err) => fail$2(f(err))));
|
|
25558
|
+
const mapError$1 = /*#__PURE__*/ dual(2, (self, f) => catch_$1(self, (err) => fail$2(f(err))));
|
|
25037
25559
|
/**
|
|
25038
25560
|
* Converts all errors in the channel to defects (unrecoverable failures).
|
|
25039
25561
|
* This is useful when you want to treat errors as programming errors.
|
|
@@ -25061,7 +25583,7 @@ const mapError$1 = /*#__PURE__*/ dual(2, (self, f) => catch_(self, (err) => fail
|
|
|
25061
25583
|
* @category error handling
|
|
25062
25584
|
* @since 2.0.0
|
|
25063
25585
|
*/
|
|
25064
|
-
const orDie$1 = (self) => catch_(self, die);
|
|
25586
|
+
const orDie$1 = (self) => catch_$1(self, die$1);
|
|
25065
25587
|
/**
|
|
25066
25588
|
* Merges multiple channels with specified concurrency and buffering options.
|
|
25067
25589
|
*
|
|
@@ -25099,7 +25621,7 @@ const orDie$1 = (self) => catch_(self, die);
|
|
|
25099
25621
|
* @category combining
|
|
25100
25622
|
* @since 2.0.0
|
|
25101
25623
|
*/
|
|
25102
|
-
const mergeAll = /*#__PURE__*/ dual(2, (channels, { bufferSize = 16, concurrency, switch: switch_ = false }) => fromTransformBracket(fnUntraced(function* (upstream, scope, forkedScope) {
|
|
25624
|
+
const mergeAll$1 = /*#__PURE__*/ dual(2, (channels, { bufferSize = 16, concurrency, switch: switch_ = false }) => fromTransformBracket(fnUntraced(function* (upstream, scope, forkedScope) {
|
|
25103
25625
|
const concurrencyN = concurrency === "unbounded" ? Number.MAX_SAFE_INTEGER : Math.max(1, concurrency);
|
|
25104
25626
|
const semaphore = switch_ ? void 0 : makeUnsafe$1(concurrencyN);
|
|
25105
25627
|
const doneLatch = yield* make$30(true);
|
|
@@ -25126,12 +25648,12 @@ const mergeAll = /*#__PURE__*/ dual(2, (channels, { bufferSize = 16, concurrency
|
|
|
25126
25648
|
if (fibers.size === 0) yield* doneLatch.open;
|
|
25127
25649
|
yield* interrupt(fiber);
|
|
25128
25650
|
}
|
|
25129
|
-
const fiber = yield* childPull.pipe(tap(() => yieldNow), flatMap$2((value) => offer(queue, value)), forever({ disableYield: true }), onError(fnUntraced(function* (cause) {
|
|
25651
|
+
const fiber = yield* childPull.pipe(tap$1(() => yieldNow), flatMap$2((value) => offer(queue, value)), forever({ disableYield: true }), onError(fnUntraced(function* (cause) {
|
|
25130
25652
|
const exit$2 = doneExitFromCause(cause);
|
|
25131
25653
|
const closeExit = yield* exit(close(childScope, exit$2));
|
|
25132
25654
|
if (!fibers.has(fiber)) return;
|
|
25133
25655
|
const failure = asVoidAll([exit$2, closeExit]);
|
|
25134
|
-
if (isFailure(failure)) yield* failCause$
|
|
25656
|
+
if (isFailure(failure)) yield* failCause$2(queue, failure.cause);
|
|
25135
25657
|
fibers.delete(fiber);
|
|
25136
25658
|
if (semaphore) yield* semaphore.release(1);
|
|
25137
25659
|
if (fibers.size === 0) yield* doneLatch.open;
|
|
@@ -25141,8 +25663,8 @@ const mergeAll = /*#__PURE__*/ dual(2, (channels, { bufferSize = 16, concurrency
|
|
|
25141
25663
|
}
|
|
25142
25664
|
}).pipe(catchCause$1((cause) => {
|
|
25143
25665
|
const halt = filterDone(cause);
|
|
25144
|
-
if (isSuccess$1(halt)) return doneLatch.whenOpen(failCause$
|
|
25145
|
-
return failCause$
|
|
25666
|
+
if (isSuccess$1(halt)) return doneLatch.whenOpen(failCause$2(queue, cause));
|
|
25667
|
+
return failCause$2(queue, cause);
|
|
25146
25668
|
}), forkIn(forkedScope));
|
|
25147
25669
|
return take$1(queue);
|
|
25148
25670
|
})));
|
|
@@ -25177,12 +25699,12 @@ const merge$2 = /*#__PURE__*/ dual((args) => isChannel(args[0]) && isChannel(arg
|
|
|
25177
25699
|
let done = 0;
|
|
25178
25700
|
function onExit(side, cause) {
|
|
25179
25701
|
done++;
|
|
25180
|
-
if (!isDoneCause(cause)) return failCause$
|
|
25702
|
+
if (!isDoneCause(cause)) return failCause$2(queue, cause);
|
|
25181
25703
|
switch (strategy) {
|
|
25182
|
-
case "both": return done === 2 ? failCause$
|
|
25704
|
+
case "both": return done === 2 ? failCause$2(queue, cause) : void_$1;
|
|
25183
25705
|
case "left":
|
|
25184
|
-
case "right": return side === strategy ? failCause$
|
|
25185
|
-
case "either": return failCause$
|
|
25706
|
+
case "right": return side === strategy ? failCause$2(queue, cause) : void_$1;
|
|
25707
|
+
case "either": return failCause$2(queue, cause);
|
|
25186
25708
|
}
|
|
25187
25709
|
}
|
|
25188
25710
|
const runSide = (side, channel, scope) => toTransform(channel)(upstream, scope).pipe(flatMap$2((pull) => pull.pipe(flatMap$2((value) => offer(queue, value)), forever)), onError((cause) => onExitPrimitive(doneExitFromCause(cause), (exit) => close(scope, exit)).pipe(matchCauseEffect({
|
|
@@ -25271,7 +25793,7 @@ const splitLines$1 = () => fromTransform$1((upstream, _scope) => sync(() => {
|
|
|
25271
25793
|
if (done$14._tag === "Some") return done(done$14.value);
|
|
25272
25794
|
return matchEffect$1(upstream, {
|
|
25273
25795
|
onSuccess: loop,
|
|
25274
|
-
onFailure: failCause$
|
|
25796
|
+
onFailure: failCause$3,
|
|
25275
25797
|
onDone: (leftover) => {
|
|
25276
25798
|
done$14 = some$1(leftover);
|
|
25277
25799
|
if (stringBuilder.length > 0) {
|
|
@@ -25350,8 +25872,8 @@ const pipeTo = /*#__PURE__*/ dual(2, (self, that) => fromTransform$1((upstream,
|
|
|
25350
25872
|
* @since 2.0.0
|
|
25351
25873
|
*/
|
|
25352
25874
|
const pipeToOrFail = /*#__PURE__*/ dual(2, (self, that) => fromTransform$1((upstream, scope) => flatMap$2(toTransform(self)(upstream, scope), (upstream) => {
|
|
25353
|
-
const upstreamPull = catchCause$1(upstream, (cause) => isDoneCause(cause) ? failCause$
|
|
25354
|
-
return map$3(toTransform(that)(upstreamPull, scope), (pull) => catchDefect(pull, (defect) => isDone(defect) ? failCause$
|
|
25875
|
+
const upstreamPull = catchCause$1(upstream, (cause) => isDoneCause(cause) ? failCause$3(cause) : die$2(Done(cause)));
|
|
25876
|
+
return map$3(toTransform(that)(upstreamPull, scope), (pull) => catchDefect(pull, (defect) => isDone(defect) ? failCause$3(defect.value) : die$2(defect)));
|
|
25355
25877
|
})));
|
|
25356
25878
|
/**
|
|
25357
25879
|
* Constructs a `Channel` from a scoped effect that will result in a
|
|
@@ -25419,6 +25941,20 @@ const unwrap$3 = (channel) => fromTransform$1((upstream, scope) => {
|
|
|
25419
25941
|
*/
|
|
25420
25942
|
const onExit = /*#__PURE__*/ dual(2, (self, finalizer) => fromTransformBracket((upstream, scope, forkedScope) => addFinalizerExit(forkedScope, finalizer).pipe(andThen(toTransform(self)(upstream, scope)))));
|
|
25421
25943
|
/**
|
|
25944
|
+
* Runs an effect when the channel completes successfully.
|
|
25945
|
+
*
|
|
25946
|
+
* **Details**
|
|
25947
|
+
*
|
|
25948
|
+
* The effect runs before the original done value is propagated. The effect is
|
|
25949
|
+
* not run when the channel fails. If the effect fails, the returned channel
|
|
25950
|
+
* fails with that error.
|
|
25951
|
+
*
|
|
25952
|
+
* @stability stable
|
|
25953
|
+
* @category hooks
|
|
25954
|
+
* @since 4.0.0
|
|
25955
|
+
*/
|
|
25956
|
+
const onEnd$1 = /*#__PURE__*/ dual(2, (self, onEnd) => transformPull$1(self, (pull) => succeed$4(catchDone(pull, (leftover) => flatMap$2(onEnd, () => done(leftover))))));
|
|
25957
|
+
/**
|
|
25422
25958
|
* Returns a channel with a finalizer effect that is guaranteed to run once the
|
|
25423
25959
|
* channel begins execution, whether it succeeds or fails.
|
|
25424
25960
|
*
|
|
@@ -25463,6 +25999,15 @@ const runWith = (self, f, onHalt) => suspend$2(() => {
|
|
|
25463
25999
|
*/
|
|
25464
26000
|
const provideContext$1 = /*#__PURE__*/ dual(2, (self, context) => fromTransform$1((upstream, scope) => map$3(provideContext$2(toTransform(self)(upstream, scope), context), provideContext$2(context))));
|
|
25465
26001
|
/**
|
|
26002
|
+
* Provides a concrete service for a context key, removing that service
|
|
26003
|
+
* requirement from the returned channel.
|
|
26004
|
+
*
|
|
26005
|
+
* @stability stable
|
|
26006
|
+
* @category providing services
|
|
26007
|
+
* @since 2.0.0
|
|
26008
|
+
*/
|
|
26009
|
+
const provideService$1 = /*#__PURE__*/ dual(3, (self, key, service) => fromTransform$1((upstream, scope) => map$3(provideService$2(toTransform(self)(upstream, scope), key, service), provideService$2(key, service))));
|
|
26010
|
+
/**
|
|
25466
26011
|
* Runs a channel and applies an effect to each output element.
|
|
25467
26012
|
*
|
|
25468
26013
|
* **Example** (Running effects for each output)
|
|
@@ -25819,6 +26364,47 @@ const take = (n) => {
|
|
|
25819
26364
|
});
|
|
25820
26365
|
};
|
|
25821
26366
|
/**
|
|
26367
|
+
* A sink that reduces its inputs using the provided function `f` starting from
|
|
26368
|
+
* the specified `initial` state.
|
|
26369
|
+
*
|
|
26370
|
+
* @stability stable
|
|
26371
|
+
* @category folding
|
|
26372
|
+
* @since 4.0.0
|
|
26373
|
+
*/
|
|
26374
|
+
const reduceArray = (initial, f) => fromTransform((upstream) => {
|
|
26375
|
+
let state = initial();
|
|
26376
|
+
return upstream.pipe(flatMap$2((arr) => {
|
|
26377
|
+
state = f(state, arr);
|
|
26378
|
+
return void_$1;
|
|
26379
|
+
}), forever({ disableYield: true }), catchDone(() => succeed$4([state])));
|
|
26380
|
+
});
|
|
26381
|
+
const last_ = /*#__PURE__*/ reduceArray(none, (_, arr) => last$1(arr));
|
|
26382
|
+
/**
|
|
26383
|
+
* Creates a sink containing the last value.
|
|
26384
|
+
*
|
|
26385
|
+
* **When to use**
|
|
26386
|
+
*
|
|
26387
|
+
* Use when you need to consume all upstream input and keep only the final
|
|
26388
|
+
* element.
|
|
26389
|
+
*
|
|
26390
|
+
* **Details**
|
|
26391
|
+
*
|
|
26392
|
+
* Returns `Option.some(last)` with the final input value, or `Option.none` when
|
|
26393
|
+
* the upstream ends without input.
|
|
26394
|
+
*
|
|
26395
|
+
* **Gotchas**
|
|
26396
|
+
*
|
|
26397
|
+
* This sink produces a result only when the upstream ends, so it does not
|
|
26398
|
+
* complete for a stream that does not end.
|
|
26399
|
+
*
|
|
26400
|
+
* @see {@link head} for taking the first input value instead
|
|
26401
|
+
*
|
|
26402
|
+
* @stability stable
|
|
26403
|
+
* @category constructors
|
|
26404
|
+
* @since 2.0.0
|
|
26405
|
+
*/
|
|
26406
|
+
const last = () => last_;
|
|
26407
|
+
/**
|
|
25822
26408
|
* A sink that executes the provided effectful function for every item fed
|
|
25823
26409
|
* to it.
|
|
25824
26410
|
*
|
|
@@ -26168,6 +26754,23 @@ const isStream = (u) => hasProperty(u, TypeId$20);
|
|
|
26168
26754
|
*/
|
|
26169
26755
|
const fromChannel = fromChannel$2;
|
|
26170
26756
|
/**
|
|
26757
|
+
* Creates a stream from an effect.
|
|
26758
|
+
*
|
|
26759
|
+
* **Example** (Creating a stream from an effect)
|
|
26760
|
+
*
|
|
26761
|
+
* ```ts import.meta.vitest
|
|
26762
|
+
* import { Effect, Stream } from "effect"
|
|
26763
|
+
*
|
|
26764
|
+
* const stream = Stream.fromEffect(Effect.succeed(42))
|
|
26765
|
+
* await Effect.runPromise(Stream.runCollect(stream)) // => [42]
|
|
26766
|
+
* ```
|
|
26767
|
+
*
|
|
26768
|
+
* @stability stable
|
|
26769
|
+
* @category constructors
|
|
26770
|
+
* @since 2.0.0
|
|
26771
|
+
*/
|
|
26772
|
+
const fromEffect = (effect) => fromChannel(fromEffect$1(map$3(effect, of)));
|
|
26773
|
+
/**
|
|
26171
26774
|
* Creates a stream from a pull effect, such as one produced by `Stream.toPull`.
|
|
26172
26775
|
*
|
|
26173
26776
|
* **Details**
|
|
@@ -26340,6 +26943,45 @@ const suspend = (stream) => fromChannel(suspend$1(() => stream().channel));
|
|
|
26340
26943
|
*/
|
|
26341
26944
|
const fail$1 = (error) => fromChannel(fail$2(error));
|
|
26342
26945
|
/**
|
|
26946
|
+
* Creates a stream that fails with the specified `Cause`.
|
|
26947
|
+
*
|
|
26948
|
+
* **Example** (Failing with a cause)
|
|
26949
|
+
*
|
|
26950
|
+
* ```ts import.meta.vitest
|
|
26951
|
+
* import { Cause, Effect, Stream } from "effect"
|
|
26952
|
+
*
|
|
26953
|
+
* const stream = Stream.failCause(Cause.fail("Database connection failed")).pipe(
|
|
26954
|
+
* Stream.catchCause(() => Stream.succeed("recovered"))
|
|
26955
|
+
* )
|
|
26956
|
+
*
|
|
26957
|
+
* await Effect.runPromise(Stream.runCollect(stream)) // => ["recovered"]
|
|
26958
|
+
* ```
|
|
26959
|
+
*
|
|
26960
|
+
* @stability stable
|
|
26961
|
+
* @category constructors
|
|
26962
|
+
* @since 2.0.0
|
|
26963
|
+
*/
|
|
26964
|
+
const failCause = (cause) => fromChannel(failCause$1(cause));
|
|
26965
|
+
/**
|
|
26966
|
+
* The stream that dies with the specified defect.
|
|
26967
|
+
*
|
|
26968
|
+
* **Example** (Dying with a defect)
|
|
26969
|
+
*
|
|
26970
|
+
* ```ts import.meta.vitest
|
|
26971
|
+
* import { Cause, Effect, Exit, Stream } from "effect"
|
|
26972
|
+
*
|
|
26973
|
+
* const defect = new Error("Boom")
|
|
26974
|
+
* const stream = Stream.die(defect)
|
|
26975
|
+
*
|
|
26976
|
+
* await Effect.runPromise(Effect.exit(Stream.runCollect(stream))) // => Exit.failCause(Cause.die(defect))
|
|
26977
|
+
* ```
|
|
26978
|
+
*
|
|
26979
|
+
* @stability stable
|
|
26980
|
+
* @category constructors
|
|
26981
|
+
* @since 2.0.0
|
|
26982
|
+
*/
|
|
26983
|
+
const die = (defect) => fromChannel(die$1(defect));
|
|
26984
|
+
/**
|
|
26343
26985
|
* Creates a new `Stream` from an iterable collection of values.
|
|
26344
26986
|
*
|
|
26345
26987
|
* **Details**
|
|
@@ -26544,6 +27186,131 @@ const map$1 = /*#__PURE__*/ dual(2, (self, f) => suspend(() => {
|
|
|
26544
27186
|
return fromChannel(map$2(self.channel, map$6((o) => f(o, i++))));
|
|
26545
27187
|
}));
|
|
26546
27188
|
/**
|
|
27189
|
+
* Transforms each emitted chunk using the provided function, which receives the chunk and its index.
|
|
27190
|
+
*
|
|
27191
|
+
* **Example** (Mapping stream chunks)
|
|
27192
|
+
*
|
|
27193
|
+
* ```ts import.meta.vitest
|
|
27194
|
+
* import { Array, Effect, Stream } from "effect"
|
|
27195
|
+
*
|
|
27196
|
+
* const program = Effect.gen(function*() {
|
|
27197
|
+
* const result = yield* Stream.make(1, 2, 3, 4).pipe(
|
|
27198
|
+
* Stream.rechunk(2),
|
|
27199
|
+
* Stream.mapArray((chunk, index) => Array.map(chunk, (n) => n + index)),
|
|
27200
|
+
* Stream.runCollect
|
|
27201
|
+
* )
|
|
27202
|
+
* result // => [ 1, 2, 4, 5 ]
|
|
27203
|
+
* })
|
|
27204
|
+
*
|
|
27205
|
+
* await Effect.runPromise(program)
|
|
27206
|
+
* ```
|
|
27207
|
+
*
|
|
27208
|
+
* @stability stable
|
|
27209
|
+
* @category mapping
|
|
27210
|
+
* @since 4.0.0
|
|
27211
|
+
*/
|
|
27212
|
+
const mapArray = /*#__PURE__*/ dual(2, (self, f) => fromChannel(map$2(self.channel, f)));
|
|
27213
|
+
/**
|
|
27214
|
+
* Maps over elements of the stream with the specified effectful function.
|
|
27215
|
+
*
|
|
27216
|
+
* **When to use**
|
|
27217
|
+
*
|
|
27218
|
+
* Use when each stream element transformation needs an Effect, service
|
|
27219
|
+
* dependency, failure channel, or configured concurrency.
|
|
27220
|
+
*
|
|
27221
|
+
* **Example** (Effectfully mapping stream values)
|
|
27222
|
+
*
|
|
27223
|
+
* ```ts import.meta.vitest
|
|
27224
|
+
* import { Effect, Stream } from "effect"
|
|
27225
|
+
*
|
|
27226
|
+
* const events: Array<string> = []
|
|
27227
|
+
* const stream = Stream.make(1, 2, 3)
|
|
27228
|
+
*
|
|
27229
|
+
* const mappedStream = stream.pipe(
|
|
27230
|
+
* Stream.mapEffect((n) =>
|
|
27231
|
+
* Effect.sync(() => {
|
|
27232
|
+
* events.push(`Processing: ${n}`)
|
|
27233
|
+
* return n * 2
|
|
27234
|
+
* })
|
|
27235
|
+
* )
|
|
27236
|
+
* )
|
|
27237
|
+
*
|
|
27238
|
+
* const program = Effect.gen(function*() {
|
|
27239
|
+
* const result = yield* Stream.runCollect(mappedStream)
|
|
27240
|
+
* result // => [2, 4, 6]
|
|
27241
|
+
* })
|
|
27242
|
+
*
|
|
27243
|
+
* await Effect.runPromise(program)
|
|
27244
|
+
* events // => ["Processing: 1", "Processing: 2", "Processing: 3"]
|
|
27245
|
+
* ```
|
|
27246
|
+
*
|
|
27247
|
+
* @stability stable
|
|
27248
|
+
* @category mapping
|
|
27249
|
+
* @since 2.0.0
|
|
27250
|
+
*/
|
|
27251
|
+
const mapEffect = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, f, options) => self.channel.pipe(flattenArray, mapEffect$1(f, options), map$2(of), fromChannel));
|
|
27252
|
+
/**
|
|
27253
|
+
* Maps over non-empty array chunks emitted by the stream effectfully.
|
|
27254
|
+
*
|
|
27255
|
+
* **When to use**
|
|
27256
|
+
*
|
|
27257
|
+
* Use when transformation needs to see and replace each non-empty emitted chunk
|
|
27258
|
+
* effectfully instead of mapping individual stream elements.
|
|
27259
|
+
*
|
|
27260
|
+
* **Example** (Effectfully mapping stream chunks)
|
|
27261
|
+
*
|
|
27262
|
+
* ```ts import.meta.vitest
|
|
27263
|
+
* import { Array, Effect, Stream } from "effect"
|
|
27264
|
+
*
|
|
27265
|
+
* const program = Effect.gen(function*() {
|
|
27266
|
+
* const result = yield* Stream.fromArray([1, 2, 3, 4]).pipe(
|
|
27267
|
+
* Stream.rechunk(2),
|
|
27268
|
+
* Stream.mapArrayEffect((chunk, index) =>
|
|
27269
|
+
* Effect.succeed(Array.map(chunk, (n) => n + index * 10))
|
|
27270
|
+
* ),
|
|
27271
|
+
* Stream.runCollect
|
|
27272
|
+
* )
|
|
27273
|
+
* result // => [ 1, 2, 13, 14 ]
|
|
27274
|
+
* })
|
|
27275
|
+
*
|
|
27276
|
+
* await Effect.runPromise(program)
|
|
27277
|
+
* ```
|
|
27278
|
+
*
|
|
27279
|
+
* @stability stable
|
|
27280
|
+
* @category mapping
|
|
27281
|
+
* @since 4.0.0
|
|
27282
|
+
*/
|
|
27283
|
+
const mapArrayEffect = /*#__PURE__*/ dual(2, (self, f) => fromChannel(mapEffect$1(self.channel, f)));
|
|
27284
|
+
/**
|
|
27285
|
+
* Runs the provided effect for each element while preserving the elements.
|
|
27286
|
+
*
|
|
27287
|
+
* **Example** (Tapping stream values)
|
|
27288
|
+
*
|
|
27289
|
+
* ```ts import.meta.vitest
|
|
27290
|
+
* import { Effect, Stream } from "effect"
|
|
27291
|
+
*
|
|
27292
|
+
* const events: Array<string> = []
|
|
27293
|
+
* const program = Effect.gen(function*() {
|
|
27294
|
+
* const result = yield* Stream.fromArray([1, 2, 3]).pipe(
|
|
27295
|
+
* Stream.tap((n) => Effect.sync(() => events.push(`before mapping: ${n}`))),
|
|
27296
|
+
* Stream.map((n) => n * 2),
|
|
27297
|
+
* Stream.tap((n) => Effect.sync(() => events.push(`after mapping: ${n}`))),
|
|
27298
|
+
* Stream.runCollect
|
|
27299
|
+
* )
|
|
27300
|
+
*
|
|
27301
|
+
* result // => [2, 4, 6]
|
|
27302
|
+
* })
|
|
27303
|
+
*
|
|
27304
|
+
* await Effect.runPromise(program)
|
|
27305
|
+
* events // => ["before mapping: 1", "after mapping: 2", "before mapping: 2", "after mapping: 4", "before mapping: 3", "after mapping: 6"]
|
|
27306
|
+
* ```
|
|
27307
|
+
*
|
|
27308
|
+
* @stability stable
|
|
27309
|
+
* @category sequencing
|
|
27310
|
+
* @since 2.0.0
|
|
27311
|
+
*/
|
|
27312
|
+
const tap = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, f, options) => mapEffect(self, (a) => as(f(a), a), options));
|
|
27313
|
+
/**
|
|
26547
27314
|
* Maps each element to a stream and flattens the resulting streams.
|
|
26548
27315
|
*
|
|
26549
27316
|
* **Details**
|
|
@@ -26575,6 +27342,62 @@ const map$1 = /*#__PURE__*/ dual(2, (self, f) => suspend(() => {
|
|
|
26575
27342
|
*/
|
|
26576
27343
|
const flatMap = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, f, options) => self.channel.pipe(flattenArray, flatMap$1((a) => f(a).channel, options), fromChannel));
|
|
26577
27344
|
/**
|
|
27345
|
+
* Flattens a stream of streams into a single stream.
|
|
27346
|
+
*
|
|
27347
|
+
* **Details**
|
|
27348
|
+
*
|
|
27349
|
+
* With the default sequential concurrency, inner streams are concatenated in
|
|
27350
|
+
* strict order. When `concurrency` is greater than `1` or `"unbounded"`,
|
|
27351
|
+
* multiple inner streams may run at the same time and their outputs are merged
|
|
27352
|
+
* as they arrive.
|
|
27353
|
+
*
|
|
27354
|
+
* **Example** (Flattening nested streams)
|
|
27355
|
+
*
|
|
27356
|
+
* ```ts import.meta.vitest
|
|
27357
|
+
* import { Effect, Stream } from "effect"
|
|
27358
|
+
*
|
|
27359
|
+
* const streamOfStreams = Stream.make(
|
|
27360
|
+
* Stream.make(1, 2),
|
|
27361
|
+
* Stream.make(3, 4),
|
|
27362
|
+
* Stream.make(5, 6)
|
|
27363
|
+
* )
|
|
27364
|
+
*
|
|
27365
|
+
* const program = Effect.gen(function*() {
|
|
27366
|
+
* const values = yield* Stream.runCollect(Stream.flatten(streamOfStreams))
|
|
27367
|
+
* values // => [ 1, 2, 3, 4, 5, 6 ]
|
|
27368
|
+
* })
|
|
27369
|
+
*
|
|
27370
|
+
* await Effect.runPromise(program)
|
|
27371
|
+
* ```
|
|
27372
|
+
*
|
|
27373
|
+
* @stability stable
|
|
27374
|
+
* @category sequencing
|
|
27375
|
+
* @since 2.0.0
|
|
27376
|
+
*/
|
|
27377
|
+
const flatten = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, options) => flatMap(self, identity, options));
|
|
27378
|
+
/**
|
|
27379
|
+
* Flattens the iterables emitted by this stream into the stream's structure.
|
|
27380
|
+
*
|
|
27381
|
+
* **Example** (Flattening iterable values)
|
|
27382
|
+
*
|
|
27383
|
+
* ```ts import.meta.vitest
|
|
27384
|
+
* import { Effect, Stream } from "effect"
|
|
27385
|
+
*
|
|
27386
|
+
* const program = Effect.gen(function*() {
|
|
27387
|
+
* const stream = Stream.make([1, 2], [3, 4]).pipe(Stream.flattenIterable)
|
|
27388
|
+
* const values = yield* Stream.runCollect(stream)
|
|
27389
|
+
* values // => [ 1, 2, 3, 4 ]
|
|
27390
|
+
* })
|
|
27391
|
+
*
|
|
27392
|
+
* await Effect.runPromise(program)
|
|
27393
|
+
* ```
|
|
27394
|
+
*
|
|
27395
|
+
* @stability stable
|
|
27396
|
+
* @category sequencing
|
|
27397
|
+
* @since 4.0.0
|
|
27398
|
+
*/
|
|
27399
|
+
const flattenIterable = (self) => flatMap(self, fromIterable$5);
|
|
27400
|
+
/**
|
|
26578
27401
|
* Concatenates two streams, emitting all elements from the first stream
|
|
26579
27402
|
* followed by all elements from the second stream.
|
|
26580
27403
|
*
|
|
@@ -26596,7 +27419,7 @@ const flatMap = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, f, option
|
|
|
26596
27419
|
* @since 2.0.0
|
|
26597
27420
|
*/
|
|
26598
27421
|
const concat = /*#__PURE__*/ dual(2, (self, that) => {
|
|
26599
|
-
const stream = fromChannel(flatten(fromIterator(() => concatChannels(self, that))));
|
|
27422
|
+
const stream = fromChannel(flatten$1(fromIterator(() => concatChannels(self, that))));
|
|
26600
27423
|
concatParts.set(stream, [self, that]);
|
|
26601
27424
|
return stream;
|
|
26602
27425
|
});
|
|
@@ -26640,6 +27463,48 @@ function* concatChannels(self, that) {
|
|
|
26640
27463
|
*/
|
|
26641
27464
|
const merge$1 = /*#__PURE__*/ dual((args) => isStream(args[0]) && isStream(args[1]), (self, that, options) => fromChannel(merge$2(toChannel(self), toChannel(that), options)));
|
|
26642
27465
|
/**
|
|
27466
|
+
* Merges a collection of streams, running up to the specified number concurrently.
|
|
27467
|
+
*
|
|
27468
|
+
* **When to use**
|
|
27469
|
+
*
|
|
27470
|
+
* Use to merge an iterable of already-created streams while bounding how many
|
|
27471
|
+
* inner streams may run at the same time.
|
|
27472
|
+
*
|
|
27473
|
+
* **Details**
|
|
27474
|
+
*
|
|
27475
|
+
* The `concurrency` option is required and may be a number or `"unbounded"`.
|
|
27476
|
+
* `bufferSize` controls buffering between inner streams, and outputs are
|
|
27477
|
+
* emitted as they arrive under concurrent merging.
|
|
27478
|
+
*
|
|
27479
|
+
* **Example** (Merging streams with bounded concurrency)
|
|
27480
|
+
*
|
|
27481
|
+
* ```ts import.meta.vitest
|
|
27482
|
+
* import { Effect, Stream } from "effect"
|
|
27483
|
+
*
|
|
27484
|
+
* const streams = [
|
|
27485
|
+
* Stream.fromEffect(Effect.delay(Effect.succeed("A"), "20 millis")),
|
|
27486
|
+
* Stream.fromEffect(Effect.delay(Effect.succeed("B"), "10 millis"))
|
|
27487
|
+
* ]
|
|
27488
|
+
*
|
|
27489
|
+
* const program = Effect.gen(function*() {
|
|
27490
|
+
* const values = yield* Stream.mergeAll(streams, { concurrency: 2 }).pipe(
|
|
27491
|
+
* Stream.runCollect
|
|
27492
|
+
* )
|
|
27493
|
+
* values // => [ 'B', 'A' ]
|
|
27494
|
+
* })
|
|
27495
|
+
*
|
|
27496
|
+
* await Effect.runPromise(program)
|
|
27497
|
+
* ```
|
|
27498
|
+
*
|
|
27499
|
+
* @see {@link merge} for merging exactly two streams and choosing a halt strategy
|
|
27500
|
+
* @see {@link flatten} for flattening a stream that already emits streams
|
|
27501
|
+
*
|
|
27502
|
+
* @stability stable
|
|
27503
|
+
* @category merging
|
|
27504
|
+
* @since 2.0.0
|
|
27505
|
+
*/
|
|
27506
|
+
const mergeAll = /*#__PURE__*/ dual(2, (streams, options) => flatten(fromIterable$5(streams), options));
|
|
27507
|
+
/**
|
|
26643
27508
|
* Filters a stream to the elements that satisfy a predicate.
|
|
26644
27509
|
*
|
|
26645
27510
|
* **Example** (Filtering stream values)
|
|
@@ -26663,6 +27528,127 @@ const merge$1 = /*#__PURE__*/ dual((args) => isStream(args[0]) && isStream(args[
|
|
|
26663
27528
|
* @since 2.0.0
|
|
26664
27529
|
*/
|
|
26665
27530
|
const filter = /*#__PURE__*/ dual(2, (self, predicate) => fromChannel(filterArray(toChannel(self), predicate)));
|
|
27531
|
+
const catch_ = /*#__PURE__*/ dual(2, (self, f) => fromChannel(catch_$1(self.channel, (error) => f(error).channel)));
|
|
27532
|
+
/**
|
|
27533
|
+
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
27534
|
+
* stream.
|
|
27535
|
+
*
|
|
27536
|
+
* **When to use**
|
|
27537
|
+
*
|
|
27538
|
+
* Use to recover from stream errors with a reusable `Filter` when matching can
|
|
27539
|
+
* also narrow or transform the error before choosing the recovery stream.
|
|
27540
|
+
*
|
|
27541
|
+
* **Details**
|
|
27542
|
+
*
|
|
27543
|
+
* Successful filter results are passed to `f`. Failed filter results go to
|
|
27544
|
+
* `orElse` when provided; otherwise the filter failure is re-failed.
|
|
27545
|
+
*
|
|
27546
|
+
* @see {@link catchIf} for predicate or refinement based recovery
|
|
27547
|
+
* @see {@link catchTag} for `_tag` based recovery from one tagged error
|
|
27548
|
+
* @see {@link catchTags} for `_tag` based recovery from multiple tagged errors
|
|
27549
|
+
* @see {@link catchCauseFilter} for filtering full causes
|
|
27550
|
+
*
|
|
27551
|
+
* @stability stable
|
|
27552
|
+
* @category error handling
|
|
27553
|
+
* @since 4.0.0
|
|
27554
|
+
*/
|
|
27555
|
+
const catchFilter = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, filter, f, orElse) => fromChannel(catchFilter$1(toChannel(self), filter, (e) => f(e).channel, orElse && ((e) => orElse(e).channel))));
|
|
27556
|
+
/**
|
|
27557
|
+
* Switches to a recovery stream based on matching `_tag` handlers.
|
|
27558
|
+
*
|
|
27559
|
+
* **Example** (Catching tagged failures with handlers)
|
|
27560
|
+
*
|
|
27561
|
+
* ```ts import.meta.vitest
|
|
27562
|
+
* import { Effect, Stream } from "effect"
|
|
27563
|
+
*
|
|
27564
|
+
* class NotFound {
|
|
27565
|
+
* readonly _tag = "NotFound"
|
|
27566
|
+
* constructor(readonly resource: string) {}
|
|
27567
|
+
* }
|
|
27568
|
+
*
|
|
27569
|
+
* class Unauthorized {
|
|
27570
|
+
* readonly _tag = "Unauthorized"
|
|
27571
|
+
* constructor(readonly user: string) {}
|
|
27572
|
+
* }
|
|
27573
|
+
*
|
|
27574
|
+
* const stream = Stream.fail(new NotFound("profile"))
|
|
27575
|
+
*
|
|
27576
|
+
* const program = Effect.gen(function* () {
|
|
27577
|
+
* const result = yield* stream.pipe(
|
|
27578
|
+
* Stream.catchTags({
|
|
27579
|
+
* NotFound: () => Stream.succeed("fallback"),
|
|
27580
|
+
* Unauthorized: () => Stream.succeed("login")
|
|
27581
|
+
* }),
|
|
27582
|
+
* Stream.runCollect
|
|
27583
|
+
* )
|
|
27584
|
+
* result // => [ 'fallback' ]
|
|
27585
|
+
* })
|
|
27586
|
+
*
|
|
27587
|
+
* await Effect.runPromise(program)
|
|
27588
|
+
* ```
|
|
27589
|
+
*
|
|
27590
|
+
* @stability stable
|
|
27591
|
+
* @category error handling
|
|
27592
|
+
* @since 2.0.0
|
|
27593
|
+
*/
|
|
27594
|
+
const catchTags = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, cases, orElse) => {
|
|
27595
|
+
let keys;
|
|
27596
|
+
return catchFilter(self, (e) => {
|
|
27597
|
+
keys ??= Object.keys(cases);
|
|
27598
|
+
return hasProperty(e, "_tag") && isString(e["_tag"]) && keys.includes(e["_tag"]) ? succeed$8(e) : fail$7(e);
|
|
27599
|
+
}, (e) => cases[e["_tag"]](e), orElse);
|
|
27600
|
+
});
|
|
27601
|
+
/**
|
|
27602
|
+
* Catches a specific reason within a tagged error.
|
|
27603
|
+
*
|
|
27604
|
+
* **When to use**
|
|
27605
|
+
*
|
|
27606
|
+
* Use to handle nested error causes without removing the parent error
|
|
27607
|
+
* from the error channel.
|
|
27608
|
+
*
|
|
27609
|
+
* **Details**
|
|
27610
|
+
*
|
|
27611
|
+
* The handler receives the unwrapped reason.
|
|
27612
|
+
*
|
|
27613
|
+
* **Example** (Catching a tagged error reason)
|
|
27614
|
+
*
|
|
27615
|
+
* ```ts import.meta.vitest
|
|
27616
|
+
* import { Data, Effect, Stream } from "effect"
|
|
27617
|
+
*
|
|
27618
|
+
* class RateLimitError extends Data.TaggedError("RateLimitError")<{
|
|
27619
|
+
* retryAfter: number
|
|
27620
|
+
* }> {}
|
|
27621
|
+
*
|
|
27622
|
+
* class QuotaExceededError extends Data.TaggedError("QuotaExceededError")<{
|
|
27623
|
+
* limit: number
|
|
27624
|
+
* }> {}
|
|
27625
|
+
*
|
|
27626
|
+
* class AiError extends Data.TaggedError("AiError")<{
|
|
27627
|
+
* reason: RateLimitError | QuotaExceededError
|
|
27628
|
+
* }> {}
|
|
27629
|
+
*
|
|
27630
|
+
* const stream = Stream.fail(
|
|
27631
|
+
* new AiError({ reason: new RateLimitError({ retryAfter: 60 }) })
|
|
27632
|
+
* )
|
|
27633
|
+
*
|
|
27634
|
+
* const program = Effect.gen(function*() {
|
|
27635
|
+
* const values = yield* stream.pipe(
|
|
27636
|
+
* Stream.catchReason("AiError", "RateLimitError", (reason) =>
|
|
27637
|
+
* Stream.succeed(`retry: ${reason.retryAfter}`)
|
|
27638
|
+
* ),
|
|
27639
|
+
* Stream.runCollect
|
|
27640
|
+
* )
|
|
27641
|
+
* values // => [ 'retry: 60' ]
|
|
27642
|
+
* })
|
|
27643
|
+
*
|
|
27644
|
+
* await Effect.runPromise(program)
|
|
27645
|
+
* ```
|
|
27646
|
+
*
|
|
27647
|
+
* @stability stable
|
|
27648
|
+
* @category error handling
|
|
27649
|
+
* @since 4.0.0
|
|
27650
|
+
*/
|
|
27651
|
+
const catchReason = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, errorTag, reasonTag, f, orElse) => fromChannel(catchReason$1(toChannel(self), errorTag, reasonTag, (reason, error) => f(reason, error).channel, orElse && ((reason, error) => orElse(reason, error).channel))));
|
|
26666
27652
|
/**
|
|
26667
27653
|
* Transforms the errors emitted by this stream using `f`.
|
|
26668
27654
|
*
|
|
@@ -26977,7 +27963,7 @@ const transduce = /*#__PURE__*/ dual(2, (self, sink) => transformPull(self, (ups
|
|
|
26977
27963
|
return succeed$4(chunk);
|
|
26978
27964
|
}
|
|
26979
27965
|
return upstream;
|
|
26980
|
-
}).pipe(catch_$
|
|
27966
|
+
}).pipe(catch_$2((error) => {
|
|
26981
27967
|
done$4 = fail$5(error);
|
|
26982
27968
|
return done();
|
|
26983
27969
|
}));
|
|
@@ -27036,7 +28022,7 @@ const aggregateWithin = /*#__PURE__*/ dual(3, (self, sink, schedule) => fromChan
|
|
|
27036
28022
|
yield* pull.pipe(pullLatch.whenOpen, flatMap$2((arr) => {
|
|
27037
28023
|
pullLatch.closeUnsafe();
|
|
27038
28024
|
return offer(buffer, arr);
|
|
27039
|
-
}), forever, catchCause$1((cause) => failCause$
|
|
28025
|
+
}), forever, catchCause$1((cause) => failCause$2(buffer, cause)), forkIn(scope));
|
|
27040
28026
|
const clock = yield* Clock;
|
|
27041
28027
|
const step = yield* toStep(schedule);
|
|
27042
28028
|
const hasInput = makeUnsafe$2(false);
|
|
@@ -27199,6 +28185,32 @@ const decodeText$1 = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, opti
|
|
|
27199
28185
|
*/
|
|
27200
28186
|
const splitLines = (self) => self.channel.pipe(pipeTo(splitLines$1()), fromChannel);
|
|
27201
28187
|
/**
|
|
28188
|
+
* Runs the provided effect when the stream ends successfully.
|
|
28189
|
+
*
|
|
28190
|
+
* **Example** (Running an effect on end)
|
|
28191
|
+
*
|
|
28192
|
+
* ```ts import.meta.vitest
|
|
28193
|
+
* import { Effect, Stream } from "effect"
|
|
28194
|
+
*
|
|
28195
|
+
* const events: Array<string> = []
|
|
28196
|
+
* const program = Effect.gen(function*() {
|
|
28197
|
+
* const values = yield* Stream.make(1, 2, 3).pipe(
|
|
28198
|
+
* Stream.onEnd(Effect.sync(() => events.push("ended"))),
|
|
28199
|
+
* Stream.runCollect
|
|
28200
|
+
* )
|
|
28201
|
+
* values // => [1, 2, 3]
|
|
28202
|
+
* })
|
|
28203
|
+
*
|
|
28204
|
+
* await Effect.runPromise(program)
|
|
28205
|
+
* events // => ["ended"]
|
|
28206
|
+
* ```
|
|
28207
|
+
*
|
|
28208
|
+
* @stability stable
|
|
28209
|
+
* @category sequencing
|
|
28210
|
+
* @since 3.6.0
|
|
28211
|
+
*/
|
|
28212
|
+
const onEnd = /*#__PURE__*/ dual(2, (self, onEnd) => fromChannel(onEnd$1(self.channel, onEnd)));
|
|
28213
|
+
/**
|
|
27202
28214
|
* Executes the provided finalizer after this stream's finalizers run.
|
|
27203
28215
|
*
|
|
27204
28216
|
* **Example** (Ensuring finalization)
|
|
@@ -27262,6 +28274,44 @@ const ensuring = /*#__PURE__*/ dual(2, (self, finalizer) => fromChannel(ensuring
|
|
|
27262
28274
|
*/
|
|
27263
28275
|
const provideContext = /*#__PURE__*/ dual(2, (self, context) => fromChannel(provideContext$1(self.channel, context)));
|
|
27264
28276
|
/**
|
|
28277
|
+
* Provides the stream with a single required service, eliminating that
|
|
28278
|
+
* requirement from its environment.
|
|
28279
|
+
*
|
|
28280
|
+
* **Example** (Providing a stream service)
|
|
28281
|
+
*
|
|
28282
|
+
* ```ts import.meta.vitest
|
|
28283
|
+
* import { Context, Effect, Stream } from "effect"
|
|
28284
|
+
*
|
|
28285
|
+
* class Greeter extends Context.Service<Greeter, {
|
|
28286
|
+
* greet: (name: string) => string
|
|
28287
|
+
* }>()("Greeter") {}
|
|
28288
|
+
*
|
|
28289
|
+
* const stream = Stream.fromEffect(
|
|
28290
|
+
* Effect.service(Greeter).pipe(
|
|
28291
|
+
* Effect.map((greeter) => greeter.greet("Ada"))
|
|
28292
|
+
* )
|
|
28293
|
+
* )
|
|
28294
|
+
*
|
|
28295
|
+
* const program = Effect.gen(function*() {
|
|
28296
|
+
* const collected = yield* Stream.runCollect(
|
|
28297
|
+
* stream.pipe(
|
|
28298
|
+
* Stream.provideService(Greeter, {
|
|
28299
|
+
* greet: (name) => `Hello, ${name}`
|
|
28300
|
+
* })
|
|
28301
|
+
* )
|
|
28302
|
+
* )
|
|
28303
|
+
* collected // => [ 'Hello, Ada' ]
|
|
28304
|
+
* })
|
|
28305
|
+
*
|
|
28306
|
+
* await Effect.runPromise(program)
|
|
28307
|
+
* ```
|
|
28308
|
+
*
|
|
28309
|
+
* @stability stable
|
|
28310
|
+
* @category providing services
|
|
28311
|
+
* @since 2.0.0
|
|
28312
|
+
*/
|
|
28313
|
+
const provideService = /*#__PURE__*/ dual(3, (self, key, service) => fromChannel(provideService$1(self.channel, key, service)));
|
|
28314
|
+
/**
|
|
27265
28315
|
* Runs a stream with a sink and returns the sink result.
|
|
27266
28316
|
*
|
|
27267
28317
|
* **Example** (Running a stream with a sink)
|
|
@@ -27861,10 +28911,12 @@ const jsonSchemaAnnotationKeys = [
|
|
|
27861
28911
|
"contentSchema"
|
|
27862
28912
|
];
|
|
27863
28913
|
/** @internal */
|
|
27864
|
-
const resolveIdentifier = /*#__PURE__*/ resolveAt("identifier");
|
|
28914
|
+
const resolveIdentifier$1 = /*#__PURE__*/ resolveAt("identifier");
|
|
27865
28915
|
/** @internal */
|
|
27866
28916
|
const resolveIdentifierFallback = /*#__PURE__*/ resolveAt(IDENTIFIER_FALLBACK_KEY);
|
|
27867
28917
|
/** @internal */
|
|
28918
|
+
const resolveDescription$1 = /*#__PURE__*/ resolveAt("description");
|
|
28919
|
+
/** @internal */
|
|
27868
28920
|
const getExpected = /*#__PURE__*/ memoize((ast) => {
|
|
27869
28921
|
const identifier = resolve$1(ast)?.identifier;
|
|
27870
28922
|
if (typeof identifier === "string") return identifier;
|
|
@@ -28454,6 +29506,22 @@ function getSchemaIssueOrThrow(cause, message) {
|
|
|
28454
29506
|
*/
|
|
28455
29507
|
const isDateTime = isDateTime$1;
|
|
28456
29508
|
/**
|
|
29509
|
+
* Checks whether a `DateTime` is a UTC `DateTime` (no time zone information).
|
|
29510
|
+
*
|
|
29511
|
+
* **When to use**
|
|
29512
|
+
*
|
|
29513
|
+
* Use to narrow a `DateTime` before passing it to code that requires a UTC
|
|
29514
|
+
* value without an associated time zone.
|
|
29515
|
+
*
|
|
29516
|
+
* @see {@link isZoned} for narrowing to zoned date-times
|
|
29517
|
+
* @see {@link match} for handling both UTC and zoned cases
|
|
29518
|
+
*
|
|
29519
|
+
* @stability stable
|
|
29520
|
+
* @category guards
|
|
29521
|
+
* @since 3.6.0
|
|
29522
|
+
*/
|
|
29523
|
+
const isUtc = isUtc$1;
|
|
29524
|
+
/**
|
|
28457
29525
|
* Create a `DateTime` from supported input values.
|
|
28458
29526
|
*
|
|
28459
29527
|
* **When to use**
|
|
@@ -28528,6 +29596,43 @@ const makeUnsafe = makeUnsafe$3;
|
|
|
28528
29596
|
*/
|
|
28529
29597
|
const makeZonedUnsafe = makeZonedUnsafe$1;
|
|
28530
29598
|
/**
|
|
29599
|
+
* Creates a `DateTime` safely from supported input values.
|
|
29600
|
+
*
|
|
29601
|
+
* **Details**
|
|
29602
|
+
*
|
|
29603
|
+
* - A `DateTime`
|
|
29604
|
+
* - A JavaScript `Date`
|
|
29605
|
+
* - The number of milliseconds since the Unix epoch
|
|
29606
|
+
* - An object with date and time parts
|
|
29607
|
+
* - A string that can be parsed as a date
|
|
29608
|
+
*
|
|
29609
|
+
* Returns `Some` with the constructed `DateTime` when the input is valid, or
|
|
29610
|
+
* `None` when construction would fail, including invalid `Date` instances or
|
|
29611
|
+
* unparseable strings.
|
|
29612
|
+
*
|
|
29613
|
+
* **Example** (Creating optional DateTime values)
|
|
29614
|
+
*
|
|
29615
|
+
* ```ts import.meta.vitest
|
|
29616
|
+
* import { DateTime, Option } from "effect"
|
|
29617
|
+
*
|
|
29618
|
+
* // from Date
|
|
29619
|
+
* DateTime.make(new Date("2024-01-01T12:00:00Z")) // => Option.some(DateTime.makeUnsafe("2024-01-01T12:00:00Z"))
|
|
29620
|
+
*
|
|
29621
|
+
* // from parts
|
|
29622
|
+
* DateTime.make({ year: 2024 }) // => Option.some(DateTime.makeUnsafe("2024-01-01T00:00:00Z"))
|
|
29623
|
+
*
|
|
29624
|
+
* // from string
|
|
29625
|
+
* DateTime.make("2024-01-01") // => Option.some(DateTime.makeUnsafe("2024-01-01T00:00:00Z"))
|
|
29626
|
+
*
|
|
29627
|
+
* DateTime.make("not a date") // => Option.none()
|
|
29628
|
+
* ```
|
|
29629
|
+
*
|
|
29630
|
+
* @stability stable
|
|
29631
|
+
* @category constructors
|
|
29632
|
+
* @since 3.6.0
|
|
29633
|
+
*/
|
|
29634
|
+
const make$21 = make$32;
|
|
29635
|
+
/**
|
|
28531
29636
|
* Gets the current time using the `Clock` service and converts it to a `DateTime`.
|
|
28532
29637
|
*
|
|
28533
29638
|
* **Example** (Getting the current DateTime)
|
|
@@ -28545,6 +29650,37 @@ const makeZonedUnsafe = makeZonedUnsafe$1;
|
|
|
28545
29650
|
*/
|
|
28546
29651
|
const now = now$1;
|
|
28547
29652
|
/**
|
|
29653
|
+
* Converts a `DateTime` to a UTC `DateTime`.
|
|
29654
|
+
*
|
|
29655
|
+
* **When to use**
|
|
29656
|
+
*
|
|
29657
|
+
* Use to represent the same instant in UTC instead of its current time zone.
|
|
29658
|
+
*
|
|
29659
|
+
* **Details**
|
|
29660
|
+
*
|
|
29661
|
+
* The returned value keeps the same epoch milliseconds and changes only the
|
|
29662
|
+
* `DateTime` representation to UTC.
|
|
29663
|
+
*
|
|
29664
|
+
* **Example** (Converting DateTime values to UTC)
|
|
29665
|
+
*
|
|
29666
|
+
* ```ts import.meta.vitest
|
|
29667
|
+
* import { DateTime } from "effect"
|
|
29668
|
+
*
|
|
29669
|
+
* const now = DateTime.makeZonedUnsafe({ year: 2024 }, {
|
|
29670
|
+
* timeZone: "Europe/London"
|
|
29671
|
+
* })
|
|
29672
|
+
*
|
|
29673
|
+
* // set as UTC
|
|
29674
|
+
* const utc: DateTime.Utc = DateTime.toUtc(now)
|
|
29675
|
+
* utc // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
29676
|
+
* ```
|
|
29677
|
+
*
|
|
29678
|
+
* @stability stable
|
|
29679
|
+
* @category converting
|
|
29680
|
+
* @since 3.13.0
|
|
29681
|
+
*/
|
|
29682
|
+
const toUtc = toUtc$1;
|
|
29683
|
+
/**
|
|
28548
29684
|
* Gets the milliseconds since the Unix epoch of a `DateTime`.
|
|
28549
29685
|
*
|
|
28550
29686
|
* **Details**
|
|
@@ -28565,6 +29701,31 @@ const now = now$1;
|
|
|
28565
29701
|
* @since 3.6.0
|
|
28566
29702
|
*/
|
|
28567
29703
|
const toEpochMillis = toEpochMillis$1;
|
|
29704
|
+
/**
|
|
29705
|
+
* Formats a `DateTime` as a UTC ISO string.
|
|
29706
|
+
*
|
|
29707
|
+
* **Details**
|
|
29708
|
+
*
|
|
29709
|
+
* Always returns the UTC representation in ISO 8601 format, ignoring any time zone.
|
|
29710
|
+
*
|
|
29711
|
+
* **Example** (Formatting DateTime values as ISO strings)
|
|
29712
|
+
*
|
|
29713
|
+
* ```ts import.meta.vitest
|
|
29714
|
+
* import { DateTime } from "effect"
|
|
29715
|
+
*
|
|
29716
|
+
* DateTime.formatIso(DateTime.makeUnsafe("2024-01-01T12:30:45.123Z")) // => "2024-01-01T12:30:45.123Z"
|
|
29717
|
+
*
|
|
29718
|
+
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:30:45.123Z", {
|
|
29719
|
+
* timeZone: "Europe/London"
|
|
29720
|
+
* })
|
|
29721
|
+
* DateTime.formatIso(zoned) // => "2024-01-01T12:30:45.123Z"
|
|
29722
|
+
* ```
|
|
29723
|
+
*
|
|
29724
|
+
* @stability stable
|
|
29725
|
+
* @category formatting
|
|
29726
|
+
* @since 3.6.0
|
|
29727
|
+
*/
|
|
29728
|
+
const formatIso = formatIso$1;
|
|
28568
29729
|
//#endregion
|
|
28569
29730
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/encoding/Base64.js
|
|
28570
29731
|
/**
|
|
@@ -28781,6 +29942,36 @@ function forbidden(message) {
|
|
|
28781
29942
|
return isSome(oe) ? new Forbidden(annotations, oe.value, options) : new Forbidden(annotations);
|
|
28782
29943
|
});
|
|
28783
29944
|
}
|
|
29945
|
+
/**
|
|
29946
|
+
* Getter that always fails with a `Forbidden` issue indicating that encoding is unsupported.
|
|
29947
|
+
*
|
|
29948
|
+
* **When to use**
|
|
29949
|
+
*
|
|
29950
|
+
* Use as the encode side of a decode-only Schema transformation.
|
|
29951
|
+
*
|
|
29952
|
+
* **Details**
|
|
29953
|
+
*
|
|
29954
|
+
* Its `Getter<never, unknown>` type is assignable to every encoding getter because it accepts any input and never
|
|
29955
|
+
* produces an output value.
|
|
29956
|
+
*
|
|
29957
|
+
* **Example** (Rejecting encoding)
|
|
29958
|
+
*
|
|
29959
|
+
* ```ts import.meta.vitest
|
|
29960
|
+
* import { Effect, Option, SchemaGetter } from "effect"
|
|
29961
|
+
*
|
|
29962
|
+
* const issue = await Effect.runPromise(
|
|
29963
|
+
* Effect.flip(SchemaGetter.run(SchemaGetter.forbiddenEncoding, Option.some("value"), {}))
|
|
29964
|
+
* )
|
|
29965
|
+
* issue._tag // => "Forbidden"
|
|
29966
|
+
* ```
|
|
29967
|
+
*
|
|
29968
|
+
* @see {@link forbidden} for a forbidden getter with a custom message
|
|
29969
|
+
*
|
|
29970
|
+
* @stability stable
|
|
29971
|
+
* @category constructors
|
|
29972
|
+
* @since 4.0.0
|
|
29973
|
+
*/
|
|
29974
|
+
const forbiddenEncoding = /*#__PURE__*/ forbidden(() => "Encoding is not supported");
|
|
28784
29975
|
const passthrough_$1 = /*#__PURE__*/ makeGetter({ _tag: "Passthrough" });
|
|
28785
29976
|
function passthrough$1() {
|
|
28786
29977
|
return passthrough_$1;
|
|
@@ -28873,6 +30064,43 @@ function transformEffect$1(f) {
|
|
|
28873
30064
|
});
|
|
28874
30065
|
}
|
|
28875
30066
|
/**
|
|
30067
|
+
* Creates a getter that transforms the full `Option` — both present and absent values.
|
|
30068
|
+
*
|
|
30069
|
+
* **When to use**
|
|
30070
|
+
*
|
|
30071
|
+
* Use when you need a schema getter to handle both `Some` and `None` cases.
|
|
30072
|
+
*
|
|
30073
|
+
* **Details**
|
|
30074
|
+
*
|
|
30075
|
+
* The getter is pure and never fails. It receives the full `Option<E>` and
|
|
30076
|
+
* must return `Option<T>`, so it can turn a present value into absent or an
|
|
30077
|
+
* absent value into present.
|
|
30078
|
+
*
|
|
30079
|
+
* **Example** (Filtering out empty strings)
|
|
30080
|
+
*
|
|
30081
|
+
* ```ts import.meta.vitest
|
|
30082
|
+
* import { Effect, Option, SchemaGetter } from "effect"
|
|
30083
|
+
*
|
|
30084
|
+
* const skipEmpty = SchemaGetter.transformOptional<string, string>((o) =>
|
|
30085
|
+
* Option.filter(o, (s) => s.length > 0)
|
|
30086
|
+
* )
|
|
30087
|
+
* Effect.runSync(SchemaGetter.run(skipEmpty, Option.some(""), {})) // => Option.none()
|
|
30088
|
+
* ```
|
|
30089
|
+
*
|
|
30090
|
+
* @see {@link transform} when you only need to transform present values
|
|
30091
|
+
* @see {@link omit} when you always want `None`
|
|
30092
|
+
*
|
|
30093
|
+
* @stability stable
|
|
30094
|
+
* @category transforming
|
|
30095
|
+
* @since 4.0.0
|
|
30096
|
+
*/
|
|
30097
|
+
function transformOptional$1(f) {
|
|
30098
|
+
return makeGetter({
|
|
30099
|
+
_tag: "TransformOptional",
|
|
30100
|
+
transform: f
|
|
30101
|
+
});
|
|
30102
|
+
}
|
|
30103
|
+
/**
|
|
28876
30104
|
* Creates a getter that effectfully transforms the full `Option`.
|
|
28877
30105
|
*
|
|
28878
30106
|
* @stability stable
|
|
@@ -28886,6 +30114,74 @@ function transformOptionalEffect(f) {
|
|
|
28886
30114
|
});
|
|
28887
30115
|
}
|
|
28888
30116
|
/**
|
|
30117
|
+
* Creates a getter that always returns `None`, effectively omitting the value from output.
|
|
30118
|
+
*
|
|
30119
|
+
* **When to use**
|
|
30120
|
+
*
|
|
30121
|
+
* Use when you need a schema getter to exclude a field during decoding or
|
|
30122
|
+
* encoding.
|
|
30123
|
+
*
|
|
30124
|
+
* **Details**
|
|
30125
|
+
*
|
|
30126
|
+
* - Always returns `Option.None` regardless of input.
|
|
30127
|
+
* - Never fails.
|
|
30128
|
+
*
|
|
30129
|
+
* **Example** (Omitting a field during encoding)
|
|
30130
|
+
*
|
|
30131
|
+
* ```ts import.meta.vitest
|
|
30132
|
+
* import { Effect, Option, SchemaGetter } from "effect"
|
|
30133
|
+
*
|
|
30134
|
+
* const omitField = SchemaGetter.omit<string>()
|
|
30135
|
+
* Effect.runSync(SchemaGetter.run(omitField, Option.some("hidden"), {})) // => Option.none()
|
|
30136
|
+
* ```
|
|
30137
|
+
*
|
|
30138
|
+
* @see {@link transformOptional} when you want conditional omission
|
|
30139
|
+
* @see {@link forbidden} when you want to fail instead of silently omit
|
|
30140
|
+
*
|
|
30141
|
+
* @stability stable
|
|
30142
|
+
* @category filtering
|
|
30143
|
+
* @since 4.0.0
|
|
30144
|
+
*/
|
|
30145
|
+
function omit$1() {
|
|
30146
|
+
return transformOptional$1(() => none());
|
|
30147
|
+
}
|
|
30148
|
+
/**
|
|
30149
|
+
* Creates a getter that replaces `undefined` values with a default.
|
|
30150
|
+
*
|
|
30151
|
+
* **When to use**
|
|
30152
|
+
*
|
|
30153
|
+
* Use when you need a schema getter to provide a fallback for a field that may
|
|
30154
|
+
* be `undefined` in the encoded input.
|
|
30155
|
+
*
|
|
30156
|
+
* **Details**
|
|
30157
|
+
*
|
|
30158
|
+
* - If the input is `Some(undefined)` or `None`, produces `Some(T)`.
|
|
30159
|
+
* - If the input is `Some(value)` where value is not `undefined`, passes it through.
|
|
30160
|
+
* - `defaultValue` is an `Effect` that will be executed each time a default is needed.
|
|
30161
|
+
*
|
|
30162
|
+
* **Example** (Providing a default value for an optional field)
|
|
30163
|
+
*
|
|
30164
|
+
* ```ts import.meta.vitest
|
|
30165
|
+
* import { Effect, Option, SchemaGetter } from "effect"
|
|
30166
|
+
*
|
|
30167
|
+
* const withZero = SchemaGetter.withDefault(Effect.succeed(0))
|
|
30168
|
+
* await Effect.runPromise(SchemaGetter.run(withZero, Option.some(undefined), {})) // => Option.some(0)
|
|
30169
|
+
* ```
|
|
30170
|
+
*
|
|
30171
|
+
* @see {@link transformOptionalEffect} for custom effectful missing-key handling
|
|
30172
|
+
* @see {@link required} when absent input should fail instead of using a default
|
|
30173
|
+
*
|
|
30174
|
+
* @stability stable
|
|
30175
|
+
* @category transforming
|
|
30176
|
+
* @since 4.0.0
|
|
30177
|
+
*/
|
|
30178
|
+
function withDefault$2(defaultValue) {
|
|
30179
|
+
return transformOptionalEffect((o) => {
|
|
30180
|
+
const filtered = filter$3(o, isNotUndefined);
|
|
30181
|
+
return isSome(filtered) ? succeed$4(filtered) : mapEager(defaultValue, some$1);
|
|
30182
|
+
});
|
|
30183
|
+
}
|
|
30184
|
+
/**
|
|
28889
30185
|
* Coerces any value to a `string` using the global `String()` constructor.
|
|
28890
30186
|
*
|
|
28891
30187
|
* **When to use**
|
|
@@ -28946,6 +30242,35 @@ function String$4() {
|
|
|
28946
30242
|
function Number$3() {
|
|
28947
30243
|
return transform$1(globalThis.Number);
|
|
28948
30244
|
}
|
|
30245
|
+
/**
|
|
30246
|
+
* Coerces a value to `bigint` using the global `BigInt()` constructor.
|
|
30247
|
+
*
|
|
30248
|
+
* **When to use**
|
|
30249
|
+
*
|
|
30250
|
+
* Use when you need a schema getter to convert a present string, number, or
|
|
30251
|
+
* boolean value to `bigint`.
|
|
30252
|
+
*
|
|
30253
|
+
* **Details**
|
|
30254
|
+
*
|
|
30255
|
+
* - Delegates to `globalThis.BigInt`.
|
|
30256
|
+
* - Throws at runtime if the input cannot be converted (e.g. non-numeric string).
|
|
30257
|
+
*
|
|
30258
|
+
* **Example** (Coercing to a bigint)
|
|
30259
|
+
*
|
|
30260
|
+
* ```ts import.meta.vitest
|
|
30261
|
+
* import { Effect, Option, SchemaGetter } from "effect"
|
|
30262
|
+
*
|
|
30263
|
+
* const toBigInt = SchemaGetter.BigInt<string>()
|
|
30264
|
+
* Effect.runSync(SchemaGetter.run(toBigInt, Option.some("42"), {})) // => Option.some(42n)
|
|
30265
|
+
* ```
|
|
30266
|
+
*
|
|
30267
|
+
* @stability stable
|
|
30268
|
+
* @category converting
|
|
30269
|
+
* @since 4.0.0
|
|
30270
|
+
*/
|
|
30271
|
+
function BigInt$3() {
|
|
30272
|
+
return transform$1(globalThis.BigInt);
|
|
30273
|
+
}
|
|
28949
30274
|
function parseJson(options) {
|
|
28950
30275
|
return transformEffect$1((input, parseOptions) => try_({
|
|
28951
30276
|
try: () => JSON.parse(input, options?.reviver),
|
|
@@ -29538,6 +30863,53 @@ function transformEffect(options) {
|
|
|
29538
30863
|
function transform(options) {
|
|
29539
30864
|
return new Transformation(transform$1(options.decode), transform$1(options.encode));
|
|
29540
30865
|
}
|
|
30866
|
+
/**
|
|
30867
|
+
* Creates a `Transformation` where decode and encode operate on `Option`
|
|
30868
|
+
* values, giving full control over missing-key handling.
|
|
30869
|
+
*
|
|
30870
|
+
* **When to use**
|
|
30871
|
+
*
|
|
30872
|
+
* Use when you need a schema transformation to produce or consume `Option.None`
|
|
30873
|
+
* for absent keys.
|
|
30874
|
+
* - You are working with optional struct fields.
|
|
30875
|
+
*
|
|
30876
|
+
* **Details**
|
|
30877
|
+
*
|
|
30878
|
+
* - Each function receives `Option<input>` and returns `Option<output>`.
|
|
30879
|
+
* - `Option.None` input means the key is absent; returning `Option.None`
|
|
30880
|
+
* omits the key from the output.
|
|
30881
|
+
* - Pure and synchronous.
|
|
30882
|
+
*
|
|
30883
|
+
* **Example** (Converting an optional key to Option)
|
|
30884
|
+
*
|
|
30885
|
+
* ```ts import.meta.vitest
|
|
30886
|
+
* import { Option, Schema, SchemaTransformation } from "effect"
|
|
30887
|
+
*
|
|
30888
|
+
* const schema = Schema.Struct({
|
|
30889
|
+
* a: Schema.optionalKey(Schema.Number).pipe(
|
|
30890
|
+
* Schema.decodeTo(
|
|
30891
|
+
* Schema.Option(Schema.Number),
|
|
30892
|
+
* SchemaTransformation.transformOptional({
|
|
30893
|
+
* decode: Option.some,
|
|
30894
|
+
* encode: Option.flatten
|
|
30895
|
+
* })
|
|
30896
|
+
* )
|
|
30897
|
+
* )
|
|
30898
|
+
* })
|
|
30899
|
+
* Schema.decodeSync(schema)({}).a // => Option.none()
|
|
30900
|
+
* ```
|
|
30901
|
+
*
|
|
30902
|
+
* @see {@link transform} — when you don't need Option-level control
|
|
30903
|
+
* @see {@link optionFromOptionalKey} — built-in for the common optional-key-to-Option pattern
|
|
30904
|
+
* @see {@link optionFromOptional} — built-in for optional (undefined) to Option
|
|
30905
|
+
*
|
|
30906
|
+
* @stability stable
|
|
30907
|
+
* @category transforming
|
|
30908
|
+
* @since 4.0.0
|
|
30909
|
+
*/
|
|
30910
|
+
function transformOptional(options) {
|
|
30911
|
+
return new Transformation(transformOptional$1(options.decode), transformOptional$1(options.encode));
|
|
30912
|
+
}
|
|
29541
30913
|
const passthrough_ = /*#__PURE__*/ new Transformation(/*#__PURE__*/ passthrough$1(), /*#__PURE__*/ passthrough$1());
|
|
29542
30914
|
function passthrough() {
|
|
29543
30915
|
return passthrough_;
|
|
@@ -29577,6 +30949,40 @@ function passthrough() {
|
|
|
29577
30949
|
* @since 4.0.0
|
|
29578
30950
|
*/
|
|
29579
30951
|
const numberFromString = /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$3(), /*#__PURE__*/ String$4());
|
|
30952
|
+
/**
|
|
30953
|
+
* Decodes a `string` into a `bigint` and encodes a `bigint` back to a
|
|
30954
|
+
* `string`.
|
|
30955
|
+
*
|
|
30956
|
+
* **When to use**
|
|
30957
|
+
*
|
|
30958
|
+
* Use when you need a schema transformation to parse large integer strings
|
|
30959
|
+
* (e.g. database IDs, blockchain values).
|
|
30960
|
+
*
|
|
30961
|
+
* **Details**
|
|
30962
|
+
*
|
|
30963
|
+
* Decoding coerces the string to a bigint like `BigInt(s)`. Encoding coerces
|
|
30964
|
+
* the bigint to a string like `String(n)`. Decoding fails if the string is not
|
|
30965
|
+
* a valid bigint representation.
|
|
30966
|
+
*
|
|
30967
|
+
* **Example** (Converting a string to a BigInt)
|
|
30968
|
+
*
|
|
30969
|
+
* ```ts import.meta.vitest
|
|
30970
|
+
* import { Schema, SchemaTransformation } from "effect"
|
|
30971
|
+
*
|
|
30972
|
+
* const schema = Schema.String.pipe(
|
|
30973
|
+
* Schema.decodeTo(Schema.BigInt, SchemaTransformation.bigintFromString)
|
|
30974
|
+
* )
|
|
30975
|
+
* Schema.decodeSync(schema)("42") // => 42n
|
|
30976
|
+
* ```
|
|
30977
|
+
*
|
|
30978
|
+
* @see {@link numberFromString}
|
|
30979
|
+
* @see {@link transform}
|
|
30980
|
+
*
|
|
30981
|
+
* @stability stable
|
|
30982
|
+
* @category converting
|
|
30983
|
+
* @since 4.0.0
|
|
30984
|
+
*/
|
|
30985
|
+
const bigintFromString = /*#__PURE__*/ new Transformation(/*#__PURE__*/ BigInt$3(), /*#__PURE__*/ String$4());
|
|
29580
30986
|
const isJsonError = (input) => isObject(input) && typeof input["message"] === "string";
|
|
29581
30987
|
const decodeJsonError = (input) => {
|
|
29582
30988
|
const err = Object.hasOwn(input, "cause") ? new Error(input.message, { cause: decodeDefect(input.cause) }) : new Error(input.message);
|
|
@@ -30154,7 +31560,7 @@ const String$3 = class extends ASTNodeImpl {
|
|
|
30154
31560
|
_tag = "String";
|
|
30155
31561
|
/** @internal */
|
|
30156
31562
|
getParser() {
|
|
30157
|
-
return fromRefinement(this, isString);
|
|
31563
|
+
return fromRefinement(this, isString$1);
|
|
30158
31564
|
}
|
|
30159
31565
|
/** @internal */
|
|
30160
31566
|
matchPart(s, options) {
|
|
@@ -30277,6 +31683,51 @@ const Boolean$2 = class extends ASTNodeImpl {
|
|
|
30277
31683
|
*/
|
|
30278
31684
|
const boolean = /*#__PURE__*/ new Boolean$2();
|
|
30279
31685
|
/**
|
|
31686
|
+
* Constructs a {@link BigInt}.
|
|
31687
|
+
*
|
|
31688
|
+
* @stability stable
|
|
31689
|
+
* @category constructors
|
|
31690
|
+
* @since 4.0.0
|
|
31691
|
+
*/
|
|
31692
|
+
const BigInt$2 = class extends ASTNodeImpl {
|
|
31693
|
+
_tag = "BigInt";
|
|
31694
|
+
/** @internal */
|
|
31695
|
+
getParser() {
|
|
31696
|
+
return fromRefinement(this, isBigInt);
|
|
31697
|
+
}
|
|
31698
|
+
/** @internal */
|
|
31699
|
+
matchPart(s, options) {
|
|
31700
|
+
if (!isStringBigIntRegExp.test(s)) return void 0;
|
|
31701
|
+
const value = globalThis.BigInt(s);
|
|
31702
|
+
if (options.disableChecks || !this.checks) return value;
|
|
31703
|
+
return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;
|
|
31704
|
+
}
|
|
31705
|
+
/** @internal */
|
|
31706
|
+
toCodecStringTree() {
|
|
31707
|
+
return replaceEncoding(this, [bigIntToString]);
|
|
31708
|
+
}
|
|
31709
|
+
/** @internal */
|
|
31710
|
+
getExpected() {
|
|
31711
|
+
return "bigint";
|
|
31712
|
+
}
|
|
31713
|
+
};
|
|
31714
|
+
/**
|
|
31715
|
+
* Provides the singleton {@link BigInt} AST instance.
|
|
31716
|
+
*
|
|
31717
|
+
* **When to use**
|
|
31718
|
+
*
|
|
31719
|
+
* Use to reuse the canonical `BigInt` AST node when constructing, inspecting,
|
|
31720
|
+
* or transforming schemas at the AST level.
|
|
31721
|
+
*
|
|
31722
|
+
* @see {@link BigInt} for the AST node class and string-codec behavior
|
|
31723
|
+
* @see {@link isBigInt} for narrowing an AST to a `BigInt` node
|
|
31724
|
+
*
|
|
31725
|
+
* @stability stable
|
|
31726
|
+
* @category constructors
|
|
31727
|
+
* @since 4.0.0
|
|
31728
|
+
*/
|
|
31729
|
+
const bigInt = /*#__PURE__*/ new BigInt$2();
|
|
31730
|
+
/**
|
|
30280
31731
|
* Constructs a {@link Arrays}.
|
|
30281
31732
|
*
|
|
30282
31733
|
* @stability stable
|
|
@@ -30369,7 +31820,7 @@ const Arrays = class extends ASTNodeImpl {
|
|
|
30369
31820
|
}
|
|
30370
31821
|
return parse(input, options);
|
|
30371
31822
|
} catch (error) {
|
|
30372
|
-
return die$
|
|
31823
|
+
return die$2(error);
|
|
30373
31824
|
}
|
|
30374
31825
|
};
|
|
30375
31826
|
}
|
|
@@ -30419,7 +31870,7 @@ const parseArrayConcurrent = /*#__PURE__*/ iterateConcurrent()(parseArrayOptions
|
|
|
30419
31870
|
const wrapPropertyKeyIssue = (s, ast, key, exit) => {
|
|
30420
31871
|
if (exit.cause.reasons.length === 0) return exit;
|
|
30421
31872
|
const issue = getSchemaIssue(exit.cause);
|
|
30422
|
-
if (issue === void 0) return failCause$
|
|
31873
|
+
if (issue === void 0) return failCause$4(map$4(exit.cause, (issue) => new Composite(ast, [new Pointer([key], issue)], s.input, s.options)));
|
|
30423
31874
|
const pointer = new Pointer([key], issue);
|
|
30424
31875
|
if (s.options.errors === "all") {
|
|
30425
31876
|
if (s.issues) s.issues.push(pointer);
|
|
@@ -30448,7 +31899,7 @@ function getIndexSignatureKeys(input, parameter, options = defaultParseOptions)
|
|
|
30448
31899
|
default: return [];
|
|
30449
31900
|
}
|
|
30450
31901
|
}
|
|
30451
|
-
return go(parameterFromPropertyKey(toEncoded(parameter)));
|
|
31902
|
+
return go(parameterFromPropertyKey(toEncoded$1(parameter)));
|
|
30452
31903
|
}
|
|
30453
31904
|
/**
|
|
30454
31905
|
* Constructs a {@link PropertySignature}.
|
|
@@ -30683,7 +32134,7 @@ const Objects = class extends ASTNodeImpl {
|
|
|
30683
32134
|
if (terminal) return terminal;
|
|
30684
32135
|
}
|
|
30685
32136
|
} catch (error) {
|
|
30686
|
-
return die$
|
|
32137
|
+
return die$2(error);
|
|
30687
32138
|
}
|
|
30688
32139
|
return succeed$1(out);
|
|
30689
32140
|
};
|
|
@@ -30768,6 +32219,11 @@ function tuple(elements, checks = void 0) {
|
|
|
30768
32219
|
function union(members, options, checks) {
|
|
30769
32220
|
return new Union$1(members.map(getAST), options, void 0, checks);
|
|
30770
32221
|
}
|
|
32222
|
+
/** @internal */
|
|
32223
|
+
function mutable$1(ast) {
|
|
32224
|
+
if (ast.encoding) throw new Error("mutable does not support encodings");
|
|
32225
|
+
return new Arrays(true, ast.elements, ast.rest, ast.annotations, ast.checks, void 0, ast.context, ast.encodingChecks);
|
|
32226
|
+
}
|
|
30771
32227
|
const toCandidate = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
30772
32228
|
while (true) {
|
|
30773
32229
|
if (isSuspend(ast)) return unknown;
|
|
@@ -31033,7 +32489,7 @@ const Union$1 = class extends ASTNodeImpl {
|
|
|
31033
32489
|
if (typeof expected === "string") return expected;
|
|
31034
32490
|
if (this.types.length === 0) return "never";
|
|
31035
32491
|
const types = this.types.map((type) => {
|
|
31036
|
-
const encoded = toEncoded(type);
|
|
32492
|
+
const encoded = toEncoded$1(type);
|
|
31037
32493
|
switch (encoded._tag) {
|
|
31038
32494
|
case "Arrays": {
|
|
31039
32495
|
const literals = encoded.elements.filter(isLiteral);
|
|
@@ -31053,7 +32509,7 @@ const Union$1 = class extends ASTNodeImpl {
|
|
|
31053
32509
|
};
|
|
31054
32510
|
function failSingleUnionCandidate(ast, cause, input, options) {
|
|
31055
32511
|
const issue = getSchemaIssue(cause);
|
|
31056
|
-
if (!issue) return failCause$
|
|
32512
|
+
if (!issue) return failCause$4(cause);
|
|
31057
32513
|
return fail$5(new AnyOf(ast, [issue], input, options));
|
|
31058
32514
|
}
|
|
31059
32515
|
function catchSingleUnionCandidate(ast, result, input, options) {
|
|
@@ -31122,6 +32578,36 @@ function formatIsOptional(isOptional) {
|
|
|
31122
32578
|
return isOptional ? "?" : "";
|
|
31123
32579
|
}
|
|
31124
32580
|
/**
|
|
32581
|
+
* Constructs a {@link Suspend}.
|
|
32582
|
+
*
|
|
32583
|
+
* @stability stable
|
|
32584
|
+
* @category constructors
|
|
32585
|
+
* @since 4.0.0
|
|
32586
|
+
*/
|
|
32587
|
+
const Suspend = class extends ASTNodeImpl {
|
|
32588
|
+
_tag = "Suspend";
|
|
32589
|
+
thunk;
|
|
32590
|
+
constructor(thunk, annotations, checks, encoding, context) {
|
|
32591
|
+
if (checks) throw new Error("Cannot add checks to Suspend");
|
|
32592
|
+
super(annotations, void 0, encoding, context);
|
|
32593
|
+
let ast;
|
|
32594
|
+
this.thunk = () => ast ??= thunk();
|
|
32595
|
+
}
|
|
32596
|
+
/** @internal */
|
|
32597
|
+
getParser(compile) {
|
|
32598
|
+
let parser;
|
|
32599
|
+
return (input, options) => (parser ??= compile(this.thunk()))(input, options);
|
|
32600
|
+
}
|
|
32601
|
+
/** @internal */
|
|
32602
|
+
recur(recur) {
|
|
32603
|
+
return new Suspend(() => recur(this.thunk()), this.annotations, void 0, void 0, this.context);
|
|
32604
|
+
}
|
|
32605
|
+
/** @internal */
|
|
32606
|
+
getExpected(getExpected) {
|
|
32607
|
+
return getExpected(this.thunk());
|
|
32608
|
+
}
|
|
32609
|
+
};
|
|
32610
|
+
/**
|
|
31125
32611
|
* Constructs a {@link Filter}.
|
|
31126
32612
|
*
|
|
31127
32613
|
* @stability stable
|
|
@@ -31506,13 +32992,13 @@ function canPreserveEncodingChecks(ast) {
|
|
|
31506
32992
|
* @category transforming
|
|
31507
32993
|
* @since 4.0.0
|
|
31508
32994
|
*/
|
|
31509
|
-
const toType = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
32995
|
+
const toType$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
31510
32996
|
const owner = getContextOwner(ast);
|
|
31511
32997
|
if (owner !== ast) {
|
|
31512
|
-
const type = toType(owner);
|
|
32998
|
+
const type = toType$1(owner);
|
|
31513
32999
|
return type === owner && ast.encoding === void 0 ? ast : replaceContext(type, ast.context);
|
|
31514
33000
|
}
|
|
31515
|
-
const type = "recur" in ast ? ast.recur(toType) : ast;
|
|
33001
|
+
const type = "recur" in ast ? ast.recur(toType$1) : ast;
|
|
31516
33002
|
if ("encodingChecks" in type && type.encodingChecks) {
|
|
31517
33003
|
const checks = canPreserveEncodingChecks(ast) ? type.encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(type.encodingChecks) : void 0;
|
|
31518
33004
|
return copy$1(type, {
|
|
@@ -31549,8 +33035,8 @@ const toType = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
|
31549
33035
|
* @category transforming
|
|
31550
33036
|
* @since 4.0.0
|
|
31551
33037
|
*/
|
|
31552
|
-
const toEncoded = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
31553
|
-
return toType(flip(ast));
|
|
33038
|
+
const toEncoded$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
33039
|
+
return toType$1(flip(ast));
|
|
31554
33040
|
});
|
|
31555
33041
|
function flipEncoding(ast, encoding) {
|
|
31556
33042
|
const links = encoding;
|
|
@@ -31651,6 +33137,20 @@ function isStringFinite(annotations) {
|
|
|
31651
33137
|
const finiteString = /*#__PURE__*/ appendChecks(string, [/*#__PURE__*/ isStringFinite()]);
|
|
31652
33138
|
const finiteToString = /*#__PURE__*/ new Link(finiteString, numberFromString);
|
|
31653
33139
|
const numberToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finiteString, nonFiniteLiterals]), numberFromString);
|
|
33140
|
+
const isStringBigIntRegExp = /*#__PURE__*/ new globalThis.RegExp(`^-?\\d+$`);
|
|
33141
|
+
/** @internal */
|
|
33142
|
+
function isStringBigInt(annotations) {
|
|
33143
|
+
return isPattern$1(isStringBigIntRegExp, {
|
|
33144
|
+
expected: "a string representing a bigint",
|
|
33145
|
+
representation: {
|
|
33146
|
+
id: "effect/schema/isStringBigInt",
|
|
33147
|
+
payload: null
|
|
33148
|
+
},
|
|
33149
|
+
toJsonSchema: () => ({ pattern: isStringBigIntRegExp.source }),
|
|
33150
|
+
...annotations
|
|
33151
|
+
});
|
|
33152
|
+
}
|
|
33153
|
+
const bigIntToString = /*#__PURE__*/ new Link(/* @__PURE__ */ appendChecks(string, [/*#__PURE__*/ isStringBigInt({ expected: "a string representing a bigint" })]), bigintFromString);
|
|
31654
33154
|
/** @internal */
|
|
31655
33155
|
function collectIssues(checks, value, issues, ast, options) {
|
|
31656
33156
|
for (let i = 0; i < checks.length; i++) {
|
|
@@ -31676,6 +33176,33 @@ function getConstructorDescriptor(ast) {
|
|
|
31676
33176
|
const getDescriptor = ast.annotations?.[CONSTRUCTOR_ANNOTATION_KEY];
|
|
31677
33177
|
return isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;
|
|
31678
33178
|
}
|
|
33179
|
+
/**
|
|
33180
|
+
* Returns the `identifier` annotation from the AST node, if set.
|
|
33181
|
+
*
|
|
33182
|
+
* **Details**
|
|
33183
|
+
*
|
|
33184
|
+
* The identifier is typically set by `Schema.annotations({ identifier: "..." })`
|
|
33185
|
+
* and is used for error messages and schema identification.
|
|
33186
|
+
*
|
|
33187
|
+
* @see {@link resolve}
|
|
33188
|
+
* @see {@link resolveTitle}
|
|
33189
|
+
* @stability stable
|
|
33190
|
+
* @category annotations
|
|
33191
|
+
* @since 4.0.0
|
|
33192
|
+
*/
|
|
33193
|
+
const resolveIdentifier = resolveIdentifier$1;
|
|
33194
|
+
/**
|
|
33195
|
+
* Returns the `description` annotation from the AST node, if set.
|
|
33196
|
+
*
|
|
33197
|
+
* @see {@link resolve}
|
|
33198
|
+
* @see {@link resolveTitle}
|
|
33199
|
+
* @see {@link resolveIdentifier}
|
|
33200
|
+
*
|
|
33201
|
+
* @stability stable
|
|
33202
|
+
* @category annotations
|
|
33203
|
+
* @since 4.0.0
|
|
33204
|
+
*/
|
|
33205
|
+
const resolveDescription = resolveDescription$1;
|
|
31679
33206
|
function isJsonLeaf(u) {
|
|
31680
33207
|
return u === null || typeof u === "string" || typeof u === "boolean" || typeof u === "number" && globalThis.Number.isFinite(u);
|
|
31681
33208
|
}
|
|
@@ -31745,6 +33272,11 @@ const Json$1 = /*#__PURE__*/ new Declaration([], () => (input, ast, options) =>
|
|
|
31745
33272
|
toCodecStringTree: () => unknownToStringTree
|
|
31746
33273
|
});
|
|
31747
33274
|
/** @internal */
|
|
33275
|
+
const MutableJson$1 = /*#__PURE__*/ annotate(Json$1, { representation: {
|
|
33276
|
+
id: "effect/schema/MutableJson",
|
|
33277
|
+
payload: null
|
|
33278
|
+
} });
|
|
33279
|
+
/** @internal */
|
|
31748
33280
|
const unknownToJson = /*#__PURE__*/ new Link(Json$1, /*#__PURE__*/ passthrough());
|
|
31749
33281
|
/** @internal */
|
|
31750
33282
|
const objectKeywordToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Arrays(false, [], [Json$1]), /*#__PURE__*/ new Objects([], [/*#__PURE__*/ new IndexSignature(string, Json$1)])]), /*#__PURE__*/ passthrough());
|
|
@@ -32272,7 +33804,7 @@ const fromDuplex = (options) => fromTransform$1((upstream, scope) => {
|
|
|
32272
33804
|
encoding: options.encoding
|
|
32273
33805
|
}).pipe(catchCause$1((cause) => {
|
|
32274
33806
|
if (isDoneCause(cause)) return void_$1;
|
|
32275
|
-
exit.current = failCause$
|
|
33807
|
+
exit.current = failCause$4(cause);
|
|
32276
33808
|
latch.openUnsafe();
|
|
32277
33809
|
return void_$1;
|
|
32278
33810
|
}), forkIn(scope), flatMap$2(() => readableToPullUnsafe({
|
|
@@ -32638,7 +34170,7 @@ const layer$12 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
32638
34170
|
return sync(stop);
|
|
32639
34171
|
});
|
|
32640
34172
|
const terminateProcessGroup = fnUntraced(function* (command, childProcess, exitSignal, options) {
|
|
32641
|
-
const signalGroup = (signal) => killProcessGroup(command, childProcess, signal).pipe(catch_$
|
|
34173
|
+
const signalGroup = (signal) => killProcessGroup(command, childProcess, signal).pipe(catch_$2(() => killProcess(command, childProcess, signal)));
|
|
32642
34174
|
yield* signalGroup(options?.killSignal ?? "SIGTERM");
|
|
32643
34175
|
if (isUndefined(options?.forceKillAfter)) yield* awaitProcessExit(childProcess, exitSignal, processGroupGraceMillis);
|
|
32644
34176
|
else {
|
|
@@ -33264,7 +34796,7 @@ const Proto$5 = {
|
|
|
33264
34796
|
return this.toString();
|
|
33265
34797
|
},
|
|
33266
34798
|
toString() {
|
|
33267
|
-
return `<redacted${isString(this.label) ? ":" + this.label : ""}>`;
|
|
34799
|
+
return `<redacted${isString$1(this.label) ? ":" + this.label : ""}>`;
|
|
33268
34800
|
},
|
|
33269
34801
|
[symbol$2]() {
|
|
33270
34802
|
return hash(redactedRegistry.get(this));
|
|
@@ -34673,7 +36205,7 @@ function makeEffect(schema) {
|
|
|
34673
36205
|
const ast = schema.ast;
|
|
34674
36206
|
let parser;
|
|
34675
36207
|
return (input, options) => {
|
|
34676
|
-
return (parser ??= runWithCompiler(constructorCompiler, toType(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
|
|
36208
|
+
return (parser ??= runWithCompiler(constructorCompiler, toType$1(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
|
|
34677
36209
|
...options.parseOptions,
|
|
34678
36210
|
disableChecks: true
|
|
34679
36211
|
} : { disableChecks: true } : options?.parseOptions);
|
|
@@ -34734,7 +36266,7 @@ function makeOption(schema) {
|
|
|
34734
36266
|
* @since 4.0.0
|
|
34735
36267
|
*/
|
|
34736
36268
|
function make$13(schema) {
|
|
34737
|
-
return makeConstructorSync(toType(schema.ast));
|
|
36269
|
+
return makeConstructorSync(toType$1(schema.ast));
|
|
34738
36270
|
}
|
|
34739
36271
|
/**
|
|
34740
36272
|
* Creates a type guard that checks whether an input satisfies the schema's decoded
|
|
@@ -34776,7 +36308,7 @@ function makeIs(ast) {
|
|
|
34776
36308
|
}
|
|
34777
36309
|
/** @internal */
|
|
34778
36310
|
function _is(ast) {
|
|
34779
|
-
const typeAST = toType(ast);
|
|
36311
|
+
const typeAST = toType$1(ast);
|
|
34780
36312
|
let guard = (input) => {
|
|
34781
36313
|
guard = makeIs(typeAST);
|
|
34782
36314
|
return guard(input);
|
|
@@ -34811,6 +36343,10 @@ function decodeUnknownEffect$1(schema, options) {
|
|
|
34811
36343
|
const parser = run(schema.ast);
|
|
34812
36344
|
return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
34813
36345
|
}
|
|
36346
|
+
/** @internal */
|
|
36347
|
+
function decodeUnknownOption$1(schema, options) {
|
|
36348
|
+
return asOption(decodeUnknownEffect$1(schema, options));
|
|
36349
|
+
}
|
|
34814
36350
|
/**
|
|
34815
36351
|
* Creates an effectful encoder for `unknown` input.
|
|
34816
36352
|
*
|
|
@@ -34866,6 +36402,16 @@ function runWithCompiler(compiler, ast) {
|
|
|
34866
36402
|
function asExit(parser) {
|
|
34867
36403
|
return (input, options) => runSyncExit(parser(input, options));
|
|
34868
36404
|
}
|
|
36405
|
+
/** @internal */
|
|
36406
|
+
function asOption(parser) {
|
|
36407
|
+
const parserExit = asExit(parser);
|
|
36408
|
+
return (input, options) => {
|
|
36409
|
+
const exit = parserExit(input, options);
|
|
36410
|
+
if (isSuccess(exit)) return some$1(exit.value);
|
|
36411
|
+
getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
|
|
36412
|
+
return none();
|
|
36413
|
+
};
|
|
36414
|
+
}
|
|
34869
36415
|
function runSync(effect, message) {
|
|
34870
36416
|
const exit = runSyncExit(effect);
|
|
34871
36417
|
if (isSuccess(exit)) return exit.value;
|
|
@@ -34887,7 +36433,7 @@ function makeConstructorSync(ast) {
|
|
|
34887
36433
|
try {
|
|
34888
36434
|
output = make(input, parseOptions);
|
|
34889
36435
|
} catch (error) {
|
|
34890
|
-
getSchemaIssueOrThrow(die$
|
|
36436
|
+
getSchemaIssueOrThrow(die$3(error), "Constructor adapter can only throw schema issues");
|
|
34891
36437
|
throw error;
|
|
34892
36438
|
}
|
|
34893
36439
|
if (output !== invalid$1 && output !== missing) return output;
|
|
@@ -35054,6 +36600,45 @@ function decodeUriFragment(fragment) {
|
|
|
35054
36600
|
return;
|
|
35055
36601
|
}
|
|
35056
36602
|
}
|
|
36603
|
+
/**
|
|
36604
|
+
* Parses a JSON Pointer URI fragment into decoded path tokens.
|
|
36605
|
+
*
|
|
36606
|
+
* **When to use**
|
|
36607
|
+
*
|
|
36608
|
+
* Use when you need to resolve a URI fragment against a JSON document.
|
|
36609
|
+
*
|
|
36610
|
+
* **Details**
|
|
36611
|
+
*
|
|
36612
|
+
* Percent-encoding is decoded before the pointer is split into tokens, then
|
|
36613
|
+
* each token is decoded with {@link unescapeToken}. The empty string and `#`
|
|
36614
|
+
* both represent the document root.
|
|
36615
|
+
*
|
|
36616
|
+
* **Gotchas**
|
|
36617
|
+
*
|
|
36618
|
+
* Returns `undefined` when the input is not a URI fragment, contains characters
|
|
36619
|
+
* that require percent-encoding, or contains an invalid JSON Pointer escape
|
|
36620
|
+
* sequence.
|
|
36621
|
+
*
|
|
36622
|
+
* **Example** (Parsing URI fragments)
|
|
36623
|
+
*
|
|
36624
|
+
* ```ts import.meta.vitest
|
|
36625
|
+
* import { JsonPointer } from "effect"
|
|
36626
|
+
*
|
|
36627
|
+
* JsonPointer.parseUriFragment("#/users/a~1b") // => ["users", "a/b"]
|
|
36628
|
+
* JsonPointer.parseUriFragment("#/caf%C3%A9") // => ["café"]
|
|
36629
|
+
* JsonPointer.parseUriFragment("#/%") // => undefined
|
|
36630
|
+
* JsonPointer.parseUriFragment("#/a#b") // => undefined
|
|
36631
|
+
* ```
|
|
36632
|
+
*
|
|
36633
|
+
* @see {@link formatUriFragment} for the inverse operation
|
|
36634
|
+
* @stability stable
|
|
36635
|
+
* @category decoding
|
|
36636
|
+
* @since 4.0.0
|
|
36637
|
+
*/
|
|
36638
|
+
function parseUriFragment(fragment) {
|
|
36639
|
+
const pointer = decodeUriFragment(fragment);
|
|
36640
|
+
return pointer === void 0 ? void 0 : pointer.length === 0 ? [] : pointer.slice(1).split("/").map(unescapeToken);
|
|
36641
|
+
}
|
|
35057
36642
|
//#endregion
|
|
35058
36643
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/JsonSchema.js
|
|
35059
36644
|
/**
|
|
@@ -35067,6 +36652,11 @@ function decodeUriFragment(fragment) {
|
|
|
35067
36652
|
* @stability stable
|
|
35068
36653
|
* @since 4.0.0
|
|
35069
36654
|
*/
|
|
36655
|
+
/** @internal */
|
|
36656
|
+
function getReferenceKey($ref) {
|
|
36657
|
+
const path = $ref.startsWith("#") ? parseUriFragment($ref) : void 0;
|
|
36658
|
+
return path !== void 0 && path.length === 2 && path[0] === "$defs" ? path[1] : void 0;
|
|
36659
|
+
}
|
|
35070
36660
|
function transformSchema(node, transform) {
|
|
35071
36661
|
return walk(node, false, true);
|
|
35072
36662
|
function walk(node, inheritedResource, isRoot = false) {
|
|
@@ -35164,7 +36754,7 @@ function validateCanonicalObjectPropertyNames(ast) {
|
|
|
35164
36754
|
}
|
|
35165
36755
|
function makeReorder(getPriority) {
|
|
35166
36756
|
return (types) => {
|
|
35167
|
-
const sortedTypes = [...types].sort((a, b) => getPriority(toEncoded(a)) - getPriority(toEncoded(b)));
|
|
36757
|
+
const sortedTypes = [...types].sort((a, b) => getPriority(toEncoded$1(a)) - getPriority(toEncoded$1(b)));
|
|
35168
36758
|
if (!sortedTypes.some((ast, index) => ast !== types[index])) return types;
|
|
35169
36759
|
return sortedTypes;
|
|
35170
36760
|
};
|
|
@@ -35182,7 +36772,7 @@ function toCodecJsonASTStep(ast, recur) {
|
|
|
35182
36772
|
case "Declaration": {
|
|
35183
36773
|
const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
|
|
35184
36774
|
if (!isFunction(getLink)) return replaceEncoding(ast, [unknownToJson]);
|
|
35185
|
-
const link = getLink(ast.typeParameters.map((tp) => make$12(toEncoded(tp))));
|
|
36775
|
+
const link = getLink(ast.typeParameters.map((tp) => make$12(toEncoded$1(tp))));
|
|
35186
36776
|
return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, recur)]);
|
|
35187
36777
|
}
|
|
35188
36778
|
case "Unknown": return replaceEncoding(ast, [unknownToJson]);
|
|
@@ -35225,7 +36815,7 @@ const toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
|
|
|
35225
36815
|
function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
|
|
35226
36816
|
switch (ast._tag) {
|
|
35227
36817
|
case "Declaration": {
|
|
35228
|
-
const typeParameters = ast.typeParameters.map((tp) => make$12(recur(toEncoded(tp))));
|
|
36818
|
+
const typeParameters = ast.typeParameters.map((tp) => make$12(recur(toEncoded$1(tp))));
|
|
35229
36819
|
const getStringTreeLink = ast.annotations?.toCodecStringTree;
|
|
35230
36820
|
if (isFunction(getStringTreeLink)) {
|
|
35231
36821
|
const link = getStringTreeLink(typeParameters);
|
|
@@ -35915,8 +37505,8 @@ function toRepresentations(asts, options) {
|
|
|
35915
37505
|
function getCandidate(input) {
|
|
35916
37506
|
const ast = getLastEncoding(input);
|
|
35917
37507
|
const owner = getContextOwner(ast);
|
|
35918
|
-
let identifier = resolveIdentifier(ast);
|
|
35919
|
-
const fallback = identifier === void 0 ? (ast !== input ? resolveIdentifier(input) : void 0) ?? resolveIdentifierFallback(ast) : void 0;
|
|
37508
|
+
let identifier = resolveIdentifier$1(ast);
|
|
37509
|
+
const fallback = identifier === void 0 ? (ast !== input ? resolveIdentifier$1(input) : void 0) ?? resolveIdentifierFallback(ast) : void 0;
|
|
35920
37510
|
if (fallback !== void 0) identifier = `${fallback}Encoded`;
|
|
35921
37511
|
let candidatesByIdentifier = candidates.get(owner);
|
|
35922
37512
|
if (candidatesByIdentifier === void 0) {
|
|
@@ -35967,7 +37557,7 @@ function toRepresentations(asts, options) {
|
|
|
35967
37557
|
}
|
|
35968
37558
|
function visitChecks(checks) {
|
|
35969
37559
|
checks?.forEach((check) => {
|
|
35970
|
-
check.annotations?.representation?.schemas?.forEach((schema) => visit(toType(schema)));
|
|
37560
|
+
check.annotations?.representation?.schemas?.forEach((schema) => visit(toType$1(schema)));
|
|
35971
37561
|
if (check._tag === "FilterGroup") visitChecks(check.checks);
|
|
35972
37562
|
});
|
|
35973
37563
|
}
|
|
@@ -36107,7 +37697,7 @@ function toRepresentations(asts, options) {
|
|
|
36107
37697
|
const { representation, ...ordinary } = annotations;
|
|
36108
37698
|
const projected = representation === void 0 ? void 0 : representation.schemas === void 0 ? representation : {
|
|
36109
37699
|
...representation,
|
|
36110
|
-
schemas: representation.schemas.map((schema) => recur(toType(schema)))
|
|
37700
|
+
schemas: representation.schemas.map((schema) => recur(toType$1(schema)))
|
|
36111
37701
|
};
|
|
36112
37702
|
return {
|
|
36113
37703
|
...projected === void 0 ? void 0 : { representation: projected },
|
|
@@ -36391,7 +37981,7 @@ function fromIssueEffect(self) {
|
|
|
36391
37981
|
return catchCause$1(self, (cause) => failCauseSync(() => map$4(cause, (issue) => new SchemaError(issue))));
|
|
36392
37982
|
}
|
|
36393
37983
|
function fromIssueExit(exit) {
|
|
36394
|
-
return isSuccess(exit) ? exit : failCause$
|
|
37984
|
+
return isSuccess(exit) ? exit : failCause$4(map$4(exit.cause, (issue) => new SchemaError(issue)));
|
|
36395
37985
|
}
|
|
36396
37986
|
function getSchemaErrorOrThrow(cause, message) {
|
|
36397
37987
|
let schemaError;
|
|
@@ -36498,6 +38088,34 @@ function decodeUnknownEffect(schema, options) {
|
|
|
36498
38088
|
*/
|
|
36499
38089
|
const decodeEffect = decodeUnknownEffect;
|
|
36500
38090
|
/**
|
|
38091
|
+
* Decodes an `unknown` input against a schema, returning an `Option` that is
|
|
38092
|
+
* `Some` with the decoded value on success or `None` for schema mismatches.
|
|
38093
|
+
*
|
|
38094
|
+
* **When to use**
|
|
38095
|
+
*
|
|
38096
|
+
* Use when you do not know the input type statically and only need to know
|
|
38097
|
+
* whether decoding succeeded.
|
|
38098
|
+
*
|
|
38099
|
+
* **Details**
|
|
38100
|
+
*
|
|
38101
|
+
* Prefer this over {@link decodeUnknownExit} or {@link decodeUnknownEffect}
|
|
38102
|
+
* when you don't need error details. For input already typed as the schema's
|
|
38103
|
+
* `Encoded` type use {@link decodeOption}.
|
|
38104
|
+
* Options may be provided either when creating the decoder or when applying it;
|
|
38105
|
+
* application options override creation options.
|
|
38106
|
+
*
|
|
38107
|
+
* **Gotchas**
|
|
38108
|
+
*
|
|
38109
|
+
* Only causes made entirely of schema issues are converted to `None`. Causes
|
|
38110
|
+
* that contain defects, interruptions, or other non-schema reasons throw
|
|
38111
|
+
* instead.
|
|
38112
|
+
*
|
|
38113
|
+
* @stability stable
|
|
38114
|
+
* @category decoding
|
|
38115
|
+
* @since 3.10.0
|
|
38116
|
+
*/
|
|
38117
|
+
const decodeUnknownOption = decodeUnknownOption$1;
|
|
38118
|
+
/**
|
|
36501
38119
|
* Decodes an `unknown` input against a schema synchronously, returning the
|
|
36502
38120
|
* decoded value or throwing a {@link SchemaError} for schema mismatches.
|
|
36503
38121
|
*
|
|
@@ -36777,6 +38395,24 @@ const optional = /*#__PURE__*/ lambda((self) => {
|
|
|
36777
38395
|
return make$11(optional$1(self.ast), { schema });
|
|
36778
38396
|
});
|
|
36779
38397
|
/**
|
|
38398
|
+
* Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
|
|
38399
|
+
* discarding the encoding transformation path.
|
|
38400
|
+
*
|
|
38401
|
+
* @stability stable
|
|
38402
|
+
* @category transforming
|
|
38403
|
+
* @since 4.0.0
|
|
38404
|
+
*/
|
|
38405
|
+
const toType = /*#__PURE__*/ lambda((schema) => make$11(toType$1(schema.ast), { schema }));
|
|
38406
|
+
/**
|
|
38407
|
+
* Extracts the encoded-side schema: sets `Type` to equal the `Encoded`,
|
|
38408
|
+
* discarding the decoding transformation path.
|
|
38409
|
+
*
|
|
38410
|
+
* @stability stable
|
|
38411
|
+
* @category transforming
|
|
38412
|
+
* @since 4.0.0
|
|
38413
|
+
*/
|
|
38414
|
+
const toEncoded = /*#__PURE__*/ lambda((schema) => make$11(toEncoded$1(schema.ast), { schema }));
|
|
38415
|
+
/**
|
|
36780
38416
|
* Creates a schema for a single literal value (string, number, bigint, boolean, or null).
|
|
36781
38417
|
*
|
|
36782
38418
|
* **Example** (Defining a string literal)
|
|
@@ -36896,6 +38532,21 @@ const Number$1 = /*#__PURE__*/ make$11(number);
|
|
|
36896
38532
|
*/
|
|
36897
38533
|
const Boolean$1 = /*#__PURE__*/ make$11(boolean);
|
|
36898
38534
|
/**
|
|
38535
|
+
* Schema for `bigint` values. Validates that the input is `typeof` `"bigint"`.
|
|
38536
|
+
*
|
|
38537
|
+
* **When to use**
|
|
38538
|
+
*
|
|
38539
|
+
* Use when the input is already a bigint and the schema should validate and
|
|
38540
|
+
* preserve bigint values without parsing from another representation.
|
|
38541
|
+
*
|
|
38542
|
+
* @see {@link BigIntFromString} for parsing string input into a bigint
|
|
38543
|
+
*
|
|
38544
|
+
* @stability stable
|
|
38545
|
+
* @category schemas
|
|
38546
|
+
* @since 4.0.0
|
|
38547
|
+
*/
|
|
38548
|
+
const BigInt$1 = /*#__PURE__*/ make$11(bigInt);
|
|
38549
|
+
/**
|
|
36899
38550
|
* Schema for a TypeScript `void` return value.
|
|
36900
38551
|
*
|
|
36901
38552
|
* **When to use**
|
|
@@ -37061,6 +38712,34 @@ const ArraySchema = /*#__PURE__*/ lambda((schema) => make$11(new Arrays(false, [
|
|
|
37061
38712
|
* @since 3.10.0
|
|
37062
38713
|
*/
|
|
37063
38714
|
const NonEmptyArray = /*#__PURE__*/ lambda((schema) => make$11(new Arrays(false, [schema.ast], [schema.ast]), { value: schema }));
|
|
38715
|
+
/**
|
|
38716
|
+
* Makes an array or tuple schema mutable, removing the `readonly` modifier.
|
|
38717
|
+
*
|
|
38718
|
+
* **Gotchas**
|
|
38719
|
+
*
|
|
38720
|
+
* This combinator does not support an encoding attached to the array or tuple
|
|
38721
|
+
* node and throws if one is present. Encodings on element schemas are
|
|
38722
|
+
* supported.
|
|
38723
|
+
*
|
|
38724
|
+
* **Example** (Defining mutable arrays)
|
|
38725
|
+
*
|
|
38726
|
+
* ```ts import.meta.vitest
|
|
38727
|
+
* import { Schema } from "effect"
|
|
38728
|
+
*
|
|
38729
|
+
* const schema = Schema.mutable(Schema.Array(Schema.Number))
|
|
38730
|
+
*
|
|
38731
|
+
* // number[] (mutable)
|
|
38732
|
+
* type T = typeof schema.Type
|
|
38733
|
+
* const value: T = [1, 2]
|
|
38734
|
+
* value.push(3)
|
|
38735
|
+
* value // => [1, 2, 3]
|
|
38736
|
+
* ```
|
|
38737
|
+
*
|
|
38738
|
+
* @stability stable
|
|
38739
|
+
* @category transforming
|
|
38740
|
+
* @since 3.10.0
|
|
38741
|
+
*/
|
|
38742
|
+
const mutable = /*#__PURE__*/ lambda((schema) => make$11(mutable$1(schema.ast), { schema }));
|
|
37064
38743
|
function makeUnion(ast, members) {
|
|
37065
38744
|
return make$11(ast, {
|
|
37066
38745
|
members,
|
|
@@ -37178,6 +38857,17 @@ function decodeTo(to, transformation) {
|
|
|
37178
38857
|
});
|
|
37179
38858
|
};
|
|
37180
38859
|
}
|
|
38860
|
+
/**
|
|
38861
|
+
* Constructs a decode-only `SchemaAST.Link`.
|
|
38862
|
+
*
|
|
38863
|
+
* @internal
|
|
38864
|
+
*/
|
|
38865
|
+
function linkDecoding() {
|
|
38866
|
+
return (to, decode) => link$1()(to, {
|
|
38867
|
+
decode,
|
|
38868
|
+
encode: forbiddenEncoding
|
|
38869
|
+
});
|
|
38870
|
+
}
|
|
37181
38871
|
/** @internal */
|
|
37182
38872
|
const TrueLiterals = /*#__PURE__*/ Literals([
|
|
37183
38873
|
"true",
|
|
@@ -37199,6 +38889,11 @@ const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...Fal
|
|
|
37199
38889
|
decode: (value) => value === "true" || value === "yes" || value === "on" || value === "1" || value === "y",
|
|
37200
38890
|
encode: (value) => value ? "true" : "false"
|
|
37201
38891
|
})));
|
|
38892
|
+
function encodeTo(to, transformation) {
|
|
38893
|
+
return (from) => {
|
|
38894
|
+
return transformation ? decodeTo(from, transformation)(to) : decodeTo(from)(to);
|
|
38895
|
+
};
|
|
38896
|
+
}
|
|
37202
38897
|
/**
|
|
37203
38898
|
* Attaches a constructor default value to a schema field.
|
|
37204
38899
|
*
|
|
@@ -37229,6 +38924,100 @@ const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...Fal
|
|
|
37229
38924
|
function withConstructorDefault(defaultValue) {
|
|
37230
38925
|
return (schema) => make$11(withConstructorDefault$1(schema.ast, defaultValue), { schema });
|
|
37231
38926
|
}
|
|
38927
|
+
function toIssueEffect(self) {
|
|
38928
|
+
return catchCause$1(self, (cause) => failCauseSync(() => map$4(cause, (error) => error.issue)));
|
|
38929
|
+
}
|
|
38930
|
+
/**
|
|
38931
|
+
* Makes a struct key optional on the `Encoded` side and provides a default
|
|
38932
|
+
* `Encoded` value when the key is missing during decoding.
|
|
38933
|
+
*
|
|
38934
|
+
* **Details**
|
|
38935
|
+
*
|
|
38936
|
+
* The key uses `optionalKey` on the encoded side, so it may be absent from the
|
|
38937
|
+
* input object but **not** `undefined`. The default value is specified in terms
|
|
38938
|
+
* of the `Encoded` type (before any decoding transformations).
|
|
38939
|
+
*
|
|
38940
|
+
* Options:
|
|
38941
|
+
*
|
|
38942
|
+
* - `encodingStrategy`:
|
|
38943
|
+
* - `"passthrough"` (default): include the value in the encoded output.
|
|
38944
|
+
* - `"omit"`: omit the key from the encoded output.
|
|
38945
|
+
*
|
|
38946
|
+
* **Example** (Providing a default for a missing struct key)
|
|
38947
|
+
*
|
|
38948
|
+
* ```ts import.meta.vitest
|
|
38949
|
+
* import { Effect, Schema } from "effect"
|
|
38950
|
+
*
|
|
38951
|
+
* const MySchema = Schema.Struct({
|
|
38952
|
+
* name: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed("anonymous")))
|
|
38953
|
+
* })
|
|
38954
|
+
*
|
|
38955
|
+
* Schema.decodeUnknownSync(MySchema)({}).name // => "anonymous"
|
|
38956
|
+
* ```
|
|
38957
|
+
*
|
|
38958
|
+
* @see {@link withDecodingDefault} for the value-level variant (key absent **or** `undefined`)
|
|
38959
|
+
* @see {@link withDecodingDefaultTypeKey} for the variant where the default is a `Type` value
|
|
38960
|
+
* @stability stable
|
|
38961
|
+
* @category decoding
|
|
38962
|
+
* @since 4.0.0
|
|
38963
|
+
*/
|
|
38964
|
+
function withDecodingDefaultKey(defaultValue, options) {
|
|
38965
|
+
const encode = options?.encodingStrategy === "omit" ? omit$1() : passthrough$1();
|
|
38966
|
+
return (self) => {
|
|
38967
|
+
return optionalKey(toEncoded(self)).pipe(decodeTo(self, {
|
|
38968
|
+
decode: withDefault$2(toIssueEffect(defaultValue)),
|
|
38969
|
+
encode
|
|
38970
|
+
}));
|
|
38971
|
+
};
|
|
38972
|
+
}
|
|
38973
|
+
/**
|
|
38974
|
+
* Wraps the `Encoded` side with `optional` (key absent **or** `undefined`)
|
|
38975
|
+
* and provides a default `Encoded` value when the field is missing or
|
|
38976
|
+
* `undefined` during decoding.
|
|
38977
|
+
*
|
|
38978
|
+
* **When to use**
|
|
38979
|
+
*
|
|
38980
|
+
* Use when the default is expressed in the encoded representation, before the
|
|
38981
|
+
* field's decoding transformation runs.
|
|
38982
|
+
*
|
|
38983
|
+
* **Details**
|
|
38984
|
+
*
|
|
38985
|
+
* The default value is specified in terms of the `Encoded` type (before any
|
|
38986
|
+
* decoding transformations).
|
|
38987
|
+
*
|
|
38988
|
+
* Options:
|
|
38989
|
+
*
|
|
38990
|
+
* - `encodingStrategy`:
|
|
38991
|
+
* - `"passthrough"` (default): include the value in the encoded output.
|
|
38992
|
+
* - `"omit"`: omit the key from the encoded output.
|
|
38993
|
+
*
|
|
38994
|
+
* **Example** (Providing a default for an optional field value)
|
|
38995
|
+
*
|
|
38996
|
+
* ```ts import.meta.vitest
|
|
38997
|
+
* import { Effect, Schema } from "effect"
|
|
38998
|
+
*
|
|
38999
|
+
* const MySchema = Schema.Struct({
|
|
39000
|
+
* name: Schema.String.pipe(Schema.optional, Schema.withDecodingDefault(Effect.succeed("anonymous")))
|
|
39001
|
+
* })
|
|
39002
|
+
*
|
|
39003
|
+
* Schema.decodeUnknownSync(MySchema)({ name: undefined }).name // => "anonymous"
|
|
39004
|
+
* ```
|
|
39005
|
+
*
|
|
39006
|
+
* @see {@link withDecodingDefaultKey} for the key-level variant (key absent only, not `undefined`)
|
|
39007
|
+
* @see {@link withDecodingDefaultType} for the variant where the default is a `Type` value
|
|
39008
|
+
* @stability stable
|
|
39009
|
+
* @category decoding
|
|
39010
|
+
* @since 3.10.0
|
|
39011
|
+
*/
|
|
39012
|
+
function withDecodingDefault(defaultValue, options) {
|
|
39013
|
+
const encode = options?.encodingStrategy === "omit" ? omit$1() : passthrough$1();
|
|
39014
|
+
return (self) => {
|
|
39015
|
+
return optional(toEncoded(self)).pipe(decodeTo(self, {
|
|
39016
|
+
decode: withDefault$2(toIssueEffect(defaultValue)),
|
|
39017
|
+
encode
|
|
39018
|
+
}));
|
|
39019
|
+
};
|
|
39020
|
+
}
|
|
37232
39021
|
/**
|
|
37233
39022
|
* Combines a {@link Literal} schema with {@link withConstructorDefault}, making it ideal
|
|
37234
39023
|
* for discriminator fields in tagged unions. When constructing via `make`, the
|
|
@@ -37495,6 +39284,29 @@ function isUUID(version, annotations) {
|
|
|
37495
39284
|
*/
|
|
37496
39285
|
const Finite = /*#__PURE__*/ make$11(finite);
|
|
37497
39286
|
/**
|
|
39287
|
+
* Creates a greater-than-or-equal-to (`>=`) check for any ordered type from an
|
|
39288
|
+
* `Order.Order` instance.
|
|
39289
|
+
*
|
|
39290
|
+
* @stability stable
|
|
39291
|
+
* @category validation
|
|
39292
|
+
* @since 4.0.0
|
|
39293
|
+
*/
|
|
39294
|
+
function makeIsGreaterThanOrEqualTo(options) {
|
|
39295
|
+
const gte = isGreaterThanOrEqualTo$1(options.order);
|
|
39296
|
+
const formatter = options.formatter ?? format$2;
|
|
39297
|
+
return (minimum, annotations) => {
|
|
39298
|
+
return makeFilter((input) => gte(input, minimum), {
|
|
39299
|
+
expected: `a value greater than or equal to ${formatter(minimum)}`,
|
|
39300
|
+
arbitraryConstraint: {
|
|
39301
|
+
order: options.order,
|
|
39302
|
+
minimum
|
|
39303
|
+
},
|
|
39304
|
+
...options.annotate?.(minimum),
|
|
39305
|
+
...annotations
|
|
39306
|
+
});
|
|
39307
|
+
};
|
|
39308
|
+
}
|
|
39309
|
+
/**
|
|
37498
39310
|
* Creates an inclusive or exclusive range check for any ordered type from an
|
|
37499
39311
|
* `Order.Order` instance.
|
|
37500
39312
|
*
|
|
@@ -37530,6 +39342,36 @@ function encodeNumberPayload(number) {
|
|
|
37530
39342
|
return number;
|
|
37531
39343
|
}
|
|
37532
39344
|
/**
|
|
39345
|
+
* Validates that a number is greater than or equal to the specified value
|
|
39346
|
+
* (inclusive).
|
|
39347
|
+
*
|
|
39348
|
+
* **Details**
|
|
39349
|
+
*
|
|
39350
|
+
* JSON Schema:
|
|
39351
|
+
*
|
|
39352
|
+
* This check corresponds to the `minimum` constraint in JSON Schema.
|
|
39353
|
+
*
|
|
39354
|
+
* Arbitrary:
|
|
39355
|
+
*
|
|
39356
|
+
* During arbitrary generation, this applies a `minimum` constraint
|
|
39357
|
+
* to ensure generated numbers are greater than or equal to the specified value.
|
|
39358
|
+
*
|
|
39359
|
+
* @stability stable
|
|
39360
|
+
* @category validation
|
|
39361
|
+
* @since 4.0.0
|
|
39362
|
+
*/
|
|
39363
|
+
const isGreaterThanOrEqualTo = /*#__PURE__*/ makeIsGreaterThanOrEqualTo({
|
|
39364
|
+
order: Number$5,
|
|
39365
|
+
annotate: (minimum) => ({
|
|
39366
|
+
representation: {
|
|
39367
|
+
id: "effect/schema/isGreaterThanOrEqualTo",
|
|
39368
|
+
payload: { minimum: encodeNumberPayload(minimum) }
|
|
39369
|
+
},
|
|
39370
|
+
toJsonSchema: () => ({ minimum }),
|
|
39371
|
+
toCode: () => ({ runtime: `Schema.isGreaterThanOrEqualTo(${format$2(minimum)})` })
|
|
39372
|
+
})
|
|
39373
|
+
});
|
|
39374
|
+
/**
|
|
37533
39375
|
* Validates that a number is within a specified range. The range boundaries can
|
|
37534
39376
|
* be inclusive or exclusive based on the provided options.
|
|
37535
39377
|
*
|
|
@@ -37804,6 +39646,22 @@ const URL$2 = /*#__PURE__*/ instanceOf(globalThis.URL, {
|
|
|
37804
39646
|
expected: "URL",
|
|
37805
39647
|
toCodecJson: () => link$1()(URLString, urlFromString)
|
|
37806
39648
|
});
|
|
39649
|
+
/**
|
|
39650
|
+
* Schema that decodes a `string` into a `URL`.
|
|
39651
|
+
*
|
|
39652
|
+
* **Details**
|
|
39653
|
+
*
|
|
39654
|
+
* Decoding:
|
|
39655
|
+
* - A **valid** URL `string` is decoded as a `URL`
|
|
39656
|
+
*
|
|
39657
|
+
* Encoding:
|
|
39658
|
+
* - A `URL` is encoded as a `string`
|
|
39659
|
+
*
|
|
39660
|
+
* @stability stable
|
|
39661
|
+
* @category schemas
|
|
39662
|
+
* @since 4.0.0
|
|
39663
|
+
*/
|
|
39664
|
+
const URLFromString = /*#__PURE__*/ URLString.pipe(/*#__PURE__*/ decodeTo(URL$2, urlFromString));
|
|
37807
39665
|
const JsonString = /*#__PURE__*/ String$2.annotate({
|
|
37808
39666
|
expected: "a string that will be decoded as JSON",
|
|
37809
39667
|
contentMediaType: "application/json"
|
|
@@ -37875,6 +39733,23 @@ const Uint8Array$1 = /*#__PURE__*/ instanceOf(globalThis.Uint8Array, {
|
|
|
37875
39733
|
toCodecJson: () => link$1()(Base64String, uint8ArrayFromBase64String)
|
|
37876
39734
|
});
|
|
37877
39735
|
/**
|
|
39736
|
+
* Schema that decodes a base64 encoded string into a
|
|
39737
|
+
* `Uint8Array`.
|
|
39738
|
+
*
|
|
39739
|
+
* **Details**
|
|
39740
|
+
*
|
|
39741
|
+
* Decoding:
|
|
39742
|
+
* - A **valid** base64 encoded string is decoded as a `Uint8Array`.
|
|
39743
|
+
*
|
|
39744
|
+
* Encoding:
|
|
39745
|
+
* - A `Uint8Array` is encoded as a base64-encoded string.
|
|
39746
|
+
*
|
|
39747
|
+
* @stability stable
|
|
39748
|
+
* @category schemas
|
|
39749
|
+
* @since 3.10.0
|
|
39750
|
+
*/
|
|
39751
|
+
const Uint8ArrayFromBase64 = /*#__PURE__*/ Base64String.pipe(/*#__PURE__*/ decodeTo(Uint8Array$1, uint8ArrayFromBase64String));
|
|
39752
|
+
/**
|
|
37878
39753
|
* Creates a schema for `Cause.Reason` values using separate schemas for typed
|
|
37879
39754
|
* failures and unexpected defects.
|
|
37880
39755
|
*
|
|
@@ -38017,6 +39892,159 @@ function Cause(error, defect) {
|
|
|
38017
39892
|
defect
|
|
38018
39893
|
});
|
|
38019
39894
|
}
|
|
39895
|
+
const dateTimeUtcFromString = /*#__PURE__*/ transformEffect({
|
|
39896
|
+
decode: (s, options) => {
|
|
39897
|
+
return match$6(make$21(s), {
|
|
39898
|
+
onNone: () => fail$3(new InvalidValue({ expected: "a valid UTC DateTime string" }, s, options)),
|
|
39899
|
+
onSome: (result) => succeed$4(toUtc(result))
|
|
39900
|
+
});
|
|
39901
|
+
},
|
|
39902
|
+
encode: (utc) => succeed$4(formatIso(utc))
|
|
39903
|
+
});
|
|
39904
|
+
const arbitraryMinimumDateTimestamp = -864e13;
|
|
39905
|
+
const arbitraryMaximumDateTimestamp = 864e13;
|
|
39906
|
+
function dateTimeArbitraryBounds(constraint, domainMinimum, domainMaximum) {
|
|
39907
|
+
const minimum = Math.max(domainMinimum, constraint?.minimum === void 0 ? domainMinimum : constraint.minimum.epochMilliseconds + (constraint.exclusiveMinimum === true ? 1 : 0));
|
|
39908
|
+
const maximum = Math.min(domainMaximum, constraint?.maximum === void 0 ? domainMaximum : constraint.maximum.epochMilliseconds - (constraint.exclusiveMaximum === true ? 1 : 0));
|
|
39909
|
+
return minimum <= maximum ? [minimum, maximum] : [domainMinimum, domainMaximum];
|
|
39910
|
+
}
|
|
39911
|
+
function dateTimeArbitraryInteger(minimum, maximum) {
|
|
39912
|
+
return Int.check(isBetween({
|
|
39913
|
+
minimum,
|
|
39914
|
+
maximum
|
|
39915
|
+
}));
|
|
39916
|
+
}
|
|
39917
|
+
/**
|
|
39918
|
+
* Schema for `DateTime.Utc` values.
|
|
39919
|
+
*
|
|
39920
|
+
* **When to use**
|
|
39921
|
+
*
|
|
39922
|
+
* Use to validate existing `DateTime.Utc` schema values and use the default JSON
|
|
39923
|
+
* codec that represents them as UTC ISO strings.
|
|
39924
|
+
*
|
|
39925
|
+
* **Details**
|
|
39926
|
+
*
|
|
39927
|
+
* The default JSON codec decodes UTC ISO strings into `DateTime.Utc` values and
|
|
39928
|
+
* encodes `DateTime.Utc` values as UTC ISO strings.
|
|
39929
|
+
*
|
|
39930
|
+
* @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
|
|
39931
|
+
* @see {@link DateTimeUtcFromDate} for decoding JavaScript Date values into UTC values
|
|
39932
|
+
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
39933
|
+
* @see {@link DateTimeZoned} for preserving zoned DateTime values
|
|
39934
|
+
*
|
|
39935
|
+
* @stability stable
|
|
39936
|
+
* @category schemas
|
|
39937
|
+
* @since 3.10.0
|
|
39938
|
+
*/
|
|
39939
|
+
const DateTimeUtc = /*#__PURE__*/ declare((u) => isDateTime(u) && isUtc(u), {
|
|
39940
|
+
representation: {
|
|
39941
|
+
id: "effect/schema/DateTimeUtc",
|
|
39942
|
+
payload: null
|
|
39943
|
+
},
|
|
39944
|
+
toCode: () => ({
|
|
39945
|
+
runtime: `Schema.DateTimeUtc`,
|
|
39946
|
+
Type: `DateTime.Utc`,
|
|
39947
|
+
importDeclarations: [`import * as DateTime from "effect/DateTime"`]
|
|
39948
|
+
}),
|
|
39949
|
+
expected: "DateTime.Utc",
|
|
39950
|
+
toCodecArbitrary: ({ constraint }) => {
|
|
39951
|
+
const [minimum, maximum] = dateTimeArbitraryBounds(constraint, arbitraryMinimumDateTimestamp, arbitraryMaximumDateTimestamp);
|
|
39952
|
+
return linkDecoding()(dateTimeArbitraryInteger(minimum, maximum), transform$1(makeUnsafe));
|
|
39953
|
+
},
|
|
39954
|
+
toCodecJson: () => link$1()(String$2, dateTimeUtcFromString),
|
|
39955
|
+
toFormatter: () => (utc) => utc.toString()
|
|
39956
|
+
});
|
|
39957
|
+
/**
|
|
39958
|
+
* Schema that decodes a date-time string into a `DateTime.Utc`.
|
|
39959
|
+
*
|
|
39960
|
+
* **Details**
|
|
39961
|
+
*
|
|
39962
|
+
* Decoding:
|
|
39963
|
+
*
|
|
39964
|
+
* - A string accepted by `DateTime.make` is parsed and normalized to UTC. Strings
|
|
39965
|
+
* without an explicit zone are interpreted as UTC.
|
|
39966
|
+
*
|
|
39967
|
+
* Encoding:
|
|
39968
|
+
*
|
|
39969
|
+
* - A `DateTime.Utc` is encoded as a UTC ISO 8601 string.
|
|
39970
|
+
*
|
|
39971
|
+
* @see {@link DateTimeUtcFromDate} for decoding JavaScript Date values into UTC values
|
|
39972
|
+
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
39973
|
+
* @see {@link DateFromString} for decoding strings into JavaScript Date instances
|
|
39974
|
+
*
|
|
39975
|
+
* @stability stable
|
|
39976
|
+
* @category schemas
|
|
39977
|
+
* @since 4.0.0
|
|
39978
|
+
*/
|
|
39979
|
+
const DateTimeUtcFromString = /*#__PURE__*/ String$2.annotate({ expected: "a string that will be decoded as a DateTime.Utc" }).pipe(/*#__PURE__*/ decodeTo(DateTimeUtc, dateTimeUtcFromString));
|
|
39980
|
+
/**
|
|
39981
|
+
* Schema for `Duration` values.
|
|
39982
|
+
*
|
|
39983
|
+
* **Details**
|
|
39984
|
+
*
|
|
39985
|
+
* The default JSON serializer encodes `Duration` as a tagged object with the
|
|
39986
|
+
* duration type and value.
|
|
39987
|
+
*
|
|
39988
|
+
* **Example** (Defining a Duration schema)
|
|
39989
|
+
*
|
|
39990
|
+
* ```ts import.meta.vitest
|
|
39991
|
+
* import { Duration, Schema } from "effect"
|
|
39992
|
+
*
|
|
39993
|
+
* Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5)) // => Duration.seconds(5)
|
|
39994
|
+
* ```
|
|
39995
|
+
*
|
|
39996
|
+
* @stability stable
|
|
39997
|
+
* @category schemas
|
|
39998
|
+
*
|
|
39999
|
+
* @since 3.10.0
|
|
40000
|
+
*/
|
|
40001
|
+
const Duration = /*#__PURE__*/ declare(isDuration, {
|
|
40002
|
+
representation: {
|
|
40003
|
+
id: "effect/schema/Duration",
|
|
40004
|
+
payload: null
|
|
40005
|
+
},
|
|
40006
|
+
toCode: () => ({
|
|
40007
|
+
runtime: `Schema.Duration`,
|
|
40008
|
+
Type: `Duration.Duration`,
|
|
40009
|
+
importDeclarations: [`import * as Duration from "effect/Duration"`]
|
|
40010
|
+
}),
|
|
40011
|
+
expected: "Duration",
|
|
40012
|
+
toCodecJson: () => link$1()(Union([
|
|
40013
|
+
Struct({ _tag: Literal("Infinity") }),
|
|
40014
|
+
Struct({ _tag: Literal("NegativeInfinity") }),
|
|
40015
|
+
Struct({
|
|
40016
|
+
_tag: Literal("Nanos"),
|
|
40017
|
+
value: BigInt$1
|
|
40018
|
+
}),
|
|
40019
|
+
Struct({
|
|
40020
|
+
_tag: Literal("Millis"),
|
|
40021
|
+
value: Int
|
|
40022
|
+
})
|
|
40023
|
+
]), transform({
|
|
40024
|
+
decode: (e) => {
|
|
40025
|
+
switch (e._tag) {
|
|
40026
|
+
case "Infinity": return infinity;
|
|
40027
|
+
case "NegativeInfinity": return negativeInfinity;
|
|
40028
|
+
case "Nanos": return nanos(e.value);
|
|
40029
|
+
case "Millis": return millis(e.value);
|
|
40030
|
+
}
|
|
40031
|
+
},
|
|
40032
|
+
encode: (duration) => {
|
|
40033
|
+
switch (duration.value._tag) {
|
|
40034
|
+
case "Infinity": return { _tag: "Infinity" };
|
|
40035
|
+
case "NegativeInfinity": return { _tag: "NegativeInfinity" };
|
|
40036
|
+
case "Nanos": return {
|
|
40037
|
+
_tag: "Nanos",
|
|
40038
|
+
value: duration.value.nanos
|
|
40039
|
+
};
|
|
40040
|
+
case "Millis": return {
|
|
40041
|
+
_tag: "Millis",
|
|
40042
|
+
value: duration.value.millis
|
|
40043
|
+
};
|
|
40044
|
+
}
|
|
40045
|
+
}
|
|
40046
|
+
}))
|
|
40047
|
+
});
|
|
38020
40048
|
/**
|
|
38021
40049
|
* Creates a schema for `Exit` values using schemas for the success value, typed
|
|
38022
40050
|
* failure, and unexpected defect channels.
|
|
@@ -38045,7 +40073,7 @@ function Exit(value, error, defect) {
|
|
|
38045
40073
|
onFailure: (issue) => makeCompositeAtKey(ast, "value", issue, input, options)
|
|
38046
40074
|
});
|
|
38047
40075
|
case "Failure": return mapBothEager(decodeUnknownEffect$1(cause)(input.cause, options), {
|
|
38048
|
-
onSuccess: failCause$
|
|
40076
|
+
onSuccess: failCause$4,
|
|
38049
40077
|
onFailure: (issue) => makeCompositeAtKey(ast, "cause", issue, input, options)
|
|
38050
40078
|
});
|
|
38051
40079
|
}
|
|
@@ -38068,7 +40096,7 @@ function Exit(value, error, defect) {
|
|
|
38068
40096
|
_tag: Literal("Failure"),
|
|
38069
40097
|
cause: Cause(error, defect)
|
|
38070
40098
|
})]), transform({
|
|
38071
|
-
decode: (e) => e._tag === "Success" ? succeed$6(e.value) : failCause$
|
|
40099
|
+
decode: (e) => e._tag === "Success" ? succeed$6(e.value) : failCause$4(e.cause),
|
|
38072
40100
|
encode: (exit) => isSuccess(exit) ? {
|
|
38073
40101
|
_tag: "Success",
|
|
38074
40102
|
value: exit.value
|
|
@@ -38576,6 +40604,18 @@ const Json = /*#__PURE__*/ make$11(/*#__PURE__*/ annotate(Json$1, { toCode: () =
|
|
|
38576
40604
|
runtime: "Schema.Json",
|
|
38577
40605
|
Type: "Schema.Json"
|
|
38578
40606
|
}) }));
|
|
40607
|
+
/**
|
|
40608
|
+
* Schema that accepts any mutable JSON-compatible value. See {@link Json} for
|
|
40609
|
+
* the immutable variant.
|
|
40610
|
+
*
|
|
40611
|
+
* @stability stable
|
|
40612
|
+
* @category schemas
|
|
40613
|
+
* @since 4.0.0
|
|
40614
|
+
*/
|
|
40615
|
+
const MutableJson = /*#__PURE__*/ make$11(/*#__PURE__*/ annotate(MutableJson$1, { toCode: () => ({
|
|
40616
|
+
runtime: "Schema.MutableJson",
|
|
40617
|
+
Type: "Schema.MutableJson"
|
|
40618
|
+
}) }));
|
|
38579
40619
|
//#endregion
|
|
38580
40620
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/http/HttpClientError.js
|
|
38581
40621
|
/**
|
|
@@ -40569,7 +42609,7 @@ var Writer = class {
|
|
|
40569
42609
|
}
|
|
40570
42610
|
};
|
|
40571
42611
|
function matchesEveryKey(parameter) {
|
|
40572
|
-
const ast = toEncoded(parameter);
|
|
42612
|
+
const ast = toEncoded$1(parameter);
|
|
40573
42613
|
return ast._tag === "String" && ast.checks === void 0;
|
|
40574
42614
|
}
|
|
40575
42615
|
function matchIndexSignature(layout, key, options) {
|
|
@@ -40974,7 +43014,7 @@ function toBinaryASTStep(ast) {
|
|
|
40974
43014
|
const getJson = ast.annotations?.toCodecJson;
|
|
40975
43015
|
const getCodec = ast.annotations?.toCodec;
|
|
40976
43016
|
if (!isFunction(getJson) && !isFunction(getCodec)) return ast;
|
|
40977
|
-
const typeParameters = ast.typeParameters.map((tp) => make$11(toEncoded(tp)));
|
|
43017
|
+
const typeParameters = ast.typeParameters.map((tp) => make$11(toEncoded$1(tp)));
|
|
40978
43018
|
const link = (isFunction(getJson) ? getJson(typeParameters) : void 0) ?? (isFunction(getCodec) ? getCodec(typeParameters) : void 0);
|
|
40979
43019
|
return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, toBinaryAST)]);
|
|
40980
43020
|
}
|
|
@@ -41125,7 +43165,7 @@ function computeRequired(layout) {
|
|
|
41125
43165
|
function compileLayout(root) {
|
|
41126
43166
|
const exact = isExact(root);
|
|
41127
43167
|
const exitSuccess = !exact && isExitWithExactSuccess(root);
|
|
41128
|
-
root = toEncoded(root);
|
|
43168
|
+
root = toEncoded$1(root);
|
|
41129
43169
|
const memo = /* @__PURE__ */ new Map();
|
|
41130
43170
|
let recursive = false;
|
|
41131
43171
|
let stringSlots = 0;
|
|
@@ -43373,7 +45413,7 @@ function decodeValueUnchecked(layout, r) {
|
|
|
43373
45413
|
if (tag === 0) return succeed$6(requirePresent(decodeChecked(layout.value, r)));
|
|
43374
45414
|
if (tag !== 1) invalid("bool", void 0, r.options);
|
|
43375
45415
|
const cause = decodeValue(layout.cause, r);
|
|
43376
|
-
return failCause$
|
|
45416
|
+
return failCause$4(cause);
|
|
43377
45417
|
}
|
|
43378
45418
|
case "cause": {
|
|
43379
45419
|
const count = r.uvarint();
|
|
@@ -43441,14 +45481,14 @@ function makeTransformation(layout, mode, trusted, successOnly = false) {
|
|
|
43441
45481
|
if (trusted !== void 0 && isObjectOrArray(value) && (!successOnly || isSuccessExit(value))) trusted.value = value;
|
|
43442
45482
|
return succeed$4(value);
|
|
43443
45483
|
} catch (e) {
|
|
43444
|
-
return e instanceof IssueError ? fail$3(e.issue) : die$
|
|
45484
|
+
return e instanceof IssueError ? fail$3(e.issue) : die$2(e);
|
|
43445
45485
|
}
|
|
43446
45486
|
},
|
|
43447
45487
|
encode: (value, options) => {
|
|
43448
45488
|
try {
|
|
43449
45489
|
return succeed$4(encodeFrame(layout, value, options, mode));
|
|
43450
45490
|
} catch (e) {
|
|
43451
|
-
return e instanceof IssueError ? fail$3(e.issue) : die$
|
|
45491
|
+
return e instanceof IssueError ? fail$3(e.issue) : die$2(e);
|
|
43452
45492
|
}
|
|
43453
45493
|
}
|
|
43454
45494
|
});
|
|
@@ -43477,7 +45517,7 @@ function takeTrusted(trusted, input) {
|
|
|
43477
45517
|
return true;
|
|
43478
45518
|
}
|
|
43479
45519
|
function bypassPass(target, decodeAccept, encodeAccept) {
|
|
43480
|
-
const type = make$11(toType(target.ast));
|
|
45520
|
+
const type = make$11(toType$1(target.ast));
|
|
43481
45521
|
const parse = decodeUnknownEffect$1(type);
|
|
43482
45522
|
const run = (accept) => () => (input, _ast, options) => accept(input, options) ? sameExit : parse(input, options);
|
|
43483
45523
|
return make$11(new Declaration([type.ast], run(decodeAccept), { identifier: "binary value" }, void 0, void 0, void 0, void 0, run(encodeAccept)));
|
|
@@ -43501,7 +45541,7 @@ function passThrough(target) {
|
|
|
43501
45541
|
return bypassPass(target, reportsExcess, reportsExcess);
|
|
43502
45542
|
}
|
|
43503
45543
|
function withCycleGuard(target) {
|
|
43504
|
-
const type = make$11(toType(target.ast));
|
|
45544
|
+
const type = make$11(toType$1(target.ast));
|
|
43505
45545
|
const decoded = /* @__PURE__ */ new WeakSet();
|
|
43506
45546
|
return decodeTo(declareConstructor()([type], ([type]) => (input, ast, options) => {
|
|
43507
45547
|
if (isObjectOrArray(input) && decoded.delete(input)) return succeed$4(input);
|
|
@@ -44541,7 +46581,7 @@ const unwrap = (wrapped) => {
|
|
|
44541
46581
|
};
|
|
44542
46582
|
const isSourceError = (u) => isTagged(u, "SourceError");
|
|
44543
46583
|
const cursorToString = () => "<configuration>";
|
|
44544
|
-
const mapReasons = (f) => (self) => catchCause$1(self, (cause) => failCause$
|
|
46584
|
+
const mapReasons = (f) => (self) => catchCause$1(self, (cause) => failCause$3(fromReasons(cause.reasons.map(f))));
|
|
44545
46585
|
const loadCursor = (provider, path) => provider.load(path).pipe(mapReasons((reason) => isFailReason(reason) ? makeDieReason(reason.error).annotate(reasonAnnotations(reason)) : reason), mapEager((node) => ({
|
|
44546
46586
|
provider,
|
|
44547
46587
|
path,
|
|
@@ -44701,7 +46741,7 @@ const toConfigCursorAST = /*#__PURE__*/ memoize((root) => {
|
|
|
44701
46741
|
*/
|
|
44702
46742
|
function schema(codec, path) {
|
|
44703
46743
|
const codecStringTree = toCodecStringTree(codec);
|
|
44704
|
-
const encodedAst = toEncoded(codecStringTree.ast);
|
|
46744
|
+
const encodedAst = toEncoded$1(codecStringTree.ast);
|
|
44705
46745
|
const decodeCursor = decodeUnknownEffect$1(make$11(toConfigCursorAST(codecStringTree.ast)));
|
|
44706
46746
|
const localPath = typeof path === "string" ? [path] : path ?? [];
|
|
44707
46747
|
return make$5((provider, pathPrefix) => {
|
|
@@ -45858,7 +47898,7 @@ function defaultShouldQuit(input) {
|
|
|
45858
47898
|
* @category layers
|
|
45859
47899
|
* @since 4.0.0
|
|
45860
47900
|
*/
|
|
45861
|
-
const layer$1 = /*#__PURE__*/ provideMerge(layer$12, /*#__PURE__*/ mergeAll$
|
|
47901
|
+
const layer$1 = /*#__PURE__*/ provideMerge(layer$12, /*#__PURE__*/ mergeAll$2(layer$8, layer$10, layer$6, layer$4, layer$3));
|
|
45862
47902
|
//#endregion
|
|
45863
47903
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Runtime.js
|
|
45864
47904
|
/**
|
|
@@ -46439,4 +48479,4 @@ var RpcContracts = class extends make$7(make$9("notes.watch", {
|
|
|
46439
48479
|
payload: Struct({ id: NoteId })
|
|
46440
48480
|
})) {};
|
|
46441
48481
|
//#endregion
|
|
46442
|
-
export { Socket as $, isNonEmpty as $a, match$5 as $c, onExitPrimitive as $i, isNotUndefined as $l, mkUint8Array as $n, make$33 as $o, cached as $r, contains as $s, fromInput as $t, withDefault as A, tryPromise as Aa, some as Ac, gen as Ai, contA as Al, toEpochMillis as An, map$4 as Ao, take$1 as Ar, Tracer as As, TaggedError as At, constPing as B, withLogSpan as Ba, toEntries as Bc, logInfo as Bi, toStringUnknown as Bl, flatMap as Bn, merge$3 as Bo, badArgument as Br, Reference as Bs, encodeUnknownEffect as Bt, Redacted as C, sync as Ca, last as Cc, forEach$1 as Ci, toArray as Cl, toArrayBuffer as Cn, fromReasons as Co, failCause$1 as Cr, forkUnsafe$1 as Cs, Literal as Ct, option as D, timeoutOption as Da, prepend$1 as Dc, forkScoped as Di, flip$1 as Dl, ChildProcessSpawner as Dn, interruptors as Do, offerUnsafe as Dr, sync$2 as Ds, Record as Dt, map as E, timeout as Ea, match$4 as Ec, forkIn as Ei, combine$1 as El, make$18 as En, hasInterruptsOnly as Eo, offerAll as Er, reportCauseUnsafe as Es, NullOr as Et, layerJson as F, useSpan as Fa, filter$3 as Fc, isEffect as Fi, setStackTraceLimit as Fl, decodeText$1 as Fn, effect as Fo, getCurrent as Fr, TaggedError$1 as Fs, decodeEffect as Ft, ClientAbort as G, min as Ga, flatMap$6 as Gc, mapError$2 as Gi, array as Gl, fromQueue as Gn, succeedContext as Go, zero$1 as Gr, getOrUndefined as Gs, tag as Gt, ServerClient as H, withSpan as Ha, make$37 as Hc, makeSpanScoped as Hi, redact$1 as Hl, fromChannel as Hn, provide$2 as Ho, fromInputUnsafe as Hr, add as Hs, is as Ht, layerSchemaBinary as I, void_$1 as Ia, get$6 as Ic, log as Ii, BaseProto as Il, empty$4 as In, effectContext as Io, interrupt as Ir, taggedEnum as Is, decodeSync as It, spanAttributes as J, isDoneCause as Ja, getOrThrow as Jc, matchCauseEffectEager as Ji, number$1 as Jl, limitBytes as Jn, addFinalizer$1 as Jo, andThen as Jr, make$36 as Js, toJsonSchemaDocument as Jt, getStreamSchemas as K, spaced as Ka, fromOption$2 as Kc, match as Ki, combine$2 as Kl, fromReadableStream as Kn, unwrap$4 as Ko, acquireRelease as Kr, getOrUndefinedUnsafe as Ks, toCodecJson as Kt, RequestId as L, whileLoop as La, has$3 as Lc, logDebug as Li, Class$2 as Ll, ensuring as Ln, effectDiscard as Lo, interruptAll as Lr, parts as Ls, decodeUnknownEffect as Lt, withRun as M, uninterruptible as Ma, take$3 as Mc, ignoreCause as Mi, withFiber$1 as Ml, Path$1 as Mn, squash as Mo, publishUnsafe as Mr, make$34 as Ms, Tuple as Mt, withRunClient as N, uninterruptibleMask as Na, takeRight as Nc, interrupt$1 as Ni, assignProperty$1 as Nl, FileSystem as Nn, CurrentMemoMap as No, unbounded as Nr, nativeTracer as Ns, Union as Nt, succeed as O, timeoutOrElse as Oa, reduce as Oc, fromOption as Oi, mapInput as Ol, encode as On, isNoSuchElementError as Oo, shutdown as Or, DisablePropagation as Os, String$2 as Ot, RpcSerialization as P, updateContext as Pa, assignProperty as Pc, interruptible as Pi, getStackTraceLimit as Pl, concat as Pn, buildWithMemoMap as Po, makeUnsafe$2 as Pr, Error$2 as Ps, Unknown as Pt, CloseEvent as Q, isEmpty$1 as Qa, map$8 as Qc, onExit$1 as Qi, hasProperty as Ql, mkString as Qn, forkUnsafe as Qo, asVoid as Qr, allocate as Qs, empty as Qt, ResponseDefectEncoded as R, withFiber as Ra, keys$1 as Rc, logError as Ri, NodeInspectSymbol as Rl, fail$1 as Rn, empty$7 as Ro, interruptAs as Rr, seconds as Rs, encodeEffect as Rt, Port as S, suspend$2 as Sa, join$1 as Sc, fnUntraced as Si, some$1 as Sl, pipeThroughDuplex as Sn, findError as So, end as Sr, fiberEnterUninterruptibleUnsafe as Ss, Finite as St, URL$1 as T, tapError as Ta, map$6 as Tc, forkChild as Ti, String$6 as Tl, fromWritable as Tn, hasInterrupts as To, offer as Tr, onExitUnsafe as Ts, NonEmptyArray as Tt, exitSchema as U, zipWith as Ua, fail$7 as Uc, map$3 as Ui, equals$1 as Ul, fromIterable$5 as Un, provideMerge as Uo, gibibytes as Ur, empty$8 as Us, optional as Ut, constPong as V, withParentSpan as Va, empty$11 as Vc, logWarning as Vi, format$2 as Vl, fromArray as Vn, mergeAll$1 as Vo, fromInput$2 as Vr, Service as Vs, fromJsonString as Vt, isWrapper as W, exponential as Wa, failVoid as Wc, mapEager as Wi, symbol$1 as Wl, fromPubSub as Wn, succeed$5 as Wo, mebibytes as Wr, get$4 as Ws, optionalKey as Wt, Collector as X, endsWith as Xa, isResult as Xc, never$1 as Xi, string$1 as Xl, mapAccum as Xn, close as Xo, as as Xr, merge$4 as Xs, omit as Xt, spanName as Y, Random as Ya, isFailure$1 as Yc, matchEffect as Yi, optimize as Yl, map$1 as Yn, addFinalizerExit as Yo, annotateLogs as Yr, makeUnsafe$6 as Ys, isSchemaError$1 as Yt, makeCollectorUnsafe as Z, includes as Za, isSuccess$1 as Zc, onError as Zi, symbol$2 as Zl, mapError as Zn, closeUnsafe as Zo, asSome as Zr, Prototype as Zs, encodeUnknownEffect$1 as Zt, QuitError as _, scoped as _a, head as _c, failCause$2 as _i, liftThrowable as _l, fromSetCookie as _n, StackTrace as _o, mkUint8Array$1 as _r, isDeferred as _s, BooleanLiterals as _t, ImageType as a, provide as aa, every$1 as ac, catchIf as ai, filter$4 as al, CurrentRedactedNames as an, replaceAll as ao, runHead as ar, TracerTimingEnabled as as, layerWebSocket as at, constTrue as au, layer$8 as b, succeed$4 as ba, isReadonlyArrayEmpty as bc, flatMapEager as bi, none as bl, toSetCookieHeaders as bn, done as bo, bounded as br, effectIsExit as bs, Exit as bt, NotesError as c, raceFirst as ca, findFirst as cc, catchTags as ci, flatten$2 as cl, fromRecordUnsafe as cn, startsWith as co, succeed$2 as cr, failCause$3 as cs, EmptyBodyError as ct, constant as cu, layer as d, retry as da, flatMap$5 as dc, contextWith as di, getOrElse$1 as dl, remove$1 as dn, trimEnd as do, toReadableStreamEffect as dr, isFailure as ds, HttpClientErrorSchema as dt, identity as du, onInterrupt as ea, dedupe as ec, callback$1 as ei, succeed$8 as el, setAll as en, length as eo, orDie as er, makeUnsafe$4 as es, SocketError as et, isObject as eu, make as f, retryOrElse as fa, fromIterable$6 as fc, delay as fi, getOrNull as fl, set$1 as fn, max as fo, toReadableStreamWith as fr, isSuccess as fs, InvalidUrlError as ft, pipe as fu, layer$1 as g, scope as ga, groupBy as gc, fail$3 as gi, liftPredicate as gl, empty$3 as gn, Done as go, mapError$1 as gr, into as gs, ArraySchema as gt, errorReported as h, runSync$1 as ha, getUnsafe$1 as hc, exit as hi, isSome as hl, value as hn, Clock as ho, fromTransform$1 as hr, doneUnsafe as hs, Any as ht, FileType as i, promise as ia, ensure as ic, catchFilter as ii, exists as il, get as in, replace as io, runForEachArray as ir, MinimumLogLevel as is, fromWebSocket as it, constFalse$1 as iu, Stdio as j, try_ as ja, sort as jc, ignore as ji, contE as jl, defaultFormatter as jn, prettyErrors as jo, takeAll as jr, externalSpan as js, TrueLiterals as jt, unwrap as k, transposeOption as ka, reverse as kc, fromResult as ki, PipeInspectableProto as kl, now as kn, makeDieReason as ko, shutdownUnsafe as kr, ParentSpan as ks, Struct as kt, Organization as l, repeat as la, findFirstIndex as lc, catch_$1 as li, fromNullishOr as ll, isRedactedName as ln, toLowerCase as lo, suspend as lr, interrupt$2 as ls, EncodeError as lt, dual as lu, errorExitCode as m, runForkWith as ma, getSomes as mc, ensuring$2 as mi, isNone as ml, make$16 as mn, round as mo, fromPull$1 as mr, _await as ms, TransportError as mt, Capture as n, orDie$2 as na, drop as nc, catchCauseIf as ni, all$4 as nl, has as nn, padStart as no, run$1 as nr, CurrentLogAnnotations as ns, SocketOpenError as nt, isUndefined as nu, Note as o, provideContext$2 as oa, filter$2 as oc, catchReason as oi, flatMap$7 as ol, empty$2 as on, slice as oo, runLast as or, die$3 as os, layerWebSocketConstructorGlobal as ot, constUndefined as ou, runMain as p, runFork as pa, get$5 as pc, die$1 as pi, getOrUndefined$1 as pl, setAll$1 as pn, parse as po, unwrap$1 as pr, succeed$6 as ps, StatusCodeError as pt, pipeArguments as pu, isStreamSchema as q, catchDone as qa, getOrElse as qc, matchCauseEffect as qi, hash as ql, groupedWithin as qn, Scope as qo, all$1 as qr, getUnsafe as qs, toCodecStringTree as qt, Extraction as r, orElseSucceed as ra, empty$9 as rc, catchDefect as ri, contains$1 as rl, fromIterable$2 as rn, repeat$2 as ro, runForEach as rr, CurrentLogSpans as rs, SocketReadError as rt, compose as ru, NoteId as s, provideService as sa, filterMap as sc, catchTag as si, flatMapNullishOr as sl, fromInput$1 as sn, split as so, scan as sr, fail$5 as ss, DecodeError as st, constVoid as su, RpcContracts as t, option$1 as ta, dedupeAdjacentWith as tc, catchCause$1 as ti, try_$2 as tl, fromIterable as tn, match$1 as to, pipeThroughChannel as tr, provide$3 as ts, SocketErrorReason as tt, isTagged as tu, LogToStderr as u, result as ua, findLast as uc, context as ui, fromUndefinedOr as ul, merge as un, trim as uo, takeUntil as ur, isExit as us, HttpClientError as ut, flow as uu, Terminal as v, service as va, headNonEmpty as vc, filterOrFail as vi, map$9 as vl, isEmpty as vn, combine as vo, make$25 as vr, makeUnsafe$5 as vs, Defect as vt, String$1 as w, tapCause as wa, lastNonEmpty as wc, forever as wi, Number$5 as wl, toUint8Array as wn, hasDies as wo, make$26 as wr, makeSpanUnsafe as ws, Never as wt, Crypto as x, succeedNone as xa, isReadonlyArrayNonEmpty as xc, fn as xi, orElse as xl, fromReadable as xn, filterInterruptors as xo, collect as xr, fiberEnterInterruptibleUnsafe as xs, FalseLiterals as xt, isQuitError as y, serviceOption as ya, isArray as yc, flatMap$2 as yi, match$6 as yl, parseHeader as yn, die$2 as yo, makeUnsafe$1 as yr, ConsoleRef as ys, Error$1 as yt, constEof as z, withFiberSucceed as za, map$7 as zc, logFatal as zi, toJson as zl, filter as zn, launch as zo, runIn as zr, toMillis as zs, encodeSync as zt };
|
|
48482
|
+
export { Socket as $, forkIn as $a, effectIsExit as $c, identity as $d, shutdownUnsafe as $i, groupBy as $l, empty$3 as $n, tapCause as $o, fromArray as $r, fail$4 as $s, decodeSync as $t, isSome as $u, withDefault as A, catchDefect as Aa, closeUnsafe as Ac, array as Ad, takeUntil as Ai, make$36 as Al, isSchemaError$1 as An, orElseSucceed as Ao, passthrough as Ar, isNonEmpty as As, Literal as At, fromOption$2 as Au, constPing as B, die$2 as Ba, fail$5 as Bc, isNotNullish as Bd, mkUint8Array$1 as Bi, empty$9 as Bl, get as Bn, retryOrElse as Bo, catchReason as Br, toLowerCase as Bs, String$2 as Bt, all$4 as Bu, Redacted as C, as as Ca, succeed$5 as Cc, NodeInspectSymbol as Cd, runForEach as Ci, Service as Cl, toCodecStringTree as Cn, never$1 as Co, null_ as Cr, catchDone as Cs, Duration as Ct, toEntries as Cu, option as D, callback$1 as Da, addFinalizer$1 as Dc, redact$1 as Dd, scan as Di, getOrUndefined as Dl, withConstructorDefault as Dn, onInterrupt as Do, resolveIdentifier as Dr, endsWith as Ds, Finite as Dt, fail$7 as Du, map as E, cached as Ea, Scope as Ec, format$2 as Ed, runLast as Ei, get$4 as El, toType as En, onExitPrimitive as Eo, resolveDescription as Er, camelToSnake as Es, FalseLiterals as Et, make$37 as Eu, layerJson as F, catchTags$1 as Fa, CurrentLogAnnotations as Fc, string$1 as Fd, last as Fi, appendAll$1 as Fl, fromInput as Fn, provideServiceEffect as Fo, now as Fr, replace as Fs, Null as Ft, isSuccess$1 as Fu, ClientAbort as G, filterOrFail as Ga, isSuccess as Gc, compose as Gd, collect as Gi, findFirst as Gl, isRedactedName as Gn, scoped as Go, die as Gr, round as Gs, URL$2 as Gt, flatMapNullishOr as Gu, ServerClient as H, exit as Ha, interrupt$2 as Hc, isObject as Hd, make$25 as Hi, every$1 as Hl, empty$2 as Hn, runForkWith as Ho, catch_ as Hr, trimEnd as Hs, TaggedError as Ht, exists as Hu, layerSchemaBinary as I, catch_$2 as Ia, CurrentLogSpans as Ic, symbol$2 as Id, fromPull$1 as Ii, contains as Il, setAll as In, raceFirst as Io, toEpochMillis as Ir, replaceAll as Is, NullOr as It, map$8 as Iu, spanAttributes as J, fn as Ja, doneUnsafe as Jc, constUndefined as Jd, make$26 as Ji, flatMap$5 as Jl, set$1 as Jn, succeed$4 as Jo, fail$1 as Jr, StackTrace as Js, Uint8ArrayFromBase64 as Jt, fromUndefinedOr as Ju, getStreamSchemas as K, flatMap$2 as Ka, succeed$6 as Kc, constFalse$1 as Kd, end as Ki, findFirstIndex as Kl, merge as Kn, service as Ko, empty$4 as Kr, Clock as Ks, URLFromString as Kt, flatten$5 as Ku, RequestId as L, context as La, MinimumLogLevel as Lc, hasProperty as Ld, fromTransform$1 as Li, dedupe as Ll, fromIterable as Ln, repeat as Lo, defaultFormatter as Lr, slice as Ls, Number$1 as Lt, match$5 as Lu, withRun as M, catchIf as Ma, make$33 as Mc, hash as Md, toReadableStreamEffect as Mi, merge$4 as Ml, getReferenceKey as Mn, provide as Mo, transformOptional as Mr, match$1 as Ms, MutableJson as Mt, getOrThrow as Mu, withRunClient as N, catchReason$2 as Na, makeUnsafe$4 as Nc, number$1 as Nd, toReadableStreamWith as Ni, Prototype as Nl, encodeUnknownEffect$1 as Nn, provideContext$2 as No, encode as Nr, padStart as Ns, Never as Nt, isFailure$1 as Nu, succeed as O, catchCause$1 as Oa, addFinalizerExit as Oc, equals$1 as Od, succeed$2 as Oi, getOrUndefinedUnsafe as Ol, withDecodingDefault as On, option$1 as Oo, string as Or, includes as Os, Int as Ot, failVoid as Ou, RpcSerialization as P, catchTag as Pa, provide$3 as Pc, optimize as Pd, unwrap$1 as Pi, allocate as Pl, empty as Pn, provideService$2 as Po, formatIso as Pr, repeat$2 as Ps, NonEmptyArray as Pt, isResult as Pu, CloseEvent as Q, forkChild as Qa, ConsoleRef as Qc, flow as Qd, shutdown as Qi, getUnsafe$1 as Ql, value as Qn, tap$1 as Qo, flattenIterable as Qr, done as Qs, decodeEffect as Qt, isNone as Qu, ResponseDefectEncoded as R, contextWith as Ra, TracerTimingEnabled as Rc, isIterable as Rd, map$2 as Ri, dedupeAdjacentWith as Rl, has as Rn, result as Ro, Path$1 as Rr, split as Rs, Record as Rt, succeed$8 as Ru, Port as S, annotateLogs as Sa, provideMerge as Sc, Class$2 as Sd, runCollect as Si, Reference as Sl, toCodecJson as Sn, matchEffect as So, mapOrSame as Sr, spaced as Ss, Defect as St, map$7 as Su, URL$1 as T, asVoid as Ta, unwrap$4 as Tc, toStringUnknown as Td, runHead as Ti, empty$8 as Tl, toJsonSchemaDocument as Tn, onExit$1 as To, replaceChecks as Tr, Random as Ts, Exit as Tt, headUnsafe as Tu, exitSchema as U, fail$3 as Ua, isExit as Uc, isTagged as Ud, makeUnsafe$1 as Ui, filter$2 as Ul, fromInput$1 as Un, runSync$1 as Uo, concat as Ur, max as Us, TrueLiterals as Ut, filter$3 as Uu, constPong as V, ensuring$2 as Va, failCause$4 as Vc, isNotUndefined as Vd, pipeTo as Vi, ensure as Vl, CurrentRedactedNames as Vn, runFork as Vo, catchTags as Vr, trim as Vs, Struct as Vt, contains$1 as Vu, isWrapper as W, failCause$3 as Wa, isFailure as Wc, isUndefined as Wd, bounded as Wi, filterMap as Wl, fromRecordUnsafe as Wn, scope as Wo, decodeText$1 as Wr, parse as Ws, Tuple as Wt, flatMap$7 as Wu, Collector as X, forEach$1 as Xa, isDeferred as Xc, constant as Xd, offerAll as Xi, get$5 as Xl, isRedacted as Xn, suspend$2 as Xo, filter as Xr, combine as Xs, Union as Xt, getOrNull as Xu, spanName as Y, fnUntraced as Ya, into as Yc, constVoid as Yd, offer as Yi, fromIterable$6 as Yl, setAll$1 as Yn, succeedNone as Yo, failCause as Yr, annotate$1 as Ys, UndefinedOr as Yt, getOrElse$1 as Yu, makeCollectorUnsafe as Z, forever as Za, makeUnsafe$5 as Zc, dual as Zd, offerUnsafe as Zi, getSomes as Zl, make$16 as Zn, sync as Zo, flatMap as Zr, die$3 as Zs, Unknown as Zt, getOrUndefined$1 as Zu, QuitError as _, zero$1 as _a, empty$7 as _c, withFiber$1 as _d, onEnd as _i, format$1 as _l, makeFilter as _n, mapEager as _o, Suspend as _r, withParentSpan as _s, Boolean$1 as _t, takeRight as _u, ImageType as a, await_ as aa, hasInterruptsOnly as ac, orElse as ad, fromReadableStream as ai, reportCauseUnsafe as al, encodeTo as an, ignoreCause as ao, pipeThroughDuplex as ar, tryPromise as as, layerWebSocket as at, join$1 as au, layer$8 as b, andThen as ba, mergeAll$2 as bc, setStackTraceLimit as bd, provideService as bi, seconds as bl, optionalKey as bn, matchCauseEffect as bo, isNever as br, exponential as bs, DateTimeUtc as bt, has$3 as bu, NotesError as c, interruptAll as ca, makeDieReason as cc, toArray as cd, map$1 as ci, ParentSpan as cl, is as cn, isEffect as co, fromWritable as cr, uninterruptibleMask as cs, EmptyBodyError as ct, map$6 as cu, layer as d, runIn as da, squash as dc, combine$1 as dd, mapArrayEffect as di, make$34 as dl, isMaxLength as dn, logError as do, Arrays as dr, useSpan as ds, HttpClientErrorSchema as dt, prepend$1 as du, take$1 as ea, filterInterruptors as ec, liftPredicate as ed, pipe as ef, fromChannel as ei, fiberEnterInterruptibleUnsafe as el, decodeTo as en, forkScoped as eo, fromSetCookie as er, tapError as es, SocketError as et, head as eu, make as f, badArgument as fa, CurrentMemoMap as fc, flip$1 as fd, mapEffect as fi, nativeTracer as fl, isMinLength as fn, logFatal as fo, Filter as fr, void_$1 as fs, InvalidUrlError as ft, reduce as fu, layer$1 as g, mebibytes as ga, effectDiscard as gc, contE as gd, mkUint8Array as gi, taggedEnum as gl, make$11 as gn, map$3 as go, PropertySignature as gr, withLogSpan as gs, ArraySchema as gt, take$3 as gu, errorReported as h, gibibytes as ha, effectContext as hc, contA as hd, mkString as hi, TaggedError$1 as hl, isSchemaError as hn, makeSpanScoped as ho, Objects as hr, withFiberSucceed as hs, Any as ht, sort as hu, FileType as i, makeUnsafe$2 as ia, hasInterrupts as ic, none as id, fromQueue as ii, onExitUnsafe as il, encodeSync as in, ignore as io, fromReadable as ir, transposeOption as is, fromWebSocket as it, isReadonlyArrayNonEmpty as iu, Stdio as j, catchFilter$2 as ja, forkUnsafe as jc, combine$2 as jd, tap as ji, makeUnsafe$6 as jl, omit as jn, promise as jo, transform as jr, length as js, Literals as jt, getOrElse as ju, unwrap as k, catchCauseIf as ka, close as kc, symbol$1 as kd, suspend as ki, getUnsafe as kl, withDecodingDefaultKey as kn, orDie$2 as ko, toEncoded$1 as kr, isEmpty$1 as ks, Json as kt, flatMap$6 as ku, Organization as l, interruptAllAs as la, map$4 as lc, Number$5 as ld, mapAccum as li, Tracer as ll, isGreaterThanOrEqualTo as ln, log as lo, make$18 as lr, updateContext as ls, EncodeError as lt, match$4 as lu, errorExitCode as m, fromInputUnsafe as ma, effect as mc, PipeInspectableProto as md, mergeAll as mi, TaggedClass as ml, isSchema as mn, logWarning as mo, Literal$1 as mr, withFiber as ms, TransportError as mt, some as mu, Capture as n, publishUnsafe as na, fromReasons as nc, map$9 as nd, fromIterable$5 as ni, forkUnsafe$1 as nl, decodeUnknownOption as nn, fromResult as no, parseHeader as nr, timeoutOption as ns, SocketOpenError as nt, isArrayNonEmpty as nu, Note as o, getCurrent as oa, interruptors as oc, orElseSome as od, groupedWithin as oi, sync$2 as ol, encodeUnknownEffect as on, interrupt$1 as oo, toArrayBuffer as or, try_ as os, layerWebSocketConstructorGlobal as ot, last$1 as ou, runMain as p, fromInput$2 as pa, buildWithMemoMap as pc, mapInput as pd, mapError as pi, Error$2 as pl, isPattern as pn, logInfo as po, FilterGroup as pr, whileLoop as ps, StatusCodeError as pt, reverse as pu, isStreamSchema as q, flatMapEager as qa, _await as qc, constTrue as qd, failCause$2 as qi, findLast as ql, remove$1 as qn, serviceOption as qo, ensuring as qr, Done as qs, Uint8Array$1 as qt, fromNullishOr as qu, Extraction as r, unbounded as ra, hasDies as rc, match$6 as rd, fromPubSub as ri, makeSpanUnsafe as rl, encodeEffect as rn, gen as ro, toSetCookieHeaders as rr, timeoutOrElse as rs, SocketReadError as rt, isReadonlyArrayEmpty as ru, NoteId as s, interrupt as sa, isNoSuchElementError as sc, some$1 as sd, limitBytes as si, DisablePropagation as sl, fromJsonString as sn, interruptible as so, toUint8Array as sr, uninterruptible as ss, DecodeError as st, lastNonEmpty as su, RpcContracts as t, takeAll as ta, findError as tc, liftThrowable as td, pipeArguments as tf, fromEffect as ti, fiberEnterUninterruptibleUnsafe as tl, decodeUnknownEffect as tn, fromOption as to, isEmpty as tr, timeout as ts, SocketErrorReason as tt, headNonEmpty as tu, LogToStderr as u, interruptAs as ua, prettyErrors as uc, String$6 as ud, mapArray as ui, externalSpan as ul, isInt as un, logDebug as uo, ChildProcessSpawner as ur, updateService as us, HttpClientError as ut, of as uu, Terminal as v, acquireRelease as va, launch as vc, assignProperty$1 as vd, orDie as vi, millis as vl, mutable as vn, mapError$2 as vo, Union$1 as vr, withSpan as vs, BooleanLiterals as vt, assignProperty as vu, String$1 as w, asSome as wa, succeedContext as wc, toJson as wd, runForEachArray as wi, add as wl, toEncoded as wn, onError as wo, optionalKey$1 as wr, isDoneCause as ws, Error$1 as wt, empty$10 as wu, Crypto as x, annotateCurrentSpan as xa, provide$2 as xc, BaseProto as xd, run$1 as xi, toMillis as xl, tag as xn, matchCauseEffectEager as xo, isOptional as xr, min as xs, DateTimeUtcFromString as xt, keys$1 as xu, isQuitError as y, all$1 as ya, merge$3 as yc, getStackTraceLimit as yd, pipeThroughChannel as yi, parts as yl, optional as yn, match as yo, decodeTo$1 as yr, zipWith as ys, Class as yt, get$6 as yu, constEof as z, delay as za, die$4 as zc, isNotNull as zd, mapError$1 as zi, drop as zl, fromIterable$2 as zn, retry as zo, FileSystem as zr, startsWith as zs, Redacted$1 as zt, try_$2 as zu };
|