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
@@ -21,27 +21,27 @@ import {
21
21
  traversesUnions,
22
22
  writeCreatedBeforeConfigureMessage,
23
23
  writtenConfigMessage
24
- } from "./chunk-NIZDOWFU.js";
24
+ } from "./chunk-46PLKNON.js";
25
25
  import {
26
26
  encode,
27
27
  inverses,
28
28
  writeMissingInverseMessage
29
- } from "./chunk-CSVAPWDE.js";
29
+ } from "./chunk-GID3FSQA.js";
30
30
  import {
31
31
  ArkFirstIssueTraversal,
32
32
  UndetailedErrors,
33
33
  UndetailedTraversal,
34
34
  errorModes,
35
35
  rejectUndetailed
36
- } from "./chunk-HA3POWOU.js";
36
+ } from "./chunk-R7WXIH5P.js";
37
37
  import {
38
38
  normalizeLocale
39
- } from "./chunk-OA5Q2JLI.js";
39
+ } from "./chunk-NU73GNCX.js";
40
40
  import {
41
41
  inPlaceTransforms,
42
42
  inputOnlyMorphs,
43
43
  writesInPlace
44
- } from "./chunk-5WRZ25AB.js";
44
+ } from "./chunk-MTWKGAGO.js";
45
45
  import {
46
46
  After,
47
47
  AfterNode,
@@ -209,6 +209,7 @@ import {
209
209
  writeInvalidMergeOperandMessage,
210
210
  writeInvalidOperandMessage,
211
211
  writeInvalidPropertyKeyMessage,
212
+ writeInvalidRangeRuleMessage,
212
213
  writeInvalidSchemaMessage,
213
214
  writeLiteralUnionEntriesMessage,
214
215
  writeMissingImportMessage,
@@ -226,7 +227,7 @@ import {
226
227
  writeUnsatisfiableExpressionError,
227
228
  writeUnsatisfiedParameterConstraintMessage,
228
229
  zeroDivisorMessage
229
- } from "./chunk-KVQCLBJR.js";
230
+ } from "./chunk-KXOC3JEX.js";
230
231
  import {
231
232
  arrayIndexMatcher,
232
233
  arrayIndexSource,
@@ -265,7 +266,7 @@ import {
265
266
  writeInvalidLocaleMessage,
266
267
  writeInvalidUndeclaredKeyBehaviorMessage,
267
268
  writeUnknownConfigOptionMessage
268
- } from "./chunk-CQU7WIIR.js";
269
+ } from "./chunk-KXOSUYRA.js";
269
270
  import {
270
271
  ToJsonSchemaError,
271
272
  openApiNull,
@@ -276,13 +277,13 @@ import {
276
277
  writeInvalidJsonSchemaTargetMessage,
277
278
  writeNullableJsonSchema,
278
279
  writeUnionJsonSchema
279
- } from "./chunk-57LF5Y5P.js";
280
+ } from "./chunk-W2XOI5DY.js";
280
281
  import {
281
282
  rootApplyParams,
282
283
  rootApplyParts,
283
284
  rootApplyRuntime,
284
285
  writeRootApply
285
- } from "./chunk-CGWRW4JZ.js";
286
+ } from "./chunk-K7SLP5D2.js";
286
287
  import {
287
288
  CompiledFunction,
288
289
  NodeCompiler,
@@ -297,7 +298,7 @@ import {
297
298
  returnsTransformErrors,
298
299
  serializeLiteralKey,
299
300
  tryJit
300
- } from "./chunk-PIFOURNM.js";
301
+ } from "./chunk-VYMXHSFR.js";
301
302
  import {
302
303
  $ark,
303
304
  ArkErrors,
@@ -345,14 +346,16 @@ import {
345
346
  registerLocaleRenderer,
346
347
  registeredReference,
347
348
  registryName,
349
+ serializableErrors,
348
350
  siteTraversalOf,
349
351
  suppliedText,
350
352
  unrenderedLocaleMessage,
351
353
  unwrittenError,
352
354
  writeActual,
355
+ writeInvalidLocaleObjectMessage,
353
356
  writeKeywordExpected,
354
357
  writeText
355
- } from "./chunk-A7A6FDBS.js";
358
+ } from "./chunk-PDLTEX6Z.js";
356
359
  import {
357
360
  FirstIssueTraversal,
358
361
  FirstIssues,
@@ -440,6 +443,7 @@ import {
440
443
  rejects,
441
444
  removedProblemMessage,
442
445
  resolving,
446
+ setOwnValue,
443
447
  sharedMessageOf,
444
448
  silentCtx,
445
449
  throwIssues,
@@ -466,13 +470,13 @@ import {
466
470
  writeProtoActual,
467
471
  writeUnitActual,
468
472
  writeUnitMessage
469
- } from "./chunk-5TN5JRP7.js";
473
+ } from "./chunk-3KBOPH3J.js";
470
474
  import {
471
475
  ParseError,
472
476
  arkKind,
473
477
  describeCollapsibleDate,
474
478
  printKind
475
- } from "./chunk-QBX4MEQR.js";
479
+ } from "./chunk-3HZC67MT.js";
476
480
  import {
477
481
  __export,
478
482
  __reExport
@@ -830,7 +834,9 @@ __export(internal_exports, {
830
834
  schemaKindOf: () => schemaKindOf,
831
835
  schemaKindsRightOf: () => schemaKindsRightOf,
832
836
  schemaScope: () => schemaScope,
837
+ serializableErrors: () => serializableErrors,
833
838
  serializeLiteralKey: () => serializeLiteralKey,
839
+ setOwnValue: () => setOwnValue,
834
840
  sets: () => sets,
835
841
  shareConfig: () => shareConfig,
836
842
  sharedMessageOf: () => sharedMessageOf,
@@ -890,9 +896,11 @@ __export(internal_exports, {
890
896
  writeInvalidKeysMessage: () => writeInvalidKeysMessage,
891
897
  writeInvalidLengthBoundMessage: () => writeInvalidLengthBoundMessage,
892
898
  writeInvalidLocaleMessage: () => writeInvalidLocaleMessage,
899
+ writeInvalidLocaleObjectMessage: () => writeInvalidLocaleObjectMessage,
893
900
  writeInvalidMergeOperandMessage: () => writeInvalidMergeOperandMessage,
894
901
  writeInvalidOperandMessage: () => writeInvalidOperandMessage,
895
902
  writeInvalidPropertyKeyMessage: () => writeInvalidPropertyKeyMessage,
903
+ writeInvalidRangeRuleMessage: () => writeInvalidRangeRuleMessage,
896
904
  writeInvalidSchemaMessage: () => writeInvalidSchemaMessage,
897
905
  writeInvalidUndeclaredKeyBehaviorMessage: () => writeInvalidUndeclaredKeyBehaviorMessage,
898
906
  writeKeywordExpected: () => writeKeywordExpected,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  registerBuilderCompiler,
3
3
  registeredReference
4
- } from "./chunk-A7A6FDBS.js";
4
+ } from "./chunk-PDLTEX6Z.js";
5
5
  import {
6
6
  TransformErrors,
7
7
  addMorphErrs,
@@ -16,14 +16,15 @@ import {
16
16
  transformResolution,
17
17
  transformedInApply,
18
18
  transformsValid
19
- } from "./chunk-5TN5JRP7.js";
19
+ } from "./chunk-3KBOPH3J.js";
20
20
  import {
21
21
  CastableBase,
22
22
  DynamicFunction,
23
23
  hasDomain,
24
24
  isDotAccessible,
25
- serializePrimitive
26
- } from "./chunk-QBX4MEQR.js";
25
+ serializePrimitive,
26
+ throwInternalError
27
+ } from "./chunk-3HZC67MT.js";
27
28
 
28
29
  // ../schema/out/shared/compile.js
29
30
  var writeErrorBuilder = function (context) {
@@ -207,6 +208,12 @@ var NodeCompiler = class extends CompiledFunction {
207
208
  serialize(value) {
208
209
  return hasDomain(value, "object") || typeof value === "symbol" ? this.ref(value) : serializePrimitive(value);
209
210
  }
211
+ /** validates that a numeric literal interpolated into generated JS is a number */
212
+ num(n) {
213
+ if (typeof n !== "number")
214
+ throwInternalError(`Expected a numeric literal (was ${typeof n})`);
215
+ return `${n}`;
216
+ }
210
217
  ref(value) {
211
218
  if (!this.refs)
212
219
  return registeredReference(value);
@@ -5,7 +5,7 @@ import {
5
5
  isEmptyObject,
6
6
  printable,
7
7
  throwParseError
8
- } from "./chunk-QBX4MEQR.js";
8
+ } from "./chunk-3HZC67MT.js";
9
9
 
10
10
  // ../schema/out/shared/jsonSchema.js
11
11
  var ToJsonSchemaError = class extends Error {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  type
3
- } from "./chunk-GPNWBJL3.js";
3
+ } from "./chunk-C2V6QPE3.js";
4
4
  import {
5
5
  parse
6
- } from "./chunk-XMEK4I7J.js";
6
+ } from "./chunk-C3B4IFQL.js";
7
7
  import {
8
8
  RootModule
9
- } from "./chunk-KVQCLBJR.js";
9
+ } from "./chunk-KXOC3JEX.js";
10
10
 
11
11
  // out/fromJsonSchema.js
12
12
  var fromJsonSchema = (schema) => (
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  configureSchema
3
- } from "./chunk-CQU7WIIR.js";
3
+ } from "./chunk-KXOSUYRA.js";
4
4
 
