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.
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-QBX4MEQR.js → chunk-3HZC67MT.js} +15 -15
  22. package/out/{chunk-5TN5JRP7.js → chunk-3KBOPH3J.js} +63 -41
  23. package/out/{chunk-NIZDOWFU.js → chunk-46PLKNON.js} +2 -2
  24. package/out/{chunk-7JXN4WJX.js → chunk-4FTHWK63.js} +1 -1
  25. package/out/{chunk-EA2DNEDI.js → chunk-4HREHNIV.js} +12 -12
  26. package/out/{chunk-J7CKAEDX.js → chunk-4NZCLVBD.js} +1 -1
  27. package/out/{chunk-7N3JEHA4.js → chunk-6FMBO47M.js} +1 -1
  28. package/out/{chunk-W77ROLOT.js → chunk-7TALAWYX.js} +1 -1
  29. package/out/{chunk-YMYPW3L5.js → chunk-BCYKO54Z.js} +3 -3
  30. package/out/{chunk-7SVIUP6X.js → chunk-C2JOL5M2.js} +2 -2
  31. package/out/{chunk-GPNWBJL3.js → chunk-C2V6QPE3.js} +17 -11
  32. package/out/{chunk-XMEK4I7J.js → chunk-C3B4IFQL.js} +887 -266
  33. package/out/{chunk-FY4M7GE7.js → chunk-FWRSDUJ2.js} +4 -4
  34. package/out/chunk-GID3FSQA.js +161 -0
  35. package/out/{chunk-CGWRW4JZ.js → chunk-K7SLP5D2.js} +4 -4
  36. package/out/{chunk-KDMHK4KP.js → chunk-KQPSKGUI.js} +2 -2
  37. package/out/{chunk-KVQCLBJR.js → chunk-KXOC3JEX.js} +241 -66
  38. package/out/{chunk-CQU7WIIR.js → chunk-KXOSUYRA.js} +6 -6
  39. package/out/{chunk-5WRZ25AB.js → chunk-MTWKGAGO.js} +4 -4
  40. package/out/{chunk-OA5Q2JLI.js → chunk-NU73GNCX.js} +8 -4
  41. package/out/{chunk-ZFB6DQWY.js → chunk-P5W67FQH.js} +6 -11
  42. package/out/{chunk-A7A6FDBS.js → chunk-PDLTEX6Z.js} +50 -44
  43. package/out/{chunk-RAM6G3F6.js → chunk-QUS4IAXJ.js} +26 -25
  44. package/out/{chunk-HA3POWOU.js → chunk-R7WXIH5P.js} +6 -5
  45. package/out/{chunk-YN3XRJ7H.js → chunk-UJJGG4VQ.js} +1 -1
  46. package/out/{chunk-NIYAI7AF.js → chunk-US6BWOGJ.js} +3 -3
  47. package/out/{chunk-JZ4KBCMM.js → chunk-VMMMOO4R.js} +21 -13
  48. package/out/{chunk-PIFOURNM.js → chunk-VYMXHSFR.js} +11 -4
  49. package/out/{chunk-57LF5Y5P.js → chunk-W2XOI5DY.js} +1 -1
  50. package/out/{chunk-SGFGLENC.js → chunk-WC5L5YRP.js} +3 -3
  51. package/out/{chunk-V4TZHFNK.js → chunk-WKOSL2G6.js} +1 -1
  52. package/out/{chunk-UH6XKS3C.js → chunk-XNUAQSJ4.js} +30 -9
  53. package/out/{chunk-C5JGK6GT.js → chunk-ZRYEHGSG.js} +20 -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
@@ -3,13 +3,13 @@ import {
3
3
  copyConfig,
4
4
  isSameConfig,
5
5
  validateToJsonSchemaTarget
6
- } from "./chunk-57LF5Y5P.js";
6
+ } from "./chunk-W2XOI5DY.js";
7
7
  import {
8
8
  editsBetween
9
9
  } from "./chunk-TACLEIDM.js";
