@deslop/opm 0.1.1247 → 0.1.1256
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/dist/server.js +1016 -416
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -3158,7 +3158,7 @@ const Prototype = (options) => makePrimitiveProto({
|
|
|
3158
3158
|
* @category constructors
|
|
3159
3159
|
* @since 2.0.0
|
|
3160
3160
|
*/
|
|
3161
|
-
const make$
|
|
3161
|
+
const make$71 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
3162
3162
|
const isStrictEquivalent = (x, y) => x === y;
|
|
3163
3163
|
/**
|
|
3164
3164
|
* Creates an equivalence relation that uses strict equality (`===`) to compare values.
|
|
@@ -3268,7 +3268,7 @@ const strictEqual = () => isStrictEquivalent;
|
|
|
3268
3268
|
* @since 4.0.0
|
|
3269
3269
|
*/
|
|
3270
3270
|
function Tuple$1(elements) {
|
|
3271
|
-
return make$
|
|
3271
|
+
return make$71((self, that) => {
|
|
3272
3272
|
if (self.length !== that.length) return false;
|
|
3273
3273
|
for (let i = 0; i < self.length; i++) if (!elements[i](self[i], that[i])) return false;
|
|
3274
3274
|
return true;
|
|
@@ -3278,7 +3278,7 @@ function Tuple$1(elements) {
|
|
|
3278
3278
|
* @since 4.0.0
|
|
3279
3279
|
*/
|
|
3280
3280
|
function Array_(item) {
|
|
3281
|
-
return make$
|
|
3281
|
+
return make$71((self, that) => {
|
|
3282
3282
|
if (self.length !== that.length) return false;
|
|
3283
3283
|
for (let i = 0; i < self.length; i++) if (!item(self[i], that[i])) return false;
|
|
3284
3284
|
return true;
|
|
@@ -3479,7 +3479,7 @@ const getSuccess$1 = (self) => isFailure$2(self) ? none$1 : some$3(self.success)
|
|
|
3479
3479
|
* @category constructors
|
|
3480
3480
|
* @since 2.0.0
|
|
3481
3481
|
*/
|
|
3482
|
-
function make$
|
|
3482
|
+
function make$70(compare) {
|
|
3483
3483
|
return (self, that) => self === that ? 0 : compare(self, that);
|
|
3484
3484
|
}
|
|
3485
3485
|
/**
|
|
@@ -3510,7 +3510,7 @@ function make$69(compare) {
|
|
|
3510
3510
|
* @category instances
|
|
3511
3511
|
* @since 4.0.0
|
|
3512
3512
|
*/
|
|
3513
|
-
const String$10 = /*#__PURE__*/ make$
|
|
3513
|
+
const String$10 = /*#__PURE__*/ make$70((self, that) => self < that ? -1 : 1);
|
|
3514
3514
|
/**
|
|
3515
3515
|
* Order instance for numbers that compares them numerically.
|
|
3516
3516
|
*
|
|
@@ -3543,7 +3543,7 @@ const String$10 = /*#__PURE__*/ make$69((self, that) => self < that ? -1 : 1);
|
|
|
3543
3543
|
* @category instances
|
|
3544
3544
|
* @since 4.0.0
|
|
3545
3545
|
*/
|
|
3546
|
-
const Number$6 = /*#__PURE__*/ make$
|
|
3546
|
+
const Number$6 = /*#__PURE__*/ make$70((self, that) => {
|
|
3547
3547
|
if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
|
|
3548
3548
|
if (globalThis.Number.isNaN(self)) return -1;
|
|
3549
3549
|
if (globalThis.Number.isNaN(that)) return 1;
|
|
@@ -3580,7 +3580,7 @@ const Number$6 = /*#__PURE__*/ make$69((self, that) => {
|
|
|
3580
3580
|
* @since 4.0.0
|
|
3581
3581
|
*/
|
|
3582
3582
|
function flip$1(O) {
|
|
3583
|
-
return make$
|
|
3583
|
+
return make$70((self, that) => O(that, self));
|
|
3584
3584
|
}
|
|
3585
3585
|
/**
|
|
3586
3586
|
* Transforms an `Order` on type `A` into an `Order` on type `B` by providing a function that
|
|
@@ -3615,7 +3615,7 @@ function flip$1(O) {
|
|
|
3615
3615
|
* @category mapping
|
|
3616
3616
|
* @since 2.0.0
|
|
3617
3617
|
*/
|
|
3618
|
-
const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$
|
|
3618
|
+
const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$70((b1, b2) => self(f(b1), f(b2))));
|
|
3619
3619
|
/**
|
|
3620
3620
|
* Checks whether one value is strictly less than another according to the given order.
|
|
3621
3621
|
*
|
|
@@ -4524,7 +4524,7 @@ const ServiceProto = {
|
|
|
4524
4524
|
.../*#__PURE__*/ Prototype({
|
|
4525
4525
|
label: "Service",
|
|
4526
4526
|
evaluate(fiber) {
|
|
4527
|
-
return exitSucceed(get$
|
|
4527
|
+
return exitSucceed(get$11(fiber.context, this));
|
|
4528
4528
|
}
|
|
4529
4529
|
}),
|
|
4530
4530
|
toJSON() {
|
|
@@ -4537,13 +4537,13 @@ const ServiceProto = {
|
|
|
4537
4537
|
return self;
|
|
4538
4538
|
},
|
|
4539
4539
|
context(self) {
|
|
4540
|
-
return make$
|
|
4540
|
+
return make$69(this, self);
|
|
4541
4541
|
},
|
|
4542
4542
|
use(f) {
|
|
4543
|
-
return withFiber$1((fiber) => f(get$
|
|
4543
|
+
return withFiber$1((fiber) => f(get$11(fiber.context, this)));
|
|
4544
4544
|
},
|
|
4545
4545
|
useSync(f) {
|
|
4546
|
-
return withFiber$1((fiber) => exitSucceed(f(get$
|
|
4546
|
+
return withFiber$1((fiber) => exitSucceed(f(get$11(fiber.context, this))));
|
|
4547
4547
|
}
|
|
4548
4548
|
};
|
|
4549
4549
|
const cacheKeys = /*#__PURE__*/ new Set();
|
|
@@ -4760,7 +4760,7 @@ const emptyContext = /*#__PURE__*/ makeUnsafe$9(/*#__PURE__*/ new Map());
|
|
|
4760
4760
|
* @category constructors
|
|
4761
4761
|
* @since 2.0.0
|
|
4762
4762
|
*/
|
|
4763
|
-
const make$
|
|
4763
|
+
const make$69 = (key, service) => makeUnsafe$9(/* @__PURE__ */ new Map([[key.key, service]]));
|
|
4764
4764
|
/**
|
|
4765
4765
|
* Adds a service to a given `Context`.
|
|
4766
4766
|
*
|
|
@@ -4922,7 +4922,7 @@ const getUnsafe$2 = /*#__PURE__*/ dual(2, (self, service) => {
|
|
|
4922
4922
|
* @category getters
|
|
4923
4923
|
* @since 2.0.0
|
|
4924
4924
|
*/
|
|
4925
|
-
const get$
|
|
4925
|
+
const get$11 = getUnsafe$2;
|
|
4926
4926
|
const defaultValueCacheKey = "~effect/Context/defaultValue";
|
|
4927
4927
|
const getDefaultValue = (ref) => {
|
|
4928
4928
|
if (defaultValueCacheKey in ref) return ref[defaultValueCacheKey];
|
|
@@ -5064,41 +5064,6 @@ const mergeAll$2 = (...ctxs) => {
|
|
|
5064
5064
|
return makeUnsafe$9(map);
|
|
5065
5065
|
};
|
|
5066
5066
|
/**
|
|
5067
|
-
* Returns a new `Context` with the specified service keys removed.
|
|
5068
|
-
*
|
|
5069
|
-
* **When to use**
|
|
5070
|
-
*
|
|
5071
|
-
* Use when you want to remove a denylist of services from a `Context`.
|
|
5072
|
-
*
|
|
5073
|
-
* **Example** (Omitting services from a context)
|
|
5074
|
-
*
|
|
5075
|
-
* ```ts import.meta.vitest
|
|
5076
|
-
* import { Context, Option, pipe } from "effect"
|
|
5077
|
-
*
|
|
5078
|
-
* const Port = Context.Service<{ PORT: number }>("Port")
|
|
5079
|
-
* const Timeout = Context.Service<{ TIMEOUT: number }>("Timeout")
|
|
5080
|
-
*
|
|
5081
|
-
* const someContext = pipe(
|
|
5082
|
-
* Context.make(Port, { PORT: 8080 }),
|
|
5083
|
-
* Context.add(Timeout, { TIMEOUT: 5000 })
|
|
5084
|
-
* )
|
|
5085
|
-
*
|
|
5086
|
-
* const context = pipe(someContext, Context.omit(Timeout))
|
|
5087
|
-
*
|
|
5088
|
-
* Context.getOption(context, Port) // => Option.some({ PORT: 8080 })
|
|
5089
|
-
* Context.getOption(context, Timeout) // => Option.none()
|
|
5090
|
-
* ```
|
|
5091
|
-
*
|
|
5092
|
-
* @see {@link pick} for keeping selected services
|
|
5093
|
-
*
|
|
5094
|
-
* @stability stable
|
|
5095
|
-
* @category filtering
|
|
5096
|
-
* @since 2.0.0
|
|
5097
|
-
*/
|
|
5098
|
-
const omit$1 = (...keys) => (self) => withFlat(self, (map) => {
|
|
5099
|
-
for (let i = 0; i < keys.length; i++) map.delete(keys[i].key);
|
|
5100
|
-
});
|
|
5101
|
-
/**
|
|
5102
5067
|
* Creates a context key with a default value.
|
|
5103
5068
|
*
|
|
5104
5069
|
* **When to use**
|
|
@@ -5606,7 +5571,7 @@ const all$3 = (input) => {
|
|
|
5606
5571
|
* @category constructors
|
|
5607
5572
|
* @since 2.0.0
|
|
5608
5573
|
*/
|
|
5609
|
-
const make$
|
|
5574
|
+
const make$68 = (...elements) => elements;
|
|
5610
5575
|
/**
|
|
5611
5576
|
* Creates an `Equivalence` for tuples by comparing corresponding elements
|
|
5612
5577
|
* using the provided per-position `Equivalence`s. Two tuples are equivalent
|
|
@@ -5639,7 +5604,7 @@ const make$67 = (...elements) => elements;
|
|
|
5639
5604
|
* @category instances
|
|
5640
5605
|
* @since 4.0.0
|
|
5641
5606
|
*/
|
|
5642
|
-
const makeEquivalence$
|
|
5607
|
+
const makeEquivalence$4 = Tuple$1;
|
|
5643
5608
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Iterable.js
|
|
5644
5609
|
/**
|
|
5645
5610
|
* Gets the first element of an `Iterable` without returning an `Option`.
|
|
@@ -5858,6 +5823,36 @@ const toEntries = /*#__PURE__*/ collect$1((key, value) => [key, value]);
|
|
|
5858
5823
|
*/
|
|
5859
5824
|
const has$5 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key));
|
|
5860
5825
|
/**
|
|
5826
|
+
* Removes a key from a record.
|
|
5827
|
+
*
|
|
5828
|
+
* **When to use**
|
|
5829
|
+
*
|
|
5830
|
+
* Use to create a shallow copy of a record without one property.
|
|
5831
|
+
*
|
|
5832
|
+
* **Details**
|
|
5833
|
+
*
|
|
5834
|
+
* If the key is not present, the result is still a shallow copy of the original
|
|
5835
|
+
* record.
|
|
5836
|
+
*
|
|
5837
|
+
* **Example** (Removing a key)
|
|
5838
|
+
*
|
|
5839
|
+
* ```ts import.meta.vitest
|
|
5840
|
+
* import { Record } from "effect"
|
|
5841
|
+
*
|
|
5842
|
+
* Record.remove({ a: 1, b: 2 }, "a") // => { b: 2 }
|
|
5843
|
+
* ```
|
|
5844
|
+
*
|
|
5845
|
+
* @stability stable
|
|
5846
|
+
* @category mutations
|
|
5847
|
+
* @since 2.0.0
|
|
5848
|
+
*/
|
|
5849
|
+
const remove$4 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
5850
|
+
if (!has$5(self, key)) return { ...self };
|
|
5851
|
+
const out = { ...self };
|
|
5852
|
+
delete out[key];
|
|
5853
|
+
return out;
|
|
5854
|
+
});
|
|
5855
|
+
/**
|
|
5861
5856
|
* Maps a record into another record by applying a transformation function to each of its values.
|
|
5862
5857
|
*
|
|
5863
5858
|
* **Example** (Mapping record values)
|
|
@@ -5990,7 +5985,7 @@ const isSubrecordBy = (equivalence) => dual(2, (self, that) => {
|
|
|
5990
5985
|
* @category instances
|
|
5991
5986
|
* @since 4.0.0
|
|
5992
5987
|
*/
|
|
5993
|
-
const makeEquivalence$
|
|
5988
|
+
const makeEquivalence$3 = (equivalence) => {
|
|
5994
5989
|
const is = isSubrecordBy(equivalence);
|
|
5995
5990
|
return (self, that) => is(self, that) && is(that, self);
|
|
5996
5991
|
};
|
|
@@ -6338,7 +6333,7 @@ function isOutOfBounds(i, as) {
|
|
|
6338
6333
|
* @category getters
|
|
6339
6334
|
* @since 2.0.0
|
|
6340
6335
|
*/
|
|
6341
|
-
const get$
|
|
6336
|
+
const get$10 = /*#__PURE__*/ dual(2, (self, index) => {
|
|
6342
6337
|
const i = Math.floor(index);
|
|
6343
6338
|
return isOutOfBounds(i, self) ? none() : some$2(self[i]);
|
|
6344
6339
|
});
|
|
@@ -6399,7 +6394,7 @@ const getUnsafe$1 = /*#__PURE__*/ dual(2, (self, index) => {
|
|
|
6399
6394
|
* @category getters
|
|
6400
6395
|
* @since 2.0.0
|
|
6401
6396
|
*/
|
|
6402
|
-
const head = /*#__PURE__*/ get$
|
|
6397
|
+
const head = /*#__PURE__*/ get$10(0);
|
|
6403
6398
|
/**
|
|
6404
6399
|
* Returns the first element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
6405
6400
|
* wrapper).
|
|
@@ -6611,7 +6606,7 @@ const sort = /*#__PURE__*/ dual(2, (self, O) => {
|
|
|
6611
6606
|
* @category zipping
|
|
6612
6607
|
* @since 2.0.0
|
|
6613
6608
|
*/
|
|
6614
|
-
const zip = /*#__PURE__*/ dual(2, (self, that) => zipWith$2(self, that, make$
|
|
6609
|
+
const zip = /*#__PURE__*/ dual(2, (self, that) => zipWith$2(self, that, make$68));
|
|
6615
6610
|
/**
|
|
6616
6611
|
* Combines elements from two iterables pairwise using a function. If the
|
|
6617
6612
|
* iterables differ in length, extra elements are discarded.
|
|
@@ -7267,7 +7262,7 @@ const some$1 = /*#__PURE__*/ dual(2, (self, predicate) => self.some(predicate));
|
|
|
7267
7262
|
* @category instances
|
|
7268
7263
|
* @since 4.0.0
|
|
7269
7264
|
*/
|
|
7270
|
-
const makeEquivalence$
|
|
7265
|
+
const makeEquivalence$2 = Array_;
|
|
7271
7266
|
/**
|
|
7272
7267
|
* Removes duplicates using `Equal.asEquivalence()`, preserving the order of the
|
|
7273
7268
|
* first occurrence.
|
|
@@ -7335,7 +7330,7 @@ const bigintNanosPerDay = /*#__PURE__*/ BigInt(864e11);
|
|
|
7335
7330
|
const bigintNanosPerWeek = /*#__PURE__*/ BigInt(6048e11);
|
|
7336
7331
|
const roundTiesAwayFromZero = (input) => BigInt(Math.sign(input) * Math.round(Math.abs(input)));
|
|
7337
7332
|
const roundMillisToNanos = (millis) => Number.isInteger(millis) ? BigInt(millis) * bigint1e6 : roundTiesAwayFromZero(millis * 1e6);
|
|
7338
|
-
const fromNanosNumber = (nanos) => make$
|
|
7333
|
+
const fromNanosNumber = (nanos) => make$67(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
|
|
7339
7334
|
const nanosToUnit = (nanos, divisor) => {
|
|
7340
7335
|
const value = Number(nanos);
|
|
7341
7336
|
if (Number.isFinite(value)) return value / divisor;
|
|
@@ -7358,9 +7353,9 @@ const divideTiesAwayFromZero = (numerator, denominator) => {
|
|
|
7358
7353
|
};
|
|
7359
7354
|
const fromMillisString = (input, scale) => {
|
|
7360
7355
|
const millis = Number(input) * scale;
|
|
7361
|
-
if (!Number.isFinite(millis)) return make$
|
|
7356
|
+
if (!Number.isFinite(millis)) return make$67(millis);
|
|
7362
7357
|
const nanos = parseNanos(input, BigInt(scale) * bigint1e6);
|
|
7363
|
-
return make$
|
|
7358
|
+
return make$67(Number.isInteger(millis) && BigInt(millis) * bigint1e6 === nanos ? millis : nanos);
|
|
7364
7359
|
};
|
|
7365
7360
|
const DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/;
|
|
7366
7361
|
/**
|
|
@@ -7427,7 +7422,7 @@ const fromInputUnsafe$1 = (input) => {
|
|
|
7427
7422
|
if (input[0] === -Infinity || input[1] === -Infinity) return negativeInfinity;
|
|
7428
7423
|
if (input[0] === Infinity || input[1] === Infinity) return infinity;
|
|
7429
7424
|
const nanos = input[0] * 1e9 + input[1];
|
|
7430
|
-
return Number.isFinite(nanos) && Number.isInteger(input[0]) && Number.isInteger(input[1]) ? make$
|
|
7425
|
+
return Number.isFinite(nanos) && Number.isInteger(input[0]) && Number.isInteger(input[1]) ? make$67(BigInt(input[0]) * bigint1e9 + BigInt(input[1])) : fromNanosNumber(nanos);
|
|
7431
7426
|
}
|
|
7432
7427
|
const obj = input;
|
|
7433
7428
|
let millis = 0;
|
|
@@ -7438,13 +7433,13 @@ const fromInputUnsafe$1 = (input) => {
|
|
|
7438
7433
|
if (obj.seconds) millis += obj.seconds * 1e3;
|
|
7439
7434
|
if (obj.milliseconds) millis += obj.milliseconds;
|
|
7440
7435
|
if (!obj.microseconds && !obj.nanoseconds) {
|
|
7441
|
-
if (!Number.isFinite(millis)) return make$
|
|
7436
|
+
if (!Number.isFinite(millis)) return make$67(millis);
|
|
7442
7437
|
const exact = sumObjectNanos(obj);
|
|
7443
|
-
return exact === void 0 || BigInt(millis) * bigint1e6 === exact ? make$
|
|
7438
|
+
return exact === void 0 || BigInt(millis) * bigint1e6 === exact ? make$67(millis) : make$67(exact);
|
|
7444
7439
|
}
|
|
7445
7440
|
const nanos = millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0);
|
|
7446
7441
|
const exact = Number.isFinite(nanos) ? sumObjectNanos(obj) : void 0;
|
|
7447
|
-
return exact === void 0 ? fromNanosNumber(nanos) : make$
|
|
7442
|
+
return exact === void 0 ? fromNanosNumber(nanos) : make$67(exact);
|
|
7448
7443
|
}
|
|
7449
7444
|
}
|
|
7450
7445
|
return invalid$3(input);
|
|
@@ -7521,7 +7516,7 @@ const DurationProto = {
|
|
|
7521
7516
|
return pipeArguments(this, arguments);
|
|
7522
7517
|
}
|
|
7523
7518
|
};
|
|
7524
|
-
const make$
|
|
7519
|
+
const make$67 = (input) => {
|
|
7525
7520
|
const duration = Object.create(DurationProto);
|
|
7526
7521
|
if (typeof input === "number") {
|
|
7527
7522
|
if (isNaN(input) || input === 0 || Object.is(input, -0)) duration.value = zeroDurationValue;
|
|
@@ -7644,8 +7639,8 @@ const abs = (self) => {
|
|
|
7644
7639
|
switch (self.value._tag) {
|
|
7645
7640
|
case "Infinity":
|
|
7646
7641
|
case "NegativeInfinity": return infinity;
|
|
7647
|
-
case "Millis": return self.value.millis < 0 ? make$
|
|
7648
|
-
case "Nanos": return self.value.nanos < bigint0$3 ? make$
|
|
7642
|
+
case "Millis": return self.value.millis < 0 ? make$67(-self.value.millis) : self;
|
|
7643
|
+
case "Nanos": return self.value.nanos < bigint0$3 ? make$67(-self.value.nanos) : self;
|
|
7649
7644
|
}
|
|
7650
7645
|
};
|
|
7651
7646
|
/**
|
|
@@ -7663,7 +7658,7 @@ const abs = (self) => {
|
|
|
7663
7658
|
* @category constructors
|
|
7664
7659
|
* @since 2.0.0
|
|
7665
7660
|
*/
|
|
7666
|
-
const zero$2 = /*#__PURE__*/ make$
|
|
7661
|
+
const zero$2 = /*#__PURE__*/ make$67(0);
|
|
7667
7662
|
/**
|
|
7668
7663
|
* A Duration representing infinite time.
|
|
7669
7664
|
*
|
|
@@ -7679,7 +7674,7 @@ const zero$2 = /*#__PURE__*/ make$66(0);
|
|
|
7679
7674
|
* @category constructors
|
|
7680
7675
|
* @since 2.0.0
|
|
7681
7676
|
*/
|
|
7682
|
-
const infinity = /*#__PURE__*/ make$
|
|
7677
|
+
const infinity = /*#__PURE__*/ make$67(Infinity);
|
|
7683
7678
|
/**
|
|
7684
7679
|
* A Duration representing negative infinite time.
|
|
7685
7680
|
*
|
|
@@ -7695,7 +7690,7 @@ const infinity = /*#__PURE__*/ make$66(Infinity);
|
|
|
7695
7690
|
* @category constructors
|
|
7696
7691
|
* @since 4.0.0
|
|
7697
7692
|
*/
|
|
7698
|
-
const negativeInfinity = /*#__PURE__*/ make$
|
|
7693
|
+
const negativeInfinity = /*#__PURE__*/ make$67(-Infinity);
|
|
7699
7694
|
/**
|
|
7700
7695
|
* Creates a Duration from nanoseconds.
|
|
7701
7696
|
*
|
|
@@ -7711,7 +7706,7 @@ const negativeInfinity = /*#__PURE__*/ make$66(-Infinity);
|
|
|
7711
7706
|
* @category constructors
|
|
7712
7707
|
* @since 2.0.0
|
|
7713
7708
|
*/
|
|
7714
|
-
const nanos = (nanos) => make$
|
|
7709
|
+
const nanos = (nanos) => make$67(nanos);
|
|
7715
7710
|
/**
|
|
7716
7711
|
* Creates a Duration from milliseconds.
|
|
7717
7712
|
*
|
|
@@ -7727,7 +7722,7 @@ const nanos = (nanos) => make$66(nanos);
|
|
|
7727
7722
|
* @category constructors
|
|
7728
7723
|
* @since 2.0.0
|
|
7729
7724
|
*/
|
|
7730
|
-
const millis = (millis) => make$
|
|
7725
|
+
const millis = (millis) => make$67(millis);
|
|
7731
7726
|
/**
|
|
7732
7727
|
* Creates a Duration from seconds.
|
|
7733
7728
|
*
|
|
@@ -7743,7 +7738,7 @@ const millis = (millis) => make$66(millis);
|
|
|
7743
7738
|
* @category constructors
|
|
7744
7739
|
* @since 2.0.0
|
|
7745
7740
|
*/
|
|
7746
|
-
const seconds = (seconds) => make$
|
|
7741
|
+
const seconds = (seconds) => make$67(seconds * 1e3);
|
|
7747
7742
|
/**
|
|
7748
7743
|
* Converts a Duration to milliseconds.
|
|
7749
7744
|
*
|
|
@@ -7910,7 +7905,7 @@ const matchPair = /*#__PURE__*/ dual(3, (self, that, options) => {
|
|
|
7910
7905
|
* @category instances
|
|
7911
7906
|
* @since 2.0.0
|
|
7912
7907
|
*/
|
|
7913
|
-
const Order$2 = /*#__PURE__*/ make$
|
|
7908
|
+
const Order$2 = /*#__PURE__*/ make$70((self, that) => matchPair(self, that, {
|
|
7914
7909
|
onMillis: (self, that) => self < that ? -1 : self > that ? 1 : 0,
|
|
7915
7910
|
onNanos: (self, that) => self < that ? -1 : self > that ? 1 : 0,
|
|
7916
7911
|
onInfinity: (self, that) => {
|
|
@@ -7983,8 +7978,8 @@ const max = /*#__PURE__*/ max$1(Order$2);
|
|
|
7983
7978
|
* @since 2.0.0
|
|
7984
7979
|
*/
|
|
7985
7980
|
const sum = /*#__PURE__*/ dual(2, (self, that) => matchPair(self, that, {
|
|
7986
|
-
onMillis: (self, that) => make$
|
|
7987
|
-
onNanos: (self, that) => make$
|
|
7981
|
+
onMillis: (self, that) => make$67(self + that),
|
|
7982
|
+
onNanos: (self, that) => make$67(self + that),
|
|
7988
7983
|
onInfinity: (self, that) => {
|
|
7989
7984
|
const s = self.value._tag;
|
|
7990
7985
|
const t = that.value._tag;
|
|
@@ -8808,7 +8803,7 @@ var ParentSpan = class extends (/*#__PURE__*/ Service$1()(ParentSpanKey, { fiber
|
|
|
8808
8803
|
* @category constructors
|
|
8809
8804
|
* @since 2.0.0
|
|
8810
8805
|
*/
|
|
8811
|
-
const make$
|
|
8806
|
+
const make$66 = (options) => options;
|
|
8812
8807
|
/**
|
|
8813
8808
|
* Creates an `ExternalSpan` from trace and span identifiers, defaulting
|
|
8814
8809
|
* `sampled` to `true` and annotations to an empty context when they are not
|
|
@@ -8988,7 +8983,7 @@ const Tracer = /*#__PURE__*/ Reference(TracerKey, {
|
|
|
8988
8983
|
* @category references
|
|
8989
8984
|
* @since 4.0.0
|
|
8990
8985
|
*/
|
|
8991
|
-
const nativeTracer = /*#__PURE__*/ make$
|
|
8986
|
+
const nativeTracer = /*#__PURE__*/ make$66({ span: (options) => new NativeSpan(options) });
|
|
8992
8987
|
/**
|
|
8993
8988
|
* Default in-memory `Span` implementation used by the native tracer. It
|
|
8994
8989
|
* generates span and trace identifiers, stores attributes, events, and links,
|
|
@@ -9402,7 +9397,7 @@ var FiberImpl = class {
|
|
|
9402
9397
|
return this._dispatcher ??= this.cache.scheduler.makeDispatcher();
|
|
9403
9398
|
}
|
|
9404
9399
|
getRef(ref) {
|
|
9405
|
-
return get$
|
|
9400
|
+
return get$11(this.context, ref);
|
|
9406
9401
|
}
|
|
9407
9402
|
addObserver(cb) {
|
|
9408
9403
|
if (this._exit) {
|
|
@@ -9421,7 +9416,7 @@ var FiberImpl = class {
|
|
|
9421
9416
|
interruptUnsafe(fiberId, annotations) {
|
|
9422
9417
|
if (this._exit) return;
|
|
9423
9418
|
let cause = causeInterrupt(fiberId);
|
|
9424
|
-
if (this.cache.stackFrame) cause = causeAnnotate(cause, make$
|
|
9419
|
+
if (this.cache.stackFrame) cause = causeAnnotate(cause, make$69(StackTraceKey, this.cache.stackFrame));
|
|
9425
9420
|
if (annotations) cause = causeAnnotate(cause, annotations);
|
|
9426
9421
|
this._interruptedCause = this._interruptedCause ? causeAddInterrupts(this._interruptedCause, cause) : cause;
|
|
9427
9422
|
if (this.interruptible) {
|
|
@@ -9570,17 +9565,17 @@ var FiberImpl = class {
|
|
|
9570
9565
|
const makeFiberContextCache = (context) => {
|
|
9571
9566
|
const currentTracer = getOrUndefinedUnsafe(context, TracerKey);
|
|
9572
9567
|
return {
|
|
9573
|
-
scheduler: get$
|
|
9568
|
+
scheduler: get$11(context, Scheduler),
|
|
9574
9569
|
tracer: currentTracer,
|
|
9575
9570
|
tracerContext: currentTracer ? currentTracer["context"] : void 0,
|
|
9576
|
-
tracerEnabled: get$
|
|
9571
|
+
tracerEnabled: get$11(context, TracerEnabled),
|
|
9577
9572
|
span: getOrUndefinedUnsafe(context, ParentSpanKey),
|
|
9578
|
-
logLevel: get$
|
|
9579
|
-
minimumLogLevel: get$
|
|
9580
|
-
stackFrame: get$
|
|
9573
|
+
logLevel: get$11(context, CurrentLogLevel),
|
|
9574
|
+
minimumLogLevel: get$11(context, MinimumLogLevel$1),
|
|
9575
|
+
stackFrame: get$11(context, CurrentStackFrame),
|
|
9581
9576
|
runtimeMetrics: getOrUndefinedUnsafe(context, FiberRuntimeMetricsKey),
|
|
9582
|
-
maxOpsBeforeYield: get$
|
|
9583
|
-
preventYield: get$
|
|
9577
|
+
maxOpsBeforeYield: get$11(context, MaxOpsBeforeYield),
|
|
9578
|
+
preventYield: get$11(context, PreventSchedulerYield)
|
|
9584
9579
|
};
|
|
9585
9580
|
};
|
|
9586
9581
|
const deferredInterruptCont = {
|
|
@@ -10178,7 +10173,7 @@ const forever$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, optio
|
|
|
10178
10173
|
step: constVoid
|
|
10179
10174
|
}));
|
|
10180
10175
|
/** @internal */
|
|
10181
|
-
const catchCause$
|
|
10176
|
+
const catchCause$3 = /*#__PURE__*/ dual(2, (self, f) => new OnFailureImpl(self, f.length !== 1 ? (cause) => f(cause) : f));
|
|
10182
10177
|
const OnFailureProto = /*#__PURE__*/ makePrimitiveProto({
|
|
10183
10178
|
op: "OnFailure",
|
|
10184
10179
|
[evaluate]: evaluateCont
|
|
@@ -10189,7 +10184,7 @@ const OnFailureImpl = function(self, f) {
|
|
|
10189
10184
|
};
|
|
10190
10185
|
OnFailureImpl.prototype = OnFailureProto;
|
|
10191
10186
|
/** @internal */
|
|
10192
|
-
const catchCauseFilter$1 = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$
|
|
10187
|
+
const catchCauseFilter$1 = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$3(self, (cause) => {
|
|
10193
10188
|
const eb = filter(cause);
|
|
10194
10189
|
return isFailure$1(eb) ? failCause$5(eb.failure) : f(eb.success, cause);
|
|
10195
10190
|
}));
|
|
@@ -10198,9 +10193,9 @@ const catch_$2 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter$1(self, fin
|
|
|
10198
10193
|
/** @internal */
|
|
10199
10194
|
const catchDefect$1 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter$1(self, findDefect, f));
|
|
10200
10195
|
/** @internal */
|
|
10201
|
-
const tapCause$1 = /*#__PURE__*/ dual(2, (self, f) => catchCause$
|
|
10196
|
+
const tapCause$1 = /*#__PURE__*/ dual(2, (self, f) => catchCause$3(self, (cause) => andThen$1(f(cause), failCause$5(cause))));
|
|
10202
10197
|
/** @internal */
|
|
10203
|
-
const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$
|
|
10198
|
+
const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$3(self, (cause) => {
|
|
10204
10199
|
const result = filter(cause);
|
|
10205
10200
|
if (isFailure$1(result)) return failCause$5(cause);
|
|
10206
10201
|
return andThen$1(f(result.success, cause), failCause$5(cause));
|
|
@@ -10208,14 +10203,14 @@ const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$2(s
|
|
|
10208
10203
|
/** @internal */
|
|
10209
10204
|
const tapError$4 = /*#__PURE__*/ dual(2, (self, f) => tapCauseFilter(self, findError, (e) => f(e)));
|
|
10210
10205
|
/** @internal */
|
|
10211
|
-
const catchIf$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$
|
|
10206
|
+
const catchIf$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$3(self, (cause) => {
|
|
10212
10207
|
const error = findRecoverableError(cause);
|
|
10213
10208
|
if (isFailure$1(error)) return failCause$5(error.failure);
|
|
10214
10209
|
if (!predicate(error.success)) return orElse ? orElse(error.success) : failCause$5(cause);
|
|
10215
10210
|
return f(error.success);
|
|
10216
10211
|
}));
|
|
10217
10212
|
/** @internal */
|
|
10218
|
-
const catchFilter$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, filter, f, orElse) => catchCause$
|
|
10213
|
+
const catchFilter$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, filter, f, orElse) => catchCause$3(self, (cause) => {
|
|
10219
10214
|
const error = findRecoverableError(cause);
|
|
10220
10215
|
if (isFailure$1(error)) return failCause$5(error.failure);
|
|
10221
10216
|
const result = filter(error.success);
|
|
@@ -10242,7 +10237,7 @@ const catchReason$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, e
|
|
|
10242
10237
|
return orElse ? orElse(reason, e) : fail$10(e);
|
|
10243
10238
|
}));
|
|
10244
10239
|
/** @internal */
|
|
10245
|
-
const mapError$3 = /*#__PURE__*/ dual(2, (self, f) => catchCause$
|
|
10240
|
+
const mapError$3 = /*#__PURE__*/ dual(2, (self, f) => catchCause$3(self, (cause) => failCause$5(causeMap(cause, f))));
|
|
10246
10241
|
/** @internal */
|
|
10247
10242
|
const mapBoth = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$1(self, {
|
|
10248
10243
|
onFailure: (cause) => failCause$5(causeMap(cause, options.onFailure)),
|
|
@@ -10382,9 +10377,9 @@ const delay$1 = /*#__PURE__*/ dual(2, (self, duration) => andThen$1(sleep$1(dura
|
|
|
10382
10377
|
/** @internal */
|
|
10383
10378
|
const timeoutOrElse$1 = /*#__PURE__*/ dual(2, (self, options) => flatMap$5(timeoutOption$1(self, options.duration), (option) => isNone(option) ? options.orElse() : succeed$8(option.value)));
|
|
10384
10379
|
/** @internal */
|
|
10385
|
-
const timeoutErrorFromDuration = (duration) => new TimeoutError(`Operation timed out after '${format$1(duration)}'`);
|
|
10380
|
+
const timeoutErrorFromDuration = (duration) => new TimeoutError$1(`Operation timed out after '${format$1(duration)}'`);
|
|
10386
10381
|
/** @internal */
|
|
10387
|
-
const timeout$
|
|
10382
|
+
const timeout$2 = /*#__PURE__*/ dual(2, (self, duration) => {
|
|
10388
10383
|
const decoded = fromInputUnsafe$1(duration);
|
|
10389
10384
|
return timeoutOrElse$1(self, {
|
|
10390
10385
|
duration: decoded,
|
|
@@ -10426,7 +10421,7 @@ const runFinalizer = (finalizer, exit_) => {
|
|
|
10426
10421
|
return exitDie(defect);
|
|
10427
10422
|
}
|
|
10428
10423
|
};
|
|
10429
|
-
const combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause$
|
|
10424
|
+
const combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause$3(finalizer, (cause) => failCause$5(causeElectDefects(causeCombine(exit_.cause, cause))));
|
|
10430
10425
|
const scopeCloseFinalizers = /*#__PURE__*/ fnUntraced$1(function* (self, finalizers, exit_) {
|
|
10431
10426
|
let exits = [];
|
|
10432
10427
|
const fibers = [];
|
|
@@ -11086,11 +11081,11 @@ const NoopSpanProto = {
|
|
|
11086
11081
|
const noopSpan = (options) => Object.assign(Object.create(NoopSpanProto), options);
|
|
11087
11082
|
const filterDisablePropagation = (span) => {
|
|
11088
11083
|
if (!span) return none();
|
|
11089
|
-
return get$
|
|
11084
|
+
return get$11(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some$2(span);
|
|
11090
11085
|
};
|
|
11091
11086
|
/** @internal */
|
|
11092
11087
|
const makeSpanUnsafe = (fiber, name, options) => {
|
|
11093
|
-
const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$
|
|
11088
|
+
const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$11(options.annotations, DisablePropagation);
|
|
11094
11089
|
const parent = options?.parent !== void 0 ? some$2(options.parent) : options?.root ? none() : filterDisablePropagation(fiber.cache.span);
|
|
11095
11090
|
let span;
|
|
11096
11091
|
if (disablePropagation) span = noopSpan({
|
|
@@ -11174,6 +11169,15 @@ const withSpan$1 = function() {
|
|
|
11174
11169
|
return (self, ...args) => useSpan$1(name, fnArg ? fnArg(...args) : options, (span) => withParentSpan$1(self, span, traceOptions));
|
|
11175
11170
|
};
|
|
11176
11171
|
/** @internal */
|
|
11172
|
+
const annotateCurrentSpan$1 = (...args) => withFiber$1((fiber) => {
|
|
11173
|
+
const span = fiber.currentSpanLocal;
|
|
11174
|
+
if (span && span.status._tag !== "Ended") {
|
|
11175
|
+
if (args.length === 1) for (const [key, value] of Object.entries(args[0])) span.attribute(key, value);
|
|
11176
|
+
else span.attribute(args[0], args[1]);
|
|
11177
|
+
}
|
|
11178
|
+
return void_$3;
|
|
11179
|
+
});
|
|
11180
|
+
/** @internal */
|
|
11177
11181
|
const ClockRef = /*#__PURE__*/ Reference("effect/Clock", { defaultValue: () => new ClockImpl() });
|
|
11178
11182
|
const MAX_TIMER_MILLIS = 2 ** 31 - 1;
|
|
11179
11183
|
var ClockImpl = class {
|
|
@@ -11241,7 +11245,7 @@ const TimeoutErrorTypeId = "~effect/Cause/TimeoutError";
|
|
|
11241
11245
|
/** @internal */
|
|
11242
11246
|
const isTimeoutError$1 = (u) => hasProperty(u, TimeoutErrorTypeId);
|
|
11243
11247
|
/** @internal */
|
|
11244
|
-
var TimeoutError = class extends (/*#__PURE__*/ TaggedError$2("TimeoutError")) {
|
|
11248
|
+
var TimeoutError$1 = class extends (/*#__PURE__*/ TaggedError$2("TimeoutError")) {
|
|
11245
11249
|
[TimeoutErrorTypeId] = TimeoutErrorTypeId;
|
|
11246
11250
|
constructor(message) {
|
|
11247
11251
|
super({ message });
|
|
@@ -12021,6 +12025,22 @@ const done$1 = done$2;
|
|
|
12021
12025
|
*/
|
|
12022
12026
|
const isTimeoutError = isTimeoutError$1;
|
|
12023
12027
|
/**
|
|
12028
|
+
* Constructs a `TimeoutError` with an optional message.
|
|
12029
|
+
*
|
|
12030
|
+
* **Example** (Creating a TimeoutError)
|
|
12031
|
+
*
|
|
12032
|
+
* ```ts import.meta.vitest
|
|
12033
|
+
* import { Cause } from "effect"
|
|
12034
|
+
*
|
|
12035
|
+
* new Cause.TimeoutError("Operation timed out").message // => "Operation timed out"
|
|
12036
|
+
* ```
|
|
12037
|
+
*
|
|
12038
|
+
* @stability stable
|
|
12039
|
+
* @category constructors
|
|
12040
|
+
* @since 4.0.0
|
|
12041
|
+
*/
|
|
12042
|
+
const TimeoutError = TimeoutError$1;
|
|
12043
|
+
/**
|
|
12024
12044
|
* Constructs an `IllegalArgumentError` with an optional message.
|
|
12025
12045
|
*
|
|
12026
12046
|
* **Example** (Creating an IllegalArgumentError)
|
|
@@ -12961,7 +12981,7 @@ const Scope = scopeTag;
|
|
|
12961
12981
|
* @category constructors
|
|
12962
12982
|
* @since 2.0.0
|
|
12963
12983
|
*/
|
|
12964
|
-
const make$
|
|
12984
|
+
const make$65 = scopeMake;
|
|
12965
12985
|
/**
|
|
12966
12986
|
* Creates a new `Scope` synchronously without wrapping it in an `Effect`.
|
|
12967
12987
|
* This is useful when you need a scope immediately but should be used with caution
|
|
@@ -13610,8 +13630,8 @@ const buildWithScope = /*#__PURE__*/ dual(2, (self, scope) => withFiber$1((fiber
|
|
|
13610
13630
|
* @since 2.0.0
|
|
13611
13631
|
*/
|
|
13612
13632
|
const succeed$6 = function() {
|
|
13613
|
-
if (arguments.length === 1) return (resource) => succeedContext(make$
|
|
13614
|
-
return succeedContext(make$
|
|
13633
|
+
if (arguments.length === 1) return (resource) => succeedContext(make$69(arguments[0], resource));
|
|
13634
|
+
return succeedContext(make$69(arguments[0], arguments[1]));
|
|
13615
13635
|
};
|
|
13616
13636
|
/**
|
|
13617
13637
|
* Constructs a layer that provides all services in an already available
|
|
@@ -13723,8 +13743,8 @@ const empty$10 = /*#__PURE__*/ succeedContext(/*#__PURE__*/ empty$14());
|
|
|
13723
13743
|
* @since 2.0.0
|
|
13724
13744
|
*/
|
|
13725
13745
|
const sync$1 = function() {
|
|
13726
|
-
if (arguments.length === 1) return (evaluate) => syncContext(() => make$
|
|
13727
|
-
return syncContext(() => make$
|
|
13746
|
+
if (arguments.length === 1) return (evaluate) => syncContext(() => make$69(arguments[0], evaluate()));
|
|
13747
|
+
return syncContext(() => make$69(arguments[0], arguments[1]()));
|
|
13728
13748
|
};
|
|
13729
13749
|
/**
|
|
13730
13750
|
* Constructs a layer lazily that provides all services in a `Context`.
|
|
@@ -13808,7 +13828,7 @@ const effect = function() {
|
|
|
13808
13828
|
if (arguments.length === 1) return (effect) => effectImpl(arguments[0], effect);
|
|
13809
13829
|
return effectImpl(arguments[0], arguments[1]);
|
|
13810
13830
|
};
|
|
13811
|
-
const effectImpl = (service, effect) => effectContext(map$8(effect, (value) => make$
|
|
13831
|
+
const effectImpl = (service, effect) => effectContext(map$8(effect, (value) => make$69(service, value)));
|
|
13812
13832
|
/**
|
|
13813
13833
|
* Constructs a layer from an effect that produces all services in a `Context`.
|
|
13814
13834
|
*
|
|
@@ -13916,7 +13936,7 @@ const unwrapKey = /*#__PURE__*/ Service$1("effect/Layer/unwrap");
|
|
|
13916
13936
|
* @category converting
|
|
13917
13937
|
* @since 4.0.0
|
|
13918
13938
|
*/
|
|
13919
|
-
const unwrap$8 = (self) => flatMap$4(effect(unwrapKey)(self), get$
|
|
13939
|
+
const unwrap$8 = (self) => flatMap$4(effect(unwrapKey)(self), get$11(unwrapKey));
|
|
13920
13940
|
const mergeAllEffect = (layers, memoMap, scope) => {
|
|
13921
13941
|
const parentScope = forkUnsafe(scope, "parallel");
|
|
13922
13942
|
return forEach$2(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$8((context) => mergeAll$2(...context)));
|
|
@@ -14267,6 +14287,63 @@ const provideMerge = /*#__PURE__*/ dual(2, (self, that) => provideWith(self, tha
|
|
|
14267
14287
|
*/
|
|
14268
14288
|
const flatMap$4 = /*#__PURE__*/ dual(2, (self, f) => fromBuild((memoMap, scope) => flatMap$5(self.build(memoMap, scope), (context) => f(context).build(memoMap, scope))));
|
|
14269
14289
|
/**
|
|
14290
|
+
* Recovers from any failure cause by switching to another layer.
|
|
14291
|
+
*
|
|
14292
|
+
* **When to use**
|
|
14293
|
+
*
|
|
14294
|
+
* Use when you need `Layer` recovery to inspect more than the typed error,
|
|
14295
|
+
* such as defects or interruption information.
|
|
14296
|
+
*
|
|
14297
|
+
* **Details**
|
|
14298
|
+
*
|
|
14299
|
+
* The handler receives the full `Cause` of the failed layer, including typed
|
|
14300
|
+
* errors, unexpected defects, and interruption information, and returns the
|
|
14301
|
+
* fallback layer to build instead. Finalizers for resources acquired by the
|
|
14302
|
+
* failed layer are still run before the fallback layer is acquired.
|
|
14303
|
+
*
|
|
14304
|
+
* **Example** (Recovering from layer failures by cause)
|
|
14305
|
+
*
|
|
14306
|
+
* ```ts import.meta.vitest
|
|
14307
|
+
* import { Context, Data, Effect, Layer } from "effect"
|
|
14308
|
+
*
|
|
14309
|
+
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
14310
|
+
* message: string
|
|
14311
|
+
* }> {}
|
|
14312
|
+
*
|
|
14313
|
+
* class Database extends Context.Service<Database, {
|
|
14314
|
+
* readonly query: (sql: string) => Effect.Effect<string>
|
|
14315
|
+
* }>()("Database") {}
|
|
14316
|
+
*
|
|
14317
|
+
* const primaryDatabaseLayer = Layer.effect(Database,
|
|
14318
|
+
* Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
|
|
14319
|
+
* )
|
|
14320
|
+
*
|
|
14321
|
+
* const databaseWithFallback = primaryDatabaseLayer.pipe(
|
|
14322
|
+
* Layer.catchCause(() => {
|
|
14323
|
+
* return Layer.succeed(Database, {
|
|
14324
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
|
|
14325
|
+
* })
|
|
14326
|
+
* })
|
|
14327
|
+
* )
|
|
14328
|
+
*
|
|
14329
|
+
* const program = Effect.gen(function*() {
|
|
14330
|
+
* const database = yield* Database
|
|
14331
|
+
* return yield* database.query("SELECT * FROM users")
|
|
14332
|
+
* }).pipe(
|
|
14333
|
+
* Effect.provide(databaseWithFallback)
|
|
14334
|
+
* )
|
|
14335
|
+
*
|
|
14336
|
+
* await Effect.runPromise(program) // => "Memory: SELECT * FROM users"
|
|
14337
|
+
* ```
|
|
14338
|
+
*
|
|
14339
|
+
* @see {@link catchTag} for recovering from specific tagged errors
|
|
14340
|
+
*
|
|
14341
|
+
* @stability stable
|
|
14342
|
+
* @category error handling
|
|
14343
|
+
* @since 4.0.0
|
|
14344
|
+
*/
|
|
14345
|
+
const catchCause$2 = /*#__PURE__*/ dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => catchCause$3(self.build(memoMap, scope), (cause) => onError(cause).build(memoMap, scope))));
|
|
14346
|
+
/**
|
|
14270
14347
|
* Builds this layer and keeps it alive until the returned effect is interrupted.
|
|
14271
14348
|
*
|
|
14272
14349
|
* **When to use**
|
|
@@ -14629,7 +14706,7 @@ const makeZonedUnsafe$1 = (input, options) => {
|
|
|
14629
14706
|
return makeZonedFromAdjusted(self.epochMilliseconds, zone, options?.disambiguation ?? "compatible");
|
|
14630
14707
|
};
|
|
14631
14708
|
/** @internal */
|
|
14632
|
-
const make$
|
|
14709
|
+
const make$64 = /*#__PURE__*/ liftThrowable(makeUnsafe$6);
|
|
14633
14710
|
const validZoneCache = /*#__PURE__*/ new Map();
|
|
14634
14711
|
const formatOptions = {
|
|
14635
14712
|
day: "numeric",
|
|
@@ -15485,7 +15562,7 @@ const fromStepWithMetadata = (step) => fromStep(map$8(step, (f) => {
|
|
|
15485
15562
|
* @category destructors
|
|
15486
15563
|
* @since 4.0.0
|
|
15487
15564
|
*/
|
|
15488
|
-
const toStep = (schedule) => catchCause$
|
|
15565
|
+
const toStep = (schedule) => catchCause$3(schedule.step, (cause) => succeed$8(() => failCause$5(cause)));
|
|
15489
15566
|
/**
|
|
15490
15567
|
* Extracts a step function from a `Schedule` that sleeps for each computed
|
|
15491
15568
|
* delay and returns metadata for the completed step.
|
|
@@ -17426,7 +17503,7 @@ const catchReason = catchReason$1;
|
|
|
17426
17503
|
* @category error handling
|
|
17427
17504
|
* @since 4.0.0
|
|
17428
17505
|
*/
|
|
17429
|
-
const catchCause$1 = catchCause$
|
|
17506
|
+
const catchCause$1 = catchCause$3;
|
|
17430
17507
|
/**
|
|
17431
17508
|
* Recovers from defects using a provided recovery function.
|
|
17432
17509
|
*
|
|
@@ -17977,7 +18054,7 @@ const firstSuccessOf = firstSuccessOf$1;
|
|
|
17977
18054
|
* @category delays & timeouts
|
|
17978
18055
|
* @since 2.0.0
|
|
17979
18056
|
*/
|
|
17980
|
-
const timeout = timeout$
|
|
18057
|
+
const timeout$1 = timeout$2;
|
|
17981
18058
|
/**
|
|
17982
18059
|
* Runs an effect with a time limit and represents only the timeout case as
|
|
17983
18060
|
* `Option.none`.
|
|
@@ -19385,6 +19462,31 @@ const repeat = repeat$1;
|
|
|
19385
19462
|
*/
|
|
19386
19463
|
const withTracerEnabled = withTracerEnabled$1;
|
|
19387
19464
|
/**
|
|
19465
|
+
* Adds an annotation to the current span if available.
|
|
19466
|
+
*
|
|
19467
|
+
* **Example** (Annotating the current span)
|
|
19468
|
+
*
|
|
19469
|
+
* ```ts import.meta.vitest
|
|
19470
|
+
* import { Effect } from "effect"
|
|
19471
|
+
*
|
|
19472
|
+
* const program = Effect.gen(function*() {
|
|
19473
|
+
* yield* Effect.annotateCurrentSpan("userId", "123")
|
|
19474
|
+
* yield* Effect.annotateCurrentSpan({
|
|
19475
|
+
* operation: "user-lookup"
|
|
19476
|
+
* })
|
|
19477
|
+
* return "success"
|
|
19478
|
+
* })
|
|
19479
|
+
*
|
|
19480
|
+
* const traced = Effect.withSpan(program, "user-operation")
|
|
19481
|
+
* Effect.runSync(traced) // => "success"
|
|
19482
|
+
* ```
|
|
19483
|
+
*
|
|
19484
|
+
* @stability stable
|
|
19485
|
+
* @category tracing
|
|
19486
|
+
* @since 2.0.0
|
|
19487
|
+
*/
|
|
19488
|
+
const annotateCurrentSpan = annotateCurrentSpan$1;
|
|
19489
|
+
/**
|
|
19388
19490
|
* Create a new span for tracing, and automatically close it when the effect
|
|
19389
19491
|
* completes.
|
|
19390
19492
|
*
|
|
@@ -20842,7 +20944,7 @@ const Empty$2 = /*#__PURE__*/ Symbol.for("effect/MutableList/Empty");
|
|
|
20842
20944
|
* @category constructors
|
|
20843
20945
|
* @since 2.0.0
|
|
20844
20946
|
*/
|
|
20845
|
-
const make$
|
|
20947
|
+
const make$63 = () => ({
|
|
20846
20948
|
head: void 0,
|
|
20847
20949
|
tail: void 0,
|
|
20848
20950
|
length: 0
|
|
@@ -21217,12 +21319,12 @@ const QueueProto = {
|
|
|
21217
21319
|
* @category constructors
|
|
21218
21320
|
* @since 4.0.0
|
|
21219
21321
|
*/
|
|
21220
|
-
const make$
|
|
21322
|
+
const make$62 = (options) => withFiber$1((fiber) => {
|
|
21221
21323
|
const self = Object.create(QueueProto);
|
|
21222
21324
|
self.dispatcher = fiber.currentDispatcher;
|
|
21223
21325
|
self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
|
|
21224
21326
|
self.strategy = options?.strategy ?? "suspend";
|
|
21225
|
-
self.messages = make$
|
|
21327
|
+
self.messages = make$63();
|
|
21226
21328
|
self.scheduleRunning = false;
|
|
21227
21329
|
self.state = {
|
|
21228
21330
|
_tag: "Open",
|
|
@@ -21263,7 +21365,7 @@ const make$61 = (options) => withFiber$1((fiber) => {
|
|
|
21263
21365
|
* @category constructors
|
|
21264
21366
|
* @since 2.0.0
|
|
21265
21367
|
*/
|
|
21266
|
-
const bounded = (capacity) => make$
|
|
21368
|
+
const bounded = (capacity) => make$62({ capacity });
|
|
21267
21369
|
/**
|
|
21268
21370
|
* Creates a bounded queue with sliding strategy. When the queue reaches capacity,
|
|
21269
21371
|
* new elements are added and the oldest elements are dropped.
|
|
@@ -21300,7 +21402,7 @@ const bounded = (capacity) => make$61({ capacity });
|
|
|
21300
21402
|
* @category constructors
|
|
21301
21403
|
* @since 2.0.0
|
|
21302
21404
|
*/
|
|
21303
|
-
const sliding = (capacity) => make$
|
|
21405
|
+
const sliding = (capacity) => make$62({
|
|
21304
21406
|
capacity,
|
|
21305
21407
|
strategy: "sliding"
|
|
21306
21408
|
});
|
|
@@ -22330,7 +22432,7 @@ const makeUuid = (bytes, randomBytes, format) => {
|
|
|
22330
22432
|
* @category constructors
|
|
22331
22433
|
* @since 4.0.0
|
|
22332
22434
|
*/
|
|
22333
|
-
const make$
|
|
22435
|
+
const make$61 = (randomBytes) => {
|
|
22334
22436
|
const randomBytesChecked = (size) => {
|
|
22335
22437
|
checkSize(size);
|
|
22336
22438
|
return randomBytes(size);
|
|
@@ -22376,7 +22478,7 @@ const fillRandom = (crypto, size) => {
|
|
|
22376
22478
|
* @category layers
|
|
22377
22479
|
* @since 4.0.0
|
|
22378
22480
|
*/
|
|
22379
|
-
const layerWebCrypto$7 = /*#__PURE__*/ effect(SecureRandom, /*#__PURE__*/ WebCrypto.use((crypto) => succeed$5(make$
|
|
22481
|
+
const layerWebCrypto$7 = /*#__PURE__*/ effect(SecureRandom, /*#__PURE__*/ WebCrypto.use((crypto) => succeed$5(make$61((size) => fillRandom(crypto, size)))));
|
|
22380
22482
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Random.js
|
|
22381
22483
|
/**
|
|
22382
22484
|
* Represents a service for generating pseudo-random numbers.
|
|
@@ -22628,7 +22730,7 @@ var SemaphoreImpl = class {
|
|
|
22628
22730
|
* @category constructors
|
|
22629
22731
|
* @since 4.0.0
|
|
22630
22732
|
*/
|
|
22631
|
-
const make$
|
|
22733
|
+
const make$60 = (permits) => sync$2(() => new SemaphoreImpl(permits));
|
|
22632
22734
|
/**
|
|
22633
22735
|
* Runs an effect with a single permit and releases the permit when the effect
|
|
22634
22736
|
* completes.
|
|
@@ -22748,7 +22850,7 @@ const isBigDecimal = (u) => hasProperty(u, TypeId$52);
|
|
|
22748
22850
|
* @category constructors
|
|
22749
22851
|
* @since 2.0.0
|
|
22750
22852
|
*/
|
|
22751
|
-
const make$
|
|
22853
|
+
const make$59 = (value, scale) => {
|
|
22752
22854
|
if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
|
|
22753
22855
|
const o = Object.create(BigDecimalProto);
|
|
22754
22856
|
o.value = value;
|
|
@@ -22756,7 +22858,7 @@ const make$58 = (value, scale) => {
|
|
|
22756
22858
|
return o;
|
|
22757
22859
|
};
|
|
22758
22860
|
const makeNormalized = (value, scale) => {
|
|
22759
|
-
const o = make$
|
|
22861
|
+
const o = make$59(value, scale);
|
|
22760
22862
|
o.normalized = o;
|
|
22761
22863
|
return o;
|
|
22762
22864
|
};
|
|
@@ -23190,7 +23292,7 @@ const binaryUnits = [
|
|
|
23190
23292
|
const allUnits = [...decimalUnits, .../*#__PURE__*/ binaryUnits.slice(1)];
|
|
23191
23293
|
const unitsByName = /*#__PURE__*/ new Map(/*#__PURE__*/ allUnits.flatMap((unit) => unit.names.map((name) => [name, unit])));
|
|
23192
23294
|
const unitsBySymbol = /*#__PURE__*/ new Map(/*#__PURE__*/ allUnits.map((unit) => [unit.symbol, unit]));
|
|
23193
|
-
const make$
|
|
23295
|
+
const make$58 = (value) => value;
|
|
23194
23296
|
/**
|
|
23195
23297
|
* The byte size containing zero bytes.
|
|
23196
23298
|
*
|
|
@@ -23198,13 +23300,13 @@ const make$57 = (value) => value;
|
|
|
23198
23300
|
* @category constants
|
|
23199
23301
|
* @since 4.0.0
|
|
23200
23302
|
*/
|
|
23201
|
-
const zero = /*#__PURE__*/ make$
|
|
23303
|
+
const zero = /*#__PURE__*/ make$58(bigint0);
|
|
23202
23304
|
const invalid$2 = (message) => {
|
|
23203
23305
|
throw new Error(`Invalid ByteSize: ${message}`);
|
|
23204
23306
|
};
|
|
23205
23307
|
const fromNumber = (input) => {
|
|
23206
23308
|
if (!Number.isSafeInteger(input) || input < 0) return invalid$2(`expected a non-negative safe integer, received ${input}`);
|
|
23207
|
-
return make$
|
|
23309
|
+
return make$58(BigInt(input));
|
|
23208
23310
|
};
|
|
23209
23311
|
const maxSafeInteger = /*#__PURE__*/ BigInt(Number.MAX_SAFE_INTEGER);
|
|
23210
23312
|
const scaleDecimal = (quantity, factor) => {
|
|
@@ -23220,14 +23322,14 @@ const scaleDecimal = (quantity, factor) => {
|
|
|
23220
23322
|
const fromQuantity = (quantity, unit) => {
|
|
23221
23323
|
if (typeof quantity === "bigint") {
|
|
23222
23324
|
if (quantity < bigint0) return invalid$2(`expected a non-negative quantity, received ${quantity}`);
|
|
23223
|
-
return make$
|
|
23325
|
+
return make$58(quantity * unit.factor);
|
|
23224
23326
|
}
|
|
23225
23327
|
if (binaryUnits.includes(unit)) {
|
|
23226
23328
|
const value = quantity * Number(unit.factor);
|
|
23227
|
-
if (Number.isSafeInteger(value) && value >= 0) return make$
|
|
23329
|
+
if (Number.isSafeInteger(value) && value >= 0) return make$58(BigInt(value));
|
|
23228
23330
|
} else {
|
|
23229
23331
|
const value = scaleDecimal(String(quantity), unit.factor);
|
|
23230
|
-
if (value !== void 0 && value <= maxSafeInteger) return make$
|
|
23332
|
+
if (value !== void 0 && value <= maxSafeInteger) return make$58(value);
|
|
23231
23333
|
}
|
|
23232
23334
|
return invalid$2(`expected an exact non-negative safe-integer byte result, received ${quantity} ${unit.symbol}`);
|
|
23233
23335
|
};
|
|
@@ -23253,7 +23355,7 @@ const fromStringUnsafe = (input) => {
|
|
|
23253
23355
|
if (unit === void 0) return invalid$2(`unsupported unit ${JSON.stringify(match[2])}`);
|
|
23254
23356
|
const value = scaleDecimal(match[1], unit.factor);
|
|
23255
23357
|
if (value === void 0) return invalid$2(`${JSON.stringify(input)} does not represent an integral number of bytes`);
|
|
23256
|
-
return make$
|
|
23358
|
+
return make$58(value);
|
|
23257
23359
|
};
|
|
23258
23360
|
/**
|
|
23259
23361
|
* Decodes a trusted input into a byte size and throws for invalid input.
|
|
@@ -23266,7 +23368,7 @@ const fromInputUnsafe = (input) => {
|
|
|
23266
23368
|
switch (typeof input) {
|
|
23267
23369
|
case "bigint":
|
|
23268
23370
|
if (input < bigint0) return invalid$2(`expected a non-negative bigint, received ${input}`);
|
|
23269
|
-
return make$
|
|
23371
|
+
return make$58(input);
|
|
23270
23372
|
case "number": return fromNumber(input);
|
|
23271
23373
|
case "string": return fromStringUnsafe(input);
|
|
23272
23374
|
}
|
|
@@ -23326,14 +23428,14 @@ const emptyArray = [];
|
|
|
23326
23428
|
* @category instances
|
|
23327
23429
|
* @since 4.0.0
|
|
23328
23430
|
*/
|
|
23329
|
-
const makeEquivalence = (isEquivalent) => make$
|
|
23431
|
+
const makeEquivalence$1 = (isEquivalent) => make$71((self, that) => {
|
|
23330
23432
|
if (self.length !== that.length) return false;
|
|
23331
23433
|
const as = toReadonlyArray(self);
|
|
23332
23434
|
const bs = toReadonlyArray(that);
|
|
23333
23435
|
for (let i = 0; i < as.length; i++) if (!isEquivalent(as[i], bs[i])) return false;
|
|
23334
23436
|
return true;
|
|
23335
23437
|
});
|
|
23336
|
-
const _equivalence = /*#__PURE__*/ makeEquivalence(equals$1);
|
|
23438
|
+
const _equivalence = /*#__PURE__*/ makeEquivalence$1(equals$1);
|
|
23337
23439
|
const ChunkProto = {
|
|
23338
23440
|
[TypeId$51]: { _A: (_) => _ },
|
|
23339
23441
|
toString() {
|
|
@@ -24500,7 +24602,7 @@ const redactedProto = (typeId, label) => ({
|
|
|
24500
24602
|
* Builds a key. Keys compare by reference: comparing key bytes is not constant
|
|
24501
24603
|
* time, and structural equality would let secret keys act as `HashMap` keys.
|
|
24502
24604
|
*/
|
|
24503
|
-
const make$
|
|
24605
|
+
const make$57 = (proto, algorithm, material) => byReferenceUnsafe(Object.create(proto, {
|
|
24504
24606
|
algorithm: {
|
|
24505
24607
|
value: algorithm,
|
|
24506
24608
|
enumerable: true
|
|
@@ -24508,7 +24610,7 @@ const make$56 = (proto, algorithm, material) => byReferenceUnsafe(Object.create(
|
|
|
24508
24610
|
[MaterialId]: { value: material }
|
|
24509
24611
|
}));
|
|
24510
24612
|
/** @internal */
|
|
24511
|
-
const makeBytes = (proto, algorithm, bytes) => make$
|
|
24613
|
+
const makeBytes = (proto, algorithm, bytes) => make$57(proto, algorithm, {
|
|
24512
24614
|
_tag: "Bytes",
|
|
24513
24615
|
bytes
|
|
24514
24616
|
});
|
|
@@ -24571,7 +24673,7 @@ const importedAlgorithm = (algorithm, cryptoKey) => {
|
|
|
24571
24673
|
*/
|
|
24572
24674
|
const fromCryptoKey$3 = (module, method, proto, algorithm, cryptoKey, expected) => suspend$2(() => {
|
|
24573
24675
|
const problem = checkCryptoKey(cryptoKey, expected);
|
|
24574
|
-
return problem === void 0 ? succeed$5(make$
|
|
24676
|
+
return problem === void 0 ? succeed$5(make$57(proto, importedAlgorithm(algorithm, cryptoKey), {
|
|
24575
24677
|
_tag: "CryptoKey",
|
|
24576
24678
|
cryptoKey
|
|
24577
24679
|
})) : invalidKey(module, method, problem);
|
|
@@ -26609,7 +26711,7 @@ const makeZonedUnsafe = makeZonedUnsafe$1;
|
|
|
26609
26711
|
* @category constructors
|
|
26610
26712
|
* @since 3.6.0
|
|
26611
26713
|
*/
|
|
26612
|
-
const make$
|
|
26714
|
+
const make$56 = make$64;
|
|
26613
26715
|
/**
|
|
26614
26716
|
* Gets the milliseconds since the Unix epoch of a `DateTime`.
|
|
26615
26717
|
*
|
|
@@ -27120,7 +27222,7 @@ var HashMapImpl = class {
|
|
|
27120
27222
|
const thatImpl = that;
|
|
27121
27223
|
if (this.size !== thatImpl.size) return false;
|
|
27122
27224
|
for (const [key, value] of this) {
|
|
27123
|
-
const otherValue = pipe(that, get$
|
|
27225
|
+
const otherValue = pipe(that, get$9(key));
|
|
27124
27226
|
if (isNone(otherValue) || !equals$1(value, otherValue.value)) return false;
|
|
27125
27227
|
}
|
|
27126
27228
|
return true;
|
|
@@ -27166,7 +27268,7 @@ const fromIterable$5 = (entries) => {
|
|
|
27166
27268
|
return new HashMapImpl(false, 0, root, size);
|
|
27167
27269
|
};
|
|
27168
27270
|
/** @internal */
|
|
27169
|
-
const get$
|
|
27271
|
+
const get$9 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
27170
27272
|
return self._root.get(0, hash(key), key);
|
|
27171
27273
|
});
|
|
27172
27274
|
/** @internal */
|
|
@@ -27187,7 +27289,7 @@ const setHash$1 = (self, key, hash, value) => {
|
|
|
27187
27289
|
return new HashMapImpl(false, impl._edit, newRoot, impl._size + (added.value ? 1 : 0));
|
|
27188
27290
|
};
|
|
27189
27291
|
/** @internal */
|
|
27190
|
-
const set$
|
|
27292
|
+
const set$3 = /*#__PURE__*/ dual(3, (self, key, value) => {
|
|
27191
27293
|
return setHash$1(self, key, hash(key), value);
|
|
27192
27294
|
});
|
|
27193
27295
|
/** @internal */
|
|
@@ -27269,7 +27371,7 @@ const fromIterable$4 = fromIterable$5;
|
|
|
27269
27371
|
* @category getters
|
|
27270
27372
|
* @since 2.0.0
|
|
27271
27373
|
*/
|
|
27272
|
-
const get$
|
|
27374
|
+
const get$8 = get$9;
|
|
27273
27375
|
/**
|
|
27274
27376
|
* Returns an `IterableIterator` of the values within the `HashMap`.
|
|
27275
27377
|
*
|
|
@@ -27333,7 +27435,7 @@ const keyMap = (self) => self.keyMap;
|
|
|
27333
27435
|
/** @internal */
|
|
27334
27436
|
const fromIterable$3 = (values) => {
|
|
27335
27437
|
let map = empty$9();
|
|
27336
|
-
for (const value of values) map = set$
|
|
27438
|
+
for (const value of values) map = set$3(map, value, true);
|
|
27337
27439
|
return makeImpl(map);
|
|
27338
27440
|
};
|
|
27339
27441
|
/** @internal */
|
|
@@ -27858,7 +27960,7 @@ const isRedacted = (u) => hasProperty(u, TypeId$45);
|
|
|
27858
27960
|
* @category constructors
|
|
27859
27961
|
* @since 3.3.0
|
|
27860
27962
|
*/
|
|
27861
|
-
const make$
|
|
27963
|
+
const make$55 = (value, options) => {
|
|
27862
27964
|
const self = Object.create(Proto$17);
|
|
27863
27965
|
if (options?.label) self.label = options.label;
|
|
27864
27966
|
redactedRegistry.set(self, value);
|
|
@@ -27904,6 +28006,36 @@ const Proto$17 = {
|
|
|
27904
28006
|
* @since 3.3.0
|
|
27905
28007
|
*/
|
|
27906
28008
|
const value = value$1;
|
|
28009
|
+
/**
|
|
28010
|
+
* Generates an equivalence relation for `Redacted<A>` values based on an
|
|
28011
|
+
* equivalence relation for the underlying values `A`. This function is useful
|
|
28012
|
+
* for comparing `Redacted` instances without exposing their contents.
|
|
28013
|
+
*
|
|
28014
|
+
* **When to use**
|
|
28015
|
+
*
|
|
28016
|
+
* Use when you need to compare wrapped secrets through an approved equality
|
|
28017
|
+
* rule without exposing the underlying values at each comparison site.
|
|
28018
|
+
*
|
|
28019
|
+
* **Example** (Comparing redacted values)
|
|
28020
|
+
*
|
|
28021
|
+
* ```ts import.meta.vitest
|
|
28022
|
+
* import { Equivalence, Redacted } from "effect"
|
|
28023
|
+
*
|
|
28024
|
+
* const API_KEY1 = Redacted.make("1234567890")
|
|
28025
|
+
* const API_KEY2 = Redacted.make("1-34567890")
|
|
28026
|
+
* const API_KEY3 = Redacted.make("1234567890")
|
|
28027
|
+
*
|
|
28028
|
+
* const equivalence = Redacted.makeEquivalence(Equivalence.strictEqual<string>())
|
|
28029
|
+
*
|
|
28030
|
+
* equivalence(API_KEY1, API_KEY2) // => false
|
|
28031
|
+
* equivalence(API_KEY1, API_KEY3) // => true
|
|
28032
|
+
* ```
|
|
28033
|
+
*
|
|
28034
|
+
* @stability stable
|
|
28035
|
+
* @category instances
|
|
28036
|
+
* @since 4.0.0
|
|
28037
|
+
*/
|
|
28038
|
+
const makeEquivalence = (isEquivalent) => make$71((x, y) => isEquivalent(value(x), value(y)));
|
|
27907
28039
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/Headers.js
|
|
27908
28040
|
/**
|
|
27909
28041
|
* Models HTTP headers for the unstable HTTP client and server modules.
|
|
@@ -27932,7 +28064,7 @@ const TypeId$44 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
|
|
|
27932
28064
|
const Proto$16 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
|
|
27933
28065
|
[TypeId$44]: { value: TypeId$44 },
|
|
27934
28066
|
[symbolRedactable]: { value(context) {
|
|
27935
|
-
return redact$1(this, get$
|
|
28067
|
+
return redact$1(this, get$11(context, CurrentRedactedNames$1));
|
|
27936
28068
|
} },
|
|
27937
28069
|
toJSON: { value() {
|
|
27938
28070
|
return redact$2(this);
|
|
@@ -27946,7 +28078,7 @@ const Proto$16 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.crea
|
|
|
27946
28078
|
toString: { value: BaseProto.toString },
|
|
27947
28079
|
[NodeInspectSymbol]: { value: BaseProto[NodeInspectSymbol] }
|
|
27948
28080
|
});
|
|
27949
|
-
const make$
|
|
28081
|
+
const make$54 = (input) => Object.assign(Object.create(Proto$16), input);
|
|
27950
28082
|
/**
|
|
27951
28083
|
* Provides an `Equivalence` instance that compares `Headers` by header names
|
|
27952
28084
|
* and string values.
|
|
@@ -27955,7 +28087,7 @@ const make$53 = (input) => Object.assign(Object.create(Proto$16), input);
|
|
|
27955
28087
|
* @category instances
|
|
27956
28088
|
* @since 4.0.0
|
|
27957
28089
|
*/
|
|
27958
|
-
const Equivalence$2 = /*#__PURE__*/ makeEquivalence$
|
|
28090
|
+
const Equivalence$2 = /*#__PURE__*/ makeEquivalence$3(/*#__PURE__*/ strictEqual());
|
|
27959
28091
|
/**
|
|
27960
28092
|
* An empty `Headers` collection.
|
|
27961
28093
|
*
|
|
@@ -28010,7 +28142,7 @@ const fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto$16);
|
|
|
28010
28142
|
* @category combinators
|
|
28011
28143
|
* @since 4.0.0
|
|
28012
28144
|
*/
|
|
28013
|
-
const get$
|
|
28145
|
+
const get$7 = /*#__PURE__*/ dual(2, (self, key) => fromUndefinedOr(self[key.toLowerCase()]));
|
|
28014
28146
|
/**
|
|
28015
28147
|
* Returns a new `Headers` collection with the given header set.
|
|
28016
28148
|
*
|
|
@@ -28022,8 +28154,8 @@ const get$6 = /*#__PURE__*/ dual(2, (self, key) => fromUndefinedOr(self[key.toLo
|
|
|
28022
28154
|
* @category combinators
|
|
28023
28155
|
* @since 4.0.0
|
|
28024
28156
|
*/
|
|
28025
|
-
const set$
|
|
28026
|
-
const out = make$
|
|
28157
|
+
const set$2 = /*#__PURE__*/ dual(3, (self, key, value) => {
|
|
28158
|
+
const out = make$54(self);
|
|
28027
28159
|
out[key.toLowerCase()] = value;
|
|
28028
28160
|
return out;
|
|
28029
28161
|
});
|
|
@@ -28038,7 +28170,7 @@ const set$1 = /*#__PURE__*/ dual(3, (self, key, value) => {
|
|
|
28038
28170
|
* @category combinators
|
|
28039
28171
|
* @since 4.0.0
|
|
28040
28172
|
*/
|
|
28041
|
-
const setAll$1 = /*#__PURE__*/ dual(2, (self, headers) => make$
|
|
28173
|
+
const setAll$1 = /*#__PURE__*/ dual(2, (self, headers) => make$54({
|
|
28042
28174
|
...self,
|
|
28043
28175
|
...fromInput$1(headers)
|
|
28044
28176
|
}));
|
|
@@ -28054,7 +28186,7 @@ const setAll$1 = /*#__PURE__*/ dual(2, (self, headers) => make$53({
|
|
|
28054
28186
|
* @since 4.0.0
|
|
28055
28187
|
*/
|
|
28056
28188
|
const merge$3 = /*#__PURE__*/ dual(2, (self, headers) => {
|
|
28057
|
-
const out = make$
|
|
28189
|
+
const out = make$54(self);
|
|
28058
28190
|
Object.assign(out, headers);
|
|
28059
28191
|
return out;
|
|
28060
28192
|
});
|
|
@@ -28070,7 +28202,7 @@ const merge$3 = /*#__PURE__*/ dual(2, (self, headers) => {
|
|
|
28070
28202
|
* @since 4.0.0
|
|
28071
28203
|
*/
|
|
28072
28204
|
const remove$2 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
28073
|
-
const out = make$
|
|
28205
|
+
const out = make$54(self);
|
|
28074
28206
|
delete out[key.toLowerCase()];
|
|
28075
28207
|
return out;
|
|
28076
28208
|
});
|
|
@@ -28090,8 +28222,8 @@ const redact$1 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
|
28090
28222
|
const modify = (key) => {
|
|
28091
28223
|
if (typeof key === "string") {
|
|
28092
28224
|
const k = key.toLowerCase();
|
|
28093
|
-
if (k in self) out[k] = make$
|
|
28094
|
-
} else for (const name in self) if (name.search(key) !== -1) out[name] = make$
|
|
28225
|
+
if (k in self) out[k] = make$55(self[k]);
|
|
28226
|
+
} else for (const name in self) if (name.search(key) !== -1) out[name] = make$55(self[name]);
|
|
28095
28227
|
};
|
|
28096
28228
|
if (Array.isArray(key)) for (let i = 0; i < key.length; i++) modify(key[i]);
|
|
28097
28229
|
else modify(key);
|
|
@@ -28367,7 +28499,7 @@ const Proto$15 = {
|
|
|
28367
28499
|
[symbolRedactable](context) {
|
|
28368
28500
|
return {
|
|
28369
28501
|
_id: "UrlParams",
|
|
28370
|
-
params: Object.fromEntries(redact(this, get$
|
|
28502
|
+
params: Object.fromEntries(redact(this, get$11(context, CurrentRedactedNames)))
|
|
28371
28503
|
};
|
|
28372
28504
|
},
|
|
28373
28505
|
toJSON() {
|
|
@@ -28391,7 +28523,7 @@ const Proto$15 = {
|
|
|
28391
28523
|
* @category constructors
|
|
28392
28524
|
* @since 4.0.0
|
|
28393
28525
|
*/
|
|
28394
|
-
const make$
|
|
28526
|
+
const make$53 = (params) => {
|
|
28395
28527
|
const self = Object.create(Proto$15);
|
|
28396
28528
|
self.params = params;
|
|
28397
28529
|
return self;
|
|
@@ -28417,7 +28549,7 @@ const fromInput = (input) => {
|
|
|
28417
28549
|
const [keys, value] = parsed[i];
|
|
28418
28550
|
out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
|
|
28419
28551
|
} else out.push(parsed[i]);
|
|
28420
|
-
return make$
|
|
28552
|
+
return make$53(out);
|
|
28421
28553
|
};
|
|
28422
28554
|
const fromInputNested = (input) => {
|
|
28423
28555
|
const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$6(input) : Object.entries(input);
|
|
@@ -28443,8 +28575,8 @@ const coerce = (value) => isRedacted(value) ? value : String(value);
|
|
|
28443
28575
|
* @category instances
|
|
28444
28576
|
* @since 4.0.0
|
|
28445
28577
|
*/
|
|
28446
|
-
const Equivalence$1 = /*#__PURE__*/ make$
|
|
28447
|
-
const arrayEquivalence = /*#__PURE__*/ makeEquivalence$
|
|
28578
|
+
const Equivalence$1 = /*#__PURE__*/ make$71((a, b) => arrayEquivalence(a.params, b.params));
|
|
28579
|
+
const arrayEquivalence = /*#__PURE__*/ makeEquivalence$2(/*#__PURE__*/ makeEquivalence$4([/*#__PURE__*/ strictEqual(), /*#__PURE__*/ asEquivalence()]));
|
|
28448
28580
|
/**
|
|
28449
28581
|
* An empty `UrlParams` value.
|
|
28450
28582
|
*
|
|
@@ -28452,7 +28584,7 @@ const arrayEquivalence = /*#__PURE__*/ makeEquivalence$1(/*#__PURE__*/ makeEquiv
|
|
|
28452
28584
|
* @category constructors
|
|
28453
28585
|
* @since 4.0.0
|
|
28454
28586
|
*/
|
|
28455
|
-
const empty$6 = /*#__PURE__*/ make$
|
|
28587
|
+
const empty$6 = /*#__PURE__*/ make$53([]);
|
|
28456
28588
|
/**
|
|
28457
28589
|
* Sets multiple query parameters from input.
|
|
28458
28590
|
*
|
|
@@ -28473,7 +28605,7 @@ const setAll = /*#__PURE__*/ dual(2, (self, input) => {
|
|
|
28473
28605
|
if (keys.has(self.params[i][0])) continue;
|
|
28474
28606
|
params.push(self.params[i]);
|
|
28475
28607
|
}
|
|
28476
|
-
return make$
|
|
28608
|
+
return make$53(params);
|
|
28477
28609
|
});
|
|
28478
28610
|
/**
|
|
28479
28611
|
* Returns the parameter pairs with selected values wrapped in `Redacted`.
|
|
@@ -28489,7 +28621,7 @@ const setAll = /*#__PURE__*/ dual(2, (self, input) => {
|
|
|
28489
28621
|
*/
|
|
28490
28622
|
const redact = /*#__PURE__*/ dual(2, (self, key) => {
|
|
28491
28623
|
const patterns = Array.isArray(key) ? key : [key];
|
|
28492
|
-
return self.params.map(([name, value]) => [name, typeof value === "string" && isRedactedName(name, patterns) ? make$
|
|
28624
|
+
return self.params.map(([name, value]) => [name, typeof value === "string" && isRedactedName(name, patterns) ? make$55(value) : value]);
|
|
28493
28625
|
});
|
|
28494
28626
|
/**
|
|
28495
28627
|
* Checks whether a parameter name matches one of the redaction patterns.
|
|
@@ -28568,7 +28700,7 @@ const decodeQueryKey = (key) => {
|
|
|
28568
28700
|
return key;
|
|
28569
28701
|
}
|
|
28570
28702
|
};
|
|
28571
|
-
const currentRedactedNames = () => get$
|
|
28703
|
+
const currentRedactedNames = () => get$11(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$14(), CurrentRedactedNames);
|
|
28572
28704
|
/**
|
|
28573
28705
|
* Query parameter names or patterns to redact in inspection, spans and errors.
|
|
28574
28706
|
*
|
|
@@ -28878,6 +29010,24 @@ function makeCompositeAtKey(compositeAst, pointerKey, pointerIssue, compositeInp
|
|
|
28878
29010
|
return new Composite(compositeAst, [new Pointer([pointerKey], pointerIssue)], compositeInput, parseOptions);
|
|
28879
29011
|
}
|
|
28880
29012
|
/**
|
|
29013
|
+
* Constructs a schema issue for a forbidden parsing operation.
|
|
29014
|
+
*
|
|
29015
|
+
* @stability stable
|
|
29016
|
+
* @category constructors
|
|
29017
|
+
* @since 4.0.0
|
|
29018
|
+
*/
|
|
29019
|
+
const Forbidden = class extends IssueNodeImpl {
|
|
29020
|
+
_tag = "Forbidden";
|
|
29021
|
+
/**
|
|
29022
|
+
* The metadata for the issue.
|
|
29023
|
+
*/
|
|
29024
|
+
annotations;
|
|
29025
|
+
constructor(annotations, input, options) {
|
|
29026
|
+
super(input, options);
|
|
29027
|
+
this.annotations = annotations;
|
|
29028
|
+
}
|
|
29029
|
+
};
|
|
29030
|
+
/**
|
|
28881
29031
|
* Constructs a schema issue for a value that matches no union member.
|
|
28882
29032
|
*
|
|
28883
29033
|
* @stability stable
|
|
@@ -29185,7 +29335,7 @@ const compose = /*#__PURE__*/ dual(2, (self, other) => {
|
|
|
29185
29335
|
if (other._tag === "Passthrough") return self;
|
|
29186
29336
|
switch (self._tag) {
|
|
29187
29337
|
case "Transform": switch (other._tag) {
|
|
29188
|
-
case "Transform": return transform$
|
|
29338
|
+
case "Transform": return transform$3((input) => other.transform(self.transform(input)));
|
|
29189
29339
|
case "TransformOptional": return transformOptional((input) => other.transform(map$12(input, self.transform)));
|
|
29190
29340
|
case "TransformEffect": return transformEffect$1((input, options) => other.transform(self.transform(input), options));
|
|
29191
29341
|
case "TransformOptionalEffect": return composeOptionalEffect(self, other);
|
|
@@ -29205,6 +29355,84 @@ const compose = /*#__PURE__*/ dual(2, (self, other) => {
|
|
|
29205
29355
|
case "TransformOptionalEffect": return composeOptionalEffect(self, other);
|
|
29206
29356
|
}
|
|
29207
29357
|
});
|
|
29358
|
+
/**
|
|
29359
|
+
* Creates a getter that always fails with the given issue.
|
|
29360
|
+
*
|
|
29361
|
+
* **When to use**
|
|
29362
|
+
*
|
|
29363
|
+
* Use when you need a schema getter that unconditionally rejects input.
|
|
29364
|
+
* - Building custom validation getters that produce specific error types.
|
|
29365
|
+
*
|
|
29366
|
+
* **Details**
|
|
29367
|
+
*
|
|
29368
|
+
* - Always fails with the `Issue` returned by `f`.
|
|
29369
|
+
* - The failure function receives the original `Option<E>` input and the
|
|
29370
|
+
* effective `ParseOptions` for error context.
|
|
29371
|
+
*
|
|
29372
|
+
* **Example** (Defining an always-failing getter)
|
|
29373
|
+
*
|
|
29374
|
+
* ```ts import.meta.vitest
|
|
29375
|
+
* import { Effect, Option, SchemaGetter, SchemaIssue } from "effect"
|
|
29376
|
+
*
|
|
29377
|
+
* const rejectAll = SchemaGetter.fail<string, string>(
|
|
29378
|
+
* () => new SchemaIssue.InvalidValue({ message: "not allowed" })
|
|
29379
|
+
* )
|
|
29380
|
+
* const issue = await Effect.runPromise(
|
|
29381
|
+
* Effect.flip(SchemaGetter.run(rejectAll, Option.some("x"), {}))
|
|
29382
|
+
* )
|
|
29383
|
+
* issue._tag // => "InvalidValue"
|
|
29384
|
+
* ```
|
|
29385
|
+
*
|
|
29386
|
+
* @see {@link forbidden} for a convenience helper for `Forbidden` issues
|
|
29387
|
+
* @see {@link checkEffect} to fail conditionally based on input value
|
|
29388
|
+
*
|
|
29389
|
+
* @stability stable
|
|
29390
|
+
* @category constructors
|
|
29391
|
+
* @since 4.0.0
|
|
29392
|
+
*/
|
|
29393
|
+
function fail$2(f) {
|
|
29394
|
+
return transformOptionalEffect((oe, options) => fail$6(f(oe, options)));
|
|
29395
|
+
}
|
|
29396
|
+
/**
|
|
29397
|
+
* Creates a getter that always fails with a `Forbidden` issue.
|
|
29398
|
+
*
|
|
29399
|
+
* **When to use**
|
|
29400
|
+
*
|
|
29401
|
+
* Use when you need a schema getter to disallow a field or direction
|
|
29402
|
+
* (encode/decode) entirely.
|
|
29403
|
+
* - You want a clear "forbidden" error message in schema validation output.
|
|
29404
|
+
*
|
|
29405
|
+
* **Details**
|
|
29406
|
+
*
|
|
29407
|
+
* - Always fails with `SchemaIssue.Forbidden`.
|
|
29408
|
+
* - The message function receives the `Option<E>` input for context.
|
|
29409
|
+
*
|
|
29410
|
+
* **Example** (Forbidding a decode direction)
|
|
29411
|
+
*
|
|
29412
|
+
* ```ts import.meta.vitest
|
|
29413
|
+
* import { Effect, Option, SchemaGetter } from "effect"
|
|
29414
|
+
*
|
|
29415
|
+
* const noEncode = SchemaGetter.forbidden<string, number>(
|
|
29416
|
+
* () => "encoding is not supported"
|
|
29417
|
+
* )
|
|
29418
|
+
* const issue = await Effect.runPromise(
|
|
29419
|
+
* Effect.flip(SchemaGetter.run(noEncode, Option.some(1), {}))
|
|
29420
|
+
* )
|
|
29421
|
+
* issue._tag // => "Forbidden"
|
|
29422
|
+
* ```
|
|
29423
|
+
*
|
|
29424
|
+
* @see {@link fail} to fail with a custom issue type
|
|
29425
|
+
*
|
|
29426
|
+
* @stability stable
|
|
29427
|
+
* @category constructors
|
|
29428
|
+
* @since 4.0.0
|
|
29429
|
+
*/
|
|
29430
|
+
function forbidden(message) {
|
|
29431
|
+
return fail$2((oe, options) => {
|
|
29432
|
+
const annotations = { message: message(oe) };
|
|
29433
|
+
return isSome(oe) ? new Forbidden(annotations, oe.value, options) : new Forbidden(annotations);
|
|
29434
|
+
});
|
|
29435
|
+
}
|
|
29208
29436
|
const passthrough_$1 = /*#__PURE__*/ makeGetter({ _tag: "Passthrough" });
|
|
29209
29437
|
function passthrough$1() {
|
|
29210
29438
|
return passthrough_$1;
|
|
@@ -29247,7 +29475,7 @@ function passthrough$1() {
|
|
|
29247
29475
|
* @category transforming
|
|
29248
29476
|
* @since 4.0.0
|
|
29249
29477
|
*/
|
|
29250
|
-
function transform$
|
|
29478
|
+
function transform$3(f) {
|
|
29251
29479
|
return makeGetter({
|
|
29252
29480
|
_tag: "Transform",
|
|
29253
29481
|
transform: f
|
|
@@ -29374,7 +29602,7 @@ function transformOptionalEffect(f) {
|
|
|
29374
29602
|
* @since 4.0.0
|
|
29375
29603
|
*/
|
|
29376
29604
|
function String$8() {
|
|
29377
|
-
return transform$
|
|
29605
|
+
return transform$3(globalThis.String);
|
|
29378
29606
|
}
|
|
29379
29607
|
/**
|
|
29380
29608
|
* Coerces any value to a `number` using the global `Number()` constructor.
|
|
@@ -29405,7 +29633,7 @@ function String$8() {
|
|
|
29405
29633
|
* @since 4.0.0
|
|
29406
29634
|
*/
|
|
29407
29635
|
function Number$4() {
|
|
29408
|
-
return transform$
|
|
29636
|
+
return transform$3(globalThis.Number);
|
|
29409
29637
|
}
|
|
29410
29638
|
function parseJson(options) {
|
|
29411
29639
|
return transformEffect$1((input, parseOptions) => try_({
|
|
@@ -29495,7 +29723,7 @@ function splitKeyValue$1(options) {
|
|
|
29495
29723
|
const keyValueSeparator = options?.keyValueSeparator ?? "=";
|
|
29496
29724
|
const trim = options?.trim ?? false;
|
|
29497
29725
|
const keepEmptyValues = options?.keepEmptyValues ?? false;
|
|
29498
|
-
return transform$
|
|
29726
|
+
return transform$3((input) => input.split(separator).reduce((acc, pair) => {
|
|
29499
29727
|
let key;
|
|
29500
29728
|
let value;
|
|
29501
29729
|
if (keyValueSeparator === "") {
|
|
@@ -29549,7 +29777,7 @@ function splitKeyValue$1(options) {
|
|
|
29549
29777
|
function joinKeyValue(options) {
|
|
29550
29778
|
const separator = options?.separator ?? ",";
|
|
29551
29779
|
const keyValueSeparator = options?.keyValueSeparator ?? "=";
|
|
29552
|
-
return transform$
|
|
29780
|
+
return transform$3((input) => Object.entries(input).map(([key, value]) => `${key}${keyValueSeparator}${value}`).join(separator));
|
|
29553
29781
|
}
|
|
29554
29782
|
/**
|
|
29555
29783
|
* Splits a string into an array of strings by a separator.
|
|
@@ -29582,7 +29810,7 @@ function joinKeyValue(options) {
|
|
|
29582
29810
|
*/
|
|
29583
29811
|
function split(options) {
|
|
29584
29812
|
const separator = options?.separator ?? ",";
|
|
29585
|
-
return transform$
|
|
29813
|
+
return transform$3((input) => input === "" ? [] : input.split(separator));
|
|
29586
29814
|
}
|
|
29587
29815
|
/**
|
|
29588
29816
|
* Encodes a `Uint8Array` or string to a Base64 string.
|
|
@@ -29610,7 +29838,7 @@ function split(options) {
|
|
|
29610
29838
|
* @since 4.0.0
|
|
29611
29839
|
*/
|
|
29612
29840
|
function encodeBase64() {
|
|
29613
|
-
return transform$
|
|
29841
|
+
return transform$3(encode);
|
|
29614
29842
|
}
|
|
29615
29843
|
/**
|
|
29616
29844
|
* Decodes a Base64 string to a `Uint8Array`.
|
|
@@ -29665,7 +29893,7 @@ function decodeBase64$1() {
|
|
|
29665
29893
|
* @since 4.0.0
|
|
29666
29894
|
*/
|
|
29667
29895
|
function encodeUriComponent() {
|
|
29668
|
-
return transform$
|
|
29896
|
+
return transform$3(encodeURIComponent);
|
|
29669
29897
|
}
|
|
29670
29898
|
/**
|
|
29671
29899
|
* Decodes a URI component encoded string using `decodeURIComponent`.
|
|
@@ -29906,8 +30134,8 @@ function transformEffect(options) {
|
|
|
29906
30134
|
* @category transforming
|
|
29907
30135
|
* @since 3.10.0
|
|
29908
30136
|
*/
|
|
29909
|
-
function transform$
|
|
29910
|
-
return new Transformation(transform$
|
|
30137
|
+
function transform$2(options) {
|
|
30138
|
+
return new Transformation(transform$3(options.decode), transform$3(options.encode));
|
|
29911
30139
|
}
|
|
29912
30140
|
/**
|
|
29913
30141
|
* Transforms a string into a record of key-value pairs and
|
|
@@ -30031,7 +30259,7 @@ const makeEncodeDefect = (options) => {
|
|
|
30031
30259
|
};
|
|
30032
30260
|
const decodeDefect = (input) => isJsonError(input) ? decodeJsonError(input) : input;
|
|
30033
30261
|
/** @internal */
|
|
30034
|
-
const defectFromJson = (options) => transform$
|
|
30262
|
+
const defectFromJson = (options) => transform$2({
|
|
30035
30263
|
decode: decodeDefect,
|
|
30036
30264
|
encode: makeEncodeDefect(options)
|
|
30037
30265
|
});
|
|
@@ -30396,7 +30624,7 @@ const Undefined$1 = class extends ASTNodeImpl {
|
|
|
30396
30624
|
return "undefined";
|
|
30397
30625
|
}
|
|
30398
30626
|
};
|
|
30399
|
-
const undefinedToNull = /*#__PURE__*/ new Link(null_, /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
30627
|
+
const undefinedToNull = /*#__PURE__*/ new Link(null_, /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$3(() => void 0), /*#__PURE__*/ transform$3(() => null)));
|
|
30400
30628
|
const undefined_ = /*#__PURE__*/ new Undefined$1();
|
|
30401
30629
|
/**
|
|
30402
30630
|
* Constructs a {@link Void}.
|
|
@@ -30634,7 +30862,7 @@ function templateLiteralTransformation(template) {
|
|
|
30634
30862
|
const segments = segmentTemplateLiteralParts(template, s, options);
|
|
30635
30863
|
if (segments) return succeed$5(segments);
|
|
30636
30864
|
return fail$6(new InvalidValue$1({ expected: "a string matching template literal parts" }, s, options));
|
|
30637
|
-
}), transform$
|
|
30865
|
+
}), transform$3((parts) => parts.join("")));
|
|
30638
30866
|
}
|
|
30639
30867
|
/**
|
|
30640
30868
|
* Constructs a {@link Literal}.
|
|
@@ -30674,7 +30902,7 @@ const Literal$1 = class extends ASTNodeImpl {
|
|
|
30674
30902
|
};
|
|
30675
30903
|
function literalToString(ast) {
|
|
30676
30904
|
const literalAsString = globalThis.String(ast.literal);
|
|
30677
|
-
return replaceEncoding(ast, [new Link(new Literal$1(literalAsString), new Transformation(transform$
|
|
30905
|
+
return replaceEncoding(ast, [new Link(new Literal$1(literalAsString), new Transformation(transform$3(() => ast.literal), transform$3(() => literalAsString)))]);
|
|
30678
30906
|
}
|
|
30679
30907
|
/**
|
|
30680
30908
|
* Constructs a {@link String}.
|
|
@@ -31741,7 +31969,7 @@ function isFinite$1(annotations) {
|
|
|
31741
31969
|
}
|
|
31742
31970
|
/** @internal */
|
|
31743
31971
|
const finite = /*#__PURE__*/ appendChecks(number, [/*#__PURE__*/ isFinite$1()]);
|
|
31744
|
-
const numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finite, nonFiniteLiterals]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$4(), /*#__PURE__*/ transform$
|
|
31972
|
+
const numberToJson = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([finite, nonFiniteLiterals]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$4(), /*#__PURE__*/ transform$3((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
|
|
31745
31973
|
/**
|
|
31746
31974
|
* Creates a {@link Filter} that validates strings by running `RegExp.test`.
|
|
31747
31975
|
*
|
|
@@ -32048,13 +32276,13 @@ function canPreserveEncodingChecks(ast) {
|
|
|
32048
32276
|
* @category transforming
|
|
32049
32277
|
* @since 4.0.0
|
|
32050
32278
|
*/
|
|
32051
|
-
const toType = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
32279
|
+
const toType$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
32052
32280
|
const owner = getContextOwner(ast);
|
|
32053
32281
|
if (owner !== ast) {
|
|
32054
|
-
const type = toType(owner);
|
|
32282
|
+
const type = toType$1(owner);
|
|
32055
32283
|
return type === owner && ast.encoding === void 0 ? ast : replaceContext(type, ast.context);
|
|
32056
32284
|
}
|
|
32057
|
-
const type = "recur" in ast ? ast.recur(toType) : ast;
|
|
32285
|
+
const type = "recur" in ast ? ast.recur(toType$1) : ast;
|
|
32058
32286
|
if ("encodingChecks" in type && type.encodingChecks) {
|
|
32059
32287
|
const checks = canPreserveEncodingChecks(ast) ? type.encodingChecks : isArrays(type) || isObjects(type) || isDeclaration(type) && type.typeParameters.length > 0 ? extractStructuralChecks(type.encodingChecks) : void 0;
|
|
32060
32288
|
return copy$1(type, {
|
|
@@ -32092,7 +32320,7 @@ const toType = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
|
32092
32320
|
* @since 4.0.0
|
|
32093
32321
|
*/
|
|
32094
32322
|
const toEncoded = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
32095
|
-
return toType(flip(ast));
|
|
32323
|
+
return toType$1(flip(ast));
|
|
32096
32324
|
});
|
|
32097
32325
|
function flipEncoding(ast, encoding) {
|
|
32098
32326
|
const links = encoding;
|
|
@@ -32562,7 +32790,7 @@ function makeEffect(schema) {
|
|
|
32562
32790
|
const ast = schema.ast;
|
|
32563
32791
|
let parser;
|
|
32564
32792
|
return (input, options) => {
|
|
32565
|
-
return (parser ??= runWithCompiler(constructorCompiler, toType(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
|
|
32793
|
+
return (parser ??= runWithCompiler(constructorCompiler, toType$1(ast)))(input, options?.disableChecks ? options?.parseOptions ? {
|
|
32566
32794
|
...options.parseOptions,
|
|
32567
32795
|
disableChecks: true
|
|
32568
32796
|
} : { disableChecks: true } : options?.parseOptions);
|
|
@@ -32622,8 +32850,8 @@ function makeOption(schema) {
|
|
|
32622
32850
|
* @category constructors
|
|
32623
32851
|
* @since 4.0.0
|
|
32624
32852
|
*/
|
|
32625
|
-
function make$
|
|
32626
|
-
return makeConstructorSync(toType(schema.ast));
|
|
32853
|
+
function make$52(schema) {
|
|
32854
|
+
return makeConstructorSync(toType$1(schema.ast));
|
|
32627
32855
|
}
|
|
32628
32856
|
/**
|
|
32629
32857
|
* Creates a type guard that checks whether an input satisfies the schema's decoded
|
|
@@ -32665,7 +32893,7 @@ function makeIs(ast) {
|
|
|
32665
32893
|
}
|
|
32666
32894
|
/** @internal */
|
|
32667
32895
|
function _is(ast) {
|
|
32668
|
-
const typeAST = toType(ast);
|
|
32896
|
+
const typeAST = toType$1(ast);
|
|
32669
32897
|
let guard = (input) => {
|
|
32670
32898
|
guard = makeIs(typeAST);
|
|
32671
32899
|
return guard(input);
|
|
@@ -32816,7 +33044,7 @@ const RebuildOptions = /*#__PURE__*/ Symbol();
|
|
|
32816
33044
|
const SchemaProto = {
|
|
32817
33045
|
[TypeId$39]: TypeId$39,
|
|
32818
33046
|
get make() {
|
|
32819
|
-
const value = make$
|
|
33047
|
+
const value = make$52(this);
|
|
32820
33048
|
Object.defineProperty(this, "make", {
|
|
32821
33049
|
value,
|
|
32822
33050
|
enumerable: true
|
|
@@ -32852,11 +33080,11 @@ const SchemaProto = {
|
|
|
32852
33080
|
return this.rebuild(appendChecks(this.ast, checks));
|
|
32853
33081
|
},
|
|
32854
33082
|
rebuild(ast) {
|
|
32855
|
-
return make$
|
|
33083
|
+
return make$51(ast, this[RebuildOptions]);
|
|
32856
33084
|
}
|
|
32857
33085
|
};
|
|
32858
33086
|
/** @internal */
|
|
32859
|
-
function make$
|
|
33087
|
+
function make$51(ast, options) {
|
|
32860
33088
|
function Schema() {}
|
|
32861
33089
|
const self = Object.setPrototypeOf(Schema, SchemaProto);
|
|
32862
33090
|
if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) Object.defineProperties(self, Object.getOwnPropertyDescriptors({ ...options }));
|
|
@@ -32868,7 +33096,7 @@ function make$50(ast, options) {
|
|
|
32868
33096
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/internal/schema/toCodec.js
|
|
32869
33097
|
/** @internal */
|
|
32870
33098
|
function toCodecJson$1(schema) {
|
|
32871
|
-
return make$
|
|
33099
|
+
return make$51(toCodecJsonAST(schema.ast), { schema });
|
|
32872
33100
|
}
|
|
32873
33101
|
/** @internal */
|
|
32874
33102
|
const toCodecJsonAST = /*#__PURE__*/ makeCodecDerivation(toCodecJsonASTStep);
|
|
@@ -32912,7 +33140,7 @@ function toCodecJsonASTStep(ast, recur) {
|
|
|
32912
33140
|
case "Declaration": {
|
|
32913
33141
|
const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
|
|
32914
33142
|
if (!isFunction(getLink)) return replaceEncoding(ast, [unknownToJson]);
|
|
32915
|
-
const link = getLink(ast.typeParameters.map((tp) => make$
|
|
33143
|
+
const link = getLink(ast.typeParameters.map((tp) => make$51(toEncoded(tp))));
|
|
32916
33144
|
return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, recur)]);
|
|
32917
33145
|
}
|
|
32918
33146
|
case "Unknown": return replaceEncoding(ast, [unknownToJson]);
|
|
@@ -32939,7 +33167,7 @@ function toCodecJsonASTStep(ast, recur) {
|
|
|
32939
33167
|
}
|
|
32940
33168
|
/** @internal */
|
|
32941
33169
|
function toCodecStringTree$1(schema) {
|
|
32942
|
-
return make$
|
|
33170
|
+
return make$51(toCodecStringTreeAST(schema.ast), { schema });
|
|
32943
33171
|
}
|
|
32944
33172
|
const toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
|
|
32945
33173
|
switch (ast._tag) {
|
|
@@ -32955,7 +33183,7 @@ const toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
|
|
|
32955
33183
|
function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
|
|
32956
33184
|
switch (ast._tag) {
|
|
32957
33185
|
case "Declaration": {
|
|
32958
|
-
const typeParameters = ast.typeParameters.map((tp) => make$
|
|
33186
|
+
const typeParameters = ast.typeParameters.map((tp) => make$51(recur(toEncoded(tp))));
|
|
32959
33187
|
const getStringTreeLink = ast.annotations?.toCodecStringTree;
|
|
32960
33188
|
if (isFunction(getStringTreeLink)) {
|
|
32961
33189
|
const link = getStringTreeLink(typeParameters);
|
|
@@ -32991,9 +33219,9 @@ function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
|
|
|
32991
33219
|
}
|
|
32992
33220
|
return ast;
|
|
32993
33221
|
}
|
|
32994
|
-
const nullToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Literal$1("null"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
32995
|
-
const booleanToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Literal$1("true"), /*#__PURE__*/ new Literal$1("false")]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
32996
|
-
const arrayFromSingleTransformation = /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$
|
|
33222
|
+
const nullToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Literal$1("null"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$3(() => null), /*#__PURE__*/ transform$3(() => "null")));
|
|
33223
|
+
const booleanToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Literal$1("true"), /*#__PURE__*/ new Literal$1("false")]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$3((s) => s === "true"), /*#__PURE__*/ String$8()));
|
|
33224
|
+
const arrayFromSingleTransformation = /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$3((input) => typeof input === "string" ? [input] : input), /*#__PURE__*/ passthrough$1());
|
|
32997
33225
|
const isCodecArrayFromSingleLink = (link) => link.transformation === arrayFromSingleTransformation;
|
|
32998
33226
|
const toCodecStringTreeAST = /*#__PURE__*/ makeCodecDerivation((ast, recur) => toCodecStringTreeASTStep(ast, recur, (ast) => {
|
|
32999
33227
|
throw new globalThis.Error("Missing structural codec for StringTree", { cause: ast });
|
|
@@ -33158,7 +33386,7 @@ const concat$2 = (chunks) => {
|
|
|
33158
33386
|
* @category instances
|
|
33159
33387
|
* @since 4.0.6
|
|
33160
33388
|
*/
|
|
33161
|
-
const Order = /*#__PURE__*/ make$
|
|
33389
|
+
const Order = /*#__PURE__*/ make$70((self, that) => {
|
|
33162
33390
|
const length = Math.min(self.length, that.length);
|
|
33163
33391
|
for (let i = 0; i < length; i++) if (self[i] !== that[i]) return self[i] < that[i] ? -1 : 1;
|
|
33164
33392
|
return self.length < that.length ? -1 : self.length > that.length ? 1 : 0;
|
|
@@ -33759,7 +33987,7 @@ const TypeId$36 = TypeId$39;
|
|
|
33759
33987
|
*/
|
|
33760
33988
|
function declareConstructor() {
|
|
33761
33989
|
return (typeParameters, run, annotations) => {
|
|
33762
|
-
return make$
|
|
33990
|
+
return make$50(new Declaration(typeParameters.map(getAST), (typeParameters) => run(typeParameters.map((ast) => make$50(ast))), annotations));
|
|
33763
33991
|
};
|
|
33764
33992
|
}
|
|
33765
33993
|
/**
|
|
@@ -34173,7 +34401,7 @@ const encodeSync = encodeUnknownSync$1;
|
|
|
34173
34401
|
* @category constructors
|
|
34174
34402
|
* @since 3.10.0
|
|
34175
34403
|
*/
|
|
34176
|
-
const make$
|
|
34404
|
+
const make$50 = make$51;
|
|
34177
34405
|
/**
|
|
34178
34406
|
* Checks whether a value is a `Schema`.
|
|
34179
34407
|
*
|
|
@@ -34207,7 +34435,7 @@ function isSchema(u) {
|
|
|
34207
34435
|
* @category combinators
|
|
34208
34436
|
* @since 4.0.0
|
|
34209
34437
|
*/
|
|
34210
|
-
const optionalKey = /*#__PURE__*/ lambda((schema) => make$
|
|
34438
|
+
const optionalKey = /*#__PURE__*/ lambda((schema) => make$50(optionalKey$1(schema.ast), { schema }));
|
|
34211
34439
|
/**
|
|
34212
34440
|
* Marks a struct field as optional, allowing the key to be absent or
|
|
34213
34441
|
* `undefined`.
|
|
@@ -34240,9 +34468,18 @@ const optionalKey = /*#__PURE__*/ lambda((schema) => make$49(optionalKey$1(schem
|
|
|
34240
34468
|
*/
|
|
34241
34469
|
const optional$2 = /*#__PURE__*/ lambda((self) => {
|
|
34242
34470
|
const schema = UndefinedOr(self);
|
|
34243
|
-
return make$
|
|
34471
|
+
return make$50(optional$3(self.ast), { schema });
|
|
34244
34472
|
});
|
|
34245
34473
|
/**
|
|
34474
|
+
* Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
|
|
34475
|
+
* discarding the encoding transformation path.
|
|
34476
|
+
*
|
|
34477
|
+
* @stability stable
|
|
34478
|
+
* @category transforming
|
|
34479
|
+
* @since 4.0.0
|
|
34480
|
+
*/
|
|
34481
|
+
const toType = /*#__PURE__*/ lambda((schema) => make$50(toType$1(schema.ast), { schema }));
|
|
34482
|
+
/**
|
|
34246
34483
|
* Creates a schema for a single literal value (string, number, bigint, boolean, or null).
|
|
34247
34484
|
*
|
|
34248
34485
|
* **Example** (Defining a string literal)
|
|
@@ -34263,12 +34500,12 @@ const optional$2 = /*#__PURE__*/ lambda((self) => {
|
|
|
34263
34500
|
* @since 3.10.0
|
|
34264
34501
|
*/
|
|
34265
34502
|
function Literal(literal) {
|
|
34266
|
-
const out = make$
|
|
34503
|
+
const out = make$50(new Literal$1(literal), {
|
|
34267
34504
|
literal,
|
|
34268
34505
|
transform(to) {
|
|
34269
34506
|
return out.pipe(decodeTo(Literal(to), {
|
|
34270
|
-
decode: transform$
|
|
34271
|
-
encode: transform$
|
|
34507
|
+
decode: transform$3(() => to),
|
|
34508
|
+
encode: transform$3(() => literal)
|
|
34272
34509
|
}));
|
|
34273
34510
|
}
|
|
34274
34511
|
});
|
|
@@ -34314,7 +34551,7 @@ function templateLiteralParts(parts) {
|
|
|
34314
34551
|
* @since 3.10.0
|
|
34315
34552
|
*/
|
|
34316
34553
|
function TemplateLiteralParser(parts) {
|
|
34317
|
-
return make$
|
|
34554
|
+
return make$50(templateLiteralParser(templateLiteralParts(parts)), { parts });
|
|
34318
34555
|
}
|
|
34319
34556
|
/**
|
|
34320
34557
|
* Schema for the `never` type. Always fails validation — no value satisfies it.
|
|
@@ -34323,7 +34560,7 @@ function TemplateLiteralParser(parts) {
|
|
|
34323
34560
|
* @category schemas
|
|
34324
34561
|
* @since 3.10.0
|
|
34325
34562
|
*/
|
|
34326
|
-
const Never = /*#__PURE__*/ make$
|
|
34563
|
+
const Never = /*#__PURE__*/ make$50(never);
|
|
34327
34564
|
/**
|
|
34328
34565
|
* Schema for the `any` type. Accepts any value without validation.
|
|
34329
34566
|
*
|
|
@@ -34332,7 +34569,7 @@ const Never = /*#__PURE__*/ make$49(never);
|
|
|
34332
34569
|
* @category schemas
|
|
34333
34570
|
* @since 3.10.0
|
|
34334
34571
|
*/
|
|
34335
|
-
const Any = /*#__PURE__*/ make$
|
|
34572
|
+
const Any = /*#__PURE__*/ make$50(any);
|
|
34336
34573
|
/**
|
|
34337
34574
|
* Schema for the `unknown` type. Accepts any value without validation.
|
|
34338
34575
|
*
|
|
@@ -34346,7 +34583,7 @@ const Any = /*#__PURE__*/ make$49(any);
|
|
|
34346
34583
|
* @category schemas
|
|
34347
34584
|
* @since 3.10.0
|
|
34348
34585
|
*/
|
|
34349
|
-
const Unknown = /*#__PURE__*/ make$
|
|
34586
|
+
const Unknown = /*#__PURE__*/ make$50(unknown);
|
|
34350
34587
|
/**
|
|
34351
34588
|
* Schema for the `null` literal. Validates that the input is strictly `null`.
|
|
34352
34589
|
*
|
|
@@ -34355,7 +34592,7 @@ const Unknown = /*#__PURE__*/ make$49(unknown);
|
|
|
34355
34592
|
* @category schemas
|
|
34356
34593
|
* @since 3.10.0
|
|
34357
34594
|
*/
|
|
34358
|
-
const Null = /*#__PURE__*/ make$
|
|
34595
|
+
const Null = /*#__PURE__*/ make$50(null_);
|
|
34359
34596
|
/**
|
|
34360
34597
|
* Schema for the `undefined` literal. Validates that the input is strictly `undefined`.
|
|
34361
34598
|
*
|
|
@@ -34364,7 +34601,7 @@ const Null = /*#__PURE__*/ make$49(null_);
|
|
|
34364
34601
|
* @category schemas
|
|
34365
34602
|
* @since 3.10.0
|
|
34366
34603
|
*/
|
|
34367
|
-
const Undefined = /*#__PURE__*/ make$
|
|
34604
|
+
const Undefined = /*#__PURE__*/ make$50(undefined_);
|
|
34368
34605
|
/**
|
|
34369
34606
|
* Schema for `string` values. Validates that the input is `typeof` `"string"`.
|
|
34370
34607
|
*
|
|
@@ -34372,7 +34609,7 @@ const Undefined = /*#__PURE__*/ make$49(undefined_);
|
|
|
34372
34609
|
* @category schemas
|
|
34373
34610
|
* @since 4.0.0
|
|
34374
34611
|
*/
|
|
34375
|
-
const String$6 = /*#__PURE__*/ make$
|
|
34612
|
+
const String$6 = /*#__PURE__*/ make$50(string);
|
|
34376
34613
|
/**
|
|
34377
34614
|
* Schema for `number` values, including `NaN`, `Infinity`, and `-Infinity`.
|
|
34378
34615
|
*
|
|
@@ -34388,7 +34625,7 @@ const String$6 = /*#__PURE__*/ make$49(string);
|
|
|
34388
34625
|
* @category schemas
|
|
34389
34626
|
* @since 4.0.0
|
|
34390
34627
|
*/
|
|
34391
|
-
const Number$2 = /*#__PURE__*/ make$
|
|
34628
|
+
const Number$2 = /*#__PURE__*/ make$50(number);
|
|
34392
34629
|
/**
|
|
34393
34630
|
* Schema for `boolean` values. Validates that the input is `typeof` `"boolean"`.
|
|
34394
34631
|
*
|
|
@@ -34402,7 +34639,7 @@ const Number$2 = /*#__PURE__*/ make$49(number);
|
|
|
34402
34639
|
* @category schemas
|
|
34403
34640
|
* @since 4.0.0
|
|
34404
34641
|
*/
|
|
34405
|
-
const Boolean$5 = /*#__PURE__*/ make$
|
|
34642
|
+
const Boolean$5 = /*#__PURE__*/ make$50(boolean);
|
|
34406
34643
|
/**
|
|
34407
34644
|
* Schema for a TypeScript `void` return value.
|
|
34408
34645
|
*
|
|
@@ -34423,9 +34660,9 @@ const Boolean$5 = /*#__PURE__*/ make$49(boolean);
|
|
|
34423
34660
|
* @category schemas
|
|
34424
34661
|
* @since 3.10.0
|
|
34425
34662
|
*/
|
|
34426
|
-
const Void = /*#__PURE__*/ make$
|
|
34663
|
+
const Void = /*#__PURE__*/ make$50(void_);
|
|
34427
34664
|
function makeStruct(ast, fields) {
|
|
34428
|
-
return make$
|
|
34665
|
+
return make$50(ast, {
|
|
34429
34666
|
fields,
|
|
34430
34667
|
mapFields(f, options) {
|
|
34431
34668
|
const fields = f(this.fields);
|
|
@@ -34518,13 +34755,13 @@ function Struct(fields) {
|
|
|
34518
34755
|
* @since 3.10.0
|
|
34519
34756
|
*/
|
|
34520
34757
|
function Record$1(key, value) {
|
|
34521
|
-
return make$
|
|
34758
|
+
return make$50(record(key.ast, value.ast), {
|
|
34522
34759
|
key,
|
|
34523
34760
|
value
|
|
34524
34761
|
});
|
|
34525
34762
|
}
|
|
34526
34763
|
function makeTuple(ast, elements) {
|
|
34527
|
-
return make$
|
|
34764
|
+
return make$50(ast, {
|
|
34528
34765
|
elements,
|
|
34529
34766
|
mapElements(f, options) {
|
|
34530
34767
|
const elements = f(this.elements);
|
|
@@ -34556,7 +34793,7 @@ function Tuple(elements) {
|
|
|
34556
34793
|
* @category constructors
|
|
34557
34794
|
* @since 4.0.0
|
|
34558
34795
|
*/
|
|
34559
|
-
const ArraySchema = /*#__PURE__*/ lambda((schema) => make$
|
|
34796
|
+
const ArraySchema = /*#__PURE__*/ lambda((schema) => make$50(new Arrays(false, [], [schema.ast]), { value: schema }));
|
|
34560
34797
|
/**
|
|
34561
34798
|
* Defines a non-empty `ReadonlyArray` schema — at least one element required.
|
|
34562
34799
|
* Type is `readonly [T, ...T[]]`.
|
|
@@ -34575,9 +34812,9 @@ const ArraySchema = /*#__PURE__*/ lambda((schema) => make$49(new Arrays(false, [
|
|
|
34575
34812
|
* @category constructors
|
|
34576
34813
|
* @since 3.10.0
|
|
34577
34814
|
*/
|
|
34578
|
-
const NonEmptyArray = /*#__PURE__*/ lambda((schema) => make$
|
|
34815
|
+
const NonEmptyArray = /*#__PURE__*/ lambda((schema) => make$50(new Arrays(false, [schema.ast], [schema.ast]), { value: schema }));
|
|
34579
34816
|
function makeUnion(ast, members) {
|
|
34580
|
-
return make$
|
|
34817
|
+
return make$50(ast, {
|
|
34581
34818
|
members,
|
|
34582
34819
|
mapMembers(f, options) {
|
|
34583
34820
|
const members = f(this.members);
|
|
@@ -34632,7 +34869,7 @@ function Union(members, options) {
|
|
|
34632
34869
|
*/
|
|
34633
34870
|
function Literals(literals) {
|
|
34634
34871
|
const members = literals.map(Literal);
|
|
34635
|
-
return make$
|
|
34872
|
+
return make$50(union$1(members, void 0, void 0), {
|
|
34636
34873
|
literals,
|
|
34637
34874
|
members,
|
|
34638
34875
|
mapMembers(f) {
|
|
@@ -34664,7 +34901,7 @@ const NullOr = /*#__PURE__*/ lambda((self) => Union([self, Null]));
|
|
|
34664
34901
|
const UndefinedOr = /*#__PURE__*/ lambda((self) => Union([self, Undefined]));
|
|
34665
34902
|
function decodeTo(to, transformation) {
|
|
34666
34903
|
return (from) => {
|
|
34667
|
-
return make$
|
|
34904
|
+
return make$50(decodeTo$1(from.ast, to.ast, transformation ? makeTransformation$1(transformation) : passthrough()), {
|
|
34668
34905
|
from,
|
|
34669
34906
|
to
|
|
34670
34907
|
});
|
|
@@ -34687,7 +34924,7 @@ const FalseLiterals = /*#__PURE__*/ Literals([
|
|
|
34687
34924
|
"n"
|
|
34688
34925
|
]);
|
|
34689
34926
|
/** @internal */
|
|
34690
|
-
const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...FalseLiterals.literals]).pipe(/*#__PURE__*/ decodeTo(Boolean$5, /*#__PURE__*/ transform$
|
|
34927
|
+
const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...FalseLiterals.literals]).pipe(/*#__PURE__*/ decodeTo(Boolean$5, /*#__PURE__*/ transform$2({
|
|
34691
34928
|
decode: (value) => value === "true" || value === "yes" || value === "on" || value === "1" || value === "y",
|
|
34692
34929
|
encode: (value) => value ? "true" : "false"
|
|
34693
34930
|
})));
|
|
@@ -34719,7 +34956,7 @@ const BooleanLiterals = /*#__PURE__*/ Literals([...TrueLiterals.literals, ...Fal
|
|
|
34719
34956
|
* @since 3.10.0
|
|
34720
34957
|
*/
|
|
34721
34958
|
function withConstructorDefault(defaultValue) {
|
|
34722
|
-
return (schema) => make$
|
|
34959
|
+
return (schema) => make$50(withConstructorDefault$1(schema.ast, defaultValue), { schema });
|
|
34723
34960
|
}
|
|
34724
34961
|
/**
|
|
34725
34962
|
* Combines a {@link Literal} schema with {@link withConstructorDefault}, making it ideal
|
|
@@ -34932,7 +35169,7 @@ function isPattern(regExp, annotations) {
|
|
|
34932
35169
|
* @category schemas
|
|
34933
35170
|
* @since 3.10.0
|
|
34934
35171
|
*/
|
|
34935
|
-
const Finite = /*#__PURE__*/ make$
|
|
35172
|
+
const Finite = /*#__PURE__*/ make$50(finite);
|
|
34936
35173
|
/**
|
|
34937
35174
|
* Creates an inclusive or exclusive range check for any ordered type from an
|
|
34938
35175
|
* `Order.Order` instance.
|
|
@@ -35347,7 +35584,7 @@ function CauseReason(error, defect) {
|
|
|
35347
35584
|
_tag: Literal("Interrupt"),
|
|
35348
35585
|
fiberId: UndefinedOr(Finite)
|
|
35349
35586
|
})
|
|
35350
|
-
]), transform$
|
|
35587
|
+
]), transform$2({
|
|
35351
35588
|
decode: (e) => {
|
|
35352
35589
|
switch (e._tag) {
|
|
35353
35590
|
case "Fail": return makeFailReason(e.error);
|
|
@@ -35373,7 +35610,7 @@ function CauseReason(error, defect) {
|
|
|
35373
35610
|
}
|
|
35374
35611
|
}))
|
|
35375
35612
|
});
|
|
35376
|
-
return make$
|
|
35613
|
+
return make$50(schema.ast, {
|
|
35377
35614
|
error,
|
|
35378
35615
|
defect
|
|
35379
35616
|
});
|
|
@@ -35421,12 +35658,12 @@ function Cause(error, defect) {
|
|
|
35421
35658
|
importDeclarations: [`import * as Cause from "effect/Cause"`]
|
|
35422
35659
|
}),
|
|
35423
35660
|
expected: "Cause",
|
|
35424
|
-
toCodec: ([error, defect]) => link$1()(ArraySchema(CauseReason(error, defect)), transform$
|
|
35661
|
+
toCodec: ([error, defect]) => link$1()(ArraySchema(CauseReason(error, defect)), transform$2({
|
|
35425
35662
|
decode: fromReasons,
|
|
35426
35663
|
encode: ({ reasons: failures }) => failures
|
|
35427
35664
|
}))
|
|
35428
35665
|
});
|
|
35429
|
-
return make$
|
|
35666
|
+
return make$50(schema.ast, {
|
|
35430
35667
|
error,
|
|
35431
35668
|
defect
|
|
35432
35669
|
});
|
|
@@ -35481,7 +35718,7 @@ function Exit(value, error, defect) {
|
|
|
35481
35718
|
}), Struct({
|
|
35482
35719
|
_tag: Literal("Failure"),
|
|
35483
35720
|
cause: Cause(error, defect)
|
|
35484
|
-
})]), transform$
|
|
35721
|
+
})]), transform$2({
|
|
35485
35722
|
decode: (e) => e._tag === "Success" ? succeed$7(e.value) : failCause$4(e.cause),
|
|
35486
35723
|
encode: (exit) => isSuccess(exit) ? {
|
|
35487
35724
|
_tag: "Success",
|
|
@@ -35492,12 +35729,90 @@ function Exit(value, error, defect) {
|
|
|
35492
35729
|
}
|
|
35493
35730
|
}))
|
|
35494
35731
|
});
|
|
35495
|
-
return make$
|
|
35732
|
+
return make$50(schema.ast, {
|
|
35496
35733
|
value,
|
|
35497
35734
|
error,
|
|
35498
35735
|
defect
|
|
35499
35736
|
});
|
|
35500
35737
|
}
|
|
35738
|
+
/**
|
|
35739
|
+
* Schema for `Redacted` values, which hide their contents from inspection.
|
|
35740
|
+
*
|
|
35741
|
+
* **Details**
|
|
35742
|
+
*
|
|
35743
|
+
* Options:
|
|
35744
|
+
*
|
|
35745
|
+
* - `label`: When provided, the schema will behave as follows:
|
|
35746
|
+
* - Values will be validated against the label in addition to the wrapped schema
|
|
35747
|
+
* - The default JSON serializer will deserialize into a `Redacted` instance with the label
|
|
35748
|
+
* - The arbitrary generator will produce a `Redacted` instance with the label
|
|
35749
|
+
* - The formatter will return the label
|
|
35750
|
+
* - `disallowJsonEncode`: When set to `true`, when attempting to encode a `Redacted` instance
|
|
35751
|
+
* into JSON, it will fail with an error. This is useful when the wrapped schema is
|
|
35752
|
+
* sensitive and should not be exposed in JSON.
|
|
35753
|
+
*
|
|
35754
|
+
* @see {@link RedactedFromValue} for decoding raw values and wrapping them in `Redacted`.
|
|
35755
|
+
* @stability stable
|
|
35756
|
+
* @category schemas
|
|
35757
|
+
* @since 3.10.0
|
|
35758
|
+
*/
|
|
35759
|
+
function Redacted(value$7, options) {
|
|
35760
|
+
const label = typeof options?.label === "string" ? options.label : void 0;
|
|
35761
|
+
const disallowJsonEncode = options?.disallowJsonEncode === true;
|
|
35762
|
+
const normalizedOptions = label !== void 0 ? disallowJsonEncode ? {
|
|
35763
|
+
label,
|
|
35764
|
+
disallowJsonEncode: true
|
|
35765
|
+
} : { label } : disallowJsonEncode ? { disallowJsonEncode: true } : void 0;
|
|
35766
|
+
const decodeLabel = label !== void 0 ? decodeUnknownEffect$1(Literal(label)) : void 0;
|
|
35767
|
+
const schema = declareConstructor()([value$7], ([value$9]) => (input, ast, poptions) => {
|
|
35768
|
+
if (isRedacted(input)) {
|
|
35769
|
+
const label = decodeLabel !== void 0 ? mapErrorEager(decodeLabel(input.label, poptions), (issue) => new Pointer(["label"], issue)) : void_$1;
|
|
35770
|
+
return flatMapEager(label, () => mapBothEager(decodeUnknownEffect$1(value$9)(value(input), poptions), {
|
|
35771
|
+
onSuccess: (value) => make$55(value, { label: input.label }),
|
|
35772
|
+
onFailure: () => {
|
|
35773
|
+
return new Composite(ast, [new Pointer(["value"], new InvalidValue$1(void 0, input, poptions))], input, poptions);
|
|
35774
|
+
}
|
|
35775
|
+
}));
|
|
35776
|
+
}
|
|
35777
|
+
return fail$6(new InvalidType(ast, input, poptions));
|
|
35778
|
+
}, {
|
|
35779
|
+
representation: {
|
|
35780
|
+
id: "effect/schema/Redacted",
|
|
35781
|
+
payload: normalizedOptions ?? null
|
|
35782
|
+
},
|
|
35783
|
+
toCode: ({ typeParameters }) => ({
|
|
35784
|
+
runtime: normalizedOptions !== void 0 ? `Schema.Redacted(${typeParameters[0].runtime}, ${format$2(normalizedOptions)})` : `Schema.Redacted(${typeParameters[0].runtime})`,
|
|
35785
|
+
Type: `Redacted.Redacted<${typeParameters[0].Type}>`,
|
|
35786
|
+
importDeclarations: [`import * as Redacted from "effect/Redacted"`]
|
|
35787
|
+
}),
|
|
35788
|
+
expected: "Redacted",
|
|
35789
|
+
toCodecJson: ([value$6]) => link$1()(value$6, {
|
|
35790
|
+
decode: transform$3((e) => make$55(e, { label })),
|
|
35791
|
+
encode: disallowJsonEncode ? forbidden((oe) => "Cannot serialize Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$3(value)
|
|
35792
|
+
}),
|
|
35793
|
+
toEquivalence: ([value]) => makeEquivalence(value)
|
|
35794
|
+
});
|
|
35795
|
+
return make$50(schema.ast, { value: value$7 });
|
|
35796
|
+
}
|
|
35797
|
+
/**
|
|
35798
|
+
* Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which
|
|
35799
|
+
* expects the input to already be a `Redacted` instance, this schema decodes
|
|
35800
|
+
* the raw value and wraps it.
|
|
35801
|
+
*
|
|
35802
|
+
* @see {@link Redacted} for schemas whose input is already a `Redacted` value.
|
|
35803
|
+
* @stability stable
|
|
35804
|
+
* @category schemas
|
|
35805
|
+
* @since 4.0.0
|
|
35806
|
+
*/
|
|
35807
|
+
function RedactedFromValue(value$8, options) {
|
|
35808
|
+
return decodeTo(Redacted(toType(value$8), {
|
|
35809
|
+
label: options?.label,
|
|
35810
|
+
disallowJsonEncode: options?.disallowEncode
|
|
35811
|
+
}), {
|
|
35812
|
+
decode: transform$3((t) => make$55(t, { label: options?.label })),
|
|
35813
|
+
encode: options?.disallowEncode ? forbidden((oe) => "Cannot encode Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$3(value)
|
|
35814
|
+
})(value$8);
|
|
35815
|
+
}
|
|
35501
35816
|
const immerable = /*#__PURE__*/ globalThis.Symbol.for("immer-draftable");
|
|
35502
35817
|
const payloadToken = {};
|
|
35503
35818
|
function makeClass(Inherited, identifier, struct$1, annotations, proto) {
|
|
@@ -35533,7 +35848,7 @@ function makeClass(Inherited, identifier, struct$1, annotations, proto) {
|
|
|
35533
35848
|
return getClassSchema(this).rebuild(ast);
|
|
35534
35849
|
}
|
|
35535
35850
|
static make(input, options) {
|
|
35536
|
-
return makeClassSync(toType(getClassSchema(this).ast), input ?? {}, options, (fields) => makeClassTrusted(this, fields));
|
|
35851
|
+
return makeClassSync(toType$1(getClassSchema(this).ast), input ?? {}, options, (fields) => makeClassTrusted(this, fields));
|
|
35537
35852
|
}
|
|
35538
35853
|
static makeOption(input, options) {
|
|
35539
35854
|
return makeOption(getClassSchema(this))(input ?? {}, options);
|
|
@@ -35581,7 +35896,7 @@ function makeClassTrusted(self, fields) {
|
|
|
35581
35896
|
} });
|
|
35582
35897
|
}
|
|
35583
35898
|
function getClassTransformation(self) {
|
|
35584
|
-
return new Transformation(transform$
|
|
35899
|
+
return new Transformation(transform$3((input) => makeClassTrusted(self, input)), passthrough$1());
|
|
35585
35900
|
}
|
|
35586
35901
|
function getClassTypeId(identifier) {
|
|
35587
35902
|
return `~effect/Schema/Class/${identifier}`;
|
|
@@ -35593,7 +35908,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
|
|
|
35593
35908
|
const ClassTypeId = getClassTypeId(identifier);
|
|
35594
35909
|
const isClassValue = (input) => input instanceof self || hasProperty(input, ClassTypeId);
|
|
35595
35910
|
const transformation = getClassTransformation(self);
|
|
35596
|
-
return memo = decodeTo(make$
|
|
35911
|
+
return memo = decodeTo(make$50(new Declaration([from.ast], () => (input, ast, options) => {
|
|
35597
35912
|
return isClassValue(input) ? succeed$5(input) : fail$6(new InvalidType(ast, input, options));
|
|
35598
35913
|
}, {
|
|
35599
35914
|
identifier,
|
|
@@ -35826,7 +36141,7 @@ const toCodecStringTree = toCodecStringTree$1;
|
|
|
35826
36141
|
* @category schemas
|
|
35827
36142
|
* @since 4.0.0
|
|
35828
36143
|
*/
|
|
35829
|
-
const Json = /*#__PURE__*/ make$
|
|
36144
|
+
const Json = /*#__PURE__*/ make$50(/*#__PURE__*/ annotate$1(Json$1, { toCode: () => ({
|
|
35830
36145
|
runtime: "Schema.Json",
|
|
35831
36146
|
Type: "Schema.Json"
|
|
35832
36147
|
}) }));
|
|
@@ -35949,7 +36264,7 @@ const makeUnsafe$3 = makeLatchUnsafe;
|
|
|
35949
36264
|
* @category constructors
|
|
35950
36265
|
* @since 4.0.0
|
|
35951
36266
|
*/
|
|
35952
|
-
const make$
|
|
36267
|
+
const make$49 = makeLatch;
|
|
35953
36268
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/MutableRef.js
|
|
35954
36269
|
const TypeId$35 = "~effect/MutableRef";
|
|
35955
36270
|
const MutableRefProto = {
|
|
@@ -35995,7 +36310,7 @@ const MutableRefProto = {
|
|
|
35995
36310
|
* @category constructors
|
|
35996
36311
|
* @since 2.0.0
|
|
35997
36312
|
*/
|
|
35998
|
-
const make$
|
|
36313
|
+
const make$48 = (value) => {
|
|
35999
36314
|
const ref = Object.create(MutableRefProto);
|
|
36000
36315
|
ref.current = value;
|
|
36001
36316
|
return ref;
|
|
@@ -36051,7 +36366,7 @@ const make$47 = (value) => {
|
|
|
36051
36366
|
* @category mutations
|
|
36052
36367
|
* @since 2.0.0
|
|
36053
36368
|
*/
|
|
36054
|
-
const set = /*#__PURE__*/ dual(2, (self, value) => {
|
|
36369
|
+
const set$1 = /*#__PURE__*/ dual(2, (self, value) => {
|
|
36055
36370
|
self.current = value;
|
|
36056
36371
|
return self;
|
|
36057
36372
|
});
|
|
@@ -36100,7 +36415,7 @@ const SubscriptionTypeId = "~effect/PubSub/Subscription";
|
|
|
36100
36415
|
* @category constructors
|
|
36101
36416
|
* @since 4.0.0
|
|
36102
36417
|
*/
|
|
36103
|
-
const make$
|
|
36418
|
+
const make$47 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(), /* @__PURE__ */ new Map(), makeUnsafe$7(), makeUnsafe$3(false), make$48(false), options.strategy(), make$48(none())));
|
|
36104
36419
|
/**
|
|
36105
36420
|
* Creates an unbounded `PubSub`.
|
|
36106
36421
|
*
|
|
@@ -36131,7 +36446,7 @@ const make$46 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(),
|
|
|
36131
36446
|
* @category constructors
|
|
36132
36447
|
* @since 2.0.0
|
|
36133
36448
|
*/
|
|
36134
|
-
const unbounded = (options) => make$
|
|
36449
|
+
const unbounded = (options) => make$47({
|
|
36135
36450
|
atomicPubSub: () => makeAtomicUnbounded(options),
|
|
36136
36451
|
strategy: () => new DroppingStrategy()
|
|
36137
36452
|
});
|
|
@@ -36256,13 +36571,13 @@ const publishUnsafe = /*#__PURE__*/ dual(2, (self, value) => {
|
|
|
36256
36571
|
* @since 2.0.0
|
|
36257
36572
|
*/
|
|
36258
36573
|
const subscribe = (self) => uninterruptible(contextWith((services) => {
|
|
36259
|
-
const localScope = get$
|
|
36574
|
+
const localScope = get$11(services, Scope);
|
|
36260
36575
|
const scope = forkUnsafe(self.scope);
|
|
36261
36576
|
const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy, self.ended);
|
|
36262
36577
|
return addFinalizer$1(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
|
|
36263
36578
|
}));
|
|
36264
36579
|
const unsubscribe = (self) => uninterruptible(withFiber((state) => {
|
|
36265
|
-
set(self.shutdownFlag, true);
|
|
36580
|
+
set$1(self.shutdownFlag, true);
|
|
36266
36581
|
return forEach$1(takeAll$2(self.pollers), (d) => interruptWith(d, state.id), {
|
|
36267
36582
|
discard: true,
|
|
36268
36583
|
concurrency: "unbounded"
|
|
@@ -36345,7 +36660,7 @@ const removeSubscribers = (subscribers, subscription, pollers) => {
|
|
|
36345
36660
|
set.delete(pollers);
|
|
36346
36661
|
if (set.size === 0) subscribers.delete(subscription);
|
|
36347
36662
|
};
|
|
36348
|
-
const makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$
|
|
36663
|
+
const makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$63(), makeUnsafe$3(false), make$48(false), strategy, pubsub.replayWindow(), ended);
|
|
36349
36664
|
var UnboundedPubSub = class {
|
|
36350
36665
|
publisherHead = {
|
|
36351
36666
|
value: AbsentValue,
|
|
@@ -36902,7 +37217,7 @@ const fromTransformBracket = (f) => fromTransform$1(fnUntraced(function* (upstre
|
|
|
36902
37217
|
* @since 4.0.0
|
|
36903
37218
|
*/
|
|
36904
37219
|
const toTransform = (channel) => channel.transform;
|
|
36905
|
-
const asyncQueue = (scope, f, options) => make$
|
|
37220
|
+
const asyncQueue = (scope, f, options) => make$62({
|
|
36906
37221
|
capacity: options?.bufferSize,
|
|
36907
37222
|
strategy: options?.strategy
|
|
36908
37223
|
}).pipe(tap$1((queue) => addFinalizer$1(scope, shutdown(queue))), tap$1((queue) => provide$3(f(queue), scope).pipe(catchCause$1((cause) => failCause$1(queue, cause)), forkIn(scope, { startImmediately: true }))));
|
|
@@ -37418,7 +37733,7 @@ const fromReadableStream$1 = (options) => fromTransform$1((_, scope) => readable
|
|
|
37418
37733
|
}));
|
|
37419
37734
|
const readableStreamToPullUnsafe = (options) => {
|
|
37420
37735
|
const reader = options.readable.getReader();
|
|
37421
|
-
const exit = options.exit ?? make$
|
|
37736
|
+
const exit = options.exit ?? make$48(void 0);
|
|
37422
37737
|
const pull = suspend$2(() => {
|
|
37423
37738
|
if (exit.current) return exit.current;
|
|
37424
37739
|
return matchCauseEffect(tryPromise({
|
|
@@ -37889,7 +38204,7 @@ const orDie$1 = (self) => catch_(self, die$1);
|
|
|
37889
38204
|
const mergeAll = /*#__PURE__*/ dual(2, (channels, { bufferSize = 16, concurrency, switch: switch_ = false }) => fromTransformBracket(fnUntraced(function* (upstream, scope, forkedScope) {
|
|
37890
38205
|
const concurrencyN = concurrency === "unbounded" ? Number.MAX_SAFE_INTEGER : Math.max(1, concurrency);
|
|
37891
38206
|
const semaphore = switch_ ? void 0 : makeUnsafe$5(concurrencyN);
|
|
37892
|
-
const doneLatch = yield* make$
|
|
38207
|
+
const doneLatch = yield* make$49(true);
|
|
37893
38208
|
const fibers = /* @__PURE__ */ new Map();
|
|
37894
38209
|
const queue = yield* bounded(bufferSize);
|
|
37895
38210
|
yield* addFinalizer$1(forkedScope, shutdown(queue));
|
|
@@ -38938,7 +39253,7 @@ const isNotLink = (error) => isIgnorable(error) || error.reason._tag === "Unknow
|
|
|
38938
39253
|
const DIRECTORY_CONCURRENCY = 16;
|
|
38939
39254
|
const byName = /*#__PURE__*/ mapInput(String$10, (entry) => entry.name);
|
|
38940
39255
|
/** @internal */
|
|
38941
|
-
const make$
|
|
39256
|
+
const make$46 = (fs) => (pattern, options) => walk(fs, compile$3([pattern], options?.dot ?? false), options);
|
|
38942
39257
|
const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
|
|
38943
39258
|
if (compiled.initial.size === 0) return [];
|
|
38944
39259
|
const root = options?.root ?? "";
|
|
@@ -39430,9 +39745,9 @@ var RcRefImpl = class {
|
|
|
39430
39745
|
}
|
|
39431
39746
|
};
|
|
39432
39747
|
/** @internal */
|
|
39433
|
-
const make$
|
|
39748
|
+
const make$45 = (options) => withFiber((fiber) => {
|
|
39434
39749
|
const context = fiber.context;
|
|
39435
|
-
const scope = get$
|
|
39750
|
+
const scope = get$11(context, Scope);
|
|
39436
39751
|
const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== void 0 ? fromInputUnsafe$1(options.idleTimeToLive) : void 0);
|
|
39437
39752
|
return as(addFinalizerExit(scope, () => {
|
|
39438
39753
|
const state = ref.state;
|
|
@@ -39495,7 +39810,7 @@ const awaitAcquiring = (self, acquiring, restore) => onExit$1(restore(join$1(acq
|
|
|
39495
39810
|
return interrupt(acquiring.fiber);
|
|
39496
39811
|
});
|
|
39497
39812
|
/** @internal */
|
|
39498
|
-
const get$
|
|
39813
|
+
const get$6 = (self_) => {
|
|
39499
39814
|
const self = self_;
|
|
39500
39815
|
return uninterruptibleMask((restore) => flatMap$3(scope, (scope) => flatMap$3(getState(self, restore), (state) => as(addFinalizerExit(scope, () => release(self, state)), state.value))));
|
|
39501
39816
|
};
|
|
@@ -39569,7 +39884,7 @@ const release = (self, state) => {
|
|
|
39569
39884
|
* @category constructors
|
|
39570
39885
|
* @since 3.5.0
|
|
39571
39886
|
*/
|
|
39572
|
-
const make$
|
|
39887
|
+
const make$44 = make$45;
|
|
39573
39888
|
/**
|
|
39574
39889
|
* Gets the value from an `RcRef`, acquiring it first if needed.
|
|
39575
39890
|
*
|
|
@@ -39615,7 +39930,7 @@ const make$43 = make$44;
|
|
|
39615
39930
|
* @category combinators
|
|
39616
39931
|
* @since 3.5.0
|
|
39617
39932
|
*/
|
|
39618
|
-
const get$
|
|
39933
|
+
const get$5 = get$6;
|
|
39619
39934
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Stream.js
|
|
39620
39935
|
/**
|
|
39621
39936
|
* Describes effectful sources that emit values over time.
|
|
@@ -39834,7 +40149,7 @@ const succeed$2 = (value) => fromChannel(succeed$3(of(value)));
|
|
|
39834
40149
|
* @category constructors
|
|
39835
40150
|
* @since 2.0.0
|
|
39836
40151
|
*/
|
|
39837
|
-
const make$
|
|
40152
|
+
const make$43 = (...values) => fromArray(values);
|
|
39838
40153
|
/**
|
|
39839
40154
|
* Creates a lazily constructed stream.
|
|
39840
40155
|
*
|
|
@@ -41049,10 +41364,10 @@ const FileSystem = /*#__PURE__*/ Service$1("effect/FileSystem");
|
|
|
41049
41364
|
* @category constructors
|
|
41050
41365
|
* @since 4.0.0
|
|
41051
41366
|
*/
|
|
41052
|
-
const make$
|
|
41367
|
+
const make$42 = (impl) => FileSystem.of({
|
|
41053
41368
|
...impl,
|
|
41054
41369
|
[TypeId$27]: TypeId$27,
|
|
41055
|
-
glob: make$
|
|
41370
|
+
glob: make$46(impl),
|
|
41056
41371
|
exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$5(false) : fail$6(e))),
|
|
41057
41372
|
readFileString: (path, encoding) => flatMap$3(impl.readFile(path), (_) => try_({
|
|
41058
41373
|
try: () => new TextDecoder(encoding).decode(_),
|
|
@@ -41271,7 +41586,7 @@ const Path$1 = /*#__PURE__*/ Service$1("effect/Path");
|
|
|
41271
41586
|
* @category constructors
|
|
41272
41587
|
* @since 4.0.0
|
|
41273
41588
|
*/
|
|
41274
|
-
const make$
|
|
41589
|
+
const make$41 = (impl) => Path$1.of({
|
|
41275
41590
|
...impl,
|
|
41276
41591
|
[TypeId$26]: TypeId$26,
|
|
41277
41592
|
resolveWithin(root, input) {
|
|
@@ -41507,7 +41822,7 @@ function makeOrElse(first, second) {
|
|
|
41507
41822
|
* @category constructors
|
|
41508
41823
|
* @since 4.0.0
|
|
41509
41824
|
*/
|
|
41510
|
-
function make$
|
|
41825
|
+
function make$40(get) {
|
|
41511
41826
|
return makeSource(get, identityPath);
|
|
41512
41827
|
}
|
|
41513
41828
|
/**
|
|
@@ -41610,7 +41925,7 @@ const orElse = /*#__PURE__*/ dual(2, (self, that) => makeOrElse(self, that));
|
|
|
41610
41925
|
*/
|
|
41611
41926
|
function fromUnknown(root, options) {
|
|
41612
41927
|
const preserveEmptyStrings = options?.preserveEmptyStrings === true;
|
|
41613
|
-
return make$
|
|
41928
|
+
return make$40((path) => succeed$5(nodeAtJson(root, path, preserveEmptyStrings)));
|
|
41614
41929
|
}
|
|
41615
41930
|
function nodeAtJson(root, path, preserveEmptyStrings) {
|
|
41616
41931
|
let cur = root;
|
|
@@ -41678,7 +41993,7 @@ function emptyStringAsMissing(value, preserveEmptyStrings) {
|
|
|
41678
41993
|
function fromEnvRecord(env, options) {
|
|
41679
41994
|
const preserveEmptyStrings = options?.preserveEmptyStrings === true;
|
|
41680
41995
|
const trie = buildEnvTrie(env);
|
|
41681
|
-
return make$
|
|
41996
|
+
return make$40((path) => succeed$5(nodeAtEnv(trie, env, path, preserveEmptyStrings)));
|
|
41682
41997
|
}
|
|
41683
41998
|
/**
|
|
41684
41999
|
* Creates a `ConfigProvider` backed by environment variables.
|
|
@@ -41852,7 +42167,7 @@ const Proto$13 = {
|
|
|
41852
42167
|
return { _id: "Config" };
|
|
41853
42168
|
}
|
|
41854
42169
|
};
|
|
41855
|
-
function make$
|
|
42170
|
+
function make$39(evaluator) {
|
|
41856
42171
|
const self = Object.create(Proto$13);
|
|
41857
42172
|
self.evaluator = evaluator;
|
|
41858
42173
|
self.parse = (provider) => flatMapEager(evaluator(provider, []), fromResult);
|
|
@@ -41887,7 +42202,7 @@ const evaluateAt = (self, provider, pathPrefix) => self.evaluator(provider, path
|
|
|
41887
42202
|
* @since 2.0.0
|
|
41888
42203
|
*/
|
|
41889
42204
|
const map$3 = /*#__PURE__*/ dual(2, (self, f) => {
|
|
41890
|
-
return make$
|
|
42205
|
+
return make$39((provider, pathPrefix) => map$6(evaluateAt(self, provider, pathPrefix), map$11(f)));
|
|
41891
42206
|
});
|
|
41892
42207
|
/**
|
|
41893
42208
|
* Combines multiple configs into a single config that parses all of them.
|
|
@@ -41934,7 +42249,7 @@ const map$3 = /*#__PURE__*/ dual(2, (self, f) => {
|
|
|
41934
42249
|
*/
|
|
41935
42250
|
function all(arg) {
|
|
41936
42251
|
const configs = globalThis.Array.isArray(arg) ? arg : Symbol.iterator in arg ? [...arg] : arg;
|
|
41937
|
-
return make$
|
|
42252
|
+
return make$39((provider, pathPrefix) => globalThis.Array.isArray(configs) ? mapEager(all$1(configs.map((config) => evaluateAt(config, provider, pathPrefix))), all$3) : mapEager(all$1(map$10(configs, (config) => evaluateAt(config, provider, pathPrefix))), all$3));
|
|
41938
42253
|
}
|
|
41939
42254
|
/**
|
|
41940
42255
|
* Provides a fallback value when the config is absent.
|
|
@@ -41973,7 +42288,7 @@ function all(arg) {
|
|
|
41973
42288
|
* @since 2.0.0
|
|
41974
42289
|
*/
|
|
41975
42290
|
const withDefault$2 = /*#__PURE__*/ dual(2, (self, defaultValue) => {
|
|
41976
|
-
return make$
|
|
42291
|
+
return make$39((provider, pathPrefix) => mapEager(evaluateAt(self, provider, pathPrefix), (resolution) => isFailure$1(resolution) ? succeed$9(defaultValue) : resolution));
|
|
41977
42292
|
});
|
|
41978
42293
|
/**
|
|
41979
42294
|
* Makes a config optional: returns `Some(value)` on success and `None` when the
|
|
@@ -42214,9 +42529,9 @@ const toConfigCursorAST = /*#__PURE__*/ memoize((root) => {
|
|
|
42214
42529
|
function schema$1(codec, path) {
|
|
42215
42530
|
const codecStringTree = toCodecStringTree(codec);
|
|
42216
42531
|
const encodedAst = toEncoded(codecStringTree.ast);
|
|
42217
|
-
const decodeCursor = decodeUnknownEffect$1(make$
|
|
42532
|
+
const decodeCursor = decodeUnknownEffect$1(make$50(toConfigCursorAST(codecStringTree.ast)));
|
|
42218
42533
|
const localPath = typeof path === "string" ? [path] : path ?? [];
|
|
42219
|
-
return make$
|
|
42534
|
+
return make$39((provider, pathPrefix) => {
|
|
42220
42535
|
const fullPath = [...pathPrefix, ...localPath];
|
|
42221
42536
|
return loadCursor(provider, fullPath).pipe(flatMapEager((cursor) => decodeCursor(cursor).pipe(mapEager(succeed$9), catchEager((issue) => {
|
|
42222
42537
|
const error = new ConfigError(new SchemaError(fullPath.length > 0 ? new Pointer(fullPath, issue) : issue));
|
|
@@ -42255,7 +42570,7 @@ const isPath = (u) => isString$1(u) || globalThis.Array.isArray(u);
|
|
|
42255
42570
|
* @since 2.0.0
|
|
42256
42571
|
*/
|
|
42257
42572
|
function succeed$1(value) {
|
|
42258
|
-
return make$
|
|
42573
|
+
return make$39(() => succeed$5(succeed$9(value)));
|
|
42259
42574
|
}
|
|
42260
42575
|
/**
|
|
42261
42576
|
* Creates a config for a single string value.
|
|
@@ -42296,7 +42611,7 @@ function Array$1(value, pathOrOptions, options) {
|
|
|
42296
42611
|
const separator = resolvedOptions?.separator ?? ",";
|
|
42297
42612
|
return schema$1(Union([String$6.pipe(decodeTo(toCodecStringTree(array), {
|
|
42298
42613
|
decode: split(resolvedOptions),
|
|
42299
|
-
encode: compose(passthrough$1({ strict: false }), transform$
|
|
42614
|
+
encode: compose(passthrough$1({ strict: false }), transform$3((input) => input.join(separator)))
|
|
42300
42615
|
})), array]), hasPath ? pathOrOptions : void 0);
|
|
42301
42616
|
}
|
|
42302
42617
|
function Record(key, value, pathOrOptions, options) {
|
|
@@ -42616,7 +42931,7 @@ const makeUnsafe$2 = (backing, deferred) => {
|
|
|
42616
42931
|
* @category constructors
|
|
42617
42932
|
* @since 2.0.0
|
|
42618
42933
|
*/
|
|
42619
|
-
const make$
|
|
42934
|
+
const make$38 = () => acquireRelease(sync(() => makeUnsafe$2(/* @__PURE__ */ new Set(), makeUnsafe$8())), (set) => suspend$2(() => {
|
|
42620
42935
|
const state = set.state;
|
|
42621
42936
|
if (state._tag === "Closed") return void_$1;
|
|
42622
42937
|
set.state = { _tag: "Closed" };
|
|
@@ -42908,7 +43223,7 @@ const LogToStderr = LogToStderr$1;
|
|
|
42908
43223
|
* @category constructors
|
|
42909
43224
|
* @since 2.0.0
|
|
42910
43225
|
*/
|
|
42911
|
-
const make$
|
|
43226
|
+
const make$37 = loggerMake;
|
|
42912
43227
|
/**
|
|
42913
43228
|
* Creates a `Layer` which will overwrite the current set of loggers with the
|
|
42914
43229
|
* specified array of `loggers`.
|
|
@@ -42946,6 +43261,19 @@ const layer$20 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntr
|
|
|
42946
43261
|
return currentLoggers;
|
|
42947
43262
|
})));
|
|
42948
43263
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/Ref.js
|
|
43264
|
+
/**
|
|
43265
|
+
* Stores fiber-safe mutable state inside Effect programs.
|
|
43266
|
+
*
|
|
43267
|
+
* A `Ref<A>` holds one value and exposes reads, writes, and atomic
|
|
43268
|
+
* transformations as effects, so state changes compose with Effect's
|
|
43269
|
+
* concurrency model. This module includes constructors, safe and unsafe reads,
|
|
43270
|
+
* set and get-and-set helpers, update and modify helpers, and conditional
|
|
43271
|
+
* update variants that leave the value unchanged when an `Option.none` result
|
|
43272
|
+
* is returned.
|
|
43273
|
+
*
|
|
43274
|
+
* @stability stable
|
|
43275
|
+
* @since 2.0.0
|
|
43276
|
+
*/
|
|
42949
43277
|
const RefProto = {
|
|
42950
43278
|
["~effect/Ref"]: { _A: identity },
|
|
42951
43279
|
...PipeInspectableProto,
|
|
@@ -42983,9 +43311,99 @@ const RefProto = {
|
|
|
42983
43311
|
*/
|
|
42984
43312
|
const makeUnsafe$1 = (value) => {
|
|
42985
43313
|
const self = Object.create(RefProto);
|
|
42986
|
-
self.ref = make$
|
|
43314
|
+
self.ref = make$48(value);
|
|
42987
43315
|
return self;
|
|
42988
43316
|
};
|
|
43317
|
+
/**
|
|
43318
|
+
* Creates a new Ref with the specified initial value.
|
|
43319
|
+
*
|
|
43320
|
+
* **When to use**
|
|
43321
|
+
*
|
|
43322
|
+
* Use to create a `Ref` for shared mutable state inside an Effect program.
|
|
43323
|
+
*
|
|
43324
|
+
* **Example** (Creating a ref)
|
|
43325
|
+
*
|
|
43326
|
+
* ```ts import.meta.vitest
|
|
43327
|
+
* import { Effect, Ref } from "effect"
|
|
43328
|
+
*
|
|
43329
|
+
* const program = Effect.gen(function*() {
|
|
43330
|
+
* const ref = yield* Ref.make(42)
|
|
43331
|
+
* return yield* Ref.get(ref)
|
|
43332
|
+
* })
|
|
43333
|
+
*
|
|
43334
|
+
* await Effect.runPromise(program) // => 42
|
|
43335
|
+
* ```
|
|
43336
|
+
*
|
|
43337
|
+
* @see {@link makeUnsafe} for synchronous construction outside Effect code
|
|
43338
|
+
*
|
|
43339
|
+
* @stability stable
|
|
43340
|
+
* @category constructors
|
|
43341
|
+
* @since 2.0.0
|
|
43342
|
+
*/
|
|
43343
|
+
const make$36 = (value) => sync(() => makeUnsafe$1(value));
|
|
43344
|
+
/**
|
|
43345
|
+
* Gets the current value of the Ref.
|
|
43346
|
+
*
|
|
43347
|
+
* **When to use**
|
|
43348
|
+
*
|
|
43349
|
+
* Use to read the current `Ref` value without changing it.
|
|
43350
|
+
*
|
|
43351
|
+
* **Example** (Getting the current value)
|
|
43352
|
+
*
|
|
43353
|
+
* ```ts import.meta.vitest
|
|
43354
|
+
* import { Effect, Ref } from "effect"
|
|
43355
|
+
*
|
|
43356
|
+
* const program = Effect.gen(function*() {
|
|
43357
|
+
* const ref = yield* Ref.make(42)
|
|
43358
|
+
* return yield* Ref.get(ref)
|
|
43359
|
+
* })
|
|
43360
|
+
*
|
|
43361
|
+
* await Effect.runPromise(program) // => 42
|
|
43362
|
+
* ```
|
|
43363
|
+
*
|
|
43364
|
+
* @see {@link set} for replacing the current value
|
|
43365
|
+
*
|
|
43366
|
+
* @stability stable
|
|
43367
|
+
* @category getters
|
|
43368
|
+
* @since 2.0.0
|
|
43369
|
+
*/
|
|
43370
|
+
const get$4 = (self) => sync(() => self.ref.current);
|
|
43371
|
+
/**
|
|
43372
|
+
* Sets the value of the Ref to the specified value.
|
|
43373
|
+
*
|
|
43374
|
+
* **When to use**
|
|
43375
|
+
*
|
|
43376
|
+
* Use to replace the current `Ref` value with a known value.
|
|
43377
|
+
*
|
|
43378
|
+
* **Example** (Setting a value)
|
|
43379
|
+
*
|
|
43380
|
+
* ```ts import.meta.vitest
|
|
43381
|
+
* import { Effect, Ref } from "effect"
|
|
43382
|
+
*
|
|
43383
|
+
* const program = Effect.gen(function*() {
|
|
43384
|
+
* const ref = yield* Ref.make(0)
|
|
43385
|
+
* yield* Ref.set(ref, 42)
|
|
43386
|
+
* return yield* Ref.get(ref)
|
|
43387
|
+
* })
|
|
43388
|
+
*
|
|
43389
|
+
* const program2 = Effect.gen(function*() {
|
|
43390
|
+
* const ref = yield* Ref.make(0)
|
|
43391
|
+
* yield* Ref.set(ref, 100)
|
|
43392
|
+
* return yield* Ref.get(ref)
|
|
43393
|
+
* })
|
|
43394
|
+
*
|
|
43395
|
+
* await Effect.runPromise(program) // => 42
|
|
43396
|
+
* await Effect.runPromise(program2) // => 100
|
|
43397
|
+
* ```
|
|
43398
|
+
*
|
|
43399
|
+
* @see {@link getAndSet} for setting while returning the previous value
|
|
43400
|
+
* @see {@link setAndGet} for setting while returning the new value
|
|
43401
|
+
*
|
|
43402
|
+
* @stability stable
|
|
43403
|
+
* @category mutations
|
|
43404
|
+
* @since 2.0.0
|
|
43405
|
+
*/
|
|
43406
|
+
const set = /*#__PURE__*/ dual(2, (self, value) => sync(() => set$1(self.ref, value)));
|
|
42989
43407
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/UndefinedOr.js
|
|
42990
43408
|
/**
|
|
42991
43409
|
* Pattern matches on an `A | undefined` value, running `onDefined` when the
|
|
@@ -43982,7 +44400,7 @@ const schema = /*#__PURE__*/ declare(isStream);
|
|
|
43982
44400
|
* @since 4.0.0
|
|
43983
44401
|
*/
|
|
43984
44402
|
function Stream$1(success, error) {
|
|
43985
|
-
return make$
|
|
44403
|
+
return make$50(schema.ast, {
|
|
43986
44404
|
[StreamSchemaTypeId]: StreamSchemaTypeId,
|
|
43987
44405
|
success,
|
|
43988
44406
|
error
|
|
@@ -44785,7 +45203,7 @@ const compressBody$1 = (body, algorithm, options) => {
|
|
|
44785
45203
|
*/
|
|
44786
45204
|
const updateHeaders = (headers, body) => {
|
|
44787
45205
|
if (body._tag === "Empty" || body._tag === "FormData") return remove$2(remove$2(headers, "content-type"), "content-length");
|
|
44788
|
-
headers = body.contentType === void 0 ? remove$2(headers, "content-type") : set$
|
|
45206
|
+
headers = body.contentType === void 0 ? remove$2(headers, "content-type") : set$2(headers, "content-type", body.contentType);
|
|
44789
45207
|
return updateContentLength(headers, body);
|
|
44790
45208
|
};
|
|
44791
45209
|
/**
|
|
@@ -44793,7 +45211,7 @@ const updateHeaders = (headers, body) => {
|
|
|
44793
45211
|
*/
|
|
44794
45212
|
const updateContentLength = (headers, body) => {
|
|
44795
45213
|
const contentLength = body._tag === "Empty" || body._tag === "FormData" ? void 0 : body.contentLength;
|
|
44796
|
-
return contentLength === void 0 ? remove$2(headers, "content-length") : set$
|
|
45214
|
+
return contentLength === void 0 ? remove$2(headers, "content-length") : set$2(headers, "content-length", contentLength.toString());
|
|
44797
45215
|
};
|
|
44798
45216
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/Url.js
|
|
44799
45217
|
/**
|
|
@@ -45000,7 +45418,7 @@ const setMethod = /*#__PURE__*/ dual(2, (self, method) => makeWith$1(method, sel
|
|
|
45000
45418
|
* @category combinators
|
|
45001
45419
|
* @since 4.0.0
|
|
45002
45420
|
*/
|
|
45003
|
-
const setHeader$1 = /*#__PURE__*/ dual(3, (self, key, value) => makeWith$1(self.method, self.url, self.urlParams, self.hash, set$
|
|
45421
|
+
const setHeader$1 = /*#__PURE__*/ dual(3, (self, key, value) => makeWith$1(self.method, self.url, self.urlParams, self.hash, set$2(self.headers, key, value), self.body));
|
|
45004
45422
|
/**
|
|
45005
45423
|
* Sets multiple request headers from an input collection, replacing existing values with matching names.
|
|
45006
45424
|
*
|
|
@@ -45100,7 +45518,7 @@ const setBody$1 = /*#__PURE__*/ dual(2, (self, body) => {
|
|
|
45100
45518
|
*/
|
|
45101
45519
|
const compressBody = /*#__PURE__*/ dual((args) => isHttpClientRequest(args[0]), (self, algorithm, options) => {
|
|
45102
45520
|
if (self.headers["content-encoding"] !== void 0) return succeed$5(self);
|
|
45103
|
-
return map$6(compressBody$1(self.body, algorithm, options), (body) => body === self.body ? self : makeWith$1(self.method, self.url, self.urlParams, self.hash, set$
|
|
45521
|
+
return map$6(compressBody$1(self.body, algorithm, options), (body) => body === self.body ? self : makeWith$1(self.method, self.url, self.urlParams, self.hash, set$2(updateContentLength(self.headers, body), "content-encoding", algorithm), body));
|
|
45104
45522
|
});
|
|
45105
45523
|
/**
|
|
45106
45524
|
* Encodes a value as a JSON request body and sets it on the request, failing with `HttpBodyError` if encoding fails.
|
|
@@ -45542,6 +45960,18 @@ const accessor = (method) => (...args) => flatMap$3(HttpClient, (client) => clie
|
|
|
45542
45960
|
*/
|
|
45543
45961
|
const get$1 = /*#__PURE__*/ accessor("get");
|
|
45544
45962
|
/**
|
|
45963
|
+
* Transforms a client by wrapping the response effect for each request.
|
|
45964
|
+
*
|
|
45965
|
+
* **Details**
|
|
45966
|
+
*
|
|
45967
|
+
* The transformation receives both the response effect and the original request, allowing it to change success, error, and environment behavior.
|
|
45968
|
+
*
|
|
45969
|
+
* @stability unstable
|
|
45970
|
+
* @category mapping
|
|
45971
|
+
* @since 4.0.0
|
|
45972
|
+
*/
|
|
45973
|
+
const transform$1 = /*#__PURE__*/ dual(2, (self, f) => makeWith(flatMap$3((request) => f(self.postprocess(succeed$5(request)), request)), self.preprocess));
|
|
45974
|
+
/**
|
|
45545
45975
|
* Transforms a client by applying an effectful transformation to each response effect.
|
|
45546
45976
|
*
|
|
45547
45977
|
* @stability unstable
|
|
@@ -45662,6 +46092,14 @@ const endSpanWithStatusError = (fiber, span, request, response) => {
|
|
|
45662
46092
|
span.end(fiber.getRef(TracerTimingEnabled) ? fiber.getRef(Clock).currentTimeNanosUnsafe() : BigInt(0), exit);
|
|
45663
46093
|
};
|
|
45664
46094
|
/**
|
|
46095
|
+
* Appends an effectful transformation of the request object before sending it.
|
|
46096
|
+
*
|
|
46097
|
+
* @stability unstable
|
|
46098
|
+
* @category mapping
|
|
46099
|
+
* @since 4.0.0
|
|
46100
|
+
*/
|
|
46101
|
+
const mapRequestEffect = /*#__PURE__*/ dual(2, (self, f) => makeWith(self.postprocess, (request) => flatMap$3(self.preprocess(request), f)));
|
|
46102
|
+
/**
|
|
45665
46103
|
* Retries common transient errors, such as rate limiting, timeouts or network issues.
|
|
45666
46104
|
*
|
|
45667
46105
|
* **When to use**
|
|
@@ -45695,6 +46133,77 @@ const retryTransient = /*#__PURE__*/ dual(2, (self, options) => {
|
|
|
45695
46133
|
times
|
|
45696
46134
|
})));
|
|
45697
46135
|
});
|
|
46136
|
+
/**
|
|
46137
|
+
* Fails requests that do not receive a response within the given duration.
|
|
46138
|
+
*
|
|
46139
|
+
* **When to use**
|
|
46140
|
+
*
|
|
46141
|
+
* Use to configure a timeout once on the client, for example when providing
|
|
46142
|
+
* the `HttpClient` service, while keeping the standard `HttpClientError` error
|
|
46143
|
+
* model.
|
|
46144
|
+
*
|
|
46145
|
+
* **Details**
|
|
46146
|
+
*
|
|
46147
|
+
* A timed out request is interrupted and fails with an `HttpClientError` whose
|
|
46148
|
+
* reason is a `TransportError` with a `Cause.TimeoutError` cause.
|
|
46149
|
+
* `retryTransient` treats it as transient. Interrupting a request aborts the
|
|
46150
|
+
* underlying transport, unless the request is attached to a scope with
|
|
46151
|
+
* `withScope`, in which case it stays open until the scope closes.
|
|
46152
|
+
*
|
|
46153
|
+
* The timer starts after request preprocessing and covers everything the
|
|
46154
|
+
* wrapped client does to produce a response. For a plain client this ends when
|
|
46155
|
+
* the response headers arrive, but response middleware applied before
|
|
46156
|
+
* `timeout`, such as `tap` or `retryTransient`, runs inside the budget,
|
|
46157
|
+
* including any body reads it performs. Composition order therefore decides
|
|
46158
|
+
* how it interacts with retries: applying `timeout` before `retryTransient`
|
|
46159
|
+
* gives each attempt its own budget, while applying it after bounds the whole
|
|
46160
|
+
* retry loop.
|
|
46161
|
+
*
|
|
46162
|
+
* **Gotchas**
|
|
46163
|
+
*
|
|
46164
|
+
* Body reads outside the timed client are not covered, including those made
|
|
46165
|
+
* by response middleware applied after `timeout` and by consumers of the
|
|
46166
|
+
* `HttpClient` service. Apply a separate timeout to body reads such as
|
|
46167
|
+
* `response.json` or `response.stream` when needed.
|
|
46168
|
+
*
|
|
46169
|
+
* **Example** (Timing out each attempt)
|
|
46170
|
+
*
|
|
46171
|
+
* ```ts
|
|
46172
|
+
* import { Effect, Layer } from "effect"
|
|
46173
|
+
* import { FetchHttpClient, HttpClient } from "effect/http"
|
|
46174
|
+
*
|
|
46175
|
+
* const TimedHttpClient = Layer.effect(
|
|
46176
|
+
* HttpClient.HttpClient,
|
|
46177
|
+
* Effect.map(
|
|
46178
|
+
* HttpClient.HttpClient,
|
|
46179
|
+
* HttpClient.timeout("5 seconds")
|
|
46180
|
+
* )
|
|
46181
|
+
* ).pipe(Layer.provide(FetchHttpClient.layer))
|
|
46182
|
+
*
|
|
46183
|
+
* const program = Effect.gen(function*() {
|
|
46184
|
+
* const client = (yield* HttpClient.HttpClient).pipe(
|
|
46185
|
+
* HttpClient.retryTransient({ times: 3 })
|
|
46186
|
+
* )
|
|
46187
|
+
* return yield* client.get("https://example.com")
|
|
46188
|
+
* }).pipe(Effect.provide(TimedHttpClient))
|
|
46189
|
+
* ```
|
|
46190
|
+
*
|
|
46191
|
+
* @stability unstable
|
|
46192
|
+
* @category error handling
|
|
46193
|
+
* @since 4.1.0
|
|
46194
|
+
*/
|
|
46195
|
+
const timeout = /*#__PURE__*/ dual(2, (self, duration) => {
|
|
46196
|
+
const decoded = fromInputUnsafe$1(duration);
|
|
46197
|
+
const description = `timed out after ${format$1(decoded)}`;
|
|
46198
|
+
return transform$1(self, (effect, request) => timeoutOrElse(effect, {
|
|
46199
|
+
duration: decoded,
|
|
46200
|
+
orElse: () => fail$6(new HttpClientError({ reason: new TransportError({
|
|
46201
|
+
request,
|
|
46202
|
+
cause: new TimeoutError(`Operation ${description}`),
|
|
46203
|
+
description
|
|
46204
|
+
}) }))
|
|
46205
|
+
}));
|
|
46206
|
+
});
|
|
45698
46207
|
const parseRetryAfter = (nowMillis, value) => {
|
|
45699
46208
|
if (value === void 0) return;
|
|
45700
46209
|
const retryAfter = parseRetryAfter$1(value);
|
|
@@ -47787,7 +48296,7 @@ function toBinaryASTStep(ast) {
|
|
|
47787
48296
|
const getJson = ast.annotations?.toCodecJson;
|
|
47788
48297
|
const getCodec = ast.annotations?.toCodec;
|
|
47789
48298
|
if (!isFunction(getJson) && !isFunction(getCodec)) return ast;
|
|
47790
|
-
const typeParameters = ast.typeParameters.map((tp) => make$
|
|
48299
|
+
const typeParameters = ast.typeParameters.map((tp) => make$50(toEncoded(tp)));
|
|
47791
48300
|
const link = (isFunction(getJson) ? getJson(typeParameters) : void 0) ?? (isFunction(getCodec) ? getCodec(typeParameters) : void 0);
|
|
47792
48301
|
return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, toBinaryAST)]);
|
|
47793
48302
|
}
|
|
@@ -50223,7 +50732,7 @@ function decodeValueUnchecked(layout, r) {
|
|
|
50223
50732
|
const value = r.zigzag();
|
|
50224
50733
|
const scale = r.zigzag();
|
|
50225
50734
|
if (scale > MAX_SAFE_BIGINT || -scale > MAX_SAFE_BIGINT) invalid("safe integer length", void 0, r.options);
|
|
50226
|
-
return make$
|
|
50735
|
+
return make$59(value, Number(scale));
|
|
50227
50736
|
}
|
|
50228
50737
|
case "json": {
|
|
50229
50738
|
const text = r.readUtf8(r.end - r.pos);
|
|
@@ -50338,7 +50847,7 @@ function compileMode(layout, fingerprint) {
|
|
|
50338
50847
|
return fingerprint === true ? fingerprintModeMemo(layout) : defaultMode;
|
|
50339
50848
|
}
|
|
50340
50849
|
const compileTargetFromAst = /*#__PURE__*/ memoize((ast) => {
|
|
50341
|
-
const raw = make$
|
|
50850
|
+
const raw = make$50(toBinaryAST(ast));
|
|
50342
50851
|
const { exact, exitSuccess, layout, recursive } = compileLayout(raw.ast);
|
|
50343
50852
|
return {
|
|
50344
50853
|
target: recursive ? withCycleGuard(raw) : raw,
|
|
@@ -50357,10 +50866,10 @@ function takeTrusted(trusted, input) {
|
|
|
50357
50866
|
return true;
|
|
50358
50867
|
}
|
|
50359
50868
|
function bypassPass(target, decodeAccept, encodeAccept) {
|
|
50360
|
-
const type = make$
|
|
50869
|
+
const type = make$50(toType$1(target.ast));
|
|
50361
50870
|
const parse = decodeUnknownEffect$1(type);
|
|
50362
50871
|
const run = (accept) => () => (input, _ast, options) => accept(input, options) ? sameExit : parse(input, options);
|
|
50363
|
-
return make$
|
|
50872
|
+
return make$50(new Declaration([type.ast], run(decodeAccept), { identifier: "binary value" }, void 0, void 0, void 0, void 0, run(encodeAccept)));
|
|
50364
50873
|
}
|
|
50365
50874
|
function reportsExcess(_input, options) {
|
|
50366
50875
|
return options.onExcessProperty !== "error";
|
|
@@ -50381,12 +50890,12 @@ function passThrough(target) {
|
|
|
50381
50890
|
return bypassPass(target, reportsExcess, reportsExcess);
|
|
50382
50891
|
}
|
|
50383
50892
|
function withCycleGuard(target) {
|
|
50384
|
-
const type = make$
|
|
50893
|
+
const type = make$50(toType$1(target.ast));
|
|
50385
50894
|
const decoded = /* @__PURE__ */ new WeakSet();
|
|
50386
50895
|
return decodeTo(declareConstructor()([type], ([type]) => (input, ast, options) => {
|
|
50387
50896
|
if (isObjectOrArray(input) && decoded.delete(input)) return succeed$5(input);
|
|
50388
50897
|
return isCyclic(input) ? fail$6(new InvalidType(ast, input, options)) : decodeUnknownEffect$1(type)(input, options);
|
|
50389
|
-
}, { identifier: "acyclic value" }), transform$
|
|
50898
|
+
}, { identifier: "acyclic value" }), transform$2({
|
|
50390
50899
|
decode: (value) => {
|
|
50391
50900
|
if (isObjectOrArray(value)) decoded.add(value);
|
|
50392
50901
|
return value;
|
|
@@ -50632,7 +51141,7 @@ const RpcGroupProto = {
|
|
|
50632
51141
|
});
|
|
50633
51142
|
},
|
|
50634
51143
|
annotateRpcs(service, value) {
|
|
50635
|
-
return this.annotateRpcsMerge(make$
|
|
51144
|
+
return this.annotateRpcsMerge(make$69(service, value));
|
|
50636
51145
|
},
|
|
50637
51146
|
annotateMerge(context) {
|
|
50638
51147
|
return makeProto({
|
|
@@ -50714,20 +51223,6 @@ const Service = () => (id, options) => {
|
|
|
50714
51223
|
ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
|
|
50715
51224
|
return ServiceClass;
|
|
50716
51225
|
};
|
|
50717
|
-
/**
|
|
50718
|
-
* Provides the client-side implementation for an RPC middleware service,
|
|
50719
|
-
* capturing the layer's environment and merging it into each middleware
|
|
50720
|
-
* invocation.
|
|
50721
|
-
*
|
|
50722
|
-
* @stability unstable
|
|
50723
|
-
* @category layers
|
|
50724
|
-
* @since 4.0.0
|
|
50725
|
-
*/
|
|
50726
|
-
const layerClient = (tag, service) => effectContext(gen(function* () {
|
|
50727
|
-
const services = (yield* context()).pipe(omit$1(Scope));
|
|
50728
|
-
const middleware = isEffect(service) ? yield* service : service;
|
|
50729
|
-
return makeUnsafe$9(/* @__PURE__ */ new Map([[`${tag.key}/Client`, (options) => updateContext(middleware(options), (requestContext) => merge$5(services, requestContext))]]));
|
|
50730
|
-
}));
|
|
50731
51226
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/http/FindMyWay/internal/queryString.js
|
|
50732
51227
|
/**
|
|
50733
51228
|
* @since 1.0.0
|
|
@@ -51731,7 +52226,7 @@ const stream$1 = (body, options) => {
|
|
|
51731
52226
|
* @category combinators
|
|
51732
52227
|
* @since 4.0.0
|
|
51733
52228
|
*/
|
|
51734
|
-
const setHeader = /*#__PURE__*/ dual(3, (self, key, value) => makeResponse(self, set$
|
|
52229
|
+
const setHeader = /*#__PURE__*/ dual(3, (self, key, value) => makeResponse(self, set$2(self.headers, key, value)));
|
|
51735
52230
|
/**
|
|
51736
52231
|
* Returns a response with the specified header removed.
|
|
51737
52232
|
*
|
|
@@ -52426,7 +52921,7 @@ const make$22 = /*#__PURE__*/ fnUntraced(function* (impl) {
|
|
|
52426
52921
|
const limit = bytesToRead === void 0 ? void 0 : offset + contentLength;
|
|
52427
52922
|
const start = yield* fileResponseNumber(offset, "offset");
|
|
52428
52923
|
const end = limit === void 0 ? void 0 : yield* fileResponseNumber(limit, "end");
|
|
52429
|
-
const headers = set$
|
|
52924
|
+
const headers = set$2(optionHeaders(options), "etag", toString$1(etag));
|
|
52430
52925
|
if (isSome(info.mtime)) headers["last-modified"] = info.mtime.value.toUTCString();
|
|
52431
52926
|
return impl.fileResponse(path, options?.status ?? 200, options?.statusText, headers, start, end, contentLength);
|
|
52432
52927
|
}),
|
|
@@ -52443,7 +52938,7 @@ const make$22 = /*#__PURE__*/ fnUntraced(function* (impl) {
|
|
|
52443
52938
|
});
|
|
52444
52939
|
const optionHeaders = (options) => {
|
|
52445
52940
|
const headers = options?.headers ? fromInput$1(options.headers) : empty$7;
|
|
52446
|
-
return options?.contentType ? set$
|
|
52941
|
+
return options?.contentType ? set$2(headers, "content-type", options.contentType) : headers;
|
|
52447
52942
|
};
|
|
52448
52943
|
const fileResponseSize = (input, field) => {
|
|
52449
52944
|
const size = fromInput$2(input);
|
|
@@ -53529,7 +54024,7 @@ const isMultipartError = (u) => hasProperty(u, MultipartErrorTypeId);
|
|
|
53529
54024
|
* @since 4.0.0
|
|
53530
54025
|
*/
|
|
53531
54026
|
const makeConfig = (headers) => withFiber((fiber) => {
|
|
53532
|
-
const mimeTypes = get$
|
|
54027
|
+
const mimeTypes = get$11(fiber.context, FieldMimeTypes);
|
|
53533
54028
|
return succeed$5({
|
|
53534
54029
|
headers,
|
|
53535
54030
|
maxParts: fiber.getRef(MaxParts),
|
|
@@ -54557,7 +55052,7 @@ var MiddlewareImpl = class MiddlewareImpl {
|
|
|
54557
55052
|
const stack = [getOrUndefinedUnsafe(context$3, fnContextKey)];
|
|
54558
55053
|
if (this.dependencies) {
|
|
54559
55054
|
const memoMap = yield* CurrentMemoMap;
|
|
54560
|
-
const scope = get$
|
|
55055
|
+
const scope = get$11(context$3, Scope);
|
|
54561
55056
|
const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope);
|
|
54562
55057
|
stack.push(...getMiddleware(depsContext));
|
|
54563
55058
|
}
|
|
@@ -54612,9 +55107,9 @@ const serve = (appLayer, options) => {
|
|
|
54612
55107
|
const layerWithRouter = provideMerge(appLayer, options?.routerConfig ? provide$2(layer$18, succeed$6(RouterConfig)(options.routerConfig)) : layer$18);
|
|
54613
55108
|
return contextWith((context) => {
|
|
54614
55109
|
const memoMap = CurrentMemoMap.forkOrCreate(context);
|
|
54615
|
-
return buildWithMemoMap(layerWithRouter, memoMap, get$
|
|
55110
|
+
return buildWithMemoMap(layerWithRouter, memoMap, get$11(context, Scope));
|
|
54616
55111
|
}).pipe(map$6((context) => {
|
|
54617
|
-
const handler = get$
|
|
55112
|
+
const handler = get$11(context, HttpRouter).asHttpEffect();
|
|
54618
55113
|
return merge$4(middleware ? serve$1(handler, middleware) : serve$1(handler), succeedContext(context));
|
|
54619
55114
|
}), unwrap$8, options?.disableListenLog ? identity : withLogAddress);
|
|
54620
55115
|
};
|
|
@@ -54651,9 +55146,9 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
54651
55146
|
const concurrency = options.concurrency ?? "unbounded";
|
|
54652
55147
|
const disableFatalDefects = options.disableFatalDefects ?? false;
|
|
54653
55148
|
const services = yield* context();
|
|
54654
|
-
const scope = get$
|
|
55149
|
+
const scope = get$11(services, Scope);
|
|
54655
55150
|
const trackFiber = runIn(forkUnsafe(scope, "parallel"));
|
|
54656
|
-
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$
|
|
55151
|
+
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$60(concurrency);
|
|
54657
55152
|
const clients = /* @__PURE__ */ new Map();
|
|
54658
55153
|
let isShutdown = false;
|
|
54659
55154
|
const shutdownLatch = makeUnsafe$3(false);
|
|
@@ -54892,7 +55387,7 @@ const rpcCodecs = (codecFor, rpc) => {
|
|
|
54892
55387
|
let codecs = shared ? sharedRpcCodecs.get(rpc) : void 0;
|
|
54893
55388
|
if (codecs === void 0) {
|
|
54894
55389
|
const streamSchemas = getStreamSchemas(rpc.successSchema);
|
|
54895
|
-
const parseOptions = get$
|
|
55390
|
+
const parseOptions = get$11(rpc.annotations, ParseOptions);
|
|
54896
55391
|
codecs = {
|
|
54897
55392
|
decode: decodeUnknownEffect(codecFor(rpc.payloadSchema), parseOptions),
|
|
54898
55393
|
encodeChunk: encodeUnknownEffect(codecFor(NonEmptyArray(isSome(streamSchemas) ? streamSchemas.value.success : Any)), parseOptions),
|
|
@@ -54956,7 +55451,7 @@ const make$14 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
|
54956
55451
|
const { codecFor, disconnects, end, run, send, supportsAck, supportsSpanPropagation, supportsTransferables } = yield* Protocol;
|
|
54957
55452
|
const { encodeDefectUnsafe, encodeUnknownRequestExit } = defectCodecs(codecFor);
|
|
54958
55453
|
const services = yield* context();
|
|
54959
|
-
const scope = yield* make$
|
|
55454
|
+
const scope = yield* make$65();
|
|
54960
55455
|
const server = yield* makeNoSerialization(group, {
|
|
54961
55456
|
...options,
|
|
54962
55457
|
disableClientAcks: !supportsAck,
|
|
@@ -55017,7 +55512,7 @@ const make$14 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
|
55017
55512
|
const exitSchema$1 = exitSchema(rpc);
|
|
55018
55513
|
discardSchemas = {
|
|
55019
55514
|
...schemas,
|
|
55020
|
-
encodeExit: encodeUnknownEffect(codecFor(Exit(Void, exitSchema$1.error, exitSchema$1.defect)), get$
|
|
55515
|
+
encodeExit: encodeUnknownEffect(codecFor(Exit(Void, exitSchema$1.error, exitSchema$1.defect)), get$11(rpc.annotations, ParseOptions))
|
|
55021
55516
|
};
|
|
55022
55517
|
discardSchemasCache.set(rpc, discardSchemas);
|
|
55023
55518
|
}
|
|
@@ -55232,7 +55727,7 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
|
|
|
55232
55727
|
const { encodeDefectUnsafe } = defectCodecs(serialization.codecFor);
|
|
55233
55728
|
const includesFraming = serialization.includesFraming;
|
|
55234
55729
|
const isBinary = !serialization.contentType.includes("json");
|
|
55235
|
-
const disconnects = yield* make$
|
|
55730
|
+
const disconnects = yield* make$62();
|
|
55236
55731
|
let writeRequest;
|
|
55237
55732
|
let clientId = 0;
|
|
55238
55733
|
const clients = /* @__PURE__ */ new Map();
|
|
@@ -55245,7 +55740,7 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
|
|
|
55245
55740
|
const requestHeaders = Object.entries(request.headers);
|
|
55246
55741
|
const data = yield* orDie$2(isBinary ? map$6(request.arrayBuffer, (buf) => new Uint8Array(buf)) : request.text);
|
|
55247
55742
|
const id = clientId++;
|
|
55248
|
-
const queue = yield* make$
|
|
55743
|
+
const queue = yield* make$62({ capacity: includesFraming && options.streamBufferSize !== "unbounded" ? options.streamBufferSize ?? 16 : void 0 });
|
|
55249
55744
|
const parser = serialization.makeUnsafe();
|
|
55250
55745
|
const requestIds = [];
|
|
55251
55746
|
const offer$1 = (data) => typeof data === "string" ? offer(queue, encoder.encode(data)) : offer(queue, data);
|
|
@@ -55350,7 +55845,7 @@ const layerProtocolHttp = (options) => {
|
|
|
55350
55845
|
const makeSocketProtocol = /*#__PURE__*/ gen(function* () {
|
|
55351
55846
|
const serialization = yield* RpcSerialization;
|
|
55352
55847
|
const { encodeDefectUnsafe } = defectCodecs(serialization.codecFor);
|
|
55353
|
-
const disconnects = yield* make$
|
|
55848
|
+
const disconnects = yield* make$62();
|
|
55354
55849
|
let clientId = 0;
|
|
55355
55850
|
const clients = /* @__PURE__ */ new Map();
|
|
55356
55851
|
const clientIds = /* @__PURE__ */ new Set();
|
|
@@ -55767,7 +56262,7 @@ const parseTemplate$1 = (texts, values) => {
|
|
|
55767
56262
|
const endWord = () => {
|
|
55768
56263
|
if (word.length === 0) return;
|
|
55769
56264
|
const value = word.map(unwrap$2).join("");
|
|
55770
|
-
words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make$
|
|
56265
|
+
words.push(word.length === 1 && isRedacted(word[0]) ? word[0] : word.some(isRedacted) ? make$55(value) : value);
|
|
55771
56266
|
word = [];
|
|
55772
56267
|
plain = true;
|
|
55773
56268
|
braceDepth = 0;
|
|
@@ -56231,7 +56726,7 @@ const fromReadableChannel = (options) => fromTransform$1((_, scope) => readableT
|
|
|
56231
56726
|
*/
|
|
56232
56727
|
const fromDuplex$1 = (options) => fromTransform$1((upstream, scope) => {
|
|
56233
56728
|
const duplex = options.evaluate();
|
|
56234
|
-
const exit = make$
|
|
56729
|
+
const exit = make$48(void 0);
|
|
56235
56730
|
const latch = makeUnsafe$3(false);
|
|
56236
56731
|
return pullIntoWritable({
|
|
56237
56732
|
pull: upstream,
|
|
@@ -56342,7 +56837,7 @@ const readableToPullUnsafe = (options) => {
|
|
|
56342
56837
|
const readable = options.readable;
|
|
56343
56838
|
const chunkSize = options.chunkSize ?? 4096;
|
|
56344
56839
|
const closeOnDone = options.closeOnDone ?? true;
|
|
56345
|
-
const exit = options.exit ?? make$
|
|
56840
|
+
const exit = options.exit ?? make$48(void 0);
|
|
56346
56841
|
const latch = options.latch ?? makeUnsafe$3(false);
|
|
56347
56842
|
function onReadable() {
|
|
56348
56843
|
latch.openUnsafe();
|
|
@@ -61426,7 +61921,7 @@ const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
|
61426
61921
|
resume(fail$6(handleBadArgument("writeFile")(err)));
|
|
61427
61922
|
}
|
|
61428
61923
|
});
|
|
61429
|
-
const makeFileSystem = /*#__PURE__*/ map$6(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$
|
|
61924
|
+
const makeFileSystem = /*#__PURE__*/ map$6(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$42({
|
|
61430
61925
|
access,
|
|
61431
61926
|
chmod,
|
|
61432
61927
|
chown,
|
|
@@ -62662,7 +63157,7 @@ const fileUrlOps = (windows) => ({
|
|
|
62662
63157
|
* @category layers
|
|
62663
63158
|
* @since 4.0.0
|
|
62664
63159
|
*/
|
|
62665
|
-
const layer$9 = /* @__PURE__ */ succeed$6(Path$1)(/*#__PURE__*/ make$
|
|
63160
|
+
const layer$9 = /* @__PURE__ */ succeed$6(Path$1)(/*#__PURE__*/ make$41({
|
|
62666
63161
|
...Path,
|
|
62667
63162
|
.../*#__PURE__*/ fileUrlOps(void 0)
|
|
62668
63163
|
}));
|
|
@@ -62733,7 +63228,7 @@ const layer$7 = /* @__PURE__ */ succeed$6(Stdio, /*#__PURE__*/ make$33({
|
|
|
62733
63228
|
const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
|
|
62734
63229
|
const stdin = process.stdin;
|
|
62735
63230
|
const stdout = process.stdout;
|
|
62736
|
-
const lines = yield* make$
|
|
63231
|
+
const lines = yield* make$62();
|
|
62737
63232
|
let inputEnded = stdin.readableEnded;
|
|
62738
63233
|
let readlineActive = false;
|
|
62739
63234
|
const onStdinEnd = () => {
|
|
@@ -62742,7 +63237,7 @@ const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
62742
63237
|
};
|
|
62743
63238
|
stdin.once("end", onStdinEnd);
|
|
62744
63239
|
yield* addFinalizer(() => sync(() => stdin.off("end", onStdinEnd)));
|
|
62745
|
-
const rlRef = yield* make$
|
|
63240
|
+
const rlRef = yield* make$44({
|
|
62746
63241
|
acquire: acquireRelease(sync(() => {
|
|
62747
63242
|
const rl = readline.createInterface({
|
|
62748
63243
|
input: stdin,
|
|
@@ -62774,7 +63269,7 @@ const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
62774
63269
|
const setRawMode = (enabled) => sync(() => {
|
|
62775
63270
|
if (stdin.isTTY) stdin.setRawMode(enabled);
|
|
62776
63271
|
});
|
|
62777
|
-
const rawModeRef = yield* make$
|
|
63272
|
+
const rawModeRef = yield* make$44({
|
|
62778
63273
|
acquire: acquireRelease(setRawMode(true), () => setRawMode(false)),
|
|
62779
63274
|
idleTimeToLive: "10 millis"
|
|
62780
63275
|
});
|
|
@@ -62795,7 +63290,7 @@ const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
62795
63290
|
return queue;
|
|
62796
63291
|
});
|
|
62797
63292
|
const readInput = gen(function* () {
|
|
62798
|
-
const queue = yield* make$
|
|
63293
|
+
const queue = yield* make$62();
|
|
62799
63294
|
const handleKeypress = (s, k) => {
|
|
62800
63295
|
const userInput = {
|
|
62801
63296
|
input: fromUndefinedOr(s),
|
|
@@ -62822,14 +63317,14 @@ const layer$6 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
62822
63317
|
stdin.on("keypress", handleKeypress);
|
|
62823
63318
|
if (inputEnded) handleEnd();
|
|
62824
63319
|
else {
|
|
62825
|
-
yield* get$
|
|
62826
|
-
yield* get$
|
|
63320
|
+
yield* get$5(rlRef);
|
|
63321
|
+
yield* get$5(rawModeRef);
|
|
62827
63322
|
stdin.once("end", handleEnd);
|
|
62828
63323
|
}
|
|
62829
63324
|
return queue;
|
|
62830
63325
|
});
|
|
62831
63326
|
const readLine = suspend$2(() => poll(lines).pipe(flatMap$3(match$8({
|
|
62832
|
-
onNone: () => scoped(andThen(get$
|
|
63327
|
+
onNone: () => scoped(andThen(get$5(rlRef), take(lines))),
|
|
62833
63328
|
onSome: succeed$5
|
|
62834
63329
|
})), mapError$2(() => new QuitError({}))));
|
|
62835
63330
|
const display = (prompt) => uninterruptible(callback$1((resume) => {
|
|
@@ -64922,7 +65417,7 @@ const map$2 = /*#__PURE__*/ dual(2, (self, f) => flatMap(self, (a) => succeed(f(
|
|
|
64922
65417
|
* @category constructors
|
|
64923
65418
|
* @since 4.0.0
|
|
64924
65419
|
*/
|
|
64925
|
-
const Password = (options) => basePrompt(options, "password").pipe(map$2(make$
|
|
65420
|
+
const Password = (options) => basePrompt(options, "password").pipe(map$2(make$55));
|
|
64926
65421
|
/**
|
|
64927
65422
|
* Runs a prompt by reading terminal input and rendering prompt frames until the
|
|
64928
65423
|
* prompt submits a value.
|
|
@@ -66946,7 +67441,7 @@ const Formatter = /*#__PURE__*/ Reference("effect/cli/CliOutput", { defaultValue
|
|
|
66946
67441
|
*/
|
|
66947
67442
|
const defaultPresenter = { present: /*#__PURE__*/ fnUntraced(function* (event) {
|
|
66948
67443
|
const context$2 = yield* context();
|
|
66949
|
-
const formatter = getOrUndefined(context$2, Formatter) ?? defaultFormatter({ colors: get$
|
|
67444
|
+
const formatter = getOrUndefined(context$2, Formatter) ?? defaultFormatter({ colors: get$11(context$2, TerminalCapabilities).canColor });
|
|
66950
67445
|
switch (event._tag) {
|
|
66951
67446
|
case "Help": return yield* log(formatter.formatHelpDoc(event.helpDoc));
|
|
66952
67447
|
case "InvalidInvocation":
|
|
@@ -69341,7 +69836,7 @@ const defaults = { builtIns: BuiltIns };
|
|
|
69341
69836
|
*
|
|
69342
69837
|
* @internal
|
|
69343
69838
|
*/
|
|
69344
|
-
const resolveFormatter = /*#__PURE__*/ contextWith((context) => succeed$5(getOrUndefined(context, Formatter) ?? defaultFormatter({ colors: get$
|
|
69839
|
+
const resolveFormatter = /*#__PURE__*/ contextWith((context) => succeed$5(getOrUndefined(context, Formatter) ?? defaultFormatter({ colors: get$11(context, TerminalCapabilities).canColor })));
|
|
69345
69840
|
// ../../node_modules/.pnpm/effect@4.1.2/node_modules/effect/dist/cli/internal/lexer.js
|
|
69346
69841
|
/**
|
|
69347
69842
|
* @internal
|
|
@@ -70810,7 +71305,7 @@ const runWith = (command, config) => {
|
|
|
70810
71305
|
}
|
|
70811
71306
|
const services = match$8(logLevel, {
|
|
70812
71307
|
onNone: () => empty$14(),
|
|
70813
|
-
onSome: (level) => make$
|
|
71308
|
+
onSome: (level) => make$69(MinimumLogLevel, level)
|
|
70814
71309
|
});
|
|
70815
71310
|
yield* provideContext$2(program, services);
|
|
70816
71311
|
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$9(error) : fail$11(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail$6(error))), catchFilter((error) => {
|
|
@@ -71210,7 +71705,7 @@ const Port = String$6.check(isPattern(/^\d{1,5}$/u), makeFilter((value) => exist
|
|
|
71210
71705
|
const AppVersion = String$6.check(isPattern(/^0\.1\.\d+$/u));
|
|
71211
71706
|
const RUNTIME_PATH = "/api/runtime";
|
|
71212
71707
|
const RuntimeConfig = Struct({
|
|
71213
|
-
auth: optionalKey(
|
|
71708
|
+
auth: optionalKey(Origin),
|
|
71214
71709
|
name: String$6,
|
|
71215
71710
|
traces: String$6,
|
|
71216
71711
|
version: AppVersion
|
|
@@ -71328,17 +71823,17 @@ const layerFlusher = /*#__PURE__*/ sync$1(Flusher, () => {
|
|
|
71328
71823
|
*/
|
|
71329
71824
|
const make$3 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
71330
71825
|
const services = yield* context();
|
|
71331
|
-
const clock = get$
|
|
71332
|
-
const scope = get$
|
|
71826
|
+
const clock = get$11(services, Clock);
|
|
71827
|
+
const scope = get$11(services, Scope);
|
|
71333
71828
|
const exportInterval = max(fromInputUnsafe$1(options.exportInterval), zero$2);
|
|
71334
|
-
const client = get$
|
|
71829
|
+
const client = get$11(services, HttpClient).pipe(tap((response) => ignore$1(response.arrayBuffer)), tapError((error) => error.response ? ignore$1(error.response.arrayBuffer) : void_$1), filterStatusOk, transformResponse(provideService(TracerPropagationEnabled, false)), retryTransient({
|
|
71335
71830
|
schedule: policy,
|
|
71336
71831
|
times: 3
|
|
71337
71832
|
}));
|
|
71338
71833
|
const exporterUserAgent = `OTel-OTLP-Exporter-JavaScript-Effect-${options.label}/${getCurrentVersion()}`;
|
|
71339
71834
|
const userHeaders = fromInput$1(options.headers);
|
|
71340
71835
|
const userAgent = userHeaders["user-agent"];
|
|
71341
|
-
const headers = set$
|
|
71836
|
+
const headers = set$2(userHeaders, "user-agent", userAgent ? `${userAgent} ${exporterUserAgent}` : exporterUserAgent);
|
|
71342
71837
|
const request = post(options.url, { headers });
|
|
71343
71838
|
const exportsEmpty = options.maxBatchSize === "disabled" && options.exportEmpty === true;
|
|
71344
71839
|
let buffer = [];
|
|
@@ -71365,15 +71860,15 @@ const make$3 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
71365
71860
|
package: "@effect/opentelemetry",
|
|
71366
71861
|
module: options.label
|
|
71367
71862
|
}));
|
|
71368
|
-
const exportFibers = yield* make$
|
|
71863
|
+
const exportFibers = yield* make$38();
|
|
71369
71864
|
const runExportFork = yield* runtime(exportFibers)();
|
|
71370
71865
|
yield* addFinalizer$1(scope, suspend$2(() => {
|
|
71371
71866
|
if (disabledUntil !== void 0) return void_$1;
|
|
71372
71867
|
runExportFork(runExport);
|
|
71373
71868
|
return awaitEmpty(exportFibers);
|
|
71374
71869
|
}).pipe(ignore$1, interruptible, timeoutOption(options.shutdownTimeout)));
|
|
71375
|
-
const armed = yield* make$
|
|
71376
|
-
const wake = yield* make$
|
|
71870
|
+
const armed = yield* make$49(exportsEmpty);
|
|
71871
|
+
const wake = yield* make$49();
|
|
71377
71872
|
const disarmIfEmpty = sync(() => {
|
|
71378
71873
|
if (exportsEmpty || buffer.length > 0 || !armed.closeUnsafe()) return;
|
|
71379
71874
|
wake.openUnsafe();
|
|
@@ -71620,7 +72115,7 @@ const make$1 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
71620
72115
|
excludeLogSpans: options.excludeLogSpans ?? false,
|
|
71621
72116
|
clock: yield* Clock
|
|
71622
72117
|
};
|
|
71623
|
-
return make$
|
|
72118
|
+
return make$37((options) => {
|
|
71624
72119
|
exporter.push(makeLogRecord(options, opts));
|
|
71625
72120
|
});
|
|
71626
72121
|
});
|
|
@@ -71745,7 +72240,7 @@ const layer = /*#__PURE__*/ flow(/* @__PURE__ */ fnUntraced(function* (options)
|
|
|
71745
72240
|
if (!span.sampled) return;
|
|
71746
72241
|
exporter.push(makeOtlpSpan(span));
|
|
71747
72242
|
}
|
|
71748
|
-
return make$
|
|
72243
|
+
return make$66({
|
|
71749
72244
|
span(options) {
|
|
71750
72245
|
return new SpanImpl(options, exportFn);
|
|
71751
72246
|
},
|
|
@@ -71910,8 +72405,9 @@ const SpanKind = {
|
|
|
71910
72405
|
};
|
|
71911
72406
|
// ../../packages/runtime/src/telemetry.ts
|
|
71912
72407
|
function layerOtlp(serviceName, url, runtime, version) {
|
|
71913
|
-
return unwrap$8(gen(function* () {
|
|
72408
|
+
return pipe(unwrap$8(gen(function* () {
|
|
71914
72409
|
const start = `${yield* currentTimeNanos}`;
|
|
72410
|
+
const redacted = yield* CurrentRedactedNames;
|
|
71915
72411
|
const resource = {
|
|
71916
72412
|
attributes: {
|
|
71917
72413
|
"scope.run.started_unix_nano": start,
|
|
@@ -71922,14 +72418,28 @@ function layerOtlp(serviceName, url, runtime, version) {
|
|
|
71922
72418
|
serviceVersion: getOrUndefined$1(liftPredicate(version, (current) => current !== "0.1.0"))
|
|
71923
72419
|
};
|
|
71924
72420
|
return pipe(mergeAll$1(layer({
|
|
71925
|
-
exportInterval: "250 millis",
|
|
71926
72421
|
resource,
|
|
71927
72422
|
url: new URL("/v1/traces", url).href
|
|
71928
72423
|
}), layer$1({
|
|
71929
|
-
exportInterval: "250 millis",
|
|
71930
72424
|
resource,
|
|
71931
72425
|
url: new URL("/v1/logs", url).href
|
|
71932
|
-
})
|
|
72426
|
+
}), succeed$6(CurrentRedactedNames)([
|
|
72427
|
+
...redacted,
|
|
72428
|
+
"code",
|
|
72429
|
+
"state",
|
|
72430
|
+
"request",
|
|
72431
|
+
"access_token",
|
|
72432
|
+
"refresh_token",
|
|
72433
|
+
"id_token",
|
|
72434
|
+
"client_secret",
|
|
72435
|
+
"client_assertion",
|
|
72436
|
+
"code_verifier",
|
|
72437
|
+
"session",
|
|
72438
|
+
"token"
|
|
72439
|
+
])), provide$2([layerJson, layer$12]));
|
|
72440
|
+
})), catchCause$2((cause) => {
|
|
72441
|
+
if (hasInterrupts(cause)) return effectDiscard(interrupt$1);
|
|
72442
|
+
return effectDiscard(logWarning("Telemetry is unavailable"));
|
|
71933
72443
|
}));
|
|
71934
72444
|
}
|
|
71935
72445
|
// ../../packages/runtime/src/auth/lib/utils.ts
|
|
@@ -71946,12 +72456,77 @@ gen(function* () {
|
|
|
71946
72456
|
if (yield* localAuth) return yield* withDefault$2(listed, ["0"]);
|
|
71947
72457
|
return yield* listed;
|
|
71948
72458
|
});
|
|
72459
|
+
function failureOptions(error, status) {
|
|
72460
|
+
if (is$3(AuthError)(error) && error.error === "temporarily_unavailable") return {
|
|
72461
|
+
headers: { "retry-after": "5" },
|
|
72462
|
+
status: 503
|
|
72463
|
+
};
|
|
72464
|
+
return { status };
|
|
72465
|
+
}
|
|
71949
72466
|
var CurrentUser = class extends Service$1()("@deslop/runtime/auth/lib/utils/CurrentUser") {};
|
|
71950
|
-
var RpcAuth = class
|
|
71951
|
-
|
|
71952
|
-
|
|
71953
|
-
|
|
71954
|
-
|
|
72467
|
+
var RpcAuth = class extends Service()("@deslop/runtime/auth/lib/utils/RpcAuth", { error: AuthError }) {};
|
|
72468
|
+
Literals([
|
|
72469
|
+
"anthropic",
|
|
72470
|
+
"openrouter",
|
|
72471
|
+
"opencode-zen",
|
|
72472
|
+
"opencode-go"
|
|
72473
|
+
]);
|
|
72474
|
+
// ../../packages/runtime/src/ai/service.ts
|
|
72475
|
+
var AiUnavailable = class extends TaggedError()("AiUnavailable", { message: String$6 }) {};
|
|
72476
|
+
fromJsonString(Struct({ error: Struct({ message: String$6 }) }));
|
|
72477
|
+
var AiGateway = class AiGateway extends Service$1()("@deslop/runtime/ai/service/AiGateway") {
|
|
72478
|
+
static layer = effect(this, gen(function* () {
|
|
72479
|
+
const gateway = yield* option(String$5("GATEWAY_URL"));
|
|
72480
|
+
const local = yield* localAuth;
|
|
72481
|
+
const app = yield* String$5("APP_URL");
|
|
72482
|
+
const client = yield* HttpClient;
|
|
72483
|
+
const store = toSchemaStore(yield* KeyValueStore, Record$1(String$6, RedactedFromValue(String$6)));
|
|
72484
|
+
const grants = yield* make$36(getOrElse(yield* store.get("ai-gateway-grants"), () => ({})));
|
|
72485
|
+
const lock = yield* make$60(1);
|
|
72486
|
+
return AiGateway.of({
|
|
72487
|
+
apiUrl: (provider) => match$8(gateway, {
|
|
72488
|
+
onNone: () => fail$6(AiUnavailable.make({ message: "Start the app with --gateway" })),
|
|
72489
|
+
onSome: (url) => succeed$5(`${url}/ai/${provider}${match$1(provider === "openrouter", {
|
|
72490
|
+
onFalse: () => "",
|
|
72491
|
+
onTrue: () => "/v1"
|
|
72492
|
+
})}`)
|
|
72493
|
+
}),
|
|
72494
|
+
authorize: (userId) => (http) => pipe(mapRequestEffect(http, (request) => gen(function* () {
|
|
72495
|
+
if (local) return request;
|
|
72496
|
+
const token = (yield* get$4(grants))[userId];
|
|
72497
|
+
if (token === void 0) return yield* new HttpClientError({ reason: new TransportError({
|
|
72498
|
+
description: "AI access is unavailable; sign in again to enroll with Gateway",
|
|
72499
|
+
request
|
|
72500
|
+
}) });
|
|
72501
|
+
return setHeader$1(request, "authorization", `Bearer ${value(token)}`);
|
|
72502
|
+
})), tap((response) => pipe(gen(function* () {
|
|
72503
|
+
if (local || response.headers["x-gateway-grant-refused"] === void 0 || !exists(gateway, (url) => startsWith(`${url}/ai/`)(response.request.url))) return;
|
|
72504
|
+
const current = yield* get$4(grants);
|
|
72505
|
+
const token = current[userId];
|
|
72506
|
+
if (token === void 0 || response.request.headers["authorization"] !== `Bearer ${value(token)}`) return;
|
|
72507
|
+
const next = remove$4(current, userId);
|
|
72508
|
+
yield* pipe(store.set("ai-gateway-grants", next), ignore$1({
|
|
72509
|
+
log: "Warn",
|
|
72510
|
+
message: "The rejected AI grant could not be removed from storage"
|
|
72511
|
+
}));
|
|
72512
|
+
yield* set(grants, next);
|
|
72513
|
+
}), withPermit(lock)))),
|
|
72514
|
+
enroll: fnUntraced(function* (userId, headers) {
|
|
72515
|
+
return yield* pipe(gen(function* () {
|
|
72516
|
+
if (local || isNone(gateway) || (yield* get$4(grants))[userId] !== void 0) return;
|
|
72517
|
+
const response = yield* client.execute(yield* bodyJson(post(`${getOrElse(gateway, () => "")}/ai/grants`, { headers: match$1(headers["authorization"] !== void 0, {
|
|
72518
|
+
onFalse: () => ({ cookie: headers["cookie"] ?? "" }),
|
|
72519
|
+
onTrue: () => ({ authorization: headers["authorization"] })
|
|
72520
|
+
}) }), { app }));
|
|
72521
|
+
const result = yield* schemaBodyJson(Struct({ token: String$6 }))(response);
|
|
72522
|
+
const next = {
|
|
72523
|
+
...yield* get$4(grants),
|
|
72524
|
+
[userId]: make$55(result.token)
|
|
72525
|
+
};
|
|
72526
|
+
yield* store.set("ai-gateway-grants", next);
|
|
72527
|
+
yield* set(grants, next);
|
|
72528
|
+
}), withPermit(lock), timeout$1("10 seconds"), catch_$1(() => logWarning("AI Gateway enrollment failed")));
|
|
72529
|
+
})
|
|
71955
72530
|
});
|
|
71956
72531
|
}));
|
|
71957
72532
|
};
|
|
@@ -71973,12 +72548,21 @@ function rejected(message) {
|
|
|
71973
72548
|
function developer() {
|
|
71974
72549
|
return succeed$5(DEVELOPER);
|
|
71975
72550
|
}
|
|
72551
|
+
function enrolled(user, headers) {
|
|
72552
|
+
return gen(function* () {
|
|
72553
|
+
const gateway = getOrUndefined(yield* context(), AiGateway);
|
|
72554
|
+
if (gateway !== void 0) yield* gateway.enroll(user.id, headers);
|
|
72555
|
+
});
|
|
72556
|
+
}
|
|
71976
72557
|
const unavailable = text$2("The authorization service is temporarily unavailable; retry later", {
|
|
71977
72558
|
headers: { "retry-after": "5" },
|
|
71978
72559
|
status: 503
|
|
71979
72560
|
});
|
|
71980
72561
|
var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
|
|
71981
|
-
static makeContext = (auth) => pipe(make$
|
|
72562
|
+
static makeContext = (auth) => pipe(make$69(Auth, auth), add$2(RpcAuth, RpcAuth.of((effect, request) => pipe(auth.user(request.headers), tap$1((user) => enrolled(user, request.headers)), tap$1(() => {
|
|
72563
|
+
if (isStreamSchema(request.rpc.successSchema)) return annotateCurrentSpan("rpc.stream", true);
|
|
72564
|
+
return void_$1;
|
|
72565
|
+
}), flatMap$3((user) => raceFirst(provideService(effect, CurrentUser, user), pipe(delay(auth.user(request.headers), "5 minutes"), retry({ while: (error) => error.error === "temporarily_unavailable" }), forever)))))));
|
|
71982
72566
|
static layer = effectContext(gen(function* () {
|
|
71983
72567
|
if (yield* localAuth) return Auth.makeContext(Auth.of({
|
|
71984
72568
|
access: developer,
|
|
@@ -71991,13 +72575,13 @@ var Auth = class Auth extends Service$1()("@deslop/runtime/auth/service/Auth") {
|
|
|
71991
72575
|
return yield* pipe(client.get(new URL(VERIFY_PATH, issuer).href, {
|
|
71992
72576
|
headers: { authorization: headers["authorization"] ?? "" },
|
|
71993
72577
|
urlParams: { resource: audience }
|
|
71994
|
-
}), flatMap$3(schemaBodyJson(User)), timeout("10 seconds"));
|
|
72578
|
+
}), flatMap$3(schemaBodyJson(User)), timeout$1("10 seconds"));
|
|
71995
72579
|
}, rejected("Sign in first"));
|
|
71996
72580
|
return Auth.makeContext(Auth.of({
|
|
71997
72581
|
access,
|
|
71998
72582
|
user: fn("Auth.user")(function* (headers) {
|
|
71999
|
-
if (isSome(get$
|
|
72000
|
-
return yield* pipe(client.get(new URL(SESSION_PATH, issuer).href, { headers: { cookie: headers["cookie"] ?? "" } }), flatMap$3(schemaBodyJson(User)), timeout("10 seconds"));
|
|
72583
|
+
if (isSome(get$7(headers, "authorization"))) return yield* access(headers, canonical);
|
|
72584
|
+
return yield* pipe(client.get(new URL(SESSION_PATH, issuer).href, { headers: { cookie: headers["cookie"] ?? "" } }), flatMap$3(schemaBodyJson(User)), timeout$1("10 seconds"));
|
|
72001
72585
|
}, rejected("Sign in first"))
|
|
72002
72586
|
}));
|
|
72003
72587
|
}));
|
|
@@ -72010,6 +72594,7 @@ middleware()(gen(function* () {
|
|
|
72010
72594
|
if (user.failure.error === "temporarily_unavailable") return unavailable;
|
|
72011
72595
|
return text$2("Sign in first", { status: 401 });
|
|
72012
72596
|
}
|
|
72597
|
+
yield* enrolled(user.success, (yield* HttpServerRequest).headers);
|
|
72013
72598
|
return yield* provideService(app, CurrentUser, user.success);
|
|
72014
72599
|
});
|
|
72015
72600
|
}));
|
|
@@ -72044,7 +72629,7 @@ const dataDirectory = gen(function* () {
|
|
|
72044
72629
|
});
|
|
72045
72630
|
return directory;
|
|
72046
72631
|
});
|
|
72047
|
-
fnUntraced(function* (name) {
|
|
72632
|
+
const tool = fnUntraced(function* (name) {
|
|
72048
72633
|
const fs = yield* FileSystem;
|
|
72049
72634
|
const path = yield* Path$1;
|
|
72050
72635
|
const version = (yield* packageMetadata).version;
|
|
@@ -72061,6 +72646,9 @@ fnUntraced(function* (name) {
|
|
|
72061
72646
|
yield* forEach$1(filter$4(yield* fs.readDirectory(tools), (entry) => entry !== version), (entry) => fs.remove(path.join(tools, entry), { recursive: true }), { concurrency: 1 });
|
|
72062
72647
|
return target;
|
|
72063
72648
|
});
|
|
72649
|
+
var ToolPath = class extends Service$1()("@deslop/runtime/server/ToolPath") {
|
|
72650
|
+
static layer = succeed$6(this, tool);
|
|
72651
|
+
};
|
|
72064
72652
|
const guard = make$17((app) => gen(function* () {
|
|
72065
72653
|
const request = yield* HttpServerRequest;
|
|
72066
72654
|
const host = request.headers["host"] ?? "";
|
|
@@ -72077,7 +72665,7 @@ function layerKeyValueStore(directory) {
|
|
|
72077
72665
|
const base = yield* KeyValueStore;
|
|
72078
72666
|
const fs = yield* FileSystem;
|
|
72079
72667
|
const path = yield* Path$1;
|
|
72080
|
-
const writes = yield* make$
|
|
72668
|
+
const writes = yield* make$60(1);
|
|
72081
72669
|
return make$35({
|
|
72082
72670
|
...omit(base, [
|
|
72083
72671
|
"set",
|
|
@@ -72094,7 +72682,7 @@ function layerKeyValueStore(directory) {
|
|
|
72094
72682
|
return pipe(gen(function* () {
|
|
72095
72683
|
if (isString$1(value)) yield* fs.writeFileString(`${target}.tmp`, value, { mode: 384 });
|
|
72096
72684
|
else yield* fs.writeFile(`${target}.tmp`, value, { mode: 384 });
|
|
72097
|
-
}), andThen(fs.rename(`${target}.tmp`, target)), withPermit(writes),
|
|
72685
|
+
}), andThen(fs.rename(`${target}.tmp`, target)), uninterruptible, withPermit(writes), mapError$2((cause) => new KeyValueStoreError({
|
|
72098
72686
|
cause,
|
|
72099
72687
|
key,
|
|
72100
72688
|
message: "Cannot save the value",
|
|
@@ -72104,8 +72692,16 @@ function layerKeyValueStore(directory) {
|
|
|
72104
72692
|
});
|
|
72105
72693
|
})), provide$2(layerFileSystem(directory)));
|
|
72106
72694
|
}
|
|
72107
|
-
unwrap$8(map$6(dataDirectory, layerKeyValueStore));
|
|
72108
|
-
const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(mebibytes(10)))
|
|
72695
|
+
const layerDataStore = unwrap$8(map$6(dataDirectory, layerKeyValueStore));
|
|
72696
|
+
const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(mebibytes(10)), effect(TracerDisabledWhen, map$6(TracerDisabledWhen, (previous) => (request) => {
|
|
72697
|
+
const path = headNonEmpty(split$1(request.url, "?"));
|
|
72698
|
+
return previous(request) || path === "/api/rpc" && toLowerCase(request.headers["upgrade"] ?? "") === "websocket" || startsWith("/assets/")(path) || contains$1([
|
|
72699
|
+
"/icon",
|
|
72700
|
+
"/favicon.ico",
|
|
72701
|
+
"/apple-touch-icon.png",
|
|
72702
|
+
"/manifest.webmanifest"
|
|
72703
|
+
], path);
|
|
72704
|
+
})));
|
|
72109
72705
|
const layerTelemetry = unwrap$8(gen(function* () {
|
|
72110
72706
|
const metadata = yield* packageMetadata;
|
|
72111
72707
|
return match$8(yield* option(String$5("OTEL_URL")), {
|
|
@@ -72118,6 +72714,7 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
72118
72714
|
const canonical = new URL(yield* String$5("APP_URL")).origin;
|
|
72119
72715
|
const issuer = yield* option(String$5("AUTH_URL"));
|
|
72120
72716
|
const traces = yield* pipe(String$5("OTEL_URL"), withDefault$2(""));
|
|
72717
|
+
const metadata = yield* cached(packageMetadata);
|
|
72121
72718
|
const toIssuer = fnUntraced(function* (search) {
|
|
72122
72719
|
const request = yield* HttpServerRequest;
|
|
72123
72720
|
const next = filter$5(liftThrowable(() => new URL(new URL(request.url, canonical).searchParams.get("next") ?? canonical, canonical))(), (url) => url.origin === canonical);
|
|
@@ -72133,21 +72730,22 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
72133
72730
|
});
|
|
72134
72731
|
});
|
|
72135
72732
|
yield* router.add("GET", RUNTIME_PATH, gen(function* () {
|
|
72733
|
+
const release = yield* metadata;
|
|
72136
72734
|
return yield* schemaJson(RuntimeConfig)({
|
|
72137
72735
|
...match$8(issuer, {
|
|
72138
72736
|
onNone: () => ({}),
|
|
72139
72737
|
onSome: (origin) => ({ auth: origin })
|
|
72140
72738
|
}),
|
|
72141
|
-
name:
|
|
72739
|
+
name: replace("@deslop/", "")(release.name),
|
|
72142
72740
|
traces,
|
|
72143
|
-
version:
|
|
72741
|
+
version: release.version
|
|
72144
72742
|
});
|
|
72145
72743
|
}));
|
|
72146
72744
|
yield* router.add("GET", "/auth/sign-in", toIssuer({}));
|
|
72147
72745
|
yield* router.add("GET", "/auth/sign-out", toIssuer({ "sign-out": "" }));
|
|
72148
72746
|
yield* router.add("GET", "/auth/user", gen(function* () {
|
|
72149
72747
|
const user = yield* result(auth.user((yield* HttpServerRequest).headers));
|
|
72150
|
-
if (isFailure$1(user)) return empty$1(
|
|
72748
|
+
if (isFailure$1(user)) return empty$1(failureOptions(user.failure, 401));
|
|
72151
72749
|
return yield* schemaJson(Account)({
|
|
72152
72750
|
...user.success,
|
|
72153
72751
|
signOut: isSome(issuer)
|
|
@@ -72156,14 +72754,14 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
72156
72754
|
}));
|
|
72157
72755
|
const layerAnnounce = effectDiscard(gen(function* () {
|
|
72158
72756
|
const origin = new URL(yield* String$5("APP_URL")).origin;
|
|
72159
|
-
const client =
|
|
72757
|
+
const client = pipe(yield* HttpClient, filterStatusOk, timeout("10 seconds"), retryTransient({
|
|
72758
|
+
schedule: spaced("1 minute"),
|
|
72759
|
+
times: 60
|
|
72760
|
+
}));
|
|
72160
72761
|
yield* match$8(yield* option(String$5("AUTH_URL")), {
|
|
72161
72762
|
onNone: () => void_$1,
|
|
72162
72763
|
onSome: fnUntraced(function* (issuer) {
|
|
72163
|
-
yield* pipe(post(new URL(APPS_PATH, issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"),
|
|
72164
|
-
schedule: spaced("1 minute"),
|
|
72165
|
-
times: 60
|
|
72166
|
-
}), ignore$1({
|
|
72764
|
+
yield* pipe(post(new URL(APPS_PATH, issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"), ignore$1({
|
|
72167
72765
|
log: "Warn",
|
|
72168
72766
|
message: "Auth did not list this app"
|
|
72169
72767
|
}), forkScoped);
|
|
@@ -72182,11 +72780,10 @@ const layerWeb = unwrap$8(gen(function* () {
|
|
|
72182
72780
|
if (!(yield* (yield* FileSystem).exists((yield* Path$1).join(client, "index.html")))) return empty$10;
|
|
72183
72781
|
const name = capitalize(yield* appName);
|
|
72184
72782
|
return mergeAll$1(add$1("GET", MANIFEST_PATH, succeed$5(jsonUnsafe({
|
|
72185
|
-
background_color: "#
|
|
72783
|
+
background_color: "#0d0c0c",
|
|
72186
72784
|
display: "standalone",
|
|
72187
72785
|
icons: [{
|
|
72188
72786
|
purpose: "any",
|
|
72189
|
-
sizes: "512x512",
|
|
72190
72787
|
src: "/apple-touch-icon.png",
|
|
72191
72788
|
type: "image/png"
|
|
72192
72789
|
}],
|
|
@@ -72195,7 +72792,7 @@ const layerWeb = unwrap$8(gen(function* () {
|
|
|
72195
72792
|
scope: "/",
|
|
72196
72793
|
short_name: name,
|
|
72197
72794
|
start_url: "/",
|
|
72198
|
-
theme_color: "#
|
|
72795
|
+
theme_color: "#0d0c0c"
|
|
72199
72796
|
}, {
|
|
72200
72797
|
contentType: "application/manifest+json",
|
|
72201
72798
|
headers: { "cache-control": "no-cache" }
|
|
@@ -72244,7 +72841,7 @@ const execute = fnUntraced(function* (command, args) {
|
|
|
72244
72841
|
}, { concurrency: "unbounded" });
|
|
72245
72842
|
if (result.code !== 0) return yield* AppError.make({ message: `${command} failed: ${result.stderr}` });
|
|
72246
72843
|
return result.stdout;
|
|
72247
|
-
});
|
|
72844
|
+
}, scoped);
|
|
72248
72845
|
function systemctl(...args) {
|
|
72249
72846
|
return execute("systemctl", ["--user", ...args]);
|
|
72250
72847
|
}
|
|
@@ -72294,7 +72891,7 @@ function status(name) {
|
|
|
72294
72891
|
return systemctl("show", `deslop-${name}.service`, "--property=LoadState,ActiveState,SubState,MainPID");
|
|
72295
72892
|
}
|
|
72296
72893
|
function restart(name) {
|
|
72297
|
-
return pipe(systemctl("restart", `deslop-${name}.service`), timeout("30 seconds"));
|
|
72894
|
+
return pipe(systemctl("restart", `deslop-${name}.service`), timeout$1("30 seconds"));
|
|
72298
72895
|
}
|
|
72299
72896
|
// ../../packages/runtime/src/cli/update.ts
|
|
72300
72897
|
const serviceDirectory = fnUntraced(function* (name) {
|
|
@@ -72318,7 +72915,7 @@ const update$1 = fnUntraced(function* (name) {
|
|
|
72318
72915
|
const path = yield* Path$1;
|
|
72319
72916
|
const root = yield* serviceDirectory(name);
|
|
72320
72917
|
const running = (yield* decodeEffect(fromJsonString(Struct({ version: AppVersion })))(yield* fs.readFileString(path.join(root, "current", "package.json")))).version;
|
|
72321
|
-
const latest = (yield* pipe(filterStatusOk(yield* HttpClient).get(`https://registry.npmjs.org/@deslop%2f${name}/latest`), flatMap$3(schemaBodyJson(Struct({ version: AppVersion }))), timeout("15 seconds"))).version;
|
|
72918
|
+
const latest = (yield* pipe(filterStatusOk(yield* HttpClient).get(`https://registry.npmjs.org/@deslop%2f${name}/latest`), flatMap$3(schemaBodyJson(Struct({ version: AppVersion }))), timeout$1("15 seconds"))).version;
|
|
72322
72919
|
if (latest === running) return `${name} ${running} is current\n`;
|
|
72323
72920
|
const npm = path.resolve(path.dirname(execPath), "../lib/node_modules/npm/bin/npm-cli.js");
|
|
72324
72921
|
if (!(yield* fs.exists(npm))) return yield* AppError.make({ message: "This Node runtime does not include npm; install Node with Vite+" });
|
|
@@ -72335,7 +72932,7 @@ const update$1 = fnUntraced(function* (name) {
|
|
|
72335
72932
|
"--prefer-online",
|
|
72336
72933
|
"--registry=https://registry.npmjs.org",
|
|
72337
72934
|
`@deslop/${name}@${latest}`
|
|
72338
|
-
]), timeout("5 minutes"));
|
|
72935
|
+
]), timeout$1("5 minutes"));
|
|
72339
72936
|
const previous = yield* option$1(fs.readLink(path.join(root, "current")));
|
|
72340
72937
|
yield* activate(name, path.join(directory, "node_modules", "@deslop", name));
|
|
72341
72938
|
yield* restart(name);
|
|
@@ -72344,6 +72941,7 @@ const update$1 = fnUntraced(function* (name) {
|
|
|
72344
72941
|
return `Updated ${name} from ${running} to ${latest}\n`;
|
|
72345
72942
|
});
|
|
72346
72943
|
// ../../packages/runtime/src/cli.ts
|
|
72944
|
+
const DEFAULT_HOST = "127.0.0.1";
|
|
72347
72945
|
const SETTINGS = {
|
|
72348
72946
|
APP_URL: {
|
|
72349
72947
|
description: "Canonical origin, such as the HTTPS name a proxy serves",
|
|
@@ -72355,8 +72953,13 @@ const SETTINGS = {
|
|
|
72355
72953
|
flag: "auth",
|
|
72356
72954
|
schema: SecureOrigin
|
|
72357
72955
|
},
|
|
72956
|
+
GATEWAY_URL: {
|
|
72957
|
+
description: "Deslop Gateway origin for AI calls",
|
|
72958
|
+
flag: "gateway",
|
|
72959
|
+
schema: Origin
|
|
72960
|
+
},
|
|
72358
72961
|
HOST: {
|
|
72359
|
-
description:
|
|
72962
|
+
description: `Listen address; defaults to ${DEFAULT_HOST}`,
|
|
72360
72963
|
flag: "host",
|
|
72361
72964
|
schema: NonEmptyString
|
|
72362
72965
|
},
|
|
@@ -72364,23 +72967,18 @@ const SETTINGS = {
|
|
|
72364
72967
|
description: "Scope origin to export traces and logs to",
|
|
72365
72968
|
flag: "traces",
|
|
72366
72969
|
schema: Origin
|
|
72367
|
-
},
|
|
72368
|
-
PORT: {
|
|
72369
|
-
description: "Listen port; defaults to the package's config.port",
|
|
72370
|
-
flag: "port",
|
|
72371
|
-
schema: Port
|
|
72372
72970
|
}
|
|
72373
72971
|
};
|
|
72374
72972
|
String$6.check(isPattern(/^\d+(?:,\d+)*$/u));
|
|
72375
72973
|
function flagsOf(settings) {
|
|
72376
|
-
return map$10(settings, (setting, key) => pipe(String$1(setting.flag), withSchema(setting.schema), withFallbackConfig(schema$1(setting.schema, key)), withDescription(setting.description), optional));
|
|
72974
|
+
return map$10(settings, (setting, key) => pipe(String$1(setting.flag), withSchema(setting.schema), withFallbackConfig(schema$1(setting.schema, key)), withDescription(`${setting.description} [${key}]`), optional));
|
|
72377
72975
|
}
|
|
72378
|
-
const provider = fnUntraced(function* (given) {
|
|
72379
|
-
const port = given["PORT"] ?? `${
|
|
72976
|
+
const provider = fnUntraced(function* (given, defaultPort) {
|
|
72977
|
+
const port = given["PORT"] ?? `${defaultPort}`;
|
|
72380
72978
|
const url = given["APP_URL"] ?? `http://localhost:${port}`;
|
|
72381
72979
|
if (given["AUTH_URL"] !== void 0 && new URL(url).protocol !== "https:") return yield* AppError.make({ message: "With --auth, set --url to the app's HTTPS origin" });
|
|
72382
72980
|
return orElse(fromUnknown({
|
|
72383
|
-
HOST:
|
|
72981
|
+
HOST: DEFAULT_HOST,
|
|
72384
72982
|
...given,
|
|
72385
72983
|
APP_URL: url,
|
|
72386
72984
|
PORT: port
|
|
@@ -72388,33 +72986,41 @@ const provider = fnUntraced(function* (given) {
|
|
|
72388
72986
|
});
|
|
72389
72987
|
const layerPlatform = mergeAll$1(layer$4, layer$12, layer$15);
|
|
72390
72988
|
function server(app) {
|
|
72391
|
-
return pipe(serve(pipe(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(
|
|
72989
|
+
return pipe(serve(pipe(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(match$8(fromUndefinedOr(app.middleware), {
|
|
72990
|
+
onNone: () => empty$10,
|
|
72991
|
+
onSome: (middleware$1) => middleware()(middleware$1).layer
|
|
72992
|
+
})), provide$2(Auth.layer), provideMerge(pipe(AiGateway.layer, provide$2(layerDataStore)))), {
|
|
72392
72993
|
disableLogger: true,
|
|
72393
|
-
middleware:
|
|
72994
|
+
middleware: guard
|
|
72394
72995
|
}), provide$2(mergeAll$1(layerProtocol, match$1(app.telemetry === false, {
|
|
72395
72996
|
onFalse: () => layerTelemetry,
|
|
72396
72997
|
onTrue: () => empty$10
|
|
72397
72998
|
}))), provide$2(layerNodeHttpServer), provide$2(layerPlatform), launch);
|
|
72398
72999
|
}
|
|
72399
73000
|
function output(text) {
|
|
72400
|
-
return flatMap$3(Stdio, (stdio) => run$4(make$
|
|
73001
|
+
return flatMap$3(Stdio, (stdio) => run$4(make$43(text), stdio.stdout()));
|
|
72401
73002
|
}
|
|
72402
73003
|
function runApp(app) {
|
|
72403
|
-
const settings = {
|
|
72404
|
-
...SETTINGS,
|
|
72405
|
-
...app.settings
|
|
72406
|
-
};
|
|
72407
73004
|
const program = gen(function* () {
|
|
72408
73005
|
const metadata = yield* packageMetadata;
|
|
72409
73006
|
const name = yield* appName;
|
|
73007
|
+
const settings = {
|
|
73008
|
+
...SETTINGS,
|
|
73009
|
+
PORT: {
|
|
73010
|
+
description: `Listen port; defaults to ${metadata.config.port}`,
|
|
73011
|
+
flag: "port",
|
|
73012
|
+
schema: Port
|
|
73013
|
+
},
|
|
73014
|
+
...app.settings
|
|
73015
|
+
};
|
|
72410
73016
|
const root = pipe(make$5(name), withSharedFlags(flagsOf(settings)));
|
|
72411
73017
|
const given = map$6(root, (input) => getSomes$1(input));
|
|
72412
|
-
return yield* pipe(root, withHandler((input) => flatMap$3(provider(getSomes$1(input)), (values) => provideService(server(app), ConfigProvider, values))), withSubcommands([pipe(make$5("service"), withSubcommands([
|
|
73018
|
+
return yield* pipe(root, withHandler((input) => flatMap$3(provider(getSomes$1(input), metadata.config.port), (values) => provideService(server(app), ConfigProvider, values))), withSubcommands([pipe(make$5("service"), withSubcommands([
|
|
72413
73019
|
make$5("install", {}, fnUntraced(function* () {
|
|
72414
73020
|
const fs = yield* FileSystem;
|
|
72415
73021
|
const path = yield* Path$1;
|
|
72416
73022
|
const flags = yield* given;
|
|
72417
|
-
yield* provider(flags);
|
|
73023
|
+
yield* provider(flags, metadata.config.port);
|
|
72418
73024
|
const entry = path.join(yield* activate(name, yield* fs.realPath(packageRoot)), "dist", "server.js");
|
|
72419
73025
|
const args = flatten$4(collect$1(flags, (key, value) => [`--${settings[key]?.flag ?? key}`, value]));
|
|
72420
73026
|
yield* output(yield* install(name, [
|
|
@@ -72437,7 +73043,7 @@ function runApp(app) {
|
|
|
72437
73043
|
runMain(pipe(program, scoped, provide(layerPlatform), provideService(LogToStderr, true)));
|
|
72438
73044
|
}
|
|
72439
73045
|
// src/routes/icon.svg
|
|
72440
|
-
var icon_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" shape-rendering=\"crispEdges\"><path fill=\"#
|
|
73046
|
+
var icon_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\" shape-rendering=\"crispEdges\"><path fill=\"#000\" fill-opacity=\".18\" d=\"M12 40h1v1h-1zM10 41h3v1h-3zM8 42h4v1h-4zM10 43h4v1h-4zM12 44h4v1h-4zM14 45h4v1h-4zM16 46h4v1h-4zM18 47h4v1h-4zM20 48h4v1h-4zM51 48h1v1h-1zM22 49h4v1h-4zM51 49h3v1h-3zM24 50h4v1h-4zM52 50h4v1h-4zM26 51h4v1h-4zM50 51h4v1h-4zM28 52h4v1h-4zM44 52h8v1h-8zM30 53h4v1h-4zM43 53h7v1h-7zM32 54h4v1h-4zM44 54h4v1h-4zM34 55h4v1h-4zM42 55h4v1h-4zM36 56h8v1h-8zM38 57h4v1h-4z\"/><path fill=\"#000\" fill-opacity=\".38\" d=\"M12 42h2v1h-2zM14 43h1v1h-1zM16 44h1v1h-1zM18 45h1v1h-1zM20 46h1v1h-1zM22 47h1v1h-1zM24 48h1v1h-1zM26 49h1v1h-1zM28 50h1v1h-1zM50 50h2v1h-2zM30 51h1v1h-1zM45 51h2v1h-2zM49 51h1v1h-1zM32 52h1v1h-1zM43 52h1v1h-1zM34 53h1v1h-1zM36 54h1v1h-1zM42 54h2v1h-2zM38 55h1v1h-1zM41 55h1v1h-1z\"/><path fill=\"#7a5d4c\" d=\"M23 8h2v1h-2zM21 9h2v1h-2zM25 9h2v1h-2zM19 10h2v1h-2zM27 10h2v1h-2zM17 11h2v1h-2zM29 11h2v1h-2zM15 12h2v1h-2zM23 12h1v1h-1zM31 12h2v1h-2zM14 13h1v1h-1zM21 13h2v1h-2zM33 13h2v1h-2zM13 14h1v1h-1zM19 14h2v1h-2zM35 14h2v1h-2zM13 15h1v1h-1zM37 15h2v1h-2zM13 16h1v1h-1zM39 16h2v1h-2zM13 17h1v1h-1zM41 17h2v1h-2zM13 18h1v1h-1zM43 18h2v1h-2zM13 19h1v1h-1zM45 19h2v1h-2zM13 20h1v1h-1zM47 20h2v1h-2zM13 21h1v1h-1zM49 21h1v1h-1zM13 22h1v1h-1zM50 22h1v1h-1zM13 23h1v1h-1zM50 23h1v1h-1zM13 24h1v1h-1zM50 24h1v1h-1zM13 25h1v1h-1zM50 25h1v1h-1zM13 26h1v1h-1zM50 26h1v1h-1zM13 27h1v1h-1zM50 27h1v1h-1zM13 28h1v1h-1zM50 28h1v1h-1zM13 29h1v1h-1zM50 29h1v1h-1zM13 30h1v1h-1zM50 30h1v1h-1zM13 31h1v1h-1zM50 31h1v1h-1zM13 32h1v1h-1zM50 32h1v1h-1zM13 33h1v1h-1zM50 33h1v1h-1zM13 34h1v1h-1zM50 34h1v1h-1zM13 35h1v1h-1zM50 35h1v1h-1zM13 36h1v1h-1zM50 36h1v1h-1zM13 37h1v1h-1zM50 37h1v1h-1zM13 38h1v1h-1zM50 38h1v1h-1zM13 39h1v1h-1zM50 39h1v1h-1zM13 40h1v1h-1zM50 40h1v1h-1zM13 41h1v1h-1zM50 41h1v1h-1zM14 42h1v1h-1zM50 42h1v1h-1zM15 43h2v1h-2zM50 43h1v1h-1zM17 44h2v1h-2zM50 44h1v1h-1zM19 45h2v1h-2zM50 45h1v1h-1zM21 46h2v1h-2zM50 46h1v1h-1zM23 47h2v1h-2zM50 47h1v1h-1zM25 48h2v1h-2zM50 48h1v1h-1zM27 49h2v1h-2zM49 49h2v1h-2zM29 50h2v1h-2zM46 50h1v1h-1zM48 50h2v1h-2zM31 51h2v1h-2zM47 51h2v1h-2zM33 52h2v1h-2zM35 53h2v1h-2zM41 53h2v1h-2zM37 54h2v1h-2zM40 54h2v1h-2zM39 55h2v1h-2z\"/><path fill=\"#f3d1b7\" d=\"M23 9h2v1h-2zM21 10h3v1h-3zM25 10h2v1h-2zM19 11h2v1h-2zM27 11h2v1h-2zM17 12h2v1h-2zM29 12h2v1h-2zM15 13h4v1h-4zM31 13h2v1h-2zM17 14h2v1h-2zM33 14h2v1h-2zM19 15h2v1h-2zM35 15h2v1h-2zM21 16h2v1h-2zM37 16h2v1h-2zM23 17h2v1h-2zM39 17h2v1h-2zM25 18h2v1h-2zM41 18h2v1h-2zM27 19h2v1h-2zM43 19h2v1h-2zM29 20h2v1h-2zM45 20h2v1h-2zM31 21h2v1h-2zM47 21h2v1h-2zM33 22h2v1h-2zM35 23h2v1h-2zM47 23h1v1h-1zM37 24h2v1h-2zM47 24h1v1h-1zM39 25h2v1h-2zM47 25h1v1h-1zM47 26h1v1h-1zM39 27h1v1h-1zM47 27h1v1h-1zM39 28h1v1h-1zM47 28h1v1h-1zM39 29h1v1h-1zM47 29h1v1h-1zM39 30h1v1h-1zM47 30h1v1h-1zM39 31h1v1h-1zM47 31h1v1h-1zM39 32h1v1h-1zM47 32h1v1h-1zM39 33h1v1h-1zM47 33h1v1h-1zM39 34h1v1h-1zM47 34h1v1h-1zM39 35h1v1h-1zM47 35h1v1h-1zM39 36h1v1h-1zM47 36h1v1h-1zM39 37h1v1h-1zM47 37h1v1h-1zM39 38h1v1h-1zM47 38h1v1h-1zM39 39h1v1h-1zM47 39h1v1h-1zM39 40h1v1h-1zM47 40h1v1h-1zM39 41h1v1h-1zM47 41h1v1h-1zM39 42h1v1h-1zM47 42h1v1h-1zM39 43h1v1h-1zM47 43h1v1h-1zM39 44h1v1h-1zM47 44h1v1h-1zM39 45h1v1h-1zM47 45h1v1h-1zM39 46h1v1h-1zM47 46h1v1h-1zM39 47h1v1h-1zM47 47h1v1h-1zM39 48h1v1h-1zM47 48h1v1h-1zM39 49h1v1h-1zM47 49h1v1h-1zM39 50h1v1h-1zM39 51h1v1h-1zM39 52h1v1h-1zM39 53h1v1h-1z\"/><path fill=\"#fee7d5\" d=\"M24 10h1v1h-1zM21 11h2v1h-2zM25 11h2v1h-2zM19 12h2v1h-2zM27 12h2v1h-2zM29 13h2v1h-2zM15 14h2v1h-2zM31 14h2v1h-2zM17 15h2v1h-2zM33 15h2v1h-2zM19 16h2v1h-2zM35 16h2v1h-2zM21 17h2v1h-2zM37 17h2v1h-2zM23 18h2v1h-2zM39 18h2v1h-2zM25 19h2v1h-2zM41 19h2v1h-2zM27 20h2v1h-2zM43 20h2v1h-2zM29 21h2v1h-2zM45 21h2v1h-2zM31 22h2v1h-2zM47 22h2v1h-2zM33 23h2v1h-2zM35 24h2v1h-2zM37 25h2v1h-2zM39 26h2v1h-2z\"/><path fill=\"#b38d74\" d=\"M23 11h1v1h-1zM21 12h2v1h-2zM19 13h2v1h-2zM49 22h1v1h-1zM48 23h2v1h-2zM48 24h2v1h-2zM48 25h2v1h-2zM41 26h1v1h-1zM48 26h2v1h-2zM40 27h2v1h-2zM48 27h2v1h-2zM40 28h2v1h-2zM48 28h2v1h-2zM40 29h2v1h-2zM48 29h2v1h-2zM40 30h2v1h-2zM48 30h2v1h-2zM40 31h2v1h-2zM48 31h2v1h-2zM40 32h2v1h-2zM48 32h2v1h-2zM40 33h2v1h-2zM48 33h2v1h-2zM40 34h2v1h-2zM48 34h2v1h-2zM40 35h2v1h-2zM48 35h2v1h-2zM40 36h2v1h-2zM48 36h2v1h-2zM40 37h2v1h-2zM48 37h2v1h-2zM40 38h2v1h-2zM48 38h2v1h-2zM40 39h2v1h-2zM48 39h2v1h-2zM40 40h2v1h-2zM48 40h2v1h-2zM40 41h2v1h-2zM48 41h2v1h-2zM40 42h2v1h-2zM48 42h2v1h-2zM40 43h2v1h-2zM48 43h2v1h-2zM40 44h2v1h-2zM48 44h2v1h-2zM40 45h2v1h-2zM48 45h2v1h-2zM40 46h2v1h-2zM48 46h2v1h-2zM40 47h2v1h-2zM48 47h2v1h-2zM40 48h2v1h-2zM48 48h2v1h-2zM40 49h2v1h-2zM48 49h1v1h-1zM40 50h2v1h-2zM40 51h2v1h-2zM40 52h2v1h-2zM40 53h1v1h-1z\"/><path fill=\"#E4BC9E\" d=\"M24 11h1v1h-1zM25 12h2v1h-2zM27 13h2v1h-2zM14 14h1v1h-1zM29 14h2v1h-2zM14 15h3v1h-3zM31 15h2v1h-2zM14 16h5v1h-5zM33 16h2v1h-2zM14 17h7v1h-7zM35 17h2v1h-2zM14 18h9v1h-9zM37 18h2v1h-2zM14 19h11v1h-11zM39 19h2v1h-2zM14 20h13v1h-13zM41 20h2v1h-2zM14 21h15v1h-15zM43 21h2v1h-2zM14 22h17v1h-17zM45 22h2v1h-2zM14 23h7v1h-7zM23 23h10v1h-10zM46 23h1v1h-1zM14 24h9v1h-9zM25 24h10v1h-10zM46 24h1v1h-1zM14 25h6v1h-6zM21 25h16v1h-16zM46 25h1v1h-1zM14 26h5v1h-5zM23 26h16v1h-16zM46 26h1v1h-1zM14 27h5v1h-5zM25 27h14v1h-14zM46 27h1v1h-1zM14 28h5v1h-5zM25 28h7v1h-7zM33 28h6v1h-6zM46 28h1v1h-1zM14 29h6v1h-6zM26 29h7v1h-7zM35 29h4v1h-4zM46 29h1v1h-1zM14 30h7v1h-7zM26 30h2v1h-2zM29 30h6v1h-6zM36 30h3v1h-3zM46 30h1v1h-1zM14 31h9v1h-9zM26 31h2v1h-2zM29 31h1v1h-1zM33 31h6v1h-6zM46 31h1v1h-1zM14 32h14v1h-14zM29 32h1v1h-1zM35 32h4v1h-4zM46 32h1v1h-1zM14 33h14v1h-14zM29 33h1v1h-1zM36 33h3v1h-3zM46 33h1v1h-1zM14 34h14v1h-14zM29 34h2v1h-2zM37 34h2v1h-2zM46 34h1v1h-1zM14 35h14v1h-14zM29 35h2v1h-2zM37 35h2v1h-2zM46 35h1v1h-1zM14 36h14v1h-14zM29 36h4v1h-4zM37 36h2v1h-2zM46 36h1v1h-1zM14 37h13v1h-13zM29 37h6v1h-6zM36 37h3v1h-3zM46 37h1v1h-1zM14 38h15v1h-15zM30 38h9v1h-9zM46 38h1v1h-1zM14 39h11v1h-11zM27 39h12v1h-12zM46 39h1v1h-1zM14 40h11v1h-11zM29 40h10v1h-10zM46 40h1v1h-1zM15 41h11v1h-11zM31 41h8v1h-8zM46 41h1v1h-1zM17 42h10v1h-10zM32 42h7v1h-7zM46 42h1v1h-1zM19 43h8v1h-8zM32 43h7v1h-7zM46 43h1v1h-1zM21 44h8v1h-8zM30 44h9v1h-9zM46 44h1v1h-1zM23 45h16v1h-16zM46 45h1v1h-1zM25 46h14v1h-14zM46 46h1v1h-1zM27 47h12v1h-12zM46 47h1v1h-1zM29 48h10v1h-10zM46 48h1v1h-1zM31 49h8v1h-8zM33 50h6v1h-6zM35 51h4v1h-4zM37 52h2v1h-2z\"/><path fill=\"#cca68b\" d=\"M24 12h1v1h-1zM25 13h2v1h-2zM27 14h2v1h-2zM29 15h2v1h-2zM31 16h2v1h-2zM33 17h2v1h-2zM35 18h2v1h-2zM37 19h2v1h-2zM39 20h2v1h-2zM41 21h2v1h-2zM43 22h2v1h-2zM45 23h1v1h-1zM14 41h1v1h-1zM15 42h2v1h-2zM17 43h2v1h-2zM19 44h2v1h-2zM21 45h2v1h-2zM23 46h2v1h-2zM25 47h2v1h-2zM27 48h2v1h-2zM29 49h2v1h-2zM46 49h1v1h-1zM31 50h2v1h-2zM47 50h1v1h-1zM33 51h2v1h-2zM35 52h2v1h-2zM37 53h2v1h-2zM39 54h1v1h-1z\"/><path fill=\"#f9f5e6\" d=\"M23 13h2v1h-2zM21 14h6v1h-6zM21 15h8v1h-8zM23 16h8v1h-8zM25 17h8v1h-8zM27 18h8v1h-8zM29 19h8v1h-8zM31 20h8v1h-8zM33 21h8v1h-8zM35 22h8v1h-8zM37 23h8v1h-8zM39 24h6v1h-6zM41 25h2v1h-2z\"/><path fill=\"#2A211C\" d=\"M21 23h2v1h-2zM23 24h2v1h-2zM20 25h1v1h-1zM19 26h1v1h-1zM21 26h2v1h-2zM19 27h1v1h-1zM23 27h2v1h-2zM19 28h1v1h-1zM32 28h1v1h-1zM20 29h1v1h-1zM23 29h1v1h-1zM25 29h1v1h-1zM33 29h2v1h-2zM21 30h2v1h-2zM25 30h1v1h-1zM35 30h1v1h-1zM23 31h3v1h-3zM30 31h3v1h-3zM30 32h1v1h-1zM33 32h2v1h-2zM30 33h1v1h-1zM32 33h1v1h-1zM35 33h1v1h-1zM36 34h1v1h-1zM31 35h2v1h-2zM36 35h1v1h-1zM33 36h2v1h-2zM36 36h1v1h-1zM35 37h1v1h-1zM25 39h2v1h-2zM25 40h1v1h-1zM27 40h2v1h-2zM26 41h1v1h-1zM29 41h2v1h-2zM31 42h1v1h-1zM27 43h2v1h-2zM30 43h2v1h-2zM29 44h1v1h-1z\"/><path fill=\"#c0bdad\" d=\"M45 24h1v1h-1zM43 25h3v1h-3zM42 26h4v1h-4zM42 27h4v1h-4zM42 28h4v1h-4zM42 29h4v1h-4zM42 30h4v1h-4zM42 31h4v1h-4zM42 32h4v1h-4zM42 33h4v1h-4zM42 34h4v1h-4zM42 35h4v1h-4zM42 36h4v1h-4zM42 37h4v1h-4zM42 38h4v1h-4zM42 39h4v1h-4zM42 40h4v1h-4zM42 41h4v1h-4zM42 42h4v1h-4zM42 43h4v1h-4zM42 44h4v1h-4zM42 45h4v1h-4zM42 46h4v1h-4zM42 47h4v1h-4zM42 48h4v1h-4zM42 49h4v1h-4zM42 50h3v1h-3zM42 51h1v1h-1z\"/><path fill=\"#FFFCF0\" d=\"M20 26h1v1h-1zM20 27h3v1h-3zM20 28h5v1h-5zM21 29h2v1h-2zM24 29h1v1h-1zM23 30h2v1h-2zM31 32h2v1h-2zM31 33h1v1h-1zM33 33h2v1h-2zM31 34h5v1h-5zM33 35h3v1h-3zM35 36h1v1h-1z\"/><path fill=\"#A77457\" d=\"M28 30h1v1h-1zM28 31h1v1h-1zM28 32h1v1h-1zM28 33h1v1h-1zM28 34h1v1h-1zM28 35h1v1h-1zM28 36h1v1h-1zM27 37h2v1h-2zM29 38h1v1h-1z\"/><path fill=\"#C98481\" d=\"M26 40h1v1h-1zM27 41h2v1h-2zM27 42h4v1h-4zM29 43h1v1h-1z\"/><path fill=\"#8b897c\" d=\"M45 50h1v1h-1zM43 51h2v1h-2zM42 52h1v1h-1z\"/></svg>";
|
|
72441
73047
|
// src/services/chapters/schema.ts
|
|
72442
73048
|
var ChaptersError = class extends TaggedError()("ChaptersError", {
|
|
72443
73049
|
cause: optional$2(Defect()),
|
|
@@ -119276,12 +119882,12 @@ var require_mime_type = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
119276
119882
|
require_undici();
|
|
119277
119883
|
require_mime_type();
|
|
119278
119884
|
// src/services/chapters/lib/store.ts
|
|
119279
|
-
const failed
|
|
119885
|
+
const failed = mapError$2((cause) => ChaptersError.make({
|
|
119280
119886
|
cause,
|
|
119281
119887
|
message: "The chapter storage failed."
|
|
119282
119888
|
}));
|
|
119283
|
-
const openStore = fnUntraced(function* (
|
|
119284
|
-
const store =
|
|
119889
|
+
const openStore = fnUntraced(function* () {
|
|
119890
|
+
const store = yield* KeyValueStore;
|
|
119285
119891
|
const chapters = toSchemaStore(store, ArraySchema(Chapter));
|
|
119286
119892
|
const devices = toSchemaStore(store, ArraySchema(PushToken));
|
|
119287
119893
|
const tokens = yield* make$34(copy$3(getOrElse(yield* devices.get("devices"), () => [])));
|
|
@@ -119289,16 +119895,16 @@ const openStore = fnUntraced(function* (directory) {
|
|
|
119289
119895
|
return pipe(updateEffect$1(tokens, (current) => {
|
|
119290
119896
|
const next = update(current);
|
|
119291
119897
|
return as(devices.set("devices", next), next);
|
|
119292
|
-
}), uninterruptible, failed
|
|
119898
|
+
}), uninterruptible, failed);
|
|
119293
119899
|
}
|
|
119294
119900
|
return {
|
|
119295
119901
|
addDevice: (token) => updateDevices((current) => dedupe([...current, token])),
|
|
119296
119902
|
devices: get$3(tokens),
|
|
119297
|
-
load: pipe(chapters.get("chapters"), map$6(getOrElse(() => [])), failed
|
|
119903
|
+
load: pipe(chapters.get("chapters"), map$6(getOrElse(() => [])), failed),
|
|
119298
119904
|
removeDevice: (token) => updateDevices((current) => filter$4(current, (saved) => saved !== token)),
|
|
119299
|
-
save: (current) => pipe(chapters.set("chapters", current), failed
|
|
119905
|
+
save: (current) => pipe(chapters.set("chapters", current), failed)
|
|
119300
119906
|
};
|
|
119301
|
-
}, failed
|
|
119907
|
+
}, failed);
|
|
119302
119908
|
// src/services/chapters/lib/utils.ts
|
|
119303
119909
|
const TITLE = /^(?<tags>(?:\[[^\]]*\]\s*)*)Chapter\s+(?<number>\d+(?:\.\d+)?)(?:\/\d+)?\s*\[(?:English|Translations)\]/iu;
|
|
119304
119910
|
const CUBARI = /https:\/\/cubari\.moe\/read\/(?<source>imgchest|imgur|gist)\/(?<slug>[\w-]+)(?:\/(?<chapter>[\d.]+))?/u;
|
|
@@ -119320,7 +119926,7 @@ function postFrom(entry) {
|
|
|
119320
119926
|
return pipe(fromNullishOr(TITLE.exec(trim(entry.title))?.groups), flatMap$8((groups) => all$4({
|
|
119321
119927
|
links: liftPredicate(dedupe(map$9(fromIterable$6(matchAll(CUBARI_LINKS)(entry.content)), (match) => match[0])), isArrayNonEmpty),
|
|
119322
119928
|
number: parse$9(groups["number"] ?? ""),
|
|
119323
|
-
postedAt: map$12(make$
|
|
119929
|
+
postedAt: map$12(make$56(entry.published), toEpochMillis),
|
|
119324
119930
|
revised: some$2(includes("revised")(toLowerCase(groups["tags"] ?? ""))),
|
|
119325
119931
|
series: some$2(seriesFromTags(groups["tags"] ?? ""))
|
|
119326
119932
|
})));
|
|
@@ -119403,12 +120009,6 @@ const ARCHIVE_POSTS = map$9([
|
|
|
119403
120009
|
series: release.series
|
|
119404
120010
|
}));
|
|
119405
120011
|
const newestFirst = flip$1(byNumber);
|
|
119406
|
-
function failed(message) {
|
|
119407
|
-
return mapError$2((cause) => ChaptersError.make({
|
|
119408
|
-
cause,
|
|
119409
|
-
message
|
|
119410
|
-
}));
|
|
119411
|
-
}
|
|
119412
120012
|
function indexUrl(series) {
|
|
119413
120013
|
return `https://cubari.moe/read/gist/${INDEXES[series]}/`;
|
|
119414
120014
|
}
|
|
@@ -119420,7 +120020,7 @@ function change(chapters, key, update) {
|
|
|
119420
120020
|
}
|
|
119421
120021
|
function changed(chapters, before) {
|
|
119422
120022
|
const previous = fromIterable$4(map$9(before, (chapter) => [keyOf(chapter), chapter]));
|
|
119423
|
-
return filter$4(chapters, (chapter) => !exists(get$
|
|
120023
|
+
return filter$4(chapters, (chapter) => !exists(get$8(previous, keyOf(chapter)), (item) => item === chapter));
|
|
119424
120024
|
}
|
|
119425
120025
|
function postsOf(feed) {
|
|
119426
120026
|
const $ = load(feed, { xml: true });
|
|
@@ -119431,15 +120031,16 @@ function postsOf(feed) {
|
|
|
119431
120031
|
})), getSomes);
|
|
119432
120032
|
}
|
|
119433
120033
|
var Chapters = class Chapters extends Service$1()("@deslop/opm/services/chapters/service/Chapters") {
|
|
119434
|
-
static layer =
|
|
120034
|
+
static layer = effect(this, gen(function* () {
|
|
119435
120035
|
const client = yield* HttpClient;
|
|
119436
|
-
const exit = yield*
|
|
119437
|
-
const store = yield* openStore(
|
|
120036
|
+
const exit = yield* option(String$5("OPM_PROXY"));
|
|
120037
|
+
const store = yield* openStore();
|
|
119438
120038
|
const state = yield* make$32(sort(yield* store.load, newestFirst));
|
|
119439
120039
|
function series(url) {
|
|
119440
|
-
return pipe(client.get(url, { headers: { "user-agent": BROWSER } }), flatMap$3(filterStatusOk$1), flatMap$3(schemaBodyJson(CubariSeries)), timeout("20 seconds"), retry({
|
|
120040
|
+
return pipe(client.get(url, { headers: { "user-agent": BROWSER } }), flatMap$3(filterStatusOk$1), flatMap$3(schemaBodyJson(CubariSeries)), timeout$1("20 seconds"), retry({
|
|
119441
120041
|
schedule: exponential("1 second"),
|
|
119442
|
-
times: 2
|
|
120042
|
+
times: 2,
|
|
120043
|
+
while: isTransientError
|
|
119443
120044
|
}));
|
|
119444
120045
|
}
|
|
119445
120046
|
const resolve = fnUntraced(function* (post, link) {
|
|
@@ -119496,7 +120097,7 @@ var Chapters = class Chapters extends Service$1()("@deslop/opm/services/chapters
|
|
|
119496
120097
|
});
|
|
119497
120098
|
const feeds = yield* forEach$1(FEEDS, (url) => pipe(gen(function* () {
|
|
119498
120099
|
const session = `${yield* nextIntBetween(1e7, 99999999)}`;
|
|
119499
|
-
return yield* pipe(get$1(url, { headers: { "user-agent": BROWSER } }), flatMap$3(filterStatusOk$1), flatMap$3((response) => response.text), timeout("20 seconds"), provide(match$8(exit, {
|
|
120100
|
+
return yield* pipe(get$1(url, { headers: { "user-agent": BROWSER } }), flatMap$3(filterStatusOk$1), flatMap$3((response) => response.text), timeout$1("20 seconds"), provide(match$8(exit, {
|
|
119500
120101
|
onNone: () => succeed$6(HttpClient, client),
|
|
119501
120102
|
onSome: (proxy) => pipe(layerNodeHttpNoAgent, provide$2(layerAgentOptions({ proxyEnv: {
|
|
119502
120103
|
HTTP_PROXY: replaceAll("{session}", session)(proxy),
|
|
@@ -119509,7 +120110,7 @@ var Chapters = class Chapters extends Service$1()("@deslop/opm/services/chapters
|
|
|
119509
120110
|
const posts = sort([...ARCHIVE_POSTS, ...flatten$4(getSomes(feeds))], mapInput(Number$6, (post) => post.postedAt));
|
|
119510
120111
|
const known = fromIterable$4(map$9(yield* get$2(state), (chapter) => [keyOf(chapter), chapter]));
|
|
119511
120112
|
const now = yield* currentTimeMillis;
|
|
119512
|
-
const candidates = filterMap(posts, (post) => match$6(filter$4(post.links, (link) => match$8(get$
|
|
120113
|
+
const candidates = filterMap(posts, (post) => match$6(filter$4(post.links, (link) => match$8(get$8(known, keyOf(post)), {
|
|
119513
120114
|
onNone: () => true,
|
|
119514
120115
|
onSome: (item) => post.revised && post.postedAt > (item.revisedAt ?? item.postedAt) && link !== item.source
|
|
119515
120116
|
})), {
|
|
@@ -119522,7 +120123,7 @@ var Chapters = class Chapters extends Service$1()("@deslop/opm/services/chapters
|
|
|
119522
120123
|
const found = yield* forEach$1(toEntries(groupBy(candidates, (candidate) => keyOf(candidate.post))), (entry) => pipe(firstSuccessOf(flatMap$6(entry[1], (candidate) => map$9(candidate.links, (link) => resolve(candidate.post, link)))), asSome, tapError$3((error) => logWarning(`Chapter ${entry[0]} has no readable pages`, error)), orElseSucceed(none)), { concurrency: 1 });
|
|
119523
120124
|
const loaded = fromIterable$4(map$9(getSomes(found), (chapter) => [keyOf(chapter), chapter]));
|
|
119524
120125
|
yield* save((current) => {
|
|
119525
|
-
const revised = map$9(current, (item) => match$8(get$
|
|
120126
|
+
const revised = map$9(current, (item) => match$8(get$8(loaded, keyOf(item)), {
|
|
119526
120127
|
onNone: () => item,
|
|
119527
120128
|
onSome: (chapter) => ({
|
|
119528
120129
|
...item,
|
|
@@ -119550,7 +120151,7 @@ var Chapters = class Chapters extends Service$1()("@deslop/opm/services/chapters
|
|
|
119550
120151
|
threadId: chapter.series,
|
|
119551
120152
|
title: `${SERIES_NAMES[chapter.series]} · Chapter ${chapter.number}`,
|
|
119552
120153
|
to
|
|
119553
|
-
}))), flatMap$3((request) => client.execute(request)), flatMap$3(filterStatusOk$1), flatMap$3(schemaBodyJson(PushTickets)), timeout("20 seconds"));
|
|
120154
|
+
}))), flatMap$3((request) => client.execute(request)), flatMap$3(filterStatusOk$1), flatMap$3(schemaBodyJson(PushTickets.check(makeFilter((received) => received.data.length === tokens.length, { message: "Expo must return exactly one ticket per message" })))), timeout$1("20 seconds"));
|
|
119554
120155
|
const tickets = zip(tokens, answer.data);
|
|
119555
120156
|
yield* forEach$1(filter$4(tickets, (pair) => pair[1].details?.error === "DeviceNotRegistered"), (pair) => store.removeDevice(pair[0]), {
|
|
119556
120157
|
concurrency: 1,
|
|
@@ -119580,7 +120181,7 @@ var Chapters = class Chapters extends Service$1()("@deslop/opm/services/chapters
|
|
|
119580
120181
|
yield* forkScoped(repeat(pipe(sync, ignore$1({
|
|
119581
120182
|
log: "Warn",
|
|
119582
120183
|
message: "The chapter sync failed"
|
|
119583
|
-
}), andThen(notify)), spaced("6 hours")));
|
|
120184
|
+
}), andThen(notify), withSpan("Chapters.sync")), spaced("6 hours")));
|
|
119584
120185
|
return Chapters.of({
|
|
119585
120186
|
changes: pipe(changes(state), mapAccum(() => none(), (previous, current) => [some$2(current), match$8(previous, {
|
|
119586
120187
|
onNone: () => [{
|
|
@@ -119615,7 +120216,6 @@ var Chapters = class Chapters extends Service$1()("@deslop/opm/services/chapters
|
|
|
119615
120216
|
});
|
|
119616
120217
|
}));
|
|
119617
120218
|
};
|
|
119618
|
-
const layerChapters = unwrap$8(pipe(dataDirectory, failed("The chapters folder could not be read."), map$6(Chapters.layer)));
|
|
119619
120219
|
// src/main.server.ts
|
|
119620
120220
|
runApp({
|
|
119621
120221
|
icon: icon_default,
|
|
@@ -119629,6 +120229,6 @@ runApp({
|
|
|
119629
120229
|
"library.watch": () => chapters.changes
|
|
119630
120230
|
});
|
|
119631
120231
|
}))
|
|
119632
|
-
}), provide$2(layerJson$1), provide$2(
|
|
120232
|
+
}), provide$2(layerJson$1), provide$2(Chapters.layer), provide$2(layerDataStore))
|
|
119633
120233
|
});
|
|
119634
120234
|
export {};
|