5
5
  // out/config.js
6
6
  var configure = configureSchema;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InternalTypedFn
3
- } from "./chunk-7JXN4WJX.js";
3
+ } from "./chunk-4FTHWK63.js";
4
4
  import {
5
5
  dateGetTime,
6
6
  getBuiltinNameOfConstructor,
@@ -11,7 +11,7 @@ import {
11
11
  stringifyPath,
12
12
  throwError,
13
13
  throwParseError
14
- } from "./chunk-QBX4MEQR.js";
14
+ } from "./chunk-3HZC67MT.js";
15
15
 
16
16
  // out/runtime.js
17
17
  import { ArkErrors as ArkErrors2, codedIssue, describeActual, enInfo, errorsOf, failsKey, failsKeySite, failsSite, findsOnRead, FirstIssues, holdsExpression, inContext, isCustomIssue, issueAt, issuesOf, mergeIssues, runtimeConfig as runtimeConfig2, sharedMessageOf, supportedJsonSchemaTargets, throwOnDefault, ToJsonSchemaError, traversesUnions, validateStandardJsonSchemaTarget, writeFromPath, writeListed, withContextOf } from "arktype/schema/runtime";
@@ -810,7 +810,7 @@ var union = ((branches, description, issueOf, fails) => {
810
810
  });
