lalph 0.1.87 → 0.1.90
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/cli.mjs +2236 -364
- package/package.json +1 -1
- package/src/IssueSource.ts +24 -1
- package/src/IssueSources.ts +2 -2
- package/src/Prd.ts +68 -21
- package/src/Worktree.ts +1 -12
- package/src/commands/edit.ts +3 -1
- package/src/commands/plan.ts +3 -7
- package/src/commands/root.ts +91 -95
- package/src/commands/shell.ts +1 -6
package/dist/cli.mjs
CHANGED
|
@@ -488,7 +488,7 @@ function isString$1(input) {
|
|
|
488
488
|
* @category guards
|
|
489
489
|
* @since 2.0.0
|
|
490
490
|
*/
|
|
491
|
-
function isNumber(input) {
|
|
491
|
+
function isNumber$1(input) {
|
|
492
492
|
return typeof input === "number";
|
|
493
493
|
}
|
|
494
494
|
/**
|
|
@@ -610,7 +610,7 @@ function isSymbol(input) {
|
|
|
610
610
|
* @since 4.0.0
|
|
611
611
|
*/
|
|
612
612
|
function isPropertyKey(u) {
|
|
613
|
-
return isString$1(u) || isNumber(u) || isSymbol(u);
|
|
613
|
+
return isString$1(u) || isNumber$1(u) || isSymbol(u);
|
|
614
614
|
}
|
|
615
615
|
/**
|
|
616
616
|
* Checks whether a value is a `function`.
|
|
@@ -2791,7 +2791,7 @@ const TaggedError = TaggedError$1;
|
|
|
2791
2791
|
* @category constructors
|
|
2792
2792
|
* @since 2.0.0
|
|
2793
2793
|
*/
|
|
2794
|
-
function make$
|
|
2794
|
+
function make$54(compare) {
|
|
2795
2795
|
return (self$1, that) => self$1 === that ? 0 : compare(self$1, that);
|
|
2796
2796
|
}
|
|
2797
2797
|
/**
|
|
@@ -2825,7 +2825,7 @@ function make$53(compare) {
|
|
|
2825
2825
|
* @category instances
|
|
2826
2826
|
* @since 4.0.0
|
|
2827
2827
|
*/
|
|
2828
|
-
const String$5 = /* @__PURE__ */ make$
|
|
2828
|
+
const String$5 = /* @__PURE__ */ make$54((self$1, that) => self$1 < that ? -1 : 1);
|
|
2829
2829
|
/**
|
|
2830
2830
|
* An `Order` instance for numbers that compares them numerically.
|
|
2831
2831
|
*
|
|
@@ -2861,7 +2861,7 @@ const String$5 = /* @__PURE__ */ make$53((self$1, that) => self$1 < that ? -1 :
|
|
|
2861
2861
|
* @category instances
|
|
2862
2862
|
* @since 4.0.0
|
|
2863
2863
|
*/
|
|
2864
|
-
const Number$
|
|
2864
|
+
const Number$5 = /* @__PURE__ */ make$54((self$1, that) => {
|
|
2865
2865
|
if (globalThis.Number.isNaN(self$1) && globalThis.Number.isNaN(that)) return 0;
|
|
2866
2866
|
if (globalThis.Number.isNaN(self$1)) return -1;
|
|
2867
2867
|
if (globalThis.Number.isNaN(that)) return 1;
|
|
@@ -2897,7 +2897,7 @@ const Number$4 = /* @__PURE__ */ make$53((self$1, that) => {
|
|
|
2897
2897
|
* @category instances
|
|
2898
2898
|
* @since 4.0.0
|
|
2899
2899
|
*/
|
|
2900
|
-
const BigInt$3 = /* @__PURE__ */ make$
|
|
2900
|
+
const BigInt$3 = /* @__PURE__ */ make$54((self$1, that) => self$1 < that ? -1 : 1);
|
|
2901
2901
|
/**
|
|
2902
2902
|
* Transforms an `Order` on type `A` into an `Order` on type `B` by providing a function that
|
|
2903
2903
|
* maps values of type `B` to values of type `A`.
|
|
@@ -2932,7 +2932,7 @@ const BigInt$3 = /* @__PURE__ */ make$53((self$1, that) => self$1 < that ? -1 :
|
|
|
2932
2932
|
* @category mapping
|
|
2933
2933
|
* @since 2.0.0
|
|
2934
2934
|
*/
|
|
2935
|
-
const mapInput = /* @__PURE__ */ dual(2, (self$1, f) => make$
|
|
2935
|
+
const mapInput = /* @__PURE__ */ dual(2, (self$1, f) => make$54((b1, b2) => self$1(f(b1), f(b2))));
|
|
2936
2936
|
/**
|
|
2937
2937
|
* An `Order` instance for `Date` objects that compares them chronologically by their timestamp.
|
|
2938
2938
|
*
|
|
@@ -2966,7 +2966,7 @@ const mapInput = /* @__PURE__ */ dual(2, (self$1, f) => make$53((b1, b2) => self
|
|
|
2966
2966
|
* @category instances
|
|
2967
2967
|
* @since 2.0.0
|
|
2968
2968
|
*/
|
|
2969
|
-
const Date$2 = /* @__PURE__ */ mapInput(Number$
|
|
2969
|
+
const Date$2 = /* @__PURE__ */ mapInput(Number$5, (date$2) => date$2.getTime());
|
|
2970
2970
|
/**
|
|
2971
2971
|
* Creates an `Order` for a tuple type based on orders for each element.
|
|
2972
2972
|
*
|
|
@@ -3001,7 +3001,7 @@ const Date$2 = /* @__PURE__ */ mapInput(Number$4, (date$2) => date$2.getTime());
|
|
|
3001
3001
|
* @since 4.0.0
|
|
3002
3002
|
*/
|
|
3003
3003
|
function Tuple$2(elements) {
|
|
3004
|
-
return make$
|
|
3004
|
+
return make$54((self$1, that) => {
|
|
3005
3005
|
const len = elements.length;
|
|
3006
3006
|
for (let i = 0; i < len; i++) {
|
|
3007
3007
|
const o = elements[i](self$1[i], that[i]);
|
|
@@ -3045,7 +3045,7 @@ function Tuple$2(elements) {
|
|
|
3045
3045
|
* @since 4.0.0
|
|
3046
3046
|
*/
|
|
3047
3047
|
function Array$4(O) {
|
|
3048
|
-
return make$
|
|
3048
|
+
return make$54((self$1, that) => {
|
|
3049
3049
|
const aLen = self$1.length;
|
|
3050
3050
|
const bLen = that.length;
|
|
3051
3051
|
const len = Math.min(aLen, bLen);
|
|
@@ -3053,7 +3053,7 @@ function Array$4(O) {
|
|
|
3053
3053
|
const o = O(self$1[i], that[i]);
|
|
3054
3054
|
if (o !== 0) return o;
|
|
3055
3055
|
}
|
|
3056
|
-
return Number$
|
|
3056
|
+
return Number$5(aLen, bLen);
|
|
3057
3057
|
});
|
|
3058
3058
|
}
|
|
3059
3059
|
/**
|
|
@@ -3099,7 +3099,7 @@ function Array$4(O) {
|
|
|
3099
3099
|
*/
|
|
3100
3100
|
function Struct$2(fields) {
|
|
3101
3101
|
const keys$1 = Object.keys(fields);
|
|
3102
|
-
return make$
|
|
3102
|
+
return make$54((self$1, that) => {
|
|
3103
3103
|
for (const key of keys$1) {
|
|
3104
3104
|
const o = fields[key](self$1[key], that[key]);
|
|
3105
3105
|
if (o !== 0) return o;
|
|
@@ -3410,7 +3410,7 @@ const liftThrowable = (f) => (...a) => {
|
|
|
3410
3410
|
|
|
3411
3411
|
//#endregion
|
|
3412
3412
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Duration.js
|
|
3413
|
-
const TypeId$
|
|
3413
|
+
const TypeId$57 = "~effect/time/Duration";
|
|
3414
3414
|
const bigint0$1 = /* @__PURE__ */ BigInt(0);
|
|
3415
3415
|
const bigint24 = /* @__PURE__ */ BigInt(24);
|
|
3416
3416
|
const bigint60 = /* @__PURE__ */ BigInt(60);
|
|
@@ -3436,9 +3436,9 @@ const DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|m
|
|
|
3436
3436
|
*/
|
|
3437
3437
|
const fromDurationInputUnsafe = (input) => {
|
|
3438
3438
|
if (isDuration(input)) return input;
|
|
3439
|
-
if (isNumber(input)) return millis(input);
|
|
3439
|
+
if (isNumber$1(input)) return millis(input);
|
|
3440
3440
|
if (isBigInt(input)) return nanos(input);
|
|
3441
|
-
if (Array.isArray(input) && input.length === 2 && input.every(isNumber)) {
|
|
3441
|
+
if (Array.isArray(input) && input.length === 2 && input.every(isNumber$1)) {
|
|
3442
3442
|
if (input[0] === -Infinity || input[1] === -Infinity || Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero;
|
|
3443
3443
|
if (input[0] === Infinity || input[1] === Infinity) return infinity;
|
|
3444
3444
|
return nanos(BigInt(Math.round(input[0] * 1e9)) + BigInt(Math.round(input[1])));
|
|
@@ -3494,7 +3494,7 @@ const zeroDurationValue = {
|
|
|
3494
3494
|
};
|
|
3495
3495
|
const infinityDurationValue = { _tag: "Infinity" };
|
|
3496
3496
|
const DurationProto = {
|
|
3497
|
-
[TypeId$
|
|
3497
|
+
[TypeId$57]: TypeId$57,
|
|
3498
3498
|
[symbol$3]() {
|
|
3499
3499
|
return structure(this.value);
|
|
3500
3500
|
},
|
|
@@ -3533,9 +3533,9 @@ const DurationProto = {
|
|
|
3533
3533
|
return pipeArguments(this, arguments);
|
|
3534
3534
|
}
|
|
3535
3535
|
};
|
|
3536
|
-
const make$
|
|
3536
|
+
const make$53 = (input) => {
|
|
3537
3537
|
const duration = Object.create(DurationProto);
|
|
3538
|
-
if (isNumber(input)) if (isNaN(input) || input <= 0) duration.value = zeroDurationValue;
|
|
3538
|
+
if (isNumber$1(input)) if (isNaN(input) || input <= 0) duration.value = zeroDurationValue;
|
|
3539
3539
|
else if (!Number.isFinite(input)) duration.value = infinityDurationValue;
|
|
3540
3540
|
else if (!Number.isInteger(input)) duration.value = {
|
|
3541
3541
|
_tag: "Nanos",
|
|
@@ -3566,7 +3566,7 @@ const make$52 = (input) => {
|
|
|
3566
3566
|
* @since 2.0.0
|
|
3567
3567
|
* @category guards
|
|
3568
3568
|
*/
|
|
3569
|
-
const isDuration = (u) => hasProperty(u, TypeId$
|
|
3569
|
+
const isDuration = (u) => hasProperty(u, TypeId$57);
|
|
3570
3570
|
/**
|
|
3571
3571
|
* Checks if a Duration is finite (not infinite).
|
|
3572
3572
|
*
|
|
@@ -3616,7 +3616,7 @@ const isZero = (self$1) => {
|
|
|
3616
3616
|
* @since 2.0.0
|
|
3617
3617
|
* @category constructors
|
|
3618
3618
|
*/
|
|
3619
|
-
const zero = /* @__PURE__ */ make$
|
|
3619
|
+
const zero = /* @__PURE__ */ make$53(0);
|
|
3620
3620
|
/**
|
|
3621
3621
|
* A Duration representing infinite time.
|
|
3622
3622
|
*
|
|
@@ -3630,7 +3630,7 @@ const zero = /* @__PURE__ */ make$52(0);
|
|
|
3630
3630
|
* @since 2.0.0
|
|
3631
3631
|
* @category constructors
|
|
3632
3632
|
*/
|
|
3633
|
-
const infinity = /* @__PURE__ */ make$
|
|
3633
|
+
const infinity = /* @__PURE__ */ make$53(Infinity);
|
|
3634
3634
|
/**
|
|
3635
3635
|
* Creates a Duration from nanoseconds.
|
|
3636
3636
|
*
|
|
@@ -3645,7 +3645,7 @@ const infinity = /* @__PURE__ */ make$52(Infinity);
|
|
|
3645
3645
|
* @since 2.0.0
|
|
3646
3646
|
* @category constructors
|
|
3647
3647
|
*/
|
|
3648
|
-
const nanos = (nanos$1) => make$
|
|
3648
|
+
const nanos = (nanos$1) => make$53(nanos$1);
|
|
3649
3649
|
/**
|
|
3650
3650
|
* Creates a Duration from microseconds.
|
|
3651
3651
|
*
|
|
@@ -3660,7 +3660,7 @@ const nanos = (nanos$1) => make$52(nanos$1);
|
|
|
3660
3660
|
* @since 2.0.0
|
|
3661
3661
|
* @category constructors
|
|
3662
3662
|
*/
|
|
3663
|
-
const micros = (micros$1) => make$
|
|
3663
|
+
const micros = (micros$1) => make$53(micros$1 * bigint1e3);
|
|
3664
3664
|
/**
|
|
3665
3665
|
* Creates a Duration from milliseconds.
|
|
3666
3666
|
*
|
|
@@ -3675,7 +3675,7 @@ const micros = (micros$1) => make$52(micros$1 * bigint1e3);
|
|
|
3675
3675
|
* @since 2.0.0
|
|
3676
3676
|
* @category constructors
|
|
3677
3677
|
*/
|
|
3678
|
-
const millis = (millis$1) => make$
|
|
3678
|
+
const millis = (millis$1) => make$53(millis$1);
|
|
3679
3679
|
/**
|
|
3680
3680
|
* Creates a Duration from seconds.
|
|
3681
3681
|
*
|
|
@@ -3690,7 +3690,7 @@ const millis = (millis$1) => make$52(millis$1);
|
|
|
3690
3690
|
* @since 2.0.0
|
|
3691
3691
|
* @category constructors
|
|
3692
3692
|
*/
|
|
3693
|
-
const seconds = (seconds$1) => make$
|
|
3693
|
+
const seconds = (seconds$1) => make$53(seconds$1 * 1e3);
|
|
3694
3694
|
/**
|
|
3695
3695
|
* Creates a Duration from minutes.
|
|
3696
3696
|
*
|
|
@@ -3705,7 +3705,7 @@ const seconds = (seconds$1) => make$52(seconds$1 * 1e3);
|
|
|
3705
3705
|
* @since 2.0.0
|
|
3706
3706
|
* @category constructors
|
|
3707
3707
|
*/
|
|
3708
|
-
const minutes = (minutes$1) => make$
|
|
3708
|
+
const minutes = (minutes$1) => make$53(minutes$1 * 6e4);
|
|
3709
3709
|
/**
|
|
3710
3710
|
* Creates a Duration from hours.
|
|
3711
3711
|
*
|
|
@@ -3720,7 +3720,7 @@ const minutes = (minutes$1) => make$52(minutes$1 * 6e4);
|
|
|
3720
3720
|
* @since 2.0.0
|
|
3721
3721
|
* @category constructors
|
|
3722
3722
|
*/
|
|
3723
|
-
const hours = (hours$1) => make$
|
|
3723
|
+
const hours = (hours$1) => make$53(hours$1 * 36e5);
|
|
3724
3724
|
/**
|
|
3725
3725
|
* Creates a Duration from days.
|
|
3726
3726
|
*
|
|
@@ -3735,7 +3735,7 @@ const hours = (hours$1) => make$52(hours$1 * 36e5);
|
|
|
3735
3735
|
* @since 2.0.0
|
|
3736
3736
|
* @category constructors
|
|
3737
3737
|
*/
|
|
3738
|
-
const days = (days$1) => make$
|
|
3738
|
+
const days = (days$1) => make$53(days$1 * 864e5);
|
|
3739
3739
|
/**
|
|
3740
3740
|
* Creates a Duration from weeks.
|
|
3741
3741
|
*
|
|
@@ -3750,7 +3750,7 @@ const days = (days$1) => make$52(days$1 * 864e5);
|
|
|
3750
3750
|
* @since 2.0.0
|
|
3751
3751
|
* @category constructors
|
|
3752
3752
|
*/
|
|
3753
|
-
const weeks = (weeks$1) => make$
|
|
3753
|
+
const weeks = (weeks$1) => make$53(weeks$1 * 6048e5);
|
|
3754
3754
|
/**
|
|
3755
3755
|
* Converts a Duration to milliseconds.
|
|
3756
3756
|
*
|
|
@@ -4065,7 +4065,7 @@ const format$2 = (self$1) => {
|
|
|
4065
4065
|
* @category constructors
|
|
4066
4066
|
* @since 2.0.0
|
|
4067
4067
|
*/
|
|
4068
|
-
const make$
|
|
4068
|
+
const make$52 = (isEquivalent) => (self$1, that) => self$1 === that || isEquivalent(self$1, that);
|
|
4069
4069
|
const isStrictEquivalent = (x, y) => x === y;
|
|
4070
4070
|
/**
|
|
4071
4071
|
* Creates an equivalence relation that uses strict equality (`===`) to compare values.
|
|
@@ -4175,7 +4175,7 @@ const strictEqual = () => isStrictEquivalent;
|
|
|
4175
4175
|
* @since 4.0.0
|
|
4176
4176
|
*/
|
|
4177
4177
|
function Tuple$1(elements) {
|
|
4178
|
-
return make$
|
|
4178
|
+
return make$52((self$1, that) => {
|
|
4179
4179
|
if (self$1.length !== that.length) return false;
|
|
4180
4180
|
for (let i = 0; i < self$1.length; i++) if (!elements[i](self$1[i], that[i])) return false;
|
|
4181
4181
|
return true;
|
|
@@ -4232,7 +4232,7 @@ function Tuple$1(elements) {
|
|
|
4232
4232
|
* @since 4.0.0
|
|
4233
4233
|
*/
|
|
4234
4234
|
function Array$3(item) {
|
|
4235
|
-
return make$
|
|
4235
|
+
return make$52((self$1, that) => {
|
|
4236
4236
|
if (self$1.length !== that.length) return false;
|
|
4237
4237
|
for (let i = 0; i < self$1.length; i++) if (!item(self$1[i], that[i])) return false;
|
|
4238
4238
|
return true;
|
|
@@ -4308,7 +4308,7 @@ function Array$3(item) {
|
|
|
4308
4308
|
*/
|
|
4309
4309
|
function Struct$1(fields) {
|
|
4310
4310
|
const keys$1 = Reflect.ownKeys(fields);
|
|
4311
|
-
return make$
|
|
4311
|
+
return make$52((self$1, that) => {
|
|
4312
4312
|
for (const key of keys$1) if (!fields[key](self$1[key], that[key])) return false;
|
|
4313
4313
|
return true;
|
|
4314
4314
|
});
|
|
@@ -4319,9 +4319,9 @@ function Struct$1(fields) {
|
|
|
4319
4319
|
/**
|
|
4320
4320
|
* @since 2.0.0
|
|
4321
4321
|
*/
|
|
4322
|
-
const TypeId$
|
|
4322
|
+
const TypeId$56 = "~effect/data/Option";
|
|
4323
4323
|
const CommonProto$1 = {
|
|
4324
|
-
[TypeId$
|
|
4324
|
+
[TypeId$56]: { _A: (_) => _ },
|
|
4325
4325
|
...PipeInspectableProto,
|
|
4326
4326
|
...YieldableProto
|
|
4327
4327
|
};
|
|
@@ -4372,7 +4372,7 @@ const NoneProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Co
|
|
|
4372
4372
|
}
|
|
4373
4373
|
});
|
|
4374
4374
|
/** @internal */
|
|
4375
|
-
const isOption$1 = (input) => hasProperty(input, TypeId$
|
|
4375
|
+
const isOption$1 = (input) => hasProperty(input, TypeId$56);
|
|
4376
4376
|
/** @internal */
|
|
4377
4377
|
const isNone$1 = (fa) => fa._tag === "None";
|
|
4378
4378
|
/** @internal */
|
|
@@ -4388,9 +4388,9 @@ const some$1 = (value) => {
|
|
|
4388
4388
|
|
|
4389
4389
|
//#endregion
|
|
4390
4390
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/internal/result.js
|
|
4391
|
-
const TypeId$
|
|
4391
|
+
const TypeId$55 = "~effect/data/Result";
|
|
4392
4392
|
const CommonProto = {
|
|
4393
|
-
[TypeId$
|
|
4393
|
+
[TypeId$55]: {
|
|
4394
4394
|
_A: (_) => _,
|
|
4395
4395
|
_E: (_) => _
|
|
4396
4396
|
},
|
|
@@ -4444,7 +4444,7 @@ const FailureProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create
|
|
|
4444
4444
|
}
|
|
4445
4445
|
});
|
|
4446
4446
|
/** @internal */
|
|
4447
|
-
const isResult$1 = (input) => hasProperty(input, TypeId$
|
|
4447
|
+
const isResult$1 = (input) => hasProperty(input, TypeId$55);
|
|
4448
4448
|
/** @internal */
|
|
4449
4449
|
const isFailure$5 = (result$2) => result$2._tag === "Failure";
|
|
4450
4450
|
/** @internal */
|
|
@@ -5025,7 +5025,7 @@ const filterMap$2 = flatMap$3;
|
|
|
5025
5025
|
* @category Filtering
|
|
5026
5026
|
* @since 2.0.0
|
|
5027
5027
|
*/
|
|
5028
|
-
const filter$
|
|
5028
|
+
const filter$6 = /* @__PURE__ */ dual(2, (self$1, predicate) => filterMap$2(self$1, (b) => predicate(b) ? some$1(b) : none$4));
|
|
5029
5029
|
/**
|
|
5030
5030
|
* Creates an `Equivalence` instance for comparing `Option` values, using a
|
|
5031
5031
|
* provided `Equivalence` for the inner type.
|
|
@@ -5066,7 +5066,7 @@ const filter$5 = /* @__PURE__ */ dual(2, (self$1, predicate) => filterMap$2(self
|
|
|
5066
5066
|
* @category Equivalence
|
|
5067
5067
|
* @since 2.0.0
|
|
5068
5068
|
*/
|
|
5069
|
-
const makeEquivalence$4 = (isEquivalent) => make$
|
|
5069
|
+
const makeEquivalence$4 = (isEquivalent) => make$52((x, y) => isNone(x) ? isNone(y) : isNone(y) ? false : isEquivalent(x.value, y.value));
|
|
5070
5070
|
|
|
5071
5071
|
//#endregion
|
|
5072
5072
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Result.js
|
|
@@ -5475,7 +5475,7 @@ const has$2 = (key) => (input) => input.has(key) ? input : fail$8(input);
|
|
|
5475
5475
|
* @since 4.0.0
|
|
5476
5476
|
* @category Constructors
|
|
5477
5477
|
*/
|
|
5478
|
-
const number$1 = /* @__PURE__ */ fromPredicate(isNumber);
|
|
5478
|
+
const number$1 = /* @__PURE__ */ fromPredicate(isNumber$1);
|
|
5479
5479
|
/**
|
|
5480
5480
|
* A predefined filter that only passes through boolean values.
|
|
5481
5481
|
*
|
|
@@ -5912,7 +5912,7 @@ const map$11 = /* @__PURE__ */ dual(2, (self$1, f) => {
|
|
|
5912
5912
|
* @category filtering
|
|
5913
5913
|
* @since 2.0.0
|
|
5914
5914
|
*/
|
|
5915
|
-
const filter$
|
|
5915
|
+
const filter$5 = /* @__PURE__ */ dual(2, (self$1, predicate) => {
|
|
5916
5916
|
const out = empty$13();
|
|
5917
5917
|
for (const key of keys(self$1)) if (predicate(self$1[key], key)) out[key] = self$1[key];
|
|
5918
5918
|
return out;
|
|
@@ -6420,7 +6420,7 @@ const map$10 = /* @__PURE__ */ dual(2, (self$1, f) => self$1.map(f));
|
|
|
6420
6420
|
* @category filtering
|
|
6421
6421
|
* @since 2.0.0
|
|
6422
6422
|
*/
|
|
6423
|
-
const filter$
|
|
6423
|
+
const filter$4 = /* @__PURE__ */ dual(2, (self$1, predicate) => {
|
|
6424
6424
|
const as$3 = fromIterable$2(self$1);
|
|
6425
6425
|
const out = [];
|
|
6426
6426
|
for (let i = 0; i < as$3.length; i++) if (predicate(as$3[i], i)) out.push(as$3[i]);
|
|
@@ -6571,23 +6571,23 @@ const ServiceProto = {
|
|
|
6571
6571
|
};
|
|
6572
6572
|
},
|
|
6573
6573
|
asEffect() {
|
|
6574
|
-
return (this.asEffect = constant(withFiber$1((fiber$2) => exitSucceed(get$
|
|
6574
|
+
return (this.asEffect = constant(withFiber$1((fiber$2) => exitSucceed(get$8(fiber$2.services, this)))))();
|
|
6575
6575
|
},
|
|
6576
6576
|
of(self$1) {
|
|
6577
6577
|
return self$1;
|
|
6578
6578
|
},
|
|
6579
6579
|
serviceMap(self$1) {
|
|
6580
|
-
return make$
|
|
6580
|
+
return make$51(this, self$1);
|
|
6581
6581
|
},
|
|
6582
6582
|
use(f) {
|
|
6583
|
-
return withFiber$1((fiber$2) => f(get$
|
|
6583
|
+
return withFiber$1((fiber$2) => f(get$8(fiber$2.services, this)));
|
|
6584
6584
|
},
|
|
6585
6585
|
useSync(f) {
|
|
6586
|
-
return withFiber$1((fiber$2) => exitSucceed(f(get$
|
|
6586
|
+
return withFiber$1((fiber$2) => exitSucceed(f(get$8(fiber$2.services, this))));
|
|
6587
6587
|
}
|
|
6588
6588
|
};
|
|
6589
6589
|
const ReferenceTypeId = "~effect/ServiceMap/Reference";
|
|
6590
|
-
const TypeId$
|
|
6590
|
+
const TypeId$54 = "~effect/ServiceMap";
|
|
6591
6591
|
/**
|
|
6592
6592
|
* @example
|
|
6593
6593
|
* ```ts
|
|
@@ -6611,7 +6611,7 @@ const makeUnsafe$8 = (mapUnsafe) => {
|
|
|
6611
6611
|
};
|
|
6612
6612
|
const Proto$19 = {
|
|
6613
6613
|
...PipeInspectableProto,
|
|
6614
|
-
[TypeId$
|
|
6614
|
+
[TypeId$54]: { _Services: (_) => _ },
|
|
6615
6615
|
toJSON() {
|
|
6616
6616
|
return {
|
|
6617
6617
|
_id: "ServiceMap",
|
|
@@ -6644,7 +6644,7 @@ const Proto$19 = {
|
|
|
6644
6644
|
* @since 4.0.0
|
|
6645
6645
|
* @category Guards
|
|
6646
6646
|
*/
|
|
6647
|
-
const isServiceMap = (u) => hasProperty(u, TypeId$
|
|
6647
|
+
const isServiceMap = (u) => hasProperty(u, TypeId$54);
|
|
6648
6648
|
/**
|
|
6649
6649
|
* Checks if the provided argument is a `Reference`.
|
|
6650
6650
|
*
|
|
@@ -6699,7 +6699,7 @@ const emptyServiceMap = /* @__PURE__ */ makeUnsafe$8(/* @__PURE__ */ new Map());
|
|
|
6699
6699
|
* @since 4.0.0
|
|
6700
6700
|
* @category Constructors
|
|
6701
6701
|
*/
|
|
6702
|
-
const make$
|
|
6702
|
+
const make$51 = (key, service$2) => makeUnsafe$8(new Map([[key.key, service$2]]));
|
|
6703
6703
|
/**
|
|
6704
6704
|
* Adds a service to a given `ServiceMap`.
|
|
6705
6705
|
*
|
|
@@ -6800,7 +6800,7 @@ const getUnsafe = /* @__PURE__ */ dual(2, (self$1, service$2) => {
|
|
|
6800
6800
|
* @since 4.0.0
|
|
6801
6801
|
* @category Getters
|
|
6802
6802
|
*/
|
|
6803
|
-
const get$
|
|
6803
|
+
const get$8 = getUnsafe;
|
|
6804
6804
|
/**
|
|
6805
6805
|
* @example
|
|
6806
6806
|
* ```ts
|
|
@@ -7243,7 +7243,7 @@ var ParentSpan = class extends Service()(ParentSpanKey) {};
|
|
|
7243
7243
|
* })
|
|
7244
7244
|
* ```
|
|
7245
7245
|
*/
|
|
7246
|
-
const make$
|
|
7246
|
+
const make$50 = (options) => options;
|
|
7247
7247
|
/**
|
|
7248
7248
|
* @since 2.0.0
|
|
7249
7249
|
* @category constructors
|
|
@@ -7312,7 +7312,7 @@ const TracerKey = "effect/Tracer";
|
|
|
7312
7312
|
* })
|
|
7313
7313
|
* ```
|
|
7314
7314
|
*/
|
|
7315
|
-
const Tracer = /* @__PURE__ */ Reference(TracerKey, { defaultValue: () => make$
|
|
7315
|
+
const Tracer = /* @__PURE__ */ Reference(TracerKey, { defaultValue: () => make$50({ span: (name, parent, annotations$1, links, startTime, kind) => new NativeSpan(name, parent, annotations$1, links.slice(), startTime, kind) }) });
|
|
7316
7316
|
/**
|
|
7317
7317
|
* @since 4.0.0
|
|
7318
7318
|
* @category native tracer
|
|
@@ -8212,10 +8212,10 @@ var FiberImpl = class {
|
|
|
8212
8212
|
interruptUnsafe(fiberId$2, annotations$1) {
|
|
8213
8213
|
if (this._exit) return;
|
|
8214
8214
|
let cause = causeInterrupt(fiberId$2);
|
|
8215
|
-
if (this.currentStackFrame) cause = causeAnnotate(cause, make$
|
|
8215
|
+
if (this.currentStackFrame) cause = causeAnnotate(cause, make$51(StackTraceKey, this.currentStackFrame));
|
|
8216
8216
|
if (annotations$1) cause = causeAnnotate(cause, annotations$1);
|
|
8217
8217
|
this._interruptedCause = this._interruptedCause ? causeMerge(this._interruptedCause, cause) : cause;
|
|
8218
|
-
if (this.interruptible) this.evaluate(failCause$
|
|
8218
|
+
if (this.interruptible) this.evaluate(failCause$5(this._interruptedCause));
|
|
8219
8219
|
}
|
|
8220
8220
|
pollUnsafe() {
|
|
8221
8221
|
return this._exit;
|
|
@@ -8399,7 +8399,7 @@ const fiberInterruptAllAs = /* @__PURE__ */ dual(2, (fibers, fiberId$2) => withF
|
|
|
8399
8399
|
/** @internal */
|
|
8400
8400
|
const succeed$5 = exitSucceed;
|
|
8401
8401
|
/** @internal */
|
|
8402
|
-
const failCause$
|
|
8402
|
+
const failCause$5 = exitFailCause;
|
|
8403
8403
|
/** @internal */
|
|
8404
8404
|
const fail$7 = exitFail;
|
|
8405
8405
|
/** @internal */
|
|
@@ -8447,7 +8447,7 @@ const succeedSome$1 = (a) => succeed$5(some(a));
|
|
|
8447
8447
|
/** @internal */
|
|
8448
8448
|
const succeedNone$1 = /* @__PURE__ */ succeed$5(/* @__PURE__ */ none$3());
|
|
8449
8449
|
/** @internal */
|
|
8450
|
-
const failCauseSync$1 = (evaluate$1) => suspend$4(() => failCause$
|
|
8450
|
+
const failCauseSync$1 = (evaluate$1) => suspend$4(() => failCause$5(internalCall(evaluate$1)));
|
|
8451
8451
|
/** @internal */
|
|
8452
8452
|
const die$4 = (defect) => exitDie(defect);
|
|
8453
8453
|
/** @internal */
|
|
@@ -8523,7 +8523,7 @@ const asyncFinalizer = /* @__PURE__ */ makePrimitive$1({
|
|
|
8523
8523
|
}
|
|
8524
8524
|
},
|
|
8525
8525
|
[contE](cause, _fiber) {
|
|
8526
|
-
return causeHasInterrupt(cause) ? flatMap$2(this[args](), () => failCause$
|
|
8526
|
+
return causeHasInterrupt(cause) ? flatMap$2(this[args](), () => failCause$5(cause)) : failCause$5(cause);
|
|
8527
8527
|
}
|
|
8528
8528
|
});
|
|
8529
8529
|
/** @internal */
|
|
@@ -8670,7 +8670,7 @@ const raceAll$1 = (all$2, options) => withFiber$1((parent) => callback$2((resume
|
|
|
8670
8670
|
doneCount++;
|
|
8671
8671
|
if (exit$2._tag === "Failure") {
|
|
8672
8672
|
failures.push(...exit$2.cause.failures);
|
|
8673
|
-
if (doneCount >= len) resume(failCause$
|
|
8673
|
+
if (doneCount >= len) resume(failCause$5(causeFromFailures(failures)));
|
|
8674
8674
|
return;
|
|
8675
8675
|
}
|
|
8676
8676
|
const isWinner = !done$3;
|
|
@@ -8872,7 +8872,7 @@ const provideServices$1 = /* @__PURE__ */ dual(2, (self$1, services$2) => {
|
|
|
8872
8872
|
return updateServices$1(self$1, merge$5(services$2));
|
|
8873
8873
|
});
|
|
8874
8874
|
/** @internal */
|
|
8875
|
-
const provideService$
|
|
8875
|
+
const provideService$2 = function() {
|
|
8876
8876
|
if (arguments.length === 1) return dual(2, (self$1, impl) => provideServiceImpl(self$1, arguments[0], impl));
|
|
8877
8877
|
return dual(3, (self$1, service$2, impl) => provideServiceImpl(self$1, service$2, impl)).apply(this, arguments);
|
|
8878
8878
|
};
|
|
@@ -8882,9 +8882,9 @@ const provideServiceImpl = (self$1, service$2, implementation) => withFiber$1((f
|
|
|
8882
8882
|
return onExit$3(self$1, () => fiber$2.setServices(addOrOmit(fiber$2.services, service$2, prev)));
|
|
8883
8883
|
});
|
|
8884
8884
|
/** @internal */
|
|
8885
|
-
const provideServiceEffect$
|
|
8885
|
+
const provideServiceEffect$2 = /* @__PURE__ */ dual(3, (self$1, service$2, acquire) => flatMap$2(acquire, (implementation) => provideService$2(self$1, service$2, implementation)));
|
|
8886
8886
|
/** @internal */
|
|
8887
|
-
const withConcurrency$1 = /* @__PURE__ */ provideService$
|
|
8887
|
+
const withConcurrency$1 = /* @__PURE__ */ provideService$2(CurrentConcurrency);
|
|
8888
8888
|
/** @internal */
|
|
8889
8889
|
const zip$1 = /* @__PURE__ */ dual((args$1) => isEffect$1(args$1[1]), (self$1, that, options) => zipWith$1(self$1, that, (a, a2) => [a, a2], options));
|
|
8890
8890
|
/** @internal */
|
|
@@ -8917,21 +8917,21 @@ const OnFailureProto = /* @__PURE__ */ makePrimitiveProto({
|
|
|
8917
8917
|
}
|
|
8918
8918
|
});
|
|
8919
8919
|
/** @internal */
|
|
8920
|
-
const catchCauseFilter$2 = /* @__PURE__ */ dual(3, (self$1, filter$
|
|
8921
|
-
const eb = filter$
|
|
8922
|
-
return !isFail(eb) ? internalCall(() => f(eb, cause)) : failCause$
|
|
8920
|
+
const catchCauseFilter$2 = /* @__PURE__ */ dual(3, (self$1, filter$7, f) => catchCause$2(self$1, (cause) => {
|
|
8921
|
+
const eb = filter$7(cause);
|
|
8922
|
+
return !isFail(eb) ? internalCall(() => f(eb, cause)) : failCause$5(eb.fail);
|
|
8923
8923
|
}));
|
|
8924
8924
|
/** @internal */
|
|
8925
8925
|
const catch_$2 = /* @__PURE__ */ dual(2, (self$1, f) => catchCauseFilter$2(self$1, causeFilterError, (e) => f(e)));
|
|
8926
8926
|
/** @internal */
|
|
8927
8927
|
const catchDefect$1 = /* @__PURE__ */ dual(2, (self$1, f) => catchCauseFilter$2(self$1, causeFilterDefect, f));
|
|
8928
8928
|
/** @internal */
|
|
8929
|
-
const tapCause$1 = /* @__PURE__ */ dual(2, (self$1, f) => catchCause$2(self$1, (cause) => andThen$1(internalCall(() => f(cause)), failCause$
|
|
8929
|
+
const tapCause$1 = /* @__PURE__ */ dual(2, (self$1, f) => catchCause$2(self$1, (cause) => andThen$1(internalCall(() => f(cause)), failCause$5(cause))));
|
|
8930
8930
|
/** @internal */
|
|
8931
|
-
const tapCauseFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$
|
|
8932
|
-
const result$2 = filter$
|
|
8931
|
+
const tapCauseFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$7, f) => catchCauseFilter$2(self$1, (cause) => {
|
|
8932
|
+
const result$2 = filter$7(cause);
|
|
8933
8933
|
return isFail(result$2) ? fail$8(cause) : result$2;
|
|
8934
|
-
}, (failure, cause) => andThen$1(internalCall(() => f(failure, cause)), failCause$
|
|
8934
|
+
}, (failure, cause) => andThen$1(internalCall(() => f(failure, cause)), failCause$5(cause))));
|
|
8935
8935
|
/** @internal */
|
|
8936
8936
|
const tapError$1 = /* @__PURE__ */ dual(2, (self$1, f) => tapCauseFilter$1(self$1, causeFilterError, (e) => f(e)));
|
|
8937
8937
|
/** @internal */
|
|
@@ -8944,11 +8944,11 @@ const tapDefect$1 = /* @__PURE__ */ dual(2, (self$1, f) => tapCauseFilter$1(self
|
|
|
8944
8944
|
/** @internal */
|
|
8945
8945
|
const catchIf$1 = /* @__PURE__ */ dual(3, (self$1, predicate, f) => catchCause$2(self$1, (cause) => {
|
|
8946
8946
|
const error$1 = causeFilterError(cause);
|
|
8947
|
-
if (isFail(error$1)) return failCause$
|
|
8948
|
-
return predicate(error$1) ? internalCall(() => f(error$1)) : failCause$
|
|
8947
|
+
if (isFail(error$1)) return failCause$5(error$1.fail);
|
|
8948
|
+
return predicate(error$1) ? internalCall(() => f(error$1)) : failCause$5(cause);
|
|
8949
8949
|
}));
|
|
8950
8950
|
/** @internal */
|
|
8951
|
-
const catchFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$
|
|
8951
|
+
const catchFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$7, f) => catchCauseFilter$2(self$1, compose(causeFilterError, mapFail(filter$7, causeFail)), (e) => f(e)));
|
|
8952
8952
|
/** @internal */
|
|
8953
8953
|
const catchTag$1 = /* @__PURE__ */ dual(3, (self$1, k, f) => {
|
|
8954
8954
|
const pred = Array.isArray(k) ? (e) => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k);
|
|
@@ -9037,7 +9037,7 @@ const matchCause$1 = /* @__PURE__ */ dual(2, (self$1, options) => matchCauseEffe
|
|
|
9037
9037
|
const matchEffect$2 = /* @__PURE__ */ dual(2, (self$1, options) => matchCauseEffect$1(self$1, {
|
|
9038
9038
|
onFailure: (cause) => {
|
|
9039
9039
|
const fail$11 = cause.failures.find(failureIsFail$1);
|
|
9040
|
-
return fail$11 ? internalCall(() => options.onFailure(fail$11.error)) : failCause$
|
|
9040
|
+
return fail$11 ? internalCall(() => options.onFailure(fail$11.error)) : failCause$5(cause);
|
|
9041
9041
|
},
|
|
9042
9042
|
onSuccess: options.onSuccess
|
|
9043
9043
|
}));
|
|
@@ -9192,7 +9192,7 @@ const scopeMake = (finalizerStrategy) => sync$1(() => scopeMakeUnsafe(finalizerS
|
|
|
9192
9192
|
/** @internal */
|
|
9193
9193
|
const scope$1 = /* @__PURE__ */ scopeTag.asEffect();
|
|
9194
9194
|
/** @internal */
|
|
9195
|
-
const provideScope = /* @__PURE__ */ provideService$
|
|
9195
|
+
const provideScope = /* @__PURE__ */ provideService$2(scopeTag);
|
|
9196
9196
|
/** @internal */
|
|
9197
9197
|
const scoped$2 = (self$1) => withFiber$1((fiber$2) => {
|
|
9198
9198
|
const prev = getOption(fiber$2.services, scopeTag);
|
|
@@ -9245,14 +9245,14 @@ const onExitInterruptible$1 = /* @__PURE__ */ dual(2, (self$1, f) => onExitPrimi
|
|
|
9245
9245
|
/** @internal */
|
|
9246
9246
|
const ensuring$1 = /* @__PURE__ */ dual(2, (self$1, finalizer) => onExit$3(self$1, (_) => finalizer));
|
|
9247
9247
|
/** @internal */
|
|
9248
|
-
const onExitFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$
|
|
9249
|
-
const b = filter$
|
|
9248
|
+
const onExitFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$7, f) => onExit$3(self$1, (exit$2) => {
|
|
9249
|
+
const b = filter$7(exit$2);
|
|
9250
9250
|
return isFail(b) ? void 0 : f(b, exit$2);
|
|
9251
9251
|
}));
|
|
9252
9252
|
/** @internal */
|
|
9253
9253
|
const onError$1 = /* @__PURE__ */ dual(2, (self$1, f) => onExitFilter$1(self$1, exitFilterCause, f));
|
|
9254
9254
|
/** @internal */
|
|
9255
|
-
const onErrorFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$
|
|
9255
|
+
const onErrorFilter$1 = /* @__PURE__ */ dual(3, (self$1, filter$7, f) => onExitFilter$1(self$1, compose(exitFilterCause, filter$7), (eb, exit$2) => f(eb, exit$2.cause)));
|
|
9256
9256
|
/** @internal */
|
|
9257
9257
|
const onInterrupt$1 = /* @__PURE__ */ dual(2, (self$1, finalizer) => onErrorFilter$1(self$1, causeFilterInterruptors, isEffect$1(finalizer) ? constant(finalizer) : finalizer));
|
|
9258
9258
|
/** @internal */
|
|
@@ -9289,7 +9289,7 @@ const cachedWithTTL$1 = /* @__PURE__ */ dual(2, (self$1, timeToLive) => map$9(ca
|
|
|
9289
9289
|
/** @internal */
|
|
9290
9290
|
const cached$1 = (self$1) => cachedWithTTL$1(self$1, infinity);
|
|
9291
9291
|
/** @internal */
|
|
9292
|
-
const interrupt$4 = /* @__PURE__ */ withFiber$1((fiber$2) => failCause$
|
|
9292
|
+
const interrupt$4 = /* @__PURE__ */ withFiber$1((fiber$2) => failCause$5(causeInterrupt(fiber$2.id)));
|
|
9293
9293
|
/** @internal */
|
|
9294
9294
|
const uninterruptible$1 = (self$1) => withFiber$1((fiber$2) => {
|
|
9295
9295
|
if (!fiber$2.interruptible) return self$1;
|
|
@@ -9301,7 +9301,7 @@ const setInterruptible = /* @__PURE__ */ makePrimitive$1({
|
|
|
9301
9301
|
op: "SetInterruptible",
|
|
9302
9302
|
[contAll](fiber$2) {
|
|
9303
9303
|
fiber$2.interruptible = this[args];
|
|
9304
|
-
if (fiber$2._interruptedCause && fiber$2.interruptible) return () => failCause$
|
|
9304
|
+
if (fiber$2._interruptedCause && fiber$2.interruptible) return () => failCause$5(fiber$2._interruptedCause);
|
|
9305
9305
|
}
|
|
9306
9306
|
});
|
|
9307
9307
|
const setInterruptibleTrue = /* @__PURE__ */ setInterruptible(true);
|
|
@@ -9311,7 +9311,7 @@ const interruptible$1 = (self$1) => withFiber$1((fiber$2) => {
|
|
|
9311
9311
|
if (fiber$2.interruptible) return self$1;
|
|
9312
9312
|
fiber$2.interruptible = true;
|
|
9313
9313
|
fiber$2._stack.push(setInterruptibleFalse);
|
|
9314
|
-
if (fiber$2._interruptedCause) return failCause$
|
|
9314
|
+
if (fiber$2._interruptedCause) return failCause$5(fiber$2._interruptedCause);
|
|
9315
9315
|
return self$1;
|
|
9316
9316
|
});
|
|
9317
9317
|
/** @internal */
|
|
@@ -9441,7 +9441,7 @@ const forEachSequential = (iterable, f, options) => suspend$4(() => {
|
|
|
9441
9441
|
});
|
|
9442
9442
|
const filterOrElse$1 = /* @__PURE__ */ dual(3, (self$1, predicate, orElse$1) => flatMap$2(self$1, (a) => predicate(a) ? succeed$5(a) : orElse$1(a)));
|
|
9443
9443
|
/** @internal */
|
|
9444
|
-
const filter$
|
|
9444
|
+
const filter$3 = /* @__PURE__ */ dual((args$1) => isIterable(args$1[0]) && !isEffect$1(args$1[0]), (elements, predicate, options) => suspend$4(() => {
|
|
9445
9445
|
const out = [];
|
|
9446
9446
|
return as$1(forEach$2(elements, (a, i) => map$9(predicate(a, i), (keep) => {
|
|
9447
9447
|
if (keep) out.push(a);
|
|
@@ -9451,9 +9451,9 @@ const filter$2 = /* @__PURE__ */ dual((args$1) => isIterable(args$1[0]) && !isEf
|
|
|
9451
9451
|
}), out);
|
|
9452
9452
|
}));
|
|
9453
9453
|
/** @internal */
|
|
9454
|
-
const filterMap$1 = /* @__PURE__ */ dual((args$1) => isIterable(args$1[0]) && !isEffect$1(args$1[0]), (elements, filter$
|
|
9454
|
+
const filterMap$1 = /* @__PURE__ */ dual((args$1) => isIterable(args$1[0]) && !isEffect$1(args$1[0]), (elements, filter$7, options) => suspend$4(() => {
|
|
9455
9455
|
const out = [];
|
|
9456
|
-
return as$1(forEach$2(elements, (a) => map$9(filter$
|
|
9456
|
+
return as$1(forEach$2(elements, (a) => map$9(filter$7(a), (result$2) => {
|
|
9457
9457
|
if (!isFail(result$2)) out.push(result$2);
|
|
9458
9458
|
}), {
|
|
9459
9459
|
discard: true,
|
|
@@ -9696,11 +9696,11 @@ const makeLatch$1 = (open$1) => sync$1(() => makeLatchUnsafe$1(open$1));
|
|
|
9696
9696
|
/** @internal */
|
|
9697
9697
|
const tracer$2 = /* @__PURE__ */ withFiber$1((fiber$2) => succeed$5(fiber$2.getRef(Tracer)));
|
|
9698
9698
|
/** @internal */
|
|
9699
|
-
const withTracer$1 = /* @__PURE__ */ dual(2, (effect$1, tracer$3) => provideService$
|
|
9699
|
+
const withTracer$1 = /* @__PURE__ */ dual(2, (effect$1, tracer$3) => provideService$2(effect$1, Tracer, tracer$3));
|
|
9700
9700
|
/** @internal */
|
|
9701
|
-
const withTracerEnabled$1 = /* @__PURE__ */ provideService$
|
|
9701
|
+
const withTracerEnabled$1 = /* @__PURE__ */ provideService$2(TracerEnabled);
|
|
9702
9702
|
/** @internal */
|
|
9703
|
-
const withTracerTiming$1 = /* @__PURE__ */ provideService$
|
|
9703
|
+
const withTracerTiming$1 = /* @__PURE__ */ provideService$2(TracerTimingEnabled);
|
|
9704
9704
|
const bigint0 = /* @__PURE__ */ BigInt(0);
|
|
9705
9705
|
const NoopSpanProto = {
|
|
9706
9706
|
_tag: "Span",
|
|
@@ -9724,11 +9724,11 @@ const NoopSpanProto = {
|
|
|
9724
9724
|
/** @internal */
|
|
9725
9725
|
const noopSpan = (options) => Object.assign(Object.create(NoopSpanProto), options);
|
|
9726
9726
|
const filterDisablePropagation = (span) => {
|
|
9727
|
-
if (span) return get$
|
|
9727
|
+
if (span) return get$8(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(span.parent) : void 0 : span;
|
|
9728
9728
|
};
|
|
9729
9729
|
/** @internal */
|
|
9730
9730
|
const makeSpanUnsafe = (fiber$2, name, options) => {
|
|
9731
|
-
const disablePropagation = !fiber$2.getRef(TracerEnabled) || options?.annotations && get$
|
|
9731
|
+
const disablePropagation = !fiber$2.getRef(TracerEnabled) || options?.annotations && get$8(options.annotations, DisablePropagation);
|
|
9732
9732
|
const parent = options?.parent ?? (options?.root ? void 0 : filterDisablePropagation(fiber$2.currentSpan));
|
|
9733
9733
|
let span;
|
|
9734
9734
|
if (disablePropagation) span = noopSpan({
|
|
@@ -9808,7 +9808,7 @@ const useSpan$1 = (name, ...args$1) => {
|
|
|
9808
9808
|
});
|
|
9809
9809
|
});
|
|
9810
9810
|
};
|
|
9811
|
-
const provideParentSpan = /* @__PURE__ */ provideService$
|
|
9811
|
+
const provideParentSpan = /* @__PURE__ */ provideService$2(ParentSpan);
|
|
9812
9812
|
/** @internal */
|
|
9813
9813
|
const withParentSpan$1 = function() {
|
|
9814
9814
|
const dataFirst = isEffect$1(arguments[0]);
|
|
@@ -9962,7 +9962,7 @@ const logLevelToOrder = (level) => {
|
|
|
9962
9962
|
}
|
|
9963
9963
|
};
|
|
9964
9964
|
/** @internal */
|
|
9965
|
-
const LogLevelOrder = /* @__PURE__ */ mapInput(Number$
|
|
9965
|
+
const LogLevelOrder = /* @__PURE__ */ mapInput(Number$5, logLevelToOrder);
|
|
9966
9966
|
/** @internal */
|
|
9967
9967
|
const isLogLevelGreaterThan = /* @__PURE__ */ isGreaterThan$4(LogLevelOrder);
|
|
9968
9968
|
/** @internal */
|
|
@@ -10247,7 +10247,7 @@ const succeed$4 = exitSucceed;
|
|
|
10247
10247
|
* @category constructors
|
|
10248
10248
|
* @since 2.0.0
|
|
10249
10249
|
*/
|
|
10250
|
-
const failCause$
|
|
10250
|
+
const failCause$4 = exitFailCause;
|
|
10251
10251
|
/**
|
|
10252
10252
|
* Creates a failed `Exit` from an error value.
|
|
10253
10253
|
*
|
|
@@ -10617,7 +10617,7 @@ const makeUnsafe$7 = () => {
|
|
|
10617
10617
|
* @since 2.0.0
|
|
10618
10618
|
* @category constructors
|
|
10619
10619
|
*/
|
|
10620
|
-
const make$
|
|
10620
|
+
const make$49 = () => sync$1(() => makeUnsafe$7());
|
|
10621
10621
|
const _await = (self$1) => callback$2((resume) => {
|
|
10622
10622
|
if (self$1.effect) return resume(self$1.effect);
|
|
10623
10623
|
self$1.resumes ??= [];
|
|
@@ -10671,6 +10671,47 @@ const completeWith = /* @__PURE__ */ dual(2, (self$1, effect$1) => sync$1(() =>
|
|
|
10671
10671
|
*/
|
|
10672
10672
|
const done$1 = completeWith;
|
|
10673
10673
|
/**
|
|
10674
|
+
* Fails the `Deferred` with the specified `Cause`, which will be propagated to
|
|
10675
|
+
* all fibers waiting on the value of the `Deferred`.
|
|
10676
|
+
*
|
|
10677
|
+
* @example
|
|
10678
|
+
* ```ts
|
|
10679
|
+
* import { Cause, Deferred, Effect } from "effect"
|
|
10680
|
+
*
|
|
10681
|
+
* const program = Effect.gen(function*() {
|
|
10682
|
+
* const deferred = yield* Deferred.make<number, string>()
|
|
10683
|
+
* const success = yield* Deferred.failCause(
|
|
10684
|
+
* deferred,
|
|
10685
|
+
* Cause.fail("Operation failed")
|
|
10686
|
+
* )
|
|
10687
|
+
* console.log(success) // true
|
|
10688
|
+
* })
|
|
10689
|
+
* ```
|
|
10690
|
+
*
|
|
10691
|
+
* @since 2.0.0
|
|
10692
|
+
* @category utils
|
|
10693
|
+
*/
|
|
10694
|
+
const failCause$3 = /* @__PURE__ */ dual(2, (self$1, cause) => done$1(self$1, exitFailCause(cause)));
|
|
10695
|
+
/**
|
|
10696
|
+
* Completes the `Deferred` with interruption. This will interrupt all fibers
|
|
10697
|
+
* waiting on the value of the `Deferred` with the specified `FiberId`.
|
|
10698
|
+
*
|
|
10699
|
+
* @example
|
|
10700
|
+
* ```ts
|
|
10701
|
+
* import { Deferred, Effect } from "effect"
|
|
10702
|
+
*
|
|
10703
|
+
* const program = Effect.gen(function*() {
|
|
10704
|
+
* const deferred = yield* Deferred.make<number>()
|
|
10705
|
+
* const success = yield* Deferred.interruptWith(deferred, 42)
|
|
10706
|
+
* console.log(success) // true
|
|
10707
|
+
* })
|
|
10708
|
+
* ```
|
|
10709
|
+
*
|
|
10710
|
+
* @since 2.0.0
|
|
10711
|
+
* @category utils
|
|
10712
|
+
*/
|
|
10713
|
+
const interruptWith = /* @__PURE__ */ dual(2, (self$1, fiberId$2) => failCause$3(self$1, causeInterrupt(fiberId$2)));
|
|
10714
|
+
/**
|
|
10674
10715
|
* Returns `true` if this `Deferred` has already been completed with a value or
|
|
10675
10716
|
* an error, `false` otherwise.
|
|
10676
10717
|
*
|
|
@@ -10854,7 +10895,7 @@ const Scope = scopeTag;
|
|
|
10854
10895
|
* @category constructors
|
|
10855
10896
|
* @since 2.0.0
|
|
10856
10897
|
*/
|
|
10857
|
-
const make$
|
|
10898
|
+
const make$48 = scopeMake;
|
|
10858
10899
|
/**
|
|
10859
10900
|
* Creates a new `Scope` synchronously without wrapping it in an `Effect`.
|
|
10860
10901
|
* This is useful when you need a scope immediately but should be used with caution
|
|
@@ -11064,7 +11105,7 @@ const use$1 = scopeUse;
|
|
|
11064
11105
|
|
|
11065
11106
|
//#endregion
|
|
11066
11107
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Layer.js
|
|
11067
|
-
const TypeId$
|
|
11108
|
+
const TypeId$53 = "~effect/Layer";
|
|
11068
11109
|
const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
11069
11110
|
/**
|
|
11070
11111
|
* Returns `true` if the specified value is a `Layer`, `false` otherwise.
|
|
@@ -11089,9 +11130,9 @@ const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
|
11089
11130
|
* @since 2.0.0
|
|
11090
11131
|
* @category getters
|
|
11091
11132
|
*/
|
|
11092
|
-
const isLayer = (u) => hasProperty(u, TypeId$
|
|
11133
|
+
const isLayer = (u) => hasProperty(u, TypeId$53);
|
|
11093
11134
|
const LayerProto = {
|
|
11094
|
-
[TypeId$
|
|
11135
|
+
[TypeId$53]: {
|
|
11095
11136
|
_ROut: identity,
|
|
11096
11137
|
_E: identity,
|
|
11097
11138
|
_RIn: identity
|
|
@@ -11291,7 +11332,7 @@ const CurrentMemoMap = /* @__PURE__ */ Reference("effect/Layer/CurrentMemoMap",
|
|
|
11291
11332
|
* @since 2.0.0
|
|
11292
11333
|
* @category memo map
|
|
11293
11334
|
*/
|
|
11294
|
-
const buildWithMemoMap = /* @__PURE__ */ dual(3, (self$1, memoMap, scope$2) => provideService$
|
|
11335
|
+
const buildWithMemoMap = /* @__PURE__ */ dual(3, (self$1, memoMap, scope$2) => provideService$2(self$1.build(memoMap, scope$2), CurrentMemoMap, memoMap));
|
|
11295
11336
|
/**
|
|
11296
11337
|
* Builds a layer into a scoped value.
|
|
11297
11338
|
*
|
|
@@ -11407,8 +11448,8 @@ const buildWithScope = /* @__PURE__ */ dual(2, (self$1, scope$2) => suspend$4(()
|
|
|
11407
11448
|
* @category constructors
|
|
11408
11449
|
*/
|
|
11409
11450
|
const succeed$2 = function() {
|
|
11410
|
-
if (arguments.length === 1) return (resource) => succeedServices(make$
|
|
11411
|
-
return succeedServices(make$
|
|
11451
|
+
if (arguments.length === 1) return (resource) => succeedServices(make$51(arguments[0], resource));
|
|
11452
|
+
return succeedServices(make$51(arguments[0], arguments[1]));
|
|
11412
11453
|
};
|
|
11413
11454
|
/**
|
|
11414
11455
|
* Constructs a layer from the specified value, which must return one or more
|
|
@@ -11498,7 +11539,7 @@ const effect = function() {
|
|
|
11498
11539
|
const effectOrFn = arguments[1];
|
|
11499
11540
|
return typeof effectOrFn === "function" ? (...args$1) => effectImpl(arguments[0], suspend$4(() => effectOrFn(...args$1))) : effectImpl(arguments[0], effectOrFn);
|
|
11500
11541
|
};
|
|
11501
|
-
const effectImpl = (service$2, effect$1) => effectServices(map$9(effect$1, (value) => make$
|
|
11542
|
+
const effectImpl = (service$2, effect$1) => effectServices(map$9(effect$1, (value) => make$51(service$2, value)));
|
|
11502
11543
|
/**
|
|
11503
11544
|
* Constructs a layer from the specified scoped effect, which must return one
|
|
11504
11545
|
* or more services.
|
|
@@ -11580,7 +11621,7 @@ const effectDiscard = (effect$1) => effectServices(as$1(effect$1, empty$11()));
|
|
|
11580
11621
|
*/
|
|
11581
11622
|
const unwrap$3 = (self$1) => {
|
|
11582
11623
|
const service$2 = Service("effect/Layer/unwrap");
|
|
11583
|
-
return flatMap$1(effect(service$2)(self$1), get$
|
|
11624
|
+
return flatMap$1(effect(service$2)(self$1), get$8(service$2));
|
|
11584
11625
|
};
|
|
11585
11626
|
const mergeAllEffect = (layers, memoMap, scope$2) => {
|
|
11586
11627
|
const parentScope = forkUnsafe(scope$2, "parallel");
|
|
@@ -11889,9 +11930,9 @@ const fresh = (self$1) => fromBuildUnsafe((_, scope$2) => self$1.build(makeMemoM
|
|
|
11889
11930
|
* @since 3.16.0
|
|
11890
11931
|
* @category Type IDs
|
|
11891
11932
|
*/
|
|
11892
|
-
const TypeId$
|
|
11933
|
+
const TypeId$52 = "~effect/ExecutionPlan";
|
|
11893
11934
|
const Proto$18 = {
|
|
11894
|
-
[TypeId$
|
|
11935
|
+
[TypeId$52]: TypeId$52,
|
|
11895
11936
|
get withRequirements() {
|
|
11896
11937
|
const self$1 = this;
|
|
11897
11938
|
return servicesWith$1((services$2) => succeed$5(makeProto$1(self$1.steps.map((step) => ({
|
|
@@ -11922,7 +11963,7 @@ const CurrentMetadata$1 = /* @__PURE__ */ Reference("effect/ExecutionPlan/Curren
|
|
|
11922
11963
|
/**
|
|
11923
11964
|
* @since 2.0.0
|
|
11924
11965
|
*/
|
|
11925
|
-
const TypeId$
|
|
11966
|
+
const TypeId$51 = CauseTypeId;
|
|
11926
11967
|
/**
|
|
11927
11968
|
* @since 2.0.0
|
|
11928
11969
|
*/
|
|
@@ -12563,11 +12604,11 @@ const currentTimeNanos = currentTimeNanos$1;
|
|
|
12563
12604
|
//#endregion
|
|
12564
12605
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/internal/dateTime.js
|
|
12565
12606
|
/** @internal */
|
|
12566
|
-
const TypeId$
|
|
12607
|
+
const TypeId$50 = "~effect/time/DateTime";
|
|
12567
12608
|
/** @internal */
|
|
12568
12609
|
const TimeZoneTypeId = "~effect/time/DateTime/TimeZone";
|
|
12569
12610
|
const Proto$17 = {
|
|
12570
|
-
[TypeId$
|
|
12611
|
+
[TypeId$50]: TypeId$50,
|
|
12571
12612
|
pipe() {
|
|
12572
12613
|
return pipeArguments(this, arguments);
|
|
12573
12614
|
},
|
|
@@ -12673,7 +12714,7 @@ const makeZonedProto = (epochMillis, zone, partsUtc) => {
|
|
|
12673
12714
|
return self$1;
|
|
12674
12715
|
};
|
|
12675
12716
|
/** @internal */
|
|
12676
|
-
const isDateTime$1 = (u) => hasProperty(u, TypeId$
|
|
12717
|
+
const isDateTime$1 = (u) => hasProperty(u, TypeId$50);
|
|
12677
12718
|
const isDateTimeArgs = (args$1) => isDateTime$1(args$1[0]);
|
|
12678
12719
|
/** @internal */
|
|
12679
12720
|
const isTimeZone$1 = (u) => hasProperty(u, TimeZoneTypeId);
|
|
@@ -12686,11 +12727,11 @@ const isUtc$1 = (self$1) => self$1._tag === "Utc";
|
|
|
12686
12727
|
/** @internal */
|
|
12687
12728
|
const isZoned$1 = (self$1) => self$1._tag === "Zoned";
|
|
12688
12729
|
/** @internal */
|
|
12689
|
-
const Equivalence$3 = /* @__PURE__ */ make$
|
|
12730
|
+
const Equivalence$3 = /* @__PURE__ */ make$52((a, b) => a.epochMillis === b.epochMillis);
|
|
12690
12731
|
/** @internal */
|
|
12691
|
-
const Order$
|
|
12732
|
+
const Order$4 = /* @__PURE__ */ make$54((self$1, that) => self$1.epochMillis < that.epochMillis ? -1 : self$1.epochMillis > that.epochMillis ? 1 : 0);
|
|
12692
12733
|
/** @internal */
|
|
12693
|
-
const clamp$1 = /* @__PURE__ */ clamp$2(Order$
|
|
12734
|
+
const clamp$1 = /* @__PURE__ */ clamp$2(Order$4);
|
|
12694
12735
|
const makeUtc = (epochMillis) => {
|
|
12695
12736
|
const self$1 = Object.create(ProtoUtc);
|
|
12696
12737
|
self$1.epochMillis = epochMillis;
|
|
@@ -12741,7 +12782,7 @@ const makeZonedUnsafe$1 = (input, options) => {
|
|
|
12741
12782
|
/** @internal */
|
|
12742
12783
|
const makeZoned$1 = /* @__PURE__ */ liftThrowable(makeZonedUnsafe$1);
|
|
12743
12784
|
/** @internal */
|
|
12744
|
-
const make$
|
|
12785
|
+
const make$47 = /* @__PURE__ */ liftThrowable(makeUnsafe$5);
|
|
12745
12786
|
const zonedStringRegExp = /^(.{17,35})\[(.+)\]$/;
|
|
12746
12787
|
/** @internal */
|
|
12747
12788
|
const makeZonedFromString$1 = (input) => {
|
|
@@ -12841,19 +12882,19 @@ const distanceDurationResult$1 = /* @__PURE__ */ dual(2, (self$1, other) => {
|
|
|
12841
12882
|
/** @internal */
|
|
12842
12883
|
const distanceDuration$1 = /* @__PURE__ */ dual(2, (self$1, other) => millis(Math.abs(distance$1(self$1, other))));
|
|
12843
12884
|
/** @internal */
|
|
12844
|
-
const min$1 = /* @__PURE__ */ min$2(Order$
|
|
12885
|
+
const min$1 = /* @__PURE__ */ min$2(Order$4);
|
|
12845
12886
|
/** @internal */
|
|
12846
|
-
const max$1 = /* @__PURE__ */ max$2(Order$
|
|
12887
|
+
const max$1 = /* @__PURE__ */ max$2(Order$4);
|
|
12847
12888
|
/** @internal */
|
|
12848
|
-
const isGreaterThan$3 = /* @__PURE__ */ isGreaterThan$4(Order$
|
|
12889
|
+
const isGreaterThan$3 = /* @__PURE__ */ isGreaterThan$4(Order$4);
|
|
12849
12890
|
/** @internal */
|
|
12850
|
-
const isGreaterThanOrEqualTo$2 = /* @__PURE__ */ isGreaterThanOrEqualTo$3(Order$
|
|
12891
|
+
const isGreaterThanOrEqualTo$2 = /* @__PURE__ */ isGreaterThanOrEqualTo$3(Order$4);
|
|
12851
12892
|
/** @internal */
|
|
12852
|
-
const isLessThan$3 = /* @__PURE__ */ isLessThan$4(Order$
|
|
12893
|
+
const isLessThan$3 = /* @__PURE__ */ isLessThan$4(Order$4);
|
|
12853
12894
|
/** @internal */
|
|
12854
|
-
const isLessThanOrEqualTo$2 = /* @__PURE__ */ isLessThanOrEqualTo$3(Order$
|
|
12895
|
+
const isLessThanOrEqualTo$2 = /* @__PURE__ */ isLessThanOrEqualTo$3(Order$4);
|
|
12855
12896
|
/** @internal */
|
|
12856
|
-
const between$1 = /* @__PURE__ */ isBetween$1(Order$
|
|
12897
|
+
const between$1 = /* @__PURE__ */ isBetween$1(Order$4);
|
|
12857
12898
|
/** @internal */
|
|
12858
12899
|
const isFuture$1 = (self$1) => map$9(now$1, isLessThan$3(self$1));
|
|
12859
12900
|
/** @internal */
|
|
@@ -13171,6 +13212,78 @@ const formatIsoOffset$1 = (self$1) => {
|
|
|
13171
13212
|
/** @internal */
|
|
13172
13213
|
const formatIsoZoned$1 = (self$1) => self$1.zone._tag === "Offset" ? formatIsoOffset$1(self$1) : `${formatIsoOffset$1(self$1)}[${self$1.zone.id}]`;
|
|
13173
13214
|
|
|
13215
|
+
//#endregion
|
|
13216
|
+
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Number.js
|
|
13217
|
+
/**
|
|
13218
|
+
* The global `Number` constructor.
|
|
13219
|
+
*
|
|
13220
|
+
* @example
|
|
13221
|
+
* ```ts
|
|
13222
|
+
* import * as N from "effect/Number"
|
|
13223
|
+
*
|
|
13224
|
+
* const num = N.Number("42")
|
|
13225
|
+
* console.log(num) // 42
|
|
13226
|
+
*
|
|
13227
|
+
* const float = N.Number("3.14")
|
|
13228
|
+
* console.log(float) // 3.14
|
|
13229
|
+
* ```
|
|
13230
|
+
*
|
|
13231
|
+
* @category constructors
|
|
13232
|
+
* @since 4.0.0
|
|
13233
|
+
*/
|
|
13234
|
+
const Number$4 = globalThis.Number;
|
|
13235
|
+
/**
|
|
13236
|
+
* Tests if a value is a `number`.
|
|
13237
|
+
*
|
|
13238
|
+
* @example
|
|
13239
|
+
* ```ts
|
|
13240
|
+
* import { isNumber } from "effect/Number"
|
|
13241
|
+
* import * as assert from "node:assert"
|
|
13242
|
+
*
|
|
13243
|
+
* assert.deepStrictEqual(isNumber(2), true)
|
|
13244
|
+
* assert.deepStrictEqual(isNumber("2"), false)
|
|
13245
|
+
* ```
|
|
13246
|
+
*
|
|
13247
|
+
* @category guards
|
|
13248
|
+
* @since 2.0.0
|
|
13249
|
+
*/
|
|
13250
|
+
const isNumber = isNumber$1;
|
|
13251
|
+
/**
|
|
13252
|
+
* An `Order` instance for `number` values.
|
|
13253
|
+
*
|
|
13254
|
+
* @example
|
|
13255
|
+
* ```ts
|
|
13256
|
+
* import * as Number from "effect/Number"
|
|
13257
|
+
*
|
|
13258
|
+
* console.log(Number.Order(1, 2)) // -1
|
|
13259
|
+
* console.log(Number.Order(2, 1)) // 1
|
|
13260
|
+
* console.log(Number.Order(1, 1)) // 0
|
|
13261
|
+
* ```
|
|
13262
|
+
*
|
|
13263
|
+
* @category instances
|
|
13264
|
+
* @since 2.0.0
|
|
13265
|
+
*/
|
|
13266
|
+
const Order$3 = Number$5;
|
|
13267
|
+
/**
|
|
13268
|
+
* Returns the next power of 2 from the given number.
|
|
13269
|
+
*
|
|
13270
|
+
* @example
|
|
13271
|
+
* ```ts
|
|
13272
|
+
* import { nextPow2 } from "effect/Number"
|
|
13273
|
+
* import * as assert from "node:assert"
|
|
13274
|
+
*
|
|
13275
|
+
* assert.deepStrictEqual(nextPow2(5), 8)
|
|
13276
|
+
* assert.deepStrictEqual(nextPow2(17), 32)
|
|
13277
|
+
* ```
|
|
13278
|
+
*
|
|
13279
|
+
* @category math
|
|
13280
|
+
* @since 2.0.0
|
|
13281
|
+
*/
|
|
13282
|
+
const nextPow2 = (n) => {
|
|
13283
|
+
const nextPow = Math.ceil(Math.log(n) / Math.log(2));
|
|
13284
|
+
return Math.max(Math.pow(2, nextPow), 2);
|
|
13285
|
+
};
|
|
13286
|
+
|
|
13174
13287
|
//#endregion
|
|
13175
13288
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/String.js
|
|
13176
13289
|
/**
|
|
@@ -13298,7 +13411,7 @@ const filterDoneLeftover = /* @__PURE__ */ composePassthrough(filterError, (e) =
|
|
|
13298
13411
|
*/
|
|
13299
13412
|
const doneExitFromCause = (cause) => {
|
|
13300
13413
|
const halt = filterDone(cause);
|
|
13301
|
-
return !isFail(halt) ? succeed$4(halt.value) : failCause$
|
|
13414
|
+
return !isFail(halt) ? succeed$4(halt.value) : failCause$4(halt.fail);
|
|
13302
13415
|
};
|
|
13303
13416
|
/**
|
|
13304
13417
|
* Pattern matches on a Pull, handling success, failure, and done cases.
|
|
@@ -13360,7 +13473,7 @@ const matchEffect$1 = /* @__PURE__ */ dual(2, (self$1, options) => matchCauseEff
|
|
|
13360
13473
|
*
|
|
13361
13474
|
* @since 2.0.0
|
|
13362
13475
|
*/
|
|
13363
|
-
const TypeId$
|
|
13476
|
+
const TypeId$49 = "~effect/Schedule";
|
|
13364
13477
|
/**
|
|
13365
13478
|
* @since 4.0.0
|
|
13366
13479
|
* @category Metadata
|
|
@@ -13376,7 +13489,7 @@ const CurrentMetadata = /* @__PURE__ */ Reference("effect/Schedule/CurrentMetada
|
|
|
13376
13489
|
elapsedSincePrevious: 0
|
|
13377
13490
|
}) });
|
|
13378
13491
|
const ScheduleProto = {
|
|
13379
|
-
[TypeId$
|
|
13492
|
+
[TypeId$49]: {
|
|
13380
13493
|
_Out: identity,
|
|
13381
13494
|
_In: identity,
|
|
13382
13495
|
_Env: identity
|
|
@@ -13404,7 +13517,7 @@ const ScheduleProto = {
|
|
|
13404
13517
|
* @since 2.0.0
|
|
13405
13518
|
* @category guards
|
|
13406
13519
|
*/
|
|
13407
|
-
const isSchedule = (u) => hasProperty(u, TypeId$
|
|
13520
|
+
const isSchedule = (u) => hasProperty(u, TypeId$49);
|
|
13408
13521
|
/**
|
|
13409
13522
|
* Creates a Schedule from a step function that returns a Pull.
|
|
13410
13523
|
*
|
|
@@ -13505,7 +13618,7 @@ const fromStepWithMetadata = (step) => fromStep(map$9(step, (f) => {
|
|
|
13505
13618
|
* @since 4.0.0
|
|
13506
13619
|
* @category destructors
|
|
13507
13620
|
*/
|
|
13508
|
-
const toStep = (schedule) => catchCause$2(schedule.step, (cause) => succeed$5(() => failCause$
|
|
13621
|
+
const toStep = (schedule) => catchCause$2(schedule.step, (cause) => succeed$5(() => failCause$5(cause)));
|
|
13509
13622
|
/**
|
|
13510
13623
|
* Extracts a step function from a Schedule that provides metadata about each
|
|
13511
13624
|
* execution. It will also handle sleeping for the computed delay.
|
|
@@ -13555,7 +13668,7 @@ const toStepWithMetadata = (schedule) => clockWith$2((clock) => map$9(toStep(sch
|
|
|
13555
13668
|
*/
|
|
13556
13669
|
const passthrough$2 = (self$1) => fromStep(map$9(toStep(self$1), (step) => (now$2, input) => matchEffect$1(step(now$2, input), {
|
|
13557
13670
|
onSuccess: (result$2) => succeed$5([input, result$2[1]]),
|
|
13558
|
-
onFailure: failCause$
|
|
13671
|
+
onFailure: failCause$5,
|
|
13559
13672
|
onDone: () => done(input)
|
|
13560
13673
|
})));
|
|
13561
13674
|
/**
|
|
@@ -13718,7 +13831,7 @@ const provide$2 = /* @__PURE__ */ dual(2, (self$1, source) => isServiceMap(sourc
|
|
|
13718
13831
|
/** @internal */
|
|
13719
13832
|
const repeatOrElse$1 = /* @__PURE__ */ dual(3, (self$1, schedule, orElse$1) => flatMap$2(toStepWithMetadata(schedule), (step) => {
|
|
13720
13833
|
let meta = CurrentMetadata.defaultValue();
|
|
13721
|
-
return catch_$2(forever$2(tap$1(flatMap$2(suspend$4(() => provideService$
|
|
13834
|
+
return catch_$2(forever$2(tap$1(flatMap$2(suspend$4(() => provideService$2(self$1, CurrentMetadata, meta)), step), (meta_) => {
|
|
13722
13835
|
meta = meta_;
|
|
13723
13836
|
}), { autoYield: false }), (error$1) => isDone$2(error$1) ? succeed$5(error$1.value) : orElse$1(error$1, meta.attempt === 0 ? none$3() : some(meta)));
|
|
13724
13837
|
}));
|
|
@@ -13726,7 +13839,7 @@ const repeatOrElse$1 = /* @__PURE__ */ dual(3, (self$1, schedule, orElse$1) => f
|
|
|
13726
13839
|
const retryOrElse$1 = /* @__PURE__ */ dual(3, (self$1, policy, orElse$1) => flatMap$2(toStepWithMetadata(policy), (step) => {
|
|
13727
13840
|
let meta = CurrentMetadata.defaultValue();
|
|
13728
13841
|
let lastError;
|
|
13729
|
-
const loop = catch_$2(suspend$4(() => provideService$
|
|
13842
|
+
const loop = catch_$2(suspend$4(() => provideService$2(self$1, CurrentMetadata, meta)), (error$1) => {
|
|
13730
13843
|
lastError = error$1;
|
|
13731
13844
|
return flatMap$2(step(error$1), (meta_) => {
|
|
13732
13845
|
meta = meta_;
|
|
@@ -13740,13 +13853,13 @@ const repeat$1 = /* @__PURE__ */ dual(2, (self$1, options) => {
|
|
|
13740
13853
|
return repeatOrElse$1(self$1, typeof options === "function" ? options(identity) : isSchedule(options) ? options : buildFromOptions(options), fail$7);
|
|
13741
13854
|
});
|
|
13742
13855
|
/** @internal */
|
|
13743
|
-
const retry$
|
|
13856
|
+
const retry$4 = /* @__PURE__ */ dual(2, (self$1, options) => {
|
|
13744
13857
|
return retryOrElse$1(self$1, typeof options === "function" ? options(identity) : isSchedule(options) ? options : buildFromOptions(options), fail$7);
|
|
13745
13858
|
});
|
|
13746
13859
|
/** @internal */
|
|
13747
13860
|
const scheduleFrom$1 = /* @__PURE__ */ dual(3, (self$1, initial, schedule) => flatMap$2(toStepWithMetadata(schedule), (step) => {
|
|
13748
13861
|
let meta = CurrentMetadata.defaultValue();
|
|
13749
|
-
const selfWithMeta = suspend$4(() => provideService$
|
|
13862
|
+
const selfWithMeta = suspend$4(() => provideService$2(self$1, CurrentMetadata, meta));
|
|
13750
13863
|
return catch_$2(flatMap$2(step(initial), (meta_) => {
|
|
13751
13864
|
meta = meta_;
|
|
13752
13865
|
const body = constant(flatMap$2(selfWithMeta, step));
|
|
@@ -13781,7 +13894,7 @@ const withExecutionPlan$1 = /* @__PURE__ */ dual(2, (self$1, plan$1) => suspend$
|
|
|
13781
13894
|
attempt: 0,
|
|
13782
13895
|
stepIndex: 0
|
|
13783
13896
|
};
|
|
13784
|
-
const provideMeta = provideServiceEffect$
|
|
13897
|
+
const provideMeta = provideServiceEffect$2(CurrentMetadata$1, sync$1(() => {
|
|
13785
13898
|
meta = {
|
|
13786
13899
|
attempt: meta.attempt + 1,
|
|
13787
13900
|
stepIndex: i
|
|
@@ -13802,10 +13915,10 @@ const withExecutionPlan$1 = /* @__PURE__ */ dual(2, (self$1, plan$1) => suspend$
|
|
|
13802
13915
|
attempted = true;
|
|
13803
13916
|
return result$2.asEffect();
|
|
13804
13917
|
});
|
|
13805
|
-
nextEffect = retry$
|
|
13918
|
+
nextEffect = retry$4(nextEffect, scheduleFromStep(step, false));
|
|
13806
13919
|
} else {
|
|
13807
13920
|
const schedule = scheduleFromStep(step, true);
|
|
13808
|
-
nextEffect = schedule ? retry$
|
|
13921
|
+
nextEffect = schedule ? retry$4(nextEffect, schedule) : nextEffect;
|
|
13809
13922
|
}
|
|
13810
13923
|
return result$1(nextEffect);
|
|
13811
13924
|
},
|
|
@@ -13833,7 +13946,7 @@ const scheduleOnce = /* @__PURE__ */ recurs(1);
|
|
|
13833
13946
|
|
|
13834
13947
|
//#endregion
|
|
13835
13948
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Request.js
|
|
13836
|
-
const TypeId$
|
|
13949
|
+
const TypeId$48 = "~effect/Request";
|
|
13837
13950
|
const requestVariance = /* @__PURE__ */ byReferenceUnsafe({
|
|
13838
13951
|
_E: (_) => _,
|
|
13839
13952
|
_A: (_) => _,
|
|
@@ -13844,7 +13957,7 @@ const requestVariance = /* @__PURE__ */ byReferenceUnsafe({
|
|
|
13844
13957
|
*/
|
|
13845
13958
|
const RequestPrototype = {
|
|
13846
13959
|
...StructuralProto,
|
|
13847
|
-
[TypeId$
|
|
13960
|
+
[TypeId$48]: requestVariance
|
|
13848
13961
|
};
|
|
13849
13962
|
/**
|
|
13850
13963
|
* @since 2.0.0
|
|
@@ -13865,7 +13978,7 @@ const request$2 = /* @__PURE__ */ dual(2, (self$1, resolver) => {
|
|
|
13865
13978
|
const requestUnsafe$1 = (self$1, options) => {
|
|
13866
13979
|
const entry = addEntry(options.resolver, self$1, options.onExit, {
|
|
13867
13980
|
services: options.services,
|
|
13868
|
-
currentScheduler: get$
|
|
13981
|
+
currentScheduler: get$8(options.services, Scheduler)
|
|
13869
13982
|
});
|
|
13870
13983
|
return () => removeEntryUnsafe(options.resolver, entry);
|
|
13871
13984
|
};
|
|
@@ -13954,7 +14067,7 @@ function runBatch(batch) {
|
|
|
13954
14067
|
|
|
13955
14068
|
//#endregion
|
|
13956
14069
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Effect.js
|
|
13957
|
-
const TypeId$
|
|
14070
|
+
const TypeId$47 = EffectTypeId;
|
|
13958
14071
|
/**
|
|
13959
14072
|
* Tests if a value is an `Effect`.
|
|
13960
14073
|
*
|
|
@@ -13969,7 +14082,7 @@ const TypeId$46 = EffectTypeId;
|
|
|
13969
14082
|
* @since 2.0.0
|
|
13970
14083
|
* @category guards
|
|
13971
14084
|
*/
|
|
13972
|
-
const isEffect = (u) => typeof u === "object" && u !== null && TypeId$
|
|
14085
|
+
const isEffect = (u) => typeof u === "object" && u !== null && TypeId$47 in u;
|
|
13973
14086
|
/**
|
|
13974
14087
|
* Combines multiple effects into one, returning results based on the input
|
|
13975
14088
|
* structure.
|
|
@@ -14702,7 +14815,7 @@ const failSync = failSync$1;
|
|
|
14702
14815
|
* @since 2.0.0
|
|
14703
14816
|
* @category Creating Effects
|
|
14704
14817
|
*/
|
|
14705
|
-
const failCause$2 = failCause$
|
|
14818
|
+
const failCause$2 = failCause$5;
|
|
14706
14819
|
/**
|
|
14707
14820
|
* Creates an `Effect` that represents a failure with a `Cause` computed lazily.
|
|
14708
14821
|
*
|
|
@@ -16245,7 +16358,7 @@ const eventually = eventually$1;
|
|
|
16245
16358
|
* @since 2.0.0
|
|
16246
16359
|
* @category Error handling
|
|
16247
16360
|
*/
|
|
16248
|
-
const retry$
|
|
16361
|
+
const retry$3 = retry$4;
|
|
16249
16362
|
/**
|
|
16250
16363
|
* Retries a failing effect and runs a fallback effect if retries are exhausted.
|
|
16251
16364
|
*
|
|
@@ -16721,7 +16834,7 @@ const raceFirst = raceFirst$1;
|
|
|
16721
16834
|
* @since 2.0.0
|
|
16722
16835
|
* @category Filtering
|
|
16723
16836
|
*/
|
|
16724
|
-
const filter$
|
|
16837
|
+
const filter$2 = filter$3;
|
|
16725
16838
|
/**
|
|
16726
16839
|
* @since 2.0.0
|
|
16727
16840
|
* @category Filtering
|
|
@@ -17477,7 +17590,7 @@ const updateService = updateService$1;
|
|
|
17477
17590
|
* @since 2.0.0
|
|
17478
17591
|
* @category ServiceMap
|
|
17479
17592
|
*/
|
|
17480
|
-
const provideService = provideService$
|
|
17593
|
+
const provideService$1 = provideService$2;
|
|
17481
17594
|
/**
|
|
17482
17595
|
* Provides the effect with the single service it requires. If the effect
|
|
17483
17596
|
* requires more than one service use `provide` instead.
|
|
@@ -17530,7 +17643,7 @@ const provideService = provideService$1;
|
|
|
17530
17643
|
* @since 2.0.0
|
|
17531
17644
|
* @category ServiceMap
|
|
17532
17645
|
*/
|
|
17533
|
-
const provideServiceEffect = provideServiceEffect$
|
|
17646
|
+
const provideServiceEffect$1 = provideServiceEffect$2;
|
|
17534
17647
|
/**
|
|
17535
17648
|
* Sets the concurrency level for parallel operations within an effect.
|
|
17536
17649
|
*
|
|
@@ -20095,7 +20208,7 @@ const fnUntracedEager = fnUntracedEager$1;
|
|
|
20095
20208
|
* @since 4.0.0
|
|
20096
20209
|
*/
|
|
20097
20210
|
/** @internal */
|
|
20098
|
-
function set$
|
|
20211
|
+
function set$6(self$1, key, value) {
|
|
20099
20212
|
if (key === "__proto__") Object.defineProperty(self$1, key, {
|
|
20100
20213
|
value,
|
|
20101
20214
|
writable: true,
|
|
@@ -20184,7 +20297,7 @@ const escape = (string$8) => string$8.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
|
20184
20297
|
|
|
20185
20298
|
//#endregion
|
|
20186
20299
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/DateTime.js
|
|
20187
|
-
TypeId$
|
|
20300
|
+
TypeId$50;
|
|
20188
20301
|
TimeZoneTypeId;
|
|
20189
20302
|
/**
|
|
20190
20303
|
* @since 3.6.0
|
|
@@ -20271,7 +20384,7 @@ const Equivalence$2 = Equivalence$3;
|
|
|
20271
20384
|
* @category instances
|
|
20272
20385
|
* @since 3.6.0
|
|
20273
20386
|
*/
|
|
20274
|
-
const Order$1 = Order$
|
|
20387
|
+
const Order$1 = Order$4;
|
|
20275
20388
|
/**
|
|
20276
20389
|
* Clamp a `DateTime` between a minimum and maximum value.
|
|
20277
20390
|
*
|
|
@@ -20417,7 +20530,7 @@ const makeZoned = makeZoned$1;
|
|
|
20417
20530
|
* DateTime.make("2024-01-01")
|
|
20418
20531
|
* ```
|
|
20419
20532
|
*/
|
|
20420
|
-
const make$
|
|
20533
|
+
const make$46 = make$47;
|
|
20421
20534
|
/**
|
|
20422
20535
|
* Create a `DateTime.Zoned` from a string.
|
|
20423
20536
|
*
|
|
@@ -22156,7 +22269,7 @@ const redactedRegistry = /* @__PURE__ */ new WeakMap();
|
|
|
22156
22269
|
*
|
|
22157
22270
|
* @since 3.3.0
|
|
22158
22271
|
*/
|
|
22159
|
-
const TypeId$
|
|
22272
|
+
const TypeId$46 = "~effect/data/Redacted";
|
|
22160
22273
|
/**
|
|
22161
22274
|
* @example
|
|
22162
22275
|
* ```ts
|
|
@@ -22172,7 +22285,7 @@ const TypeId$45 = "~effect/data/Redacted";
|
|
|
22172
22285
|
* @since 3.3.0
|
|
22173
22286
|
* @category refinements
|
|
22174
22287
|
*/
|
|
22175
|
-
const isRedacted = (u) => hasProperty(u, TypeId$
|
|
22288
|
+
const isRedacted = (u) => hasProperty(u, TypeId$46);
|
|
22176
22289
|
/**
|
|
22177
22290
|
* This function creates a `Redacted<A>` instance from a given value `A`,
|
|
22178
22291
|
* securely hiding its content.
|
|
@@ -22187,14 +22300,14 @@ const isRedacted = (u) => hasProperty(u, TypeId$45);
|
|
|
22187
22300
|
* @since 3.3.0
|
|
22188
22301
|
* @category constructors
|
|
22189
22302
|
*/
|
|
22190
|
-
const make$
|
|
22303
|
+
const make$45 = (value, options) => {
|
|
22191
22304
|
const redacted = Object.create(Proto$16);
|
|
22192
22305
|
if (options?.label) redacted.label = options.label;
|
|
22193
22306
|
redactedRegistry.set(redacted, value);
|
|
22194
22307
|
return redacted;
|
|
22195
22308
|
};
|
|
22196
22309
|
const Proto$16 = {
|
|
22197
|
-
[TypeId$
|
|
22310
|
+
[TypeId$46]: { _A: (_) => _ },
|
|
22198
22311
|
label: void 0,
|
|
22199
22312
|
...PipeInspectableProto,
|
|
22200
22313
|
toJSON() {
|
|
@@ -22213,15 +22326,15 @@ const Proto$16 = {
|
|
|
22213
22326
|
|
|
22214
22327
|
//#endregion
|
|
22215
22328
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/SchemaIssue.js
|
|
22216
|
-
const TypeId$
|
|
22329
|
+
const TypeId$45 = "~effect/SchemaIssue/Issue";
|
|
22217
22330
|
/**
|
|
22218
22331
|
* @since 4.0.0
|
|
22219
22332
|
*/
|
|
22220
22333
|
function isIssue(u) {
|
|
22221
|
-
return hasProperty(u, TypeId$
|
|
22334
|
+
return hasProperty(u, TypeId$45);
|
|
22222
22335
|
}
|
|
22223
22336
|
var Base$1 = class {
|
|
22224
|
-
[TypeId$
|
|
22337
|
+
[TypeId$45] = TypeId$45;
|
|
22225
22338
|
toString() {
|
|
22226
22339
|
return defaultFormatter$1(this);
|
|
22227
22340
|
}
|
|
@@ -22246,10 +22359,10 @@ var Filter$1 = class extends Base$1 {
|
|
|
22246
22359
|
* The issue that occurred.
|
|
22247
22360
|
*/
|
|
22248
22361
|
issue;
|
|
22249
|
-
constructor(actual, filter$
|
|
22362
|
+
constructor(actual, filter$7, issue) {
|
|
22250
22363
|
super();
|
|
22251
22364
|
this.actual = actual;
|
|
22252
|
-
this.filter = filter$
|
|
22365
|
+
this.filter = filter$7;
|
|
22253
22366
|
this.issue = issue;
|
|
22254
22367
|
}
|
|
22255
22368
|
};
|
|
@@ -22494,7 +22607,7 @@ var OneOf = class extends Base$1 {
|
|
|
22494
22607
|
}
|
|
22495
22608
|
};
|
|
22496
22609
|
/** @internal */
|
|
22497
|
-
function make$
|
|
22610
|
+
function make$44(input, out) {
|
|
22498
22611
|
if (isIssue(out)) return out;
|
|
22499
22612
|
if (out === void 0) return;
|
|
22500
22613
|
if (typeof out === "boolean") return out ? void 0 : new InvalidValue$1(some(input));
|
|
@@ -22763,7 +22876,7 @@ function decodeBase64() {
|
|
|
22763
22876
|
*/
|
|
22764
22877
|
function dateTimeUtcFromInput() {
|
|
22765
22878
|
return transformOrFail$1((input) => {
|
|
22766
|
-
const dt = make$
|
|
22879
|
+
const dt = make$46(input);
|
|
22767
22880
|
return dt ? succeed$1(toUtc(dt)) : fail$4(new InvalidValue$1(some(input), { message: "Invalid DateTime input" }));
|
|
22768
22881
|
});
|
|
22769
22882
|
}
|
|
@@ -22798,13 +22911,13 @@ function collectBracketPathEntries(isLeaf) {
|
|
|
22798
22911
|
/**
|
|
22799
22912
|
* @since 4.0.0
|
|
22800
22913
|
*/
|
|
22801
|
-
const TypeId$
|
|
22914
|
+
const TypeId$44 = "~effect/SchemaTransformation/Transformation";
|
|
22802
22915
|
/**
|
|
22803
22916
|
* @category model
|
|
22804
22917
|
* @since 4.0.0
|
|
22805
22918
|
*/
|
|
22806
22919
|
var Transformation = class Transformation {
|
|
22807
|
-
[TypeId$
|
|
22920
|
+
[TypeId$44] = TypeId$44;
|
|
22808
22921
|
_tag = "Transformation";
|
|
22809
22922
|
decode;
|
|
22810
22923
|
encode;
|
|
@@ -22823,12 +22936,12 @@ var Transformation = class Transformation {
|
|
|
22823
22936
|
* @since 4.0.0
|
|
22824
22937
|
*/
|
|
22825
22938
|
function isTransformation(u) {
|
|
22826
|
-
return hasProperty(u, TypeId$
|
|
22939
|
+
return hasProperty(u, TypeId$44);
|
|
22827
22940
|
}
|
|
22828
22941
|
/**
|
|
22829
22942
|
* @since 4.0.0
|
|
22830
22943
|
*/
|
|
22831
|
-
const make$
|
|
22944
|
+
const make$43 = (options) => {
|
|
22832
22945
|
if (isTransformation(options)) return options;
|
|
22833
22946
|
return new Transformation(options.decode, options.encode);
|
|
22834
22947
|
};
|
|
@@ -22918,7 +23031,7 @@ function makeGuard(tag$1) {
|
|
|
22918
23031
|
* @since 4.0.0
|
|
22919
23032
|
*/
|
|
22920
23033
|
function isAST(u) {
|
|
22921
|
-
return hasProperty(u, TypeId$
|
|
23034
|
+
return hasProperty(u, TypeId$43) && u[TypeId$43] === TypeId$43;
|
|
22922
23035
|
}
|
|
22923
23036
|
/**
|
|
22924
23037
|
* @category Guard
|
|
@@ -22981,13 +23094,13 @@ var Context = class {
|
|
|
22981
23094
|
this.annotations = annotations$1;
|
|
22982
23095
|
}
|
|
22983
23096
|
};
|
|
22984
|
-
const TypeId$
|
|
23097
|
+
const TypeId$43 = "~effect/Schema";
|
|
22985
23098
|
/**
|
|
22986
23099
|
* @category model
|
|
22987
23100
|
* @since 4.0.0
|
|
22988
23101
|
*/
|
|
22989
23102
|
var Base = class {
|
|
22990
|
-
[TypeId$
|
|
23103
|
+
[TypeId$43] = TypeId$43;
|
|
22991
23104
|
annotations;
|
|
22992
23105
|
checks;
|
|
22993
23106
|
encoding;
|
|
@@ -23233,7 +23346,7 @@ var Number$2 = class extends Base {
|
|
|
23233
23346
|
_tag = "Number";
|
|
23234
23347
|
/** @internal */
|
|
23235
23348
|
getParser() {
|
|
23236
|
-
return fromRefinement(this, isNumber);
|
|
23349
|
+
return fromRefinement(this, isNumber$1);
|
|
23237
23350
|
}
|
|
23238
23351
|
/** @internal */
|
|
23239
23352
|
toCodecJson() {
|
|
@@ -23575,7 +23688,7 @@ var Objects = class Objects extends Base {
|
|
|
23575
23688
|
else issues = [issue];
|
|
23576
23689
|
continue;
|
|
23577
23690
|
} else return yield* fail$4(new Composite(ast, oinput, [issue]));
|
|
23578
|
-
} else set$
|
|
23691
|
+
} else set$6(out, key, input[key]);
|
|
23579
23692
|
}
|
|
23580
23693
|
}
|
|
23581
23694
|
for (let i = 0; i < propertyCount; i++) {
|
|
@@ -23592,7 +23705,7 @@ var Objects = class Objects extends Base {
|
|
|
23592
23705
|
else issues = [issue];
|
|
23593
23706
|
continue;
|
|
23594
23707
|
} else return yield* fail$4(new Composite(ast, oinput, [issue]));
|
|
23595
|
-
} else if (exit$2.value._tag === "Some") set$
|
|
23708
|
+
} else if (exit$2.value._tag === "Some") set$6(out, p.name, exit$2.value.value);
|
|
23596
23709
|
else if (!isOptional(p.type)) {
|
|
23597
23710
|
const issue = new Pointer([p.name], new MissingKey(p.type.context?.annotations));
|
|
23598
23711
|
if (errorsAllOption) {
|
|
@@ -23637,8 +23750,8 @@ var Objects = class Objects extends Base {
|
|
|
23637
23750
|
const v2 = exitValue.value.value;
|
|
23638
23751
|
if (is$2.merge && is$2.merge.decode && Object.hasOwn(out, k2)) {
|
|
23639
23752
|
const [k, v] = is$2.merge.decode.combine([k2, out[k2]], [k2, v2]);
|
|
23640
|
-
set$
|
|
23641
|
-
} else set$
|
|
23753
|
+
set$6(out, k, v);
|
|
23754
|
+
} else set$6(out, k2, v2);
|
|
23642
23755
|
}
|
|
23643
23756
|
}
|
|
23644
23757
|
}
|
|
@@ -23646,7 +23759,7 @@ var Objects = class Objects extends Base {
|
|
|
23646
23759
|
if (options.propertyOrder === "original") {
|
|
23647
23760
|
const keys$1 = (inputKeys ?? Reflect.ownKeys(input)).concat(expectedKeys);
|
|
23648
23761
|
const preserved = {};
|
|
23649
|
-
for (const key of keys$1) if (Object.hasOwn(out, key)) set$
|
|
23762
|
+
for (const key of keys$1) if (Object.hasOwn(out, key)) set$6(preserved, key, out[key]);
|
|
23650
23763
|
return some(preserved);
|
|
23651
23764
|
}
|
|
23652
23765
|
return some(out);
|
|
@@ -23994,8 +24107,8 @@ var FilterGroup = class FilterGroup extends Class$3 {
|
|
|
23994
24107
|
}
|
|
23995
24108
|
};
|
|
23996
24109
|
/** @internal */
|
|
23997
|
-
function makeFilter$1(filter$
|
|
23998
|
-
return new Filter((input, ast, options) => make$
|
|
24110
|
+
function makeFilter$1(filter$7, annotations$1, aborted = false) {
|
|
24111
|
+
return new Filter((input, ast, options) => make$44(input, filter$7(input, ast, options)), annotations$1, aborted);
|
|
23999
24112
|
}
|
|
24000
24113
|
/** @internal */
|
|
24001
24114
|
function isPattern$1(regExp, annotations$1) {
|
|
@@ -24095,7 +24208,7 @@ function optionalKey$1(ast) {
|
|
|
24095
24208
|
/** @internal */
|
|
24096
24209
|
function withConstructorDefault$1(ast, defaultValue) {
|
|
24097
24210
|
const encoding = [new Link(unknown, new Transformation(new Getter((o) => {
|
|
24098
|
-
if (isNone(filter$
|
|
24211
|
+
if (isNone(filter$6(o, isNotUndefined))) {
|
|
24099
24212
|
const oe = defaultValue(o);
|
|
24100
24213
|
return isEffect(oe) ? oe : succeed$1(oe);
|
|
24101
24214
|
} else return succeed$1(o);
|
|
@@ -24378,7 +24491,7 @@ function nominal() {
|
|
|
24378
24491
|
/**
|
|
24379
24492
|
* @since 4.0.0
|
|
24380
24493
|
*/
|
|
24381
|
-
const TypeId$
|
|
24494
|
+
const TypeId$42 = "~effect/platform/PlatformError";
|
|
24382
24495
|
/**
|
|
24383
24496
|
* @since 4.0.0
|
|
24384
24497
|
* @category Models
|
|
@@ -24418,7 +24531,7 @@ var PlatformError = class extends TaggedError("PlatformError") {
|
|
|
24418
24531
|
/**
|
|
24419
24532
|
* @since 4.0.0
|
|
24420
24533
|
*/
|
|
24421
|
-
[TypeId$
|
|
24534
|
+
[TypeId$42] = TypeId$42;
|
|
24422
24535
|
get message() {
|
|
24423
24536
|
return this.reason.message;
|
|
24424
24537
|
}
|
|
@@ -24742,7 +24855,7 @@ const Empty$2 = /* @__PURE__ */ Symbol.for("effect/MutableList/Empty");
|
|
|
24742
24855
|
* @since 4.0.0
|
|
24743
24856
|
* @category constructors
|
|
24744
24857
|
*/
|
|
24745
|
-
const make$
|
|
24858
|
+
const make$42 = () => ({
|
|
24746
24859
|
head: void 0,
|
|
24747
24860
|
tail: void 0,
|
|
24748
24861
|
length: 0
|
|
@@ -24794,6 +24907,46 @@ const append = (self$1, message) => {
|
|
|
24794
24907
|
self$1.length++;
|
|
24795
24908
|
};
|
|
24796
24909
|
/**
|
|
24910
|
+
* Prepends an element to the beginning of the MutableList.
|
|
24911
|
+
* This operation is optimized for high-frequency usage.
|
|
24912
|
+
*
|
|
24913
|
+
* @example
|
|
24914
|
+
* ```ts
|
|
24915
|
+
* import * as MutableList from "effect/MutableList"
|
|
24916
|
+
*
|
|
24917
|
+
* const list = MutableList.make<string>()
|
|
24918
|
+
*
|
|
24919
|
+
* // Prepend elements (they'll be at the front)
|
|
24920
|
+
* MutableList.prepend(list, "third")
|
|
24921
|
+
* MutableList.prepend(list, "second")
|
|
24922
|
+
* MutableList.prepend(list, "first")
|
|
24923
|
+
*
|
|
24924
|
+
* console.log(list.length) // 3
|
|
24925
|
+
*
|
|
24926
|
+
* // Elements taken from head (most recently prepended first)
|
|
24927
|
+
* console.log(MutableList.take(list)) // "first"
|
|
24928
|
+
* console.log(MutableList.take(list)) // "second"
|
|
24929
|
+
* console.log(MutableList.take(list)) // "third"
|
|
24930
|
+
*
|
|
24931
|
+
* // Use case: priority items or stack-like behavior
|
|
24932
|
+
* MutableList.append(list, "normal")
|
|
24933
|
+
* MutableList.prepend(list, "priority") // This will be taken first
|
|
24934
|
+
* console.log(MutableList.take(list)) // "priority"
|
|
24935
|
+
* ```
|
|
24936
|
+
*
|
|
24937
|
+
* @since 4.0.0
|
|
24938
|
+
* @category mutations
|
|
24939
|
+
*/
|
|
24940
|
+
const prepend = (self$1, message) => {
|
|
24941
|
+
self$1.head = {
|
|
24942
|
+
array: [message],
|
|
24943
|
+
mutable: true,
|
|
24944
|
+
offset: 0,
|
|
24945
|
+
next: self$1.head
|
|
24946
|
+
};
|
|
24947
|
+
self$1.length++;
|
|
24948
|
+
};
|
|
24949
|
+
/**
|
|
24797
24950
|
* Appends all elements from an iterable to the end of the MutableList.
|
|
24798
24951
|
* Returns the number of elements added.
|
|
24799
24952
|
*
|
|
@@ -24986,6 +25139,48 @@ const takeN = (self$1, n) => {
|
|
|
24986
25139
|
return array$1;
|
|
24987
25140
|
};
|
|
24988
25141
|
/**
|
|
25142
|
+
* Takes all elements from the MutableList and returns them as an array.
|
|
25143
|
+
* The list becomes empty after this operation. This is equivalent to takeN(list, list.length).
|
|
25144
|
+
*
|
|
25145
|
+
* @example
|
|
25146
|
+
* ```ts
|
|
25147
|
+
* import * as MutableList from "effect/MutableList"
|
|
25148
|
+
*
|
|
25149
|
+
* const list = MutableList.make<string>()
|
|
25150
|
+
* MutableList.appendAll(list, ["apple", "banana", "cherry"])
|
|
25151
|
+
*
|
|
25152
|
+
* console.log(list.length) // 3
|
|
25153
|
+
*
|
|
25154
|
+
* // Take all elements
|
|
25155
|
+
* const allItems = MutableList.takeAll(list)
|
|
25156
|
+
* console.log(allItems) // ["apple", "banana", "cherry"]
|
|
25157
|
+
* console.log(list.length) // 0
|
|
25158
|
+
*
|
|
25159
|
+
* // Useful for converting to array and clearing
|
|
25160
|
+
* const queue = MutableList.make<number>()
|
|
25161
|
+
* MutableList.appendAll(queue, [1, 2, 3, 4, 5])
|
|
25162
|
+
*
|
|
25163
|
+
* const snapshot = MutableList.takeAll(queue)
|
|
25164
|
+
* console.log("Queue contents:", snapshot)
|
|
25165
|
+
* console.log("Queue is now empty:", queue.length === 0)
|
|
25166
|
+
*
|
|
25167
|
+
* // Drain pattern for processing
|
|
25168
|
+
* function drainAndProcess<T>(
|
|
25169
|
+
* list: MutableList.MutableList<T>,
|
|
25170
|
+
* processor: (items: Array<T>) => void
|
|
25171
|
+
* ) {
|
|
25172
|
+
* if (list.length > 0) {
|
|
25173
|
+
* const items = MutableList.takeAll(list)
|
|
25174
|
+
* processor(items)
|
|
25175
|
+
* }
|
|
25176
|
+
* }
|
|
25177
|
+
* ```
|
|
25178
|
+
*
|
|
25179
|
+
* @since 4.0.0
|
|
25180
|
+
* @category elements
|
|
25181
|
+
*/
|
|
25182
|
+
const takeAll$1 = (self$1) => takeN(self$1, self$1.length);
|
|
25183
|
+
/**
|
|
24989
25184
|
* Takes a single element from the beginning of the MutableList.
|
|
24990
25185
|
* Returns the element if available, or the Empty symbol if the list is empty.
|
|
24991
25186
|
* The taken element is removed from the list.
|
|
@@ -25033,7 +25228,7 @@ const takeN = (self$1, n) => {
|
|
|
25033
25228
|
* @since 4.0.0
|
|
25034
25229
|
* @category elements
|
|
25035
25230
|
*/
|
|
25036
|
-
const take$
|
|
25231
|
+
const take$2 = (self$1) => {
|
|
25037
25232
|
if (!self$1.head) return Empty$2;
|
|
25038
25233
|
const message = self$1.head.array[self$1.head.offset];
|
|
25039
25234
|
if (self$1.head.mutable) self$1.head.array[self$1.head.offset] = void 0;
|
|
@@ -25043,12 +25238,111 @@ const take$1 = (self$1) => {
|
|
|
25043
25238
|
else clear$2(self$1);
|
|
25044
25239
|
return message;
|
|
25045
25240
|
};
|
|
25241
|
+
/**
|
|
25242
|
+
* Filters the MutableList in place, keeping only elements that satisfy the predicate.
|
|
25243
|
+
* This operation modifies the list and rebuilds its internal structure for efficiency.
|
|
25244
|
+
*
|
|
25245
|
+
* @example
|
|
25246
|
+
* ```ts
|
|
25247
|
+
* import * as MutableList from "effect/MutableList"
|
|
25248
|
+
*
|
|
25249
|
+
* const list = MutableList.make<number>()
|
|
25250
|
+
* MutableList.appendAll(list, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
|
25251
|
+
*
|
|
25252
|
+
* console.log(list.length) // 10
|
|
25253
|
+
*
|
|
25254
|
+
* // Keep only even numbers
|
|
25255
|
+
* MutableList.filter(list, (n) => n % 2 === 0)
|
|
25256
|
+
*
|
|
25257
|
+
* console.log(list.length) // 5
|
|
25258
|
+
* console.log(MutableList.takeAll(list)) // [2, 4, 6, 8, 10]
|
|
25259
|
+
*
|
|
25260
|
+
* // Filter with index
|
|
25261
|
+
* const indexed = MutableList.make<string>()
|
|
25262
|
+
* MutableList.appendAll(indexed, ["a", "b", "c", "d", "e"])
|
|
25263
|
+
*
|
|
25264
|
+
* // Keep elements at even indices
|
|
25265
|
+
* MutableList.filter(indexed, (value, index) => index % 2 === 0)
|
|
25266
|
+
* console.log(MutableList.takeAll(indexed)) // ["a", "c", "e"]
|
|
25267
|
+
*
|
|
25268
|
+
* // Real-world example: filtering a log queue
|
|
25269
|
+
* const logs = MutableList.make<{ level: string; message: string }>()
|
|
25270
|
+
* MutableList.appendAll(logs, [
|
|
25271
|
+
* { level: "INFO", message: "App started" },
|
|
25272
|
+
* { level: "ERROR", message: "Connection failed" },
|
|
25273
|
+
* { level: "DEBUG", message: "Cache hit" },
|
|
25274
|
+
* { level: "ERROR", message: "Timeout" }
|
|
25275
|
+
* ])
|
|
25276
|
+
*
|
|
25277
|
+
* // Keep only errors
|
|
25278
|
+
* MutableList.filter(logs, (log) => log.level === "ERROR")
|
|
25279
|
+
* console.log(MutableList.takeAll(logs)) // Only error logs
|
|
25280
|
+
* ```
|
|
25281
|
+
*
|
|
25282
|
+
* @since 4.0.0
|
|
25283
|
+
* @category mutations
|
|
25284
|
+
*/
|
|
25285
|
+
const filter$1 = (self$1, f) => {
|
|
25286
|
+
const array$1 = [];
|
|
25287
|
+
let chunk = self$1.head;
|
|
25288
|
+
while (chunk) {
|
|
25289
|
+
for (let i = chunk.offset; i < chunk.array.length; i++) if (f(chunk.array[i], i)) array$1.push(chunk.array[i]);
|
|
25290
|
+
chunk = chunk.next;
|
|
25291
|
+
}
|
|
25292
|
+
self$1.head = self$1.tail = {
|
|
25293
|
+
array: array$1,
|
|
25294
|
+
mutable: true,
|
|
25295
|
+
offset: 0,
|
|
25296
|
+
next: void 0
|
|
25297
|
+
};
|
|
25298
|
+
};
|
|
25299
|
+
/**
|
|
25300
|
+
* Removes all occurrences of a specific value from the MutableList.
|
|
25301
|
+
* This operation modifies the list in place.
|
|
25302
|
+
*
|
|
25303
|
+
* @example
|
|
25304
|
+
* ```ts
|
|
25305
|
+
* import * as MutableList from "effect/MutableList"
|
|
25306
|
+
*
|
|
25307
|
+
* const list = MutableList.make<string>()
|
|
25308
|
+
* MutableList.appendAll(list, ["apple", "banana", "apple", "cherry", "apple"])
|
|
25309
|
+
*
|
|
25310
|
+
* console.log(list.length) // 5
|
|
25311
|
+
*
|
|
25312
|
+
* // Remove all occurrences of "apple"
|
|
25313
|
+
* MutableList.remove(list, "apple")
|
|
25314
|
+
*
|
|
25315
|
+
* console.log(list.length) // 2
|
|
25316
|
+
* console.log(MutableList.takeAll(list)) // ["banana", "cherry"]
|
|
25317
|
+
*
|
|
25318
|
+
* // Remove non-existent value (no effect)
|
|
25319
|
+
* MutableList.remove(list, "grape")
|
|
25320
|
+
* console.log(list.length) // 2
|
|
25321
|
+
*
|
|
25322
|
+
* // Real-world example: removing completed tasks
|
|
25323
|
+
* const tasks = MutableList.make<{ id: number; status: string }>()
|
|
25324
|
+
* MutableList.appendAll(tasks, [
|
|
25325
|
+
* { id: 1, status: "pending" },
|
|
25326
|
+
* { id: 2, status: "completed" },
|
|
25327
|
+
* { id: 3, status: "pending" },
|
|
25328
|
+
* { id: 4, status: "completed" }
|
|
25329
|
+
* ])
|
|
25330
|
+
*
|
|
25331
|
+
* // Remove completed tasks by filtering status
|
|
25332
|
+
* MutableList.filter(tasks, (task) => task.status !== "completed")
|
|
25333
|
+
* console.log(MutableList.takeAll(tasks)) // Only pending tasks
|
|
25334
|
+
* ```
|
|
25335
|
+
*
|
|
25336
|
+
* @since 4.0.0
|
|
25337
|
+
* @category mutations
|
|
25338
|
+
*/
|
|
25339
|
+
const remove$3 = (self$1, value) => filter$1(self$1, (v) => v !== value);
|
|
25046
25340
|
|
|
25047
25341
|
//#endregion
|
|
25048
25342
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/MutableRef.js
|
|
25049
|
-
const TypeId$
|
|
25343
|
+
const TypeId$41 = "~effect/MutableRef";
|
|
25050
25344
|
const MutableRefProto = {
|
|
25051
|
-
[TypeId$
|
|
25345
|
+
[TypeId$41]: TypeId$41,
|
|
25052
25346
|
...PipeInspectableProto,
|
|
25053
25347
|
toJSON() {
|
|
25054
25348
|
return {
|
|
@@ -25081,11 +25375,1402 @@ const MutableRefProto = {
|
|
|
25081
25375
|
* @since 2.0.0
|
|
25082
25376
|
* @category constructors
|
|
25083
25377
|
*/
|
|
25084
|
-
const make$
|
|
25378
|
+
const make$41 = (value) => {
|
|
25085
25379
|
const ref = Object.create(MutableRefProto);
|
|
25086
25380
|
ref.current = value;
|
|
25087
25381
|
return ref;
|
|
25088
25382
|
};
|
|
25383
|
+
/**
|
|
25384
|
+
* Gets the current value of the MutableRef.
|
|
25385
|
+
*
|
|
25386
|
+
* @example
|
|
25387
|
+
* ```ts
|
|
25388
|
+
* import { MutableRef } from "effect"
|
|
25389
|
+
*
|
|
25390
|
+
* const ref = MutableRef.make("hello")
|
|
25391
|
+
* console.log(MutableRef.get(ref)) // "hello"
|
|
25392
|
+
*
|
|
25393
|
+
* MutableRef.set(ref, "world")
|
|
25394
|
+
* console.log(MutableRef.get(ref)) // "world"
|
|
25395
|
+
*
|
|
25396
|
+
* // Reading complex objects
|
|
25397
|
+
* const config = MutableRef.make({ port: 3000, host: "localhost" })
|
|
25398
|
+
* const currentConfig = MutableRef.get(config)
|
|
25399
|
+
* console.log(currentConfig.port) // 3000
|
|
25400
|
+
*
|
|
25401
|
+
* // Multiple reads return the same value
|
|
25402
|
+
* const value1 = MutableRef.get(ref)
|
|
25403
|
+
* const value2 = MutableRef.get(ref)
|
|
25404
|
+
* console.log(value1 === value2) // true
|
|
25405
|
+
* ```
|
|
25406
|
+
*
|
|
25407
|
+
* @since 2.0.0
|
|
25408
|
+
* @category general
|
|
25409
|
+
*/
|
|
25410
|
+
const get$7 = (self$1) => self$1.current;
|
|
25411
|
+
/**
|
|
25412
|
+
* Sets the MutableRef to a new value and returns the reference.
|
|
25413
|
+
*
|
|
25414
|
+
* @example
|
|
25415
|
+
* ```ts
|
|
25416
|
+
* import { MutableRef } from "effect"
|
|
25417
|
+
*
|
|
25418
|
+
* const ref = MutableRef.make("initial")
|
|
25419
|
+
*
|
|
25420
|
+
* // Set a new value
|
|
25421
|
+
* MutableRef.set(ref, "updated")
|
|
25422
|
+
* console.log(MutableRef.get(ref)) // "updated"
|
|
25423
|
+
*
|
|
25424
|
+
* // Chain set operations (since it returns the ref)
|
|
25425
|
+
* const result = MutableRef.set(ref, "final")
|
|
25426
|
+
* console.log(result === ref) // true (same reference)
|
|
25427
|
+
* console.log(MutableRef.get(ref)) // "final"
|
|
25428
|
+
*
|
|
25429
|
+
* // Set complex objects
|
|
25430
|
+
* const config = MutableRef.make({ debug: false, verbose: false })
|
|
25431
|
+
* MutableRef.set(config, { debug: true, verbose: true })
|
|
25432
|
+
* console.log(MutableRef.get(config)) // { debug: true, verbose: true }
|
|
25433
|
+
*
|
|
25434
|
+
* // Pipe-able version
|
|
25435
|
+
* const setValue = MutableRef.set("new value")
|
|
25436
|
+
* setValue(ref)
|
|
25437
|
+
* console.log(MutableRef.get(ref)) // "new value"
|
|
25438
|
+
*
|
|
25439
|
+
* // Useful for state management
|
|
25440
|
+
* const state = MutableRef.make<"idle" | "loading" | "success" | "error">("idle")
|
|
25441
|
+
* MutableRef.set(state, "loading")
|
|
25442
|
+
* // ... perform async operation
|
|
25443
|
+
* MutableRef.set(state, "success")
|
|
25444
|
+
* ```
|
|
25445
|
+
*
|
|
25446
|
+
* @since 2.0.0
|
|
25447
|
+
* @category general
|
|
25448
|
+
*/
|
|
25449
|
+
const set$5 = /* @__PURE__ */ dual(2, (self$1, value) => {
|
|
25450
|
+
self$1.current = value;
|
|
25451
|
+
return self$1;
|
|
25452
|
+
});
|
|
25453
|
+
|
|
25454
|
+
//#endregion
|
|
25455
|
+
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/PubSub.js
|
|
25456
|
+
/**
|
|
25457
|
+
* This module provides utilities for working with publish-subscribe (PubSub) systems.
|
|
25458
|
+
*
|
|
25459
|
+
* A PubSub is an asynchronous message hub where publishers can publish messages and subscribers
|
|
25460
|
+
* can subscribe to receive those messages. PubSub supports various backpressure strategies,
|
|
25461
|
+
* message replay, and concurrent access from multiple producers and consumers.
|
|
25462
|
+
*
|
|
25463
|
+
* @example
|
|
25464
|
+
* ```ts
|
|
25465
|
+
* import { Effect, PubSub } from "effect"
|
|
25466
|
+
*
|
|
25467
|
+
* const program = Effect.gen(function*() {
|
|
25468
|
+
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
25469
|
+
*
|
|
25470
|
+
* // Publisher
|
|
25471
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
25472
|
+
* yield* PubSub.publish(pubsub, "World")
|
|
25473
|
+
*
|
|
25474
|
+
* // Subscriber
|
|
25475
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
25476
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
25477
|
+
* const message1 = yield* PubSub.take(subscription)
|
|
25478
|
+
* const message2 = yield* PubSub.take(subscription)
|
|
25479
|
+
* console.log(message1, message2) // "Hello", "World"
|
|
25480
|
+
* }))
|
|
25481
|
+
* })
|
|
25482
|
+
* ```
|
|
25483
|
+
*
|
|
25484
|
+
* @since 2.0.0
|
|
25485
|
+
*/
|
|
25486
|
+
const TypeId$40 = "~effect/PubSub";
|
|
25487
|
+
const SubscriptionTypeId = "~effect/PubSub/Subscription";
|
|
25488
|
+
/**
|
|
25489
|
+
* Creates a PubSub with a custom atomic implementation and strategy.
|
|
25490
|
+
*
|
|
25491
|
+
* @example
|
|
25492
|
+
* ```ts
|
|
25493
|
+
* import { Effect } from "effect"
|
|
25494
|
+
* import * as PubSub from "effect/PubSub"
|
|
25495
|
+
*
|
|
25496
|
+
* const program = Effect.gen(function*() {
|
|
25497
|
+
* // Create custom PubSub with specific atomic implementation and strategy
|
|
25498
|
+
* const pubsub = yield* PubSub.make<string>({
|
|
25499
|
+
* atomicPubSub: () => PubSub.makeAtomicBounded(100),
|
|
25500
|
+
* strategy: () => new PubSub.BackPressureStrategy()
|
|
25501
|
+
* })
|
|
25502
|
+
*
|
|
25503
|
+
* // Use the created PubSub
|
|
25504
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
25505
|
+
* })
|
|
25506
|
+
* ```
|
|
25507
|
+
*
|
|
25508
|
+
* @since 4.0.0
|
|
25509
|
+
* @category constructors
|
|
25510
|
+
*/
|
|
25511
|
+
const make$40 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(), /* @__PURE__ */ new Map(), makeUnsafe$6(), makeLatchUnsafe(false), make$41(false), options.strategy()));
|
|
25512
|
+
/**
|
|
25513
|
+
* Creates a bounded PubSub with backpressure strategy.
|
|
25514
|
+
*
|
|
25515
|
+
* The PubSub will retain messages until they have been taken by all subscribers.
|
|
25516
|
+
* When the PubSub reaches capacity, publishers will be suspended until space becomes available.
|
|
25517
|
+
* This ensures message delivery guarantees but may slow down fast publishers.
|
|
25518
|
+
*
|
|
25519
|
+
* @param capacity - The maximum number of messages the PubSub can hold, or an options object
|
|
25520
|
+
* with capacity and optional replay buffer size
|
|
25521
|
+
* @returns An Effect that creates a bounded PubSub
|
|
25522
|
+
*
|
|
25523
|
+
* @example
|
|
25524
|
+
* ```ts
|
|
25525
|
+
* import { Effect } from "effect"
|
|
25526
|
+
* import * as PubSub from "effect/PubSub"
|
|
25527
|
+
*
|
|
25528
|
+
* const program = Effect.gen(function*() {
|
|
25529
|
+
* // Create bounded PubSub with capacity 100
|
|
25530
|
+
* const pubsub = yield* PubSub.bounded<string>(100)
|
|
25531
|
+
*
|
|
25532
|
+
* // Create with replay buffer for late subscribers
|
|
25533
|
+
* const pubsubWithReplay = yield* PubSub.bounded<string>({
|
|
25534
|
+
* capacity: 100,
|
|
25535
|
+
* replay: 10 // Last 10 messages replayed to new subscribers
|
|
25536
|
+
* })
|
|
25537
|
+
* })
|
|
25538
|
+
* ```
|
|
25539
|
+
*
|
|
25540
|
+
* @since 2.0.0
|
|
25541
|
+
* @category constructors
|
|
25542
|
+
*/
|
|
25543
|
+
const bounded$1 = (capacity) => make$40({
|
|
25544
|
+
atomicPubSub: () => makeAtomicBounded(capacity),
|
|
25545
|
+
strategy: () => new BackPressureStrategy()
|
|
25546
|
+
});
|
|
25547
|
+
/**
|
|
25548
|
+
* Creates a bounded `PubSub` with the dropping strategy. The `PubSub` will drop new
|
|
25549
|
+
* messages if the `PubSub` is at capacity.
|
|
25550
|
+
*
|
|
25551
|
+
* For best performance use capacities that are powers of two.
|
|
25552
|
+
*
|
|
25553
|
+
* @example
|
|
25554
|
+
* ```ts
|
|
25555
|
+
* import { Effect } from "effect"
|
|
25556
|
+
* import * as PubSub from "effect/PubSub"
|
|
25557
|
+
*
|
|
25558
|
+
* const program = Effect.gen(function*() {
|
|
25559
|
+
* // Create dropping PubSub that drops new messages when full
|
|
25560
|
+
* const pubsub = yield* PubSub.dropping<string>(3)
|
|
25561
|
+
*
|
|
25562
|
+
* // With replay buffer for late subscribers
|
|
25563
|
+
* const pubsubWithReplay = yield* PubSub.dropping<string>({
|
|
25564
|
+
* capacity: 3,
|
|
25565
|
+
* replay: 5
|
|
25566
|
+
* })
|
|
25567
|
+
*
|
|
25568
|
+
* // Fill the PubSub and see dropping behavior
|
|
25569
|
+
* yield* PubSub.publish(pubsub, "msg1") // succeeds
|
|
25570
|
+
* yield* PubSub.publish(pubsub, "msg2") // succeeds
|
|
25571
|
+
* yield* PubSub.publish(pubsub, "msg3") // succeeds
|
|
25572
|
+
* const dropped = yield* PubSub.publish(pubsub, "msg4") // returns false (dropped)
|
|
25573
|
+
* console.log("Message dropped:", !dropped)
|
|
25574
|
+
* })
|
|
25575
|
+
* ```
|
|
25576
|
+
*
|
|
25577
|
+
* @since 2.0.0
|
|
25578
|
+
* @category constructors
|
|
25579
|
+
*/
|
|
25580
|
+
const dropping = (capacity) => make$40({
|
|
25581
|
+
atomicPubSub: () => makeAtomicBounded(capacity),
|
|
25582
|
+
strategy: () => new DroppingStrategy()
|
|
25583
|
+
});
|
|
25584
|
+
/**
|
|
25585
|
+
* Creates a bounded `PubSub` with the sliding strategy. The `PubSub` will add new
|
|
25586
|
+
* messages and drop old messages if the `PubSub` is at capacity.
|
|
25587
|
+
*
|
|
25588
|
+
* For best performance use capacities that are powers of two.
|
|
25589
|
+
*
|
|
25590
|
+
* @example
|
|
25591
|
+
* ```ts
|
|
25592
|
+
* import { Effect } from "effect"
|
|
25593
|
+
* import * as PubSub from "effect/PubSub"
|
|
25594
|
+
*
|
|
25595
|
+
* const program = Effect.gen(function*() {
|
|
25596
|
+
* // Create sliding PubSub that evicts old messages when full
|
|
25597
|
+
* const pubsub = yield* PubSub.sliding<string>(3)
|
|
25598
|
+
*
|
|
25599
|
+
* // With replay buffer
|
|
25600
|
+
* const pubsubWithReplay = yield* PubSub.sliding<string>({
|
|
25601
|
+
* capacity: 3,
|
|
25602
|
+
* replay: 2
|
|
25603
|
+
* })
|
|
25604
|
+
*
|
|
25605
|
+
* // Fill and overflow the PubSub
|
|
25606
|
+
* yield* PubSub.publish(pubsub, "msg1")
|
|
25607
|
+
* yield* PubSub.publish(pubsub, "msg2")
|
|
25608
|
+
* yield* PubSub.publish(pubsub, "msg3")
|
|
25609
|
+
* yield* PubSub.publish(pubsub, "msg4") // "msg1" is evicted
|
|
25610
|
+
*
|
|
25611
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
25612
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
25613
|
+
* const messages = yield* PubSub.takeAll(subscription)
|
|
25614
|
+
* console.log(messages) // ["msg2", "msg3", "msg4"]
|
|
25615
|
+
* }))
|
|
25616
|
+
* })
|
|
25617
|
+
* ```
|
|
25618
|
+
*
|
|
25619
|
+
* @since 2.0.0
|
|
25620
|
+
* @category constructors
|
|
25621
|
+
*/
|
|
25622
|
+
const sliding = (capacity) => make$40({
|
|
25623
|
+
atomicPubSub: () => makeAtomicBounded(capacity),
|
|
25624
|
+
strategy: () => new SlidingStrategy()
|
|
25625
|
+
});
|
|
25626
|
+
/**
|
|
25627
|
+
* Creates an unbounded `PubSub`.
|
|
25628
|
+
*
|
|
25629
|
+
* @example
|
|
25630
|
+
* ```ts
|
|
25631
|
+
* import { Effect } from "effect"
|
|
25632
|
+
* import * as PubSub from "effect/PubSub"
|
|
25633
|
+
*
|
|
25634
|
+
* const program = Effect.gen(function*() {
|
|
25635
|
+
* // Create unbounded PubSub
|
|
25636
|
+
* const pubsub = yield* PubSub.unbounded<string>()
|
|
25637
|
+
*
|
|
25638
|
+
* // With replay buffer for late subscribers
|
|
25639
|
+
* const pubsubWithReplay = yield* PubSub.unbounded<string>({
|
|
25640
|
+
* replay: 10
|
|
25641
|
+
* })
|
|
25642
|
+
*
|
|
25643
|
+
* // Can publish unlimited messages
|
|
25644
|
+
* for (let i = 0; i < 1000; i++) {
|
|
25645
|
+
* yield* PubSub.publish(pubsub, `message-${i}`)
|
|
25646
|
+
* }
|
|
25647
|
+
*
|
|
25648
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
25649
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
25650
|
+
* const message = yield* PubSub.take(subscription)
|
|
25651
|
+
* console.log("First message:", message)
|
|
25652
|
+
* }))
|
|
25653
|
+
* })
|
|
25654
|
+
* ```
|
|
25655
|
+
*
|
|
25656
|
+
* @since 2.0.0
|
|
25657
|
+
* @category constructors
|
|
25658
|
+
*/
|
|
25659
|
+
const unbounded = (options) => make$40({
|
|
25660
|
+
atomicPubSub: () => makeAtomicUnbounded(options),
|
|
25661
|
+
strategy: () => new DroppingStrategy()
|
|
25662
|
+
});
|
|
25663
|
+
/**
|
|
25664
|
+
* Creates a bounded atomic PubSub implementation with optional replay buffer.
|
|
25665
|
+
*
|
|
25666
|
+
* @since 4.0.0
|
|
25667
|
+
* @category constructors
|
|
25668
|
+
*/
|
|
25669
|
+
const makeAtomicBounded = (capacity) => {
|
|
25670
|
+
const options = typeof capacity === "number" ? { capacity } : capacity;
|
|
25671
|
+
ensureCapacity(options.capacity);
|
|
25672
|
+
const replayBuffer = options.replay && options.replay > 0 ? new ReplayBuffer(Math.ceil(options.replay)) : void 0;
|
|
25673
|
+
if (options.capacity === 1) return new BoundedPubSubSingle(replayBuffer);
|
|
25674
|
+
else if (nextPow2(options.capacity) === options.capacity) return new BoundedPubSubPow2(options.capacity, replayBuffer);
|
|
25675
|
+
else return new BoundedPubSubArb(options.capacity, replayBuffer);
|
|
25676
|
+
};
|
|
25677
|
+
/**
|
|
25678
|
+
* Creates an unbounded atomic PubSub implementation with optional replay buffer.
|
|
25679
|
+
*
|
|
25680
|
+
* @since 4.0.0
|
|
25681
|
+
* @category constructors
|
|
25682
|
+
*/
|
|
25683
|
+
const makeAtomicUnbounded = (options) => new UnboundedPubSub(options?.replay ? new ReplayBuffer(options.replay) : void 0);
|
|
25684
|
+
/**
|
|
25685
|
+
* Interrupts any fibers that are suspended on `offer` or `take`. Future calls
|
|
25686
|
+
* to `offer*` and `take*` will be interrupted immediately.
|
|
25687
|
+
*
|
|
25688
|
+
* @example
|
|
25689
|
+
* ```ts
|
|
25690
|
+
* import { Effect, Fiber, PubSub } from "effect"
|
|
25691
|
+
*
|
|
25692
|
+
* const program = Effect.gen(function*() {
|
|
25693
|
+
* const pubsub = yield* PubSub.bounded<string>(1)
|
|
25694
|
+
*
|
|
25695
|
+
* // Start a fiber that will be suspended waiting to publish
|
|
25696
|
+
* const publisherFiber = yield* Effect.forkChild(
|
|
25697
|
+
* Effect.gen(function*() {
|
|
25698
|
+
* yield* PubSub.publish(pubsub, "msg1") // fills the buffer
|
|
25699
|
+
* yield* PubSub.publish(pubsub, "msg2") // will suspend here
|
|
25700
|
+
* })
|
|
25701
|
+
* )
|
|
25702
|
+
*
|
|
25703
|
+
* // Shutdown the PubSub
|
|
25704
|
+
* yield* PubSub.shutdown(pubsub)
|
|
25705
|
+
*
|
|
25706
|
+
* // The suspended publisher will be interrupted
|
|
25707
|
+
* const result = yield* Fiber.await(publisherFiber)
|
|
25708
|
+
* console.log("Publisher interrupted:", result._tag === "Failure")
|
|
25709
|
+
* })
|
|
25710
|
+
* ```
|
|
25711
|
+
*
|
|
25712
|
+
* @since 2.0.0
|
|
25713
|
+
* @category lifecycle
|
|
25714
|
+
*/
|
|
25715
|
+
const shutdown$1 = (self$1) => uninterruptible(withFiber((fiber$2) => {
|
|
25716
|
+
set$5(self$1.shutdownFlag, true);
|
|
25717
|
+
return close(self$1.scope, interrupt$3(fiber$2.id)).pipe(andThen(self$1.strategy.shutdown), when(self$1.shutdownHook.open), asVoid);
|
|
25718
|
+
}));
|
|
25719
|
+
/**
|
|
25720
|
+
* Publishes a message to the `PubSub`, returning whether the message was published
|
|
25721
|
+
* to the `PubSub`.
|
|
25722
|
+
*
|
|
25723
|
+
* @example
|
|
25724
|
+
* ```ts
|
|
25725
|
+
* import { Effect } from "effect"
|
|
25726
|
+
* import * as PubSub from "effect/PubSub"
|
|
25727
|
+
*
|
|
25728
|
+
* const program = Effect.gen(function*() {
|
|
25729
|
+
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
25730
|
+
*
|
|
25731
|
+
* // Publish a message
|
|
25732
|
+
* const published = yield* PubSub.publish(pubsub, "Hello World")
|
|
25733
|
+
* console.log("Message published:", published) // true
|
|
25734
|
+
*
|
|
25735
|
+
* // With a full bounded PubSub using backpressure strategy
|
|
25736
|
+
* const smallPubsub = yield* PubSub.bounded<string>(1)
|
|
25737
|
+
* yield* PubSub.publish(smallPubsub, "msg1") // succeeds
|
|
25738
|
+
*
|
|
25739
|
+
* // This will suspend until space becomes available
|
|
25740
|
+
* const publishEffect = PubSub.publish(smallPubsub, "msg2")
|
|
25741
|
+
*
|
|
25742
|
+
* // Create a subscriber to free up space
|
|
25743
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
25744
|
+
* const subscription = yield* PubSub.subscribe(smallPubsub)
|
|
25745
|
+
* yield* PubSub.take(subscription) // frees space
|
|
25746
|
+
* const result = yield* publishEffect
|
|
25747
|
+
* console.log("Second message published:", result) // true
|
|
25748
|
+
* }))
|
|
25749
|
+
* })
|
|
25750
|
+
* ```
|
|
25751
|
+
*
|
|
25752
|
+
* @since 2.0.0
|
|
25753
|
+
* @category publishing
|
|
25754
|
+
*/
|
|
25755
|
+
const publish = /* @__PURE__ */ dual(2, (self$1, value) => suspend$3(() => {
|
|
25756
|
+
if (self$1.shutdownFlag.current) return interrupt$1;
|
|
25757
|
+
if (self$1.pubsub.publish(value)) {
|
|
25758
|
+
self$1.strategy.completeSubscribersUnsafe(self$1.pubsub, self$1.subscribers);
|
|
25759
|
+
return succeed$1(true);
|
|
25760
|
+
}
|
|
25761
|
+
return self$1.strategy.handleSurplus(self$1.pubsub, self$1.subscribers, [value], self$1.shutdownFlag);
|
|
25762
|
+
}));
|
|
25763
|
+
/**
|
|
25764
|
+
* Subscribes to receive messages from the `PubSub`. The resulting subscription can
|
|
25765
|
+
* be evaluated multiple times within the scope to take a message from the `PubSub`
|
|
25766
|
+
* each time.
|
|
25767
|
+
*
|
|
25768
|
+
* @example
|
|
25769
|
+
* ```ts
|
|
25770
|
+
* import { Effect, PubSub } from "effect"
|
|
25771
|
+
*
|
|
25772
|
+
* const program = Effect.gen(function*() {
|
|
25773
|
+
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
25774
|
+
*
|
|
25775
|
+
* // Publish some messages
|
|
25776
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
25777
|
+
* yield* PubSub.publish(pubsub, "World")
|
|
25778
|
+
*
|
|
25779
|
+
* // Subscribe within a scope for automatic cleanup
|
|
25780
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
25781
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
25782
|
+
*
|
|
25783
|
+
* // Take messages one by one
|
|
25784
|
+
* const msg1 = yield* PubSub.take(subscription)
|
|
25785
|
+
* const msg2 = yield* PubSub.take(subscription)
|
|
25786
|
+
* console.log(msg1, msg2) // "Hello", "World"
|
|
25787
|
+
*
|
|
25788
|
+
* // Subscription is automatically cleaned up when scope exits
|
|
25789
|
+
* }))
|
|
25790
|
+
*
|
|
25791
|
+
* // Multiple subscribers can receive the same messages
|
|
25792
|
+
* yield* PubSub.publish(pubsub, "Broadcast")
|
|
25793
|
+
*
|
|
25794
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
25795
|
+
* const sub1 = yield* PubSub.subscribe(pubsub)
|
|
25796
|
+
* const sub2 = yield* PubSub.subscribe(pubsub)
|
|
25797
|
+
*
|
|
25798
|
+
* const [msg1, msg2] = yield* Effect.all([
|
|
25799
|
+
* PubSub.take(sub1),
|
|
25800
|
+
* PubSub.take(sub2)
|
|
25801
|
+
* ])
|
|
25802
|
+
* console.log("Both received:", msg1, msg2) // "Broadcast", "Broadcast"
|
|
25803
|
+
* }))
|
|
25804
|
+
* })
|
|
25805
|
+
* ```
|
|
25806
|
+
*
|
|
25807
|
+
* @since 2.0.0
|
|
25808
|
+
* @category subscription
|
|
25809
|
+
*/
|
|
25810
|
+
const subscribe = (self$1) => acquireRelease(sync(() => makeSubscriptionUnsafe(self$1.pubsub, self$1.subscribers, self$1.strategy)), unsubscribe);
|
|
25811
|
+
const unsubscribe = (self$1) => uninterruptible(withFiber((state) => {
|
|
25812
|
+
set$5(self$1.shutdownFlag, true);
|
|
25813
|
+
return forEach$1(takeAll$1(self$1.pollers), (d) => interruptWith(d, state.id), {
|
|
25814
|
+
discard: true,
|
|
25815
|
+
concurrency: "unbounded"
|
|
25816
|
+
}).pipe(tap(() => {
|
|
25817
|
+
self$1.subscribers.delete(self$1.subscription);
|
|
25818
|
+
self$1.subscription.unsubscribe();
|
|
25819
|
+
self$1.strategy.onPubSubEmptySpaceUnsafe(self$1.pubsub, self$1.subscribers);
|
|
25820
|
+
}), when(self$1.shutdownHook.open), asVoid);
|
|
25821
|
+
}));
|
|
25822
|
+
/**
|
|
25823
|
+
* Takes a single message from the subscription. If no messages are available,
|
|
25824
|
+
* this will suspend until a message becomes available.
|
|
25825
|
+
*
|
|
25826
|
+
* @example
|
|
25827
|
+
* ```ts
|
|
25828
|
+
* import { Effect, Fiber, PubSub } from "effect"
|
|
25829
|
+
*
|
|
25830
|
+
* const program = Effect.gen(function*() {
|
|
25831
|
+
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
25832
|
+
*
|
|
25833
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
25834
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
25835
|
+
*
|
|
25836
|
+
* // Start a fiber to take a message (will suspend)
|
|
25837
|
+
* const takeFiber = yield* Effect.forkChild(
|
|
25838
|
+
* PubSub.take(subscription)
|
|
25839
|
+
* )
|
|
25840
|
+
*
|
|
25841
|
+
* // Publish a message
|
|
25842
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
25843
|
+
*
|
|
25844
|
+
* // The take will now complete
|
|
25845
|
+
* const message = yield* Fiber.join(takeFiber)
|
|
25846
|
+
* console.log("Received:", message) // "Hello"
|
|
25847
|
+
* }))
|
|
25848
|
+
* })
|
|
25849
|
+
* ```
|
|
25850
|
+
*
|
|
25851
|
+
* @since 4.0.0
|
|
25852
|
+
* @category subscription
|
|
25853
|
+
*/
|
|
25854
|
+
const take$1 = (self$1) => suspend$3(() => {
|
|
25855
|
+
if (self$1.shutdownFlag.current) return interrupt$1;
|
|
25856
|
+
if (self$1.replayWindow.remaining > 0) {
|
|
25857
|
+
const message$1 = self$1.replayWindow.take();
|
|
25858
|
+
return succeed$1(message$1);
|
|
25859
|
+
}
|
|
25860
|
+
const message = self$1.pollers.length === 0 ? self$1.subscription.poll() : Empty$2;
|
|
25861
|
+
if (message === Empty$2) return pollForItem(self$1);
|
|
25862
|
+
else {
|
|
25863
|
+
self$1.strategy.onPubSubEmptySpaceUnsafe(self$1.pubsub, self$1.subscribers);
|
|
25864
|
+
return succeed$1(message);
|
|
25865
|
+
}
|
|
25866
|
+
});
|
|
25867
|
+
const pollForItem = (self$1) => {
|
|
25868
|
+
const deferred = makeUnsafe$7();
|
|
25869
|
+
let set$7 = self$1.subscribers.get(self$1.subscription);
|
|
25870
|
+
if (!set$7) {
|
|
25871
|
+
set$7 = /* @__PURE__ */ new Set();
|
|
25872
|
+
self$1.subscribers.set(self$1.subscription, set$7);
|
|
25873
|
+
}
|
|
25874
|
+
set$7.add(self$1.pollers);
|
|
25875
|
+
append(self$1.pollers, deferred);
|
|
25876
|
+
self$1.strategy.completePollersUnsafe(self$1.pubsub, self$1.subscribers, self$1.subscription, self$1.pollers);
|
|
25877
|
+
return onInterrupt(_await(deferred), () => {
|
|
25878
|
+
remove$3(self$1.pollers, deferred);
|
|
25879
|
+
return void_$1;
|
|
25880
|
+
});
|
|
25881
|
+
};
|
|
25882
|
+
const AbsentValue = /* @__PURE__ */ Symbol.for("effect/PubSub/AbsentValue");
|
|
25883
|
+
const addSubscribers = (subscribers, subscription, pollers) => {
|
|
25884
|
+
if (!subscribers.has(subscription)) subscribers.set(subscription, /* @__PURE__ */ new Set());
|
|
25885
|
+
subscribers.get(subscription).add(pollers);
|
|
25886
|
+
};
|
|
25887
|
+
const removeSubscribers = (subscribers, subscription, pollers) => {
|
|
25888
|
+
if (!subscribers.has(subscription)) return;
|
|
25889
|
+
const set$7 = subscribers.get(subscription);
|
|
25890
|
+
set$7.delete(pollers);
|
|
25891
|
+
if (set$7.size === 0) subscribers.delete(subscription);
|
|
25892
|
+
};
|
|
25893
|
+
const makeSubscriptionUnsafe = (pubsub, subscribers, strategy) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$42(), makeLatchUnsafe(false), make$41(false), strategy, pubsub.replayWindow());
|
|
25894
|
+
var BoundedPubSubArb = class {
|
|
25895
|
+
array;
|
|
25896
|
+
publisherIndex = 0;
|
|
25897
|
+
subscribers;
|
|
25898
|
+
subscriberCount = 0;
|
|
25899
|
+
subscribersIndex = 0;
|
|
25900
|
+
capacity;
|
|
25901
|
+
replayBuffer;
|
|
25902
|
+
constructor(capacity, replayBuffer) {
|
|
25903
|
+
this.capacity = capacity;
|
|
25904
|
+
this.replayBuffer = replayBuffer;
|
|
25905
|
+
this.array = Array.from({ length: capacity });
|
|
25906
|
+
this.subscribers = Array.from({ length: capacity });
|
|
25907
|
+
}
|
|
25908
|
+
replayWindow() {
|
|
25909
|
+
return this.replayBuffer ? new ReplayWindowImpl(this.replayBuffer) : emptyReplayWindow;
|
|
25910
|
+
}
|
|
25911
|
+
isEmpty() {
|
|
25912
|
+
return this.publisherIndex === this.subscribersIndex;
|
|
25913
|
+
}
|
|
25914
|
+
isFull() {
|
|
25915
|
+
return this.publisherIndex === this.subscribersIndex + this.capacity;
|
|
25916
|
+
}
|
|
25917
|
+
size() {
|
|
25918
|
+
return this.publisherIndex - this.subscribersIndex;
|
|
25919
|
+
}
|
|
25920
|
+
publish(value) {
|
|
25921
|
+
if (this.isFull()) return false;
|
|
25922
|
+
if (this.subscriberCount !== 0) {
|
|
25923
|
+
const index = this.publisherIndex % this.capacity;
|
|
25924
|
+
this.array[index] = value;
|
|
25925
|
+
this.subscribers[index] = this.subscriberCount;
|
|
25926
|
+
this.publisherIndex += 1;
|
|
25927
|
+
}
|
|
25928
|
+
if (this.replayBuffer) this.replayBuffer.offer(value);
|
|
25929
|
+
return true;
|
|
25930
|
+
}
|
|
25931
|
+
publishAll(elements) {
|
|
25932
|
+
if (this.subscriberCount === 0) {
|
|
25933
|
+
if (this.replayBuffer) this.replayBuffer.offerAll(elements);
|
|
25934
|
+
return [];
|
|
25935
|
+
}
|
|
25936
|
+
const chunk = fromIterable$2(elements);
|
|
25937
|
+
const n = chunk.length;
|
|
25938
|
+
const size$2 = this.publisherIndex - this.subscribersIndex;
|
|
25939
|
+
const available = this.capacity - size$2;
|
|
25940
|
+
const forPubSub = Math.min(n, available);
|
|
25941
|
+
if (forPubSub === 0) return chunk;
|
|
25942
|
+
let iteratorIndex = 0;
|
|
25943
|
+
const publishAllIndex = this.publisherIndex + forPubSub;
|
|
25944
|
+
while (this.publisherIndex !== publishAllIndex) {
|
|
25945
|
+
const a = chunk[iteratorIndex++];
|
|
25946
|
+
const index = this.publisherIndex % this.capacity;
|
|
25947
|
+
this.array[index] = a;
|
|
25948
|
+
this.subscribers[index] = this.subscriberCount;
|
|
25949
|
+
this.publisherIndex += 1;
|
|
25950
|
+
if (this.replayBuffer) this.replayBuffer.offer(a);
|
|
25951
|
+
}
|
|
25952
|
+
return chunk.slice(iteratorIndex);
|
|
25953
|
+
}
|
|
25954
|
+
slide() {
|
|
25955
|
+
if (this.subscribersIndex !== this.publisherIndex) {
|
|
25956
|
+
const index = this.subscribersIndex % this.capacity;
|
|
25957
|
+
this.array[index] = AbsentValue;
|
|
25958
|
+
this.subscribers[index] = 0;
|
|
25959
|
+
this.subscribersIndex += 1;
|
|
25960
|
+
}
|
|
25961
|
+
if (this.replayBuffer) this.replayBuffer.slide();
|
|
25962
|
+
}
|
|
25963
|
+
subscribe() {
|
|
25964
|
+
this.subscriberCount += 1;
|
|
25965
|
+
return new BoundedPubSubArbSubscription(this, this.publisherIndex, false);
|
|
25966
|
+
}
|
|
25967
|
+
};
|
|
25968
|
+
var BoundedPubSubArbSubscription = class {
|
|
25969
|
+
self;
|
|
25970
|
+
subscriberIndex;
|
|
25971
|
+
unsubscribed;
|
|
25972
|
+
constructor(self$1, subscriberIndex, unsubscribed) {
|
|
25973
|
+
this.self = self$1;
|
|
25974
|
+
this.subscriberIndex = subscriberIndex;
|
|
25975
|
+
this.unsubscribed = unsubscribed;
|
|
25976
|
+
}
|
|
25977
|
+
isEmpty() {
|
|
25978
|
+
return this.unsubscribed || this.self.publisherIndex === this.subscriberIndex || this.self.publisherIndex === this.self.subscribersIndex;
|
|
25979
|
+
}
|
|
25980
|
+
size() {
|
|
25981
|
+
if (this.unsubscribed) return 0;
|
|
25982
|
+
return this.self.publisherIndex - Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
25983
|
+
}
|
|
25984
|
+
poll() {
|
|
25985
|
+
if (this.unsubscribed) return Empty$2;
|
|
25986
|
+
this.subscriberIndex = Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
25987
|
+
if (this.subscriberIndex !== this.self.publisherIndex) {
|
|
25988
|
+
const index = this.subscriberIndex % this.self.capacity;
|
|
25989
|
+
const elem = this.self.array[index];
|
|
25990
|
+
this.self.subscribers[index] -= 1;
|
|
25991
|
+
if (this.self.subscribers[index] === 0) {
|
|
25992
|
+
this.self.array[index] = AbsentValue;
|
|
25993
|
+
this.self.subscribersIndex += 1;
|
|
25994
|
+
}
|
|
25995
|
+
this.subscriberIndex += 1;
|
|
25996
|
+
return elem;
|
|
25997
|
+
}
|
|
25998
|
+
return Empty$2;
|
|
25999
|
+
}
|
|
26000
|
+
pollUpTo(n) {
|
|
26001
|
+
if (this.unsubscribed) return [];
|
|
26002
|
+
this.subscriberIndex = Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
26003
|
+
const size$2 = this.self.publisherIndex - this.subscriberIndex;
|
|
26004
|
+
const toPoll = Math.min(n, size$2);
|
|
26005
|
+
if (toPoll <= 0) return [];
|
|
26006
|
+
const builder = [];
|
|
26007
|
+
const pollUpToIndex = this.subscriberIndex + toPoll;
|
|
26008
|
+
while (this.subscriberIndex !== pollUpToIndex) {
|
|
26009
|
+
const index = this.subscriberIndex % this.self.capacity;
|
|
26010
|
+
const a = this.self.array[index];
|
|
26011
|
+
this.self.subscribers[index] -= 1;
|
|
26012
|
+
if (this.self.subscribers[index] === 0) {
|
|
26013
|
+
this.self.array[index] = AbsentValue;
|
|
26014
|
+
this.self.subscribersIndex += 1;
|
|
26015
|
+
}
|
|
26016
|
+
builder.push(a);
|
|
26017
|
+
this.subscriberIndex += 1;
|
|
26018
|
+
}
|
|
26019
|
+
return builder;
|
|
26020
|
+
}
|
|
26021
|
+
unsubscribe() {
|
|
26022
|
+
if (!this.unsubscribed) {
|
|
26023
|
+
this.unsubscribed = true;
|
|
26024
|
+
this.self.subscriberCount -= 1;
|
|
26025
|
+
this.subscriberIndex = Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
26026
|
+
while (this.subscriberIndex !== this.self.publisherIndex) {
|
|
26027
|
+
const index = this.subscriberIndex % this.self.capacity;
|
|
26028
|
+
this.self.subscribers[index] -= 1;
|
|
26029
|
+
if (this.self.subscribers[index] === 0) {
|
|
26030
|
+
this.self.array[index] = AbsentValue;
|
|
26031
|
+
this.self.subscribersIndex += 1;
|
|
26032
|
+
}
|
|
26033
|
+
this.subscriberIndex += 1;
|
|
26034
|
+
}
|
|
26035
|
+
}
|
|
26036
|
+
}
|
|
26037
|
+
};
|
|
26038
|
+
var BoundedPubSubPow2 = class {
|
|
26039
|
+
array;
|
|
26040
|
+
mask;
|
|
26041
|
+
publisherIndex = 0;
|
|
26042
|
+
subscribers;
|
|
26043
|
+
subscriberCount = 0;
|
|
26044
|
+
subscribersIndex = 0;
|
|
26045
|
+
capacity;
|
|
26046
|
+
replayBuffer;
|
|
26047
|
+
constructor(capacity, replayBuffer) {
|
|
26048
|
+
this.capacity = capacity;
|
|
26049
|
+
this.replayBuffer = replayBuffer;
|
|
26050
|
+
this.array = Array.from({ length: capacity });
|
|
26051
|
+
this.mask = capacity - 1;
|
|
26052
|
+
this.subscribers = Array.from({ length: capacity });
|
|
26053
|
+
}
|
|
26054
|
+
replayWindow() {
|
|
26055
|
+
return this.replayBuffer ? new ReplayWindowImpl(this.replayBuffer) : emptyReplayWindow;
|
|
26056
|
+
}
|
|
26057
|
+
isEmpty() {
|
|
26058
|
+
return this.publisherIndex === this.subscribersIndex;
|
|
26059
|
+
}
|
|
26060
|
+
isFull() {
|
|
26061
|
+
return this.publisherIndex === this.subscribersIndex + this.capacity;
|
|
26062
|
+
}
|
|
26063
|
+
size() {
|
|
26064
|
+
return this.publisherIndex - this.subscribersIndex;
|
|
26065
|
+
}
|
|
26066
|
+
publish(value) {
|
|
26067
|
+
if (this.isFull()) return false;
|
|
26068
|
+
if (this.subscriberCount !== 0) {
|
|
26069
|
+
const index = this.publisherIndex & this.mask;
|
|
26070
|
+
this.array[index] = value;
|
|
26071
|
+
this.subscribers[index] = this.subscriberCount;
|
|
26072
|
+
this.publisherIndex += 1;
|
|
26073
|
+
}
|
|
26074
|
+
if (this.replayBuffer) this.replayBuffer.offer(value);
|
|
26075
|
+
return true;
|
|
26076
|
+
}
|
|
26077
|
+
publishAll(elements) {
|
|
26078
|
+
if (this.subscriberCount === 0) {
|
|
26079
|
+
if (this.replayBuffer) this.replayBuffer.offerAll(elements);
|
|
26080
|
+
return [];
|
|
26081
|
+
}
|
|
26082
|
+
const chunk = fromIterable$2(elements);
|
|
26083
|
+
const n = chunk.length;
|
|
26084
|
+
const size$2 = this.publisherIndex - this.subscribersIndex;
|
|
26085
|
+
const available = this.capacity - size$2;
|
|
26086
|
+
const forPubSub = Math.min(n, available);
|
|
26087
|
+
if (forPubSub === 0) return chunk;
|
|
26088
|
+
let iteratorIndex = 0;
|
|
26089
|
+
const publishAllIndex = this.publisherIndex + forPubSub;
|
|
26090
|
+
while (this.publisherIndex !== publishAllIndex) {
|
|
26091
|
+
const elem = chunk[iteratorIndex++];
|
|
26092
|
+
const index = this.publisherIndex & this.mask;
|
|
26093
|
+
this.array[index] = elem;
|
|
26094
|
+
this.subscribers[index] = this.subscriberCount;
|
|
26095
|
+
this.publisherIndex += 1;
|
|
26096
|
+
if (this.replayBuffer) this.replayBuffer.offer(elem);
|
|
26097
|
+
}
|
|
26098
|
+
return chunk.slice(iteratorIndex);
|
|
26099
|
+
}
|
|
26100
|
+
slide() {
|
|
26101
|
+
if (this.subscribersIndex !== this.publisherIndex) {
|
|
26102
|
+
const index = this.subscribersIndex & this.mask;
|
|
26103
|
+
this.array[index] = AbsentValue;
|
|
26104
|
+
this.subscribers[index] = 0;
|
|
26105
|
+
this.subscribersIndex += 1;
|
|
26106
|
+
}
|
|
26107
|
+
if (this.replayBuffer) this.replayBuffer.slide();
|
|
26108
|
+
}
|
|
26109
|
+
subscribe() {
|
|
26110
|
+
this.subscriberCount += 1;
|
|
26111
|
+
return new BoundedPubSubPow2Subscription(this, this.publisherIndex, false);
|
|
26112
|
+
}
|
|
26113
|
+
};
|
|
26114
|
+
var BoundedPubSubPow2Subscription = class {
|
|
26115
|
+
self;
|
|
26116
|
+
subscriberIndex;
|
|
26117
|
+
unsubscribed;
|
|
26118
|
+
constructor(self$1, subscriberIndex, unsubscribed) {
|
|
26119
|
+
this.self = self$1;
|
|
26120
|
+
this.subscriberIndex = subscriberIndex;
|
|
26121
|
+
this.unsubscribed = unsubscribed;
|
|
26122
|
+
}
|
|
26123
|
+
isEmpty() {
|
|
26124
|
+
return this.unsubscribed || this.self.publisherIndex === this.subscriberIndex || this.self.publisherIndex === this.self.subscribersIndex;
|
|
26125
|
+
}
|
|
26126
|
+
size() {
|
|
26127
|
+
if (this.unsubscribed) return 0;
|
|
26128
|
+
return this.self.publisherIndex - Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
26129
|
+
}
|
|
26130
|
+
poll() {
|
|
26131
|
+
if (this.unsubscribed) return Empty$2;
|
|
26132
|
+
this.subscriberIndex = Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
26133
|
+
if (this.subscriberIndex !== this.self.publisherIndex) {
|
|
26134
|
+
const index = this.subscriberIndex & this.self.mask;
|
|
26135
|
+
const elem = this.self.array[index];
|
|
26136
|
+
this.self.subscribers[index] -= 1;
|
|
26137
|
+
if (this.self.subscribers[index] === 0) {
|
|
26138
|
+
this.self.array[index] = AbsentValue;
|
|
26139
|
+
this.self.subscribersIndex += 1;
|
|
26140
|
+
}
|
|
26141
|
+
this.subscriberIndex += 1;
|
|
26142
|
+
return elem;
|
|
26143
|
+
}
|
|
26144
|
+
return Empty$2;
|
|
26145
|
+
}
|
|
26146
|
+
pollUpTo(n) {
|
|
26147
|
+
if (this.unsubscribed) return [];
|
|
26148
|
+
this.subscriberIndex = Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
26149
|
+
const size$2 = this.self.publisherIndex - this.subscriberIndex;
|
|
26150
|
+
const toPoll = Math.min(n, size$2);
|
|
26151
|
+
if (toPoll <= 0) return [];
|
|
26152
|
+
const builder = [];
|
|
26153
|
+
const pollUpToIndex = this.subscriberIndex + toPoll;
|
|
26154
|
+
while (this.subscriberIndex !== pollUpToIndex) {
|
|
26155
|
+
const index = this.subscriberIndex & this.self.mask;
|
|
26156
|
+
const elem = this.self.array[index];
|
|
26157
|
+
this.self.subscribers[index] -= 1;
|
|
26158
|
+
if (this.self.subscribers[index] === 0) {
|
|
26159
|
+
this.self.array[index] = AbsentValue;
|
|
26160
|
+
this.self.subscribersIndex += 1;
|
|
26161
|
+
}
|
|
26162
|
+
builder.push(elem);
|
|
26163
|
+
this.subscriberIndex += 1;
|
|
26164
|
+
}
|
|
26165
|
+
return builder;
|
|
26166
|
+
}
|
|
26167
|
+
unsubscribe() {
|
|
26168
|
+
if (!this.unsubscribed) {
|
|
26169
|
+
this.unsubscribed = true;
|
|
26170
|
+
this.self.subscriberCount -= 1;
|
|
26171
|
+
this.subscriberIndex = Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
26172
|
+
while (this.subscriberIndex !== this.self.publisherIndex) {
|
|
26173
|
+
const index = this.subscriberIndex & this.self.mask;
|
|
26174
|
+
this.self.subscribers[index] -= 1;
|
|
26175
|
+
if (this.self.subscribers[index] === 0) {
|
|
26176
|
+
this.self.array[index] = AbsentValue;
|
|
26177
|
+
this.self.subscribersIndex += 1;
|
|
26178
|
+
}
|
|
26179
|
+
this.subscriberIndex += 1;
|
|
26180
|
+
}
|
|
26181
|
+
}
|
|
26182
|
+
}
|
|
26183
|
+
};
|
|
26184
|
+
var BoundedPubSubSingle = class {
|
|
26185
|
+
publisherIndex = 0;
|
|
26186
|
+
subscriberCount = 0;
|
|
26187
|
+
subscribers = 0;
|
|
26188
|
+
value = AbsentValue;
|
|
26189
|
+
capacity = 1;
|
|
26190
|
+
replayBuffer;
|
|
26191
|
+
constructor(replayBuffer) {
|
|
26192
|
+
this.replayBuffer = replayBuffer;
|
|
26193
|
+
}
|
|
26194
|
+
replayWindow() {
|
|
26195
|
+
return this.replayBuffer ? new ReplayWindowImpl(this.replayBuffer) : emptyReplayWindow;
|
|
26196
|
+
}
|
|
26197
|
+
pipe() {
|
|
26198
|
+
return pipeArguments(this, arguments);
|
|
26199
|
+
}
|
|
26200
|
+
isEmpty() {
|
|
26201
|
+
return this.subscribers === 0;
|
|
26202
|
+
}
|
|
26203
|
+
isFull() {
|
|
26204
|
+
return !this.isEmpty();
|
|
26205
|
+
}
|
|
26206
|
+
size() {
|
|
26207
|
+
return this.isEmpty() ? 0 : 1;
|
|
26208
|
+
}
|
|
26209
|
+
publish(value) {
|
|
26210
|
+
if (this.isFull()) return false;
|
|
26211
|
+
if (this.subscriberCount !== 0) {
|
|
26212
|
+
this.value = value;
|
|
26213
|
+
this.subscribers = this.subscriberCount;
|
|
26214
|
+
this.publisherIndex += 1;
|
|
26215
|
+
}
|
|
26216
|
+
if (this.replayBuffer) this.replayBuffer.offer(value);
|
|
26217
|
+
return true;
|
|
26218
|
+
}
|
|
26219
|
+
publishAll(elements) {
|
|
26220
|
+
if (this.subscriberCount === 0) {
|
|
26221
|
+
if (this.replayBuffer) this.replayBuffer.offerAll(elements);
|
|
26222
|
+
return [];
|
|
26223
|
+
}
|
|
26224
|
+
const chunk = fromIterable$2(elements);
|
|
26225
|
+
if (chunk.length === 0) return chunk;
|
|
26226
|
+
if (this.publish(chunk[0])) return chunk.slice(1);
|
|
26227
|
+
else return chunk;
|
|
26228
|
+
}
|
|
26229
|
+
slide() {
|
|
26230
|
+
if (this.isFull()) {
|
|
26231
|
+
this.subscribers = 0;
|
|
26232
|
+
this.value = AbsentValue;
|
|
26233
|
+
}
|
|
26234
|
+
if (this.replayBuffer) this.replayBuffer.slide();
|
|
26235
|
+
}
|
|
26236
|
+
subscribe() {
|
|
26237
|
+
this.subscriberCount += 1;
|
|
26238
|
+
return new BoundedPubSubSingleSubscription(this, this.publisherIndex, false);
|
|
26239
|
+
}
|
|
26240
|
+
};
|
|
26241
|
+
var BoundedPubSubSingleSubscription = class {
|
|
26242
|
+
self;
|
|
26243
|
+
subscriberIndex;
|
|
26244
|
+
unsubscribed;
|
|
26245
|
+
constructor(self$1, subscriberIndex, unsubscribed) {
|
|
26246
|
+
this.self = self$1;
|
|
26247
|
+
this.subscriberIndex = subscriberIndex;
|
|
26248
|
+
this.unsubscribed = unsubscribed;
|
|
26249
|
+
}
|
|
26250
|
+
isEmpty() {
|
|
26251
|
+
return this.unsubscribed || this.self.subscribers === 0 || this.subscriberIndex === this.self.publisherIndex;
|
|
26252
|
+
}
|
|
26253
|
+
size() {
|
|
26254
|
+
return this.isEmpty() ? 0 : 1;
|
|
26255
|
+
}
|
|
26256
|
+
poll() {
|
|
26257
|
+
if (this.isEmpty()) return Empty$2;
|
|
26258
|
+
const elem = this.self.value;
|
|
26259
|
+
this.self.subscribers -= 1;
|
|
26260
|
+
if (this.self.subscribers === 0) this.self.value = AbsentValue;
|
|
26261
|
+
this.subscriberIndex += 1;
|
|
26262
|
+
return elem;
|
|
26263
|
+
}
|
|
26264
|
+
pollUpTo(n) {
|
|
26265
|
+
if (this.isEmpty() || n < 1) return [];
|
|
26266
|
+
const a = this.self.value;
|
|
26267
|
+
this.self.subscribers -= 1;
|
|
26268
|
+
if (this.self.subscribers === 0) this.self.value = AbsentValue;
|
|
26269
|
+
this.subscriberIndex += 1;
|
|
26270
|
+
return [a];
|
|
26271
|
+
}
|
|
26272
|
+
unsubscribe() {
|
|
26273
|
+
if (!this.unsubscribed) {
|
|
26274
|
+
this.unsubscribed = true;
|
|
26275
|
+
this.self.subscriberCount -= 1;
|
|
26276
|
+
if (this.subscriberIndex !== this.self.publisherIndex) {
|
|
26277
|
+
this.self.subscribers -= 1;
|
|
26278
|
+
if (this.self.subscribers === 0) this.self.value = AbsentValue;
|
|
26279
|
+
}
|
|
26280
|
+
}
|
|
26281
|
+
}
|
|
26282
|
+
};
|
|
26283
|
+
var UnboundedPubSub = class {
|
|
26284
|
+
publisherHead = {
|
|
26285
|
+
value: AbsentValue,
|
|
26286
|
+
subscribers: 0,
|
|
26287
|
+
next: null
|
|
26288
|
+
};
|
|
26289
|
+
publisherTail = this.publisherHead;
|
|
26290
|
+
publisherIndex = 0;
|
|
26291
|
+
subscribersIndex = 0;
|
|
26292
|
+
capacity = Number.MAX_SAFE_INTEGER;
|
|
26293
|
+
replayBuffer;
|
|
26294
|
+
constructor(replayBuffer) {
|
|
26295
|
+
this.replayBuffer = replayBuffer;
|
|
26296
|
+
}
|
|
26297
|
+
replayWindow() {
|
|
26298
|
+
return this.replayBuffer ? new ReplayWindowImpl(this.replayBuffer) : emptyReplayWindow;
|
|
26299
|
+
}
|
|
26300
|
+
isEmpty() {
|
|
26301
|
+
return this.publisherHead === this.publisherTail;
|
|
26302
|
+
}
|
|
26303
|
+
isFull() {
|
|
26304
|
+
return false;
|
|
26305
|
+
}
|
|
26306
|
+
size() {
|
|
26307
|
+
return this.publisherIndex - this.subscribersIndex;
|
|
26308
|
+
}
|
|
26309
|
+
publish(value) {
|
|
26310
|
+
const subscribers = this.publisherTail.subscribers;
|
|
26311
|
+
if (subscribers !== 0) {
|
|
26312
|
+
this.publisherTail.next = {
|
|
26313
|
+
value,
|
|
26314
|
+
subscribers,
|
|
26315
|
+
next: null
|
|
26316
|
+
};
|
|
26317
|
+
this.publisherTail = this.publisherTail.next;
|
|
26318
|
+
this.publisherIndex += 1;
|
|
26319
|
+
}
|
|
26320
|
+
if (this.replayBuffer) this.replayBuffer.offer(value);
|
|
26321
|
+
return true;
|
|
26322
|
+
}
|
|
26323
|
+
publishAll(elements) {
|
|
26324
|
+
if (this.publisherTail.subscribers !== 0) for (const a of elements) this.publish(a);
|
|
26325
|
+
else if (this.replayBuffer) this.replayBuffer.offerAll(elements);
|
|
26326
|
+
return [];
|
|
26327
|
+
}
|
|
26328
|
+
slide() {
|
|
26329
|
+
if (this.publisherHead !== this.publisherTail) {
|
|
26330
|
+
this.publisherHead = this.publisherHead.next;
|
|
26331
|
+
this.publisherHead.value = AbsentValue;
|
|
26332
|
+
this.subscribersIndex += 1;
|
|
26333
|
+
}
|
|
26334
|
+
if (this.replayBuffer) this.replayBuffer.slide();
|
|
26335
|
+
}
|
|
26336
|
+
subscribe() {
|
|
26337
|
+
this.publisherTail.subscribers += 1;
|
|
26338
|
+
return new UnboundedPubSubSubscription(this, this.publisherTail, this.publisherIndex, false);
|
|
26339
|
+
}
|
|
26340
|
+
};
|
|
26341
|
+
var UnboundedPubSubSubscription = class {
|
|
26342
|
+
self;
|
|
26343
|
+
subscriberHead;
|
|
26344
|
+
subscriberIndex;
|
|
26345
|
+
unsubscribed;
|
|
26346
|
+
constructor(self$1, subscriberHead, subscriberIndex, unsubscribed) {
|
|
26347
|
+
this.self = self$1;
|
|
26348
|
+
this.subscriberHead = subscriberHead;
|
|
26349
|
+
this.subscriberIndex = subscriberIndex;
|
|
26350
|
+
this.unsubscribed = unsubscribed;
|
|
26351
|
+
}
|
|
26352
|
+
isEmpty() {
|
|
26353
|
+
if (this.unsubscribed) return true;
|
|
26354
|
+
let empty$15 = true;
|
|
26355
|
+
let loop = true;
|
|
26356
|
+
while (loop) if (this.subscriberHead === this.self.publisherTail) loop = false;
|
|
26357
|
+
else if (this.subscriberHead.next.value !== AbsentValue) {
|
|
26358
|
+
empty$15 = false;
|
|
26359
|
+
loop = false;
|
|
26360
|
+
} else {
|
|
26361
|
+
this.subscriberHead = this.subscriberHead.next;
|
|
26362
|
+
this.subscriberIndex += 1;
|
|
26363
|
+
}
|
|
26364
|
+
return empty$15;
|
|
26365
|
+
}
|
|
26366
|
+
size() {
|
|
26367
|
+
if (this.unsubscribed) return 0;
|
|
26368
|
+
return this.self.publisherIndex - Math.max(this.subscriberIndex, this.self.subscribersIndex);
|
|
26369
|
+
}
|
|
26370
|
+
poll() {
|
|
26371
|
+
if (this.unsubscribed) return Empty$2;
|
|
26372
|
+
let loop = true;
|
|
26373
|
+
let polled = Empty$2;
|
|
26374
|
+
while (loop) if (this.subscriberHead === this.self.publisherTail) loop = false;
|
|
26375
|
+
else {
|
|
26376
|
+
const elem = this.subscriberHead.next.value;
|
|
26377
|
+
if (elem !== AbsentValue) {
|
|
26378
|
+
polled = elem;
|
|
26379
|
+
this.subscriberHead.subscribers -= 1;
|
|
26380
|
+
if (this.subscriberHead.subscribers === 0) {
|
|
26381
|
+
this.self.publisherHead = this.self.publisherHead.next;
|
|
26382
|
+
this.self.publisherHead.value = AbsentValue;
|
|
26383
|
+
this.self.subscribersIndex += 1;
|
|
26384
|
+
}
|
|
26385
|
+
loop = false;
|
|
26386
|
+
}
|
|
26387
|
+
this.subscriberHead = this.subscriberHead.next;
|
|
26388
|
+
this.subscriberIndex += 1;
|
|
26389
|
+
}
|
|
26390
|
+
return polled;
|
|
26391
|
+
}
|
|
26392
|
+
pollUpTo(n) {
|
|
26393
|
+
const builder = [];
|
|
26394
|
+
let i = 0;
|
|
26395
|
+
while (i !== n) {
|
|
26396
|
+
const a = this.poll();
|
|
26397
|
+
if (a === Empty$2) i = n;
|
|
26398
|
+
else {
|
|
26399
|
+
builder.push(a);
|
|
26400
|
+
i += 1;
|
|
26401
|
+
}
|
|
26402
|
+
}
|
|
26403
|
+
return builder;
|
|
26404
|
+
}
|
|
26405
|
+
unsubscribe() {
|
|
26406
|
+
if (!this.unsubscribed) {
|
|
26407
|
+
this.unsubscribed = true;
|
|
26408
|
+
this.self.publisherTail.subscribers -= 1;
|
|
26409
|
+
while (this.subscriberHead !== this.self.publisherTail) {
|
|
26410
|
+
if (this.subscriberHead.next.value !== AbsentValue) {
|
|
26411
|
+
this.subscriberHead.subscribers -= 1;
|
|
26412
|
+
if (this.subscriberHead.subscribers === 0) {
|
|
26413
|
+
this.self.publisherHead = this.self.publisherHead.next;
|
|
26414
|
+
this.self.publisherHead.value = AbsentValue;
|
|
26415
|
+
this.self.subscribersIndex += 1;
|
|
26416
|
+
}
|
|
26417
|
+
}
|
|
26418
|
+
this.subscriberHead = this.subscriberHead.next;
|
|
26419
|
+
}
|
|
26420
|
+
}
|
|
26421
|
+
}
|
|
26422
|
+
};
|
|
26423
|
+
var SubscriptionImpl = class {
|
|
26424
|
+
[SubscriptionTypeId] = { _A: identity };
|
|
26425
|
+
pubsub;
|
|
26426
|
+
subscribers;
|
|
26427
|
+
subscription;
|
|
26428
|
+
pollers;
|
|
26429
|
+
shutdownHook;
|
|
26430
|
+
shutdownFlag;
|
|
26431
|
+
strategy;
|
|
26432
|
+
replayWindow;
|
|
26433
|
+
constructor(pubsub, subscribers, subscription, pollers, shutdownHook, shutdownFlag, strategy, replayWindow) {
|
|
26434
|
+
this.pubsub = pubsub;
|
|
26435
|
+
this.subscribers = subscribers;
|
|
26436
|
+
this.subscription = subscription;
|
|
26437
|
+
this.pollers = pollers;
|
|
26438
|
+
this.shutdownHook = shutdownHook;
|
|
26439
|
+
this.shutdownFlag = shutdownFlag;
|
|
26440
|
+
this.strategy = strategy;
|
|
26441
|
+
this.replayWindow = replayWindow;
|
|
26442
|
+
}
|
|
26443
|
+
pipe() {
|
|
26444
|
+
return pipeArguments(this, arguments);
|
|
26445
|
+
}
|
|
26446
|
+
};
|
|
26447
|
+
var PubSubImpl = class {
|
|
26448
|
+
[TypeId$40] = { _A: identity };
|
|
26449
|
+
pubsub;
|
|
26450
|
+
subscribers;
|
|
26451
|
+
scope;
|
|
26452
|
+
shutdownHook;
|
|
26453
|
+
shutdownFlag;
|
|
26454
|
+
strategy;
|
|
26455
|
+
constructor(pubsub, subscribers, scope$2, shutdownHook, shutdownFlag, strategy) {
|
|
26456
|
+
this.pubsub = pubsub;
|
|
26457
|
+
this.subscribers = subscribers;
|
|
26458
|
+
this.scope = scope$2;
|
|
26459
|
+
this.shutdownHook = shutdownHook;
|
|
26460
|
+
this.shutdownFlag = shutdownFlag;
|
|
26461
|
+
this.strategy = strategy;
|
|
26462
|
+
}
|
|
26463
|
+
pipe() {
|
|
26464
|
+
return pipeArguments(this, arguments);
|
|
26465
|
+
}
|
|
26466
|
+
};
|
|
26467
|
+
const makePubSubUnsafe = (pubsub, subscribers, scope$2, shutdownHook, shutdownFlag, strategy) => new PubSubImpl(pubsub, subscribers, scope$2, shutdownHook, shutdownFlag, strategy);
|
|
26468
|
+
const ensureCapacity = (capacity) => {
|
|
26469
|
+
if (capacity <= 0) throw new Error(`Cannot construct PubSub with capacity of ${capacity}`);
|
|
26470
|
+
};
|
|
26471
|
+
/**
|
|
26472
|
+
* A strategy that applies back pressure to publishers when the `PubSub` is at
|
|
26473
|
+
* capacity. This guarantees that all subscribers will receive all messages
|
|
26474
|
+
* published to the `PubSub` while they are subscribed. However, it creates the
|
|
26475
|
+
* risk that a slow subscriber will slow down the rate at which messages
|
|
26476
|
+
* are published and received by other subscribers.
|
|
26477
|
+
*
|
|
26478
|
+
* @since 4.0.0
|
|
26479
|
+
* @category models
|
|
26480
|
+
*/
|
|
26481
|
+
var BackPressureStrategy = class {
|
|
26482
|
+
publishers = /* @__PURE__ */ make$42();
|
|
26483
|
+
get shutdown() {
|
|
26484
|
+
return withFiber((fiber$2) => forEach$1(takeAll$1(this.publishers), ([_, deferred, last$1]) => last$1 ? interruptWith(deferred, fiber$2.id) : void_$1, {
|
|
26485
|
+
concurrency: "unbounded",
|
|
26486
|
+
discard: true
|
|
26487
|
+
}));
|
|
26488
|
+
}
|
|
26489
|
+
handleSurplus(pubsub, subscribers, elements, isShutdown) {
|
|
26490
|
+
return suspend$3(() => {
|
|
26491
|
+
const deferred = makeUnsafe$7();
|
|
26492
|
+
this.offerUnsafe(elements, deferred);
|
|
26493
|
+
this.onPubSubEmptySpaceUnsafe(pubsub, subscribers);
|
|
26494
|
+
this.completeSubscribersUnsafe(pubsub, subscribers);
|
|
26495
|
+
return (get$7(isShutdown) ? interrupt$1 : _await(deferred)).pipe(onInterrupt(() => {
|
|
26496
|
+
this.removeUnsafe(deferred);
|
|
26497
|
+
return void_$1;
|
|
26498
|
+
}));
|
|
26499
|
+
});
|
|
26500
|
+
}
|
|
26501
|
+
onPubSubEmptySpaceUnsafe(pubsub, subscribers) {
|
|
26502
|
+
let keepPolling = true;
|
|
26503
|
+
while (keepPolling && !pubsub.isFull()) {
|
|
26504
|
+
const publisher = take$2(this.publishers);
|
|
26505
|
+
if (publisher === Empty$2) keepPolling = false;
|
|
26506
|
+
else {
|
|
26507
|
+
const [value, deferred] = publisher;
|
|
26508
|
+
const published = pubsub.publish(value);
|
|
26509
|
+
if (published && publisher[2]) doneUnsafe(deferred, succeed$4(true));
|
|
26510
|
+
else if (!published) prepend(this.publishers, publisher);
|
|
26511
|
+
this.completeSubscribersUnsafe(pubsub, subscribers);
|
|
26512
|
+
}
|
|
26513
|
+
}
|
|
26514
|
+
}
|
|
26515
|
+
completePollersUnsafe(pubsub, subscribers, subscription, pollers) {
|
|
26516
|
+
return strategyCompletePollersUnsafe(this, pubsub, subscribers, subscription, pollers);
|
|
26517
|
+
}
|
|
26518
|
+
completeSubscribersUnsafe(pubsub, subscribers) {
|
|
26519
|
+
return strategyCompleteSubscribersUnsafe(this, pubsub, subscribers);
|
|
26520
|
+
}
|
|
26521
|
+
offerUnsafe(elements, deferred) {
|
|
26522
|
+
const iterator$1 = elements[Symbol.iterator]();
|
|
26523
|
+
let next = iterator$1.next();
|
|
26524
|
+
if (!next.done) while (1) {
|
|
26525
|
+
const value = next.value;
|
|
26526
|
+
next = iterator$1.next();
|
|
26527
|
+
if (next.done) {
|
|
26528
|
+
append(this.publishers, [
|
|
26529
|
+
value,
|
|
26530
|
+
deferred,
|
|
26531
|
+
true
|
|
26532
|
+
]);
|
|
26533
|
+
break;
|
|
26534
|
+
}
|
|
26535
|
+
append(this.publishers, [
|
|
26536
|
+
value,
|
|
26537
|
+
deferred,
|
|
26538
|
+
false
|
|
26539
|
+
]);
|
|
26540
|
+
}
|
|
26541
|
+
}
|
|
26542
|
+
removeUnsafe(deferred) {
|
|
26543
|
+
filter$1(this.publishers, ([_, d]) => d !== deferred);
|
|
26544
|
+
}
|
|
26545
|
+
};
|
|
26546
|
+
/**
|
|
26547
|
+
* A strategy that drops new messages when the `PubSub` is at capacity. This
|
|
26548
|
+
* guarantees that a slow subscriber will not slow down the rate at which
|
|
26549
|
+
* messages are published. However, it creates the risk that a slow
|
|
26550
|
+
* subscriber will slow down the rate at which messages are received by
|
|
26551
|
+
* other subscribers and that subscribers may not receive all messages
|
|
26552
|
+
* published to the `PubSub` while they are subscribed.
|
|
26553
|
+
*
|
|
26554
|
+
* @example
|
|
26555
|
+
* ```ts
|
|
26556
|
+
* import { Effect } from "effect"
|
|
26557
|
+
* import * as PubSub from "effect/PubSub"
|
|
26558
|
+
*
|
|
26559
|
+
* const program = Effect.gen(function*() {
|
|
26560
|
+
* // Create PubSub with dropping strategy
|
|
26561
|
+
* const pubsub = yield* PubSub.dropping<string>(2)
|
|
26562
|
+
*
|
|
26563
|
+
* // Or explicitly create with dropping strategy
|
|
26564
|
+
* const customPubsub = yield* PubSub.make<string>({
|
|
26565
|
+
* atomicPubSub: () => PubSub.makeAtomicBounded(2),
|
|
26566
|
+
* strategy: () => new PubSub.DroppingStrategy()
|
|
26567
|
+
* })
|
|
26568
|
+
*
|
|
26569
|
+
* // Fill the PubSub
|
|
26570
|
+
* const pub1 = yield* PubSub.publish(pubsub, "msg1") // true
|
|
26571
|
+
* const pub2 = yield* PubSub.publish(pubsub, "msg2") // true
|
|
26572
|
+
* const pub3 = yield* PubSub.publish(pubsub, "msg3") // false (dropped)
|
|
26573
|
+
*
|
|
26574
|
+
* console.log("Publication results:", [pub1, pub2, pub3]) // [true, true, false]
|
|
26575
|
+
*
|
|
26576
|
+
* // Subscribers will only see the first two messages
|
|
26577
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
26578
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
26579
|
+
* const messages = yield* PubSub.takeAll(subscription)
|
|
26580
|
+
* console.log("Received messages:", messages) // ["msg1", "msg2"]
|
|
26581
|
+
* }))
|
|
26582
|
+
* })
|
|
26583
|
+
* ```
|
|
26584
|
+
*
|
|
26585
|
+
* @since 4.0.0
|
|
26586
|
+
* @category models
|
|
26587
|
+
*/
|
|
26588
|
+
var DroppingStrategy = class {
|
|
26589
|
+
get shutdown() {
|
|
26590
|
+
return void_$1;
|
|
26591
|
+
}
|
|
26592
|
+
handleSurplus(_pubsub, _subscribers, _elements, _isShutdown) {
|
|
26593
|
+
return succeed$1(false);
|
|
26594
|
+
}
|
|
26595
|
+
onPubSubEmptySpaceUnsafe(_pubsub, _subscribers) {}
|
|
26596
|
+
completePollersUnsafe(pubsub, subscribers, subscription, pollers) {
|
|
26597
|
+
return strategyCompletePollersUnsafe(this, pubsub, subscribers, subscription, pollers);
|
|
26598
|
+
}
|
|
26599
|
+
completeSubscribersUnsafe(pubsub, subscribers) {
|
|
26600
|
+
return strategyCompleteSubscribersUnsafe(this, pubsub, subscribers);
|
|
26601
|
+
}
|
|
26602
|
+
};
|
|
26603
|
+
/**
|
|
26604
|
+
* A strategy that adds new messages and drops old messages when the `PubSub` is
|
|
26605
|
+
* at capacity. This guarantees that a slow subscriber will not slow down
|
|
26606
|
+
* the rate at which messages are published and received by other
|
|
26607
|
+
* subscribers. However, it creates the risk that a slow subscriber will
|
|
26608
|
+
* not receive some messages published to the `PubSub` while it is subscribed.
|
|
26609
|
+
*
|
|
26610
|
+
* @example
|
|
26611
|
+
* ```ts
|
|
26612
|
+
* import { Effect } from "effect"
|
|
26613
|
+
* import * as PubSub from "effect/PubSub"
|
|
26614
|
+
*
|
|
26615
|
+
* const program = Effect.gen(function*() {
|
|
26616
|
+
* // Create PubSub with sliding strategy
|
|
26617
|
+
* const pubsub = yield* PubSub.sliding<string>(2)
|
|
26618
|
+
*
|
|
26619
|
+
* // Or explicitly create with sliding strategy
|
|
26620
|
+
* const customPubsub = yield* PubSub.make<string>({
|
|
26621
|
+
* atomicPubSub: () => PubSub.makeAtomicBounded(2),
|
|
26622
|
+
* strategy: () => new PubSub.SlidingStrategy()
|
|
26623
|
+
* })
|
|
26624
|
+
*
|
|
26625
|
+
* // Publish messages that exceed capacity
|
|
26626
|
+
* yield* PubSub.publish(pubsub, "msg1") // stored
|
|
26627
|
+
* yield* PubSub.publish(pubsub, "msg2") // stored
|
|
26628
|
+
* yield* PubSub.publish(pubsub, "msg3") // "msg1" evicted, "msg3" stored
|
|
26629
|
+
* yield* PubSub.publish(pubsub, "msg4") // "msg2" evicted, "msg4" stored
|
|
26630
|
+
*
|
|
26631
|
+
* // Subscribers will see the most recent messages
|
|
26632
|
+
* yield* Effect.scoped(Effect.gen(function*() {
|
|
26633
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
26634
|
+
* const messages = yield* PubSub.takeAll(subscription)
|
|
26635
|
+
* console.log("Recent messages:", messages) // ["msg3", "msg4"]
|
|
26636
|
+
* }))
|
|
26637
|
+
* })
|
|
26638
|
+
* ```
|
|
26639
|
+
*
|
|
26640
|
+
* @since 4.0.0
|
|
26641
|
+
* @category models
|
|
26642
|
+
*/
|
|
26643
|
+
var SlidingStrategy = class {
|
|
26644
|
+
get shutdown() {
|
|
26645
|
+
return void_$1;
|
|
26646
|
+
}
|
|
26647
|
+
handleSurplus(pubsub, subscribers, elements, _isShutdown) {
|
|
26648
|
+
return sync(() => {
|
|
26649
|
+
this.slidingPublishUnsafe(pubsub, elements);
|
|
26650
|
+
this.completeSubscribersUnsafe(pubsub, subscribers);
|
|
26651
|
+
return true;
|
|
26652
|
+
});
|
|
26653
|
+
}
|
|
26654
|
+
onPubSubEmptySpaceUnsafe(_pubsub, _subscribers) {}
|
|
26655
|
+
completePollersUnsafe(pubsub, subscribers, subscription, pollers) {
|
|
26656
|
+
return strategyCompletePollersUnsafe(this, pubsub, subscribers, subscription, pollers);
|
|
26657
|
+
}
|
|
26658
|
+
completeSubscribersUnsafe(pubsub, subscribers) {
|
|
26659
|
+
return strategyCompleteSubscribersUnsafe(this, pubsub, subscribers);
|
|
26660
|
+
}
|
|
26661
|
+
slidingPublishUnsafe(pubsub, elements) {
|
|
26662
|
+
const it = elements[Symbol.iterator]();
|
|
26663
|
+
let next = it.next();
|
|
26664
|
+
if (!next.done && pubsub.capacity > 0) {
|
|
26665
|
+
let a = next.value;
|
|
26666
|
+
let loop = true;
|
|
26667
|
+
while (loop) {
|
|
26668
|
+
pubsub.slide();
|
|
26669
|
+
const pub = pubsub.publish(a);
|
|
26670
|
+
if (pub && (next = it.next()) && !next.done) a = next.value;
|
|
26671
|
+
else if (pub) loop = false;
|
|
26672
|
+
}
|
|
26673
|
+
}
|
|
26674
|
+
}
|
|
26675
|
+
};
|
|
26676
|
+
const strategyCompletePollersUnsafe = (strategy, pubsub, subscribers, subscription, pollers) => {
|
|
26677
|
+
let keepPolling = true;
|
|
26678
|
+
while (keepPolling && !subscription.isEmpty()) {
|
|
26679
|
+
const poller = take$2(pollers);
|
|
26680
|
+
if (poller === Empty$2) {
|
|
26681
|
+
removeSubscribers(subscribers, subscription, pollers);
|
|
26682
|
+
if (pollers.length === 0) keepPolling = false;
|
|
26683
|
+
else addSubscribers(subscribers, subscription, pollers);
|
|
26684
|
+
} else {
|
|
26685
|
+
const pollResult = subscription.poll();
|
|
26686
|
+
if (pollResult === Empty$2) prepend(pollers, poller);
|
|
26687
|
+
else {
|
|
26688
|
+
doneUnsafe(poller, succeed$4(pollResult));
|
|
26689
|
+
strategy.onPubSubEmptySpaceUnsafe(pubsub, subscribers);
|
|
26690
|
+
}
|
|
26691
|
+
}
|
|
26692
|
+
}
|
|
26693
|
+
};
|
|
26694
|
+
const strategyCompleteSubscribersUnsafe = (strategy, pubsub, subscribers) => {
|
|
26695
|
+
for (const [subscription, pollersSet] of subscribers) for (const pollers of pollersSet) strategy.completePollersUnsafe(pubsub, subscribers, subscription, pollers);
|
|
26696
|
+
};
|
|
26697
|
+
var ReplayBuffer = class {
|
|
26698
|
+
capacity;
|
|
26699
|
+
head = {
|
|
26700
|
+
value: AbsentValue,
|
|
26701
|
+
next: null
|
|
26702
|
+
};
|
|
26703
|
+
tail = this.head;
|
|
26704
|
+
size = 0;
|
|
26705
|
+
index = 0;
|
|
26706
|
+
constructor(capacity) {
|
|
26707
|
+
this.capacity = capacity;
|
|
26708
|
+
}
|
|
26709
|
+
slide() {
|
|
26710
|
+
this.index++;
|
|
26711
|
+
}
|
|
26712
|
+
offer(a) {
|
|
26713
|
+
this.tail.value = a;
|
|
26714
|
+
this.tail.next = {
|
|
26715
|
+
value: AbsentValue,
|
|
26716
|
+
next: null
|
|
26717
|
+
};
|
|
26718
|
+
this.tail = this.tail.next;
|
|
26719
|
+
if (this.size === this.capacity) this.head = this.head.next;
|
|
26720
|
+
else this.size += 1;
|
|
26721
|
+
}
|
|
26722
|
+
offerAll(as$3) {
|
|
26723
|
+
for (const a of as$3) this.offer(a);
|
|
26724
|
+
}
|
|
26725
|
+
};
|
|
26726
|
+
var ReplayWindowImpl = class {
|
|
26727
|
+
head;
|
|
26728
|
+
index;
|
|
26729
|
+
remaining;
|
|
26730
|
+
buffer;
|
|
26731
|
+
constructor(buffer$1) {
|
|
26732
|
+
this.buffer = buffer$1;
|
|
26733
|
+
this.index = buffer$1.index;
|
|
26734
|
+
this.remaining = buffer$1.size;
|
|
26735
|
+
this.head = buffer$1.head;
|
|
26736
|
+
}
|
|
26737
|
+
fastForward() {
|
|
26738
|
+
while (this.index < this.buffer.index) {
|
|
26739
|
+
this.head = this.head.next;
|
|
26740
|
+
this.index++;
|
|
26741
|
+
}
|
|
26742
|
+
}
|
|
26743
|
+
take() {
|
|
26744
|
+
if (this.remaining === 0) return;
|
|
26745
|
+
else if (this.index < this.buffer.index) this.fastForward();
|
|
26746
|
+
this.remaining--;
|
|
26747
|
+
const value = this.head.value;
|
|
26748
|
+
this.head = this.head.next;
|
|
26749
|
+
return value;
|
|
26750
|
+
}
|
|
26751
|
+
takeN(n) {
|
|
26752
|
+
if (this.remaining === 0) return [];
|
|
26753
|
+
else if (this.index < this.buffer.index) this.fastForward();
|
|
26754
|
+
const len = Math.min(n, this.remaining);
|
|
26755
|
+
const items = new Array(len);
|
|
26756
|
+
for (let i = 0; i < len; i++) {
|
|
26757
|
+
const value = this.head.value;
|
|
26758
|
+
this.head = this.head.next;
|
|
26759
|
+
items[i] = value;
|
|
26760
|
+
}
|
|
26761
|
+
this.remaining -= len;
|
|
26762
|
+
return items;
|
|
26763
|
+
}
|
|
26764
|
+
takeAll() {
|
|
26765
|
+
return this.takeN(this.remaining);
|
|
26766
|
+
}
|
|
26767
|
+
};
|
|
26768
|
+
const emptyReplayWindow = {
|
|
26769
|
+
remaining: 0,
|
|
26770
|
+
take: () => void 0,
|
|
26771
|
+
takeN: () => [],
|
|
26772
|
+
takeAll: () => []
|
|
26773
|
+
};
|
|
25089
26774
|
|
|
25090
26775
|
//#endregion
|
|
25091
26776
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Queue.js
|
|
@@ -25188,7 +26873,7 @@ const make$39 = (options) => withFiber$1((fiber$2) => {
|
|
|
25188
26873
|
self$1.scheduler = fiber$2.currentScheduler;
|
|
25189
26874
|
self$1.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
|
|
25190
26875
|
self$1.strategy = options?.strategy ?? "suspend";
|
|
25191
|
-
self$1.messages = make$
|
|
26876
|
+
self$1.messages = make$42();
|
|
25192
26877
|
self$1.scheduleRunning = false;
|
|
25193
26878
|
self$1.state = {
|
|
25194
26879
|
_tag: "Open",
|
|
@@ -25267,7 +26952,7 @@ const offer = (self$1, message) => suspend$4(() => {
|
|
|
25267
26952
|
}
|
|
25268
26953
|
return offerRemainingSingle(self$1, message);
|
|
25269
26954
|
case "sliding":
|
|
25270
|
-
take$
|
|
26955
|
+
take$2(self$1.messages);
|
|
25271
26956
|
append(self$1.messages, message);
|
|
25272
26957
|
return exitTrue;
|
|
25273
26958
|
}
|
|
@@ -25307,7 +26992,7 @@ const offerUnsafe = (self$1, message) => {
|
|
|
25307
26992
|
if (self$1.state._tag !== "Open") return false;
|
|
25308
26993
|
else if (self$1.messages.length >= self$1.capacity) {
|
|
25309
26994
|
if (self$1.strategy === "sliding") {
|
|
25310
|
-
take$
|
|
26995
|
+
take$2(self$1.messages);
|
|
25311
26996
|
append(self$1.messages, message);
|
|
25312
26997
|
return true;
|
|
25313
26998
|
} else if (self$1.capacity <= 0 && self$1.state.takers.size > 0) {
|
|
@@ -25704,14 +27389,14 @@ const take = (self$1) => suspend$4(() => takeUnsafe(self$1) ?? andThen$1(awaitTa
|
|
|
25704
27389
|
const takeUnsafe = (self$1) => {
|
|
25705
27390
|
if (self$1.state._tag === "Done") return self$1.state.exit;
|
|
25706
27391
|
if (self$1.messages.length > 0) {
|
|
25707
|
-
const message = take$
|
|
27392
|
+
const message = take$2(self$1.messages);
|
|
25708
27393
|
releaseCapacity(self$1);
|
|
25709
27394
|
return exitSucceed(message);
|
|
25710
27395
|
} else if (self$1.capacity <= 0 && self$1.state.offers.size > 0) {
|
|
25711
27396
|
self$1.capacity = 1;
|
|
25712
27397
|
releaseCapacity(self$1);
|
|
25713
27398
|
self$1.capacity = 0;
|
|
25714
|
-
const message = take$
|
|
27399
|
+
const message = take$2(self$1.messages);
|
|
25715
27400
|
releaseCapacity(self$1);
|
|
25716
27401
|
return exitSucceed(message);
|
|
25717
27402
|
}
|
|
@@ -25781,7 +27466,7 @@ const takeBetweenUnsafe = (self$1, min$3, max$3) => {
|
|
|
25781
27466
|
self$1.capacity = 1;
|
|
25782
27467
|
releaseCapacity(self$1);
|
|
25783
27468
|
self$1.capacity = 0;
|
|
25784
|
-
const messages = [take$
|
|
27469
|
+
const messages = [take$2(self$1.messages)];
|
|
25785
27470
|
releaseCapacity(self$1);
|
|
25786
27471
|
return exitSucceed(messages);
|
|
25787
27472
|
}
|
|
@@ -25868,6 +27553,14 @@ const finalize = (self$1, exit$2) => {
|
|
|
25868
27553
|
openState.awaiters.clear();
|
|
25869
27554
|
};
|
|
25870
27555
|
|
|
27556
|
+
//#endregion
|
|
27557
|
+
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Take.js
|
|
27558
|
+
/**
|
|
27559
|
+
* @since 4.0.0
|
|
27560
|
+
* @categor Conversions
|
|
27561
|
+
*/
|
|
27562
|
+
const toPull = (take$3) => isExit(take$3) ? isSuccess$2(take$3) ? done(take$3.value) : take$3 : succeed$1(take$3);
|
|
27563
|
+
|
|
25871
27564
|
//#endregion
|
|
25872
27565
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/Channel.js
|
|
25873
27566
|
/**
|
|
@@ -26228,6 +27921,16 @@ const failCause = (cause) => fromPull$1(failCause$2(cause));
|
|
|
26228
27921
|
*/
|
|
26229
27922
|
const die = (defect) => failCause(die$2(defect));
|
|
26230
27923
|
/**
|
|
27924
|
+
* @since 4.0.0
|
|
27925
|
+
* @category constructors
|
|
27926
|
+
*/
|
|
27927
|
+
const fromEffectTake = (effect$1) => fromPull$1(succeed$1(flatMap(effect$1, toPull)));
|
|
27928
|
+
/**
|
|
27929
|
+
* @since 4.0.0
|
|
27930
|
+
* @category constructors
|
|
27931
|
+
*/
|
|
27932
|
+
const fromPubSubTake$1 = (pubsub) => unwrap$2(map$6(subscribe(pubsub), (sub) => fromEffectTake(take$1(sub))));
|
|
27933
|
+
/**
|
|
26231
27934
|
* Maps the output of this channel using the specified function.
|
|
26232
27935
|
*
|
|
26233
27936
|
* @example
|
|
@@ -26371,7 +28074,7 @@ const mapEffectConcurrent = (self$1, f, options) => fromTransformBracket(fnUntra
|
|
|
26371
28074
|
trackFiber(fiber$2);
|
|
26372
28075
|
fiber$2.addObserver(onExit$4);
|
|
26373
28076
|
return offer(effects, join$1(fiber$2));
|
|
26374
|
-
}), forever({ autoYield: false }), catchCause$1((cause) => offer(effects, failCause$
|
|
28077
|
+
}), forever({ autoYield: false }), catchCause$1((cause) => offer(effects, failCause$4(cause)).pipe(andThen(failCause$1(effects, cause)))), forkIn(forkedScope));
|
|
26375
28078
|
}
|
|
26376
28079
|
return take(queue);
|
|
26377
28080
|
}));
|
|
@@ -26428,8 +28131,8 @@ const flattenArray = (self$1) => transformPull$1(self$1, (pull) => {
|
|
|
26428
28131
|
* @since 4.0.0
|
|
26429
28132
|
* @category Filtering
|
|
26430
28133
|
*/
|
|
26431
|
-
const filterMapEffect$1 = /* @__PURE__ */ dual(2, (self$1, filter$
|
|
26432
|
-
return flatMap(filter$
|
|
28134
|
+
const filterMapEffect$1 = /* @__PURE__ */ dual(2, (self$1, filter$7) => fromTransform$1((upstream, scope$2) => map$6(toTransform(self$1)(upstream, scope$2), (pull) => flatMap(pull, function loop(elem) {
|
|
28135
|
+
return flatMap(filter$7(elem), (result$2) => isFail(result$2) ? flatMap(pull, loop) : succeed$1(result$2));
|
|
26433
28136
|
}))));
|
|
26434
28137
|
/**
|
|
26435
28138
|
* Filters arrays of elements emitted by a channel, applying the filter
|
|
@@ -26467,14 +28170,14 @@ const filterMapEffect$1 = /* @__PURE__ */ dual(2, (self$1, filter$6) => fromTran
|
|
|
26467
28170
|
* @category Filtering
|
|
26468
28171
|
*/
|
|
26469
28172
|
const filterArray = /* @__PURE__ */ dual(2, (self$1, predicate) => transformPull$1(self$1, (pull) => succeed$1(flatMap(pull, function loop(arr) {
|
|
26470
|
-
const filtered = filter$
|
|
28173
|
+
const filtered = filter$4(arr, predicate);
|
|
26471
28174
|
return isReadonlyArrayNonEmpty(filtered) ? succeed$1(filtered) : flatMap(pull, loop);
|
|
26472
28175
|
}))));
|
|
26473
28176
|
/**
|
|
26474
28177
|
* @since 4.0.0
|
|
26475
28178
|
* @category Filtering
|
|
26476
28179
|
*/
|
|
26477
|
-
const filterMapArrayEffect = /* @__PURE__ */ dual(2, (self$1, filter$
|
|
28180
|
+
const filterMapArrayEffect = /* @__PURE__ */ dual(2, (self$1, filter$7) => filterMapEffect$1(self$1, (arr) => map$6(filterMap(arr, filter$7), (passes) => isReadonlyArrayNonEmpty(passes) ? passes : failVoid)));
|
|
26478
28181
|
/**
|
|
26479
28182
|
* Catches any cause of failure from the channel and allows recovery by
|
|
26480
28183
|
* creating a new channel based on the caught cause.
|
|
@@ -26517,7 +28220,7 @@ const catchCause = /* @__PURE__ */ dual(2, (self$1, f) => fromTransform$1((upstr
|
|
|
26517
28220
|
if (isDoneCause(cause)) return failCause$2(cause);
|
|
26518
28221
|
const toClose = forkedScope;
|
|
26519
28222
|
forkedScope = forkUnsafe(scope$2);
|
|
26520
|
-
return close(toClose, failCause$
|
|
28223
|
+
return close(toClose, failCause$4(cause)).pipe(andThen(toTransform(f(cause))(upstream, forkedScope)), flatMap((childPull) => {
|
|
26521
28224
|
currentPull = childPull;
|
|
26522
28225
|
return childPull;
|
|
26523
28226
|
}));
|
|
@@ -26532,8 +28235,8 @@ const catchCause = /* @__PURE__ */ dual(2, (self$1, f) => fromTransform$1((upstr
|
|
|
26532
28235
|
* @since 4.0.0
|
|
26533
28236
|
* @category Error handling
|
|
26534
28237
|
*/
|
|
26535
|
-
const catchCauseFilter = /* @__PURE__ */ dual(3, (self$1, filter$
|
|
26536
|
-
const eb = filter$
|
|
28238
|
+
const catchCauseFilter = /* @__PURE__ */ dual(3, (self$1, filter$7, f) => catchCause(self$1, (cause) => {
|
|
28239
|
+
const eb = filter$7(cause);
|
|
26537
28240
|
return !isFail(eb) ? f(eb, cause) : failCause(eb.fail);
|
|
26538
28241
|
}));
|
|
26539
28242
|
const catch_ = /* @__PURE__ */ dual(2, (self$1, f) => catchCauseFilter(self$1, filterError, f));
|
|
@@ -26572,6 +28275,28 @@ const mapError$1 = /* @__PURE__ */ dual(2, (self$1, f) => catch_(self$1, (err) =
|
|
|
26572
28275
|
*/
|
|
26573
28276
|
const orDie$1 = (self$1) => catch_(self$1, die);
|
|
26574
28277
|
/**
|
|
28278
|
+
* Returns a new channel that retries this channel according to the specified
|
|
28279
|
+
* schedule whenever it fails.
|
|
28280
|
+
*
|
|
28281
|
+
* @since 4.0.0
|
|
28282
|
+
* @category utils
|
|
28283
|
+
*/
|
|
28284
|
+
const retry$2 = /* @__PURE__ */ dual(2, (self$1, schedule) => suspend$2(() => {
|
|
28285
|
+
let step = void 0;
|
|
28286
|
+
let meta = CurrentMetadata.defaultValue();
|
|
28287
|
+
const withReset = onFirst(provideServiceEffect(self$1, CurrentMetadata, sync(() => meta)), () => {
|
|
28288
|
+
step = void 0;
|
|
28289
|
+
return void_$1;
|
|
28290
|
+
});
|
|
28291
|
+
const resolvedSchedule = typeof schedule === "function" ? schedule(identity) : schedule;
|
|
28292
|
+
const loop = catch_(withReset, fnUntraced(function* (error$1) {
|
|
28293
|
+
if (!step) step = yield* toStepWithMetadata(resolvedSchedule);
|
|
28294
|
+
meta = yield* step(error$1);
|
|
28295
|
+
return loop;
|
|
28296
|
+
}, (effect$1, error$1) => catchDone(effect$1, () => succeed$1(fail$2(error$1))), unwrap$2));
|
|
28297
|
+
return loop;
|
|
28298
|
+
}));
|
|
28299
|
+
/**
|
|
26575
28300
|
* Returns a new channel, which is the merge of this channel and the specified
|
|
26576
28301
|
* channel.
|
|
26577
28302
|
*
|
|
@@ -26784,12 +28509,34 @@ const bufferArray = /* @__PURE__ */ dual(2, (self$1, options) => fromTransform$1
|
|
|
26784
28509
|
* @category utils
|
|
26785
28510
|
*/
|
|
26786
28511
|
const onExit$1 = /* @__PURE__ */ dual(2, (self$1, finalizer) => fromTransformBracket((upstream, scope$2, forkedScope) => addFinalizerExit(forkedScope, finalizer).pipe(andThen(toTransform(self$1)(upstream, scope$2)))));
|
|
28512
|
+
/**
|
|
28513
|
+
* @since 4.0.0
|
|
28514
|
+
* @category utils
|
|
28515
|
+
*/
|
|
28516
|
+
const onFirst = /* @__PURE__ */ dual(2, (self$1, onFirst$1) => transformPull$1(self$1, (pull) => sync(() => {
|
|
28517
|
+
let isFirst = true;
|
|
28518
|
+
const pullFirst = tap(pull, (element) => {
|
|
28519
|
+
isFirst = false;
|
|
28520
|
+
return onFirst$1(element);
|
|
28521
|
+
});
|
|
28522
|
+
return suspend$3(() => isFirst ? pullFirst : pull);
|
|
28523
|
+
})));
|
|
26787
28524
|
const runWith$1 = (self$1, f, onHalt) => suspend$3(() => {
|
|
26788
28525
|
const scope$2 = makeUnsafe$6();
|
|
26789
28526
|
const makePull = toTransform(self$1)(done(), scope$2);
|
|
26790
28527
|
return catchDone(flatMap(makePull, f), onHalt ? onHalt : succeed$1).pipe(onExit$2((exit$2) => close(scope$2, exit$2)));
|
|
26791
28528
|
});
|
|
26792
28529
|
/**
|
|
28530
|
+
* @since 4.0.0
|
|
28531
|
+
* @category Services
|
|
28532
|
+
*/
|
|
28533
|
+
const provideService = /* @__PURE__ */ dual(3, (self$1, key, service$2) => fromTransform$1((upstream, scope$2) => map$6(provideService$1(toTransform(self$1)(upstream, scope$2), key, service$2), provideService$1(key, service$2))));
|
|
28534
|
+
/**
|
|
28535
|
+
* @since 4.0.0
|
|
28536
|
+
* @category Services
|
|
28537
|
+
*/
|
|
28538
|
+
const provideServiceEffect = /* @__PURE__ */ dual(3, (self$1, key, service$2) => fromTransform$1((upstream, scope$2) => flatMap(service$2, (s) => toTransform(provideService(self$1, key, s))(upstream, scope$2))));
|
|
28539
|
+
/**
|
|
26793
28540
|
* Runs a channel and applies an effect to each output element.
|
|
26794
28541
|
*
|
|
26795
28542
|
* @example
|
|
@@ -26875,6 +28622,18 @@ const runFold = /* @__PURE__ */ dual(3, (self$1, initial, f) => suspend$3(() =>
|
|
|
26875
28622
|
* @category Destructors
|
|
26876
28623
|
*/
|
|
26877
28624
|
const toPullScoped = (self$1, scope$2) => toTransform(self$1)(done(), scope$2);
|
|
28625
|
+
const makePubSub = (options) => acquireRelease(options.capacity === "unbounded" ? unbounded(options) : options.strategy === "dropping" ? dropping(options) : options.strategy === "sliding" ? sliding(options) : bounded$1(options), shutdown$1);
|
|
28626
|
+
/**
|
|
28627
|
+
* Converts a channel to a PubSub for concurrent consumption.
|
|
28628
|
+
*
|
|
28629
|
+
* @since 4.0.0
|
|
28630
|
+
* @category Destructors
|
|
28631
|
+
*/
|
|
28632
|
+
const toPubSubTake$1 = /* @__PURE__ */ dual(2, /* @__PURE__ */ fnUntraced(function* (self$1, options) {
|
|
28633
|
+
const pubsub = yield* makePubSub(options);
|
|
28634
|
+
yield* runForEach$1(self$1, (value) => publish(pubsub, value)).pipe(onExit$2((exit$2) => publish(pubsub, exit$2)), forkScoped);
|
|
28635
|
+
return pubsub;
|
|
28636
|
+
}));
|
|
26878
28637
|
|
|
26879
28638
|
//#endregion
|
|
26880
28639
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/internal/stream.js
|
|
@@ -27500,7 +29259,7 @@ const makeUnsafe$3 = (options) => ({
|
|
|
27500
29259
|
*/
|
|
27501
29260
|
const make$37 = (options) => withFiber((fiber$2) => {
|
|
27502
29261
|
const services$2 = fiber$2.services;
|
|
27503
|
-
const scope$2 = get$
|
|
29262
|
+
const scope$2 = get$8(services$2, Scope);
|
|
27504
29263
|
const self$1 = makeUnsafe$3({
|
|
27505
29264
|
lookup: options.lookup,
|
|
27506
29265
|
services: services$2,
|
|
@@ -27668,7 +29427,7 @@ var RcRefImpl = class {
|
|
|
27668
29427
|
/** @internal */
|
|
27669
29428
|
const make$36 = (options) => withFiber((fiber$2) => {
|
|
27670
29429
|
const services$2 = fiber$2.services;
|
|
27671
|
-
const scope$2 = get$
|
|
29430
|
+
const scope$2 = get$8(services$2, Scope);
|
|
27672
29431
|
const ref = new RcRefImpl(options.acquire, services$2, scope$2, options.idleTimeToLive ? fromDurationInputUnsafe(options.idleTimeToLive) : void 0);
|
|
27673
29432
|
return as(addFinalizerExit(scope$2, () => {
|
|
27674
29433
|
const close$1 = ref.state._tag === "Acquired" ? close(ref.state.scope, void_$2) : void_$1;
|
|
@@ -27873,6 +29632,35 @@ const DefaultChunkSize = DefaultChunkSize$1;
|
|
|
27873
29632
|
*/
|
|
27874
29633
|
const fromChannel = fromChannel$2;
|
|
27875
29634
|
/**
|
|
29635
|
+
* Creates a stream from an effect producing a value of type `A`, which is
|
|
29636
|
+
* repeated using the specified schedule.
|
|
29637
|
+
*
|
|
29638
|
+
* **Previously Known As**
|
|
29639
|
+
*
|
|
29640
|
+
* This API replaces the following from Effect 3.x:
|
|
29641
|
+
*
|
|
29642
|
+
* - `Stream.repeatEffectWithSchedule`
|
|
29643
|
+
*
|
|
29644
|
+
* @since 2.0.0
|
|
29645
|
+
* @category constructors
|
|
29646
|
+
*/
|
|
29647
|
+
const fromEffectSchedule = (effect$1, schedule) => fromPull(gen(function* () {
|
|
29648
|
+
const step = yield* toStepWithMetadata(schedule);
|
|
29649
|
+
let s = yield* provideService$1(effect$1, CurrentMetadata, CurrentMetadata.defaultValue());
|
|
29650
|
+
let initial = true;
|
|
29651
|
+
const pull = suspend$3(() => step(s)).pipe(flatMap((meta) => provideService$1(effect$1, CurrentMetadata, meta)), map$6((next) => {
|
|
29652
|
+
s = next;
|
|
29653
|
+
return of(next);
|
|
29654
|
+
}));
|
|
29655
|
+
return suspend$3(() => {
|
|
29656
|
+
if (initial) {
|
|
29657
|
+
initial = false;
|
|
29658
|
+
return succeed$1(of(s));
|
|
29659
|
+
}
|
|
29660
|
+
return pull;
|
|
29661
|
+
});
|
|
29662
|
+
}));
|
|
29663
|
+
/**
|
|
27876
29664
|
* Creates a stream from a pull effect.
|
|
27877
29665
|
*
|
|
27878
29666
|
* A pull effect is a low-level representation of a stream that can be used
|
|
@@ -28032,6 +29820,11 @@ const suspend$1 = (stream$3) => fromChannel(suspend$2(() => stream$3().channel))
|
|
|
28032
29820
|
*/
|
|
28033
29821
|
const fail$1 = (error$1) => fromChannel(fail$2(error$1));
|
|
28034
29822
|
/**
|
|
29823
|
+
* @since 4.0.0
|
|
29824
|
+
* @category constructors
|
|
29825
|
+
*/
|
|
29826
|
+
const fromPubSubTake = (pubsub) => fromChannel(fromPubSubTake$1(pubsub));
|
|
29827
|
+
/**
|
|
28035
29828
|
* Creates a stream from a ReadableStream.
|
|
28036
29829
|
*
|
|
28037
29830
|
* @example
|
|
@@ -28201,7 +29994,7 @@ const filter = /* @__PURE__ */ dual(2, (self$1, predicate) => fromChannel(filter
|
|
|
28201
29994
|
* @since 2.0.0
|
|
28202
29995
|
* @category Filtering
|
|
28203
29996
|
*/
|
|
28204
|
-
const filterMapEffect = /* @__PURE__ */ dual(2, (self$1, filter$
|
|
29997
|
+
const filterMapEffect = /* @__PURE__ */ dual(2, (self$1, filter$7) => fromChannel(filterMapArrayEffect(toChannel(self$1), filter$7)));
|
|
28205
29998
|
/**
|
|
28206
29999
|
* Allows a faster producer to progress independently of a slower consumer by
|
|
28207
30000
|
* buffering up to `capacity` elements in a queue.
|
|
@@ -28239,6 +30032,19 @@ const mapError = /* @__PURE__ */ dual(2, (self$1, f) => fromChannel(mapError$1(s
|
|
|
28239
30032
|
*/
|
|
28240
30033
|
const orDie = (self$1) => fromChannel(orDie$1(self$1.channel));
|
|
28241
30034
|
/**
|
|
30035
|
+
* When the stream fails, retry it according to the given schedule
|
|
30036
|
+
*
|
|
30037
|
+
* This retries the entire stream, so will re-execute all of the stream's
|
|
30038
|
+
* acquire operations.
|
|
30039
|
+
*
|
|
30040
|
+
* The schedule is reset as soon as the first element passes through the
|
|
30041
|
+
* stream again.
|
|
30042
|
+
*
|
|
30043
|
+
* @since 2.0.0
|
|
30044
|
+
* @category Error handling
|
|
30045
|
+
*/
|
|
30046
|
+
const retry$1 = /* @__PURE__ */ dual(2, (self$1, policy) => fromChannel(retry$2(self$1.channel, policy)));
|
|
30047
|
+
/**
|
|
28242
30048
|
* Applies the Sink transducer to the stream and emits its outputs.
|
|
28243
30049
|
*
|
|
28244
30050
|
* @since 2.0.0
|
|
@@ -28265,6 +30071,19 @@ const transduce = /* @__PURE__ */ dual(2, (self$1, sink) => transformPull(self$1
|
|
|
28265
30071
|
return suspend$3(() => done$3 ? done$3 : pull);
|
|
28266
30072
|
})));
|
|
28267
30073
|
/**
|
|
30074
|
+
* @since 2.0.0
|
|
30075
|
+
* @category Broadcast
|
|
30076
|
+
*/
|
|
30077
|
+
const broadcast = /* @__PURE__ */ dual(2, (self$1, options) => map$6(toPubSubTake(self$1, options), fromPubSubTake));
|
|
30078
|
+
/**
|
|
30079
|
+
* @since 2.0.0
|
|
30080
|
+
* @category Broadcast
|
|
30081
|
+
*/
|
|
30082
|
+
const share = /* @__PURE__ */ dual(2, (self$1, options) => map$6(make$35({
|
|
30083
|
+
acquire: broadcast(self$1, options),
|
|
30084
|
+
idleTimeToLive: options.idleTimeToLive
|
|
30085
|
+
}), (ref) => unwrap(get$3(ref))));
|
|
30086
|
+
/**
|
|
28268
30087
|
* Pipes all the values from this stream through the provided channel.
|
|
28269
30088
|
*
|
|
28270
30089
|
* The channel processes chunks of values (NonEmptyReadonlyArray) and can transform both
|
|
@@ -28574,6 +30393,11 @@ const toReadableStreamWith = /* @__PURE__ */ dual((args$1) => isStream(args$1[0]
|
|
|
28574
30393
|
* @category destructors
|
|
28575
30394
|
*/
|
|
28576
30395
|
const toReadableStreamEffect = /* @__PURE__ */ dual((args$1) => isStream(args$1[0]), (self$1, options) => map$6(services(), (context) => toReadableStreamWith(self$1, context, options)));
|
|
30396
|
+
/**
|
|
30397
|
+
* @since 4.0.0
|
|
30398
|
+
* @category destructors
|
|
30399
|
+
*/
|
|
30400
|
+
const toPubSubTake = /* @__PURE__ */ dual(2, (self$1, options) => toPubSubTake$1(self$1.channel, options));
|
|
28577
30401
|
|
|
28578
30402
|
//#endregion
|
|
28579
30403
|
//#region node_modules/.pnpm/effect@https+++pkg.pr.new+Effect-TS+effect-smol+effect@53d2c5b_bb57938f6a2db8d6e7529a5713147df2/node_modules/effect/dist/FileSystem.js
|
|
@@ -29272,15 +31096,15 @@ const Proto$15 = {
|
|
|
29272
31096
|
* @category Constructors
|
|
29273
31097
|
* @since 4.0.0
|
|
29274
31098
|
*/
|
|
29275
|
-
function make$33(get$
|
|
31099
|
+
function make$33(get$9, mapInput$1, prefix$2) {
|
|
29276
31100
|
const self$1 = Object.create(Proto$15);
|
|
29277
|
-
self$1.get = get$
|
|
31101
|
+
self$1.get = get$9;
|
|
29278
31102
|
self$1.mapInput = mapInput$1;
|
|
29279
31103
|
self$1.prefix = prefix$2;
|
|
29280
31104
|
self$1.load = (path$2) => {
|
|
29281
31105
|
if (mapInput$1) path$2 = mapInput$1(path$2);
|
|
29282
31106
|
if (prefix$2) path$2 = [...prefix$2, ...path$2];
|
|
29283
|
-
return get$
|
|
31107
|
+
return get$9(path$2);
|
|
29284
31108
|
};
|
|
29285
31109
|
return self$1;
|
|
29286
31110
|
}
|
|
@@ -30060,7 +31884,7 @@ function fromASTs(asts) {
|
|
|
30060
31884
|
const schemas = map$10(asts, (ast) => recur$2(ast));
|
|
30061
31885
|
return {
|
|
30062
31886
|
representations: map$10(schemas, compact),
|
|
30063
|
-
references: map$11(filter$
|
|
31887
|
+
references: map$11(filter$5(references, (_, k) => !isCompactable(k)), compact)
|
|
30064
31888
|
};
|
|
30065
31889
|
function isCompactable($ref) {
|
|
30066
31890
|
return !usedReferences.has($ref);
|
|
@@ -30327,7 +32151,7 @@ const fromASTBlacklist = /* @__PURE__ */ new Set([
|
|
|
30327
32151
|
]);
|
|
30328
32152
|
function fromASTAnnotations(annotations$1) {
|
|
30329
32153
|
if (annotations$1 !== void 0) {
|
|
30330
|
-
const filtered = filter$
|
|
32154
|
+
const filtered = filter$5(annotations$1, (_, k) => !fromASTBlacklist.has(k));
|
|
30331
32155
|
if (!isEmptyRecord(filtered)) return { annotations: filtered };
|
|
30332
32156
|
}
|
|
30333
32157
|
}
|
|
@@ -30539,11 +32363,11 @@ function toJsonSchemaMultiDocument(multiDocument, options) {
|
|
|
30539
32363
|
}
|
|
30540
32364
|
}
|
|
30541
32365
|
}
|
|
30542
|
-
function filterToJsonSchema(filter$
|
|
30543
|
-
const meta = filter$
|
|
32366
|
+
function filterToJsonSchema(filter$7, type) {
|
|
32367
|
+
const meta = filter$7.meta;
|
|
30544
32368
|
if (!meta) return void 0;
|
|
30545
32369
|
let out = on$1(meta);
|
|
30546
|
-
const a = collectJsonSchemaAnnotations(filter$
|
|
32370
|
+
const a = collectJsonSchemaAnnotations(filter$7.annotations);
|
|
30547
32371
|
if (a) out = {
|
|
30548
32372
|
...out,
|
|
30549
32373
|
...a
|
|
@@ -31159,7 +32983,7 @@ function suspend(f) {
|
|
|
31159
32983
|
}
|
|
31160
32984
|
function decodeTo(to, transformation) {
|
|
31161
32985
|
return (from) => {
|
|
31162
|
-
return make$31(decodeTo$1(from.ast, to.ast, transformation ? make$
|
|
32986
|
+
return make$31(decodeTo$1(from.ast, to.ast, transformation ? make$43(transformation) : passthrough()), {
|
|
31163
32987
|
from,
|
|
31164
32988
|
to
|
|
31165
32989
|
});
|
|
@@ -31202,7 +33026,7 @@ function instanceOf(constructor, annotations$1) {
|
|
|
31202
33026
|
*/
|
|
31203
33027
|
function link$1() {
|
|
31204
33028
|
return (encodeTo, transformation) => {
|
|
31205
|
-
return new Link(encodeTo.ast, make$
|
|
33029
|
+
return new Link(encodeTo.ast, make$43(transformation));
|
|
31206
33030
|
};
|
|
31207
33031
|
}
|
|
31208
33032
|
/**
|
|
@@ -31428,7 +33252,7 @@ function makeIsBetween(deriveOptions) {
|
|
|
31428
33252
|
* @since 4.0.0
|
|
31429
33253
|
*/
|
|
31430
33254
|
const isGreaterThan = /* @__PURE__ */ makeIsGreaterThan({
|
|
31431
|
-
order: Number$
|
|
33255
|
+
order: Number$5,
|
|
31432
33256
|
annotate: (exclusiveMinimum) => ({
|
|
31433
33257
|
meta: {
|
|
31434
33258
|
_tag: "isGreaterThan",
|
|
@@ -31457,7 +33281,7 @@ const isGreaterThan = /* @__PURE__ */ makeIsGreaterThan({
|
|
|
31457
33281
|
* @since 4.0.0
|
|
31458
33282
|
*/
|
|
31459
33283
|
const isGreaterThanOrEqualTo = /* @__PURE__ */ makeIsGreaterThanOrEqualTo({
|
|
31460
|
-
order: Number$
|
|
33284
|
+
order: Number$5,
|
|
31461
33285
|
annotate: (minimum) => ({
|
|
31462
33286
|
meta: {
|
|
31463
33287
|
_tag: "isGreaterThanOrEqualTo",
|
|
@@ -31483,7 +33307,7 @@ const isGreaterThanOrEqualTo = /* @__PURE__ */ makeIsGreaterThanOrEqualTo({
|
|
|
31483
33307
|
* @since 4.0.0
|
|
31484
33308
|
*/
|
|
31485
33309
|
const isLessThan = /* @__PURE__ */ makeIsLessThan({
|
|
31486
|
-
order: Number$
|
|
33310
|
+
order: Number$5,
|
|
31487
33311
|
annotate: (exclusiveMaximum) => ({
|
|
31488
33312
|
meta: {
|
|
31489
33313
|
_tag: "isLessThan",
|
|
@@ -31512,7 +33336,7 @@ const isLessThan = /* @__PURE__ */ makeIsLessThan({
|
|
|
31512
33336
|
* @since 4.0.0
|
|
31513
33337
|
*/
|
|
31514
33338
|
const isLessThanOrEqualTo = /* @__PURE__ */ makeIsLessThanOrEqualTo({
|
|
31515
|
-
order: Number$
|
|
33339
|
+
order: Number$5,
|
|
31516
33340
|
annotate: (maximum) => ({
|
|
31517
33341
|
meta: {
|
|
31518
33342
|
_tag: "isLessThanOrEqualTo",
|
|
@@ -31540,7 +33364,7 @@ const isLessThanOrEqualTo = /* @__PURE__ */ makeIsLessThanOrEqualTo({
|
|
|
31540
33364
|
* @since 4.0.0
|
|
31541
33365
|
*/
|
|
31542
33366
|
const isBetween = /* @__PURE__ */ makeIsBetween({
|
|
31543
|
-
order: Number$
|
|
33367
|
+
order: Number$5,
|
|
31544
33368
|
annotate: (options) => {
|
|
31545
33369
|
return {
|
|
31546
33370
|
meta: {
|
|
@@ -33470,7 +35294,7 @@ var require_ini = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
33470
35294
|
if (Array.isArray(p[key])) p[key].push(value);
|
|
33471
35295
|
else p[key] = value;
|
|
33472
35296
|
}
|
|
33473
|
-
const remove$
|
|
35297
|
+
const remove$4 = [];
|
|
33474
35298
|
for (const k of Object.keys(out)) {
|
|
33475
35299
|
if (!hasOwnProperty.call(out, k) || typeof out[k] !== "object" || Array.isArray(out[k])) continue;
|
|
33476
35300
|
const parts$1 = splitSections(k, ".");
|
|
@@ -33484,9 +35308,9 @@ var require_ini = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
33484
35308
|
}
|
|
33485
35309
|
if (p === out && nl === l) continue;
|
|
33486
35310
|
p[nl] = out[k];
|
|
33487
|
-
remove$
|
|
35311
|
+
remove$4.push(k);
|
|
33488
35312
|
}
|
|
33489
|
-
for (const del of remove$
|
|
35313
|
+
for (const del of remove$4) delete out[del];
|
|
33490
35314
|
return out;
|
|
33491
35315
|
};
|
|
33492
35316
|
const isQuoted = (val) => {
|
|
@@ -39900,12 +41724,12 @@ var require_set = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
39900
41724
|
}
|
|
39901
41725
|
static from(schema$1, iterable, ctx) {
|
|
39902
41726
|
const { replacer } = ctx;
|
|
39903
|
-
const set$
|
|
41727
|
+
const set$7 = new this(schema$1);
|
|
39904
41728
|
if (iterable && Symbol.iterator in Object(iterable)) for (let value of iterable) {
|
|
39905
41729
|
if (typeof replacer === "function") value = replacer.call(iterable, value, value);
|
|
39906
|
-
set$
|
|
41730
|
+
set$7.items.push(Pair.createPair(value, null, ctx));
|
|
39907
41731
|
}
|
|
39908
|
-
return set$
|
|
41732
|
+
return set$7;
|
|
39909
41733
|
}
|
|
39910
41734
|
};
|
|
39911
41735
|
YAMLSet.tag = "tag:yaml.org,2002:set";
|
|
@@ -44641,11 +46465,11 @@ const renderAutoCompleteFilter = (state, options) => {
|
|
|
44641
46465
|
};
|
|
44642
46466
|
const renderAutoCompleteOutput = (state, leadingSymbol, trailingSymbol, options) => {
|
|
44643
46467
|
const prefix$2 = leadingSymbol + " ";
|
|
44644
|
-
const filter$
|
|
46468
|
+
const filter$7 = renderAutoCompleteFilter(state, options);
|
|
44645
46469
|
return match$5(options.message.split(NEWLINE_REGEXP), {
|
|
44646
|
-
onEmpty: () => prefix$2 + " " + trailingSymbol + " " + filter$
|
|
46470
|
+
onEmpty: () => prefix$2 + " " + trailingSymbol + " " + filter$7,
|
|
44647
46471
|
onNonEmpty: (promptLines) => {
|
|
44648
|
-
return prefix$2 + map$10(promptLines, (line) => annotateLine(line)).join("\n") + " " + trailingSymbol + " " + filter$
|
|
46472
|
+
return prefix$2 + map$10(promptLines, (line) => annotateLine(line)).join("\n") + " " + trailingSymbol + " " + filter$7;
|
|
44649
46473
|
}
|
|
44650
46474
|
});
|
|
44651
46475
|
};
|
|
@@ -47533,7 +49357,7 @@ const withSubcommands = /* @__PURE__ */ dual(2, (self$1, subcommands) => {
|
|
|
47533
49357
|
if (internal._subcommand) {
|
|
47534
49358
|
const child = byName.get(internal._subcommand.name);
|
|
47535
49359
|
if (!child) return yield* new ShowHelp({ commandPath: path$2 });
|
|
47536
|
-
return yield* child.handle(internal._subcommand.result, [...path$2, child.name]).pipe(provideService(impl.service, input));
|
|
49360
|
+
return yield* child.handle(internal._subcommand.result, [...path$2, child.name]).pipe(provideService$1(impl.service, input));
|
|
47537
49361
|
}
|
|
47538
49362
|
return yield* impl.handle(input, path$2);
|
|
47539
49363
|
});
|
|
@@ -47732,7 +49556,7 @@ const runWith = (command, config) => {
|
|
|
47732
49556
|
if (parseResult._tag === "Failure") return yield* showHelp(command, commandPath, [parseResult.failure]);
|
|
47733
49557
|
const parsed = parseResult.success;
|
|
47734
49558
|
const program = commandImpl.handle(parsed, [command.name]);
|
|
47735
|
-
yield* logLevel !== void 0 ? provideService(program, MinimumLogLevel, logLevel) : program;
|
|
49559
|
+
yield* logLevel !== void 0 ? provideService$1(program, MinimumLogLevel, logLevel) : program;
|
|
47736
49560
|
}, catch_$1((error$1) => isCliError(error$1) && error$1._tag === "ShowHelp" ? showHelp(command, error$1.commandPath) : fail$4(error$1)));
|
|
47737
49561
|
};
|
|
47738
49562
|
|
|
@@ -48377,12 +50201,12 @@ const makeUnsafe = (backing, deferred) => {
|
|
|
48377
50201
|
* @since 2.0.0
|
|
48378
50202
|
* @category constructors
|
|
48379
50203
|
*/
|
|
48380
|
-
const make$25 = () => acquireRelease(sync(() => makeUnsafe(/* @__PURE__ */ new Set(), makeUnsafe$7())), (set$
|
|
48381
|
-
const state = set$
|
|
50204
|
+
const make$25 = () => acquireRelease(sync(() => makeUnsafe(/* @__PURE__ */ new Set(), makeUnsafe$7())), (set$7) => suspend$3(() => {
|
|
50205
|
+
const state = set$7.state;
|
|
48382
50206
|
if (state._tag === "Closed") return void_$1;
|
|
48383
|
-
set$
|
|
50207
|
+
set$7.state = { _tag: "Closed" };
|
|
48384
50208
|
const fibers = state.backing;
|
|
48385
|
-
return interruptAll(fibers).pipe(into(set$
|
|
50209
|
+
return interruptAll(fibers).pipe(into(set$7.deferred));
|
|
48386
50210
|
}));
|
|
48387
50211
|
const internalFiberId = -1;
|
|
48388
50212
|
const isInternalInterruption = /* @__PURE__ */ toPredicate(/* @__PURE__ */ compose(filterInterruptors, /* @__PURE__ */ has$2(internalFiberId)));
|
|
@@ -49125,20 +50949,20 @@ const toSchemaStore = (self$1, schema$1) => {
|
|
|
49125
50949
|
const jsonSchema = fromJsonString(serializer);
|
|
49126
50950
|
const decode$2 = decodeEffect(jsonSchema);
|
|
49127
50951
|
const encode$2 = encodeEffect(jsonSchema);
|
|
49128
|
-
const get$
|
|
50952
|
+
const get$9 = (key) => flatMap(self$1.get(key), match$9({
|
|
49129
50953
|
onUndefined: () => succeedNone,
|
|
49130
50954
|
onDefined: (value) => asSome(decode$2(value))
|
|
49131
50955
|
}));
|
|
49132
|
-
const set$
|
|
49133
|
-
const modify$1 = (key, f) => flatMap(get$
|
|
50956
|
+
const set$7 = (key, value) => flatMap(encode$2(value), (json) => self$1.set(key, json));
|
|
50957
|
+
const modify$1 = (key, f) => flatMap(get$9(key), (o) => {
|
|
49134
50958
|
if (isNone(o)) return succeedNone;
|
|
49135
50959
|
const newValue = f(o.value);
|
|
49136
|
-
return as(set$
|
|
50960
|
+
return as(set$7(key, newValue), some(newValue));
|
|
49137
50961
|
});
|
|
49138
50962
|
return {
|
|
49139
50963
|
[SchemaStoreTypeId]: SchemaStoreTypeId,
|
|
49140
|
-
get: get$
|
|
49141
|
-
set: set$
|
|
50964
|
+
get: get$9,
|
|
50965
|
+
set: set$7,
|
|
49142
50966
|
modify: modify$1,
|
|
49143
50967
|
remove: self$1.remove,
|
|
49144
50968
|
clear: self$1.clear,
|
|
@@ -50810,7 +52634,7 @@ const makePipedCommand = (left, right, options = {}) => Object.assign(Object.cre
|
|
|
50810
52634
|
* @since 4.0.0
|
|
50811
52635
|
* @category Constructors
|
|
50812
52636
|
*/
|
|
50813
|
-
const make$21 = function make$
|
|
52637
|
+
const make$21 = function make$55(...args$1) {
|
|
50814
52638
|
if (isTemplateString(args$1[0])) {
|
|
50815
52639
|
const [templates, ...expressions] = args$1;
|
|
50816
52640
|
const tokens = parseTemplates(templates, expressions);
|
|
@@ -51257,7 +53081,7 @@ const toUint8Array = (readable, options) => map$6(toArrayBuffer(readable, option
|
|
|
51257
53081
|
const readableToPullUnsafe = (options) => {
|
|
51258
53082
|
const readable = options.readable;
|
|
51259
53083
|
const closeOnDone = options.closeOnDone ?? true;
|
|
51260
|
-
const exit$2 = options.exit ?? make$
|
|
53084
|
+
const exit$2 = options.exit ?? make$41(void 0);
|
|
51261
53085
|
const latch = makeLatchUnsafe(false);
|
|
51262
53086
|
function onReadable() {
|
|
51263
53087
|
latch.openUnsafe();
|
|
@@ -52105,7 +53929,7 @@ const TypeId$14 = /* @__PURE__ */ Symbol.for("~effect/http/Headers");
|
|
|
52105
53929
|
const Proto$5 = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), BaseProto, {
|
|
52106
53930
|
[TypeId$14]: TypeId$14,
|
|
52107
53931
|
[symbolRedactable](context) {
|
|
52108
|
-
return redact(this, get$
|
|
53932
|
+
return redact(this, get$8(context, CurrentRedactedNames));
|
|
52109
53933
|
},
|
|
52110
53934
|
toJSON() {
|
|
52111
53935
|
return redact$1(this);
|
|
@@ -52193,8 +54017,8 @@ const redact = /* @__PURE__ */ dual(2, (self$1, key) => {
|
|
|
52193
54017
|
const modify$1 = (key$1) => {
|
|
52194
54018
|
if (typeof key$1 === "string") {
|
|
52195
54019
|
const k = key$1.toLowerCase();
|
|
52196
|
-
if (k in self$1) out[k] = make$
|
|
52197
|
-
} else for (const name in self$1) if (key$1.test(name)) out[name] = make$
|
|
54020
|
+
if (k in self$1) out[k] = make$45(self$1[k]);
|
|
54021
|
+
} else for (const name in self$1) if (key$1.test(name)) out[name] = make$45(self$1[name]);
|
|
52198
54022
|
};
|
|
52199
54023
|
if (Array.isArray(key)) for (let i = 0; i < key.length; i++) modify$1(key[i]);
|
|
52200
54024
|
else modify$1(key);
|
|
@@ -52417,7 +54241,7 @@ const fromInputNested = (input) => {
|
|
|
52417
54241
|
* @since 4.0.0
|
|
52418
54242
|
* @category Equivalence
|
|
52419
54243
|
*/
|
|
52420
|
-
const Equivalence = /* @__PURE__ */ make$
|
|
54244
|
+
const Equivalence = /* @__PURE__ */ make$52((a, b) => arrayEquivalence(a.params, b.params));
|
|
52421
54245
|
const arrayEquivalence = /* @__PURE__ */ makeEquivalence$1(/* @__PURE__ */ makeEquivalence$3([/* @__PURE__ */ strictEqual(), /* @__PURE__ */ strictEqual()]));
|
|
52422
54246
|
/**
|
|
52423
54247
|
* @since 4.0.0
|
|
@@ -53239,7 +55063,7 @@ const retryTransient = /* @__PURE__ */ dual(2, (self$1, options) => {
|
|
|
53239
55063
|
schedule: passthroughSchedule,
|
|
53240
55064
|
times,
|
|
53241
55065
|
while: isTransientResponse
|
|
53242
|
-
}), mode === "response-only" ? identity : retry$
|
|
55066
|
+
}), mode === "response-only" ? identity : retry$3({
|
|
53243
55067
|
while: isOnlySchedule || options.while === void 0 ? isTransientError : or(isTransientError, options.while),
|
|
53244
55068
|
schedule,
|
|
53245
55069
|
times
|
|
@@ -54523,7 +56347,7 @@ const fromWebSocket = (acquire, options) => withFiber((fiber$2) => {
|
|
|
54523
56347
|
const runRaw = (handler$1, opts) => scopedWith(fnUntraced(function* (scope$2) {
|
|
54524
56348
|
const fiberSet = yield* make$25().pipe(provide$4(scope$2));
|
|
54525
56349
|
const ws = yield* provide$4(acquire, scope$2);
|
|
54526
|
-
const run$8 = yield* provideService(runtime(fiberSet)(), WebSocket$1, ws);
|
|
56350
|
+
const run$8 = yield* provideService$1(runtime(fiberSet)(), WebSocket$1, ws);
|
|
54527
56351
|
let open$1 = false;
|
|
54528
56352
|
function onMessage(event) {
|
|
54529
56353
|
if (event.data instanceof Blob) return promise(() => event.data.arrayBuffer()).pipe(andThen((buffer$1) => handler$1(new Uint8Array(buffer$1))), run$8);
|
|
@@ -55529,7 +57353,7 @@ var MultipartError = class MultipartError extends TaggedError("MultipartError")
|
|
|
55529
57353
|
* @category Config
|
|
55530
57354
|
*/
|
|
55531
57355
|
const makeConfig = (headers) => withFiber((fiber$2) => {
|
|
55532
|
-
const mimeTypes = get$
|
|
57356
|
+
const mimeTypes = get$8(fiber$2.services, FieldMimeTypes);
|
|
55533
57357
|
return succeed$1({
|
|
55534
57358
|
headers,
|
|
55535
57359
|
maxParts: fiber$2.getRef(MaxParts),
|
|
@@ -55578,7 +57402,7 @@ const makeChannel = (headers) => fromTransform$1((upstream) => map$6(makeConfig(
|
|
|
55578
57402
|
return void_$1;
|
|
55579
57403
|
}), catchCause$1((cause) => {
|
|
55580
57404
|
if (isDoneCause(cause)) parser.end();
|
|
55581
|
-
else exit$2 = some(failCause$
|
|
57405
|
+
else exit$2 = some(failCause$4(cause));
|
|
55582
57406
|
return void_$1;
|
|
55583
57407
|
}));
|
|
55584
57408
|
return pump.pipe(flatMap(function loop() {
|
|
@@ -56537,7 +58361,7 @@ var MiddlewareImpl = class MiddlewareImpl {
|
|
|
56537
58361
|
const stack = [context.mapUnsafe.get(fnContextKey)];
|
|
56538
58362
|
if (this.dependencies) {
|
|
56539
58363
|
const memoMap = yield* CurrentMemoMap;
|
|
56540
|
-
const scope$2 = get$
|
|
58364
|
+
const scope$2 = get$8(context, Scope);
|
|
56541
58365
|
const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope$2);
|
|
56542
58366
|
stack.push(...getMiddleware(depsContext));
|
|
56543
58367
|
}
|
|
@@ -61573,8 +63397,8 @@ var Settings = class extends Service()("lalph/Settings", { make: gen(function* (
|
|
|
61573
63397
|
},
|
|
61574
63398
|
capacity: Number.MAX_SAFE_INTEGER
|
|
61575
63399
|
});
|
|
61576
|
-
const get$
|
|
61577
|
-
const set$
|
|
63400
|
+
const get$9 = (setting) => get$2(cache, setting);
|
|
63401
|
+
const set$7 = (setting, value) => {
|
|
61578
63402
|
const s = toSchemaStore(store, setting.schema);
|
|
61579
63403
|
const setCache = set$3(cache, setting, value);
|
|
61580
63404
|
const update = match$7(value, {
|
|
@@ -61584,8 +63408,8 @@ var Settings = class extends Service()("lalph/Settings", { make: gen(function* (
|
|
|
61584
63408
|
return andThen(update, setCache);
|
|
61585
63409
|
};
|
|
61586
63410
|
return {
|
|
61587
|
-
get: get$
|
|
61588
|
-
set: set$
|
|
63411
|
+
get: get$9,
|
|
63412
|
+
set: set$7
|
|
61589
63413
|
};
|
|
61590
63414
|
}) }) {
|
|
61591
63415
|
static layer = effect(this, this.make).pipe(provide$3(layerKvs));
|
|
@@ -127133,11 +128957,11 @@ var UpdateNotificationCategoryChannelSubscriptionMutation = class extends Reques
|
|
|
127133
128957
|
* @param subscribe - required subscribe to pass to updateNotificationCategoryChannelSubscription
|
|
127134
128958
|
* @returns parsed response from UpdateNotificationCategoryChannelSubscriptionMutation
|
|
127135
128959
|
*/
|
|
127136
|
-
async fetch(category, channel, subscribe) {
|
|
128960
|
+
async fetch(category, channel, subscribe$1) {
|
|
127137
128961
|
const data = (await this._request(UpdateNotificationCategoryChannelSubscriptionDocument.toString(), {
|
|
127138
128962
|
category,
|
|
127139
128963
|
channel,
|
|
127140
|
-
subscribe
|
|
128964
|
+
subscribe: subscribe$1
|
|
127141
128965
|
})).notificationCategoryChannelSubscriptionUpdate;
|
|
127142
128966
|
return new UserSettingsPayload(this._request, data);
|
|
127143
128967
|
}
|
|
@@ -134692,8 +136516,8 @@ var LinearSdk = class extends Request$1 {
|
|
|
134692
136516
|
* @param subscribe - required subscribe to pass to updateNotificationCategoryChannelSubscription
|
|
134693
136517
|
* @returns UserSettingsPayload
|
|
134694
136518
|
*/
|
|
134695
|
-
updateNotificationCategoryChannelSubscription(category, channel, subscribe) {
|
|
134696
|
-
return new UpdateNotificationCategoryChannelSubscriptionMutation(this._request).fetch(category, channel, subscribe);
|
|
136519
|
+
updateNotificationCategoryChannelSubscription(category, channel, subscribe$1) {
|
|
136520
|
+
return new UpdateNotificationCategoryChannelSubscriptionMutation(this._request).fetch(category, channel, subscribe$1);
|
|
134697
136521
|
}
|
|
134698
136522
|
/**
|
|
134699
136523
|
* Marks notification and all related notifications as read.
|
|
@@ -135730,7 +137554,7 @@ var TokenManager$1 = class extends Service()("lalph/Linear/TokenManager", { make
|
|
|
135730
137554
|
const tokenStore = toSchemaStore(kvs, AccessToken$1);
|
|
135731
137555
|
const httpClient = (yield* HttpClient).pipe(filterStatusOk, retryTransient({ schedule: spaced(1e3) }));
|
|
135732
137556
|
let currentToken = yield* orDie$2(tokenStore.get(""));
|
|
135733
|
-
const set$
|
|
137557
|
+
const set$7 = (token) => match$7(token, {
|
|
135734
137558
|
onNone: () => orDie$2(tokenStore.remove("")).pipe(map$6(() => {
|
|
135735
137559
|
currentToken = none$3();
|
|
135736
137560
|
})),
|
|
@@ -135741,19 +137565,19 @@ var TokenManager$1 = class extends Service()("lalph/Linear/TokenManager", { make
|
|
|
135741
137565
|
const getNoLock = uninterruptibleMask(fnUntraced(function* (restore) {
|
|
135742
137566
|
if (isNone(currentToken)) {
|
|
135743
137567
|
const newToken = yield* restore(pkce);
|
|
135744
|
-
yield* set$
|
|
137568
|
+
yield* set$7(some(newToken));
|
|
135745
137569
|
return newToken;
|
|
135746
137570
|
} else if (currentToken.value.isExpired()) {
|
|
135747
137571
|
const newToken = yield* refresh(currentToken.value);
|
|
135748
|
-
yield* set$
|
|
137572
|
+
yield* set$7(newToken);
|
|
135749
137573
|
if (isNone(newToken)) return yield* getNoLock;
|
|
135750
137574
|
return newToken.value;
|
|
135751
137575
|
}
|
|
135752
137576
|
return currentToken.value;
|
|
135753
137577
|
}));
|
|
135754
|
-
const get$
|
|
137578
|
+
const get$9 = makeSemaphoreUnsafe(1).withPermit(getNoLock);
|
|
135755
137579
|
const pkce = gen(function* () {
|
|
135756
|
-
const deferred = yield* make$
|
|
137580
|
+
const deferred = yield* make$49();
|
|
135757
137581
|
const CallbackRoute = add("GET", "/callback", gen(function* () {
|
|
135758
137582
|
const params$1 = yield* callbackParams;
|
|
135759
137583
|
yield* succeed$3(deferred, params$1);
|
|
@@ -135794,7 +137618,7 @@ var TokenManager$1 = class extends Service()("lalph/Linear/TokenManager", { make
|
|
|
135794
137618
|
}), httpClient.execute, flatMap(schemaBodyJson(TokenResponse$1)));
|
|
135795
137619
|
return AccessToken$1.fromResponse(res);
|
|
135796
137620
|
}, option$1);
|
|
135797
|
-
return { get: get$
|
|
137621
|
+
return { get: get$9 };
|
|
135798
137622
|
}) }) {
|
|
135799
137623
|
static layer = effect(this, this.make).pipe(provide$3([layerKvs, layer$9]));
|
|
135800
137624
|
};
|
|
@@ -135828,6 +137652,15 @@ const TokenResponse$1 = Struct({
|
|
|
135828
137652
|
//#endregion
|
|
135829
137653
|
//#region src/IssueSource.ts
|
|
135830
137654
|
var IssueSource = class extends Service()("lalph/IssueSource") {};
|
|
137655
|
+
var IssueSourceUpdates = class extends Service()("lalph/IssueSourceUpdates", { make: gen(function* () {
|
|
137656
|
+
const source = yield* IssueSource;
|
|
137657
|
+
return yield* fromEffectSchedule(source.issues, spaced("1 minute")).pipe(retry$1(spaced("10 seconds")), orDie, share({
|
|
137658
|
+
capacity: 1,
|
|
137659
|
+
strategy: "dropping"
|
|
137660
|
+
}));
|
|
137661
|
+
}) }) {
|
|
137662
|
+
static layer = effect(this, this.make);
|
|
137663
|
+
};
|
|
135831
137664
|
var IssueSourceError = class extends ErrorClass("lalph/IssueSourceError")({
|
|
135832
137665
|
_tag: tag("IssueSourceError"),
|
|
135833
137666
|
cause: Defect
|
|
@@ -135914,7 +137747,7 @@ var Linear = class extends Service()("lalph/Linear", { make: gen(function* () {
|
|
|
135914
137747
|
try: () => prev.fetchNext(),
|
|
135915
137748
|
catch: (cause) => new LinearError({ cause })
|
|
135916
137749
|
}) : use$2(f);
|
|
135917
|
-
return [connection.nodes, some(connection).pipe(filter$
|
|
137750
|
+
return [connection.nodes, some(connection).pipe(filter$6((c) => c.pageInfo.hasNextPage))];
|
|
135918
137751
|
}));
|
|
135919
137752
|
const projects = stream$3((client) => client.projects({ filter: { status: { type: { nin: ["canceled", "completed"] } } } }));
|
|
135920
137753
|
const labels = stream$3((client) => client.issueLabels());
|
|
@@ -135995,7 +137828,7 @@ const LinearIssueSource = effect(IssueSource, gen(function* () {
|
|
|
135995
137828
|
projectId: project.id
|
|
135996
137829
|
}).pipe(mapError$2((cause) => new IssueSourceError({ cause })), map$6((issues$1) => {
|
|
135997
137830
|
const threeDaysAgo = nowUnsafe().pipe(subtract({ days: 3 }));
|
|
135998
|
-
return pipe(filter$
|
|
137831
|
+
return pipe(filter$4(issues$1, (issue) => {
|
|
135999
137832
|
identifierMap.set(issue.identifier, issue.id);
|
|
136000
137833
|
const completedAt = issue.completedAt;
|
|
136001
137834
|
if (!completedAt) return true;
|
|
@@ -138969,11 +140802,11 @@ var require_light = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
138969
140802
|
return this._onFailure(error$1, eventInfo, clearGlobalState, run$7, free);
|
|
138970
140803
|
}
|
|
138971
140804
|
async _onFailure(error$1, eventInfo, clearGlobalState, run$7, free) {
|
|
138972
|
-
var retry$
|
|
140805
|
+
var retry$5, retryAfter;
|
|
138973
140806
|
if (clearGlobalState()) {
|
|
138974
|
-
retry$
|
|
138975
|
-
if (retry$
|
|
138976
|
-
retryAfter = ~~retry$
|
|
140807
|
+
retry$5 = await this.Events.trigger("failed", error$1, eventInfo);
|
|
140808
|
+
if (retry$5 != null) {
|
|
140809
|
+
retryAfter = ~~retry$5;
|
|
138977
140810
|
this.Events.trigger("retry", `Retrying ${this.options.id} after ${retryAfter} ms`, eventInfo);
|
|
138978
140811
|
this.retryCount++;
|
|
138979
140812
|
return run$7(retryAfter);
|
|
@@ -142234,7 +144067,7 @@ var TokenManager = class extends Service()("lalph/Github/TokenManager", { make:
|
|
|
142234
144067
|
const tokenStore = toSchemaStore(kvs, AccessToken);
|
|
142235
144068
|
const httpClient = (yield* HttpClient).pipe(filterStatusOk, retryTransient({ schedule: spaced(1e3) }));
|
|
142236
144069
|
let currentToken = yield* orDie$2(tokenStore.get(""));
|
|
142237
|
-
const set$
|
|
144070
|
+
const set$7 = (token) => match$7(token, {
|
|
142238
144071
|
onNone: () => orDie$2(tokenStore.remove("")).pipe(map$6(() => {
|
|
142239
144072
|
currentToken = none$3();
|
|
142240
144073
|
})),
|
|
@@ -142245,12 +144078,12 @@ var TokenManager = class extends Service()("lalph/Github/TokenManager", { make:
|
|
|
142245
144078
|
const getNoLock = gen(function* () {
|
|
142246
144079
|
if (isNone(currentToken)) {
|
|
142247
144080
|
const newToken = yield* deviceCode;
|
|
142248
|
-
yield* set$
|
|
144081
|
+
yield* set$7(some(newToken));
|
|
142249
144082
|
return newToken;
|
|
142250
144083
|
}
|
|
142251
144084
|
return currentToken.value;
|
|
142252
144085
|
});
|
|
142253
|
-
const get$
|
|
144086
|
+
const get$9 = makeSemaphoreUnsafe(1).withPermit(getNoLock);
|
|
142254
144087
|
const deviceCode = gen(function* () {
|
|
142255
144088
|
const code = yield* post("https://github.com/login/device/code").pipe(bodyUrlParams({
|
|
142256
144089
|
client_id: clientId,
|
|
@@ -142265,7 +144098,7 @@ var TokenManager = class extends Service()("lalph/Github/TokenManager", { make:
|
|
|
142265
144098
|
}), httpClient.execute, flatMap(schemaBodyUrlParams(PollResponse)), delay(seconds(code.interval)), repeat({ until: (res) => "access_token" in res }));
|
|
142266
144099
|
return AccessToken.fromResponse(tokenResponse);
|
|
142267
144100
|
});
|
|
142268
|
-
return { get: get$
|
|
144101
|
+
return { get: get$9 };
|
|
142269
144102
|
}) }) {
|
|
142270
144103
|
static layer = effect(this, this.make).pipe(provide$3([layerKvs, layer$9]));
|
|
142271
144104
|
};
|
|
@@ -142332,7 +144165,7 @@ var ReviewThreads = class extends Class("github/ReviewThreads")({ edges: Array$1
|
|
|
142332
144165
|
//#region src/Github/Cli.ts
|
|
142333
144166
|
var GithubCli = class extends Service()("lalph/Github/Cli", { make: gen(function* () {
|
|
142334
144167
|
const spawner = yield* ChildProcessSpawner;
|
|
142335
|
-
const [owner, repo] = (yield* make$21`gh repo view --json nameWithOwner -q ${".nameWithOwner"}`.pipe(string, option$1, flatMap(flow(map$12(trim), filter$
|
|
144168
|
+
const [owner, repo] = (yield* make$21`gh repo view --json nameWithOwner -q ${".nameWithOwner"}`.pipe(string, option$1, flatMap(flow(map$12(trim), filter$6(isNonEmpty), match$7({
|
|
142336
144169
|
onNone: () => fail$4(new GithubCliRepoNotFound()),
|
|
142337
144170
|
onSome: (value) => succeed$1(value)
|
|
142338
144171
|
}))))).split("/");
|
|
@@ -142341,7 +144174,7 @@ var GithubCli = class extends Service()("lalph/Github/Cli", { make: gen(function
|
|
|
142341
144174
|
comments: data.data.repository.pullRequest.comments.edges.map((edge) => edge.node),
|
|
142342
144175
|
reviewThreads: data.data.repository.pullRequest.reviewThreads.edges.map((edge) => edge.node)
|
|
142343
144176
|
};
|
|
142344
|
-
}), provideService(ChildProcessSpawner, spawner));
|
|
144177
|
+
}), provideService$1(ChildProcessSpawner, spawner));
|
|
142345
144178
|
const prFeedbackMd = (pr) => reviewComments(pr).pipe(map$6(({ comments, reviewThreads }) => {
|
|
142346
144179
|
const eligibleReviewThreads = reviewThreads.filter((thread) => thread.shouldDisplayThread);
|
|
142347
144180
|
if (comments.length === 0 && eligibleReviewThreads.length === 0) return `No review comments found.`;
|
|
@@ -142627,7 +144460,7 @@ const GithubIssueSource = effect(IssueSource, gen(function* () {
|
|
|
142627
144460
|
const labelFilter = new Setting("github.labelFilter", Option(String$1));
|
|
142628
144461
|
const labelSelect = gen(function* () {
|
|
142629
144462
|
const label = yield* text$2({ message: "What label do you want to filter issues by? (leave empty for none)" });
|
|
142630
|
-
const labelOption = some(label.trim()).pipe(filter$
|
|
144463
|
+
const labelOption = some(label.trim()).pipe(filter$6(isNonEmpty));
|
|
142631
144464
|
yield* labelFilter.set(some(labelOption));
|
|
142632
144465
|
return labelOption;
|
|
142633
144466
|
});
|
|
@@ -142639,7 +144472,7 @@ const getOrSelectLabel = gen(function* () {
|
|
|
142639
144472
|
const autoMergeLabel = new Setting("github.autoMergeLabel", Option(String$1));
|
|
142640
144473
|
const autoMergeLabelSelect = gen(function* () {
|
|
142641
144474
|
const label = yield* text$2({ message: "What label do you want to use for auto-mergable issues? (leave empty for none)" });
|
|
142642
|
-
const labelOption = some(label.trim()).pipe(filter$
|
|
144475
|
+
const labelOption = some(label.trim()).pipe(filter$6(isNonEmpty));
|
|
142643
144476
|
yield* autoMergeLabel.set(some(labelOption));
|
|
142644
144477
|
return labelOption;
|
|
142645
144478
|
});
|
|
@@ -142649,7 +144482,7 @@ const getOrSelectAutoMergeLabel = gen(function* () {
|
|
|
142649
144482
|
return yield* autoMergeLabelSelect;
|
|
142650
144483
|
});
|
|
142651
144484
|
const resetGithub = labelFilter.set(none$3()).pipe(andThen(autoMergeLabel.set(none$3())));
|
|
142652
|
-
const maybeNextPage = (page, linkHeader) => pipe(fromNullishOr$2(linkHeader), filter$
|
|
144485
|
+
const maybeNextPage = (page, linkHeader) => pipe(fromNullishOr$2(linkHeader), filter$6((_) => _.includes(`rel="next"`)), as$2(page + 1));
|
|
142653
144486
|
|
|
142654
144487
|
//#endregion
|
|
142655
144488
|
//#region src/IssueSources.ts
|
|
@@ -142690,7 +144523,7 @@ const resetCurrentIssueSource = gen(function* () {
|
|
|
142690
144523
|
var CurrentIssueSource = class CurrentIssueSource extends Service()("lalph/CurrentIssueSource") {
|
|
142691
144524
|
static layer = effectServices(gen(function* () {
|
|
142692
144525
|
const source = yield* getOrSelectIssueSource;
|
|
142693
|
-
const services$2 = yield* buildWithMemoMap(source.layer, yield* CurrentMemoMap, yield* scope).pipe(withSpan("CurrentIssueSource.build"));
|
|
144526
|
+
const services$2 = yield* buildWithMemoMap(IssueSourceUpdates.layer.pipe(provideMerge(source.layer)), yield* CurrentMemoMap, yield* scope).pipe(withSpan("CurrentIssueSource.build"));
|
|
142694
144527
|
return add$3(services$2, CurrentIssueSource, source);
|
|
142695
144528
|
}));
|
|
142696
144529
|
};
|
|
@@ -142909,14 +144742,80 @@ ${prdNotes(options)}`;
|
|
|
142909
144742
|
static layer = effect(this, this.make);
|
|
142910
144743
|
};
|
|
142911
144744
|
|
|
144745
|
+
//#endregion
|
|
144746
|
+
//#region src/Worktree.ts
|
|
144747
|
+
var Worktree = class extends Service()("lalph/Worktree", { make: gen(function* () {
|
|
144748
|
+
const fs = yield* FileSystem;
|
|
144749
|
+
const pathService = yield* Path$1;
|
|
144750
|
+
const inExisting = yield* fs.exists(pathService.join(".lalph", "prd.yml"));
|
|
144751
|
+
if (inExisting) return {
|
|
144752
|
+
directory: pathService.resolve("."),
|
|
144753
|
+
inExisting
|
|
144754
|
+
};
|
|
144755
|
+
const directory$2 = yield* fs.makeTempDirectory();
|
|
144756
|
+
yield* addFinalizer(fnUntraced(function* () {
|
|
144757
|
+
yield* execIgnore(make$21`git worktree remove --force ${directory$2}`);
|
|
144758
|
+
}));
|
|
144759
|
+
yield* make$21`git worktree add ${directory$2} -d HEAD`.pipe(exitCode);
|
|
144760
|
+
yield* fs.makeDirectory(pathService.join(directory$2, ".lalph"), { recursive: true });
|
|
144761
|
+
const setupPath = pathService.resolve("scripts", "worktree-setup.sh");
|
|
144762
|
+
yield* seedSetupScript(setupPath);
|
|
144763
|
+
if (yield* fs.exists(setupPath)) yield* make$21({
|
|
144764
|
+
cwd: directory$2,
|
|
144765
|
+
extendEnv: true,
|
|
144766
|
+
shell: process.env.SHELL ?? true
|
|
144767
|
+
})`${setupPath}`.pipe(exitCode);
|
|
144768
|
+
return {
|
|
144769
|
+
directory: directory$2,
|
|
144770
|
+
inExisting
|
|
144771
|
+
};
|
|
144772
|
+
}) }) {
|
|
144773
|
+
static layer = effect(this, this.make);
|
|
144774
|
+
static layerLocal = effect(this, gen(function* () {
|
|
144775
|
+
const pathService = yield* Path$1;
|
|
144776
|
+
const fs = yield* FileSystem;
|
|
144777
|
+
return {
|
|
144778
|
+
directory: pathService.resolve("."),
|
|
144779
|
+
inExisting: yield* fs.exists(pathService.join(".lalph", "prd.yml"))
|
|
144780
|
+
};
|
|
144781
|
+
}));
|
|
144782
|
+
};
|
|
144783
|
+
const execIgnore = (command) => command.pipe(exitCode, catchCause$1(logWarning));
|
|
144784
|
+
const seedSetupScript = fnUntraced(function* (setupPath) {
|
|
144785
|
+
const fs = yield* FileSystem;
|
|
144786
|
+
const pathService = yield* Path$1;
|
|
144787
|
+
if (yield* fs.exists(setupPath)) return;
|
|
144788
|
+
const baseBranch = yield* discoverBaseBranch;
|
|
144789
|
+
yield* fs.makeDirectory(pathService.dirname(setupPath), { recursive: true });
|
|
144790
|
+
yield* fs.writeFileString(setupPath, setupScriptTemplate(baseBranch));
|
|
144791
|
+
yield* fs.chmod(setupPath, 493);
|
|
144792
|
+
});
|
|
144793
|
+
const discoverBaseBranch = gen(function* () {
|
|
144794
|
+
const originHead = yield* make$21`git symbolic-ref --short refs/remotes/origin/HEAD`.pipe(string, catch_$1((_) => succeed$1("")), map$6((output) => output.trim()));
|
|
144795
|
+
if (originHead !== "") return originHead.startsWith("origin/") ? originHead.slice(7) : originHead;
|
|
144796
|
+
const currentBranch = yield* make$21`git branch --show-current`.pipe(string, catch_$1((_) => succeed$1("")), map$6((output) => output.trim()));
|
|
144797
|
+
return currentBranch === "" ? "main" : currentBranch;
|
|
144798
|
+
});
|
|
144799
|
+
const setupScriptTemplate = (baseBranch) => `#!/usr/bin/env bash
|
|
144800
|
+
set -euo pipefail
|
|
144801
|
+
|
|
144802
|
+
git fetch origin
|
|
144803
|
+
git checkout origin/${baseBranch}
|
|
144804
|
+
|
|
144805
|
+
# Seeded by lalph. Customize this to prepare new worktrees.
|
|
144806
|
+
`;
|
|
144807
|
+
|
|
142912
144808
|
//#endregion
|
|
142913
144809
|
//#region src/Prd.ts
|
|
142914
144810
|
var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
144811
|
+
const worktree = yield* Worktree;
|
|
142915
144812
|
const pathService = yield* Path$1;
|
|
142916
144813
|
const fs = yield* FileSystem;
|
|
142917
144814
|
const source = yield* IssueSource;
|
|
142918
|
-
const
|
|
142919
|
-
|
|
144815
|
+
const sourceUpdates = yield* IssueSourceUpdates;
|
|
144816
|
+
let chosenIssueId = null;
|
|
144817
|
+
const lalphDir = pathService.join(worktree.directory, `.lalph`);
|
|
144818
|
+
const prdFile = pathService.join(worktree.directory, `.lalph`, `prd.yml`);
|
|
142920
144819
|
const readPrd = gen(function* () {
|
|
142921
144820
|
const yaml = yield* fs.readFileString(prdFile);
|
|
142922
144821
|
return PrdIssue.arrayFromYaml(yaml);
|
|
@@ -142953,6 +144852,34 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142953
144852
|
state: "todo"
|
|
142954
144853
|
});
|
|
142955
144854
|
});
|
|
144855
|
+
if (worktree.inExisting) {
|
|
144856
|
+
const initialPrdIssues = yield* readPrd;
|
|
144857
|
+
return {
|
|
144858
|
+
path: prdFile,
|
|
144859
|
+
mergableGithubPrs,
|
|
144860
|
+
maybeRevertIssue,
|
|
144861
|
+
revertUpdatedIssues: gen(function* () {
|
|
144862
|
+
const updated = yield* readPrd;
|
|
144863
|
+
for (const issue of updated) {
|
|
144864
|
+
if (issue.state !== "in-progress") continue;
|
|
144865
|
+
const prevIssue = initialPrdIssues.find((i) => i.id === issue.id);
|
|
144866
|
+
if (!prevIssue || prevIssue.state === "in-progress") continue;
|
|
144867
|
+
yield* source.updateIssue({
|
|
144868
|
+
issueId: issue.id,
|
|
144869
|
+
state: prevIssue.state
|
|
144870
|
+
});
|
|
144871
|
+
}
|
|
144872
|
+
}),
|
|
144873
|
+
flagUnmergable,
|
|
144874
|
+
findById: fnUntraced(function* (issueId) {
|
|
144875
|
+
return (yield* readPrd).find((i) => i.id === issueId) ?? null;
|
|
144876
|
+
}),
|
|
144877
|
+
setChosenIssueId: (issueId) => sync(() => {
|
|
144878
|
+
chosenIssueId = issueId;
|
|
144879
|
+
})
|
|
144880
|
+
};
|
|
144881
|
+
}
|
|
144882
|
+
yield* addFinalizer(() => ignore(fs.remove(prdFile)));
|
|
142956
144883
|
let current = yield* source.issues;
|
|
142957
144884
|
yield* fs.writeFileString(prdFile, PrdIssue.arrayToYaml(current));
|
|
142958
144885
|
const updatedIssues = /* @__PURE__ */ new Map();
|
|
@@ -142970,6 +144897,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142970
144897
|
if (issue.githubPrNumber) githubPrs.set(issue.id, issue.githubPrNumber);
|
|
142971
144898
|
const existing = current.find((i) => i.id === issue.id);
|
|
142972
144899
|
if (!existing || !existing.isChangedComparedTo(issue)) continue;
|
|
144900
|
+
if (chosenIssueId && existing.id !== chosenIssueId) continue;
|
|
142973
144901
|
yield* source.updateIssue({
|
|
142974
144902
|
issueId: issue.id,
|
|
142975
144903
|
title: issue.title,
|
|
@@ -142994,19 +144922,18 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142994
144922
|
method: "sync"
|
|
142995
144923
|
}));
|
|
142996
144924
|
const updateSyncHandle = yield* make$26();
|
|
142997
|
-
const updateSync =
|
|
144925
|
+
const updateSync = fnUntraced(function* (sourceIssues) {
|
|
142998
144926
|
const tempFile = yield* fs.makeTempFileScoped();
|
|
142999
|
-
const sourceIssues = yield* source.issues;
|
|
143000
144927
|
if (!(sourceIssues.length !== current.length || sourceIssues.some((u, i) => u.isChangedComparedTo(current[i])))) return;
|
|
143001
144928
|
yield* fs.writeFileString(tempFile, PrdIssue.arrayToYaml(sourceIssues));
|
|
143002
144929
|
yield* fs.rename(tempFile, prdFile);
|
|
143003
144930
|
current = sourceIssues;
|
|
143004
|
-
}
|
|
143005
|
-
yield* fs.watch(
|
|
144931
|
+
}, scoped$1, run$2(updateSyncHandle, { onlyIfMissing: true }));
|
|
144932
|
+
yield* fs.watch(lalphDir).pipe(buffer({
|
|
143006
144933
|
capacity: 1,
|
|
143007
144934
|
strategy: "dropping"
|
|
143008
|
-
}), runForEach((_) => clear(updateSyncHandle).pipe(andThen(ignore(sync$2)))), retry$
|
|
143009
|
-
yield*
|
|
144935
|
+
}), runForEach((_) => clear(updateSyncHandle).pipe(andThen(ignore(sync$2)))), retry$3(forever$1), forkScoped);
|
|
144936
|
+
yield* sourceUpdates.pipe(runForEach(updateSync), forkScoped);
|
|
143010
144937
|
const findById = (issueId) => sync(() => current.find((i) => i.id === issueId) ?? null);
|
|
143011
144938
|
return {
|
|
143012
144939
|
path: prdFile,
|
|
@@ -143022,77 +144949,16 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
143022
144949
|
}
|
|
143023
144950
|
})),
|
|
143024
144951
|
flagUnmergable,
|
|
143025
|
-
findById
|
|
144952
|
+
findById,
|
|
144953
|
+
setChosenIssueId: (issueId) => sync(() => {
|
|
144954
|
+
chosenIssueId = issueId;
|
|
144955
|
+
})
|
|
143026
144956
|
};
|
|
143027
144957
|
}).pipe(withSpan("Prd.build")) }) {
|
|
143028
|
-
static
|
|
143029
|
-
|
|
143030
|
-
|
|
143031
|
-
//#endregion
|
|
143032
|
-
//#region src/Worktree.ts
|
|
143033
|
-
var Worktree = class extends Service()("lalph/Worktree", { make: gen(function* () {
|
|
143034
|
-
const fs = yield* FileSystem;
|
|
143035
|
-
const pathService = yield* Path$1;
|
|
143036
|
-
const prd = yield* Prd;
|
|
143037
|
-
const inExisting = yield* fs.exists(pathService.join(".lalph", "worktree"));
|
|
143038
|
-
if (inExisting) return {
|
|
143039
|
-
directory: pathService.resolve("."),
|
|
143040
|
-
inExisting
|
|
143041
|
-
};
|
|
143042
|
-
const directory$2 = yield* fs.makeTempDirectory();
|
|
143043
|
-
yield* addFinalizer(fnUntraced(function* () {
|
|
143044
|
-
yield* execIgnore(make$21`git worktree remove --force ${directory$2}`);
|
|
143045
|
-
}));
|
|
143046
|
-
yield* make$21`git worktree add ${directory$2} -d HEAD`.pipe(exitCode);
|
|
143047
|
-
yield* fs.makeDirectory(pathService.join(directory$2, ".lalph"), { recursive: true });
|
|
143048
|
-
yield* scoped$1(fs.open(pathService.join(directory$2, ".lalph", "worktree"), { flag: "a+" }));
|
|
143049
|
-
yield* fs.symlink(prd.path, pathService.join(directory$2, ".lalph", "prd.yml"));
|
|
143050
|
-
const setupPath = pathService.resolve("scripts", "worktree-setup.sh");
|
|
143051
|
-
yield* seedSetupScript(setupPath);
|
|
143052
|
-
if (yield* fs.exists(setupPath)) yield* make$21({
|
|
143053
|
-
cwd: directory$2,
|
|
143054
|
-
extendEnv: true,
|
|
143055
|
-
shell: process.env.SHELL ?? true
|
|
143056
|
-
})`${setupPath}`.pipe(exitCode);
|
|
143057
|
-
return {
|
|
143058
|
-
directory: directory$2,
|
|
143059
|
-
inExisting
|
|
143060
|
-
};
|
|
143061
|
-
}) }) {
|
|
143062
|
-
static layer = effect(this, this.make);
|
|
143063
|
-
static layerLocal = effect(this, gen(function* () {
|
|
143064
|
-
const pathService = yield* Path$1;
|
|
143065
|
-
const fs = yield* FileSystem;
|
|
143066
|
-
return {
|
|
143067
|
-
directory: pathService.resolve("."),
|
|
143068
|
-
inExisting: yield* fs.exists(pathService.join(".lalph", "prd.yml"))
|
|
143069
|
-
};
|
|
143070
|
-
}));
|
|
144958
|
+
static layerNoWorktree = effect(this, this.make);
|
|
144959
|
+
static layer = this.layerNoWorktree.pipe(provideMerge(Worktree.layer));
|
|
144960
|
+
static layerLocal = this.layerNoWorktree.pipe(provideMerge(Worktree.layerLocal));
|
|
143071
144961
|
};
|
|
143072
|
-
const execIgnore = (command) => command.pipe(exitCode, catchCause$1(logWarning));
|
|
143073
|
-
const seedSetupScript = fnUntraced(function* (setupPath) {
|
|
143074
|
-
const fs = yield* FileSystem;
|
|
143075
|
-
const pathService = yield* Path$1;
|
|
143076
|
-
if (yield* fs.exists(setupPath)) return;
|
|
143077
|
-
const baseBranch = yield* discoverBaseBranch;
|
|
143078
|
-
yield* fs.makeDirectory(pathService.dirname(setupPath), { recursive: true });
|
|
143079
|
-
yield* fs.writeFileString(setupPath, setupScriptTemplate(baseBranch));
|
|
143080
|
-
yield* fs.chmod(setupPath, 493);
|
|
143081
|
-
});
|
|
143082
|
-
const discoverBaseBranch = gen(function* () {
|
|
143083
|
-
const originHead = yield* make$21`git symbolic-ref --short refs/remotes/origin/HEAD`.pipe(string, catch_$1((_) => succeed$1("")), map$6((output) => output.trim()));
|
|
143084
|
-
if (originHead !== "") return originHead.startsWith("origin/") ? originHead.slice(7) : originHead;
|
|
143085
|
-
const currentBranch = yield* make$21`git branch --show-current`.pipe(string, catch_$1((_) => succeed$1("")), map$6((output) => output.trim()));
|
|
143086
|
-
return currentBranch === "" ? "main" : currentBranch;
|
|
143087
|
-
});
|
|
143088
|
-
const setupScriptTemplate = (baseBranch) => `#!/usr/bin/env bash
|
|
143089
|
-
set -euo pipefail
|
|
143090
|
-
|
|
143091
|
-
git fetch origin
|
|
143092
|
-
git checkout origin/${baseBranch}
|
|
143093
|
-
|
|
143094
|
-
# Seeded by lalph. Customize this to prepare new worktrees.
|
|
143095
|
-
`;
|
|
143096
144962
|
|
|
143097
144963
|
//#endregion
|
|
143098
144964
|
//#region src/shared/child-process.ts
|
|
@@ -143126,7 +144992,7 @@ const parseCommandPrefix = (value) => {
|
|
|
143126
144992
|
const parts$1 = parseCommand(value);
|
|
143127
144993
|
return isReadonlyArrayNonEmpty(parts$1) ? prefix(parts$1[0], parts$1.slice(1)) : identity;
|
|
143128
144994
|
};
|
|
143129
|
-
const normalizePrefix = (value) => some(value.trim()).pipe(filter$
|
|
144995
|
+
const normalizePrefix = (value) => some(value.trim()).pipe(filter$6(isNonEmpty));
|
|
143130
144996
|
const promptForCommandPrefix = gen(function* () {
|
|
143131
144997
|
const prefixOption = normalizePrefix(yield* text$2({ message: "Command prefix for agent commands? (leave empty for none)" }));
|
|
143132
144998
|
yield* commandPrefixSetting.set(some(prefixOption));
|
|
@@ -143181,6 +145047,7 @@ const commandRoot = make$28("lalph", {
|
|
|
143181
145047
|
specsDirectory,
|
|
143182
145048
|
verbose
|
|
143183
145049
|
}).pipe(withHandler(fnUntraced(function* ({ iterations: iterations$1, concurrency: concurrency$1, targetBranch: targetBranch$1, maxIterationMinutes: maxIterationMinutes$1, stallMinutes: stallMinutes$1, specsDirectory: specsDirectory$1 }) {
|
|
145050
|
+
const source = yield* build(CurrentIssueSource.layer);
|
|
143184
145051
|
const commandPrefix = yield* getCommandPrefix;
|
|
143185
145052
|
yield* getOrSelectCliAgent;
|
|
143186
145053
|
const isFinite$3 = Number.isFinite(iterations$1);
|
|
@@ -143188,7 +145055,7 @@ const commandRoot = make$28("lalph", {
|
|
|
143188
145055
|
const runConcurrency = Math.max(1, concurrency$1);
|
|
143189
145056
|
const semaphore = makeSemaphoreUnsafe(runConcurrency);
|
|
143190
145057
|
const fibers = yield* make$25();
|
|
143191
|
-
yield* resetInProgress.pipe(withSpan("Main.resetInProgress"));
|
|
145058
|
+
yield* resetInProgress.pipe(provide$1(source), withSpan("Main.resetInProgress"));
|
|
143192
145059
|
yield* log$1(`Executing ${iterationsDisplay} iteration(s) with concurrency ${runConcurrency}`);
|
|
143193
145060
|
if (isSome(targetBranch$1)) yield* log$1(`Using target branch: ${targetBranch$1.value}`);
|
|
143194
145061
|
let iteration = 0;
|
|
@@ -143197,7 +145064,7 @@ const commandRoot = make$28("lalph", {
|
|
|
143197
145064
|
yield* semaphore.take(1);
|
|
143198
145065
|
if (quit || isFinite$3 && iteration >= iterations$1) break;
|
|
143199
145066
|
const currentIteration = iteration;
|
|
143200
|
-
const startedDeferred = yield* make$
|
|
145067
|
+
const startedDeferred = yield* make$49();
|
|
143201
145068
|
yield* checkForWork.pipe(andThen(run({
|
|
143202
145069
|
startedDeferred,
|
|
143203
145070
|
targetBranch: targetBranch$1,
|
|
@@ -143218,12 +145085,12 @@ const commandRoot = make$28("lalph", {
|
|
|
143218
145085
|
quit = true;
|
|
143219
145086
|
return void_$1;
|
|
143220
145087
|
}
|
|
143221
|
-
}), annotateLogs({ iteration: currentIteration }), ensuring(semaphore.release(1)), ensuring(completeWith(startedDeferred, void_$1)), run$1(fibers));
|
|
145088
|
+
}), annotateLogs({ iteration: currentIteration }), ensuring(semaphore.release(1)), ensuring(completeWith(startedDeferred, void_$1)), provide$1(source), run$1(fibers));
|
|
143222
145089
|
yield* _await(startedDeferred);
|
|
143223
145090
|
iteration++;
|
|
143224
145091
|
}
|
|
143225
145092
|
yield* awaitEmpty(fibers);
|
|
143226
|
-
}, scoped$1
|
|
145093
|
+
}, scoped$1)));
|
|
143227
145094
|
const run = fnUntraced(function* (options) {
|
|
143228
145095
|
const fs = yield* FileSystem;
|
|
143229
145096
|
const pathService = yield* Path$1;
|
|
@@ -143251,7 +145118,7 @@ const run = fnUntraced(function* (options) {
|
|
|
143251
145118
|
}), raceFirst(stallTimeout));
|
|
143252
145119
|
return yield* handle.exitCode;
|
|
143253
145120
|
}, scoped$1);
|
|
143254
|
-
const currentBranch = (dir) => make$21({ cwd: dir })`git branch --show-current`.pipe(string, flatMap((output) => some(output.trim()).pipe(filter$
|
|
145121
|
+
const currentBranch = (dir) => make$21({ cwd: dir })`git branch --show-current`.pipe(string, flatMap((output) => some(output.trim()).pipe(filter$6((b) => b.length > 0), fromOption)));
|
|
143255
145122
|
if (isSome(options.targetBranch)) yield* exec`git checkout ${`origin/${options.targetBranch.value}`}`;
|
|
143256
145123
|
yield* gen(function* () {
|
|
143257
145124
|
let taskId = void 0;
|
|
@@ -143275,6 +145142,7 @@ const run = fnUntraced(function* (options) {
|
|
|
143275
145142
|
return yield* new ChosenTaskNotFound();
|
|
143276
145143
|
})));
|
|
143277
145144
|
taskId = chosenTask.id;
|
|
145145
|
+
yield* prd.setChosenIssueId(taskId);
|
|
143278
145146
|
yield* source.ensureInProgress(taskId).pipe(timeoutOrElse({
|
|
143279
145147
|
duration: "1 minute",
|
|
143280
145148
|
onTimeout: () => fail$4(new RunnerStalled())
|
|
@@ -143328,7 +145196,7 @@ const run = fnUntraced(function* (options) {
|
|
|
143328
145196
|
yield* exec`git checkout --detach ${currentBranchName}`;
|
|
143329
145197
|
yield* exec`git branch -D ${currentBranchName}`;
|
|
143330
145198
|
}).pipe(ignore)));
|
|
143331
|
-
}, scoped$1, provide$1([PromptGen.layer,
|
|
145199
|
+
}, scoped$1, provide$1([PromptGen.layer, Prd.layer]));
|
|
143332
145200
|
var RunnerStalled = class extends TaggedError("RunnerStalled") {
|
|
143333
145201
|
message = "The runner has stalled due to inactivity.";
|
|
143334
145202
|
};
|
|
@@ -143350,7 +145218,7 @@ const commandPlan = make$28("plan", { dangerous }).pipe(withDescription("Iterate
|
|
|
143350
145218
|
targetBranch: targetBranch$1,
|
|
143351
145219
|
commandPrefix: yield* getCommandPrefix,
|
|
143352
145220
|
dangerous: dangerous$1
|
|
143353
|
-
}).pipe(provide$1(
|
|
145221
|
+
}).pipe(provide$1(CurrentIssueSource.layer));
|
|
143354
145222
|
})));
|
|
143355
145223
|
const plan = fnUntraced(function* (options) {
|
|
143356
145224
|
const fs = yield* FileSystem;
|
|
@@ -143370,7 +145238,11 @@ const plan = fnUntraced(function* (options) {
|
|
|
143370
145238
|
}), setCwd(worktree.directory), options.commandPrefix, exitCode);
|
|
143371
145239
|
yield* log$1(`Agent exited with code: ${exitCode$1}`);
|
|
143372
145240
|
if (!worktree.inExisting) yield* pipe(fs.copy(pathService.join(worktree.directory, options.specsDirectory), options.specsDirectory, { overwrite: true }), ignore);
|
|
143373
|
-
}, scoped$1, provide$1([
|
|
145241
|
+
}, scoped$1, provide$1([
|
|
145242
|
+
PromptGen.layer,
|
|
145243
|
+
Prd.layer,
|
|
145244
|
+
Worktree.layer
|
|
145245
|
+
]));
|
|
143374
145246
|
|
|
143375
145247
|
//#endregion
|
|
143376
145248
|
//#region src/shared/config.ts
|
|
@@ -143444,7 +145316,7 @@ const commandEdit = make$28("edit").pipe(withDescription("Open the prd.yml file
|
|
|
143444
145316
|
stdout: "inherit",
|
|
143445
145317
|
stderr: "inherit"
|
|
143446
145318
|
}).pipe(exitCode);
|
|
143447
|
-
}, scoped$1, provide$1(Prd.
|
|
145319
|
+
}, scoped$1, provide$1(Prd.layerLocal.pipe(provide$3(CurrentIssueSource.layer))))));
|
|
143448
145320
|
|
|
143449
145321
|
//#endregion
|
|
143450
145322
|
//#region src/commands/shell.ts
|
|
@@ -143459,7 +145331,7 @@ const commandShell = make$28("shell").pipe(withDescription("Enter an interactive
|
|
|
143459
145331
|
stdout: "inherit",
|
|
143460
145332
|
stderr: "inherit"
|
|
143461
145333
|
}).pipe(exitCode);
|
|
143462
|
-
}, scoped$1, provide$1(
|
|
145334
|
+
}, scoped$1, provide$1(Prd.layer.pipe(provide$3(CurrentIssueSource.layer))))));
|
|
143463
145335
|
|
|
143464
145336
|
//#endregion
|
|
143465
145337
|
//#region src/commands/source.ts
|
|
@@ -143467,7 +145339,7 @@ const commandSource = make$28("source").pipe(withDescription("Select the issue s
|
|
|
143467
145339
|
|
|
143468
145340
|
//#endregion
|
|
143469
145341
|
//#region package.json
|
|
143470
|
-
var version = "0.1.
|
|
145342
|
+
var version = "0.1.90";
|
|
143471
145343
|
|
|
143472
145344
|
//#endregion
|
|
143473
145345
|
//#region src/Tracing.ts
|
|
@@ -143492,7 +145364,7 @@ const TracerLogger = gen(function* () {
|
|
|
143492
145364
|
logger$1.log(options);
|
|
143493
145365
|
});
|
|
143494
145366
|
};
|
|
143495
|
-
return make$
|
|
145367
|
+
return make$50({ span(name, parent, annotations$1, links, startTime, kind, options) {
|
|
143496
145368
|
const span = tracer$3.span(name, parent, annotations$1, links, startTime, kind, options);
|
|
143497
145369
|
log$2(`${name}: started`, startTime);
|
|
143498
145370
|
const oldEnd = span.end;
|