@foldkit/oxlint-plugin 0.6.0 → 0.7.0
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 +1546 -1028
- 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.109/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.109/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,
|
|
@@ -192,7 +192,7 @@ __export(Effect_exports, {
|
|
|
192
192
|
sleep: () => sleep2,
|
|
193
193
|
spanAnnotations: () => spanAnnotations2,
|
|
194
194
|
spanLinks: () => spanLinks2,
|
|
195
|
-
succeed: () =>
|
|
195
|
+
succeed: () => succeed5,
|
|
196
196
|
succeedNone: () => succeedNone3,
|
|
197
197
|
succeedSome: () => succeedSome3,
|
|
198
198
|
suspend: () => suspend2,
|
|
@@ -248,7 +248,7 @@ __export(Effect_exports, {
|
|
|
248
248
|
zipWith: () => zipWith4
|
|
249
249
|
});
|
|
250
250
|
|
|
251
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
251
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Pipeable.js
|
|
252
252
|
var pipeArguments = (self, args2) => {
|
|
253
253
|
switch (args2.length) {
|
|
254
254
|
case 0:
|
|
@@ -292,7 +292,7 @@ var Class = /* @__PURE__ */ (function() {
|
|
|
292
292
|
return PipeableBase;
|
|
293
293
|
})();
|
|
294
294
|
|
|
295
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
295
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Function.js
|
|
296
296
|
var dual = function(arity, body) {
|
|
297
297
|
if (typeof arity === "function") {
|
|
298
298
|
return function() {
|
|
@@ -346,16 +346,26 @@ function pipe(a, ...args2) {
|
|
|
346
346
|
function memoize(f) {
|
|
347
347
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
348
348
|
return (a) => {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
349
|
+
const cached3 = cache.get(a);
|
|
350
|
+
if (cached3 !== void 0) return cached3;
|
|
351
|
+
const result3 = f(a);
|
|
352
|
+
cache.set(a, result3);
|
|
353
|
+
return result3;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function memoizeIdempotent(f) {
|
|
357
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
358
|
+
return (a) => {
|
|
359
|
+
const cached3 = cache.get(a);
|
|
360
|
+
if (cached3 !== void 0) return cached3;
|
|
352
361
|
const result3 = f(a);
|
|
353
362
|
cache.set(a, result3);
|
|
363
|
+
cache.set(result3, result3);
|
|
354
364
|
return result3;
|
|
355
365
|
};
|
|
356
366
|
}
|
|
357
367
|
|
|
358
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
368
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/equal.js
|
|
359
369
|
var getAllObjectKeys = (obj) => {
|
|
360
370
|
const keys2 = new Set(Reflect.ownKeys(obj));
|
|
361
371
|
if (obj.constructor === Object) return keys2;
|
|
@@ -378,7 +388,7 @@ var getAllObjectKeys = (obj) => {
|
|
|
378
388
|
};
|
|
379
389
|
var byReferenceInstances = /* @__PURE__ */ new WeakSet();
|
|
380
390
|
|
|
381
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
391
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Predicate.js
|
|
382
392
|
function isString(input) {
|
|
383
393
|
return typeof input === "string";
|
|
384
394
|
}
|
|
@@ -412,7 +422,7 @@ function isIterable(input) {
|
|
|
412
422
|
return hasProperty(input, Symbol.iterator) || isString(input);
|
|
413
423
|
}
|
|
414
424
|
|
|
415
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
425
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Hash.js
|
|
416
426
|
var symbol = "~effect/interfaces/Hash";
|
|
417
427
|
var hash = (self) => {
|
|
418
428
|
switch (typeof self) {
|
|
@@ -433,6 +443,9 @@ var hash = (self) => {
|
|
|
433
443
|
if (self === null) {
|
|
434
444
|
return string("null");
|
|
435
445
|
} else if (self instanceof Date) {
|
|
446
|
+
if (Number.isNaN(self.getTime())) {
|
|
447
|
+
return string("Invalid Date");
|
|
448
|
+
}
|
|
436
449
|
return string(self.toISOString());
|
|
437
450
|
} else if (self instanceof RegExp) {
|
|
438
451
|
return string(self.toString());
|
|
@@ -448,6 +461,8 @@ var hash = (self) => {
|
|
|
448
461
|
return self[symbol]();
|
|
449
462
|
} else if (typeof self === "function") {
|
|
450
463
|
return random(self);
|
|
464
|
+
} else if (self instanceof DataView) {
|
|
465
|
+
return array(new Uint8Array(self.buffer, self.byteOffset, self.byteLength));
|
|
451
466
|
} else if (Array.isArray(self) || ArrayBuffer.isView(self)) {
|
|
452
467
|
return array(self);
|
|
453
468
|
} else if (self instanceof Map) {
|
|
@@ -531,7 +546,7 @@ function withVisitedTracking(obj, fn3) {
|
|
|
531
546
|
return result3;
|
|
532
547
|
}
|
|
533
548
|
|
|
534
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
549
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Equal.js
|
|
535
550
|
var symbol2 = "~effect/interfaces/Equal";
|
|
536
551
|
function equals() {
|
|
537
552
|
if (arguments.length === 1) {
|
|
@@ -580,7 +595,9 @@ function compareObjects(self, that) {
|
|
|
580
595
|
return false;
|
|
581
596
|
} else if (self instanceof Date) {
|
|
582
597
|
if (!(that instanceof Date)) return false;
|
|
583
|
-
|
|
598
|
+
const selfTime = self.getTime();
|
|
599
|
+
const thatTime = that.getTime();
|
|
600
|
+
return selfTime === thatTime || Number.isNaN(selfTime) && Number.isNaN(thatTime);
|
|
584
601
|
} else if (self instanceof RegExp) {
|
|
585
602
|
if (!(that instanceof RegExp)) return false;
|
|
586
603
|
return self.toString() === that.toString();
|
|
@@ -601,9 +618,14 @@ function compareObjects(self, that) {
|
|
|
601
618
|
}
|
|
602
619
|
return compareArrays(self, that);
|
|
603
620
|
} else if (ArrayBuffer.isView(self)) {
|
|
604
|
-
|
|
621
|
+
const selfIsDataView = self instanceof DataView;
|
|
622
|
+
if (!ArrayBuffer.isView(that) || self.byteLength !== that.byteLength || selfIsDataView !== that instanceof DataView) {
|
|
605
623
|
return false;
|
|
606
624
|
}
|
|
625
|
+
if (selfIsDataView) {
|
|
626
|
+
const thatDataView = that;
|
|
627
|
+
return compareTypedArrays(new Uint8Array(self.buffer, self.byteOffset, self.byteLength), new Uint8Array(thatDataView.buffer, thatDataView.byteOffset, thatDataView.byteLength));
|
|
628
|
+
}
|
|
607
629
|
return compareTypedArrays(self, that);
|
|
608
630
|
} else if (self instanceof Map) {
|
|
609
631
|
if (!(that instanceof Map) || self.size !== that.size) {
|
|
@@ -672,10 +694,14 @@ function compareRecords(self, that) {
|
|
|
672
694
|
}
|
|
673
695
|
function makeCompareMap(keyEquivalence, valueEquivalence) {
|
|
674
696
|
return function compareMaps2(self, that) {
|
|
697
|
+
const thatEntries = Array.from(that);
|
|
675
698
|
for (const [selfKey, selfValue] of self) {
|
|
676
699
|
let found = false;
|
|
677
|
-
for (
|
|
700
|
+
for (let i = 0; i < thatEntries.length; i++) {
|
|
701
|
+
const [thatKey, thatValue] = thatEntries[i];
|
|
678
702
|
if (keyEquivalence(selfKey, thatKey) && valueEquivalence(selfValue, thatValue)) {
|
|
703
|
+
thatEntries[i] = thatEntries[thatEntries.length - 1];
|
|
704
|
+
thatEntries.pop();
|
|
679
705
|
found = true;
|
|
680
706
|
break;
|
|
681
707
|
}
|
|
@@ -690,10 +716,14 @@ function makeCompareMap(keyEquivalence, valueEquivalence) {
|
|
|
690
716
|
var compareMaps = /* @__PURE__ */ makeCompareMap(compareBoth, compareBoth);
|
|
691
717
|
function makeCompareSet(equivalence) {
|
|
692
718
|
return function compareSets2(self, that) {
|
|
719
|
+
const thatValues = Array.from(that);
|
|
693
720
|
for (const selfValue of self) {
|
|
694
721
|
let found = false;
|
|
695
|
-
for (
|
|
722
|
+
for (let i = 0; i < thatValues.length; i++) {
|
|
723
|
+
const thatValue = thatValues[i];
|
|
696
724
|
if (equivalence(selfValue, thatValue)) {
|
|
725
|
+
thatValues[i] = thatValues[thatValues.length - 1];
|
|
726
|
+
thatValues.pop();
|
|
697
727
|
found = true;
|
|
698
728
|
break;
|
|
699
729
|
}
|
|
@@ -713,7 +743,7 @@ var byReferenceUnsafe = (obj) => {
|
|
|
713
743
|
return obj;
|
|
714
744
|
};
|
|
715
745
|
|
|
716
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
746
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Redactable.js
|
|
717
747
|
var symbolRedactable = /* @__PURE__ */ Symbol.for("~effect/Redactable");
|
|
718
748
|
var isRedactable = (u) => hasProperty(u, symbolRedactable);
|
|
719
749
|
function redact(u) {
|
|
@@ -724,18 +754,21 @@ function getRedacted(redactable) {
|
|
|
724
754
|
return redactable[symbolRedactable](globalThis[currentFiberTypeId]?.context ?? emptyContext);
|
|
725
755
|
}
|
|
726
756
|
var currentFiberTypeId = "~effect/Fiber/currentFiber";
|
|
757
|
+
var emptyMap = /* @__PURE__ */ new Map();
|
|
727
758
|
var emptyContext = {
|
|
728
759
|
"~effect/Context": {},
|
|
729
|
-
|
|
760
|
+
base: emptyMap,
|
|
761
|
+
depth: 0,
|
|
762
|
+
mapUnsafe: emptyMap,
|
|
730
763
|
pipe() {
|
|
731
764
|
return pipeArguments(this, arguments);
|
|
732
765
|
}
|
|
733
766
|
};
|
|
734
767
|
|
|
735
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
768
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Formatter.js
|
|
736
769
|
function format(input, options) {
|
|
737
770
|
const space = options?.space ?? 0;
|
|
738
|
-
const
|
|
771
|
+
const ancestors = /* @__PURE__ */ new WeakSet();
|
|
739
772
|
const gap = !space ? "" : typeof space === "number" ? " ".repeat(space) : space;
|
|
740
773
|
const ind = (d) => gap.repeat(d);
|
|
741
774
|
const wrap = (v, body) => {
|
|
@@ -749,47 +782,45 @@ function format(input, options) {
|
|
|
749
782
|
return ["[ownKeys threw]"];
|
|
750
783
|
}
|
|
751
784
|
};
|
|
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
|
-
}
|
|
785
|
+
function recur(v, d = 0) {
|
|
770
786
|
if (typeof v === "string") return JSON.stringify(v);
|
|
771
787
|
if (typeof v === "number" || v == null || typeof v === "boolean" || typeof v === "symbol") return String(v);
|
|
772
788
|
if (typeof v === "bigint") return String(v) + "n";
|
|
773
789
|
if (typeof v === "object" || typeof v === "function") {
|
|
774
|
-
if (
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
if (
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
790
|
+
if (ancestors.has(v)) return CIRCULAR;
|
|
791
|
+
ancestors.add(v);
|
|
792
|
+
let output;
|
|
793
|
+
if (symbolRedactable in v) {
|
|
794
|
+
output = recur(getRedacted(v), d);
|
|
795
|
+
} else if (Array.isArray(v)) {
|
|
796
|
+
output = !gap || v.length <= 1 ? `[${v.map((x) => recur(x, d)).join(",")}]` : `[
|
|
797
|
+
${ind(d + 1)}${v.map((x) => recur(x, d + 1)).join(",\n" + ind(d + 1))}
|
|
798
|
+
${ind(d)}]`;
|
|
799
|
+
} else if (v instanceof Date) {
|
|
800
|
+
output = formatDate(v);
|
|
801
|
+
} else if (!options?.ignoreToString && hasProperty(v, "toString") && typeof v["toString"] === "function" && v["toString"] !== Object.prototype.toString && v["toString"] !== Array.prototype.toString) {
|
|
802
|
+
const s = safeToString(v);
|
|
803
|
+
output = v instanceof Error && v.cause ? `${s} (cause: ${recur(v.cause, d)})` : s;
|
|
804
|
+
} else if (Symbol.iterator in v) {
|
|
805
|
+
output = `${v.constructor.name}(${recur(Array.from(v), d)})`;
|
|
806
|
+
} else {
|
|
807
|
+
const keys2 = ownKeys(v);
|
|
808
|
+
if (!gap || keys2.length <= 1) {
|
|
809
|
+
const body = `{${keys2.map((k) => `${formatPropertyKey(k)}:${recur(v[k], d)}`).join(",")}}`;
|
|
810
|
+
output = wrap(v, body);
|
|
811
|
+
} else {
|
|
812
|
+
const body = `{
|
|
813
|
+
${keys2.map((k) => `${ind(d + 1)}${formatPropertyKey(k)}: ${recur(v[k], d + 1)}`).join(",\n")}
|
|
787
814
|
${ind(d)}}`;
|
|
788
|
-
|
|
815
|
+
output = wrap(v, body);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
ancestors.delete(v);
|
|
819
|
+
return output;
|
|
789
820
|
}
|
|
790
821
|
return String(v);
|
|
791
822
|
}
|
|
792
|
-
return
|
|
823
|
+
return recur(input, 0);
|
|
793
824
|
}
|
|
794
825
|
var CIRCULAR = "[Circular]";
|
|
795
826
|
function formatPropertyKey(name) {
|
|
@@ -815,8 +846,12 @@ function safeToString(input) {
|
|
|
815
846
|
}
|
|
816
847
|
function formatJson(input, options) {
|
|
817
848
|
const ancestors = [];
|
|
818
|
-
return JSON.stringify(input, function(
|
|
819
|
-
const
|
|
849
|
+
return JSON.stringify(input, function(key, value) {
|
|
850
|
+
const original = Object.getOwnPropertyDescriptor(this, key)?.value;
|
|
851
|
+
const redacted = hasProperty(original, symbolRedactable) ? redact(original) : redact(value);
|
|
852
|
+
if (typeof redacted === "bigint") {
|
|
853
|
+
return format(redacted);
|
|
854
|
+
}
|
|
820
855
|
if (typeof redacted !== "object" || redacted === null) {
|
|
821
856
|
return redacted;
|
|
822
857
|
}
|
|
@@ -828,22 +863,23 @@ function formatJson(input, options) {
|
|
|
828
863
|
}
|
|
829
864
|
ancestors.push(redacted);
|
|
830
865
|
return redacted;
|
|
831
|
-
}, options?.space);
|
|
866
|
+
}, options?.space) ?? "null";
|
|
832
867
|
}
|
|
833
868
|
|
|
834
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
869
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Inspectable.js
|
|
835
870
|
var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
836
871
|
var toJson = (input) => {
|
|
837
872
|
try {
|
|
873
|
+
input = redact(input);
|
|
838
874
|
if (hasProperty(input, "toJSON") && isFunction(input["toJSON"]) && input["toJSON"].length === 0) {
|
|
839
875
|
return input.toJSON();
|
|
840
876
|
} else if (Array.isArray(input)) {
|
|
841
877
|
return input.map(toJson);
|
|
842
878
|
}
|
|
879
|
+
return input;
|
|
843
880
|
} catch {
|
|
844
881
|
return "[toJSON threw]";
|
|
845
882
|
}
|
|
846
|
-
return redact(input);
|
|
847
883
|
};
|
|
848
884
|
var toStringUnknown = (u, whitespace = 2) => {
|
|
849
885
|
if (typeof u === "string") {
|
|
@@ -852,7 +888,9 @@ var toStringUnknown = (u, whitespace = 2) => {
|
|
|
852
888
|
try {
|
|
853
889
|
return typeof u === "object" ? formatJson(u, {
|
|
854
890
|
space: whitespace
|
|
855
|
-
}) :
|
|
891
|
+
}) : format(u, {
|
|
892
|
+
space: whitespace
|
|
893
|
+
});
|
|
856
894
|
} catch {
|
|
857
895
|
return String(u);
|
|
858
896
|
}
|
|
@@ -895,7 +933,7 @@ var Class2 = class {
|
|
|
895
933
|
}
|
|
896
934
|
};
|
|
897
935
|
|
|
898
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
936
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Utils.js
|
|
899
937
|
var SingleShotGen = class _SingleShotGen {
|
|
900
938
|
called = false;
|
|
901
939
|
self;
|
|
@@ -955,7 +993,7 @@ var pickInternalCall = () => {
|
|
|
955
993
|
};
|
|
956
994
|
var internalCall = /* @__PURE__ */ pickInternalCall();
|
|
957
995
|
|
|
958
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
996
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/record.js
|
|
959
997
|
function assignProperty(self, key, value) {
|
|
960
998
|
if (key === "__proto__") {
|
|
961
999
|
Object.defineProperty(self, key, {
|
|
@@ -977,7 +1015,7 @@ function assignProperties(self, source) {
|
|
|
977
1015
|
}
|
|
978
1016
|
}
|
|
979
1017
|
|
|
980
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1018
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/core.js
|
|
981
1019
|
var EffectTypeId = `~effect/Effect`;
|
|
982
1020
|
var ExitTypeId = `~effect/Exit`;
|
|
983
1021
|
var effectVariance = {
|
|
@@ -1192,12 +1230,12 @@ var makePrimitive = (options) => {
|
|
|
1192
1230
|
};
|
|
1193
1231
|
var makeExit = (options) => {
|
|
1194
1232
|
const Proto3 = {
|
|
1195
|
-
...makePrimitiveProto(options),
|
|
1196
1233
|
[ExitTypeId]: ExitTypeId,
|
|
1197
1234
|
_tag: options.op,
|
|
1198
1235
|
get [options.prop]() {
|
|
1199
1236
|
return this[args];
|
|
1200
1237
|
},
|
|
1238
|
+
...makePrimitiveProto(options),
|
|
1201
1239
|
toString() {
|
|
1202
1240
|
return `${options.op}(${format(this[args])})`;
|
|
1203
1241
|
},
|
|
@@ -1337,30 +1375,13 @@ var done = (value) => {
|
|
|
1337
1375
|
return exitFail(Done(value));
|
|
1338
1376
|
};
|
|
1339
1377
|
|
|
1340
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1378
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Effectable.js
|
|
1341
1379
|
var Prototype2 = (options) => makePrimitiveProto({
|
|
1342
1380
|
op: options.label,
|
|
1343
1381
|
[evaluate]: options.evaluate
|
|
1344
1382
|
});
|
|
1345
1383
|
|
|
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
|
|
1384
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Option.js
|
|
1364
1385
|
var Option_exports = {};
|
|
1365
1386
|
__export(Option_exports, {
|
|
1366
1387
|
Do: () => Do,
|
|
@@ -1425,14 +1446,14 @@ __export(Option_exports, {
|
|
|
1425
1446
|
zipWith: () => zipWith
|
|
1426
1447
|
});
|
|
1427
1448
|
|
|
1428
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1449
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Combiner.js
|
|
1429
1450
|
function make(combine2) {
|
|
1430
1451
|
return {
|
|
1431
1452
|
combine: combine2
|
|
1432
1453
|
};
|
|
1433
1454
|
}
|
|
1434
1455
|
|
|
1435
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1456
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Reducer.js
|
|
1436
1457
|
function make2(combine2, initialValue, combineAll2) {
|
|
1437
1458
|
return {
|
|
1438
1459
|
combine: combine2,
|
|
@@ -1447,7 +1468,7 @@ function make2(combine2, initialValue, combineAll2) {
|
|
|
1447
1468
|
};
|
|
1448
1469
|
}
|
|
1449
1470
|
|
|
1450
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1471
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Equivalence.js
|
|
1451
1472
|
var make3 = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
|
|
1452
1473
|
function Array_(item) {
|
|
1453
1474
|
return make3((self, that) => {
|
|
@@ -1459,7 +1480,7 @@ function Array_(item) {
|
|
|
1459
1480
|
});
|
|
1460
1481
|
}
|
|
1461
1482
|
|
|
1462
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1483
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/doNotation.js
|
|
1463
1484
|
var let_ = (map8) => dual(3, (self, name, f) => map8(self, (a) => ({
|
|
1464
1485
|
...a,
|
|
1465
1486
|
[name]: f(a)
|
|
@@ -1472,7 +1493,7 @@ var bind = (map8, flatMap6) => dual(3, (self, name, f) => flatMap6(self, (a) =>
|
|
|
1472
1493
|
[name]: b
|
|
1473
1494
|
}))));
|
|
1474
1495
|
|
|
1475
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1496
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/option.js
|
|
1476
1497
|
var TypeId = "~effect/data/Option";
|
|
1477
1498
|
var CommonProto = {
|
|
1478
1499
|
[TypeId]: {
|
|
@@ -1538,7 +1559,7 @@ var some = (value) => {
|
|
|
1538
1559
|
return a;
|
|
1539
1560
|
};
|
|
1540
1561
|
|
|
1541
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1562
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/result.js
|
|
1542
1563
|
var TypeId2 = "~effect/data/Result";
|
|
1543
1564
|
var CommonProto2 = {
|
|
1544
1565
|
[TypeId2]: {
|
|
@@ -1608,7 +1629,7 @@ var getFailure = (self) => isSuccess(self) ? none : some(self.failure);
|
|
|
1608
1629
|
var getSuccess = (self) => isFailure(self) ? none : some(self.success);
|
|
1609
1630
|
var fromOption = /* @__PURE__ */ dual(2, (self, onNone) => isNone(self) ? fail(onNone()) : succeed(self.value));
|
|
1610
1631
|
|
|
1611
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1632
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Order.js
|
|
1612
1633
|
function make4(compare) {
|
|
1613
1634
|
return (self, that) => self === that ? 0 : compare(self, that);
|
|
1614
1635
|
}
|
|
@@ -1649,7 +1670,7 @@ var isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
|
|
|
1649
1670
|
var min = (O) => dual(2, (self, that) => self === that || O(self, that) < 1 ? self : that);
|
|
1650
1671
|
var max = (O) => dual(2, (self, that) => self === that || O(self, that) > -1 ? self : that);
|
|
1651
1672
|
|
|
1652
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1673
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Option.js
|
|
1653
1674
|
var none2 = () => none;
|
|
1654
1675
|
var some2 = some;
|
|
1655
1676
|
var isOption2 = isOption;
|
|
@@ -1827,38 +1848,29 @@ function makeReducerFailFast(reducer2) {
|
|
|
1827
1848
|
});
|
|
1828
1849
|
}
|
|
1829
1850
|
|
|
1830
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
1851
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Context.js
|
|
1831
1852
|
var ServiceTypeId = "~effect/Context/Service";
|
|
1832
1853
|
var Service = function() {
|
|
1833
|
-
const prevLimit = getStackTraceLimit();
|
|
1834
|
-
setStackTraceLimit(2);
|
|
1835
|
-
const err = new Error();
|
|
1836
|
-
setStackTraceLimit(prevLimit);
|
|
1837
1854
|
function KeyClass() {
|
|
1838
1855
|
}
|
|
1839
1856
|
const self = KeyClass;
|
|
1840
1857
|
Object.setPrototypeOf(self, ServiceProto);
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
}
|
|
1845
|
-
});
|
|
1846
|
-
if (arguments.length > 0) {
|
|
1847
|
-
self.key = arguments[0];
|
|
1848
|
-
if (arguments[1]?.defaultValue) {
|
|
1858
|
+
const init2 = (key, options) => {
|
|
1859
|
+
self.key = key;
|
|
1860
|
+
if (options?.defaultValue) {
|
|
1849
1861
|
self[ReferenceTypeId] = ReferenceTypeId;
|
|
1850
|
-
self.defaultValue =
|
|
1862
|
+
self.defaultValue = options.defaultValue;
|
|
1851
1863
|
}
|
|
1852
|
-
return self;
|
|
1853
|
-
}
|
|
1854
|
-
return function(key, options) {
|
|
1855
|
-
self.key = key;
|
|
1856
1864
|
if (options?.make) {
|
|
1857
1865
|
;
|
|
1858
1866
|
self.make = options.make;
|
|
1859
1867
|
}
|
|
1868
|
+
if (options?.fiberCached) {
|
|
1869
|
+
cacheKeys.add(key);
|
|
1870
|
+
}
|
|
1860
1871
|
return self;
|
|
1861
1872
|
};
|
|
1873
|
+
return arguments.length > 0 ? init2(arguments[0], arguments[1]) : init2;
|
|
1862
1874
|
};
|
|
1863
1875
|
var ServiceProto = {
|
|
1864
1876
|
[ServiceTypeId]: ServiceTypeId,
|
|
@@ -1871,8 +1883,7 @@ var ServiceProto = {
|
|
|
1871
1883
|
toJSON() {
|
|
1872
1884
|
return {
|
|
1873
1885
|
_id: "Service",
|
|
1874
|
-
key: this.key
|
|
1875
|
-
stack: this.stack
|
|
1886
|
+
key: this.key
|
|
1876
1887
|
};
|
|
1877
1888
|
},
|
|
1878
1889
|
of(self) {
|
|
@@ -1888,19 +1899,62 @@ var ServiceProto = {
|
|
|
1888
1899
|
return withFiber((fiber3) => exitSucceed(f(get(fiber3.context, this))));
|
|
1889
1900
|
}
|
|
1890
1901
|
};
|
|
1902
|
+
var cacheKeys = /* @__PURE__ */ new Set();
|
|
1891
1903
|
var ReferenceTypeId = "~effect/Context/Reference";
|
|
1892
1904
|
var TypeId3 = "~effect/Context";
|
|
1893
|
-
var
|
|
1905
|
+
var MaxDepth = 8;
|
|
1906
|
+
var FlattenAfterBaseHits = 8;
|
|
1907
|
+
var makeImpl = (cacheRoot, base, overlay, depth) => {
|
|
1894
1908
|
const self = Object.create(Proto);
|
|
1895
|
-
self.
|
|
1896
|
-
self.
|
|
1909
|
+
self.cacheRoot = cacheRoot ?? self;
|
|
1910
|
+
self.base = base;
|
|
1911
|
+
self.overlay = overlay;
|
|
1912
|
+
self.depth = depth;
|
|
1913
|
+
self._flat = void 0;
|
|
1914
|
+
self.baseHits = 0;
|
|
1897
1915
|
return self;
|
|
1898
1916
|
};
|
|
1917
|
+
var applyOverlays = (map8, overlay) => {
|
|
1918
|
+
if (!overlay) return;
|
|
1919
|
+
applyOverlays(map8, overlay.parent);
|
|
1920
|
+
map8.set(overlay.key, overlay.value);
|
|
1921
|
+
};
|
|
1922
|
+
var flatten2 = (self) => {
|
|
1923
|
+
if (self._flat) return self._flat;
|
|
1924
|
+
if (!self.overlay) return self._flat = self.base;
|
|
1925
|
+
const map8 = new Map(self.base);
|
|
1926
|
+
applyOverlays(map8, self.overlay);
|
|
1927
|
+
return self._flat = map8;
|
|
1928
|
+
};
|
|
1929
|
+
var withFlat = (self, f) => {
|
|
1930
|
+
const map8 = new Map(self.mapUnsafe);
|
|
1931
|
+
f(map8);
|
|
1932
|
+
return makeUnsafe(map8);
|
|
1933
|
+
};
|
|
1934
|
+
var notFound = /* @__PURE__ */ Symbol();
|
|
1935
|
+
var lookup = (self, key) => {
|
|
1936
|
+
const impl = self;
|
|
1937
|
+
for (let overlay = impl.overlay; overlay; overlay = overlay.parent) {
|
|
1938
|
+
if (overlay.key === key) return overlay.value;
|
|
1939
|
+
}
|
|
1940
|
+
const value = impl.base.get(key);
|
|
1941
|
+
if (value === void 0 && !impl.base.has(key)) return notFound;
|
|
1942
|
+
if (impl.overlay && ++impl.baseHits >= FlattenAfterBaseHits) {
|
|
1943
|
+
impl.base = flatten2(impl);
|
|
1944
|
+
impl.overlay = void 0;
|
|
1945
|
+
impl.depth = 0;
|
|
1946
|
+
}
|
|
1947
|
+
return value;
|
|
1948
|
+
};
|
|
1949
|
+
var makeUnsafe = (mapUnsafe) => makeImpl(void 0, mapUnsafe, void 0, 0);
|
|
1899
1950
|
var Proto = {
|
|
1900
1951
|
...PipeInspectableProto,
|
|
1901
1952
|
[TypeId3]: {
|
|
1902
1953
|
_Services: (_) => _
|
|
1903
1954
|
},
|
|
1955
|
+
get mapUnsafe() {
|
|
1956
|
+
return flatten2(this);
|
|
1957
|
+
},
|
|
1904
1958
|
toJSON() {
|
|
1905
1959
|
return {
|
|
1906
1960
|
_id: "Context",
|
|
@@ -1911,11 +1965,12 @@ var Proto = {
|
|
|
1911
1965
|
};
|
|
1912
1966
|
},
|
|
1913
1967
|
[symbol2](that) {
|
|
1914
|
-
if (!isContext(that)
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1968
|
+
if (!isContext(that)) return false;
|
|
1969
|
+
const self = this.mapUnsafe;
|
|
1970
|
+
const other = that.mapUnsafe;
|
|
1971
|
+
if (self.size !== other.size) return false;
|
|
1972
|
+
for (const [key, value] of self) {
|
|
1973
|
+
if (!other.has(key) || !equals(value, other.get(key))) return false;
|
|
1919
1974
|
}
|
|
1920
1975
|
return true;
|
|
1921
1976
|
},
|
|
@@ -1923,29 +1978,41 @@ var Proto = {
|
|
|
1923
1978
|
return number(this.mapUnsafe.size);
|
|
1924
1979
|
}
|
|
1925
1980
|
};
|
|
1981
|
+
var hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
|
|
1926
1982
|
var isContext = (u) => hasProperty(u, TypeId3);
|
|
1927
|
-
var isReference = (u) =>
|
|
1983
|
+
var isReference = (u) => !!u[ReferenceTypeId];
|
|
1928
1984
|
var empty = () => emptyContext2;
|
|
1929
1985
|
var emptyContext2 = /* @__PURE__ */ makeUnsafe(/* @__PURE__ */ new Map());
|
|
1930
1986
|
var make5 = (key, service3) => makeUnsafe(/* @__PURE__ */ new Map([[key.key, service3]]));
|
|
1931
|
-
var add = /* @__PURE__ */ dual(3, (self, key, service3) =>
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1987
|
+
var add = /* @__PURE__ */ dual(3, (self, key, service3) => addUnsafe(self, key.key, service3));
|
|
1988
|
+
var addUnsafe = (self, key, service3) => {
|
|
1989
|
+
const impl = self;
|
|
1990
|
+
const cacheRoot = cacheKeys.has(key) ? void 0 : impl.cacheRoot;
|
|
1991
|
+
if (impl.depth >= MaxDepth) {
|
|
1992
|
+
const map8 = new Map(impl.mapUnsafe);
|
|
1993
|
+
map8.set(key, service3);
|
|
1994
|
+
return makeImpl(cacheRoot, map8, void 0, 0);
|
|
1995
|
+
}
|
|
1996
|
+
return makeImpl(cacheRoot, impl.base, {
|
|
1997
|
+
key,
|
|
1998
|
+
value: service3,
|
|
1999
|
+
parent: impl.overlay
|
|
2000
|
+
}, impl.depth + 1);
|
|
2001
|
+
};
|
|
2002
|
+
var getOrUndefined2 = /* @__PURE__ */ dual(2, (self, key) => getOrUndefinedUnsafe(self, key.key));
|
|
2003
|
+
var getOrUndefinedUnsafe = (self, key) => {
|
|
2004
|
+
const value = lookup(self, key);
|
|
2005
|
+
return value === notFound ? void 0 : value;
|
|
2006
|
+
};
|
|
1935
2007
|
var getUnsafe = /* @__PURE__ */ dual(2, (self, service3) => {
|
|
1936
|
-
|
|
1937
|
-
|
|
2008
|
+
const value = lookup(self, service3.key);
|
|
2009
|
+
if (value === notFound) {
|
|
2010
|
+
if (isReference(service3)) return getDefaultValue(service3);
|
|
1938
2011
|
throw serviceNotFoundError(service3);
|
|
1939
2012
|
}
|
|
1940
|
-
return
|
|
2013
|
+
return value;
|
|
1941
2014
|
});
|
|
1942
2015
|
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
2016
|
var defaultValueCacheKey = "~effect/Context/defaultValue";
|
|
1950
2017
|
var getDefaultValue = (ref) => {
|
|
1951
2018
|
if (defaultValueCacheKey in ref) {
|
|
@@ -1955,15 +2022,6 @@ var getDefaultValue = (ref) => {
|
|
|
1955
2022
|
};
|
|
1956
2023
|
var serviceNotFoundError = (service3) => {
|
|
1957
2024
|
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
2025
|
if (error.stack) {
|
|
1968
2026
|
const lines = error.stack.split("\n");
|
|
1969
2027
|
lines.splice(1, 3);
|
|
@@ -1972,17 +2030,14 @@ var serviceNotFoundError = (service3) => {
|
|
|
1972
2030
|
return error;
|
|
1973
2031
|
};
|
|
1974
2032
|
var getOption = /* @__PURE__ */ dual(2, (self, service3) => {
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
}
|
|
2033
|
+
const value = lookup(self, service3.key);
|
|
2034
|
+
if (value !== notFound) return some2(value);
|
|
1978
2035
|
return isReference(service3) ? some2(getDefaultValue(service3)) : none2();
|
|
1979
2036
|
});
|
|
1980
2037
|
var merge = /* @__PURE__ */ dual(2, (self, that) => {
|
|
1981
2038
|
if (self.mapUnsafe.size === 0) return that;
|
|
1982
2039
|
if (that.mapUnsafe.size === 0) return self;
|
|
1983
|
-
return
|
|
1984
|
-
that.mapUnsafe.forEach((value, key) => map8.set(key, value));
|
|
1985
|
-
});
|
|
2040
|
+
return withFlat(self, (map8) => that.mapUnsafe.forEach((value, key) => map8.set(key, value)));
|
|
1986
2041
|
});
|
|
1987
2042
|
var mergeAll = (...ctxs) => {
|
|
1988
2043
|
const map8 = /* @__PURE__ */ new Map();
|
|
@@ -1993,25 +2048,27 @@ var mergeAll = (...ctxs) => {
|
|
|
1993
2048
|
}
|
|
1994
2049
|
return makeUnsafe(map8);
|
|
1995
2050
|
};
|
|
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
2051
|
var Reference = Service;
|
|
2006
2052
|
|
|
2007
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2053
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Duration.js
|
|
2008
2054
|
var TypeId4 = "~effect/time/Duration";
|
|
2009
2055
|
var bigint0 = /* @__PURE__ */ BigInt(0);
|
|
2010
2056
|
var bigint1 = /* @__PURE__ */ BigInt(1);
|
|
2057
|
+
var bigint2 = /* @__PURE__ */ BigInt(2);
|
|
2058
|
+
var bigint10 = /* @__PURE__ */ BigInt(10);
|
|
2011
2059
|
var bigint1e3 = /* @__PURE__ */ BigInt(1e3);
|
|
2012
2060
|
var roundTiesAwayFromZero = (input) => BigInt(input < 0 ? Math.ceil(input - 0.5) : Math.floor(input + 0.5));
|
|
2013
2061
|
var roundMillisToNanos = (millis2) => roundTiesAwayFromZero(millis2 * 1e6);
|
|
2014
|
-
var parseNanos = (input, scale) =>
|
|
2062
|
+
var parseNanos = (input, scale) => {
|
|
2063
|
+
const decimalIndex = input.indexOf(".");
|
|
2064
|
+
if (decimalIndex === -1) return BigInt(input) * scale;
|
|
2065
|
+
const isNegative = input[0] === "-";
|
|
2066
|
+
const fractional = input.slice(decimalIndex + 1);
|
|
2067
|
+
const fractionalScale = bigint10 ** BigInt(fractional.length);
|
|
2068
|
+
const scaled = (BigInt(input.slice(isNegative ? 1 : 0, decimalIndex)) * fractionalScale + BigInt(fractional)) * scale;
|
|
2069
|
+
const rounded = scaled / fractionalScale + (scaled % fractionalScale * bigint2 >= fractionalScale ? bigint1 : bigint0);
|
|
2070
|
+
return isNegative ? -rounded : rounded;
|
|
2071
|
+
};
|
|
2015
2072
|
var DURATION_REGEXP = /^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/;
|
|
2016
2073
|
var fromInputUnsafe = (input) => {
|
|
2017
2074
|
switch (typeof input) {
|
|
@@ -2106,7 +2163,16 @@ var negativeInfinityDurationValue = {
|
|
|
2106
2163
|
var DurationProto = {
|
|
2107
2164
|
[TypeId4]: TypeId4,
|
|
2108
2165
|
[symbol]() {
|
|
2109
|
-
|
|
2166
|
+
switch (this.value._tag) {
|
|
2167
|
+
case "Millis": {
|
|
2168
|
+
const nanos2 = this.value.millis * 1e6;
|
|
2169
|
+
return Number.isFinite(nanos2) ? hash(roundTiesAwayFromZero(nanos2)) : number(this.value.millis);
|
|
2170
|
+
}
|
|
2171
|
+
case "Nanos":
|
|
2172
|
+
return hash(this.value.nanos);
|
|
2173
|
+
default:
|
|
2174
|
+
return structure(this.value);
|
|
2175
|
+
}
|
|
2110
2176
|
},
|
|
2111
2177
|
[symbol2](that) {
|
|
2112
2178
|
return isDuration(that) && equals2(this, that);
|
|
@@ -2251,7 +2317,7 @@ var subtract = /* @__PURE__ */ dual(2, (self, that) => matchPair(self, that, {
|
|
|
2251
2317
|
}));
|
|
2252
2318
|
var equals2 = /* @__PURE__ */ dual(2, (self, that) => Equivalence(self, that));
|
|
2253
2319
|
|
|
2254
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2320
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Array.js
|
|
2255
2321
|
var Array_exports = {};
|
|
2256
2322
|
__export(Array_exports, {
|
|
2257
2323
|
Array: () => Array2,
|
|
@@ -2292,7 +2358,7 @@ __export(Array_exports, {
|
|
|
2292
2358
|
findLastIndex: () => findLastIndex,
|
|
2293
2359
|
flatMap: () => flatMap3,
|
|
2294
2360
|
flatMapNullishOr: () => flatMapNullishOr2,
|
|
2295
|
-
flatten: () =>
|
|
2361
|
+
flatten: () => flatten3,
|
|
2296
2362
|
forEach: () => forEach,
|
|
2297
2363
|
fromIterable: () => fromIterable2,
|
|
2298
2364
|
fromNullishOr: () => fromNullishOr3,
|
|
@@ -2389,10 +2455,10 @@ __export(Array_exports, {
|
|
|
2389
2455
|
zipWith: () => zipWith2
|
|
2390
2456
|
});
|
|
2391
2457
|
|
|
2392
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2458
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/array.js
|
|
2393
2459
|
var isArrayNonEmpty = (self) => self.length > 0;
|
|
2394
2460
|
|
|
2395
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2461
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Result.js
|
|
2396
2462
|
var Result_exports = {};
|
|
2397
2463
|
__export(Result_exports, {
|
|
2398
2464
|
Do: () => Do2,
|
|
@@ -2467,8 +2533,8 @@ var mapBoth = /* @__PURE__ */ dual(2, (self, {
|
|
|
2467
2533
|
onFailure,
|
|
2468
2534
|
onSuccess
|
|
2469
2535
|
}) => 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)) :
|
|
2536
|
+
var mapError = /* @__PURE__ */ dual(2, (self, f) => isFailure2(self) ? fail2(f(self.failure)) : self);
|
|
2537
|
+
var map2 = /* @__PURE__ */ dual(2, (self, f) => isSuccess2(self) ? succeed2(f(self.success)) : self);
|
|
2472
2538
|
var match3 = /* @__PURE__ */ dual(2, (self, {
|
|
2473
2539
|
onFailure,
|
|
2474
2540
|
onSuccess
|
|
@@ -2547,10 +2613,10 @@ var tap2 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
2547
2613
|
return self;
|
|
2548
2614
|
});
|
|
2549
2615
|
|
|
2550
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2616
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Tuple.js
|
|
2551
2617
|
var make7 = (...elements) => elements;
|
|
2552
2618
|
|
|
2553
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2619
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Iterable.js
|
|
2554
2620
|
var findFirst = /* @__PURE__ */ dual(2, (self, f) => {
|
|
2555
2621
|
let i = 0;
|
|
2556
2622
|
for (const a of self) {
|
|
@@ -2593,7 +2659,7 @@ var filter2 = /* @__PURE__ */ dual(2, (self, predicate) => ({
|
|
|
2593
2659
|
}
|
|
2594
2660
|
}));
|
|
2595
2661
|
|
|
2596
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2662
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Record.js
|
|
2597
2663
|
var empty2 = () => ({});
|
|
2598
2664
|
var isEmptyRecord = (self) => Object.keys(self).length === 0;
|
|
2599
2665
|
var fromEntries = Object.fromEntries;
|
|
@@ -2643,7 +2709,7 @@ var union = /* @__PURE__ */ dual(3, (self, that, combine2) => {
|
|
|
2643
2709
|
return out;
|
|
2644
2710
|
});
|
|
2645
2711
|
|
|
2646
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
2712
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Array.js
|
|
2647
2713
|
var Array2 = globalThis.Array;
|
|
2648
2714
|
var make8 = (...elements) => elements;
|
|
2649
2715
|
var allocate = (n) => new Array2(n);
|
|
@@ -2702,7 +2768,7 @@ var isArrayNonEmpty2 = isArrayNonEmpty;
|
|
|
2702
2768
|
var isReadonlyArrayNonEmpty = isArrayNonEmpty;
|
|
2703
2769
|
var length = (self) => self.length;
|
|
2704
2770
|
function isOutOfBounds(i, as4) {
|
|
2705
|
-
return i < 0 || i >= as4.length;
|
|
2771
|
+
return !Number.isFinite(i) || i < 0 || i >= as4.length;
|
|
2706
2772
|
}
|
|
2707
2773
|
var clamp = (i, as4) => Math.floor(Math.min(Math.max(0, i), as4.length));
|
|
2708
2774
|
var get2 = /* @__PURE__ */ dual(2, (self, index) => {
|
|
@@ -2866,29 +2932,32 @@ var findLast = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
2866
2932
|
});
|
|
2867
2933
|
var insertAt = /* @__PURE__ */ dual(3, (self, i, b) => {
|
|
2868
2934
|
const out = Array2.from(self);
|
|
2869
|
-
|
|
2935
|
+
const index = Math.floor(i);
|
|
2936
|
+
if (index !== out.length && isOutOfBounds(index, out)) {
|
|
2870
2937
|
return none2();
|
|
2871
2938
|
}
|
|
2872
|
-
out.splice(
|
|
2939
|
+
out.splice(index, 0, b);
|
|
2873
2940
|
return some2(out);
|
|
2874
2941
|
});
|
|
2875
2942
|
var replace = /* @__PURE__ */ dual(3, (self, i, b) => modify(self, i, () => b));
|
|
2876
2943
|
var modify = /* @__PURE__ */ dual(3, (self, i, f) => {
|
|
2877
2944
|
const arr = Array2.from(self);
|
|
2878
|
-
|
|
2945
|
+
const index = Math.floor(i);
|
|
2946
|
+
if (isOutOfBounds(index, arr)) {
|
|
2879
2947
|
return none2();
|
|
2880
2948
|
}
|
|
2881
2949
|
const out = arr;
|
|
2882
|
-
const b = f(arr[
|
|
2883
|
-
out[
|
|
2950
|
+
const b = f(arr[index]);
|
|
2951
|
+
out[index] = b;
|
|
2884
2952
|
return some2(out);
|
|
2885
2953
|
});
|
|
2886
2954
|
var remove = /* @__PURE__ */ dual(2, (self, i) => {
|
|
2887
2955
|
const out = Array2.from(self);
|
|
2888
|
-
|
|
2956
|
+
const index = Math.floor(i);
|
|
2957
|
+
if (isOutOfBounds(index, out)) {
|
|
2889
2958
|
return out;
|
|
2890
2959
|
}
|
|
2891
|
-
out.splice(
|
|
2960
|
+
out.splice(index, 1);
|
|
2892
2961
|
return out;
|
|
2893
2962
|
});
|
|
2894
2963
|
var reverse = (self) => Array2.from(self).reverse();
|
|
@@ -3170,7 +3239,7 @@ var flatMap3 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
3170
3239
|
}
|
|
3171
3240
|
return out;
|
|
3172
3241
|
});
|
|
3173
|
-
var
|
|
3242
|
+
var flatten3 = /* @__PURE__ */ flatMap3(identity);
|
|
3174
3243
|
var getSomes = (self) => {
|
|
3175
3244
|
const out = [];
|
|
3176
3245
|
for (const a of self) {
|
|
@@ -3345,7 +3414,7 @@ var countBy = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
3345
3414
|
return count;
|
|
3346
3415
|
});
|
|
3347
3416
|
|
|
3348
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3417
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Filter.js
|
|
3349
3418
|
var composePassthrough = /* @__PURE__ */ dual(2, (left, right) => (input) => {
|
|
3350
3419
|
const leftOut = left(input);
|
|
3351
3420
|
if (isFailure2(leftOut)) return fail2(input);
|
|
@@ -3354,8 +3423,9 @@ var composePassthrough = /* @__PURE__ */ dual(2, (left, right) => (input) => {
|
|
|
3354
3423
|
return rightOut;
|
|
3355
3424
|
});
|
|
3356
3425
|
|
|
3357
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3426
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Scheduler.js
|
|
3358
3427
|
var Scheduler = /* @__PURE__ */ Reference("effect/Scheduler", {
|
|
3428
|
+
fiberCached: true,
|
|
3359
3429
|
defaultValue: () => new MixedScheduler()
|
|
3360
3430
|
});
|
|
3361
3431
|
var setImmediate = "setImmediate" in globalThis ? (f) => {
|
|
@@ -3365,6 +3435,15 @@ var setImmediate = "setImmediate" in globalThis ? (f) => {
|
|
|
3365
3435
|
const timer = setTimeout(f, 0);
|
|
3366
3436
|
return () => clearTimeout(timer);
|
|
3367
3437
|
};
|
|
3438
|
+
var setMicrotask = (f) => {
|
|
3439
|
+
let cancelled = false;
|
|
3440
|
+
Promise.resolve().then(() => {
|
|
3441
|
+
if (!cancelled) f();
|
|
3442
|
+
});
|
|
3443
|
+
return () => {
|
|
3444
|
+
cancelled = true;
|
|
3445
|
+
};
|
|
3446
|
+
};
|
|
3368
3447
|
var PriorityBuckets = class {
|
|
3369
3448
|
buckets = [];
|
|
3370
3449
|
scheduleTask(task, priority) {
|
|
@@ -3393,9 +3472,9 @@ var PriorityBuckets = class {
|
|
|
3393
3472
|
var MixedScheduler = class {
|
|
3394
3473
|
executionMode;
|
|
3395
3474
|
setImmediate;
|
|
3396
|
-
constructor(executionMode = "async", setImmediateFn
|
|
3475
|
+
constructor(executionMode = "async", setImmediateFn) {
|
|
3397
3476
|
this.executionMode = executionMode;
|
|
3398
|
-
this.setImmediate = setImmediateFn;
|
|
3477
|
+
this.setImmediate = setImmediateFn ?? (executionMode === "sync" ? setMicrotask : setImmediate);
|
|
3399
3478
|
}
|
|
3400
3479
|
/**
|
|
3401
3480
|
* Returns whether the fiber has reached its operation budget and should yield.
|
|
@@ -3473,15 +3552,19 @@ var MixedSchedulerDispatcher = class {
|
|
|
3473
3552
|
}
|
|
3474
3553
|
};
|
|
3475
3554
|
var MaxOpsBeforeYield = /* @__PURE__ */ Reference("effect/Scheduler/MaxOpsBeforeYield", {
|
|
3555
|
+
fiberCached: true,
|
|
3476
3556
|
defaultValue: () => 2048
|
|
3477
3557
|
});
|
|
3478
3558
|
var PreventSchedulerYield = /* @__PURE__ */ Reference("effect/Scheduler/PreventSchedulerYield", {
|
|
3559
|
+
fiberCached: true,
|
|
3479
3560
|
defaultValue: () => false
|
|
3480
3561
|
});
|
|
3481
3562
|
|
|
3482
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3563
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Tracer.js
|
|
3483
3564
|
var ParentSpanKey = "effect/Tracer/ParentSpan";
|
|
3484
|
-
var ParentSpan = class extends (/* @__PURE__ */ Service()(ParentSpanKey
|
|
3565
|
+
var ParentSpan = class extends (/* @__PURE__ */ Service()(ParentSpanKey, {
|
|
3566
|
+
fiberCached: true
|
|
3567
|
+
})) {
|
|
3485
3568
|
};
|
|
3486
3569
|
var make9 = (options) => options;
|
|
3487
3570
|
var DisablePropagation = /* @__PURE__ */ Reference("effect/Tracer/DisablePropagation", {
|
|
@@ -3495,6 +3578,7 @@ var MinimumTraceLevel = /* @__PURE__ */ Reference("effect/Tracer/MinimumTraceLev
|
|
|
3495
3578
|
});
|
|
3496
3579
|
var TracerKey = "effect/Tracer";
|
|
3497
3580
|
var Tracer = /* @__PURE__ */ Reference(TracerKey, {
|
|
3581
|
+
fiberCached: true,
|
|
3498
3582
|
defaultValue: () => make9({
|
|
3499
3583
|
span: (options) => new NativeSpan(options)
|
|
3500
3584
|
})
|
|
@@ -3559,14 +3643,15 @@ var randomHexString = /* @__PURE__ */ (function() {
|
|
|
3559
3643
|
};
|
|
3560
3644
|
})();
|
|
3561
3645
|
|
|
3562
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3646
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/metric.js
|
|
3563
3647
|
var FiberRuntimeMetricsKey = "effect/observability/Metric/FiberRuntimeMetricsKey";
|
|
3564
3648
|
|
|
3565
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3649
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/references.js
|
|
3566
3650
|
var CurrentErrorReporters = /* @__PURE__ */ Reference("effect/ErrorReporter/CurrentErrorReporters", {
|
|
3567
3651
|
defaultValue: () => /* @__PURE__ */ new Set()
|
|
3568
3652
|
});
|
|
3569
3653
|
var CurrentStackFrame = /* @__PURE__ */ Reference("effect/References/CurrentStackFrame", {
|
|
3654
|
+
fiberCached: true,
|
|
3570
3655
|
defaultValue: constUndefined
|
|
3571
3656
|
});
|
|
3572
3657
|
var TracerEnabled = /* @__PURE__ */ Reference("effect/References/TracerEnabled", {
|
|
@@ -3585,16 +3670,35 @@ var CurrentLogAnnotations = /* @__PURE__ */ Reference("effect/References/Current
|
|
|
3585
3670
|
defaultValue: () => ({})
|
|
3586
3671
|
});
|
|
3587
3672
|
var CurrentLogLevel = /* @__PURE__ */ Reference("effect/References/CurrentLogLevel", {
|
|
3673
|
+
fiberCached: true,
|
|
3588
3674
|
defaultValue: () => "Info"
|
|
3589
3675
|
});
|
|
3590
3676
|
var MinimumLogLevel = /* @__PURE__ */ Reference("effect/References/MinimumLogLevel", {
|
|
3677
|
+
fiberCached: true,
|
|
3591
3678
|
defaultValue: () => "Info"
|
|
3592
3679
|
});
|
|
3593
3680
|
var CurrentLogSpans = /* @__PURE__ */ Reference("effect/References/CurrentLogSpans", {
|
|
3594
3681
|
defaultValue: () => []
|
|
3595
3682
|
});
|
|
3596
3683
|
|
|
3597
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
3684
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/stackTraceLimit.js
|
|
3685
|
+
var isStackTraceLimitWritable = () => {
|
|
3686
|
+
const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
3687
|
+
if (desc === void 0) {
|
|
3688
|
+
return Object.isExtensible(Error);
|
|
3689
|
+
}
|
|
3690
|
+
return Object.hasOwn(desc, "writable") ? desc.writable === true : desc.set !== void 0;
|
|
3691
|
+
};
|
|
3692
|
+
var canWriteStackTraceLimit = /* @__PURE__ */ isStackTraceLimitWritable();
|
|
3693
|
+
var getStackTraceLimit = () => Error.stackTraceLimit;
|
|
3694
|
+
var setStackTraceLimit = (value) => {
|
|
3695
|
+
if (canWriteStackTraceLimit) {
|
|
3696
|
+
;
|
|
3697
|
+
Error.stackTraceLimit = value;
|
|
3698
|
+
}
|
|
3699
|
+
};
|
|
3700
|
+
|
|
3701
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/tracer.js
|
|
3598
3702
|
var addSpanStackTrace = (options) => {
|
|
3599
3703
|
if (options?.captureStackTrace === false) {
|
|
3600
3704
|
return options;
|
|
@@ -3625,10 +3729,7 @@ var makeStackCleaner = (line) => (stack) => {
|
|
|
3625
3729
|
};
|
|
3626
3730
|
var spanCleaner = /* @__PURE__ */ makeStackCleaner(3);
|
|
3627
3731
|
|
|
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
|
|
3732
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/effect.js
|
|
3632
3733
|
var Interrupt = class extends ReasonBase {
|
|
3633
3734
|
fiberId;
|
|
3634
3735
|
constructor(fiberId3, annotations = constEmptyAnnotations) {
|
|
@@ -3697,7 +3798,7 @@ var causeMap = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
3697
3798
|
const failures = self.reasons.map((failure) => {
|
|
3698
3799
|
if (isFailReason(failure)) {
|
|
3699
3800
|
hasFail = true;
|
|
3700
|
-
return new Fail(f(failure.error));
|
|
3801
|
+
return new Fail(f(failure.error), failure.annotations);
|
|
3701
3802
|
}
|
|
3702
3803
|
return failure;
|
|
3703
3804
|
});
|
|
@@ -3866,7 +3967,7 @@ ${prefix}}`;
|
|
|
3866
3967
|
}
|
|
3867
3968
|
return stack;
|
|
3868
3969
|
};
|
|
3869
|
-
var FiberTypeId =
|
|
3970
|
+
var FiberTypeId = "~effect/Fiber";
|
|
3870
3971
|
var fiberVariance = {
|
|
3871
3972
|
_A: identity,
|
|
3872
3973
|
_E: identity
|
|
@@ -3920,7 +4021,7 @@ var FiberImpl = class {
|
|
|
3920
4021
|
return this._dispatcher ??= this.currentScheduler.makeDispatcher();
|
|
3921
4022
|
}
|
|
3922
4023
|
getRef(ref) {
|
|
3923
|
-
return
|
|
4024
|
+
return get(this.context, ref);
|
|
3924
4025
|
}
|
|
3925
4026
|
addObserver(cb) {
|
|
3926
4027
|
if (this._exit) {
|
|
@@ -4057,20 +4158,22 @@ var FiberImpl = class {
|
|
|
4057
4158
|
return pipeArguments(this, arguments);
|
|
4058
4159
|
}
|
|
4059
4160
|
setContext(context3) {
|
|
4161
|
+
const previous = this.context;
|
|
4060
4162
|
this.context = context3;
|
|
4163
|
+
if (previous !== void 0 && hasSameCache(previous, context3)) return;
|
|
4061
4164
|
const scheduler = this.getRef(Scheduler);
|
|
4062
4165
|
if (scheduler !== this.currentScheduler) {
|
|
4063
4166
|
this.currentScheduler = scheduler;
|
|
4064
4167
|
this._dispatcher = void 0;
|
|
4065
4168
|
}
|
|
4066
|
-
this.currentSpan = context3
|
|
4169
|
+
this.currentSpan = getOrUndefinedUnsafe(context3, ParentSpanKey);
|
|
4067
4170
|
this.currentLogLevel = this.getRef(CurrentLogLevel);
|
|
4068
4171
|
this.minimumLogLevel = this.getRef(MinimumLogLevel);
|
|
4069
|
-
this.currentStackFrame =
|
|
4172
|
+
this.currentStackFrame = this.getRef(CurrentStackFrame);
|
|
4070
4173
|
this.maxOpsBeforeYield = this.getRef(MaxOpsBeforeYield);
|
|
4071
4174
|
this.currentPreventYield = this.getRef(PreventSchedulerYield);
|
|
4072
|
-
this.runtimeMetrics = context3
|
|
4073
|
-
const currentTracer = context3
|
|
4175
|
+
this.runtimeMetrics = getOrUndefinedUnsafe(context3, FiberRuntimeMetricsKey);
|
|
4176
|
+
const currentTracer = getOrUndefinedUnsafe(context3, TracerKey);
|
|
4074
4177
|
this.currentTracerContext = currentTracer ? currentTracer["context"] : void 0;
|
|
4075
4178
|
}
|
|
4076
4179
|
get currentSpanLocal() {
|
|
@@ -4500,7 +4603,7 @@ var flatMapEager = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
4500
4603
|
}
|
|
4501
4604
|
return flatMap4(self, f);
|
|
4502
4605
|
});
|
|
4503
|
-
var
|
|
4606
|
+
var flatten4 = (self) => flatMap4(self, identity);
|
|
4504
4607
|
var map5 = /* @__PURE__ */ dual(2, (self, f) => flatMap4(self, (a) => succeed3(internalCall(() => f(a)))));
|
|
4505
4608
|
var mapEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMap(self, f) : map5(self, f));
|
|
4506
4609
|
var mapErrorEager = /* @__PURE__ */ dual(2, (self, f) => effectIsExit(self) ? exitMapError(self, f) : mapError2(self, f));
|
|
@@ -4541,7 +4644,7 @@ var exitAsVoidAll = (exits) => {
|
|
|
4541
4644
|
};
|
|
4542
4645
|
var service = (service3) => service3;
|
|
4543
4646
|
var serviceOption = (service3) => withFiber((fiber3) => succeed3(getOption(fiber3.context, service3)));
|
|
4544
|
-
var serviceOptional = (service3) => withFiber((fiber3) =>
|
|
4647
|
+
var serviceOptional = (service3) => withFiber((fiber3) => fromOption4(getOption(fiber3.context, service3)));
|
|
4545
4648
|
var updateContext = /* @__PURE__ */ dual(2, (self, f) => withFiber((fiber3) => {
|
|
4546
4649
|
const prevContext = fiber3.context;
|
|
4547
4650
|
const nextContext = f(prevContext);
|
|
@@ -4589,11 +4692,7 @@ var provideService = function() {
|
|
|
4589
4692
|
}
|
|
4590
4693
|
return dual(3, (self, service3, impl) => provideServiceImpl(self, service3, impl)).apply(this, arguments);
|
|
4591
4694
|
};
|
|
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
|
-
});
|
|
4695
|
+
var provideServiceImpl = (self, service3, implementation) => updateContext(self, add(service3, implementation));
|
|
4597
4696
|
var provideServiceEffect = /* @__PURE__ */ dual(3, (self, service3, acquire) => flatMap4(acquire, (implementation) => provideService(self, service3, implementation)));
|
|
4598
4697
|
var zip2 = /* @__PURE__ */ dual((args2) => isEffect(args2[1]), (self, that, options) => zipWith3(self, that, (a, a2) => [a, a2], options));
|
|
4599
4698
|
var zipWith3 = /* @__PURE__ */ dual((args2) => isEffect(args2[1]), (self, that, f, options) => options?.concurrent ? map5(all3([self, that], {
|
|
@@ -4837,8 +4936,8 @@ var timeout = /* @__PURE__ */ dual(2, (self, duration) => timeoutOrElse(self, {
|
|
|
4837
4936
|
}));
|
|
4838
4937
|
var timeoutOption = /* @__PURE__ */ dual(2, (self, duration) => raceFirst(asSome(self), as2(sleep(duration), none2())));
|
|
4839
4938
|
var timed = (self) => clockWith((clock) => {
|
|
4840
|
-
const start = clock.
|
|
4841
|
-
return map5(self, (a) => [nanos(clock.
|
|
4939
|
+
const start = clock.monotonicTimeNanosUnsafe();
|
|
4940
|
+
return map5(self, (a) => [nanos(clock.monotonicTimeNanosUnsafe() - start), a]);
|
|
4842
4941
|
});
|
|
4843
4942
|
var ScopeTypeId = "~effect/Scope";
|
|
4844
4943
|
var ScopeCloseableTypeId = "~effect/Scope/Closeable";
|
|
@@ -5197,10 +5296,24 @@ var forEachSequential = (iterable, f, options) => suspend(() => {
|
|
|
5197
5296
|
var iterateEagerImpl = (options) => {
|
|
5198
5297
|
const onItem = options.onItem;
|
|
5199
5298
|
const step = options.step;
|
|
5299
|
+
const runSequential = (state, items, index, end) => {
|
|
5300
|
+
for (; index < end; index++) {
|
|
5301
|
+
const item = items[index];
|
|
5302
|
+
const effect = onItem(state, item, index);
|
|
5303
|
+
if (!effectIsExit(effect)) {
|
|
5304
|
+
return flatMap4(exit(effect), (itemExit) => step(state, item, itemExit, index) ?? runSequential(state, items, index + 1, end) ?? void_3);
|
|
5305
|
+
}
|
|
5306
|
+
const terminal = step(state, item, effect, index);
|
|
5307
|
+
if (terminal) return terminal._tag === "Failure" ? terminal : void 0;
|
|
5308
|
+
}
|
|
5309
|
+
};
|
|
5200
5310
|
return (state, items, opts) => {
|
|
5201
|
-
let index =
|
|
5311
|
+
let index = 0;
|
|
5202
5312
|
const end = opts?.end ?? items.length;
|
|
5203
5313
|
const concurrency = opts?.concurrency ?? 1;
|
|
5314
|
+
if (concurrency === 1) {
|
|
5315
|
+
return runSequential(state, items, 0, end);
|
|
5316
|
+
}
|
|
5204
5317
|
const orderedStep = opts?.orderedStep === true && concurrency > 1;
|
|
5205
5318
|
let done4 = false;
|
|
5206
5319
|
let parentFiber;
|
|
@@ -5239,12 +5352,6 @@ var iterateEagerImpl = (options) => {
|
|
|
5239
5352
|
if (effectIsExit(eff)) {
|
|
5240
5353
|
terminal = runStep(item, eff, index);
|
|
5241
5354
|
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
5355
|
} else if (!parentFiber) {
|
|
5249
5356
|
return callback((cb) => {
|
|
5250
5357
|
parentFiber = getCurrentFiber();
|
|
@@ -5399,16 +5506,17 @@ var forkChild = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, optio
|
|
|
5399
5506
|
return succeed3(forkUnsafe(fiber3, self, options?.startImmediately, false, options?.uninterruptible ?? false));
|
|
5400
5507
|
}));
|
|
5401
5508
|
var forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterruptible3 = false) => {
|
|
5402
|
-
const
|
|
5403
|
-
const
|
|
5509
|
+
const parentRuntime = parent;
|
|
5510
|
+
const interruptible3 = uninterruptible3 === "inherit" ? parentRuntime.interruptible : !uninterruptible3;
|
|
5511
|
+
const child = new FiberImpl(parentRuntime.context, interruptible3);
|
|
5404
5512
|
if (immediate) {
|
|
5405
5513
|
child.evaluate(effect);
|
|
5406
5514
|
} else {
|
|
5407
|
-
|
|
5515
|
+
parentRuntime.currentDispatcher.scheduleTask(() => child.evaluate(effect), 0);
|
|
5408
5516
|
}
|
|
5409
5517
|
if (!daemon && !child._exit) {
|
|
5410
|
-
|
|
5411
|
-
child.addObserver(() =>
|
|
5518
|
+
parentRuntime.children().add(child);
|
|
5519
|
+
child.addObserver(() => parentRuntime._children.delete(child));
|
|
5412
5520
|
}
|
|
5413
5521
|
return child;
|
|
5414
5522
|
};
|
|
@@ -5715,10 +5823,8 @@ var useSpan = (name, ...args2) => {
|
|
|
5715
5823
|
return withFiber((fiber3) => {
|
|
5716
5824
|
const span2 = makeSpanUnsafe(fiber3, name, options);
|
|
5717
5825
|
const clock = fiber3.getRef(ClockRef);
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
span2.end(clock.currentTimeNanosUnsafe(), exit3);
|
|
5721
|
-
}));
|
|
5826
|
+
const timingEnabled = fiber3.getRef(TracerTimingEnabled);
|
|
5827
|
+
return onExit(internalCall(() => evaluate2(span2)), (exit3) => endSpan(span2, exit3, clock, timingEnabled));
|
|
5722
5828
|
});
|
|
5723
5829
|
};
|
|
5724
5830
|
var provideParentSpan = /* @__PURE__ */ provideService(ParentSpan);
|
|
@@ -5790,9 +5896,13 @@ var ClockImpl = class {
|
|
|
5790
5896
|
}
|
|
5791
5897
|
currentTimeMillis = /* @__PURE__ */ sync(() => this.currentTimeMillisUnsafe());
|
|
5792
5898
|
currentTimeNanosUnsafe() {
|
|
5793
|
-
return
|
|
5899
|
+
return wallTimeNanos();
|
|
5794
5900
|
}
|
|
5795
5901
|
currentTimeNanos = /* @__PURE__ */ sync(() => this.currentTimeNanosUnsafe());
|
|
5902
|
+
monotonicTimeNanosUnsafe() {
|
|
5903
|
+
return monotonicNowNanos();
|
|
5904
|
+
}
|
|
5905
|
+
monotonicTimeNanos = /* @__PURE__ */ sync(() => this.monotonicTimeNanosUnsafe());
|
|
5796
5906
|
sleep(duration) {
|
|
5797
5907
|
return this.sleepMillis(toMillis(duration));
|
|
5798
5908
|
}
|
|
@@ -5806,24 +5916,41 @@ var ClockImpl = class {
|
|
|
5806
5916
|
});
|
|
5807
5917
|
}
|
|
5808
5918
|
};
|
|
5809
|
-
var
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5919
|
+
var nanosPerMilli = /* @__PURE__ */ BigInt(1e6);
|
|
5920
|
+
var monotonicNowNanos = /* @__PURE__ */ (function() {
|
|
5921
|
+
const processHrtime = globalThis.process?.hrtime;
|
|
5922
|
+
if (typeof processHrtime?.bigint === "function") {
|
|
5923
|
+
return () => processHrtime.bigint();
|
|
5813
5924
|
}
|
|
5814
|
-
|
|
5925
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
5926
|
+
return () => BigInt(Math.round(performance.now() * 1e6));
|
|
5927
|
+
}
|
|
5928
|
+
let previous = /* @__PURE__ */ BigInt(0);
|
|
5815
5929
|
return () => {
|
|
5816
|
-
|
|
5817
|
-
|
|
5930
|
+
const current = BigInt(Date.now()) * nanosPerMilli;
|
|
5931
|
+
if (current > previous) {
|
|
5932
|
+
previous = current;
|
|
5933
|
+
}
|
|
5934
|
+
return previous;
|
|
5818
5935
|
};
|
|
5819
5936
|
})();
|
|
5820
|
-
var
|
|
5821
|
-
const
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5937
|
+
var wallTimeNanos = /* @__PURE__ */ (function() {
|
|
5938
|
+
const reanchorThresholdNanos = /* @__PURE__ */ BigInt(1e9);
|
|
5939
|
+
let origin;
|
|
5940
|
+
return () => {
|
|
5941
|
+
const monotonic = monotonicNowNanos();
|
|
5942
|
+
const wall = BigInt(Date.now()) * nanosPerMilli;
|
|
5943
|
+
if (origin === void 0) {
|
|
5944
|
+
origin = wall - monotonic;
|
|
5945
|
+
} else {
|
|
5946
|
+
const projected = origin + monotonic;
|
|
5947
|
+
const skew = wall > projected ? wall - projected : projected - wall;
|
|
5948
|
+
if (skew > reanchorThresholdNanos) {
|
|
5949
|
+
origin = wall - monotonic;
|
|
5950
|
+
}
|
|
5951
|
+
}
|
|
5952
|
+
return origin + monotonic;
|
|
5953
|
+
};
|
|
5827
5954
|
})();
|
|
5828
5955
|
var clockWith = (f) => withFiber((fiber3) => f(fiber3.getRef(ClockRef)));
|
|
5829
5956
|
var sleep = (duration) => clockWith((clock) => clock.sleep(fromInputUnsafe(duration)));
|
|
@@ -6086,13 +6213,14 @@ var reportCauseUnsafe = (fiber3, cause, defectsOnly) => {
|
|
|
6086
6213
|
reporters.forEach((reporter) => reporter.report(opts));
|
|
6087
6214
|
};
|
|
6088
6215
|
|
|
6089
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6216
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Exit.js
|
|
6217
|
+
var succeed4 = exitSucceed;
|
|
6090
6218
|
var failCause2 = exitFailCause;
|
|
6091
6219
|
var fail4 = exitFail;
|
|
6092
6220
|
var void_4 = exitVoid;
|
|
6093
6221
|
var isSuccess4 = exitIsSuccess;
|
|
6094
6222
|
|
|
6095
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6223
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Deferred.js
|
|
6096
6224
|
var TypeId5 = "~effect/Deferred";
|
|
6097
6225
|
var DeferredProto = {
|
|
6098
6226
|
[TypeId5]: {
|
|
@@ -6114,8 +6242,10 @@ var _await = (self) => callback((resume) => {
|
|
|
6114
6242
|
self.resumes ??= [];
|
|
6115
6243
|
self.resumes.push(resume);
|
|
6116
6244
|
return sync(() => {
|
|
6117
|
-
const
|
|
6118
|
-
|
|
6245
|
+
const resumes = self.resumes;
|
|
6246
|
+
if (resumes === void 0) return;
|
|
6247
|
+
const index = resumes.indexOf(resume);
|
|
6248
|
+
if (index >= 0) resumes.splice(index, 1);
|
|
6119
6249
|
});
|
|
6120
6250
|
});
|
|
6121
6251
|
var completeWith = /* @__PURE__ */ dual(2, (self, effect) => sync(() => doneUnsafe(self, effect)));
|
|
@@ -6132,16 +6262,16 @@ var doneUnsafe = (self, effect) => {
|
|
|
6132
6262
|
return true;
|
|
6133
6263
|
};
|
|
6134
6264
|
|
|
6135
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6265
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/References.js
|
|
6136
6266
|
var CurrentLogAnnotations2 = CurrentLogAnnotations;
|
|
6137
6267
|
var CurrentLogSpans2 = CurrentLogSpans;
|
|
6138
6268
|
|
|
6139
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6269
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Scope.js
|
|
6140
6270
|
var makeUnsafe3 = scopeMakeUnsafe;
|
|
6141
6271
|
var forkUnsafe2 = scopeForkUnsafe;
|
|
6142
6272
|
var close = scopeClose;
|
|
6143
6273
|
|
|
6144
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6274
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Layer.js
|
|
6145
6275
|
var TypeId6 = "~effect/Layer";
|
|
6146
6276
|
var MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
6147
6277
|
var memoMapReuse = (entry, scope3) => {
|
|
@@ -6206,11 +6336,13 @@ var MemoMapImpl = class {
|
|
|
6206
6336
|
return this.parent?.get(layer, scope3);
|
|
6207
6337
|
}
|
|
6208
6338
|
getOrElseMemoize(layer, scope3, build) {
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6339
|
+
return suspend(() => {
|
|
6340
|
+
const existing = this.get(layer, scope3);
|
|
6341
|
+
if (existing) {
|
|
6342
|
+
return existing;
|
|
6343
|
+
}
|
|
6344
|
+
return memoMapBuild(this, layer, scope3, build);
|
|
6345
|
+
});
|
|
6214
6346
|
}
|
|
6215
6347
|
};
|
|
6216
6348
|
var makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
@@ -6234,7 +6366,7 @@ var mergeAll2 = (...layers) => fromBuild((memoMap, scope3) => mergeAllEffect(lay
|
|
|
6234
6366
|
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
6367
|
var provide2 = /* @__PURE__ */ dual(2, (self, that) => provideWith(self, that, identity));
|
|
6236
6368
|
|
|
6237
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6369
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/ExecutionPlan.js
|
|
6238
6370
|
var TypeId7 = "~effect/ExecutionPlan";
|
|
6239
6371
|
var Proto2 = {
|
|
6240
6372
|
[TypeId7]: TypeId7,
|
|
@@ -6261,17 +6393,17 @@ var CurrentMetadata = /* @__PURE__ */ Reference("effect/ExecutionPlan/CurrentMet
|
|
|
6261
6393
|
})
|
|
6262
6394
|
});
|
|
6263
6395
|
|
|
6264
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6396
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Cause.js
|
|
6265
6397
|
var isFailReason2 = isFailReason;
|
|
6266
6398
|
var map6 = causeMap;
|
|
6267
6399
|
var findError2 = findError;
|
|
6268
6400
|
var isDone2 = isDone;
|
|
6269
6401
|
var done3 = done;
|
|
6270
6402
|
|
|
6271
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6403
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Data.js
|
|
6272
6404
|
var TaggedError2 = TaggedError;
|
|
6273
6405
|
|
|
6274
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6406
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Pull.js
|
|
6275
6407
|
var catchDone = /* @__PURE__ */ dual(2, (effect, f) => catchCauseFilter(effect, filterDoneLeftover, (l) => f(l)));
|
|
6276
6408
|
var filterDone = /* @__PURE__ */ composePassthrough(findError2, (e) => isDone2(e) ? succeed2(e) : fail2(e));
|
|
6277
6409
|
var filterDoneLeftover = /* @__PURE__ */ composePassthrough(findError2, (e) => isDone2(e) ? succeed2(e.value) : fail2(e));
|
|
@@ -6283,7 +6415,7 @@ var matchEffect2 = /* @__PURE__ */ dual(2, (self, options) => matchCauseEffect(s
|
|
|
6283
6415
|
}
|
|
6284
6416
|
}));
|
|
6285
6417
|
|
|
6286
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6418
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Schedule.js
|
|
6287
6419
|
var TypeId8 = "~effect/Schedule";
|
|
6288
6420
|
var CurrentMetadata2 = /* @__PURE__ */ Reference("effect/Schedule/CurrentMetadata", {
|
|
6289
6421
|
defaultValue: /* @__PURE__ */ constant({
|
|
@@ -6375,11 +6507,11 @@ var while_ = /* @__PURE__ */ dual(2, (self, predicate) => fromStep(map5(toStep(s
|
|
|
6375
6507
|
})));
|
|
6376
6508
|
var forever2 = /* @__PURE__ */ spaced(zero);
|
|
6377
6509
|
|
|
6378
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6510
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/layer.js
|
|
6379
6511
|
var provideLayer = (self, layer, options) => scopedWith((scope3) => flatMap4(options?.local ? buildWithMemoMap(layer, makeMemoMapUnsafe(), scope3) : buildWithScope(layer, scope3), (context3) => provideContext(self, context3)));
|
|
6380
6512
|
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
6513
|
|
|
6382
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6514
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/schedule.js
|
|
6383
6515
|
var repeatOrElse = /* @__PURE__ */ dual(3, (self, schedule2, orElse3) => flatMap4(toStepWithMetadata(schedule2), (step) => {
|
|
6384
6516
|
let meta2 = CurrentMetadata2.defaultValue();
|
|
6385
6517
|
return catch_(forever(tap3(flatMap4(suspend(() => provideService(self, CurrentMetadata2, meta2)), step), (meta_) => sync(() => {
|
|
@@ -6450,8 +6582,52 @@ var buildFromOptions = (options) => {
|
|
|
6450
6582
|
return schedule2;
|
|
6451
6583
|
};
|
|
6452
6584
|
|
|
6453
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6454
|
-
var
|
|
6585
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/executionPlan.js
|
|
6586
|
+
var makeEventEmitter = (onEvent, currentMetadata) => {
|
|
6587
|
+
let lastStepIndex = -1;
|
|
6588
|
+
let stepAttempt = 0;
|
|
6589
|
+
const emit = (event) => ignoreCause(onEvent(event));
|
|
6590
|
+
return {
|
|
6591
|
+
begin: clockWith((clock) => suspend(() => {
|
|
6592
|
+
const meta2 = currentMetadata();
|
|
6593
|
+
if (meta2.stepIndex !== lastStepIndex) {
|
|
6594
|
+
lastStepIndex = meta2.stepIndex;
|
|
6595
|
+
stepAttempt = 0;
|
|
6596
|
+
}
|
|
6597
|
+
stepAttempt++;
|
|
6598
|
+
const state = {
|
|
6599
|
+
attempt: meta2.attempt,
|
|
6600
|
+
stepAttempt,
|
|
6601
|
+
stepIndex: meta2.stepIndex,
|
|
6602
|
+
startNanos: clock.monotonicTimeNanosUnsafe()
|
|
6603
|
+
};
|
|
6604
|
+
return as2(emit({
|
|
6605
|
+
_tag: "AttemptStart",
|
|
6606
|
+
attempt: state.attempt,
|
|
6607
|
+
stepAttempt: state.stepAttempt,
|
|
6608
|
+
stepIndex: state.stepIndex
|
|
6609
|
+
}), state);
|
|
6610
|
+
})),
|
|
6611
|
+
end: (state, exit3) => clockWith((clock) => {
|
|
6612
|
+
const duration = nanos(clock.monotonicTimeNanosUnsafe() - state.startNanos);
|
|
6613
|
+
return emit(exit3._tag === "Success" ? {
|
|
6614
|
+
_tag: "AttemptSuccess",
|
|
6615
|
+
attempt: state.attempt,
|
|
6616
|
+
stepAttempt: state.stepAttempt,
|
|
6617
|
+
stepIndex: state.stepIndex,
|
|
6618
|
+
duration
|
|
6619
|
+
} : {
|
|
6620
|
+
_tag: "AttemptFailure",
|
|
6621
|
+
attempt: state.attempt,
|
|
6622
|
+
stepAttempt: state.stepAttempt,
|
|
6623
|
+
stepIndex: state.stepIndex,
|
|
6624
|
+
duration,
|
|
6625
|
+
cause: exit3.cause
|
|
6626
|
+
});
|
|
6627
|
+
})
|
|
6628
|
+
};
|
|
6629
|
+
};
|
|
6630
|
+
var withExecutionPlan = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, plan, options) => suspend(() => {
|
|
6455
6631
|
let i = 0;
|
|
6456
6632
|
let meta2 = {
|
|
6457
6633
|
attempt: 0,
|
|
@@ -6464,12 +6640,14 @@ var withExecutionPlan = /* @__PURE__ */ dual(2, (self, plan) => suspend(() => {
|
|
|
6464
6640
|
};
|
|
6465
6641
|
return meta2;
|
|
6466
6642
|
}));
|
|
6643
|
+
const emitter = options?.onEvent === void 0 ? void 0 : makeEventEmitter(options.onEvent, () => meta2);
|
|
6644
|
+
const instrument = emitter === void 0 ? identity : (attempt) => uninterruptibleMask((restore) => flatMap4(emitter.begin, (state) => onExit(restore(attempt), (exit3) => emitter.end(state, exit3))));
|
|
6467
6645
|
let result3;
|
|
6468
6646
|
return flatMap4(whileLoop({
|
|
6469
6647
|
while: () => i < plan.steps.length && (result3 === void 0 || isFailure2(result3)),
|
|
6470
6648
|
body() {
|
|
6471
6649
|
const step = plan.steps[i];
|
|
6472
|
-
let nextEffect = provideMeta(provide3(self, step.provide));
|
|
6650
|
+
let nextEffect = provideMeta(instrument(provide3(self, step.provide)));
|
|
6473
6651
|
if (result3) {
|
|
6474
6652
|
let attempted = false;
|
|
6475
6653
|
const wrapped = nextEffect;
|
|
@@ -6509,7 +6687,7 @@ var scheduleFromStep = (step, first) => {
|
|
|
6509
6687
|
};
|
|
6510
6688
|
var scheduleOnce = /* @__PURE__ */ recurs(1);
|
|
6511
6689
|
|
|
6512
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6690
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Request.js
|
|
6513
6691
|
var TypeId9 = "~effect/Request";
|
|
6514
6692
|
var requestVariance = /* @__PURE__ */ byReferenceUnsafe({
|
|
6515
6693
|
/* c8 ignore next */
|
|
@@ -6525,7 +6703,7 @@ var RequestPrototype = {
|
|
|
6525
6703
|
};
|
|
6526
6704
|
var makeEntry = (options) => options;
|
|
6527
6705
|
|
|
6528
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6706
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/request.js
|
|
6529
6707
|
var request = /* @__PURE__ */ dual(2, (self, resolver) => {
|
|
6530
6708
|
const withResolver = (resolver2) => callback((resume) => {
|
|
6531
6709
|
const entry = addEntry(resolver2, self, resume, getCurrentFiber());
|
|
@@ -6635,7 +6813,7 @@ function runBatch(batch) {
|
|
|
6635
6813
|
return batch.run;
|
|
6636
6814
|
}
|
|
6637
6815
|
|
|
6638
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6816
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Metric.js
|
|
6639
6817
|
var CurrentMetricAttributesKey = "effect/Metric/CurrentMetricAttributes";
|
|
6640
6818
|
var CurrentMetricAttributes = /* @__PURE__ */ Reference(CurrentMetricAttributesKey, {
|
|
6641
6819
|
defaultValue: () => ({})
|
|
@@ -6717,10 +6895,7 @@ function makeKey(metric, attributes) {
|
|
|
6717
6895
|
return key;
|
|
6718
6896
|
}
|
|
6719
6897
|
function serializeAttributes(attributes) {
|
|
6720
|
-
return
|
|
6721
|
-
}
|
|
6722
|
-
function serializeEntries(entries) {
|
|
6723
|
-
return entries.map(([key, value]) => `${key}=${value}`).join(",");
|
|
6898
|
+
return JSON.stringify(Array.isArray(attributes) ? attributes : Object.entries(attributes));
|
|
6724
6899
|
}
|
|
6725
6900
|
function mergeAttributes(self, other) {
|
|
6726
6901
|
return {
|
|
@@ -6738,7 +6913,7 @@ function attributesToRecord(attributes) {
|
|
|
6738
6913
|
return attributes;
|
|
6739
6914
|
}
|
|
6740
6915
|
|
|
6741
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
6916
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Effect.js
|
|
6742
6917
|
var TypeId11 = EffectTypeId;
|
|
6743
6918
|
var isEffect2 = isEffect;
|
|
6744
6919
|
var all4 = all3;
|
|
@@ -6751,7 +6926,7 @@ var forEach3 = forEach2;
|
|
|
6751
6926
|
var whileLoop2 = whileLoop;
|
|
6752
6927
|
var promise2 = promise;
|
|
6753
6928
|
var tryPromise2 = tryPromise;
|
|
6754
|
-
var
|
|
6929
|
+
var succeed5 = succeed3;
|
|
6755
6930
|
var succeedNone3 = succeedNone2;
|
|
6756
6931
|
var succeedSome3 = succeedSome2;
|
|
6757
6932
|
var suspend2 = suspend;
|
|
@@ -6779,7 +6954,7 @@ var fromOption5 = fromOption4;
|
|
|
6779
6954
|
var transposeOption3 = transposeOption2;
|
|
6780
6955
|
var fromNullishOr5 = fromNullishOr4;
|
|
6781
6956
|
var flatMap5 = flatMap4;
|
|
6782
|
-
var
|
|
6957
|
+
var flatten5 = flatten4;
|
|
6783
6958
|
var andThen4 = andThen3;
|
|
6784
6959
|
var tap4 = tap3;
|
|
6785
6960
|
var result2 = result;
|
|
@@ -6981,9 +7156,9 @@ var trackDefects = /* @__PURE__ */ dual((args2) => isEffect2(args2[0]), (self, m
|
|
|
6981
7156
|
return update(metric, input);
|
|
6982
7157
|
}));
|
|
6983
7158
|
var trackDuration = /* @__PURE__ */ dual((args2) => isEffect2(args2[0]), (self, metric, f) => clockWith2((clock) => {
|
|
6984
|
-
const startTime = clock.
|
|
7159
|
+
const startTime = clock.monotonicTimeNanosUnsafe();
|
|
6985
7160
|
return onExit2(self, () => {
|
|
6986
|
-
const endTime = clock.
|
|
7161
|
+
const endTime = clock.monotonicTimeNanosUnsafe();
|
|
6987
7162
|
const duration = subtract(fromInputUnsafe(endTime), fromInputUnsafe(startTime));
|
|
6988
7163
|
const input = f === void 0 ? duration : internalCall(() => f(duration));
|
|
6989
7164
|
return update(metric, input);
|
|
@@ -6992,10 +7167,11 @@ var trackDuration = /* @__PURE__ */ dual((args2) => isEffect2(args2[0]), (self,
|
|
|
6992
7167
|
var Transaction = class extends (/* @__PURE__ */ Service()("effect/Effect/Transaction")) {
|
|
6993
7168
|
};
|
|
6994
7169
|
var tx = (effect) => withFiber2((fiber3) => {
|
|
6995
|
-
|
|
7170
|
+
let state = getOrUndefined2(fiber3.context, Transaction);
|
|
7171
|
+
if (state) {
|
|
6996
7172
|
return effect;
|
|
6997
7173
|
}
|
|
6998
|
-
|
|
7174
|
+
state = {
|
|
6999
7175
|
journal: /* @__PURE__ */ new Map(),
|
|
7000
7176
|
retry: false
|
|
7001
7177
|
};
|
|
@@ -7021,9 +7197,9 @@ var tx = (effect) => withFiber2((fiber3) => {
|
|
|
7021
7197
|
});
|
|
7022
7198
|
var isTransactionConsistent = (state) => {
|
|
7023
7199
|
for (const [ref, {
|
|
7024
|
-
version
|
|
7200
|
+
version
|
|
7025
7201
|
}] of state.journal) {
|
|
7026
|
-
if (ref.version !==
|
|
7202
|
+
if (ref.version !== version) {
|
|
7027
7203
|
return false;
|
|
7028
7204
|
}
|
|
7029
7205
|
}
|
|
@@ -7076,7 +7252,7 @@ var effectify = (fn3, onError3, onSyncError) => (...args2) => callback2((resume)
|
|
|
7076
7252
|
if (err) {
|
|
7077
7253
|
resume(fail5(onError3 ? onError3(err, args2) : err));
|
|
7078
7254
|
} else {
|
|
7079
|
-
resume(
|
|
7255
|
+
resume(succeed5(result3));
|
|
7080
7256
|
}
|
|
7081
7257
|
});
|
|
7082
7258
|
} catch (err) {
|
|
@@ -7093,7 +7269,7 @@ var flatMapEager2 = flatMapEager;
|
|
|
7093
7269
|
var catchEager2 = catchEager;
|
|
7094
7270
|
var fnUntracedEager2 = fnUntracedEager;
|
|
7095
7271
|
|
|
7096
|
-
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-
|
|
7272
|
+
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.109/node_modules/effect-oxlint/dist/RuleContext.js
|
|
7097
7273
|
var RuleContextBase = Service()("effect-oxlint/RuleContext");
|
|
7098
7274
|
var RuleContext = class extends RuleContextBase {
|
|
7099
7275
|
};
|
|
@@ -7114,7 +7290,7 @@ service2(RuleContext).pipe(map7((ctx) => ctx.sourceCode));
|
|
|
7114
7290
|
service2(RuleContext).pipe(map7((ctx) => ctx.sourceCode.text));
|
|
7115
7291
|
service2(RuleContext).pipe(map7((ctx) => ctx.sourceCode.ast));
|
|
7116
7292
|
|
|
7117
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7293
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Encoding.js
|
|
7118
7294
|
var EncodingErrorTypeId = "~effect/encoding/EncodingError";
|
|
7119
7295
|
var EncodingError = class extends (/* @__PURE__ */ TaggedError2("EncodingError")) {
|
|
7120
7296
|
/**
|
|
@@ -7206,39 +7382,45 @@ function getBase64Code(charCode) {
|
|
|
7206
7382
|
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
7383
|
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
7384
|
|
|
7209
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7385
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/schema/annotations.js
|
|
7210
7386
|
function resolve(ast) {
|
|
7211
7387
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
7212
7388
|
}
|
|
7213
|
-
function resolveAt(key) {
|
|
7214
|
-
return (ast) => resolve(ast)?.[key];
|
|
7215
|
-
}
|
|
7216
7389
|
var STRUCTURAL_ANNOTATION_KEY = "~structural";
|
|
7217
7390
|
var SENTINELS_ANNOTATION_KEY = "~sentinels";
|
|
7218
|
-
var
|
|
7391
|
+
var CONSTRUCTOR_ANNOTATION_KEY = "~constructor";
|
|
7219
7392
|
var getExpected = /* @__PURE__ */ memoize((ast) => {
|
|
7220
|
-
const identifier2 =
|
|
7393
|
+
const identifier2 = resolve(ast)?.identifier;
|
|
7221
7394
|
if (typeof identifier2 === "string") return identifier2;
|
|
7222
7395
|
return ast.getExpected(getExpected);
|
|
7223
7396
|
});
|
|
7224
7397
|
|
|
7225
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7398
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/schema/parser.js
|
|
7399
|
+
var missing = /* @__PURE__ */ Symbol();
|
|
7400
|
+
var succeed6 = succeed4;
|
|
7401
|
+
var missingExit = /* @__PURE__ */ succeed6(missing);
|
|
7402
|
+
var sameExit = /* @__PURE__ */ succeed6(missing);
|
|
7403
|
+
var toOption = (value) => value === missing ? none2() : some2(value);
|
|
7404
|
+
var fromOptionExit = (option3) => option3._tag === "None" ? missingExit : succeed6(option3.value);
|
|
7405
|
+
|
|
7406
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/SchemaIssue.js
|
|
7226
7407
|
var TypeId12 = "~effect/SchemaIssue/Issue";
|
|
7227
7408
|
function isIssue(u) {
|
|
7228
7409
|
return hasProperty(u, TypeId12) && u[TypeId12] === TypeId12;
|
|
7229
7410
|
}
|
|
7411
|
+
function hasInput(issue) {
|
|
7412
|
+
return Object.hasOwn(issue, "input");
|
|
7413
|
+
}
|
|
7230
7414
|
var Base = class {
|
|
7231
7415
|
[TypeId12] = TypeId12;
|
|
7232
|
-
|
|
7233
|
-
|
|
7416
|
+
constructor(input, options) {
|
|
7417
|
+
if (options?.reportInput === true && input !== missing) {
|
|
7418
|
+
this.input = input;
|
|
7419
|
+
}
|
|
7234
7420
|
}
|
|
7235
7421
|
};
|
|
7236
7422
|
var Filter = class extends Base {
|
|
7237
7423
|
_tag = "Filter";
|
|
7238
|
-
/**
|
|
7239
|
-
* The input value that caused the issue.
|
|
7240
|
-
*/
|
|
7241
|
-
actual;
|
|
7242
7424
|
/**
|
|
7243
7425
|
* The filter that failed.
|
|
7244
7426
|
*/
|
|
@@ -7247,9 +7429,8 @@ var Filter = class extends Base {
|
|
|
7247
7429
|
* The issue that occurred.
|
|
7248
7430
|
*/
|
|
7249
7431
|
issue;
|
|
7250
|
-
constructor(
|
|
7251
|
-
super();
|
|
7252
|
-
this.actual = actual;
|
|
7432
|
+
constructor(filter7, issue, input, options) {
|
|
7433
|
+
super(input, options);
|
|
7253
7434
|
this.filter = filter7;
|
|
7254
7435
|
this.issue = issue;
|
|
7255
7436
|
}
|
|
@@ -7260,18 +7441,13 @@ var Encoding = class extends Base {
|
|
|
7260
7441
|
* The schema that caused the issue.
|
|
7261
7442
|
*/
|
|
7262
7443
|
ast;
|
|
7263
|
-
/**
|
|
7264
|
-
* The input value that caused the issue.
|
|
7265
|
-
*/
|
|
7266
|
-
actual;
|
|
7267
7444
|
/**
|
|
7268
7445
|
* The issue that occurred.
|
|
7269
7446
|
*/
|
|
7270
7447
|
issue;
|
|
7271
|
-
constructor(ast,
|
|
7272
|
-
super();
|
|
7448
|
+
constructor(ast, issue, input, options) {
|
|
7449
|
+
super(input, options);
|
|
7273
7450
|
this.ast = ast;
|
|
7274
|
-
this.actual = actual;
|
|
7275
7451
|
this.issue = issue;
|
|
7276
7452
|
}
|
|
7277
7453
|
};
|
|
@@ -7308,14 +7484,9 @@ var UnexpectedKey = class extends Base {
|
|
|
7308
7484
|
* The schema that caused the issue.
|
|
7309
7485
|
*/
|
|
7310
7486
|
ast;
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
*/
|
|
7314
|
-
actual;
|
|
7315
|
-
constructor(ast, actual) {
|
|
7316
|
-
super();
|
|
7487
|
+
constructor(ast, input, options) {
|
|
7488
|
+
super(input, options);
|
|
7317
7489
|
this.ast = ast;
|
|
7318
|
-
this.actual = actual;
|
|
7319
7490
|
}
|
|
7320
7491
|
};
|
|
7321
7492
|
var Composite = class extends Base {
|
|
@@ -7324,18 +7495,13 @@ var Composite = class extends Base {
|
|
|
7324
7495
|
* The schema that caused the issue.
|
|
7325
7496
|
*/
|
|
7326
7497
|
ast;
|
|
7327
|
-
/**
|
|
7328
|
-
* The input value that caused the issue.
|
|
7329
|
-
*/
|
|
7330
|
-
actual;
|
|
7331
7498
|
/**
|
|
7332
7499
|
* The issues that occurred.
|
|
7333
7500
|
*/
|
|
7334
7501
|
issues;
|
|
7335
|
-
constructor(ast,
|
|
7336
|
-
super();
|
|
7502
|
+
constructor(ast, issues, input, options) {
|
|
7503
|
+
super(input, options);
|
|
7337
7504
|
this.ast = ast;
|
|
7338
|
-
this.actual = actual;
|
|
7339
7505
|
this.issues = issues;
|
|
7340
7506
|
}
|
|
7341
7507
|
};
|
|
@@ -7345,29 +7511,19 @@ var InvalidType = class extends Base {
|
|
|
7345
7511
|
* The schema that caused the issue.
|
|
7346
7512
|
*/
|
|
7347
7513
|
ast;
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
*/
|
|
7351
|
-
actual;
|
|
7352
|
-
constructor(ast, actual) {
|
|
7353
|
-
super();
|
|
7514
|
+
constructor(ast, input, options) {
|
|
7515
|
+
super(input, options);
|
|
7354
7516
|
this.ast = ast;
|
|
7355
|
-
this.actual = actual;
|
|
7356
7517
|
}
|
|
7357
7518
|
};
|
|
7358
7519
|
var InvalidValue = class extends Base {
|
|
7359
7520
|
_tag = "InvalidValue";
|
|
7360
|
-
/**
|
|
7361
|
-
* The value that caused the issue.
|
|
7362
|
-
*/
|
|
7363
|
-
actual;
|
|
7364
7521
|
/**
|
|
7365
7522
|
* The metadata for the issue.
|
|
7366
7523
|
*/
|
|
7367
7524
|
annotations;
|
|
7368
|
-
constructor(
|
|
7369
|
-
super();
|
|
7370
|
-
this.actual = actual;
|
|
7525
|
+
constructor(annotations, input, options) {
|
|
7526
|
+
super(input, options);
|
|
7371
7527
|
this.annotations = annotations;
|
|
7372
7528
|
}
|
|
7373
7529
|
};
|
|
@@ -7377,18 +7533,13 @@ var AnyOf = class extends Base {
|
|
|
7377
7533
|
* The schema that caused the issue.
|
|
7378
7534
|
*/
|
|
7379
7535
|
ast;
|
|
7380
|
-
/**
|
|
7381
|
-
* The input value that caused the issue.
|
|
7382
|
-
*/
|
|
7383
|
-
actual;
|
|
7384
7536
|
/**
|
|
7385
7537
|
* The issues that occurred.
|
|
7386
7538
|
*/
|
|
7387
7539
|
issues;
|
|
7388
|
-
constructor(ast,
|
|
7389
|
-
super();
|
|
7540
|
+
constructor(ast, issues, input, options) {
|
|
7541
|
+
super(input, options);
|
|
7390
7542
|
this.ast = ast;
|
|
7391
|
-
this.actual = actual;
|
|
7392
7543
|
this.issues = issues;
|
|
7393
7544
|
}
|
|
7394
7545
|
};
|
|
@@ -7398,127 +7549,85 @@ var OneOf = class extends Base {
|
|
|
7398
7549
|
* The schema that caused the issue.
|
|
7399
7550
|
*/
|
|
7400
7551
|
ast;
|
|
7401
|
-
/**
|
|
7402
|
-
* The input value that caused the issue.
|
|
7403
|
-
*/
|
|
7404
|
-
actual;
|
|
7405
7552
|
/**
|
|
7406
7553
|
* The schemas that were successful.
|
|
7407
7554
|
*/
|
|
7408
7555
|
successes;
|
|
7409
|
-
constructor(ast,
|
|
7410
|
-
super();
|
|
7556
|
+
constructor(ast, successes, input, options) {
|
|
7557
|
+
super(input, options);
|
|
7411
7558
|
this.ast = ast;
|
|
7412
|
-
this.actual = actual;
|
|
7413
7559
|
this.successes = successes;
|
|
7414
7560
|
}
|
|
7415
7561
|
};
|
|
7416
|
-
function makeFilterIssue(input,
|
|
7562
|
+
function makeFilterIssue(entry, input, options) {
|
|
7417
7563
|
if (isIssue(entry)) {
|
|
7418
7564
|
return entry;
|
|
7419
7565
|
}
|
|
7420
7566
|
if (typeof entry === "string") {
|
|
7421
|
-
return new InvalidValue(
|
|
7567
|
+
return new InvalidValue({
|
|
7422
7568
|
message: entry
|
|
7423
|
-
});
|
|
7569
|
+
}, input, options);
|
|
7424
7570
|
}
|
|
7425
|
-
const inner = typeof entry.issue === "string" ? new InvalidValue(
|
|
7571
|
+
const inner = typeof entry.issue === "string" ? new InvalidValue({
|
|
7426
7572
|
message: entry.issue
|
|
7427
|
-
}) : entry.issue;
|
|
7573
|
+
}, input, options) : entry.issue;
|
|
7428
7574
|
return new Pointer(entry.path, inner);
|
|
7429
7575
|
}
|
|
7430
|
-
function makeSingle(input,
|
|
7576
|
+
function makeSingle(out, input, options) {
|
|
7431
7577
|
if (out === void 0) {
|
|
7432
7578
|
return void 0;
|
|
7433
7579
|
}
|
|
7434
7580
|
if (typeof out === "boolean") {
|
|
7435
|
-
return out ? void 0 : new InvalidValue(
|
|
7581
|
+
return out ? void 0 : new InvalidValue(void 0, input, options);
|
|
7436
7582
|
}
|
|
7437
|
-
return makeFilterIssue(input,
|
|
7583
|
+
return makeFilterIssue(out, input, options);
|
|
7438
7584
|
}
|
|
7439
|
-
function
|
|
7585
|
+
function normalizeFilterOutput(ast, out, input, options) {
|
|
7440
7586
|
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)));
|
|
7587
|
+
if (!isReadonlyArrayNonEmpty(out)) {
|
|
7588
|
+
return void 0;
|
|
7446
7589
|
}
|
|
7447
|
-
return
|
|
7590
|
+
return out.length === 1 ? makeFilterIssue(out[0], input, options) : new Composite(ast, map4(out, (entry) => makeFilterIssue(entry, input, options)), input, options);
|
|
7448
7591
|
}
|
|
7449
|
-
return makeSingle(input,
|
|
7592
|
+
return makeSingle(out, input, options);
|
|
7450
7593
|
}
|
|
7451
7594
|
var defaultLeafHook = (issue) => {
|
|
7452
7595
|
const message = findMessage(issue);
|
|
7453
7596
|
if (message !== void 0) return message;
|
|
7454
7597
|
switch (issue._tag) {
|
|
7455
7598
|
case "InvalidType":
|
|
7456
|
-
return getExpectedMessage(getExpected(issue.ast),
|
|
7457
|
-
case "InvalidValue":
|
|
7458
|
-
|
|
7599
|
+
return getExpectedMessage(getExpected(issue.ast), issue);
|
|
7600
|
+
case "InvalidValue": {
|
|
7601
|
+
const expected = findExpected(issue);
|
|
7602
|
+
if (expected !== void 0) return getExpectedMessage(expected, issue);
|
|
7603
|
+
const input = formatInput(issue);
|
|
7604
|
+
return input === void 0 ? "Expected a valid value" : `Invalid data ${input}`;
|
|
7605
|
+
}
|
|
7459
7606
|
case "MissingKey":
|
|
7460
7607
|
return "Missing key";
|
|
7461
|
-
case "UnexpectedKey":
|
|
7462
|
-
|
|
7608
|
+
case "UnexpectedKey": {
|
|
7609
|
+
const input = formatInput(issue);
|
|
7610
|
+
return input === void 0 ? "Expected no excess property" : `Unexpected key with value ${input}`;
|
|
7611
|
+
}
|
|
7463
7612
|
case "Forbidden":
|
|
7464
7613
|
return "Forbidden operation";
|
|
7465
|
-
case "OneOf":
|
|
7466
|
-
|
|
7614
|
+
case "OneOf": {
|
|
7615
|
+
const input = formatInput(issue);
|
|
7616
|
+
return input === void 0 ? "Expected exactly one member to match" : `Expected exactly one member to match the input ${input}`;
|
|
7617
|
+
}
|
|
7467
7618
|
}
|
|
7468
7619
|
};
|
|
7469
|
-
var defaultCheckHook = (issue) =>
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
function getExpectedMessage(expected, actual) {
|
|
7473
|
-
return `Expected ${expected}, got ${actual}`;
|
|
7620
|
+
var defaultCheckHook = (issue) => findMessage(issue.issue) ?? findMessage(issue);
|
|
7621
|
+
function formatInput(issue) {
|
|
7622
|
+
return hasInput(issue) ? format(issue.input) : void 0;
|
|
7474
7623
|
}
|
|
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
|
-
}
|
|
7624
|
+
function findExpected(issue) {
|
|
7625
|
+
const expected = issue.annotations?.expected;
|
|
7626
|
+
return typeof expected === "string" ? expected : void 0;
|
|
7627
|
+
}
|
|
7628
|
+
function getExpectedMessage(expected, issue) {
|
|
7629
|
+
const input = formatInput(issue);
|
|
7630
|
+
return input === void 0 ? `Expected ${expected}` : `Expected ${expected}, got ${input}`;
|
|
7522
7631
|
}
|
|
7523
7632
|
function formatCheck(check) {
|
|
7524
7633
|
const expected = check.annotations?.expected;
|
|
@@ -7531,48 +7640,53 @@ function formatCheck(check) {
|
|
|
7531
7640
|
}
|
|
7532
7641
|
}
|
|
7533
7642
|
function makeFormatterDefault() {
|
|
7534
|
-
return (issue) =>
|
|
7643
|
+
return (issue) => formatIssue(issue, "");
|
|
7535
7644
|
}
|
|
7536
7645
|
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) {
|
|
7646
|
+
function formatIssue(issue, path) {
|
|
7647
|
+
let message;
|
|
7547
7648
|
switch (issue._tag) {
|
|
7548
|
-
case "
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
return getMessageAnnotation(issue.filter.annotations);
|
|
7649
|
+
case "Filter": {
|
|
7650
|
+
const annotated = defaultCheckHook(issue);
|
|
7651
|
+
if (annotated !== void 0) {
|
|
7652
|
+
message = annotated;
|
|
7653
|
+
} else {
|
|
7654
|
+
if (issue.issue._tag !== "InvalidValue") {
|
|
7655
|
+
return formatIssue(issue.issue, path);
|
|
7656
|
+
}
|
|
7657
|
+
const expected = findExpected(issue.issue);
|
|
7658
|
+
message = expected === void 0 ? getExpectedMessage(formatCheck(issue.filter), issue) : getExpectedMessage(expected, issue.issue);
|
|
7659
|
+
}
|
|
7660
|
+
break;
|
|
7661
|
+
}
|
|
7562
7662
|
case "Encoding":
|
|
7563
|
-
return
|
|
7663
|
+
return formatIssue(issue.issue, path);
|
|
7664
|
+
case "Pointer":
|
|
7665
|
+
return formatIssue(issue.issue, path + formatPath(issue.path));
|
|
7666
|
+
case "Composite":
|
|
7667
|
+
case "AnyOf": {
|
|
7668
|
+
if (issue._tag === "Composite" || issue.issues.length > 0) {
|
|
7669
|
+
return issue.issues.map((issue2) => formatIssue(issue2, path)).join("\n");
|
|
7670
|
+
}
|
|
7671
|
+
message = findMessage(issue) ?? getExpectedMessage(getExpected(issue.ast), issue);
|
|
7672
|
+
break;
|
|
7673
|
+
}
|
|
7674
|
+
default:
|
|
7675
|
+
message = defaultLeafHook(issue);
|
|
7676
|
+
break;
|
|
7564
7677
|
}
|
|
7678
|
+
return path ? `${message}
|
|
7679
|
+
at ${path}` : message;
|
|
7565
7680
|
}
|
|
7566
|
-
function
|
|
7567
|
-
|
|
7681
|
+
function findMessage(issue) {
|
|
7682
|
+
if (issue._tag === "Pointer") return;
|
|
7683
|
+
if (issue._tag === "Encoding") return findMessage(issue.issue);
|
|
7684
|
+
const annotations = issue._tag === "Filter" ? issue.filter.annotations : "annotations" in issue ? issue.annotations : issue.ast.annotations;
|
|
7685
|
+
const message = annotations?.[issue._tag === "MissingKey" ? "messageMissingKey" : issue._tag === "UnexpectedKey" ? "messageUnexpectedKey" : "message"];
|
|
7568
7686
|
if (typeof message === "string") return message;
|
|
7569
7687
|
}
|
|
7570
|
-
function formatOption(actual) {
|
|
7571
|
-
if (isNone2(actual)) return "no value provided";
|
|
7572
|
-
return format(actual.value);
|
|
7573
|
-
}
|
|
7574
7688
|
|
|
7575
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7689
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/schema/cause.js
|
|
7576
7690
|
function getSchemaIssue(cause) {
|
|
7577
7691
|
let issue;
|
|
7578
7692
|
for (const reason of cause.reasons) {
|
|
@@ -7593,7 +7707,7 @@ function getSchemaIssueOrThrow(cause, message) {
|
|
|
7593
7707
|
return issue;
|
|
7594
7708
|
}
|
|
7595
7709
|
|
|
7596
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7710
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/SchemaGetter.js
|
|
7597
7711
|
var Getter = class _Getter extends Class {
|
|
7598
7712
|
run;
|
|
7599
7713
|
constructor(run2) {
|
|
@@ -7613,7 +7727,7 @@ var Getter = class _Getter extends Class {
|
|
|
7613
7727
|
return new _Getter((oe, options) => this.run(oe, options).pipe(flatMapEager2((ot) => other.run(ot, options))));
|
|
7614
7728
|
}
|
|
7615
7729
|
};
|
|
7616
|
-
var passthrough_ = /* @__PURE__ */ new Getter(
|
|
7730
|
+
var passthrough_ = /* @__PURE__ */ new Getter(succeed5);
|
|
7617
7731
|
function isPassthrough(getter) {
|
|
7618
7732
|
return getter.run === passthrough_.run;
|
|
7619
7733
|
}
|
|
@@ -7630,12 +7744,12 @@ function transformOrFail(f) {
|
|
|
7630
7744
|
return onSome((e, options) => f(e, options).pipe(mapEager2(some2)));
|
|
7631
7745
|
}
|
|
7632
7746
|
function transformOptional(f) {
|
|
7633
|
-
return new Getter((oe) =>
|
|
7747
|
+
return new Getter((oe) => succeed5(f(oe)));
|
|
7634
7748
|
}
|
|
7635
7749
|
function withDefault(defaultValue) {
|
|
7636
7750
|
return new Getter((o) => {
|
|
7637
7751
|
const filtered = filter(o, isNotUndefined);
|
|
7638
|
-
return isSome2(filtered) ?
|
|
7752
|
+
return isSome2(filtered) ? succeed5(filtered) : mapEager2(defaultValue, some2);
|
|
7639
7753
|
});
|
|
7640
7754
|
}
|
|
7641
7755
|
function String2() {
|
|
@@ -7648,12 +7762,12 @@ function encodeBase642() {
|
|
|
7648
7762
|
return transform(encodeBase64);
|
|
7649
7763
|
}
|
|
7650
7764
|
function decodeBase642() {
|
|
7651
|
-
return transformOrFail((input) => mapErrorEager2(fromResult2(decodeBase64(input)), (
|
|
7652
|
-
|
|
7653
|
-
})));
|
|
7765
|
+
return transformOrFail((input, options) => mapErrorEager2(fromResult2(decodeBase64(input)), () => new InvalidValue({
|
|
7766
|
+
expected: "a valid Base64 string"
|
|
7767
|
+
}, input, options)));
|
|
7654
7768
|
}
|
|
7655
7769
|
|
|
7656
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7770
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/SchemaTransformation.js
|
|
7657
7771
|
var TypeId13 = "~effect/SchemaTransformation/Transformation";
|
|
7658
7772
|
var Transformation = class _Transformation {
|
|
7659
7773
|
[TypeId13] = TypeId13;
|
|
@@ -7674,7 +7788,7 @@ var Transformation = class _Transformation {
|
|
|
7674
7788
|
function isTransformation(u) {
|
|
7675
7789
|
return hasProperty(u, TypeId13) && u[TypeId13] === TypeId13;
|
|
7676
7790
|
}
|
|
7677
|
-
var
|
|
7791
|
+
var make10 = (options) => {
|
|
7678
7792
|
if (isTransformation(options)) {
|
|
7679
7793
|
return options;
|
|
7680
7794
|
}
|
|
@@ -7692,14 +7806,14 @@ function passthrough3() {
|
|
|
7692
7806
|
}
|
|
7693
7807
|
var numberFromString = /* @__PURE__ */ new Transformation(/* @__PURE__ */ Number3(), /* @__PURE__ */ String2());
|
|
7694
7808
|
var urlFromString = /* @__PURE__ */ transformOrFail2({
|
|
7695
|
-
decode: (s) => URL.canParse(s) ?
|
|
7696
|
-
|
|
7697
|
-
})),
|
|
7698
|
-
encode: (url) =>
|
|
7809
|
+
decode: (s, options) => URL.canParse(s) ? succeed5(new URL(s)) : fail5(new InvalidValue({
|
|
7810
|
+
expected: "a valid URL string"
|
|
7811
|
+
}, s, options)),
|
|
7812
|
+
encode: (url) => succeed5(url.href)
|
|
7699
7813
|
});
|
|
7700
7814
|
var uint8ArrayFromBase64String = /* @__PURE__ */ new Transformation(/* @__PURE__ */ decodeBase642(), /* @__PURE__ */ encodeBase642());
|
|
7701
7815
|
|
|
7702
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
7816
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/SchemaAST.js
|
|
7703
7817
|
function makeGuard(tag2) {
|
|
7704
7818
|
return (ast) => ast._tag === tag2;
|
|
7705
7819
|
}
|
|
@@ -7709,6 +7823,7 @@ var isLiteral = /* @__PURE__ */ makeGuard("Literal");
|
|
|
7709
7823
|
var isUniqueSymbol = /* @__PURE__ */ makeGuard("UniqueSymbol");
|
|
7710
7824
|
var isArrays = /* @__PURE__ */ makeGuard("Arrays");
|
|
7711
7825
|
var isObjects = /* @__PURE__ */ makeGuard("Objects");
|
|
7826
|
+
var isSuspend = /* @__PURE__ */ makeGuard("Suspend");
|
|
7712
7827
|
var Link = class {
|
|
7713
7828
|
to;
|
|
7714
7829
|
transformation;
|
|
@@ -7722,12 +7837,12 @@ var Context = class {
|
|
|
7722
7837
|
isOptional;
|
|
7723
7838
|
isMutable;
|
|
7724
7839
|
/** Used for constructor default values (e.g. `withConstructorDefault` API) */
|
|
7725
|
-
|
|
7840
|
+
constructorDefault;
|
|
7726
7841
|
annotations;
|
|
7727
|
-
constructor(isOptional2, isMutable,
|
|
7842
|
+
constructor(isOptional2, isMutable, constructorDefault = void 0, annotations = void 0) {
|
|
7728
7843
|
this.isOptional = isOptional2;
|
|
7729
7844
|
this.isMutable = isMutable;
|
|
7730
|
-
this.
|
|
7845
|
+
this.constructorDefault = constructorDefault;
|
|
7731
7846
|
this.annotations = annotations;
|
|
7732
7847
|
}
|
|
7733
7848
|
};
|
|
@@ -7761,23 +7876,23 @@ var Declaration = class _Declaration extends Base2 {
|
|
|
7761
7876
|
}
|
|
7762
7877
|
/** @internal */
|
|
7763
7878
|
getParser() {
|
|
7764
|
-
|
|
7765
|
-
return (
|
|
7766
|
-
if (
|
|
7767
|
-
return
|
|
7879
|
+
let run2;
|
|
7880
|
+
return (input, options) => {
|
|
7881
|
+
if (input === missing) return missingExit;
|
|
7882
|
+
return (run2 ??= this.run(this.typeParameters))(input, this, options);
|
|
7768
7883
|
};
|
|
7769
7884
|
}
|
|
7770
|
-
_rebuild(
|
|
7771
|
-
const tps = mapOrSame(this.typeParameters,
|
|
7885
|
+
_rebuild(recur, checks, encodingChecks) {
|
|
7886
|
+
const tps = mapOrSame(this.typeParameters, recur);
|
|
7772
7887
|
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
7888
|
}
|
|
7774
7889
|
/** @internal */
|
|
7775
|
-
recur(
|
|
7776
|
-
return this._rebuild(
|
|
7890
|
+
recur(recur) {
|
|
7891
|
+
return this._rebuild(recur, this.checks, this.encodingChecks);
|
|
7777
7892
|
}
|
|
7778
7893
|
/** @internal */
|
|
7779
|
-
flip(
|
|
7780
|
-
return this._rebuild(
|
|
7894
|
+
flip(recur) {
|
|
7895
|
+
return this._rebuild(recur, this.encodingChecks, this.checks);
|
|
7781
7896
|
}
|
|
7782
7897
|
/** @internal */
|
|
7783
7898
|
getExpected() {
|
|
@@ -7841,7 +7956,8 @@ var String3 = class extends Base2 {
|
|
|
7841
7956
|
}
|
|
7842
7957
|
/** @internal */
|
|
7843
7958
|
matchPart(s, options) {
|
|
7844
|
-
|
|
7959
|
+
const checks = this.checks;
|
|
7960
|
+
return checks && !options.disableChecks && collectIssues(checks, s, void 0, this, options) ? void 0 : s;
|
|
7845
7961
|
}
|
|
7846
7962
|
/** @internal */
|
|
7847
7963
|
getExpected() {
|
|
@@ -7864,7 +7980,10 @@ var Number4 = class extends Base2 {
|
|
|
7864
7980
|
return this._match(isStringFiniteRegExp, s, options);
|
|
7865
7981
|
}
|
|
7866
7982
|
_match(regexp, s, options) {
|
|
7867
|
-
|
|
7983
|
+
if (!regexp.test(s)) return void 0;
|
|
7984
|
+
const value = globalThis.Number(s);
|
|
7985
|
+
if (options.disableChecks || !this.checks) return value;
|
|
7986
|
+
return collectIssues(this.checks, value, void 0, this, options) ? void 0 : value;
|
|
7868
7987
|
}
|
|
7869
7988
|
/** @internal */
|
|
7870
7989
|
toCodecJson() {
|
|
@@ -7889,7 +8008,7 @@ function hasCheck(checks, id) {
|
|
|
7889
8008
|
return checks.some((check) => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
|
|
7890
8009
|
}
|
|
7891
8010
|
function numberToJson(checks) {
|
|
7892
|
-
const encodedFinite = checks
|
|
8011
|
+
const encodedFinite = !checks ? finite : appendChecks(finite, checks);
|
|
7893
8012
|
return new Link(new Union([encodedFinite, nonFiniteLiterals], "anyOf"), new Transformation(Number3(), transform((n) => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
|
|
7894
8013
|
}
|
|
7895
8014
|
var number2 = /* @__PURE__ */ new Number4();
|
|
@@ -7905,51 +8024,62 @@ var Arrays = class _Arrays extends Base2 {
|
|
|
7905
8024
|
this.elements = elements;
|
|
7906
8025
|
this.rest = rest;
|
|
7907
8026
|
this.encodingChecks = encodingChecks;
|
|
7908
|
-
|
|
7909
|
-
|
|
8027
|
+
let hasOptional = false;
|
|
8028
|
+
for (let i = 0; i < elements.length; i++) {
|
|
8029
|
+
if (isOptional(elements[i])) {
|
|
8030
|
+
hasOptional = true;
|
|
8031
|
+
} else if (hasOptional) {
|
|
8032
|
+
throw new Error("A required element cannot follow an optional element. ts(1257)");
|
|
8033
|
+
}
|
|
8034
|
+
}
|
|
8035
|
+
if (hasOptional && rest.length > 1) {
|
|
7910
8036
|
throw new Error("A required element cannot follow an optional element. ts(1257)");
|
|
7911
8037
|
}
|
|
7912
|
-
|
|
7913
|
-
|
|
8038
|
+
for (let i = 1; i < rest.length; i++) {
|
|
8039
|
+
if (isOptional(rest[i])) {
|
|
8040
|
+
throw new Error("An optional element cannot follow a rest element. ts(1266)");
|
|
8041
|
+
}
|
|
7914
8042
|
}
|
|
7915
8043
|
}
|
|
7916
8044
|
/** @internal */
|
|
7917
|
-
getParser(
|
|
8045
|
+
getParser(compile, compileConstructorDefault2 = compile) {
|
|
7918
8046
|
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;
|
|
8047
|
+
let elements;
|
|
8048
|
+
let rest;
|
|
8049
|
+
const elementLen = ast.elements.length;
|
|
8050
|
+
const tailLen = Math.max(0, ast.rest.length - 1);
|
|
7930
8051
|
function getParser(tailThreshold, index) {
|
|
7931
8052
|
if (index < elementLen) {
|
|
7932
8053
|
return elements[index];
|
|
7933
8054
|
} else if (index >= tailThreshold) {
|
|
7934
|
-
return
|
|
8055
|
+
return rest[index - tailThreshold + 1];
|
|
7935
8056
|
}
|
|
7936
|
-
return
|
|
8057
|
+
return rest[0];
|
|
7937
8058
|
}
|
|
7938
|
-
return fnUntracedEager2(function* (
|
|
7939
|
-
if (
|
|
7940
|
-
return
|
|
8059
|
+
return fnUntracedEager2(function* (input, options) {
|
|
8060
|
+
if (input === missing) {
|
|
8061
|
+
return missing;
|
|
7941
8062
|
}
|
|
7942
|
-
const input = oinput.value;
|
|
7943
8063
|
if (!Array.isArray(input)) {
|
|
7944
|
-
return yield* fail5(new InvalidType(ast,
|
|
8064
|
+
return yield* fail5(new InvalidType(ast, input, options));
|
|
8065
|
+
}
|
|
8066
|
+
if (!elements) {
|
|
8067
|
+
elements = ast.elements.map((ast2) => ({
|
|
8068
|
+
ast: ast2,
|
|
8069
|
+
parser: compileConstructorDefault2(ast2)
|
|
8070
|
+
}));
|
|
8071
|
+
rest = ast.rest.map((ast2) => ({
|
|
8072
|
+
ast: ast2,
|
|
8073
|
+
parser: compileConstructorDefault2(ast2)
|
|
8074
|
+
}));
|
|
7945
8075
|
}
|
|
7946
8076
|
const len = input.length;
|
|
7947
8077
|
const state = {
|
|
7948
8078
|
ast,
|
|
7949
8079
|
getParser,
|
|
7950
|
-
|
|
8080
|
+
input,
|
|
7951
8081
|
len,
|
|
7952
|
-
tailThreshold:
|
|
8082
|
+
tailThreshold: Math.max(elementLen, len - tailLen),
|
|
7953
8083
|
output: new globalThis.Array(len),
|
|
7954
8084
|
issues: void 0,
|
|
7955
8085
|
options
|
|
@@ -7962,33 +8092,34 @@ var Arrays = class _Arrays extends Base2 {
|
|
|
7962
8092
|
if (eff) yield* eff;
|
|
7963
8093
|
if (ast.rest.length === 0 && len > elementLen) {
|
|
7964
8094
|
for (let i = elementLen; i <= len - 1; i++) {
|
|
7965
|
-
const
|
|
8095
|
+
const unexpected = new UnexpectedKey(ast, input[i], options);
|
|
8096
|
+
const issue = new Pointer([i], unexpected);
|
|
7966
8097
|
if (options.errors === "all") {
|
|
7967
8098
|
if (state.issues) state.issues.push(issue);
|
|
7968
8099
|
else state.issues = [issue];
|
|
7969
8100
|
} else {
|
|
7970
|
-
return yield* fail5(new Composite(ast,
|
|
8101
|
+
return yield* fail5(new Composite(ast, [issue], input, options));
|
|
7971
8102
|
}
|
|
7972
8103
|
}
|
|
7973
8104
|
}
|
|
7974
8105
|
if (state.issues) {
|
|
7975
|
-
return yield* fail5(new Composite(ast,
|
|
8106
|
+
return yield* fail5(new Composite(ast, state.issues, input, options));
|
|
7976
8107
|
}
|
|
7977
|
-
return
|
|
8108
|
+
return state.output;
|
|
7978
8109
|
});
|
|
7979
8110
|
}
|
|
7980
|
-
_rebuild(
|
|
7981
|
-
const elements = mapOrSame(this.elements,
|
|
7982
|
-
const rest = mapOrSame(this.rest,
|
|
8111
|
+
_rebuild(recur, checks, encodingChecks) {
|
|
8112
|
+
const elements = mapOrSame(this.elements, recur);
|
|
8113
|
+
const rest = mapOrSame(this.rest, recur);
|
|
7983
8114
|
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
8115
|
}
|
|
7985
8116
|
/** @internal */
|
|
7986
|
-
recur(
|
|
7987
|
-
return this._rebuild(
|
|
8117
|
+
recur(recur) {
|
|
8118
|
+
return this._rebuild(recur, this.checks, this.encodingChecks);
|
|
7988
8119
|
}
|
|
7989
8120
|
/** @internal */
|
|
7990
|
-
flip(
|
|
7991
|
-
return this._rebuild(
|
|
8121
|
+
flip(recur) {
|
|
8122
|
+
return this._rebuild(recur, this.encodingChecks, this.checks);
|
|
7992
8123
|
}
|
|
7993
8124
|
/** @internal */
|
|
7994
8125
|
getExpected() {
|
|
@@ -7997,14 +8128,16 @@ var Arrays = class _Arrays extends Base2 {
|
|
|
7997
8128
|
};
|
|
7998
8129
|
var parseArray = /* @__PURE__ */ iterateEager()({
|
|
7999
8130
|
onItem(s, item, i) {
|
|
8000
|
-
const value = i < s.len ?
|
|
8131
|
+
const value = i < s.len ? item : missing;
|
|
8001
8132
|
return s.getParser(s.tailThreshold, i).parser(value, s.options);
|
|
8002
8133
|
},
|
|
8003
|
-
step(s,
|
|
8134
|
+
step(s, item, exit3, i) {
|
|
8004
8135
|
if (exit3._tag === "Failure") {
|
|
8005
8136
|
return wrapPropertyKeyIssue(s, s.ast, i, exit3);
|
|
8006
|
-
}
|
|
8007
|
-
|
|
8137
|
+
}
|
|
8138
|
+
const value = exit3 === sameExit ? item : exit3[args];
|
|
8139
|
+
if (value !== missing) {
|
|
8140
|
+
s.output[i] = value;
|
|
8008
8141
|
} else {
|
|
8009
8142
|
const p = s.getParser(s.tailThreshold, i);
|
|
8010
8143
|
if (isOptional(p.ast)) return;
|
|
@@ -8013,14 +8146,11 @@ var parseArray = /* @__PURE__ */ iterateEager()({
|
|
|
8013
8146
|
if (s.issues) s.issues.push(issue);
|
|
8014
8147
|
else s.issues = [issue];
|
|
8015
8148
|
} else {
|
|
8016
|
-
return fail4(new Composite(s.ast, s.
|
|
8149
|
+
return fail4(new Composite(s.ast, [issue], s.input, s.options));
|
|
8017
8150
|
}
|
|
8018
8151
|
}
|
|
8019
8152
|
}
|
|
8020
8153
|
});
|
|
8021
|
-
function resolveTailThreshold(inputLen, elementLen, tailLen) {
|
|
8022
|
-
return Math.max(elementLen, inputLen - tailLen);
|
|
8023
|
-
}
|
|
8024
8154
|
var resolveConcurrency = (value) => {
|
|
8025
8155
|
value = value === "unbounded" ? Infinity : value ?? 1;
|
|
8026
8156
|
return value > 1 ? {
|
|
@@ -8033,14 +8163,14 @@ var wrapPropertyKeyIssue = (s, ast, key, exit3) => {
|
|
|
8033
8163
|
}
|
|
8034
8164
|
const issue = getSchemaIssue(exit3.cause);
|
|
8035
8165
|
if (issue === void 0) {
|
|
8036
|
-
return failCause2(map6(exit3.cause, (issue2) => new Composite(ast,
|
|
8166
|
+
return failCause2(map6(exit3.cause, (issue2) => new Composite(ast, [new Pointer([key], issue2)], s.input, s.options)));
|
|
8037
8167
|
}
|
|
8038
8168
|
const pointer = new Pointer([key], issue);
|
|
8039
8169
|
if (s.options.errors === "all") {
|
|
8040
8170
|
if (s.issues) s.issues.push(pointer);
|
|
8041
8171
|
else s.issues = [pointer];
|
|
8042
8172
|
} else {
|
|
8043
|
-
return fail4(new Composite(ast, s.
|
|
8173
|
+
return fail4(new Composite(ast, [pointer], s.input, s.options));
|
|
8044
8174
|
}
|
|
8045
8175
|
};
|
|
8046
8176
|
var FINITE_PATTERN = "[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";
|
|
@@ -8091,14 +8221,12 @@ function isIndexSignatureParameter(ast) {
|
|
|
8091
8221
|
var IndexSignature = class {
|
|
8092
8222
|
parameter;
|
|
8093
8223
|
type;
|
|
8094
|
-
|
|
8095
|
-
constructor(parameter, type, merge4) {
|
|
8224
|
+
constructor(parameter, type) {
|
|
8096
8225
|
if (!isIndexSignatureParameter(parameter)) {
|
|
8097
8226
|
throw new Error(`Invalid index signature parameter ${parameter._tag}`);
|
|
8098
8227
|
}
|
|
8099
8228
|
this.parameter = parameter;
|
|
8100
8229
|
this.type = type;
|
|
8101
|
-
this.merge = merge4;
|
|
8102
8230
|
if (isOptional(type) && !containsUndefined(type)) {
|
|
8103
8231
|
throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
|
|
8104
8232
|
}
|
|
@@ -8120,72 +8248,80 @@ var Objects = class _Objects extends Base2 {
|
|
|
8120
8248
|
}
|
|
8121
8249
|
}
|
|
8122
8250
|
/** @internal */
|
|
8123
|
-
getParser(
|
|
8251
|
+
getParser(compile, compileConstructorDefault2 = compile) {
|
|
8124
8252
|
const ast = this;
|
|
8125
8253
|
const expectedKeys = [];
|
|
8126
|
-
const expectedKeysSet = /* @__PURE__ */ new Set();
|
|
8127
|
-
const properties = [];
|
|
8128
8254
|
for (const ps of ast.propertySignatures) {
|
|
8129
8255
|
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
8256
|
}
|
|
8257
|
+
const hasProperties = expectedKeys.length;
|
|
8138
8258
|
const indexCount = ast.indexSignatures.length;
|
|
8139
|
-
|
|
8259
|
+
let expectedKeysSet = hasProperties && indexCount ? new Set(expectedKeys) : void 0;
|
|
8260
|
+
if (!hasProperties && !indexCount) {
|
|
8140
8261
|
return fromRefinement(ast, isNotNullish);
|
|
8141
8262
|
}
|
|
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
|
-
}
|
|
8263
|
+
let properties;
|
|
8264
|
+
let indexes;
|
|
8265
|
+
const finishIndex = (s, key, k2, inputValue, exitValue) => {
|
|
8266
|
+
if (exitValue._tag === "Failure") {
|
|
8267
|
+
return wrapPropertyKeyIssue(s, ast, key, exitValue) ?? void_4;
|
|
8268
|
+
}
|
|
8269
|
+
const value = exitValue === sameExit ? inputValue : exitValue[args];
|
|
8270
|
+
if (k2 !== missing && value !== missing) {
|
|
8271
|
+
if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(k2))) return void_4;
|
|
8272
|
+
assignProperty(s.out, k2, value);
|
|
8273
|
+
}
|
|
8274
|
+
return void_4;
|
|
8275
|
+
};
|
|
8276
|
+
const parseIndex = (s, key, index, exitKey) => {
|
|
8277
|
+
if (!exitKey) {
|
|
8278
|
+
const eff = index.parserKey(key, s.options);
|
|
8279
|
+
if (!effectIsExit(eff)) {
|
|
8280
|
+
return flatMap5(exit2(eff), (exit3) => parseIndex(s, key, index, exit3));
|
|
8172
8281
|
}
|
|
8173
|
-
|
|
8282
|
+
exitKey = eff;
|
|
8283
|
+
}
|
|
8284
|
+
if (exitKey._tag === "Failure") {
|
|
8285
|
+
return wrapPropertyKeyIssue(s, ast, key, exitKey) ?? void_4;
|
|
8286
|
+
}
|
|
8287
|
+
const k2 = exitKey === sameExit ? key : exitKey[args];
|
|
8288
|
+
const inputValue = s.input[key];
|
|
8289
|
+
const result3 = index.parserValue(inputValue, s.options);
|
|
8290
|
+
return effectIsExit(result3) ? finishIndex(s, key, k2, inputValue, result3) : flatMap5(exit2(result3), (exit3) => finishIndex(s, key, k2, inputValue, exit3));
|
|
8291
|
+
};
|
|
8292
|
+
const parseStringIndex = (s, key, index) => {
|
|
8293
|
+
const inputValue = s.input[key];
|
|
8294
|
+
const result3 = index.parserValue(inputValue, s.options);
|
|
8295
|
+
return effectIsExit(result3) ? finishIndex(s, key, key, inputValue, result3) : flatMap5(exit2(result3), (exit3) => finishIndex(s, key, key, inputValue, exit3));
|
|
8296
|
+
};
|
|
8297
|
+
const parseIndexes = indexCount ? iterateEager()({
|
|
8298
|
+
onItem: (s, [key, index]) => parseIndex(s, key, index),
|
|
8174
8299
|
step: (_s, _, exit3) => exit3._tag === "Failure" ? exit3 : void 0
|
|
8175
8300
|
}) : void 0;
|
|
8176
|
-
return fnUntracedEager2(function* (
|
|
8177
|
-
if (
|
|
8178
|
-
return
|
|
8301
|
+
return fnUntracedEager2(function* (input, options) {
|
|
8302
|
+
if (input === missing) {
|
|
8303
|
+
return missing;
|
|
8179
8304
|
}
|
|
8180
|
-
const input = oinput.value;
|
|
8181
8305
|
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
|
|
8182
|
-
return yield* fail5(new InvalidType(ast,
|
|
8306
|
+
return yield* fail5(new InvalidType(ast, input, options));
|
|
8307
|
+
}
|
|
8308
|
+
if (!properties) {
|
|
8309
|
+
properties = ast.propertySignatures.map((ps) => ({
|
|
8310
|
+
parser: compileConstructorDefault2(ps.type),
|
|
8311
|
+
name: ps.name,
|
|
8312
|
+
type: ps.type
|
|
8313
|
+
}));
|
|
8314
|
+
indexes = indexCount ? ast.indexSignatures.map((is2) => ({
|
|
8315
|
+
is: is2,
|
|
8316
|
+
parserKey: compile(parameterFromPropertyKey(is2.parameter)),
|
|
8317
|
+
parserValue: compileConstructorDefault2(is2.type)
|
|
8318
|
+
})) : void 0;
|
|
8183
8319
|
}
|
|
8320
|
+
const record2 = input;
|
|
8184
8321
|
const out = {};
|
|
8185
8322
|
const state = {
|
|
8186
8323
|
ast,
|
|
8187
|
-
|
|
8188
|
-
input,
|
|
8324
|
+
input: record2,
|
|
8189
8325
|
out,
|
|
8190
8326
|
issues: void 0,
|
|
8191
8327
|
options
|
|
@@ -8194,13 +8330,15 @@ var Objects = class _Objects extends Base2 {
|
|
|
8194
8330
|
const onExcessPropertyError = options.onExcessProperty === "error";
|
|
8195
8331
|
const onExcessPropertyPreserve = options.onExcessProperty === "preserve";
|
|
8196
8332
|
let inputKeys;
|
|
8197
|
-
if (
|
|
8198
|
-
|
|
8333
|
+
if (!indexCount && (onExcessPropertyError || onExcessPropertyPreserve)) {
|
|
8334
|
+
expectedKeysSet ??= new Set(expectedKeys);
|
|
8335
|
+
inputKeys = Reflect.ownKeys(record2);
|
|
8199
8336
|
for (let i = 0; i < inputKeys.length; i++) {
|
|
8200
8337
|
const key = inputKeys[i];
|
|
8201
8338
|
if (!expectedKeysSet.has(key)) {
|
|
8202
8339
|
if (onExcessPropertyError) {
|
|
8203
|
-
const
|
|
8340
|
+
const unexpected = new UnexpectedKey(ast, record2[key], options);
|
|
8341
|
+
const issue = new Pointer([key], unexpected);
|
|
8204
8342
|
if (errorsAllOption) {
|
|
8205
8343
|
if (state.issues) {
|
|
8206
8344
|
state.issues.push(issue);
|
|
@@ -8209,66 +8347,77 @@ var Objects = class _Objects extends Base2 {
|
|
|
8209
8347
|
}
|
|
8210
8348
|
continue;
|
|
8211
8349
|
} else {
|
|
8212
|
-
return yield* fail5(new Composite(ast,
|
|
8350
|
+
return yield* fail5(new Composite(ast, [issue], input, options));
|
|
8213
8351
|
}
|
|
8214
8352
|
} else {
|
|
8215
|
-
assignProperty(out, key,
|
|
8353
|
+
assignProperty(out, key, record2[key]);
|
|
8216
8354
|
}
|
|
8217
8355
|
}
|
|
8218
8356
|
}
|
|
8219
8357
|
}
|
|
8220
8358
|
const concurrency = resolveConcurrency(options?.concurrency);
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8359
|
+
if (hasProperties) {
|
|
8360
|
+
const eff = parseProperties(state, properties, concurrency);
|
|
8361
|
+
if (eff) yield* eff;
|
|
8362
|
+
}
|
|
8363
|
+
if (indexCount && !concurrency) {
|
|
8364
|
+
for (let i = 0; i < indexCount; i++) {
|
|
8365
|
+
const index = indexes[i];
|
|
8366
|
+
const parse = index.is.parameter === string2 ? parseStringIndex : parseIndex;
|
|
8367
|
+
const keys2 = index.is.parameter === string2 ? Object.keys(record2) : getIndexSignatureKeys(record2, index.is.parameter, options);
|
|
8368
|
+
for (let j = 0; j < keys2.length; j++) {
|
|
8369
|
+
const eff = parse(state, keys2[j], index);
|
|
8370
|
+
if (!effectIsExit(eff)) yield* eff;
|
|
8371
|
+
else if (eff._tag === "Failure") return yield* eff;
|
|
8372
|
+
}
|
|
8373
|
+
}
|
|
8374
|
+
} else if (parseIndexes) {
|
|
8224
8375
|
const keyPairs = empty3();
|
|
8225
8376
|
for (let i = 0; i < indexCount; i++) {
|
|
8226
|
-
const
|
|
8227
|
-
const keys2 = getIndexSignatureKeys(
|
|
8377
|
+
const index = indexes[i];
|
|
8378
|
+
const keys2 = getIndexSignatureKeys(record2, index.is.parameter, options);
|
|
8228
8379
|
for (let j = 0; j < keys2.length; j++) {
|
|
8229
|
-
|
|
8230
|
-
keyPairs.push([key, is2]);
|
|
8380
|
+
keyPairs.push([keys2[j], index]);
|
|
8231
8381
|
}
|
|
8232
8382
|
}
|
|
8233
|
-
const
|
|
8234
|
-
if (
|
|
8383
|
+
const eff = parseIndexes(state, keyPairs, concurrency);
|
|
8384
|
+
if (eff) yield* eff;
|
|
8235
8385
|
}
|
|
8236
8386
|
if (state.issues) {
|
|
8237
|
-
return yield* fail5(new Composite(ast,
|
|
8387
|
+
return yield* fail5(new Composite(ast, state.issues, input, options));
|
|
8238
8388
|
}
|
|
8239
8389
|
if (options.propertyOrder === "original") {
|
|
8240
|
-
const keys2 = (inputKeys ?? Reflect.ownKeys(
|
|
8390
|
+
const keys2 = (inputKeys ?? Reflect.ownKeys(record2)).concat(expectedKeys);
|
|
8241
8391
|
const preserved = {};
|
|
8242
8392
|
for (const key of keys2) {
|
|
8243
8393
|
if (Object.hasOwn(out, key)) {
|
|
8244
8394
|
assignProperty(preserved, key, out[key]);
|
|
8245
8395
|
}
|
|
8246
8396
|
}
|
|
8247
|
-
return
|
|
8397
|
+
return preserved;
|
|
8248
8398
|
}
|
|
8249
|
-
return
|
|
8399
|
+
return out;
|
|
8250
8400
|
});
|
|
8251
8401
|
}
|
|
8252
|
-
_rebuild(
|
|
8402
|
+
_rebuild(recur, recurParameter, checks, encodingChecks) {
|
|
8253
8403
|
const props = mapOrSame(this.propertySignatures, (ps) => {
|
|
8254
|
-
const t =
|
|
8404
|
+
const t = recur(ps.type);
|
|
8255
8405
|
return t === ps.type ? ps : new PropertySignature(ps.name, t);
|
|
8256
8406
|
});
|
|
8257
8407
|
const indexes = mapOrSame(this.indexSignatures, (is2) => {
|
|
8258
8408
|
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);
|
|
8409
|
+
const t = recur(is2.type);
|
|
8410
|
+
return p === is2.parameter && t === is2.type ? is2 : new IndexSignature(p, t);
|
|
8262
8411
|
});
|
|
8263
8412
|
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
8413
|
}
|
|
8265
8414
|
/** @internal */
|
|
8266
|
-
flip(
|
|
8267
|
-
return this._rebuild(
|
|
8415
|
+
flip(recur) {
|
|
8416
|
+
return this._rebuild(recur, recur, this.encodingChecks, this.checks);
|
|
8268
8417
|
}
|
|
8269
8418
|
/** @internal */
|
|
8270
|
-
recur(
|
|
8271
|
-
return this._rebuild(
|
|
8419
|
+
recur(recur, recurParameter = recur) {
|
|
8420
|
+
return this._rebuild(recur, recurParameter, this.checks, this.encodingChecks);
|
|
8272
8421
|
}
|
|
8273
8422
|
/** @internal */
|
|
8274
8423
|
getExpected() {
|
|
@@ -8278,22 +8427,32 @@ var Objects = class _Objects extends Base2 {
|
|
|
8278
8427
|
};
|
|
8279
8428
|
var parseProperties = /* @__PURE__ */ iterateEager()({
|
|
8280
8429
|
onItem(s, p) {
|
|
8281
|
-
|
|
8430
|
+
if (!Object.hasOwn(s.input, p.name)) {
|
|
8431
|
+
return p.parser(missing, s.options);
|
|
8432
|
+
}
|
|
8433
|
+
const value = s.input[p.name];
|
|
8434
|
+
assignProperty(s.out, p.name, value);
|
|
8282
8435
|
return p.parser(value, s.options);
|
|
8283
8436
|
},
|
|
8284
8437
|
step(s, p, exit3) {
|
|
8285
8438
|
if (exit3._tag === "Failure") {
|
|
8286
8439
|
return wrapPropertyKeyIssue(s, s.ast, p.name, exit3);
|
|
8287
|
-
}
|
|
8288
|
-
|
|
8289
|
-
|
|
8440
|
+
}
|
|
8441
|
+
if (exit3 === sameExit) return;
|
|
8442
|
+
const value = exit3[args];
|
|
8443
|
+
if (value !== missing) {
|
|
8444
|
+
assignProperty(s.out, p.name, value);
|
|
8445
|
+
return;
|
|
8446
|
+
}
|
|
8447
|
+
delete s.out[p.name];
|
|
8448
|
+
if (!isOptional(p.type)) {
|
|
8290
8449
|
const issue = new Pointer([p.name], new MissingKey(p.type.context?.annotations));
|
|
8291
8450
|
if (s.options.errors === "all") {
|
|
8292
8451
|
if (s.issues) s.issues.push(issue);
|
|
8293
8452
|
else s.issues = [issue];
|
|
8294
8453
|
return;
|
|
8295
8454
|
} else {
|
|
8296
|
-
return fail4(new Composite(s.ast, s.
|
|
8455
|
+
return fail4(new Composite(s.ast, [issue], s.input, s.options));
|
|
8297
8456
|
}
|
|
8298
8457
|
}
|
|
8299
8458
|
}
|
|
@@ -8317,6 +8476,17 @@ function tuple(elements, checks = void 0) {
|
|
|
8317
8476
|
function union3(members, mode, checks) {
|
|
8318
8477
|
return new Union(members.map(getAST), mode, void 0, checks);
|
|
8319
8478
|
}
|
|
8479
|
+
var toCandidate = /* @__PURE__ */ memoizeIdempotent((ast) => {
|
|
8480
|
+
while (true) {
|
|
8481
|
+
if (isSuspend(ast)) return unknown;
|
|
8482
|
+
const encoding = ast.encoding;
|
|
8483
|
+
if (!encoding) {
|
|
8484
|
+
return ast.recur?.(toCandidate, identity) ?? ast;
|
|
8485
|
+
}
|
|
8486
|
+
if (encoding.some((link2) => link2.transformation._tag === "Middleware" && link2.transformation.decode !== identity)) return unknown;
|
|
8487
|
+
ast = encoding[encoding.length - 1].to;
|
|
8488
|
+
}
|
|
8489
|
+
});
|
|
8320
8490
|
function getCandidateTypes(ast) {
|
|
8321
8491
|
switch (ast._tag) {
|
|
8322
8492
|
case "Null":
|
|
@@ -8380,74 +8550,162 @@ function collectSentinels(ast) {
|
|
|
8380
8550
|
});
|
|
8381
8551
|
case "Arrays":
|
|
8382
8552
|
return ast.elements.flatMap((e, i) => {
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8553
|
+
if (!isOptional(e)) {
|
|
8554
|
+
if (isLiteral(e)) {
|
|
8555
|
+
return [{
|
|
8556
|
+
key: i,
|
|
8557
|
+
literal: e.literal
|
|
8558
|
+
}];
|
|
8559
|
+
}
|
|
8560
|
+
if (isUniqueSymbol(e)) {
|
|
8561
|
+
return [{
|
|
8562
|
+
key: i,
|
|
8563
|
+
literal: e.symbol
|
|
8564
|
+
}];
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8567
|
+
return [];
|
|
8387
8568
|
});
|
|
8569
|
+
case "Union": {
|
|
8570
|
+
if (ast.types.length === 0) return [];
|
|
8571
|
+
const members = ast.types.map((type) => collectSentinels(toCandidate(type)));
|
|
8572
|
+
return members[0].filter((s) => members.every((sentinels) => sentinels.some((o) => o.key === s.key && o.literal === s.literal)));
|
|
8573
|
+
}
|
|
8388
8574
|
case "Suspend":
|
|
8389
8575
|
return collectSentinels(ast.thunk());
|
|
8390
8576
|
}
|
|
8391
8577
|
}
|
|
8392
8578
|
var candidateIndexCache = /* @__PURE__ */ new WeakMap();
|
|
8579
|
+
var emptyCandidates = /* @__PURE__ */ Object.freeze([]);
|
|
8393
8580
|
function getIndex(types) {
|
|
8394
|
-
let
|
|
8395
|
-
if (
|
|
8396
|
-
|
|
8581
|
+
let index = candidateIndexCache.get(types);
|
|
8582
|
+
if (index) return index;
|
|
8583
|
+
let bySentinel;
|
|
8584
|
+
let sentinelCandidateCount = 0;
|
|
8585
|
+
let otherwise;
|
|
8586
|
+
let literalCandidates;
|
|
8587
|
+
let onlyLiterals = true;
|
|
8397
8588
|
for (let i = 0; i < types.length; i++) {
|
|
8398
8589
|
const a = types[i];
|
|
8399
|
-
const encoded =
|
|
8590
|
+
const encoded = toCandidate(a);
|
|
8400
8591
|
if (isNever2(encoded)) continue;
|
|
8401
|
-
|
|
8592
|
+
if (onlyLiterals) {
|
|
8593
|
+
if (isLiteral(encoded) || isUniqueSymbol(encoded)) {
|
|
8594
|
+
literalCandidates ??= /* @__PURE__ */ new Map();
|
|
8595
|
+
const literal = isLiteral(encoded) ? encoded.literal : encoded.symbol;
|
|
8596
|
+
let arr = literalCandidates.get(literal);
|
|
8597
|
+
if (!arr) literalCandidates.set(literal, arr = []);
|
|
8598
|
+
arr.push(a);
|
|
8599
|
+
} else {
|
|
8600
|
+
onlyLiterals = false;
|
|
8601
|
+
}
|
|
8602
|
+
}
|
|
8402
8603
|
const sentinels = collectSentinels(encoded);
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
idx.bySentinel ??= /* @__PURE__ */ new Map();
|
|
8604
|
+
if (sentinels.length) {
|
|
8605
|
+
bySentinel ??= /* @__PURE__ */ new Map();
|
|
8606
|
+
sentinelCandidateCount++;
|
|
8407
8607
|
for (const {
|
|
8408
8608
|
key,
|
|
8409
8609
|
literal
|
|
8410
8610
|
} of sentinels) {
|
|
8411
|
-
let
|
|
8412
|
-
if (!
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8611
|
+
let entry = bySentinel.get(key);
|
|
8612
|
+
if (!entry) bySentinel.set(key, entry = [/* @__PURE__ */ new Map(), /* @__PURE__ */ new Set()]);
|
|
8613
|
+
entry[1].add(i);
|
|
8614
|
+
let indexes = entry[0].get(literal);
|
|
8615
|
+
if (!indexes) entry[0].set(literal, indexes = /* @__PURE__ */ new Set());
|
|
8616
|
+
indexes.add(i);
|
|
8416
8617
|
}
|
|
8417
8618
|
} else {
|
|
8418
|
-
|
|
8419
|
-
|
|
8619
|
+
otherwise ??= {};
|
|
8620
|
+
const candidateTypes = getCandidateTypes(encoded);
|
|
8621
|
+
for (const t of candidateTypes) (otherwise[t] ??= []).push(i);
|
|
8622
|
+
}
|
|
8623
|
+
}
|
|
8624
|
+
if (onlyLiterals && literalCandidates) {
|
|
8625
|
+
literalCandidates.forEach(Object.freeze);
|
|
8626
|
+
index = (input) => literalCandidates.get(input) ?? emptyCandidates;
|
|
8627
|
+
} else if (bySentinel?.size === 1 && !otherwise) {
|
|
8628
|
+
const [key, [byValue]] = bySentinel.entries().next().value;
|
|
8629
|
+
const candidates = byValue;
|
|
8630
|
+
for (const [literal, indexes] of byValue) {
|
|
8631
|
+
candidates.set(literal, Object.freeze(Array.from(indexes, (index2) => types[index2])));
|
|
8632
|
+
}
|
|
8633
|
+
index = (input, isConstructor) => {
|
|
8634
|
+
if (isObjectKeyword(input)) {
|
|
8635
|
+
const value = Object.hasOwn(input, key) ? input[key] : void 0;
|
|
8636
|
+
if (value !== void 0) return candidates.get(value) ?? emptyCandidates;
|
|
8637
|
+
if (isConstructor) return types;
|
|
8638
|
+
}
|
|
8639
|
+
return emptyCandidates;
|
|
8640
|
+
};
|
|
8641
|
+
} else if (bySentinel) {
|
|
8642
|
+
let commonSentinel;
|
|
8643
|
+
for (const entry of bySentinel) {
|
|
8644
|
+
if ((!commonSentinel || entry[1][0].size > commonSentinel[1][0].size) && entry[1][1].size === sentinelCandidateCount) {
|
|
8645
|
+
commonSentinel = entry;
|
|
8646
|
+
}
|
|
8420
8647
|
}
|
|
8648
|
+
index = (input, isConstructor) => {
|
|
8649
|
+
const runtimeType = input === null ? "null" : Array.isArray(input) ? "array" : typeof input;
|
|
8650
|
+
const base = otherwise?.[runtimeType] ?? emptyCandidates;
|
|
8651
|
+
if (!isObjectKeyword(input)) return base.map((i) => types[i]);
|
|
8652
|
+
const selected = new Set(base);
|
|
8653
|
+
let directKey;
|
|
8654
|
+
if (commonSentinel) {
|
|
8655
|
+
const [key, [byValue]] = commonSentinel;
|
|
8656
|
+
const hasKey = Object.hasOwn(input, key);
|
|
8657
|
+
const value = hasKey ? input[key] : void 0;
|
|
8658
|
+
if (hasKey && (!isConstructor || value !== void 0)) {
|
|
8659
|
+
const match7 = byValue.get(value);
|
|
8660
|
+
if (!match7) return base.map((i) => types[i]);
|
|
8661
|
+
for (const i of match7) selected.add(i);
|
|
8662
|
+
directKey = key;
|
|
8663
|
+
}
|
|
8664
|
+
}
|
|
8665
|
+
if (directKey === void 0) {
|
|
8666
|
+
for (const [key, [byValue, all5]] of bySentinel) {
|
|
8667
|
+
const hasKey = Object.hasOwn(input, key);
|
|
8668
|
+
const value = hasKey ? input[key] : void 0;
|
|
8669
|
+
if (hasKey && (!isConstructor || value !== void 0)) {
|
|
8670
|
+
const match7 = byValue.get(value);
|
|
8671
|
+
if (match7) {
|
|
8672
|
+
for (const i of match7) selected.add(i);
|
|
8673
|
+
}
|
|
8674
|
+
} else if (isConstructor) {
|
|
8675
|
+
for (const i of all5) selected.add(i);
|
|
8676
|
+
}
|
|
8677
|
+
}
|
|
8678
|
+
}
|
|
8679
|
+
for (const [key, [byValue, all5]] of bySentinel) {
|
|
8680
|
+
if (key === directKey) continue;
|
|
8681
|
+
const hasKey = Object.hasOwn(input, key);
|
|
8682
|
+
const value = hasKey ? input[key] : void 0;
|
|
8683
|
+
if (hasKey && (!isConstructor || value !== void 0)) {
|
|
8684
|
+
const match7 = byValue.get(value);
|
|
8685
|
+
for (const i of selected) {
|
|
8686
|
+
if (all5.has(i) && !match7?.has(i)) selected.delete(i);
|
|
8687
|
+
}
|
|
8688
|
+
}
|
|
8689
|
+
}
|
|
8690
|
+
return Array.from(selected).sort((a, b) => a - b).map((i) => types[i]);
|
|
8691
|
+
};
|
|
8692
|
+
} else {
|
|
8693
|
+
index = (input) => {
|
|
8694
|
+
const runtimeType = input === null ? "null" : Array.isArray(input) ? "array" : typeof input;
|
|
8695
|
+
return (otherwise?.[runtimeType] ?? emptyCandidates).map((i) => types[i]).filter(filterLiterals(input));
|
|
8696
|
+
};
|
|
8421
8697
|
}
|
|
8422
|
-
candidateIndexCache.set(types,
|
|
8423
|
-
return
|
|
8698
|
+
candidateIndexCache.set(types, index);
|
|
8699
|
+
return index;
|
|
8424
8700
|
}
|
|
8425
8701
|
function filterLiterals(input) {
|
|
8426
8702
|
return (ast) => {
|
|
8427
|
-
const encoded =
|
|
8703
|
+
const encoded = toCandidate(ast);
|
|
8428
8704
|
return encoded._tag === "Literal" ? encoded.literal === input : encoded._tag === "UniqueSymbol" ? encoded.symbol === input : true;
|
|
8429
8705
|
};
|
|
8430
8706
|
}
|
|
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));
|
|
8707
|
+
function getCandidates(input, types, isConstructor = false) {
|
|
8708
|
+
return getIndex(types)(input, isConstructor);
|
|
8451
8709
|
}
|
|
8452
8710
|
var Union = class _Union extends Base2 {
|
|
8453
8711
|
_tag = "Union";
|
|
@@ -8461,21 +8719,24 @@ var Union = class _Union extends Base2 {
|
|
|
8461
8719
|
this.encodingChecks = encodingChecks;
|
|
8462
8720
|
}
|
|
8463
8721
|
/** @internal */
|
|
8464
|
-
getParser(
|
|
8722
|
+
getParser(compile, compileConstructorDefault2) {
|
|
8465
8723
|
const ast = this;
|
|
8466
|
-
return (
|
|
8467
|
-
if (
|
|
8468
|
-
return
|
|
8724
|
+
return (input, options) => {
|
|
8725
|
+
if (input === missing) {
|
|
8726
|
+
return missingExit;
|
|
8727
|
+
}
|
|
8728
|
+
const candidates = getCandidates(input, ast.types, compileConstructorDefault2 !== void 0);
|
|
8729
|
+
if (candidates.length === 1) {
|
|
8730
|
+
const result3 = compile(candidates[0])(input, options);
|
|
8731
|
+
if (result3._tag === "Success") return result3;
|
|
8732
|
+
return effectIsExit(result3) ? failSingleUnionCandidate(ast, result3.cause, input, options) : catchCause2(result3, (cause) => failSingleUnionCandidate(ast, cause, input, options));
|
|
8469
8733
|
}
|
|
8470
|
-
const input = oinput.value;
|
|
8471
|
-
const candidates = getCandidates(input, ast.types);
|
|
8472
8734
|
const state = {
|
|
8473
8735
|
ast,
|
|
8474
|
-
|
|
8475
|
-
oinput,
|
|
8736
|
+
compile,
|
|
8476
8737
|
input,
|
|
8477
8738
|
out: void 0,
|
|
8478
|
-
successes: [],
|
|
8739
|
+
successes: ast.mode === "oneOf" ? [] : void 0,
|
|
8479
8740
|
issues: void 0,
|
|
8480
8741
|
options
|
|
8481
8742
|
};
|
|
@@ -8485,24 +8746,27 @@ var Union = class _Union extends Base2 {
|
|
|
8485
8746
|
orderedStep: true
|
|
8486
8747
|
} : void 0);
|
|
8487
8748
|
if (!eff) {
|
|
8488
|
-
|
|
8749
|
+
if (state.out) return state.out;
|
|
8750
|
+
return fail5(new AnyOf(ast, state.issues ?? [], input, options));
|
|
8489
8751
|
}
|
|
8490
|
-
return
|
|
8491
|
-
|
|
8752
|
+
return flatMapEager2(eff, (_) => {
|
|
8753
|
+
if (state.out === sameExit) return succeed5(input);
|
|
8754
|
+
if (state.out) return state.out;
|
|
8755
|
+
return fail5(new AnyOf(ast, state.issues ?? [], input, options));
|
|
8492
8756
|
});
|
|
8493
8757
|
};
|
|
8494
8758
|
}
|
|
8495
|
-
_rebuild(
|
|
8496
|
-
const types = mapOrSame(this.types,
|
|
8759
|
+
_rebuild(recur, checks, encodingChecks) {
|
|
8760
|
+
const types = mapOrSame(this.types, recur);
|
|
8497
8761
|
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
8762
|
}
|
|
8499
8763
|
/** @internal */
|
|
8500
|
-
recur(
|
|
8501
|
-
return this._rebuild(
|
|
8764
|
+
recur(recur) {
|
|
8765
|
+
return this._rebuild(recur, this.checks, this.encodingChecks);
|
|
8502
8766
|
}
|
|
8503
8767
|
/** @internal */
|
|
8504
|
-
flip(
|
|
8505
|
-
return this._rebuild(
|
|
8768
|
+
flip(recur) {
|
|
8769
|
+
return this._rebuild(recur, this.encodingChecks, this.checks);
|
|
8506
8770
|
}
|
|
8507
8771
|
/** @internal */
|
|
8508
8772
|
matchPart(s, options) {
|
|
@@ -8540,10 +8804,15 @@ var Union = class _Union extends Base2 {
|
|
|
8540
8804
|
return Array.from(new Set(types)).join(" | ");
|
|
8541
8805
|
}
|
|
8542
8806
|
};
|
|
8807
|
+
function failSingleUnionCandidate(ast, cause, input, options) {
|
|
8808
|
+
const issue = getSchemaIssue(cause);
|
|
8809
|
+
if (!issue) return failCause2(cause);
|
|
8810
|
+
return fail4(new AnyOf(ast, [issue], input, options));
|
|
8811
|
+
}
|
|
8543
8812
|
var parseUnion = /* @__PURE__ */ iterateEager()({
|
|
8544
8813
|
onItem(s, ast) {
|
|
8545
|
-
const parser = s.
|
|
8546
|
-
return parser(s.
|
|
8814
|
+
const parser = s.compile(ast);
|
|
8815
|
+
return parser(s.input, s.options);
|
|
8547
8816
|
},
|
|
8548
8817
|
step(s, candidate, exit3) {
|
|
8549
8818
|
if (exit3._tag === "Failure") {
|
|
@@ -8554,13 +8823,14 @@ var parseUnion = /* @__PURE__ */ iterateEager()({
|
|
|
8554
8823
|
if (s.issues) s.issues.push(issue);
|
|
8555
8824
|
else s.issues = [issue];
|
|
8556
8825
|
} else {
|
|
8557
|
-
if (s.out && s.
|
|
8826
|
+
if (s.out && s.successes) {
|
|
8558
8827
|
s.successes.push(candidate);
|
|
8559
|
-
return fail4(new OneOf(s.ast, s.input, s.
|
|
8828
|
+
return fail4(new OneOf(s.ast, s.successes, s.input, s.options));
|
|
8560
8829
|
}
|
|
8561
|
-
s.out = exit3
|
|
8562
|
-
s.successes
|
|
8563
|
-
|
|
8830
|
+
s.out = exit3;
|
|
8831
|
+
if (s.successes) {
|
|
8832
|
+
s.successes.push(candidate);
|
|
8833
|
+
} else {
|
|
8564
8834
|
return void_4;
|
|
8565
8835
|
}
|
|
8566
8836
|
}
|
|
@@ -8620,7 +8890,7 @@ var FilterGroup = class _FilterGroup extends Class {
|
|
|
8620
8890
|
}
|
|
8621
8891
|
};
|
|
8622
8892
|
function makeFilter(filter7, annotations, aborted = false) {
|
|
8623
|
-
return new Filter2((input, ast, options) =>
|
|
8893
|
+
return new Filter2((input, ast, options) => normalizeFilterOutput(ast, filter7(input, ast, options), input, options), annotations, aborted);
|
|
8624
8894
|
}
|
|
8625
8895
|
function isFinite(annotations) {
|
|
8626
8896
|
return makeFilter((n) => globalThis.Number.isFinite(n), {
|
|
@@ -8647,7 +8917,11 @@ function isFinite(annotations) {
|
|
|
8647
8917
|
var finite = /* @__PURE__ */ appendChecks(number2, [/* @__PURE__ */ isFinite()]);
|
|
8648
8918
|
function isPattern(regExp, annotations) {
|
|
8649
8919
|
const source = regExp.source;
|
|
8650
|
-
|
|
8920
|
+
const pattern = new globalThis.RegExp(source, regExp.flags);
|
|
8921
|
+
return makeFilter((s) => {
|
|
8922
|
+
pattern.lastIndex = 0;
|
|
8923
|
+
return pattern.test(s);
|
|
8924
|
+
}, {
|
|
8651
8925
|
expected: `a string matching the RegExp ${source}`,
|
|
8652
8926
|
representation: {
|
|
8653
8927
|
id: "effect/schema/isPattern",
|
|
@@ -8672,6 +8946,10 @@ function modifyOwnPropertyDescriptors(ast, f) {
|
|
|
8672
8946
|
f(d);
|
|
8673
8947
|
return Object.create(Object.getPrototypeOf(ast), d);
|
|
8674
8948
|
}
|
|
8949
|
+
var contextOwners = /* @__PURE__ */ new WeakMap();
|
|
8950
|
+
function getContextOwner(ast) {
|
|
8951
|
+
return contextOwners.get(ast) ?? ast;
|
|
8952
|
+
}
|
|
8675
8953
|
function replaceEncoding(ast, encoding) {
|
|
8676
8954
|
if (ast.encoding === encoding) {
|
|
8677
8955
|
return ast;
|
|
@@ -8684,9 +8962,15 @@ function replaceContext(ast, context3) {
|
|
|
8684
8962
|
if (ast.context === context3) {
|
|
8685
8963
|
return ast;
|
|
8686
8964
|
}
|
|
8687
|
-
|
|
8965
|
+
const owner = getContextOwner(ast);
|
|
8966
|
+
if (owner.context === context3) {
|
|
8967
|
+
return owner;
|
|
8968
|
+
}
|
|
8969
|
+
const out = modifyOwnPropertyDescriptors(ast, (d) => {
|
|
8688
8970
|
d.context.value = context3;
|
|
8689
8971
|
});
|
|
8972
|
+
contextOwners.set(out, owner);
|
|
8973
|
+
return out;
|
|
8690
8974
|
}
|
|
8691
8975
|
function annotate(ast, annotations) {
|
|
8692
8976
|
if (ast.checks) {
|
|
@@ -8701,7 +8985,7 @@ function annotate(ast, annotations) {
|
|
|
8701
8985
|
});
|
|
8702
8986
|
}
|
|
8703
8987
|
function replaceChecks(ast, checks) {
|
|
8704
|
-
if (ast._tag === "Suspend" && checks
|
|
8988
|
+
if (ast._tag === "Suspend" && checks) {
|
|
8705
8989
|
throw new Error("Cannot add checks to Suspend");
|
|
8706
8990
|
}
|
|
8707
8991
|
if (ast.checks === checks) {
|
|
@@ -8724,11 +9008,15 @@ function updateLastLink(encoding, f) {
|
|
|
8724
9008
|
const out = mapLink(last2, f);
|
|
8725
9009
|
return out === last2 ? encoding : append(encoding.slice(0, encoding.length - 1), out);
|
|
8726
9010
|
}
|
|
8727
|
-
function
|
|
9011
|
+
function applyToSelfOrLastLinkEncodingIdempotent(f, options) {
|
|
8728
9012
|
function out(ast) {
|
|
8729
|
-
|
|
9013
|
+
if (ast.encoding) {
|
|
9014
|
+
const last2 = ast.encoding[ast.encoding.length - 1];
|
|
9015
|
+
return options?.stopAt?.(last2) ? ast : replaceEncoding(ast, updateLastLink(ast.encoding, out));
|
|
9016
|
+
}
|
|
9017
|
+
return f(ast);
|
|
8730
9018
|
}
|
|
8731
|
-
return
|
|
9019
|
+
return memoizeIdempotent(out);
|
|
8732
9020
|
}
|
|
8733
9021
|
function appendTransformation(from, transformation, to) {
|
|
8734
9022
|
const link2 = new Link(from, transformation);
|
|
@@ -8748,7 +9036,7 @@ function mapOrSame(as4, f) {
|
|
|
8748
9036
|
return changed ? out : as4;
|
|
8749
9037
|
}
|
|
8750
9038
|
function annotateKey(ast, annotations) {
|
|
8751
|
-
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, ast.context.
|
|
9039
|
+
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, ast.context.constructorDefault, {
|
|
8752
9040
|
...ast.context.annotations,
|
|
8753
9041
|
...annotations
|
|
8754
9042
|
}) : new Context(false, false, void 0, annotations);
|
|
@@ -8756,8 +9044,8 @@ function annotateKey(ast, annotations) {
|
|
|
8756
9044
|
}
|
|
8757
9045
|
function withConstructorDefault(ast, defaultValue) {
|
|
8758
9046
|
const transformation = new Transformation(withDefault(defaultValue), passthrough2());
|
|
8759
|
-
const
|
|
8760
|
-
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable,
|
|
9047
|
+
const constructorDefault = new Link(unknown, transformation);
|
|
9048
|
+
const context3 = ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) : new Context(false, false, constructorDefault);
|
|
8761
9049
|
return replaceContext(ast, context3);
|
|
8762
9050
|
}
|
|
8763
9051
|
function decodeTo(from, to, transformation) {
|
|
@@ -8777,7 +9065,7 @@ function extractStructuralChecks(checks) {
|
|
|
8777
9065
|
const out = checks.flatMap(extract);
|
|
8778
9066
|
return isArrayNonEmpty2(out) ? out : void 0;
|
|
8779
9067
|
}
|
|
8780
|
-
var toType = /* @__PURE__ */
|
|
9068
|
+
var toType = /* @__PURE__ */ memoizeIdempotent((ast) => {
|
|
8781
9069
|
if (ast.encoding) {
|
|
8782
9070
|
return toType(replaceEncoding(ast, void 0));
|
|
8783
9071
|
}
|
|
@@ -8793,7 +9081,7 @@ var toType = /* @__PURE__ */ memoize((ast) => {
|
|
|
8793
9081
|
}
|
|
8794
9082
|
return type;
|
|
8795
9083
|
});
|
|
8796
|
-
var toEncoded = /* @__PURE__ */
|
|
9084
|
+
var toEncoded = /* @__PURE__ */ memoizeIdempotent((ast) => {
|
|
8797
9085
|
return toType(flip4(ast));
|
|
8798
9086
|
});
|
|
8799
9087
|
function flipEncoding(ast, encoding) {
|
|
@@ -8829,29 +9117,21 @@ function containsUndefined(ast) {
|
|
|
8829
9117
|
}
|
|
8830
9118
|
}
|
|
8831
9119
|
function fromConst(ast, value) {
|
|
8832
|
-
const
|
|
8833
|
-
return (
|
|
8834
|
-
if (
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
return oinput.value === value ? succeed6 : fail5(new InvalidType(ast, oinput));
|
|
9120
|
+
const succeed7 = succeed6(value);
|
|
9121
|
+
return (input, options) => {
|
|
9122
|
+
if (input === missing) return missingExit;
|
|
9123
|
+
if (input === value) return succeed7;
|
|
9124
|
+
return fail5(new InvalidType(ast, input, options));
|
|
8838
9125
|
};
|
|
8839
9126
|
}
|
|
8840
9127
|
function fromRefinement(ast, refinement) {
|
|
8841
|
-
return (
|
|
8842
|
-
if (
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
return refinement(oinput.value) ? succeed4(oinput) : fail5(new InvalidType(ast, oinput));
|
|
9128
|
+
return (input, options) => {
|
|
9129
|
+
if (input === missing) return missingExit;
|
|
9130
|
+
if (refinement(input)) return sameExit;
|
|
9131
|
+
return fail5(new InvalidType(ast, input, options));
|
|
8846
9132
|
};
|
|
8847
9133
|
}
|
|
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) => {
|
|
9134
|
+
var parameterFromPropertyKey = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
|
|
8855
9135
|
switch (ast._tag) {
|
|
8856
9136
|
default:
|
|
8857
9137
|
return ast;
|
|
@@ -8887,70 +9167,33 @@ function collectIssues(checks, value, issues, ast, options) {
|
|
|
8887
9167
|
for (let i = 0; i < checks.length; i++) {
|
|
8888
9168
|
const check = checks[i];
|
|
8889
9169
|
if (check._tag === "FilterGroup") {
|
|
8890
|
-
collectIssues(check.checks, value, issues, ast, options);
|
|
9170
|
+
issues = collectIssues(check.checks, value, issues, ast, options);
|
|
9171
|
+
if (issues && (options.errors !== "all" || issues[issues.length - 1].filter.aborted)) {
|
|
9172
|
+
return issues;
|
|
9173
|
+
}
|
|
8891
9174
|
} else {
|
|
8892
9175
|
const issue = check.run(value, ast, options);
|
|
8893
9176
|
if (issue) {
|
|
8894
|
-
|
|
8895
|
-
if (
|
|
8896
|
-
|
|
9177
|
+
const filter7 = new Filter(check, issue, value, options);
|
|
9178
|
+
if (issues) issues.push(filter7);
|
|
9179
|
+
else issues = [filter7];
|
|
9180
|
+
if (options.errors !== "all" || check.aborted) {
|
|
9181
|
+
return issues;
|
|
8897
9182
|
}
|
|
8898
9183
|
}
|
|
8899
9184
|
}
|
|
8900
9185
|
}
|
|
9186
|
+
return issues;
|
|
8901
9187
|
}
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
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;
|
|
9188
|
+
function getConstructorDescriptor(ast) {
|
|
9189
|
+
if (!isDeclaration(ast)) return void 0;
|
|
9190
|
+
const getDescriptor = ast.annotations?.[CONSTRUCTOR_ANNOTATION_KEY];
|
|
9191
|
+
return isFunction(getDescriptor) ? getDescriptor(ast.typeParameters) : void 0;
|
|
8922
9192
|
}
|
|
8923
9193
|
|
|
8924
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
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);
|
|
8942
|
-
}
|
|
8943
|
-
return toConstructorAST(ast2);
|
|
8944
|
-
});
|
|
8945
|
-
case "Suspend":
|
|
8946
|
-
return ast.recur(toConstructorAST);
|
|
8947
|
-
default:
|
|
8948
|
-
return ast;
|
|
8949
|
-
}
|
|
8950
|
-
});
|
|
9194
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/SchemaParser.js
|
|
8951
9195
|
function makeEffect(schema) {
|
|
8952
|
-
const
|
|
8953
|
-
const parser = run(ast);
|
|
9196
|
+
const parser = runWithCompiler(constructorCompiler, toType(schema.ast));
|
|
8954
9197
|
return (input, options) => {
|
|
8955
9198
|
return parser(input, options?.disableChecks ? options?.parseOptions ? {
|
|
8956
9199
|
...options.parseOptions,
|
|
@@ -8971,7 +9214,7 @@ function makeOption(schema) {
|
|
|
8971
9214
|
return none2();
|
|
8972
9215
|
};
|
|
8973
9216
|
}
|
|
8974
|
-
function
|
|
9217
|
+
function make11(schema) {
|
|
8975
9218
|
const parser = makeEffect(schema);
|
|
8976
9219
|
return (input, options) => {
|
|
8977
9220
|
const exit3 = runSyncExit2(parser(input, options));
|
|
@@ -8979,7 +9222,7 @@ function make12(schema) {
|
|
|
8979
9222
|
return exit3.value;
|
|
8980
9223
|
}
|
|
8981
9224
|
const issue = getSchemaIssueOrThrow(exit3.cause, "Constructor adapter can only throw schema issues");
|
|
8982
|
-
throw new Error(
|
|
9225
|
+
throw new Error("Schema validation failed", {
|
|
8983
9226
|
cause: issue
|
|
8984
9227
|
});
|
|
8985
9228
|
};
|
|
@@ -8988,104 +9231,164 @@ function decodeUnknownEffect(schema, options) {
|
|
|
8988
9231
|
const parser = run(schema.ast);
|
|
8989
9232
|
return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
8990
9233
|
}
|
|
8991
|
-
var mergeParseOptions = (options, overrideOptions) => overrideOptions
|
|
9234
|
+
var mergeParseOptions = (options, overrideOptions) => overrideOptions ? {
|
|
8992
9235
|
...options,
|
|
8993
9236
|
...overrideOptions
|
|
9237
|
+
} : options;
|
|
9238
|
+
var getValue = (value) => {
|
|
9239
|
+
if (value === missing) {
|
|
9240
|
+
return fail5(new InvalidValue());
|
|
9241
|
+
}
|
|
9242
|
+
return succeed5(value);
|
|
8994
9243
|
};
|
|
8995
9244
|
function run(ast) {
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9245
|
+
return runWithCompiler(normalCompiler, ast);
|
|
9246
|
+
}
|
|
9247
|
+
function runWithCompiler(compiler, ast) {
|
|
9248
|
+
let parser;
|
|
9249
|
+
return (input, options) => {
|
|
9250
|
+
const result3 = (parser ??= compiler(ast))(input, options ?? defaultParseOptions);
|
|
9251
|
+
if (result3 === sameExit) {
|
|
9252
|
+
return succeed5(input);
|
|
9000
9253
|
}
|
|
9001
|
-
|
|
9002
|
-
|
|
9254
|
+
if (!effectIsExit(result3)) {
|
|
9255
|
+
return flatMapEager2(result3, getValue);
|
|
9256
|
+
}
|
|
9257
|
+
return result3[args] === missing ? getValue(missing) : result3;
|
|
9258
|
+
};
|
|
9003
9259
|
}
|
|
9004
|
-
|
|
9005
|
-
|
|
9260
|
+
var normalCompiler = /* @__PURE__ */ memoize((ast) => makeParser(ast, normalCompiler));
|
|
9261
|
+
var constructorCompiler = /* @__PURE__ */ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault));
|
|
9262
|
+
var compileDefaulted = /* @__PURE__ */ memoize((ast) => makeParser(ast, constructorCompiler, compileConstructorDefault, ast.context?.constructorDefault));
|
|
9263
|
+
function compileConstructorDefault(ast) {
|
|
9264
|
+
return ast.context?.constructorDefault ? compileDefaulted(ast) : constructorCompiler(ast);
|
|
9265
|
+
}
|
|
9266
|
+
function applyTransformation(result3, current, transformation, options) {
|
|
9267
|
+
let transformed;
|
|
9268
|
+
if (effectIsExit(result3) && result3._tag === "Success") {
|
|
9269
|
+
const optional2 = toOption(result3 === sameExit ? current : result3[args]);
|
|
9270
|
+
transformed = transformation._tag === "Transformation" ? transformation.decode.run(optional2, options) : transformation.decode(succeed6(optional2), options);
|
|
9271
|
+
} else if (transformation._tag === "Transformation") {
|
|
9272
|
+
transformed = flatMapEager2(result3, (value) => transformation.decode.run(toOption(value), options));
|
|
9273
|
+
} else {
|
|
9274
|
+
transformed = transformation.decode(mapEager2(result3, toOption), options);
|
|
9275
|
+
}
|
|
9276
|
+
return effectIsExit(transformed) && transformed._tag === "Success" ? fromOptionExit(transformed[args]) : flatMapEager2(transformed, fromOptionExit);
|
|
9006
9277
|
}
|
|
9007
|
-
|
|
9008
|
-
let
|
|
9278
|
+
function makeConstructorParser(descriptor, compile) {
|
|
9279
|
+
let sourceParser;
|
|
9280
|
+
return (input, options) => {
|
|
9281
|
+
if (input === missing) return missingExit;
|
|
9282
|
+
if (descriptor.isConstructed(input)) return sameExit;
|
|
9283
|
+
const result3 = (sourceParser ??= compile(descriptor.link.to))(input, options);
|
|
9284
|
+
return applyTransformation(result3, input, descriptor.link.transformation, options);
|
|
9285
|
+
};
|
|
9286
|
+
}
|
|
9287
|
+
function makeParser(ast, compile, compileConstructorDefault2, constructorDefault) {
|
|
9288
|
+
const descriptor = compileConstructorDefault2 ? getConstructorDescriptor(ast) : void 0;
|
|
9289
|
+
const parser = descriptor ? makeConstructorParser(descriptor, compile) : ast.getParser(compile, compileConstructorDefault2);
|
|
9009
9290
|
const checks = ast.checks;
|
|
9010
|
-
const
|
|
9011
|
-
const links = encoding;
|
|
9012
|
-
const len = links?.length ?? 0;
|
|
9291
|
+
const links = constructorDefault ? ast.encoding ? [...ast.encoding, constructorDefault] : [constructorDefault] : ast.encoding;
|
|
9013
9292
|
const encodingChecks = ast.encodingChecks;
|
|
9014
9293
|
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);
|
|
9294
|
+
if (!links && !checks && !encodingChecks) {
|
|
9295
|
+
if (!astOptions) {
|
|
9296
|
+
return parser;
|
|
9297
|
+
}
|
|
9298
|
+
return (input, options) => parser(input, mergeParseOptions(options, astOptions));
|
|
9299
|
+
}
|
|
9300
|
+
let encodingParsers;
|
|
9301
|
+
const parseLocal = (input, options) => {
|
|
9302
|
+
let result3 = parser(input, options);
|
|
9303
|
+
if (encodingChecks && !options.disableChecks) {
|
|
9304
|
+
if (effectIsExit(result3)) {
|
|
9305
|
+
if (result3._tag === "Success") {
|
|
9306
|
+
const output = result3 === sameExit ? input : result3[args];
|
|
9307
|
+
if (input !== missing && output !== missing) {
|
|
9308
|
+
const issues = collectIssues(encodingChecks, input, void 0, ast, options);
|
|
9309
|
+
if (issues) {
|
|
9310
|
+
result3 = fail5(new Composite(ast, issues, input, options));
|
|
9311
|
+
}
|
|
9312
|
+
}
|
|
9046
9313
|
}
|
|
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));
|
|
9314
|
+
} else {
|
|
9315
|
+
result3 = flatMap5(result3, (value) => {
|
|
9316
|
+
if (input !== missing && value !== missing) {
|
|
9317
|
+
const issues = collectIssues(encodingChecks, input, void 0, ast, options);
|
|
9318
|
+
if (issues) {
|
|
9319
|
+
return fail5(new Composite(ast, issues, input, options));
|
|
9060
9320
|
}
|
|
9061
9321
|
}
|
|
9062
|
-
return
|
|
9322
|
+
return succeed5(value);
|
|
9063
9323
|
});
|
|
9064
9324
|
}
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9325
|
+
}
|
|
9326
|
+
if (checks && !options.disableChecks) {
|
|
9327
|
+
if (effectIsExit(result3)) {
|
|
9328
|
+
if (result3._tag === "Success") {
|
|
9329
|
+
const value = result3 === sameExit ? input : result3[args];
|
|
9330
|
+
if (value === missing) return result3;
|
|
9331
|
+
const issues = collectIssues(checks, value, void 0, ast, options);
|
|
9332
|
+
if (issues) {
|
|
9333
|
+
result3 = fail5(new Composite(ast, issues, value, options));
|
|
9334
|
+
}
|
|
9335
|
+
}
|
|
9336
|
+
} else {
|
|
9337
|
+
result3 = flatMap5(result3, (value) => {
|
|
9338
|
+
if (value !== missing) {
|
|
9339
|
+
const issues = collectIssues(checks, value, void 0, ast, options);
|
|
9340
|
+
if (issues) {
|
|
9341
|
+
return fail5(new Composite(ast, issues, value, options));
|
|
9073
9342
|
}
|
|
9074
9343
|
}
|
|
9075
|
-
return
|
|
9344
|
+
return succeed5(value);
|
|
9076
9345
|
});
|
|
9077
9346
|
}
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
const sroa = srou ? flatMapEager2(srou, parseLocal) : parseLocal(ou);
|
|
9081
|
-
return sroa;
|
|
9347
|
+
}
|
|
9348
|
+
return result3;
|
|
9082
9349
|
};
|
|
9083
|
-
|
|
9350
|
+
if (!links) {
|
|
9351
|
+
return astOptions ? (input, options) => parseLocal(input, mergeParseOptions(options, astOptions)) : parseLocal;
|
|
9352
|
+
}
|
|
9353
|
+
return (input, options) => {
|
|
9354
|
+
if (astOptions) {
|
|
9355
|
+
options = mergeParseOptions(options, astOptions);
|
|
9356
|
+
}
|
|
9357
|
+
const parsers = encodingParsers ??= links.map((link2) => compile(link2.to));
|
|
9358
|
+
let current = input;
|
|
9359
|
+
let result3 = parsers[parsers.length - 1](input, options);
|
|
9360
|
+
for (let i = links.length - 1; i >= 0; i--) {
|
|
9361
|
+
result3 = applyTransformation(result3, current, links[i].transformation, options);
|
|
9362
|
+
if (i !== 0) {
|
|
9363
|
+
const next = parsers[i - 1];
|
|
9364
|
+
if (result3._tag === "Success") {
|
|
9365
|
+
current = result3[args];
|
|
9366
|
+
result3 = next(current, options);
|
|
9367
|
+
} else {
|
|
9368
|
+
result3 = flatMapEager2(result3, (value) => {
|
|
9369
|
+
const nextResult = next(value, options);
|
|
9370
|
+
return nextResult === sameExit ? succeed6(value) : nextResult;
|
|
9371
|
+
});
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
}
|
|
9375
|
+
if (result3._tag === "Success") {
|
|
9376
|
+
const value = result3[args];
|
|
9377
|
+
const local = parseLocal(value, options);
|
|
9378
|
+
return local === sameExit ? result3 : local;
|
|
9379
|
+
}
|
|
9380
|
+
result3 = catchCause2(result3, (cause) => failCauseSync2(() => map6(cause, (issue) => new Encoding(ast, issue, input, options))));
|
|
9381
|
+
return flatMapEager2(result3, (value) => {
|
|
9382
|
+
const local = parseLocal(value, options);
|
|
9383
|
+
return local === sameExit ? succeed6(value) : local;
|
|
9384
|
+
});
|
|
9385
|
+
};
|
|
9386
|
+
}
|
|
9084
9387
|
|
|
9085
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9086
|
-
var
|
|
9388
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/internal/schema/schema.js
|
|
9389
|
+
var TypeId15 = "~effect/Schema/Schema";
|
|
9087
9390
|
var SchemaProto = {
|
|
9088
|
-
[
|
|
9391
|
+
[TypeId15]: TypeId15,
|
|
9089
9392
|
pipe() {
|
|
9090
9393
|
return pipeArguments(this, arguments);
|
|
9091
9394
|
},
|
|
@@ -9099,35 +9402,49 @@ var SchemaProto = {
|
|
|
9099
9402
|
return this.rebuild(appendChecks(this.ast, checks));
|
|
9100
9403
|
}
|
|
9101
9404
|
};
|
|
9102
|
-
function
|
|
9405
|
+
function make12(ast, options) {
|
|
9103
9406
|
function Schema() {
|
|
9104
9407
|
}
|
|
9105
9408
|
const self = Object.defineProperties(Object.setPrototypeOf(Schema, SchemaProto), Object.getOwnPropertyDescriptors({
|
|
9106
9409
|
...options
|
|
9107
9410
|
}));
|
|
9108
9411
|
self.ast = ast;
|
|
9109
|
-
self.rebuild = (ast2) =>
|
|
9110
|
-
|
|
9111
|
-
self.
|
|
9112
|
-
self.make = make12(self);
|
|
9412
|
+
self.rebuild = (ast2) => make12(ast2, options);
|
|
9413
|
+
self.makeEffect = makeEffect(self);
|
|
9414
|
+
self.make = make11(self);
|
|
9113
9415
|
self.makeOption = makeOption(self);
|
|
9114
9416
|
return self;
|
|
9115
9417
|
}
|
|
9116
|
-
function fromIssueEffect(self) {
|
|
9117
|
-
return catchCause2(self, (cause) => failCauseSync2(() => map6(cause, (issue) => new SchemaError(issue))));
|
|
9118
|
-
}
|
|
9119
9418
|
|
|
9120
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9419
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Struct.js
|
|
9121
9420
|
var lambda = (f) => f;
|
|
9122
9421
|
|
|
9123
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9422
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Schema.js
|
|
9124
9423
|
function declareConstructor() {
|
|
9125
9424
|
return (typeParameters, run2, annotations) => {
|
|
9126
|
-
return
|
|
9425
|
+
return make13(new Declaration(typeParameters.map(getAST), (typeParameters2) => run2(typeParameters2.map((ast) => make13(ast))), annotations));
|
|
9127
9426
|
};
|
|
9128
9427
|
}
|
|
9129
9428
|
function declare(is2, annotations) {
|
|
9130
|
-
return declareConstructor()([], () => (input, ast) => is2(input) ?
|
|
9429
|
+
return declareConstructor()([], () => (input, ast, options) => is2(input) ? succeed5(input) : fail5(new InvalidType(ast, input, options)), annotations);
|
|
9430
|
+
}
|
|
9431
|
+
var SchemaErrorTypeId = "~effect/SchemaError/SchemaError";
|
|
9432
|
+
var SchemaError = class extends (/* @__PURE__ */ TaggedError2("SchemaError")) {
|
|
9433
|
+
[SchemaErrorTypeId] = SchemaErrorTypeId;
|
|
9434
|
+
constructor(issue) {
|
|
9435
|
+
super({
|
|
9436
|
+
issue
|
|
9437
|
+
});
|
|
9438
|
+
}
|
|
9439
|
+
get message() {
|
|
9440
|
+
return defaultFormatter(this.issue);
|
|
9441
|
+
}
|
|
9442
|
+
toString() {
|
|
9443
|
+
return `SchemaError(${this.message})`;
|
|
9444
|
+
}
|
|
9445
|
+
};
|
|
9446
|
+
function isSchemaError(u) {
|
|
9447
|
+
return hasProperty(u, SchemaErrorTypeId) && u[SchemaErrorTypeId] === SchemaErrorTypeId;
|
|
9131
9448
|
}
|
|
9132
9449
|
function decodeUnknownEffect2(schema, options) {
|
|
9133
9450
|
const parser = decodeUnknownEffect(schema, options);
|
|
@@ -9135,6 +9452,9 @@ function decodeUnknownEffect2(schema, options) {
|
|
|
9135
9452
|
return fromIssueEffect(parser(input, options2));
|
|
9136
9453
|
};
|
|
9137
9454
|
}
|
|
9455
|
+
function fromIssueEffect(self) {
|
|
9456
|
+
return catchCause2(self, (cause) => failCauseSync2(() => map6(cause, (issue) => new SchemaError(issue))));
|
|
9457
|
+
}
|
|
9138
9458
|
function getSchemaErrorOrThrow(cause, message) {
|
|
9139
9459
|
let schemaError;
|
|
9140
9460
|
for (const reason of cause.reasons) {
|
|
@@ -9165,9 +9485,9 @@ function decodeUnknownSync(schema, options) {
|
|
|
9165
9485
|
return runSchemaErrorSync(parser(input, options2));
|
|
9166
9486
|
};
|
|
9167
9487
|
}
|
|
9168
|
-
var
|
|
9488
|
+
var make13 = make12;
|
|
9169
9489
|
function Literal2(literal) {
|
|
9170
|
-
const out =
|
|
9490
|
+
const out = make13(new Literal(literal), {
|
|
9171
9491
|
literal,
|
|
9172
9492
|
transform(to) {
|
|
9173
9493
|
return out.pipe(decodeTo2(Literal2(to), {
|
|
@@ -9178,10 +9498,10 @@ function Literal2(literal) {
|
|
|
9178
9498
|
});
|
|
9179
9499
|
return out;
|
|
9180
9500
|
}
|
|
9181
|
-
var String4 = /* @__PURE__ */
|
|
9182
|
-
var Number5 = /* @__PURE__ */
|
|
9501
|
+
var String4 = /* @__PURE__ */ make13(string2);
|
|
9502
|
+
var Number5 = /* @__PURE__ */ make13(number2);
|
|
9183
9503
|
function makeStruct(ast, fields) {
|
|
9184
|
-
return
|
|
9504
|
+
return make13(ast, {
|
|
9185
9505
|
fields,
|
|
9186
9506
|
mapFields(f, options) {
|
|
9187
9507
|
const fields2 = f(this.fields);
|
|
@@ -9193,7 +9513,7 @@ function Struct(fields) {
|
|
|
9193
9513
|
return makeStruct(struct(fields, void 0), fields);
|
|
9194
9514
|
}
|
|
9195
9515
|
function makeTuple(ast, elements) {
|
|
9196
|
-
return
|
|
9516
|
+
return make13(ast, {
|
|
9197
9517
|
elements,
|
|
9198
9518
|
mapElements(f, options) {
|
|
9199
9519
|
const elements2 = f(this.elements);
|
|
@@ -9204,11 +9524,11 @@ function makeTuple(ast, elements) {
|
|
|
9204
9524
|
function Tuple(elements) {
|
|
9205
9525
|
return makeTuple(tuple(elements), elements);
|
|
9206
9526
|
}
|
|
9207
|
-
var ArraySchema = /* @__PURE__ */ lambda((schema) =>
|
|
9527
|
+
var ArraySchema = /* @__PURE__ */ lambda((schema) => make13(new Arrays(false, [], [schema.ast]), {
|
|
9208
9528
|
value: schema
|
|
9209
9529
|
}));
|
|
9210
9530
|
function makeUnion(ast, members) {
|
|
9211
|
-
return
|
|
9531
|
+
return make13(ast, {
|
|
9212
9532
|
members,
|
|
9213
9533
|
mapMembers(f, options) {
|
|
9214
9534
|
const members2 = f(this.members);
|
|
@@ -9221,29 +9541,26 @@ function Union2(members, options) {
|
|
|
9221
9541
|
}
|
|
9222
9542
|
function decodeTo2(to, transformation) {
|
|
9223
9543
|
return (from) => {
|
|
9224
|
-
return
|
|
9544
|
+
return make13(decodeTo(from.ast, to.ast, transformation ? make10(transformation) : passthrough3()), {
|
|
9225
9545
|
from,
|
|
9226
9546
|
to
|
|
9227
9547
|
});
|
|
9228
9548
|
};
|
|
9229
9549
|
}
|
|
9230
9550
|
function withConstructorDefault2(defaultValue) {
|
|
9231
|
-
return (schema) =>
|
|
9551
|
+
return (schema) => make13(withConstructorDefault(schema.ast, defaultValue), {
|
|
9232
9552
|
schema
|
|
9233
9553
|
});
|
|
9234
9554
|
}
|
|
9235
|
-
function toIssueEffect(self) {
|
|
9236
|
-
return catchCause2(self, (cause) => failCauseSync2(() => map6(cause, (error) => error.issue)));
|
|
9237
|
-
}
|
|
9238
9555
|
function tag(literal) {
|
|
9239
|
-
return Literal2(literal).pipe(withConstructorDefault2(
|
|
9556
|
+
return Literal2(literal).pipe(withConstructorDefault2(succeed5(literal)));
|
|
9240
9557
|
}
|
|
9241
9558
|
function instanceOf(constructor, annotations) {
|
|
9242
9559
|
return declare((u) => u instanceof constructor, annotations);
|
|
9243
9560
|
}
|
|
9244
9561
|
function link() {
|
|
9245
9562
|
return (encodeTo, transformation) => {
|
|
9246
|
-
return new Link(encodeTo.ast,
|
|
9563
|
+
return new Link(encodeTo.ast, make10(transformation));
|
|
9247
9564
|
};
|
|
9248
9565
|
}
|
|
9249
9566
|
var makeFilter2 = makeFilter;
|
|
@@ -9311,13 +9628,13 @@ var RegExp2 = /* @__PURE__ */ instanceOf(globalThis.RegExp, {
|
|
|
9311
9628
|
source: String4,
|
|
9312
9629
|
flags: String4
|
|
9313
9630
|
}), transformOrFail2({
|
|
9314
|
-
decode: (e) => try_3({
|
|
9631
|
+
decode: (e, options) => try_3({
|
|
9315
9632
|
try: () => new globalThis.RegExp(e.source, e.flags),
|
|
9316
|
-
catch: (
|
|
9317
|
-
|
|
9318
|
-
})
|
|
9633
|
+
catch: () => new InvalidValue({
|
|
9634
|
+
expected: "valid RegExp source and flags"
|
|
9635
|
+
}, e, options)
|
|
9319
9636
|
}),
|
|
9320
|
-
encode: (regExp) =>
|
|
9637
|
+
encode: (regExp) => succeed5({
|
|
9321
9638
|
source: regExp.source,
|
|
9322
9639
|
flags: regExp.flags
|
|
9323
9640
|
})
|
|
@@ -9372,19 +9689,19 @@ var File = /* @__PURE__ */ instanceOf(globalThis.File, {
|
|
|
9372
9689
|
name: String4,
|
|
9373
9690
|
lastModified: Int
|
|
9374
9691
|
}), transformOrFail2({
|
|
9375
|
-
decode: (e) => match3(decodeBase64(e.data), {
|
|
9376
|
-
onFailure: (
|
|
9377
|
-
|
|
9378
|
-
})),
|
|
9692
|
+
decode: (e, options) => match3(decodeBase64(e.data), {
|
|
9693
|
+
onFailure: () => fail5(new InvalidValue({
|
|
9694
|
+
expected: "a valid Base64 string"
|
|
9695
|
+
}, e.data, options)),
|
|
9379
9696
|
onSuccess: (bytes) => {
|
|
9380
9697
|
const buffer = new globalThis.Uint8Array(bytes);
|
|
9381
|
-
return
|
|
9698
|
+
return succeed5(new globalThis.File([buffer], e.name, {
|
|
9382
9699
|
type: e.type,
|
|
9383
9700
|
lastModified: e.lastModified
|
|
9384
9701
|
}));
|
|
9385
9702
|
}
|
|
9386
9703
|
}),
|
|
9387
|
-
encode: (file) => tryPromise2({
|
|
9704
|
+
encode: (file, options) => tryPromise2({
|
|
9388
9705
|
try: async () => {
|
|
9389
9706
|
const bytes = new globalThis.Uint8Array(await file.arrayBuffer());
|
|
9390
9707
|
return {
|
|
@@ -9394,9 +9711,9 @@ var File = /* @__PURE__ */ instanceOf(globalThis.File, {
|
|
|
9394
9711
|
lastModified: file.lastModified
|
|
9395
9712
|
};
|
|
9396
9713
|
},
|
|
9397
|
-
catch: (
|
|
9398
|
-
|
|
9399
|
-
})
|
|
9714
|
+
catch: () => new InvalidValue({
|
|
9715
|
+
expected: "a readable File"
|
|
9716
|
+
}, file, options)
|
|
9400
9717
|
})
|
|
9401
9718
|
}))
|
|
9402
9719
|
});
|
|
@@ -9422,10 +9739,10 @@ var FormData2 = /* @__PURE__ */ instanceOf(globalThis.FormData, {
|
|
|
9422
9739
|
for (const [key, entry] of e) {
|
|
9423
9740
|
out.append(key, entry.value);
|
|
9424
9741
|
}
|
|
9425
|
-
return
|
|
9742
|
+
return succeed5(out);
|
|
9426
9743
|
},
|
|
9427
9744
|
encode: (formData) => {
|
|
9428
|
-
return
|
|
9745
|
+
return succeed5(globalThis.Array.from(formData.entries()).map(([key, value]) => {
|
|
9429
9746
|
if (typeof value === "string") {
|
|
9430
9747
|
return [key, {
|
|
9431
9748
|
_tag: "String",
|
|
@@ -9477,7 +9794,7 @@ var Uint8Array2 = /* @__PURE__ */ instanceOf(globalThis.Uint8Array, {
|
|
|
9477
9794
|
toArbitrary: () => (fc) => fc.uint8Array()
|
|
9478
9795
|
});
|
|
9479
9796
|
|
|
9480
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9797
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Ref.js
|
|
9481
9798
|
var Ref_exports = {};
|
|
9482
9799
|
__export(Ref_exports, {
|
|
9483
9800
|
get: () => get3,
|
|
@@ -9485,7 +9802,7 @@ __export(Ref_exports, {
|
|
|
9485
9802
|
getAndUpdate: () => getAndUpdate,
|
|
9486
9803
|
getAndUpdateSome: () => getAndUpdateSome,
|
|
9487
9804
|
getUnsafe: () => getUnsafe3,
|
|
9488
|
-
make: () =>
|
|
9805
|
+
make: () => make15,
|
|
9489
9806
|
makeUnsafe: () => makeUnsafe4,
|
|
9490
9807
|
modify: () => modify2,
|
|
9491
9808
|
modifySome: () => modifySome,
|
|
@@ -9497,10 +9814,10 @@ __export(Ref_exports, {
|
|
|
9497
9814
|
updateSomeAndGet: () => updateSomeAndGet
|
|
9498
9815
|
});
|
|
9499
9816
|
|
|
9500
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9501
|
-
var
|
|
9817
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/MutableRef.js
|
|
9818
|
+
var TypeId16 = "~effect/MutableRef";
|
|
9502
9819
|
var MutableRefProto = {
|
|
9503
|
-
[
|
|
9820
|
+
[TypeId16]: TypeId16,
|
|
9504
9821
|
...PipeInspectableProto,
|
|
9505
9822
|
toJSON() {
|
|
9506
9823
|
return {
|
|
@@ -9509,7 +9826,7 @@ var MutableRefProto = {
|
|
|
9509
9826
|
};
|
|
9510
9827
|
}
|
|
9511
9828
|
};
|
|
9512
|
-
var
|
|
9829
|
+
var make14 = (value) => {
|
|
9513
9830
|
const ref = Object.create(MutableRefProto);
|
|
9514
9831
|
ref.current = value;
|
|
9515
9832
|
return ref;
|
|
@@ -9519,10 +9836,10 @@ var set = /* @__PURE__ */ dual(2, (self, value) => {
|
|
|
9519
9836
|
return self;
|
|
9520
9837
|
});
|
|
9521
9838
|
|
|
9522
|
-
// ../../node_modules/.pnpm/effect@4.0.0-
|
|
9523
|
-
var
|
|
9839
|
+
// ../../node_modules/.pnpm/effect@4.0.0-rc.109/node_modules/effect/dist/Ref.js
|
|
9840
|
+
var TypeId17 = "~effect/Ref";
|
|
9524
9841
|
var RefProto = {
|
|
9525
|
-
[
|
|
9842
|
+
[TypeId17]: {
|
|
9526
9843
|
_A: identity
|
|
9527
9844
|
},
|
|
9528
9845
|
...PipeInspectableProto,
|
|
@@ -9535,10 +9852,10 @@ var RefProto = {
|
|
|
9535
9852
|
};
|
|
9536
9853
|
var makeUnsafe4 = (value) => {
|
|
9537
9854
|
const self = Object.create(RefProto);
|
|
9538
|
-
self.ref =
|
|
9855
|
+
self.ref = make14(value);
|
|
9539
9856
|
return self;
|
|
9540
9857
|
};
|
|
9541
|
-
var
|
|
9858
|
+
var make15 = (value) => sync2(() => makeUnsafe4(value));
|
|
9542
9859
|
var get3 = (self) => sync2(() => self.ref.current);
|
|
9543
9860
|
var set2 = /* @__PURE__ */ dual(2, (self, value) => sync2(() => set(self.ref, value)));
|
|
9544
9861
|
var getAndSet = /* @__PURE__ */ dual(2, (self, value) => sync2(() => {
|
|
@@ -9588,7 +9905,7 @@ var updateSomeAndGet = /* @__PURE__ */ dual(2, (self, pf) => sync2(() => {
|
|
|
9588
9905
|
}));
|
|
9589
9906
|
var getUnsafe3 = (self) => self.ref.current;
|
|
9590
9907
|
|
|
9591
|
-
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-
|
|
9908
|
+
// ../../node_modules/.pnpm/effect-oxlint@0.3.2_effect@4.0.0-rc.109/node_modules/effect-oxlint/dist/index.js
|
|
9592
9909
|
var AST_exports = /* @__PURE__ */ __exportAll({
|
|
9593
9910
|
calleeIdentifier: () => calleeIdentifier,
|
|
9594
9911
|
calleeName: () => calleeName,
|
|
@@ -9660,13 +9977,13 @@ var Diagnostic_exports = /* @__PURE__ */ __exportAll({
|
|
|
9660
9977
|
fromId: () => fromId,
|
|
9661
9978
|
insertAfter: () => insertAfter,
|
|
9662
9979
|
insertBefore: () => insertBefore,
|
|
9663
|
-
make: () =>
|
|
9980
|
+
make: () => make16,
|
|
9664
9981
|
removeFix: () => removeFix,
|
|
9665
9982
|
replaceText: () => replaceText,
|
|
9666
9983
|
withFix: () => withFix,
|
|
9667
9984
|
withSuggestions: () => withSuggestions
|
|
9668
9985
|
});
|
|
9669
|
-
var
|
|
9986
|
+
var make16 = (opts) => ({
|
|
9670
9987
|
node: opts.node,
|
|
9671
9988
|
message: opts.message,
|
|
9672
9989
|
data: opts.data
|
|
@@ -9764,7 +10081,7 @@ var tracked = (nodeType, predicate, ref) => ({
|
|
|
9764
10081
|
});
|
|
9765
10082
|
var filter6 = dual(2, (predicate, visitor) => service2(RuleContext).pipe(map7((ctx) => predicate(ctx.filename) ? visitor : {})));
|
|
9766
10083
|
var accumulate = (nodeType, extract, analyze) => gen4(function* () {
|
|
9767
|
-
const ref = yield*
|
|
10084
|
+
const ref = yield* make15([]);
|
|
9768
10085
|
return merge3(on(nodeType, (node) => pipe(extract(node), match({
|
|
9769
10086
|
onNone: () => void_5,
|
|
9770
10087
|
onSome: (value) => update2(ref, (items) => [...items, value])
|
|
@@ -9818,7 +10135,7 @@ var banMember = (obj, prop, opts) => define({
|
|
|
9818
10135
|
const ctx = yield* RuleContext;
|
|
9819
10136
|
return { MemberExpression: (node) => pipe(narrow(node, "MemberExpression"), flatMap(matchMember(obj, prop)), match({
|
|
9820
10137
|
onNone: () => void_5,
|
|
9821
|
-
onSome: (matched) => ctx.report(
|
|
10138
|
+
onSome: (matched) => ctx.report(make16({
|
|
9822
10139
|
node: matched,
|
|
9823
10140
|
message: opts.message
|
|
9824
10141
|
}))
|
|
@@ -9835,7 +10152,7 @@ var banImport = (source, opts) => define({
|
|
|
9835
10152
|
const ctx = yield* RuleContext;
|
|
9836
10153
|
return { ImportDeclaration: (node) => pipe(narrow(node, "ImportDeclaration"), flatMap(matchImport(source)), match({
|
|
9837
10154
|
onNone: () => void_5,
|
|
9838
|
-
onSome: (matched) => ctx.report(
|
|
10155
|
+
onSome: (matched) => ctx.report(make16({
|
|
9839
10156
|
node: matched,
|
|
9840
10157
|
message: opts.message
|
|
9841
10158
|
}))
|
|
@@ -9854,7 +10171,7 @@ var banCallOf = (name, opts) => {
|
|
|
9854
10171
|
const ctx = yield* RuleContext;
|
|
9855
10172
|
return { CallExpression: (node) => pipe(narrow(node, "CallExpression"), flatMap(calleeName), filter((n) => contains2(names, n)), match({
|
|
9856
10173
|
onNone: () => void_5,
|
|
9857
|
-
onSome: () => ctx.report(
|
|
10174
|
+
onSome: () => ctx.report(make16({
|
|
9858
10175
|
node,
|
|
9859
10176
|
message: opts.message
|
|
9860
10177
|
}))
|
|
@@ -9872,7 +10189,7 @@ var banCallOfMember = (obj, prop, opts) => define({
|
|
|
9872
10189
|
const ctx = yield* RuleContext;
|
|
9873
10190
|
return { CallExpression: (node) => pipe(narrow(node, "CallExpression"), flatMap(matchCallOf(obj, prop)), match({
|
|
9874
10191
|
onNone: () => void_5,
|
|
9875
|
-
onSome: (matched) => ctx.report(
|
|
10192
|
+
onSome: (matched) => ctx.report(make16({
|
|
9876
10193
|
node: matched,
|
|
9877
10194
|
message: opts.message
|
|
9878
10195
|
}))
|
|
@@ -9891,7 +10208,7 @@ var banNewExpr = (name, opts) => {
|
|
|
9891
10208
|
const ctx = yield* RuleContext;
|
|
9892
10209
|
return { NewExpression: (node) => pipe(narrow(node, "NewExpression"), flatMap(calleeIdentifier), filter((n) => contains2(names, n)), match({
|
|
9893
10210
|
onNone: () => void_5,
|
|
9894
|
-
onSome: () => ctx.report(
|
|
10211
|
+
onSome: () => ctx.report(make16({
|
|
9895
10212
|
node,
|
|
9896
10213
|
message: opts.message
|
|
9897
10214
|
}))
|
|
@@ -9907,7 +10224,7 @@ var banStatement = (nodeType, opts) => define({
|
|
|
9907
10224
|
}),
|
|
9908
10225
|
create: function* () {
|
|
9909
10226
|
const ctx = yield* RuleContext;
|
|
9910
|
-
return { [nodeType]: (node) => ctx.report(
|
|
10227
|
+
return { [nodeType]: (node) => ctx.report(make16({
|
|
9911
10228
|
node,
|
|
9912
10229
|
message: opts.message
|
|
9913
10230
|
})) };
|
|
@@ -9921,7 +10238,7 @@ var banMultiple = (spec, opts) => define({
|
|
|
9921
10238
|
}),
|
|
9922
10239
|
create: function* () {
|
|
9923
10240
|
const ctx = yield* RuleContext;
|
|
9924
|
-
const report = (node) => ctx.report(
|
|
10241
|
+
const report = (node) => ctx.report(make16({
|
|
9925
10242
|
node,
|
|
9926
10243
|
message: opts.message
|
|
9927
10244
|
}));
|
|
@@ -10115,16 +10432,59 @@ var commandDefinePascalConst = Rule_exports.define({
|
|
|
10115
10432
|
});
|
|
10116
10433
|
|
|
10117
10434
|
// src/message.ts
|
|
10118
|
-
var
|
|
10119
|
-
var
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
return false;
|
|
10435
|
+
var foldkitMessageModule = "foldkit/message";
|
|
10436
|
+
var staticPropertyName = (property) => {
|
|
10437
|
+
if (property.type !== "Property") {
|
|
10438
|
+
return Option_exports.none();
|
|
10123
10439
|
}
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10440
|
+
if (!property.computed && isIdentifier(property.key)) {
|
|
10441
|
+
return Option_exports.some({ name: property.key.name, node: property.key });
|
|
10442
|
+
}
|
|
10443
|
+
if (isStringLiteral(property.key)) {
|
|
10444
|
+
return Option_exports.some({ name: property.key.value, node: property.key });
|
|
10445
|
+
}
|
|
10446
|
+
return Option_exports.none();
|
|
10447
|
+
};
|
|
10448
|
+
var recordFoldkitMessageUnionBindings = (bindings, node) => {
|
|
10449
|
+
if (node.type !== "Program") {
|
|
10450
|
+
return;
|
|
10451
|
+
}
|
|
10452
|
+
for (const statement of node.body) {
|
|
10453
|
+
if (statement.type !== "ImportDeclaration" || statement.importKind === "type" || statement.source.value !== foldkitMessageModule) {
|
|
10454
|
+
continue;
|
|
10455
|
+
}
|
|
10456
|
+
for (const specifier of statement.specifiers) {
|
|
10457
|
+
if (specifier.type === "ImportSpecifier" && specifier.importKind !== "type" && (isIdentifier(specifier.imported, "defineMessageUnion") || isStringLiteral(specifier.imported) && specifier.imported.value === "defineMessageUnion")) {
|
|
10458
|
+
bindings.add(specifier.local.name);
|
|
10459
|
+
}
|
|
10460
|
+
}
|
|
10461
|
+
}
|
|
10462
|
+
};
|
|
10463
|
+
var messageCases = (node, bindings) => {
|
|
10464
|
+
if (!isIdentifier(node.callee) || !bindings.has(node.callee.name)) {
|
|
10465
|
+
return [];
|
|
10466
|
+
}
|
|
10467
|
+
const [casesByTag] = node.arguments;
|
|
10468
|
+
if (!isObjectExpression(casesByTag)) {
|
|
10469
|
+
return [];
|
|
10470
|
+
}
|
|
10471
|
+
return casesByTag.properties.flatMap((property) => {
|
|
10472
|
+
const maybeName = staticPropertyName(property);
|
|
10473
|
+
if (property.type !== "Property" || Option_exports.isNone(maybeName) || !isObjectExpression(property.value)) {
|
|
10474
|
+
return [];
|
|
10475
|
+
}
|
|
10476
|
+
return [
|
|
10477
|
+
{
|
|
10478
|
+
name: maybeName.value.name,
|
|
10479
|
+
nameNode: maybeName.value.node,
|
|
10480
|
+
fields: property.value
|
|
10481
|
+
}
|
|
10482
|
+
];
|
|
10483
|
+
});
|
|
10127
10484
|
};
|
|
10485
|
+
var hasMessagePayloadProperty = (fields) => fields.properties.some(
|
|
10486
|
+
(property) => property.type === "Property" && (isIdentifier(property.key, "message") || isStringLiteral(property.key) && property.key.value === "message")
|
|
10487
|
+
);
|
|
10128
10488
|
|
|
10129
10489
|
// src/rules/got-prefix-requires-submodel-payload.ts
|
|
10130
10490
|
var gotPrefixRequiresSubmodelPayload = Rule_exports.define({
|
|
@@ -10135,18 +10495,23 @@ var gotPrefixRequiresSubmodelPayload = Rule_exports.define({
|
|
|
10135
10495
|
}),
|
|
10136
10496
|
create: function* () {
|
|
10137
10497
|
const ctx = yield* RuleContext;
|
|
10498
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
10138
10499
|
return {
|
|
10500
|
+
Program: (node) => {
|
|
10501
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
10502
|
+
return Effect_exports.void;
|
|
10503
|
+
},
|
|
10139
10504
|
CallExpression: (node) => {
|
|
10140
|
-
if (!isCallExpression(node)
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
}
|
|
10505
|
+
if (!isCallExpression(node)) return Effect_exports.void;
|
|
10506
|
+
return Effect_exports.forEach(
|
|
10507
|
+
messageCases(node, messageUnionBindings),
|
|
10508
|
+
(messageCase) => /^Got[A-Z]/.test(messageCase.name) && !hasMessagePayloadProperty(messageCase.fields) ? ctx.report(
|
|
10509
|
+
Diagnostic_exports.make({
|
|
10510
|
+
node: messageCase.nameNode,
|
|
10511
|
+
message: "Got* is reserved for Submodel wrappers. Add a { message: Child.Message } payload or choose a Message name that does not start with Got."
|
|
10512
|
+
})
|
|
10513
|
+
) : Effect_exports.void,
|
|
10514
|
+
{ discard: true }
|
|
10150
10515
|
);
|
|
10151
10516
|
}
|
|
10152
10517
|
};
|
|
@@ -10162,20 +10527,23 @@ var gotSubmodelMessageName = Rule_exports.define({
|
|
|
10162
10527
|
}),
|
|
10163
10528
|
create: function* () {
|
|
10164
10529
|
const ctx = yield* RuleContext;
|
|
10530
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
10165
10531
|
return {
|
|
10532
|
+
Program: (node) => {
|
|
10533
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
10534
|
+
return Effect_exports.void;
|
|
10535
|
+
},
|
|
10166
10536
|
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
|
-
})
|
|
10537
|
+
if (!isCallExpression(node)) return Effect_exports.void;
|
|
10538
|
+
return Effect_exports.forEach(
|
|
10539
|
+
messageCases(node, messageUnionBindings),
|
|
10540
|
+
(messageCase) => hasMessagePayloadProperty(messageCase.fields) && !/^Got[A-Z].*Message$/.test(messageCase.name) ? ctx.report(
|
|
10541
|
+
Diagnostic_exports.make({
|
|
10542
|
+
node: messageCase.nameNode,
|
|
10543
|
+
message: "Submodel wrapper Messages should be named Got*Message so Foldkit DevTools can filter them."
|
|
10544
|
+
})
|
|
10545
|
+
) : Effect_exports.void,
|
|
10546
|
+
{ discard: true }
|
|
10179
10547
|
);
|
|
10180
10548
|
}
|
|
10181
10549
|
};
|
|
@@ -10187,10 +10555,10 @@ var gotWrapperTagPattern = /^Got[A-Z]/;
|
|
|
10187
10555
|
var routingKeySuffixPattern = /Id$/;
|
|
10188
10556
|
var isRoutingKey = (keyName) => keyName === "message" || keyName === "id" || routingKeySuffixPattern.test(keyName);
|
|
10189
10557
|
var staticPropertyKey = (property) => {
|
|
10190
|
-
if (property.type !== "Property"
|
|
10558
|
+
if (property.type !== "Property") {
|
|
10191
10559
|
return Option_exports.none();
|
|
10192
10560
|
}
|
|
10193
|
-
if (isIdentifier(property.key)) {
|
|
10561
|
+
if (!property.computed && isIdentifier(property.key)) {
|
|
10194
10562
|
return Option_exports.some({ keyNode: property.key, keyName: property.key.name });
|
|
10195
10563
|
}
|
|
10196
10564
|
if (isStringLiteral(property.key)) {
|
|
@@ -10207,30 +10575,37 @@ var gotWrapperCarriesOnlyRouting = Rule_exports.define({
|
|
|
10207
10575
|
}),
|
|
10208
10576
|
create: function* () {
|
|
10209
10577
|
const ctx = yield* RuleContext;
|
|
10578
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
10210
10579
|
return {
|
|
10580
|
+
Program: (node) => {
|
|
10581
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
10582
|
+
return Effect_exports.void;
|
|
10583
|
+
},
|
|
10211
10584
|
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)) {
|
|
10585
|
+
if (!isCallExpression(node)) {
|
|
10217
10586
|
return Effect_exports.void;
|
|
10218
10587
|
}
|
|
10219
|
-
const wrapperTag = tagArgument.value;
|
|
10220
10588
|
return Effect_exports.forEach(
|
|
10221
|
-
|
|
10222
|
-
(
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10589
|
+
messageCases(node, messageUnionBindings),
|
|
10590
|
+
(messageCase) => gotWrapperTagPattern.test(messageCase.name) ? Effect_exports.forEach(
|
|
10591
|
+
messageCase.fields.properties,
|
|
10592
|
+
(property) => pipe(
|
|
10593
|
+
staticPropertyKey(property),
|
|
10594
|
+
Option_exports.match({
|
|
10595
|
+
onNone: () => Effect_exports.void,
|
|
10596
|
+
onSome: ({ keyNode, keyName }) => isRoutingKey(keyName) ? Effect_exports.void : ctx.report(
|
|
10597
|
+
Diagnostic_exports.make({
|
|
10598
|
+
node: keyNode,
|
|
10599
|
+
message: extraFieldMessage(
|
|
10600
|
+
messageCase.name,
|
|
10601
|
+
keyName
|
|
10602
|
+
)
|
|
10603
|
+
})
|
|
10604
|
+
)
|
|
10605
|
+
})
|
|
10606
|
+
),
|
|
10607
|
+
{ discard: true }
|
|
10608
|
+
) : Effect_exports.void,
|
|
10234
10609
|
{ discard: true }
|
|
10235
10610
|
);
|
|
10236
10611
|
}
|
|
@@ -10501,12 +10876,12 @@ var unstableViewOffenses = (node, context3) => {
|
|
|
10501
10876
|
if (Option_exports.isNone(maybeSlot)) {
|
|
10502
10877
|
return [];
|
|
10503
10878
|
}
|
|
10504
|
-
const slot = maybeSlot
|
|
10879
|
+
const { value: slot } = maybeSlot;
|
|
10505
10880
|
const maybeViewArgument = Array_exports.get(node.arguments, slot.viewArgumentIndex);
|
|
10506
10881
|
if (Option_exports.isNone(maybeViewArgument)) {
|
|
10507
10882
|
return [];
|
|
10508
10883
|
}
|
|
10509
|
-
const viewArgument = maybeViewArgument
|
|
10884
|
+
const { value: viewArgument } = maybeViewArgument;
|
|
10510
10885
|
if (viewArgument.type === "SpreadElement") {
|
|
10511
10886
|
return [];
|
|
10512
10887
|
}
|
|
@@ -10600,37 +10975,6 @@ var lazyViewStableReferences = Rule_exports.define({
|
|
|
10600
10975
|
}
|
|
10601
10976
|
});
|
|
10602
10977
|
|
|
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
10978
|
// src/rules/mount-factory-must-use-element.ts
|
|
10635
10979
|
var MOUNT_DEFINITION_METHODS = ["define", "defineStream"];
|
|
10636
10980
|
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 +11210,7 @@ var noArrayIndexViewKeys = Rule_exports.define({
|
|
|
10866
11210
|
if (Option_exports.isNone(maybeKeyExpression)) {
|
|
10867
11211
|
return;
|
|
10868
11212
|
}
|
|
10869
|
-
const keyExpression = maybeKeyExpression
|
|
11213
|
+
const { value: keyExpression } = maybeKeyExpression;
|
|
10870
11214
|
const maybeIndexName = Array_exports.findFirst(
|
|
10871
11215
|
activeIndexNames,
|
|
10872
11216
|
(indexName) => referencesIndexName(keyExpression, indexName)
|
|
@@ -10888,7 +11232,7 @@ var noArrayIndexViewKeys = Rule_exports.define({
|
|
|
10888
11232
|
|
|
10889
11233
|
// src/rules/no-child-message-construction-in-root.ts
|
|
10890
11234
|
var pascalIdentifierPattern = /^[A-Z][A-Za-z0-9]*$/;
|
|
10891
|
-
var childMessageConstructionMessage = (namespace,
|
|
11235
|
+
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
11236
|
var noChildMessageConstructionInRoot = Rule_exports.define({
|
|
10893
11237
|
name: "no-child-message-construction-in-root",
|
|
10894
11238
|
meta: Rule_exports.meta({
|
|
@@ -10911,8 +11255,8 @@ var noChildMessageConstructionInRoot = Rule_exports.define({
|
|
|
10911
11255
|
Option_exports.match({
|
|
10912
11256
|
onNone: () => Effect_exports.void,
|
|
10913
11257
|
onSome: (path) => {
|
|
10914
|
-
const [namespace, middle,
|
|
10915
|
-
if (namespace === void 0 || middle !== "Message" ||
|
|
11258
|
+
const [namespace, middle, constructorName2, extraSegment] = path;
|
|
11259
|
+
if (namespace === void 0 || middle !== "Message" || constructorName2 === void 0 || constructorName2 === "Message" || extraSegment !== void 0 || !pascalIdentifierPattern.test(namespace) || !pascalIdentifierPattern.test(constructorName2)) {
|
|
10916
11260
|
return Effect_exports.void;
|
|
10917
11261
|
}
|
|
10918
11262
|
return ctx.report(
|
|
@@ -10920,7 +11264,7 @@ var noChildMessageConstructionInRoot = Rule_exports.define({
|
|
|
10920
11264
|
node,
|
|
10921
11265
|
message: childMessageConstructionMessage(
|
|
10922
11266
|
namespace,
|
|
10923
|
-
|
|
11267
|
+
constructorName2
|
|
10924
11268
|
)
|
|
10925
11269
|
})
|
|
10926
11270
|
);
|
|
@@ -11330,6 +11674,15 @@ var noEmptyChildrenArray = Rule_exports.define({
|
|
|
11330
11674
|
});
|
|
11331
11675
|
|
|
11332
11676
|
// src/rules/no-empty-object-tagged-call.ts
|
|
11677
|
+
var constructorName = (callee) => {
|
|
11678
|
+
if (isIdentifier(callee) && /^[A-Z][A-Za-z0-9]*$/.test(callee.name)) {
|
|
11679
|
+
return callee.name;
|
|
11680
|
+
}
|
|
11681
|
+
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)) {
|
|
11682
|
+
return `${callee.object.name}.${callee.property.name}`;
|
|
11683
|
+
}
|
|
11684
|
+
return void 0;
|
|
11685
|
+
};
|
|
11333
11686
|
var noEmptyObjectTaggedCall = Rule_exports.define({
|
|
11334
11687
|
name: "no-empty-object-tagged-call",
|
|
11335
11688
|
meta: Rule_exports.meta({
|
|
@@ -11340,10 +11693,11 @@ var noEmptyObjectTaggedCall = Rule_exports.define({
|
|
|
11340
11693
|
const ctx = yield* RuleContext;
|
|
11341
11694
|
return {
|
|
11342
11695
|
CallExpression: (node) => {
|
|
11343
|
-
if (!isCallExpression(node)
|
|
11696
|
+
if (!isCallExpression(node)) {
|
|
11344
11697
|
return Effect_exports.void;
|
|
11345
11698
|
}
|
|
11346
|
-
|
|
11699
|
+
const name = constructorName(node.callee);
|
|
11700
|
+
if (name === void 0 || node.arguments.length !== 1) {
|
|
11347
11701
|
return Effect_exports.void;
|
|
11348
11702
|
}
|
|
11349
11703
|
const [argument] = node.arguments;
|
|
@@ -11353,7 +11707,7 @@ var noEmptyObjectTaggedCall = Rule_exports.define({
|
|
|
11353
11707
|
return ctx.report(
|
|
11354
11708
|
Diagnostic_exports.make({
|
|
11355
11709
|
node,
|
|
11356
|
-
message: `Call no-field Message constructors as ${
|
|
11710
|
+
message: `Call no-field Message constructors as ${name}() instead of ${name}({}).`
|
|
11357
11711
|
})
|
|
11358
11712
|
);
|
|
11359
11713
|
}
|
|
@@ -11459,7 +11813,7 @@ var noHardcodedRouteStrings = Rule_exports.define({
|
|
|
11459
11813
|
if (Option_exports.isNone(maybeFunctionName)) {
|
|
11460
11814
|
return Effect_exports.void;
|
|
11461
11815
|
}
|
|
11462
|
-
const functionName = maybeFunctionName
|
|
11816
|
+
const { value: functionName } = maybeFunctionName;
|
|
11463
11817
|
const [firstArgument] = node.arguments;
|
|
11464
11818
|
if (isStringLiteral(firstArgument) && isHardcodedRouteString(functionName, firstArgument.value)) {
|
|
11465
11819
|
return ctx.report(
|
|
@@ -11530,6 +11884,143 @@ var noModuleLevelMutableState = Rule_exports.define({
|
|
|
11530
11884
|
}
|
|
11531
11885
|
});
|
|
11532
11886
|
|
|
11887
|
+
// src/rules/no-nonportable-server-globals.ts
|
|
11888
|
+
var restrictedGlobalNames = /* @__PURE__ */ new Set([
|
|
11889
|
+
"alert",
|
|
11890
|
+
"cancelAnimationFrame",
|
|
11891
|
+
"cancelIdleCallback",
|
|
11892
|
+
"confirm",
|
|
11893
|
+
"customElements",
|
|
11894
|
+
"document",
|
|
11895
|
+
"getComputedStyle",
|
|
11896
|
+
"history",
|
|
11897
|
+
"IntersectionObserver",
|
|
11898
|
+
"localStorage",
|
|
11899
|
+
"location",
|
|
11900
|
+
"matchMedia",
|
|
11901
|
+
"MutationObserver",
|
|
11902
|
+
"navigator",
|
|
11903
|
+
"prompt",
|
|
11904
|
+
"requestAnimationFrame",
|
|
11905
|
+
"requestIdleCallback",
|
|
11906
|
+
"ResizeObserver",
|
|
11907
|
+
"screen",
|
|
11908
|
+
"sessionStorage",
|
|
11909
|
+
"window"
|
|
11910
|
+
]);
|
|
11911
|
+
var isInsideTypeQuery = (node) => {
|
|
11912
|
+
const parent = node.parent;
|
|
11913
|
+
if (parent === null) {
|
|
11914
|
+
return false;
|
|
11915
|
+
}
|
|
11916
|
+
if (parent.type === "TSTypeQuery") {
|
|
11917
|
+
return true;
|
|
11918
|
+
}
|
|
11919
|
+
if (parent.type === "TSQualifiedName") {
|
|
11920
|
+
return isInsideTypeQuery(parent);
|
|
11921
|
+
}
|
|
11922
|
+
return false;
|
|
11923
|
+
};
|
|
11924
|
+
var staticMemberName = (node) => {
|
|
11925
|
+
if (!node.computed && node.property.type === "Identifier") {
|
|
11926
|
+
return node.property.name;
|
|
11927
|
+
}
|
|
11928
|
+
if (node.computed && node.property.type === "Literal" && typeof node.property.value === "string") {
|
|
11929
|
+
return node.property.value;
|
|
11930
|
+
}
|
|
11931
|
+
return void 0;
|
|
11932
|
+
};
|
|
11933
|
+
var staticPropertyName2 = (property) => {
|
|
11934
|
+
if (property.key.type === "Identifier") {
|
|
11935
|
+
return property.key.name;
|
|
11936
|
+
}
|
|
11937
|
+
if (property.key.type === "Literal" && typeof property.key.value === "string") {
|
|
11938
|
+
return property.key.value;
|
|
11939
|
+
}
|
|
11940
|
+
return void 0;
|
|
11941
|
+
};
|
|
11942
|
+
var destructuringSource = (node) => {
|
|
11943
|
+
const parent = node.parent;
|
|
11944
|
+
if (parent.type === "VariableDeclarator" && parent.id === node) {
|
|
11945
|
+
return parent.init;
|
|
11946
|
+
}
|
|
11947
|
+
if (parent.type === "AssignmentExpression" && parent.left === node) {
|
|
11948
|
+
return parent.right;
|
|
11949
|
+
}
|
|
11950
|
+
return void 0;
|
|
11951
|
+
};
|
|
11952
|
+
var destructuredGlobalThis = (node) => {
|
|
11953
|
+
const source = destructuringSource(node);
|
|
11954
|
+
return source?.type === "Identifier" && source.name === "globalThis" ? source : void 0;
|
|
11955
|
+
};
|
|
11956
|
+
var restrictedGlobalDiagnostic = (node, name) => Diagnostic_exports.make({
|
|
11957
|
+
node,
|
|
11958
|
+
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.`
|
|
11959
|
+
});
|
|
11960
|
+
var indexReferences = (scopes) => {
|
|
11961
|
+
const references = /* @__PURE__ */ new WeakMap();
|
|
11962
|
+
for (const scope3 of scopes) {
|
|
11963
|
+
for (const reference of scope3.references) {
|
|
11964
|
+
references.set(reference.identifier, reference);
|
|
11965
|
+
}
|
|
11966
|
+
}
|
|
11967
|
+
return references;
|
|
11968
|
+
};
|
|
11969
|
+
var isUnshadowedGlobalReference = (references, node) => {
|
|
11970
|
+
const reference = references.get(node);
|
|
11971
|
+
return reference !== void 0 && (reference.resolved === null || Array_exports.isArrayEmpty(reference.resolved.defs));
|
|
11972
|
+
};
|
|
11973
|
+
var noNonportableServerGlobals = Rule_exports.define({
|
|
11974
|
+
name: "no-nonportable-server-globals",
|
|
11975
|
+
meta: Rule_exports.meta({
|
|
11976
|
+
type: "problem",
|
|
11977
|
+
description: "Avoid browser-only globals in files that run across Foldkit server targets."
|
|
11978
|
+
}),
|
|
11979
|
+
create: function* () {
|
|
11980
|
+
const ctx = yield* RuleContext;
|
|
11981
|
+
const references = indexReferences(ctx.sourceCode.scopeManager.scopes);
|
|
11982
|
+
return {
|
|
11983
|
+
Identifier: (node) => {
|
|
11984
|
+
if (node.type !== "Identifier" || !restrictedGlobalNames.has(node.name) || isInsideTypeQuery(node)) {
|
|
11985
|
+
return Effect_exports.void;
|
|
11986
|
+
}
|
|
11987
|
+
return isUnshadowedGlobalReference(references, node) ? ctx.report(restrictedGlobalDiagnostic(node, node.name)) : Effect_exports.void;
|
|
11988
|
+
},
|
|
11989
|
+
MemberExpression: (node) => {
|
|
11990
|
+
if (node.type !== "MemberExpression" || node.object.type !== "Identifier" || node.object.name !== "globalThis") {
|
|
11991
|
+
return Effect_exports.void;
|
|
11992
|
+
}
|
|
11993
|
+
const memberName = staticMemberName(node);
|
|
11994
|
+
if (memberName === void 0 || !restrictedGlobalNames.has(memberName)) {
|
|
11995
|
+
return Effect_exports.void;
|
|
11996
|
+
}
|
|
11997
|
+
return isUnshadowedGlobalReference(references, node.object) ? ctx.report(restrictedGlobalDiagnostic(node, memberName)) : Effect_exports.void;
|
|
11998
|
+
},
|
|
11999
|
+
ObjectPattern: (node) => {
|
|
12000
|
+
if (node.type !== "ObjectPattern") {
|
|
12001
|
+
return Effect_exports.void;
|
|
12002
|
+
}
|
|
12003
|
+
const source = destructuredGlobalThis(node);
|
|
12004
|
+
if (source === void 0) {
|
|
12005
|
+
return Effect_exports.void;
|
|
12006
|
+
}
|
|
12007
|
+
const restrictedProperties = node.properties.flatMap((property) => {
|
|
12008
|
+
if (property.type !== "Property") {
|
|
12009
|
+
return [];
|
|
12010
|
+
}
|
|
12011
|
+
const name = staticPropertyName2(property);
|
|
12012
|
+
return name !== void 0 && restrictedGlobalNames.has(name) ? [{ name, property }] : [];
|
|
12013
|
+
});
|
|
12014
|
+
return isUnshadowedGlobalReference(references, source) ? Effect_exports.forEach(
|
|
12015
|
+
restrictedProperties,
|
|
12016
|
+
({ name, property }) => ctx.report(restrictedGlobalDiagnostic(property, name)),
|
|
12017
|
+
{ discard: true }
|
|
12018
|
+
) : Effect_exports.void;
|
|
12019
|
+
}
|
|
12020
|
+
};
|
|
12021
|
+
}
|
|
12022
|
+
});
|
|
12023
|
+
|
|
11533
12024
|
// src/rules/no-noop-message.ts
|
|
11534
12025
|
var noNoopMessage = Rule_exports.define({
|
|
11535
12026
|
name: "no-noop-message",
|
|
@@ -11539,18 +12030,23 @@ var noNoopMessage = Rule_exports.define({
|
|
|
11539
12030
|
}),
|
|
11540
12031
|
create: function* () {
|
|
11541
12032
|
const ctx = yield* RuleContext;
|
|
12033
|
+
const messageUnionBindings = /* @__PURE__ */ new Set();
|
|
11542
12034
|
return {
|
|
12035
|
+
Program: (node) => {
|
|
12036
|
+
recordFoldkitMessageUnionBindings(messageUnionBindings, node);
|
|
12037
|
+
return Effect_exports.void;
|
|
12038
|
+
},
|
|
11543
12039
|
CallExpression: (node) => {
|
|
11544
|
-
if (!isCallExpression(node)
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
}
|
|
12040
|
+
if (!isCallExpression(node)) return Effect_exports.void;
|
|
12041
|
+
return Effect_exports.forEach(
|
|
12042
|
+
messageCases(node, messageUnionBindings),
|
|
12043
|
+
(messageCase) => ["NoOp", "Noop", "NoOperation"].includes(messageCase.name) ? ctx.report(
|
|
12044
|
+
Diagnostic_exports.make({
|
|
12045
|
+
node: messageCase.nameNode,
|
|
12046
|
+
message: "Every Foldkit Message should describe what happened; avoid generic NoOp Messages."
|
|
12047
|
+
})
|
|
12048
|
+
) : Effect_exports.void,
|
|
12049
|
+
{ discard: true }
|
|
11554
12050
|
);
|
|
11555
12051
|
}
|
|
11556
12052
|
};
|
|
@@ -11853,7 +12349,7 @@ var preferCallableMessageConstructor = Rule_exports.define({
|
|
|
11853
12349
|
return ctx.report(
|
|
11854
12350
|
Diagnostic_exports.make({
|
|
11855
12351
|
node,
|
|
11856
|
-
message: "Construct Messages with their callable Schema constructor (e.g. Foo({ ... })) instead of typing an object literal with a _tag."
|
|
12352
|
+
message: "Construct Messages with their callable Schema constructor (e.g. Message.Foo({ ... })) instead of typing an object literal with a _tag."
|
|
11857
12353
|
})
|
|
11858
12354
|
);
|
|
11859
12355
|
},
|
|
@@ -11864,7 +12360,7 @@ var preferCallableMessageConstructor = Rule_exports.define({
|
|
|
11864
12360
|
return ctx.report(
|
|
11865
12361
|
Diagnostic_exports.make({
|
|
11866
12362
|
node,
|
|
11867
|
-
message: "Construct Messages with their callable Schema constructor (e.g. Foo({ ... })) instead of casting an object literal with a _tag."
|
|
12363
|
+
message: "Construct Messages with their callable Schema constructor (e.g. Message.Foo({ ... })) instead of casting an object literal with a _tag."
|
|
11868
12364
|
})
|
|
11869
12365
|
);
|
|
11870
12366
|
}
|
|
@@ -12246,7 +12742,6 @@ var basePlugin = Plugin_exports.define({
|
|
|
12246
12742
|
"got-wrapper-carries-only-routing": gotWrapperCarriesOnlyRouting,
|
|
12247
12743
|
"keyed-required-for-mapped-rows": keyedRequiredForMappedRows,
|
|
12248
12744
|
"lazy-view-stable-references": lazyViewStableReferences,
|
|
12249
|
-
"message-binding-matches-tag": messageBindingMatchesTag,
|
|
12250
12745
|
"mount-factory-must-use-element": mountFactoryMustUseElement,
|
|
12251
12746
|
"no-array-index-view-keys": noArrayIndexViewKeys,
|
|
12252
12747
|
"no-child-message-construction-in-root": noChildMessageConstructionInRoot,
|
|
@@ -12257,6 +12752,7 @@ var basePlugin = Plugin_exports.define({
|
|
|
12257
12752
|
"no-hand-rolled-command-struct": noHandRolledCommandStruct,
|
|
12258
12753
|
"no-hardcoded-route-strings": noHardcodedRouteStrings,
|
|
12259
12754
|
"no-module-level-mutable-state": noModuleLevelMutableState,
|
|
12755
|
+
"no-nonportable-server-globals": noNonportableServerGlobals,
|
|
12260
12756
|
"no-noop-message": noNoopMessage,
|
|
12261
12757
|
"no-raw-dom-event-attributes": noRawDomEventAttributes,
|
|
12262
12758
|
"no-spread-in-evo": noSpreadInEvo,
|
|
@@ -12266,26 +12762,48 @@ var basePlugin = Plugin_exports.define({
|
|
|
12266
12762
|
"wrap-child-output-in-got-message": wrapChildOutputInGotMessage
|
|
12267
12763
|
}
|
|
12268
12764
|
});
|
|
12269
|
-
var testFilePatterns = [
|
|
12270
|
-
|
|
12765
|
+
var testFilePatterns = [
|
|
12766
|
+
"**/*.test.ts",
|
|
12767
|
+
"**/*.test.tsx",
|
|
12768
|
+
"**/*.spec.ts",
|
|
12769
|
+
"**/*.spec.tsx"
|
|
12770
|
+
];
|
|
12771
|
+
var serverFilePatterns = [
|
|
12772
|
+
"**/entry.server.ts",
|
|
12773
|
+
"**/entry.server.tsx",
|
|
12774
|
+
"**/server/**/*.ts",
|
|
12775
|
+
"**/server/**/*.tsx",
|
|
12776
|
+
"**/prerender.ts"
|
|
12777
|
+
];
|
|
12778
|
+
var serverOverride = {
|
|
12779
|
+
files: serverFilePatterns,
|
|
12780
|
+
excludeFiles: testFilePatterns,
|
|
12781
|
+
rules: {
|
|
12782
|
+
"foldkit/no-nonportable-server-globals": "error"
|
|
12783
|
+
}
|
|
12784
|
+
};
|
|
12785
|
+
var testOverride = (config) => ({
|
|
12786
|
+
files: testFilePatterns,
|
|
12787
|
+
rules: Object.fromEntries(
|
|
12788
|
+
Object.keys(config.rules).map((id) => [
|
|
12789
|
+
id,
|
|
12790
|
+
"off"
|
|
12791
|
+
])
|
|
12792
|
+
)
|
|
12793
|
+
});
|
|
12794
|
+
var withOverrides = (config) => ({
|
|
12271
12795
|
...config,
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
id,
|
|
12278
|
-
"off"
|
|
12279
|
-
])
|
|
12280
|
-
)
|
|
12281
|
-
}
|
|
12282
|
-
]
|
|
12796
|
+
rules: {
|
|
12797
|
+
...config.rules,
|
|
12798
|
+
"foldkit/no-nonportable-server-globals": "off"
|
|
12799
|
+
},
|
|
12800
|
+
overrides: [serverOverride, testOverride(config)]
|
|
12283
12801
|
});
|
|
12284
12802
|
var index_default = {
|
|
12285
12803
|
...basePlugin,
|
|
12286
12804
|
configs: {
|
|
12287
|
-
recommended:
|
|
12288
|
-
all:
|
|
12805
|
+
recommended: withOverrides(basePlugin.configs.recommended),
|
|
12806
|
+
all: withOverrides(basePlugin.configs.all)
|
|
12289
12807
|
}
|
|
12290
12808
|
};
|
|
12291
12809
|
export {
|