811
811
 
812
812
  // out/runtime.js
813
- var precompiledForArktype_3_0_0_beta_2 = true;
813
+ var precompiledForArktype_3_0_0_rc_0 = true;
814
814
  var assign = /* @__PURE__ */ (() => Object.assign)();
815
815
  var is = /* @__PURE__ */ (() => Object.is)();
816
816
  var freeze = /* @__PURE__ */ (() => Object.freeze)();
@@ -859,10 +859,25 @@ var failureMessage = {
859
859
  },
860
860
  enumerable: true
861
861
  };
862
- var standardResultOf = (out) => out instanceof ArkErrors2 ? Object.defineProperty(Object.defineProperty({ issues: out.issues }, "_s", {
863
- value: () => out.summary,
864
- writable: true
865
- }), "message", failureMessage) : { value: out };
862
+ var failureToJson = {
863
+ value() {
864
+ return {
865
+ issues: this._s(true),
866
+ message: this._s()
867
+ };
868
+ },
869
+ writable: true,
870
+ configurable: true
871
+ };
872
+ var standardResultOf = (out) => {
873
+ if (!(out instanceof ArkErrors2))
874
+ return { value: out };
875
+ const issues = out.issues;
876
+ return Object.defineProperty(Object.defineProperty(Object.defineProperty({ issues }, "_s", {
877
+ value: (json) => json ? typeof out.toJSON === "function" ? out.toJSON() : issues.toJSON() : out.summary,
878
+ writable: true
879
+ }), "message", failureMessage), "toJSON", failureToJson);
880
+ };
866
881
  var standardValidated = (validator, input, options) => {
867
882
  const context = options?.libraryOptions?.context;
868
883
  return standardResultOf(context === void 0 ? validator(input, void 0, null) : inContext(context, () => validator(input, void 0, null)));
@@ -1186,7 +1201,13 @@ var InvalidErrors = /* @__PURE__ */ (() => {
1186
1201
  }
1187
1202
  get _() {
1188
1203
  return this._f ??= [
1189
- { code: "predicate", path: [], data: this._d }
1204
+ {
1205
+ code: "predicate",
1206
+ path: [],
1207
+ data: this._d,
1208
+ expected: "valid",
1209
+ message: "is invalid"
1210
+ }
1190
1211
  ];
1191
1212
  }
1192
1213
  }
@@ -1459,7 +1480,7 @@ export {
1459
1480
  discriminate,
1460
1481
  discriminateOr,
1461
1482
  union,
1462
- precompiledForArktype_3_0_0_beta_2,
1483
+ precompiledForArktype_3_0_0_rc_0,
1463
1484
  assign,
1464
1485
  is,
1465
1486
  freeze,
@@ -1,13 +1,30 @@
1
1
  import {
2
2
  FileConstructor,
3
3
  baseNameOf
4
- } from "./chunk-QBX4MEQR.js";
4
+ } from "./chunk-3HZC67MT.js";
5
5
 
6
6
  // ../util/out/registry.js
7
- var arkUtilVersion = "3.0.0-beta.2";
7
+ var arkUtilVersion = "3.0.0-rc.0";
8
+ var reservedRegistryKeys = {
9
+ inPlace: void 0,
10
+ errorModes: void 0,
11
+ encode: void 0,
12
+ sets: void 0,
13
+ kw: void 0,
14
+ config: void 0,
15
+ cfg: void 0,
16
+ defaultConfig: void 0,
17
+ ambient: void 0,
18
+ nodesById: void 0,
19
+ reached: void 0,
20
+ deferDefaultCheck: void 0,
21
+ eagerTypes: void 0,
22
+ typeAttachments: void 0
23
+ };
8
24
  var initialRegistryContents = {
9
25
  version: arkUtilVersion,
10
- FileConstructor
26
+ FileConstructor,
27
+ ...reservedRegistryKeys
11
28
  };
12
29
  var registry = initialRegistryContents;
13
30
  var namesByResolution = /* @__PURE__ */ new Map();
package/out/cli.d.ts CHANGED
@@ -19,6 +19,10 @@ export declare const bundledSkillPath: () => string;
19
19
  export declare const detectPackageManager: (startDir: string) => PackageManager;
20
20
  export declare const installDevCommand: (pm: PackageManager, pkg: string) => string;
21
21
  export declare const detectMigrationSource: (manifest: PackageManifest | undefined) => MigrationSource | undefined;
22
- export declare const installBundledSkill: (projectRoot: string, targetDir?: string) => string;
22
+ export type InstallSkillOptions = {
23
+ allowOutside?: boolean;
24
+ cwd?: string;
25
+ };
26
+ export declare const installBundledSkill: (projectRoot: string, targetDir?: string, opts?: InstallSkillOptions) => string;
23
27
  export declare const runCli: (argv: string[], ctx?: CliContext) => number;
24
28
  export {};