10
10
  import {
11
11
  compileSerializedValue
12
- } from "./chunk-PIFOURNM.js";
12
+ } from "./chunk-VYMXHSFR.js";
13
13
  import {
14
14
  $ark,
15
15
  configureAfterTypeMessage,
@@ -18,11 +18,11 @@ import {
18
18
  errorWritersByCode,
19
19
  namedReference,
20
20
  registeredReference
21
- } from "./chunk-A7A6FDBS.js";
21
+ } from "./chunk-PDLTEX6Z.js";
22
22
  import {
23
23
  isNode,
24
24
  removedProblemMessage
25
- } from "./chunk-5TN5JRP7.js";
25
+ } from "./chunk-3KBOPH3J.js";
26
26
  import {
27
27
  envHasCsp,
28
28
  flatMorph,
@@ -33,7 +33,7 @@ import {
33
33
  serializePrimitive,
34
34
  throwInternalError,
35
35
  throwParseError
36
- } from "./chunk-QBX4MEQR.js";
36
+ } from "./chunk-3HZC67MT.js";
37
37
 
38
38
  // ../schema/out/shared/implement.js
39
39
  var basisKinds = ["unit", "proto", "domain"];
@@ -86,7 +86,7 @@ var precedenceOfKind = (kind) => precedenceByKind[kind];
86
86
  var schemaKindsRightOf = (kind) => rootKinds.slice(precedenceOfKind(kind) + 1);
87
87
  var unionChildKinds = /* @__PURE__ */ (() => [...schemaKindsRightOf("union"), "alias"])();
88
88
  var morphChildKinds = /* @__PURE__ */ (() => [...schemaKindsRightOf("morph"), "alias"])();
89
- var ambiguousStringPattern = /^(?:"|\$ark\d*\.|(?:NaN|-?Infinity|-0|-?\d+n|undefined|[+-]?\d{4,6}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z)$)/;
89
+ var ambiguousStringPattern = /^(?:"|\$ark\d*\.|(?:NaN|-?Infinity|-0|-?\d+n|undefined|Invalid Date|[+-]?\d{4,6}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z)$)/;
90
90
  var defaultValueSerializer = function (v) {
91
91
  if (typeof v === "string")
92
92
  return ambiguousStringPattern.test(v) ? JSON.stringify(v) : v;
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  precompileInPlace
3
- } from "./chunk-KVQCLBJR.js";
3
+ } from "./chunk-KXOC3JEX.js";
4
4
  import {
5
5
  arrayIndexMatcher
6
6
  } from "./chunk-CWSF57VM.js";
7
7
  import {
8
8
  $ark
9
- } from "./chunk-A7A6FDBS.js";
9
+ } from "./chunk-PDLTEX6Z.js";
10
10
  import {
11
11
  hasArkKind
12
- } from "./chunk-5TN5JRP7.js";
12
+ } from "./chunk-3KBOPH3J.js";
13
13
  import {
14
14
  arityOf
15
- } from "./chunk-QBX4MEQR.js";
15
+ } from "./chunk-3HZC67MT.js";
16
16
 
17
17
  // ../schema/out/shared/inPlace.js
18
18
  var keys = () => ({ every: false, indices: false, named: /* @__PURE__ */ new Set() });
@@ -8,17 +8,19 @@ import {
8
8
  unrenderedLocaleMessage,
9
9
  unwrittenError,
10
10
  writeActual,
11
+ writeInvalidLocaleObjectMessage,
11
12
  writeKeywordExpected,
12
13
  writeText
13
- } from "./chunk-A7A6FDBS.js";
14
+ } from "./chunk-PDLTEX6Z.js";
14
15
  import {
15
16
  describeActual
16
- } from "./chunk-5TN5JRP7.js";
17
+ } from "./chunk-3KBOPH3J.js";
17
18
  import {
18
19
  omit,
19
20
  stringifyPath,
20
- throwError
21
- } from "./chunk-QBX4MEQR.js";
21
+ throwError,
22
+ throwParseError
23
+ } from "./chunk-3HZC67MT.js";
22
24
 
