arktype 3.0.0-beta.1 → 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 +48 -144
- package/out/_internal/regex/charset.d.ts +24 -0
- package/out/_internal/regex/escape.d.ts +29 -0
- package/out/_internal/regex/execArray.d.ts +24 -0
- package/out/_internal/regex/group.d.ts +34 -0
- package/out/_internal/regex/index.d.ts +2 -0
- package/out/_internal/regex/internal.d.ts +9 -0
- package/out/_internal/regex/parse.d.ts +10 -0
- package/out/_internal/regex/quantify.d.ts +59 -0
- package/out/_internal/regex/regex.d.ts +38 -0
- package/out/_internal/regex/state.d.ts +383 -0
- package/out/_internal/schema/codecs.d.ts +2 -0
- package/out/_internal/schema/config.d.ts +103 -0
- package/out/_internal/schema/constraint.d.ts +78 -0
- package/out/_internal/schema/errors.d.ts +1 -0
- package/out/_internal/schema/generic.d.ts +85 -0
- package/out/_internal/schema/i18n.d.ts +3 -0
- package/out/_internal/schema/index.d.ts +54 -0
- package/out/_internal/schema/internal.d.ts +15 -0
- package/out/_internal/schema/intrinsic.d.ts +28 -0
- package/out/_internal/schema/kinds.d.ts +76 -0
- package/out/_internal/schema/module.d.ts +23 -0
- package/out/_internal/schema/mutatesInput.d.ts +2 -0
- package/out/_internal/schema/node.d.ts +349 -0
- package/out/_internal/schema/parse.d.ts +77 -0
- package/out/_internal/schema/parseSchema.d.ts +116 -0
- package/out/_internal/schema/predicate.d.ts +46 -0
- package/out/_internal/schema/refinements/after.d.ts +32 -0
- package/out/_internal/schema/refinements/before.d.ts +32 -0
- package/out/_internal/schema/refinements/divisor.d.ts +41 -0
- package/out/_internal/schema/refinements/exactLength.d.ts +43 -0
- package/out/_internal/schema/refinements/kinds.d.ts +40 -0
- package/out/_internal/schema/refinements/max.d.ts +33 -0
- package/out/_internal/schema/refinements/maxLength.d.ts +32 -0
- package/out/_internal/schema/refinements/min.d.ts +33 -0
- package/out/_internal/schema/refinements/minLength.d.ts +32 -0
- package/out/_internal/schema/refinements/notEqual.d.ts +38 -0
- package/out/_internal/schema/refinements/notEqualLength.d.ts +38 -0
- package/out/_internal/schema/refinements/pattern.d.ts +43 -0
- package/out/_internal/schema/refinements/range.d.ts +101 -0
- package/out/_internal/schema/roots/alias.d.ts +49 -0
- package/out/_internal/schema/roots/basis.d.ts +12 -0
- package/out/_internal/schema/roots/domain.d.ts +45 -0
- package/out/_internal/schema/roots/intersection.d.ts +72 -0
- package/out/_internal/schema/roots/morph.d.ts +59 -0
- package/out/_internal/schema/roots/proto.d.ts +42 -0
- package/out/_internal/schema/roots/root.d.ts +163 -0
- package/out/_internal/schema/roots/union.d.ts +146 -0
- package/out/_internal/schema/roots/unit.d.ts +36 -0
- package/out/_internal/schema/runtime.d.ts +29 -0
- package/out/_internal/schema/runtimeLean.d.ts +2 -0
- package/out/_internal/schema/runtimeNone.d.ts +2 -0
- package/out/_internal/schema/runtimeNoneLean.d.ts +2 -0
- package/out/_internal/schema/scope.d.ts +203 -0
- package/out/_internal/schema/shared/codecs.d.ts +5 -0
- package/out/_internal/schema/shared/compile.d.ts +144 -0
- package/out/_internal/schema/shared/configured.d.ts +14 -0
- package/out/_internal/schema/shared/declare.d.ts +100 -0
- package/out/_internal/schema/shared/disjoint.d.ts +45 -0
- package/out/_internal/schema/shared/enWriters.d.ts +30 -0
- package/out/_internal/schema/shared/errorModes.d.ts +25 -0
- package/out/_internal/schema/shared/errorWriters.d.ts +34 -0
- package/out/_internal/schema/shared/errors.d.ts +264 -0
- package/out/_internal/schema/shared/implement.d.ts +154 -0
- package/out/_internal/schema/shared/inPlace.d.ts +8 -0
- package/out/_internal/schema/shared/issueFeatures.d.ts +38 -0
- package/out/_internal/schema/shared/issues.d.ts +261 -0
- package/out/_internal/schema/shared/issuesLean.d.ts +80 -0
- package/out/_internal/schema/shared/issuesNone.d.ts +22 -0
- package/out/_internal/schema/shared/issuesNoneLean.d.ts +20 -0
- package/out/_internal/schema/shared/issuesUndetailed.d.ts +25 -0
- package/out/_internal/schema/shared/jsonSchema.d.ts +153 -0
- package/out/_internal/schema/shared/listed.d.ts +15 -0
- package/out/_internal/schema/shared/locale.d.ts +149 -0
- package/out/_internal/schema/shared/registry.d.ts +16 -0
- package/out/_internal/schema/shared/render.d.ts +3 -0
- package/out/_internal/schema/shared/rootApply.d.ts +19 -0
- package/out/_internal/schema/shared/sets.d.ts +26 -0
- package/out/_internal/schema/shared/standardFailure.d.ts +22 -0
- package/out/_internal/schema/shared/standardSchema.d.ts +124 -0
- package/out/_internal/schema/shared/toJsonSchema.d.ts +229 -0
- package/out/_internal/schema/shared/transform.d.ts +35 -0
- package/out/_internal/schema/shared/traversal.d.ts +288 -0
- package/out/_internal/schema/shared/utils.d.ts +59 -0
- package/out/_internal/schema/structure/index.d.ts +43 -0
- package/out/_internal/schema/structure/optional.d.ts +61 -0
- package/out/_internal/schema/structure/prop.d.ts +45 -0
- package/out/_internal/schema/structure/required.d.ts +49 -0
- package/out/_internal/schema/structure/sequence.d.ts +127 -0
- package/out/_internal/schema/structure/shared.d.ts +3 -0
- package/out/_internal/schema/structure/structure.d.ts +178 -0
- package/out/_internal/schema/units.d.ts +123 -0
- package/out/_internal/sets/algebra.d.ts +26 -0
- package/out/_internal/sets/constraint.d.ts +19 -0
- package/out/_internal/sets/engine.d.ts +2 -0
- package/out/_internal/sets/formats.d.ts +23 -0
- package/out/_internal/sets/fromJsonSchema.d.ts +15 -0
- package/out/_internal/sets/implement.d.ts +16 -0
- package/out/_internal/sets/index.d.ts +2 -0
- package/out/_internal/sets/internal.d.ts +20 -0
- package/out/_internal/sets/intersections.d.ts +5 -0
- package/out/_internal/sets/kinds.d.ts +3 -0
- package/out/_internal/sets/refinements.d.ts +14 -0
- package/out/_internal/sets/roots/alias.d.ts +3 -0
- package/out/_internal/sets/roots/domain.d.ts +3 -0
- package/out/_internal/sets/roots/intersection.d.ts +4 -0
- package/out/_internal/sets/roots/morph.d.ts +4 -0
- package/out/_internal/sets/roots/proto.d.ts +3 -0
- package/out/_internal/sets/roots/union.d.ts +16 -0
- package/out/_internal/sets/roots/unit.d.ts +3 -0
- package/out/_internal/sets/structure/index.d.ts +3 -0
- package/out/_internal/sets/structure/prop.d.ts +8 -0
- package/out/_internal/sets/structure/sequence.d.ts +3 -0
- package/out/_internal/sets/structure/structure.d.ts +3 -0
- package/out/_internal/sets/toJsonSchema.d.ts +25 -0
- package/out/_internal/util/arrays.d.ts +130 -0
- package/out/_internal/util/clone.d.ts +4 -0
- package/out/_internal/util/describe.d.ts +25 -0
- package/out/_internal/util/domain.d.ts +49 -0
- package/out/_internal/util/errors.d.ts +29 -0
- package/out/_internal/util/facts.d.ts +22 -0
- package/out/_internal/util/flatMorph.d.ts +41 -0
- package/out/_internal/util/formats.d.ts +8 -0
- package/out/_internal/util/functions.d.ts +33 -0
- package/out/_internal/util/generics.d.ts +65 -0
- package/out/_internal/util/get.d.ts +9 -0
- package/out/_internal/util/hkt.d.ts +27 -0
- package/out/_internal/util/i18n.d.ts +12 -0
- package/out/_internal/util/index.d.ts +28 -0
- package/out/_internal/util/internal.d.ts +2 -0
- package/out/_internal/util/intersections.d.ts +50 -0
- package/out/_internal/util/isomorphic.d.ts +8 -0
- package/out/_internal/util/keys.d.ts +18 -0
- package/out/_internal/util/lazily.d.ts +7 -0
- package/out/_internal/util/numbers.d.ts +82 -0
- package/out/_internal/util/objectKinds.d.ts +157 -0
- package/out/_internal/util/path.d.ts +16 -0
- package/out/_internal/util/primitive.d.ts +16 -0
- package/out/_internal/util/records.d.ts +173 -0
- package/out/_internal/util/registry.d.ts +13 -0
- package/out/_internal/util/scanner.d.ts +110 -0
- package/out/_internal/util/serialize.d.ts +40 -0
- package/out/_internal/util/strings.d.ts +35 -0
- package/out/_internal/util/traits.d.ts +89 -0
- package/out/_internal/util/unionToTuple.d.ts +14 -0
- package/out/_internal/util/weak.d.ts +8 -0
- package/out/attributes.d.ts +15 -11
- package/out/checkers.d.ts +1 -1
- package/out/chunk-22RQSVV3.js +0 -0
- package/out/chunk-3HZC67MT.js +965 -0
- package/out/chunk-3KBOPH3J.js +1564 -0
- package/out/chunk-3SH2BQ4T.js +15 -0
- package/out/chunk-46PLKNON.js +126 -0
- package/out/{chunk-G45P2CLE.js → chunk-4FTHWK63.js} +6 -1
- package/out/{chunk-UK5UGFOX.js → chunk-4HREHNIV.js} +23 -11
- package/out/chunk-4NZCLVBD.js +14 -0
- package/out/chunk-6FMBO47M.js +7 -0
- package/out/chunk-7TALAWYX.js +10 -0
- package/out/{chunk-DLWCO4RV.js → chunk-BCYKO54Z.js} +11 -2
- package/out/chunk-BDJVONP7.js +168 -0
- package/out/{chunk-E3DZXEZK.js → chunk-C2JOL5M2.js} +4 -2
- package/out/{chunk-2U2AWCI3.js → chunk-C2V6QPE3.js} +126 -97
- package/out/chunk-C3B4IFQL.js +6408 -0
- package/out/chunk-CWSF57VM.js +10 -0
- package/out/chunk-F5BACUJS.js +7 -0
- package/out/{chunk-EVCML554.js → chunk-FWRSDUJ2.js} +14 -5
- package/out/chunk-GID3FSQA.js +161 -0
- package/out/chunk-I2KLQ2HA.js +22 -0
- package/out/chunk-K7SLP5D2.js +84 -0
- package/out/chunk-KQPSKGUI.js +9 -0
- package/out/chunk-KXOC3JEX.js +8234 -0
- package/out/chunk-KXOSUYRA.js +405 -0
- package/out/chunk-LHNEY6QW.js +0 -0
- package/out/chunk-MTWKGAGO.js +323 -0
- package/out/chunk-NU73GNCX.js +170 -0
- package/out/{chunk-RAZ3TXOE.js → chunk-P5W67FQH.js} +34 -19
- package/out/chunk-PDLTEX6Z.js +1118 -0
- package/out/{chunk-VV6YDN2D.js → chunk-QUS4IAXJ.js} +304 -263
- package/out/chunk-R7WXIH5P.js +94 -0
- package/out/chunk-TACLEIDM.js +95 -0
- package/out/chunk-UJJGG4VQ.js +71 -0
- package/out/chunk-US6BWOGJ.js +109 -0
- package/out/chunk-VMMMOO4R.js +945 -0
- package/out/chunk-VYMXHSFR.js +439 -0
- package/out/chunk-W2XOI5DY.js +141 -0
- package/out/chunk-WC5L5YRP.js +25 -0
- package/out/{chunk-NRIGTMPM.js → chunk-WKOSL2G6.js} +4 -1
- package/out/chunk-XLG66ZDF.js +0 -0
- package/out/{chunk-5U2ZMDNI.js → chunk-XNUAQSJ4.js} +52 -30
- package/out/chunk-ZRYEHGSG.js +79 -0
- package/out/cli.d.ts +28 -0
- package/out/cli.js +636 -0
- package/out/codecs.d.ts +6 -5
- package/out/codecs.js +23 -7
- package/out/config.d.ts +5 -17
- package/out/config.js +11 -2
- package/out/declare.d.ts +40 -12
- package/out/deferred.d.ts +2 -2
- package/out/errors.d.ts +1 -1
- package/out/errors.js +10 -2
- package/out/fn.d.ts +20 -13
- package/out/fromJsonSchema.d.ts +18 -0
- package/out/generic.d.ts +9 -6
- package/out/i18n.d.ts +2 -2
- package/out/i18n.js +9 -2
- package/out/index.d.ts +16 -7
- package/out/index.js +25 -8
- package/out/internal.d.ts +4 -0
- package/out/internal.js +41 -17
- package/out/island.js +22 -6
- package/out/islandDependency.js +42 -18
- package/out/jsonSchema/infer.d.ts +805 -0
- package/out/jsonSchema/validate.d.ts +416 -0
- package/out/keywords/Array.d.ts +2 -2
- package/out/keywords/builtins.d.ts +3 -3
- package/out/keywords/constructors.d.ts +1 -1
- package/out/keywords/functions.d.ts +5 -192
- package/out/keywords/keywords.d.ts +3 -3
- package/out/keywords/number.d.ts +2 -2
- package/out/keywords/phrases.d.ts +4 -191
- package/out/keywords/string.d.ts +3 -3
- package/out/keywords/ts.d.ts +18 -18
- package/out/keywords/ts.js +19 -4
- package/out/locale.d.ts +6 -2
- package/out/locales/de.js +9 -2
- package/out/locales/en.js +21 -5
- package/out/match.d.ts +13 -10
- package/out/module.d.ts +2 -2
- package/out/mutatesInput.js +18 -3
- package/out/nary.d.ts +220 -194
- package/out/parser/ast/bounds.d.ts +2 -2
- package/out/parser/ast/default.d.ts +2 -2
- package/out/parser/ast/divisor.d.ts +2 -2
- package/out/parser/ast/generic.d.ts +2 -2
- package/out/parser/ast/infer.d.ts +1 -1
- package/out/parser/ast/keyof.d.ts +2 -2
- package/out/parser/ast/utils.d.ts +1 -1
- package/out/parser/ast/validate.d.ts +2 -2
- package/out/parser/definition.d.ts +4 -4
- package/out/parser/objectLiteral.d.ts +2 -2
- package/out/parser/property.d.ts +2 -2
- package/out/parser/reduce/dynamic.d.ts +2 -2
- package/out/parser/reduce/shared.d.ts +1 -1
- package/out/parser/reduce/static.d.ts +1 -1
- package/out/parser/shift/operand/enclosed.d.ts +2 -2
- package/out/parser/shift/operand/genericArgs.d.ts +2 -2
- package/out/parser/shift/operand/operand.d.ts +1 -1
- package/out/parser/shift/operand/unenclosed.d.ts +2 -2
- package/out/parser/shift/operand/unresolvable.d.ts +2 -2
- package/out/parser/shift/operator/bounds.d.ts +2 -2
- package/out/parser/shift/operator/brand.d.ts +2 -2
- package/out/parser/shift/operator/default.d.ts +4 -4
- package/out/parser/shift/operator/divisor.d.ts +1 -1
- package/out/parser/shift/operator/operator.d.ts +1 -1
- package/out/parser/shift/tokens.d.ts +1 -1
- package/out/parser/string.d.ts +2 -2
- package/out/parser/tupleExpressions.d.ts +6 -8
- package/out/parser/tupleLiteral.d.ts +2 -2
- package/out/precompiled.d.ts +1 -1
- package/out/precompiled.js +16 -2
- package/out/regex.d.ts +1 -0
- package/out/regex.js +2 -0
- package/out/runtime.d.ts +10 -8
- package/out/runtime.js +6 -4
- package/out/runtimeDevelopment.js +70 -52
- package/out/schema.d.ts +1 -0
- package/out/schema.js +15 -0
- package/out/schemaInternal.d.ts +1 -0
- package/out/schemaInternal.js +1401 -0
- package/out/schemaIssueFeatures.d.ts +1 -0
- package/out/schemaRuntime.d.ts +1 -0
- package/out/schemaRuntime.js +7 -0
- package/out/schemaRuntimeLean.d.ts +1 -0
- package/out/schemaRuntimeLean.js +1870 -0
- package/out/schemaRuntimeNone.d.ts +1 -0
- package/out/schemaRuntimeNone.js +1774 -0
- package/out/schemaRuntimeNoneLean.d.ts +1 -0
- package/out/schemaRuntimeNoneLean.js +1767 -0
- package/out/scope.d.ts +3 -4
- package/out/shared/issueFeatures.d.ts +38 -0
- package/out/shared/issueFeatures.js +40 -0
- package/out/standalone/artifact.d.ts +6 -6
- package/out/standalone/baking.d.ts +2 -2
- package/out/standalone/combinators.d.ts +1 -1
- package/out/standalone/compilers.d.ts +1 -1
- package/out/standalone/fallbacks.d.ts +1 -1
- package/out/standalone/keys.d.ts +1 -1
- package/out/standalone/sites.d.ts +3 -3
- package/out/standalone/units.d.ts +1 -1
- package/out/standalone/values.d.ts +1 -1
- package/out/type.d.ts +6 -6
- package/out/util.d.ts +1 -0
- package/out/util.js +137 -0
- package/out/variants/array.d.ts +6 -6
- package/out/variants/base.d.ts +61 -10
- package/out/variants/date.d.ts +5 -5
- package/out/variants/instantiate.d.ts +1 -1
- package/out/variants/number.d.ts +6 -6
- package/out/variants/object.d.ts +25 -12
- package/out/variants/string.d.ts +8 -8
- package/package.json +183 -8
- package/skills/arktype/SKILL.md +93 -93
- package/skills/arktype/references/migrating.md +144 -158
- package/skills/arktype/references/precompile.md +7 -7
- package/out/chunk-4CUA5XIP.js +0 -7
- package/out/chunk-GPNK5353.js +0 -2529
- package/out/chunk-MLKGABMK.js +0 -9
- package/out/chunk-PRTMQCHS.js +0 -3
- package/out/chunk-R5G57XC7.js +0 -7
- package/out/chunk-SWOOCAHN.js +0 -4
- package/out/chunk-TAHPKDNM.js +0 -3
- package/out/chunk-UETB6YE2.js +0 -14
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
tsGenericDefinitions,
|
|
9
9
|
tsKeywordDefinitions,
|
|
10
10
|
unknown
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C3B4IFQL.js";
|
|
12
|
+
import {
|
|
13
|
+
Hkt
|
|
14
|
+
} from "./chunk-BDJVONP7.js";
|
|
12
15
|
import {
|
|
13
16
|
keywordMeta
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-C2JOL5M2.js";
|
|
15
18
|
import {
|
|
16
19
|
capitalizeString,
|
|
17
20
|
epochDescriptions,
|
|
@@ -35,11 +38,45 @@ import {
|
|
|
35
38
|
parsesFinite,
|
|
36
39
|
trimString,
|
|
37
40
|
uppercaseString
|
|
38
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4HREHNIV.js";
|
|
42
|
+
import {
|
|
43
|
+
RootModule,
|
|
44
|
+
constraintInputOf,
|
|
45
|
+
genericNode,
|
|
46
|
+
intrinsic,
|
|
47
|
+
node,
|
|
48
|
+
rootSchema,
|
|
49
|
+
writeUnresolvableMessage
|
|
50
|
+
} from "./chunk-KXOC3JEX.js";
|
|
51
|
+
import {
|
|
52
|
+
defineLazily
|
|
53
|
+
} from "./chunk-UJJGG4VQ.js";
|
|
54
|
+
import {
|
|
55
|
+
ipv4Matcher,
|
|
56
|
+
ipv6Matcher,
|
|
57
|
+
iso8601Matcher,
|
|
58
|
+
uuidMatcher
|
|
59
|
+
} from "./chunk-US6BWOGJ.js";
|
|
60
|
+
import {
|
|
61
|
+
$ark
|
|
62
|
+
} from "./chunk-PDLTEX6Z.js";
|
|
63
|
+
import {
|
|
64
|
+
registry
|
|
65
|
+
} from "./chunk-ZRYEHGSG.js";
|
|
66
|
+
import {
|
|
67
|
+
cached,
|
|
68
|
+
defineProperties,
|
|
69
|
+
ecmascriptConstructors,
|
|
70
|
+
flatMorph,
|
|
71
|
+
liftArray,
|
|
72
|
+
numericStringMatcher,
|
|
73
|
+
platformConstructors,
|
|
74
|
+
throwParseError,
|
|
75
|
+
typedArrayConstructors,
|
|
76
|
+
wellFormedIntegerMatcher
|
|
77
|
+
} from "./chunk-3HZC67MT.js";
|
|
39
78
|
|
|
40
79
|
// out/keywords/builtins.js
|
|
41
|
-
import { genericNode, intrinsic } from "@ark/schema";
|
|
42
|
-
import { cached, Hkt } from "@ark/util";
|
|
43
80
|
var MergeHkt = class extends Hkt {
|
|
44
81
|
description = 'merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`';
|
|
45
82
|
};
|
|
@@ -51,35 +88,31 @@ var builtinDefinitions = {
|
|
|
51
88
|
var arkBuiltins = /* @__PURE__ */ keywordModule(builtinDefinitions, { name: "builtins" });
|
|
52
89
|
|
|
53
90
|
// out/keywords/Array.js
|
|
54
|
-
|
|
55
|
-
import { Hkt as Hkt2, liftArray } from "@ark/util";
|
|
56
|
-
var liftFromHkt = class extends Hkt2 {
|
|
91
|
+
var liftFromHkt = class extends Hkt {
|
|
57
92
|
};
|
|
58
|
-
var liftFrom = function () { return
|
|
59
|
-
const nonArrayElement = args.element.exclude(
|
|
93
|
+
var liftFrom = function () { return genericNode("element")((args) => {
|
|
94
|
+
const nonArrayElement = args.element.exclude(intrinsic.Array);
|
|
60
95
|
const lifted = nonArrayElement.array();
|
|
61
96
|
return nonArrayElement.rawOr(lifted).pipe(liftArray).distribute((branch) => branch.assertIs("morph").declareOut(lifted), rootSchema);
|
|
62
97
|
}, liftFromHkt) };
|
|
63
98
|
var arkArray = keywordModule({
|
|
64
|
-
root: () =>
|
|
99
|
+
root: () => intrinsic.Array,
|
|
65
100
|
readonly: "root",
|
|
66
|
-
index: () =>
|
|
101
|
+
index: () => intrinsic.nonNegativeIntegerString,
|
|
67
102
|
liftFrom
|
|
68
103
|
}, {
|
|
69
104
|
name: "Array"
|
|
70
105
|
});
|
|
71
106
|
|
|
72
107
|
// out/keywords/FormData.js
|
|
73
|
-
|
|
74
|
-
import { cached as cached2, registry } from "@ark/util";
|
|
75
|
-
var value = cached2(function () { return node("union", {
|
|
108
|
+
var value = cached(function () { return node("union", {
|
|
76
109
|
branches: [
|
|
77
110
|
node("domain", { domain: "string" }),
|
|
78
111
|
node("proto", { proto: registry.FileConstructor })
|
|
79
112
|
]
|
|
80
113
|
}) });
|
|
81
114
|
var parsedFormDataValue = () => value().rawOr(value().array());
|
|
82
|
-
var parsed =
|
|
115
|
+
var parsed = cached(function () { return node("intersection", {
|
|
83
116
|
meta: keywordMeta("FormData.parsed"),
|
|
84
117
|
domain: node("domain", { domain: "object" }),
|
|
85
118
|
structure: node("structure", {
|
|
@@ -104,7 +137,6 @@ var arkFormData = keywordModule({
|
|
|
104
137
|
});
|
|
105
138
|
|
|
106
139
|
// out/keywords/TypedArray.js
|
|
107
|
-
import { flatMorph, typedArrayConstructors } from "@ark/util";
|
|
108
140
|
var TypedArray = keywordModule(flatMorph(typedArrayConstructors, (k, constructor) => [
|
|
109
141
|
k.slice(0, -"Array".length),
|
|
110
142
|
["instanceof", constructor]
|
|
@@ -113,8 +145,6 @@ var TypedArray = keywordModule(flatMorph(typedArrayConstructors, (k, constructor
|
|
|
113
145
|
});
|
|
114
146
|
|
|
115
147
|
// out/keywords/constructors.js
|
|
116
|
-
import { writeUnresolvableMessage } from "@ark/schema";
|
|
117
|
-
import { ecmascriptConstructors, platformConstructors, throwParseError, typedArrayConstructors as typedArrayConstructors2 } from "@ark/util";
|
|
118
148
|
var omittedPrototypes = {
|
|
119
149
|
Boolean: 1,
|
|
120
150
|
Number: 1,
|
|
@@ -124,7 +154,7 @@ var instanceOfDefinitions = {};
|
|
|
124
154
|
for (const constructors of [
|
|
125
155
|
ecmascriptConstructors,
|
|
126
156
|
platformConstructors,
|
|
127
|
-
|
|
157
|
+
typedArrayConstructors
|
|
128
158
|
]) {
|
|
129
159
|
for (const k in constructors) {
|
|
130
160
|
if (k in omittedPrototypes)
|
|
@@ -146,48 +176,46 @@ var arkPrototypes = /* @__PURE__ */ keywordModule(prototypeDefinitions, {
|
|
|
146
176
|
});
|
|
147
177
|
|
|
148
178
|
// out/keywords/number.js
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
var epoch = cached3(function () { return node2("intersection", {
|
|
152
|
-
domain: node2("domain", {
|
|
179
|
+
var epoch = cached(function () { return node("intersection", {
|
|
180
|
+
domain: node("domain", {
|
|
153
181
|
domain: "number",
|
|
154
182
|
meta: {
|
|
155
183
|
description: epochDescriptions.domain,
|
|
156
184
|
keyword: "number.epoch"
|
|
157
185
|
}
|
|
158
186
|
}),
|
|
159
|
-
divisor:
|
|
187
|
+
divisor: node("divisor", {
|
|
160
188
|
rule: 1,
|
|
161
189
|
meta: {
|
|
162
190
|
description: `an integer representing a Unix timestamp`,
|
|
163
191
|
keyword: "number.epoch"
|
|
164
192
|
}
|
|
165
193
|
}),
|
|
166
|
-
min:
|
|
194
|
+
min: node("min", {
|
|
167
195
|
rule: -maxEpoch,
|
|
168
196
|
meta: { description: epochDescriptions.min, keyword: "number.epoch" }
|
|
169
197
|
}),
|
|
170
|
-
max:
|
|
198
|
+
max: node("max", {
|
|
171
199
|
rule: maxEpoch,
|
|
172
200
|
meta: { description: epochDescriptions.max, keyword: "number.epoch" }
|
|
173
201
|
}),
|
|
174
202
|
meta: keywordMeta("number.epoch")
|
|
175
203
|
}) });
|
|
176
|
-
var integer =
|
|
177
|
-
domain:
|
|
178
|
-
divisor:
|
|
204
|
+
var integer = cached(() => node("intersection", {
|
|
205
|
+
domain: node("domain", { domain: "number" }),
|
|
206
|
+
divisor: node("divisor", { rule: 1 })
|
|
179
207
|
}));
|
|
180
208
|
var number = keywordModule({
|
|
181
|
-
root: () =>
|
|
209
|
+
root: () => intrinsic.number,
|
|
182
210
|
integer,
|
|
183
211
|
epoch,
|
|
184
|
-
safe: function () { return
|
|
185
|
-
domain:
|
|
212
|
+
safe: function () { return node("intersection", {
|
|
213
|
+
domain: node("domain", {
|
|
186
214
|
domain: "number",
|
|
187
215
|
numberAllowsNaN: false
|
|
188
216
|
}),
|
|
189
|
-
min:
|
|
190
|
-
max:
|
|
217
|
+
min: node("min", { rule: Number.MIN_SAFE_INTEGER }),
|
|
218
|
+
max: node("max", { rule: Number.MAX_SAFE_INTEGER })
|
|
191
219
|
}) },
|
|
192
220
|
NaN: ["===", Number.NaN],
|
|
193
221
|
Infinity: ["===", Number.POSITIVE_INFINITY],
|
|
@@ -197,34 +225,38 @@ var number = keywordModule({
|
|
|
197
225
|
});
|
|
198
226
|
|
|
199
227
|
// out/keywords/string.js
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
var regexStringNode = function (regex2, alias, annotations) { return node3("intersection", {
|
|
203
|
-
domain: node3("domain", { domain: "string" }),
|
|
228
|
+
var regexStringNode = function (regex2, alias, annotations) { return node("intersection", {
|
|
229
|
+
domain: node("domain", { domain: "string" }),
|
|
204
230
|
pattern: [
|
|
205
|
-
|
|
231
|
+
node("pattern", {
|
|
206
232
|
...constraintInputOf("pattern", regex2),
|
|
207
233
|
meta: { ...keywordMeta(alias), ...annotations }
|
|
208
234
|
})
|
|
209
235
|
],
|
|
210
236
|
...annotations && { meta: annotations }
|
|
211
237
|
}) };
|
|
212
|
-
var predicateStringNode = function (predicate, alias, jsonSchema, meta) { return
|
|
213
|
-
domain:
|
|
238
|
+
var predicateStringNode = function (predicate, alias, jsonSchema, meta) { return node("intersection", {
|
|
239
|
+
domain: node("domain", { domain: "string" }),
|
|
214
240
|
predicate: [
|
|
215
|
-
|
|
241
|
+
node("predicate", {
|
|
216
242
|
meta: jsonSchema ? { ...keywordMeta(alias), jsonSchema } : keywordMeta(alias),
|
|
217
243
|
predicate
|
|
218
244
|
})
|
|
219
245
|
],
|
|
220
246
|
...meta && { meta }
|
|
221
247
|
}) };
|
|
222
|
-
var stringIntegerRoot =
|
|
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
|
+
}) });
|
|
223
255
|
var stringInteger = keywordModule({
|
|
224
256
|
root: stringIntegerRoot,
|
|
225
|
-
parse: () =>
|
|
257
|
+
parse: () => node("morph", {
|
|
226
258
|
morphs: [stringIntegerRoot(), parseInteger],
|
|
227
|
-
declaredOut:
|
|
259
|
+
declaredOut: safeInteger()
|
|
228
260
|
})
|
|
229
261
|
}, {
|
|
230
262
|
name: "string.integer"
|
|
@@ -236,10 +268,10 @@ var base64 = keywordModule({
|
|
|
236
268
|
}, {
|
|
237
269
|
name: "string.base64"
|
|
238
270
|
});
|
|
239
|
-
var preformattedCapitalize =
|
|
271
|
+
var preformattedCapitalize = cached(() => regexStringNode(/^(?:[^a-z][\S\s]*)?$/, "string.capitalize.preformatted"));
|
|
240
272
|
var capitalize = keywordModule({
|
|
241
|
-
root: () =>
|
|
242
|
-
morphs: [
|
|
273
|
+
root: () => node("morph", {
|
|
274
|
+
morphs: [intrinsic.string, capitalizeString],
|
|
243
275
|
declaredOut: preformattedCapitalize()
|
|
244
276
|
}),
|
|
245
277
|
preformatted: preformattedCapitalize
|
|
@@ -247,16 +279,16 @@ var capitalize = keywordModule({
|
|
|
247
279
|
name: "string.capitalize"
|
|
248
280
|
});
|
|
249
281
|
var creditCardMatcher = /^(?:4\d{12}(?:\d{3,6})?|(?:5[1-5]|6[27])\d{14}|(?:222[1-9]|22[3-9]\d|2[3-6]\d\d|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|81\d{14,17})$/;
|
|
250
|
-
var creditCard =
|
|
251
|
-
domain:
|
|
282
|
+
var creditCard = cached(function () { return node("intersection", {
|
|
283
|
+
domain: node("domain", { domain: "string" }),
|
|
252
284
|
pattern: [
|
|
253
|
-
|
|
285
|
+
node("pattern", {
|
|
254
286
|
meta: keywordMeta("string.creditCard"),
|
|
255
287
|
rule: creditCardMatcher.source
|
|
256
288
|
})
|
|
257
289
|
],
|
|
258
290
|
predicate: [
|
|
259
|
-
|
|
291
|
+
node("predicate", {
|
|
260
292
|
meta: keywordMeta("string.creditCard"),
|
|
261
293
|
predicate: isLuhnValid
|
|
262
294
|
})
|
|
@@ -290,38 +322,38 @@ var tryParseDatePattern = function (data, opts) {
|
|
|
290
322
|
return date;
|
|
291
323
|
return writeFormattedExpected(opts.format);
|
|
292
324
|
};
|
|
293
|
-
var parsableDate =
|
|
294
|
-
var epochRoot =
|
|
325
|
+
var parsableDate = cached(() => predicateStringNode(isParsableDate, "string.date", { format: "date-time" }));
|
|
326
|
+
var epochRoot = cached(function () { return stringInteger.root.internal.rawConstrain("predicate", {
|
|
295
327
|
meta: keywordMeta("string.date.epoch"),
|
|
296
328
|
predicate: isEpochString
|
|
297
329
|
}).configure(keywordMeta("string.date.epoch"), "self").assertIs("intersection") });
|
|
298
330
|
var epoch2 = keywordModule({
|
|
299
331
|
root: epochRoot,
|
|
300
|
-
parse: () =>
|
|
332
|
+
parse: () => node("morph", {
|
|
301
333
|
morphs: [epochRoot(), parseEpoch],
|
|
302
|
-
declaredOut:
|
|
334
|
+
declaredOut: intrinsic.Date
|
|
303
335
|
})
|
|
304
336
|
}, {
|
|
305
337
|
name: "string.date.epoch"
|
|
306
338
|
});
|
|
307
|
-
var isoRoot =
|
|
339
|
+
var isoRoot = cached(() => regexStringNode(iso8601Matcher, "string.date.iso", {
|
|
308
340
|
format: "date-time"
|
|
309
341
|
}).internal.assertIs("intersection"));
|
|
310
342
|
var iso = keywordModule({
|
|
311
343
|
root: isoRoot,
|
|
312
|
-
parse: () =>
|
|
344
|
+
parse: () => node("morph", {
|
|
313
345
|
morphs: [isoRoot(), parseIsoDate],
|
|
314
|
-
declaredOut:
|
|
346
|
+
declaredOut: intrinsic.Date
|
|
315
347
|
})
|
|
316
348
|
}, {
|
|
317
349
|
name: "string.date.iso"
|
|
318
350
|
});
|
|
319
351
|
var stringDate = keywordModule({
|
|
320
352
|
root: parsableDate,
|
|
321
|
-
parse: function () { return
|
|
353
|
+
parse: function () { return node("morph", {
|
|
322
354
|
declaredIn: parsableDate(),
|
|
323
|
-
morphs: [
|
|
324
|
-
declaredOut:
|
|
355
|
+
morphs: [intrinsic.string, parseDate],
|
|
356
|
+
declaredOut: intrinsic.Date
|
|
325
357
|
}) },
|
|
326
358
|
iso,
|
|
327
359
|
epoch: epoch2
|
|
@@ -347,18 +379,18 @@ var ip = keywordModule({
|
|
|
347
379
|
var jsonRoot = function () { return predicateStringNode(isJsonString, "string.json", { type: "string", contentMediaType: "application/json" }, keywordMeta("string.json")) };
|
|
348
380
|
var json = keywordModule({
|
|
349
381
|
root: jsonRoot,
|
|
350
|
-
parse: function () { return
|
|
351
|
-
meta: "
|
|
352
|
-
morphs: [
|
|
353
|
-
declaredOut:
|
|
382
|
+
parse: function () { return node("morph", {
|
|
383
|
+
meta: keywordMeta("string.json.parse"),
|
|
384
|
+
morphs: [intrinsic.string, parseJson],
|
|
385
|
+
declaredOut: intrinsic.jsonData
|
|
354
386
|
}) }
|
|
355
387
|
}, {
|
|
356
388
|
name: "string.json"
|
|
357
389
|
});
|
|
358
|
-
var preformattedLower =
|
|
390
|
+
var preformattedLower = cached(() => regexStringNode(/^[^A-Z]*$/, "string.lower.preformatted"));
|
|
359
391
|
var lower = keywordModule({
|
|
360
|
-
root: () =>
|
|
361
|
-
morphs: [
|
|
392
|
+
root: () => node("morph", {
|
|
393
|
+
morphs: [intrinsic.string, lowercaseString],
|
|
362
394
|
declaredOut: preformattedLower()
|
|
363
395
|
}),
|
|
364
396
|
preformatted: preformattedLower
|
|
@@ -366,12 +398,12 @@ var lower = keywordModule({
|
|
|
366
398
|
name: "string.lower"
|
|
367
399
|
});
|
|
368
400
|
var normalizedForms = ["NFC", "NFD", "NFKC", "NFKD"];
|
|
369
|
-
var preformattedNodes =
|
|
401
|
+
var preformattedNodes = flatMorph(normalizedForms, function (i, form) { return [
|
|
370
402
|
form,
|
|
371
|
-
|
|
372
|
-
domain:
|
|
403
|
+
cached(() => node("intersection", {
|
|
404
|
+
domain: node("domain", { domain: "string" }),
|
|
373
405
|
predicate: [
|
|
374
|
-
|
|
406
|
+
node("predicate", {
|
|
375
407
|
meta: keywordMeta(`string.normalize.${form}.preformatted`),
|
|
376
408
|
predicate: normalizationsByForm[form].predicate
|
|
377
409
|
})
|
|
@@ -379,10 +411,10 @@ var preformattedNodes = flatMorph2(normalizedForms, function (i, form) { return
|
|
|
379
411
|
meta: keywordMeta(`string.normalize.${form}.preformatted`)
|
|
380
412
|
}))
|
|
381
413
|
] });
|
|
382
|
-
var normalizeNodes =
|
|
414
|
+
var normalizeNodes = flatMorph(normalizedForms, function (i, form) { return [
|
|
383
415
|
form,
|
|
384
|
-
() =>
|
|
385
|
-
morphs: [
|
|
416
|
+
() => node("morph", {
|
|
417
|
+
morphs: [intrinsic.string, normalizationsByForm[form].morphs],
|
|
386
418
|
declaredOut: preformattedNodes[form]()
|
|
387
419
|
})
|
|
388
420
|
] });
|
|
@@ -419,15 +451,15 @@ var normalize = keywordModule({
|
|
|
419
451
|
}, {
|
|
420
452
|
name: "string.normalize"
|
|
421
453
|
});
|
|
422
|
-
var numericRoot =
|
|
454
|
+
var numericRoot = cached(() => regexStringNode(numericStringMatcher, "string.numeric"));
|
|
423
455
|
var stringNumeric = keywordModule({
|
|
424
456
|
root: numericRoot,
|
|
425
457
|
parse: function () {
|
|
426
458
|
const root = numericRoot();
|
|
427
|
-
const input = $ark.cfg.numberAllowsInfinity ? root :
|
|
459
|
+
const input = $ark.cfg.numberAllowsInfinity ? root : node("intersection", {
|
|
428
460
|
...root.inner,
|
|
429
461
|
predicate: [
|
|
430
|
-
|
|
462
|
+
node("predicate", {
|
|
431
463
|
predicate: parsesFinite,
|
|
432
464
|
// JSON Schema can't say it, so the pattern stands for it
|
|
433
465
|
meta: {
|
|
@@ -437,9 +469,9 @@ var stringNumeric = keywordModule({
|
|
|
437
469
|
})
|
|
438
470
|
]
|
|
439
471
|
});
|
|
440
|
-
return
|
|
472
|
+
return node("morph", {
|
|
441
473
|
morphs: [input, parseNumeric],
|
|
442
|
-
declaredOut:
|
|
474
|
+
declaredOut: intrinsic.number
|
|
443
475
|
});
|
|
444
476
|
}
|
|
445
477
|
}, {
|
|
@@ -448,40 +480,40 @@ var stringNumeric = keywordModule({
|
|
|
448
480
|
var regex = () => predicateStringNode(isRegexPattern, "string.regex", { format: "regex" });
|
|
449
481
|
var semverMatcher = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/;
|
|
450
482
|
var semver = () => regexStringNode(semverMatcher, "string.semver");
|
|
451
|
-
var preformattedTrim =
|
|
483
|
+
var preformattedTrim = cached(() => regexStringNode(
|
|
452
484
|
// no leading or trailing whitespace
|
|
453
485
|
/^\S[\S\s]*\S$|^\S?$/,
|
|
454
486
|
"string.trim.preformatted"
|
|
455
487
|
));
|
|
456
488
|
var trim = keywordModule({
|
|
457
|
-
root: () =>
|
|
458
|
-
morphs: [
|
|
489
|
+
root: () => node("morph", {
|
|
490
|
+
morphs: [intrinsic.string, trimString],
|
|
459
491
|
declaredOut: preformattedTrim()
|
|
460
492
|
}),
|
|
461
493
|
preformatted: preformattedTrim
|
|
462
494
|
}, {
|
|
463
495
|
name: "string.trim"
|
|
464
496
|
});
|
|
465
|
-
var preformattedUpper =
|
|
497
|
+
var preformattedUpper = cached(() => regexStringNode(/^[^a-z]*$/, "string.upper.preformatted"));
|
|
466
498
|
var upper = keywordModule({
|
|
467
|
-
root: () =>
|
|
468
|
-
morphs: [
|
|
499
|
+
root: () => node("morph", {
|
|
500
|
+
morphs: [intrinsic.string, uppercaseString],
|
|
469
501
|
declaredOut: preformattedUpper()
|
|
470
502
|
}),
|
|
471
503
|
preformatted: preformattedUpper
|
|
472
504
|
}, {
|
|
473
505
|
name: "string.upper"
|
|
474
506
|
});
|
|
475
|
-
var urlRoot =
|
|
507
|
+
var urlRoot = cached(function () { return (
|
|
476
508
|
// URL.canParse and RFC 3986 differ only at the edges, e.g. a space in a path
|
|
477
509
|
predicateStringNode(isParsableUrl, "string.url", { format: "uri" })
|
|
478
510
|
) });
|
|
479
511
|
var url = keywordModule({
|
|
480
512
|
root: urlRoot,
|
|
481
|
-
parse: function () { return
|
|
513
|
+
parse: function () { return node("morph", {
|
|
482
514
|
declaredIn: urlRoot(),
|
|
483
|
-
morphs: [
|
|
484
|
-
declaredOut:
|
|
515
|
+
morphs: [intrinsic.string, parseUrl],
|
|
516
|
+
declaredOut: node("proto", { proto: URL })
|
|
485
517
|
}) }
|
|
486
518
|
}, {
|
|
487
519
|
name: "string.url"
|
|
@@ -494,7 +526,7 @@ var uuid = keywordModule({
|
|
|
494
526
|
"@",
|
|
495
527
|
{ ...keywordMeta("string.uuid"), format: "uuid" }
|
|
496
528
|
],
|
|
497
|
-
...
|
|
529
|
+
...flatMorph(uuidVersions, function (i, version) { return [
|
|
498
530
|
`v${version}`,
|
|
499
531
|
() => regexStringNode(new RegExp(`^[\\dA-Fa-f]{8}-[\\dA-Fa-f]{4}-${version}[\\dA-Fa-f]{3}-[89ABab][\\dA-Fa-f]{3}-[\\dA-Fa-f]{12}$`), `string.uuid.v${version}`, { format: "uuid" })
|
|
500
532
|
] })
|
|
@@ -502,7 +534,7 @@ var uuid = keywordModule({
|
|
|
502
534
|
name: "string.uuid"
|
|
503
535
|
});
|
|
504
536
|
var string = keywordModule({
|
|
505
|
-
root: () =>
|
|
537
|
+
root: () => intrinsic.string,
|
|
506
538
|
alpha: () => regexStringNode(/^[A-Za-z]*$/, "string.alpha"),
|
|
507
539
|
alphanumeric: () => regexStringNode(/^[\dA-Za-z]*$/, "string.alphanumeric"),
|
|
508
540
|
hex,
|
|
@@ -530,8 +562,6 @@ var string = keywordModule({
|
|
|
530
562
|
});
|
|
531
563
|
|
|
532
564
|
// out/keywords/keywords.js
|
|
533
|
-
import { RootModule } from "@ark/schema";
|
|
534
|
-
import { defineLazily, defineProperties } from "@ark/util";
|
|
535
565
|
var ark = new InternalScope({
|
|
536
566
|
...tsKeywordDefinitions,
|
|
537
567
|
...tsGenericDefinitions,
|
|
@@ -595,7 +625,6 @@ export {
|
|
|
595
625
|
epoch,
|
|
596
626
|
integer,
|
|
597
627
|
number,
|
|
598
|
-
iso8601Matcher,
|
|
599
628
|
regexStringNode,
|
|
600
629
|
stringInteger,
|
|
601
630
|
capitalize,
|