arktype 3.0.0-beta.2 → 3.0.0-rc.1

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.
Files changed (100) hide show
  1. package/README.md +55 -20
  2. package/out/_internal/regex/quantify.d.ts +17 -1
  3. package/out/_internal/schema/refinements/range.d.ts +2 -1
  4. package/out/_internal/schema/roots/domain.d.ts +1 -0
  5. package/out/_internal/schema/roots/root.d.ts +3 -1
  6. package/out/_internal/schema/roots/union.d.ts +8 -3
  7. package/out/_internal/schema/shared/compile.d.ts +2 -0
  8. package/out/_internal/schema/shared/declare.d.ts +9 -6
  9. package/out/_internal/schema/shared/errors.d.ts +3 -0
  10. package/out/_internal/schema/shared/issues.d.ts +5 -1
  11. package/out/_internal/schema/shared/issuesLean.d.ts +4 -0
  12. package/out/_internal/schema/shared/issuesNone.d.ts +1 -0
  13. package/out/_internal/schema/shared/issuesNoneLean.d.ts +1 -0
  14. package/out/_internal/schema/shared/standardFailure.d.ts +1 -0
  15. package/out/_internal/schema/shared/toJsonSchema.d.ts +16 -3
  16. package/out/_internal/schema/shared/transform.d.ts +1 -0
  17. package/out/_internal/sets/constraint.d.ts +2 -0
  18. package/out/_internal/sets/fromJsonSchema.d.ts +3 -1
  19. package/out/_internal/util/registry.d.ts +1 -1
  20. package/out/attributes.d.ts +12 -8
  21. package/out/chunk-2FVJ5JBN.js +161 -0
  22. package/out/{chunk-QBX4MEQR.js → chunk-3HZC67MT.js} +15 -15
  23. package/out/{chunk-5TN5JRP7.js → chunk-3KBOPH3J.js} +63 -41
  24. package/out/{chunk-GPNWBJL3.js → chunk-3WYMLH45.js} +17 -11
  25. package/out/{chunk-NIZDOWFU.js → chunk-46PLKNON.js} +2 -2
  26. package/out/{chunk-7JXN4WJX.js → chunk-4FTHWK63.js} +1 -1
  27. package/out/{chunk-EA2DNEDI.js → chunk-4HREHNIV.js} +12 -12
  28. package/out/{chunk-ZFB6DQWY.js → chunk-4J7H2ELX.js} +6 -11
  29. package/out/{chunk-7SVIUP6X.js → chunk-4MUH2MO4.js} +2 -2
  30. package/out/{chunk-J7CKAEDX.js → chunk-4NZCLVBD.js} +1 -1
  31. package/out/{chunk-RAM6G3F6.js → chunk-54U3D6OV.js} +26 -25
  32. package/out/{chunk-HA3POWOU.js → chunk-5FNHK7CC.js} +6 -5
  33. package/out/{chunk-KVQCLBJR.js → chunk-7SUZFAHZ.js} +241 -66
  34. package/out/{chunk-YMYPW3L5.js → chunk-AMNHRY72.js} +3 -3
  35. package/out/{chunk-UH6XKS3C.js → chunk-BQR65UPE.js} +30 -9
  36. package/out/{chunk-V4TZHFNK.js → chunk-BWKJV74G.js} +1 -1
  37. package/out/{chunk-7N3JEHA4.js → chunk-CXHXN7DF.js} +1 -1
  38. package/out/{chunk-FY4M7GE7.js → chunk-E4OQHHFS.js} +4 -4
  39. package/out/{chunk-CGWRW4JZ.js → chunk-ERGIJZFA.js} +4 -4
  40. package/out/{chunk-OA5Q2JLI.js → chunk-H44UG6HG.js} +8 -4
  41. package/out/{chunk-A7A6FDBS.js → chunk-I65VSWGS.js} +50 -44
  42. package/out/{chunk-C5JGK6GT.js → chunk-J2BFVWVY.js} +20 -3
  43. package/out/{chunk-W77ROLOT.js → chunk-JIILWIU4.js} +1 -1
  44. package/out/{chunk-5WRZ25AB.js → chunk-LMUBBBHJ.js} +4 -4
  45. package/out/{chunk-CQU7WIIR.js → chunk-P3HEEGB5.js} +6 -6
  46. package/out/{chunk-JZ4KBCMM.js → chunk-RKJNLXEQ.js} +21 -13
  47. package/out/{chunk-XMEK4I7J.js → chunk-TM22D5DL.js} +887 -266
  48. package/out/{chunk-PIFOURNM.js → chunk-TQYLOZRT.js} +11 -4
  49. package/out/{chunk-YN3XRJ7H.js → chunk-UJJGG4VQ.js} +1 -1
  50. package/out/{chunk-NIYAI7AF.js → chunk-US6BWOGJ.js} +3 -3
  51. package/out/{chunk-57LF5Y5P.js → chunk-W2XOI5DY.js} +1 -1
  52. package/out/{chunk-KDMHK4KP.js → chunk-XVLEFUSY.js} +2 -2
  53. package/out/{chunk-SGFGLENC.js → chunk-YPN67JMD.js} +3 -3
  54. package/out/cli.d.ts +5 -1
  55. package/out/cli.js +301 -49
  56. package/out/codecs.d.ts +4 -3
  57. package/out/codecs.js +18 -18
  58. package/out/config.js +8 -8
  59. package/out/declare.d.ts +2 -4
  60. package/out/errors.js +8 -8
  61. package/out/fn.d.ts +2 -2
  62. package/out/fromJsonSchema.d.ts +1 -1
  63. package/out/generic.d.ts +7 -4
  64. package/out/i18n.js +5 -5
  65. package/out/index.js +19 -19
  66. package/out/internal.js +32 -32
  67. package/out/island.js +18 -18
  68. package/out/islandDependency.js +33 -33
  69. package/out/jsonSchema/infer.d.ts +16 -6
  70. package/out/jsonSchema/validate.d.ts +16 -4
  71. package/out/keywords/functions.d.ts +4 -169
  72. package/out/keywords/keywords.d.ts +1 -1
  73. package/out/keywords/phrases.d.ts +3 -168
  74. package/out/keywords/ts.js +14 -14
  75. package/out/locales/de.js +6 -6
  76. package/out/locales/en.js +15 -15
  77. package/out/match.d.ts +12 -9
  78. package/out/mutatesInput.js +14 -14
  79. package/out/nary.d.ts +219 -193
  80. package/out/parser/definition.d.ts +2 -2
  81. package/out/parser/shift/operator/default.d.ts +2 -2
  82. package/out/parser/tupleExpressions.d.ts +2 -0
  83. package/out/precompiled.js +11 -11
  84. package/out/runtime.d.ts +1 -1
  85. package/out/runtime.js +5 -5
  86. package/out/schema.js +11 -11
  87. package/out/schemaInternal.js +29 -17
  88. package/out/schemaRuntime.js +4 -4
  89. package/out/schemaRuntimeLean.js +60 -36
  90. package/out/schemaRuntimeNone.js +52 -31
  91. package/out/schemaRuntimeNoneLean.js +52 -31
  92. package/out/type.d.ts +3 -3
  93. package/out/util.js +14 -11
  94. package/out/variants/base.d.ts +9 -8
  95. package/out/variants/object.d.ts +14 -6
  96. package/package.json +4 -4
  97. package/skills/arktype/SKILL.md +17 -17
  98. package/skills/arktype/references/migrating.md +13 -13
  99. package/skills/arktype/references/precompile.md +4 -4
  100. package/out/chunk-CSVAPWDE.js +0 -83
