clanka 0.10.1 → 0.12.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/README.md +75 -0
- package/dist/Acp.d.ts +1 -1
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +112 -7
- package/dist/Acp.js.map +1 -1
- package/dist/Acp.test.js +178 -0
- package/dist/Acp.test.js.map +1 -1
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +26 -8
- package/dist/Agent.js.map +1 -1
- package/dist/AgentExecutor.js +15 -1
- package/dist/AgentExecutor.js.map +1 -1
- package/dist/AgentExecutor.test.js +24 -4
- package/dist/AgentExecutor.test.js.map +1 -1
- package/dist/AgentSkills.test.js +0 -1
- package/dist/AgentSkills.test.js.map +1 -1
- package/dist/AgentSubagents.test.js +16 -6
- package/dist/AgentSubagents.test.js.map +1 -1
- package/dist/AgentTools.d.ts +7 -0
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +7 -0
- package/dist/AgentTools.js.map +1 -1
- package/dist/McpConfig.d.ts +36 -0
- package/dist/McpConfig.d.ts.map +1 -0
- package/dist/McpConfig.js +182 -0
- package/dist/McpConfig.js.map +1 -0
- package/dist/McpConfig.test.d.ts +2 -0
- package/dist/McpConfig.test.d.ts.map +1 -0
- package/dist/McpConfig.test.js +163 -0
- package/dist/McpConfig.test.js.map +1 -0
- package/dist/McpServers.d.ts +176 -0
- package/dist/McpServers.d.ts.map +1 -0
- package/dist/McpServers.js +707 -0
- package/dist/McpServers.js.map +1 -0
- package/dist/McpServers.test.d.ts +2 -0
- package/dist/McpServers.test.d.ts.map +1 -0
- package/dist/McpServers.test.js +717 -0
- package/dist/McpServers.test.js.map +1 -0
- package/dist/TypeBuilder.d.ts +9 -0
- package/dist/TypeBuilder.d.ts.map +1 -1
- package/dist/TypeBuilder.js +24 -11
- package/dist/TypeBuilder.js.map +1 -1
- package/dist/TypeBuilder.test.js +33 -0
- package/dist/TypeBuilder.test.js.map +1 -1
- package/dist/bin/{Effect-2jPlJ8eu.mjs → Effect-DuThyCJ1.mjs} +155 -74
- package/dist/bin/Effect-DuThyCJ1.mjs.map +1 -0
- package/dist/bin/McpClient-CIiPyMDJ.mjs +36 -0
- package/dist/bin/McpClient-CIiPyMDJ.mjs.map +1 -0
- package/dist/bin/{OutputFormatter-BFAv48k9.mjs → OutputFormatter-BvIjvUmT.mjs} +3 -3
- package/dist/bin/{OutputFormatter-BFAv48k9.mjs.map → OutputFormatter-BvIjvUmT.mjs.map} +1 -1
- package/dist/bin/{Schema-D-7VuCiC.mjs → Schema-DcXUXpRg.mjs} +1069 -124
- package/dist/bin/Schema-DcXUXpRg.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-Cb8aqvGv.mjs → SemanticSearch-CdGA4CIC.mjs} +27 -21
- package/dist/bin/SemanticSearch-CdGA4CIC.mjs.map +1 -0
- package/dist/bin/{Stream-DEu2tfCV.mjs → Stream-I9SRMlLj.mjs} +60 -45
- package/dist/bin/Stream-I9SRMlLj.mjs.map +1 -0
- package/dist/bin/cli.mjs +27217 -10325
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/{index.min-CI3qqohw.mjs → index.min-Bkz7vIWv.mjs} +7 -7
- package/dist/bin/index.min-Bkz7vIWv.mjs.map +1 -0
- package/dist/bin/rolldown-runtime-zY4HT0JA.mjs +30 -0
- package/dist/bin/{turndown.cjs-DK29wZw3.mjs → turndown.cjs-LntFxFyd.mjs} +2 -2
- package/dist/bin/{turndown.cjs-DK29wZw3.mjs.map → turndown.cjs-LntFxFyd.mjs.map} +1 -1
- package/dist/cli.js +46 -7
- package/dist/cli.js.map +1 -1
- package/dist/fixtures/McpFakeServer.d.ts +47 -0
- package/dist/fixtures/McpFakeServer.d.ts.map +1 -0
- package/dist/fixtures/McpFakeServer.js +112 -0
- package/dist/fixtures/McpFakeServer.js.map +1 -0
- package/dist/fixtures/McpStdioServer.d.ts +2 -0
- package/dist/fixtures/McpStdioServer.d.ts.map +1 -0
- package/dist/fixtures/McpStdioServer.js +53 -0
- package/dist/fixtures/McpStdioServer.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/Acp.test.ts +242 -0
- package/src/Acp.ts +141 -5
- package/src/Agent.ts +38 -10
- package/src/AgentExecutor.test.ts +31 -5
- package/src/AgentExecutor.ts +14 -1
- package/src/AgentSkills.test.ts +0 -1
- package/src/AgentSubagents.test.ts +20 -6
- package/src/AgentTools.ts +8 -0
- package/src/McpConfig.test.ts +238 -0
- package/src/McpConfig.ts +255 -0
- package/src/McpServers.test.ts +1050 -0
- package/src/McpServers.ts +1072 -0
- package/src/TypeBuilder.test.ts +70 -0
- package/src/TypeBuilder.ts +41 -14
- package/src/cli.ts +92 -8
- package/src/fixtures/McpFakeServer.ts +162 -0
- package/src/fixtures/McpStdioServer.ts +60 -0
- package/src/index.ts +5 -0
- package/dist/bin/Effect-2jPlJ8eu.mjs.map +0 -1
- package/dist/bin/McpClient-1W508adc.mjs +0 -14179
- package/dist/bin/McpClient-1W508adc.mjs.map +0 -1
- package/dist/bin/Schema-D-7VuCiC.mjs.map +0 -1
- package/dist/bin/SemanticSearch-Cb8aqvGv.mjs.map +0 -1
- package/dist/bin/Stream-DEu2tfCV.mjs.map +0 -1
- package/dist/bin/index.min-CI3qqohw.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1
|
+
import { $a as millis, $o as make$9, $s as isNotUndefined, $t as tryPromise, As as symbolRedactable, Ba as isFailure, Bi as iterateConcurrent, Bs as string$1, Cc as Class$2, Ci as currentTimeMillis$1, Cs as format$1, Da as map$3, Ds as formatPropertyKey, Ea as makeEquivalence$3, Es as formatPath, F as failCauseSync, Fa as fail$1, Fo as liftThrowable, Fs as array, Gi as map$2, Go as Number$4, Gs as isBigInt, H as fnUntracedEager, Ha as map$6, Hs as structureKeys, Io as map$4, Is as combine, It as runSyncExit, Ja as infinity, Jo as isGreaterThanOrEqualTo$1, Js as isFunction, Ki as monotonicTimeNanos$1, Ko as String$4, Ks as isBoolean, Kt as suspend$1, L as flatMap, La as flatMap$1, Lo as match, Ls as hash, M as exit, Mo as isNone, N as fail$2, No as isOption, Ns as equals, Os as currentFiberTypeId, Po as isSome, Ps as symbol$2, Qo as Tuple$1, Qs as isNotNullish, R as flatMapEager, Ra as getOrThrow, Ro as none, Rs as number$1, Sa as isReadonlyArrayNonEmpty, Tc as pipeArguments, To as fromNullOr, Ts as formatJson, Ua as match$1, Uo as BigInt$4, Us as symbol$1, Ut as succeed$3, Va as isSuccess$1, Vi as iterateEager, Vo as some, Vs as structure, Wa as succeed$1, Wn as remainder, Wo as Date$3, Ws as hasProperty, Wt as succeedNone, Xa as isFinite$2, Xo as isLessThanOrEqualTo$1, Xs as isNever$1, Y as fromResult, Ya as isDuration, Yi as resolveConcurrency, Yo as isLessThan$1, Zo as make$10, _c as dual, _r as makeInterruptReason, _s as getStackTraceLimit, aa as encode$1, ac as isPropertyKey, ao as toSeconds, as as TaggedError$2, ba as isArrayNonEmpty, bc as memoize, cc as isTagged, ci as failCause, ct as mapBothEager, di as isExit, do as get, dt as mapErrorEager, en as try_, er as die$1, es as strictEqual, fa as dedupe, fr as isFailReason, gi as ClockRef, gr as makeFailReason, gs as assignProperty$1, hi as void_$1, hr as makeDieReason, hs as assignProperties, ic as isObjectKeyword, io as toMillis, is as PipeInspectableProto, js as asEquivalence, k as die, ko as getOrNull, ks as redact$2, lt as mapEager, m as catchCause, mi as succeed$2, nc as isNumber, no as negativeInfinity, oc as isString$1, or as fromReasons, os as args, pa as empty$4, pi as isSuccess, pr as isReason, qa as fromInputUnsafe, qn as IllegalArgumentError, qo as isGreaterThan$1, qs as isError, rc as isObject, ro as seconds, rs as Error$3, sc as isSymbol, si as fail$3, sn as void_$2, so as Reference, to as nanos, ua as append, uc as isUnknown, uo as empty$3, ur as isCause, va as fromIterable$1, vr as map$5, vs as setStackTraceLimit, wc as Prototype, wi as effectIsExit, wo as flatten, ws as formatDate, xc as memoizeIdempotent, xo as filter, xs as NodeInspectSymbol, yc as identity, ys as BaseProto, zs as optimize } from "./Effect-DuThyCJ1.mjs";
|
|
2
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Tuple.js
|
|
3
3
|
const makeEquivalence$2 = Tuple$1;
|
|
4
4
|
//#endregion
|
|
5
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
5
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Record.js
|
|
6
6
|
const has = dual(2, (self, key) => Object.hasOwn(self, key));
|
|
7
7
|
const map$1 = dual(2, (self, f) => {
|
|
8
8
|
const out = { ...self };
|
|
@@ -20,7 +20,7 @@ const makeEquivalence$1 = (equivalence) => {
|
|
|
20
20
|
return (self, that) => is(self, that) && is(that, self);
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
|
23
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
23
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Data.js
|
|
24
24
|
const Class$1 = class extends Class$2 {
|
|
25
25
|
constructor(props) {
|
|
26
26
|
super();
|
|
@@ -51,22 +51,22 @@ function taggedMatch() {
|
|
|
51
51
|
const Error$2 = Error$3;
|
|
52
52
|
const TaggedError$1 = TaggedError$2;
|
|
53
53
|
//#endregion
|
|
54
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
54
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/encoding/EncodingError.js
|
|
55
55
|
const EncodingErrorTypeId = "~effect/encoding/EncodingError";
|
|
56
56
|
var EncodingError = class extends TaggedError$1("EncodingError") {
|
|
57
57
|
[EncodingErrorTypeId] = EncodingErrorTypeId;
|
|
58
58
|
};
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
60
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Clock.js
|
|
61
61
|
const Clock = ClockRef;
|
|
62
62
|
const currentTimeMillis = currentTimeMillis$1;
|
|
63
63
|
const monotonicTimeNanos = monotonicTimeNanos$1;
|
|
64
64
|
//#endregion
|
|
65
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
66
|
-
const TypeId$
|
|
65
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/dateTime.js
|
|
66
|
+
const TypeId$12 = "~effect/DateTime";
|
|
67
67
|
const TimeZoneTypeId = "~effect/DateTime/TimeZone";
|
|
68
|
-
const Proto$
|
|
69
|
-
[TypeId$
|
|
68
|
+
const Proto$4 = {
|
|
69
|
+
[TypeId$12]: TypeId$12,
|
|
70
70
|
pipe() {
|
|
71
71
|
return pipeArguments(this, arguments);
|
|
72
72
|
},
|
|
@@ -78,12 +78,12 @@ const Proto$3 = {
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
const ProtoUtc = {
|
|
81
|
-
...Proto$
|
|
81
|
+
...Proto$4,
|
|
82
82
|
_tag: "Utc",
|
|
83
|
-
[symbol]() {
|
|
83
|
+
[symbol$1]() {
|
|
84
84
|
return number$1(this.epochMilliseconds);
|
|
85
85
|
},
|
|
86
|
-
[symbol$
|
|
86
|
+
[symbol$2](that) {
|
|
87
87
|
return isDateTime$1(that) && that._tag === "Utc" && this.epochMilliseconds === that.epochMilliseconds;
|
|
88
88
|
},
|
|
89
89
|
toString() {
|
|
@@ -91,12 +91,12 @@ const ProtoUtc = {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
const ProtoZoned = {
|
|
94
|
-
...Proto$
|
|
94
|
+
...Proto$4,
|
|
95
95
|
_tag: "Zoned",
|
|
96
|
-
[symbol]() {
|
|
96
|
+
[symbol$1]() {
|
|
97
97
|
return combine(number$1(this.epochMilliseconds))(hash(this.zone));
|
|
98
98
|
},
|
|
99
|
-
[symbol$
|
|
99
|
+
[symbol$2](that) {
|
|
100
100
|
return isDateTime$1(that) && that._tag === "Zoned" && this.epochMilliseconds === that.epochMilliseconds && equals(this.zone, that.zone);
|
|
101
101
|
},
|
|
102
102
|
toString() {
|
|
@@ -112,10 +112,10 @@ const ProtoTimeZone = {
|
|
|
112
112
|
const ProtoTimeZoneNamed = {
|
|
113
113
|
...ProtoTimeZone,
|
|
114
114
|
_tag: "Named",
|
|
115
|
-
[symbol]() {
|
|
115
|
+
[symbol$1]() {
|
|
116
116
|
return string$1(`Named:${this.id}`);
|
|
117
117
|
},
|
|
118
|
-
[symbol$
|
|
118
|
+
[symbol$2](that) {
|
|
119
119
|
return isTimeZone(that) && that._tag === "Named" && this.id === that.id;
|
|
120
120
|
},
|
|
121
121
|
toString() {
|
|
@@ -132,10 +132,10 @@ const ProtoTimeZoneNamed = {
|
|
|
132
132
|
const ProtoTimeZoneOffset = {
|
|
133
133
|
...ProtoTimeZone,
|
|
134
134
|
_tag: "Offset",
|
|
135
|
-
[symbol]() {
|
|
135
|
+
[symbol$1]() {
|
|
136
136
|
return string$1(`Offset:${this.offset}`);
|
|
137
137
|
},
|
|
138
|
-
[symbol$
|
|
138
|
+
[symbol$2](that) {
|
|
139
139
|
return isTimeZone(that) && that._tag === "Offset" && this.offset === that.offset;
|
|
140
140
|
},
|
|
141
141
|
toString() {
|
|
@@ -149,7 +149,7 @@ const ProtoTimeZoneOffset = {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
-
const isDateTime$1 = (u) => hasProperty(u, TypeId$
|
|
152
|
+
const isDateTime$1 = (u) => hasProperty(u, TypeId$12);
|
|
153
153
|
const isTimeZone = (u) => hasProperty(u, TimeZoneTypeId);
|
|
154
154
|
const isUtc$1 = (self) => self._tag === "Utc";
|
|
155
155
|
const makeUtc = (epochMillis) => {
|
|
@@ -179,7 +179,7 @@ const makeUnsafe$1 = (input) => {
|
|
|
179
179
|
return fromDateUnsafe$1(new Date(input));
|
|
180
180
|
};
|
|
181
181
|
const hasZone = (input) => /Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(input);
|
|
182
|
-
const make$
|
|
182
|
+
const make$8 = liftThrowable(makeUnsafe$1);
|
|
183
183
|
const now$1 = map$2(currentTimeMillis, makeUtc);
|
|
184
184
|
const toUtc$1 = (self) => makeUtc(self.epochMilliseconds);
|
|
185
185
|
const toDateUtc$1 = (self) => new Date(self.epochMilliseconds);
|
|
@@ -233,7 +233,7 @@ const formatIsoOffset = (self) => {
|
|
|
233
233
|
};
|
|
234
234
|
const formatIsoZoned = (self) => self.zone._tag === "Offset" ? formatIsoOffset(self) : `${formatIsoOffset(self)}[${self.zone.id}]`;
|
|
235
235
|
//#endregion
|
|
236
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
236
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/redacted.js
|
|
237
237
|
const redactedRegistry = new WeakMap();
|
|
238
238
|
const value$1 = (self) => {
|
|
239
239
|
if (redactedRegistry.has(self)) return redactedRegistry.get(self);
|
|
@@ -241,17 +241,17 @@ const value$1 = (self) => {
|
|
|
241
241
|
};
|
|
242
242
|
const stringOrRedacted = (val) => typeof val === "string" ? val : value$1(val);
|
|
243
243
|
//#endregion
|
|
244
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
245
|
-
const TypeId$
|
|
246
|
-
const isRedacted = (u) => hasProperty(u, TypeId$
|
|
247
|
-
const make$
|
|
248
|
-
const self = Object.create(Proto$
|
|
244
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Redacted.js
|
|
245
|
+
const TypeId$11 = "~effect/Redacted";
|
|
246
|
+
const isRedacted = (u) => hasProperty(u, TypeId$11);
|
|
247
|
+
const make$7 = (value, options) => {
|
|
248
|
+
const self = Object.create(Proto$3);
|
|
249
249
|
if (options?.label) self.label = options.label;
|
|
250
250
|
redactedRegistry.set(self, value);
|
|
251
251
|
return self;
|
|
252
252
|
};
|
|
253
|
-
const Proto$
|
|
254
|
-
[TypeId$
|
|
253
|
+
const Proto$3 = {
|
|
254
|
+
[TypeId$11]: { _A: (_) => _ },
|
|
255
255
|
label: void 0,
|
|
256
256
|
...PipeInspectableProto,
|
|
257
257
|
toJSON() {
|
|
@@ -260,25 +260,25 @@ const Proto$2 = {
|
|
|
260
260
|
toString() {
|
|
261
261
|
return `<redacted${isString$1(this.label) ? ":" + this.label : ""}>`;
|
|
262
262
|
},
|
|
263
|
-
[symbol]() {
|
|
263
|
+
[symbol$1]() {
|
|
264
264
|
return hash(redactedRegistry.get(this));
|
|
265
265
|
},
|
|
266
|
-
[symbol$
|
|
266
|
+
[symbol$2](that) {
|
|
267
267
|
return isRedacted(that) && equals(redactedRegistry.get(this), redactedRegistry.get(that));
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
270
|
const value = value$1;
|
|
271
|
-
const makeEquivalence = (isEquivalent) => make$
|
|
271
|
+
const makeEquivalence = (isEquivalent) => make$9((x, y) => isEquivalent(value(x), value(y)));
|
|
272
272
|
//#endregion
|
|
273
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
274
|
-
const TypeId$
|
|
273
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/BigDecimal.js
|
|
274
|
+
const TypeId$10 = "~effect/BigDecimal";
|
|
275
275
|
const BigDecimalProto = {
|
|
276
|
-
[TypeId$
|
|
277
|
-
[symbol]() {
|
|
276
|
+
[TypeId$10]: TypeId$10,
|
|
277
|
+
[symbol$1]() {
|
|
278
278
|
const normalized = normalize(this);
|
|
279
279
|
return combine(string$1(String(normalized.value)), number$1(normalized.scale));
|
|
280
280
|
},
|
|
281
|
-
[symbol$
|
|
281
|
+
[symbol$2](that) {
|
|
282
282
|
return isBigDecimal(that) && compare(this, that) === 0;
|
|
283
283
|
},
|
|
284
284
|
toString() {
|
|
@@ -298,8 +298,8 @@ const BigDecimalProto = {
|
|
|
298
298
|
return pipeArguments(this, arguments);
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
|
-
const isBigDecimal = (u) => hasProperty(u, TypeId$
|
|
302
|
-
const make$
|
|
301
|
+
const isBigDecimal = (u) => hasProperty(u, TypeId$10);
|
|
302
|
+
const make$6 = (value, scale) => {
|
|
303
303
|
if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
|
|
304
304
|
const o = Object.create(BigDecimalProto);
|
|
305
305
|
o.value = value;
|
|
@@ -307,7 +307,7 @@ const make$5 = (value, scale) => {
|
|
|
307
307
|
return o;
|
|
308
308
|
};
|
|
309
309
|
const makeNormalized = (value, scale) => {
|
|
310
|
-
const o = make$
|
|
310
|
+
const o = make$6(value, scale);
|
|
311
311
|
o.normalized = o;
|
|
312
312
|
return o;
|
|
313
313
|
};
|
|
@@ -350,7 +350,7 @@ const compare = (self, that) => {
|
|
|
350
350
|
const powerOfTen = comparisonPowersOfTen[absoluteScaleDifference] ??= bigint10 ** BigInt(absoluteScaleDifference);
|
|
351
351
|
return scaleDifference > 0 ? compareBigInt(self.value, that.value * powerOfTen) : compareBigInt(self.value * powerOfTen, that.value);
|
|
352
352
|
};
|
|
353
|
-
const Order = make$
|
|
353
|
+
const Order = make$10(compare);
|
|
354
354
|
const sign = (n) => n.value === bigint0 ? 0 : n.value < bigint0 ? -1 : 1;
|
|
355
355
|
const format = (n) => {
|
|
356
356
|
const normalized = normalize(n);
|
|
@@ -374,12 +374,12 @@ const toExponential = (n) => {
|
|
|
374
374
|
};
|
|
375
375
|
const isZero = (n) => n.value === bigint0;
|
|
376
376
|
//#endregion
|
|
377
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
377
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/DateTime.js
|
|
378
378
|
const isDateTime = isDateTime$1;
|
|
379
379
|
const isUtc = isUtc$1;
|
|
380
380
|
const fromDateUnsafe = fromDateUnsafe$1;
|
|
381
381
|
const makeUnsafe = makeUnsafe$1;
|
|
382
|
-
const make$
|
|
382
|
+
const make$5 = make$8;
|
|
383
383
|
const now = now$1;
|
|
384
384
|
const toUtc = toUtc$1;
|
|
385
385
|
const toDateUtc = toDateUtc$1;
|
|
@@ -388,7 +388,7 @@ const removeTime = removeTime$1;
|
|
|
388
388
|
const formatIso = formatIso$1;
|
|
389
389
|
const formatIsoDate = formatIsoDate$1;
|
|
390
390
|
//#endregion
|
|
391
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
391
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/encoding/Base64.js
|
|
392
392
|
const encode = (input) => encodeBytes(typeof input === "string" ? encoder$1.encode(input) : input);
|
|
393
393
|
const decode = (str) => {
|
|
394
394
|
const stripped = stripCrlf(str);
|
|
@@ -459,9 +459,9 @@ const getCode = (charCode) => {
|
|
|
459
459
|
return codes[charCode];
|
|
460
460
|
};
|
|
461
461
|
//#endregion
|
|
462
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
463
|
-
const TypeId$
|
|
464
|
-
const isCookies = (u) => hasProperty(u, TypeId$
|
|
462
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/Cookies.js
|
|
463
|
+
const TypeId$9 = "~effect/http/Cookies";
|
|
464
|
+
const isCookies = (u) => hasProperty(u, TypeId$9);
|
|
465
465
|
const CookieTypeId = "~effect/http/Cookies/Cookie";
|
|
466
466
|
const isCookie = (u) => hasProperty(u, CookieTypeId);
|
|
467
467
|
const CookieErrorTypeId = "~effect/http/Cookies/CookieError";
|
|
@@ -478,8 +478,8 @@ var CookiesError = class CookiesError extends TaggedError$1("CookiesError") {
|
|
|
478
478
|
return this.reason._tag;
|
|
479
479
|
}
|
|
480
480
|
};
|
|
481
|
-
const Proto$
|
|
482
|
-
[TypeId$
|
|
481
|
+
const Proto$2 = {
|
|
482
|
+
[TypeId$9]: TypeId$9,
|
|
483
483
|
...BaseProto,
|
|
484
484
|
toJSON() {
|
|
485
485
|
return {
|
|
@@ -492,7 +492,7 @@ const Proto$1 = {
|
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
494
|
const fromReadonlyRecord = (cookies) => {
|
|
495
|
-
const self = Object.create(Proto$
|
|
495
|
+
const self = Object.create(Proto$2);
|
|
496
496
|
self.cookies = cookies;
|
|
497
497
|
return self;
|
|
498
498
|
};
|
|
@@ -594,7 +594,7 @@ function parseSetCookie(header) {
|
|
|
594
594
|
options: Object.keys(options).length > 0 ? options : void 0
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
|
-
const empty$
|
|
597
|
+
const empty$2 = fromIterable([]);
|
|
598
598
|
const fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
599
599
|
const cookieNameRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
600
600
|
const cookieDomainRegExp = /^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/;
|
|
@@ -684,7 +684,93 @@ const tryDecodeURIComponent = (str) => {
|
|
|
684
684
|
}
|
|
685
685
|
};
|
|
686
686
|
//#endregion
|
|
687
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
687
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/Headers.js
|
|
688
|
+
const TypeId$8 = Symbol.for("~effect/http/Headers");
|
|
689
|
+
const Proto$1 = Object.defineProperties(Object.create(null), {
|
|
690
|
+
[TypeId$8]: { value: TypeId$8 },
|
|
691
|
+
[symbolRedactable]: { value(context) {
|
|
692
|
+
return redact$1(this, get(context, CurrentRedactedNames$1));
|
|
693
|
+
} },
|
|
694
|
+
toJSON: { value() {
|
|
695
|
+
return redact$2(this);
|
|
696
|
+
} },
|
|
697
|
+
[symbol$2]: { value(that) {
|
|
698
|
+
return Equivalence$1(this, that);
|
|
699
|
+
} },
|
|
700
|
+
[symbol$1]: { value() {
|
|
701
|
+
return structure(this);
|
|
702
|
+
} },
|
|
703
|
+
toString: { value: BaseProto.toString },
|
|
704
|
+
[NodeInspectSymbol]: { value: BaseProto[NodeInspectSymbol] }
|
|
705
|
+
});
|
|
706
|
+
const make$4 = (input) => Object.assign(Object.create(Proto$1), input);
|
|
707
|
+
const Equivalence$1 = makeEquivalence$1(strictEqual());
|
|
708
|
+
const empty$1 = Object.create(Proto$1);
|
|
709
|
+
const fromInput$1 = (input) => {
|
|
710
|
+
if (input === void 0) return empty$1;
|
|
711
|
+
else if (Symbol.iterator in input) {
|
|
712
|
+
const out = Object.create(Proto$1);
|
|
713
|
+
for (const [k, v] of input) out[k.toLowerCase()] = v;
|
|
714
|
+
return out;
|
|
715
|
+
}
|
|
716
|
+
const out = Object.create(Proto$1);
|
|
717
|
+
for (const [k, v] of Object.entries(input)) if (Array.isArray(v)) out[k.toLowerCase()] = v.join(", ");
|
|
718
|
+
else if (v !== void 0) out[k.toLowerCase()] = v;
|
|
719
|
+
return out;
|
|
720
|
+
};
|
|
721
|
+
const fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto$1);
|
|
722
|
+
const set = dual(3, (self, key, value) => {
|
|
723
|
+
const out = make$4(self);
|
|
724
|
+
out[key.toLowerCase()] = value;
|
|
725
|
+
return out;
|
|
726
|
+
});
|
|
727
|
+
const setAll$1 = dual(2, (self, headers) => make$4({
|
|
728
|
+
...self,
|
|
729
|
+
...fromInput$1(headers)
|
|
730
|
+
}));
|
|
731
|
+
const merge = dual(2, (self, headers) => {
|
|
732
|
+
const out = make$4(self);
|
|
733
|
+
Object.assign(out, headers);
|
|
734
|
+
return out;
|
|
735
|
+
});
|
|
736
|
+
const remove = dual(2, (self, key) => {
|
|
737
|
+
const out = make$4(self);
|
|
738
|
+
delete out[key.toLowerCase()];
|
|
739
|
+
return out;
|
|
740
|
+
});
|
|
741
|
+
const redact$1 = dual(2, (self, key) => {
|
|
742
|
+
const out = { ...self };
|
|
743
|
+
const modify = (key) => {
|
|
744
|
+
if (typeof key === "string") {
|
|
745
|
+
const k = key.toLowerCase();
|
|
746
|
+
if (k in self) out[k] = make$7(self[k]);
|
|
747
|
+
} else for (const name in self) if (name.search(key) !== -1) out[name] = make$7(self[name]);
|
|
748
|
+
};
|
|
749
|
+
if (Array.isArray(key)) for (let i = 0; i < key.length; i++) modify(key[i]);
|
|
750
|
+
else modify(key);
|
|
751
|
+
return out;
|
|
752
|
+
});
|
|
753
|
+
const isRedactedName$1 = (name, patterns) => {
|
|
754
|
+
const lowerName = name.toLowerCase();
|
|
755
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
756
|
+
const pattern = patterns[i];
|
|
757
|
+
if (typeof pattern === "string") {
|
|
758
|
+
if (pattern.toLowerCase() === lowerName) return true;
|
|
759
|
+
} else if (name.search(pattern) !== -1) return true;
|
|
760
|
+
}
|
|
761
|
+
return false;
|
|
762
|
+
};
|
|
763
|
+
const CurrentRedactedNames$1 = Reference("effect/Headers/CurrentRedactedNames", { defaultValue: () => [
|
|
764
|
+
"authorization",
|
|
765
|
+
"cookie",
|
|
766
|
+
"set-cookie",
|
|
767
|
+
"x-api-key"
|
|
768
|
+
] });
|
|
769
|
+
//#endregion
|
|
770
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/internal/urlParams.js
|
|
771
|
+
const unwrap = (value$6) => typeof value$6 === "string" ? value$6 : value(value$6);
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/http/UrlParams.js
|
|
688
774
|
const TypeId$7 = "~effect/http/UrlParams";
|
|
689
775
|
const isUrlParams = (u) => hasProperty(u, TypeId$7);
|
|
690
776
|
const Proto = {
|
|
@@ -693,16 +779,19 @@ const Proto = {
|
|
|
693
779
|
[Symbol.iterator]() {
|
|
694
780
|
return this.params[Symbol.iterator]();
|
|
695
781
|
},
|
|
696
|
-
|
|
782
|
+
[symbolRedactable](context) {
|
|
697
783
|
return {
|
|
698
784
|
_id: "UrlParams",
|
|
699
|
-
params: Object.fromEntries(this
|
|
785
|
+
params: Object.fromEntries(redact(this, get(context, CurrentRedactedNames)))
|
|
700
786
|
};
|
|
701
787
|
},
|
|
702
|
-
|
|
788
|
+
toJSON() {
|
|
789
|
+
return redact$2(this);
|
|
790
|
+
},
|
|
791
|
+
[symbol$2](that) {
|
|
703
792
|
return Equivalence(this, that);
|
|
704
793
|
},
|
|
705
|
-
[symbol]() {
|
|
794
|
+
[symbol$1]() {
|
|
706
795
|
return array(this.params.flat());
|
|
707
796
|
}
|
|
708
797
|
};
|
|
@@ -725,15 +814,16 @@ const fromInputNested = (input) => {
|
|
|
725
814
|
const entries = typeof input[Symbol.iterator] === "function" ? fromIterable$1(input) : Object.entries(input);
|
|
726
815
|
const out = [];
|
|
727
816
|
for (const [key, value] of entries) if (Array.isArray(value)) {
|
|
728
|
-
for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key,
|
|
729
|
-
} else if (value !== null && typeof value === "object") {
|
|
817
|
+
for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key, coerce(value[i])]);
|
|
818
|
+
} else if (value !== null && typeof value === "object" && !isRedacted(value)) {
|
|
730
819
|
const nested = fromInputNested(value);
|
|
731
820
|
for (const [k, v] of nested) out.push([[key, ...typeof k === "string" ? [k] : k], v]);
|
|
732
|
-
} else if (value !== void 0) out.push([key,
|
|
821
|
+
} else if (value !== void 0) out.push([key, coerce(value)]);
|
|
733
822
|
return out;
|
|
734
823
|
};
|
|
735
|
-
const
|
|
736
|
-
const
|
|
824
|
+
const coerce = (value) => isRedacted(value) ? value : String(value);
|
|
825
|
+
const Equivalence = make$9((a, b) => arrayEquivalence(a.params, b.params));
|
|
826
|
+
const arrayEquivalence = makeEquivalence$3(makeEquivalence$2([strictEqual(), asEquivalence()]));
|
|
737
827
|
const empty = make$3([]);
|
|
738
828
|
const setAll = dual(2, (self, input) => {
|
|
739
829
|
const params = fromInput(input).params.slice();
|
|
@@ -745,20 +835,77 @@ const setAll = dual(2, (self, input) => {
|
|
|
745
835
|
}
|
|
746
836
|
return make$3(params);
|
|
747
837
|
});
|
|
748
|
-
const toString = (input) => new URLSearchParams(fromInput(input).params).toString();
|
|
838
|
+
const toString = (input) => new URLSearchParams(fromInput(input).params.map(([key, value]) => [key, unwrap(value)])).toString();
|
|
749
839
|
const toRecord = (self) => {
|
|
750
840
|
const out = {};
|
|
751
|
-
for (const [k,
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
841
|
+
for (const [k, v] of self.params) {
|
|
842
|
+
const value = unwrap(v);
|
|
843
|
+
if (!Object.hasOwn(out, k)) assignProperty$1(out, k, value);
|
|
844
|
+
else {
|
|
845
|
+
const current = out[k];
|
|
846
|
+
if (typeof current === "string") assignProperty$1(out, k, [current, value]);
|
|
847
|
+
else current.push(value);
|
|
848
|
+
}
|
|
756
849
|
}
|
|
757
850
|
return out;
|
|
758
851
|
};
|
|
759
852
|
const toReadonlyRecord = toRecord;
|
|
853
|
+
const redact = dual(2, (self, key) => {
|
|
854
|
+
const patterns = Array.isArray(key) ? key : [key];
|
|
855
|
+
return self.params.map(([name, value]) => [name, typeof value === "string" && isRedactedName(name, patterns) ? make$7(value) : value]);
|
|
856
|
+
});
|
|
857
|
+
const isRedactedName = isRedactedName$1;
|
|
858
|
+
const redactUrl = (url, redactedNames = currentRedactedNames()) => {
|
|
859
|
+
if (url.includes("@")) url = redactUserinfo(url);
|
|
860
|
+
const queryStart = url.indexOf("?");
|
|
861
|
+
if (queryStart === -1 || redactedNames.length === 0) return url;
|
|
862
|
+
const hashStart = url.indexOf("#");
|
|
863
|
+
if (hashStart !== -1 && hashStart < queryStart) return url;
|
|
864
|
+
const queryEnd = hashStart === -1 ? url.length : hashStart;
|
|
865
|
+
return url.slice(0, queryStart + 1) + redactQuery(url.slice(queryStart + 1, queryEnd), redactedNames) + url.slice(queryEnd);
|
|
866
|
+
};
|
|
867
|
+
const authorityStart = /^(?:(https?|ftp|wss?):[/\\]*|[a-z][a-z\d+.-]*:\/\/|[/\\]{2,})/i;
|
|
868
|
+
const specialAuthorityEnd = /[/\\?#]/;
|
|
869
|
+
const authorityEnd = /[/?#]/;
|
|
870
|
+
const redactUserinfo = (url) => {
|
|
871
|
+
let normalized = "";
|
|
872
|
+
const offsets = [];
|
|
873
|
+
for (let i = 0; i < url.length; i++) {
|
|
874
|
+
const code = url.charCodeAt(i);
|
|
875
|
+
if (code === 9 || code === 10 || code === 13 || normalized === "" && code <= 32) continue;
|
|
876
|
+
normalized += url[i];
|
|
877
|
+
offsets.push(i);
|
|
878
|
+
}
|
|
879
|
+
const authority = authorityStart.exec(normalized);
|
|
880
|
+
if (authority === null) return url;
|
|
881
|
+
const start = authority[0].length;
|
|
882
|
+
const special = authority[1] !== void 0 || !authority[0].includes(":");
|
|
883
|
+
const rest = normalized.slice(start);
|
|
884
|
+
const end = rest.search(special ? specialAuthorityEnd : authorityEnd);
|
|
885
|
+
const userinfoEnd = (end === -1 ? rest : rest.slice(0, end)).lastIndexOf("@");
|
|
886
|
+
return userinfoEnd === -1 ? url : url.slice(0, offsets[start]) + "REDACTED:REDACTED" + url.slice(offsets[start + userinfoEnd]);
|
|
887
|
+
};
|
|
888
|
+
const redactQuery = (query, redactedNames) => query.split("&").map((part) => {
|
|
889
|
+
const index = part.indexOf("=");
|
|
890
|
+
return index !== -1 && isRedactedName(decodeQueryKey(part.slice(0, index)), redactedNames) ? part.slice(0, index + 1) + "REDACTED" : part;
|
|
891
|
+
}).join("&");
|
|
892
|
+
const decodeQueryKey = (key) => {
|
|
893
|
+
if (!key.includes("%") && !key.includes("+")) return key;
|
|
894
|
+
try {
|
|
895
|
+
return decodeURIComponent(key.replace(/\+/g, " "));
|
|
896
|
+
} catch {
|
|
897
|
+
return key;
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
const currentRedactedNames = () => get(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$3(), CurrentRedactedNames);
|
|
901
|
+
const CurrentRedactedNames = Reference("effect/http/UrlParams/CurrentRedactedNames", { defaultValue: () => [
|
|
902
|
+
"AWSAccessKeyId",
|
|
903
|
+
"Signature",
|
|
904
|
+
"sig",
|
|
905
|
+
"X-Goog-Signature"
|
|
906
|
+
] });
|
|
760
907
|
//#endregion
|
|
761
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
908
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/annotations.js
|
|
762
909
|
function resolve$1(ast) {
|
|
763
910
|
return ast.checks ? ast.checks[ast.checks.length - 1].annotations : ast.annotations;
|
|
764
911
|
}
|
|
@@ -805,7 +952,7 @@ const annotationExcludedKeys = new Set([
|
|
|
805
952
|
"toCodecArbitrary"
|
|
806
953
|
]);
|
|
807
954
|
//#endregion
|
|
808
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
955
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/parser.js
|
|
809
956
|
const missing = Symbol();
|
|
810
957
|
const succeed = succeed$2;
|
|
811
958
|
const missingExit = succeed(missing);
|
|
@@ -813,7 +960,7 @@ const sameExit = succeed(missing);
|
|
|
813
960
|
const toOption = (value) => value === missing ? none() : some(value);
|
|
814
961
|
const fromOptionExit = (option) => option._tag === "None" ? missingExit : succeed(option.value);
|
|
815
962
|
//#endregion
|
|
816
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
963
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaIssue.js
|
|
817
964
|
const TypeId$6 = "~effect/SchemaIssue/Issue";
|
|
818
965
|
function isIssue(u) {
|
|
819
966
|
return hasProperty(u, TypeId$6) && u[TypeId$6] === TypeId$6;
|
|
@@ -1026,7 +1173,7 @@ function findMessage(issue) {
|
|
|
1026
1173
|
if (typeof message === "string") return message;
|
|
1027
1174
|
}
|
|
1028
1175
|
//#endregion
|
|
1029
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1176
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/cause.js
|
|
1030
1177
|
function getSchemaIssue(cause) {
|
|
1031
1178
|
let issue;
|
|
1032
1179
|
for (const reason of cause.reasons) {
|
|
@@ -1041,7 +1188,7 @@ function getSchemaIssueOrThrow(cause, message) {
|
|
|
1041
1188
|
return issue;
|
|
1042
1189
|
}
|
|
1043
1190
|
//#endregion
|
|
1044
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1191
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaGetter.js
|
|
1045
1192
|
const runGetter = (self, input, options) => {
|
|
1046
1193
|
switch (self._tag) {
|
|
1047
1194
|
case "Passthrough": return succeed$3(input);
|
|
@@ -1093,6 +1240,9 @@ const passthrough_$1 = makeGetter({ _tag: "Passthrough" });
|
|
|
1093
1240
|
function passthrough$1() {
|
|
1094
1241
|
return passthrough_$1;
|
|
1095
1242
|
}
|
|
1243
|
+
function passthroughSubtype() {
|
|
1244
|
+
return passthrough_$1;
|
|
1245
|
+
}
|
|
1096
1246
|
function transform$1(f) {
|
|
1097
1247
|
return makeGetter({
|
|
1098
1248
|
_tag: "Transform",
|
|
@@ -1162,14 +1312,14 @@ function decodeBase64() {
|
|
|
1162
1312
|
}
|
|
1163
1313
|
function dateTimeUtcFromInput$1() {
|
|
1164
1314
|
return transformEffect$1((input, options) => {
|
|
1165
|
-
return match(make$
|
|
1315
|
+
return match(make$5(input), {
|
|
1166
1316
|
onNone: () => fail$2(new InvalidValue({ message: "Invalid DateTime input" }, input, options)),
|
|
1167
1317
|
onSome: (dt) => succeed$3(toUtc(dt))
|
|
1168
1318
|
});
|
|
1169
1319
|
});
|
|
1170
1320
|
}
|
|
1171
1321
|
//#endregion
|
|
1172
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1322
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaTransformation.js
|
|
1173
1323
|
const Middleware = class extends Class$2 {
|
|
1174
1324
|
_tag = "Middleware";
|
|
1175
1325
|
decode;
|
|
@@ -1285,7 +1435,7 @@ function fromJsonString$1(options) {
|
|
|
1285
1435
|
return new Transformation(parseJson(options ?? {}), stringifyJson(options));
|
|
1286
1436
|
}
|
|
1287
1437
|
//#endregion
|
|
1288
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
1438
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaAST.js
|
|
1289
1439
|
function makeGuard(tag) {
|
|
1290
1440
|
return (ast) => ast._tag === tag;
|
|
1291
1441
|
}
|
|
@@ -1439,6 +1589,140 @@ const Unknown$1 = class extends ASTNodeImpl {
|
|
|
1439
1589
|
}
|
|
1440
1590
|
};
|
|
1441
1591
|
const unknown = new Unknown$1();
|
|
1592
|
+
const ObjectKeyword$1 = class extends ASTNodeImpl {
|
|
1593
|
+
_tag = "ObjectKeyword";
|
|
1594
|
+
getParser() {
|
|
1595
|
+
return fromRefinement(this, isObjectKeyword);
|
|
1596
|
+
}
|
|
1597
|
+
getExpected() {
|
|
1598
|
+
return "object | array | function";
|
|
1599
|
+
}
|
|
1600
|
+
};
|
|
1601
|
+
const objectKeyword = new ObjectKeyword$1();
|
|
1602
|
+
const Enum$1 = class extends ASTNodeImpl {
|
|
1603
|
+
_tag = "Enum";
|
|
1604
|
+
enums;
|
|
1605
|
+
constructor(enums, annotations, checks, encoding, context) {
|
|
1606
|
+
super(annotations, checks, encoding, context);
|
|
1607
|
+
for (const [, value] of enums) if (typeof value === "number" && !globalThis.Number.isFinite(value)) throw new Error(`A numeric enum value must be finite, got ${format$1(value)}`);
|
|
1608
|
+
this.enums = enums;
|
|
1609
|
+
}
|
|
1610
|
+
getParser() {
|
|
1611
|
+
const values = new Set(this.enums.map(([, v]) => v));
|
|
1612
|
+
return fromRefinement(this, (input) => values.has(input));
|
|
1613
|
+
}
|
|
1614
|
+
toCodecStringTree() {
|
|
1615
|
+
if (this.enums.some(([_, v]) => typeof v === "number")) {
|
|
1616
|
+
const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v]));
|
|
1617
|
+
return replaceEncoding(this, [new Link(new Union$1(Object.keys(coercions).map((k) => new Literal$1(k))), new Transformation(transform$1((s) => coercions[s]), String$3()))]);
|
|
1618
|
+
}
|
|
1619
|
+
return this;
|
|
1620
|
+
}
|
|
1621
|
+
getExpected() {
|
|
1622
|
+
return this.enums.map(([_, value]) => JSON.stringify(value)).join(" | ");
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
function formatTemplateLiteralPath(path) {
|
|
1626
|
+
return typeof path === "number" ? `parts[${path}]` : path;
|
|
1627
|
+
}
|
|
1628
|
+
function isTemplateLiteralPart(ast, path, validated) {
|
|
1629
|
+
if (validated.has(ast)) return true;
|
|
1630
|
+
if (ast.encoding) throw new Error(`TemplateLiteral parts cannot have an encoding at ${formatTemplateLiteralPath(path)}`);
|
|
1631
|
+
let valid;
|
|
1632
|
+
switch (ast._tag) {
|
|
1633
|
+
case "String":
|
|
1634
|
+
case "Number":
|
|
1635
|
+
case "BigInt":
|
|
1636
|
+
valid = true;
|
|
1637
|
+
break;
|
|
1638
|
+
case "Literal":
|
|
1639
|
+
valid = !ast.checks;
|
|
1640
|
+
break;
|
|
1641
|
+
case "TemplateLiteral": {
|
|
1642
|
+
const currentPath = formatTemplateLiteralPath(path);
|
|
1643
|
+
valid = !ast.checks && ast.parts.every((part, index) => isTemplateLiteralPart(part, `${currentPath}.parts[${index}]`, validated));
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1646
|
+
case "Union": {
|
|
1647
|
+
const currentPath = formatTemplateLiteralPath(path);
|
|
1648
|
+
valid = !ast.checks && ast.types.every((part, index) => isTemplateLiteralPart(part, `${currentPath}.types[${index}]`, validated));
|
|
1649
|
+
break;
|
|
1650
|
+
}
|
|
1651
|
+
default: return false;
|
|
1652
|
+
}
|
|
1653
|
+
if (valid) validated.add(ast);
|
|
1654
|
+
return valid;
|
|
1655
|
+
}
|
|
1656
|
+
const TemplateLiteral$1 = class extends ASTNodeImpl {
|
|
1657
|
+
_tag = "TemplateLiteral";
|
|
1658
|
+
parts;
|
|
1659
|
+
encodedParts;
|
|
1660
|
+
literals;
|
|
1661
|
+
suffixLengths;
|
|
1662
|
+
constructor(parts, annotations, checks, encoding, context) {
|
|
1663
|
+
super(annotations, checks, encoding, context);
|
|
1664
|
+
const encodedParts = [];
|
|
1665
|
+
const literals = [];
|
|
1666
|
+
const validated = new Set();
|
|
1667
|
+
for (let index = 0; index < parts.length; index++) {
|
|
1668
|
+
const part = parts[index];
|
|
1669
|
+
if (!isTemplateLiteralPart(part, index, validated)) throw new Error(`Invalid TemplateLiteral part ${part._tag}`);
|
|
1670
|
+
encodedParts.push(part);
|
|
1671
|
+
literals.push(part._tag === "Literal" ? globalThis.String(part.literal) : void 0);
|
|
1672
|
+
}
|
|
1673
|
+
const suffixLengths = new Array(encodedParts.length + 1);
|
|
1674
|
+
suffixLengths[encodedParts.length] = 0;
|
|
1675
|
+
for (let i = encodedParts.length - 1; i >= 0; i--) suffixLengths[i] = suffixLengths[i + 1] + (literals[i]?.length ?? 0);
|
|
1676
|
+
this.parts = parts;
|
|
1677
|
+
this.encodedParts = encodedParts;
|
|
1678
|
+
this.literals = literals;
|
|
1679
|
+
this.suffixLengths = suffixLengths;
|
|
1680
|
+
}
|
|
1681
|
+
getParser(compile) {
|
|
1682
|
+
const tuple = new Arrays(false, this.parts.map(partFromString), []);
|
|
1683
|
+
const parser = compile(decodeTo$1(string, tuple, templateLiteralTransformation(this)));
|
|
1684
|
+
return (input, options) => {
|
|
1685
|
+
if (input === missing) return missingExit;
|
|
1686
|
+
const result = parser(input, options);
|
|
1687
|
+
if (result._tag === "Success") return sameExit;
|
|
1688
|
+
return mapBothEager(result, {
|
|
1689
|
+
onSuccess: () => input,
|
|
1690
|
+
onFailure: (issue) => new Composite(this, [issue], input, options)
|
|
1691
|
+
});
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
getExpected() {
|
|
1695
|
+
return "string";
|
|
1696
|
+
}
|
|
1697
|
+
matchPart(s, options) {
|
|
1698
|
+
return segmentTemplateLiteralParts(this, s, options) === void 0 ? void 0 : s;
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
function templateLiteralTransformation(template) {
|
|
1702
|
+
return new Transformation(transformEffect$1((s, options) => {
|
|
1703
|
+
const segments = segmentTemplateLiteralParts(template, s, options);
|
|
1704
|
+
if (segments) return succeed$3(segments);
|
|
1705
|
+
return fail$2(new InvalidValue({ expected: "a string matching template literal parts" }, s, options));
|
|
1706
|
+
}), transform$1((parts) => parts.join("")));
|
|
1707
|
+
}
|
|
1708
|
+
const UniqueSymbol$1 = class extends ASTNodeImpl {
|
|
1709
|
+
_tag = "UniqueSymbol";
|
|
1710
|
+
symbol;
|
|
1711
|
+
constructor(symbol, annotations, checks, encoding, context) {
|
|
1712
|
+
super(annotations, checks, encoding, context);
|
|
1713
|
+
this.symbol = symbol;
|
|
1714
|
+
}
|
|
1715
|
+
getParser() {
|
|
1716
|
+
return fromConst(this, this.symbol);
|
|
1717
|
+
}
|
|
1718
|
+
toCodecStringTree() {
|
|
1719
|
+
const key = globalThis.Symbol.keyFor(this.symbol);
|
|
1720
|
+
return replaceEncoding(this, [new Link(key === void 0 ? never : new Literal$1(globalThis.String(this.symbol)), symbolToString.transformation)]);
|
|
1721
|
+
}
|
|
1722
|
+
getExpected() {
|
|
1723
|
+
return globalThis.String(this.symbol);
|
|
1724
|
+
}
|
|
1725
|
+
};
|
|
1442
1726
|
const Literal$1 = class extends ASTNodeImpl {
|
|
1443
1727
|
_tag = "Literal";
|
|
1444
1728
|
literal;
|
|
@@ -1524,6 +1808,23 @@ const Boolean$1 = class extends ASTNodeImpl {
|
|
|
1524
1808
|
}
|
|
1525
1809
|
};
|
|
1526
1810
|
const boolean = new Boolean$1();
|
|
1811
|
+
const Symbol$2 = class extends ASTNodeImpl {
|
|
1812
|
+
_tag = "Symbol";
|
|
1813
|
+
getParser() {
|
|
1814
|
+
return fromRefinement(this, isSymbol);
|
|
1815
|
+
}
|
|
1816
|
+
matchKey(s, options) {
|
|
1817
|
+
if (options.disableChecks || !this.checks) return s;
|
|
1818
|
+
return collectIssues(this.checks, s, void 0, this, options) ? void 0 : s;
|
|
1819
|
+
}
|
|
1820
|
+
toCodecStringTree() {
|
|
1821
|
+
return replaceEncoding(this, [symbolToString]);
|
|
1822
|
+
}
|
|
1823
|
+
getExpected() {
|
|
1824
|
+
return "symbol";
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
const symbol = new Symbol$2();
|
|
1527
1828
|
const BigInt$2 = class extends ASTNodeImpl {
|
|
1528
1829
|
_tag = "BigInt";
|
|
1529
1830
|
getParser() {
|
|
@@ -1852,7 +2153,7 @@ const Objects = class extends ASTNodeImpl {
|
|
|
1852
2153
|
}
|
|
1853
2154
|
}
|
|
1854
2155
|
else if (parseIndexes) {
|
|
1855
|
-
const keyPairs = empty$
|
|
2156
|
+
const keyPairs = empty$4();
|
|
1856
2157
|
for (let i = 0; i < indexCount; i++) {
|
|
1857
2158
|
const index = indexes[i];
|
|
1858
2159
|
const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
|
|
@@ -1996,6 +2297,10 @@ function structWithRest(ast, records) {
|
|
|
1996
2297
|
}
|
|
1997
2298
|
return new Objects(propertySignatures, indexSignatures, void 0, checks);
|
|
1998
2299
|
}
|
|
2300
|
+
function tupleWithRest(ast, rest) {
|
|
2301
|
+
if (ast.encoding) throw new Error("TupleWithRest does not support encodings");
|
|
2302
|
+
return new Arrays(ast.isMutable, ast.elements, rest, void 0, ast.checks);
|
|
2303
|
+
}
|
|
1999
2304
|
function mutable$1(ast) {
|
|
2000
2305
|
if (ast.encoding) throw new Error("mutable does not support encodings");
|
|
2001
2306
|
return new Arrays(true, ast.elements, ast.rest, ast.annotations, ast.checks, void 0, ast.context, ast.encodingChecks);
|
|
@@ -2546,6 +2851,11 @@ const optionalKey$1 = memoizeIdempotent((ast) => {
|
|
|
2546
2851
|
});
|
|
2547
2852
|
const optionalKeyLastLink = applyToLastLink(optionalKey$1);
|
|
2548
2853
|
const optional$1 = memoize((ast) => optionalKey$1(new Union$1([ast, undefined_])));
|
|
2854
|
+
const mutableKey$1 = memoizeIdempotent((ast) => {
|
|
2855
|
+
const context = ast.context ? ast.context.isMutable === false ? new Context(ast.context.isOptional, true, ast.context.constructorDefault, ast.context.annotations) : ast.context : new Context(false, true);
|
|
2856
|
+
return mutableKeyLastLink(replaceContext(ast, context));
|
|
2857
|
+
});
|
|
2858
|
+
const mutableKeyLastLink = applyToLastLink(mutableKey$1);
|
|
2549
2859
|
function withConstructorDefault$1(ast, defaultValue) {
|
|
2550
2860
|
return replaceContext(ast, ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, defaultValue, ast.context.annotations) : new Context(false, false, defaultValue));
|
|
2551
2861
|
}
|
|
@@ -2667,6 +2977,53 @@ function fromRefinement(ast, refinement) {
|
|
|
2667
2977
|
return fail$2(new InvalidType(ast, input, options));
|
|
2668
2978
|
};
|
|
2669
2979
|
}
|
|
2980
|
+
function segmentTemplateLiteralParts(ast, input, options) {
|
|
2981
|
+
const parts = ast.encodedParts;
|
|
2982
|
+
const literals = ast.literals;
|
|
2983
|
+
const inputLength = input.length;
|
|
2984
|
+
for (let i = 0; i < literals.length; i++) {
|
|
2985
|
+
const literal = literals[i];
|
|
2986
|
+
if (literal && !input.includes(literal)) return void 0;
|
|
2987
|
+
}
|
|
2988
|
+
if (ast.suffixLengths[0] > inputLength) return void 0;
|
|
2989
|
+
const out = new Array(parts.length);
|
|
2990
|
+
let failures;
|
|
2991
|
+
function go(i, pos) {
|
|
2992
|
+
if (i === parts.length) return pos === inputLength;
|
|
2993
|
+
if (failures?.has(i * (inputLength + 1) + pos)) return false;
|
|
2994
|
+
const part = parts[i];
|
|
2995
|
+
if (i === parts.length - 1) {
|
|
2996
|
+
const s = input.slice(pos);
|
|
2997
|
+
if (part.matchPart(s, options) !== void 0) {
|
|
2998
|
+
out[i] = s;
|
|
2999
|
+
return true;
|
|
3000
|
+
}
|
|
3001
|
+
} else if (part._tag === "Literal") {
|
|
3002
|
+
const s = literals[i];
|
|
3003
|
+
if (input.startsWith(s, pos) && go(i + 1, pos + s.length)) {
|
|
3004
|
+
out[i] = s;
|
|
3005
|
+
return true;
|
|
3006
|
+
}
|
|
3007
|
+
} else {
|
|
3008
|
+
const maximumEnd = inputLength - ast.suffixLengths[i + 1];
|
|
3009
|
+
const anchor = literals[i + 1];
|
|
3010
|
+
let end = anchor === void 0 ? maximumEnd : input.lastIndexOf(anchor, maximumEnd);
|
|
3011
|
+
while (end >= pos) {
|
|
3012
|
+
const s = input.slice(pos, end);
|
|
3013
|
+
if (part.matchPart(s, options) !== void 0 && go(i + 1, end)) {
|
|
3014
|
+
out[i] = s;
|
|
3015
|
+
return true;
|
|
3016
|
+
}
|
|
3017
|
+
if (end === 0) break;
|
|
3018
|
+
end = anchor === void 0 ? end - 1 : input.lastIndexOf(anchor, end - 1);
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
failures ??= new Set();
|
|
3022
|
+
failures.add(i * (inputLength + 1) + pos);
|
|
3023
|
+
return false;
|
|
3024
|
+
}
|
|
3025
|
+
return go(0, 0) ? out : void 0;
|
|
3026
|
+
}
|
|
2670
3027
|
const parameterFromPropertyKey = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
|
|
2671
3028
|
switch (ast._tag) {
|
|
2672
3029
|
default: return ast;
|
|
@@ -2682,6 +3039,15 @@ const parameterFromString = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
|
|
|
2682
3039
|
case "Union": return ast.recur(parameterFromString);
|
|
2683
3040
|
}
|
|
2684
3041
|
});
|
|
3042
|
+
const partFromString = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
|
|
3043
|
+
switch (ast._tag) {
|
|
3044
|
+
default: return ast;
|
|
3045
|
+
case "Number":
|
|
3046
|
+
case "Literal":
|
|
3047
|
+
case "BigInt": return ast.toCodecStringTree();
|
|
3048
|
+
case "Union": return ast.recur(partFromString);
|
|
3049
|
+
}
|
|
3050
|
+
});
|
|
2685
3051
|
const STRING_PATTERN = "[\\s\\S]*?";
|
|
2686
3052
|
const isStringFiniteRegExp = new globalThis.RegExp(`^${FINITE_PATTERN}$`);
|
|
2687
3053
|
const isStringNumberRegExp = new globalThis.RegExp(`^(?:${FINITE_PATTERN}|Infinity|-Infinity|NaN)$`);
|
|
@@ -2713,6 +3079,23 @@ function isStringBigInt(annotations) {
|
|
|
2713
3079
|
}
|
|
2714
3080
|
const bigIntString = appendChecks(string, [isStringBigInt({ expected: "a string representing a bigint" })]);
|
|
2715
3081
|
const bigIntToString = new Link(bigIntString, bigintFromString);
|
|
3082
|
+
const isStringSymbolRegExp = new globalThis.RegExp(`^Symbol\\(([\\s\\S]*)\\)$`);
|
|
3083
|
+
const symbolString = appendChecks(string, [isStringSymbol()]);
|
|
3084
|
+
const symbolToString = new Link(symbolString, new Transformation(transform$1((description) => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)[1])), transformEffect$1((sym, options) => {
|
|
3085
|
+
if (globalThis.Symbol.keyFor(sym) !== void 0) return succeed$3(globalThis.String(sym));
|
|
3086
|
+
return fail$2(new Forbidden({ message: "cannot serialize to string, Symbol is not registered" }, sym, options));
|
|
3087
|
+
})));
|
|
3088
|
+
function isStringSymbol(annotations) {
|
|
3089
|
+
return isPattern$1(isStringSymbolRegExp, {
|
|
3090
|
+
expected: "a string representing a symbol",
|
|
3091
|
+
representation: {
|
|
3092
|
+
id: "effect/schema/isStringSymbol",
|
|
3093
|
+
payload: null
|
|
3094
|
+
},
|
|
3095
|
+
toJsonSchema: () => ({ pattern: isStringSymbolRegExp.source }),
|
|
3096
|
+
...annotations
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
2716
3099
|
function collectIssues(checks, value, issues, ast, options) {
|
|
2717
3100
|
for (let i = 0; i < checks.length; i++) {
|
|
2718
3101
|
const check = checks[i];
|
|
@@ -2814,7 +3197,7 @@ const StringTree = new Declaration([], () => (input, ast, options) => isStringTr
|
|
|
2814
3197
|
});
|
|
2815
3198
|
const unknownToStringTree = new Link(StringTree, passthrough());
|
|
2816
3199
|
//#endregion
|
|
2817
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
3200
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/interpreter.js
|
|
2818
3201
|
const flatMapTransformation = (result, current, f) => result === sameExit ? f(current) : flatMapEager(result, f);
|
|
2819
3202
|
function compileTransformation(transformation) {
|
|
2820
3203
|
if (transformation._tag === "Middleware") return (result, current, options) => {
|
|
@@ -2946,7 +3329,7 @@ function compile(ast, compile, compileField, base, specialize) {
|
|
|
2946
3329
|
};
|
|
2947
3330
|
}
|
|
2948
3331
|
//#endregion
|
|
2949
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
3332
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/compilerRegistry.js
|
|
2950
3333
|
const invalid = Symbol();
|
|
2951
3334
|
const cache = new WeakMap();
|
|
2952
3335
|
let compiler;
|
|
@@ -3034,7 +3417,7 @@ function resolve(ast) {
|
|
|
3034
3417
|
return entry;
|
|
3035
3418
|
}
|
|
3036
3419
|
//#endregion
|
|
3037
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
3420
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/SchemaParser.js
|
|
3038
3421
|
function makeEffect(schema) {
|
|
3039
3422
|
const ast = schema.ast;
|
|
3040
3423
|
let parser;
|
|
@@ -3114,6 +3497,9 @@ const decodeEffect$1 = decodeUnknownEffect$1;
|
|
|
3114
3497
|
function decodeUnknownOption$1(schema, options) {
|
|
3115
3498
|
return asOption(decodeUnknownEffect$1(schema, options));
|
|
3116
3499
|
}
|
|
3500
|
+
function decodeUnknownResult(schema, options) {
|
|
3501
|
+
return asResult(decodeUnknownEffect$1(schema, options));
|
|
3502
|
+
}
|
|
3117
3503
|
function encodeUnknownEffect$1(schema, options) {
|
|
3118
3504
|
const parser = run(flip(schema.ast));
|
|
3119
3505
|
return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
@@ -3133,7 +3519,7 @@ function run(ast) {
|
|
|
3133
3519
|
function parserResult(result, input) {
|
|
3134
3520
|
if (result === sameExit) return succeed$3(input);
|
|
3135
3521
|
if (!effectIsExit(result)) return flatMapEager(result, getValue);
|
|
3136
|
-
return result[args] === missing ? getValue(missing) : result;
|
|
3522
|
+
return result["~effect/Effect/args"] === missing ? getValue(missing) : result;
|
|
3137
3523
|
}
|
|
3138
3524
|
function runWithCompiler(compiler, ast) {
|
|
3139
3525
|
let parser;
|
|
@@ -3141,7 +3527,7 @@ function runWithCompiler(compiler, ast) {
|
|
|
3141
3527
|
const result = (parser ??= compiler(ast))(input, options ?? defaultParseOptions);
|
|
3142
3528
|
if (result === sameExit) return succeed$3(input);
|
|
3143
3529
|
if (!effectIsExit(result)) return flatMapEager(result, getValue);
|
|
3144
|
-
return result[args] === missing ? getValue(missing) : result;
|
|
3530
|
+
return result["~effect/Effect/args"] === missing ? getValue(missing) : result;
|
|
3145
3531
|
};
|
|
3146
3532
|
}
|
|
3147
3533
|
function asExit(parser) {
|
|
@@ -3156,6 +3542,14 @@ function asOption(parser) {
|
|
|
3156
3542
|
return none();
|
|
3157
3543
|
};
|
|
3158
3544
|
}
|
|
3545
|
+
function asResult(parser) {
|
|
3546
|
+
const parserExit = asExit(parser);
|
|
3547
|
+
return (input, options) => {
|
|
3548
|
+
const exit = parserExit(input, options);
|
|
3549
|
+
if (isSuccess(exit)) return succeed$1(exit.value);
|
|
3550
|
+
return fail$1(getSchemaIssueOrThrow(exit.cause, "Result adapter can only return schema issues"));
|
|
3551
|
+
};
|
|
3552
|
+
}
|
|
3159
3553
|
function runSync(effect, message) {
|
|
3160
3554
|
const exit = runSyncExit(effect);
|
|
3161
3555
|
if (isSuccess(exit)) return exit.value;
|
|
@@ -3188,7 +3582,7 @@ function makeConstructorSync(ast) {
|
|
|
3188
3582
|
const normalCompiler = (ast) => resolve(ast).parser;
|
|
3189
3583
|
const constructorCompiler = (ast) => resolve(ast).makeEffect;
|
|
3190
3584
|
//#endregion
|
|
3191
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
3585
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/make.js
|
|
3192
3586
|
const TypeId$3 = "~effect/Schema/Schema";
|
|
3193
3587
|
const RebuildOptions = Symbol();
|
|
3194
3588
|
const SchemaProto = {
|
|
@@ -3243,7 +3637,7 @@ function make$1(ast, options) {
|
|
|
3243
3637
|
return self;
|
|
3244
3638
|
}
|
|
3245
3639
|
//#endregion
|
|
3246
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
3640
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/JsonPointer.js
|
|
3247
3641
|
function escapeToken(token) {
|
|
3248
3642
|
return token.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
3249
3643
|
}
|
|
@@ -3269,8 +3663,27 @@ function parseUriFragment(fragment) {
|
|
|
3269
3663
|
const pointer = decodeUriFragment(fragment);
|
|
3270
3664
|
return pointer === void 0 ? void 0 : pointer.length === 0 ? [] : pointer.slice(1).split("/").map(unescapeToken);
|
|
3271
3665
|
}
|
|
3666
|
+
function formatUriFragment(path) {
|
|
3667
|
+
return path.reduce((fragment, token) => `${fragment}/${formatUriFragmentToken(token)}`, "#");
|
|
3668
|
+
}
|
|
3272
3669
|
//#endregion
|
|
3273
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
3670
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/JsonSchema.js
|
|
3671
|
+
const META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema#";
|
|
3672
|
+
const META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
3673
|
+
function isMetaSchemaUri(value, uri) {
|
|
3674
|
+
return value === uri || value === (uri.endsWith("#") ? uri.slice(0, -1) : `${uri}#`);
|
|
3675
|
+
}
|
|
3676
|
+
function fromSchemaDraft07(js) {
|
|
3677
|
+
return fromSchemaDraft2020_12(convertDraft07(js));
|
|
3678
|
+
}
|
|
3679
|
+
function fromSchemaDraft2020_12(js) {
|
|
3680
|
+
const { $defs, ...schema } = js;
|
|
3681
|
+
return {
|
|
3682
|
+
dialect: "draft-2020-12",
|
|
3683
|
+
schema,
|
|
3684
|
+
definitions: isObject($defs) ? $defs : {}
|
|
3685
|
+
};
|
|
3686
|
+
}
|
|
3274
3687
|
function getReferenceKey($ref) {
|
|
3275
3688
|
const path = $ref.startsWith("#") ? parseUriFragment($ref) : void 0;
|
|
3276
3689
|
return path !== void 0 && path.length === 2 && path[0] === "$defs" ? path[1] : void 0;
|
|
@@ -3330,9 +3743,154 @@ function mapObject(value, f) {
|
|
|
3330
3743
|
for (const key of Object.keys(value)) assignProperty$1(out, key, f(value[key], key));
|
|
3331
3744
|
return out;
|
|
3332
3745
|
}
|
|
3746
|
+
function runConverter(adapter, options, use) {
|
|
3747
|
+
const locations = new Map();
|
|
3748
|
+
const references = [];
|
|
3749
|
+
let rootUri = ROOT_URI;
|
|
3750
|
+
function convert(root, sourcePath = [], targetPath = []) {
|
|
3751
|
+
if (sourcePath.length === 0 && options?.trackIds) rootUri = resolveResourceUri(isObject(root) ? getResourceId(root) : void 0, ROOT_URI) ?? ROOT_URI;
|
|
3752
|
+
return loop(root, sourcePath, targetPath, {
|
|
3753
|
+
sourceRoot: [],
|
|
3754
|
+
targetRoot: [],
|
|
3755
|
+
uri: rootUri
|
|
3756
|
+
});
|
|
3757
|
+
}
|
|
3758
|
+
function finish() {
|
|
3759
|
+
for (const [out, value, sourceResource] of references) {
|
|
3760
|
+
let reference = value;
|
|
3761
|
+
const resolved = resolveUrl(value, sourceResource);
|
|
3762
|
+
if (resolved !== void 0) {
|
|
3763
|
+
const sourcePointer = parseUriFragment(resolved.hash);
|
|
3764
|
+
resolved.hash = "";
|
|
3765
|
+
if (sourcePointer !== void 0) {
|
|
3766
|
+
const targetPath = locations.get(locationKey(resolved.href, sourcePointer));
|
|
3767
|
+
if (targetPath !== void 0) reference = relocateReference(value, targetPath);
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
assignProperty$1(out, "$ref", reference);
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
const out = use(convert);
|
|
3774
|
+
finish();
|
|
3775
|
+
return out;
|
|
3776
|
+
function loop(node, sourcePath, targetPath, resourceScope) {
|
|
3777
|
+
if (typeof node === "boolean") {
|
|
3778
|
+
recordLocations(sourcePath, targetPath, resourceScope);
|
|
3779
|
+
return options?.booleanAdapter?.(node) ?? node;
|
|
3780
|
+
}
|
|
3781
|
+
if (!isObject(node)) return node;
|
|
3782
|
+
let currentResourceScope = resourceScope;
|
|
3783
|
+
const id = getResourceId(node);
|
|
3784
|
+
if (sourcePath.length > 0 && options?.trackIds && createsResource(id)) {
|
|
3785
|
+
const uri = resolveResourceUri(id, resourceScope.uri);
|
|
3786
|
+
if (uri !== void 0) currentResourceScope = {
|
|
3787
|
+
parent: resourceScope,
|
|
3788
|
+
sourceRoot: sourcePath,
|
|
3789
|
+
targetRoot: targetPath,
|
|
3790
|
+
uri
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
recordLocations(sourcePath, targetPath, currentResourceScope);
|
|
3794
|
+
const currentResource = currentResourceScope.uri;
|
|
3795
|
+
return adapter(node, {
|
|
3796
|
+
isDocumentRoot: sourcePath.length === 0,
|
|
3797
|
+
schema(value, sourceKey, targetKey = sourceKey) {
|
|
3798
|
+
return loop(value, [...sourcePath, sourceKey], [...targetPath, targetKey], currentResourceScope);
|
|
3799
|
+
},
|
|
3800
|
+
schemaAt(value, sourceSuffix, targetSuffix) {
|
|
3801
|
+
return loop(value, [...sourcePath, ...sourceSuffix], [...targetPath, ...targetSuffix], currentResourceScope);
|
|
3802
|
+
},
|
|
3803
|
+
schemaArray(value, sourceKey, targetKey = sourceKey) {
|
|
3804
|
+
return Array.isArray(value) ? value.map((item, index) => loop(item, [
|
|
3805
|
+
...sourcePath,
|
|
3806
|
+
sourceKey,
|
|
3807
|
+
String(index)
|
|
3808
|
+
], [
|
|
3809
|
+
...targetPath,
|
|
3810
|
+
targetKey,
|
|
3811
|
+
String(index)
|
|
3812
|
+
], currentResourceScope)) : value;
|
|
3813
|
+
},
|
|
3814
|
+
schemaMap(value, sourceKey, targetKey = sourceKey) {
|
|
3815
|
+
if (!isObject(value)) return value;
|
|
3816
|
+
return mapObject(value, (item, key) => loop(item, [
|
|
3817
|
+
...sourcePath,
|
|
3818
|
+
sourceKey,
|
|
3819
|
+
key
|
|
3820
|
+
], [
|
|
3821
|
+
...targetPath,
|
|
3822
|
+
targetKey,
|
|
3823
|
+
key
|
|
3824
|
+
], currentResourceScope));
|
|
3825
|
+
},
|
|
3826
|
+
reference(out, value) {
|
|
3827
|
+
if (typeof value === "string") references.push([
|
|
3828
|
+
out,
|
|
3829
|
+
value,
|
|
3830
|
+
currentResource
|
|
3831
|
+
]);
|
|
3832
|
+
else assignProperty$1(out, "$ref", value);
|
|
3833
|
+
}
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3836
|
+
function getResourceId(schema) {
|
|
3837
|
+
return options?.ignoreRefSiblings === true && typeof schema.$ref === "string" ? void 0 : schema.$id;
|
|
3838
|
+
}
|
|
3839
|
+
function recordLocations(sourcePath, targetPath, scope) {
|
|
3840
|
+
if (scope.parent !== void 0) recordLocations(sourcePath, targetPath, scope.parent);
|
|
3841
|
+
locations.set(locationKey(scope.uri, sourcePath.slice(scope.sourceRoot.length)), targetPath.slice(scope.targetRoot.length));
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
const ROOT_URI = "https://effect.invalid/.json-schema/";
|
|
3845
|
+
function resolveUrl(value, base) {
|
|
3846
|
+
return URL.canParse(value, base) ? new URL(value, base) : void 0;
|
|
3847
|
+
}
|
|
3848
|
+
function resolveResourceUri(value, base) {
|
|
3849
|
+
if (typeof value !== "string") return void 0;
|
|
3850
|
+
const url = resolveUrl(value, base);
|
|
3851
|
+
if (url === void 0) return void 0;
|
|
3852
|
+
url.hash = "";
|
|
3853
|
+
return url.href;
|
|
3854
|
+
}
|
|
3855
|
+
function relocateReference(reference, targetPath) {
|
|
3856
|
+
const index = reference.indexOf("#");
|
|
3857
|
+
if (index === -1 && targetPath.length === 0) return reference;
|
|
3858
|
+
return `${index === -1 ? reference : reference.slice(0, index)}${formatUriFragment(targetPath)}`;
|
|
3859
|
+
}
|
|
3860
|
+
function locationKey(resource, pointer) {
|
|
3861
|
+
return `${resource}\u0000${JSON.stringify(pointer)}`;
|
|
3862
|
+
}
|
|
3333
3863
|
function createsResource(id) {
|
|
3334
3864
|
return typeof id === "string" && id.length > 0 && id[0] !== "#";
|
|
3335
3865
|
}
|
|
3866
|
+
function convertSchema(root, adapter, options) {
|
|
3867
|
+
return runConverter(adapter, options, (convert) => convert(root));
|
|
3868
|
+
}
|
|
3869
|
+
const SCHEMA_MAP_KEYWORDS = new Set(["properties", "patternProperties"]);
|
|
3870
|
+
const SCHEMA_ARRAY_KEYWORDS = new Set([
|
|
3871
|
+
"allOf",
|
|
3872
|
+
"anyOf",
|
|
3873
|
+
"oneOf"
|
|
3874
|
+
]);
|
|
3875
|
+
const JSON_SCHEMA_SINGLE_KEYWORDS = new Set([
|
|
3876
|
+
"not",
|
|
3877
|
+
"additionalProperties",
|
|
3878
|
+
"propertyNames",
|
|
3879
|
+
"contains",
|
|
3880
|
+
"if",
|
|
3881
|
+
"then",
|
|
3882
|
+
"else",
|
|
3883
|
+
"contentSchema"
|
|
3884
|
+
]);
|
|
3885
|
+
function convertSubschemaKeyword(out, key, value, context, singleKeywords, mapKeywords = SCHEMA_MAP_KEYWORDS) {
|
|
3886
|
+
let converted;
|
|
3887
|
+
if (mapKeywords.has(key)) converted = context.schemaMap(value, key);
|
|
3888
|
+
else if (SCHEMA_ARRAY_KEYWORDS.has(key)) converted = context.schemaArray(value, key);
|
|
3889
|
+
else if (singleKeywords.has(key)) converted = context.schema(value, key);
|
|
3890
|
+
else return false;
|
|
3891
|
+
assignProperty$1(out, key, converted);
|
|
3892
|
+
return true;
|
|
3893
|
+
}
|
|
3336
3894
|
const PRE_2020_TO_2020_COLLISIONS = [
|
|
3337
3895
|
"$anchor",
|
|
3338
3896
|
"$defs",
|
|
@@ -3365,8 +3923,91 @@ const OPEN_API_30_TO_2020_COLLISIONS = [
|
|
|
3365
3923
|
"propertyNames",
|
|
3366
3924
|
"then"
|
|
3367
3925
|
];
|
|
3926
|
+
const ANCHOR_REGEXP = /^[A-Za-z_][-A-Za-z0-9._]*$/;
|
|
3927
|
+
function convertDraft07(root) {
|
|
3928
|
+
return convertSchema(root, (source, context) => {
|
|
3929
|
+
const out = {};
|
|
3930
|
+
if (typeof source.$ref === "string") {
|
|
3931
|
+
context.reference(out, source.$ref);
|
|
3932
|
+
if (Object.hasOwn(source, "definitions")) assignProperty$1(out, "$defs", context.schemaMap(source.definitions, "definitions", "$defs"));
|
|
3933
|
+
return out;
|
|
3934
|
+
}
|
|
3935
|
+
rejectKeywordCollisions(source, DRAFT_07_TO_2020_COLLISIONS, "Draft 2020-12", "Draft-07");
|
|
3936
|
+
let items = void 0;
|
|
3937
|
+
let additionalItems = void 0;
|
|
3938
|
+
for (const key of Object.keys(source)) {
|
|
3939
|
+
const value = source[key];
|
|
3940
|
+
if (convertSubschemaKeyword(out, key, value, context, JSON_SCHEMA_SINGLE_KEYWORDS)) continue;
|
|
3941
|
+
switch (key) {
|
|
3942
|
+
case "$schema":
|
|
3943
|
+
assignProperty$1(out, key, isMetaSchemaUri(value, "http://json-schema.org/draft-07/schema#") ? META_SCHEMA_URI_DRAFT_2020_12 : value);
|
|
3944
|
+
break;
|
|
3945
|
+
case "$id":
|
|
3946
|
+
convertDraft07Id(out, value);
|
|
3947
|
+
break;
|
|
3948
|
+
case "definitions":
|
|
3949
|
+
assignProperty$1(out, "$defs", context.schemaMap(value, key, "$defs"));
|
|
3950
|
+
break;
|
|
3951
|
+
case "dependencies": {
|
|
3952
|
+
if (!isObject(value)) {
|
|
3953
|
+
assignProperty$1(out, key, value);
|
|
3954
|
+
break;
|
|
3955
|
+
}
|
|
3956
|
+
const dependentRequired = {};
|
|
3957
|
+
const dependentSchemas = {};
|
|
3958
|
+
for (const dependency of Object.keys(value)) {
|
|
3959
|
+
const dependencyValue = value[dependency];
|
|
3960
|
+
assignProperty$1(Array.isArray(dependencyValue) ? dependentRequired : dependentSchemas, dependency, Array.isArray(dependencyValue) ? dependencyValue : context.schemaAt(dependencyValue, ["dependencies", dependency], ["dependentSchemas", dependency]));
|
|
3961
|
+
}
|
|
3962
|
+
if (Object.keys(dependentRequired).length > 0) assignProperty$1(out, "dependentRequired", dependentRequired);
|
|
3963
|
+
if (Object.keys(dependentSchemas).length > 0) assignProperty$1(out, "dependentSchemas", dependentSchemas);
|
|
3964
|
+
break;
|
|
3965
|
+
}
|
|
3966
|
+
case "items":
|
|
3967
|
+
items = value;
|
|
3968
|
+
break;
|
|
3969
|
+
case "additionalItems":
|
|
3970
|
+
additionalItems = value;
|
|
3971
|
+
break;
|
|
3972
|
+
default: assignProperty$1(out, key, value);
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
if (items !== void 0) {
|
|
3976
|
+
if (Array.isArray(items)) {
|
|
3977
|
+
assignProperty$1(out, "prefixItems", context.schemaArray(items, "items", "prefixItems"));
|
|
3978
|
+
if (additionalItems !== void 0) assignProperty$1(out, "items", context.schema(additionalItems, "additionalItems", "items"));
|
|
3979
|
+
} else assignProperty$1(out, "items", context.schema(items, "items"));
|
|
3980
|
+
}
|
|
3981
|
+
return out;
|
|
3982
|
+
}, {
|
|
3983
|
+
trackIds: true,
|
|
3984
|
+
ignoreRefSiblings: true
|
|
3985
|
+
});
|
|
3986
|
+
}
|
|
3987
|
+
function convertDraft07Id(out, value) {
|
|
3988
|
+
if (typeof value !== "string" || !value.includes("#")) {
|
|
3989
|
+
assignProperty$1(out, "$id", value);
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
const fragmentIndex = value.indexOf("#");
|
|
3993
|
+
const id = value.slice(0, fragmentIndex);
|
|
3994
|
+
const anchor = value.slice(fragmentIndex + 1);
|
|
3995
|
+
if (anchor.length === 0) {
|
|
3996
|
+
if (id.length > 0) assignProperty$1(out, "$id", id);
|
|
3997
|
+
return;
|
|
3998
|
+
}
|
|
3999
|
+
if (!ANCHOR_REGEXP.test(anchor)) unsupported("$id", "Draft 2020-12", `fragment "#${anchor}" is not a valid $anchor`);
|
|
4000
|
+
if (id.length > 0) assignProperty$1(out, "$id", id);
|
|
4001
|
+
assignProperty$1(out, "$anchor", anchor);
|
|
4002
|
+
}
|
|
4003
|
+
function unsupported(keyword, dialect, details) {
|
|
4004
|
+
throw new Error(`Cannot convert JSON Schema keyword "${keyword}" to ${dialect}: ${details}`);
|
|
4005
|
+
}
|
|
4006
|
+
function rejectKeywordCollisions(source, keywords, targetDialect, sourceDialect) {
|
|
4007
|
+
for (const keyword of keywords) if (Object.hasOwn(source, keyword)) unsupported(keyword, targetDialect, `it is not active in ${sourceDialect} but would become active in the target`);
|
|
4008
|
+
}
|
|
3368
4009
|
//#endregion
|
|
3369
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
4010
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/toCodec.js
|
|
3370
4011
|
function toCodecJson$1(schema) {
|
|
3371
4012
|
return make$1(toCodecJsonAST(schema.ast), { schema });
|
|
3372
4013
|
}
|
|
@@ -3492,17 +4133,17 @@ const toCodecStringTreeAST = applyToSelfOrLastLinkEncodingIdempotent((ast) => {
|
|
|
3492
4133
|
return out;
|
|
3493
4134
|
}, { stopAt: isCodecArrayFromSingleLink });
|
|
3494
4135
|
//#endregion
|
|
3495
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
4136
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/RegExp.js
|
|
3496
4137
|
const RegExp$1 = globalThis.RegExp;
|
|
3497
4138
|
const escape = (string) => string.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
3498
4139
|
//#endregion
|
|
3499
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
4140
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/errors.js
|
|
3500
4141
|
function errorWithPath(message, path) {
|
|
3501
4142
|
if (path.length > 0) message += `\n at ${formatPath(path)}`;
|
|
3502
4143
|
return new Error(message);
|
|
3503
4144
|
}
|
|
3504
4145
|
//#endregion
|
|
3505
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
4146
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js
|
|
3506
4147
|
function formatDefinitionReference(key) {
|
|
3507
4148
|
return `#/$defs/${formatUriFragmentToken(key)}`;
|
|
3508
4149
|
}
|
|
@@ -4071,7 +4712,7 @@ function toJsonSchemaDocument$1(document, options) {
|
|
|
4071
4712
|
};
|
|
4072
4713
|
}
|
|
4073
4714
|
//#endregion
|
|
4074
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
4715
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schema/toRepresentation.js
|
|
4075
4716
|
const defaultReferencePolicy = ({ identifier }) => identifier;
|
|
4076
4717
|
function annotationsField(annotations) {
|
|
4077
4718
|
return annotations === void 0 ? void 0 : { annotations };
|
|
@@ -4335,7 +4976,7 @@ function toRepresentations(asts, options) {
|
|
|
4335
4976
|
}
|
|
4336
4977
|
}
|
|
4337
4978
|
//#endregion
|
|
4338
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
4979
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Struct.js
|
|
4339
4980
|
const omit = dual(2, (self, keys) => {
|
|
4340
4981
|
return buildStruct(self, (k, v) => !hasPropertyKey(keys, k) ? [k, v] : void 0);
|
|
4341
4982
|
});
|
|
@@ -4359,13 +5000,13 @@ function buildStruct(source, f) {
|
|
|
4359
5000
|
return out;
|
|
4360
5001
|
}
|
|
4361
5002
|
//#endregion
|
|
4362
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
5003
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/internal/schemaError.js
|
|
4363
5004
|
const SchemaErrorTypeId = "~effect/Schema/SchemaError";
|
|
4364
5005
|
function isSchemaError$1(u) {
|
|
4365
5006
|
return hasProperty(u, "~effect/Schema/SchemaError") && u["~effect/Schema/SchemaError"] === "~effect/Schema/SchemaError";
|
|
4366
5007
|
}
|
|
4367
5008
|
//#endregion
|
|
4368
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
5009
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/net/NetAddress.js
|
|
4369
5010
|
const TypeId$2 = "~effect/net/NetAddress";
|
|
4370
5011
|
const ipv4Value = (self) => self.value;
|
|
4371
5012
|
const ipv6Words = (self) => self;
|
|
@@ -4382,10 +5023,10 @@ const Ipv4Proto = {
|
|
|
4382
5023
|
...BaseProto,
|
|
4383
5024
|
_tag: "Ipv4Address",
|
|
4384
5025
|
[TypeId$2]: TypeId$2,
|
|
4385
|
-
[symbol$
|
|
5026
|
+
[symbol$2](that) {
|
|
4386
5027
|
return isIpv4Address(that) && ipv4Value(this) === ipv4Value(that);
|
|
4387
5028
|
},
|
|
4388
|
-
[symbol]() {
|
|
5029
|
+
[symbol$1]() {
|
|
4389
5030
|
return optimize(combine(ipv4HashSeed, ipv4Value(this) | 0));
|
|
4390
5031
|
},
|
|
4391
5032
|
toString() {
|
|
@@ -4399,13 +5040,13 @@ const Ipv6Proto = {
|
|
|
4399
5040
|
...BaseProto,
|
|
4400
5041
|
_tag: "Ipv6Address",
|
|
4401
5042
|
[TypeId$2]: TypeId$2,
|
|
4402
|
-
[symbol$
|
|
5043
|
+
[symbol$2](that) {
|
|
4403
5044
|
if (!isIpv6Address(that)) return false;
|
|
4404
5045
|
const self = ipv6Words(this);
|
|
4405
5046
|
const other = ipv6Words(that);
|
|
4406
5047
|
return self.w0 === other.w0 && self.w1 === other.w1 && self.w2 === other.w2 && self.w3 === other.w3;
|
|
4407
5048
|
},
|
|
4408
|
-
[symbol]() {
|
|
5049
|
+
[symbol$1]() {
|
|
4409
5050
|
const self = ipv6Words(this);
|
|
4410
5051
|
let h = combine(ipv6HashSeed, self.w0 | 0);
|
|
4411
5052
|
h = combine(h, self.w1 | 0);
|
|
@@ -4423,10 +5064,10 @@ const MacProto = {
|
|
|
4423
5064
|
...BaseProto,
|
|
4424
5065
|
_tag: "MacAddress",
|
|
4425
5066
|
[TypeId$2]: TypeId$2,
|
|
4426
|
-
[symbol$
|
|
5067
|
+
[symbol$2](that) {
|
|
4427
5068
|
return isMacAddress(that) && bytesEqual(getMacBytes(this), getMacBytes(that));
|
|
4428
5069
|
},
|
|
4429
|
-
[symbol]() {
|
|
5070
|
+
[symbol$1]() {
|
|
4430
5071
|
return combine(macHashSeed, array(getMacBytes(this)));
|
|
4431
5072
|
},
|
|
4432
5073
|
toString() {
|
|
@@ -4574,10 +5215,10 @@ const InetV4Proto = {
|
|
|
4574
5215
|
...BaseProto,
|
|
4575
5216
|
_tag: "InetAddressV4",
|
|
4576
5217
|
[TypeId$2]: TypeId$2,
|
|
4577
|
-
[symbol$
|
|
5218
|
+
[symbol$2](that) {
|
|
4578
5219
|
return isInetAddressV4(that) && this.port === that.port && equals(this.address, that.address);
|
|
4579
5220
|
},
|
|
4580
|
-
[symbol]() {
|
|
5221
|
+
[symbol$1]() {
|
|
4581
5222
|
return combine(hash(this.address), number$1(this.port));
|
|
4582
5223
|
},
|
|
4583
5224
|
toString() {
|
|
@@ -4591,10 +5232,10 @@ const InetV6Proto = {
|
|
|
4591
5232
|
...BaseProto,
|
|
4592
5233
|
_tag: "InetAddressV6",
|
|
4593
5234
|
[TypeId$2]: TypeId$2,
|
|
4594
|
-
[symbol$
|
|
5235
|
+
[symbol$2](that) {
|
|
4595
5236
|
return isInetAddressV6(that) && this.port === that.port && this.scopeId === that.scopeId && equals(this.address, that.address);
|
|
4596
5237
|
},
|
|
4597
|
-
[symbol]() {
|
|
5238
|
+
[symbol$1]() {
|
|
4598
5239
|
return combine(combine(hash(this.address), number$1(this.port)), number$1(this.scopeId));
|
|
4599
5240
|
},
|
|
4600
5241
|
toString() {
|
|
@@ -4613,10 +5254,10 @@ const UnixPathProto = {
|
|
|
4613
5254
|
...BaseProto,
|
|
4614
5255
|
_tag: "UnixPathAddress",
|
|
4615
5256
|
[TypeId$2]: TypeId$2,
|
|
4616
|
-
[symbol$
|
|
5257
|
+
[symbol$2](that) {
|
|
4617
5258
|
return isUnixPathAddress(that) && this.path === that.path;
|
|
4618
5259
|
},
|
|
4619
|
-
[symbol]() {
|
|
5260
|
+
[symbol$1]() {
|
|
4620
5261
|
return combine(string$1("UnixPathAddress"), string$1(this.path));
|
|
4621
5262
|
},
|
|
4622
5263
|
toString() {
|
|
@@ -4627,7 +5268,7 @@ const UnixPathProto = {
|
|
|
4627
5268
|
}
|
|
4628
5269
|
};
|
|
4629
5270
|
//#endregion
|
|
4630
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
5271
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/net/Host.js
|
|
4631
5272
|
const TypeId$1 = "~effect/net/Host";
|
|
4632
5273
|
const labelPattern = /^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/;
|
|
4633
5274
|
const numericLabel = /^(?:\d+|0x[0-9a-f]*)$/;
|
|
@@ -4651,10 +5292,10 @@ const HostPortProto = {
|
|
|
4651
5292
|
...BaseProto,
|
|
4652
5293
|
_tag: "HostPort",
|
|
4653
5294
|
[TypeId$1]: TypeId$1,
|
|
4654
|
-
[symbol$
|
|
5295
|
+
[symbol$2](that) {
|
|
4655
5296
|
return isHostPort(that) && this.port === that.port && equals(this.host, that.host);
|
|
4656
5297
|
},
|
|
4657
|
-
[symbol]() {
|
|
5298
|
+
[symbol$1]() {
|
|
4658
5299
|
return combine(hash(this.host), number$1(this.port));
|
|
4659
5300
|
},
|
|
4660
5301
|
toString() {
|
|
@@ -4669,7 +5310,7 @@ const formatHostPort = (self) => {
|
|
|
4669
5310
|
return host.includes(":") ? `[${host}]:${self.port}` : `${host}:${self.port}`;
|
|
4670
5311
|
};
|
|
4671
5312
|
//#endregion
|
|
4672
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
5313
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/net/Dns.js
|
|
4673
5314
|
const RecordTypeId = "~effect/net/Dns/DnsRecord";
|
|
4674
5315
|
const isUint8 = (u) => Number.isInteger(u) && u >= 0 && u <= 255;
|
|
4675
5316
|
const isUint16 = (u) => Number.isInteger(u) && u >= 0 && u <= 65535;
|
|
@@ -4728,10 +5369,10 @@ const isDnsRecord = (u) => hasProperty(u, RecordTypeId);
|
|
|
4728
5369
|
const RecordPrototype = {
|
|
4729
5370
|
...BaseProto,
|
|
4730
5371
|
[RecordTypeId]: RecordTypeId,
|
|
4731
|
-
[symbol$
|
|
5372
|
+
[symbol$2](that) {
|
|
4732
5373
|
return isDnsRecord(that) && that._tag === this._tag && Object.keys(this).every((key) => equals(this[key], that[key]));
|
|
4733
5374
|
},
|
|
4734
|
-
[symbol]() {
|
|
5375
|
+
[symbol$1]() {
|
|
4735
5376
|
return structureKeys(this, Object.keys(this));
|
|
4736
5377
|
},
|
|
4737
5378
|
toString() {
|
|
@@ -4807,7 +5448,7 @@ const formatRecord = (self) => {
|
|
|
4807
5448
|
}
|
|
4808
5449
|
};
|
|
4809
5450
|
//#endregion
|
|
4810
|
-
//#region node_modules/.pnpm/effect@4.0.
|
|
5451
|
+
//#region node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Schema.js
|
|
4811
5452
|
const TypeId = TypeId$3;
|
|
4812
5453
|
function declareConstructor() {
|
|
4813
5454
|
return (typeParameters, run, annotations) => {
|
|
@@ -4900,6 +5541,7 @@ const optional = lambda((self) => {
|
|
|
4900
5541
|
const schema = UndefinedOr(self);
|
|
4901
5542
|
return make(optional$1(self.ast), { schema });
|
|
4902
5543
|
});
|
|
5544
|
+
const mutableKey = lambda((schema) => make(mutableKey$1(schema.ast), { schema }));
|
|
4903
5545
|
const toType = lambda((schema) => make(toType$1(schema.ast), { schema }));
|
|
4904
5546
|
const toEncoded = lambda((schema) => make(toEncoded$1(schema.ast), { schema }));
|
|
4905
5547
|
function Literal(literal) {
|
|
@@ -4914,16 +5556,31 @@ function Literal(literal) {
|
|
|
4914
5556
|
});
|
|
4915
5557
|
return out;
|
|
4916
5558
|
}
|
|
5559
|
+
function templateLiteralParts(parts) {
|
|
5560
|
+
return parts.map((part) => isSchema(part) ? part.ast : new Literal$1(part));
|
|
5561
|
+
}
|
|
5562
|
+
function TemplateLiteral(parts) {
|
|
5563
|
+
return make(new TemplateLiteral$1(templateLiteralParts(parts)), { parts });
|
|
5564
|
+
}
|
|
5565
|
+
function Enum(enums) {
|
|
5566
|
+
return make(new Enum$1(Object.keys(enums).filter((key) => typeof enums[enums[key]] !== "number").map((key) => [key, enums[key]])), { enums });
|
|
5567
|
+
}
|
|
4917
5568
|
const Never = make(never);
|
|
4918
5569
|
const Any = make(any);
|
|
4919
5570
|
const Unknown = make(unknown);
|
|
4920
5571
|
const Null = make(null_);
|
|
4921
5572
|
const Undefined = make(undefined_);
|
|
4922
5573
|
const String$1 = make(string);
|
|
5574
|
+
const StringForLiteralAutocomplete = String$1;
|
|
4923
5575
|
const Number$1 = make(number);
|
|
4924
5576
|
const Boolean = make(boolean);
|
|
5577
|
+
const Symbol$1 = make(symbol);
|
|
4925
5578
|
const BigInt$1 = make(bigInt);
|
|
4926
5579
|
const Void = make(void_);
|
|
5580
|
+
const ObjectKeyword = make(objectKeyword);
|
|
5581
|
+
function UniqueSymbol(symbol) {
|
|
5582
|
+
return make(new UniqueSymbol$1(symbol));
|
|
5583
|
+
}
|
|
4927
5584
|
function makeStruct(ast, fields) {
|
|
4928
5585
|
return make(ast, {
|
|
4929
5586
|
fields,
|
|
@@ -4960,6 +5617,12 @@ function makeTuple(ast, elements) {
|
|
|
4960
5617
|
function Tuple(elements) {
|
|
4961
5618
|
return makeTuple(tuple(elements), elements);
|
|
4962
5619
|
}
|
|
5620
|
+
function TupleWithRest(schema, rest) {
|
|
5621
|
+
return make(tupleWithRest(schema.ast, rest.map(getAST)), {
|
|
5622
|
+
schema,
|
|
5623
|
+
rest
|
|
5624
|
+
});
|
|
5625
|
+
}
|
|
4963
5626
|
const ArraySchema = lambda((schema) => make(new Arrays(false, [], [schema.ast]), { value: schema }));
|
|
4964
5627
|
const NonEmptyArray = lambda((schema) => make(new Arrays(false, [schema.ast], [schema.ast]), { value: schema }));
|
|
4965
5628
|
const mutable = lambda((schema) => make(mutable$1(schema.ast), { schema }));
|
|
@@ -5046,6 +5709,7 @@ function withConstructorDefault(defaultValue) {
|
|
|
5046
5709
|
return (schema) => make(withConstructorDefault$1(schema.ast, defaultValue), { schema });
|
|
5047
5710
|
}
|
|
5048
5711
|
function toIssueEffect(self) {
|
|
5712
|
+
if (effectIsExit(self) && self._tag === "Success") return self;
|
|
5049
5713
|
return catchCause(self, (cause) => failCauseSync(() => map$5(cause, (error) => error.issue)));
|
|
5050
5714
|
}
|
|
5051
5715
|
function withDecodingDefaultKey(defaultValue, options) {
|
|
@@ -5168,6 +5832,9 @@ function link() {
|
|
|
5168
5832
|
};
|
|
5169
5833
|
}
|
|
5170
5834
|
const makeFilter = makeFilter$1;
|
|
5835
|
+
function makeFilterGroup(checks, annotations = void 0) {
|
|
5836
|
+
return new FilterGroup(checks, annotations);
|
|
5837
|
+
}
|
|
5171
5838
|
function isPattern(regExp, annotations) {
|
|
5172
5839
|
const source = regExp.source;
|
|
5173
5840
|
const flags = regExp.flags;
|
|
@@ -5179,6 +5846,26 @@ function isPattern(regExp, annotations) {
|
|
|
5179
5846
|
...annotations
|
|
5180
5847
|
});
|
|
5181
5848
|
}
|
|
5849
|
+
const getUUIDRegExp = (version) => {
|
|
5850
|
+
if (version) return new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
5851
|
+
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;
|
|
5852
|
+
};
|
|
5853
|
+
function isUUID(version, annotations) {
|
|
5854
|
+
const regExp = getUUIDRegExp(version);
|
|
5855
|
+
return isPattern(regExp, {
|
|
5856
|
+
expected: version ? `a UUID v${version}` : "a UUID",
|
|
5857
|
+
representation: {
|
|
5858
|
+
id: "effect/schema/isUUID",
|
|
5859
|
+
payload: { version: version ?? null }
|
|
5860
|
+
},
|
|
5861
|
+
toJsonSchema: () => ({
|
|
5862
|
+
pattern: regExp.source,
|
|
5863
|
+
format: "uuid"
|
|
5864
|
+
}),
|
|
5865
|
+
toCode: () => ({ runtime: version === void 0 ? "Schema.isUUID()" : `Schema.isUUID(${version})` }),
|
|
5866
|
+
...annotations
|
|
5867
|
+
});
|
|
5868
|
+
}
|
|
5182
5869
|
function isBase64(annotations) {
|
|
5183
5870
|
const regExp = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
5184
5871
|
return isPattern(regExp, {
|
|
@@ -5192,6 +5879,68 @@ function isBase64(annotations) {
|
|
|
5192
5879
|
...annotations
|
|
5193
5880
|
});
|
|
5194
5881
|
}
|
|
5882
|
+
function literalToJsonSchema(literal, original, pattern) {
|
|
5883
|
+
if (literal.length === 0) return original.length === 0 ? {} : [{}, true];
|
|
5884
|
+
const constraint = { pattern: new globalThis.RegExp(pattern).source };
|
|
5885
|
+
return literal === original ? constraint : [constraint, true];
|
|
5886
|
+
}
|
|
5887
|
+
function isStartingWith(startsWith, annotations) {
|
|
5888
|
+
const formatted = JSON.stringify(startsWith);
|
|
5889
|
+
const regExp = new globalThis.RegExp(`^${escape(startsWith)}`);
|
|
5890
|
+
const jsonSchemaLiteral = startsWith.replace(/[\uD800-\uDBFF]$/, "");
|
|
5891
|
+
return makeFilter((s) => s.startsWith(startsWith), {
|
|
5892
|
+
expected: `a string starting with ${formatted}`,
|
|
5893
|
+
representation: {
|
|
5894
|
+
id: "effect/schema/isStartingWith",
|
|
5895
|
+
payload: { startsWith }
|
|
5896
|
+
},
|
|
5897
|
+
toJsonSchema: () => literalToJsonSchema(jsonSchemaLiteral, startsWith, `^${escape(jsonSchemaLiteral)}`),
|
|
5898
|
+
toCode: () => ({ runtime: `Schema.isStartingWith(${format$1(startsWith)})` }),
|
|
5899
|
+
arbitraryConstraint: { patterns: [{
|
|
5900
|
+
source: regExp.source,
|
|
5901
|
+
flags: regExp.flags
|
|
5902
|
+
}] },
|
|
5903
|
+
...annotations
|
|
5904
|
+
});
|
|
5905
|
+
}
|
|
5906
|
+
function isEndingWith(endsWith, annotations) {
|
|
5907
|
+
const formatted = JSON.stringify(endsWith);
|
|
5908
|
+
const regExp = new globalThis.RegExp(`${escape(endsWith)}$`);
|
|
5909
|
+
const jsonSchemaLiteral = endsWith.replace(/^[\uDC00-\uDFFF]/, "");
|
|
5910
|
+
return makeFilter((s) => s.endsWith(endsWith), {
|
|
5911
|
+
expected: `a string ending with ${formatted}`,
|
|
5912
|
+
representation: {
|
|
5913
|
+
id: "effect/schema/isEndingWith",
|
|
5914
|
+
payload: { endsWith }
|
|
5915
|
+
},
|
|
5916
|
+
toJsonSchema: () => literalToJsonSchema(jsonSchemaLiteral, endsWith, `${escape(jsonSchemaLiteral)}$`),
|
|
5917
|
+
toCode: () => ({ runtime: `Schema.isEndingWith(${format$1(endsWith)})` }),
|
|
5918
|
+
arbitraryConstraint: { patterns: [{
|
|
5919
|
+
source: regExp.source,
|
|
5920
|
+
flags: regExp.flags
|
|
5921
|
+
}] },
|
|
5922
|
+
...annotations
|
|
5923
|
+
});
|
|
5924
|
+
}
|
|
5925
|
+
function isIncluding(includes, annotations) {
|
|
5926
|
+
const formatted = JSON.stringify(includes);
|
|
5927
|
+
const regExp = new globalThis.RegExp(escape(includes));
|
|
5928
|
+
const jsonSchemaLiteral = includes.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g, "");
|
|
5929
|
+
return makeFilter((s) => s.includes(includes), {
|
|
5930
|
+
expected: `a string including ${formatted}`,
|
|
5931
|
+
representation: {
|
|
5932
|
+
id: "effect/schema/isIncluding",
|
|
5933
|
+
payload: { includes }
|
|
5934
|
+
},
|
|
5935
|
+
toJsonSchema: () => literalToJsonSchema(jsonSchemaLiteral, includes, escape(jsonSchemaLiteral)),
|
|
5936
|
+
toCode: () => ({ runtime: `Schema.isIncluding(${format$1(includes)})` }),
|
|
5937
|
+
arbitraryConstraint: { patterns: [{
|
|
5938
|
+
source: regExp.source,
|
|
5939
|
+
flags: regExp.flags
|
|
5940
|
+
}] },
|
|
5941
|
+
...annotations
|
|
5942
|
+
});
|
|
5943
|
+
}
|
|
5195
5944
|
const Finite = make(finite);
|
|
5196
5945
|
const isFinite = isFinite$1;
|
|
5197
5946
|
function makeIsGreaterThan(options) {
|
|
@@ -5350,6 +6099,20 @@ const isBetween = makeIsBetween({
|
|
|
5350
6099
|
};
|
|
5351
6100
|
}
|
|
5352
6101
|
});
|
|
6102
|
+
function isMultipleOf(divisor, annotations) {
|
|
6103
|
+
if (!globalThis.Number.isFinite(divisor) || divisor === 0) throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(divisor)}`);
|
|
6104
|
+
divisor = globalThis.Math.abs(divisor);
|
|
6105
|
+
return makeFilter((input) => remainder(input, divisor) === 0, {
|
|
6106
|
+
expected: `a value that is a multiple of ${divisor}`,
|
|
6107
|
+
representation: {
|
|
6108
|
+
id: "effect/schema/isMultipleOf",
|
|
6109
|
+
payload: { divisor }
|
|
6110
|
+
},
|
|
6111
|
+
toJsonSchema: () => ({ multipleOf: divisor }),
|
|
6112
|
+
toCode: () => ({ runtime: `Schema.isMultipleOf(${format$1(divisor)})` }),
|
|
6113
|
+
...annotations
|
|
6114
|
+
});
|
|
6115
|
+
}
|
|
5353
6116
|
function isInt(annotations) {
|
|
5354
6117
|
return makeFilter((n) => globalThis.Number.isSafeInteger(n), {
|
|
5355
6118
|
expected: "an integer",
|
|
@@ -5562,6 +6325,42 @@ function isMaxLength(maxLength, annotations) {
|
|
|
5562
6325
|
...annotations
|
|
5563
6326
|
});
|
|
5564
6327
|
}
|
|
6328
|
+
function isBetweenLength(minimum, maximum, annotations) {
|
|
6329
|
+
minimum = normalizeCardinality(minimum);
|
|
6330
|
+
maximum = normalizeCardinality(maximum);
|
|
6331
|
+
return makeFilter((input) => input.length >= minimum && input.length <= maximum, {
|
|
6332
|
+
expected: minimum === maximum ? `a value with a length of ${minimum}` : `a value with a length between ${minimum} and ${maximum}`,
|
|
6333
|
+
representation: {
|
|
6334
|
+
id: "effect/schema/isBetweenLength",
|
|
6335
|
+
payload: {
|
|
6336
|
+
minimum,
|
|
6337
|
+
maximum
|
|
6338
|
+
}
|
|
6339
|
+
},
|
|
6340
|
+
toJsonSchema: ({ type }) => type === "string" ? maximum === 0 || Math.ceil(minimum / 2) > maximum ? {
|
|
6341
|
+
minLength: Math.ceil(minimum / 2),
|
|
6342
|
+
maxLength: maximum
|
|
6343
|
+
} : [{
|
|
6344
|
+
minLength: Math.ceil(minimum / 2),
|
|
6345
|
+
maxLength: maximum
|
|
6346
|
+
}, true] : type === "array" ? {
|
|
6347
|
+
minItems: minimum,
|
|
6348
|
+
maxItems: maximum
|
|
6349
|
+
} : type === void 0 ? [{
|
|
6350
|
+
minLength: Math.ceil(minimum / 2),
|
|
6351
|
+
maxLength: maximum,
|
|
6352
|
+
minItems: minimum,
|
|
6353
|
+
maxItems: maximum
|
|
6354
|
+
}, true] : [{}, true],
|
|
6355
|
+
toCode: () => ({ runtime: `Schema.isBetweenLength(${minimum}, ${maximum})` }),
|
|
6356
|
+
[STRUCTURAL_ANNOTATION_KEY]: true,
|
|
6357
|
+
arbitraryConstraint: {
|
|
6358
|
+
minLength: minimum,
|
|
6359
|
+
maxLength: maximum
|
|
6360
|
+
},
|
|
6361
|
+
...annotations
|
|
6362
|
+
});
|
|
6363
|
+
}
|
|
5565
6364
|
function isMinCodePoints(minCodePoints, annotations) {
|
|
5566
6365
|
minCodePoints = normalizeCardinality(minCodePoints);
|
|
5567
6366
|
return makeFilter((input) => countCodePointsUpTo(input, minCodePoints) >= minCodePoints, {
|
|
@@ -5590,6 +6389,30 @@ function isMaxCodePoints(maxCodePoints, annotations) {
|
|
|
5590
6389
|
...annotations
|
|
5591
6390
|
});
|
|
5592
6391
|
}
|
|
6392
|
+
function isBetweenCodePoints(minimum, maximum, annotations) {
|
|
6393
|
+
minimum = normalizeCardinality(minimum);
|
|
6394
|
+
maximum = normalizeCardinality(maximum);
|
|
6395
|
+
return makeFilter((input) => {
|
|
6396
|
+
const count = countCodePointsUpTo(input, maximum + 1);
|
|
6397
|
+
return count >= minimum && count <= maximum;
|
|
6398
|
+
}, {
|
|
6399
|
+
expected: minimum === maximum ? `a string with ${minimum} code points` : `a string with between ${minimum} and ${maximum} code points`,
|
|
6400
|
+
representation: {
|
|
6401
|
+
id: "effect/schema/isBetweenCodePoints",
|
|
6402
|
+
payload: {
|
|
6403
|
+
minimum,
|
|
6404
|
+
maximum
|
|
6405
|
+
}
|
|
6406
|
+
},
|
|
6407
|
+
toJsonSchema: () => ({ allOf: [{ minLength: minimum }, { maxLength: maximum }] }),
|
|
6408
|
+
toCode: () => ({ runtime: `Schema.isBetweenCodePoints(${minimum}, ${maximum})` }),
|
|
6409
|
+
arbitraryConstraint: {
|
|
6410
|
+
minCodePoints: minimum,
|
|
6411
|
+
maxCodePoints: maximum
|
|
6412
|
+
},
|
|
6413
|
+
...annotations
|
|
6414
|
+
});
|
|
6415
|
+
}
|
|
5593
6416
|
function countCodePointsUpTo(input, limit) {
|
|
5594
6417
|
if (limit === 0) return 0;
|
|
5595
6418
|
let count = 0;
|
|
@@ -5600,6 +6423,73 @@ function normalizeCardinality(value) {
|
|
|
5600
6423
|
if (!globalThis.Number.isFinite(value)) throw new globalThis.RangeError(`Expected a finite number, got ${value}`);
|
|
5601
6424
|
return Math.max(0, Math.floor(value));
|
|
5602
6425
|
}
|
|
6426
|
+
function isMinSize(minSize, annotations) {
|
|
6427
|
+
minSize = normalizeCardinality(minSize);
|
|
6428
|
+
return makeFilter((input) => input.size >= minSize, {
|
|
6429
|
+
expected: `a value with a size of at least ${minSize}`,
|
|
6430
|
+
representation: {
|
|
6431
|
+
id: "effect/schema/isMinSize",
|
|
6432
|
+
payload: { minSize }
|
|
6433
|
+
},
|
|
6434
|
+
toJsonSchema: () => [{}, true],
|
|
6435
|
+
toCode: () => ({ runtime: `Schema.isMinSize(${minSize})` }),
|
|
6436
|
+
[STRUCTURAL_ANNOTATION_KEY]: true,
|
|
6437
|
+
arbitraryConstraint: { minSize },
|
|
6438
|
+
...annotations
|
|
6439
|
+
});
|
|
6440
|
+
}
|
|
6441
|
+
function isMaxSize(maxSize, annotations) {
|
|
6442
|
+
maxSize = normalizeCardinality(maxSize);
|
|
6443
|
+
return makeFilter((input) => input.size <= maxSize, {
|
|
6444
|
+
expected: `a value with a size of at most ${maxSize}`,
|
|
6445
|
+
representation: {
|
|
6446
|
+
id: "effect/schema/isMaxSize",
|
|
6447
|
+
payload: { maxSize }
|
|
6448
|
+
},
|
|
6449
|
+
toJsonSchema: () => [{}, true],
|
|
6450
|
+
toCode: () => ({ runtime: `Schema.isMaxSize(${maxSize})` }),
|
|
6451
|
+
[STRUCTURAL_ANNOTATION_KEY]: true,
|
|
6452
|
+
arbitraryConstraint: { maxSize },
|
|
6453
|
+
...annotations
|
|
6454
|
+
});
|
|
6455
|
+
}
|
|
6456
|
+
function isBetweenSize(minimum, maximum, annotations) {
|
|
6457
|
+
minimum = normalizeCardinality(minimum);
|
|
6458
|
+
maximum = normalizeCardinality(maximum);
|
|
6459
|
+
return makeFilter((input) => input.size >= minimum && input.size <= maximum, {
|
|
6460
|
+
expected: minimum === maximum ? `a value with a size of ${minimum}` : `a value with a size between ${minimum} and ${maximum}`,
|
|
6461
|
+
representation: {
|
|
6462
|
+
id: "effect/schema/isBetweenSize",
|
|
6463
|
+
payload: {
|
|
6464
|
+
minimum,
|
|
6465
|
+
maximum
|
|
6466
|
+
}
|
|
6467
|
+
},
|
|
6468
|
+
toJsonSchema: () => [{}, true],
|
|
6469
|
+
toCode: () => ({ runtime: `Schema.isBetweenSize(${minimum}, ${maximum})` }),
|
|
6470
|
+
[STRUCTURAL_ANNOTATION_KEY]: true,
|
|
6471
|
+
arbitraryConstraint: {
|
|
6472
|
+
minSize: minimum,
|
|
6473
|
+
maxSize: maximum
|
|
6474
|
+
},
|
|
6475
|
+
...annotations
|
|
6476
|
+
});
|
|
6477
|
+
}
|
|
6478
|
+
function isMinProperties(minProperties, annotations) {
|
|
6479
|
+
minProperties = normalizeCardinality(minProperties);
|
|
6480
|
+
return makeFilter((input) => Reflect.ownKeys(input).length >= minProperties, {
|
|
6481
|
+
expected: `a value with at least ${minProperties === 1 ? "1 entry" : `${minProperties} entries`}`,
|
|
6482
|
+
representation: {
|
|
6483
|
+
id: "effect/schema/isMinProperties",
|
|
6484
|
+
payload: { minProperties }
|
|
6485
|
+
},
|
|
6486
|
+
toJsonSchema: ({ type }) => type === "object" ? { minProperties } : [{ minProperties }, true],
|
|
6487
|
+
toCode: () => ({ runtime: `Schema.isMinProperties(${minProperties})` }),
|
|
6488
|
+
[STRUCTURAL_ANNOTATION_KEY]: true,
|
|
6489
|
+
arbitraryConstraint: { minProperties },
|
|
6490
|
+
...annotations
|
|
6491
|
+
});
|
|
6492
|
+
}
|
|
5603
6493
|
function isMaxProperties(maxProperties, annotations) {
|
|
5604
6494
|
maxProperties = normalizeCardinality(maxProperties);
|
|
5605
6495
|
return makeFilter((input) => Reflect.ownKeys(input).length <= maxProperties, {
|
|
@@ -5615,6 +6505,34 @@ function isMaxProperties(maxProperties, annotations) {
|
|
|
5615
6505
|
...annotations
|
|
5616
6506
|
});
|
|
5617
6507
|
}
|
|
6508
|
+
function isBetweenProperties(minimum, maximum, annotations) {
|
|
6509
|
+
minimum = normalizeCardinality(minimum);
|
|
6510
|
+
maximum = normalizeCardinality(maximum);
|
|
6511
|
+
return makeFilter((input) => Reflect.ownKeys(input).length >= minimum && Reflect.ownKeys(input).length <= maximum, {
|
|
6512
|
+
expected: minimum === maximum ? `a value with exactly ${minimum === 1 ? "1 entry" : `${minimum} entries`}` : `a value with between ${minimum} and ${maximum} entries`,
|
|
6513
|
+
representation: {
|
|
6514
|
+
id: "effect/schema/isBetweenProperties",
|
|
6515
|
+
payload: {
|
|
6516
|
+
minimum,
|
|
6517
|
+
maximum
|
|
6518
|
+
}
|
|
6519
|
+
},
|
|
6520
|
+
toJsonSchema: ({ type }) => type === "object" ? {
|
|
6521
|
+
minProperties: minimum,
|
|
6522
|
+
maxProperties: maximum
|
|
6523
|
+
} : [{
|
|
6524
|
+
minProperties: minimum,
|
|
6525
|
+
maxProperties: maximum
|
|
6526
|
+
}, true],
|
|
6527
|
+
toCode: () => ({ runtime: `Schema.isBetweenProperties(${minimum}, ${maximum})` }),
|
|
6528
|
+
[STRUCTURAL_ANNOTATION_KEY]: true,
|
|
6529
|
+
arbitraryConstraint: {
|
|
6530
|
+
minProperties: minimum,
|
|
6531
|
+
maxProperties: maximum
|
|
6532
|
+
},
|
|
6533
|
+
...annotations
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
5618
6536
|
function isPropertyNames(keySchema, annotations) {
|
|
5619
6537
|
const propertyNames = toEncoded(keySchema);
|
|
5620
6538
|
const parser = _issue(propertyNames.ast);
|
|
@@ -5643,6 +6561,19 @@ function isPropertyNames(keySchema, annotations) {
|
|
|
5643
6561
|
...annotations
|
|
5644
6562
|
});
|
|
5645
6563
|
}
|
|
6564
|
+
function isUnique(annotations) {
|
|
6565
|
+
return makeFilter((input) => dedupe(input).length === input.length, {
|
|
6566
|
+
expected: "an array with unique items",
|
|
6567
|
+
representation: {
|
|
6568
|
+
id: "effect/schema/isUnique",
|
|
6569
|
+
payload: null
|
|
6570
|
+
},
|
|
6571
|
+
toJsonSchema: () => ({ uniqueItems: true }),
|
|
6572
|
+
toCode: () => ({ runtime: "Schema.isUnique()" }),
|
|
6573
|
+
arbitraryConstraint: { uniqueBy: identity },
|
|
6574
|
+
...annotations
|
|
6575
|
+
});
|
|
6576
|
+
}
|
|
5646
6577
|
const NonEmptyString = String$1.check(isNonEmpty());
|
|
5647
6578
|
const getErrorOptionsKey = (options) => (options?.includeStack === true ? 1 : 0) | (options?.excludeCause === true ? 2 : 0);
|
|
5648
6579
|
const getErrorOptions = (key) => {
|
|
@@ -5958,7 +6889,7 @@ function Cause(error, defect) {
|
|
|
5958
6889
|
}
|
|
5959
6890
|
function dateTimeUtcFromInput() {
|
|
5960
6891
|
return transformEffect$1((input, options) => {
|
|
5961
|
-
return match(make$
|
|
6892
|
+
return match(make$5(input), {
|
|
5962
6893
|
onNone: () => fail$2(new InvalidValue({ message: "Invalid DateTime input" }, input, options)),
|
|
5963
6894
|
onSome: (dt) => succeed$3(toUtc(dt))
|
|
5964
6895
|
});
|
|
@@ -5966,7 +6897,7 @@ function dateTimeUtcFromInput() {
|
|
|
5966
6897
|
}
|
|
5967
6898
|
const dateTimeUtcFromString = transformEffect({
|
|
5968
6899
|
decode: (s, options) => {
|
|
5969
|
-
return match(make$
|
|
6900
|
+
return match(make$5(s), {
|
|
5970
6901
|
onNone: () => fail$2(new InvalidValue({ expected: "a valid UTC DateTime string" }, s, options)),
|
|
5971
6902
|
onSome: (result) => succeed$3(toUtc(result))
|
|
5972
6903
|
});
|
|
@@ -6015,6 +6946,10 @@ const DateTimeUtcFromMillis = Int.pipe(decodeTo(DateTimeUtc, {
|
|
|
6015
6946
|
}));
|
|
6016
6947
|
const Ipv4Address = declare(isIpv4Address, { identifier: "Ipv4Address" });
|
|
6017
6948
|
const Ipv6Address = declare(isIpv6Address, { identifier: "Ipv6Address" });
|
|
6949
|
+
const durationFromMillis = transform({
|
|
6950
|
+
decode: (i) => millis(i),
|
|
6951
|
+
encode: (a) => toMillis(a)
|
|
6952
|
+
});
|
|
6018
6953
|
const Duration = declare(isDuration, {
|
|
6019
6954
|
representation: {
|
|
6020
6955
|
id: "effect/schema/Duration",
|
|
@@ -6062,6 +6997,7 @@ const Duration = declare(isDuration, {
|
|
|
6062
6997
|
}
|
|
6063
6998
|
}))
|
|
6064
6999
|
});
|
|
7000
|
+
const DurationFromMillis = Number$1.pipe(decodeTo(Duration, durationFromMillis));
|
|
6065
7001
|
const dnsCanonicalAddress = (schema, parse) => String$1.pipe(decodeTo(schema, transformEffect({
|
|
6066
7002
|
decode: (input, options) => {
|
|
6067
7003
|
const result = parse(input);
|
|
@@ -6235,7 +7171,7 @@ const UrlParams = declare(isUrlParams, {
|
|
|
6235
7171
|
toEquivalence: () => Equivalence,
|
|
6236
7172
|
toCodec: () => link()(ArraySchema(Tuple([String$1, String$1])), transform({
|
|
6237
7173
|
decode: make$3,
|
|
6238
|
-
encode: (self) => self.params
|
|
7174
|
+
encode: (self) => self.params.map(([key, value]) => [key, unwrap(value)])
|
|
6239
7175
|
}))
|
|
6240
7176
|
});
|
|
6241
7177
|
const RecordFromUrlParams = UrlParams.pipe(decodeTo(Record(String$1, Union([String$1, NonEmptyArray(String$1)])), transform({
|
|
@@ -6245,7 +7181,7 @@ const RecordFromUrlParams = UrlParams.pipe(decodeTo(Record(String$1, Union([Stri
|
|
|
6245
7181
|
function OptionFromOptional(schema) {
|
|
6246
7182
|
return optional(schema).pipe(decodeTo(Option(toType(schema)), optionFromOptional()));
|
|
6247
7183
|
}
|
|
6248
|
-
function Redacted(value$
|
|
7184
|
+
function Redacted(value$4, options) {
|
|
6249
7185
|
const label = typeof options?.label === "string" ? options.label : void 0;
|
|
6250
7186
|
const disallowJsonEncode = options?.disallowJsonEncode === true;
|
|
6251
7187
|
const normalizedOptions = label !== void 0 ? disallowJsonEncode ? {
|
|
@@ -6253,11 +7189,11 @@ function Redacted(value$3, options) {
|
|
|
6253
7189
|
disallowJsonEncode: true
|
|
6254
7190
|
} : { label } : disallowJsonEncode ? { disallowJsonEncode: true } : void 0;
|
|
6255
7191
|
const decodeLabel = label !== void 0 ? decodeUnknownEffect$1(Literal(label)) : void 0;
|
|
6256
|
-
const schema = declareConstructor()([value$
|
|
7192
|
+
const schema = declareConstructor()([value$4], ([value$3]) => (input, ast, poptions) => {
|
|
6257
7193
|
if (isRedacted(input)) {
|
|
6258
7194
|
const label = decodeLabel !== void 0 ? mapErrorEager(decodeLabel(input.label, poptions), (issue) => new Pointer(["label"], issue)) : void_$2;
|
|
6259
|
-
return flatMapEager(label, () => mapBothEager(decodeUnknownEffect$1(value$
|
|
6260
|
-
onSuccess: (value) => make$
|
|
7195
|
+
return flatMapEager(label, () => mapBothEager(decodeUnknownEffect$1(value$3)(value(input), poptions), {
|
|
7196
|
+
onSuccess: (value) => make$7(value, { label: input.label }),
|
|
6261
7197
|
onFailure: () => {
|
|
6262
7198
|
return new Composite(ast, [new Pointer(["value"], new InvalidValue(void 0, input, poptions))], input, poptions);
|
|
6263
7199
|
}
|
|
@@ -6275,13 +7211,22 @@ function Redacted(value$3, options) {
|
|
|
6275
7211
|
importDeclarations: [`import * as Redacted from "effect/Redacted"`]
|
|
6276
7212
|
}),
|
|
6277
7213
|
expected: "Redacted",
|
|
6278
|
-
toCodecJson: ([value$
|
|
6279
|
-
decode: transform$1((e) => make$
|
|
7214
|
+
toCodecJson: ([value$5]) => link()(value$5, {
|
|
7215
|
+
decode: transform$1((e) => make$7(e, { label })),
|
|
6280
7216
|
encode: disallowJsonEncode ? forbidden((oe) => "Cannot serialize Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$1(value)
|
|
6281
7217
|
}),
|
|
6282
7218
|
toEquivalence: ([value]) => makeEquivalence(value)
|
|
6283
7219
|
});
|
|
6284
|
-
return make(schema.ast, { value: value$
|
|
7220
|
+
return make(schema.ast, { value: value$4 });
|
|
7221
|
+
}
|
|
7222
|
+
function RedactedFromValue(value$2, options) {
|
|
7223
|
+
return decodeTo(Redacted(toType(value$2), {
|
|
7224
|
+
label: options?.label,
|
|
7225
|
+
disallowJsonEncode: options?.disallowEncode
|
|
7226
|
+
}), {
|
|
7227
|
+
decode: transform$1((t) => make$7(t, { label: options?.label })),
|
|
7228
|
+
encode: options?.disallowEncode ? forbidden((oe) => "Cannot encode Redacted" + (isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : transform$1(value)
|
|
7229
|
+
})(value$2);
|
|
6285
7230
|
}
|
|
6286
7231
|
const immerable = globalThis.Symbol.for("immer-draftable");
|
|
6287
7232
|
const payloadToken = {};
|
|
@@ -6432,6 +7377,6 @@ const MutableJson = make(annotate(MutableJson$1, { toCode: () => ({
|
|
|
6432
7377
|
Type: "Schema.MutableJson"
|
|
6433
7378
|
}) }));
|
|
6434
7379
|
//#endregion
|
|
6435
|
-
export {
|
|
7380
|
+
export { TupleWithRest as $, null_ as $n, monotonicTimeNanos as $r, isMinLength as $t, NonEmptyString as A, toCodecJson$1 as An, CurrentRedactedNames$1 as Ar, isBetweenProperties as At, RedactedFromValue as B, Filter as Bn, fromSetCookie as Br, isIncluding as Bt, JsonObject as C, toType as Cn, CurrentRedactedNames as Cr, instanceOf as Ct, Natural as D, evolve as Dn, setAll as Dr, isBetweenCodePoints as Dt, MutableJson as E, withDecodingDefaultKey as En, redactUrl as Er, isBetweenBigInt as Et, Option as F, decodeEffect$1 as Fn, merge as Fr, isGreaterThanBigInt as Ft, StructWithRest as G, Suspend as Gn, fromDateUnsafe as Gr, isLessThanOrEqualTo as Gt, String$1 as H, Literal$1 as Hn, encode as Hr, isLessThan as Ht, OptionFromNullOr as I, decodeUnknownEffect$1 as In, remove as Ir, isGreaterThanDate as It, TaggedError as J, decodeTo$1 as Jn, isRedacted as Jr, isMaxCodePoints as Jt, Symbol$1 as K, Union$1 as Kn, now as Kr, isLessThanOrEqualToBigInt as Kt, OptionFromOptional as L, decodeUnknownResult as Ln, set as Lr, isGreaterThanOrEqualTo as Lt, NullOr as M, fromSchemaDraft2020_12 as Mn, fromInput$1 as Mr, isEndingWith as Mt, Number$1 as N, getReferenceKey as Nn, fromRecordUnsafe as Nr, isFinite as Nt, Never as O, omit as On, toString as Or, isBetweenDate as Ot, ObjectKeyword as P, _is as Pn, isRedactedName$1 as Pr, isGreaterThan as Pt, Tuple as Q, mapOrSame as Qn, Clock as Qr, isMinCodePoints as Qt, Record as R, encodeEffect$1 as Rn, setAll$1 as Rr, isGreaterThanOrEqualToBigInt as Rt, Json as S, toJsonSchemaDocument as Sn, Pointer as Sr, fromJsonString as St, Literals as T, withDecodingDefault as Tn, fromInput as Tr, isBetween as Tt, StringForLiteralAutocomplete as U, Objects as Un, formatIso as Ur, isLessThanBigInt as Ut, SchemaError as V, FilterGroup as Vn, decode as Vr, isInt as Vt, Struct as W, PropertySignature as Wn, formatIsoDate as Wr, isLessThanDate as Wt, TemplateLiteral as X, isNever as Xn, value as Xr, isMaxProperties as Xt, TaggedUnion as Y, isJson as Yn, make$7 as Yr, isMaxLength as Yt, TrueLiterals as Z, isOptional as Zn, stringOrRedacted as Zr, isMaxSize as Zt, Error$1 as _, suspend as _n, passthroughSubtype as _r, decodeUnknownOption as _t, BooleanFromBit as a, assignProperty as ai, isSchema as an, string as ar, UndefinedOr as at, Finite as b, toCodecStringTree as bn, transformOptional$1 as br, encodeTo as bt, Date$1 as c, isUUID as cn, unknown as cr, Unknown as ct, DateTimeUtcFromMillis as d, makeFilter as dn, transform as dr, check as dt, EncodingError as ei, isMinProperties as en, optionalKey$1 as er, URL$1 as et, DateTimeUtcFromString as f, makeFilterGroup as fn, transformEffect as fr, declare as ft, Enum as g, optionalKey as gn, passthrough$1 as gr, decodeUnknownEffect as gt, DurationFromMillis as h, optional as hn, map as hr, decodeTo as ht, Boolean as i, taggedEnum as ii, isPropertyNames as in, resolveIdentifier as ir, Undefined as it, Null as j, fromSchemaDraft07 as jn, empty$1 as jr, isBetweenSize as jt, NonEmptyArray as k, errorWithPath as kn, unwrap as kr, isBetweenLength as kt, DateTimeUtc as l, isUnique as ln, Transformation as lr, Void as lt, Duration as m, mutableKey as mn, dateTimeUtcFromInput$1 as mr, decodeSync as mt, ArraySchema as n, TaggedClass$1 as ni, isMultipleOf as nn, resolveAt as nr, Uint8Array$1 as nt, BooleanLiterals as o, map$1 as oi, isSchemaError as on, toEncoded$1 as or, Union as ot, Defect as p, mutable as pn, transformOptional as pr, decodeEffect as pt, TaggedClass as q, applyToSelfOrLastLinkEncoding as qn, removeTime as qr, isLessThanOrEqualToDate as qt, BigInt$1 as r, TaggedError$1 as ri, isPattern as rn, resolveDescription as rr, Uint8ArrayFromBase64 as rt, Class as s, isStartingWith as sn, toType$1 as sr, UniqueSymbol as st, Any as t, Error$2 as ti, isMinSize as tn, replaceChecks as tr, URLFromString as tt, DateTimeUtcFromDate as u, make as un, passthrough as ur, brand as ut, Exit as v, tag as vn, transform$1 as vr, decodeUnknownSync as vt, Literal as w, withConstructorDefault as wn, empty as wr, is as wt, Int as x, toEncoded as xn, InvalidValue as xr, encodeUnknownEffect as xt, FalseLiterals as y, toCodecJson as yn, transformEffect$1 as yr, encodeEffect as yt, Redacted as z, Arrays as zn, empty$2 as zr, isGreaterThanOrEqualToDate as zt };
|
|
6436
7381
|
|
|
6437
|
-
//# sourceMappingURL=Schema-
|
|
7382
|
+
//# sourceMappingURL=Schema-DcXUXpRg.mjs.map
|