@foldkit/oxlint-plugin 0.6.0 → 0.7.0-canary.9869cf777983
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/all.json +23 -3
- package/dist/index.js +1698 -1166
- package/package.json +2 -2
- package/recommended.json +23 -3
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __export = (target, all5) => {
|
|
|
4
4
|
__defProp(target, name, { get: all5[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-
|
|
7
|
+
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.111/node_modules/effect-oxlint/dist/chunk.js
|
|
8
8
|
var __defProp2 = Object.defineProperty;
|
|
9
9
|
var __exportAll = (all5, no_symbols) => {
|
|
10
10
|
let target = {};
|
|
@@ -16,7 +16,7 @@ var __exportAll = (all5, no_symbols) => {
|
|
|
16
16
|
return target;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
19
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Effect.js
|
|
20
20
|
var Effect_exports = {};
|
|
21
21
|
__export(Effect_exports, {
|
|
22
22
|
Do: () => Do5,
|
|
@@ -85,7 +85,7 @@ __export(Effect_exports, {
|
|
|
85
85
|
firstSuccessOf: () => firstSuccessOf2,
|
|
86
86
|
flatMap: () => flatMap5,
|
|
87
87
|
flatMapEager: () => flatMapEager2,
|
|
88
|
-
flatten: () =>
|
|
88
|
+
flatten: () => flatten5,
|
|
89
89
|
flip: () => flip3,
|
|
90
90
|
fn: () => fn2,
|
|
91
91
|
fnUntraced: () => fnUntraced2,
|
|
@@ -100,6 +100,7 @@ __export(Effect_exports, {
|
|
|
100
100
|
fromOption: () => fromOption5,
|
|
101
101
|
fromResult: () => fromResult2,
|
|
102
102
|
gen: () => gen4,
|
|
103
|
+
head: () => head3,
|
|
103
104
|
ignore: () => ignore2,
|
|
104
105
|
ignoreCause: () => ignoreCause2,
|
|
105
106
|
interrupt: () => interrupt2,
|
|
@@ -192,7 +193,7 @@ __export(Effect_exports, {
|
|
|
192
193
|
sleep: () => sleep2,
|
|
193
194
|
spanAnnotations: () => spanAnnotations2,
|
|
194
195
|
spanLinks: () => spanLinks2,
|
|
195
|
-
succeed: () =>
|
|
196
|
+
succeed: () => succeed5,
|
|
196
197
|
succeedNone: () => succeedNone3,
|
|
197
198
|
succeedSome: () => succeedSome3,
|
|
198
199
|
suspend: () => suspend2,
|
|
@@ -248,7 +249,7 @@ __export(Effect_exports, {
|
|
|
248
249
|
zipWith: () => zipWith4
|
|
249
250
|
});
|
|
250
251
|
|
|
251
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
252
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Pipeable.js
|
|
252
253
|
var pipeArguments = (self, args2) => {
|
|
253
254
|
switch (args2.length) {
|
|
254
255
|
case 0:
|
|
@@ -292,7 +293,7 @@ var Class = /* @__PURE__ */ (function() {
|
|
|
292
293
|
return PipeableBase;
|
|
293
294
|
})();
|
|
294
295
|
|
|
295
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
296
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Function.js
|
|
296
297
|
var dual = function(arity, body) {
|
|
297
298
|
if (typeof arity === "function") {
|
|
298
299
|
return function() {
|
|
@@ -346,16 +347,26 @@ function pipe(a, ...args2) {
|
|
|
346
347
|
function memoize(f) {
|
|
347
348
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
348
349
|
return (a) => {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
const cached3 = cache.get(a);
|
|
351
|
+
if (cached3 !== void 0) return cached3;
|
|
352
|
+
const result3 = f(a);
|
|
353
|
+
cache.set(a, result3);
|
|
354
|
+
return result3;
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function memoizeIdempotent(f) {
|
|
358
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
359
|
+
return (a) => {
|
|
360
|
+
const cached3 = cache.get(a);
|
|
361
|
+
if (cached3 !== void 0) return cached3;
|
|
352
362
|
const result3 = f(a);
|
|
353
363
|
cache.set(a, result3);
|
|
364
|
+
cache.set(result3, result3);
|
|
354
365
|
return result3;
|
|
355
366
|
};
|
|
356
367
|
}
|
|
357
368
|
|
|
358
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
369
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/equal.js
|
|
359
370
|
var getAllObjectKeys = (obj) => {
|
|
360
371
|
const keys2 = new Set(Reflect.ownKeys(obj));
|
|
361
372
|
if (obj.constructor === Object) return keys2;
|
|
@@ -378,7 +389,7 @@ var getAllObjectKeys = (obj) => {
|
|
|
378
389
|
};
|
|
379
390
|
var byReferenceInstances = /* @__PURE__ */ new WeakSet();
|
|
380
391
|
|
|
381
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
392
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Predicate.js
|
|
382
393
|
function isString(input) {
|
|
383
394
|
return typeof input === "string";
|
|
384
395
|
}
|
|
@@ -412,7 +423,7 @@ function isIterable(input) {
|
|
|
412
423
|
return hasProperty(input, Symbol.iterator) || isString(input);
|
|
413
424
|
}
|
|
414
425
|
|
|
415
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
426
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Hash.js
|
|
416
427
|
var symbol = "~effect/interfaces/Hash";
|
|
417
428
|
var hash = (self) => {
|
|
418
429
|
switch (typeof self) {
|
|
@@ -433,6 +444,9 @@ var hash = (self) => {
|
|
|
433
444
|
if (self === null) {
|
|
434
445
|
return string("null");
|
|
435
446
|
} else if (self instanceof Date) {
|
|
447
|
+
if (Number.isNaN(self.getTime())) {
|
|
448
|
+
return string("Invalid Date");
|
|
449
|
+
}
|
|
436
450
|
return string(self.toISOString());
|
|
437
451
|
} else if (self instanceof RegExp) {
|
|
438
452
|
return string(self.toString());
|
|
@@ -448,6 +462,8 @@ var hash = (self) => {
|
|
|
448
462
|
return self[symbol]();
|
|
449
463
|
} else if (typeof self === "function") {
|
|
450
464
|
return random(self);
|
|
465
|
+
} else if (self instanceof DataView) {
|
|
466
|
+
return array(new Uint8Array(self.buffer, self.byteOffset, self.byteLength));
|
|
451
467
|
} else if (Array.isArray(self) || ArrayBuffer.isView(self)) {
|
|
452
468
|
return array(self);
|
|
453
469
|
} else if (self instanceof Map) {
|
|
@@ -531,7 +547,7 @@ function withVisitedTracking(obj, fn3) {
|
|
|
531
547
|
return result3;
|
|
532
548
|
}
|
|
533
549
|
|
|
534
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
550
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Equal.js
|
|
535
551
|
var symbol2 = "~effect/interfaces/Equal";
|
|
536
552
|
function equals() {
|
|
537
553
|
if (arguments.length === 1) {
|
|
@@ -580,7 +596,9 @@ function compareObjects(self, that) {
|
|
|
580
596
|
return false;
|
|
581
597
|
} else if (self instanceof Date) {
|
|
582
598
|
if (!(that instanceof Date)) return false;
|
|
583
|
-
|
|
599
|
+
const selfTime = self.getTime();
|
|
600
|
+
const thatTime = that.getTime();
|
|
601
|
+
return selfTime === thatTime || Number.isNaN(selfTime) && Number.isNaN(thatTime);
|
|
584
602
|
} else if (self instanceof RegExp) {
|
|
585
603
|
if (!(that instanceof RegExp)) return false;
|
|
586
604
|
return self.toString() === that.toString();
|
|
@@ -601,9 +619,14 @@ function compareObjects(self, that) {
|
|
|
601
619
|
}
|
|
602
620
|
return compareArrays(self, that);
|
|
603
621
|
} else if (ArrayBuffer.isView(self)) {
|
|
604
|
-
|
|
622
|
+
const selfIsDataView = self instanceof DataView;
|
|
623
|
+
if (!ArrayBuffer.isView(that) || self.byteLength !== that.byteLength || selfIsDataView !== that instanceof DataView) {
|
|
605
624
|
return false;
|
|
606
625
|
}
|
|
626
|
+
if (selfIsDataView) {
|
|
627
|
+
const thatDataView = that;
|
|
628
|
+
return compareTypedArrays(new Uint8Array(self.buffer, self.byteOffset, self.byteLength), new Uint8Array(thatDataView.buffer, thatDataView.byteOffset, thatDataView.byteLength));
|
|
629
|
+
}
|
|
607
630
|
return compareTypedArrays(self, that);
|
|
608
631
|
} else if (self instanceof Map) {
|
|
609
632
|
if (!(that instanceof Map) || self.size !== that.size) {
|
|
@@ -672,10 +695,14 @@ function compareRecords(self, that) {
|
|
|
672
695
|
}
|
|
673
696
|
function makeCompareMap(keyEquivalence, valueEquivalence) {
|
|
674
697
|
return function compareMaps2(self, that) {
|
|
698
|
+
const thatEntries = Array.from(that);
|
|
675
699
|
for (const [selfKey, selfValue] of self) {
|
|
676
700
|
let found = false;
|
|
677
|
-
for (
|
|
701
|
+
for (let i = 0; i < thatEntries.length; i++) {
|
|
702
|
+
const [thatKey, thatValue] = thatEntries[i];
|
|
678
703
|
if (keyEquivalence(selfKey, thatKey) && valueEquivalence(selfValue, thatValue)) {
|
|
704
|
+
thatEntries[i] = thatEntries[thatEntries.length - 1];
|
|
705
|
+
thatEntries.pop();
|
|
679
706
|
found = true;
|
|
680
707
|
break;
|
|
681
708
|
}
|
|
@@ -690,10 +717,14 @@ function makeCompareMap(keyEquivalence, valueEquivalence) {
|
|
|
690
717
|
var compareMaps = /* @__PURE__ */ makeCompareMap(compareBoth, compareBoth);
|
|
691
718
|
function makeCompareSet(equivalence) {
|
|
692
719
|
return function compareSets2(self, that) {
|
|
720
|
+
const thatValues = Array.from(that);
|
|
693
721
|
for (const selfValue of self) {
|
|
694
722
|
let found = false;
|
|
695
|
-
for (
|
|
723
|
+
for (let i = 0; i < thatValues.length; i++) {
|
|
724
|
+
const thatValue = thatValues[i];
|
|
696
725
|
if (equivalence(selfValue, thatValue)) {
|
|
726
|
+
thatValues[i] = thatValues[thatValues.length - 1];
|
|
727
|
+
thatValues.pop();
|
|
697
728
|
found = true;
|
|
698
729
|
break;
|
|
699
730
|
}
|
|
@@ -713,7 +744,7 @@ var byReferenceUnsafe = (obj) => {
|
|
|
713
744
|
return obj;
|
|
714
745
|
};
|
|
715
746
|
|
|
716
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
747
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Redactable.js
|
|
717
748
|
var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Redactable");
|
|
718
749
|
var isRedactable = (u) => hasProperty(u, symbolRedactable);
|
|
719
750
|
function redact(u) {
|
|
@@ -724,18 +755,21 @@ function getRedacted(redactable) {
|
|
|
724
755
|
return redactable[symbolRedactable](globalThis[currentFiberTypeId]?.context ?? emptyContext);
|
|
725
756
|
}
|
|
726
757
|
var currentFiberTypeId = "~effect/Fiber/currentFiber";
|
|
758
|
+
var emptyMap = /* @__PURE__ */ new Map();
|
|
727
759
|
var emptyContext = {
|
|
728
760
|
"~effect/Context": {},
|
|
729
|
-
|
|
761
|
+
base: emptyMap,
|
|
762
|
+
depth: 0,
|
|
763
|
+
mapUnsafe: emptyMap,
|
|
730
764
|
pipe() {
|
|
731
765
|
return pipeArguments(this, arguments);
|
|
732
766
|
}
|
|
733
767
|
};
|
|
734
768
|
|
|
735
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
769
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Formatter.js
|
|
736
770
|
function format(input, options) {
|
|
737
771
|
const space = options?.space ?? 0;
|
|
738
|
-
const
|
|
772
|
+
const ancestors = /* @__PURE__ */ new WeakSet();
|
|
739
773
|
const gap = !space ? "" : typeof space === "number" ? " ".repeat(space) : space;
|
|
740
774
|
const ind = (d) => gap.repeat(d);
|
|
741
775
|
const wrap = (v, body) => {
|
|
@@ -749,47 +783,45 @@ function format(input, options) {
|
|
|
749
783
|
return ["[ownKeys threw]"];
|
|
750
784
|
}
|
|
751
785
|
};
|
|
752
|
-
function
|
|
753
|
-
if (Array.isArray(v)) {
|
|
754
|
-
if (seen.has(v)) return CIRCULAR;
|
|
755
|
-
seen.add(v);
|
|
756
|
-
if (!gap || v.length <= 1) return `[${v.map((x) => recur2(x, d)).join(",")}]`;
|
|
757
|
-
const inner = v.map((x) => recur2(x, d + 1)).join(",\n" + ind(d + 1));
|
|
758
|
-
return `[
|
|
759
|
-
${ind(d + 1)}${inner}
|
|
760
|
-
${ind(d)}]`;
|
|
761
|
-
}
|
|
762
|
-
if (v instanceof Date) return formatDate(v);
|
|
763
|
-
if (!options?.ignoreToString && hasProperty(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) {
|
|
764
|
-
const s = safeToString(v);
|
|
765
|
-
if (v instanceof Error && v.cause) {
|
|
766
|
-
return `${s} (cause: ${recur2(v.cause, d)})`;
|
|
767
|
-
}
|
|
768
|
-
return s;
|
|
769
|
-
}
|
|
786
|
+
function recur(v, d = 0) {
|
|
770
787
|
if (typeof v === "string") return JSON.stringify(v);
|
|
771
788
|
if (typeof v === "number" || v == null || typeof v === "boolean" || typeof v === "symbol") return String(v);
|
|
772
789
|
if (typeof v === "bigint") return String(v) + "n";
|
|
773
790
|
if (typeof v === "object" || typeof v === "function") {
|
|
774
|
-
if (
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
if (
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
791
|
+
if (ancestors.has(v)) return CIRCULAR;
|
|
792
|
+
ancestors.add(v);
|
|
793
|
+
let output;
|
|
794
|
+
if (symbolRedactable in v) {
|
|
795
|
+
output = recur(getRedacted(v), d);
|
|
796
|
+
} else if (Array.isArray(v)) {
|
|
797
|
+
output = !gap || v.length <= 1 ? `[${v.map((x) => recur(x, d)).join(",")}]` : `[
|
|
798
|
+
${ind(d + 1)}${v.map((x) => recur(x, d + 1)).join(",\n" + ind(d + 1))}
|
|
799
|
+
${ind(d)}]`;
|
|
800
|
+
} else if (v instanceof Date) {
|
|
801
|
+
output = formatDate(v);
|
|
802
|
+
} else if (!options?.ignoreToString && hasProperty(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) {
|
|
803
|
+
const s = safeToString(v);
|
|
804
|
+
output = v instanceof Error && v.cause ? `${s} (cause: ${recur(v.cause, d)})` : s;
|
|
805
|
+
} else if (Symbol.iterator in v) {
|
|
806
|
+
output = `${v.constructor.name}(${recur(Array.from(v), d)})`;
|
|
807
|
+
} else {
|
|
808
|
+
const keys2 = ownKeys(v);
|
|
809
|
+
if (!gap || keys2.length <= 1) {
|
|
810
|
+
const body = `{${keys2.map((k) => `${formatPropertyKey(k)}:${recur(v[k], d)}`).join(",")}}`;
|
|
811
|
+
output = wrap(v, body);
|
|
812
|
+
} else {
|
|
813
|
+
const body = `{
|
|
814
|
+
${keys2.map((k) => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(v[k], d + 1)}`).join(",\n")}
|
|
787
815
|
${ind(d)}}`;
|
|
788
|
-
|
|
816
|
+
output = wrap(v, body);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
ancestors.delete(v);
|
|
820
|
+
return output;
|
|
789
821
|
}
|
|
790
822
|
return String(v);
|
|
791
823
|
}
|
|
792
|
-
return
|
|
824
|
+
return recur(input, 0);
|
|
793
825
|
}
|
|
794
826
|
var CIRCULAR = "[Circular]";
|
|
795
827
|
function formatPropertyKey(name) {
|
|
@@ -815,8 +847,12 @@ function safeToString(input) {
|
|
|
815
847
|
}
|
|
816
848
|
function formatJson(input, options) {
|
|
817
849
|
const ancestors = [];
|
|
818
|
-
return JSON.stringify(input, function(
|
|
819
|
-
const
|
|
850
|
+
return JSON.stringify(input, function(key, value) {
|
|
851
|
+
const original = Object.getOwnPropertyDescriptor(this, key)?.value;
|
|
852
|
+
const redacted = hasProperty(original, symbolRedactable) ? redact(original) : redact(value);
|
|
853
|
+
if (typeof redacted === "bigint") {
|
|
854
|
+
return format(redacted);
|
|
855
|
+
}
|
|
820
856
|
if (typeof redacted !== "object" || redacted === null) {
|
|
821
857
|
return redacted;
|
|
822
858
|
}
|
|
@@ -828,22 +864,23 @@ function formatJson(input, options) {
|
|
|
828
864
|
}
|
|
829
865
|
ancestors.push(redacted);
|
|
830
866
|
return redacted;
|
|
831
|
-
}, options?.space);
|
|
867
|
+
}, options?.space) ?? "null";
|
|
832
868
|
}
|
|
833
869
|
|
|
834
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
870
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Inspectable.js
|
|
835
871
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
836
872
|
var toJson = (input) => {
|
|
837
873
|
try {
|
|
874
|
+
input = redact(input);
|
|
838
875
|
if (hasProperty(input, "toJSON") && isFunction(input["toJSON"]) && input["toJSON"].length === 0) {
|
|
839
876
|
return input.toJSON();
|
|
840
877
|
} else if (Array.isArray(input)) {
|
|
841
878
|
return input.map(toJson);
|
|
842
879
|
}
|
|
880
|
+
return input;
|
|
843
881
|
} catch {
|
|
844
882
|
return "[toJSON threw]";
|
|
845
883
|
}
|
|
846
|
-
return redact(input);
|
|
847
884
|
};
|
|
848
885
|
var toStringUnknown = (u, whitespace = 2) => {
|
|
849
886
|
if (typeof u === "string") {
|
|
@@ -852,7 +889,9 @@ var toStringUnknown = (u, whitespace = 2) => {
|
|
|
852
889
|
try {
|
|
853
890
|
return typeof u === "object" ? formatJson(u, {
|
|
854
891
|
space: whitespace
|
|
855
|
-
}) :
|
|
892
|
+
}) : format(u, {
|
|
893
|
+
space: whitespace
|
|
894
|
+
});
|
|
856
895
|
} catch {
|
|
857
896
|
return String(u);
|
|
858
897
|
}
|
|
@@ -895,7 +934,7 @@ var Class2 = class {
|
|
|
895
934
|
}
|
|
896
935
|
};
|
|
897
936
|
|
|
898
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
937
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Utils.js
|
|
899
938
|
var SingleShotGen = class _SingleShotGen {
|
|
900
939
|
called = false;
|
|
901
940
|
self;
|
|
@@ -955,7 +994,7 @@ var pickInternalCall = () => {
|
|
|
955
994
|
};
|
|
956
995
|
var internalCall = /* @__PURE__ */ pickInternalCall();
|
|
957
996
|
|
|
958
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
997
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/record.js
|
|
959
998
|
function assignProperty(self, key, value) {
|
|
960
999
|
if (key === "__proto__") {
|
|
961
1000
|
Object.defineProperty(self, key, {
|
|
@@ -977,7 +1016,7 @@ function assignProperties(self, source) {
|
|
|
977
1016
|
}
|
|
978
1017
|
}
|
|
979
1018
|
|
|
980
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1019
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/core.js
|
|
981
1020
|
var EffectTypeId = `~effect/Effect`;
|
|
982
1021
|
var ExitTypeId = `~effect/Exit`;
|
|
983
1022
|
var effectVariance = {
|
|
@@ -1192,12 +1231,12 @@ var makePrimitive = (options) => {
|
|
|
1192
1231
|
};
|
|
1193
1232
|
var makeExit = (options) => {
|
|
1194
1233
|
const Proto3 = {
|
|
1195
|
-
...makePrimitiveProto(options),
|
|
1196
1234
|
[ExitTypeId]: ExitTypeId,
|
|
1197
1235
|
_tag: options.op,
|
|
1198
1236
|
get [options.prop]() {
|
|
1199
1237
|
return this[args];
|
|
1200
1238
|
},
|
|
1239
|
+
...makePrimitiveProto(options),
|
|
1201
1240
|
toString() {
|
|
1202
1241
|
return `${options.op}(${format(this[args])})`;
|
|
1203
1242
|
},
|
|
@@ -1337,30 +1376,13 @@ var done = (value) => {
|
|
|
1337
1376
|
return exitFail(Done(value));
|
|
1338
1377
|
};
|
|
1339
1378
|
|
|
1340
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1379
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Effectable.js
|
|
1341
1380
|
var Prototype2 = (options) => makePrimitiveProto({
|
|
1342
1381
|
op: options.label,
|
|
1343
1382
|
[evaluate]: options.evaluate
|
|
1344
1383
|
});
|
|
1345
1384
|
|
|
1346
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1347
|
-
var isStackTraceLimitWritable = () => {
|
|
1348
|
-
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
1349
|
-
if (desc === void 0) {
|
|
1350
|
-
return Object.isExtensible(Error);
|
|
1351
|
-
}
|
|
1352
|
-
return Object.hasOwn(desc, "writable") ? desc.writable === true : desc.set !== void 0;
|
|
1353
|
-
};
|
|
1354
|
-
var canWriteStackTraceLimit = /* @__PURE__ */ isStackTraceLimitWritable();
|
|
1355
|
-
var getStackTraceLimit = () => Error.stackTraceLimit;
|
|
1356
|
-
var setStackTraceLimit = (value) => {
|
|
1357
|
-
if (canWriteStackTraceLimit) {
|
|
1358
|
-
;
|
|
1359
|
-
Error.stackTraceLimit = value;
|
|
1360
|
-
}
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/Option.js
|
|
1385
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Option.js
|
|
1364
1386
|
var Option_exports = {};
|
|
1365
1387
|
__export(Option_exports, {
|
|
1366
1388
|
Do: () => Do,
|
|
@@ -1425,14 +1447,14 @@ __export(Option_exports, {
|
|
|
1425
1447
|
zipWith: () => zipWith
|
|
1426
1448
|
});
|
|
1427
1449
|
|
|
1428
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1450
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Combiner.js
|
|
1429
1451
|
function make(combine2) {
|
|
1430
1452
|
return {
|
|
1431
1453
|
combine: combine2
|
|
1432
1454
|
};
|
|
1433
1455
|
}
|
|
1434
1456
|
|
|
1435
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1457
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Reducer.js
|
|
1436
1458
|
function make2(combine2, initialValue, combineAll2) {
|
|
1437
1459
|
return {
|
|
1438
1460
|
combine: combine2,
|
|
@@ -1447,7 +1469,7 @@ function make2(combine2, initialValue, combineAll2) {
|
|
|
1447
1469
|
};
|
|
1448
1470
|
}
|
|
1449
1471
|
|
|
1450
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1472
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Equivalence.js
|
|
1451
1473
|
var make3 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
1452
1474
|
function Array_(item) {
|
|
1453
1475
|
return make3((self, that) => {
|
|
@@ -1459,7 +1481,7 @@ function Array_(item) {
|
|
|
1459
1481
|
});
|
|
1460
1482
|
}
|
|
1461
1483
|
|
|
1462
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1484
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/doNotation.js
|
|
1463
1485
|
var let_ = (map8) => dual(3, (self, name, f) => map8(self, (a) => ({
|
|
1464
1486
|
...a,
|
|
1465
1487
|
[name]: f(a)
|
|
@@ -1472,7 +1494,7 @@ var bind = (map8, flatMap6) => dual(3, (self, name, f) => flatMap6(self, (a) =>
|
|
|
1472
1494
|
[name]: b
|
|
1473
1495
|
}))));
|
|
1474
1496
|
|
|
1475
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1497
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/option.js
|
|
1476
1498
|
var TypeId = "~effect/data/Option";
|
|
1477
1499
|
var CommonProto = {
|
|
1478
1500
|
[TypeId]: {
|
|
@@ -1538,7 +1560,7 @@ var some = (value) => {
|
|
|
1538
1560
|
return a;
|
|
1539
1561
|
};
|
|
1540
1562
|
|
|
1541
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1563
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/result.js
|
|
1542
1564
|
var TypeId2 = "~effect/data/Result";
|
|
1543
1565
|
var CommonProto2 = {
|
|
1544
1566
|
[TypeId2]: {
|
|
@@ -1608,7 +1630,7 @@ var getFailure = (self) => isSuccess(self) ? none : some(self.failure);
|
|
|
1608
1630
|
var getSuccess = (self) => isFailure(self) ? none : some(self.success);
|
|
1609
1631
|
var fromOption = /* @__PURE__ */ dual(2, (self, onNone) => isNone(self) ? fail(onNone()) : succeed(self.value));
|
|
1610
1632
|
|
|
1611
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1633
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Order.js
|
|
1612
1634
|
function make4(compare) {
|
|
1613
1635
|
return (self, that) => self === that ? 0 : compare(self, that);
|
|
1614
1636
|
}
|
|
@@ -1649,7 +1671,7 @@ var isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
|
|
|
1649
1671
|
var min = (O) => dual(2, (self, that) => self === that || O(self, that) < 1 ? self : that);
|
|
1650
1672
|
var max = (O) => dual(2, (self, that) => self === that || O(self, that) > -1 ? self : that);
|
|
1651
1673
|
|
|
1652
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1674
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Option.js
|
|
1653
1675
|
var none2 = () => none;
|
|
1654
1676
|
var some2 = some;
|
|
1655
1677
|
var isOption2 = isOption;
|
|
@@ -1827,38 +1849,29 @@ function makeReducerFailFast(reducer2) {
|
|
|
1827
1849
|
});
|
|
1828
1850
|
}
|
|
1829
1851
|
|
|
1830
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1852
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Context.js
|
|
1831
1853
|
var ServiceTypeId = "~effect/Context/Service";
|
|
1832
1854
|
var Service = function() {
|
|
1833
|
-
const prevLimit = getStackTraceLimit();
|
|
1834
|
-
setStackTraceLimit(2);
|
|
1835
|
-
const err = new Error();
|
|
1836
|
-
setStackTraceLimit(prevLimit);
|
|
1837
1855
|
function KeyClass() {
|
|
1838
1856
|
}
|
|
1839
1857
|
const self = KeyClass;
|
|
1840
1858
|
Object.setPrototypeOf(self, ServiceProto);
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
}
|
|
1845
|
-
});
|
|
1846
|
-
if (arguments.length > 0) {
|
|
1847
|
-
self.key = arguments[0];
|
|
1848
|
-
if (arguments[1]?.defaultValue) {
|
|
1859
|
+
const init2 = (key, options) => {
|
|
1860
|
+
self.key = key;
|
|
1861
|
+
if (options?.defaultValue) {
|
|
1849
1862
|
self[ReferenceTypeId] = ReferenceTypeId;
|
|
1850
|
-
self.defaultValue =
|
|
1863
|
+
self.defaultValue = options.defaultValue;
|
|
1851
1864
|
}
|
|
1852
|
-
return self;
|
|
1853
|
-
}
|
|
1854
|
-
return function(key, options) {
|
|
1855
|
-
self.key = key;
|
|
1856
1865
|
if (options?.make) {
|
|
1857
1866
|
;
|
|
1858
1867
|
self.make = options.make;
|
|
1859
1868
|
}
|
|
1869
|
+
if (options?.fiberCached) {
|
|
1870
|
+
cacheKeys.add(key);
|
|
1871
|
+
}
|
|
1860
1872
|
return self;
|
|
1861
1873
|
};
|
|
1874
|
+
return arguments.length > 0 ? init2(arguments[0], arguments[1]) : init2;
|
|
1862
1875
|
};
|
|
1863
1876
|
var ServiceProto = {
|
|
1864
1877
|
[ServiceTypeId]: ServiceTypeId,
|
|
@@ -1871,8 +1884,7 @@ var ServiceProto = {
|
|
|
1871
1884
|
toJSON() {
|
|
1872
1885
|
return {
|
|
1873
1886
|
_id: "Service",
|
|
1874
|
-
key: this.key
|
|
1875
|
-
stack: this.stack
|
|
1887
|
+
key: this.key
|
|
1876
1888
|
};
|
|
1877
1889
|
},
|
|
1878
1890
|
of(self) {
|
|
@@ -1888,15 +1900,58 @@ var ServiceProto = {
|
|
|
1888
1900
|
return withFiber((fiber3) => exitSucceed(f(get(fiber3.context, this))));
|
|
1889
1901
|
}
|
|
1890
1902
|
};
|
|
1903
|
+
var cacheKeys = /* @__PURE__ */ new Set();
|
|
1891
1904
|
var ReferenceTypeId = "~effect/Context/Reference";
|
|
1892
1905
|
var TypeId3 = "~effect/Context";
|
|
1893
|
-
var
|
|
1906
|
+
var MaxDepth = 8;
|
|
1907
|
+
var FlattenAfterBaseHits = 8;
|
|
1908
|
+
var makeImpl = (cacheRoot, base, overlay, depth) => {
|
|
1894
1909
|
const self = Object.create(Proto);
|
|
1895
|
-
self.
|
|
1896
|
-
self.
|
|
1910
|
+
self.cacheRoot = cacheRoot ?? self;
|
|
1911
|
+
self.base = base;
|
|
1912
|
+
self.overlay = overlay;
|
|
1913
|
+
self.depth = depth;
|
|
1914
|
+
self._flat = void 0;
|
|
1915
|
+
self.baseHits = 0;
|
|
1897
1916
|
return self;
|
|
1898
1917
|
};
|
|
1918
|
+
var applyOverlays = (map8, overlay) => {
|
|
1919
|
+
if (!overlay) return;
|
|
1920
|
+
applyOverlays(map8, overlay.parent);
|
|
1921
|
+
map8.set(overlay.key, overlay.value);
|
|
1922
|
+
};
|
|
1923
|
+
var flatten2 = (self) => {
|
|
1924
|
+
if (self._flat) return self._flat;
|
|
1925
|
+
if (!self.overlay) return self._flat = self.base;
|
|
1926
|
+
const map8 = new Map(self.base);
|
|
1927
|
+
applyOverlays(map8, self.overlay);
|
|
1928
|
+
return self._flat = map8;
|
|
1929
|
+
};
|
|
1930
|
+
var withFlat = (self, f) => {
|
|
1931
|
+
const map8 = new Map(self.mapUnsafe);
|
|
1932
|
+
f(map8);
|
|
1933
|
+
return makeUnsafe(map8);
|
|
1934
|
+
};
|
|
1935
|
+
var notFound = /* @__PURE__ */ Symbol();
|
|
1936
|
+
var lookup = (self, key) => {
|
|
1937
|
+
const impl = self;
|
|
1938
|
+
for (let overlay = impl.overlay; overlay; overlay = overlay.parent) {
|
|
1939
|
+
if (overlay.key === key) return overlay.value;
|
|
1940
|
+
}
|
|
1941
|
+
const value = impl.base.get(key);
|
|
1942
|
+
if (value === void 0 && !impl.base.has(key)) return notFound;
|
|
1943
|
+
if (impl.overlay && ++impl.baseHits >= FlattenAfterBaseHits) {
|
|
1944
|
+
impl.base = flatten2(impl);
|
|
1945
|
+
impl.overlay = void 0;
|
|
1946
|
+
impl.depth = 0;
|
|
1947
|
+
}
|
|
1948
|
+
return value;
|
|
1949
|
+
};
|
|
1950
|
+
var makeUnsafe = (mapUnsafe) => makeImpl(void 0, mapUnsafe, void 0, 0);
|
|
1899
1951
|
var Proto = {
|
|
1952
|
+
get mapUnsafe() {
|
|
1953
|
+
return flatten2(this);
|
|
1954
|
+
},
|
|
1900
1955
|
...PipeInspectableProto,
|
|
1901
1956
|
[TypeId3]: {
|
|
1902
1957
|
_Services: (_) => _
|
|
@@ -1911,11 +1966,12 @@ var Proto = {
|
|
|
1911
1966
|
};
|
|
1912
1967
|
},
|
|
1913
1968
|
[symbol2](that) {
|
|
1914
|
-
if (!isContext(that)
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1969
|
+
if (!isContext(that)) return false;
|
|
1970
|
+
const self = this.mapUnsafe;
|
|
1971
|
+
const other = that.mapUnsafe;
|
|
1972
|
+
if (self.size !== other.size) return false;
|
|
1973
|
+
for (const [key, value] of self) {
|
|
1974
|
+
if (!other.has(key) || !equals(value, other.get(key))) return false;
|
|
1919
1975
|
}
|
|
1920
1976
|
return true;
|
|
1921
1977
|
},
|
|
@@ -1923,29 +1979,41 @@ var Proto = {
|
|
|
1923
1979
|
return number(this.mapUnsafe.size);
|
|
1924
1980
|
}
|
|
1925
1981
|
};
|
|
1982
|
+
var hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
|
|
1926
1983
|
var isContext = (u) => hasProperty(u, TypeId3);
|
|
1927
|
-
var isReference = (u) =>
|
|
1984
|
+
var isReference = (u) => !!u[ReferenceTypeId];
|
|
1928
1985
|
var empty = () => emptyContext2;
|
|
1929
1986
|
var emptyContext2 = /* @__PURE__ */ makeUnsafe(/* @__PURE__ */ new Map());
|
|
1930
1987
|
var make5 = (key, service3) => makeUnsafe(/* @__PURE__ */ new Map([[key.key, service3]]));
|
|
1931
|
-
var add = /* @__PURE__ */ dual(3, (self, key, service3) =>
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1988
|
+
var add = /* @__PURE__ */ dual(3, (self, key, service3) => addUnsafe(self, key.key, service3));
|
|
1989
|
+
var addUnsafe = (self, key, service3) => {
|
|
1990
|
+
const impl = self;
|
|
1991
|
+
const cacheRoot = cacheKeys.has(key) ? void 0 : impl.cacheRoot;
|
|
1992
|
+
if (impl.depth >= MaxDepth) {
|
|
1993
|
+
const map8 = new Map(impl.mapUnsafe);
|
|
1994
|
+
map8.set(key, service3);
|
|
1995
|
+
return makeImpl(cacheRoot, map8, void 0, 0);
|
|
1996
|
+
}
|
|
1997
|
+
return makeImpl(cacheRoot, impl.base, {
|
|
1998
|
+
key,
|
|
1999
|
+
value: service3,
|
|
2000
|
+
parent: impl.overlay
|
|
2001
|
+
}, impl.depth + 1);
|
|
2002
|
+
};
|
|
2003
|
+
var getOrUndefined2 = /* @__PURE__ */ dual(2, (self, key) => getOrUndefinedUnsafe(self, key.key));
|
|
2004
|
+
var getOrUndefinedUnsafe = (self, key) => {
|
|
2005
|
+
const value = lookup(self, key);
|
|
2006
|
+
return value === notFound ? void 0 : value;
|
|
2007
|
+
};
|
|
1935
2008
|
var getUnsafe = /* @__PURE__ */ dual(2, (self, service3) => {
|
|
1936
|
-
|
|
1937
|
-
|
|
2009
|
+
const value = lookup(self, service3.key);
|
|
2010
|
+
if (value === notFound) {
|
|
2011
|
+
if (isReference(service3)) return getDefaultValue(service3);
|
|
1938
2012
|
throw serviceNotFoundError(service3);
|
|
1939
2013
|
}
|
|
1940
|
-
return
|
|
2014
|
+
return value;
|
|
1941
2015
|
});
|
|
1942
2016
|
var get = getUnsafe;
|
|
1943
|
-
var getReferenceUnsafe = (self, service3) => {
|
|
1944
|
-
if (!self.mapUnsafe.has(service3.key)) {
|
|
1945
|
-
return getDefaultValue(service3);
|
|
1946
|
-
}
|
|
1947
|
-
return self.mapUnsafe.get(service3.key);
|
|
1948
|
-
};
|
|
1949
2017
|
var defaultValueCacheKey = "~effect/Context/defaultValue";
|
|
1950
2018
|
var getDefaultValue = (ref) => {
|
|
1951
2019
|
if (defaultValueCacheKey in ref) {
|
|
@@ -1955,15 +2023,6 @@ var getDefaultValue = (ref) => {
|
|
|
1955
2023
|
};
|
|
1956
2024
|
var serviceNotFoundError = (service3) => {
|
|
1957
2025
|
const error = new Error(`Service not found${service3.key ? `: ${String(service3.key)}` : ""}`);
|
|
1958
|
-
if (service3.stack) {
|
|
1959
|
-
const lines = service3.stack.split("\n");
|
|
1960
|
-
if (lines.length > 2) {
|
|
1961
|
-
const afterAt = lines[2].match(/at (.*)/);
|
|
1962
|
-
if (afterAt) {
|
|
1963
|
-
error.message = error.message + ` (defined at ${afterAt[1]})`;
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
2026
|
if (error.stack) {
|
|
1968
2027
|
const lines = error.stack.split("\n");
|
|
1969
2028
|
lines.splice(1, 3);
|
|
@@ -1972,17 +2031,14 @@ var serviceNotFoundError = (service3) => {
|
|
|
1972
2031
|
return error;
|
|
1973
2032
|
};
|
|
1974
2033
|
var getOption = /* @__PURE__ */ dual(2, (self, service3) => {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
}
|
|
2034
|
+
const value = lookup(self, service3.key);
|
|
2035
|
+
if (value !== notFound) return some2(value);
|
|
1978
2036
|
return isReference(service3) ? some2(getDefaultValue(service3)) : none2();
|
|
1979
2037
|
});
|
|
1980
2038
|
var merge = /* @__PURE__ */ dual(2, (self, that) => {
|
|
1981
2039
|
if (self.mapUnsafe.size === 0) return that;
|
|
1982
2040
|
if (that.mapUnsafe.size === 0) return self;
|
|
1983
|
-
return
|
|
1984
|
-
that.mapUnsafe.forEach((value, key) => map8.set(key, value));
|
|
1985
|
-
});
|
|
2041
|
+
return withFlat(self, (map8) => that.mapUnsafe.forEach((value, key) => map8.set(key, value)));
|
|
1986
2042
|
});
|
|
1987
2043
|
var mergeAll = (...ctxs) => {
|
|
1988
2044
|
const map8 = /* @__PURE__ */ new Map();
|
|
@@ -1993,25 +2049,27 @@ var mergeAll = (...ctxs) => {
|
|
|
1993
2049
|
}
|
|
1994
2050
|
return makeUnsafe(map8);
|
|
1995
2051
|
};
|
|
1996
|
-
var withMapUnsafe = (self, f) => {
|
|
1997
|
-
if (self.mutable) {
|
|
1998
|
-
f(self.mapUnsafe);
|
|
1999
|
-
return self;
|
|
2000
|
-
}
|
|
2001
|
-
const map8 = new Map(self.mapUnsafe);
|
|
2002
|
-
f(map8);
|
|
2003
|
-
return makeUnsafe(map8);
|
|
2004
|
-
};
|
|
2005
2052
|
var Reference = Service;
|
|
2006
2053
|
|
|
2007
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2054
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Duration.js
|
|
2008
2055
|
var TypeId4 = "~effect/time/Duration";
|
|
2009
2056
|
var bigint0 = /* @__PURE__ */ BigInt(0);
|
|
2010
2057
|
var bigint1 = /* @__PURE__ */ BigInt(1);
|
|
2058
|
+
var bigint2 = /* @__PURE__ */ BigInt(2);
|
|
2059
|
+
var bigint10 = /* @__PURE__ */ BigInt(10);
|
|
2011
2060
|
var bigint1e3 = /* @__PURE__ */ BigInt(1e3);
|
|
2012
2061
|
var roundTiesAwayFromZero = (input) => BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5));
|
|
2013
2062
|
var roundMillisToNanos = (millis2) => roundTiesAwayFromZero(millis2 * 1e6);
|
|
2014
|
-
var parseNanos = (input, scale) =>
|
|
2063
|
+
var parseNanos = (input, scale) => {
|
|
2064
|
+
const decimalIndex = input.indexOf(".");
|
|
2065
|
+
if (decimalIndex === -1) return BigInt(input) * scale;
|
|
2066
|
+
const isNegative = input[0] === "-";
|
|
2067
|
+
const fractional = input.slice(decimalIndex + 1);
|
|
2068
|
+
const fractionalScale = bigint10 ** BigInt(fractional.length);
|
|
2069
|
+
const scaled = (BigInt(input.slice(isNegative ? 1 : 0, decimalIndex)) * fractionalScale + BigInt(fractional)) * scale;
|
|
2070
|
+
const rounded = scaled / fractionalScale + (scaled % fractionalScale * bigint2 >= fractionalScale ? bigint1 : bigint0);
|
|
2071
|
+
return isNegative ? -rounded : rounded;
|
|
2072
|
+
};
|
|
2015
2073
|
var DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/;
|
|
2016
2074
|
var fromInputUnsafe = (input) => {
|
|
2017
2075
|
switch (typeof input) {
|
|
@@ -2106,7 +2164,16 @@ var negativeInfinityDurationValue = {
|
|
|
2106
2164
|
var DurationProto = {
|
|
2107
2165
|
[TypeId4]: TypeId4,
|
|
2108
2166
|
[symbol]() {
|
|
2109
|
-
|
|
2167
|
+
switch (this.value._tag) {
|
|
2168
|
+
case "Millis": {
|
|
2169
|
+
const nanos2 = this.value.millis * 1e6;
|
|
2170
|
+
return Number.isFinite(nanos2) ? hash(roundTiesAwayFromZero(nanos2)) : number(this.value.millis);
|
|
2171
|
+
}
|
|
2172
|
+
case "Nanos":
|
|
2173
|
+
return hash(this.value.nanos);
|
|
2174
|
+
default:
|
|
2175
|
+
return structure(this.value);
|
|
2176
|
+
}
|
|
2110
2177
|
},
|
|
2111
2178
|
[symbol2](that) {
|
|
2112
2179
|
return isDuration(that) && equals2(this, that);
|
|
@@ -2251,7 +2318,7 @@ var subtract = /* @__PURE__ */ dual(2, (self, that) => matchPair(self, that, {
|
|
|
2251
2318
|
}));
|
|
2252
2319
|
var equals2 = /* @__PURE__ */ dual(2, (self, that) => Equivalence(self, that));
|
|
2253
2320
|
|
|
2254
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2321
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Array.js
|
|
2255
2322
|
var Array_exports = {};
|
|
2256
2323
|
__export(Array_exports, {
|
|
2257
2324
|
Array: () => Array2,
|
|
@@ -2292,7 +2359,7 @@ __export(Array_exports, {
|
|
|
2292
2359
|
findLastIndex: () => findLastIndex,
|
|
2293
2360
|
flatMap: () => flatMap3,
|
|
2294
2361
|
flatMapNullishOr: () => flatMapNullishOr2,
|
|
2295
|
-
flatten: () =>
|
|
2362
|
+
flatten: () => flatten3,
|
|
2296
2363
|
forEach: () => forEach,
|
|
2297
2364
|
fromIterable: () => fromIterable2,
|
|
2298
2365
|
fromNullishOr: () => fromNullishOr3,
|
|
@@ -2389,10 +2456,10 @@ __export(Array_exports, {
|
|
|
2389
2456
|
zipWith: () => zipWith2
|
|
2390
2457
|
});
|
|
2391
2458
|
|
|
2392
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2459
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/array.js
|
|
2393
2460
|
var isArrayNonEmpty = (self) => self.length > 0;
|
|
2394
2461
|
|
|
2395
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2462
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Result.js
|
|
2396
2463
|
var Result_exports = {};
|
|
2397
2464
|
__export(Result_exports, {
|
|
2398
2465
|
Do: () => Do2,
|
|
@@ -2467,8 +2534,8 @@ var mapBoth = /* @__PURE__ */ dual(2, (self, {
|
|
|
2467
2534
|
onFailure,
|
|
2468
2535
|
onSuccess
|
|
2469
2536
|
}) => isFailure2(self) ? fail2(onFailure(self.failure)) : succeed2(onSuccess(self.success)));
|
|
2470
|
-
var mapError = /* @__PURE__ */ dual(2, (self, f) => isFailure2(self) ? fail2(f(self.failure)) :
|
|
2471
|
-
var map2 = /* @__PURE__ */ dual(2, (self, f) => isSuccess2(self) ? succeed2(f(self.success)) :
|
|
2537
|
+
var mapError = /* @__PURE__ */ dual(2, (self, f) => isFailure2(self) ? fail2(f(self.failure)) : self);
|
|
2538
|
+
var map2 = /* @__PURE__ */ dual(2, (self, f) => isSuccess2(self) ? succeed2(f(self.success)) : self);
|
|
2472
2539
|
var match3 = /* @__PURE__ */ dual(2, (self, {
|
|
2473
2540
|
onFailure,
|
|
2474
2541
|
onSuccess
|
|
@@ -2547,10 +2614,10 @@ var tap2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
2547
2614
|
return self;
|
|
2548
2615
|
});
|
|
2549
2616
|
|
|
2550
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2617
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Tuple.js
|
|
2551
2618
|
var make7 = (...elements) => elements;
|
|
2552
2619
|
|
|
2553
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2620
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Iterable.js
|
|
2554
2621
|
var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
|
|
2555
2622
|
let i = 0;
|
|
2556
2623
|
for (const a of self) {
|
|
@@ -2593,7 +2660,7 @@ var filter2 = /* @__PURE__ */ dual(2, (self, predicate) => ({
|
|
|
2593
2660
|
}
|
|
2594
2661
|
}));
|
|
2595
2662
|
|
|
2596
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2663
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Record.js
|
|
2597
2664
|
var empty2 = () => ({});
|
|
2598
2665
|
var isEmptyRecord = (self) => Object.keys(self).length === 0;
|
|
2599
2666
|
var fromEntries = Object.fromEntries;
|
|
@@ -2643,7 +2710,7 @@ var union = /* @__PURE__ */ dual(3, (self, that, combine2) => {
|
|
|
2643
2710
|
return out;
|
|
2644
2711
|
});
|
|
2645
2712
|
|
|
2646
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2713
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Array.js
|
|
2647
2714
|
var Array2 = globalThis.Array;
|
|
2648
2715
|
var make8 = (...elements) => elements;
|
|
2649
2716
|
var allocate = (n) => new Array2(n);
|
|
@@ -2673,7 +2740,7 @@ var matchRight = /* @__PURE__ */ dual(2, (self, {
|
|
|
2673
2740
|
onEmpty,
|
|
2674
2741
|
onNonEmpty
|
|
2675
2742
|
}) => isReadonlyArrayNonEmpty(self) ? onNonEmpty(initNonEmpty(self), lastNonEmpty(self)) : onEmpty());
|
|
2676
|
-
var prepend = /* @__PURE__ */ dual(2, (self,
|
|
2743
|
+
var prepend = /* @__PURE__ */ dual(2, (self, head4) => [head4, ...self]);
|
|
2677
2744
|
var prependAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable2(that).concat(fromIterable2(self)));
|
|
2678
2745
|
var append = /* @__PURE__ */ dual(2, (self, last2) => [...self, last2]);
|
|
2679
2746
|
var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable2(self).concat(fromIterable2(that)));
|
|
@@ -2702,7 +2769,7 @@ var isArrayNonEmpty2 = isArrayNonEmpty;
|
|
|
2702
2769
|
var isReadonlyArrayNonEmpty = isArrayNonEmpty;
|
|
2703
2770
|
var length = (self) => self.length;
|
|
2704
2771
|
function isOutOfBounds(i, as4) {
|
|
2705
|
-
return i < 0 || i >= as4.length;
|
|
2772
|
+
return !Number.isFinite(i) || i < 0 || i >= as4.length;
|
|
2706
2773
|
}
|
|
2707
2774
|
var clamp = (i, as4) => Math.floor(Math.min(Math.max(0, i), as4.length));
|
|
2708
2775
|
var get2 = /* @__PURE__ */ dual(2, (self, index) => {
|
|
@@ -2866,29 +2933,32 @@ var findLast = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
2866
2933
|
});
|
|
2867
2934
|
var insertAt = /* @__PURE__ */ dual(3, (self, i, b) => {
|
|
2868
2935
|
const out = Array2.from(self);
|
|
2869
|
-
|
|
2936
|
+
const index = Math.floor(i);
|
|
2937
|
+
if (index !== out.length && isOutOfBounds(index, out)) {
|
|
2870
2938
|
return none2();
|
|
2871
2939
|
}
|
|
2872
|
-
out.splice(
|
|
2940
|
+
out.splice(index, 0, b);
|
|
2873
2941
|
return some2(out);
|
|
2874
2942
|
});
|
|
2875
2943
|
var replace = /* @__PURE__ */ dual(3, (self, i, b) => modify(self, i, () => b));
|
|
2876
2944
|
var modify = /* @__PURE__ */ dual(3, (self, i, f) => {
|
|
2877
2945
|
const arr = Array2.from(self);
|
|
2878
|
-
|
|
2946
|
+
const index = Math.floor(i);
|
|
2947
|
+
if (isOutOfBounds(index, arr)) {
|
|
2879
2948
|
return none2();
|
|
2880
2949
|
}
|
|
2881
2950
|
const out = arr;
|
|
2882
|
-
const b = f(arr[
|
|
2883
|
-
out[
|
|
2951
|
+
const b = f(arr[index]);
|
|
2952
|
+
out[index] = b;
|
|
2884
2953
|
return some2(out);
|
|
2885
2954
|
});
|
|
2886
2955
|
var remove = /* @__PURE__ */ dual(2, (self, i) => {
|
|
2887
2956
|
const out = Array2.from(self);
|
|
2888
|
-
|
|
2957
|
+
const index = Math.floor(i);
|
|
2958
|
+
if (isOutOfBounds(index, out)) {
|
|
2889
2959
|
return out;
|
|
2890
2960
|
}
|
|
2891
|
-
out.splice(
|
|
2961
|
+
out.splice(index, 1);
|
|
2892
2962
|
return out;
|
|
2893
2963
|
});
|
|
2894
2964
|
var reverse = (self) => Array2.from(self).reverse();
|
|
@@ -3170,7 +3240,7 @@ var flatMap3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
3170
3240
|
}
|
|
3171
3241
|
return out;
|
|
3172
3242
|
});
|
|
3173
|
-
var
|
|
3243
|
+
var flatten3 = /* @__PURE__ */ flatMap3(identity);
|
|
3174
3244
|
var getSomes = (self) => {
|
|
3175
3245
|
const out = [];
|
|
3176
3246
|
for (const a of self) {
|
|
@@ -3345,17 +3415,9 @@ var countBy = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
3345
3415
|
return count;
|
|
3346
3416
|
});
|
|
3347
3417
|
|
|
3348
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3349
|
-
var composePassthrough = /* @__PURE__ */ dual(2, (left, right) => (input) => {
|
|
3350
|
-
const leftOut = left(input);
|
|
3351
|
-
if (isFailure2(leftOut)) return fail2(input);
|
|
3352
|
-
const rightOut = right(leftOut.success);
|
|
3353
|
-
if (isFailure2(rightOut)) return fail2(input);
|
|
3354
|
-
return rightOut;
|
|
3355
|
-
});
|
|
3356
|
-
|
|
3357
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/Scheduler.js
|
|
3418
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Scheduler.js
|
|
3358
3419
|
var Scheduler = /* @__PURE__ */ Reference("effect/Scheduler", {
|
|
3420
|
+
fiberCached: true,
|
|
3359
3421
|
defaultValue: () => new MixedScheduler()
|
|
3360
3422
|
});
|
|
3361
3423
|
var setImmediate = "setImmediate" in globalThis ? (f) => {
|
|
@@ -3365,6 +3427,15 @@ var setImmediate = "setImmediate" in globalThis ? (f) => {
|
|
|
3365
3427
|
const timer = setTimeout(f, 0);
|
|
3366
3428
|
return () => clearTimeout(timer);
|
|
3367
3429
|
};
|
|
3430
|
+
var setMicrotask = (f) => {
|
|
3431
|
+
let cancelled = false;
|
|
3432
|
+
Promise.resolve().then(() => {
|
|
3433
|
+
if (!cancelled) f();
|
|
3434
|
+
});
|
|
3435
|
+
return () => {
|
|
3436
|
+
cancelled = true;
|
|
3437
|
+
};
|
|
3438
|
+
};
|
|
3368
3439
|
var PriorityBuckets = class {
|
|
3369
3440
|
buckets = [];
|
|
3370
3441
|
scheduleTask(task, priority) {
|
|
@@ -3393,9 +3464,9 @@ var PriorityBuckets = class {
|
|
|
3393
3464
|
var MixedScheduler = class {
|
|
3394
3465
|
executionMode;
|
|
3395
3466
|
setImmediate;
|
|
3396
|
-
constructor(executionMode = "async", setImmediateFn
|
|
3467
|
+
constructor(executionMode = "async", setImmediateFn) {
|
|
3397
3468
|
this.executionMode = executionMode;
|
|
3398
|
-
this.setImmediate = setImmediateFn;
|
|
3469
|
+
this.setImmediate = setImmediateFn ?? (executionMode === "sync" ? setMicrotask : setImmediate);
|
|
3399
3470
|
}
|
|
3400
3471
|
/**
|
|
3401
3472
|
* Returns whether the fiber has reached its operation budget and should yield.
|
|
@@ -3473,15 +3544,126 @@ var MixedSchedulerDispatcher = class {
|
|
|
3473
3544
|
}
|
|
3474
3545
|
};
|
|
3475
3546
|
var MaxOpsBeforeYield = /* @__PURE__ */ Reference("effect/Scheduler/MaxOpsBeforeYield", {
|
|
3547
|
+
fiberCached: true,
|
|
3476
3548
|
defaultValue: () => 2048
|
|
3477
3549
|
});
|
|
3478
3550
|
var PreventSchedulerYield = /* @__PURE__ */ Reference("effect/Scheduler/PreventSchedulerYield", {
|
|
3551
|
+
fiberCached: true,
|
|
3479
3552
|
defaultValue: () => false
|
|
3480
3553
|
});
|
|
3481
3554
|
|
|
3482
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3555
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Data.js
|
|
3556
|
+
var TaggedError2 = TaggedError;
|
|
3557
|
+
|
|
3558
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Encoding.js
|
|
3559
|
+
var EncodingErrorTypeId = "~effect/encoding/EncodingError";
|
|
3560
|
+
var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")) {
|
|
3561
|
+
/**
|
|
3562
|
+
* Marks this value as an encoding or decoding error for runtime guards.
|
|
3563
|
+
*
|
|
3564
|
+
* **When to use**
|
|
3565
|
+
*
|
|
3566
|
+
* Use to identify `EncodingError` instances through `isEncodingError`.
|
|
3567
|
+
*
|
|
3568
|
+
* @since 4.0.0
|
|
3569
|
+
*/
|
|
3570
|
+
[EncodingErrorTypeId] = EncodingErrorTypeId;
|
|
3571
|
+
};
|
|
3572
|
+
var encodeBase64 = (input) => typeof input === "string" ? base64EncodeUint8Array(encoder.encode(input)) : base64EncodeUint8Array(input);
|
|
3573
|
+
var decodeBase64 = (str) => {
|
|
3574
|
+
const stripped = stripCrlf(str);
|
|
3575
|
+
const length2 = stripped.length;
|
|
3576
|
+
if (length2 % 4 !== 0) {
|
|
3577
|
+
return fail2(new EncodingError({
|
|
3578
|
+
kind: "Decode",
|
|
3579
|
+
module: "Base64",
|
|
3580
|
+
input: stripped,
|
|
3581
|
+
message: `Length must be a multiple of 4, but is ${length2}`
|
|
3582
|
+
}));
|
|
3583
|
+
}
|
|
3584
|
+
const index = stripped.indexOf("=");
|
|
3585
|
+
if (index !== -1 && (index < length2 - 2 || index === length2 - 2 && stripped[length2 - 1] !== "=")) {
|
|
3586
|
+
return fail2(new EncodingError({
|
|
3587
|
+
kind: "Decode",
|
|
3588
|
+
module: "Base64",
|
|
3589
|
+
input: stripped,
|
|
3590
|
+
message: `Found a '=' character, but it is not at the end`
|
|
3591
|
+
}));
|
|
3592
|
+
}
|
|
3593
|
+
try {
|
|
3594
|
+
const missingOctets = stripped.endsWith("==") ? 2 : stripped.endsWith("=") ? 1 : 0;
|
|
3595
|
+
const result3 = new Uint8Array(3 * (length2 / 4) - missingOctets);
|
|
3596
|
+
for (let i = 0, j = 0; i < length2; i += 4, j += 3) {
|
|
3597
|
+
const buffer = getBase64Code(stripped.charCodeAt(i)) << 18 | getBase64Code(stripped.charCodeAt(i + 1)) << 12 | getBase64Code(stripped.charCodeAt(i + 2)) << 6 | getBase64Code(stripped.charCodeAt(i + 3));
|
|
3598
|
+
result3[j] = buffer >> 16;
|
|
3599
|
+
result3[j + 1] = buffer >> 8 & 255;
|
|
3600
|
+
result3[j + 2] = buffer & 255;
|
|
3601
|
+
}
|
|
3602
|
+
return succeed2(result3);
|
|
3603
|
+
} catch (e) {
|
|
3604
|
+
return fail2(new EncodingError({
|
|
3605
|
+
kind: "Decode",
|
|
3606
|
+
module: "Base64",
|
|
3607
|
+
input: stripped,
|
|
3608
|
+
message: e instanceof Error ? e.message : "Invalid input"
|
|
3609
|
+
}));
|
|
3610
|
+
}
|
|
3611
|
+
};
|
|
3612
|
+
var randomHex = (length2) => {
|
|
3613
|
+
let result3 = "";
|
|
3614
|
+
for (let i = length2 >>> 3; i > 0; i--) {
|
|
3615
|
+
const word = Math.random() * 4294967296 >>> 0;
|
|
3616
|
+
result3 += byteToHex[word >>> 24] + byteToHex[word >>> 16 & 255] + byteToHex[word >>> 8 & 255] + byteToHex[word & 255];
|
|
3617
|
+
}
|
|
3618
|
+
return result3;
|
|
3619
|
+
};
|
|
3620
|
+
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
3621
|
+
var stripCrlf = (str) => str.replace(/[\n\r]/g, "");
|
|
3622
|
+
var base64EncodeUint8Array = (bytes) => {
|
|
3623
|
+
const length2 = bytes.length;
|
|
3624
|
+
let result3 = "";
|
|
3625
|
+
let i;
|
|
3626
|
+
for (i = 2; i < length2; i += 3) {
|
|
3627
|
+
result3 += base64abc[bytes[i - 2] >> 2];
|
|
3628
|
+
result3 += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
3629
|
+
result3 += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
3630
|
+
result3 += base64abc[bytes[i] & 63];
|
|
3631
|
+
}
|
|
3632
|
+
if (i === length2 + 1) {
|
|
3633
|
+
result3 += base64abc[bytes[i - 2] >> 2];
|
|
3634
|
+
result3 += base64abc[(bytes[i - 2] & 3) << 4];
|
|
3635
|
+
result3 += "==";
|
|
3636
|
+
}
|
|
3637
|
+
if (i === length2) {
|
|
3638
|
+
result3 += base64abc[bytes[i - 2] >> 2];
|
|
3639
|
+
result3 += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
3640
|
+
result3 += base64abc[(bytes[i - 1] & 15) << 2];
|
|
3641
|
+
result3 += "=";
|
|
3642
|
+
}
|
|
3643
|
+
return result3;
|
|
3644
|
+
};
|
|
3645
|
+
function getBase64Code(charCode) {
|
|
3646
|
+
if (charCode >= base64codes.length) {
|
|
3647
|
+
throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`);
|
|
3648
|
+
}
|
|
3649
|
+
const code = base64codes[charCode];
|
|
3650
|
+
if (code === 255) {
|
|
3651
|
+
throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`);
|
|
3652
|
+
}
|
|
3653
|
+
return code;
|
|
3654
|
+
}
|
|
3655
|
+
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
3656
|
+
var base64codes = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 0, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51];
|
|
3657
|
+
var byteToHex = [];
|
|
3658
|
+
for (let i = 0; i < 256; i++) {
|
|
3659
|
+
byteToHex.push(i.toString(16).padStart(2, "0"));
|
|
3660
|
+
}
|
|
3661
|
+
|
|
3662
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Tracer.js
|
|
3483
3663
|
var ParentSpanKey = "effect/Tracer/ParentSpan";
|
|
3484
|
-
var ParentSpan = class extends (/* @__PURE__ */ Service()(ParentSpanKey
|
|
3664
|
+
var ParentSpan = class extends (/* @__PURE__ */ Service()(ParentSpanKey, {
|
|
3665
|
+
fiberCached: true
|
|
3666
|
+
})) {
|
|
3485
3667
|
};
|
|
3486
3668
|
var make9 = (options) => options;
|
|
3487
3669
|
var DisablePropagation = /* @__PURE__ */ Reference("effect/Tracer/DisablePropagation", {
|
|
@@ -3495,6 +3677,7 @@ var MinimumTraceLevel = /* @__PURE__ */ Reference("effect/Tracer/MinimumTraceLev
|
|
|
3495
3677
|
});
|
|
3496
3678
|
var TracerKey = "effect/Tracer";
|
|
3497
3679
|
var Tracer = /* @__PURE__ */ Reference(TracerKey, {
|
|
3680
|
+
fiberCached: true,
|
|
3498
3681
|
defaultValue: () => make9({
|
|
3499
3682
|
span: (options) => new NativeSpan(options)
|
|
3500
3683
|
})
|
|
@@ -3526,8 +3709,8 @@ var NativeSpan = class {
|
|
|
3526
3709
|
startTime: options.startTime
|
|
3527
3710
|
};
|
|
3528
3711
|
this.attributes = /* @__PURE__ */ new Map();
|
|
3529
|
-
this.traceId = getOrUndefined(options.parent)?.traceId ??
|
|
3530
|
-
this.spanId =
|
|
3712
|
+
this.traceId = getOrUndefined(options.parent)?.traceId ?? randomHex(32);
|
|
3713
|
+
this.spanId = randomHex(16);
|
|
3531
3714
|
}
|
|
3532
3715
|
end(endTime, exit3) {
|
|
3533
3716
|
this.status = {
|
|
@@ -3547,26 +3730,16 @@ var NativeSpan = class {
|
|
|
3547
3730
|
this.links.push(...links);
|
|
3548
3731
|
}
|
|
3549
3732
|
};
|
|
3550
|
-
var randomHexString = /* @__PURE__ */ (function() {
|
|
3551
|
-
const characters = "abcdef0123456789";
|
|
3552
|
-
const charactersLength = characters.length;
|
|
3553
|
-
return function(length2) {
|
|
3554
|
-
let result3 = "";
|
|
3555
|
-
for (let i = 0; i < length2; i++) {
|
|
3556
|
-
result3 += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
3557
|
-
}
|
|
3558
|
-
return result3;
|
|
3559
|
-
};
|
|
3560
|
-
})();
|
|
3561
3733
|
|
|
3562
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3734
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/metric.js
|
|
3563
3735
|
var FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey";
|
|
3564
3736
|
|
|
3565
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3737
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/references.js
|
|
3566
3738
|
var CurrentErrorReporters = /* @__PURE__ */ Reference("effect/ErrorReporter/CurrentErrorReporters", {
|
|
3567
3739
|
defaultValue: () => /* @__PURE__ */ new Set()
|
|
3568
3740
|
});
|
|
3569
3741
|
var CurrentStackFrame = /* @__PURE__ */ Reference("effect/References/CurrentStackFrame", {
|
|
3742
|
+
fiberCached: true,
|
|
3570
3743
|
defaultValue: constUndefined
|
|
3571
3744
|
});
|
|
3572
3745
|
var TracerEnabled = /* @__PURE__ */ Reference("effect/References/TracerEnabled", {
|
|
@@ -3585,16 +3758,35 @@ var CurrentLogAnnotations = /* @__PURE__ */ Reference("effect/References/Current
|
|
|
3585
3758
|
defaultValue: () => ({})
|
|
3586
3759
|
});
|
|
3587
3760
|
var CurrentLogLevel = /* @__PURE__ */ Reference("effect/References/CurrentLogLevel", {
|
|
3761
|
+
fiberCached: true,
|
|
3588
3762
|
defaultValue: () => "Info"
|
|
3589
3763
|
});
|
|
3590
3764
|
var MinimumLogLevel = /* @__PURE__ */ Reference("effect/References/MinimumLogLevel", {
|
|
3765
|
+
fiberCached: true,
|
|
3591
3766
|
defaultValue: () => "Info"
|
|
3592
3767
|
});
|
|
3593
3768
|
var CurrentLogSpans = /* @__PURE__ */ Reference("effect/References/CurrentLogSpans", {
|
|
3594
3769
|
defaultValue: () => []
|
|
3595
3770
|
});
|
|
3596
3771
|
|
|
3597
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3772
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/stackTraceLimit.js
|
|
3773
|
+
var isStackTraceLimitWritable = () => {
|
|
3774
|
+
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
3775
|
+
if (desc === void 0) {
|
|
3776
|
+
return Object.isExtensible(Error);
|
|
3777
|
+
}
|
|
3778
|
+
return Object.hasOwn(desc, "writable") ? desc.writable === true : desc.set !== void 0;
|
|
3779
|
+
};
|
|
3780
|
+
var canWriteStackTraceLimit = /* @__PURE__ */ isStackTraceLimitWritable();
|
|
3781
|
+
var getStackTraceLimit = () => Error.stackTraceLimit;
|
|
3782
|
+
var setStackTraceLimit = (value) => {
|
|
3783
|
+
if (canWriteStackTraceLimit) {
|
|
3784
|
+
;
|
|
3785
|
+
Error.stackTraceLimit = value;
|
|
3786
|
+
}
|
|
3787
|
+
};
|
|
3788
|
+
|
|
3789
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/tracer.js
|
|
3598
3790
|
var addSpanStackTrace = (options) => {
|
|
3599
3791
|
if (options?.captureStackTrace === false) {
|
|
3600
3792
|
return options;
|
|
@@ -3625,10 +3817,7 @@ var makeStackCleaner = (line) => (stack) => {
|
|
|
3625
3817
|
};
|
|
3626
3818
|
var spanCleaner = /* @__PURE__ */ makeStackCleaner(3);
|
|
3627
3819
|
|
|
3628
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3629
|
-
var version = "dev";
|
|
3630
|
-
|
|
3631
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/internal/effect.js
|
|
3820
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/effect.js
|
|
3632
3821
|
var Interrupt = class extends ReasonBase {
|
|
3633
3822
|
fiberId;
|
|
3634
3823
|
constructor(fiberId3, annotations = constEmptyAnnotations) {
|
|
@@ -3697,7 +3886,7 @@ var causeMap = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
3697
3886
|
const failures = self.reasons.map((failure) => {
|
|
3698
3887
|
if (isFailReason(failure)) {
|
|
3699
3888
|
hasFail = true;
|
|
3700
|
-
return new Fail(f(failure.error));
|
|
3889
|
+
return new Fail(f(failure.error), failure.annotations);
|
|
3701
3890
|
}
|
|
3702
3891
|
return failure;
|
|
3703
3892
|
});
|
|
@@ -3866,7 +4055,7 @@ ${prefix}}`;
|
|
|
3866
4055
|
}
|
|
3867
4056
|
return stack;
|
|
3868
4057
|
};
|
|
3869
|
-
var FiberTypeId =
|
|
4058
|
+
var FiberTypeId = "~effect/Fiber";
|
|
3870
4059
|
var fiberVariance = {
|
|
3871
4060
|
_A: identity,
|
|
3872
4061
|
_E: identity
|
|
@@ -3920,7 +4109,7 @@ var FiberImpl = class {
|
|
|
3920
4109
|
return this._dispatcher ??= this.currentScheduler.makeDispatcher();
|
|
3921
4110
|
}
|
|
3922
4111
|
getRef(ref) {
|
|
3923
|
-
return
|
|
4112
|
+
return get(this.context, ref);
|
|
3924
4113
|
}
|
|
3925
4114
|
addObserver(cb) {
|
|
3926
4115
|
if (this._exit) {
|
|
@@ -3929,6 +4118,7 @@ var FiberImpl = class {
|
|
|
3929
4118
|
}
|
|
3930
4119
|
this._observers.push(cb);
|
|
3931
4120
|
return () => {
|
|
4121
|
+
if (this._exit) return;
|
|
3932
4122
|
const index = this._observers.indexOf(cb);
|
|
3933
4123
|
if (index >= 0) {
|
|
3934
4124
|
this._observers.splice(index, 1);
|
|
@@ -4057,20 +4247,22 @@ var FiberImpl = class {
|
|
|
4057
4247
|
return pipeArguments(this, arguments);
|
|
4058
4248
|
}
|
|
4059
4249
|
setContext(context3) {
|
|
4250
|
+
const previous = this.context;
|
|
4060
4251
|
this.context = context3;
|
|
4252
|
+
if (previous !== void 0 && hasSameCache(previous, context3)) return;
|
|
4061
4253
|
const scheduler = this.getRef(Scheduler);
|
|
4062
4254
|
if (scheduler !== this.currentScheduler) {
|
|
4063
4255
|
this.currentScheduler = scheduler;
|
|
4064
4256
|
this._dispatcher = void 0;
|
|
4065
4257
|
}
|
|
4066
|
-
this.currentSpan = context3
|
|
4258
|
+
this.currentSpan = getOrUndefinedUnsafe(context3, ParentSpanKey);
|
|
4067
4259
|
this.currentLogLevel = this.getRef(CurrentLogLevel);
|
|
4068
4260
|
this.minimumLogLevel = this.getRef(MinimumLogLevel);
|
|
4069
|
-
this.currentStackFrame =
|
|
4261
|
+
this.currentStackFrame = this.getRef(CurrentStackFrame);
|
|
4070
4262
|
this.maxOpsBeforeYield = this.getRef(MaxOpsBeforeYield);
|
|
4071
4263
|
this.currentPreventYield = this.getRef(PreventSchedulerYield);
|
|
4072
|
-
this.runtimeMetrics = context3
|
|
4073
|
-
const currentTracer = context3
|
|
4264
|
+
this.runtimeMetrics = getOrUndefinedUnsafe(context3, FiberRuntimeMetricsKey);
|
|
4265
|
+
const currentTracer = getOrUndefinedUnsafe(context3, TracerKey);
|
|
4074
4266
|
this.currentTracerContext = currentTracer ? currentTracer["context"] : void 0;
|
|
4075
4267
|
}
|
|
4076
4268
|
get currentSpanLocal() {
|
|
@@ -4305,7 +4497,7 @@ var fn = function() {
|
|
|
4305
4497
|
return makeFn(name, arguments[0], defError, Array.prototype.slice.call(arguments, 1), nameFirst, spanOptions);
|
|
4306
4498
|
};
|
|
4307
4499
|
var makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions) => {
|
|
4308
|
-
const body = typeof bodyOrOptions === "function" ? bodyOrOptions : pipeables.
|
|
4500
|
+
const body = typeof bodyOrOptions === "function" ? bodyOrOptions : pipeables.shift().bind(bodyOrOptions.self);
|
|
4309
4501
|
return defineFunctionLength(body.length, function(...args2) {
|
|
4310
4502
|
let result3 = suspend(() => {
|
|
4311
4503
|
const iter = body.apply(this, arguments);
|
|
@@ -4500,7 +4692,7 @@ var flatMapEager = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
4500
4692
|
}
|
|
4501
4693
|
return flatMap4(self, f);
|
|
4502
4694
|
});
|
|
4503
|
-
var
|
|
4695
|
+
var flatten4 = (self) => flatMap4(self, identity);
|
|
4504
4696
|
var map5 = /* @__PURE__ */ dual(2, (self, f) => flatMap4(self, (a) => succeed3(internalCall(() => f(a)))));
|
|
4505
4697
|
var mapEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map5(self, f));
|
|
4506
4698
|
var mapErrorEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMapError(self, f) : mapError2(self, f));
|
|
@@ -4541,7 +4733,7 @@ var exitAsVoidAll = (exits) => {
|
|
|
4541
4733
|
};
|
|
4542
4734
|
var service = (service3) => service3;
|
|
4543
4735
|
var serviceOption = (service3) => withFiber((fiber3) => succeed3(getOption(fiber3.context, service3)));
|
|
4544
|
-
var serviceOptional = (service3) => withFiber((fiber3) =>
|
|
4736
|
+
var serviceOptional = (service3) => withFiber((fiber3) => fromOption4(getOption(fiber3.context, service3)));
|
|
4545
4737
|
var updateContext = /* @__PURE__ */ dual(2, (self, f) => withFiber((fiber3) => {
|
|
4546
4738
|
const prevContext = fiber3.context;
|
|
4547
4739
|
const nextContext = f(prevContext);
|
|
@@ -4589,11 +4781,7 @@ var provideService = function() {
|
|
|
4589
4781
|
}
|
|
4590
4782
|
return dual(3, (self, service3, impl) => provideServiceImpl(self, service3, impl)).apply(this, arguments);
|
|
4591
4783
|
};
|
|
4592
|
-
var provideServiceImpl = (self, service3, implementation) => updateContext(self, (
|
|
4593
|
-
const prev = s.mapUnsafe.get(service3.key);
|
|
4594
|
-
if (prev === implementation) return s;
|
|
4595
|
-
return add(s, service3, implementation);
|
|
4596
|
-
});
|
|
4784
|
+
var provideServiceImpl = (self, service3, implementation) => updateContext(self, add(service3, implementation));
|
|
4597
4785
|
var provideServiceEffect = /* @__PURE__ */ dual(3, (self, service3, acquire) => flatMap4(acquire, (implementation) => provideService(self, service3, implementation)));
|
|
4598
4786
|
var zip2 = /* @__PURE__ */ dual((args2) => isEffect(args2[1]), (self, that, options) => zipWith3(self, that, (a, a2) => [a, a2], options));
|
|
4599
4787
|
var zipWith3 = /* @__PURE__ */ dual((args2) => isEffect(args2[1]), (self, that, f, options) => options?.concurrent ? map5(all3([self, that], {
|
|
@@ -4837,8 +5025,8 @@ var timeout = /* @__PURE__ */ dual(2, (self, duration) => timeoutOrElse(self, {
|
|
|
4837
5025
|
}));
|
|
4838
5026
|
var timeoutOption = /* @__PURE__ */ dual(2, (self, duration) => raceFirst(asSome(self), as2(sleep(duration), none2())));
|
|
4839
5027
|
var timed = (self) => clockWith((clock) => {
|
|
4840
|
-
const start = clock.
|
|
4841
|
-
return map5(self, (a) => [nanos(clock.
|
|
5028
|
+
const start = clock.monotonicTimeNanosUnsafe();
|
|
5029
|
+
return map5(self, (a) => [nanos(clock.monotonicTimeNanosUnsafe() - start), a]);
|
|
4842
5030
|
});
|
|
4843
5031
|
var ScopeTypeId = "~effect/Scope";
|
|
4844
5032
|
var ScopeCloseableTypeId = "~effect/Scope/Closeable";
|
|
@@ -4865,6 +5053,7 @@ var scopeCloseUnsafe = (self, exit_) => {
|
|
|
4865
5053
|
}
|
|
4866
5054
|
return scopeCloseFinalizers(self, finalizers, exit_);
|
|
4867
5055
|
};
|
|
5056
|
+
var combineFinalizerCause = (exit_, finalizer) => exitIsSuccess(exit_) ? finalizer : catchCause(finalizer, (cause) => failCause(causeCombine(exit_.cause, cause)));
|
|
4868
5057
|
var scopeCloseFinalizers = /* @__PURE__ */ fnUntraced(function* (self, finalizers, exit_) {
|
|
4869
5058
|
let exits = [];
|
|
4870
5059
|
const fibers = [];
|
|
@@ -4964,7 +5153,7 @@ var onExitPrimitive = /* @__PURE__ */ makePrimitive({
|
|
|
4964
5153
|
[contE](cause, _, exit3) {
|
|
4965
5154
|
exit3 ??= exitFailCause(cause);
|
|
4966
5155
|
const eff = this[args][1](exit3);
|
|
4967
|
-
return eff ? flatMap4(eff, (_2) => exit3) : exit3;
|
|
5156
|
+
return eff ? flatMap4(combineFinalizerCause(exit3, eff), (_2) => exit3) : exit3;
|
|
4968
5157
|
}
|
|
4969
5158
|
});
|
|
4970
5159
|
var onExit = /* @__PURE__ */ dual(2, onExitPrimitive);
|
|
@@ -5180,6 +5369,10 @@ var forEach2 = /* @__PURE__ */ dual((args2) => typeof args2[1] === "function", (
|
|
|
5180
5369
|
});
|
|
5181
5370
|
return eff ? as2(eff, out) : succeed3(out);
|
|
5182
5371
|
}));
|
|
5372
|
+
var head2 = (self) => flatMap4(self, (elements) => {
|
|
5373
|
+
const result3 = elements[Symbol.iterator]().next();
|
|
5374
|
+
return result3.done ? fail3(new NoSuchElementError()) : succeed3(result3.value);
|
|
5375
|
+
});
|
|
5183
5376
|
var forEachSequential = (iterable, f, options) => suspend(() => {
|
|
5184
5377
|
const out = options?.discard ? void 0 : [];
|
|
5185
5378
|
const iterator = iterable[Symbol.iterator]();
|
|
@@ -5197,10 +5390,24 @@ var forEachSequential = (iterable, f, options) => suspend(() => {
|
|
|
5197
5390
|
var iterateEagerImpl = (options) => {
|
|
5198
5391
|
const onItem = options.onItem;
|
|
5199
5392
|
const step = options.step;
|
|
5393
|
+
const runSequential = (state, items, index, end) => {
|
|
5394
|
+
for (; index < end; index++) {
|
|
5395
|
+
const item = items[index];
|
|
5396
|
+
const effect = onItem(state, item, index);
|
|
5397
|
+
if (!effectIsExit(effect)) {
|
|
5398
|
+
return flatMap4(exit(effect), (itemExit) => step(state, item, itemExit, index) ?? runSequential(state, items, index + 1, end) ?? void_3);
|
|
5399
|
+
}
|
|
5400
|
+
const terminal = step(state, item, effect, index);
|
|
5401
|
+
if (terminal) return terminal._tag === "Failure" ? terminal : void 0;
|
|
5402
|
+
}
|
|
5403
|
+
};
|
|
5200
5404
|
return (state, items, opts) => {
|
|
5201
|
-
let index =
|
|
5405
|
+
let index = 0;
|
|
5202
5406
|
const end = opts?.end ?? items.length;
|
|
5203
5407
|
const concurrency = opts?.concurrency ?? 1;
|
|
5408
|
+
if (concurrency === 1) {
|
|
5409
|
+
return runSequential(state, items, 0, end);
|
|
5410
|
+
}
|
|
5204
5411
|
const orderedStep = opts?.orderedStep === true && concurrency > 1;
|
|
5205
5412
|
let done4 = false;
|
|
5206
5413
|
let parentFiber;
|
|
@@ -5239,12 +5446,6 @@ var iterateEagerImpl = (options) => {
|
|
|
5239
5446
|
if (effectIsExit(eff)) {
|
|
5240
5447
|
terminal = runStep(item, eff, index);
|
|
5241
5448
|
if (terminal) break;
|
|
5242
|
-
} else if (concurrency === 1) {
|
|
5243
|
-
return flatMap4(exit(eff), (exit3) => {
|
|
5244
|
-
terminal = runStep(item, exit3, index);
|
|
5245
|
-
index++;
|
|
5246
|
-
return terminal ?? go() ?? void_3;
|
|
5247
|
-
});
|
|
5248
5449
|
} else if (!parentFiber) {
|
|
5249
5450
|
return callback((cb) => {
|
|
5250
5451
|
parentFiber = getCurrentFiber();
|
|
@@ -5399,16 +5600,17 @@ var forkChild = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, optio
|
|
|
5399
5600
|
return succeed3(forkUnsafe(fiber3, self, options?.startImmediately, false, options?.uninterruptible ?? false));
|
|
5400
5601
|
}));
|
|
5401
5602
|
var forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterruptible3 = false) => {
|
|
5402
|
-
const
|
|
5403
|
-
const
|
|
5603
|
+
const parentRuntime = parent;
|
|
5604
|
+
const interruptible3 = uninterruptible3 === "inherit" ? parentRuntime.interruptible : !uninterruptible3;
|
|
5605
|
+
const child = new FiberImpl(parentRuntime.context, interruptible3);
|
|
5404
5606
|
if (immediate) {
|
|
5405
5607
|
child.evaluate(effect);
|
|
5406
5608
|
} else {
|
|
5407
|
-
|
|
5609
|
+
parentRuntime.currentDispatcher.scheduleTask(() => child.evaluate(effect), 0);
|
|
5408
5610
|
}
|
|
5409
5611
|
if (!daemon && !child._exit) {
|
|
5410
|
-
|
|
5411
|
-
child.addObserver(() =>
|
|
5612
|
+
parentRuntime.children().add(child);
|
|
5613
|
+
child.addObserver(() => parentRuntime._children.delete(child));
|
|
5412
5614
|
}
|
|
5413
5615
|
return child;
|
|
5414
5616
|
};
|
|
@@ -5647,7 +5849,7 @@ var makeSpanUnsafe = (fiber3, name, options) => {
|
|
|
5647
5849
|
const annotationsFromEnv = fiber3.getRef(TracerSpanAnnotations);
|
|
5648
5850
|
const linksFromEnv = fiber3.getRef(TracerSpanLinks);
|
|
5649
5851
|
const level = options?.level ?? fiber3.getRef(CurrentTraceLevel);
|
|
5650
|
-
const links = options?.links !== void 0 ? [...linksFromEnv, ...options.links] : linksFromEnv.slice();
|
|
5852
|
+
const links = options?.links !== void 0 ? [...linksFromEnv, ...options.links] : linksFromEnv.length === 0 ? [] : linksFromEnv.slice();
|
|
5651
5853
|
span2 = tracer3.span({
|
|
5652
5854
|
name,
|
|
5653
5855
|
parent,
|
|
@@ -5658,12 +5860,12 @@ var makeSpanUnsafe = (fiber3, name, options) => {
|
|
|
5658
5860
|
root: options?.root ?? isNone2(parent),
|
|
5659
5861
|
sampled: options?.sampled ?? (isSome2(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber3.getRef(MinimumTraceLevel), level))
|
|
5660
5862
|
});
|
|
5661
|
-
for (const
|
|
5662
|
-
span2.attribute(key,
|
|
5863
|
+
for (const key in annotationsFromEnv) {
|
|
5864
|
+
span2.attribute(key, annotationsFromEnv[key]);
|
|
5663
5865
|
}
|
|
5664
5866
|
if (options?.attributes !== void 0) {
|
|
5665
|
-
for (const
|
|
5666
|
-
span2.attribute(key,
|
|
5867
|
+
for (const key in options.attributes) {
|
|
5868
|
+
span2.attribute(key, options.attributes[key]);
|
|
5667
5869
|
}
|
|
5668
5870
|
}
|
|
5669
5871
|
}
|
|
@@ -5715,10 +5917,8 @@ var useSpan = (name, ...args2) => {
|
|
|
5715
5917
|
return withFiber((fiber3) => {
|
|
5716
5918
|
const span2 = makeSpanUnsafe(fiber3, name, options);
|
|
5717
5919
|
const clock = fiber3.getRef(ClockRef);
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
span2.end(clock.currentTimeNanosUnsafe(), exit3);
|
|
5721
|
-
}));
|
|
5920
|
+
const timingEnabled = fiber3.getRef(TracerTimingEnabled);
|
|
5921
|
+
return onExit(internalCall(() => evaluate2(span2)), (exit3) => endSpan(span2, exit3, clock, timingEnabled));
|
|
5722
5922
|
});
|
|
5723
5923
|
};
|
|
5724
5924
|
var provideParentSpan = /* @__PURE__ */ provideService(ParentSpan);
|
|
@@ -5790,9 +5990,13 @@ var ClockImpl = class {
|
|
|
5790
5990
|
}
|
|
5791
5991
|
currentTimeMillis = /* @__PURE__ */ sync(() => this.currentTimeMillisUnsafe());
|
|
5792
5992
|
currentTimeNanosUnsafe() {
|
|
5793
|
-
return
|
|
5993
|
+
return wallTimeNanos();
|
|
5794
5994
|
}
|
|
5795
5995
|
currentTimeNanos = /* @__PURE__ */ sync(() => this.currentTimeNanosUnsafe());
|
|
5996
|
+
monotonicTimeNanosUnsafe() {
|
|
5997
|
+
return monotonicNowNanos();
|
|
5998
|
+
}
|
|
5999
|
+
monotonicTimeNanos = /* @__PURE__ */ sync(() => this.monotonicTimeNanosUnsafe());
|
|
5796
6000
|
sleep(duration) {
|
|
5797
6001
|
return this.sleepMillis(toMillis(duration));
|
|
5798
6002
|
}
|
|
@@ -5806,24 +6010,41 @@ var ClockImpl = class {
|
|
|
5806
6010
|
});
|
|
5807
6011
|
}
|
|
5808
6012
|
};
|
|
5809
|
-
var
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
6013
|
+
var nanosPerMilli = /* @__PURE__ */ BigInt(1e6);
|
|
6014
|
+
var monotonicNowNanos = /* @__PURE__ */ (function() {
|
|
6015
|
+
const processHrtime = globalThis.process?.hrtime;
|
|
6016
|
+
if (typeof processHrtime?.bigint === "function") {
|
|
6017
|
+
return () => processHrtime.bigint();
|
|
5813
6018
|
}
|
|
5814
|
-
|
|
6019
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
6020
|
+
return () => BigInt(Math.round(performance.now() * 1e6));
|
|
6021
|
+
}
|
|
6022
|
+
let previous = /* @__PURE__ */ BigInt(0);
|
|
5815
6023
|
return () => {
|
|
5816
|
-
|
|
5817
|
-
|
|
6024
|
+
const current = BigInt(Date.now()) * nanosPerMilli;
|
|
6025
|
+
if (current > previous) {
|
|
6026
|
+
previous = current;
|
|
6027
|
+
}
|
|
6028
|
+
return previous;
|
|
5818
6029
|
};
|
|
5819
6030
|
})();
|
|
5820
|
-
var
|
|
5821
|
-
const
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
6031
|
+
var wallTimeNanos = /* @__PURE__ */ (function() {
|
|
6032
|
+
const reanchorThresholdNanos = /* @__PURE__ */ BigInt(1e9);
|
|
6033
|
+
let origin;
|
|
6034
|
+
return () => {
|
|
6035
|
+
const monotonic = monotonicNowNanos();
|
|
6036
|
+
const wall = BigInt(Date.now()) * nanosPerMilli;
|
|
6037
|
+
if (origin === void 0) {
|
|
6038
|
+
origin = wall - monotonic;
|
|
6039
|
+
} else {
|
|
6040
|
+
const projected = origin + monotonic;
|
|
6041
|
+
const skew = wall > projected ? wall - projected : projected - wall;
|
|
6042
|
+
if (skew > reanchorThresholdNanos) {
|
|
6043
|
+
origin = wall - monotonic;
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
return origin + monotonic;
|
|
6047
|
+
};
|
|
5827
6048
|
})();
|
|
5828
6049
|
var clockWith = (f) => withFiber((fiber3) => f(fiber3.getRef(ClockRef)));
|
|
5829
6050
|
var sleep = (duration) => clockWith((clock) => clock.sleep(fromInputUnsafe(duration)));
|
|
@@ -6086,13 +6307,14 @@ var reportCauseUnsafe = (fiber3, cause, defectsOnly) => {
|
|
|
6086
6307
|
reporters.forEach((reporter) => reporter.report(opts));
|
|
6087
6308
|
};
|
|
6088
6309
|
|
|
6089
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6310
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Exit.js
|
|
6311
|
+
var succeed4 = exitSucceed;
|
|
6090
6312
|
var failCause2 = exitFailCause;
|
|
6091
6313
|
var fail4 = exitFail;
|
|
6092
6314
|
var void_4 = exitVoid;
|
|
6093
6315
|
var isSuccess4 = exitIsSuccess;
|
|
6094
6316
|
|
|
6095
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6317
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Deferred.js
|
|
6096
6318
|
var TypeId5 = "~effect/Deferred";
|
|
6097
6319
|
var DeferredProto = {
|
|
6098
6320
|
[TypeId5]: {
|
|
@@ -6114,8 +6336,10 @@ var _await = (self) => callback((resume) => {
|
|
|
6114
6336
|
self.resumes ??= [];
|
|
6115
6337
|
self.resumes.push(resume);
|
|
6116
6338
|
return sync(() => {
|
|
6117
|
-
const
|
|
6118
|
-
|
|
6339
|
+
const resumes = self.resumes;
|
|
6340
|
+
if (resumes === void 0) return;
|
|
6341
|
+
const index = resumes.indexOf(resume);
|
|
6342
|
+
if (index >= 0) resumes.splice(index, 1);
|
|
6119
6343
|
});
|
|
6120
6344
|
});
|
|
6121
6345
|
var completeWith = /* @__PURE__ */ dual(2, (self, effect) => sync(() => doneUnsafe(self, effect)));
|
|
@@ -6124,24 +6348,25 @@ var doneUnsafe = (self, effect) => {
|
|
|
6124
6348
|
if (self.effect) return false;
|
|
6125
6349
|
self.effect = effect;
|
|
6126
6350
|
if (self.resumes) {
|
|
6127
|
-
|
|
6128
|
-
self.resumes[i](effect);
|
|
6129
|
-
}
|
|
6351
|
+
const resumes = self.resumes;
|
|
6130
6352
|
self.resumes = void 0;
|
|
6353
|
+
for (let i = 0; i < resumes.length; i++) {
|
|
6354
|
+
resumes[i](effect);
|
|
6355
|
+
}
|
|
6131
6356
|
}
|
|
6132
6357
|
return true;
|
|
6133
6358
|
};
|
|
6134
6359
|
|
|
6135
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6360
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/References.js
|
|
6136
6361
|
var CurrentLogAnnotations2 = CurrentLogAnnotations;
|
|
6137
6362
|
var CurrentLogSpans2 = CurrentLogSpans;
|
|
6138
6363
|
|
|
6139
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6364
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Scope.js
|
|
6140
6365
|
var makeUnsafe3 = scopeMakeUnsafe;
|
|
6141
6366
|
var forkUnsafe2 = scopeForkUnsafe;
|
|
6142
6367
|
var close = scopeClose;
|
|
6143
6368
|
|
|
6144
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6369
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Layer.js
|
|
6145
6370
|
var TypeId6 = "~effect/Layer";
|
|
6146
6371
|
var MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
6147
6372
|
var memoMapReuse = (entry, scope3) => {
|
|
@@ -6206,11 +6431,13 @@ var MemoMapImpl = class {
|
|
|
6206
6431
|
return this.parent?.get(layer, scope3);
|
|
6207
6432
|
}
|
|
6208
6433
|
getOrElseMemoize(layer, scope3, build) {
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6434
|
+
return suspend(() => {
|
|
6435
|
+
const existing = this.get(layer, scope3);
|
|
6436
|
+
if (existing) {
|
|
6437
|
+
return existing;
|
|
6438
|
+
}
|
|
6439
|
+
return memoMapBuild(this, layer, scope3, build);
|
|
6440
|
+
});
|
|
6214
6441
|
}
|
|
6215
6442
|
};
|
|
6216
6443
|
var makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
@@ -6234,7 +6461,7 @@ var mergeAll2 = (...layers) => fromBuild((memoMap, scope3) => mergeAllEffect(lay
|
|
|
6234
6461
|
var provideWith = (self, that, f) => fromBuild((memoMap, scope3) => flatMap4(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope3) : that.build(memoMap, scope3), (context3) => self.build(memoMap, scope3).pipe(provideContext(context3), map5((merged) => f(merged, context3)))));
|
|
6235
6462
|
var provide2 = /* @__PURE__ */ dual(2, (self, that) => provideWith(self, that, identity));
|
|
6236
6463
|
|
|
6237
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6464
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/ExecutionPlan.js
|
|
6238
6465
|
var TypeId7 = "~effect/ExecutionPlan";
|
|
6239
6466
|
var Proto2 = {
|
|
6240
6467
|
[TypeId7]: TypeId7,
|
|
@@ -6261,20 +6488,33 @@ var CurrentMetadata = /* @__PURE__ */ Reference("effect/ExecutionPlan/CurrentMet
|
|
|
6261
6488
|
})
|
|
6262
6489
|
});
|
|
6263
6490
|
|
|
6264
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6491
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Cause.js
|
|
6265
6492
|
var isFailReason2 = isFailReason;
|
|
6493
|
+
var fromReasons = causeFromReasons;
|
|
6266
6494
|
var map6 = causeMap;
|
|
6267
|
-
var findError2 = findError;
|
|
6268
6495
|
var isDone2 = isDone;
|
|
6269
6496
|
var done3 = done;
|
|
6270
6497
|
|
|
6271
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6272
|
-
var TaggedError2 = TaggedError;
|
|
6273
|
-
|
|
6274
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/Pull.js
|
|
6498
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Pull.js
|
|
6275
6499
|
var catchDone = /* @__PURE__ */ dual(2, (effect, f) => catchCauseFilter(effect, filterDoneLeftover, (l) => f(l)));
|
|
6276
|
-
var
|
|
6277
|
-
var
|
|
6500
|
+
var isDoneFailure = (failure) => failure._tag === "Fail" && isDone2(failure.error);
|
|
6501
|
+
var filterDone = (cause) => {
|
|
6502
|
+
let done4;
|
|
6503
|
+
let hasFailure = false;
|
|
6504
|
+
for (const reason of cause.reasons) {
|
|
6505
|
+
if (isDoneFailure(reason)) {
|
|
6506
|
+
done4 ??= reason.error;
|
|
6507
|
+
} else if (reason._tag !== "Interrupt") {
|
|
6508
|
+
hasFailure = true;
|
|
6509
|
+
}
|
|
6510
|
+
}
|
|
6511
|
+
if (done4 === void 0) return fail2(cause);
|
|
6512
|
+
return hasFailure ? fail2(fromReasons(cause.reasons.filter((reason) => !isDoneFailure(reason)))) : succeed2(done4);
|
|
6513
|
+
};
|
|
6514
|
+
var filterDoneLeftover = (cause) => {
|
|
6515
|
+
const done4 = filterDone(cause);
|
|
6516
|
+
return isFailure2(done4) ? done4 : succeed2(done4.success.value);
|
|
6517
|
+
};
|
|
6278
6518
|
var matchEffect2 = /* @__PURE__ */ dual(2, (self, options) => matchCauseEffect(self, {
|
|
6279
6519
|
onSuccess: options.onSuccess,
|
|
6280
6520
|
onFailure: (cause) => {
|
|
@@ -6283,7 +6523,7 @@ var matchEffect2 = /* @__PURE__ */ dual(2, (self, options) => matchCauseEffect(s
|
|
|
6283
6523
|
}
|
|
6284
6524
|
}));
|
|
6285
6525
|
|
|
6286
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6526
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Schedule.js
|
|
6287
6527
|
var TypeId8 = "~effect/Schedule";
|
|
6288
6528
|
var CurrentMetadata2 = /* @__PURE__ */ Reference("effect/Schedule/CurrentMetadata", {
|
|
6289
6529
|
defaultValue: /* @__PURE__ */ constant({
|
|
@@ -6375,11 +6615,11 @@ var while_ = /* @__PURE__ */ dual(2, (self, predicate) => fromStep(map5(toStep(s
|
|
|
6375
6615
|
})));
|
|
6376
6616
|
var forever2 = /* @__PURE__ */ spaced(zero);
|
|
6377
6617
|
|
|
6378
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6618
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/layer.js
|
|
6379
6619
|
var provideLayer = (self, layer, options) => scopedWith((scope3) => flatMap4(options?.local ? buildWithMemoMap(layer, makeMemoMapUnsafe(), scope3) : buildWithScope(layer, scope3), (context3) => provideContext(self, context3)));
|
|
6380
6620
|
var provide3 = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, source, options) => isContext(source) ? provideContext(self, source) : provideLayer(self, Array.isArray(source) ? mergeAll2(...source) : source, options));
|
|
6381
6621
|
|
|
6382
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6622
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schedule.js
|
|
6383
6623
|
var repeatOrElse = /* @__PURE__ */ dual(3, (self, schedule2, orElse3) => flatMap4(toStepWithMetadata(schedule2), (step) => {
|
|
6384
6624
|
let meta2 = CurrentMetadata2.defaultValue();
|
|
6385
6625
|
return catch_(forever(tap3(flatMap4(suspend(() => provideService(self, CurrentMetadata2, meta2)), step), (meta_) => sync(() => {
|
|
@@ -6450,8 +6690,52 @@ var buildFromOptions = (options) => {
|
|
|
6450
6690
|
return schedule2;
|
|
6451
6691
|
};
|
|
6452
6692
|
|
|
6453
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6454
|
-
var
|
|
6693
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/executionPlan.js
|
|
6694
|
+
var makeEventEmitter = (onEvent, currentMetadata) => {
|
|
6695
|
+
let lastStepIndex = -1;
|
|
6696
|
+
let stepAttempt = 0;
|
|
6697
|
+
const emit = (event) => ignoreCause(onEvent(event));
|
|
6698
|
+
return {
|
|
6699
|
+
begin: clockWith((clock) => suspend(() => {
|
|
6700
|
+
const meta2 = currentMetadata();
|
|
6701
|
+
if (meta2.stepIndex !== lastStepIndex) {
|
|
6702
|
+
lastStepIndex = meta2.stepIndex;
|
|
6703
|
+
stepAttempt = 0;
|
|
6704
|
+
}
|
|
6705
|
+
stepAttempt++;
|
|
6706
|
+
const state = {
|
|
6707
|
+
attempt: meta2.attempt,
|
|
6708
|
+
stepAttempt,
|
|
6709
|
+
stepIndex: meta2.stepIndex,
|
|
6710
|
+
startNanos: clock.monotonicTimeNanosUnsafe()
|
|
6711
|
+
};
|
|
6712
|
+
return as2(emit({
|
|
6713
|
+
_tag: "AttemptStart",
|
|
6714
|
+
attempt: state.attempt,
|
|
6715
|
+
stepAttempt: state.stepAttempt,
|
|
6716
|
+
stepIndex: state.stepIndex
|
|
6717
|
+
}), state);
|
|
6718
|
+
})),
|
|
6719
|
+
end: (state, exit3) => clockWith((clock) => {
|
|
6720
|
+
const duration = nanos(clock.monotonicTimeNanosUnsafe() - state.startNanos);
|
|
6721
|
+
return emit(exit3._tag === "Success" ? {
|
|
6722
|
+
_tag: "AttemptSuccess",
|
|
6723
|
+
attempt: state.attempt,
|
|
6724
|
+
stepAttempt: state.stepAttempt,
|
|
6725
|
+
stepIndex: state.stepIndex,
|
|
6726
|
+
duration
|
|
6727
|
+
} : {
|
|
6728
|
+
_tag: "AttemptFailure",
|
|
6729
|
+
attempt: state.attempt,
|
|
6730
|
+
stepAttempt: state.stepAttempt,
|
|
6731
|
+
stepIndex: state.stepIndex,
|
|
6732
|
+
duration,
|
|
6733
|
+
cause: exit3.cause
|
|
6734
|
+
});
|
|
6735
|
+
})
|
|
6736
|
+
};
|
|
6737
|
+
};
|
|
6738
|
+
var withExecutionPlan = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, plan, options) => suspend(() => {
|
|
6455
6739
|
let i = 0;
|
|
6456
6740
|
let meta2 = {
|
|
6457
6741
|
attempt: 0,
|
|
@@ -6464,12 +6748,14 @@ var withExecutionPlan = /* @__PURE__ */ dual(2, (self, plan) => suspend(() => {
|
|
|
6464
6748
|
};
|
|
6465
6749
|
return meta2;
|
|
6466
6750
|
}));
|
|
6751
|
+
const emitter = options?.onEvent === void 0 ? void 0 : makeEventEmitter(options.onEvent, () => meta2);
|
|
6752
|
+
const instrument = emitter === void 0 ? identity : (attempt) => uninterruptibleMask((restore) => flatMap4(emitter.begin, (state) => onExit(restore(attempt), (exit3) => emitter.end(state, exit3))));
|
|
6467
6753
|
let result3;
|
|
6468
6754
|
return flatMap4(whileLoop({
|
|
6469
6755
|
while: () => i < plan.steps.length && (result3 === void 0 || isFailure2(result3)),
|
|
6470
6756
|
body() {
|
|
6471
6757
|
const step = plan.steps[i];
|
|
6472
|
-
let nextEffect = provideMeta(provide3(self, step.provide));
|
|
6758
|
+
let nextEffect = provideMeta(instrument(provide3(self, step.provide)));
|
|
6473
6759
|
if (result3) {
|
|
6474
6760
|
let attempted = false;
|
|
6475
6761
|
const wrapped = nextEffect;
|
|
@@ -6509,7 +6795,7 @@ var scheduleFromStep = (step, first) => {
|
|
|
6509
6795
|
};
|
|
6510
6796
|
var scheduleOnce = /* @__PURE__ */ recurs(1);
|
|
6511
6797
|
|
|
6512
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6798
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Request.js
|
|
6513
6799
|
var TypeId9 = "~effect/Request";
|
|
6514
6800
|
var requestVariance = /* @__PURE__ */ byReferenceUnsafe({
|
|
6515
6801
|
/* c8 ignore next */
|
|
@@ -6525,7 +6811,7 @@ var RequestPrototype = {
|
|
|
6525
6811
|
};
|
|
6526
6812
|
var makeEntry = (options) => options;
|
|
6527
6813
|
|
|
6528
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6814
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/request.js
|
|
6529
6815
|
var request = /* @__PURE__ */ dual(2, (self, resolver) => {
|
|
6530
6816
|
const withResolver = (resolver2) => callback((resume) => {
|
|
6531
6817
|
const entry = addEntry(resolver2, self, resume, getCurrentFiber());
|
|
@@ -6635,7 +6921,7 @@ function runBatch(batch) {
|
|
|
6635
6921
|
return batch.run;
|
|
6636
6922
|
}
|
|
6637
6923
|
|
|
6638
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6924
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Metric.js
|
|
6639
6925
|
var CurrentMetricAttributesKey = "effect/Metric/CurrentMetricAttributes";
|
|
6640
6926
|
var CurrentMetricAttributes = /* @__PURE__ */ Reference(CurrentMetricAttributesKey, {
|
|
6641
6927
|
defaultValue: () => ({})
|
|
@@ -6717,10 +7003,7 @@ function makeKey(metric, attributes) {
|
|
|
6717
7003
|
return key;
|
|
6718
7004
|
}
|
|
6719
7005
|
function serializeAttributes(attributes) {
|
|
6720
|
-
return
|
|
6721
|
-
}
|
|
6722
|
-
function serializeEntries(entries) {
|
|
6723
|
-
return entries.map(([key, value]) => `${key}=${value}`).join(",");
|
|
7006
|
+
return JSON.stringify(Array.isArray(attributes) ? attributes : Object.entries(attributes));
|
|
6724
7007
|
}
|
|
6725
7008
|
function mergeAttributes(self, other) {
|
|
6726
7009
|
return {
|
|
@@ -6738,7 +7021,7 @@ function attributesToRecord(attributes) {
|
|
|
6738
7021
|
return attributes;
|
|
6739
7022
|
}
|
|
6740
7023
|
|
|
6741
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7024
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Effect.js
|
|
6742
7025
|
var TypeId11 = EffectTypeId;
|
|
6743
7026
|
var isEffect2 = isEffect;
|
|
6744
7027
|
var all4 = all3;
|
|
@@ -6748,10 +7031,11 @@ var validate2 = validate;
|
|
|
6748
7031
|
var findFirst4 = findFirst3;
|
|
6749
7032
|
var findFirstFilter2 = findFirstFilter;
|
|
6750
7033
|
var forEach3 = forEach2;
|
|
7034
|
+
var head3 = head2;
|
|
6751
7035
|
var whileLoop2 = whileLoop;
|
|
6752
7036
|
var promise2 = promise;
|
|
6753
7037
|
var tryPromise2 = tryPromise;
|
|
6754
|
-
var
|
|
7038
|
+
var succeed5 = succeed3;
|
|
6755
7039
|
var succeedNone3 = succeedNone2;
|
|
6756
7040
|
var succeedSome3 = succeedSome2;
|
|
6757
7041
|
var suspend2 = suspend;
|
|
@@ -6779,7 +7063,7 @@ var fromOption5 = fromOption4;
|
|
|
6779
7063
|
var transposeOption3 = transposeOption2;
|
|
6780
7064
|
var fromNullishOr5 = fromNullishOr4;
|
|
6781
7065
|
var flatMap5 = flatMap4;
|
|
6782
|
-
var
|
|
7066
|
+
var flatten5 = flatten4;
|
|
6783
7067
|
var andThen4 = andThen3;
|
|
6784
7068
|
var tap4 = tap3;
|
|
6785
7069
|
var result2 = result;
|
|
@@ -6981,9 +7265,9 @@ var trackDefects = /* @__PURE__ */ dual((args2) => isEffect2(args2[0]), (self, m
|
|
|
6981
7265
|
return update(metric, input);
|
|
6982
7266
|
}));
|
|
6983
7267
|
var trackDuration = /* @__PURE__ */ dual((args2) => isEffect2(args2[0]), (self, metric, f) => clockWith2((clock) => {
|
|
6984
|
-
const startTime = clock.
|
|
7268
|
+
const startTime = clock.monotonicTimeNanosUnsafe();
|
|
6985
7269
|
return onExit2(self, () => {
|
|
6986
|
-
const endTime = clock.
|
|
7270
|
+
const endTime = clock.monotonicTimeNanosUnsafe();
|
|
6987
7271
|
const duration = subtract(fromInputUnsafe(endTime), fromInputUnsafe(startTime));
|
|
6988
7272
|
const input = f === void 0 ? duration : internalCall(() => f(duration));
|
|
6989
7273
|
return update(metric, input);
|
|
@@ -6992,10 +7276,11 @@ var trackDuration = /* @__PURE__ */ dual((args2) => isEffect2(args2[0]), (self,
|
|
|
6992
7276
|
var Transaction = class extends (/* @__PURE__ */ Service()("effect/Effect/Transaction")) {
|
|
6993
7277
|
};
|
|
6994
7278
|
var tx = (effect) => withFiber2((fiber3) => {
|
|
6995
|
-
|
|
7279
|
+
let state = getOrUndefined2(fiber3.context, Transaction);
|
|
7280
|
+
if (state) {
|
|
6996
7281
|
return effect;
|
|
6997
7282
|
}
|
|
6998
|
-
|
|
7283
|
+
state = {
|
|
6999
7284
|
journal: /* @__PURE__ */ new Map(),
|
|
7000
7285
|
retry: false
|
|
7001
7286
|
};
|
|
@@ -7021,9 +7306,9 @@ var tx = (effect) => withFiber2((fiber3) => {
|
|
|
7021
7306
|
});
|
|
7022
7307
|
var isTransactionConsistent = (state) => {
|
|
7023
7308
|
for (const [ref, {
|
|
7024
|
-
version
|
|
7309
|
+
version
|
|
7025
7310
|
}] of state.journal) {
|
|
7026
|
-
if (ref.version !==
|
|
7311
|
+
if (ref.version !== version) {
|
|
7027
7312
|
return false;
|
|
7028
7313
|
}
|
|
7029
7314
|
}
|
|
@@ -7076,7 +7361,7 @@ var effectify = (fn3, onError3, onSyncError) => (...args2) => callback2((resume)
|
|
|
7076
7361
|
if (err) {
|
|
7077
7362
|
resume(fail5(onError3 ? onError3(err, args2) : err));
|
|
7078
7363
|
} else {
|
|
7079
|
-
resume(
|
|
7364
|
+
resume(succeed5(result3));
|
|
7080
7365
|
}
|
|
7081
7366
|
});
|
|
7082
7367
|
} catch (err) {
|
|
@@ -7093,7 +7378,7 @@ var flatMapEager2 = flatMapEager;
|
|
|
7093
7378
|
var catchEager2 = catchEager;
|
|
7094
7379
|
var fnUntracedEager2 = fnUntracedEager;
|
|
7095
7380
|
|
|
7096
|
-
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-
|
|
7381
|
+
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.111/node_modules/effect-oxlint/dist/RuleContext.js
|
|
7097
7382
|
var RuleContextBase = Service()("effect-oxlint/RuleContext");
|
|
7098
7383
|
var RuleContext = class extends RuleContextBase {
|
|
7099
7384
|
};
|
|
@@ -7114,131 +7399,45 @@ service2(RuleContext).pipe(map7((ctx) => ctx.sourceCode));
|
|
|
7114
7399
|
service2(RuleContext).pipe(map7((ctx) => ctx.sourceCode.text));
|
|
7115
7400
|
service2(RuleContext).pipe(map7((ctx) => ctx.sourceCode.ast));
|
|
7116
7401
|
|
|
7117
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7118
|
-
var EncodingErrorTypeId = "~effect/encoding/EncodingError";
|
|
7119
|
-
var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")) {
|
|
7120
|
-
/**
|
|
7121
|
-
* Marks this value as an encoding or decoding error for runtime guards.
|
|
7122
|
-
*
|
|
7123
|
-
* **When to use**
|
|
7124
|
-
*
|
|
7125
|
-
* Use to identify `EncodingError` instances through `isEncodingError`.
|
|
7126
|
-
*
|
|
7127
|
-
* @since 4.0.0
|
|
7128
|
-
*/
|
|
7129
|
-
[EncodingErrorTypeId] = EncodingErrorTypeId;
|
|
7130
|
-
};
|
|
7131
|
-
var encodeBase64 = (input) => typeof input === "string" ? base64EncodeUint8Array(encoder.encode(input)) : base64EncodeUint8Array(input);
|
|
7132
|
-
var decodeBase64 = (str) => {
|
|
7133
|
-
const stripped = stripCrlf(str);
|
|
7134
|
-
const length2 = stripped.length;
|
|
7135
|
-
if (length2 % 4 !== 0) {
|
|
7136
|
-
return fail2(new EncodingError({
|
|
7137
|
-
kind: "Decode",
|
|
7138
|
-
module: "Base64",
|
|
7139
|
-
input: stripped,
|
|
7140
|
-
message: `Length must be a multiple of 4, but is ${length2}`
|
|
7141
|
-
}));
|
|
7142
|
-
}
|
|
7143
|
-
const index = stripped.indexOf("=");
|
|
7144
|
-
if (index !== -1 && (index < length2 - 2 || index === length2 - 2 && stripped[length2 - 1] !== "=")) {
|
|
7145
|
-
return fail2(new EncodingError({
|
|
7146
|
-
kind: "Decode",
|
|
7147
|
-
module: "Base64",
|
|
7148
|
-
input: stripped,
|
|
7149
|
-
message: `Found a '=' character, but it is not at the end`
|
|
7150
|
-
}));
|
|
7151
|
-
}
|
|
7152
|
-
try {
|
|
7153
|
-
const missingOctets = stripped.endsWith("==") ? 2 : stripped.endsWith("=") ? 1 : 0;
|
|
7154
|
-
const result3 = new Uint8Array(3 * (length2 / 4) - missingOctets);
|
|
7155
|
-
for (let i = 0, j = 0; i < length2; i += 4, j += 3) {
|
|
7156
|
-
const buffer = getBase64Code(stripped.charCodeAt(i)) << 18 | getBase64Code(stripped.charCodeAt(i + 1)) << 12 | getBase64Code(stripped.charCodeAt(i + 2)) << 6 | getBase64Code(stripped.charCodeAt(i + 3));
|
|
7157
|
-
result3[j] = buffer >> 16;
|
|
7158
|
-
result3[j + 1] = buffer >> 8 & 255;
|
|
7159
|
-
result3[j + 2] = buffer & 255;
|
|
7160
|
-
}
|
|
7161
|
-
return succeed2(result3);
|
|
7162
|
-
} catch (e) {
|
|
7163
|
-
return fail2(new EncodingError({
|
|
7164
|
-
kind: "Decode",
|
|
7165
|
-
module: "Base64",
|
|
7166
|
-
input: stripped,
|
|
7167
|
-
message: e instanceof Error ? e.message : "Invalid input"
|
|
7168
|
-
}));
|
|
7169
|
-
}
|
|
7170
|
-
};
|
|
7171
|
-
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
7172
|
-
var stripCrlf = (str) => str.replace(/[\n\r]/g, "");
|
|
7173
|
-
var base64EncodeUint8Array = (bytes) => {
|
|
7174
|
-
const length2 = bytes.length;
|
|
7175
|
-
let result3 = "";
|
|
7176
|
-
let i;
|
|
7177
|
-
for (i = 2; i < length2; i += 3) {
|
|
7178
|
-
result3 += base64abc[bytes[i - 2] >> 2];
|
|
7179
|
-
result3 += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
7180
|
-
result3 += base64abc[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
7181
|
-
result3 += base64abc[bytes[i] & 63];
|
|
7182
|
-
}
|
|
7183
|
-
if (i === length2 + 1) {
|
|
7184
|
-
result3 += base64abc[bytes[i - 2] >> 2];
|
|
7185
|
-
result3 += base64abc[(bytes[i - 2] & 3) << 4];
|
|
7186
|
-
result3 += "==";
|
|
7187
|
-
}
|
|
7188
|
-
if (i === length2) {
|
|
7189
|
-
result3 += base64abc[bytes[i - 2] >> 2];
|
|
7190
|
-
result3 += base64abc[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
7191
|
-
result3 += base64abc[(bytes[i - 1] & 15) << 2];
|
|
7192
|
-
result3 += "=";
|
|
7193
|
-
}
|
|
7194
|
-
return result3;
|
|
7195
|
-
};
|
|
7196
|
-
function getBase64Code(charCode) {
|
|
7197
|
-
if (charCode >= base64codes.length) {
|
|
7198
|
-
throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`);
|
|
7199
|
-
}
|
|
7200
|
-
const code = base64codes[charCode];
|
|
7201
|
-
if (code === 255) {
|
|
7202
|
-
throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`);
|
|
7203
|
-
}
|
|
7204
|
-
return code;
|
|
7205
|
-
}
|
|
7206
|
-
var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
|
|
7207
|
-
var base64codes = [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 0, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51];
|
|
7208
|
-
|
|
7209
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/internal/schema/annotations.js
|
|
7402
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/annotations.js
|
|
7210
7403
|
function resolve(ast) {
|
|
7211
7404
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
7212
7405
|
}
|
|
7213
|
-
function resolveAt(key) {
|
|
7214
|
-
return (ast) => resolve(ast)?.[key];
|
|
7215
|
-
}
|
|
7216
7406
|
var STRUCTURAL_ANNOTATION_KEY = "~structural";
|
|
7217
7407
|
var SENTINELS_ANNOTATION_KEY = "~sentinels";
|
|
7218
|
-
var
|
|
7408
|
+
var CONSTRUCTOR_ANNOTATION_KEY = "~constructor";
|
|
7219
7409
|
var getExpected = /* @__PURE__ */ memoize((ast) => {
|
|
7220
|
-
const identifier2 =
|
|
7410
|
+
const identifier2 = resolve(ast)?.identifier;
|
|
7221
7411
|
if (typeof identifier2 === "string") return identifier2;
|
|
7222
7412
|
return ast.getExpected(getExpected);
|
|
7223
7413
|
});
|
|
7224
7414
|
|
|
7225
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7415
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/parser.js
|
|
7416
|
+
var missing = /* @__PURE__ */ Symbol();
|
|
7417
|
+
var succeed6 = succeed4;
|
|
7418
|
+
var missingExit = /* @__PURE__ */ succeed6(missing);
|
|
7419
|
+
var sameExit = /* @__PURE__ */ succeed6(missing);
|
|
7420
|
+
var toOption = (value) => value === missing ? none2() : some2(value);
|
|
7421
|
+
var fromOptionExit = (option3) => option3._tag === "None" ? missingExit : succeed6(option3.value);
|
|
7422
|
+
|
|
7423
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaIssue.js
|
|
7226
7424
|
var TypeId12 = "~effect/SchemaIssue/Issue";
|
|
7227
7425
|
function isIssue(u) {
|
|
7228
7426
|
return hasProperty(u, TypeId12) && u[TypeId12] === TypeId12;
|
|
7229
7427
|
}
|
|
7428
|
+
function hasInput(issue) {
|
|
7429
|
+
return Object.hasOwn(issue, "input");
|
|
7430
|
+
}
|
|
7230
7431
|
var Base = class {
|
|
7231
7432
|
[TypeId12] = TypeId12;
|
|
7232
|
-
|
|
7233
|
-
|
|
7433
|
+
constructor(input, options) {
|
|
7434
|
+
if (options?.reportInput === true && input !== missing) {
|
|
7435
|
+
this.input = input;
|
|
7436
|
+
}
|
|
7234
7437
|
}
|
|
7235
7438
|
};
|
|
7236
7439
|
var Filter = class extends Base {
|
|
7237
7440
|
_tag = "Filter";
|
|
7238
|
-
/**
|
|
7239
|
-
* The input value that caused the issue.
|
|
7240
|
-
*/
|
|
7241
|
-
actual;
|
|
7242
7441
|
/**
|
|
7243
7442
|
* The filter that failed.
|
|
7244
7443
|
*/
|
|
@@ -7247,9 +7446,8 @@ var Filter = class extends Base {
|
|
|
7247
7446
|
* The issue that occurred.
|
|
7248
7447
|
*/
|
|
7249
7448
|
issue;
|
|
7250
|
-
constructor(
|
|
7251
|
-
super();
|
|
7252
|
-
this.actual = actual;
|
|
7449
|
+
constructor(filter7, issue, input, options) {
|
|
7450
|
+
super(input, options);
|
|
7253
7451
|
this.filter = filter7;
|
|
7254
7452
|
this.issue = issue;
|
|
7255
7453
|
}
|
|
@@ -7260,18 +7458,13 @@ var Encoding = class extends Base {
|
|
|
7260
7458
|
* The schema that caused the issue.
|
|
7261
7459
|
*/
|
|
7262
7460
|
ast;
|
|
7263
|
-
/**
|
|
7264
|
-
* The input value that caused the issue.
|
|
7265
|
-
*/
|
|
7266
|
-
actual;
|
|
7267
7461
|
/**
|
|
7268
7462
|
* The issue that occurred.
|
|
7269
7463
|
*/
|
|
7270
7464
|
issue;
|
|
7271
|
-
constructor(ast,
|
|
7272
|
-
super();
|
|
7465
|
+
constructor(ast, issue, input, options) {
|
|
7466
|
+
super(input, options);
|
|
7273
7467
|
this.ast = ast;
|
|
7274
|
-
this.actual = actual;
|
|
7275
7468
|
this.issue = issue;
|
|
7276
7469
|
}
|
|
7277
7470
|
};
|
|
@@ -7308,14 +7501,9 @@ var UnexpectedKey = class extends Base {
|
|
|
7308
7501
|
* The schema that caused the issue.
|
|
7309
7502
|
*/
|
|
7310
7503
|
ast;
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
*/
|
|
7314
|
-
actual;
|
|
7315
|
-
constructor(ast, actual) {
|
|
7316
|
-
super();
|
|
7504
|
+
constructor(ast, input, options) {
|
|
7505
|
+
super(input, options);
|
|
7317
7506
|
this.ast = ast;
|
|
7318
|
-
this.actual = actual;
|
|
7319
7507
|
}
|
|
7320
7508
|
};
|
|
7321
7509
|
var Composite = class extends Base {
|
|
@@ -7324,18 +7512,13 @@ var Composite = class extends Base {
|
|
|
7324
7512
|
* The schema that caused the issue.
|
|
7325
7513
|
*/
|
|
7326
7514
|
ast;
|
|
7327
|
-
/**
|
|
7328
|
-
* The input value that caused the issue.
|
|
7329
|
-
*/
|
|
7330
|
-
actual;
|
|
7331
7515
|
/**
|
|
7332
7516
|
* The issues that occurred.
|
|
7333
7517
|
*/
|
|
7334
7518
|
issues;
|
|
7335
|
-
constructor(ast,
|
|
7336
|
-
super();
|
|
7519
|
+
constructor(ast, issues, input, options) {
|
|
7520
|
+
super(input, options);
|
|
7337
7521
|
this.ast = ast;
|
|
7338
|
-
this.actual = actual;
|
|
7339
7522
|
this.issues = issues;
|
|
7340
7523
|
}
|
|
7341
7524
|
};
|
|
@@ -7345,29 +7528,19 @@ var InvalidType = class extends Base {
|
|
|
7345
7528
|
* The schema that caused the issue.
|
|
7346
7529
|
*/
|
|
7347
7530
|
ast;
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
*/
|
|
7351
|
-
actual;
|
|
7352
|
-
constructor(ast, actual) {
|
|
7353
|
-
super();
|
|
7531
|
+
constructor(ast, input, options) {
|
|
7532
|
+
super(input, options);
|
|
7354
7533
|
this.ast = ast;
|
|
7355
|
-
this.actual = actual;
|
|
7356
7534
|
}
|
|
7357
7535
|
};
|
|
7358
7536
|
var InvalidValue = class extends Base {
|
|
7359
7537
|
_tag = "InvalidValue";
|
|
7360
|
-
/**
|
|
7361
|
-
* The value that caused the issue.
|
|
7362
|
-
*/
|
|
7363
|
-
actual;
|
|
7364
7538
|
/**
|
|
7365
7539
|
* The metadata for the issue.
|
|
7366
7540
|
*/
|
|
7367
7541
|
annotations;
|
|
7368
|
-
constructor(
|
|
7369
|
-
super();
|
|
7370
|
-
this.actual = actual;
|
|
7542
|
+
constructor(annotations, input, options) {
|
|
7543
|
+
super(input, options);
|
|
7371
7544
|
this.annotations = annotations;
|
|
7372
7545
|
}
|
|
7373
7546
|
};
|
|
@@ -7377,18 +7550,13 @@ var AnyOf = class extends Base {
|
|
|
7377
7550
|
* The schema that caused the issue.
|
|
7378
7551
|
*/
|
|
7379
7552
|
ast;
|
|
7380
|
-
/**
|
|
7381
|
-
* The input value that caused the issue.
|
|
7382
|
-
*/
|
|
7383
|
-
actual;
|
|
7384
7553
|
/**
|
|
7385
7554
|
* The issues that occurred.
|
|
7386
7555
|
*/
|
|
7387
7556
|
issues;
|
|
7388
|
-
constructor(ast,
|
|
7389
|
-
super();
|
|
7557
|
+
constructor(ast, issues, input, options) {
|
|
7558
|
+
super(input, options);
|
|
7390
7559
|
this.ast = ast;
|
|
7391
|
-
this.actual = actual;
|
|
7392
7560
|
this.issues = issues;
|
|
7393
7561
|
}
|
|
7394
7562
|
};
|
|
@@ -7398,127 +7566,85 @@ var OneOf = class extends Base {
|
|
|
7398
7566
|
* The schema that caused the issue.
|
|
7399
7567
|
*/
|
|
7400
7568
|
ast;
|
|
7401
|
-
/**
|
|
7402
|
-
* The input value that caused the issue.
|
|
7403
|
-
*/
|
|
7404
|
-
actual;
|
|
7405
7569
|
/**
|
|
7406
7570
|
* The schemas that were successful.
|
|
7407
7571
|
*/
|
|
7408
7572
|
successes;
|
|
7409
|
-
constructor(ast,
|
|
7410
|
-
super();
|
|
7573
|
+
constructor(ast, successes, input, options) {
|
|
7574
|
+
super(input, options);
|
|
7411
7575
|
this.ast = ast;
|
|
7412
|
-
this.actual = actual;
|
|
7413
7576
|
this.successes = successes;
|
|
7414
7577
|
}
|
|
7415
7578
|
};
|
|
7416
|
-
function makeFilterIssue(input,
|
|
7579
|
+
function makeFilterIssue(entry, input, options) {
|
|
7417
7580
|
if (isIssue(entry)) {
|
|
7418
7581
|
return entry;
|
|
7419
7582
|
}
|
|
7420
7583
|
if (typeof entry === "string") {
|
|
7421
|
-
return new InvalidValue(
|
|
7584
|
+
return new InvalidValue({
|
|
7422
7585
|
message: entry
|
|
7423
|
-
});
|
|
7586
|
+
}, input, options);
|
|
7424
7587
|
}
|
|
7425
|
-
const inner = typeof entry.issue === "string" ? new InvalidValue(
|
|
7588
|
+
const inner = typeof entry.issue === "string" ? new InvalidValue({
|
|
7426
7589
|
message: entry.issue
|
|
7427
|
-
}) : entry.issue;
|
|
7590
|
+
}, input, options) : entry.issue;
|
|
7428
7591
|
return new Pointer(entry.path, inner);
|
|
7429
7592
|
}
|
|
7430
|
-
function makeSingle(input,
|
|
7593
|
+
function makeSingle(out, input, options) {
|
|
7431
7594
|
if (out === void 0) {
|
|
7432
7595
|
return void 0;
|
|
7433
7596
|
}
|
|
7434
7597
|
if (typeof out === "boolean") {
|
|
7435
|
-
return out ? void 0 : new InvalidValue(
|
|
7598
|
+
return out ? void 0 : new InvalidValue(void 0, input, options);
|
|
7436
7599
|
}
|
|
7437
|
-
return makeFilterIssue(input,
|
|
7600
|
+
return makeFilterIssue(out, input, options);
|
|
7438
7601
|
}
|
|
7439
|
-
function
|
|
7602
|
+
function normalizeFilterOutput(ast, out, input, options) {
|
|
7440
7603
|
if (Array.isArray(out)) {
|
|
7441
|
-
if (isReadonlyArrayNonEmpty(out)) {
|
|
7442
|
-
|
|
7443
|
-
return makeFilterIssue(input, out[0]);
|
|
7444
|
-
}
|
|
7445
|
-
return new Composite(ast, some2(input), map4(out, (entry) => makeFilterIssue(input, entry)));
|
|
7604
|
+
if (!isReadonlyArrayNonEmpty(out)) {
|
|
7605
|
+
return void 0;
|
|
7446
7606
|
}
|
|
7447
|
-
return
|
|
7607
|
+
return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map4(out, (entry) => makeFilterIssue(entry, input, options)), input, options);
|
|
7448
7608
|
}
|
|
7449
|
-
return makeSingle(input,
|
|
7609
|
+
return makeSingle(out, input, options);
|
|
7450
7610
|
}
|
|
7451
7611
|
var defaultLeafHook = (issue) => {
|
|
7452
7612
|
const message = findMessage(issue);
|
|
7453
7613
|
if (message !== void 0) return message;
|
|
7454
7614
|
switch (issue._tag) {
|
|
7455
7615
|
case "InvalidType":
|
|
7456
|
-
return getExpectedMessage(getExpected(issue.ast),
|
|
7457
|
-
case "InvalidValue":
|
|
7458
|
-
|
|
7616
|
+
return getExpectedMessage(getExpected(issue.ast), issue);
|
|
7617
|
+
case "InvalidValue": {
|
|
7618
|
+
const expected = findExpected(issue);
|
|
7619
|
+
if (expected !== void 0) return getExpectedMessage(expected, issue);
|
|
7620
|
+
const input = formatInput(issue);
|
|
7621
|
+
return input === void 0 ? "Expected a valid value" : `Invalid data ${input}`;
|
|
7622
|
+
}
|
|
7459
7623
|
case "MissingKey":
|
|
7460
7624
|
return "Missing key";
|
|
7461
|
-
case "UnexpectedKey":
|
|
7462
|
-
|
|
7625
|
+
case "UnexpectedKey": {
|
|
7626
|
+
const input = formatInput(issue);
|
|
7627
|
+
return input === void 0 ? "Expected no excess property" : `Unexpected key with value ${input}`;
|
|
7628
|
+
}
|
|
7463
7629
|
case "Forbidden":
|
|
7464
7630
|
return "Forbidden operation";
|
|
7465
|
-
case "OneOf":
|
|
7466
|
-
|
|
7631
|
+
case "OneOf": {
|
|
7632
|
+
const input = formatInput(issue);
|
|
7633
|
+
return input === void 0 ? "Expected exactly one member to match" : `Expected exactly one member to match the input ${input}`;
|
|
7634
|
+
}
|
|
7467
7635
|
}
|
|
7468
7636
|
};
|
|
7469
|
-
var defaultCheckHook = (issue) =>
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
function getExpectedMessage(expected, actual) {
|
|
7473
|
-
return `Expected ${expected}, got ${actual}`;
|
|
7637
|
+
var defaultCheckHook = (issue) => findMessage(issue.issue) ?? findMessage(issue);
|
|
7638
|
+
function formatInput(issue) {
|
|
7639
|
+
return hasInput(issue) ? format(issue.input) : void 0;
|
|
7474
7640
|
}
|
|
7475
|
-
function
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
message
|
|
7483
|
-
}];
|
|
7484
|
-
}
|
|
7485
|
-
switch (issue.issue._tag) {
|
|
7486
|
-
case "InvalidValue":
|
|
7487
|
-
return [{
|
|
7488
|
-
path,
|
|
7489
|
-
message: getExpectedMessage(formatCheck(issue.filter), format(issue.actual))
|
|
7490
|
-
}];
|
|
7491
|
-
default:
|
|
7492
|
-
return toDefaultIssues(issue.issue, path, leafHook, checkHook);
|
|
7493
|
-
}
|
|
7494
|
-
}
|
|
7495
|
-
case "Encoding":
|
|
7496
|
-
return toDefaultIssues(issue.issue, path, leafHook, checkHook);
|
|
7497
|
-
case "Pointer":
|
|
7498
|
-
return toDefaultIssues(issue.issue, [...path, ...issue.path], leafHook, checkHook);
|
|
7499
|
-
case "Composite":
|
|
7500
|
-
return issue.issues.flatMap((issue2) => toDefaultIssues(issue2, path, leafHook, checkHook));
|
|
7501
|
-
case "AnyOf": {
|
|
7502
|
-
const message = findMessage(issue);
|
|
7503
|
-
if (issue.issues.length === 0) {
|
|
7504
|
-
if (message !== void 0) return [{
|
|
7505
|
-
path,
|
|
7506
|
-
message
|
|
7507
|
-
}];
|
|
7508
|
-
const expected = getExpectedMessage(getExpected(issue.ast), format(issue.actual));
|
|
7509
|
-
return [{
|
|
7510
|
-
path,
|
|
7511
|
-
message: expected
|
|
7512
|
-
}];
|
|
7513
|
-
}
|
|
7514
|
-
return issue.issues.flatMap((issue2) => toDefaultIssues(issue2, path, leafHook, checkHook));
|
|
7515
|
-
}
|
|
7516
|
-
default:
|
|
7517
|
-
return [{
|
|
7518
|
-
path,
|
|
7519
|
-
message: leafHook(issue)
|
|
7520
|
-
}];
|
|
7521
|
-
}
|
|
7641
|
+
function findExpected(issue) {
|
|
7642
|
+
const expected = issue.annotations?.expected;
|
|
7643
|
+
return typeof expected === "string" ? expected : void 0;
|
|
7644
|
+
}
|
|
7645
|
+
function getExpectedMessage(expected, issue) {
|
|
7646
|
+
const input = formatInput(issue);
|
|
7647
|
+
return input === void 0 ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;
|
|
7522
7648
|
}
|
|
7523
7649
|
function formatCheck(check) {
|
|
7524
7650
|
const expected = check.annotations?.expected;
|
|
@@ -7531,48 +7657,53 @@ function formatCheck(check) {
|
|
|
7531
7657
|
}
|
|
7532
7658
|
}
|
|
7533
7659
|
function makeFormatterDefault() {
|
|
7534
|
-
return (issue) =>
|
|
7660
|
+
return (issue) => formatIssue(issue, "");
|
|
7535
7661
|
}
|
|
7536
7662
|
var defaultFormatter = /* @__PURE__ */ makeFormatterDefault();
|
|
7537
|
-
function
|
|
7538
|
-
let
|
|
7539
|
-
if (issue.path && issue.path.length > 0) {
|
|
7540
|
-
const path = formatPath(issue.path);
|
|
7541
|
-
out += `
|
|
7542
|
-
at ${path}`;
|
|
7543
|
-
}
|
|
7544
|
-
return out;
|
|
7545
|
-
}
|
|
7546
|
-
function findMessage(issue) {
|
|
7663
|
+
function formatIssue(issue, path) {
|
|
7664
|
+
let message;
|
|
7547
7665
|
switch (issue._tag) {
|
|
7548
|
-
case "
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
return getMessageAnnotation(issue.filter.annotations);
|
|
7666
|
+
case "Filter": {
|
|
7667
|
+
const annotated = defaultCheckHook(issue);
|
|
7668
|
+
if (annotated !== void 0) {
|
|
7669
|
+
message = annotated;
|
|
7670
|
+
} else {
|
|
7671
|
+
if (issue.issue._tag !== "InvalidValue") {
|
|
7672
|
+
return formatIssue(issue.issue, path);
|
|
7673
|
+
}
|
|
7674
|
+
const expected = findExpected(issue.issue);
|
|
7675
|
+
message = expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);
|
|
7676
|
+
}
|
|
7677
|
+
break;
|
|
7678
|
+
}
|
|
7562
7679
|
case "Encoding":
|
|
7563
|
-
return
|
|
7680
|
+
return formatIssue(issue.issue, path);
|
|
7681
|
+
case "Pointer":
|
|
7682
|
+
return formatIssue(issue.issue, path + formatPath(issue.path));
|
|
7683
|
+
case "Composite":
|
|
7684
|
+
case "AnyOf": {
|
|
7685
|
+
if (issue._tag === "Composite" || issue.issues.length > 0) {
|
|
7686
|
+
return issue.issues.map((issue2) => formatIssue(issue2, path)).join("\n");
|
|
7687
|
+
}
|
|
7688
|
+
message = findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);
|
|
7689
|
+
break;
|
|
7690
|
+
}
|
|
7691
|
+
default:
|
|
7692
|
+
message = defaultLeafHook(issue);
|
|
7693
|
+
break;
|
|
7564
7694
|
}
|
|
7695
|
+
return path ? `${message}
|
|
7696
|
+
at ${path}` : message;
|
|
7565
7697
|
}
|
|
7566
|
-
function
|
|
7567
|
-
|
|
7698
|
+
function findMessage(issue) {
|
|
7699
|
+
if (issue._tag === "Pointer") return;
|
|
7700
|
+
if (issue._tag === "Encoding") return findMessage(issue.issue);
|
|
7701
|
+
const annotations = issue._tag === "Filter" ? issue.filter.annotations : "annotations" in issue ? issue.annotations : issue.ast.annotations;
|
|
7702
|
+
const message = annotations?.[issue._tag === "MissingKey" ? "messageMissingKey" : issue._tag === "UnexpectedKey" ? "messageUnexpectedKey" : "message"];
|
|
7568
7703
|
if (typeof message === "string") return message;
|
|
7569
7704
|
}
|
|
7570
|
-
function formatOption(actual) {
|
|
7571
|
-
if (isNone2(actual)) return "no value provided";
|
|
7572
|
-
return format(actual.value);
|
|
7573
|
-
}
|
|
7574
7705
|
|
|
7575
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7706
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/cause.js
|
|
7576
7707
|
function getSchemaIssue(cause) {
|
|
7577
7708
|
let issue;
|
|
7578
7709
|
for (const reason of cause.reasons) {
|
|
@@ -7593,7 +7724,7 @@ function getSchemaIssueOrThrow(cause, message) {
|
|
|
7593
7724
|
return issue;
|
|
7594
7725
|
}
|
|
7595
7726
|
|
|
7596
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7727
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaGetter.js
|
|
7597
7728
|
var Getter = class _Getter extends Class {
|
|
7598
7729
|
run;
|
|
7599
7730
|
constructor(run2) {
|
|
@@ -7613,7 +7744,7 @@ var Getter = class _Getter extends Class {
|
|
|
7613
7744
|
return new _Getter((oe, options) => this.run(oe, options).pipe(flatMapEager2((ot) => other.run(ot, options))));
|
|
7614
7745
|
}
|
|
7615
7746
|
};
|
|
7616
|
-
var passthrough_ = /* @__PURE__ */ new Getter(
|
|
7747
|
+
var passthrough_ = /* @__PURE__ */ new Getter(succeed5);
|
|
7617
7748
|
function isPassthrough(getter) {
|
|
7618
7749
|
return getter.run === passthrough_.run;
|
|
7619
7750
|
}
|
|
@@ -7630,12 +7761,12 @@ function transformOrFail(f) {
|
|
|
7630
7761
|
return onSome((e, options) => f(e, options).pipe(mapEager2(some2)));
|
|
7631
7762
|
}
|
|
7632
7763
|
function transformOptional(f) {
|
|
7633
|
-
return new Getter((oe) =>
|
|
7764
|
+
return new Getter((oe) => succeed5(f(oe)));
|
|
7634
7765
|
}
|
|
7635
7766
|
function withDefault(defaultValue) {
|
|
7636
7767
|
return new Getter((o) => {
|
|
7637
7768
|
const filtered = filter(o, isNotUndefined);
|
|
7638
|
-
return isSome2(filtered) ?
|
|
7769
|
+
return isSome2(filtered) ? succeed5(filtered) : mapEager2(defaultValue, some2);
|
|
7639
7770
|
});
|
|
7640
7771
|
}
|
|
7641
7772
|
function String2() {
|
|
@@ -7648,12 +7779,12 @@ function encodeBase642() {
|
|
|
7648
7779
|
return transform(encodeBase64);
|
|
7649
7780
|
}
|
|
7650
7781
|
function decodeBase642() {
|
|
7651
|
-
return transformOrFail((input) => mapErrorEager2(fromResult2(decodeBase64(input)), (
|
|
7652
|
-
|
|
7653
|
-
})));
|
|
7782
|
+
return transformOrFail((input, options) => mapErrorEager2(fromResult2(decodeBase64(input)), () => new InvalidValue({
|
|
7783
|
+
expected: "a valid Base64 string"
|
|
7784
|
+
}, input, options)));
|
|
7654
7785
|
}
|
|
7655
7786
|
|
|
7656
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7787
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaTransformation.js
|
|
7657
7788
|
var TypeId13 = "~effect/SchemaTransformation/Transformation";
|
|
7658
7789
|
var Transformation = class _Transformation {
|
|
7659
7790
|
[TypeId13] = TypeId13;
|
|
@@ -7674,7 +7805,7 @@ var Transformation = class _Transformation {
|
|
|
7674
7805
|
function isTransformation(u) {
|
|
7675
7806
|
return hasProperty(u, TypeId13) && u[TypeId13] === TypeId13;
|
|
7676
7807
|
}
|
|
7677
|
-
var
|
|
7808
|
+
var make10 = (options) => {
|
|
7678
7809
|
if (isTransformation(options)) {
|
|
7679
7810
|
return options;
|
|
7680
7811
|
}
|
|
@@ -7692,14 +7823,14 @@ function passthrough3() {
|
|
|
7692
7823
|
}
|
|
7693
7824
|
var numberFromString = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Number3(), /* @__PURE__ */ String2());
|
|
7694
7825
|
var urlFromString = /* @__PURE__ */ transformOrFail2({
|
|
7695
|
-
decode: (s) => URL.canParse(s) ?
|
|
7696
|
-
|
|
7697
|
-
})),
|
|
7698
|
-
encode: (url) =>
|
|
7826
|
+
decode: (s, options) => URL.canParse(s) ? succeed5(new URL(s)) : fail5(new InvalidValue({
|
|
7827
|
+
expected: "a valid URL string"
|
|
7828
|
+
}, s, options)),
|
|
7829
|
+
encode: (url) => succeed5(url.href)
|
|
7699
7830
|
});
|
|
7700
7831
|
var uint8ArrayFromBase64String = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeBase642(), /* @__PURE__ */ encodeBase642());
|
|
7701
7832
|
|
|
7702
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7833
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaAST.js
|
|
7703
7834
|
function makeGuard(tag2) {
|
|
7704
7835
|
return (ast) => ast._tag === tag2;
|
|
7705
7836
|
}
|
|
@@ -7709,6 +7840,7 @@ var isLiteral = /* @__PURE__ */ makeGuard("Literal");
|
|
|
7709
7840
|
var isUniqueSymbol = /* @__PURE__ */ makeGuard("UniqueSymbol");
|
|
7710
7841
|
var isArrays = /* @__PURE__ */ makeGuard("Arrays");
|
|
7711
7842
|
var isObjects = /* @__PURE__ */ makeGuard("Objects");
|
|
7843
|
+
var isSuspend = /* @__PURE__ */ makeGuard("Suspend");
|
|
7712
7844
|
var Link = class {
|
|
7713
7845
|
to;
|
|
7714
7846
|
transformation;
|
|
@@ -7722,12 +7854,12 @@ var Context = class {
|
|
|
7722
7854
|
isOptional;
|
|
7723
7855
|
isMutable;
|
|
7724
7856
|
/** Used for constructor default values (e.g. `withConstructorDefault` API) */
|
|
7725
|
-
|
|
7857
|
+
constructorDefault;
|
|
7726
7858
|
annotations;
|
|
7727
|
-
constructor(isOptional2, isMutable,
|
|
7859
|
+
constructor(isOptional2, isMutable, constructorDefault = void 0, annotations = void 0) {
|
|
7728
7860
|
this.isOptional = isOptional2;
|
|
7729
7861
|
this.isMutable = isMutable;
|
|
7730
|
-
this.
|
|
7862
|
+
this.constructorDefault = constructorDefault;
|
|
7731
7863
|
this.annotations = annotations;
|
|
7732
7864
|
}
|
|
7733
7865
|
};
|
|
@@ -7761,23 +7893,23 @@ var Declaration = class _Declaration extends Base2 {
|
|
|
7761
7893
|
}
|
|
7762
7894
|
/** @internal */
|
|
7763
7895
|
getParser() {
|
|
7764
|
-
|
|
7765
|
-
return (
|
|
7766
|
-
if (
|
|
7767
|
-
return
|
|
7896
|
+
let run2;
|
|
7897
|
+
return (input, options) => {
|
|
7898
|
+
if (input === missing) return missingExit;
|
|
7899
|
+
return (run2 ??= this.run(this.typeParameters))(input, this, options);
|
|
7768
7900
|
};
|
|
7769
7901
|
}
|
|
7770
|
-
_rebuild(
|
|
7771
|
-
const tps = mapOrSame(this.typeParameters,
|
|
7902
|
+
_rebuild(recur, checks, encodingChecks) {
|
|
7903
|
+
const tps = mapOrSame(this.typeParameters, recur);
|
|
7772
7904
|
return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks ? this : new _Declaration(tps, this.run, this.annotations, checks, void 0, this.context, encodingChecks);
|
|
7773
7905
|
}
|
|
7774
7906
|
/** @internal */
|
|
7775
|
-
recur(
|
|
7776
|
-
return this._rebuild(
|
|
7907
|
+
recur(recur) {
|
|
7908
|
+
return this._rebuild(recur, this.checks, this.encodingChecks);
|
|
7777
7909
|
}
|
|
7778
7910
|
/** @internal */
|
|
7779
|
-
flip(
|
|
7780
|
-
return this._rebuild(
|
|
7911
|
+
flip(recur) {
|
|
7912
|
+
return this._rebuild(recur, this.encodingChecks, this.checks);
|
|
7781
7913
|
}
|
|
7782
7914
|
/** @internal */
|
|
7783
7915
|
getExpected() {
|
|
@@ -7841,7 +7973,8 @@ var String3 = class extends Base2 {
|
|
|
7841
7973
|
}
|
|
7842
7974
|
/** @internal */
|
|
7843
7975
|
matchPart(s, options) {
|
|
7844
|
-
|
|
7976
|
+
const checks = this.checks;
|
|
7977
|
+
return checks && !options.disableChecks && collectIssues(checks, s, void 0, this, options) ? void 0 : s;
|
|
7845
7978
|
}
|
|
7846
7979
|
/** @internal */
|
|
7847
7980
|
getExpected() {
|
|
@@ -7864,14 +7997,17 @@ var Number4 = class extends Base2 {
|
|
|
7864
7997
|
return this._match(isStringFiniteRegExp, s, options);
|
|
7865
7998
|
}
|
|
7866
7999
|
_match(regexp, s, options) {
|
|
7867
|
-
|
|
8000
|
+
if (!regexp.test(s)) return void 0;
|
|
8001
|
+
const value = globalThis.Number(s);
|
|
8002
|
+
if (options.disableChecks || !this.checks) return value;
|
|
8003
|
+
return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;
|
|
7868
8004
|
}
|
|
7869
8005
|
/** @internal */
|
|
7870
8006
|
toCodecJson() {
|
|
7871
8007
|
if (this.checks && (hasCheck(this.checks, "effect/schema/isFinite") || hasCheck(this.checks, "effect/schema/isInt"))) {
|
|
7872
8008
|
return this;
|
|
7873
8009
|
}
|
|
7874
|
-
return replaceEncoding(this, [numberToJson
|
|
8010
|
+
return replaceEncoding(this, [numberToJson]);
|
|
7875
8011
|
}
|
|
7876
8012
|
/** @internal */
|
|
7877
8013
|
toCodecStringTree() {
|
|
@@ -7888,10 +8024,6 @@ var Number4 = class extends Base2 {
|
|
|
7888
8024
|
function hasCheck(checks, id) {
|
|
7889
8025
|
return checks.some((check) => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
|
|
7890
8026
|
}
|
|
7891
|
-
function numberToJson(checks) {
|
|
7892
|
-
const encodedFinite = checks === void 0 ? finite : appendChecks(finite, checks);
|
|
7893
|
-
return new Link(new Union([encodedFinite, nonFiniteLiterals], "anyOf"), new Transformation(Number3(), transform((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
|
|
7894
|
-
}
|
|
7895
8027
|
var number2 = /* @__PURE__ */ new Number4();
|
|
7896
8028
|
var Arrays = class _Arrays extends Base2 {
|
|
7897
8029
|
_tag = "Arrays";
|
|
@@ -7905,51 +8037,62 @@ var Arrays = class _Arrays extends Base2 {
|
|
|
7905
8037
|
this.elements = elements;
|
|
7906
8038
|
this.rest = rest;
|
|
7907
8039
|
this.encodingChecks = encodingChecks;
|
|
7908
|
-
|
|
7909
|
-
|
|
8040
|
+
let hasOptional = false;
|
|
8041
|
+
for (let i = 0; i < elements.length; i++) {
|
|
8042
|
+
if (isOptional(elements[i])) {
|
|
8043
|
+
hasOptional = true;
|
|
8044
|
+
} else if (hasOptional) {
|
|
8045
|
+
throw new Error("A required element cannot follow an optional element. ts(1257)");
|
|
8046
|
+
}
|
|
8047
|
+
}
|
|
8048
|
+
if (hasOptional && rest.length > 1) {
|
|
7910
8049
|
throw new Error("A required element cannot follow an optional element. ts(1257)");
|
|
7911
8050
|
}
|
|
7912
|
-
|
|
7913
|
-
|
|
8051
|
+
for (let i = 1; i < rest.length; i++) {
|
|
8052
|
+
if (isOptional(rest[i])) {
|
|
8053
|
+
throw new Error("An optional element cannot follow a rest element. ts(1266)");
|
|
8054
|
+
}
|
|
7914
8055
|
}
|
|
7915
8056
|
}
|
|
7916
8057
|
/** @internal */
|
|
7917
|
-
getParser(
|
|
8058
|
+
getParser(compile, compileConstructorDefault2 = compile) {
|
|
7918
8059
|
const ast = this;
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
const rest = ast.rest.map((ast2) => ({
|
|
7924
|
-
ast: ast2,
|
|
7925
|
-
parser: recur2(ast2)
|
|
7926
|
-
}));
|
|
7927
|
-
const elementLen = elements.length;
|
|
7928
|
-
const [head2, ...tail2] = rest;
|
|
7929
|
-
const tailLen = tail2.length;
|
|
8060
|
+
let elements;
|
|
8061
|
+
let rest;
|
|
8062
|
+
const elementLen = ast.elements.length;
|
|
8063
|
+
const tailLen = Math.max(0, ast.rest.length - 1);
|
|
7930
8064
|
function getParser(tailThreshold, index) {
|
|
7931
8065
|
if (index < elementLen) {
|
|
7932
8066
|
return elements[index];
|
|
7933
8067
|
} else if (index >= tailThreshold) {
|
|
7934
|
-
return
|
|
8068
|
+
return rest[index - tailThreshold + 1];
|
|
7935
8069
|
}
|
|
7936
|
-
return
|
|
8070
|
+
return rest[0];
|
|
7937
8071
|
}
|
|
7938
|
-
return fnUntracedEager2(function* (
|
|
7939
|
-
if (
|
|
7940
|
-
return
|
|
8072
|
+
return fnUntracedEager2(function* (input, options) {
|
|
8073
|
+
if (input === missing) {
|
|
8074
|
+
return missing;
|
|
7941
8075
|
}
|
|
7942
|
-
const input = oinput.value;
|
|
7943
8076
|
if (!Array.isArray(input)) {
|
|
7944
|
-
return yield* fail5(new InvalidType(ast,
|
|
8077
|
+
return yield* fail5(new InvalidType(ast, input, options));
|
|
8078
|
+
}
|
|
8079
|
+
if (!elements) {
|
|
8080
|
+
elements = ast.elements.map((ast2) => ({
|
|
8081
|
+
ast: ast2,
|
|
8082
|
+
parser: compileConstructorDefault2(ast2)
|
|
8083
|
+
}));
|
|
8084
|
+
rest = ast.rest.map((ast2) => ({
|
|
8085
|
+
ast: ast2,
|
|
8086
|
+
parser: compileConstructorDefault2(ast2)
|
|
8087
|
+
}));
|
|
7945
8088
|
}
|
|
7946
8089
|
const len = input.length;
|
|
7947
8090
|
const state = {
|
|
7948
8091
|
ast,
|
|
7949
8092
|
getParser,
|
|
7950
|
-
|
|
8093
|
+
input,
|
|
7951
8094
|
len,
|
|
7952
|
-
tailThreshold:
|
|
8095
|
+
tailThreshold: Math.max(elementLen, len - tailLen),
|
|
7953
8096
|
output: new globalThis.Array(len),
|
|
7954
8097
|
issues: void 0,
|
|
7955
8098
|
options
|
|
@@ -7962,33 +8105,34 @@ var Arrays = class _Arrays extends Base2 {
|
|
|
7962
8105
|
if (eff) yield* eff;
|
|
7963
8106
|
if (ast.rest.length === 0 && len > elementLen) {
|
|
7964
8107
|
for (let i = elementLen; i <= len - 1; i++) {
|
|
7965
|
-
const
|
|
8108
|
+
const unexpected = new UnexpectedKey(ast, input[i], options);
|
|
8109
|
+
const issue = new Pointer([i], unexpected);
|
|
7966
8110
|
if (options.errors === "all") {
|
|
7967
8111
|
if (state.issues) state.issues.push(issue);
|
|
7968
8112
|
else state.issues = [issue];
|
|
7969
8113
|
} else {
|
|
7970
|
-
return yield* fail5(new Composite(ast,
|
|
8114
|
+
return yield* fail5(new Composite(ast, [issue], input, options));
|
|
7971
8115
|
}
|
|
7972
8116
|
}
|
|
7973
8117
|
}
|
|
7974
8118
|
if (state.issues) {
|
|
7975
|
-
return yield* fail5(new Composite(ast,
|
|
8119
|
+
return yield* fail5(new Composite(ast, state.issues, input, options));
|
|
7976
8120
|
}
|
|
7977
|
-
return
|
|
8121
|
+
return state.output;
|
|
7978
8122
|
});
|
|
7979
8123
|
}
|
|
7980
|
-
_rebuild(
|
|
7981
|
-
const elements = mapOrSame(this.elements,
|
|
7982
|
-
const rest = mapOrSame(this.rest,
|
|
8124
|
+
_rebuild(recur, checks, encodingChecks) {
|
|
8125
|
+
const elements = mapOrSame(this.elements, recur);
|
|
8126
|
+
const rest = mapOrSame(this.rest, recur);
|
|
7983
8127
|
return elements === this.elements && rest === this.rest && checks === this.checks && encodingChecks === this.encodingChecks ? this : new _Arrays(this.isMutable, elements, rest, this.annotations, checks, void 0, this.context, encodingChecks);
|
|
7984
8128
|
}
|
|
7985
8129
|
/** @internal */
|
|
7986
|
-
recur(
|
|
7987
|
-
return this._rebuild(
|
|
8130
|
+
recur(recur) {
|
|
8131
|
+
return this._rebuild(recur, this.checks, this.encodingChecks);
|
|
7988
8132
|
}
|
|
7989
8133
|
/** @internal */
|
|
7990
|
-
flip(
|
|
7991
|
-
return this._rebuild(
|
|
8134
|
+
flip(recur) {
|
|
8135
|
+
return this._rebuild(recur, this.encodingChecks, this.checks);
|
|
7992
8136
|
}
|
|
7993
8137
|
/** @internal */
|
|
7994
8138
|
getExpected() {
|
|
@@ -7997,14 +8141,16 @@ var Arrays = class _Arrays extends Base2 {
|
|
|
7997
8141
|
};
|
|
7998
8142
|
var parseArray = /* @__PURE__ */ iterateEager()({
|
|
7999
8143
|
onItem(s, item, i) {
|
|
8000
|
-
const value = i < s.len ?
|
|
8144
|
+
const value = i < s.len ? item : missing;
|
|
8001
8145
|
return s.getParser(s.tailThreshold, i).parser(value, s.options);
|
|
8002
8146
|
},
|
|
8003
|
-
step(s,
|
|
8147
|
+
step(s, item, exit3, i) {
|
|
8004
8148
|
if (exit3._tag === "Failure") {
|
|
8005
8149
|
return wrapPropertyKeyIssue(s, s.ast, i, exit3);
|
|
8006
|
-
}
|
|
8007
|
-
|
|
8150
|
+
}
|
|
8151
|
+
const value = exit3 === sameExit ? item : exit3[args];
|
|
8152
|
+
if (value !== missing) {
|
|
8153
|
+
s.output[i] = value;
|
|
8008
8154
|
} else {
|
|
8009
8155
|
const p = s.getParser(s.tailThreshold, i);
|
|
8010
8156
|
if (isOptional(p.ast)) return;
|
|
@@ -8013,14 +8159,11 @@ var parseArray = /* @__PURE__ */ iterateEager()({
|
|
|
8013
8159
|
if (s.issues) s.issues.push(issue);
|
|
8014
8160
|
else s.issues = [issue];
|
|
8015
8161
|
} else {
|
|
8016
|
-
return fail4(new Composite(s.ast, s.
|
|
8162
|
+
return fail4(new Composite(s.ast, [issue], s.input, s.options));
|
|
8017
8163
|
}
|
|
8018
8164
|
}
|
|
8019
8165
|
}
|
|
8020
8166
|
});
|
|
8021
|
-
function resolveTailThreshold(inputLen, elementLen, tailLen) {
|
|
8022
|
-
return Math.max(elementLen, inputLen - tailLen);
|
|
8023
|
-
}
|
|
8024
8167
|
var resolveConcurrency = (value) => {
|
|
8025
8168
|
value = value === "unbounded" ? Infinity : value ?? 1;
|
|
8026
8169
|
return value > 1 ? {
|
|
@@ -8033,14 +8176,14 @@ var wrapPropertyKeyIssue = (s, ast, key, exit3) => {
|
|
|
8033
8176
|
}
|
|
8034
8177
|
const issue = getSchemaIssue(exit3.cause);
|
|
8035
8178
|
if (issue === void 0) {
|
|
8036
|
-
return failCause2(map6(exit3.cause, (issue2) => new Composite(ast,
|
|
8179
|
+
return failCause2(map6(exit3.cause, (issue2) => new Composite(ast, [new Pointer([key], issue2)], s.input, s.options)));
|
|
8037
8180
|
}
|
|
8038
8181
|
const pointer = new Pointer([key], issue);
|
|
8039
8182
|
if (s.options.errors === "all") {
|
|
8040
8183
|
if (s.issues) s.issues.push(pointer);
|
|
8041
8184
|
else s.issues = [pointer];
|
|
8042
8185
|
} else {
|
|
8043
|
-
return fail4(new Composite(ast, s.
|
|
8186
|
+
return fail4(new Composite(ast, [pointer], s.input, s.options));
|
|
8044
8187
|
}
|
|
8045
8188
|
};
|
|
8046
8189
|
var FINITE_PATTERN = "[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";
|
|
@@ -8091,14 +8234,12 @@ function isIndexSignatureParameter(ast) {
|
|
|
8091
8234
|
var IndexSignature = class {
|
|
8092
8235
|
parameter;
|
|
8093
8236
|
type;
|
|
8094
|
-
|
|
8095
|
-
constructor(parameter, type, merge4) {
|
|
8237
|
+
constructor(parameter, type) {
|
|
8096
8238
|
if (!isIndexSignatureParameter(parameter)) {
|
|
8097
8239
|
throw new Error(`Invalid index signature parameter ${parameter._tag}`);
|
|
8098
8240
|
}
|
|
8099
8241
|
this.parameter = parameter;
|
|
8100
8242
|
this.type = type;
|
|
8101
|
-
this.merge = merge4;
|
|
8102
8243
|
if (isOptional(type) && !containsUndefined(type)) {
|
|
8103
8244
|
throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
|
|
8104
8245
|
}
|
|
@@ -8120,72 +8261,80 @@ var Objects = class _Objects extends Base2 {
|
|
|
8120
8261
|
}
|
|
8121
8262
|
}
|
|
8122
8263
|
/** @internal */
|
|
8123
|
-
getParser(
|
|
8264
|
+
getParser(compile, compileConstructorDefault2 = compile) {
|
|
8124
8265
|
const ast = this;
|
|
8125
8266
|
const expectedKeys = [];
|
|
8126
|
-
const expectedKeysSet = /* @__PURE__ */ new Set();
|
|
8127
|
-
const properties = [];
|
|
8128
8267
|
for (const ps of ast.propertySignatures) {
|
|
8129
8268
|
expectedKeys.push(ps.name);
|
|
8130
|
-
expectedKeysSet.add(ps.name);
|
|
8131
|
-
properties.push({
|
|
8132
|
-
ps,
|
|
8133
|
-
parser: recur2(ps.type),
|
|
8134
|
-
name: ps.name,
|
|
8135
|
-
type: ps.type
|
|
8136
|
-
});
|
|
8137
8269
|
}
|
|
8270
|
+
const hasProperties = expectedKeys.length;
|
|
8138
8271
|
const indexCount = ast.indexSignatures.length;
|
|
8139
|
-
|
|
8272
|
+
let expectedKeysSet = hasProperties && indexCount ? new Set(expectedKeys) : void 0;
|
|
8273
|
+
if (!hasProperties && !indexCount) {
|
|
8140
8274
|
return fromRefinement(ast, isNotNullish);
|
|
8141
8275
|
}
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
return;
|
|
8160
|
-
} else if (exitKey.value._tag === "Some" && exitValue.value._tag === "Some") {
|
|
8161
|
-
const k2 = exitKey.value.value;
|
|
8162
|
-
if (expectedKeysSet.has(key) || expectedKeysSet.has(k2)) {
|
|
8163
|
-
return;
|
|
8164
|
-
}
|
|
8165
|
-
const v2 = exitValue.value.value;
|
|
8166
|
-
if (is2.merge && is2.merge.decode && Object.hasOwn(s.out, k2)) {
|
|
8167
|
-
const [k, v] = is2.merge.decode.combine([k2, s.out[k2]], [k2, v2]);
|
|
8168
|
-
assignProperty(s.out, k, v);
|
|
8169
|
-
} else {
|
|
8170
|
-
assignProperty(s.out, k2, v2);
|
|
8171
|
-
}
|
|
8276
|
+
let properties;
|
|
8277
|
+
let indexes;
|
|
8278
|
+
const finishIndex = (s, key, k2, inputValue, exitValue) => {
|
|
8279
|
+
if (exitValue._tag === "Failure") {
|
|
8280
|
+
return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_4;
|
|
8281
|
+
}
|
|
8282
|
+
const value = exitValue === sameExit ? inputValue : exitValue[args];
|
|
8283
|
+
if (k2 !== missing && value !== missing) {
|
|
8284
|
+
if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(k2))) return void_4;
|
|
8285
|
+
assignProperty(s.out, k2, value);
|
|
8286
|
+
}
|
|
8287
|
+
return void_4;
|
|
8288
|
+
};
|
|
8289
|
+
const parseIndex = (s, key, index, exitKey) => {
|
|
8290
|
+
if (!exitKey) {
|
|
8291
|
+
const eff = index.parserKey(key, s.options);
|
|
8292
|
+
if (!effectIsExit(eff)) {
|
|
8293
|
+
return flatMap5(exit2(eff), (exit3) => parseIndex(s, key, index, exit3));
|
|
8172
8294
|
}
|
|
8173
|
-
|
|
8295
|
+
exitKey = eff;
|
|
8296
|
+
}
|
|
8297
|
+
if (exitKey._tag === "Failure") {
|
|
8298
|
+
return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? void_4;
|
|
8299
|
+
}
|
|
8300
|
+
const k2 = exitKey === sameExit ? key : exitKey[args];
|
|
8301
|
+
const inputValue = s.input[key];
|
|
8302
|
+
const result3 = index.parserValue(inputValue, s.options);
|
|
8303
|
+
return effectIsExit(result3) ? finishIndex(s, key, k2, inputValue, result3) : flatMap5(exit2(result3), (exit3) => finishIndex(s, key, k2, inputValue, exit3));
|
|
8304
|
+
};
|
|
8305
|
+
const parseStringIndex = (s, key, index) => {
|
|
8306
|
+
const inputValue = s.input[key];
|
|
8307
|
+
const result3 = index.parserValue(inputValue, s.options);
|
|
8308
|
+
return effectIsExit(result3) ? finishIndex(s, key, key, inputValue, result3) : flatMap5(exit2(result3), (exit3) => finishIndex(s, key, key, inputValue, exit3));
|
|
8309
|
+
};
|
|
8310
|
+
const parseIndexes = indexCount ? iterateEager()({
|
|
8311
|
+
onItem: (s, [key, index]) => parseIndex(s, key, index),
|
|
8174
8312
|
step: (_s, _, exit3) => exit3._tag === "Failure" ? exit3 : void 0
|
|
8175
8313
|
}) : void 0;
|
|
8176
|
-
return fnUntracedEager2(function* (
|
|
8177
|
-
if (
|
|
8178
|
-
return
|
|
8314
|
+
return fnUntracedEager2(function* (input, options) {
|
|
8315
|
+
if (input === missing) {
|
|
8316
|
+
return missing;
|
|
8179
8317
|
}
|
|
8180
|
-
const input = oinput.value;
|
|
8181
8318
|
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
|
|
8182
|
-
return yield* fail5(new InvalidType(ast,
|
|
8319
|
+
return yield* fail5(new InvalidType(ast, input, options));
|
|
8320
|
+
}
|
|
8321
|
+
if (!properties) {
|
|
8322
|
+
properties = ast.propertySignatures.map((ps) => ({
|
|
8323
|
+
parser: compileConstructorDefault2(ps.type),
|
|
8324
|
+
name: ps.name,
|
|
8325
|
+
type: ps.type
|
|
8326
|
+
}));
|
|
8327
|
+
indexes = indexCount ? ast.indexSignatures.map((is2) => ({
|
|
8328
|
+
is: is2,
|
|
8329
|
+
parserKey: compile(parameterFromPropertyKey(is2.parameter)),
|
|
8330
|
+
parserValue: compileConstructorDefault2(is2.type)
|
|
8331
|
+
})) : void 0;
|
|
8183
8332
|
}
|
|
8333
|
+
const record2 = input;
|
|
8184
8334
|
const out = {};
|
|
8185
8335
|
const state = {
|
|
8186
8336
|
ast,
|
|
8187
|
-
|
|
8188
|
-
input,
|
|
8337
|
+
input: record2,
|
|
8189
8338
|
out,
|
|
8190
8339
|
issues: void 0,
|
|
8191
8340
|
options
|
|
@@ -8194,13 +8343,15 @@ var Objects = class _Objects extends Base2 {
|
|
|
8194
8343
|
const onExcessPropertyError = options.onExcessProperty === "error";
|
|
8195
8344
|
const onExcessPropertyPreserve = options.onExcessProperty === "preserve";
|
|
8196
8345
|
let inputKeys;
|
|
8197
|
-
if (
|
|
8198
|
-
|
|
8346
|
+
if (!indexCount && (onExcessPropertyError || onExcessPropertyPreserve)) {
|
|
8347
|
+
expectedKeysSet ??= new Set(expectedKeys);
|
|
8348
|
+
inputKeys = Reflect.ownKeys(record2);
|
|
8199
8349
|
for (let i = 0; i < inputKeys.length; i++) {
|
|
8200
8350
|
const key = inputKeys[i];
|
|
8201
8351
|
if (!expectedKeysSet.has(key)) {
|
|
8202
8352
|
if (onExcessPropertyError) {
|
|
8203
|
-
const
|
|
8353
|
+
const unexpected = new UnexpectedKey(ast, record2[key], options);
|
|
8354
|
+
const issue = new Pointer([key], unexpected);
|
|
8204
8355
|
if (errorsAllOption) {
|
|
8205
8356
|
if (state.issues) {
|
|
8206
8357
|
state.issues.push(issue);
|
|
@@ -8209,66 +8360,77 @@ var Objects = class _Objects extends Base2 {
|
|
|
8209
8360
|
}
|
|
8210
8361
|
continue;
|
|
8211
8362
|
} else {
|
|
8212
|
-
return yield* fail5(new Composite(ast,
|
|
8363
|
+
return yield* fail5(new Composite(ast, [issue], input, options));
|
|
8213
8364
|
}
|
|
8214
8365
|
} else {
|
|
8215
|
-
assignProperty(out, key,
|
|
8366
|
+
assignProperty(out, key, record2[key]);
|
|
8216
8367
|
}
|
|
8217
8368
|
}
|
|
8218
8369
|
}
|
|
8219
8370
|
}
|
|
8220
8371
|
const concurrency = resolveConcurrency(options?.concurrency);
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8372
|
+
if (hasProperties) {
|
|
8373
|
+
const eff = parseProperties(state, properties, concurrency);
|
|
8374
|
+
if (eff) yield* eff;
|
|
8375
|
+
}
|
|
8376
|
+
if (indexCount && !concurrency) {
|
|
8377
|
+
for (let i = 0; i < indexCount; i++) {
|
|
8378
|
+
const index = indexes[i];
|
|
8379
|
+
const parse = index.is.parameter === string2 ? parseStringIndex : parseIndex;
|
|
8380
|
+
const keys2 = index.is.parameter === string2 ? Object.keys(record2) : getIndexSignatureKeys(record2, index.is.parameter, options);
|
|
8381
|
+
for (let j = 0; j < keys2.length; j++) {
|
|
8382
|
+
const eff = parse(state, keys2[j], index);
|
|
8383
|
+
if (!effectIsExit(eff)) yield* eff;
|
|
8384
|
+
else if (eff._tag === "Failure") return yield* eff;
|
|
8385
|
+
}
|
|
8386
|
+
}
|
|
8387
|
+
} else if (parseIndexes) {
|
|
8224
8388
|
const keyPairs = empty3();
|
|
8225
8389
|
for (let i = 0; i < indexCount; i++) {
|
|
8226
|
-
const
|
|
8227
|
-
const keys2 = getIndexSignatureKeys(
|
|
8390
|
+
const index = indexes[i];
|
|
8391
|
+
const keys2 = getIndexSignatureKeys(record2, index.is.parameter, options);
|
|
8228
8392
|
for (let j = 0; j < keys2.length; j++) {
|
|
8229
|
-
|
|
8230
|
-
keyPairs.push([key, is2]);
|
|
8393
|
+
keyPairs.push([keys2[j], index]);
|
|
8231
8394
|
}
|
|
8232
8395
|
}
|
|
8233
|
-
const
|
|
8234
|
-
if (
|
|
8396
|
+
const eff = parseIndexes(state, keyPairs, concurrency);
|
|
8397
|
+
if (eff) yield* eff;
|
|
8235
8398
|
}
|
|
8236
8399
|
if (state.issues) {
|
|
8237
|
-
return yield* fail5(new Composite(ast,
|
|
8400
|
+
return yield* fail5(new Composite(ast, state.issues, input, options));
|
|
8238
8401
|
}
|
|
8239
8402
|
if (options.propertyOrder === "original") {
|
|
8240
|
-
const keys2 = (inputKeys ?? Reflect.ownKeys(
|
|
8403
|
+
const keys2 = (inputKeys ?? Reflect.ownKeys(record2)).concat(expectedKeys);
|
|
8241
8404
|
const preserved = {};
|
|
8242
8405
|
for (const key of keys2) {
|
|
8243
8406
|
if (Object.hasOwn(out, key)) {
|
|
8244
8407
|
assignProperty(preserved, key, out[key]);
|
|
8245
8408
|
}
|
|
8246
8409
|
}
|
|
8247
|
-
return
|
|
8410
|
+
return preserved;
|
|
8248
8411
|
}
|
|
8249
|
-
return
|
|
8412
|
+
return out;
|
|
8250
8413
|
});
|
|
8251
8414
|
}
|
|
8252
|
-
_rebuild(
|
|
8415
|
+
_rebuild(recur, recurParameter, checks, encodingChecks) {
|
|
8253
8416
|
const props = mapOrSame(this.propertySignatures, (ps) => {
|
|
8254
|
-
const t =
|
|
8417
|
+
const t = recur(ps.type);
|
|
8255
8418
|
return t === ps.type ? ps : new PropertySignature(ps.name, t);
|
|
8256
8419
|
});
|
|
8257
8420
|
const indexes = mapOrSame(this.indexSignatures, (is2) => {
|
|
8258
8421
|
const p = recurParameter(is2.parameter);
|
|
8259
|
-
const t =
|
|
8260
|
-
|
|
8261
|
-
return p === is2.parameter && t === is2.type && merge4 === is2.merge ? is2 : new IndexSignature(p, t, merge4);
|
|
8422
|
+
const t = recur(is2.type);
|
|
8423
|
+
return p === is2.parameter && t === is2.type ? is2 : new IndexSignature(p, t);
|
|
8262
8424
|
});
|
|
8263
8425
|
return props === this.propertySignatures && indexes === this.indexSignatures && checks === this.checks && encodingChecks === this.encodingChecks ? this : new _Objects(props, indexes, this.annotations, checks, void 0, this.context, encodingChecks);
|
|
8264
8426
|
}
|
|
8265
8427
|
/** @internal */
|
|
8266
|
-
flip(
|
|
8267
|
-
return this._rebuild(
|
|
8428
|
+
flip(recur) {
|
|
8429
|
+
return this._rebuild(recur, recur, this.encodingChecks, this.checks);
|
|
8268
8430
|
}
|
|
8269
8431
|
/** @internal */
|
|
8270
|
-
recur(
|
|
8271
|
-
return this._rebuild(
|
|
8432
|
+
recur(recur, recurParameter = recur) {
|
|
8433
|
+
return this._rebuild(recur, recurParameter, this.checks, this.encodingChecks);
|
|
8272
8434
|
}
|
|
8273
8435
|
/** @internal */
|
|
8274
8436
|
getExpected() {
|
|
@@ -8278,22 +8440,32 @@ var Objects = class _Objects extends Base2 {
|
|
|
8278
8440
|
};
|
|
8279
8441
|
var parseProperties = /* @__PURE__ */ iterateEager()({
|
|
8280
8442
|
onItem(s, p) {
|
|
8281
|
-
|
|
8443
|
+
if (!Object.hasOwn(s.input, p.name)) {
|
|
8444
|
+
return p.parser(missing, s.options);
|
|
8445
|
+
}
|
|
8446
|
+
const value = s.input[p.name];
|
|
8447
|
+
assignProperty(s.out, p.name, value);
|
|
8282
8448
|
return p.parser(value, s.options);
|
|
8283
8449
|
},
|
|
8284
8450
|
step(s, p, exit3) {
|
|
8285
8451
|
if (exit3._tag === "Failure") {
|
|
8286
8452
|
return wrapPropertyKeyIssue(s, s.ast, p.name, exit3);
|
|
8287
|
-
}
|
|
8288
|
-
|
|
8289
|
-
|
|
8453
|
+
}
|
|
8454
|
+
if (exit3 === sameExit) return;
|
|
8455
|
+
const value = exit3[args];
|
|
8456
|
+
if (value !== missing) {
|
|
8457
|
+
assignProperty(s.out, p.name, value);
|
|
8458
|
+
return;
|
|
8459
|
+
}
|
|
8460
|
+
delete s.out[p.name];
|
|
8461
|
+
if (!isOptional(p.type)) {
|
|
8290
8462
|
const issue = new Pointer([p.name], new MissingKey(p.type.context?.annotations));
|
|
8291
8463
|
if (s.options.errors === "all") {
|
|
8292
8464
|
if (s.issues) s.issues.push(issue);
|
|
8293
8465
|
else s.issues = [issue];
|
|
8294
8466
|
return;
|
|
8295
8467
|
} else {
|
|
8296
|
-
return fail4(new Composite(s.ast, s.
|
|
8468
|
+
return fail4(new Composite(s.ast, [issue], s.input, s.options));
|
|
8297
8469
|
}
|
|
8298
8470
|
}
|
|
8299
8471
|
}
|
|
@@ -8317,6 +8489,17 @@ function tuple(elements, checks = void 0) {
|
|
|
8317
8489
|
function union3(members, mode, checks) {
|
|
8318
8490
|
return new Union(members.map(getAST), mode, void 0, checks);
|
|
8319
8491
|
}
|
|
8492
|
+
var toCandidate = /* @__PURE__ */ memoizeIdempotent((ast) => {
|
|
8493
|
+
while (true) {
|
|
8494
|
+
if (isSuspend(ast)) return unknown;
|
|
8495
|
+
const encoding = ast.encoding;
|
|
8496
|
+
if (!encoding) {
|
|
8497
|
+
return ast.recur?.(toCandidate, identity) ?? ast;
|
|
8498
|
+
}
|
|
8499
|
+
if (encoding.some((link2) => link2.transformation._tag === "Middleware" && link2.transformation.decode !== identity)) return unknown;
|
|
8500
|
+
ast = encoding[encoding.length - 1].to;
|
|
8501
|
+
}
|
|
8502
|
+
});
|
|
8320
8503
|
function getCandidateTypes(ast) {
|
|
8321
8504
|
switch (ast._tag) {
|
|
8322
8505
|
case "Null":
|
|
@@ -8380,74 +8563,162 @@ function collectSentinels(ast) {
|
|
|
8380
8563
|
});
|
|
8381
8564
|
case "Arrays":
|
|
8382
8565
|
return ast.elements.flatMap((e, i) => {
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8566
|
+
if (!isOptional(e)) {
|
|
8567
|
+
if (isLiteral(e)) {
|
|
8568
|
+
return [{
|
|
8569
|
+
key: i,
|
|
8570
|
+
literal: e.literal
|
|
8571
|
+
}];
|
|
8572
|
+
}
|
|
8573
|
+
if (isUniqueSymbol(e)) {
|
|
8574
|
+
return [{
|
|
8575
|
+
key: i,
|
|
8576
|
+
literal: e.symbol
|
|
8577
|
+
}];
|
|
8578
|
+
}
|
|
8579
|
+
}
|
|
8580
|
+
return [];
|
|
8387
8581
|
});
|
|
8582
|
+
case "Union": {
|
|
8583
|
+
if (ast.types.length === 0) return [];
|
|
8584
|
+
const members = ast.types.map((type) => collectSentinels(toCandidate(type)));
|
|
8585
|
+
return members[0].filter((s) => members.every((sentinels) => sentinels.some((o) => o.key === s.key && o.literal === s.literal)));
|
|
8586
|
+
}
|
|
8388
8587
|
case "Suspend":
|
|
8389
8588
|
return collectSentinels(ast.thunk());
|
|
8390
8589
|
}
|
|
8391
8590
|
}
|
|
8392
8591
|
var candidateIndexCache = /* @__PURE__ */ new WeakMap();
|
|
8592
|
+
var emptyCandidates = /* @__PURE__ */ Object.freeze([]);
|
|
8393
8593
|
function getIndex(types) {
|
|
8394
|
-
let
|
|
8395
|
-
if (
|
|
8396
|
-
|
|
8594
|
+
let index = candidateIndexCache.get(types);
|
|
8595
|
+
if (index) return index;
|
|
8596
|
+
let bySentinel;
|
|
8597
|
+
let sentinelCandidateCount = 0;
|
|
8598
|
+
let otherwise;
|
|
8599
|
+
let literalCandidates;
|
|
8600
|
+
let onlyLiterals = true;
|
|
8397
8601
|
for (let i = 0; i < types.length; i++) {
|
|
8398
8602
|
const a = types[i];
|
|
8399
|
-
const encoded =
|
|
8603
|
+
const encoded = toCandidate(a);
|
|
8400
8604
|
if (isNever2(encoded)) continue;
|
|
8401
|
-
|
|
8605
|
+
if (onlyLiterals) {
|
|
8606
|
+
if (isLiteral(encoded) || isUniqueSymbol(encoded)) {
|
|
8607
|
+
literalCandidates ??= /* @__PURE__ */ new Map();
|
|
8608
|
+
const literal = isLiteral(encoded) ? encoded.literal : encoded.symbol;
|
|
8609
|
+
let arr = literalCandidates.get(literal);
|
|
8610
|
+
if (!arr) literalCandidates.set(literal, arr = []);
|
|
8611
|
+
arr.push(a);
|
|
8612
|
+
} else {
|
|
8613
|
+
onlyLiterals = false;
|
|
8614
|
+
}
|
|
8615
|
+
}
|
|
8402
8616
|
const sentinels = collectSentinels(encoded);
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
idx.bySentinel ??= /* @__PURE__ */ new Map();
|
|
8617
|
+
if (sentinels.length) {
|
|
8618
|
+
bySentinel ??= /* @__PURE__ */ new Map();
|
|
8619
|
+
sentinelCandidateCount++;
|
|
8407
8620
|
for (const {
|
|
8408
8621
|
key,
|
|
8409
8622
|
literal
|
|
8410
8623
|
} of sentinels) {
|
|
8411
|
-
let
|
|
8412
|
-
if (!
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8624
|
+
let entry = bySentinel.get(key);
|
|
8625
|
+
if (!entry) bySentinel.set(key, entry = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Set()]);
|
|
8626
|
+
entry[1].add(i);
|
|
8627
|
+
let indexes = entry[0].get(literal);
|
|
8628
|
+
if (!indexes) entry[0].set(literal, indexes = /* @__PURE__ */ new Set());
|
|
8629
|
+
indexes.add(i);
|
|
8416
8630
|
}
|
|
8417
8631
|
} else {
|
|
8418
|
-
|
|
8419
|
-
|
|
8632
|
+
otherwise ??= {};
|
|
8633
|
+
const candidateTypes = getCandidateTypes(encoded);
|
|
8634
|
+
for (const t of candidateTypes) (otherwise[t] ??= []).push(i);
|
|
8635
|
+
}
|
|
8636
|
+
}
|
|
8637
|
+
if (onlyLiterals && literalCandidates) {
|
|
8638
|
+
literalCandidates.forEach(Object.freeze);
|
|
8639
|
+
index = (input) => literalCandidates.get(input) ?? emptyCandidates;
|
|
8640
|
+
} else if (bySentinel?.size === 1 && !otherwise) {
|
|
8641
|
+
const [key, [byValue]] = bySentinel.entries().next().value;
|
|
8642
|
+
const candidates = byValue;
|
|
8643
|
+
for (const [literal, indexes] of byValue) {
|
|
8644
|
+
candidates.set(literal, Object.freeze(Array.from(indexes, (index2) => types[index2])));
|
|
8645
|
+
}
|
|
8646
|
+
index = (input, isConstructor) => {
|
|
8647
|
+
if (isObjectKeyword(input)) {
|
|
8648
|
+
const value = Object.hasOwn(input, key) ? input[key] : void 0;
|
|
8649
|
+
if (value !== void 0) return candidates.get(value) ?? emptyCandidates;
|
|
8650
|
+
if (isConstructor) return types;
|
|
8651
|
+
}
|
|
8652
|
+
return emptyCandidates;
|
|
8653
|
+
};
|
|
8654
|
+
} else if (bySentinel) {
|
|
8655
|
+
let commonSentinel;
|
|
8656
|
+
for (const entry of bySentinel) {
|
|
8657
|
+
if ((!commonSentinel || entry[1][0].size > commonSentinel[1][0].size) && entry[1][1].size === sentinelCandidateCount) {
|
|
8658
|
+
commonSentinel = entry;
|
|
8659
|
+
}
|
|
8420
8660
|
}
|
|
8661
|
+
index = (input, isConstructor) => {
|
|
8662
|
+
const runtimeType = input === null ? "null" : Array.isArray(input) ? "array" : typeof input;
|
|
8663
|
+
const base = otherwise?.[runtimeType] ?? emptyCandidates;
|
|
8664
|
+
if (!isObjectKeyword(input)) return base.map((i) => types[i]);
|
|
8665
|
+
const selected = new Set(base);
|
|
8666
|
+
let directKey;
|
|
8667
|
+
if (commonSentinel) {
|
|
8668
|
+
const [key, [byValue]] = commonSentinel;
|
|
8669
|
+
const hasKey = Object.hasOwn(input, key);
|
|
8670
|
+
const value = hasKey ? input[key] : void 0;
|
|
8671
|
+
if (hasKey && (!isConstructor || value !== void 0)) {
|
|
8672
|
+
const match7 = byValue.get(value);
|
|
8673
|
+
if (!match7) return base.map((i) => types[i]);
|
|
8674
|
+
for (const i of match7) selected.add(i);
|
|
8675
|
+
directKey = key;
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
if (directKey === void 0) {
|
|
8679
|
+
for (const [key, [byValue, all5]] of bySentinel) {
|
|
8680
|
+
const hasKey = Object.hasOwn(input, key);
|
|
8681
|
+
const value = hasKey ? input[key] : void 0;
|
|
8682
|
+
if (hasKey && (!isConstructor || value !== void 0)) {
|
|
8683
|
+
const match7 = byValue.get(value);
|
|
8684
|
+
if (match7) {
|
|
8685
|
+
for (const i of match7) selected.add(i);
|
|
8686
|
+
}
|
|
8687
|
+
} else if (isConstructor) {
|
|
8688
|
+
for (const i of all5) selected.add(i);
|
|
8689
|
+
}
|
|
8690
|
+
}
|
|
8691
|
+
}
|
|
8692
|
+
for (const [key, [byValue, all5]] of bySentinel) {
|
|
8693
|
+
if (key === directKey) continue;
|
|
8694
|
+
const hasKey = Object.hasOwn(input, key);
|
|
8695
|
+
const value = hasKey ? input[key] : void 0;
|
|
8696
|
+
if (hasKey && (!isConstructor || value !== void 0)) {
|
|
8697
|
+
const match7 = byValue.get(value);
|
|
8698
|
+
for (const i of selected) {
|
|
8699
|
+
if (all5.has(i) && !match7?.has(i)) selected.delete(i);
|
|
8700
|
+
}
|
|
8701
|
+
}
|
|
8702
|
+
}
|
|
8703
|
+
return Array.from(selected).sort((a, b) => a - b).map((i) => types[i]);
|
|
8704
|
+
};
|
|
8705
|
+
} else {
|
|
8706
|
+
index = (input) => {
|
|
8707
|
+
const runtimeType = input === null ? "null" : Array.isArray(input) ? "array" : typeof input;
|
|
8708
|
+
return (otherwise?.[runtimeType] ?? emptyCandidates).map((i) => types[i]).filter(filterLiterals(input));
|
|
8709
|
+
};
|
|
8421
8710
|
}
|
|
8422
|
-
candidateIndexCache.set(types,
|
|
8423
|
-
return
|
|
8711
|
+
candidateIndexCache.set(types, index);
|
|
8712
|
+
return index;
|
|
8424
8713
|
}
|
|
8425
8714
|
function filterLiterals(input) {
|
|
8426
8715
|
return (ast) => {
|
|
8427
|
-
const encoded =
|
|
8716
|
+
const encoded = toCandidate(ast);
|
|
8428
8717
|
return encoded._tag === "Literal" ? encoded.literal === input : encoded._tag === "UniqueSymbol" ? encoded.symbol === input : true;
|
|
8429
8718
|
};
|
|
8430
8719
|
}
|
|
8431
|
-
function getCandidates(input, types) {
|
|
8432
|
-
|
|
8433
|
-
const runtimeType = input === null ? "null" : Array.isArray(input) ? "array" : typeof input;
|
|
8434
|
-
if (idx.bySentinel) {
|
|
8435
|
-
const base = idx.otherwise?.[runtimeType] ?? [];
|
|
8436
|
-
if (runtimeType === "object" || runtimeType === "array") {
|
|
8437
|
-
const selected = new Set(base);
|
|
8438
|
-
for (const [k, m] of idx.bySentinel) {
|
|
8439
|
-
if (Object.hasOwn(input, k)) {
|
|
8440
|
-
const match7 = m.get(input[k]);
|
|
8441
|
-
if (match7) {
|
|
8442
|
-
for (const candidate of match7) selected.add(candidate);
|
|
8443
|
-
}
|
|
8444
|
-
}
|
|
8445
|
-
}
|
|
8446
|
-
return Array.from(selected).sort((a, b) => a - b).map((i) => types[i]).filter(filterLiterals(input));
|
|
8447
|
-
}
|
|
8448
|
-
return base.map((i) => types[i]);
|
|
8449
|
-
}
|
|
8450
|
-
return (idx.byType?.[runtimeType] ?? []).map((i) => types[i]).filter(filterLiterals(input));
|
|
8720
|
+
function getCandidates(input, types, isConstructor = false) {
|
|
8721
|
+
return getIndex(types)(input, isConstructor);
|
|
8451
8722
|
}
|
|
8452
8723
|
var Union = class _Union extends Base2 {
|
|
8453
8724
|
_tag = "Union";
|
|
@@ -8461,21 +8732,24 @@ var Union = class _Union extends Base2 {
|
|
|
8461
8732
|
this.encodingChecks = encodingChecks;
|
|
8462
8733
|
}
|
|
8463
8734
|
/** @internal */
|
|
8464
|
-
getParser(
|
|
8735
|
+
getParser(compile, compileConstructorDefault2) {
|
|
8465
8736
|
const ast = this;
|
|
8466
|
-
return (
|
|
8467
|
-
if (
|
|
8468
|
-
return
|
|
8737
|
+
return (input, options) => {
|
|
8738
|
+
if (input === missing) {
|
|
8739
|
+
return missingExit;
|
|
8740
|
+
}
|
|
8741
|
+
const candidates = getCandidates(input, ast.types, compileConstructorDefault2 !== void 0);
|
|
8742
|
+
if (candidates.length === 1) {
|
|
8743
|
+
const result3 = compile(candidates[0])(input, options);
|
|
8744
|
+
if (result3._tag === "Success") return result3;
|
|
8745
|
+
return effectIsExit(result3) ? failSingleUnionCandidate(ast, result3.cause, input, options) : catchCause2(result3, (cause) => failSingleUnionCandidate(ast, cause, input, options));
|
|
8469
8746
|
}
|
|
8470
|
-
const input = oinput.value;
|
|
8471
|
-
const candidates = getCandidates(input, ast.types);
|
|
8472
8747
|
const state = {
|
|
8473
8748
|
ast,
|
|
8474
|
-
|
|
8475
|
-
oinput,
|
|
8749
|
+
compile,
|
|
8476
8750
|
input,
|
|
8477
8751
|
out: void 0,
|
|
8478
|
-
successes: [],
|
|
8752
|
+
successes: ast.mode === "oneOf" ? [] : void 0,
|
|
8479
8753
|
issues: void 0,
|
|
8480
8754
|
options
|
|
8481
8755
|
};
|
|
@@ -8485,24 +8759,27 @@ var Union = class _Union extends Base2 {
|
|
|
8485
8759
|
orderedStep: true
|
|
8486
8760
|
} : void 0);
|
|
8487
8761
|
if (!eff) {
|
|
8488
|
-
|
|
8762
|
+
if (state.out) return state.out;
|
|
8763
|
+
return fail5(new AnyOf(ast, state.issues ?? [], input, options));
|
|
8489
8764
|
}
|
|
8490
|
-
return
|
|
8491
|
-
|
|
8765
|
+
return flatMapEager2(eff, (_) => {
|
|
8766
|
+
if (state.out === sameExit) return succeed5(input);
|
|
8767
|
+
if (state.out) return state.out;
|
|
8768
|
+
return fail5(new AnyOf(ast, state.issues ?? [], input, options));
|
|
8492
8769
|
});
|
|
8493
8770
|
};
|
|
8494
8771
|
}
|
|
8495
|
-
_rebuild(
|
|
8496
|
-
const types = mapOrSame(this.types,
|
|
8772
|
+
_rebuild(recur, checks, encodingChecks) {
|
|
8773
|
+
const types = mapOrSame(this.types, recur);
|
|
8497
8774
|
return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new _Union(types, this.mode, this.annotations, checks, void 0, this.context, encodingChecks);
|
|
8498
8775
|
}
|
|
8499
8776
|
/** @internal */
|
|
8500
|
-
recur(
|
|
8501
|
-
return this._rebuild(
|
|
8777
|
+
recur(recur) {
|
|
8778
|
+
return this._rebuild(recur, this.checks, this.encodingChecks);
|
|
8502
8779
|
}
|
|
8503
8780
|
/** @internal */
|
|
8504
|
-
flip(
|
|
8505
|
-
return this._rebuild(
|
|
8781
|
+
flip(recur) {
|
|
8782
|
+
return this._rebuild(recur, this.encodingChecks, this.checks);
|
|
8506
8783
|
}
|
|
8507
8784
|
/** @internal */
|
|
8508
8785
|
matchPart(s, options) {
|
|
@@ -8540,10 +8817,15 @@ var Union = class _Union extends Base2 {
|
|
|
8540
8817
|
return Array.from(new Set(types)).join(" | ");
|
|
8541
8818
|
}
|
|
8542
8819
|
};
|
|
8820
|
+
function failSingleUnionCandidate(ast, cause, input, options) {
|
|
8821
|
+
const issue = getSchemaIssue(cause);
|
|
8822
|
+
if (!issue) return failCause2(cause);
|
|
8823
|
+
return fail4(new AnyOf(ast, [issue], input, options));
|
|
8824
|
+
}
|
|
8543
8825
|
var parseUnion = /* @__PURE__ */ iterateEager()({
|
|
8544
8826
|
onItem(s, ast) {
|
|
8545
|
-
const parser = s.
|
|
8546
|
-
return parser(s.
|
|
8827
|
+
const parser = s.compile(ast);
|
|
8828
|
+
return parser(s.input, s.options);
|
|
8547
8829
|
},
|
|
8548
8830
|
step(s, candidate, exit3) {
|
|
8549
8831
|
if (exit3._tag === "Failure") {
|
|
@@ -8554,13 +8836,14 @@ var parseUnion = /* @__PURE__ */ iterateEager()({
|
|
|
8554
8836
|
if (s.issues) s.issues.push(issue);
|
|
8555
8837
|
else s.issues = [issue];
|
|
8556
8838
|
} else {
|
|
8557
|
-
if (s.out && s.
|
|
8839
|
+
if (s.out && s.successes) {
|
|
8558
8840
|
s.successes.push(candidate);
|
|
8559
|
-
return fail4(new OneOf(s.ast, s.input, s.
|
|
8841
|
+
return fail4(new OneOf(s.ast, s.successes, s.input, s.options));
|
|
8560
8842
|
}
|
|
8561
|
-
s.out = exit3
|
|
8562
|
-
s.successes
|
|
8563
|
-
|
|
8843
|
+
s.out = exit3;
|
|
8844
|
+
if (s.successes) {
|
|
8845
|
+
s.successes.push(candidate);
|
|
8846
|
+
} else {
|
|
8564
8847
|
return void_4;
|
|
8565
8848
|
}
|
|
8566
8849
|
}
|
|
@@ -8620,7 +8903,7 @@ var FilterGroup = class _FilterGroup extends Class {
|
|
|
8620
8903
|
}
|
|
8621
8904
|
};
|
|
8622
8905
|
function makeFilter(filter7, annotations, aborted = false) {
|
|
8623
|
-
return new Filter2((input, ast, options) =>
|
|
8906
|
+
return new Filter2((input, ast, options) => normalizeFilterOutput(ast, filter7(input, ast, options), input, options), annotations, aborted);
|
|
8624
8907
|
}
|
|
8625
8908
|
function isFinite(annotations) {
|
|
8626
8909
|
return makeFilter((n) => globalThis.Number.isFinite(n), {
|
|
@@ -8645,9 +8928,14 @@ function isFinite(annotations) {
|
|
|
8645
8928
|
});
|
|
8646
8929
|
}
|
|
8647
8930
|
var finite = /* @__PURE__ */ appendChecks(number2, [/* @__PURE__ */ isFinite()]);
|
|
8931
|
+
var numberToJson = /* @__PURE__ */ new Link(/* @__PURE__ */ new Union([finite, nonFiniteLiterals], "anyOf"), /* @__PURE__ */ new Transformation(/* @__PURE__ */ Number3(), /* @__PURE__ */ transform((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
|
|
8648
8932
|
function isPattern(regExp, annotations) {
|
|
8649
8933
|
const source = regExp.source;
|
|
8650
|
-
|
|
8934
|
+
const pattern = new globalThis.RegExp(source, regExp.flags);
|
|
8935
|
+
return makeFilter((s) => {
|
|
8936
|
+
pattern.lastIndex = 0;
|
|
8937
|
+
return pattern.test(s);
|
|
8938
|
+
}, {
|
|
8651
8939
|
expected: `a string matching the RegExp ${source}`,
|
|
8652
8940
|
representation: {
|
|
8653
8941
|
id: "effect/schema/isPattern",
|
|
@@ -8672,6 +8960,10 @@ function modifyOwnPropertyDescriptors(ast, f) {
|
|
|
8672
8960
|
f(d);
|
|
8673
8961
|
return Object.create(Object.getPrototypeOf(ast), d);
|
|
8674
8962
|
}
|
|
8963
|
+
var contextOwners = /* @__PURE__ */ new WeakMap();
|
|
8964
|
+
function getContextOwner(ast) {
|
|
8965
|
+
return contextOwners.get(ast) ?? ast;
|
|
8966
|
+
}
|
|
8675
8967
|
function replaceEncoding(ast, encoding) {
|
|
8676
8968
|
if (ast.encoding === encoding) {
|
|
8677
8969
|
return ast;
|
|
@@ -8684,9 +8976,15 @@ function replaceContext(ast, context3) {
|
|
|
8684
8976
|
if (ast.context === context3) {
|
|
8685
8977
|
return ast;
|
|
8686
8978
|
}
|
|
8687
|
-
|
|
8979
|
+
const owner = getContextOwner(ast);
|
|
8980
|
+
if (owner.context === context3) {
|
|
8981
|
+
return owner;
|
|
8982
|
+
}
|
|
8983
|
+
const out = modifyOwnPropertyDescriptors(ast, (d) => {
|
|
8688
8984
|
d.context.value = context3;
|
|
8689
8985
|
});
|
|
8986
|
+
contextOwners.set(out, owner);
|
|
8987
|
+
return out;
|
|
8690
8988
|
}
|
|
8691
8989
|
function annotate(ast, annotations) {
|
|
8692
8990
|
if (ast.checks) {
|
|
@@ -8701,7 +8999,7 @@ function annotate(ast, annotations) {
|
|
|
8701
8999
|
});
|
|
8702
9000
|
}
|
|
8703
9001
|
function replaceChecks(ast, checks) {
|
|
8704
|
-
if (ast._tag === "Suspend" && checks
|
|
9002
|
+
if (ast._tag === "Suspend" && checks) {
|
|
8705
9003
|
throw new Error("Cannot add checks to Suspend");
|
|
8706
9004
|
}
|
|
8707
9005
|
if (ast.checks === checks) {
|
|
@@ -8724,11 +9022,15 @@ function updateLastLink(encoding, f) {
|
|
|
8724
9022
|
const out = mapLink(last2, f);
|
|
8725
9023
|
return out === last2 ? encoding : append(encoding.slice(0, encoding.length - 1), out);
|
|
8726
9024
|
}
|
|
8727
|
-
function
|
|
9025
|
+
function applyToSelfOrLastLinkEncodingIdempotent(f, options) {
|
|
8728
9026
|
function out(ast) {
|
|
8729
|
-
|
|
9027
|
+
if (ast.encoding) {
|
|
9028
|
+
const last2 = ast.encoding[ast.encoding.length - 1];
|
|
9029
|
+
return options?.stopAt?.(last2) ? ast : replaceEncoding(ast, updateLastLink(ast.encoding, out));
|
|
9030
|
+
}
|
|
9031
|
+
return f(ast);
|
|
8730
9032
|
}
|
|
8731
|
-
return
|
|
9033
|
+
return memoizeIdempotent(out);
|
|
8732
9034
|
}
|
|
8733
9035
|
function appendTransformation(from, transformation, to) {
|
|
8734
9036
|
const link2 = new Link(from, transformation);
|
|
@@ -8748,7 +9050,7 @@ function mapOrSame(as4, f) {
|
|
|
8748
9050
|
return changed ? out : as4;
|
|
8749
9051
|
}
|
|
8750
9052
|
function annotateKey(ast, annotations) {
|
|
8751
|
-
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, ast.context.
|
|
9053
|
+
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, ast.context.constructorDefault, {
|
|
8752
9054
|
...ast.context.annotations,
|
|
8753
9055
|
...annotations
|
|
8754
9056
|
}) : new Context(false, false, void 0, annotations);
|
|
@@ -8756,8 +9058,8 @@ function annotateKey(ast, annotations) {
|
|
|
8756
9058
|
}
|
|
8757
9059
|
function withConstructorDefault(ast, defaultValue) {
|
|
8758
9060
|
const transformation = new Transformation(withDefault(defaultValue), passthrough2());
|
|
8759
|
-
const
|
|
8760
|
-
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable,
|
|
9061
|
+
const constructorDefault = new Link(unknown, transformation);
|
|
9062
|
+
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) : new Context(false, false, constructorDefault);
|
|
8761
9063
|
return replaceContext(ast, context3);
|
|
8762
9064
|
}
|
|
8763
9065
|
function decodeTo(from, to, transformation) {
|
|
@@ -8777,7 +9079,7 @@ function extractStructuralChecks(checks) {
|
|
|
8777
9079
|
const out = checks.flatMap(extract);
|
|
8778
9080
|
return isArrayNonEmpty2(out) ? out : void 0;
|
|
8779
9081
|
}
|
|
8780
|
-
var toType = /* @__PURE__ */
|
|
9082
|
+
var toType = /* @__PURE__ */ memoizeIdempotent((ast) => {
|
|
8781
9083
|
if (ast.encoding) {
|
|
8782
9084
|
return toType(replaceEncoding(ast, void 0));
|
|
8783
9085
|
}
|
|
@@ -8793,7 +9095,7 @@ var toType = /* @__PURE__ */ memoize((ast) => {
|
|
|
8793
9095
|
}
|
|
8794
9096
|
return type;
|
|
8795
9097
|
});
|
|
8796
|
-
var toEncoded = /* @__PURE__ */
|
|
9098
|
+
var toEncoded = /* @__PURE__ */ memoizeIdempotent((ast) => {
|
|
8797
9099
|
return toType(flip4(ast));
|
|
8798
9100
|
});
|
|
8799
9101
|
function flipEncoding(ast, encoding) {
|
|
@@ -8829,29 +9131,21 @@ function containsUndefined(ast) {
|
|
|
8829
9131
|
}
|
|
8830
9132
|
}
|
|
8831
9133
|
function fromConst(ast, value) {
|
|
8832
|
-
const
|
|
8833
|
-
return (
|
|
8834
|
-
if (
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
return oinput.value === value ? succeed6 : fail5(new InvalidType(ast, oinput));
|
|
9134
|
+
const succeed7 = succeed6(value);
|
|
9135
|
+
return (input, options) => {
|
|
9136
|
+
if (input === missing) return missingExit;
|
|
9137
|
+
if (input === value) return succeed7;
|
|
9138
|
+
return fail5(new InvalidType(ast, input, options));
|
|
8838
9139
|
};
|
|
8839
9140
|
}
|
|
8840
9141
|
function fromRefinement(ast, refinement) {
|
|
8841
|
-
return (
|
|
8842
|
-
if (
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
return refinement(oinput.value) ? succeed4(oinput) : fail5(new InvalidType(ast, oinput));
|
|
9142
|
+
return (input, options) => {
|
|
9143
|
+
if (input === missing) return missingExit;
|
|
9144
|
+
if (refinement(input)) return sameExit;
|
|
9145
|
+
return fail5(new InvalidType(ast, input, options));
|
|
8846
9146
|
};
|
|
8847
9147
|
}
|
|
8848
|
-
|
|
8849
|
-
if (options?.disableChecks || ast.checks === void 0) return value;
|
|
8850
|
-
const issues = [];
|
|
8851
|
-
collectIssues(ast.checks, value, issues, ast, options);
|
|
8852
|
-
return issues.length === 0 ? value : void 0;
|
|
8853
|
-
}
|
|
8854
|
-
var parameterFromPropertyKey = /* @__PURE__ */ applyToSelfOrLastLinkEncoding((ast) => {
|
|
9148
|
+
var parameterFromPropertyKey = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
|
|
8855
9149
|
switch (ast._tag) {
|
|
8856
9150
|
default:
|
|
8857
9151
|
return ast;
|
|
@@ -8887,70 +9181,33 @@ function collectIssues(checks, value, issues, ast, options) {
|
|
|
8887
9181
|
for (let i = 0; i < checks.length; i++) {
|
|
8888
9182
|
const check = checks[i];
|
|
8889
9183
|
if (check._tag === "FilterGroup") {
|
|
8890
|
-
collectIssues(check.checks, value, issues, ast, options);
|
|
9184
|
+
issues = collectIssues(check.checks, value, issues, ast, options);
|
|
9185
|
+
if (issues && (options.errors !== "all" || issues[issues.length - 1].filter.aborted)) {
|
|
9186
|
+
return issues;
|
|
9187
|
+
}
|
|
8891
9188
|
} else {
|
|
8892
9189
|
const issue = check.run(value, ast, options);
|
|
8893
|
-
if (issue) {
|
|
8894
|
-
|
|
8895
|
-
if (
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
}
|
|
8900
|
-
}
|
|
8901
|
-
}
|
|
8902
|
-
var ClassTypeId = "~effect/Schema/Class";
|
|
8903
|
-
|
|
8904
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/SchemaError.js
|
|
8905
|
-
var TypeId15 = "~effect/SchemaError/SchemaError";
|
|
8906
|
-
var SchemaError = class extends (/* @__PURE__ */ TaggedError2("SchemaError")) {
|
|
8907
|
-
[TypeId15] = TypeId15;
|
|
8908
|
-
constructor(issue) {
|
|
8909
|
-
super({
|
|
8910
|
-
issue
|
|
8911
|
-
});
|
|
8912
|
-
}
|
|
8913
|
-
get message() {
|
|
8914
|
-
return this.issue.toString();
|
|
8915
|
-
}
|
|
8916
|
-
toString() {
|
|
8917
|
-
return `SchemaError(${this.message})`;
|
|
8918
|
-
}
|
|
8919
|
-
};
|
|
8920
|
-
function isSchemaError(u) {
|
|
8921
|
-
return hasProperty(u, TypeId15) && u[TypeId15] === TypeId15;
|
|
8922
|
-
}
|
|
8923
|
-
|
|
8924
|
-
// ../../node_modules/.pnpm/effect@4.0.0-beta.102/node_modules/effect/dist/SchemaParser.js
|
|
8925
|
-
var toConstructorAST = /* @__PURE__ */ memoize((ast) => {
|
|
8926
|
-
switch (ast._tag) {
|
|
8927
|
-
case "Declaration": {
|
|
8928
|
-
const getLink = ast.annotations?.[ClassTypeId];
|
|
8929
|
-
if (isFunction(getLink)) {
|
|
8930
|
-
const link2 = getLink(ast.typeParameters);
|
|
8931
|
-
return replaceEncoding(ast, [mapLink(link2, toConstructorAST)]);
|
|
8932
|
-
}
|
|
8933
|
-
return ast;
|
|
8934
|
-
}
|
|
8935
|
-
case "Objects":
|
|
8936
|
-
case "Arrays":
|
|
8937
|
-
return ast.recur((ast2) => {
|
|
8938
|
-
const defaultValue = ast2.context?.defaultValue;
|
|
8939
|
-
if (defaultValue) {
|
|
8940
|
-
const out = toConstructorAST(ast2);
|
|
8941
|
-
return replaceEncoding(out, out.encoding ? [...out.encoding, ...defaultValue] : defaultValue);
|
|
9190
|
+
if (issue) {
|
|
9191
|
+
const filter7 = new Filter(check, issue, value, options);
|
|
9192
|
+
if (issues) issues.push(filter7);
|
|
9193
|
+
else issues = [filter7];
|
|
9194
|
+
if (options.errors !== "all" || check.aborted) {
|
|
9195
|
+
return issues;
|
|
8942
9196
|
}
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
case "Suspend":
|
|
8946
|
-
return ast.recur(toConstructorAST);
|
|
8947
|
-
default:
|
|
8948
|
-
return ast;
|
|
9197
|
+
}
|
|
9198
|
+
}
|
|
8949
9199
|
}
|
|
8950
|
-
|
|
9200
|
+
return issues;
|
|
9201
|
+
}
|
|
9202
|
+
function getConstructorDescriptor(ast) {
|
|
9203
|
+
if (!isDeclaration(ast)) return void 0;
|
|
9204
|
+
const getDescriptor = ast.annotations?.[CONSTRUCTOR_ANNOTATION_KEY];
|
|
9205
|
+
return isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;
|
|
9206
|
+
}
|
|
9207
|
+
|
|
9208
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/SchemaParser.js
|
|
8951
9209
|
function makeEffect(schema) {
|
|
8952
|
-
const
|
|
8953
|
-
const parser = run(ast);
|
|
9210
|
+
const parser = runWithCompiler(constructorCompiler, toType(schema.ast));
|
|
8954
9211
|
return (input, options) => {
|
|
8955
9212
|
return parser(input, options?.disableChecks ? options?.parseOptions ? {
|
|
8956
9213
|
...options.parseOptions,
|
|
@@ -8971,7 +9228,7 @@ function makeOption(schema) {
|
|
|
8971
9228
|
return none2();
|
|
8972
9229
|
};
|
|
8973
9230
|
}
|
|
8974
|
-
function
|
|
9231
|
+
function make11(schema) {
|
|
8975
9232
|
const parser = makeEffect(schema);
|
|
8976
9233
|
return (input, options) => {
|
|
8977
9234
|
const exit3 = runSyncExit2(parser(input, options));
|
|
@@ -8979,7 +9236,7 @@ function make12(schema) {
|
|
|
8979
9236
|
return exit3.value;
|
|
8980
9237
|
}
|
|
8981
9238
|
const issue = getSchemaIssueOrThrow(exit3.cause, "Constructor adapter can only throw schema issues");
|
|
8982
|
-
throw new Error(
|
|
9239
|
+
throw new Error("Schema validation failed", {
|
|
8983
9240
|
cause: issue
|
|
8984
9241
|
});
|
|
8985
9242
|
};
|
|
@@ -8988,104 +9245,164 @@ function decodeUnknownEffect(schema, options) {
|
|
|
8988
9245
|
const parser = run(schema.ast);
|
|
8989
9246
|
return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
8990
9247
|
}
|
|
8991
|
-
var mergeParseOptions = (options, overrideOptions) => overrideOptions
|
|
9248
|
+
var mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
|
|
8992
9249
|
...options,
|
|
8993
9250
|
...overrideOptions
|
|
9251
|
+
} : options;
|
|
9252
|
+
var getValue = (value) => {
|
|
9253
|
+
if (value === missing) {
|
|
9254
|
+
return fail5(new InvalidValue());
|
|
9255
|
+
}
|
|
9256
|
+
return succeed5(value);
|
|
8994
9257
|
};
|
|
8995
9258
|
function run(ast) {
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9259
|
+
return runWithCompiler(normalCompiler, ast);
|
|
9260
|
+
}
|
|
9261
|
+
function runWithCompiler(compiler, ast) {
|
|
9262
|
+
let parser;
|
|
9263
|
+
return (input, options) => {
|
|
9264
|
+
const result3 = (parser ??= compiler(ast))(input, options ?? defaultParseOptions);
|
|
9265
|
+
if (result3 === sameExit) {
|
|
9266
|
+
return succeed5(input);
|
|
9000
9267
|
}
|
|
9001
|
-
|
|
9002
|
-
|
|
9268
|
+
if (!effectIsExit(result3)) {
|
|
9269
|
+
return flatMapEager2(result3, getValue);
|
|
9270
|
+
}
|
|
9271
|
+
return result3[args] === missing ? getValue(missing) : result3;
|
|
9272
|
+
};
|
|
9273
|
+
}
|
|
9274
|
+
var normalCompiler = /* @__PURE__ */ memoize((ast) => makeParser(ast, normalCompiler));
|
|
9275
|
+
var constructorCompiler = /* @__PURE__ */ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault));
|
|
9276
|
+
var compileDefaulted = /* @__PURE__ */ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault));
|
|
9277
|
+
function compileConstructorDefault(ast) {
|
|
9278
|
+
return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast);
|
|
9279
|
+
}
|
|
9280
|
+
function applyTransformation(result3, current, transformation, options) {
|
|
9281
|
+
let transformed;
|
|
9282
|
+
if (effectIsExit(result3) && result3._tag === "Success") {
|
|
9283
|
+
const optional2 = toOption(result3 === sameExit ? current : result3[args]);
|
|
9284
|
+
transformed = transformation._tag === "Transformation" ? transformation.decode.run(optional2, options) : transformation.decode(succeed6(optional2), options);
|
|
9285
|
+
} else if (transformation._tag === "Transformation") {
|
|
9286
|
+
transformed = flatMapEager2(result3, (value) => transformation.decode.run(toOption(value), options));
|
|
9287
|
+
} else {
|
|
9288
|
+
transformed = transformation.decode(mapEager2(result3, toOption), options);
|
|
9289
|
+
}
|
|
9290
|
+
return effectIsExit(transformed) && transformed._tag === "Success" ? fromOptionExit(transformed[args]) : flatMapEager2(transformed, fromOptionExit);
|
|
9003
9291
|
}
|
|
9004
|
-
function
|
|
9005
|
-
|
|
9292
|
+
function makeConstructorParser(descriptor, compile) {
|
|
9293
|
+
let sourceParser;
|
|
9294
|
+
return (input, options) => {
|
|
9295
|
+
if (input === missing) return missingExit;
|
|
9296
|
+
if (descriptor.isConstructed(input)) return sameExit;
|
|
9297
|
+
const result3 = (sourceParser ??= compile(descriptor.link.to))(input, options);
|
|
9298
|
+
return applyTransformation(result3, input, descriptor.link.transformation, options);
|
|
9299
|
+
};
|
|
9006
9300
|
}
|
|
9007
|
-
|
|
9008
|
-
|
|
9301
|
+
function makeParser(ast, compile, compileConstructorDefault2, constructorDefault) {
|
|
9302
|
+
const descriptor = compileConstructorDefault2 ? getConstructorDescriptor(ast) : void 0;
|
|
9303
|
+
const parser = descriptor ? makeConstructorParser(descriptor, compile) : ast.getParser(compile, compileConstructorDefault2);
|
|
9009
9304
|
const checks = ast.checks;
|
|
9010
|
-
const
|
|
9011
|
-
const links = encoding;
|
|
9012
|
-
const len = links?.length ?? 0;
|
|
9305
|
+
const links = constructorDefault ? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault] : ast.encoding;
|
|
9013
9306
|
const encodingChecks = ast.encodingChecks;
|
|
9014
9307
|
const astOptions = (checks ? checks[checks.length - 1].annotations : ast.annotations)?.["parseOptions"];
|
|
9015
|
-
if (!
|
|
9016
|
-
|
|
9017
|
-
parser
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
let srou;
|
|
9035
|
-
if (links) {
|
|
9036
|
-
for (let i = len - 1; i >= 0; i--) {
|
|
9037
|
-
const link2 = links[i];
|
|
9038
|
-
const to = link2.to;
|
|
9039
|
-
const parser2 = recur(to);
|
|
9040
|
-
srou = srou ? flatMapEager2(srou, (ou2) => parser2(ou2, options)) : parser2(ou, options);
|
|
9041
|
-
if (link2.transformation._tag === "Transformation") {
|
|
9042
|
-
const getter = link2.transformation.decode;
|
|
9043
|
-
srou = flatMapEager2(srou, (ou2) => getter.run(ou2, options));
|
|
9044
|
-
} else {
|
|
9045
|
-
srou = link2.transformation.decode(srou, options);
|
|
9308
|
+
if (!links && !checks && !encodingChecks) {
|
|
9309
|
+
if (!astOptions) {
|
|
9310
|
+
return parser;
|
|
9311
|
+
}
|
|
9312
|
+
return (input, options) => parser(input, mergeParseOptions(options, astOptions));
|
|
9313
|
+
}
|
|
9314
|
+
let encodingParsers;
|
|
9315
|
+
const parseLocal = (input, options) => {
|
|
9316
|
+
let result3 = parser(input, options);
|
|
9317
|
+
if (encodingChecks && !options.disableChecks) {
|
|
9318
|
+
if (effectIsExit(result3)) {
|
|
9319
|
+
if (result3._tag === "Success") {
|
|
9320
|
+
const output = result3 === sameExit ? input : result3[args];
|
|
9321
|
+
if (input !== missing && output !== missing) {
|
|
9322
|
+
const issues = collectIssues(encodingChecks, input, void 0, ast, options);
|
|
9323
|
+
if (issues) {
|
|
9324
|
+
result3 = fail5(new Composite(ast, issues, input, options));
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9046
9327
|
}
|
|
9047
|
-
}
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
if (encodingChecks && !options?.disableChecks) {
|
|
9054
|
-
sroa2 = flatMapEager2(sroa2, (oa) => {
|
|
9055
|
-
if (isSome2(localOu) && isSome2(oa)) {
|
|
9056
|
-
const issues = [];
|
|
9057
|
-
collectIssues(encodingChecks, localOu.value, issues, ast, options);
|
|
9058
|
-
if (isArrayNonEmpty2(issues)) {
|
|
9059
|
-
return fail5(new Composite(ast, localOu, issues));
|
|
9328
|
+
} else {
|
|
9329
|
+
result3 = flatMap5(result3, (value) => {
|
|
9330
|
+
if (input !== missing && value !== missing) {
|
|
9331
|
+
const issues = collectIssues(encodingChecks, input, void 0, ast, options);
|
|
9332
|
+
if (issues) {
|
|
9333
|
+
return fail5(new Composite(ast, issues, input, options));
|
|
9060
9334
|
}
|
|
9061
9335
|
}
|
|
9062
|
-
return
|
|
9336
|
+
return succeed5(value);
|
|
9063
9337
|
});
|
|
9064
9338
|
}
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9339
|
+
}
|
|
9340
|
+
if (checks && !options.disableChecks) {
|
|
9341
|
+
if (effectIsExit(result3)) {
|
|
9342
|
+
if (result3._tag === "Success") {
|
|
9343
|
+
const value = result3 === sameExit ? input : result3[args];
|
|
9344
|
+
if (value === missing) return result3;
|
|
9345
|
+
const issues = collectIssues(checks, value, void 0, ast, options);
|
|
9346
|
+
if (issues) {
|
|
9347
|
+
result3 = fail5(new Composite(ast, issues, value, options));
|
|
9348
|
+
}
|
|
9349
|
+
}
|
|
9350
|
+
} else {
|
|
9351
|
+
result3 = flatMap5(result3, (value) => {
|
|
9352
|
+
if (value !== missing) {
|
|
9353
|
+
const issues = collectIssues(checks, value, void 0, ast, options);
|
|
9354
|
+
if (issues) {
|
|
9355
|
+
return fail5(new Composite(ast, issues, value, options));
|
|
9073
9356
|
}
|
|
9074
9357
|
}
|
|
9075
|
-
return
|
|
9358
|
+
return succeed5(value);
|
|
9076
9359
|
});
|
|
9077
9360
|
}
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
const sroa = srou ? flatMapEager2(srou, parseLocal) : parseLocal(ou);
|
|
9081
|
-
return sroa;
|
|
9361
|
+
}
|
|
9362
|
+
return result3;
|
|
9082
9363
|
};
|
|
9083
|
-
|
|
9364
|
+
if (!links) {
|
|
9365
|
+
return astOptions ? (input, options) => parseLocal(input, mergeParseOptions(options, astOptions)) : parseLocal;
|
|
9366
|
+
}
|
|
9367
|
+
return (input, options) => {
|
|
9368
|
+
if (astOptions) {
|
|
9369
|
+
options = mergeParseOptions(options, astOptions);
|
|
9370
|
+
}
|
|
9371
|
+
const parsers = encodingParsers ??= links.map((link2) => compile(link2.to));
|
|
9372
|
+
let current = input;
|
|
9373
|
+
let result3 = parsers[parsers.length - 1](input, options);
|
|
9374
|
+
for (let i = links.length - 1; i >= 0; i--) {
|
|
9375
|
+
result3 = applyTransformation(result3, current, links[i].transformation, options);
|
|
9376
|
+
if (i !== 0) {
|
|
9377
|
+
const next = parsers[i - 1];
|
|
9378
|
+
if (result3._tag === "Success") {
|
|
9379
|
+
current = result3[args];
|
|
9380
|
+
result3 = next(current, options);
|
|
9381
|
+
} else {
|
|
9382
|
+
result3 = flatMapEager2(result3, (value) => {
|
|
9383
|
+
const nextResult = next(value, options);
|
|
9384
|
+
return nextResult === sameExit ? succeed6(value) : nextResult;
|
|
9385
|
+
});
|
|
9386
|
+
}
|
|
9387
|
+
}
|
|
9388
|
+
}
|
|
9389
|
+
if (result3._tag === "Success") {
|
|
9390
|
+
const value = result3[args];
|
|
9391
|
+
const local = parseLocal(value, options);
|
|
9392
|
+
return local === sameExit ? result3 : local;
|
|
9393
|
+
}
|
|
9394
|
+
result3 = catchCause2(result3, (cause) => failCauseSync2(() => map6(cause, (issue) => new Encoding(ast, issue, input, options))));
|
|
9395
|
+
return flatMapEager2(result3, (value) => {
|
|
9396
|
+
const local = parseLocal(value, options);
|
|
9397
|
+
return local === sameExit ? succeed6(value) : local;
|
|
9398
|
+
});
|
|
9399
|
+
};
|
|
9400
|
+
}
|
|
9084
9401
|
|
|
9085
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9086
|
-
var
|
|
9402
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/internal/schema/schema.js
|
|
9403
|
+
var TypeId15 = "~effect/Schema/Schema";
|
|
9087
9404
|
var SchemaProto = {
|
|
9088
|
-
[
|
|
9405
|
+
[TypeId15]: TypeId15,
|
|
9089
9406
|
pipe() {
|
|
9090
9407
|
return pipeArguments(this, arguments);
|
|
9091
9408
|
},
|
|
@@ -9099,35 +9416,49 @@ var SchemaProto = {
|
|
|
9099
9416
|
return this.rebuild(appendChecks(this.ast, checks));
|
|
9100
9417
|
}
|
|
9101
9418
|
};
|
|
9102
|
-
function
|
|
9419
|
+
function make12(ast, options) {
|
|
9103
9420
|
function Schema() {
|
|
9104
9421
|
}
|
|
9105
9422
|
const self = Object.defineProperties(Object.setPrototypeOf(Schema, SchemaProto), Object.getOwnPropertyDescriptors({
|
|
9106
9423
|
...options
|
|
9107
9424
|
}));
|
|
9108
9425
|
self.ast = ast;
|
|
9109
|
-
self.rebuild = (ast2) =>
|
|
9110
|
-
|
|
9111
|
-
self.
|
|
9112
|
-
self.make = make12(self);
|
|
9426
|
+
self.rebuild = (ast2) => make12(ast2, options);
|
|
9427
|
+
self.makeEffect = makeEffect(self);
|
|
9428
|
+
self.make = make11(self);
|
|
9113
9429
|
self.makeOption = makeOption(self);
|
|
9114
9430
|
return self;
|
|
9115
9431
|
}
|
|
9116
|
-
function fromIssueEffect(self) {
|
|
9117
|
-
return catchCause2(self, (cause) => failCauseSync2(() => map6(cause, (issue) => new SchemaError(issue))));
|
|
9118
|
-
}
|
|
9119
9432
|
|
|
9120
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9433
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Struct.js
|
|
9121
9434
|
var lambda = (f) => f;
|
|
9122
9435
|
|
|
9123
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9436
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Schema.js
|
|
9124
9437
|
function declareConstructor() {
|
|
9125
9438
|
return (typeParameters, run2, annotations) => {
|
|
9126
|
-
return
|
|
9439
|
+
return make13(new Declaration(typeParameters.map(getAST), (typeParameters2) => run2(typeParameters2.map((ast) => make13(ast))), annotations));
|
|
9127
9440
|
};
|
|
9128
9441
|
}
|
|
9129
9442
|
function declare(is2, annotations) {
|
|
9130
|
-
return declareConstructor()([], () => (input, ast) => is2(input) ?
|
|
9443
|
+
return declareConstructor()([], () => (input, ast, options) => is2(input) ? succeed5(input) : fail5(new InvalidType(ast, input, options)), annotations);
|
|
9444
|
+
}
|
|
9445
|
+
var SchemaErrorTypeId = "~effect/SchemaError/SchemaError";
|
|
9446
|
+
var SchemaError = class extends (/* @__PURE__ */ TaggedError2("SchemaError")) {
|
|
9447
|
+
[SchemaErrorTypeId] = SchemaErrorTypeId;
|
|
9448
|
+
constructor(issue) {
|
|
9449
|
+
super({
|
|
9450
|
+
issue
|
|
9451
|
+
});
|
|
9452
|
+
}
|
|
9453
|
+
get message() {
|
|
9454
|
+
return defaultFormatter(this.issue);
|
|
9455
|
+
}
|
|
9456
|
+
toString() {
|
|
9457
|
+
return `SchemaError(${this.message})`;
|
|
9458
|
+
}
|
|
9459
|
+
};
|
|
9460
|
+
function isSchemaError(u) {
|
|
9461
|
+
return hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;
|
|
9131
9462
|
}
|
|
9132
9463
|
function decodeUnknownEffect2(schema, options) {
|
|
9133
9464
|
const parser = decodeUnknownEffect(schema, options);
|
|
@@ -9135,6 +9466,9 @@ function decodeUnknownEffect2(schema, options) {
|
|
|
9135
9466
|
return fromIssueEffect(parser(input, options2));
|
|
9136
9467
|
};
|
|
9137
9468
|
}
|
|
9469
|
+
function fromIssueEffect(self) {
|
|
9470
|
+
return catchCause2(self, (cause) => failCauseSync2(() => map6(cause, (issue) => new SchemaError(issue))));
|
|
9471
|
+
}
|
|
9138
9472
|
function getSchemaErrorOrThrow(cause, message) {
|
|
9139
9473
|
let schemaError;
|
|
9140
9474
|
for (const reason of cause.reasons) {
|
|
@@ -9165,9 +9499,9 @@ function decodeUnknownSync(schema, options) {
|
|
|
9165
9499
|
return runSchemaErrorSync(parser(input, options2));
|
|
9166
9500
|
};
|
|
9167
9501
|
}
|
|
9168
|
-
var
|
|
9502
|
+
var make13 = make12;
|
|
9169
9503
|
function Literal2(literal) {
|
|
9170
|
-
const out =
|
|
9504
|
+
const out = make13(new Literal(literal), {
|
|
9171
9505
|
literal,
|
|
9172
9506
|
transform(to) {
|
|
9173
9507
|
return out.pipe(decodeTo2(Literal2(to), {
|
|
@@ -9178,10 +9512,10 @@ function Literal2(literal) {
|
|
|
9178
9512
|
});
|
|
9179
9513
|
return out;
|
|
9180
9514
|
}
|
|
9181
|
-
var String4 = /* @__PURE__ */
|
|
9182
|
-
var Number5 = /* @__PURE__ */
|
|
9515
|
+
var String4 = /* @__PURE__ */ make13(string2);
|
|
9516
|
+
var Number5 = /* @__PURE__ */ make13(number2);
|
|
9183
9517
|
function makeStruct(ast, fields) {
|
|
9184
|
-
return
|
|
9518
|
+
return make13(ast, {
|
|
9185
9519
|
fields,
|
|
9186
9520
|
mapFields(f, options) {
|
|
9187
9521
|
const fields2 = f(this.fields);
|
|
@@ -9193,7 +9527,7 @@ function Struct(fields) {
|
|
|
9193
9527
|
return makeStruct(struct(fields, void 0), fields);
|
|
9194
9528
|
}
|
|
9195
9529
|
function makeTuple(ast, elements) {
|
|
9196
|
-
return
|
|
9530
|
+
return make13(ast, {
|
|
9197
9531
|
elements,
|
|
9198
9532
|
mapElements(f, options) {
|
|
9199
9533
|
const elements2 = f(this.elements);
|
|
@@ -9204,11 +9538,11 @@ function makeTuple(ast, elements) {
|
|
|
9204
9538
|
function Tuple(elements) {
|
|
9205
9539
|
return makeTuple(tuple(elements), elements);
|
|
9206
9540
|
}
|
|
9207
|
-
var ArraySchema = /* @__PURE__ */ lambda((schema) =>
|
|
9541
|
+
var ArraySchema = /* @__PURE__ */ lambda((schema) => make13(new Arrays(false, [], [schema.ast]), {
|
|
9208
9542
|
value: schema
|
|
9209
9543
|
}));
|
|
9210
9544
|
function makeUnion(ast, members) {
|
|
9211
|
-
return
|
|
9545
|
+
return make13(ast, {
|
|
9212
9546
|
members,
|
|
9213
9547
|
mapMembers(f, options) {
|
|
9214
9548
|
const members2 = f(this.members);
|
|
@@ -9221,29 +9555,26 @@ function Union2(members, options) {
|
|
|
9221
9555
|
}
|
|
9222
9556
|
function decodeTo2(to, transformation) {
|
|
9223
9557
|
return (from) => {
|
|
9224
|
-
return
|
|
9558
|
+
return make13(decodeTo(from.ast, to.ast, transformation ? make10(transformation) : passthrough3()), {
|
|
9225
9559
|
from,
|
|
9226
9560
|
to
|
|
9227
9561
|
});
|
|
9228
9562
|
};
|
|
9229
9563
|
}
|
|
9230
9564
|
function withConstructorDefault2(defaultValue) {
|
|
9231
|
-
return (schema) =>
|
|
9565
|
+
return (schema) => make13(withConstructorDefault(schema.ast, defaultValue), {
|
|
9232
9566
|
schema
|
|
9233
9567
|
});
|
|
9234
9568
|
}
|
|
9235
|
-
function toIssueEffect(self) {
|
|
9236
|
-
return catchCause2(self, (cause) => failCauseSync2(() => map6(cause, (error) => error.issue)));
|
|
9237
|
-
}
|
|
9238
9569
|
function tag(literal) {
|
|
9239
|
-
return Literal2(literal).pipe(withConstructorDefault2(
|
|
9570
|
+
return Literal2(literal).pipe(withConstructorDefault2(succeed5(literal)));
|
|
9240
9571
|
}
|
|
9241
9572
|
function instanceOf(constructor, annotations) {
|
|
9242
9573
|
return declare((u) => u instanceof constructor, annotations);
|
|
9243
9574
|
}
|
|
9244
9575
|
function link() {
|
|
9245
9576
|
return (encodeTo, transformation) => {
|
|
9246
|
-
return new Link(encodeTo.ast,
|
|
9577
|
+
return new Link(encodeTo.ast, make10(transformation));
|
|
9247
9578
|
};
|
|
9248
9579
|
}
|
|
9249
9580
|
var makeFilter2 = makeFilter;
|
|
@@ -9311,13 +9642,13 @@ var RegExp2 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {
|
|
|
9311
9642
|
source: String4,
|
|
9312
9643
|
flags: String4
|
|
9313
9644
|
}), transformOrFail2({
|
|
9314
|
-
decode: (e) => try_3({
|
|
9645
|
+
decode: (e, options) => try_3({
|
|
9315
9646
|
try: () => new globalThis.RegExp(e.source, e.flags),
|
|
9316
|
-
catch: (
|
|
9317
|
-
|
|
9318
|
-
})
|
|
9647
|
+
catch: () => new InvalidValue({
|
|
9648
|
+
expected: "valid RegExp source and flags"
|
|
9649
|
+
}, e, options)
|
|
9319
9650
|
}),
|
|
9320
|
-
encode: (regExp) =>
|
|
9651
|
+
encode: (regExp) => succeed5({
|
|
9321
9652
|
source: regExp.source,
|
|
9322
9653
|
flags: regExp.flags
|
|
9323
9654
|
})
|
|
@@ -9372,19 +9703,19 @@ var File = /* @__PURE__ */ instanceOf(globalThis.File, {
|
|
|
9372
9703
|
name: String4,
|
|
9373
9704
|
lastModified: Int
|
|
9374
9705
|
}), transformOrFail2({
|
|
9375
|
-
decode: (e) => match3(decodeBase64(e.data), {
|
|
9376
|
-
onFailure: (
|
|
9377
|
-
|
|
9378
|
-
})),
|
|
9706
|
+
decode: (e, options) => match3(decodeBase64(e.data), {
|
|
9707
|
+
onFailure: () => fail5(new InvalidValue({
|
|
9708
|
+
expected: "a valid Base64 string"
|
|
9709
|
+
}, e.data, options)),
|
|
9379
9710
|
onSuccess: (bytes) => {
|
|
9380
9711
|
const buffer = new globalThis.Uint8Array(bytes);
|
|
9381
|
-
return
|
|
9712
|
+
return succeed5(new globalThis.File([buffer], e.name, {
|
|
9382
9713
|
type: e.type,
|
|
9383
9714
|
lastModified: e.lastModified
|
|
9384
9715
|
}));
|
|
9385
9716
|
}
|
|
9386
9717
|
}),
|
|
9387
|
-
encode: (file) => tryPromise2({
|
|
9718
|
+
encode: (file, options) => tryPromise2({
|
|
9388
9719
|
try: async () => {
|
|
9389
9720
|
const bytes = new globalThis.Uint8Array(await file.arrayBuffer());
|
|
9390
9721
|
return {
|
|
@@ -9394,9 +9725,9 @@ var File = /* @__PURE__ */ instanceOf(globalThis.File, {
|
|
|
9394
9725
|
lastModified: file.lastModified
|
|
9395
9726
|
};
|
|
9396
9727
|
},
|
|
9397
|
-
catch: (
|
|
9398
|
-
|
|
9399
|
-
})
|
|
9728
|
+
catch: () => new InvalidValue({
|
|
9729
|
+
expected: "a readable File"
|
|
9730
|
+
}, file, options)
|
|
9400
9731
|
})
|
|
9401
9732
|
}))
|
|
9402
9733
|
});
|
|
@@ -9422,10 +9753,10 @@ var FormData2 = /* @__PURE__ */ instanceOf(globalThis.FormData, {
|
|
|
9422
9753
|
for (const [key, entry] of e) {
|
|
9423
9754
|
out.append(key, entry.value);
|
|
9424
9755
|
}
|
|
9425
|
-
return
|
|
9756
|
+
return succeed5(out);
|
|
9426
9757
|
},
|
|
9427
9758
|
encode: (formData) => {
|
|
9428
|
-
return
|
|
9759
|
+
return succeed5(globalThis.Array.from(formData.entries()).map(([key, value]) => {
|
|
9429
9760
|
if (typeof value === "string") {
|
|
9430
9761
|
return [key, {
|
|
9431
9762
|
_tag: "String",
|
|
@@ -9477,7 +9808,7 @@ var Uint8Array2 = /* @__PURE__ */ instanceOf(globalThis.Uint8Array, {
|
|
|
9477
9808
|
toArbitrary: () => (fc) => fc.uint8Array()
|
|
9478
9809
|
});
|
|
9479
9810
|
|
|
9480
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9811
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Ref.js
|
|
9481
9812
|
var Ref_exports = {};
|
|
9482
9813
|
__export(Ref_exports, {
|
|
9483
9814
|
get: () => get3,
|
|
@@ -9485,7 +9816,7 @@ __export(Ref_exports, {
|
|
|
9485
9816
|
getAndUpdate: () => getAndUpdate,
|
|
9486
9817
|
getAndUpdateSome: () => getAndUpdateSome,
|
|
9487
9818
|
getUnsafe: () => getUnsafe3,
|
|
9488
|
-
make: () =>
|
|
9819
|
+
make: () => make15,
|
|
9489
9820
|
makeUnsafe: () => makeUnsafe4,
|
|
9490
9821
|
modify: () => modify2,
|
|
9491
9822
|
modifySome: () => modifySome,
|
|
@@ -9497,10 +9828,10 @@ __export(Ref_exports, {
|
|
|
9497
9828
|
updateSomeAndGet: () => updateSomeAndGet
|
|
9498
9829
|
});
|
|
9499
9830
|
|
|
9500
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9501
|
-
var
|
|
9831
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/MutableRef.js
|
|
9832
|
+
var TypeId16 = "~effect/MutableRef";
|
|
9502
9833
|
var MutableRefProto = {
|
|
9503
|
-
[
|
|
9834
|
+
[TypeId16]: TypeId16,
|
|
9504
9835
|
...PipeInspectableProto,
|
|
9505
9836
|
toJSON() {
|
|
9506
9837
|
return {
|
|
@@ -9509,7 +9840,7 @@ var MutableRefProto = {
|
|
|
9509
9840
|
};
|
|
9510
9841
|
}
|
|
9511
9842
|
};
|
|
9512
|
-
var
|
|
9843
|
+
var make14 = (value) => {
|
|
9513
9844
|
const ref = Object.create(MutableRefProto);
|
|
9514
9845
|
ref.current = value;
|
|
9515
9846
|
return ref;
|
|
@@ -9519,10 +9850,10 @@ var set = /* @__PURE__ */ dual(2, (self, value) => {
|
|
|
9519
9850
|
return self;
|
|
9520
9851
|
});
|
|
9521
9852
|
|
|
9522
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9523
|
-
var
|
|
9853
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.111/node_modules/effect/dist/Ref.js
|
|
9854
|
+
var TypeId17 = "~effect/Ref";
|
|
9524
9855
|
var RefProto = {
|
|
9525
|
-
[
|
|
9856
|
+
[TypeId17]: {
|
|
9526
9857
|
_A: identity
|
|
9527
9858
|
},
|
|
9528
9859
|
...PipeInspectableProto,
|
|
@@ -9535,10 +9866,10 @@ var RefProto = {
|
|
|
9535
9866
|
};
|
|
9536
9867
|
var makeUnsafe4 = (value) => {
|
|
9537
9868
|
const self = Object.create(RefProto);
|
|
9538
|
-
self.ref =
|
|
9869
|
+
self.ref = make14(value);
|
|
9539
9870
|
return self;
|
|
9540
9871
|
};
|
|
9541
|
-
var
|
|
9872
|
+
var make15 = (value) => sync2(() => makeUnsafe4(value));
|
|
9542
9873
|
var get3 = (self) => sync2(() => self.ref.current);
|
|
9543
9874
|
var set2 = /* @__PURE__ */ dual(2, (self, value) => sync2(() => set(self.ref, value)));
|
|
9544
9875
|
var getAndSet = /* @__PURE__ */ dual(2, (self, value) => sync2(() => {
|
|
@@ -9588,7 +9919,7 @@ var updateSomeAndGet = /* @__PURE__ */ dual(2, (self, pf) => sync2(() => {
|
|
|
9588
9919
|
}));
|
|
9589
9920
|
var getUnsafe3 = (self) => self.ref.current;
|
|
9590
9921
|
|
|
9591
|
-
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-
|
|
9922
|
+
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.111/node_modules/effect-oxlint/dist/index.js
|
|
9592
9923
|
var AST_exports = /* @__PURE__ */ __exportAll({
|
|
9593
9924
|
calleeIdentifier: () => calleeIdentifier,
|
|
9594
9925
|
calleeName: () => calleeName,
|
|
@@ -9660,13 +9991,13 @@ var Diagnostic_exports = /* @__PURE__ */ __exportAll({
|
|
|
9660
9991
|
fromId: () => fromId,
|
|
9661
9992
|
insertAfter: () => insertAfter,
|
|
9662
9993
|
insertBefore: () => insertBefore,
|
|
9663
|
-
make: () =>
|
|
9994
|
+
make: () => make16,
|
|
9664
9995
|
removeFix: () => removeFix,
|
|
9665
9996
|
replaceText: () => replaceText,
|
|
9666
9997
|
withFix: () => withFix,
|
|
9667
9998
|
withSuggestions: () => withSuggestions
|
|
9668
9999
|
});
|
|
9669
|
-
var
|
|
10000
|
+
var make16 = (opts) => ({
|
|
9670
10001
|
node: opts.node,
|
|
9671
10002
|
message: opts.message,
|
|
9672
10003
|
data: opts.data
|
|
@@ -9764,7 +10095,7 @@ var tracked = (nodeType, predicate, ref) => ({
|
|
|
9764
10095
|
});
|
|
9765
10096
|
var filter6 = dual(2, (predicate, visitor) => service2(RuleContext).pipe(map7((ctx) => predicate(ctx.filename) ? visitor : {})));
|
|
9766
10097
|
var accumulate = (nodeType, extract, analyze) => gen4(function* () {
|
|
9767
|
-
const ref = yield*
|
|
10098
|
+
const ref = yield* make15([]);
|
|
9768
10099
|
return merge3(on(nodeType, (node) => pipe(extract(node), match({
|
|
9769
10100
|
onNone: () => void_5,
|
|
9770
10101
|
onSome: (value) => update2(ref, (items) => [...items, value])
|
|
@@ -9818,7 +10149,7 @@ var banMember = (obj, prop, opts) => define({
|
|
|
9818
10149
|
const ctx = yield* RuleContext;
|
|
9819
10150
|
return { MemberExpression: (node) => pipe(narrow(node, "MemberExpression"), flatMap(matchMember(obj, prop)), match({
|
|
9820
10151
|
onNone: () => void_5,
|
|
9821
|
-
onSome: (matched) => ctx.report(
|
|
10152
|
+
onSome: (matched) => ctx.report(make16({
|
|
9822
10153
|
node: matched,
|
|
9823
10154
|
message: opts.message
|
|
9824
10155
|
}))
|
|
@@ -9835,7 +10166,7 @@ var banImport = (source, opts) => define({
|
|
|
9835
10166
|
const ctx = yield* RuleContext;
|
|
9836
10167
|
return { ImportDeclaration: (node) => pipe(narrow(node, "ImportDeclaration"), flatMap(matchImport(source)), match({
|
|
9837
10168
|
onNone: () => void_5,
|
|
9838
|
-
onSome: (matched) => ctx.report(
|
|
10169
|
+
onSome: (matched) => ctx.report(make16({
|
|
9839
10170
|
node: matched,
|
|
9840
10171
|
message: opts.message
|
|
9841
10172
|
}))
|
|
@@ -9854,7 +10185,7 @@ var banCallOf = (name, opts) => {
|
|
|
9854
10185
|
const ctx = yield* RuleContext;
|
|
9855
10186
|
return { CallExpression: (node) => pipe(narrow(node, "CallExpression"), flatMap(calleeName), filter((n) => contains2(names, n)), match({
|
|
9856
10187
|
onNone: () => void_5,
|
|
9857
|
-
onSome: () => ctx.report(
|
|
10188
|
+
onSome: () => ctx.report(make16({
|
|
9858
10189
|
node,
|
|
9859
10190
|
message: opts.message
|
|
9860
10191
|
}))
|
|
@@ -9872,7 +10203,7 @@ var banCallOfMember = (obj, prop, opts) => define({
|
|
|
9872
10203
|
const ctx = yield* RuleContext;
|
|
9873
10204
|
return { CallExpression: (node) => pipe(narrow(node, "CallExpression"), flatMap(matchCallOf(obj, prop)), match({
|
|
9874
10205
|
onNone: () => void_5,
|
|
9875
|
-
onSome: (matched) => ctx.report(
|
|
10206
|
+
onSome: (matched) => ctx.report(make16({
|
|
9876
10207
|
node: matched,
|
|
9877
10208
|
message: opts.message
|
|
9878
10209
|
}))
|
|
@@ -9891,7 +10222,7 @@ var banNewExpr = (name, opts) => {
|
|
|
9891
10222
|
const ctx = yield* RuleContext;
|
|
9892
10223
|
return { NewExpression: (node) => pipe(narrow(node, "NewExpression"), flatMap(calleeIdentifier), filter((n) => contains2(names, n)), match({
|
|
9893
10224
|
onNone: () => void_5,
|
|
9894
|
-
onSome: () => ctx.report(
|
|
10225
|
+
onSome: () => ctx.report(make16({
|
|
9895
10226
|
node,
|
|
9896
10227
|
message: opts.message
|
|
9897
10228
|
}))
|
|
@@ -9907,7 +10238,7 @@ var banStatement = (nodeType, opts) => define({
|
|
|
9907
10238
|
}),
|
|
9908
10239
|
create: function* () {
|
|
9909
10240
|
const ctx = yield* RuleContext;
|
|
9910
|
-
return { [nodeType]: (node) => ctx.report(
|
|
10241
|
+
return { [nodeType]: (node) => ctx.report(make16({
|
|
9911
10242
|
node,
|
|
9912
10243
|
message: opts.message
|
|
9913
10244
|
})) };
|
|
@@ -9921,7 +10252,7 @@ var banMultiple = (spec, opts) => define({
|
|
|
9921
10252
|
}),
|
|
9922
10253
|
create: function* () {
|
|
9923
10254
|
const ctx = yield* RuleContext;
|
|
9924
|
-
const report = (node) => ctx.report(
|
|
10255
|
+
const report = (node) => ctx.report(make16({
|
|
9925
10256
|
node,
|
|
9926
10257
|
message: opts.message
|
|
9927
10258
|
}));
|
|
@@ -10115,16 +10446,59 @@ var commandDefinePascalConst = Rule_exports.define({
|
|
|
10115
10446
|
});
|
|
10116
10447
|
|
|
10117
10448
|
// src/message.ts
|
|
10118
|
-
var
|
|
10119
|
-
var
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
return false;
|
|
10449
|
+
var foldkitMessageModule = "foldkit/message";
|
|
10450
|
+
var staticPropertyName = (property) => {
|
|
10451
|
+
if (property.type !== "Property") {
|
|
10452
|
+
return Option_exports.none();
|
|
10123
10453
|
}
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10454
|
+
if (!property.computed && isIdentifier(property.key)) {
|
|
10455
|
+
return Option_exports.some({ name: property.key.name, node: property.key });
|
|
10456
|
+
}
|
|
10457
|
+
if (isStringLiteral(property.key)) {
|
|
10458
|
+
return Option_exports.some({ name: property.key.value, node: property.key });
|
|
10459
|
+
}
|
|
10460
|
+
return Option_exports.none();
|
|
10461
|
+
};
|
|
10462
|
+
var recordFoldkitMessageUnionBindings = (bindings, node) => {
|
|
10463
|
+
if (node.type !== "Program") {
|
|
10464
|
+
return;
|
|
10465
|
+
}
|
|
10466
|
+
for (const statement of node.body) {
|
|
10467
|
+
if (statement.type !== "ImportDeclaration" || statement.importKind === "type" || statement.source.value !== foldkitMessageModule) {
|
|
10468
|
+
continue;
|
|
10469
|
+
}
|
|
10470
|
+
for (const specifier of statement.specifiers) {
|
|
10471
|
+
if (specifier.type === "ImportSpecifier" && specifier.importKind !== "type" && (isIdentifier(specifier.imported, "defineMessageUnion") || isStringLiteral(specifier.imported) && specifier.imported.value === "defineMessageUnion")) {
|
|
10472
|
+
bindings.add(specifier.local.name);
|
|
10473
|
+
}
|
|
10474
|
+
}
|
|
10475
|
+
}
|
|
10476
|
+
};
|
|
10477
|
+
var messageCases = (node, bindings) => {
|
|
10478
|
+
if (!isIdentifier(node.callee) || !bindings.has(node.callee.name)) {
|
|
10479
|
+
return [];
|
|
10480
|
+
}
|
|
10481
|
+
const [casesByTag] = node.arguments;
|
|
10482
|
+
if (!isObjectExpression(casesByTag)) {
|
|
10483
|
+
return [];
|
|
10484
|
+
}
|
|
10485
|
+
return casesByTag.properties.flatMap((property) => {
|
|
10486
|
+
const maybeName = staticPropertyName(property);
|
|
10487
|
+
if (property.type !== "Property" || Option_exports.isNone(maybeName) || !isObjectExpression(property.value)) {
|
|
10488
|
+
return [];
|
|
10489
|
+
}
|
|
10490
|
+
return [
|
|
10491
|
+
{
|
|
10492
|
+
name: maybeName.value.name,
|
|
10493
|
+
nameNode: maybeName.value.node,
|
|
10494
|
+
fields: property.value
|
|
10495
|
+
}
|
|
10496
|
+
];
|
|
10497
|
+
});
|
|
10127
10498
|
};
|
|
10499
|
+
var hasMessagePayloadProperty = (fields) => fields.properties.some(
|
|
10500
|
+
(property) => property.type === "Property" && (isIdentifier(property.key, "message") || isStringLiteral(property.key) && property.key.value === "message")
|
|
10501
|
+
);
|
|
10128
10502
|
|
|
10129
10503
|
// src/rules/got-prefix-requires-submodel-payload.ts
|
|
10130
10504
|
var gotPrefixRequiresSubmodelPayload = Rule_exports.define({
|
|
@@ -10135,18 +10509,23 @@ var gotPrefixRequiresSubmodelPayload = Rule_exports.define({
|
|
|
10135
10509
|
}),
|
|
10136
10510
|
create: function* () {
|
|
10137
10511
|
const ctx = yield* RuleContext;
|
|
10512
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
10138
10513
|
return {
|
|
10514
|
+
Program: (node) => {
|
|
10515
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
10516
|
+
return Effect_exports.void;
|
|
10517
|
+
},
|
|
10139
10518
|
CallExpression: (node) => {
|
|
10140
|
-
if (!isCallExpression(node)
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
}
|
|
10519
|
+
if (!isCallExpression(node)) return Effect_exports.void;
|
|
10520
|
+
return Effect_exports.forEach(
|
|
10521
|
+
messageCases(node, messageUnionBindings),
|
|
10522
|
+
(messageCase) => /^Got[A-Z]/.test(messageCase.name) && !hasMessagePayloadProperty(messageCase.fields) ? ctx.report(
|
|
10523
|
+
Diagnostic_exports.make({
|
|
10524
|
+
node: messageCase.nameNode,
|
|
10525
|
+
message: "Got* is reserved for Submodel wrappers. Add a { message: Child.Message } payload or choose a Message name that does not start with Got."
|
|
10526
|
+
})
|
|
10527
|
+
) : Effect_exports.void,
|
|
10528
|
+
{ discard: true }
|
|
10150
10529
|
);
|
|
10151
10530
|
}
|
|
10152
10531
|
};
|
|
@@ -10162,20 +10541,23 @@ var gotSubmodelMessageName = Rule_exports.define({
|
|
|
10162
10541
|
}),
|
|
10163
10542
|
create: function* () {
|
|
10164
10543
|
const ctx = yield* RuleContext;
|
|
10544
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
10165
10545
|
return {
|
|
10546
|
+
Program: (node) => {
|
|
10547
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
10548
|
+
return Effect_exports.void;
|
|
10549
|
+
},
|
|
10166
10550
|
CallExpression: (node) => {
|
|
10167
|
-
if (!isCallExpression(node)
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
message: "Submodel wrapper Messages should be named Got*Message so Foldkit DevTools can filter them."
|
|
10178
|
-
})
|
|
10551
|
+
if (!isCallExpression(node)) return Effect_exports.void;
|
|
10552
|
+
return Effect_exports.forEach(
|
|
10553
|
+
messageCases(node, messageUnionBindings),
|
|
10554
|
+
(messageCase) => hasMessagePayloadProperty(messageCase.fields) && !/^Got[A-Z].*Message$/.test(messageCase.name) ? ctx.report(
|
|
10555
|
+
Diagnostic_exports.make({
|
|
10556
|
+
node: messageCase.nameNode,
|
|
10557
|
+
message: "Submodel wrapper Messages should be named Got*Message so Foldkit DevTools can filter them."
|
|
10558
|
+
})
|
|
10559
|
+
) : Effect_exports.void,
|
|
10560
|
+
{ discard: true }
|
|
10179
10561
|
);
|
|
10180
10562
|
}
|
|
10181
10563
|
};
|
|
@@ -10187,10 +10569,10 @@ var gotWrapperTagPattern = /^Got[A-Z]/;
|
|
|
10187
10569
|
var routingKeySuffixPattern = /Id$/;
|
|
10188
10570
|
var isRoutingKey = (keyName) => keyName === "message" || keyName === "id" || routingKeySuffixPattern.test(keyName);
|
|
10189
10571
|
var staticPropertyKey = (property) => {
|
|
10190
|
-
if (property.type !== "Property"
|
|
10572
|
+
if (property.type !== "Property") {
|
|
10191
10573
|
return Option_exports.none();
|
|
10192
10574
|
}
|
|
10193
|
-
if (isIdentifier(property.key)) {
|
|
10575
|
+
if (!property.computed && isIdentifier(property.key)) {
|
|
10194
10576
|
return Option_exports.some({ keyNode: property.key, keyName: property.key.name });
|
|
10195
10577
|
}
|
|
10196
10578
|
if (isStringLiteral(property.key)) {
|
|
@@ -10207,30 +10589,37 @@ var gotWrapperCarriesOnlyRouting = Rule_exports.define({
|
|
|
10207
10589
|
}),
|
|
10208
10590
|
create: function* () {
|
|
10209
10591
|
const ctx = yield* RuleContext;
|
|
10592
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
10210
10593
|
return {
|
|
10594
|
+
Program: (node) => {
|
|
10595
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
10596
|
+
return Effect_exports.void;
|
|
10597
|
+
},
|
|
10211
10598
|
CallExpression: (node) => {
|
|
10212
|
-
if (!isCallExpression(node)
|
|
10213
|
-
return Effect_exports.void;
|
|
10214
|
-
}
|
|
10215
|
-
const [tagArgument, fieldsArgument] = node.arguments;
|
|
10216
|
-
if (!isStringLiteral(tagArgument) || !gotWrapperTagPattern.test(tagArgument.value) || !isObjectExpression(fieldsArgument)) {
|
|
10599
|
+
if (!isCallExpression(node)) {
|
|
10217
10600
|
return Effect_exports.void;
|
|
10218
10601
|
}
|
|
10219
|
-
const wrapperTag = tagArgument.value;
|
|
10220
10602
|
return Effect_exports.forEach(
|
|
10221
|
-
|
|
10222
|
-
(
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10603
|
+
messageCases(node, messageUnionBindings),
|
|
10604
|
+
(messageCase) => gotWrapperTagPattern.test(messageCase.name) ? Effect_exports.forEach(
|
|
10605
|
+
messageCase.fields.properties,
|
|
10606
|
+
(property) => pipe(
|
|
10607
|
+
staticPropertyKey(property),
|
|
10608
|
+
Option_exports.match({
|
|
10609
|
+
onNone: () => Effect_exports.void,
|
|
10610
|
+
onSome: ({ keyNode, keyName }) => isRoutingKey(keyName) ? Effect_exports.void : ctx.report(
|
|
10611
|
+
Diagnostic_exports.make({
|
|
10612
|
+
node: keyNode,
|
|
10613
|
+
message: extraFieldMessage(
|
|
10614
|
+
messageCase.name,
|
|
10615
|
+
keyName
|
|
10616
|
+
)
|
|
10617
|
+
})
|
|
10618
|
+
)
|
|
10619
|
+
})
|
|
10620
|
+
),
|
|
10621
|
+
{ discard: true }
|
|
10622
|
+
) : Effect_exports.void,
|
|
10234
10623
|
{ discard: true }
|
|
10235
10624
|
);
|
|
10236
10625
|
}
|
|
@@ -10501,12 +10890,12 @@ var unstableViewOffenses = (node, context3) => {
|
|
|
10501
10890
|
if (Option_exports.isNone(maybeSlot)) {
|
|
10502
10891
|
return [];
|
|
10503
10892
|
}
|
|
10504
|
-
const slot = maybeSlot
|
|
10893
|
+
const { value: slot } = maybeSlot;
|
|
10505
10894
|
const maybeViewArgument = Array_exports.get(node.arguments, slot.viewArgumentIndex);
|
|
10506
10895
|
if (Option_exports.isNone(maybeViewArgument)) {
|
|
10507
10896
|
return [];
|
|
10508
10897
|
}
|
|
10509
|
-
const viewArgument = maybeViewArgument
|
|
10898
|
+
const { value: viewArgument } = maybeViewArgument;
|
|
10510
10899
|
if (viewArgument.type === "SpreadElement") {
|
|
10511
10900
|
return [];
|
|
10512
10901
|
}
|
|
@@ -10600,37 +10989,6 @@ var lazyViewStableReferences = Rule_exports.define({
|
|
|
10600
10989
|
}
|
|
10601
10990
|
});
|
|
10602
10991
|
|
|
10603
|
-
// src/rules/message-binding-matches-tag.ts
|
|
10604
|
-
var messageBindingMatchesTag = Rule_exports.define({
|
|
10605
|
-
name: "message-binding-matches-tag",
|
|
10606
|
-
meta: Rule_exports.meta({
|
|
10607
|
-
type: "suggestion",
|
|
10608
|
-
description: "Keep a Message binding name in sync with the tag passed to m()."
|
|
10609
|
-
}),
|
|
10610
|
-
create: function* () {
|
|
10611
|
-
const ctx = yield* RuleContext;
|
|
10612
|
-
return {
|
|
10613
|
-
VariableDeclarator: (node) => {
|
|
10614
|
-
if (!isVariableDeclarator(node)) return Effect_exports.void;
|
|
10615
|
-
const init2 = node.init;
|
|
10616
|
-
if (init2 === null || init2 === void 0 || !isCallExpression(init2) || !isMCall(init2)) {
|
|
10617
|
-
return Effect_exports.void;
|
|
10618
|
-
}
|
|
10619
|
-
const messageName = firstStringArgument(init2);
|
|
10620
|
-
if (messageName === void 0 || !isIdentifier(node.id) || node.id.name === messageName.value) {
|
|
10621
|
-
return Effect_exports.void;
|
|
10622
|
-
}
|
|
10623
|
-
return ctx.report(
|
|
10624
|
-
Diagnostic_exports.make({
|
|
10625
|
-
node: node.id,
|
|
10626
|
-
message: `Message binding "${node.id.name}" does not match its m() tag "${messageName.value}".`
|
|
10627
|
-
})
|
|
10628
|
-
);
|
|
10629
|
-
}
|
|
10630
|
-
};
|
|
10631
|
-
}
|
|
10632
|
-
});
|
|
10633
|
-
|
|
10634
10992
|
// src/rules/mount-factory-must-use-element.ts
|
|
10635
10993
|
var MOUNT_DEFINITION_METHODS = ["define", "defineStream"];
|
|
10636
10994
|
var NO_ELEMENT_PARAMETER_MESSAGE = "This Mount factory never receives the element: it declares no usable element parameter. A Mount exists for element-caused, element-targeted work. If the element is irrelevant, use a Command, Subscription, or ManagedResource instead.";
|
|
@@ -10866,7 +11224,7 @@ var noArrayIndexViewKeys = Rule_exports.define({
|
|
|
10866
11224
|
if (Option_exports.isNone(maybeKeyExpression)) {
|
|
10867
11225
|
return;
|
|
10868
11226
|
}
|
|
10869
|
-
const keyExpression = maybeKeyExpression
|
|
11227
|
+
const { value: keyExpression } = maybeKeyExpression;
|
|
10870
11228
|
const maybeIndexName = Array_exports.findFirst(
|
|
10871
11229
|
activeIndexNames,
|
|
10872
11230
|
(indexName) => referencesIndexName(keyExpression, indexName)
|
|
@@ -10888,7 +11246,7 @@ var noArrayIndexViewKeys = Rule_exports.define({
|
|
|
10888
11246
|
|
|
10889
11247
|
// src/rules/no-child-message-construction-in-root.ts
|
|
10890
11248
|
var pascalIdentifierPattern = /^[A-Z][A-Za-z0-9]*$/;
|
|
10891
|
-
var childMessageConstructionMessage = (namespace,
|
|
11249
|
+
var childMessageConstructionMessage = (namespace, constructorName2) => `Do not construct the child Message \`${namespace}.Message.${constructorName2}(...)\` from outside the child. Have the child export a helper that produces or applies this Message, and route child output back through the parent's Got*Message wrapper.`;
|
|
10892
11250
|
var noChildMessageConstructionInRoot = Rule_exports.define({
|
|
10893
11251
|
name: "no-child-message-construction-in-root",
|
|
10894
11252
|
meta: Rule_exports.meta({
|
|
@@ -10911,8 +11269,8 @@ var noChildMessageConstructionInRoot = Rule_exports.define({
|
|
|
10911
11269
|
Option_exports.match({
|
|
10912
11270
|
onNone: () => Effect_exports.void,
|
|
10913
11271
|
onSome: (path) => {
|
|
10914
|
-
const [namespace, middle,
|
|
10915
|
-
if (namespace === void 0 || middle !== "Message" ||
|
|
11272
|
+
const [namespace, middle, constructorName2, extraSegment] = path;
|
|
11273
|
+
if (namespace === void 0 || middle !== "Message" || constructorName2 === void 0 || constructorName2 === "Message" || extraSegment !== void 0 || !pascalIdentifierPattern.test(namespace) || !pascalIdentifierPattern.test(constructorName2)) {
|
|
10916
11274
|
return Effect_exports.void;
|
|
10917
11275
|
}
|
|
10918
11276
|
return ctx.report(
|
|
@@ -10920,7 +11278,7 @@ var noChildMessageConstructionInRoot = Rule_exports.define({
|
|
|
10920
11278
|
node,
|
|
10921
11279
|
message: childMessageConstructionMessage(
|
|
10922
11280
|
namespace,
|
|
10923
|
-
|
|
11281
|
+
constructorName2
|
|
10924
11282
|
)
|
|
10925
11283
|
})
|
|
10926
11284
|
);
|
|
@@ -11330,6 +11688,15 @@ var noEmptyChildrenArray = Rule_exports.define({
|
|
|
11330
11688
|
});
|
|
11331
11689
|
|
|
11332
11690
|
// src/rules/no-empty-object-tagged-call.ts
|
|
11691
|
+
var constructorName = (callee) => {
|
|
11692
|
+
if (isIdentifier(callee) && /^[A-Z][A-Za-z0-9]*$/.test(callee.name)) {
|
|
11693
|
+
return callee.name;
|
|
11694
|
+
}
|
|
11695
|
+
if (isMemberExpression(callee) && callee.computed !== true && isIdentifier(callee.object) && callee.object.name.endsWith("Message") && isIdentifier(callee.property) && /^[A-Z][A-Za-z0-9]*$/.test(callee.property.name)) {
|
|
11696
|
+
return `${callee.object.name}.${callee.property.name}`;
|
|
11697
|
+
}
|
|
11698
|
+
return void 0;
|
|
11699
|
+
};
|
|
11333
11700
|
var noEmptyObjectTaggedCall = Rule_exports.define({
|
|
11334
11701
|
name: "no-empty-object-tagged-call",
|
|
11335
11702
|
meta: Rule_exports.meta({
|
|
@@ -11340,10 +11707,11 @@ var noEmptyObjectTaggedCall = Rule_exports.define({
|
|
|
11340
11707
|
const ctx = yield* RuleContext;
|
|
11341
11708
|
return {
|
|
11342
11709
|
CallExpression: (node) => {
|
|
11343
|
-
if (!isCallExpression(node)
|
|
11710
|
+
if (!isCallExpression(node)) {
|
|
11344
11711
|
return Effect_exports.void;
|
|
11345
11712
|
}
|
|
11346
|
-
|
|
11713
|
+
const name = constructorName(node.callee);
|
|
11714
|
+
if (name === void 0 || node.arguments.length !== 1) {
|
|
11347
11715
|
return Effect_exports.void;
|
|
11348
11716
|
}
|
|
11349
11717
|
const [argument] = node.arguments;
|
|
@@ -11353,7 +11721,7 @@ var noEmptyObjectTaggedCall = Rule_exports.define({
|
|
|
11353
11721
|
return ctx.report(
|
|
11354
11722
|
Diagnostic_exports.make({
|
|
11355
11723
|
node,
|
|
11356
|
-
message: `Call no-field Message constructors as ${
|
|
11724
|
+
message: `Call no-field Message constructors as ${name}() instead of ${name}({}).`
|
|
11357
11725
|
})
|
|
11358
11726
|
);
|
|
11359
11727
|
}
|
|
@@ -11459,7 +11827,7 @@ var noHardcodedRouteStrings = Rule_exports.define({
|
|
|
11459
11827
|
if (Option_exports.isNone(maybeFunctionName)) {
|
|
11460
11828
|
return Effect_exports.void;
|
|
11461
11829
|
}
|
|
11462
|
-
const functionName = maybeFunctionName
|
|
11830
|
+
const { value: functionName } = maybeFunctionName;
|
|
11463
11831
|
const [firstArgument] = node.arguments;
|
|
11464
11832
|
if (isStringLiteral(firstArgument) && isHardcodedRouteString(functionName, firstArgument.value)) {
|
|
11465
11833
|
return ctx.report(
|
|
@@ -11530,6 +11898,143 @@ var noModuleLevelMutableState = Rule_exports.define({
|
|
|
11530
11898
|
}
|
|
11531
11899
|
});
|
|
11532
11900
|
|
|
11901
|
+
// src/rules/no-nonportable-server-globals.ts
|
|
11902
|
+
var restrictedGlobalNames = /* @__PURE__ */ new Set([
|
|
11903
|
+
"alert",
|
|
11904
|
+
"cancelAnimationFrame",
|
|
11905
|
+
"cancelIdleCallback",
|
|
11906
|
+
"confirm",
|
|
11907
|
+
"customElements",
|
|
11908
|
+
"document",
|
|
11909
|
+
"getComputedStyle",
|
|
11910
|
+
"history",
|
|
11911
|
+
"IntersectionObserver",
|
|
11912
|
+
"localStorage",
|
|
11913
|
+
"location",
|
|
11914
|
+
"matchMedia",
|
|
11915
|
+
"MutationObserver",
|
|
11916
|
+
"navigator",
|
|
11917
|
+
"prompt",
|
|
11918
|
+
"requestAnimationFrame",
|
|
11919
|
+
"requestIdleCallback",
|
|
11920
|
+
"ResizeObserver",
|
|
11921
|
+
"screen",
|
|
11922
|
+
"sessionStorage",
|
|
11923
|
+
"window"
|
|
11924
|
+
]);
|
|
11925
|
+
var isInsideTypeQuery = (node) => {
|
|
11926
|
+
const parent = node.parent;
|
|
11927
|
+
if (parent === null) {
|
|
11928
|
+
return false;
|
|
11929
|
+
}
|
|
11930
|
+
if (parent.type === "TSTypeQuery") {
|
|
11931
|
+
return true;
|
|
11932
|
+
}
|
|
11933
|
+
if (parent.type === "TSQualifiedName") {
|
|
11934
|
+
return isInsideTypeQuery(parent);
|
|
11935
|
+
}
|
|
11936
|
+
return false;
|
|
11937
|
+
};
|
|
11938
|
+
var staticMemberName = (node) => {
|
|
11939
|
+
if (!node.computed && node.property.type === "Identifier") {
|
|
11940
|
+
return node.property.name;
|
|
11941
|
+
}
|
|
11942
|
+
if (node.computed && node.property.type === "Literal" && typeof node.property.value === "string") {
|
|
11943
|
+
return node.property.value;
|
|
11944
|
+
}
|
|
11945
|
+
return void 0;
|
|
11946
|
+
};
|
|
11947
|
+
var staticPropertyName2 = (property) => {
|
|
11948
|
+
if (property.key.type === "Identifier") {
|
|
11949
|
+
return property.key.name;
|
|
11950
|
+
}
|
|
11951
|
+
if (property.key.type === "Literal" && typeof property.key.value === "string") {
|
|
11952
|
+
return property.key.value;
|
|
11953
|
+
}
|
|
11954
|
+
return void 0;
|
|
11955
|
+
};
|
|
11956
|
+
var destructuringSource = (node) => {
|
|
11957
|
+
const parent = node.parent;
|
|
11958
|
+
if (parent.type === "VariableDeclarator" && parent.id === node) {
|
|
11959
|
+
return parent.init;
|
|
11960
|
+
}
|
|
11961
|
+
if (parent.type === "AssignmentExpression" && parent.left === node) {
|
|
11962
|
+
return parent.right;
|
|
11963
|
+
}
|
|
11964
|
+
return void 0;
|
|
11965
|
+
};
|
|
11966
|
+
var destructuredGlobalThis = (node) => {
|
|
11967
|
+
const source = destructuringSource(node);
|
|
11968
|
+
return source?.type === "Identifier" && source.name === "globalThis" ? source : void 0;
|
|
11969
|
+
};
|
|
11970
|
+
var restrictedGlobalDiagnostic = (node, name) => Diagnostic_exports.make({
|
|
11971
|
+
node,
|
|
11972
|
+
message: `Global \`${name}\` is not portable across Foldkit server targets. Use a server API available everywhere you deploy or pass the value into the entry.`
|
|
11973
|
+
});
|
|
11974
|
+
var indexReferences = (scopes) => {
|
|
11975
|
+
const references = /* @__PURE__ */ new WeakMap();
|
|
11976
|
+
for (const scope3 of scopes) {
|
|
11977
|
+
for (const reference of scope3.references) {
|
|
11978
|
+
references.set(reference.identifier, reference);
|
|
11979
|
+
}
|
|
11980
|
+
}
|
|
11981
|
+
return references;
|
|
11982
|
+
};
|
|
11983
|
+
var isUnshadowedGlobalReference = (references, node) => {
|
|
11984
|
+
const reference = references.get(node);
|
|
11985
|
+
return reference !== void 0 && (reference.resolved === null || Array_exports.isArrayEmpty(reference.resolved.defs));
|
|
11986
|
+
};
|
|
11987
|
+
var noNonportableServerGlobals = Rule_exports.define({
|
|
11988
|
+
name: "no-nonportable-server-globals",
|
|
11989
|
+
meta: Rule_exports.meta({
|
|
11990
|
+
type: "problem",
|
|
11991
|
+
description: "Avoid browser-only globals in files that run across Foldkit server targets."
|
|
11992
|
+
}),
|
|
11993
|
+
create: function* () {
|
|
11994
|
+
const ctx = yield* RuleContext;
|
|
11995
|
+
const references = indexReferences(ctx.sourceCode.scopeManager.scopes);
|
|
11996
|
+
return {
|
|
11997
|
+
Identifier: (node) => {
|
|
11998
|
+
if (node.type !== "Identifier" || !restrictedGlobalNames.has(node.name) || isInsideTypeQuery(node)) {
|
|
11999
|
+
return Effect_exports.void;
|
|
12000
|
+
}
|
|
12001
|
+
return isUnshadowedGlobalReference(references, node) ? ctx.report(restrictedGlobalDiagnostic(node, node.name)) : Effect_exports.void;
|
|
12002
|
+
},
|
|
12003
|
+
MemberExpression: (node) => {
|
|
12004
|
+
if (node.type !== "MemberExpression" || node.object.type !== "Identifier" || node.object.name !== "globalThis") {
|
|
12005
|
+
return Effect_exports.void;
|
|
12006
|
+
}
|
|
12007
|
+
const memberName = staticMemberName(node);
|
|
12008
|
+
if (memberName === void 0 || !restrictedGlobalNames.has(memberName)) {
|
|
12009
|
+
return Effect_exports.void;
|
|
12010
|
+
}
|
|
12011
|
+
return isUnshadowedGlobalReference(references, node.object) ? ctx.report(restrictedGlobalDiagnostic(node, memberName)) : Effect_exports.void;
|
|
12012
|
+
},
|
|
12013
|
+
ObjectPattern: (node) => {
|
|
12014
|
+
if (node.type !== "ObjectPattern") {
|
|
12015
|
+
return Effect_exports.void;
|
|
12016
|
+
}
|
|
12017
|
+
const source = destructuredGlobalThis(node);
|
|
12018
|
+
if (source === void 0) {
|
|
12019
|
+
return Effect_exports.void;
|
|
12020
|
+
}
|
|
12021
|
+
const restrictedProperties = node.properties.flatMap((property) => {
|
|
12022
|
+
if (property.type !== "Property") {
|
|
12023
|
+
return [];
|
|
12024
|
+
}
|
|
12025
|
+
const name = staticPropertyName2(property);
|
|
12026
|
+
return name !== void 0 && restrictedGlobalNames.has(name) ? [{ name, property }] : [];
|
|
12027
|
+
});
|
|
12028
|
+
return isUnshadowedGlobalReference(references, source) ? Effect_exports.forEach(
|
|
12029
|
+
restrictedProperties,
|
|
12030
|
+
({ name, property }) => ctx.report(restrictedGlobalDiagnostic(property, name)),
|
|
12031
|
+
{ discard: true }
|
|
12032
|
+
) : Effect_exports.void;
|
|
12033
|
+
}
|
|
12034
|
+
};
|
|
12035
|
+
}
|
|
12036
|
+
});
|
|
12037
|
+
|
|
11533
12038
|
// src/rules/no-noop-message.ts
|
|
11534
12039
|
var noNoopMessage = Rule_exports.define({
|
|
11535
12040
|
name: "no-noop-message",
|
|
@@ -11539,18 +12044,23 @@ var noNoopMessage = Rule_exports.define({
|
|
|
11539
12044
|
}),
|
|
11540
12045
|
create: function* () {
|
|
11541
12046
|
const ctx = yield* RuleContext;
|
|
12047
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
11542
12048
|
return {
|
|
12049
|
+
Program: (node) => {
|
|
12050
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
12051
|
+
return Effect_exports.void;
|
|
12052
|
+
},
|
|
11543
12053
|
CallExpression: (node) => {
|
|
11544
|
-
if (!isCallExpression(node)
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
}
|
|
12054
|
+
if (!isCallExpression(node)) return Effect_exports.void;
|
|
12055
|
+
return Effect_exports.forEach(
|
|
12056
|
+
messageCases(node, messageUnionBindings),
|
|
12057
|
+
(messageCase) => ["NoOp", "Noop", "NoOperation"].includes(messageCase.name) ? ctx.report(
|
|
12058
|
+
Diagnostic_exports.make({
|
|
12059
|
+
node: messageCase.nameNode,
|
|
12060
|
+
message: "Every Foldkit Message should describe what happened; avoid generic NoOp Messages."
|
|
12061
|
+
})
|
|
12062
|
+
) : Effect_exports.void,
|
|
12063
|
+
{ discard: true }
|
|
11554
12064
|
);
|
|
11555
12065
|
}
|
|
11556
12066
|
};
|
|
@@ -11853,7 +12363,7 @@ var preferCallableMessageConstructor = Rule_exports.define({
|
|
|
11853
12363
|
return ctx.report(
|
|
11854
12364
|
Diagnostic_exports.make({
|
|
11855
12365
|
node,
|
|
11856
|
-
message: "Construct Messages with their callable Schema constructor (e.g. Foo({ ... })) instead of typing an object literal with a _tag."
|
|
12366
|
+
message: "Construct Messages with their callable Schema constructor (e.g. Message.Foo({ ... })) instead of typing an object literal with a _tag."
|
|
11857
12367
|
})
|
|
11858
12368
|
);
|
|
11859
12369
|
},
|
|
@@ -11864,7 +12374,7 @@ var preferCallableMessageConstructor = Rule_exports.define({
|
|
|
11864
12374
|
return ctx.report(
|
|
11865
12375
|
Diagnostic_exports.make({
|
|
11866
12376
|
node,
|
|
11867
|
-
message: "Construct Messages with their callable Schema constructor (e.g. Foo({ ... })) instead of casting an object literal with a _tag."
|
|
12377
|
+
message: "Construct Messages with their callable Schema constructor (e.g. Message.Foo({ ... })) instead of casting an object literal with a _tag."
|
|
11868
12378
|
})
|
|
11869
12379
|
);
|
|
11870
12380
|
}
|
|
@@ -12246,7 +12756,6 @@ var basePlugin = Plugin_exports.define({
|
|
|
12246
12756
|
"got-wrapper-carries-only-routing": gotWrapperCarriesOnlyRouting,
|
|
12247
12757
|
"keyed-required-for-mapped-rows": keyedRequiredForMappedRows,
|
|
12248
12758
|
"lazy-view-stable-references": lazyViewStableReferences,
|
|
12249
|
-
"message-binding-matches-tag": messageBindingMatchesTag,
|
|
12250
12759
|
"mount-factory-must-use-element": mountFactoryMustUseElement,
|
|
12251
12760
|
"no-array-index-view-keys": noArrayIndexViewKeys,
|
|
12252
12761
|
"no-child-message-construction-in-root": noChildMessageConstructionInRoot,
|
|
@@ -12257,6 +12766,7 @@ var basePlugin = Plugin_exports.define({
|
|
|
12257
12766
|
"no-hand-rolled-command-struct": noHandRolledCommandStruct,
|
|
12258
12767
|
"no-hardcoded-route-strings": noHardcodedRouteStrings,
|
|
12259
12768
|
"no-module-level-mutable-state": noModuleLevelMutableState,
|
|
12769
|
+
"no-nonportable-server-globals": noNonportableServerGlobals,
|
|
12260
12770
|
"no-noop-message": noNoopMessage,
|
|
12261
12771
|
"no-raw-dom-event-attributes": noRawDomEventAttributes,
|
|
12262
12772
|
"no-spread-in-evo": noSpreadInEvo,
|
|
@@ -12266,26 +12776,48 @@ var basePlugin = Plugin_exports.define({
|
|
|
12266
12776
|
"wrap-child-output-in-got-message": wrapChildOutputInGotMessage
|
|
12267
12777
|
}
|
|
12268
12778
|
});
|
|
12269
|
-
var testFilePatterns = [
|
|
12270
|
-
|
|
12779
|
+
var testFilePatterns = [
|
|
12780
|
+
"**/*.test.ts",
|
|
12781
|
+
"**/*.test.tsx",
|
|
12782
|
+
"**/*.spec.ts",
|
|
12783
|
+
"**/*.spec.tsx"
|
|
12784
|
+
];
|
|
12785
|
+
var serverFilePatterns = [
|
|
12786
|
+
"**/entry.server.ts",
|
|
12787
|
+
"**/entry.server.tsx",
|
|
12788
|
+
"**/server/**/*.ts",
|
|
12789
|
+
"**/server/**/*.tsx",
|
|
12790
|
+
"**/prerender.ts"
|
|
12791
|
+
];
|
|
12792
|
+
var serverOverride = {
|
|
12793
|
+
files: serverFilePatterns,
|
|
12794
|
+
excludeFiles: testFilePatterns,
|
|
12795
|
+
rules: {
|
|
12796
|
+
"foldkit/no-nonportable-server-globals": "error"
|
|
12797
|
+
}
|
|
12798
|
+
};
|
|
12799
|
+
var testOverride = (config) => ({
|
|
12800
|
+
files: testFilePatterns,
|
|
12801
|
+
rules: Object.fromEntries(
|
|
12802
|
+
Object.keys(config.rules).map((id) => [
|
|
12803
|
+
id,
|
|
12804
|
+
"off"
|
|
12805
|
+
])
|
|
12806
|
+
)
|
|
12807
|
+
});
|
|
12808
|
+
var withOverrides = (config) => ({
|
|
12271
12809
|
...config,
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
id,
|
|
12278
|
-
"off"
|
|
12279
|
-
])
|
|
12280
|
-
)
|
|
12281
|
-
}
|
|
12282
|
-
]
|
|
12810
|
+
rules: {
|
|
12811
|
+
...config.rules,
|
|
12812
|
+
"foldkit/no-nonportable-server-globals": "off"
|
|
12813
|
+
},
|
|
12814
|
+
overrides: [serverOverride, testOverride(config)]
|
|
12283
12815
|
});
|
|
12284
12816
|
var index_default = {
|
|
12285
12817
|
...basePlugin,
|
|
12286
12818
|
configs: {
|
|
12287
|
-
recommended:
|
|
12288
|
-
all:
|
|
12819
|
+
recommended: withOverrides(basePlugin.configs.recommended),
|
|
12820
|
+
all: withOverrides(basePlugin.configs.all)
|
|
12289
12821
|
}
|
|
12290
12822
|
};
|
|
12291
12823
|
export {
|