23
25
  // ../schema/out/shared/render.js
24
26
  var defaultLocale;
@@ -122,6 +124,8 @@ var isDefaultDescription = function (error, description) {
122
124
  };
123
125
  var normalizedLocales = /* @__PURE__ */ new WeakMap();
124
126
  var normalizeLocale = function (locale) {
127
+ if (typeof locale !== "object" || locale === null || Array.isArray(locale))
128
+ throwParseError(writeInvalidLocaleObjectMessage(locale));
125
129
  const en = defaultLocale ??= $ark.defaultConfig.locale;
126
130
  if (locale === en)
127
131
  return en;
@@ -5,10 +5,10 @@ import {
5
5
  groupByPath,
6
6
  labelOf,
7
7
  writeKeywordExpected
8
- } from "./chunk-A7A6FDBS.js";
8
+ } from "./chunk-PDLTEX6Z.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",
@@ -10,6 +10,7 @@ import {
10
10
  isCustomIssue,
11
11
  issueAt,
12
12
  messageOf,
13
+ pathOf,
13
14
  throwOnProblem,
14
15
  writeDomainActual,
15
16
  writeLengthActual,
@@ -20,12 +21,12 @@ import {
20
21
  writeProtoActual,
21
22
  writeUnitActual,
22
23
  writeUnitMessage
23
- } from "./chunk-5TN5JRP7.js";
24
+ } from "./chunk-3KBOPH3J.js";
24
25
  import {
25
26
  nameOf,
26
27
  register,
27
28
  registry
28
- } from "./chunk-C5JGK6GT.js";
29
+ } from "./chunk-ZRYEHGSG.js";
29
30
  import {
30
31
  appendStringifiedKey,
31
32
  appendUnique,
@@ -38,8 +39,9 @@ import {
38
39
  printKind,
39
40
  printable,
40
41
  stringifyPath,
41
- throwError
42
- } from "./chunk-QBX4MEQR.js";
42
+ throwError,
43
+ throwParseError
44
+ } from "./chunk-3HZC67MT.js";
43
45
 
44
46
  // ../schema/out/shared/errorWriters.js