@@ -188,7 +188,7 @@ var numericStringMatcher = (
188
188
  // "-0" is excluded by requiring a nonzero digit after "-", not a lookahead,
189
189
  // since it's a JSON Schema pattern, which RE2 (e.g. LLM structured outputs)
190
190
  // can't read with one
191
- /^(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+|-(?:[1-9]\d*(?:\.\d+)?|0\.\d*[1-9]\d*))(?:[Ee][+-]?\d+)?$/
191
+ /^(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+|-(?:[1-9]\d*(?:\.\d+)?|0?\.\d*[1-9]\d*))(?:[Ee][+-]?\d+)?$/
192
192
  );
193
193
  var isDigitCode = (code) => code >= 48 && code <= 57;
194
194
  var isNumericString = (s) => {
@@ -205,7 +205,7 @@ var isNumericString = (s) => {
205
205
  do
206
206
  code = s.charCodeAt(++i);
207
207
  while (isDigitCode(code));
208
- } else if (isNegative || code !== 46)
208
+ } else if (code !== 46)
209
209
  return false;
210
210
  if (code === 46) {
211
211
  code = s.charCodeAt(++i);
@@ -366,12 +366,9 @@ var splitByKeys = (o, leftKeys) => {
366
366
  const l = {};
367
367
  const r = {};
368
368
  let k;
369
- for (k in o) {
370
- if (k in leftKeys)
371
- l[k] = o[k];
372
- else
373
- r[k] = o[k];
374
- }
369
+ for (k in o)
370
+ if (hasOwn(o, k))
371
+ defineValue(hasOwn(leftKeys, k) ? l : r, k, o[k]);
375
372
  return [l, r];
376
373
  };
377
374
  var pick = (o, keys) => splitByKeys(o, keys)[0];
@@ -400,7 +397,7 @@ var withAlphabetizedKeys = (o) => {
400
397
  const keys = Object.keys(o).sort();
401
398
  const result = {};
402
399
  for (let i = 0; i < keys.length; i++)
403
- result[keys[i]] = o[keys[i]];
400
+ defineValue(result, keys[i], o[keys[i]]);
404
401
  return result;
405
402
  };
406
403
  var invert = (t) => flatMorph(t, (k, v) => [v, k]);
@@ -475,7 +472,7 @@ var objectKindOf = (data) => {
475
472
  if (prototype === Object.prototype)
476
473
  return void 0;
477
474
  const constructors = builtinsOf();
478
- while (prototype?.constructor && (!isKeyOf(prototype.constructor.name, constructors) || constructors[prototype.constructor.name]?.prototype !== prototype))
475
+ while (prototype?.constructor && (!hasOwn(constructors, prototype.constructor.name) || constructors[prototype.constructor.name]?.prototype !== prototype))
479
476
  prototype = Object.getPrototypeOf(prototype);
480
477
  const name = prototype?.constructor?.name;
481
478
  if (name === void 0 || name === "Object")
@@ -567,7 +564,7 @@ var typedArrayDescriptions = {
567
564
  var objectKindDescriptions = /* @__PURE__ */ Object.assign({}, ecmascriptDescriptions, platformDescriptions, typedArrayDescriptions);
568
565
  var getBuiltinNameOfConstructor = (ctor) => {
569
566
  const constructorName = functionNameOf(Object(ctor)) ?? null;
570
- return constructorName && isKeyOf(constructorName, builtinConstructors) && builtinConstructors[constructorName] === ctor ? constructorName : null;
567
+ return constructorName && hasOwn(builtinConstructors, constructorName) && builtinConstructors[constructorName] === ctor ? constructorName : null;
571
568
  };
572
569
  var ancestorsOf = (o) => {
573
570
  let proto = Object.getPrototypeOf(o);
@@ -707,9 +704,9 @@ var _serialize = (data, opts, seen) => {
707
704
  if (toJson)
708
705
  return Reflect.apply(toJson, o, []);
709
706
  if (typeof o === "function")
710
- return printableOpts.onFunction(o);
707
+ return opts.onFunction?.(o) ?? printableOpts.onFunction(o);
711
708
  if (seen.includes(o))
712
- return "(cycle)";
709
+ return opts.onCycle?.(o) ?? "(cycle)";
713
710
  const nextSeen = [...seen, o];
714
711
  if (isArray(o))
715
712
  return o.map((item) => _serialize(item, opts, nextSeen));
@@ -717,12 +714,13 @@ var _serialize = (data, opts, seen) => {
717
714
  return o.toDateString();
718
715
  const result = {};
719
716
  for (const [k, v] of ownEntriesOf(o, opts)) {
720
- result[typeof k === "symbol" ? opts.onSymbol?.(k) ?? k.toString() : k] = _serialize(v, opts, nextSeen);
717
+ const key = typeof k === "symbol" ? opts.onSymbol?.(k) ?? k.toString() : k;
718
+ defineValue(result, key, _serialize(v, opts, nextSeen));
721
719
  }
722
720
  return result;
723
721
  }
724
722
  case "symbol":
725
- return printableOpts.onSymbol(data);
723
+ return opts.onSymbol?.(data) ?? printableOpts.onSymbol(data);
726
724
  case "bigint":
727
725
  return opts.onBigInt?.(data) ?? `${data}n`;
728
726
  case "undefined":
@@ -734,6 +732,8 @@ var _serialize = (data, opts, seen) => {
734
732
  }
735
733
  };
736
734
  var describeCollapsibleDate = (date) => {
735
+ if (!isValidDate(date))
736
+ return "Invalid Date";
737
737
  const year = date.getUTCFullYear();
738
738
  const month = date.getUTCMonth();
739
739
  const dayOfMonth = date.getUTCDate();
@@ -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-QBX4MEQR.js";
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
- for (const issue of this._)
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
- for (const issue of this._)
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
- for (const issue of this._)
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
- for (const issue of this._)
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 && { errors: issue.errors.map(jsonIssueOf) }
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[k] = data[k];
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[changes[i]] = changes[i + 2];
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[k] = r[k];
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
- if (supplied.message === "is invalid" && supplied.expected === "valid")
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
- if (!thunk && !node.alters && !node.hasAlias) {
1394
- return (data) => {
1395
- data[key] = defaultInput;
1396
- return data;
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[key] = output;
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[key] = defaultInput;
1415
- return data;
1416
- }
1436
+ if (!thunk && !node.tfs)
1437
+ return write(data, defaultInput);
1417
1438
  transformingDefault = true;
1418
1439
  try {
1419
- data[key] = travKey(key, () => value(thunk ? thunk() : defaultInput, ctx), ctx);
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,
@@ -8,13 +8,13 @@ import {
8
8
  tsGenericDefinitions,
9
9
  tsKeywordDefinitions,
10
10
  unknown
11
- } from "./chunk-XMEK4I7J.js";
11
+ } from "./chunk-TM22D5DL.js";
12
12
  import {
13
13
  Hkt
14
14
  } from "./chunk-BDJVONP7.js";
15
15
  import {
16
16
  keywordMeta
17
- } from "./chunk-7SVIUP6X.js";
17
+ } from "./chunk-4MUH2MO4.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-EA2DNEDI.js";
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-KVQCLBJR.js";
50
+ } from "./chunk-7SUZFAHZ.js";
51
51
  import {
52
52
  defineLazily
53
- } from "./chunk-YN3XRJ7H.js";
53
+ } from "./chunk-UJJGG4VQ.js";
54
54
  import {
55
55
  ipv4Matcher,
56
56
  ipv6Matcher,
57
57
  iso8601Matcher,
58
58
  uuidMatcher
59
- } from "./chunk-NIYAI7AF.js";
59
+ } from "./chunk-US6BWOGJ.js";
60
60
  import {
61
61
  $ark
62
- } from "./chunk-A7A6FDBS.js";
62
+ } from "./chunk-I65VSWGS.js";
63
63
  import {
64
64
  registry
65
- } from "./chunk-C5JGK6GT.js";
65
+ } from "./chunk-J2BFVWVY.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-QBX4MEQR.js";
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: intrinsic.integer
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: "safe JSON string parser",
383
+ meta: keywordMeta("string.json.parse"),
378
384
  morphs: [intrinsic.string, parseJson],
