arktype 3.0.0-beta.2 → 3.0.0-rc.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 +55 -20
- package/out/_internal/regex/quantify.d.ts +17 -1
- package/out/_internal/schema/refinements/range.d.ts +2 -1
- package/out/_internal/schema/roots/domain.d.ts +1 -0
- package/out/_internal/schema/roots/root.d.ts +3 -1
- package/out/_internal/schema/roots/union.d.ts +8 -3
- package/out/_internal/schema/shared/compile.d.ts +2 -0
- package/out/_internal/schema/shared/declare.d.ts +9 -6
- package/out/_internal/schema/shared/errors.d.ts +3 -0
- package/out/_internal/schema/shared/issues.d.ts +5 -1
- package/out/_internal/schema/shared/issuesLean.d.ts +4 -0
- package/out/_internal/schema/shared/issuesNone.d.ts +1 -0
- package/out/_internal/schema/shared/issuesNoneLean.d.ts +1 -0
- package/out/_internal/schema/shared/standardFailure.d.ts +1 -0
- package/out/_internal/schema/shared/toJsonSchema.d.ts +16 -3
- package/out/_internal/schema/shared/transform.d.ts +1 -0
- package/out/_internal/sets/constraint.d.ts +2 -0
- package/out/_internal/sets/fromJsonSchema.d.ts +3 -1
- package/out/_internal/util/registry.d.ts +1 -1
- package/out/attributes.d.ts +12 -8
- package/out/{chunk-QBX4MEQR.js → chunk-3HZC67MT.js} +15 -15
- package/out/{chunk-5TN5JRP7.js → chunk-3KBOPH3J.js} +63 -41
- package/out/{chunk-NIZDOWFU.js → chunk-46PLKNON.js} +2 -2
- package/out/{chunk-7JXN4WJX.js → chunk-4FTHWK63.js} +1 -1
- package/out/{chunk-EA2DNEDI.js → chunk-4HREHNIV.js} +12 -12
- package/out/{chunk-J7CKAEDX.js → chunk-4NZCLVBD.js} +1 -1
- package/out/{chunk-7N3JEHA4.js → chunk-6FMBO47M.js} +1 -1
- package/out/{chunk-W77ROLOT.js → chunk-7TALAWYX.js} +1 -1
- package/out/{chunk-YMYPW3L5.js → chunk-BCYKO54Z.js} +3 -3
- package/out/{chunk-7SVIUP6X.js → chunk-C2JOL5M2.js} +2 -2
- package/out/{chunk-GPNWBJL3.js → chunk-C2V6QPE3.js} +17 -11
- package/out/{chunk-XMEK4I7J.js → chunk-C3B4IFQL.js} +887 -266
- package/out/{chunk-FY4M7GE7.js → chunk-FWRSDUJ2.js} +4 -4
- package/out/chunk-GID3FSQA.js +161 -0
- package/out/{chunk-CGWRW4JZ.js → chunk-K7SLP5D2.js} +4 -4
- package/out/{chunk-KDMHK4KP.js → chunk-KQPSKGUI.js} +2 -2
- package/out/{chunk-KVQCLBJR.js → chunk-KXOC3JEX.js} +241 -66
- package/out/{chunk-CQU7WIIR.js → chunk-KXOSUYRA.js} +6 -6
- package/out/{chunk-5WRZ25AB.js → chunk-MTWKGAGO.js} +4 -4
- package/out/{chunk-OA5Q2JLI.js → chunk-NU73GNCX.js} +8 -4
- package/out/{chunk-ZFB6DQWY.js → chunk-P5W67FQH.js} +6 -11
- package/out/{chunk-A7A6FDBS.js → chunk-PDLTEX6Z.js} +50 -44
- package/out/{chunk-RAM6G3F6.js → chunk-QUS4IAXJ.js} +26 -25
- package/out/{chunk-HA3POWOU.js → chunk-R7WXIH5P.js} +6 -5
- package/out/{chunk-YN3XRJ7H.js → chunk-UJJGG4VQ.js} +1 -1
- package/out/{chunk-NIYAI7AF.js → chunk-US6BWOGJ.js} +3 -3
- package/out/{chunk-JZ4KBCMM.js → chunk-VMMMOO4R.js} +21 -13
- package/out/{chunk-PIFOURNM.js → chunk-VYMXHSFR.js} +11 -4
- package/out/{chunk-57LF5Y5P.js → chunk-W2XOI5DY.js} +1 -1
- package/out/{chunk-SGFGLENC.js → chunk-WC5L5YRP.js} +3 -3
- package/out/{chunk-V4TZHFNK.js → chunk-WKOSL2G6.js} +1 -1
- package/out/{chunk-UH6XKS3C.js → chunk-XNUAQSJ4.js} +30 -9
- package/out/{chunk-C5JGK6GT.js → chunk-ZRYEHGSG.js} +20 -3
- package/out/cli.d.ts +5 -1
- package/out/cli.js +301 -49
- package/out/codecs.d.ts +4 -3
- package/out/codecs.js +18 -18
- package/out/config.js +8 -8
- package/out/declare.d.ts +2 -4
- package/out/errors.js +8 -8
- package/out/fn.d.ts +2 -2
- package/out/fromJsonSchema.d.ts +1 -1
- package/out/generic.d.ts +7 -4
- package/out/i18n.js +5 -5
- package/out/index.js +19 -19
- package/out/internal.js +32 -32
- package/out/island.js +18 -18
- package/out/islandDependency.js +33 -33
- package/out/jsonSchema/infer.d.ts +16 -6
- package/out/jsonSchema/validate.d.ts +16 -4
- package/out/keywords/functions.d.ts +4 -169
- package/out/keywords/keywords.d.ts +1 -1
- package/out/keywords/phrases.d.ts +3 -168
- package/out/keywords/ts.js +14 -14
- package/out/locales/de.js +6 -6
- package/out/locales/en.js +15 -15
- package/out/match.d.ts +12 -9
- package/out/mutatesInput.js +14 -14
- package/out/nary.d.ts +219 -193
- package/out/parser/definition.d.ts +2 -2
- package/out/parser/shift/operator/default.d.ts +2 -2
- package/out/parser/tupleExpressions.d.ts +2 -0
- package/out/precompiled.js +11 -11
- package/out/runtime.d.ts +1 -1
- package/out/runtime.js +5 -5
- package/out/schema.js +11 -11
- package/out/schemaInternal.js +29 -17
- package/out/schemaRuntime.js +4 -4
- package/out/schemaRuntimeLean.js +60 -36
- package/out/schemaRuntimeNone.js +52 -31
- package/out/schemaRuntimeNoneLean.js +52 -31
- package/out/type.d.ts +3 -3
- package/out/util.js +14 -11
- package/out/variants/base.d.ts +9 -8
- package/out/variants/object.d.ts +14 -6
- package/package.json +4 -4
- package/skills/arktype/SKILL.md +17 -17
- package/skills/arktype/references/migrating.md +13 -13
- package/skills/arktype/references/precompile.md +4 -4
- package/out/chunk-CSVAPWDE.js +0 -83
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-3SH2BQ4T.js";
|
|
4
4
|
import {
|
|
5
5
|
arkKindOf,
|
|
6
|
+
defineValue,
|
|
6
7
|
describeCollapsibleDate,
|
|
7
8
|
domainDescriptions,
|
|
8
9
|
domainOf,
|
|
@@ -23,7 +24,7 @@ import {
|
|
|
23
24
|
printable,
|
|
24
25
|
throwError,
|
|
25
26
|
timeOf
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-3HZC67MT.js";
|
|
27
28
|
|
|
28
29
|
// ../schema/out/shared/enWriters.js
|
|
29
30
|
var Stamp = class {
|
|
@@ -79,6 +80,13 @@ var enInfo = /* @__PURE__ */ Object.freeze({
|
|
|
79
80
|
|
|
80
81
|
// ../schema/out/shared/issues.js
|
|
81
82
|
import { bracketsKeys, callsSiteText, findsOnRead, listsUnions, namesTraversalError, readsErrors, readsSummary, reportsIndices, writesText } from "./shared/issueFeatures.js";
|
|
83
|
+
var refuseLocale = (locale) => {
|
|
84
|
+
if (locale === void 0)
|
|
85
|
+
return;
|
|
86
|
+
if (typeof locale !== "object" || locale === null || Array.isArray(locale))
|
|
87
|
+
throw Error("Expected a Locale object");
|
|
88
|
+
throw Error('import "arktype/i18n" to write errors in locales other than en');
|
|
89
|
+
};
|
|
82
90
|
var ReadIssues = class {
|
|
83
91
|
// assigned, as a target lowering class fields defines each with a helper
|
|
84
92
|
constructor() {
|
|
@@ -95,9 +103,7 @@ var ReadIssues = class {
|
|
|
95
103
|
* Each issue, its message written when they are first read.
|
|
96
104
|
*/
|
|
97
105
|
get issues() {
|
|
98
|
-
|
|
99
|
-
issue.message ??= messageOf(issue);
|
|
100
|
-
return this._;
|
|
106
|
+
return serializableIssues(this._);
|
|
101
107
|
}
|
|
102
108
|
/**
|
|
103
109
|
* @internal fails data at the path it's at. Every bundle holds this, so it
|
|
@@ -130,7 +136,7 @@ var UnreadIssues = class {
|
|
|
130
136
|
if (!this._f) {
|
|
131
137
|
this._f = [];
|
|
132
138
|
if (this._a && (this._a(this._d, this), !this._f.length))
|
|
133
|
-
this._e(this._d, "predicate");
|
|
139
|
+
this._e(this._d, "predicate", "valid", "is invalid");
|
|
134
140
|
}
|
|
135
141
|
return this._f;
|
|
136
142
|
}
|
|
@@ -138,9 +144,7 @@ var UnreadIssues = class {
|
|
|
138
144
|
return this._.length;
|
|
139
145
|
}
|
|
140
146
|
get issues() {
|
|
141
|
-
|
|
142
|
-
issue.message ??= messageOf(issue);
|
|
143
|
-
return this._;
|
|
147
|
+
return serializableIssues(this._);
|
|
144
148
|
}
|
|
145
149
|
_e(data, code, expected, message, text) {
|
|
146
150
|
this._.push({ code, path: this._p.slice(), data, expected, message });
|
|
@@ -171,7 +175,7 @@ var Issues = readsErrors ? findsOnRead ? (
|
|
|
171
175
|
if (!this._f) {
|
|
172
176
|
this._f = [];
|
|
173
177
|
if (this._a && (this._a(this._d, this), !this._f.length))
|
|
174
|
-
this._e(this._d, "predicate");
|
|
178
|
+
this._e(this._d, "predicate", "valid", "is invalid");
|
|
175
179
|
}
|
|
176
180
|
return this._f;
|
|
177
181
|
}
|
|
@@ -179,9 +183,7 @@ var Issues = readsErrors ? findsOnRead ? (
|
|
|
179
183
|
return this._.length;
|
|
180
184
|
}
|
|
181
185
|
get issues() {
|
|
182
|
-
|
|
183
|
-
issue.message ??= messageOf(issue);
|
|
184
|
-
return this._;
|
|
186
|
+
return serializableIssues(this._);
|
|
185
187
|
}
|
|
186
188
|
_e(data, code, expected, message, text) {
|
|
187
189
|
this._.push({ code, path: this._p.slice(), data, expected, message });
|
|
@@ -201,6 +203,10 @@ var Issues = readsErrors ? findsOnRead ? (
|
|
|
201
203
|
summary += (summary && "\n") + lineOf(issue);
|
|
202
204
|
return summary;
|
|
203
205
|
}
|
|
206
|
+
summaryIn(locale) {
|
|
207
|
+
refuseLocale(locale);
|
|
208
|
+
return this.summary;
|
|
209
|
+
}
|
|
204
210
|
throw() {
|
|
205
211
|
if (namesTraversalError)
|
|
206
212
|
throw new ThrownIssues(this);
|
|
@@ -229,9 +235,7 @@ var Issues = readsErrors ? findsOnRead ? (
|
|
|
229
235
|
return this._.length;
|
|
230
236
|
}
|
|
231
237
|
get issues() {
|
|
232
|
-
|
|
233
|
-
issue.message ??= messageOf(issue);
|
|
234
|
-
return this._;
|
|
238
|
+
return serializableIssues(this._);
|
|
235
239
|
}
|
|
236
240
|
_e(data, code, expected, message, text) {
|
|
237
241
|
this._.push({ code, path: this._p.slice(), data, expected, message });
|
|
@@ -251,6 +255,10 @@ var Issues = readsErrors ? findsOnRead ? (
|
|
|
251
255
|
summary += (summary && "\n") + lineOf(issue);
|
|
252
256
|
return summary;
|
|
253
257
|
}
|
|
258
|
+
summaryIn(locale) {
|
|
259
|
+
refuseLocale(locale);
|
|
260
|
+
return this.summary;
|
|
261
|
+
}
|
|
254
262
|
// constructed by TraversalError wherever its bundle keeps the
|
|
255
263
|
// class: otherwise an Error with the same name, message and
|
|
256
264
|
// errors, and no class in its bundle. Its name is assigned and
|
|
@@ -286,10 +294,22 @@ var Issues = readsErrors ? findsOnRead ? (
|
|
|
286
294
|
var jsonIssueOf = (issue) => ({
|
|
287
295
|
code: issue.code,
|
|
288
296
|
path: issue.path.map((k) => typeof k === "symbol" ? String(k) : k),
|
|
289
|
-
expected: issue.expected,
|
|
297
|
+
...issue.expected !== void 0 && { expected: issue.expected },
|
|
290
298
|
message: issue.message ?? messageOf(issue),
|
|
291
|
-
...issue.errors
|
|
299
|
+
...issue.errors?.length ? { errors: issue.errors.map(jsonIssueOf) } : {}
|
|
292
300
|
});
|
|
301
|
+
var issuesToJson = {
|
|
302
|
+
value() {
|
|
303
|
+
return this.map(jsonIssueOf);
|
|
304
|
+
},
|
|
305
|
+
writable: true,
|
|
306
|
+
configurable: true
|
|
307
|
+
};
|
|
308
|
+
var serializableIssues = (issues) => {
|
|
309
|
+
for (const issue of issues)
|
|
310
|
+
issue.message ??= messageOf(issue);
|
|
311
|
+
return issues.toJSON ? issues : Object.defineProperty(issues, "toJSON", issuesToJson);
|
|
312
|
+
};
|
|
293
313
|
var FirstIssues = class extends Issues {
|
|
294
314
|
// read from the prototype, so no errors object lists it among its own keys
|
|
295
315
|
get failFast() {
|
|
@@ -308,14 +328,14 @@ var applyIssues = (apply, data, onFail, Ctx = Issues) => {
|
|
|
308
328
|
var issuesOf = (apply, data, errors) => {
|
|
309
329
|
apply(data, errors);
|
|
310
330
|
if (!errors._.length)
|
|
311
|
-
errors._e(data, "predicate");
|
|
331
|
+
errors._e(data, "predicate", "valid", "is invalid");
|
|
312
332
|
return errors._;
|
|
313
333
|
};
|
|
314
334
|
var foundErrors = (apply, data, onFail, Ctx = Issues) => {
|
|
315
335
|
const errors = new Ctx();
|
|
316
336
|
apply(data, errors);
|
|
317
337
|
if (!errors._.length)
|
|
318
|
-
errors._e(data, "predicate");
|
|
338
|
+
errors._e(data, "predicate", "valid", "is invalid");
|
|
319
339
|
return onFail ? onFail(errors) : errors;
|
|
320
340
|
};
|
|
321
341
|
var issueAt = (path, site, data, key) => {
|
|
@@ -363,7 +383,7 @@ var pathOf = (issue) => {
|
|
|
363
383
|
var lineOf = (issue) => {
|
|
364
384
|
const message = issue.message ??= messageOf(issue);
|
|
365
385
|
const path = reportsIndices || bracketsKeys ? pathOf(issue) : issue.path.join(".");
|
|
366
|
-
return listsUnions && issue._l !== void 0 ? issue._l : path ? path + (writesText && !message.startsWith(messageOf(issue)) ? ": " : " ") + message : message;
|
|
386
|
+
return listsUnions && issue._l !== void 0 ? issue._l : path ? path + (writesText && !(message === "is invalid" && issue.expected === "valid") && !message.startsWith(messageOf(issue)) ? ": " : " ") + message : message;
|
|
367
387
|
};
|
|
368
388
|
var messageOf = (issue) => issue.expected !== void 0 ? "must be " + issue.expected + (issue.code === "required" ? " (was missing)" : "") : issue.code === "required" ? "is missing" : "is invalid";
|
|
369
389
|
var definedThrown;
|
|
@@ -378,7 +398,7 @@ var throwIssues = (apply, data) => {
|
|
|
378
398
|
const errors = new Issues();
|
|
379
399
|
apply(data, errors);
|
|
380
400
|
if (!errors._.length)
|
|
381
|
-
errors._e(data, "predicate");
|
|
401
|
+
errors._e(data, "predicate", "valid", "is invalid");
|
|
382
402
|
return errors.throw();
|
|
383
403
|
};
|
|
384
404
|
|
|
@@ -496,9 +516,15 @@ var copyOf = (data) => {
|
|
|
496
516
|
return { ...data };
|
|
497
517
|
return Object.prototype.toString.call(data) === "[object Object]" ? Object.setPrototypeOf({ ...data }, prototype) : data;
|
|
498
518
|
};
|
|
519
|
+
var setOwnValue = (out, k, value) => {
|
|
520
|
+
if (k === "__proto__")
|
|
521
|
+
defineValue(out, k, value);
|
|
522
|
+
else
|
|
523
|
+
out[k] = value;
|
|
524
|
+
};
|
|
499
525
|
var keepOwn = (out, data, k) => {
|
|
500
526
|
if (!(k in out) && hasOwn(data, k))
|
|
501
|
-
out
|
|
527
|
+
setOwnValue(out, k, data[k]);
|
|
502
528
|
};
|
|
503
529
|
var copyDeclared = (data, declared, changes) => {
|
|
504
530
|
"use strict";
|
|
@@ -509,7 +535,7 @@ var copyDeclared = (data, declared, changes) => {
|
|
|
509
535
|
continue;
|
|
510
536
|
if (out === data)
|
|
511
537
|
out = copyOf(data);
|
|
512
|
-
out
|
|
538
|
+
setOwnValue(out, changes[i], changes[i + 2]);
|
|
513
539
|
}
|
|
514
540
|
if (out !== data)
|
|
515
541
|
for (const k of declared)
|
|
@@ -538,7 +564,7 @@ var mergeTransformed = (input, l, r) => {
|
|
|
538
564
|
delete merged[k];
|
|
539
565
|
for (const k in r) {
|
|
540
566
|
if (!(k in input) || !Object.is(r[k], input[k]))
|
|
541
|
-
merged
|
|
567
|
+
setOwnValue(merged, k, r[k]);
|
|
542
568
|
}
|
|
543
569
|
return merged;
|
|
544
570
|
};
|
|
@@ -870,11 +896,9 @@ var Traversal = class extends InternalTraversal {
|
|
|
870
896
|
// a code of its own is written without what its rule describes
|
|
871
897
|
expected: supplied.expected ?? supplied.description ?? (code === "predicate" || supplied.morph ? describePredicate(supplied) : "valid")
|
|
872
898
|
};
|
|
873
|
-
if (supplied.message !== void 0)
|
|
899
|
+
if (supplied.message !== void 0)
|
|
874
900
|
issue.message = supplied.message;
|
|
875
|
-
|
|
876
|
-
issue.expected = void 0;
|
|
877
|
-
} else if (supplied.cause !== void 0 && (supplied.meta?.keyword || supplied.morph)) {
|
|
901
|
+
else if (supplied.cause !== void 0 && supplied.morph) {
|
|
878
902
|
try {
|
|
879
903
|
issue.message = `must be ${issue.expected} (${String(supplied.cause)})`;
|
|
880
904
|
} catch {
|
|
@@ -1390,33 +1414,30 @@ var travKey = (key, fn, ctx) => {
|
|
|
1390
1414
|
};
|
|
1391
1415
|
var computeDefaultValueMorph = (key, value, defaultInput, node = value, isThunkInput = isThunk(defaultInput)) => {
|
|
1392
1416
|
const thunk = isThunkInput ? defaultInput : void 0;
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1417
|
+
const write = (data, v) => {
|
|
1418
|
+
setOwnValue(data, key, v);
|
|
1419
|
+
return data;
|
|
1420
|
+
};
|
|
1421
|
+
if (!thunk && !node.alters && !node.hasAlias)
|
|
1422
|
+
return (data) => write(data, defaultInput);
|
|
1399
1423
|
if (!node.allowsCtx && !node.ctxMorph) {
|
|
1400
1424
|
return (data) => {
|
|
1401
1425
|
const input = thunk ? thunk() : defaultInput;
|
|
1402
1426
|
const output = value.traverse(input);
|
|
1403
1427
|
if (output instanceof Issues)
|
|
1404
1428
|
return new TransformErrors(output, input).addTo(void 0, key);
|
|
1405
|
-
data
|
|
1406
|
-
return data;
|
|
1429
|
+
return write(data, output);
|
|
1407
1430
|
};
|
|
1408
1431
|
}
|
|
1409
1432
|
let transformingDefault = false;
|
|
1410
1433
|
return (data, ctx) => {
|
|
1411
1434
|
if (transformingDefault)
|
|
1412
1435
|
return data;
|
|
1413
|
-
if (!thunk && !node.tfs)
|
|
1414
|
-
data
|
|
1415
|
-
return data;
|
|
1416
|
-
}
|
|
1436
|
+
if (!thunk && !node.tfs)
|
|
1437
|
+
return write(data, defaultInput);
|
|
1417
1438
|
transformingDefault = true;
|
|
1418
1439
|
try {
|
|
1419
|
-
data
|
|
1440
|
+
write(data, travKey(key, () => value(thunk ? thunk() : defaultInput, ctx), ctx));
|
|
1420
1441
|
} finally {
|
|
1421
1442
|
transformingDefault = false;
|
|
1422
1443
|
}
|
|
@@ -1466,6 +1487,7 @@ export {
|
|
|
1466
1487
|
TransformErrors,
|
|
1467
1488
|
holdsOnlyIndices,
|
|
1468
1489
|
copyOf,
|
|
1490
|
+
setOwnValue,
|
|
1469
1491
|
keepOwn,
|
|
1470
1492
|
copyDeclared,
|
|
1471
1493
|
mergeTransformed,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
copyConfig,
|
|
3
3
|
isSameConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W2XOI5DY.js";
|
|
5
5
|
import {
|
|
6
6
|
throwParseError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3HZC67MT.js";
|
|
8
8
|
|
|
9
9
|
// ../schema/out/runtime.js
|
|
10
10
|
export { appliesValues, discriminatesBooleans, failsInBranches, findsOnRead, holdsExpression, listsUnions, transformsBranches, traversesUnions } from "./shared/issueFeatures.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
iso8601Matcher
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-US6BWOGJ.js";
|
|
4
4
|
import {
|
|
5
5
|
FileConstructor,
|
|
6
6
|
hasOwn,
|
|
7
7
|
isDigitCode
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3HZC67MT.js";
|
|
9
9
|
|
|
10
10
|
// out/keywords/functions.js
|
|
11
11
|
var keywordError = (alias, description) => ({
|
|
@@ -113,9 +113,6 @@ var isEpochString = (s, ctx) => {
|
|
|
113
113
|
}) : true;
|
|
114
114
|
};
|
|
115
115
|
var jsonString = "a JSON string";
|
|
116
|
-
var describeSyntaxError = ({ name, message }) => `${name}: ${message}`;
|
|
117
|
-
var writeJsonSyntaxErrorMessage = (error) => `must be ${jsonString} (${describeSyntaxError(error)})`;
|
|
118
|
-
var jsonMessage = (e, locale) => e.code === "predicate" && e.cause !== void 0 ? writeJsonSyntaxErrorMessage(e.cause) : locale.message(e, locale);
|
|
119
116
|
var jsonError = /* @__PURE__ */ keywordError("string.json", jsonString);
|
|
120
117
|
var isJsonString = (s, ctx) => {
|
|
121
118
|
try {
|
|
@@ -200,12 +197,9 @@ var isRegexPattern = (s, ctx) => {
|
|
|
200
197
|
}
|
|
201
198
|
};
|
|
202
199
|
var raisedErrorPhrases = {
|
|
203
|
-
"string.json":
|
|
204
|
-
"string.json.parse":
|
|
205
|
-
"string.regex":
|
|
206
|
-
noun: regexPattern,
|
|
207
|
-
message: (e, locale) => e.code === "predicate" && e.cause !== void 0 ? `must be ${regexPattern} (${describeSyntaxError(e.cause)})` : locale.message(e, locale)
|
|
208
|
-
}
|
|
200
|
+
"string.json": jsonString,
|
|
201
|
+
"string.json.parse": jsonString,
|
|
202
|
+
"string.regex": regexPattern
|
|
209
203
|
};
|
|
210
204
|
var plainUrl = /^[Hh][Tt]{2}[Pp][Ss]?:\/\/(?:[\dA-Za-z]+(?:-[\dA-Za-z]+)*\.)*[A-Za-z]+(?::\d{1,4})?(?:[#/?]|$)/;
|
|
211
205
|
var isParsableUrl = ((s) => plainUrl.test(s) || s.includes(":") && URL.canParse(s));
|
|
@@ -226,6 +220,13 @@ var parseFormData = (data) => {
|
|
|
226
220
|
result[k] = [existing, v];
|
|
227
221
|
else
|
|
228
222
|
existing.push(v);
|
|
223
|
+
} else if (k === "__proto__") {
|
|
224
|
+
Object.defineProperty(result, k, {
|
|
225
|
+
value: v,
|
|
226
|
+
writable: true,
|
|
227
|
+
enumerable: true,
|
|
228
|
+
configurable: true
|
|
229
|
+
});
|
|
229
230
|
} else
|
|
230
231
|
result[k] = v;
|
|
231
232
|
}
|
|
@@ -248,7 +249,6 @@ export {
|
|
|
248
249
|
maxEpoch,
|
|
249
250
|
epochDescriptions,
|
|
250
251
|
isEpochString,
|
|
251
|
-
writeJsonSyntaxErrorMessage,
|
|
252
252
|
isJsonString,
|
|
253
253
|
parseJson,
|
|
254
254
|
stringifyJson,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inPlaceTransforms,
|
|
3
3
|
inputOnlyMorphs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MTWKGAGO.js";
|
|
5
5
|
import {
|
|
6
6
|
parseDate,
|
|
7
7
|
parseInteger,
|
|
8
8
|
parseIsoDate,
|
|
9
9
|
parseJson,
|
|
10
10
|
parseUrl
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4HREHNIV.js";
|
|
12
12
|
import {
|
|
13
13
|
$ark
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PDLTEX6Z.js";
|
|
15
15
|
|
|
16
16
|
// ../schema/out/mutatesInput.js
|
|
17
17
|
$ark.inPlace = inPlaceTransforms;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
raisedErrorPhrases
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4HREHNIV.js";
|
|
4
4
|
import {
|
|
5
5
|
en
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KXOC3JEX.js";
|
|
7
7
|
|
|
8
8
|
// out/keywords/phrases.js
|
|
9
9
|
var epoch = "an integer representing a safe Unix timestamp";
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
tsGenericDefinitions,
|
|
9
9
|
tsKeywordDefinitions,
|
|
10
10
|
unknown
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C3B4IFQL.js";
|
|
12
12
|
import {
|
|
13
13
|
Hkt
|
|
14
14
|
} from "./chunk-BDJVONP7.js";
|
|
15
15
|
import {
|
|
16
16
|
keywordMeta
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-C2JOL5M2.js";
|
|
18
18
|
import {
|
|
19
19
|
capitalizeString,
|
|
20
20
|
epochDescriptions,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
parsesFinite,
|
|
39
39
|
trimString,
|
|
40
40
|
uppercaseString
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4HREHNIV.js";
|
|
42
42
|
import {
|
|
43
43
|
RootModule,
|
|
44
44
|
constraintInputOf,
|
|
@@ -47,22 +47,22 @@ import {
|
|
|
47
47
|
node,
|
|
48
48
|
rootSchema,
|
|
49
49
|
writeUnresolvableMessage
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-KXOC3JEX.js";
|
|
51
51
|
import {
|
|
52
52
|
defineLazily
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-UJJGG4VQ.js";
|
|
54
54
|
import {
|
|
55
55
|
ipv4Matcher,
|
|
56
56
|
ipv6Matcher,
|
|
57
57
|
iso8601Matcher,
|
|
58
58
|
uuidMatcher
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-US6BWOGJ.js";
|
|
60
60
|
import {
|
|
61
61
|
$ark
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-PDLTEX6Z.js";
|
|
63
63
|
import {
|
|
64
64
|
registry
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-ZRYEHGSG.js";
|
|
66
66
|
import {
|
|
67
67
|
cached,
|
|
68
68
|
defineProperties,
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
throwParseError,
|
|
75
75
|
typedArrayConstructors,
|
|
76
76
|
wellFormedIntegerMatcher
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-3HZC67MT.js";
|
|
78
78
|
|
|
79
79
|
// out/keywords/builtins.js
|
|
80
80
|
var MergeHkt = class extends Hkt {
|
|
@@ -246,11 +246,17 @@ var predicateStringNode = function (predicate, alias, jsonSchema, meta) { return
|
|
|
246
246
|
...meta && { meta }
|
|
247
247
|
}) };
|
|
248
248
|
var stringIntegerRoot = cached(() => regexStringNode(wellFormedIntegerMatcher, "string.integer"));
|
|
249
|
+
var safeInteger = cached(function () { return node("intersection", {
|
|
250
|
+
domain: node("domain", { domain: "number" }),
|
|
251
|
+
divisor: node("divisor", { rule: 1 }),
|
|
252
|
+
min: node("min", { rule: Number.MIN_SAFE_INTEGER }),
|
|
253
|
+
max: node("max", { rule: Number.MAX_SAFE_INTEGER })
|
|
254
|
+
}) });
|
|
249
255
|
var stringInteger = keywordModule({
|
|
250
256
|
root: stringIntegerRoot,
|
|
251
257
|
parse: () => node("morph", {
|
|
252
258
|
morphs: [stringIntegerRoot(), parseInteger],
|
|
253
|
-
declaredOut:
|
|
259
|
+
declaredOut: safeInteger()
|
|
254
260
|
})
|
|
255
261
|
}, {
|
|
256
262
|
name: "string.integer"
|
|
@@ -374,7 +380,7 @@ var jsonRoot = function () { return predicateStringNode(isJsonString, "string.js
|
|
|
374
380
|
var json = keywordModule({
|
|
375
381
|
root: jsonRoot,
|
|
376
382
|
parse: function () { return node("morph", {
|
|
377
|
-
meta: "
|
|
383
|
+
meta: keywordMeta("string.json.parse"),
|
|
378
384
|
morphs: [intrinsic.string, parseJson],
|
|
379
385
|
declaredOut: intrinsic.jsonData
|
|
380
386
|
}) }
|