45
47
  var errorWriters = {
@@ -121,6 +123,7 @@ var ThrownErrors = ThrownIssues;
121
123
  var writtenKey = Symbol("written");
122
124
  var localeKey = Symbol("locale");
123
125
  var configKey = Symbol("config");
126
+ var hasInstance = Function.prototype[Symbol.hasInstance];
124
127
  var ArkErrors = class ArkErrors extends Issues {
125
128
  constructor(config) {
126
129
  super();
@@ -142,13 +145,13 @@ var ArkErrors = class ArkErrors extends Issues {
142
145
  */
143
146
  get issues() {
144
147
  const issues = this._;
145
- if (this[writtenKey] === issues.length)
146
- return issues;
147
- const locale = selectedLocaleOf(this);
148
- const config = this[configKey];
149
- while (this[writtenKey] < issues.length)
150
- writeError(issues[this[writtenKey]++], config, locale);
151
- return issues;
148
+ if (this[writtenKey] < issues.length) {
149
+ const locale = selectedLocaleOf(this);
150
+ const config = this[configKey];
151
+ while (this[writtenKey] < issues.length)
152
+ writeError(issues[this[writtenKey]++], config, locale);
153
+ }
154
+ return serializableErrors(issues);
152
155
  }
153
156
  /** @internal the first of issues, its text written alone */
154
157
  get _first() {
@@ -193,7 +196,7 @@ var ArkErrors = class ArkErrors extends Issues {
193
196
  }
194
197
  /** @internal */
195
198
  _merge(merged, prefix) {
196
- if (merged instanceof ArkErrors)
199
+ if (hasInstance.call(ArkErrors, merged))
197
200
  return mergeErrors(this, merged, prefix);
198
201
  const config = this[configKey];
199
202
  for (const issue of merged.issues) {
@@ -209,6 +212,11 @@ var ArkErrors = class ArkErrors extends Issues {
209
212
  return this._;
210
213
  }
211
214
  };
215
+ Object.defineProperty(ArkErrors, Symbol.hasInstance, {
216
+ value(value) {
217
+ return this === ArkErrors ? value instanceof Issues : hasInstance.call(this, value);
218
+ }
219
+ });
212
220
  var selectedLocaleOf = (errors) => errors[localeKey] ??= renderer?.select(errors[configKey]) ?? errors[configKey].locale;
213
221
  var pathEquals = function (l, r) {
214
222
  if (l.length !== r.length)
@@ -644,10 +652,16 @@ var asTemplated = function (error, line) {
644
652
  templated.add(error);
645
653
  if (line !== void 0)
646
654
  noteLine(error, line);
647
- } else if (error.message?.startsWith("must be "))
655
+ } else if (line !== void 0)
656
+ error._l = line;
657
+ if (error.message?.startsWith("must be "))
648
658
  error.expected = error.message.slice(8);
649
659
  else if (error.message === "is invalid")
650
- error.expected = void 0;
660
+ error.expected = "valid";
661
+ else if (!isArkError(error) && error._l === void 0 && error.message !== void 0) {
662
+ const path = pathOf(error);
663
+ error._l = path ? `${path} ${error.message}` : error.message;
664
+ }
651
665
  return error;
652
666
  };
653
667
  var isCustom = function (error) {
@@ -810,7 +824,12 @@ var configureLocale = function (locale, base) {
810
824
  }
811
825
  return renderer ? renderer.configure(locale, base) : locale === void 0 || locale === base.locale ? base.locale : throwError(unrenderedLocaleMessage);
812
826
  };
813
- var resolveLocale = (locale) => renderer ? renderer.normalize(locale) : locale;
827
+ var resolveLocale = function (locale) {
828
+ if (typeof locale !== "object" || locale === null || Array.isArray(locale))
829
+ throwParseError(writeInvalidLocaleObjectMessage(locale));
830
+ return renderer ? renderer.normalize(locale) : locale;
831
+ };
832
+ var writeInvalidLocaleObjectMessage = (locale) => `Expected a Locale object like \`de\` from "arktype/locales/de" (was ${printable(locale)})`;
814
833
  var writtenIn = function (error, locale) {
815
834
  const config = configOf(error);
816
835
  if (!renderer && locale !== config.locale)
@@ -858,37 +877,22 @@ var summarize = function (issues, locale) {
858
877
  result += (i ? "\n" : "") + lineOf(issues[i], locale);
859
878
  return result;
860
879
  };
861
- var jsonOf = function (error) {
862
- const json = {};
863
- for (const k in error) {
864
- if (k in excludedFromJson)
865
- continue;
866
- const v = error[k];
867
- if (k === "path")
868
- json.path = v.map(jsonKeyOf);
869
- else if (k === "errors")
870
- json.errors = v.map(jsonOf);
871
- else if (isJsonPrimitive(v))
872
- json[k] = v;
873
- }
874
- return json;
875
- };
876
- var isJsonPrimitive = (v) => v === null || typeof v === "string" || typeof v === "number" || typeof v === "boolean";
880
+ var jsonOf = function (error) { return ({
881
+ code: error.code,
882
+ path: error.path.map(jsonKeyOf),
883
+ ...error.expected !== void 0 && { expected: error.expected },
884
+ message: error.message,
885
+ ...error.code === "union" && error.errors.length > 0 ? { errors: error.errors.map(jsonOf) } : {}
886
+ }) };
877
887
  var jsonKeyOf = (k) => typeof k === "symbol" ? String(k) : k;
878
- var excludedFromJson = {
879
- data: 1,
880
- actual: 1,
881
- meta: 1,
882
- unit: 1,
883
- proto: 1,
884
- rule: 1,
885
- predicate: 1,
886
- morph: 1,
887
- cause: 1,
888
- missing: 1,
889
- valueMeta: 1,
890
- cases: 1
888
+ var errorsToJson = {
889
+ value() {
890
+ return this.map(jsonOf);
891
+ },
892
+ writable: true,
893
+ configurable: true
891
894
  };
895
+ var serializableErrors = (issues) => issues.toJSON ? issues : Object.defineProperty(issues, "toJSON", errorsToJson);
892
896
  var firstIssue = (errors) => errors._first ?? errors.issues[0];
893
897
  var byPath = function (errors) {
894
898
  const result = {};
@@ -1093,7 +1097,9 @@ export {
1093
1097
  registerLocaleRenderer,
1094
1098
  defaultConfig,
1095
1099
  configureLocale,
1100
+ writeInvalidLocaleObjectMessage,
1096
1101
  unwrittenError,
1102
+ serializableErrors,
1097
1103
  firstIssue,
1098
1104
  byPath,
1099
1105
  flatByPath,
@@ -166,7 +166,7 @@ import {
166
166
  pipeTransformed,
167
167
  piped,
168
168
  pipedIntoUndetailed,
169
- precompiledForArktype_3_0_0_beta_2,
169
+ precompiledForArktype_3_0_0_rc_0,
170
170
  printKind,
171
171
  props,
172
172
  raisingTraversalOf,
@@ -237,17 +237,17 @@ import {
237
237
  writeUnitMessage,
238
238
  writtenBy,
239
239
  writtenSiteOf
240
- } from "./chunk-UH6XKS3C.js";
241
- import "./chunk-JZ4KBCMM.js";
240
+ } from "./chunk-XNUAQSJ4.js";
241
+ import "./chunk-VMMMOO4R.js";
242
242
  import {
243
243
  keywords
244
- } from "./chunk-GPNWBJL3.js";
244
+ } from "./chunk-C2V6QPE3.js";
245
245
  import {
246
246
  InternalTypedFn
247
- } from "./chunk-7JXN4WJX.js";
247
+ } from "./chunk-4FTHWK63.js";
248
248
  import {
249
249
  writesInPlace
250
- } from "./chunk-5WRZ25AB.js";
250
+ } from "./chunk-MTWKGAGO.js";
251
251
  import {
252
252
  capitalizeString,
253
253
  emptyCollectionDefaults,
@@ -277,9 +277,8 @@ import {
277
277
  uppercaseString,
278
278
  writeEpoch,
279
279
  writeIsoDate,
280
- writeJsonSyntaxErrorMessage,
281
280
  writeUrl
282
- } from "./chunk-EA2DNEDI.js";
281
+ } from "./chunk-4HREHNIV.js";
283
282
  import {
284
283
  LazyGenericRoot,
285
284
  TraversalCompiler,
@@ -287,51 +286,51 @@ import {
287
286
  hashedPrefixLength,
288
287
  madeMorphs,
289
288
  precompileRootUnits
290
- } from "./chunk-KVQCLBJR.js";
289
+ } from "./chunk-KXOC3JEX.js";
291
290
  import {
292
291
  isIpv4,
293
292
  isIpv6,
294
293
  isIso8601,
295
294
  isUuid
296
- } from "./chunk-NIYAI7AF.js";
295
+ } from "./chunk-US6BWOGJ.js";
297
296
  import {
298
297
  ToJsonSchema,
299
298
  foreignTypesByMorph,
300
299
  unionJsonSchemaWritersKey
301
- } from "./chunk-CQU7WIIR.js";
300
+ } from "./chunk-KXOSUYRA.js";
302
301
  import {
303
302
  supportedJsonSchemaTargets,
304
303
  writeNullableJsonSchema,
305
304
  writeUnionJsonSchema
306
- } from "./chunk-57LF5Y5P.js";
305
+ } from "./chunk-W2XOI5DY.js";
307
306
  import {
308
307
  hashOf
309
308
  } from "./chunk-TACLEIDM.js";
310
309
  import {
311
310
  rootApplyParts,
312
311
  rootApplyRuntime
313
- } from "./chunk-CGWRW4JZ.js";
312
+ } from "./chunk-K7SLP5D2.js";
314
313
  import {
315
314
  isDecidedByAllows,
316
315
  isRefinedPattern
317
- } from "./chunk-PIFOURNM.js";
316
+ } from "./chunk-VYMXHSFR.js";
318
317
  import {
319
318
  $ark,
320
319
  describesData,
321
320
  errorWriters,
322
321
  errorWritersByCode,
323
322
  registryName
324
- } from "./chunk-A7A6FDBS.js";
323
+ } from "./chunk-PDLTEX6Z.js";
325
324
  import {
326
325
  describeBranches,
327
326
  describeCases,
328
327
  hasArkKind,
329
328
  holeNameMarker,
330
329
  isNode
331
- } from "./chunk-5TN5JRP7.js";
330
+ } from "./chunk-3KBOPH3J.js";
332
331
  import {
333
332
  nameOf
334
- } from "./chunk-C5JGK6GT.js";
333
+ } from "./chunk-ZRYEHGSG.js";
335
334
  import {
336
335
  ParseError,
337
336
  appendStringifiedKey,
@@ -366,7 +365,7 @@ import {
366
365
  throwParseError,
367
366
  timeOf,
368
367
  unset
369
- } from "./chunk-QBX4MEQR.js";
368
+ } from "./chunk-3HZC67MT.js";
370
369
  import {
371
370
  __export
372
371
  } from "./chunk-I2KLQ2HA.js";
