@deslop/scope 0.1.1136 → 0.1.1138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -12
- package/dist/server.js +560 -200
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -3034,7 +3034,7 @@ const Prototype = (options) => makePrimitiveProto({
|
|
|
3034
3034
|
* @category constructors
|
|
3035
3035
|
* @since 2.0.0
|
|
3036
3036
|
*/
|
|
3037
|
-
const make$
|
|
3037
|
+
const make$73 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
3038
3038
|
const isStrictEquivalent = (x, y) => x === y;
|
|
3039
3039
|
/**
|
|
3040
3040
|
* Creates an equivalence relation that uses strict equality (`===`) to compare values.
|
|
@@ -3144,7 +3144,7 @@ const strictEqual = () => isStrictEquivalent;
|
|
|
3144
3144
|
* @since 4.0.0
|
|
3145
3145
|
*/
|
|
3146
3146
|
function Tuple$1(elements) {
|
|
3147
|
-
return make$
|
|
3147
|
+
return make$73((self, that) => {
|
|
3148
3148
|
if (self.length !== that.length) return false;
|
|
3149
3149
|
for (let i = 0; i < self.length; i++) if (!elements[i](self[i], that[i])) return false;
|
|
3150
3150
|
return true;
|
|
@@ -3154,7 +3154,7 @@ function Tuple$1(elements) {
|
|
|
3154
3154
|
* @since 4.0.0
|
|
3155
3155
|
*/
|
|
3156
3156
|
function Array_$1(item) {
|
|
3157
|
-
return make$
|
|
3157
|
+
return make$73((self, that) => {
|
|
3158
3158
|
if (self.length !== that.length) return false;
|
|
3159
3159
|
for (let i = 0; i < self.length; i++) if (!item(self[i], that[i])) return false;
|
|
3160
3160
|
return true;
|
|
@@ -3353,7 +3353,7 @@ const succeed$10 = (success) => new SuccessImpl(success);
|
|
|
3353
3353
|
* @category constructors
|
|
3354
3354
|
* @since 2.0.0
|
|
3355
3355
|
*/
|
|
3356
|
-
function make$
|
|
3356
|
+
function make$72(compare) {
|
|
3357
3357
|
return (self, that) => self === that ? 0 : compare(self, that);
|
|
3358
3358
|
}
|
|
3359
3359
|
/**
|
|
@@ -3384,7 +3384,7 @@ function make$71(compare) {
|
|
|
3384
3384
|
* @category instances
|
|
3385
3385
|
* @since 4.0.0
|
|
3386
3386
|
*/
|
|
3387
|
-
const String$6 = /*#__PURE__*/ make$
|
|
3387
|
+
const String$6 = /*#__PURE__*/ make$72((self, that) => self < that ? -1 : 1);
|
|
3388
3388
|
/**
|
|
3389
3389
|
* Order instance for numbers that compares them numerically.
|
|
3390
3390
|
*
|
|
@@ -3417,7 +3417,7 @@ const String$6 = /*#__PURE__*/ make$71((self, that) => self < that ? -1 : 1);
|
|
|
3417
3417
|
* @category instances
|
|
3418
3418
|
* @since 4.0.0
|
|
3419
3419
|
*/
|
|
3420
|
-
const Number$5 = /*#__PURE__*/ make$
|
|
3420
|
+
const Number$5 = /*#__PURE__*/ make$72((self, that) => {
|
|
3421
3421
|
if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
|
|
3422
3422
|
if (globalThis.Number.isNaN(self)) return -1;
|
|
3423
3423
|
if (globalThis.Number.isNaN(that)) return 1;
|
|
@@ -3451,7 +3451,7 @@ const Number$5 = /*#__PURE__*/ make$71((self, that) => {
|
|
|
3451
3451
|
* @category instances
|
|
3452
3452
|
* @since 4.0.0
|
|
3453
3453
|
*/
|
|
3454
|
-
const BigInt$5 = /*#__PURE__*/ make$
|
|
3454
|
+
const BigInt$5 = /*#__PURE__*/ make$72((self, that) => self < that ? -1 : 1);
|
|
3455
3455
|
/**
|
|
3456
3456
|
* Creates a new `Order` that reverses the comparison order of the input `Order`.
|
|
3457
3457
|
*
|
|
@@ -3483,7 +3483,7 @@ const BigInt$5 = /*#__PURE__*/ make$71((self, that) => self < that ? -1 : 1);
|
|
|
3483
3483
|
* @since 4.0.0
|
|
3484
3484
|
*/
|
|
3485
3485
|
function flip$2(O) {
|
|
3486
|
-
return make$
|
|
3486
|
+
return make$72((self, that) => O(that, self));
|
|
3487
3487
|
}
|
|
3488
3488
|
/**
|
|
3489
3489
|
* Transforms an `Order` on type `A` into an `Order` on type `B` by providing a function that
|
|
@@ -3518,12 +3518,12 @@ function flip$2(O) {
|
|
|
3518
3518
|
* @category mapping
|
|
3519
3519
|
* @since 2.0.0
|
|
3520
3520
|
*/
|
|
3521
|
-
const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$
|
|
3521
|
+
const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$72((b1, b2) => self(f(b1), f(b2))));
|
|
3522
3522
|
/**
|
|
3523
3523
|
* @since 4.0.0
|
|
3524
3524
|
*/
|
|
3525
3525
|
function Array_(O) {
|
|
3526
|
-
return make$
|
|
3526
|
+
return make$72((self, that) => {
|
|
3527
3527
|
const aLen = self.length;
|
|
3528
3528
|
const bLen = that.length;
|
|
3529
3529
|
const len = Math.min(aLen, bLen);
|
|
@@ -3574,7 +3574,7 @@ function Array_(O) {
|
|
|
3574
3574
|
*/
|
|
3575
3575
|
function Struct$1(fields) {
|
|
3576
3576
|
const keys = Object.keys(fields);
|
|
3577
|
-
return make$
|
|
3577
|
+
return make$72((self, that) => {
|
|
3578
3578
|
for (const key of keys) {
|
|
3579
3579
|
const o = fields[key](self[key], that[key]);
|
|
3580
3580
|
if (o !== 0) return o;
|
|
@@ -4410,7 +4410,7 @@ const ServiceProto = {
|
|
|
4410
4410
|
.../*#__PURE__*/ Prototype({
|
|
4411
4411
|
label: "Service",
|
|
4412
4412
|
evaluate(fiber) {
|
|
4413
|
-
return exitSucceed(get$
|
|
4413
|
+
return exitSucceed(get$10(fiber.context, this));
|
|
4414
4414
|
}
|
|
4415
4415
|
}),
|
|
4416
4416
|
toJSON() {
|
|
@@ -4423,13 +4423,13 @@ const ServiceProto = {
|
|
|
4423
4423
|
return self;
|
|
4424
4424
|
},
|
|
4425
4425
|
context(self) {
|
|
4426
|
-
return make$
|
|
4426
|
+
return make$71(this, self);
|
|
4427
4427
|
},
|
|
4428
4428
|
use(f) {
|
|
4429
|
-
return withFiber$1((fiber) => f(get$
|
|
4429
|
+
return withFiber$1((fiber) => f(get$10(fiber.context, this)));
|
|
4430
4430
|
},
|
|
4431
4431
|
useSync(f) {
|
|
4432
|
-
return withFiber$1((fiber) => exitSucceed(f(get$
|
|
4432
|
+
return withFiber$1((fiber) => exitSucceed(f(get$10(fiber.context, this))));
|
|
4433
4433
|
}
|
|
4434
4434
|
};
|
|
4435
4435
|
const cacheKeys = /*#__PURE__*/ new Set();
|
|
@@ -4628,7 +4628,7 @@ const emptyContext = /*#__PURE__*/ makeUnsafe$9(/*#__PURE__*/ new Map());
|
|
|
4628
4628
|
* @category constructors
|
|
4629
4629
|
* @since 2.0.0
|
|
4630
4630
|
*/
|
|
4631
|
-
const make$
|
|
4631
|
+
const make$71 = (key, service) => makeUnsafe$9(/* @__PURE__ */ new Map([[key.key, service]]));
|
|
4632
4632
|
/**
|
|
4633
4633
|
* Adds a service to a given `Context`.
|
|
4634
4634
|
*
|
|
@@ -4751,7 +4751,7 @@ const getOrUndefinedUnsafe = (self, key) => {
|
|
|
4751
4751
|
* @category unsafe
|
|
4752
4752
|
* @since 4.0.0
|
|
4753
4753
|
*/
|
|
4754
|
-
const getUnsafe$
|
|
4754
|
+
const getUnsafe$2 = /*#__PURE__*/ dual(2, (self, service) => {
|
|
4755
4755
|
const value = lookup(self, service.key);
|
|
4756
4756
|
if (value === notFound$1) {
|
|
4757
4757
|
if (isReference(service)) return getDefaultValue(service);
|
|
@@ -4790,7 +4790,7 @@ const getUnsafe$1 = /*#__PURE__*/ dual(2, (self, service) => {
|
|
|
4790
4790
|
* @category getters
|
|
4791
4791
|
* @since 2.0.0
|
|
4792
4792
|
*/
|
|
4793
|
-
const get$
|
|
4793
|
+
const get$10 = getUnsafe$2;
|
|
4794
4794
|
const defaultValueCacheKey = "~effect/Context/defaultValue";
|
|
4795
4795
|
const getDefaultValue = (ref) => {
|
|
4796
4796
|
if (defaultValueCacheKey in ref) return ref[defaultValueCacheKey];
|
|
@@ -5026,7 +5026,7 @@ const bigint1e3 = /*#__PURE__*/ BigInt(1e3);
|
|
|
5026
5026
|
const bigint1e6 = /*#__PURE__*/ BigInt(1e6);
|
|
5027
5027
|
const roundTiesAwayFromZero = (input) => BigInt(Math.sign(input) * Math.round(Math.abs(input)));
|
|
5028
5028
|
const roundMillisToNanos = (millis) => Number.isInteger(millis) ? BigInt(millis) * bigint1e6 : roundTiesAwayFromZero(millis * 1e6);
|
|
5029
|
-
const fromNanosNumber = (nanos) => make$
|
|
5029
|
+
const fromNanosNumber = (nanos) => make$70(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos);
|
|
5030
5030
|
const parseNanos = (input, scale) => {
|
|
5031
5031
|
const decimalIndex = input.indexOf(".");
|
|
5032
5032
|
if (decimalIndex === -1) return BigInt(input) * scale;
|
|
@@ -5116,7 +5116,7 @@ const fromInputUnsafe$1 = (input) => {
|
|
|
5116
5116
|
if (obj.minutes) millis += obj.minutes * 6e4;
|
|
5117
5117
|
if (obj.seconds) millis += obj.seconds * 1e3;
|
|
5118
5118
|
if (obj.milliseconds) millis += obj.milliseconds;
|
|
5119
|
-
if (!obj.microseconds && !obj.nanoseconds) return make$
|
|
5119
|
+
if (!obj.microseconds && !obj.nanoseconds) return make$70(millis);
|
|
5120
5120
|
return fromNanosNumber(millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0));
|
|
5121
5121
|
}
|
|
5122
5122
|
}
|
|
@@ -5198,7 +5198,7 @@ const DurationProto = {
|
|
|
5198
5198
|
return pipeArguments(this, arguments);
|
|
5199
5199
|
}
|
|
5200
5200
|
};
|
|
5201
|
-
const make$
|
|
5201
|
+
const make$70 = (input) => {
|
|
5202
5202
|
const duration = Object.create(DurationProto);
|
|
5203
5203
|
if (typeof input === "number") {
|
|
5204
5204
|
if (isNaN(input) || input === 0 || Object.is(input, -0)) duration.value = zeroDurationValue;
|
|
@@ -5321,8 +5321,8 @@ const abs = (self) => {
|
|
|
5321
5321
|
switch (self.value._tag) {
|
|
5322
5322
|
case "Infinity":
|
|
5323
5323
|
case "NegativeInfinity": return infinity;
|
|
5324
|
-
case "Millis": return self.value.millis < 0 ? make$
|
|
5325
|
-
case "Nanos": return self.value.nanos < bigint0$3 ? make$
|
|
5324
|
+
case "Millis": return self.value.millis < 0 ? make$70(-self.value.millis) : self;
|
|
5325
|
+
case "Nanos": return self.value.nanos < bigint0$3 ? make$70(-self.value.nanos) : self;
|
|
5326
5326
|
}
|
|
5327
5327
|
};
|
|
5328
5328
|
/**
|
|
@@ -5340,7 +5340,7 @@ const abs = (self) => {
|
|
|
5340
5340
|
* @category constructors
|
|
5341
5341
|
* @since 2.0.0
|
|
5342
5342
|
*/
|
|
5343
|
-
const zero$2 = /*#__PURE__*/ make$
|
|
5343
|
+
const zero$2 = /*#__PURE__*/ make$70(0);
|
|
5344
5344
|
/**
|
|
5345
5345
|
* A Duration representing infinite time.
|
|
5346
5346
|
*
|
|
@@ -5356,7 +5356,7 @@ const zero$2 = /*#__PURE__*/ make$69(0);
|
|
|
5356
5356
|
* @category constructors
|
|
5357
5357
|
* @since 2.0.0
|
|
5358
5358
|
*/
|
|
5359
|
-
const infinity = /*#__PURE__*/ make$
|
|
5359
|
+
const infinity = /*#__PURE__*/ make$70(Infinity);
|
|
5360
5360
|
/**
|
|
5361
5361
|
* A Duration representing negative infinite time.
|
|
5362
5362
|
*
|
|
@@ -5372,7 +5372,7 @@ const infinity = /*#__PURE__*/ make$69(Infinity);
|
|
|
5372
5372
|
* @category constructors
|
|
5373
5373
|
* @since 4.0.0
|
|
5374
5374
|
*/
|
|
5375
|
-
const negativeInfinity = /*#__PURE__*/ make$
|
|
5375
|
+
const negativeInfinity = /*#__PURE__*/ make$70(-Infinity);
|
|
5376
5376
|
/**
|
|
5377
5377
|
* Creates a Duration from nanoseconds.
|
|
5378
5378
|
*
|
|
@@ -5388,7 +5388,7 @@ const negativeInfinity = /*#__PURE__*/ make$69(-Infinity);
|
|
|
5388
5388
|
* @category constructors
|
|
5389
5389
|
* @since 2.0.0
|
|
5390
5390
|
*/
|
|
5391
|
-
const nanos = (nanos) => make$
|
|
5391
|
+
const nanos = (nanos) => make$70(nanos);
|
|
5392
5392
|
/**
|
|
5393
5393
|
* Creates a Duration from milliseconds.
|
|
5394
5394
|
*
|
|
@@ -5404,7 +5404,7 @@ const nanos = (nanos) => make$69(nanos);
|
|
|
5404
5404
|
* @category constructors
|
|
5405
5405
|
* @since 2.0.0
|
|
5406
5406
|
*/
|
|
5407
|
-
const millis = (millis) => make$
|
|
5407
|
+
const millis = (millis) => make$70(millis);
|
|
5408
5408
|
/**
|
|
5409
5409
|
* Creates a Duration from seconds.
|
|
5410
5410
|
*
|
|
@@ -5420,7 +5420,7 @@ const millis = (millis) => make$69(millis);
|
|
|
5420
5420
|
* @category constructors
|
|
5421
5421
|
* @since 2.0.0
|
|
5422
5422
|
*/
|
|
5423
|
-
const seconds = (seconds) => make$
|
|
5423
|
+
const seconds = (seconds) => make$70(seconds * 1e3);
|
|
5424
5424
|
/**
|
|
5425
5425
|
* Creates a Duration from minutes.
|
|
5426
5426
|
*
|
|
@@ -5436,7 +5436,7 @@ const seconds = (seconds) => make$69(seconds * 1e3);
|
|
|
5436
5436
|
* @category constructors
|
|
5437
5437
|
* @since 2.0.0
|
|
5438
5438
|
*/
|
|
5439
|
-
const minutes = (minutes) => make$
|
|
5439
|
+
const minutes = (minutes) => make$70(minutes * 6e4);
|
|
5440
5440
|
/**
|
|
5441
5441
|
* Creates a Duration from hours.
|
|
5442
5442
|
*
|
|
@@ -5452,7 +5452,7 @@ const minutes = (minutes) => make$69(minutes * 6e4);
|
|
|
5452
5452
|
* @category constructors
|
|
5453
5453
|
* @since 2.0.0
|
|
5454
5454
|
*/
|
|
5455
|
-
const hours = (hours) => make$
|
|
5455
|
+
const hours = (hours) => make$70(hours * 36e5);
|
|
5456
5456
|
/**
|
|
5457
5457
|
* Creates a Duration from days.
|
|
5458
5458
|
*
|
|
@@ -5468,7 +5468,7 @@ const hours = (hours) => make$69(hours * 36e5);
|
|
|
5468
5468
|
* @category constructors
|
|
5469
5469
|
* @since 2.0.0
|
|
5470
5470
|
*/
|
|
5471
|
-
const days = (days) => make$
|
|
5471
|
+
const days = (days) => make$70(days * 864e5);
|
|
5472
5472
|
/**
|
|
5473
5473
|
* Creates a Duration from weeks.
|
|
5474
5474
|
*
|
|
@@ -5484,7 +5484,7 @@ const days = (days) => make$69(days * 864e5);
|
|
|
5484
5484
|
* @category constructors
|
|
5485
5485
|
* @since 2.0.0
|
|
5486
5486
|
*/
|
|
5487
|
-
const weeks = (weeks) => make$
|
|
5487
|
+
const weeks = (weeks) => make$70(weeks * 6048e5);
|
|
5488
5488
|
/**
|
|
5489
5489
|
* Converts a Duration to milliseconds.
|
|
5490
5490
|
*
|
|
@@ -6346,6 +6346,27 @@ const isEmptyRecord = (self) => Object.keys(self).length === 0;
|
|
|
6346
6346
|
*/
|
|
6347
6347
|
const fromEntries = Object.fromEntries;
|
|
6348
6348
|
/**
|
|
6349
|
+
* Transforms the values of a record into an `Array` with a custom mapping function.
|
|
6350
|
+
*
|
|
6351
|
+
* **Example** (Collecting mapped record values)
|
|
6352
|
+
*
|
|
6353
|
+
* ```ts import.meta.vitest
|
|
6354
|
+
* import { Record } from "effect"
|
|
6355
|
+
*
|
|
6356
|
+
* const x = { a: 1, b: 2, c: 3 }
|
|
6357
|
+
* Record.collect(x, (key, n) => [key, n]) // => [["a", 1], ["b", 2], ["c", 3]]
|
|
6358
|
+
* ```
|
|
6359
|
+
*
|
|
6360
|
+
* @stability stable
|
|
6361
|
+
* @category converting
|
|
6362
|
+
* @since 2.0.0
|
|
6363
|
+
*/
|
|
6364
|
+
const collect$1 = /*#__PURE__*/ dual(2, (self, f) => {
|
|
6365
|
+
const out = [];
|
|
6366
|
+
for (const key of keys$1(self)) out.push(f(key, self[key]));
|
|
6367
|
+
return out;
|
|
6368
|
+
});
|
|
6369
|
+
/**
|
|
6349
6370
|
* Checks whether a given `key` exists in a record.
|
|
6350
6371
|
*
|
|
6351
6372
|
* **Example** (Checking key membership)
|
|
@@ -6380,7 +6401,7 @@ const has$3 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key));
|
|
|
6380
6401
|
* @category getters
|
|
6381
6402
|
* @since 2.0.0
|
|
6382
6403
|
*/
|
|
6383
|
-
const get$
|
|
6404
|
+
const get$9 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key) ? some$1(self[key]) : none());
|
|
6384
6405
|
/**
|
|
6385
6406
|
* Maps a record into another record by applying a transformation function to each of its values.
|
|
6386
6407
|
*
|
|
@@ -6445,6 +6466,44 @@ const filter$2 = /*#__PURE__*/ dual(2, (self, predicate) => {
|
|
|
6445
6466
|
*/
|
|
6446
6467
|
const keys$1 = (self) => Object.keys(self);
|
|
6447
6468
|
/**
|
|
6469
|
+
* Retrieves the values of a given record as an array.
|
|
6470
|
+
*
|
|
6471
|
+
* **Example** (Getting record values)
|
|
6472
|
+
*
|
|
6473
|
+
* ```ts import.meta.vitest
|
|
6474
|
+
* import { Record } from "effect"
|
|
6475
|
+
*
|
|
6476
|
+
* Record.values({ a: 1, b: 2, c: 3 }) // => [1, 2, 3]
|
|
6477
|
+
* ```
|
|
6478
|
+
*
|
|
6479
|
+
* @stability stable
|
|
6480
|
+
* @category getters
|
|
6481
|
+
* @since 2.0.0
|
|
6482
|
+
*/
|
|
6483
|
+
const values$2 = (self) => collect$1(self, (_, a) => a);
|
|
6484
|
+
/**
|
|
6485
|
+
* Adds a new key-value pair or update an existing key's value in a record.
|
|
6486
|
+
*
|
|
6487
|
+
* **Example** (Setting a record value)
|
|
6488
|
+
*
|
|
6489
|
+
* ```ts import.meta.vitest
|
|
6490
|
+
* import { Record } from "effect"
|
|
6491
|
+
*
|
|
6492
|
+
* Record.set("a", 5)({ a: 1, b: 2 }) // => { a: 5, b: 2 }
|
|
6493
|
+
* Record.set("c", 5)({ a: 1, b: 2 }) // => { a: 1, b: 2, c: 5 }
|
|
6494
|
+
* ```
|
|
6495
|
+
*
|
|
6496
|
+
* @stability stable
|
|
6497
|
+
* @category mutations
|
|
6498
|
+
* @since 2.0.0
|
|
6499
|
+
*/
|
|
6500
|
+
const set$5 = /*#__PURE__*/ dual(3, (self, key, value) => {
|
|
6501
|
+
return {
|
|
6502
|
+
...self,
|
|
6503
|
+
[key]: value
|
|
6504
|
+
};
|
|
6505
|
+
});
|
|
6506
|
+
/**
|
|
6448
6507
|
* Checks whether all the keys and values in one record are also found in another record.
|
|
6449
6508
|
* Uses the provided equivalence function to compare values.
|
|
6450
6509
|
*
|
|
@@ -6724,11 +6783,44 @@ function isOutOfBounds(i, as) {
|
|
|
6724
6783
|
* @category getters
|
|
6725
6784
|
* @since 2.0.0
|
|
6726
6785
|
*/
|
|
6727
|
-
const get$
|
|
6786
|
+
const get$8 = /*#__PURE__*/ dual(2, (self, index) => {
|
|
6728
6787
|
const i = Math.floor(index);
|
|
6729
6788
|
return isOutOfBounds(i, self) ? none() : some$1(self[i]);
|
|
6730
6789
|
});
|
|
6731
6790
|
/**
|
|
6791
|
+
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
6792
|
+
*
|
|
6793
|
+
* **When to use**
|
|
6794
|
+
*
|
|
6795
|
+
* Use to read an array element at a known valid index when out-of-bounds would
|
|
6796
|
+
* be a programming error.
|
|
6797
|
+
*
|
|
6798
|
+
* **Details**
|
|
6799
|
+
*
|
|
6800
|
+
* Throws an `Error` with the message `"Index out of bounds: <i>"`. Prefer
|
|
6801
|
+
* `get` for safe access.
|
|
6802
|
+
*
|
|
6803
|
+
* **Example** (Accessing indexes unsafely)
|
|
6804
|
+
*
|
|
6805
|
+
* ```ts import.meta.vitest
|
|
6806
|
+
* import { Array } from "effect"
|
|
6807
|
+
*
|
|
6808
|
+
* Array.getUnsafe([1, 2, 3], 1) // => 2
|
|
6809
|
+
* // Array.getUnsafe([1, 2, 3], 10) // throws Error
|
|
6810
|
+
* ```
|
|
6811
|
+
*
|
|
6812
|
+
* @see {@link get} — safe version returning `Option`
|
|
6813
|
+
*
|
|
6814
|
+
* @stability stable
|
|
6815
|
+
* @category unsafe
|
|
6816
|
+
* @since 4.0.0
|
|
6817
|
+
*/
|
|
6818
|
+
const getUnsafe$1 = /*#__PURE__*/ dual(2, (self, index) => {
|
|
6819
|
+
const i = Math.floor(index);
|
|
6820
|
+
if (isOutOfBounds(i, self)) throw new Error(`Index out of bounds: ${i}`);
|
|
6821
|
+
return self[i];
|
|
6822
|
+
});
|
|
6823
|
+
/**
|
|
6732
6824
|
* Returns the first element of an array safely wrapped in `Option.some`, or
|
|
6733
6825
|
* `Option.none` if the array is empty.
|
|
6734
6826
|
*
|
|
@@ -6752,7 +6844,31 @@ const get$7 = /*#__PURE__*/ dual(2, (self, index) => {
|
|
|
6752
6844
|
* @category getters
|
|
6753
6845
|
* @since 2.0.0
|
|
6754
6846
|
*/
|
|
6755
|
-
const head = /*#__PURE__*/ get$
|
|
6847
|
+
const head = /*#__PURE__*/ get$8(0);
|
|
6848
|
+
/**
|
|
6849
|
+
* Returns the first element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
6850
|
+
* wrapper).
|
|
6851
|
+
*
|
|
6852
|
+
* **When to use**
|
|
6853
|
+
*
|
|
6854
|
+
* Use to get the first element without `Option` wrapping when the array is known
|
|
6855
|
+
* to be non-empty.
|
|
6856
|
+
*
|
|
6857
|
+
* **Example** (Getting the head of a non-empty array)
|
|
6858
|
+
*
|
|
6859
|
+
* ```ts import.meta.vitest
|
|
6860
|
+
* import { Array } from "effect"
|
|
6861
|
+
*
|
|
6862
|
+
* Array.headNonEmpty([1, 2, 3, 4]) // => 1
|
|
6863
|
+
* ```
|
|
6864
|
+
*
|
|
6865
|
+
* @see {@link head} — safe version for possibly-empty arrays
|
|
6866
|
+
*
|
|
6867
|
+
* @stability stable
|
|
6868
|
+
* @category getters
|
|
6869
|
+
* @since 2.0.0
|
|
6870
|
+
*/
|
|
6871
|
+
const headNonEmpty = /*#__PURE__*/ getUnsafe$1(0);
|
|
6756
6872
|
/**
|
|
6757
6873
|
* Returns the last element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
6758
6874
|
* wrapper).
|
|
@@ -8051,7 +8167,7 @@ var ParentSpan = class extends (/*#__PURE__*/ Service$2()(ParentSpanKey, { fiber
|
|
|
8051
8167
|
* @category constructors
|
|
8052
8168
|
* @since 2.0.0
|
|
8053
8169
|
*/
|
|
8054
|
-
const make$
|
|
8170
|
+
const make$69 = (options) => options;
|
|
8055
8171
|
/**
|
|
8056
8172
|
* Creates an `ExternalSpan` from trace and span identifiers, defaulting
|
|
8057
8173
|
* `sampled` to `true` and annotations to an empty context when they are not
|
|
@@ -8231,7 +8347,7 @@ const Tracer = /*#__PURE__*/ Reference(TracerKey, {
|
|
|
8231
8347
|
* @category references
|
|
8232
8348
|
* @since 4.0.0
|
|
8233
8349
|
*/
|
|
8234
|
-
const nativeTracer = /*#__PURE__*/ make$
|
|
8350
|
+
const nativeTracer = /*#__PURE__*/ make$69({ span: (options) => new NativeSpan(options) });
|
|
8235
8351
|
/**
|
|
8236
8352
|
* Default in-memory `Span` implementation used by the native tracer. It
|
|
8237
8353
|
* generates span and trace identifiers, stores attributes, events, and links,
|
|
@@ -8630,7 +8746,7 @@ var FiberImpl = class {
|
|
|
8630
8746
|
return this._dispatcher ??= this.cache.scheduler.makeDispatcher();
|
|
8631
8747
|
}
|
|
8632
8748
|
getRef(ref) {
|
|
8633
|
-
return get$
|
|
8749
|
+
return get$10(this.context, ref);
|
|
8634
8750
|
}
|
|
8635
8751
|
addObserver(cb) {
|
|
8636
8752
|
if (this._exit) {
|
|
@@ -8649,7 +8765,7 @@ var FiberImpl = class {
|
|
|
8649
8765
|
interruptUnsafe(fiberId, annotations) {
|
|
8650
8766
|
if (this._exit) return;
|
|
8651
8767
|
let cause = causeInterrupt(fiberId);
|
|
8652
|
-
if (this.cache.stackFrame) cause = causeAnnotate(cause, make$
|
|
8768
|
+
if (this.cache.stackFrame) cause = causeAnnotate(cause, make$71(StackTraceKey, this.cache.stackFrame));
|
|
8653
8769
|
if (annotations) cause = causeAnnotate(cause, annotations);
|
|
8654
8770
|
this._interruptedCause = this._interruptedCause ? causeAddInterrupts(this._interruptedCause, cause) : cause;
|
|
8655
8771
|
if (this.interruptible) {
|
|
@@ -8788,17 +8904,17 @@ var FiberImpl = class {
|
|
|
8788
8904
|
const makeFiberContextCache = (context) => {
|
|
8789
8905
|
const currentTracer = getOrUndefinedUnsafe(context, TracerKey);
|
|
8790
8906
|
return {
|
|
8791
|
-
scheduler: get$
|
|
8907
|
+
scheduler: get$10(context, Scheduler),
|
|
8792
8908
|
tracer: currentTracer,
|
|
8793
8909
|
tracerContext: currentTracer ? currentTracer["context"] : void 0,
|
|
8794
|
-
tracerEnabled: get$
|
|
8910
|
+
tracerEnabled: get$10(context, TracerEnabled),
|
|
8795
8911
|
span: getOrUndefinedUnsafe(context, ParentSpanKey),
|
|
8796
|
-
logLevel: get$
|
|
8797
|
-
minimumLogLevel: get$
|
|
8798
|
-
stackFrame: get$
|
|
8912
|
+
logLevel: get$10(context, CurrentLogLevel$1),
|
|
8913
|
+
minimumLogLevel: get$10(context, MinimumLogLevel),
|
|
8914
|
+
stackFrame: get$10(context, CurrentStackFrame),
|
|
8799
8915
|
runtimeMetrics: getOrUndefinedUnsafe(context, FiberRuntimeMetricsKey),
|
|
8800
|
-
maxOpsBeforeYield: get$
|
|
8801
|
-
preventYield: get$
|
|
8916
|
+
maxOpsBeforeYield: get$10(context, MaxOpsBeforeYield),
|
|
8917
|
+
preventYield: get$10(context, PreventSchedulerYield)
|
|
8802
8918
|
};
|
|
8803
8919
|
};
|
|
8804
8920
|
const deferredInterruptCont = {
|
|
@@ -9366,7 +9482,7 @@ const updateContext$1 = /*#__PURE__*/ dual(2, (self, f) => withFiber$1((fiber) =
|
|
|
9366
9482
|
}));
|
|
9367
9483
|
/** @internal */
|
|
9368
9484
|
const updateService = /*#__PURE__*/ dual(3, (self, service, f) => updateContext$1(self, (s) => {
|
|
9369
|
-
const prev = getUnsafe$
|
|
9485
|
+
const prev = getUnsafe$2(s, service);
|
|
9370
9486
|
const next = f(prev);
|
|
9371
9487
|
if (prev === next) return s;
|
|
9372
9488
|
return add$3(s, service, next);
|
|
@@ -10277,11 +10393,11 @@ const NoopSpanProto = {
|
|
|
10277
10393
|
const noopSpan = (options) => Object.assign(Object.create(NoopSpanProto), options);
|
|
10278
10394
|
const filterDisablePropagation = (span) => {
|
|
10279
10395
|
if (!span) return none();
|
|
10280
|
-
return get$
|
|
10396
|
+
return get$10(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some$1(span);
|
|
10281
10397
|
};
|
|
10282
10398
|
/** @internal */
|
|
10283
10399
|
const makeSpanUnsafe = (fiber, name, options) => {
|
|
10284
|
-
const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$
|
|
10400
|
+
const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$10(options.annotations, DisablePropagation);
|
|
10285
10401
|
const parent = options?.parent !== void 0 ? some$1(options.parent) : options?.root ? none() : filterDisablePropagation(fiber.cache.span);
|
|
10286
10402
|
let span;
|
|
10287
10403
|
if (disablePropagation) span = noopSpan({
|
|
@@ -10314,7 +10430,7 @@ const makeSpanUnsafe = (fiber, name, options) => {
|
|
|
10314
10430
|
};
|
|
10315
10431
|
/** @internal */
|
|
10316
10432
|
const makeSpanScoped$1 = (name, options) => uninterruptible$1(withFiber$1((fiber) => {
|
|
10317
|
-
const scope = getUnsafe$
|
|
10433
|
+
const scope = getUnsafe$2(fiber.context, scopeTag);
|
|
10318
10434
|
const span = makeSpanUnsafe(fiber, name, options ?? {});
|
|
10319
10435
|
const clock = fiber.getRef(ClockRef);
|
|
10320
10436
|
const timingEnabled = fiber.getRef(TracerTimingEnabled$1);
|
|
@@ -11007,7 +11123,7 @@ const makeUnsafe$8 = () => new DeferredImpl();
|
|
|
11007
11123
|
* @category constructors
|
|
11008
11124
|
* @since 2.0.0
|
|
11009
11125
|
*/
|
|
11010
|
-
const make$
|
|
11126
|
+
const make$68 = () => sync$1(() => makeUnsafe$8());
|
|
11011
11127
|
const _await = (self) => callback$2((resume) => {
|
|
11012
11128
|
if (self.effect) return resume(self.effect);
|
|
11013
11129
|
self.resumes ??= [];
|
|
@@ -11512,7 +11628,7 @@ const Scope = scopeTag;
|
|
|
11512
11628
|
* @category constructors
|
|
11513
11629
|
* @since 2.0.0
|
|
11514
11630
|
*/
|
|
11515
|
-
const make$
|
|
11631
|
+
const make$67 = scopeMake;
|
|
11516
11632
|
/**
|
|
11517
11633
|
* Creates a new `Scope` synchronously without wrapping it in an `Effect`.
|
|
11518
11634
|
* This is useful when you need a scope immediately but should be used with caution
|
|
@@ -12125,7 +12241,7 @@ const buildWithMemoMap = /*#__PURE__*/ dual(3, (self, memoMap, scope) => provide
|
|
|
12125
12241
|
* @category destructors
|
|
12126
12242
|
* @since 2.0.0
|
|
12127
12243
|
*/
|
|
12128
|
-
const build = (self) => withFiber$1((fiber) => buildWithMemoMap(self, CurrentMemoMap.forkOrCreate(fiber.context), getUnsafe$
|
|
12244
|
+
const build = (self) => withFiber$1((fiber) => buildWithMemoMap(self, CurrentMemoMap.forkOrCreate(fiber.context), getUnsafe$2(fiber.context, Scope)));
|
|
12129
12245
|
/**
|
|
12130
12246
|
* Builds a layer using an explicit scope.
|
|
12131
12247
|
*
|
|
@@ -12212,8 +12328,8 @@ const buildWithScope = /*#__PURE__*/ dual(2, (self, scope) => withFiber$1((fiber
|
|
|
12212
12328
|
* @since 2.0.0
|
|
12213
12329
|
*/
|
|
12214
12330
|
const succeed$5 = function() {
|
|
12215
|
-
if (arguments.length === 1) return (resource) => succeedContext(make$
|
|
12216
|
-
return succeedContext(make$
|
|
12331
|
+
if (arguments.length === 1) return (resource) => succeedContext(make$71(arguments[0], resource));
|
|
12332
|
+
return succeedContext(make$71(arguments[0], arguments[1]));
|
|
12217
12333
|
};
|
|
12218
12334
|
/**
|
|
12219
12335
|
* Constructs a layer that provides all services in an already available
|
|
@@ -12307,7 +12423,7 @@ const effect = function() {
|
|
|
12307
12423
|
if (arguments.length === 1) return (effect) => effectImpl(arguments[0], effect);
|
|
12308
12424
|
return effectImpl(arguments[0], arguments[1]);
|
|
12309
12425
|
};
|
|
12310
|
-
const effectImpl = (service, effect) => effectContext(map$4(effect, (value) => make$
|
|
12426
|
+
const effectImpl = (service, effect) => effectContext(map$4(effect, (value) => make$71(service, value)));
|
|
12311
12427
|
/**
|
|
12312
12428
|
* Constructs a layer from an effect that produces all services in a `Context`.
|
|
12313
12429
|
*
|
|
@@ -12415,7 +12531,7 @@ const unwrapKey = /*#__PURE__*/ Service$2("effect/Layer/unwrap");
|
|
|
12415
12531
|
* @category converting
|
|
12416
12532
|
* @since 4.0.0
|
|
12417
12533
|
*/
|
|
12418
|
-
const unwrap$5 = (self) => flatMap$2(effect(unwrapKey)(self), get$
|
|
12534
|
+
const unwrap$5 = (self) => flatMap$2(effect(unwrapKey)(self), get$10(unwrapKey));
|
|
12419
12535
|
const mergeAllEffect = (layers, memoMap, scope) => {
|
|
12420
12536
|
const parentScope = forkUnsafe(scope, "parallel");
|
|
12421
12537
|
return forEach$2(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$4((context) => mergeAll$2(...context)));
|
|
@@ -13788,7 +13904,7 @@ const makeUnsafe$6 = (input) => {
|
|
|
13788
13904
|
*/
|
|
13789
13905
|
const hasZone = (input) => /Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(input);
|
|
13790
13906
|
/** @internal */
|
|
13791
|
-
const make$
|
|
13907
|
+
const make$66 = /*#__PURE__*/ liftThrowable(makeUnsafe$6);
|
|
13792
13908
|
/** @internal */
|
|
13793
13909
|
const toUtc$1 = (self) => makeUtc(self.epochMilliseconds);
|
|
13794
13910
|
/** @internal */
|
|
@@ -13946,6 +14062,27 @@ const toLowerCase = (self) => self.toLowerCase();
|
|
|
13946
14062
|
*/
|
|
13947
14063
|
const isNonEmpty$1 = (self) => self.length > 0;
|
|
13948
14064
|
/**
|
|
14065
|
+
* Splits a string into an array of substrings using a separator.
|
|
14066
|
+
*
|
|
14067
|
+
* **Example** (Splitting strings)
|
|
14068
|
+
*
|
|
14069
|
+
* ```ts import.meta.vitest
|
|
14070
|
+
* import { pipe, String } from "effect"
|
|
14071
|
+
*
|
|
14072
|
+
* pipe("abc", String.split("")) // => ["a", "b", "c"]
|
|
14073
|
+
* pipe("", String.split("")) // => [""]
|
|
14074
|
+
* String.split("hello,world", ",") // => ["hello", "world"]
|
|
14075
|
+
* ```
|
|
14076
|
+
*
|
|
14077
|
+
* @stability stable
|
|
14078
|
+
* @category transforming
|
|
14079
|
+
* @since 2.0.0
|
|
14080
|
+
*/
|
|
14081
|
+
const split = /*#__PURE__*/ dual(2, (self, separator) => {
|
|
14082
|
+
const out = self.split(separator);
|
|
14083
|
+
return isArrayNonEmpty$1(out) ? out : [self];
|
|
14084
|
+
});
|
|
14085
|
+
/**
|
|
13949
14086
|
* Returns `true` if `searchString` appears as a substring of `self`, at one or more positions that are
|
|
13950
14087
|
* greater than or equal to `position`; otherwise, returns `false`.
|
|
13951
14088
|
*
|
|
@@ -14284,7 +14421,7 @@ const empty$9 = () => {
|
|
|
14284
14421
|
* @category getters
|
|
14285
14422
|
* @since 2.0.0
|
|
14286
14423
|
*/
|
|
14287
|
-
const get$
|
|
14424
|
+
const get$7 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
14288
14425
|
if (self.backing.has(key)) return some$1(self.backing.get(key));
|
|
14289
14426
|
else if (isSimpleKey(key)) return none();
|
|
14290
14427
|
const hash$3 = hash(key);
|
|
@@ -19513,7 +19650,7 @@ const binaryUnits = [
|
|
|
19513
19650
|
const allUnits = [...decimalUnits, .../*#__PURE__*/ binaryUnits.slice(1)];
|
|
19514
19651
|
const unitsByName = /*#__PURE__*/ new Map(/*#__PURE__*/ allUnits.flatMap((unit) => unit.names.map((name) => [name, unit])));
|
|
19515
19652
|
const unitsBySymbol = /*#__PURE__*/ new Map(/*#__PURE__*/ allUnits.map((unit) => [unit.symbol, unit]));
|
|
19516
|
-
const make$
|
|
19653
|
+
const make$65 = (value) => value;
|
|
19517
19654
|
/**
|
|
19518
19655
|
* The byte size containing zero bytes.
|
|
19519
19656
|
*
|
|
@@ -19521,22 +19658,22 @@ const make$64 = (value) => value;
|
|
|
19521
19658
|
* @category constants
|
|
19522
19659
|
* @since 4.0.0
|
|
19523
19660
|
*/
|
|
19524
|
-
const zero$1 = /*#__PURE__*/ make$
|
|
19661
|
+
const zero$1 = /*#__PURE__*/ make$65(bigint0$1);
|
|
19525
19662
|
const invalid$1 = (message) => {
|
|
19526
19663
|
throw new Error(`Invalid ByteSize: ${message}`);
|
|
19527
19664
|
};
|
|
19528
19665
|
const fromNumber = (input) => {
|
|
19529
19666
|
if (!Number.isSafeInteger(input) || input < 0) return invalid$1(`expected a non-negative safe integer, received ${input}`);
|
|
19530
|
-
return make$
|
|
19667
|
+
return make$65(BigInt(input));
|
|
19531
19668
|
};
|
|
19532
19669
|
const fromQuantity = (quantity, unit) => {
|
|
19533
19670
|
if (typeof quantity === "bigint") {
|
|
19534
19671
|
if (quantity < bigint0$1) return invalid$1(`expected a non-negative quantity, received ${quantity}`);
|
|
19535
|
-
return make$
|
|
19672
|
+
return make$65(quantity * unit.factor);
|
|
19536
19673
|
}
|
|
19537
19674
|
const value = quantity * Number(unit.factor);
|
|
19538
19675
|
if (!Number.isSafeInteger(value) || value < 0) return invalid$1(`expected an exact non-negative safe-integer byte result, received ${quantity} ${unit.symbol}`);
|
|
19539
|
-
return make$
|
|
19676
|
+
return make$65(BigInt(value));
|
|
19540
19677
|
};
|
|
19541
19678
|
/**
|
|
19542
19679
|
* Parses a byte-size string and throws for invalid syntax, unsupported units,
|
|
@@ -19562,7 +19699,7 @@ const fromStringUnsafe = (input) => {
|
|
|
19562
19699
|
const scale = BigInt(10) ** BigInt(fraction.length);
|
|
19563
19700
|
const numerator = BigInt(match[1] + fraction) * unit.factor;
|
|
19564
19701
|
if (numerator % scale !== bigint0$1) return invalid$1(`${JSON.stringify(input)} does not represent an integral number of bytes`);
|
|
19565
|
-
return make$
|
|
19702
|
+
return make$65(numerator / scale);
|
|
19566
19703
|
};
|
|
19567
19704
|
/**
|
|
19568
19705
|
* Decodes a trusted input into a byte size and throws for invalid input.
|
|
@@ -19575,7 +19712,7 @@ const fromInputUnsafe = (input) => {
|
|
|
19575
19712
|
switch (typeof input) {
|
|
19576
19713
|
case "bigint":
|
|
19577
19714
|
if (input < bigint0$1) return invalid$1(`expected a non-negative bigint, received ${input}`);
|
|
19578
|
-
return make$
|
|
19715
|
+
return make$65(input);
|
|
19579
19716
|
case "number": return fromNumber(input);
|
|
19580
19717
|
case "string": return fromStringUnsafe(input);
|
|
19581
19718
|
}
|
|
@@ -19968,7 +20105,7 @@ const makeUnsafe$5 = makeLatchUnsafe;
|
|
|
19968
20105
|
* @category constructors
|
|
19969
20106
|
* @since 4.0.0
|
|
19970
20107
|
*/
|
|
19971
|
-
const make$
|
|
20108
|
+
const make$64 = makeLatch;
|
|
19972
20109
|
// ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/MutableRef.js
|
|
19973
20110
|
const TypeId$45 = "~effect/MutableRef";
|
|
19974
20111
|
const MutableRefProto = {
|
|
@@ -20014,7 +20151,7 @@ const MutableRefProto = {
|
|
|
20014
20151
|
* @category constructors
|
|
20015
20152
|
* @since 2.0.0
|
|
20016
20153
|
*/
|
|
20017
|
-
const make$
|
|
20154
|
+
const make$63 = (value) => {
|
|
20018
20155
|
const ref = Object.create(MutableRefProto);
|
|
20019
20156
|
ref.current = value;
|
|
20020
20157
|
return ref;
|
|
@@ -20130,7 +20267,7 @@ const Empty$2 = /*#__PURE__*/ Symbol.for("effect/MutableList/Empty");
|
|
|
20130
20267
|
* @category constructors
|
|
20131
20268
|
* @since 2.0.0
|
|
20132
20269
|
*/
|
|
20133
|
-
const make$
|
|
20270
|
+
const make$62 = () => ({
|
|
20134
20271
|
head: void 0,
|
|
20135
20272
|
tail: void 0,
|
|
20136
20273
|
length: 0
|
|
@@ -20530,7 +20667,7 @@ const SubscriptionTypeId = "~effect/PubSub/Subscription";
|
|
|
20530
20667
|
* @category constructors
|
|
20531
20668
|
* @since 4.0.0
|
|
20532
20669
|
*/
|
|
20533
|
-
const make$
|
|
20670
|
+
const make$61 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(), /* @__PURE__ */ new Map(), makeUnsafe$7(), makeUnsafe$5(false), make$63(false), options.strategy(), make$63(none())));
|
|
20534
20671
|
/**
|
|
20535
20672
|
* Creates an unbounded `PubSub`.
|
|
20536
20673
|
*
|
|
@@ -20561,7 +20698,7 @@ const make$60 = (options) => sync(() => makePubSubUnsafe(options.atomicPubSub(),
|
|
|
20561
20698
|
* @category constructors
|
|
20562
20699
|
* @since 2.0.0
|
|
20563
20700
|
*/
|
|
20564
|
-
const unbounded = (options) => make$
|
|
20701
|
+
const unbounded = (options) => make$61({
|
|
20565
20702
|
atomicPubSub: () => makeAtomicUnbounded(options),
|
|
20566
20703
|
strategy: () => new DroppingStrategy()
|
|
20567
20704
|
});
|
|
@@ -20694,7 +20831,7 @@ const publish = /*#__PURE__*/ dual(2, (self, value) => suspend$2(() => {
|
|
|
20694
20831
|
* @since 2.0.0
|
|
20695
20832
|
*/
|
|
20696
20833
|
const subscribe = (self) => uninterruptible(contextWith((services) => {
|
|
20697
|
-
const localScope = get$
|
|
20834
|
+
const localScope = get$10(services, Scope);
|
|
20698
20835
|
const scope = forkUnsafe(self.scope);
|
|
20699
20836
|
const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy, self.ended);
|
|
20700
20837
|
return addFinalizer$1(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
|
|
@@ -20790,7 +20927,7 @@ const removeSubscribers = (subscribers, subscription, pollers) => {
|
|
|
20790
20927
|
set.delete(pollers);
|
|
20791
20928
|
if (set.size === 0) subscribers.delete(subscription);
|
|
20792
20929
|
};
|
|
20793
|
-
const makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$
|
|
20930
|
+
const makeSubscriptionUnsafe = (pubsub, subscribers, strategy, ended) => new SubscriptionImpl(pubsub, subscribers, pubsub.subscribe(), make$62(), makeUnsafe$5(false), make$63(false), strategy, pubsub.replayWindow(), ended);
|
|
20794
20931
|
var UnboundedPubSub = class {
|
|
20795
20932
|
publisherHead = {
|
|
20796
20933
|
value: AbsentValue,
|
|
@@ -21252,12 +21389,12 @@ const QueueProto = {
|
|
|
21252
21389
|
* @category constructors
|
|
21253
21390
|
* @since 4.0.0
|
|
21254
21391
|
*/
|
|
21255
|
-
const make$
|
|
21392
|
+
const make$60 = (options) => withFiber$1((fiber) => {
|
|
21256
21393
|
const self = Object.create(QueueProto);
|
|
21257
21394
|
self.dispatcher = fiber.currentDispatcher;
|
|
21258
21395
|
self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
|
|
21259
21396
|
self.strategy = options?.strategy ?? "suspend";
|
|
21260
|
-
self.messages = make$
|
|
21397
|
+
self.messages = make$62();
|
|
21261
21398
|
self.scheduleRunning = false;
|
|
21262
21399
|
self.state = {
|
|
21263
21400
|
_tag: "Open",
|
|
@@ -21298,7 +21435,7 @@ const make$59 = (options) => withFiber$1((fiber) => {
|
|
|
21298
21435
|
* @category constructors
|
|
21299
21436
|
* @since 2.0.0
|
|
21300
21437
|
*/
|
|
21301
|
-
const bounded = (capacity) => make$
|
|
21438
|
+
const bounded = (capacity) => make$60({ capacity });
|
|
21302
21439
|
/**
|
|
21303
21440
|
* Creates a bounded queue with dropping strategy. When the queue reaches capacity,
|
|
21304
21441
|
* new elements are dropped and the offer operation returns false.
|
|
@@ -21334,7 +21471,7 @@ const bounded = (capacity) => make$59({ capacity });
|
|
|
21334
21471
|
* @category constructors
|
|
21335
21472
|
* @since 2.0.0
|
|
21336
21473
|
*/
|
|
21337
|
-
const dropping = (capacity) => make$
|
|
21474
|
+
const dropping = (capacity) => make$60({
|
|
21338
21475
|
capacity,
|
|
21339
21476
|
strategy: "dropping"
|
|
21340
21477
|
});
|
|
@@ -22367,7 +22504,7 @@ var SemaphoreImpl = class {
|
|
|
22367
22504
|
* @category constructors
|
|
22368
22505
|
* @since 4.0.0
|
|
22369
22506
|
*/
|
|
22370
|
-
const make$
|
|
22507
|
+
const make$59 = (permits) => sync$1(() => new SemaphoreImpl(permits));
|
|
22371
22508
|
/**
|
|
22372
22509
|
* Runs an effect with a single permit and releases the permit when the effect
|
|
22373
22510
|
* completes.
|
|
@@ -22556,7 +22693,7 @@ const fromTransformBracket = (f) => fromTransform$1(fnUntraced(function* (upstre
|
|
|
22556
22693
|
* @since 4.0.0
|
|
22557
22694
|
*/
|
|
22558
22695
|
const toTransform = (channel) => channel.transform;
|
|
22559
|
-
const asyncQueue = (scope, f, options) => make$
|
|
22696
|
+
const asyncQueue = (scope, f, options) => make$60({
|
|
22560
22697
|
capacity: options?.bufferSize,
|
|
22561
22698
|
strategy: options?.strategy
|
|
22562
22699
|
}).pipe(tap((queue) => addFinalizer$1(scope, shutdown(queue))), tap((queue) => provide$3(f(queue), scope).pipe(catchCause$1((cause) => failCause$2(queue, cause)), forkIn(scope))));
|
|
@@ -22806,7 +22943,7 @@ const fromReadableStream$1 = (options) => fromTransform$1((_, scope) => readable
|
|
|
22806
22943
|
}));
|
|
22807
22944
|
const readableStreamToPullUnsafe = (options) => {
|
|
22808
22945
|
const reader = options.readable.getReader();
|
|
22809
|
-
const exit = options.exit ?? make$
|
|
22946
|
+
const exit = options.exit ?? make$63(void 0);
|
|
22810
22947
|
const pull = suspend$2(() => {
|
|
22811
22948
|
if (exit.current) return exit.current;
|
|
22812
22949
|
return matchCauseEffect(tryPromise({
|
|
@@ -23265,7 +23402,7 @@ const orDie$1 = (self) => catch_$1(self, die);
|
|
|
23265
23402
|
const mergeAll = /*#__PURE__*/ dual(2, (channels, { bufferSize = 16, concurrency, switch: switch_ = false }) => fromTransformBracket(fnUntraced(function* (upstream, scope, forkedScope) {
|
|
23266
23403
|
const concurrencyN = concurrency === "unbounded" ? Number.MAX_SAFE_INTEGER : Math.max(1, concurrency);
|
|
23267
23404
|
const semaphore = switch_ ? void 0 : makeUnsafe$4(concurrencyN);
|
|
23268
|
-
const doneLatch = yield* make$
|
|
23405
|
+
const doneLatch = yield* make$64(true);
|
|
23269
23406
|
const fibers = /* @__PURE__ */ new Set();
|
|
23270
23407
|
const queue = yield* bounded(bufferSize);
|
|
23271
23408
|
yield* addFinalizer$1(forkedScope, shutdown(queue));
|
|
@@ -24091,9 +24228,9 @@ const makeUnsafe$3 = (options) => ({
|
|
|
24091
24228
|
* @category constructors
|
|
24092
24229
|
* @since 3.5.0
|
|
24093
24230
|
*/
|
|
24094
|
-
const make$
|
|
24231
|
+
const make$58 = (options) => withFiber((fiber) => {
|
|
24095
24232
|
const context = fiber.context;
|
|
24096
|
-
const scope = get$
|
|
24233
|
+
const scope = get$10(context, Scope);
|
|
24097
24234
|
const self = makeUnsafe$3({
|
|
24098
24235
|
lookup: options.lookup,
|
|
24099
24236
|
context,
|
|
@@ -24156,11 +24293,11 @@ const make$57 = (options) => withFiber((fiber) => {
|
|
|
24156
24293
|
* @category combinators
|
|
24157
24294
|
* @since 3.5.0
|
|
24158
24295
|
*/
|
|
24159
|
-
const get$
|
|
24296
|
+
const get$6 = /*#__PURE__*/ dual(2, (self, key) => uninterruptibleMask((restore) => {
|
|
24160
24297
|
if (self.state._tag === "Closed") return interrupt$1;
|
|
24161
24298
|
const state = self.state;
|
|
24162
24299
|
const parent = getCurrent();
|
|
24163
|
-
const o = get$
|
|
24300
|
+
const o = get$7(state.map, key);
|
|
24164
24301
|
let entry;
|
|
24165
24302
|
if (o._tag === "Some") {
|
|
24166
24303
|
entry = o.value;
|
|
@@ -24189,12 +24326,12 @@ const get$5 = /*#__PURE__*/ dual(2, (self, key) => uninterruptibleMask((restore)
|
|
|
24189
24326
|
doneUnsafe(entry.deferred, exit);
|
|
24190
24327
|
});
|
|
24191
24328
|
}
|
|
24192
|
-
const scope = getUnsafe$
|
|
24329
|
+
const scope = getUnsafe$2(parent.context, Scope);
|
|
24193
24330
|
return addFinalizer$1(scope, entry.finalizer).pipe(andThen(restore(_await(entry.deferred))));
|
|
24194
24331
|
}));
|
|
24195
24332
|
const removeInterrupted = (self, key, entry, context) => {
|
|
24196
24333
|
if (self.state._tag === "Closed") return;
|
|
24197
|
-
const o = get$
|
|
24334
|
+
const o = get$7(self.state.map, key);
|
|
24198
24335
|
if (o._tag === "None" || o.value !== entry) return;
|
|
24199
24336
|
remove$3(self.state.map, key);
|
|
24200
24337
|
if (entry.refCount > 0) return;
|
|
@@ -24205,7 +24342,7 @@ const release$1 = (self, key, entry) => withFiber((fiber) => {
|
|
|
24205
24342
|
entry.refCount--;
|
|
24206
24343
|
if (entry.refCount > 0) return void_$1;
|
|
24207
24344
|
else if (self.state._tag === "Closed") return closeEntry(entry);
|
|
24208
|
-
const o = get$
|
|
24345
|
+
const o = get$7(self.state.map, key);
|
|
24209
24346
|
if (o._tag === "None" || o.value !== entry) return closeEntry(entry);
|
|
24210
24347
|
else if (isZero$1(entry.idleTimeToLive)) {
|
|
24211
24348
|
remove$3(self.state.map, key);
|
|
@@ -24219,7 +24356,7 @@ const release$1 = (self, key, entry) => withFiber((fiber) => {
|
|
|
24219
24356
|
const remaining = entry.expiresAt - now;
|
|
24220
24357
|
if (remaining <= 0) {
|
|
24221
24358
|
if (self.state._tag === "Closed" || entry.refCount > 0) return void_$1;
|
|
24222
|
-
const o = get$
|
|
24359
|
+
const o = get$7(self.state.map, key);
|
|
24223
24360
|
if (o._tag === "None" || o.value !== entry) return void_$1;
|
|
24224
24361
|
remove$3(self.state.map, key);
|
|
24225
24362
|
return close(entry.scope, void_$2);
|
|
@@ -24256,9 +24393,9 @@ var RcRefImpl = class {
|
|
|
24256
24393
|
}
|
|
24257
24394
|
};
|
|
24258
24395
|
/** @internal */
|
|
24259
|
-
const make$
|
|
24396
|
+
const make$57 = (options) => withFiber((fiber) => {
|
|
24260
24397
|
const context = fiber.context;
|
|
24261
|
-
const scope = get$
|
|
24398
|
+
const scope = get$10(context, Scope);
|
|
24262
24399
|
const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== void 0 ? fromInputUnsafe$1(options.idleTimeToLive) : void 0);
|
|
24263
24400
|
return as(addFinalizerExit(scope, () => {
|
|
24264
24401
|
const state = ref.state;
|
|
@@ -24321,7 +24458,7 @@ const awaitAcquiring = (self, acquiring, restore) => onExit$1(restore(join(acqui
|
|
|
24321
24458
|
return interrupt(acquiring.fiber);
|
|
24322
24459
|
});
|
|
24323
24460
|
/** @internal */
|
|
24324
|
-
const get$
|
|
24461
|
+
const get$5 = (self_) => {
|
|
24325
24462
|
const self = self_;
|
|
24326
24463
|
return uninterruptibleMask((restore) => flatMap$1(scope, (scope) => flatMap$1(getState(self, restore), (state) => as(addFinalizerExit(scope, () => release(self, state)), state.value))));
|
|
24327
24464
|
};
|
|
@@ -24392,7 +24529,7 @@ const release = (self, state) => {
|
|
|
24392
24529
|
* @category constructors
|
|
24393
24530
|
* @since 3.5.0
|
|
24394
24531
|
*/
|
|
24395
|
-
const make$
|
|
24532
|
+
const make$56 = make$57;
|
|
24396
24533
|
/**
|
|
24397
24534
|
* Gets the value from an `RcRef`, acquiring it first if needed.
|
|
24398
24535
|
*
|
|
@@ -24438,7 +24575,7 @@ const make$55 = make$56;
|
|
|
24438
24575
|
* @category combinators
|
|
24439
24576
|
* @since 3.5.0
|
|
24440
24577
|
*/
|
|
24441
|
-
const get$
|
|
24578
|
+
const get$4 = get$5;
|
|
24442
24579
|
// ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Stream.js
|
|
24443
24580
|
/**
|
|
24444
24581
|
* Describes effectful sources that emit values over time.
|
|
@@ -25694,7 +25831,7 @@ const FileSystem = /*#__PURE__*/ Service$2("effect/FileSystem");
|
|
|
25694
25831
|
* @category constructors
|
|
25695
25832
|
* @since 4.0.0
|
|
25696
25833
|
*/
|
|
25697
|
-
const make$
|
|
25834
|
+
const make$55 = (impl) => FileSystem.of({
|
|
25698
25835
|
...impl,
|
|
25699
25836
|
[TypeId$36]: TypeId$36,
|
|
25700
25837
|
exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$4(false) : fail$3(e))),
|
|
@@ -25915,7 +26052,7 @@ const Path$1 = /*#__PURE__*/ Service$2("effect/Path");
|
|
|
25915
26052
|
* @category constructors
|
|
25916
26053
|
* @since 4.0.0
|
|
25917
26054
|
*/
|
|
25918
|
-
const make$
|
|
26055
|
+
const make$54 = (impl) => Path$1.of({
|
|
25919
26056
|
...impl,
|
|
25920
26057
|
[TypeId$35]: TypeId$35,
|
|
25921
26058
|
resolveWithin(root, input) {
|
|
@@ -26635,7 +26772,7 @@ const makeUnsafe$2 = makeUnsafe$6;
|
|
|
26635
26772
|
* @category constructors
|
|
26636
26773
|
* @since 3.6.0
|
|
26637
26774
|
*/
|
|
26638
|
-
const make$
|
|
26775
|
+
const make$53 = make$66;
|
|
26639
26776
|
/**
|
|
26640
26777
|
* Converts a `DateTime` to a UTC `DateTime`.
|
|
26641
26778
|
*
|
|
@@ -27432,7 +27569,7 @@ const isBigDecimal = (u) => hasProperty(u, TypeId$33);
|
|
|
27432
27569
|
* @category constructors
|
|
27433
27570
|
* @since 2.0.0
|
|
27434
27571
|
*/
|
|
27435
|
-
const make$
|
|
27572
|
+
const make$52 = (value, scale) => {
|
|
27436
27573
|
if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
|
|
27437
27574
|
const o = Object.create(BigDecimalProto);
|
|
27438
27575
|
o.value = value;
|
|
@@ -27440,7 +27577,7 @@ const make$51 = (value, scale) => {
|
|
|
27440
27577
|
return o;
|
|
27441
27578
|
};
|
|
27442
27579
|
const makeNormalized = (value, scale) => {
|
|
27443
|
-
const o = make$
|
|
27580
|
+
const o = make$52(value, scale);
|
|
27444
27581
|
o.normalized = o;
|
|
27445
27582
|
return o;
|
|
27446
27583
|
};
|
|
@@ -30375,7 +30512,7 @@ const makeHandle = (params) => Object.setPrototypeOf({ ...params }, HandleProto)
|
|
|
30375
30512
|
* @category constructors
|
|
30376
30513
|
* @since 4.0.0
|
|
30377
30514
|
*/
|
|
30378
|
-
const make$
|
|
30515
|
+
const make$51 = (spawn) => {
|
|
30379
30516
|
const streamString = (command, options) => spawn(command).pipe(map$2((handle) => decodeText$1(options?.includeStderr === true ? handle.all : handle.stdout)), unwrap$2);
|
|
30380
30517
|
const streamLines = (command, options) => splitLines(streamString(command, options));
|
|
30381
30518
|
return ChildProcessSpawner.of({
|
|
@@ -30413,7 +30550,7 @@ const Proto$15 = {
|
|
|
30413
30550
|
.../*#__PURE__*/ Prototype({
|
|
30414
30551
|
label: "Command",
|
|
30415
30552
|
evaluate(fiber) {
|
|
30416
|
-
return getUnsafe$
|
|
30553
|
+
return getUnsafe$2(fiber.context, ChildProcessSpawner).spawn(this);
|
|
30417
30554
|
}
|
|
30418
30555
|
}),
|
|
30419
30556
|
[TypeId$30]: TypeId$30
|
|
@@ -30458,7 +30595,7 @@ const makeStandardCommand = (command, args, options) => Object.assign(Object.cre
|
|
|
30458
30595
|
* @category constructors
|
|
30459
30596
|
* @since 4.0.0
|
|
30460
30597
|
*/
|
|
30461
|
-
const make$
|
|
30598
|
+
const make$50 = function make(...args) {
|
|
30462
30599
|
if (isTemplateString(args[0])) {
|
|
30463
30600
|
const [templates, ...expressions] = args;
|
|
30464
30601
|
const tokens = parseTemplates(templates, expressions);
|
|
@@ -30786,7 +30923,7 @@ const fromReadableChannel = (options) => fromTransform$1((_, scope) => readableT
|
|
|
30786
30923
|
*/
|
|
30787
30924
|
const fromDuplex = (options) => fromTransform$1((upstream, scope) => {
|
|
30788
30925
|
const duplex = options.evaluate();
|
|
30789
|
-
const exit = make$
|
|
30926
|
+
const exit = make$63(void 0);
|
|
30790
30927
|
const latch = makeUnsafe$5(false);
|
|
30791
30928
|
return pullIntoWritable({
|
|
30792
30929
|
pull: upstream,
|
|
@@ -30867,7 +31004,7 @@ const toUint8Array = (readable, options) => map$2(toArrayBuffer(readable, option
|
|
|
30867
31004
|
const readableToPullUnsafe = (options) => {
|
|
30868
31005
|
const readable = options.readable;
|
|
30869
31006
|
const closeOnDone = options.closeOnDone ?? true;
|
|
30870
|
-
const exit = options.exit ?? make$
|
|
31007
|
+
const exit = options.exit ?? make$63(void 0);
|
|
30871
31008
|
const latch = options.latch ?? makeUnsafe$5(false);
|
|
30872
31009
|
function onReadable() {
|
|
30873
31010
|
latch.openUnsafe();
|
|
@@ -31283,7 +31420,7 @@ const layer$17 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
31283
31420
|
const stdinConfig = resolveStdinOption(command.options);
|
|
31284
31421
|
const sourceStream = unwrap$2(succeed$4(getSourceStream(handles[handles.length - 1], options.from)));
|
|
31285
31422
|
const toOption = options.to ?? "stdin";
|
|
31286
|
-
if (toOption === "stdin") handles.push(yield* spawnCommand(make$
|
|
31423
|
+
if (toOption === "stdin") handles.push(yield* spawnCommand(make$50(command.command, command.args, {
|
|
31287
31424
|
...command.options,
|
|
31288
31425
|
stdin: {
|
|
31289
31426
|
...stdinConfig,
|
|
@@ -31295,7 +31432,7 @@ const layer$17 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
31295
31432
|
if (isNotUndefined(fd)) {
|
|
31296
31433
|
const fdName$1 = fdName(fd);
|
|
31297
31434
|
const existingFds = command.options.additionalFds ?? {};
|
|
31298
|
-
handles.push(yield* spawnCommand(make$
|
|
31435
|
+
handles.push(yield* spawnCommand(make$50(command.command, command.args, {
|
|
31299
31436
|
...command.options,
|
|
31300
31437
|
additionalFds: {
|
|
31301
31438
|
...existingFds,
|
|
@@ -31305,7 +31442,7 @@ const layer$17 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
31305
31442
|
}
|
|
31306
31443
|
}
|
|
31307
31444
|
})));
|
|
31308
|
-
} else handles.push(yield* spawnCommand(make$
|
|
31445
|
+
} else handles.push(yield* spawnCommand(make$50(command.command, command.args, {
|
|
31309
31446
|
...command.options,
|
|
31310
31447
|
stdin: {
|
|
31311
31448
|
...stdinConfig,
|
|
@@ -31337,7 +31474,7 @@ const layer$17 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
31337
31474
|
}
|
|
31338
31475
|
}
|
|
31339
31476
|
});
|
|
31340
|
-
return make$
|
|
31477
|
+
return make$51(spawnCommand);
|
|
31341
31478
|
}));
|
|
31342
31479
|
/**
|
|
31343
31480
|
* Flattens a `Command` into an array of `StandardCommand`s along with pipe
|
|
@@ -31370,6 +31507,19 @@ const flattenCommand = (command) => {
|
|
|
31370
31507
|
};
|
|
31371
31508
|
};
|
|
31372
31509
|
// ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Ref.js
|
|
31510
|
+
/**
|
|
31511
|
+
* Stores fiber-safe mutable state inside Effect programs.
|
|
31512
|
+
*
|
|
31513
|
+
* A `Ref<A>` holds one value and exposes reads, writes, and atomic
|
|
31514
|
+
* transformations as effects, so state changes compose with Effect's
|
|
31515
|
+
* concurrency model. This module includes constructors, safe and unsafe reads,
|
|
31516
|
+
* set and get-and-set helpers, update and modify helpers, and conditional
|
|
31517
|
+
* update variants that leave the value unchanged when an `Option.none` result
|
|
31518
|
+
* is returned.
|
|
31519
|
+
*
|
|
31520
|
+
* @stability stable
|
|
31521
|
+
* @since 2.0.0
|
|
31522
|
+
*/
|
|
31373
31523
|
const RefProto = {
|
|
31374
31524
|
["~effect/Ref"]: { _A: identity },
|
|
31375
31525
|
...PipeInspectableProto,
|
|
@@ -31407,9 +31557,102 @@ const RefProto = {
|
|
|
31407
31557
|
*/
|
|
31408
31558
|
const makeUnsafe$1 = (value) => {
|
|
31409
31559
|
const self = Object.create(RefProto);
|
|
31410
|
-
self.ref = make$
|
|
31560
|
+
self.ref = make$63(value);
|
|
31411
31561
|
return self;
|
|
31412
31562
|
};
|
|
31563
|
+
/**
|
|
31564
|
+
* Creates a new Ref with the specified initial value.
|
|
31565
|
+
*
|
|
31566
|
+
* **When to use**
|
|
31567
|
+
*
|
|
31568
|
+
* Use to create a `Ref` for shared mutable state inside an Effect program.
|
|
31569
|
+
*
|
|
31570
|
+
* **Example** (Creating a ref)
|
|
31571
|
+
*
|
|
31572
|
+
* ```ts import.meta.vitest
|
|
31573
|
+
* import { Effect, Ref } from "effect"
|
|
31574
|
+
*
|
|
31575
|
+
* const program = Effect.gen(function*() {
|
|
31576
|
+
* const ref = yield* Ref.make(42)
|
|
31577
|
+
* return yield* Ref.get(ref)
|
|
31578
|
+
* })
|
|
31579
|
+
*
|
|
31580
|
+
* await Effect.runPromise(program) // => 42
|
|
31581
|
+
* ```
|
|
31582
|
+
*
|
|
31583
|
+
* @see {@link makeUnsafe} for synchronous construction outside Effect code
|
|
31584
|
+
*
|
|
31585
|
+
* @stability stable
|
|
31586
|
+
* @category constructors
|
|
31587
|
+
* @since 2.0.0
|
|
31588
|
+
*/
|
|
31589
|
+
const make$48 = (value) => sync(() => makeUnsafe$1(value));
|
|
31590
|
+
/**
|
|
31591
|
+
* Gets the current value of the Ref.
|
|
31592
|
+
*
|
|
31593
|
+
* **When to use**
|
|
31594
|
+
*
|
|
31595
|
+
* Use to read the current `Ref` value without changing it.
|
|
31596
|
+
*
|
|
31597
|
+
* **Example** (Getting the current value)
|
|
31598
|
+
*
|
|
31599
|
+
* ```ts import.meta.vitest
|
|
31600
|
+
* import { Effect, Ref } from "effect"
|
|
31601
|
+
*
|
|
31602
|
+
* const program = Effect.gen(function*() {
|
|
31603
|
+
* const ref = yield* Ref.make(42)
|
|
31604
|
+
* return yield* Ref.get(ref)
|
|
31605
|
+
* })
|
|
31606
|
+
*
|
|
31607
|
+
* await Effect.runPromise(program) // => 42
|
|
31608
|
+
* ```
|
|
31609
|
+
*
|
|
31610
|
+
* @see {@link set} for replacing the current value
|
|
31611
|
+
*
|
|
31612
|
+
* @stability stable
|
|
31613
|
+
* @category getters
|
|
31614
|
+
* @since 2.0.0
|
|
31615
|
+
*/
|
|
31616
|
+
const get$3 = (self) => sync(() => self.ref.current);
|
|
31617
|
+
/**
|
|
31618
|
+
* Updates the value of the Ref atomically using the given function.
|
|
31619
|
+
*
|
|
31620
|
+
* **When to use**
|
|
31621
|
+
*
|
|
31622
|
+
* Use to apply a `Ref` state transition without returning a value.
|
|
31623
|
+
*
|
|
31624
|
+
* **Example** (Updating a value)
|
|
31625
|
+
*
|
|
31626
|
+
* ```ts import.meta.vitest
|
|
31627
|
+
* import { Effect, Ref } from "effect"
|
|
31628
|
+
*
|
|
31629
|
+
* const program = Effect.gen(function*() {
|
|
31630
|
+
* const counter = yield* Ref.make(5)
|
|
31631
|
+
*
|
|
31632
|
+
* yield* Ref.update(counter, (n) => n * 2)
|
|
31633
|
+
* return yield* Ref.get(counter)
|
|
31634
|
+
* })
|
|
31635
|
+
*
|
|
31636
|
+
* const program2 = Effect.gen(function*() {
|
|
31637
|
+
* const counter = yield* Ref.make(5)
|
|
31638
|
+
* yield* Ref.update(counter, (n: number) => n + 10)
|
|
31639
|
+
* return yield* Ref.get(counter)
|
|
31640
|
+
* })
|
|
31641
|
+
*
|
|
31642
|
+
* await Effect.runPromise(program) // => 10
|
|
31643
|
+
* await Effect.runPromise(program2) // => 15
|
|
31644
|
+
* ```
|
|
31645
|
+
*
|
|
31646
|
+
* @see {@link updateAndGet} for returning the new value
|
|
31647
|
+
* @see {@link getAndUpdate} for returning the previous value
|
|
31648
|
+
*
|
|
31649
|
+
* @stability stable
|
|
31650
|
+
* @category mutations
|
|
31651
|
+
* @since 2.0.0
|
|
31652
|
+
*/
|
|
31653
|
+
const update = /*#__PURE__*/ dual(2, (self, f) => sync(() => {
|
|
31654
|
+
self.ref.current = f(self.ref.current);
|
|
31655
|
+
}));
|
|
31413
31656
|
// ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/Cookies.js
|
|
31414
31657
|
/**
|
|
31415
31658
|
* Models HTTP cookies and cookie collections for requests and responses.
|
|
@@ -31903,7 +32146,7 @@ const value$2 = value$3;
|
|
|
31903
32146
|
* @category instances
|
|
31904
32147
|
* @since 4.0.0
|
|
31905
32148
|
*/
|
|
31906
|
-
const makeEquivalence = (isEquivalent) => make$
|
|
32149
|
+
const makeEquivalence = (isEquivalent) => make$73((x, y) => isEquivalent(value$2(x), value$2(y)));
|
|
31907
32150
|
// ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/Headers.js
|
|
31908
32151
|
/**
|
|
31909
32152
|
* Models HTTP headers for the unstable HTTP client and server modules.
|
|
@@ -31927,7 +32170,7 @@ const TypeId$27 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
|
|
|
31927
32170
|
const Proto$12 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
|
|
31928
32171
|
[TypeId$27]: { value: TypeId$27 },
|
|
31929
32172
|
[symbolRedactable]: { value(context) {
|
|
31930
|
-
return redact$1(this, get$
|
|
32173
|
+
return redact$1(this, get$10(context, CurrentRedactedNames$1));
|
|
31931
32174
|
} },
|
|
31932
32175
|
toJSON: { value() {
|
|
31933
32176
|
return redact$2(this);
|
|
@@ -32994,7 +33237,7 @@ const Proto$11 = {
|
|
|
32994
33237
|
[symbolRedactable](context) {
|
|
32995
33238
|
return {
|
|
32996
33239
|
_id: "UrlParams",
|
|
32997
|
-
params: Object.fromEntries(redact(this, get$
|
|
33240
|
+
params: Object.fromEntries(redact(this, get$10(context, CurrentRedactedNames)))
|
|
32998
33241
|
};
|
|
32999
33242
|
},
|
|
33000
33243
|
toJSON() {
|
|
@@ -33070,7 +33313,7 @@ const coerce = (value) => isRedacted(value) ? value : String(value);
|
|
|
33070
33313
|
* @category instances
|
|
33071
33314
|
* @since 4.0.0
|
|
33072
33315
|
*/
|
|
33073
|
-
const Equivalence = /*#__PURE__*/ make$
|
|
33316
|
+
const Equivalence = /*#__PURE__*/ make$73((a, b) => arrayEquivalence(a.params, b.params));
|
|
33074
33317
|
const arrayEquivalence = /*#__PURE__*/ makeEquivalence$1(/*#__PURE__*/ makeEquivalence$3([/*#__PURE__*/ strictEqual(), /*#__PURE__*/ asEquivalence()]));
|
|
33075
33318
|
/**
|
|
33076
33319
|
* An empty `UrlParams` value.
|
|
@@ -33195,7 +33438,7 @@ const decodeQueryKey = (key) => {
|
|
|
33195
33438
|
return key;
|
|
33196
33439
|
}
|
|
33197
33440
|
};
|
|
33198
|
-
const currentRedactedNames = () => get$
|
|
33441
|
+
const currentRedactedNames = () => get$10(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$12(), CurrentRedactedNames);
|
|
33199
33442
|
/**
|
|
33200
33443
|
* Query parameter names or patterns to redact in inspection, spans and errors.
|
|
33201
33444
|
*
|
|
@@ -37263,7 +37506,7 @@ function Cause(error, defect) {
|
|
|
37263
37506
|
}
|
|
37264
37507
|
const dateTimeUtcFromString = /*#__PURE__*/ transformEffect({
|
|
37265
37508
|
decode: (s, options) => {
|
|
37266
|
-
return match$5(make$
|
|
37509
|
+
return match$5(make$53(s), {
|
|
37267
37510
|
onNone: () => fail$3(new InvalidValue({ expected: "a valid UTC DateTime string" }, s, options)),
|
|
37268
37511
|
onSome: (result) => succeed$4(toUtc(result))
|
|
37269
37512
|
});
|
|
@@ -38181,6 +38424,14 @@ const stream$2 = (body, contentType, contentLength) => new Stream$1(body, conten
|
|
|
38181
38424
|
*/
|
|
38182
38425
|
const TypeId$22 = "~effect/http/HttpClientError";
|
|
38183
38426
|
/**
|
|
38427
|
+
* Returns `true` when a value is an `HttpClientError`.
|
|
38428
|
+
*
|
|
38429
|
+
* @stability unstable
|
|
38430
|
+
* @category guards
|
|
38431
|
+
* @since 4.0.0
|
|
38432
|
+
*/
|
|
38433
|
+
const isHttpClientError = (u) => hasProperty(u, TypeId$22);
|
|
38434
|
+
/**
|
|
38184
38435
|
* Error wrapper for HTTP client failures, exposing the failed request and the optional response through its `reason`.
|
|
38185
38436
|
*
|
|
38186
38437
|
* @stability unstable
|
|
@@ -41416,6 +41667,18 @@ const internalServerError = /*#__PURE__*/ empty({ status: 500 });
|
|
|
41416
41667
|
const succeedInternalServerError = /*#__PURE__*/ succeed$4(internalServerError);
|
|
41417
41668
|
const clientAbortError = /*#__PURE__*/ succeed$4(/*#__PURE__*/ empty({ status: 499 }));
|
|
41418
41669
|
const serverAbortError = /*#__PURE__*/ succeed$4(/*#__PURE__*/ empty({ status: 503 }));
|
|
41670
|
+
/**
|
|
41671
|
+
* Extracts the response from a successful handler exit, or derives a response
|
|
41672
|
+
* from the failure cause.
|
|
41673
|
+
*
|
|
41674
|
+
* @stability unstable
|
|
41675
|
+
* @category error handling
|
|
41676
|
+
* @since 4.0.0
|
|
41677
|
+
*/
|
|
41678
|
+
const exitResponse = (exit) => {
|
|
41679
|
+
if (exit._tag === "Success") return exit.value;
|
|
41680
|
+
return causeResponseStripped(exit.cause)[0];
|
|
41681
|
+
};
|
|
41419
41682
|
// ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/socket/Socket.js
|
|
41420
41683
|
/**
|
|
41421
41684
|
* Runtime type identifier attached to `Socket` services.
|
|
@@ -42510,7 +42773,7 @@ const isMultipartError = (u) => hasProperty(u, MultipartErrorTypeId);
|
|
|
42510
42773
|
* @since 4.0.0
|
|
42511
42774
|
*/
|
|
42512
42775
|
const makeConfig = (headers) => withFiber((fiber) => {
|
|
42513
|
-
const mimeTypes = get$
|
|
42776
|
+
const mimeTypes = get$10(fiber.context, FieldMimeTypes);
|
|
42514
42777
|
return succeed$4({
|
|
42515
42778
|
headers,
|
|
42516
42779
|
maxParts: fiber.getRef(MaxParts),
|
|
@@ -43046,7 +43309,7 @@ const stripSearchAndHash = (url) => {
|
|
|
43046
43309
|
* @since 4.0.0
|
|
43047
43310
|
*/
|
|
43048
43311
|
const withLoggerDisabled = (self) => withFiber((fiber) => {
|
|
43049
|
-
const request = getUnsafe$
|
|
43312
|
+
const request = getUnsafe$2(fiber.context, HttpServerRequest);
|
|
43050
43313
|
loggerDisabledRequests.add(request.source);
|
|
43051
43314
|
return self;
|
|
43052
43315
|
});
|
|
@@ -43091,7 +43354,7 @@ const TracerHeaderFilter = /*#__PURE__*/ Reference("effect/http/HttpMiddleware/T
|
|
|
43091
43354
|
* @since 4.0.0
|
|
43092
43355
|
*/
|
|
43093
43356
|
const logger = /*#__PURE__*/ make$28((httpApp) => withFiber((fiber) => {
|
|
43094
|
-
const request = getUnsafe$
|
|
43357
|
+
const request = getUnsafe$2(fiber.context, HttpServerRequest);
|
|
43095
43358
|
const path = stripSearchAndHash(request.url);
|
|
43096
43359
|
return withLogSpan(flatMap$1(exit(httpApp), (exit) => {
|
|
43097
43360
|
if (loggerDisabledRequests.has(request.source)) return exit;
|
|
@@ -43136,7 +43399,7 @@ const responseSpanExit = (request, response) => {
|
|
|
43136
43399
|
* @since 4.0.0
|
|
43137
43400
|
*/
|
|
43138
43401
|
const tracer = /*#__PURE__*/ make$28((httpApp) => withFiber((fiber) => {
|
|
43139
|
-
const request = getUnsafe$
|
|
43402
|
+
const request = getUnsafe$2(fiber.context, HttpServerRequest);
|
|
43140
43403
|
if (isTracerDisabledUnsafe(fiber, request)) return httpApp;
|
|
43141
43404
|
const nameGenerator = fiber.getRef(SpanNameGenerator);
|
|
43142
43405
|
const span = makeSpanUnsafe(fiber, nameGenerator(request), {
|
|
@@ -43254,7 +43517,7 @@ const cors$1 = (options) => {
|
|
|
43254
43517
|
return succeed$4(setHeaders(response, headers["vary"] === void 0 ? headers : set$2(headers, "vary", varyWith(response.headers, "Origin"))));
|
|
43255
43518
|
};
|
|
43256
43519
|
return (httpApp) => withFiber((fiber) => {
|
|
43257
|
-
const request = getUnsafe$
|
|
43520
|
+
const request = getUnsafe$2(fiber.context, HttpServerRequest);
|
|
43258
43521
|
if (request.method === "OPTIONS") return succeed$4(empty({
|
|
43259
43522
|
status: 204,
|
|
43260
43523
|
headers: headersFromRequestOptions(request)
|
|
@@ -43305,7 +43568,7 @@ const cors$1 = (options) => {
|
|
|
43305
43568
|
const decompression = (options) => {
|
|
43306
43569
|
const maxDecompressedSize = options?.maxDecompressedSize === void 0 ? void 0 : fromInputUnsafe(options.maxDecompressedSize);
|
|
43307
43570
|
return (httpApp) => withFiber((fiber) => {
|
|
43308
|
-
const request = getUnsafe$
|
|
43571
|
+
const request = getUnsafe$2(fiber.context, HttpServerRequest);
|
|
43309
43572
|
const contentEncoding = request.headers["content-encoding"];
|
|
43310
43573
|
if (contentEncoding === void 0 || !hasBody(request.method)) return httpApp;
|
|
43311
43574
|
const codings = parseContentEncoding(contentEncoding);
|
|
@@ -43416,7 +43679,7 @@ const toHandled = (self, handleResponse, middleware) => {
|
|
|
43416
43679
|
return withFiber((fiber) => {
|
|
43417
43680
|
fiberEnterUninterruptibleUnsafe(fiber);
|
|
43418
43681
|
const scope = makeUnsafe$7();
|
|
43419
|
-
const frame = new RequestFrame(scope, fiber.context, getUnsafe$
|
|
43682
|
+
const frame = new RequestFrame(scope, fiber.context, getUnsafe$2(fiber.context, HttpServerRequest));
|
|
43420
43683
|
fiber.setContext(add$3(frame.prev, Scope, scope));
|
|
43421
43684
|
const currentTracer = fiber.cache.tracer;
|
|
43422
43685
|
if (middleware === void 0 && (currentTracer === void 0 || currentTracer === nativeTracer || isTracerDisabledUnsafe(fiber, frame.request))) {
|
|
@@ -43617,7 +43880,7 @@ const make$26 = /*#__PURE__*/ gen(function* () {
|
|
|
43617
43880
|
asHttpEffect() {
|
|
43618
43881
|
let handler = withFiber((fiber) => {
|
|
43619
43882
|
let context = fiber.context;
|
|
43620
|
-
const request = getUnsafe$
|
|
43883
|
+
const request = getUnsafe$2(context, HttpServerRequest);
|
|
43621
43884
|
let result = router.find(request.method, request.url);
|
|
43622
43885
|
if (result === void 0 && request.method === "HEAD") result = router.find("GET", request.url);
|
|
43623
43886
|
if (result === void 0) return fail$3(new HttpServerError({ reason: new RouteNotFound({ request }) }));
|
|
@@ -43912,7 +44175,7 @@ var MiddlewareImpl = class MiddlewareImpl {
|
|
|
43912
44175
|
const stack = [getOrUndefinedUnsafe(context$3, fnContextKey)];
|
|
43913
44176
|
if (this.dependencies) {
|
|
43914
44177
|
const memoMap = yield* CurrentMemoMap;
|
|
43915
|
-
const scope = get$
|
|
44178
|
+
const scope = get$10(context$3, Scope);
|
|
43916
44179
|
const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope);
|
|
43917
44180
|
stack.push(...getMiddleware(depsContext));
|
|
43918
44181
|
}
|
|
@@ -43975,9 +44238,9 @@ const serve = (appLayer, options) => {
|
|
|
43975
44238
|
const layerWithRouter = provideMerge(appLayer, options?.routerConfig ? provide$2(layer$15, succeed$5(RouterConfig)(options.routerConfig)) : layer$15);
|
|
43976
44239
|
return contextWith((context) => {
|
|
43977
44240
|
const memoMap = CurrentMemoMap.forkOrCreate(context);
|
|
43978
|
-
return buildWithMemoMap(layerWithRouter, memoMap, get$
|
|
44241
|
+
return buildWithMemoMap(layerWithRouter, memoMap, get$10(context, Scope));
|
|
43979
44242
|
}).pipe(map$2((context) => {
|
|
43980
|
-
const handler = get$
|
|
44243
|
+
const handler = get$10(context, HttpRouter).asHttpEffect();
|
|
43981
44244
|
return merge$3(middleware ? serve$1(handler, middleware) : serve$1(handler), succeedContext(context));
|
|
43982
44245
|
}), unwrap$5, options?.disableListenLog ? identity : withLogAddress);
|
|
43983
44246
|
};
|
|
@@ -44704,7 +44967,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
44704
44967
|
const disableTracing = options?.disableTracing ?? false;
|
|
44705
44968
|
const generateRequestId = options?.generateRequestId ?? (() => requestIdCounter++);
|
|
44706
44969
|
const services = yield* context();
|
|
44707
|
-
const scope = get$
|
|
44970
|
+
const scope = get$10(services, Scope);
|
|
44708
44971
|
const entries = /* @__PURE__ */ new Map();
|
|
44709
44972
|
let isShutdown = false;
|
|
44710
44973
|
yield* addFinalizer$1(scope, withFiber((parent) => {
|
|
@@ -44787,7 +45050,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
44787
45050
|
});
|
|
44788
45051
|
const fiber = getCurrent();
|
|
44789
45052
|
const id = generateRequestId();
|
|
44790
|
-
const scope = getUnsafe$
|
|
45053
|
+
const scope = getUnsafe$2(fiber.context, Scope);
|
|
44791
45054
|
const queue = yield* bounded(streamBufferSize);
|
|
44792
45055
|
yield* addFinalizerExit(scope, (exit) => {
|
|
44793
45056
|
shutdownUnsafe(queue);
|
|
@@ -45166,9 +45429,9 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
45166
45429
|
const concurrency = options.concurrency ?? "unbounded";
|
|
45167
45430
|
const disableFatalDefects = options.disableFatalDefects ?? false;
|
|
45168
45431
|
const services = yield* context();
|
|
45169
|
-
const scope = get$
|
|
45432
|
+
const scope = get$10(services, Scope);
|
|
45170
45433
|
const trackFiber = runIn(forkUnsafe(scope, "parallel"));
|
|
45171
|
-
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$
|
|
45434
|
+
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$59(concurrency);
|
|
45172
45435
|
const clients = /* @__PURE__ */ new Map();
|
|
45173
45436
|
let isShutdown = false;
|
|
45174
45437
|
const shutdownLatch = makeUnsafe$5(false);
|
|
@@ -45436,7 +45699,7 @@ const handlerContext = (entry, fiberContext) => {
|
|
|
45436
45699
|
return merged;
|
|
45437
45700
|
};
|
|
45438
45701
|
const applyMiddleware = (context, handler, options) => {
|
|
45439
|
-
for (const service of options.rpc.middlewares) handler = getUnsafe$
|
|
45702
|
+
for (const service of options.rpc.middlewares) handler = getUnsafe$2(context, service)(handler, options);
|
|
45440
45703
|
return handler;
|
|
45441
45704
|
};
|
|
45442
45705
|
/**
|
|
@@ -45452,7 +45715,7 @@ const make$22 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
|
45452
45715
|
const { codecFor, disconnects, end, run, send, supportsAck, supportsSpanPropagation, supportsTransferables } = yield* Protocol;
|
|
45453
45716
|
const { encodeDefectUnsafe, encodeUnknownRequestExit } = defectCodecs(codecFor);
|
|
45454
45717
|
const services = yield* context();
|
|
45455
|
-
const scope = yield* make$
|
|
45718
|
+
const scope = yield* make$67();
|
|
45456
45719
|
const server = yield* makeNoSerialization(group, {
|
|
45457
45720
|
...options,
|
|
45458
45721
|
disableClientAcks: !supportsAck,
|
|
@@ -45624,7 +45887,7 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
|
|
|
45624
45887
|
const { encodeDefectUnsafe } = defectCodecs(serialization.codecFor);
|
|
45625
45888
|
const includesFraming = serialization.includesFraming;
|
|
45626
45889
|
const isBinary = !serialization.contentType.includes("json");
|
|
45627
|
-
const disconnects = yield* make$
|
|
45890
|
+
const disconnects = yield* make$60();
|
|
45628
45891
|
let writeRequest;
|
|
45629
45892
|
let clientId = 0;
|
|
45630
45893
|
const clients = /* @__PURE__ */ new Map();
|
|
@@ -45632,12 +45895,12 @@ const makeProtocolWithHttpEffect = /*#__PURE__*/ fnUntraced(function* (options =
|
|
|
45632
45895
|
const encoder = new TextEncoder();
|
|
45633
45896
|
const httpEffect = gen(function* () {
|
|
45634
45897
|
const fiber = getCurrent();
|
|
45635
|
-
const request = getUnsafe$
|
|
45636
|
-
const scope = getUnsafe$
|
|
45898
|
+
const request = getUnsafe$2(fiber.context, HttpServerRequest);
|
|
45899
|
+
const scope = getUnsafe$2(fiber.context, Scope);
|
|
45637
45900
|
const requestHeaders = Object.entries(request.headers);
|
|
45638
45901
|
const data = yield* orDie$2(isBinary ? map$2(request.arrayBuffer, (buf) => new Uint8Array(buf)) : request.text);
|
|
45639
45902
|
const id = clientId++;
|
|
45640
|
-
const queue = yield* make$
|
|
45903
|
+
const queue = yield* make$60({ capacity: includesFraming && options.streamBufferSize !== "unbounded" ? options.streamBufferSize ?? 16 : void 0 });
|
|
45641
45904
|
const parser = serialization.makeUnsafe();
|
|
45642
45905
|
const requestIds = [];
|
|
45643
45906
|
const offer$1 = (data) => typeof data === "string" ? offer(queue, encoder.encode(data)) : offer(queue, data);
|
|
@@ -45829,7 +46092,7 @@ const RpcGroupProto = {
|
|
|
45829
46092
|
});
|
|
45830
46093
|
},
|
|
45831
46094
|
annotateRpcs(service, value) {
|
|
45832
|
-
return this.annotateRpcsMerge(make$
|
|
46095
|
+
return this.annotateRpcsMerge(make$71(service, value));
|
|
45833
46096
|
},
|
|
45834
46097
|
annotateMerge(context) {
|
|
45835
46098
|
return makeProto$1({
|
|
@@ -50906,7 +51169,7 @@ const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
|
50906
51169
|
resume(fail$3(handleBadArgument("writeFile")(err)));
|
|
50907
51170
|
}
|
|
50908
51171
|
});
|
|
50909
|
-
const makeFileSystem = /*#__PURE__*/ map$2(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$
|
|
51172
|
+
const makeFileSystem = /*#__PURE__*/ map$2(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$55({
|
|
50910
51173
|
access,
|
|
50911
51174
|
chmod,
|
|
50912
51175
|
chown,
|
|
@@ -51636,7 +51899,7 @@ const fileUrlOps = (windows) => ({
|
|
|
51636
51899
|
* @category layers
|
|
51637
51900
|
* @since 4.0.0
|
|
51638
51901
|
*/
|
|
51639
|
-
const layer$7 = /* @__PURE__ */ succeed$5(Path$1)(/*#__PURE__*/ make$
|
|
51902
|
+
const layer$7 = /* @__PURE__ */ succeed$5(Path$1)(/*#__PURE__*/ make$54({
|
|
51640
51903
|
...Path,
|
|
51641
51904
|
.../*#__PURE__*/ fileUrlOps(void 0)
|
|
51642
51905
|
}));
|
|
@@ -51769,7 +52032,7 @@ const make$13 = (impl) => Terminal.of({
|
|
|
51769
52032
|
const layer$4 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
|
|
51770
52033
|
const stdin = process.stdin;
|
|
51771
52034
|
const stdout = process.stdout;
|
|
51772
|
-
const lines = yield* make$
|
|
52035
|
+
const lines = yield* make$60();
|
|
51773
52036
|
let inputEnded = stdin.readableEnded;
|
|
51774
52037
|
let readlineActive = false;
|
|
51775
52038
|
const onStdinEnd = () => {
|
|
@@ -51778,7 +52041,7 @@ const layer$4 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
51778
52041
|
};
|
|
51779
52042
|
stdin.once("end", onStdinEnd);
|
|
51780
52043
|
yield* addFinalizer(() => sync(() => stdin.off("end", onStdinEnd)));
|
|
51781
|
-
const rlRef = yield* make$
|
|
52044
|
+
const rlRef = yield* make$56({
|
|
51782
52045
|
acquire: acquireRelease(sync(() => {
|
|
51783
52046
|
const rl = readline.createInterface({
|
|
51784
52047
|
input: stdin,
|
|
@@ -51812,7 +52075,7 @@ const layer$4 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
51812
52075
|
const columns = sync(() => stdout.columns ?? 0);
|
|
51813
52076
|
const rows = sync(() => stdout.rows ?? 0);
|
|
51814
52077
|
const readInput = gen(function* () {
|
|
51815
|
-
const queue = yield* make$
|
|
52078
|
+
const queue = yield* make$60();
|
|
51816
52079
|
const handleKeypress = (s, k) => {
|
|
51817
52080
|
const userInput = {
|
|
51818
52081
|
input: fromUndefinedOr(s),
|
|
@@ -51839,13 +52102,13 @@ const layer$4 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
51839
52102
|
stdin.on("keypress", handleKeypress);
|
|
51840
52103
|
if (inputEnded) handleEnd();
|
|
51841
52104
|
else {
|
|
51842
|
-
yield* get$
|
|
52105
|
+
yield* get$4(rlRef);
|
|
51843
52106
|
stdin.once("end", handleEnd);
|
|
51844
52107
|
}
|
|
51845
52108
|
return queue;
|
|
51846
52109
|
});
|
|
51847
52110
|
const readLine = suspend$2(() => poll(lines).pipe(flatMap$1(match$5({
|
|
51848
|
-
onNone: () => scoped(andThen(get$
|
|
52111
|
+
onNone: () => scoped(andThen(get$4(rlRef), take(lines))),
|
|
51849
52112
|
onSome: succeed$4
|
|
51850
52113
|
})), mapError$2(() => new QuitError({}))));
|
|
51851
52114
|
const display = (prompt) => uninterruptible(callback$1((resume) => {
|
|
@@ -55260,7 +55523,7 @@ const Strict = /*#__PURE__*/ Reference("effect/ai/Tool/Strict", { defaultValue:
|
|
|
55260
55523
|
* @category getters
|
|
55261
55524
|
* @since 4.0.0
|
|
55262
55525
|
*/
|
|
55263
|
-
const getStrictMode = (tool) => get$
|
|
55526
|
+
const getStrictMode = (tool) => get$10(tool.annotations, Strict);
|
|
55264
55527
|
/**
|
|
55265
55528
|
* Schema for denied or interrupted tool calls.
|
|
55266
55529
|
*
|
|
@@ -55387,7 +55650,7 @@ const TypeId$1 = "~effect/ai/Toolkit";
|
|
|
55387
55650
|
* @since 4.0.0
|
|
55388
55651
|
*/
|
|
55389
55652
|
const FailureOrigin = /*#__PURE__*/ Reference("effect/ai/Toolkit/FailureOrigin", { defaultValue: () => "result" });
|
|
55390
|
-
const failureCause = (error, origin) => annotate$1(fail$4(error), make$
|
|
55653
|
+
const failureCause = (error, origin) => annotate$1(fail$4(error), make$71(FailureOrigin, origin));
|
|
55391
55654
|
const Proto = {
|
|
55392
55655
|
.../*#__PURE__*/ Prototype({
|
|
55393
55656
|
label: "Toolkit",
|
|
@@ -55459,7 +55722,7 @@ const Proto = {
|
|
|
55459
55722
|
})));
|
|
55460
55723
|
}
|
|
55461
55724
|
const decodedParams = decodedParamsResult.success;
|
|
55462
|
-
const queue = yield* make$
|
|
55725
|
+
const queue = yield* make$60();
|
|
55463
55726
|
const context = {
|
|
55464
55727
|
toolCallId,
|
|
55465
55728
|
preliminary: (result) => asVoid(offer(queue, {
|
|
@@ -61287,7 +61550,7 @@ const makeHandlers = (core, _lifecycle, context) => {
|
|
|
61287
61550
|
const subscriptionMetadata = { "io.modelcontextprotocol/subscriptionId": requestId };
|
|
61288
61551
|
const resourceSubscriptions = new Set(honored.resourceSubscriptions);
|
|
61289
61552
|
const pending = yield* dropping(MAX_PENDING_SUBSCRIPTION_NOTIFICATIONS);
|
|
61290
|
-
const overflowed = yield* make$
|
|
61553
|
+
const overflowed = yield* make$68();
|
|
61291
61554
|
yield* gen(function* () {
|
|
61292
61555
|
while (true) {
|
|
61293
61556
|
const event = yield* take$1(events);
|
|
@@ -61637,7 +61900,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$2()("effect/ai/Mc
|
|
|
61637
61900
|
const resources = [];
|
|
61638
61901
|
const resourceTemplates = [];
|
|
61639
61902
|
const prompts = [];
|
|
61640
|
-
const notificationsQueue = yield* make$
|
|
61903
|
+
const notificationsQueue = yield* make$60();
|
|
61641
61904
|
const notificationDelivery = {
|
|
61642
61905
|
consumers: 0,
|
|
61643
61906
|
listChangeRevision: 0,
|
|
@@ -61648,7 +61911,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$2()("effect/ai/Mc
|
|
|
61648
61911
|
const dispatcher = (yield* Scheduler).makeDispatcher();
|
|
61649
61912
|
const notifications = yield* makeNoSerialization$1(BroadcastServerNotificationRpcs, {
|
|
61650
61913
|
spanPrefix: "McpServer/Notifications",
|
|
61651
|
-
onFromClient: (options) => make$
|
|
61914
|
+
onFromClient: (options) => make$68().pipe(flatMap$1((delivered) => withFiber((fiber) => {
|
|
61652
61915
|
const message = options.message;
|
|
61653
61916
|
if (message._tag !== "Request") return void_$1;
|
|
61654
61917
|
const notification = toInternalServerNotification(message);
|
|
@@ -61665,7 +61928,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$2()("effect/ai/Mc
|
|
|
61665
61928
|
_tag: "Exit",
|
|
61666
61929
|
exit: void_$2
|
|
61667
61930
|
}));
|
|
61668
|
-
const requestQueue = get$
|
|
61931
|
+
const requestQueue = get$10(fiber.context, RequestNotificationQueue);
|
|
61669
61932
|
if (requestQueue !== void 0 && queued.requestContext !== void 0 && isRequestNotification(notification)) {
|
|
61670
61933
|
offerUnsafe(requestQueue, queued);
|
|
61671
61934
|
return andThen(_await(delivered), acknowledge);
|
|
@@ -61694,7 +61957,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$2()("effect/ai/Mc
|
|
|
61694
61957
|
});
|
|
61695
61958
|
const service = McpServer.of({
|
|
61696
61959
|
notifications: notifications.client,
|
|
61697
|
-
notifyElicitationComplete: ({ clientId, elicitationId }) => withoutSharedConsumer() ? void_$1 : make$
|
|
61960
|
+
notifyElicitationComplete: ({ clientId, elicitationId }) => withoutSharedConsumer() ? void_$1 : make$68().pipe(flatMap$1((delivered) => offer(notificationsQueue, {
|
|
61698
61961
|
notification: ServerNotification.ElicitationComplete({ elicitationId }),
|
|
61699
61962
|
targetClientId: clientId,
|
|
61700
61963
|
delivered
|
|
@@ -61963,7 +62226,7 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
|
|
|
61963
62226
|
defaultLogLevel,
|
|
61964
62227
|
serverInfo: options
|
|
61965
62228
|
}));
|
|
61966
|
-
const clients = yield* make$
|
|
62229
|
+
const clients = yield* make$58({
|
|
61967
62230
|
lookup: fnUntraced(function* (key) {
|
|
61968
62231
|
const selectedProtocol = runtime.selectProtocol(key.profile.protocolVersion);
|
|
61969
62232
|
let write;
|
|
@@ -62040,7 +62303,7 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
|
|
|
62040
62303
|
clientInfo: profile.clientInfo,
|
|
62041
62304
|
initializePayload,
|
|
62042
62305
|
requestMetadata: isReadonlyObject(payload) && isReadonlyObject(payload._meta) ? payload._meta : void 0,
|
|
62043
|
-
getClient: get$
|
|
62306
|
+
getClient: get$6(clients, new McpClientKey({
|
|
62044
62307
|
clientId: client.id,
|
|
62045
62308
|
profile
|
|
62046
62309
|
})).pipe(map$2(({ client }) => client))
|
|
@@ -62091,13 +62354,13 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
|
|
|
62091
62354
|
httpPost.expected++;
|
|
62092
62355
|
httpPostResponses.set(httpRequest, httpPost);
|
|
62093
62356
|
}
|
|
62094
|
-
const headers = isHttp ? getUnsafe$
|
|
62357
|
+
const headers = isHttp ? getUnsafe$2(getCurrent().context, HttpServerRequest).headers : fromInput$1(request.headers);
|
|
62095
62358
|
const cancellationRequest = request.tag === "notifications/cancelled" && typeof request.payload === "object" && request.payload !== null && "requestId" in request.payload && (typeof request.payload.requestId === "string" || typeof request.payload.requestId === "number") ? activeRequests.get(clientId)?.get(requestKey(request.payload.requestId)) : void 0;
|
|
62096
62359
|
const prepare = cancellationRequest === void 0 ? runtime.prepareRequest(clientId, headers, request) : succeed$4(cancellationRequest.prepared);
|
|
62097
62360
|
return gen(function* () {
|
|
62098
62361
|
const prepared = yield* prepare;
|
|
62099
62362
|
const clientState = clientStates.get(clientId);
|
|
62100
|
-
if (isHttp && clientState === void 0) yield* addFinalizer$1(getUnsafe$
|
|
62363
|
+
if (isHttp && clientState === void 0) yield* addFinalizer$1(getUnsafe$2(fiber.context, Scope), sync(() => disconnectClient(clientId)));
|
|
62101
62364
|
const session = prepared.binding;
|
|
62102
62365
|
const selectedProtocol = prepared.protocol;
|
|
62103
62366
|
clientStates.set(clientId, {
|
|
@@ -62176,7 +62439,7 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
|
|
|
62176
62439
|
case "ClientProtocolError":
|
|
62177
62440
|
case "Defect": {
|
|
62178
62441
|
const requestId = request._tag === "Exit" ? requestKey(request.requestId) : void 0;
|
|
62179
|
-
const session = isHttp ? runtime.resolveRequest(clientId, getUnsafe$
|
|
62442
|
+
const session = isHttp ? runtime.resolveRequest(clientId, getUnsafe$2(getCurrent().context, HttpServerRequest).headers) : void 0;
|
|
62180
62443
|
const reverseKey = (requestId === void 0 ? void 0 : reverseRequestClients.get(requestId))?.find((key) => isHttp ? key.profile === session?.negotiatedProfile : key.clientId === clientId);
|
|
62181
62444
|
if (request._tag === "Exit" && reverseKey === void 0) return void_$1;
|
|
62182
62445
|
if (reverseKey !== void 0 && requestId !== void 0) removeReverseRequestClient(requestId, reverseKey);
|
|
@@ -62191,7 +62454,7 @@ const runWithRuntime = /*#__PURE__*/ fnUntraced(function* (options, runtime, tra
|
|
|
62191
62454
|
version: "unknown"
|
|
62192
62455
|
}
|
|
62193
62456
|
};
|
|
62194
|
-
return get$
|
|
62457
|
+
return get$6(clients, new McpClientKey({
|
|
62195
62458
|
clientId: targetClientId,
|
|
62196
62459
|
profile
|
|
62197
62460
|
})).pipe(flatMap$1(({ write }) => write(request)), scoped);
|
|
@@ -62542,7 +62805,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
|
|
|
62542
62805
|
const failure = findFail(cause);
|
|
62543
62806
|
if (isSuccess$1(failure)) {
|
|
62544
62807
|
const error = failure.success.error;
|
|
62545
|
-
const origin = get$
|
|
62808
|
+
const origin = get$10(reasonAnnotations(failure.success), FailureOrigin);
|
|
62546
62809
|
if (origin === "parameters" && isParameterValidationError(error)) return fail$3(new InvalidParams({ message: error.reason.message }));
|
|
62547
62810
|
if (origin === "handler" && isDeclaredFailure(error)) return catchCause$1(declaredFailureResult(error), internalToolError);
|
|
62548
62811
|
}
|
|
@@ -62557,10 +62820,10 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
|
|
|
62557
62820
|
outputSchema,
|
|
62558
62821
|
annotations: {
|
|
62559
62822
|
...getOption(tool.annotations, Title).pipe(map$8((title) => ({ title })), getOrUndefined$1),
|
|
62560
|
-
readOnlyHint: get$
|
|
62561
|
-
destructiveHint: get$
|
|
62562
|
-
idempotentHint: get$
|
|
62563
|
-
openWorldHint: get$
|
|
62823
|
+
readOnlyHint: get$10(tool.annotations, Readonly),
|
|
62824
|
+
destructiveHint: get$10(tool.annotations, Destructive),
|
|
62825
|
+
idempotentHint: get$10(tool.annotations, Idempotent),
|
|
62826
|
+
openWorldHint: get$10(tool.annotations, OpenWorld)
|
|
62564
62827
|
},
|
|
62565
62828
|
_meta: toolMeta
|
|
62566
62829
|
});
|
|
@@ -62568,7 +62831,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
|
|
|
62568
62831
|
tool: mcpTool,
|
|
62569
62832
|
annotations,
|
|
62570
62833
|
handle(payload) {
|
|
62571
|
-
return built.handle(tool.name, payload ?? {}, void 0, decodeOptions).pipe(unwrap$2, runLast, flatMap$1(fromOption), flatMap$1((result) => result.isFailure && result.failureOrigin !== "handler" ? failCause$3(annotate$1(fail$4(result.result), make$
|
|
62834
|
+
return built.handle(tool.name, payload ?? {}, void 0, decodeOptions).pipe(unwrap$2, runLast, flatMap$1(fromOption), flatMap$1((result) => result.isFailure && result.failureOrigin !== "handler" ? failCause$3(annotate$1(fail$4(result.result), make$71(FailureOrigin, result.failureOrigin ?? "result"))) : succeed$4(new CallToolResult$5({
|
|
62572
62835
|
isError: result.isFailure,
|
|
62573
62836
|
structuredContent: result.isFailure ? void 0 : result.encodedResult,
|
|
62574
62837
|
content: toolResultContent(result.encodedResult)
|
|
@@ -62928,7 +63191,8 @@ var AuthError = class extends TaggedError()("AuthError", {
|
|
|
62928
63191
|
"invalid_grant",
|
|
62929
63192
|
"invalid_target",
|
|
62930
63193
|
"invalid_scope",
|
|
62931
|
-
"access_denied"
|
|
63194
|
+
"access_denied",
|
|
63195
|
+
"temporarily_unavailable"
|
|
62932
63196
|
])),
|
|
62933
63197
|
message: String$2
|
|
62934
63198
|
}) {};
|
|
@@ -62971,14 +63235,23 @@ var RpcAuth = class RpcAuth extends Service$1()("@deslop/runtime/auth/lib/utils/
|
|
|
62971
63235
|
function rejected(message) {
|
|
62972
63236
|
return mapError$2((cause) => {
|
|
62973
63237
|
if (is$2(AuthError)(cause)) return cause;
|
|
62974
|
-
return AuthError.make({
|
|
63238
|
+
if (isHttpClientError(cause) && cause.reason._tag === "StatusCodeError" && cause.reason.response.status === 401) return AuthError.make({
|
|
62975
63239
|
cause,
|
|
62976
63240
|
message
|
|
62977
63241
|
});
|
|
63242
|
+
return AuthError.make({
|
|
63243
|
+
cause,
|
|
63244
|
+
error: "temporarily_unavailable",
|
|
63245
|
+
message: "The authorization service is temporarily unavailable"
|
|
63246
|
+
});
|
|
62978
63247
|
});
|
|
62979
63248
|
}
|
|
63249
|
+
const unavailable = text("The authorization service is temporarily unavailable; retry later", {
|
|
63250
|
+
headers: { "retry-after": "5" },
|
|
63251
|
+
status: 503
|
|
63252
|
+
});
|
|
62980
63253
|
var Auth = class Auth extends Service$2()("@deslop/runtime/auth/service/Auth") {
|
|
62981
|
-
static makeContext = (auth) => pipe(make$
|
|
63254
|
+
static makeContext = (auth) => pipe(make$71(Auth, auth), add$3(RpcAuth, RpcAuth.of((effect, request) => pipe(auth.user(request.headers), flatMap$1((user) => provideService(effect, CurrentUser, user))))));
|
|
62982
63255
|
static layer = (resource) => effectContext(gen(function* () {
|
|
62983
63256
|
const url = yield* pipe(String$1("AUTH_URL"), withDefault(AUTH_URL));
|
|
62984
63257
|
const client = filterStatusOk(yield* HttpClient);
|
|
@@ -63007,7 +63280,10 @@ const HttpAuth = middleware()(gen(function* () {
|
|
|
63007
63280
|
const auth = yield* Auth;
|
|
63008
63281
|
return (app) => gen(function* () {
|
|
63009
63282
|
const user = yield* result$1(auth.user((yield* HttpServerRequest).headers));
|
|
63010
|
-
if (isFailure$1(user))
|
|
63283
|
+
if (isFailure$1(user)) {
|
|
63284
|
+
if (user.failure.error === "temporarily_unavailable") return unavailable;
|
|
63285
|
+
return text("Sign in first", { status: 401 });
|
|
63286
|
+
}
|
|
63011
63287
|
return yield* provideService(app, CurrentUser, user.success);
|
|
63012
63288
|
});
|
|
63013
63289
|
}));
|
|
@@ -63015,11 +63291,20 @@ function layerMcpAuth(resource) {
|
|
|
63015
63291
|
return middleware()(gen(function* () {
|
|
63016
63292
|
const auth = yield* Auth;
|
|
63017
63293
|
return (app) => gen(function* () {
|
|
63018
|
-
const
|
|
63019
|
-
|
|
63020
|
-
|
|
63294
|
+
const headers = (yield* HttpServerRequest).headers;
|
|
63295
|
+
const challenge = `Bearer resource_metadata="${new URL("/.well-known/oauth-protected-resource/mcp", resource).href}", scope="deslop"`;
|
|
63296
|
+
if (isNone(get$2(headers, "authorization"))) return text("OAuth authorization required; sign in with your MCP client", {
|
|
63297
|
+
headers: { "www-authenticate": challenge },
|
|
63021
63298
|
status: 401
|
|
63022
63299
|
});
|
|
63300
|
+
const user = yield* result$1(auth.access(headers, resource));
|
|
63301
|
+
if (isFailure$1(user)) {
|
|
63302
|
+
if (user.failure.error === "temporarily_unavailable") return unavailable;
|
|
63303
|
+
return text("The access token was rejected; sign in again with your MCP client", {
|
|
63304
|
+
headers: { "www-authenticate": `${challenge}, error="invalid_token"` },
|
|
63305
|
+
status: 401
|
|
63306
|
+
});
|
|
63307
|
+
}
|
|
63023
63308
|
return yield* provideService(app, CurrentUser, user.success);
|
|
63024
63309
|
});
|
|
63025
63310
|
})).layer;
|
|
@@ -63030,7 +63315,7 @@ function layerKeyValueStore(directory) {
|
|
|
63030
63315
|
const base = yield* KeyValueStore;
|
|
63031
63316
|
const fs = yield* FileSystem;
|
|
63032
63317
|
const path = yield* Path$1;
|
|
63033
|
-
const writes = yield* make$
|
|
63318
|
+
const writes = yield* make$59(1);
|
|
63034
63319
|
return make$10({
|
|
63035
63320
|
...omit(base, [
|
|
63036
63321
|
"set",
|
|
@@ -63086,7 +63371,7 @@ const layerNodeHttpServer = layerConfig(createServer, {
|
|
|
63086
63371
|
port: pipe(Port("PORT"), withDefault(5e3))
|
|
63087
63372
|
});
|
|
63088
63373
|
// package.json
|
|
63089
|
-
var version = "0.1.
|
|
63374
|
+
var version = "0.1.1138";
|
|
63090
63375
|
// src/services/telemetry/schema.ts
|
|
63091
63376
|
var TelemetryError = class extends TaggedError()("TelemetryError", {
|
|
63092
63377
|
cause: optional$6(Defect()),
|
|
@@ -63175,6 +63460,7 @@ const Query = Struct({
|
|
|
63175
63460
|
}))),
|
|
63176
63461
|
offset: Natural,
|
|
63177
63462
|
operation: String$2,
|
|
63463
|
+
runs: Literals(["current", "all"]),
|
|
63178
63464
|
service: String$2,
|
|
63179
63465
|
sort: Literals(["recent", "slowest"]),
|
|
63180
63466
|
text: String$2,
|
|
@@ -63195,6 +63481,27 @@ const Service = Struct({
|
|
|
63195
63481
|
name: String$2,
|
|
63196
63482
|
runtime: Runtime
|
|
63197
63483
|
});
|
|
63484
|
+
const ServiceStatus = Struct({
|
|
63485
|
+
...Service.fields,
|
|
63486
|
+
entries: Natural,
|
|
63487
|
+
lastEventAt: Nano,
|
|
63488
|
+
runStartedAt: Nano
|
|
63489
|
+
});
|
|
63490
|
+
const IngestionStatus = Struct({
|
|
63491
|
+
rejections: ArraySchema(Struct({
|
|
63492
|
+
count: Natural,
|
|
63493
|
+
credential: Literals([
|
|
63494
|
+
"authorization",
|
|
63495
|
+
"cookie",
|
|
63496
|
+
"none"
|
|
63497
|
+
]),
|
|
63498
|
+
lastAt: Finite,
|
|
63499
|
+
route: Literals(["/v1/traces", "/v1/logs"]),
|
|
63500
|
+
status: Int
|
|
63501
|
+
})),
|
|
63502
|
+
services: ArraySchema(ServiceStatus),
|
|
63503
|
+
since: Finite
|
|
63504
|
+
});
|
|
63198
63505
|
const TracesPage = Struct({
|
|
63199
63506
|
entries: ArraySchema(Struct({
|
|
63200
63507
|
durationMs: Finite,
|
|
@@ -63236,6 +63543,7 @@ const Trace = Struct({
|
|
|
63236
63543
|
const Filters = Struct({
|
|
63237
63544
|
errors: pipe(Query.fields.errors, withDecodingDefaultTypeKey(succeed$4(false)), annotateEncoded({ description: "Only failed spans and error logs." })),
|
|
63238
63545
|
operation: pipe(Query.fields.operation, withDecodingDefaultTypeKey(succeed$4("")), annotateEncoded({ description: "Exact span name." })),
|
|
63546
|
+
runs: pipe(Query.fields.runs, withDecodingDefaultTypeKey(succeed$4("current")), annotateEncoded({ description: "\"current\" searches the latest process/page load/app launch per service. \"all\" includes retained earlier runs in the lookback." })),
|
|
63239
63547
|
service: pipe(Query.fields.service, withDecodingDefaultTypeKey(succeed$4("")), annotateEncoded({ description: "Exact service name, from list_services." })),
|
|
63240
63548
|
since: pipe(DurationFromString, check(makeFilter(isFinite$1, { expected: "a finite duration" })), withDecodingDefaultTypeKey(succeed$4(minutes(10))), annotateEncoded({ description: "Lookback, such as \"10 minutes\" or \"1 hour\"." })),
|
|
63241
63549
|
text: pipe(Query.fields.text, withDecodingDefaultTypeKey(succeed$4("")), annotateEncoded({ description: "Case-insensitive text in the span name, log message or attributes." })),
|
|
@@ -63267,12 +63575,14 @@ function started(resource) {
|
|
|
63267
63575
|
if (is$2(Nano)(value)) return BigInt(value);
|
|
63268
63576
|
return 0n;
|
|
63269
63577
|
}
|
|
63270
|
-
function
|
|
63271
|
-
|
|
63272
|
-
|
|
63273
|
-
if (start > current) return start;
|
|
63578
|
+
function latestEntry(entries) {
|
|
63579
|
+
return reduce(entries, headNonEmpty(entries), (current, entry) => {
|
|
63580
|
+
if (started(entry.resource) > started(current.resource)) return entry;
|
|
63274
63581
|
return current;
|
|
63275
|
-
})
|
|
63582
|
+
});
|
|
63583
|
+
}
|
|
63584
|
+
function currentEntries(entries) {
|
|
63585
|
+
const latest = map$6(groupBy(entries, (entry) => entry.service), (group) => started(latestEntry(group).resource));
|
|
63276
63586
|
const stale = fromIterable(map$5(filter$1(entries, (entry) => entry.traceId !== "" && started(entry.resource) < (latest[entry.service] ?? 0n)), (entry) => entry.traceId));
|
|
63277
63587
|
return filter$1(entries, (entry) => started(entry.resource) === (latest[entry.service] ?? 0n) && !has(stale, entry.traceId));
|
|
63278
63588
|
}
|
|
@@ -63295,7 +63605,7 @@ function durationMs(start, end) {
|
|
|
63295
63605
|
function summary(entries, query) {
|
|
63296
63606
|
const times = sort(map$5(entries, (entry) => entry.durationMs), Number$5);
|
|
63297
63607
|
function percentile(ratio) {
|
|
63298
|
-
return pipe(get$
|
|
63608
|
+
return pipe(get$8(times, max(0, Math.ceil(times.length * ratio) - 1)), getOrElse(() => 0));
|
|
63299
63609
|
}
|
|
63300
63610
|
return {
|
|
63301
63611
|
count: entries.length,
|
|
@@ -63319,11 +63629,22 @@ function orderEntries(entries, sort$1) {
|
|
|
63319
63629
|
onTrue: () => flip$2(mapInput(Number$5, (entry) => entry.durationMs))
|
|
63320
63630
|
}));
|
|
63321
63631
|
}
|
|
63322
|
-
function
|
|
63323
|
-
return
|
|
63324
|
-
|
|
63325
|
-
|
|
63326
|
-
|
|
63632
|
+
function serviceStatuses(entries) {
|
|
63633
|
+
return collect$1(groupBy(entries, (entry) => entry.service), (name, group) => {
|
|
63634
|
+
const latest = latestEntry(group);
|
|
63635
|
+
const run = started(latest.resource);
|
|
63636
|
+
const current = filter$1(group, (entry) => started(entry.resource) === run);
|
|
63637
|
+
return {
|
|
63638
|
+
entries: current.length,
|
|
63639
|
+
lastEventAt: reduce(current, "0", (time, entry) => {
|
|
63640
|
+
if (BigInt(entry.time) > BigInt(time)) return entry.time;
|
|
63641
|
+
return time;
|
|
63642
|
+
}),
|
|
63643
|
+
name,
|
|
63644
|
+
runStartedAt: `${run}`,
|
|
63645
|
+
runtime: runtime(latest.resource)
|
|
63646
|
+
};
|
|
63647
|
+
});
|
|
63327
63648
|
}
|
|
63328
63649
|
function parentId(entry) {
|
|
63329
63650
|
if (isString$1(entry.payload["parentSpanId"])) return toLowerCase(entry.payload["parentSpanId"]);
|
|
@@ -63346,7 +63667,7 @@ function traceView(entries, id) {
|
|
|
63346
63667
|
const ancestors = reverse(unfold({
|
|
63347
63668
|
entry: span.entry,
|
|
63348
63669
|
seen: make$44(span.entry.spanId)
|
|
63349
|
-
}, (current) => pipe(get$
|
|
63670
|
+
}, (current) => pipe(get$9(byId, parentId(current.entry)), filter$3((parent) => !has(current.seen, parent.entry.spanId)), map$8((parent) => [parent, {
|
|
63350
63671
|
entry: parent.entry,
|
|
63351
63672
|
seen: add$1(current.seen, parent.entry.spanId)
|
|
63352
63673
|
}]))));
|
|
@@ -63355,7 +63676,7 @@ function traceView(entries, id) {
|
|
|
63355
63676
|
value: {
|
|
63356
63677
|
...span.entry,
|
|
63357
63678
|
depth: ancestors.length,
|
|
63358
|
-
logs: getOrElse(get$
|
|
63679
|
+
logs: getOrElse(get$9(bySpan, span.entry.spanId), () => []),
|
|
63359
63680
|
offsetMs: durationMs(start, span.entry.time),
|
|
63360
63681
|
parentSpanId: parentId(span.entry),
|
|
63361
63682
|
runtime: runtime(span.entry.resource)
|
|
@@ -63367,7 +63688,10 @@ function traceView(entries, id) {
|
|
|
63367
63688
|
durationMs: reduce(nodes, 0, (end, node) => max(end, node.value.offsetMs + node.value.durationMs)),
|
|
63368
63689
|
id,
|
|
63369
63690
|
logs: filter$1(logs, (log) => !has$3(byId, log.spanId)),
|
|
63370
|
-
services:
|
|
63691
|
+
services: dedupeWith(map$5([...tree, ...logs], (entry) => ({
|
|
63692
|
+
name: entry.service,
|
|
63693
|
+
runtime: runtime(entry.resource)
|
|
63694
|
+
})), (left, right) => left.name === right.name),
|
|
63371
63695
|
spans: tree
|
|
63372
63696
|
};
|
|
63373
63697
|
}
|
|
@@ -63380,9 +63704,16 @@ var Telemetry = class extends Service$2()("@deslop/scope/services/telemetry/serv
|
|
|
63380
63704
|
const fs = yield* FileSystem;
|
|
63381
63705
|
const store = toSchemaStore(yield* KeyValueStore, Entry);
|
|
63382
63706
|
const crypto = yield* Crypto;
|
|
63707
|
+
const since = yield* currentTimeMillis;
|
|
63708
|
+
const rejections = yield* make$48(empty$11());
|
|
63383
63709
|
const saved = yield* forEach$1(filter$1(yield* fs.readDirectory(directory), (file) => !endsWith(".tmp")(file)), (file) => flatMap$1(try_(() => decodeURIComponent(file)), (key) => store.get(key)), { concurrency: 8 });
|
|
63384
63710
|
const state = yield* make$9(fromIterable$2(map$5(getSomes(saved), (entry) => [entry.id, entry])));
|
|
63385
63711
|
const read = map$2(get(state), (entries) => fromIterable$6(values(entries)));
|
|
63712
|
+
const selected = fnUntraced(function* (runs) {
|
|
63713
|
+
const entries = yield* read;
|
|
63714
|
+
if (runs === "all") return entries;
|
|
63715
|
+
return currentEntries(entries);
|
|
63716
|
+
});
|
|
63386
63717
|
const save = fnUntraced(function* (entries) {
|
|
63387
63718
|
yield* uninterruptible(updateEffect(state, (current) => as(forEach$1(entries, (entry) => store.set(entry.id, entry), {
|
|
63388
63719
|
concurrency: 1,
|
|
@@ -63390,7 +63721,7 @@ var Telemetry = class extends Service$2()("@deslop/scope/services/telemetry/serv
|
|
|
63390
63721
|
}), reduce(entries, current, (all, entry) => set(all, entry.id, entry)))));
|
|
63391
63722
|
}, failed);
|
|
63392
63723
|
const page = fnUntraced(function* (query, signal) {
|
|
63393
|
-
const entries = orderEntries(filterEntries(
|
|
63724
|
+
const entries = orderEntries(filterEntries(yield* selected(query.runs), query, signal), query.sort);
|
|
63394
63725
|
return {
|
|
63395
63726
|
entries: take$3(drop$1(entries, query.offset), query.limit),
|
|
63396
63727
|
total: entries.length
|
|
@@ -63444,22 +63775,35 @@ var Telemetry = class extends Service$2()("@deslop/scope/services/telemetry/serv
|
|
|
63444
63775
|
logs: fn("Telemetry.logs")(function* (query) {
|
|
63445
63776
|
return yield* page(query, "log");
|
|
63446
63777
|
}),
|
|
63778
|
+
reject: fnUntraced(function* (input) {
|
|
63779
|
+
const now = yield* currentTimeMillis;
|
|
63780
|
+
const key = `${input.route}:${input.status}:${input.credential}`;
|
|
63781
|
+
yield* update(rejections, (current) => set$5(current, key, {
|
|
63782
|
+
...input,
|
|
63783
|
+
count: (current[key]?.count ?? 0) + 1,
|
|
63784
|
+
lastAt: now
|
|
63785
|
+
}));
|
|
63786
|
+
}),
|
|
63447
63787
|
services: fn("Telemetry.services")(function* () {
|
|
63448
|
-
return
|
|
63788
|
+
return {
|
|
63789
|
+
rejections: values$2(yield* get$3(rejections)),
|
|
63790
|
+
services: serviceStatuses(yield* read),
|
|
63791
|
+
since
|
|
63792
|
+
};
|
|
63449
63793
|
}),
|
|
63450
63794
|
spans: fn("Telemetry.spans")(function* (query) {
|
|
63451
63795
|
return yield* page(query, "trace");
|
|
63452
63796
|
}),
|
|
63453
63797
|
stats: fn("Telemetry.stats")(function* (query) {
|
|
63454
|
-
return summary(filterEntries(
|
|
63798
|
+
return summary(filterEntries(yield* selected(query.runs), query, "trace"), query);
|
|
63455
63799
|
}),
|
|
63456
63800
|
trace: fn("Telemetry.trace")(function* (id) {
|
|
63457
63801
|
const entries = yield* read;
|
|
63458
63802
|
if (!some(entries, (entry) => entry.traceId === toLowerCase(id))) return yield* TelemetryError.make({ message: "No telemetry received for this trace." });
|
|
63459
|
-
return traceView(filter$1(
|
|
63803
|
+
return traceView(filter$1(entries, (entry) => entry.traceId === toLowerCase(id)), id);
|
|
63460
63804
|
}),
|
|
63461
63805
|
traces: fn("Telemetry.traces")(function* (query) {
|
|
63462
|
-
const active =
|
|
63806
|
+
const active = yield* selected(query.runs);
|
|
63463
63807
|
const byTrace = groupBy(active, (entry) => entry.traceId);
|
|
63464
63808
|
const entries = map$5(dedupe(map$5(filter$1(filterEntries(active, query, "all"), (entry) => entry.traceId !== ""), (entry) => entry.traceId)), (id) => {
|
|
63465
63809
|
const records = byTrace[id] ?? [];
|
|
@@ -63492,16 +63836,16 @@ var Telemetry = class extends Service$2()("@deslop/scope/services/telemetry/serv
|
|
|
63492
63836
|
};
|
|
63493
63837
|
// src/tools/contracts.ts
|
|
63494
63838
|
const Tools = make$6(make$7("list_services", {
|
|
63495
|
-
description: "
|
|
63839
|
+
description: "Check ingestion first: every stored service, its runtime, latest run, last event time and entry count. Event/run times use the exporter clock (Unix nanoseconds), not receiver arrival time. Rejected OTLP requests are grouped by route, HTTP status and credential-header presence, never attributed to an app. Rejection counters and since (Unix milliseconds) reset when Scope restarts. Missing services have never sent retained telemetry.",
|
|
63496
63840
|
failure: TelemetryError,
|
|
63497
|
-
success:
|
|
63841
|
+
success: IngestionStatus
|
|
63498
63842
|
}).annotate(Readonly, true), make$7("find_traces", {
|
|
63499
63843
|
description: "Find traces, each one request or user action across client and server, newest or slowest first. Call it after reproducing a bug, or with sort \"slowest\" before claiming an action is fast; then open one with read_trace.",
|
|
63500
63844
|
failure: TelemetryError,
|
|
63501
63845
|
parameters: SortFilters,
|
|
63502
63846
|
success: TracesPage
|
|
63503
63847
|
}).annotate(Readonly, true), make$7("read_trace", {
|
|
63504
|
-
description: "Read one trace whole: every span in parent order with its depth, start offset, runtime and logs. Shows where an action spent its time and which span failed.",
|
|
63848
|
+
description: "Read one stored trace whole, including earlier runs: every span in parent order with its depth, start offset, runtime and logs. Shows where an action spent its time and which span failed.",
|
|
63505
63849
|
failure: TelemetryError,
|
|
63506
63850
|
parameters: Struct({ id: pipe(TraceId, annotateEncoded({ description: "The 32-character id from find_traces or a span." })) }),
|
|
63507
63851
|
success: Trace
|
|
@@ -63539,7 +63883,7 @@ const ToolHandlers = Tools.toLayer(gen(function* () {
|
|
|
63539
63883
|
find_logs: (filters) => flatMap$1(query(filters), telemetry.logs),
|
|
63540
63884
|
find_spans: (filters) => flatMap$1(query(filters), telemetry.spans),
|
|
63541
63885
|
find_traces: (filters) => flatMap$1(query(filters), telemetry.traces),
|
|
63542
|
-
list_services: () =>
|
|
63886
|
+
list_services: () => telemetry.services(),
|
|
63543
63887
|
measure_latency: (filters) => flatMap$1(query(filters), telemetry.stats),
|
|
63544
63888
|
read_trace: (input) => telemetry.trace(input.id)
|
|
63545
63889
|
});
|
|
@@ -63584,8 +63928,24 @@ const receiver = use((router) => gen(function* () {
|
|
|
63584
63928
|
});
|
|
63585
63929
|
yield* router.add("GET", "/health", text("ready"));
|
|
63586
63930
|
}));
|
|
63931
|
+
const observe = make$28((app) => pipe(app, decompression(), onExit$1((exit) => gen(function* () {
|
|
63932
|
+
const request = yield* HttpServerRequest;
|
|
63933
|
+
const route = headNonEmpty(split(request.url, "?"));
|
|
63934
|
+
const status = exitResponse(exit).status;
|
|
63935
|
+
if (route !== "/v1/traces" && route !== "/v1/logs" || status < 400) return;
|
|
63936
|
+
function credential() {
|
|
63937
|
+
if (request.headers["authorization"] !== void 0) return "authorization";
|
|
63938
|
+
if (request.headers["cookie"] !== void 0) return "cookie";
|
|
63939
|
+
return "none";
|
|
63940
|
+
}
|
|
63941
|
+
yield* (yield* Telemetry).reject({
|
|
63942
|
+
credential: credential(),
|
|
63943
|
+
route,
|
|
63944
|
+
status
|
|
63945
|
+
});
|
|
63946
|
+
}))));
|
|
63587
63947
|
const mcp = pipe(toolkit(Tools), provide$2(ToolHandlers), provide$2(layerMcp({
|
|
63588
|
-
instructions: "Scope is the debugger for the user's Effect apps
|
|
63948
|
+
instructions: "Scope is the debugger for the user's Effect apps. Start with list_services for ingestion freshness and rejected exports, then reproduce the action and use find_traces/read_trace or find_logs. Searches default to each service's latest process/page load/app launch; runs: all includes retained earlier runs in the lookback. read_trace always opens the whole stored trace. Use measure_latency on the same operation before and after a change. If tools are missing, check the client's MCP connection/authentication; stored OAuth credentials alone do not prove a working connection.",
|
|
63589
63949
|
name: "scope",
|
|
63590
63950
|
version
|
|
63591
63951
|
})));
|
|
@@ -63615,10 +63975,10 @@ runMain(pipe(merge$3(pipe(serve(mergeAll$1(pipe(fresh(receiver), provide$2(HttpA
|
|
|
63615
63975
|
credentials: true
|
|
63616
63976
|
})), {
|
|
63617
63977
|
disableLogger: true,
|
|
63618
|
-
middleware:
|
|
63978
|
+
middleware: observe
|
|
63619
63979
|
}), provide$2(layerNodeHttpServer)), pipe(serve(merge$3(fresh(receiver), cors({ allowedHeaders: ["content-type"] })), {
|
|
63620
63980
|
disableLogger: true,
|
|
63621
|
-
middleware:
|
|
63981
|
+
middleware: observe
|
|
63622
63982
|
}), provide$2(layerConfig(createServer, {
|
|
63623
63983
|
host: pipe(String$1("HOST"), withDefault("127.0.0.1")),
|
|
63624
63984
|
port: succeed(4318)
|