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
@@ -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_1,
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-BQR65UPE.js";
241
+ import "./chunk-RKJNLXEQ.js";
242
242
  import {
243
243
  keywords
244
- } from "./chunk-GPNWBJL3.js";
244
+ } from "./chunk-3WYMLH45.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-LMUBBBHJ.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-7SUZFAHZ.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-P3HEEGB5.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-ERGIJZFA.js";
314
313
  import {
315
314
  isDecidedByAllows,
316
315
  isRefinedPattern
317
- } from "./chunk-PIFOURNM.js";
316
+ } from "./chunk-TQYLOZRT.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-I65VSWGS.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-J2BFVWVY.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_1: () => precompiledForArktype_3_0_0_rc_1,
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-ERGIJZFA.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-I65VSWGS.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];