@@ -576,7 +575,7 @@ __export(runtimeExports_exports, {
576
575
  pipeTransformed: () => pipeTransformed,
577
576
  piped: () => piped,
578
577
  pipedIntoUndetailed: () => pipedIntoUndetailed,
579
- precompiledForArktype_3_0_0_beta_2: () => precompiledForArktype_3_0_0_beta_2,
578
+ precompiledForArktype_3_0_0_rc_0: () => precompiledForArktype_3_0_0_rc_0,
580
579
  printKind: () => printKind,
581
580
  printable: () => printable,
582
581
  props: () => props,
@@ -645,7 +644,6 @@ __export(runtimeExports_exports, {
645
644
  writeEpoch: () => writeEpoch,
646
645
  writeIdentityMismatchMessage: () => writeIdentityMismatchMessage,
647
646
  writeIsoDate: () => writeIsoDate,
648
- writeJsonSyntaxErrorMessage: () => writeJsonSyntaxErrorMessage,
649
647
  writeLengthActual: () => writeLengthActual,
650
648
  writeMessage: () => writeMessage,
651
649
  writeNotEqualActual: () => writeNotEqualActual,
@@ -830,7 +828,7 @@ var collectDefaults = function (node, defaultsByMorph) {
830
828
  if (node.defMorph) {
831
829
  defaultsByMorph.set(node.defMorph, [
832
830
  node.key,
833
- node.value,
831
+ node.requiredValue,
834
832
  node.inner.default
835
833
  ]);
836
834
  }
@@ -840,7 +838,7 @@ var collectDefaults = function (node, defaultsByMorph) {
840
838
  const [value, defaultValue] = node.defaultables[i];
841
839
  defaultsByMorph.set(node.defMorphs[i], [
842
840
  node.preLen + i,
843
- value,
841
+ node.requiredOf(value),
844
842
  defaultValue
845
843
  ]);
846
844
  }
@@ -1225,6 +1223,8 @@ var addIssueFeatures = function (features, units2, written) {
1225
1223
  features.bracketsKeys = true;
1226
1224
  features.writesText = true;
1227
1225
  features.readsErrors = true;
1226
+ if (node.is("morph"))
1227
+ features.listsUnions = true;
1228
1228
  } else if (node.is("union") && node.tfs) {
1229
1229
  features.transformsBranches = true;
1230
1230
  if (node.hasMorph || node.hasAlias)
@@ -3930,10 +3930,11 @@ var StandaloneArtifact = class {
3930
3930
  };
3931
3931
  for (const node of this.writtenSelected(holdsDefaults)) {
3932
3932
  if (node.is("optional") && node.defMorph)
3933
- collect(node.value);
3934
- else if (node.is("sequence"))
3933
+ collect(node.requiredValue);
3934
+ else if (node.is("sequence")) {
3935
3935
  for (const [value] of node.defaultables ?? [])
3936
- collect(value);
3936
+ collect(node.requiredOf(value));
3937
+ }
3937
3938
  }
3938
3939
  return this.validatorNames.size > typeCount;
3939
3940
  }
@@ -1,17 +1,18 @@
1
1
  import {
2
2
  rootApplyRuntime
3
- } from "./chunk-CGWRW4JZ.js";
3
+ } from "./chunk-K7SLP5D2.js";
4
4
  import {
5
5
  $ark,
6
6
  ArkErrors,
7
7
  ArkTraversal,
8
8
  SiteTraversal,
9
9
  invalidError,
10
- isArkError
11
- } from "./chunk-A7A6FDBS.js";
10
+ isArkError,
11
+ serializableErrors
12
+ } from "./chunk-PDLTEX6Z.js";
12
13
  import {
13
14
  lineOf
14
- } from "./chunk-5TN5JRP7.js";
15
+ } from "./chunk-3KBOPH3J.js";
15
16
 
16
17
  // ../schema/out/shared/errorModes.js
17
18
  import { findsOnRead } from "./shared/issueFeatures.js";
@@ -35,7 +36,7 @@ var UndetailedErrors = class extends ArkErrors {
35
36
  for (let i = 0; i < issues.length; i++)
36
37
  if (!isArkError(issues[i]))
37
38
  issues[i] = invalidError(issues[i], $ark.cfg);
38
- return issues;
39
+ return serializableErrors(issues);
39
40
  }
40
41
  get _first() {
41
42
  return this.issues[0];
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineValue,
3
3
  unset
4
- } from "./chunk-QBX4MEQR.js";
4
+ } from "./chunk-3HZC67MT.js";
5
5
 
6
6
  // ../util/out/lazily.js
7
7
  var lazily = (thunk) => {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  isDigitCode
3
- } from "./chunk-QBX4MEQR.js";
3
+ } from "./chunk-3HZC67MT.js";
4
4
 