379
385
  declaredOut: intrinsic.jsonData
380
386
  }) }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  copyConfig,
3
3
  isSameConfig
4
- } from "./chunk-57LF5Y5P.js";
4
+ } from "./chunk-W2XOI5DY.js";
5
5
  import {
6
6
  throwParseError
7
- } from "./chunk-QBX4MEQR.js";
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";
@@ -2,7 +2,7 @@ import {
2
2
  Callable,
3
3
  functionNameOf,
4
4
  throwParseError
5
- } from "./chunk-QBX4MEQR.js";
5
+ } from "./chunk-3HZC67MT.js";
6
6
 
7
7
  // out/fn.js
8
8
  var InternalFnParser = class extends Callable {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  iso8601Matcher
3
- } from "./chunk-NIYAI7AF.js";
3
+ } from "./chunk-US6BWOGJ.js";
4
4
  import {
5
5
  FileConstructor,
6
6
  hasOwn,
7
7
  isDigitCode
8
- } from "./chunk-QBX4MEQR.js";
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": { noun: jsonString, message: jsonMessage },
204
- "string.json.parse": { noun: jsonString, message: jsonMessage },
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,
@@ -5,10 +5,10 @@ import {
5
5
  groupByPath,
6
6
  labelOf,
7
7
  writeKeywordExpected
8
- } from "./chunk-A7A6FDBS.js";
8
+ } from "./chunk-I65VSWGS.js";
9
9
  import {
10
10
  printedActualOf
11
- } from "./chunk-5TN5JRP7.js";
11
+ } from "./chunk-3KBOPH3J.js";
12
12
  import {
13
13
  listPattern
14
14
  } from "./chunk-3SH2BQ4T.js";
@@ -19,7 +19,7 @@ import {
19
19
  objectKindOrDomainOf,
20
20
  printable,
21
21
  timeOf
22
- } from "./chunk-QBX4MEQR.js";
22
+ } from "./chunk-3HZC67MT.js";
23
23
 
24
24
  // out/locales/de.js
25
25
  var listSeparatedBy = (middle) => listPattern({ two: " oder ", middle, end: " oder " }, { two: " und ", middle, end: " und " });
@@ -115,7 +115,6 @@ var describeProto = function (proto, locale) {
115
115
  return builtinName ? locale.nouns[builtinName] : `eine Instanz von ${locale.verbatim(proto.name)}`;
116
116
  };
117
117
  var causeOf = (cause, locale) => locale.verbatim(describeCause(cause));
118
- var jsonMessage = function (e, locale) { return e.code === "predicate" && e.cause !== void 0 ? `muss eine JSON-Zeichenkette sein (${causeOf(e.cause, locale)})` : locale.message(e, locale) };
119
118
  var epoch = "ein gültiger Unix-Zeitstempel als ganze Zahl";
120
119
  var keywordPhrases = {
121
120
  "FormData.parsed": "ein Objekt mit geparsten Formulardaten",
@@ -143,11 +142,10 @@ var keywordPhrases = {
143
142
  "string.ip": "eine IP-Adresse",
144
143
  "string.ip.v4": "eine IPv4-Adresse",
145
144
  "string.ip.v6": "eine IPv6-Adresse",
146
- "string.json": { noun: "eine JSON-Zeichenkette", message: jsonMessage },
145
+ "string.json": "eine JSON-Zeichenkette",
147
146
  "string.json.parse": {
148
147
  noun: "eine JSON-Zeichenkette",
149
- actual: (data, e, locale) => data === "" ? "leer" : print(data, locale),
150
- message: jsonMessage
148
+ actual: (data, e, locale) => data === "" ? "leer" : print(data, locale)
151
149
  },
152
150
  "string.lower.preformatted": "kleingeschrieben",
153
151
  "string.normalize.NFC.preformatted": "NFC-normalisiert",
@@ -156,10 +154,7 @@ var keywordPhrases = {
156
154
  "string.normalize.NFKD.preformatted": "NFKD-normalisiert",
157
155
  "string.numeric": "eine wohlgeformte numerische Zeichenkette",
158
156
  "string.numeric.parse": "endlich",
159
- "string.regex": {
160
- noun: "ein Regex-Muster",
161
- message: function (e, locale) { return e.code === "predicate" && e.cause !== void 0 ? `muss ein Regex-Muster sein (${causeOf(e.cause, locale)})` : locale.message(e, locale) }
162
- },
157
+ "string.regex": "ein Regex-Muster",
163
158
  "string.semver": "eine semantische Version (siehe https://semver.org/)",
164
159
  "string.trim.preformatted": "ohne Leerraum am Anfang und Ende",
165
160
  "string.upper.preformatted": "durchgehend großgeschrieben",
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  raisedErrorPhrases
3
- } from "./chunk-EA2DNEDI.js";
3
+ } from "./chunk-4HREHNIV.js";
4
4
  import {
5
5
  en
6
- } from "./chunk-KVQCLBJR.js";
6
+ } from "./chunk-7SUZFAHZ.js";
7
7
 
8
8
  // out/keywords/phrases.js
9
9
  var epoch = "an integer representing a safe Unix timestamp";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  noSuggest
3
- } from "./chunk-QBX4MEQR.js";
3
+ } from "./chunk-3HZC67MT.js";
4
4
 
5
5
  // ../util/out/generics.js
6
6
  var brand = /* @__PURE__ */ noSuggest("brand");