5
5
  // ../util/out/formats.js
6
6
  var isHexCode = (code) => code - 48 >>> 0 < 10 || (code | 32) - 97 >>> 0 < 6;
7
- var uuidMatcher = /^(?:[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[1-8][\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}|0{8}-(?:0{4}-){3}0{12}|f{8}-(?:f{4}-){3}f{12})$/;
7
+ var uuidMatcher = /^(?:[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[1-8][\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}|0{8}-(?:0{4}-){3}0{12}|[Ff]{8}-(?:[Ff]{4}-){3}[Ff]{12})$/;
8
8
  var uuidWrittenOut = (
9
9
  // eslint-disable-next-line unicorn/better-regex
10
- /^(?:[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[1-8][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[89ABab][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]|0{8}-(?:0{4}-){3}0{12}|f{8}-(?:f{4}-){3}f{12})$/
10
+ /^(?:[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[1-8][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[89ABab][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]-[\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f][\dA-Fa-f]|0{8}-(?:0{4}-){3}0{12}|[Ff]{8}-(?:[Ff]{4}-){3}[Ff]{12})$/
11
11
  );
12
12
  var isUuid = (s) => s.length === 36 && uuidWrittenOut.test(s);
13
13
  var ipv4Matcher = /^((?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])\.){3}(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])$/;