arktype 2.2.10 → 3.0.0-beta.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.
- package/README.md +181 -15
- package/out/attributes.d.ts +50 -14
- package/out/checkers.d.ts +172 -0
- package/out/chunk-2U2AWCI3.js +626 -0
- package/out/chunk-4CUA5XIP.js +7 -0
- package/out/chunk-5U2ZMDNI.js +1566 -0
- package/out/chunk-DLWCO4RV.js +18 -0
- package/out/chunk-E3DZXEZK.js +72 -0
- package/out/chunk-EVCML554.js +47 -0
- package/out/chunk-G45P2CLE.js +63 -0
- package/out/chunk-GPNK5353.js +2529 -0
- package/out/chunk-MLKGABMK.js +9 -0
- package/out/chunk-NRIGTMPM.js +7 -0
- package/out/chunk-PRTMQCHS.js +3 -0
- package/out/chunk-R5G57XC7.js +7 -0
- package/out/chunk-RAZ3TXOE.js +313 -0
- package/out/chunk-SWOOCAHN.js +4 -0
- package/out/chunk-TAHPKDNM.js +3 -0
- package/out/chunk-UETB6YE2.js +14 -0
- package/out/chunk-UK5UGFOX.js +254 -0
- package/out/chunk-VV6YDN2D.js +6118 -0
- package/out/codecs.d.ts +21 -0
- package/out/codecs.js +7 -0
- package/out/config.d.ts +8 -3
- package/out/config.js +2 -3
- package/out/declare.d.ts +17 -3
- package/out/deferred.d.ts +10 -0
- package/out/errors.d.ts +1 -0
- package/out/errors.js +2 -0
- package/out/fn.d.ts +1 -1
- package/out/generic.d.ts +3 -3
- package/out/i18n.d.ts +2 -0
- package/out/i18n.js +2 -0
- package/out/index.d.ts +5 -4
- package/out/index.js +8 -9
- package/out/internal.d.ts +70 -0
- package/out/internal.js +17 -0
- package/out/island.d.ts +2 -0
- package/out/island.js +6 -0
- package/out/islandDependency.d.ts +2 -0
- package/out/islandDependency.js +18 -0
- package/out/keywords/Array.d.ts +2 -2
- package/out/keywords/builtins.d.ts +5 -3
- package/out/keywords/constructors.d.ts +9 -1
- package/out/keywords/functions.d.ts +254 -0
- package/out/keywords/keywords.d.ts +8 -9
- package/out/keywords/number.d.ts +2 -8
- package/out/keywords/phrases.d.ts +245 -0
- package/out/keywords/string.d.ts +14 -113
- package/out/keywords/ts.d.ts +35 -33
- package/out/keywords/ts.js +4 -82
- package/out/locale.d.ts +19 -0
- package/out/locales/de.d.ts +2 -0
- package/out/locales/de.js +2 -0
- package/out/locales/en.d.ts +4 -0
- package/out/locales/en.js +5 -0
- package/out/match.d.ts +6 -6
- package/out/module.d.ts +1 -1
- package/out/mutatesInput.js +3 -0
- package/out/parser/ast/generic.d.ts +6 -3
- package/out/parser/ast/infer.d.ts +1 -1
- package/out/parser/ast/validate.d.ts +11 -6
- package/out/parser/definition.d.ts +68 -7
- package/out/parser/objectLiteral.d.ts +40 -12
- package/out/parser/property.d.ts +3 -5
- package/out/parser/reduce/dynamic.d.ts +16 -7
- package/out/parser/reduce/shared.d.ts +4 -0
- package/out/parser/reduce/static.d.ts +13 -13
- package/out/parser/shift/operand/date.d.ts +0 -5
- package/out/parser/shift/operand/operand.d.ts +2 -1
- package/out/parser/shift/operand/unenclosed.d.ts +9 -6
- package/out/parser/shift/operand/unresolvable.d.ts +68 -0
- package/out/parser/shift/operator/bounds.d.ts +9 -4
- package/out/parser/shift/operator/brand.d.ts +2 -2
- package/out/parser/shift/operator/default.d.ts +2 -2
- package/out/parser/shift/operator/divisor.d.ts +2 -2
- package/out/parser/shift/operator/operator.d.ts +1 -1
- package/out/parser/shift/tokens.d.ts +9 -2
- package/out/parser/string.d.ts +61 -7
- package/out/parser/tupleExpressions.d.ts +7 -3
- package/out/precompiled.d.ts +1 -0
- package/out/precompiled.js +2 -0
- package/out/runtime.d.ts +181 -0
- package/out/runtime.js +4 -0
- package/out/runtimeDevelopment.d.ts +1 -0
- package/out/runtimeDevelopment.js +133 -0
- package/out/runtimeExports.d.ts +1 -0
- package/out/scope.d.ts +40 -11
- package/out/standalone/artifact.d.ts +265 -0
- package/out/standalone/baking.d.ts +201 -0
- package/out/standalone/combinators.d.ts +13 -0
- package/out/standalone/compilers.d.ts +23 -0
- package/out/standalone/creators.d.ts +41 -0
- package/out/standalone/fallbacks.d.ts +48 -0
- package/out/standalone/keys.d.ts +31 -0
- package/out/standalone/modules.d.ts +26 -0
- package/out/standalone/sites.d.ts +52 -0
- package/out/standalone/units.d.ts +31 -0
- package/out/standalone/values.d.ts +60 -0
- package/out/standalone.d.ts +16 -0
- package/out/type.d.ts +45 -6
- package/out/variants/array.d.ts +1 -1
- package/out/variants/base.d.ts +47 -27
- package/out/variants/date.d.ts +1 -1
- package/out/variants/instantiate.d.ts +4 -2
- package/out/variants/number.d.ts +1 -1
- package/out/variants/object.d.ts +17 -12
- package/out/variants/string.d.ts +1 -1
- package/package.json +169 -8
- package/skills/arktype/SKILL.md +278 -43
- package/skills/arktype/references/migrating.md +1296 -0
- package/skills/arktype/references/precompile.md +191 -0
- package/out/attributes.js +0 -3
- package/out/fn.js +0 -58
- package/out/generic.js +0 -37
- package/out/keywords/Array.js +0 -21
- package/out/keywords/FormData.js +0 -40
- package/out/keywords/TypedArray.js +0 -16
- package/out/keywords/builtins.js +0 -11
- package/out/keywords/constructors.js +0 -16
- package/out/keywords/keywords.js +0 -48
- package/out/keywords/number.js +0 -49
- package/out/keywords/string.js +0 -467
- package/out/match.js +0 -95
- package/out/module.js +0 -3
- package/out/nary.js +0 -1
- package/out/parser/ast/bounds.js +0 -1
- package/out/parser/ast/default.js +0 -1
- package/out/parser/ast/divisor.js +0 -1
- package/out/parser/ast/generic.js +0 -1
- package/out/parser/ast/infer.js +0 -1
- package/out/parser/ast/keyof.js +0 -1
- package/out/parser/ast/utils.js +0 -1
- package/out/parser/ast/validate.js +0 -3
- package/out/parser/definition.js +0 -78
- package/out/parser/objectLiteral.js +0 -113
- package/out/parser/property.js +0 -16
- package/out/parser/reduce/dynamic.js +0 -153
- package/out/parser/reduce/shared.js +0 -25
- package/out/parser/reduce/static.js +0 -1
- package/out/parser/shift/operand/date.js +0 -23
- package/out/parser/shift/operand/enclosed.js +0 -82
- package/out/parser/shift/operand/genericArgs.js +0 -16
- package/out/parser/shift/operand/operand.js +0 -16
- package/out/parser/shift/operand/unenclosed.js +0 -59
- package/out/parser/shift/operator/bounds.js +0 -91
- package/out/parser/shift/operator/brand.js +0 -6
- package/out/parser/shift/operator/default.js +0 -29
- package/out/parser/shift/operator/divisor.js +0 -13
- package/out/parser/shift/operator/operator.js +0 -28
- package/out/parser/shift/tokens.js +0 -37
- package/out/parser/string.js +0 -42
- package/out/parser/tupleExpressions.js +0 -75
- package/out/parser/tupleLiteral.js +0 -128
- package/out/scope.js +0 -106
- package/out/type.js +0 -55
- package/out/variants/array.js +0 -1
- package/out/variants/base.js +0 -1
- package/out/variants/date.js +0 -1
- package/out/variants/instantiate.js +0 -1
- package/out/variants/number.js +0 -1
- package/out/variants/object.js +0 -1
- package/out/variants/string.js +0 -1
- /package/out/{declare.js → mutatesInput.d.ts} +0 -0
|
@@ -0,0 +1,1566 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InternalTypedFn
|
|
3
|
+
} from "./chunk-G45P2CLE.js";
|
|
4
|
+
|
|
5
|
+
// out/runtime.js
|
|
6
|
+
import { ArkErrors as ArkErrors2, codedIssue, describeActual, enInfo, errorsOf, failsKey, failsKeySite, failsSite, findsOnRead, FirstIssues, holdsExpression, isCustomIssue, issueAt, issuesOf, mergeIssues, runtimeConfig as runtimeConfig2, sharedMessageOf, supportedJsonSchemaTargets, throwOnDefault, traversesUnions, validateStandardJsonSchemaTarget, writeFromPath, writeListed } from "@ark/schema/runtime";
|
|
7
|
+
import { dateGetTime, getBuiltinNameOfConstructor, hasDomain, printable, prototypeOf, stringifyPath, throwError, throwParseError } from "@ark/util";
|
|
8
|
+
import { addErrors, addMorphErrs, allowsInBranchBy, allowsInContext, allowsUntracked, appliesValues, ArkErrors, copyOf, describePredicate, discriminatesBooleans, enterApplied, exitApplied, failsInBranches, pipeApplied, pipeChecked, pipeTransformed, runtimeConfig, runtimeScope, silentCtx, TransformErrors, transformed, transformedInApply, transformIfAllowed, transformResolution, transformsBranches, transformsValid } from "@ark/schema/runtime";
|
|
9
|
+
export { aliasVisits, allowsAcyclic, allowsInBranch, applyCyclic, applyIssues, applyRejected, arrayIndexMatcher, callMorph, codedIssue, computeDefaultValueMorph, configure, configuredFallbackOf, configuredWriterOf, copyDeclared, alikeIssue, describeCollapsibleDate, disallowed, enInfo, enterResolution, execMorph, exitResolution, failsKey, failsKeySite, failsSite, FirstIssues, FirstIssueTraversal, fixConfig, foundErrors, fixConfigured, holdsOnlyIndices, keepOwn, InternalTraversal, listedIssue, matchesRepeated, mergeTransformed, missingTextOf, pipe, printKind, rejected, rejects, throwIssues, throwOnDefault, Traversal, TraversalError, tryMorph, writeDomainActual, writeLengthActual, writeMessage, writeNotEqualActual, writeProtoActual, writeNullableJsonSchema, writeUnionJsonSchema, writeUnitActual, writeUnitMessage } from "@ark/schema/runtime";
|
|
10
|
+
export { baseNameOf, functionNameOf, isIpv4, isIpv6, isIso8601, isNumericString, isPlainObjectOrArray, isUuid, isValidDate, isWellFormedInteger, jsTypeOfDescriptions, liftArray, ParseError, printable, throwParseError, timeOf } from "@ark/util";
|
|
11
|
+
|
|
12
|
+
// out/checkers.js
|
|
13
|
+
import { listedIssue } from "@ark/schema/runtime";
|
|
14
|
+
import { hasOwn } from "@ark/util";
|
|
15
|
+
var transformedBy = ({ t }, data, ctx) => !t ? data : t.c ? t(data, ctx) : t(data);
|
|
16
|
+
var holdingMorphs = (t, held) => {
|
|
17
|
+
for (const checker of held) {
|
|
18
|
+
t.e ??= checker.t?.e;
|
|
19
|
+
t.c ??= checker.t?.c;
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
var check = ((code, description, test) => {
|
|
24
|
+
const checker = ((data, ctx) => test(data) || !failsAt(ctx, checker, data));
|
|
25
|
+
checker.code = code;
|
|
26
|
+
checker.description = description;
|
|
27
|
+
checker.test = test;
|
|
28
|
+
return checker;
|
|
29
|
+
});
|
|
30
|
+
var narrowedBy = ((read, description) => {
|
|
31
|
+
const checker = (data, ctx) => (
|
|
32
|
+
// `allows` answers this, and a narrow cast to return a boolean may not
|
|
33
|
+
!!read()(data) || !failsAt(ctx, siteOf("predicate", description ?? describePredicate({ predicate: read() })), data)
|
|
34
|
+
);
|
|
35
|
+
checker.description = description;
|
|
36
|
+
return checker;
|
|
37
|
+
});
|
|
38
|
+
var reportedBy = (read, description, data, ctx) => {
|
|
39
|
+
const errN = ctx.errN;
|
|
40
|
+
if (!read()(data, ctx) && ctx.errN === errN) {
|
|
41
|
+
return !failsAt(ctx, siteOf("predicate", description ?? describePredicate({ predicate: read() })), data);
|
|
42
|
+
}
|
|
43
|
+
return !ctx.failFast || ctx.errN === errN;
|
|
44
|
+
};
|
|
45
|
+
var narrowedWithCtx = ((read, description) => {
|
|
46
|
+
const checker = (data, ctx) => ctx?._e && ctx._e !== stops ? reportedBy(read, description, data, ctx) : !!read()(data, silentCtx);
|
|
47
|
+
checker.description = description;
|
|
48
|
+
return checker;
|
|
49
|
+
});
|
|
50
|
+
var stops = () => true;
|
|
51
|
+
var allowingCtx = (data, ctx, checker) => {
|
|
52
|
+
if (ctx._e === stops)
|
|
53
|
+
return checker(data, ctx);
|
|
54
|
+
const { chkOnly, _e, failsUnion } = ctx;
|
|
55
|
+
ctx.chkOnly = true;
|
|
56
|
+
ctx._e = ctx.failsUnion = stops;
|
|
57
|
+
const allowed = checker(data, ctx);
|
|
58
|
+
ctx._e = _e;
|
|
59
|
+
ctx.failsUnion = failsUnion;
|
|
60
|
+
ctx.chkOnly = chkOnly;
|
|
61
|
+
return allowed;
|
|
62
|
+
};
|
|
63
|
+
var readingCtx = ((checker) => {
|
|
64
|
+
const allows = (data, ctx) => allowingCtx(data, ctx, checker);
|
|
65
|
+
checker.a = (data, ctx, k) => {
|
|
66
|
+
if (k === void 0)
|
|
67
|
+
return allowsInBranchBy(ctx, allows, data);
|
|
68
|
+
ctx.path.push(k);
|
|
69
|
+
const allowed = allowsInBranchBy(ctx, allows, data);
|
|
70
|
+
ctx.path.pop();
|
|
71
|
+
return allowed;
|
|
72
|
+
};
|
|
73
|
+
return checker;
|
|
74
|
+
});
|
|
75
|
+
var allowsReadingCtx = ((checker) => (data, ctx) => typeof ctx === "object" ? allowingCtx(data, ctx, checker) : checker(data));
|
|
76
|
+
var compiled = ((node, transforms) => {
|
|
77
|
+
const checker = (data, ctx) => !ctx ? node.tAllows(data, 0) : ctx._e === stops ? node.tAllows(data, ctx) : node.tApply(data, ctx);
|
|
78
|
+
if (transforms) {
|
|
79
|
+
checker.t = (data, ctx) => node.tTransform(data, ctx);
|
|
80
|
+
checker.t.c = 1;
|
|
81
|
+
}
|
|
82
|
+
return checker;
|
|
83
|
+
});
|
|
84
|
+
var wrapping = (checker, also) => Object.assign((data, ctx) => checker(data, ctx), checker, also);
|
|
85
|
+
var resolvedBy = (node, t) => {
|
|
86
|
+
const resolved = (data, ctx) => transformResolution(ctx, node.id, data, t);
|
|
87
|
+
resolved.c = 1;
|
|
88
|
+
return resolved;
|
|
89
|
+
};
|
|
90
|
+
var aliasedValue = ((checker, node, flags) => {
|
|
91
|
+
const wrapped = wrapping(checker);
|
|
92
|
+
const enters = flags & 1;
|
|
93
|
+
wrapped.e = (ctx, _, value, k) => {
|
|
94
|
+
ctx.path.push(k);
|
|
95
|
+
const passes = ctx._e === stops ? checker(value, ctx) : node.tfs && transformIfAllowed(ctx, node, value) || (enters ? enterApplied(ctx, node.id, value) ?? exitApplied(ctx, checker(value, ctx)) : checker(value, ctx));
|
|
96
|
+
ctx.path.pop();
|
|
97
|
+
return !passes;
|
|
98
|
+
};
|
|
99
|
+
if (checker.t && flags & 2)
|
|
100
|
+
wrapped.t = resolvedBy(node, checker.t);
|
|
101
|
+
return wrapped;
|
|
102
|
+
});
|
|
103
|
+
var aliasedMember = ((checker, id) => {
|
|
104
|
+
const entered = (data, ctx) => ctx?._e && ctx._e !== stops ? enterApplied(ctx, id, data) ?? exitApplied(ctx, checker(data, ctx)) : checker(data, ctx);
|
|
105
|
+
entered.description = checker.description;
|
|
106
|
+
entered.a = checker.a;
|
|
107
|
+
if (checker.t)
|
|
108
|
+
entered.t = resolvedBy({ id }, checker.t);
|
|
109
|
+
return entered;
|
|
110
|
+
});
|
|
111
|
+
var holdingAlias = ((checker) => {
|
|
112
|
+
const node = { tAllows: allowsReadingCtx(checker) };
|
|
113
|
+
checker.a = (data) => allowsUntracked(node, data) ?? allowsInContext(node, data, runtimeConfig);
|
|
114
|
+
return checker;
|
|
115
|
+
});
|
|
116
|
+
var narrowedInCtx = ((read, description) => {
|
|
117
|
+
const checker = (data, ctx) => (
|
|
118
|
+
// one taking only data is passed no ctx where arktype only asks
|
|
119
|
+
!ctx?._e ? !!read()(data, void 0) : ctx._e === stops ? !!read()(data, ctx) : reportedBy(read, description, data, ctx)
|
|
120
|
+
);
|
|
121
|
+
checker.description = description;
|
|
122
|
+
return checker;
|
|
123
|
+
});
|
|
124
|
+
var issuesIn = (ctx) => ctx.errN ?? ctx.count;
|
|
125
|
+
var narrowedAfter = ((structure, narrowed2) => {
|
|
126
|
+
const checker = (data, ctx) => {
|
|
127
|
+
if (!ctx?._e || ctx._e === stops)
|
|
128
|
+
return structure(data, ctx) && narrowed2(data, ctx);
|
|
129
|
+
const issues = issuesIn(ctx);
|
|
130
|
+
return structure(data, ctx) && (issuesIn(ctx) > issues || narrowed2(data, ctx));
|
|
131
|
+
};
|
|
132
|
+
checker.description = structure.description;
|
|
133
|
+
return checker;
|
|
134
|
+
});
|
|
135
|
+
var transformingNarrowedAfter = ((structure, narrowed2) => {
|
|
136
|
+
const checker = (data, ctx) => !ctx?._e || ctx._e === stops ? structure(data, ctx) && narrowed2(data, ctx) : (structure.a ? structure.a(data, ctx) : structure(data)) ? narrowed2(data, ctx) : structure(data, ctx);
|
|
137
|
+
checker.t = structure.t;
|
|
138
|
+
checker.description = structure.description;
|
|
139
|
+
return checker;
|
|
140
|
+
});
|
|
141
|
+
var narrowedByEach = ((checkers) => {
|
|
142
|
+
const checker = (data, ctx) => {
|
|
143
|
+
const applies = ctx?._e && ctx._e !== stops;
|
|
144
|
+
const issues = applies && issuesIn(ctx);
|
|
145
|
+
for (const narrowed2 of checkers) {
|
|
146
|
+
if (!narrowed2(data, ctx))
|
|
147
|
+
return false;
|
|
148
|
+
if (applies && issuesIn(ctx) > issues)
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
};
|
|
153
|
+
checker.description = checkers[0].description;
|
|
154
|
+
return checker;
|
|
155
|
+
});
|
|
156
|
+
var narrowed = ((narrow, description = "valid according to an anonymous predicate") => {
|
|
157
|
+
const checker = ((data, ctx) => !!narrow(data) || !failsAt(ctx, checker, data));
|
|
158
|
+
checker.code = "predicate";
|
|
159
|
+
checker.description = description;
|
|
160
|
+
return checker;
|
|
161
|
+
});
|
|
162
|
+
function unnamed() {
|
|
163
|
+
return arguments[0];
|
|
164
|
+
}
|
|
165
|
+
var rejecting = ((passes, message) => (data, ctx) => passes(data) || ctx.reject({ message }));
|
|
166
|
+
var rejectedSiteOf = (message) => ({
|
|
167
|
+
code: "predicate",
|
|
168
|
+
description: "valid according to an anonymous predicate",
|
|
169
|
+
x: message
|
|
170
|
+
});
|
|
171
|
+
var rejectsWith = ((passes, message, description) => {
|
|
172
|
+
const site = rejectedSiteOf(message);
|
|
173
|
+
const checker = (data, ctx) => !!passes(data) || !failsAt(ctx, site, data);
|
|
174
|
+
checker.description = description;
|
|
175
|
+
return checker;
|
|
176
|
+
});
|
|
177
|
+
var narrowedRejecting = ((read, description) => {
|
|
178
|
+
const checker = (data, ctx) => !!read()(data, {
|
|
179
|
+
reject: (input) => !failsAt(ctx, rejectedSiteOf(input.message), data)
|
|
180
|
+
});
|
|
181
|
+
checker.description = description;
|
|
182
|
+
return checker;
|
|
183
|
+
});
|
|
184
|
+
var allowsOf = ((validator) => validator.allows);
|
|
185
|
+
var stringCheck = /* @__PURE__ */ check("domain", "a string", (data) => typeof data === "string");
|
|
186
|
+
var numberCheck = /* @__PURE__ */ check("domain", "a number", (data) => Number.isFinite(data));
|
|
187
|
+
var objectCheck = /* @__PURE__ */ check("domain", "an object", (data) => typeof data === "object" ? data !== null : typeof data === "function");
|
|
188
|
+
var arrayCheck = /* @__PURE__ */ check("proto", "an array", (data) => Array.isArray(data));
|
|
189
|
+
var min = ((rule, description = rule === 0 ? "non-negative" : `at least ${rule}`) => check("min", description, (data) => data >= rule));
|
|
190
|
+
var moreThan = ((rule, description = rule === 0 ? "positive" : `more than ${rule}`) => check("min", description, (data) => data > rule));
|
|
191
|
+
var max = ((rule, description = rule === 0 ? "non-positive" : `at most ${rule}`) => check("max", description, (data) => data <= rule));
|
|
192
|
+
var lessThan = ((rule, description = rule === 0 ? "negative" : `less than ${rule}`) => check("max", description, (data) => data < rule));
|
|
193
|
+
var minLength = ((rule, description = rule === 1 ? "non-empty" : `at least length ${rule}`) => check("minLength", description, (data) => data.length >= rule));
|
|
194
|
+
var maxLength = ((rule, description = `at most length ${rule}`) => check("maxLength", description, (data) => data.length <= rule));
|
|
195
|
+
var exactLength = ((rule, description = `exactly length ${rule}`) => check("exactLength", description, (data) => data.length === rule));
|
|
196
|
+
var divisor = ((rule, description = rule === 2 ? "even" : `a multiple of ${rule}`) => check("divisor", description, (data) => data % rule === 0));
|
|
197
|
+
var integerCheck = /* @__PURE__ */ check("divisor", "an integer", (data) => data % 1 === 0);
|
|
198
|
+
var pattern = ((instance, description = `matched by ${instance.source}`) => check("pattern", description, (data) => instance.test(data)));
|
|
199
|
+
var stringRange = ((max2, min2) => {
|
|
200
|
+
const tooLong = max2 === void 0 ? stringCheck : maxLength(max2);
|
|
201
|
+
const tooShort = min2 === void 0 ? stringCheck : minLength(min2);
|
|
202
|
+
const checker = (data, ctx) => typeof data !== "string" ? !failsAt(ctx, stringCheck, data) : data.length > max2 ? !failsAt(ctx, tooLong, data) : !(data.length < min2) || !failsAt(ctx, tooShort, data);
|
|
203
|
+
checker.description = stringCheck.description;
|
|
204
|
+
return checker;
|
|
205
|
+
});
|
|
206
|
+
var integerRange = ((least, most) => {
|
|
207
|
+
const tooSmall = least === void 0 ? numberCheck : min(least);
|
|
208
|
+
const tooLarge = most === void 0 ? numberCheck : max(most);
|
|
209
|
+
const checker = (data, ctx) => Number.isFinite(data) ? (data % 1 === 0 || !failsAt(ctx, integerCheck, data)) && (!(data > most) || !failsAt(ctx, tooLarge, data)) && (!(data < least) || !failsAt(ctx, tooSmall, data)) : !failsAt(ctx, numberCheck, data);
|
|
210
|
+
checker.description = numberCheck.description;
|
|
211
|
+
return checker;
|
|
212
|
+
});
|
|
213
|
+
var arrayOf = ((element, max2, min2) => {
|
|
214
|
+
const tooLong = max2 === void 0 ? arrayCheck : maxLength(max2);
|
|
215
|
+
const tooShort = min2 === void 0 ? arrayCheck : minLength(min2);
|
|
216
|
+
const within = elementsOf(element);
|
|
217
|
+
const checker = (data, ctx) => !Array.isArray(data) ? !failsAt(ctx, arrayCheck, data) : data.length > max2 ? !failsAt(ctx, tooLong, data) : data.length < min2 ? !failsAt(ctx, tooShort, data) : within(data, ctx);
|
|
218
|
+
checker.description = arrayCheck.description;
|
|
219
|
+
return checker;
|
|
220
|
+
});
|
|
221
|
+
var printValue = (value) => typeof value === "string" ? JSON.stringify(value) : `${value}`;
|
|
222
|
+
var listed = (printed) => {
|
|
223
|
+
const last = printed.pop();
|
|
224
|
+
return printed.length ? `${printed.join(", ")} or ${last}` : last;
|
|
225
|
+
};
|
|
226
|
+
var describeValues = (values) => listed(values.map(printValue));
|
|
227
|
+
var unit = ((value, description = printValue(value)) => check("unit", description, (data) => data === value));
|
|
228
|
+
var booleanChecker = /* @__PURE__ */ check("discriminant", "boolean", (data) => typeof data === "boolean");
|
|
229
|
+
var intersection = ((basis, refinements, within, brief = basis ? basis.description : "present") => {
|
|
230
|
+
const checker = (data, ctx) => {
|
|
231
|
+
if (basis && !basis.test(data))
|
|
232
|
+
return !failsAt(ctx, basis, data);
|
|
233
|
+
let passed = true;
|
|
234
|
+
for (const refinement of refinements) {
|
|
235
|
+
if (!refinement.test(data)) {
|
|
236
|
+
if (failsAt(ctx, refinement, data))
|
|
237
|
+
return false;
|
|
238
|
+
passed = false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return !passed || !within || within(data, ctx);
|
|
242
|
+
};
|
|
243
|
+
checker.description = brief;
|
|
244
|
+
checker.t = within?.t;
|
|
245
|
+
return checker;
|
|
246
|
+
});
|
|
247
|
+
var optional = ((checker, ...value) => wrapping(checker, { o: 1, d: value }));
|
|
248
|
+
var writtenBy = ((checker, write, replacesUndefined) => {
|
|
249
|
+
const wrapped = optional(checker);
|
|
250
|
+
wrapped.w = write;
|
|
251
|
+
wrapped.u = replacesUndefined;
|
|
252
|
+
return wrapped;
|
|
253
|
+
});
|
|
254
|
+
var replacingUndefined = ((checker, value) => {
|
|
255
|
+
const wrapped = optional(checker, value);
|
|
256
|
+
wrapped.u = 1;
|
|
257
|
+
return wrapped;
|
|
258
|
+
});
|
|
259
|
+
var required = ((checker, description) => wrapping(checker, { description, x: void 0 }));
|
|
260
|
+
var sayingMissing = ((checker, message, text, description = checker.description) => wrapping(checker, { description, x: message, text }));
|
|
261
|
+
var saying = ((checker, message) => {
|
|
262
|
+
const said = (data, ctx) => {
|
|
263
|
+
const at = ctx?._e;
|
|
264
|
+
if (!at || at === stops)
|
|
265
|
+
return checker(data, ctx);
|
|
266
|
+
ctx._e = (data2, code, expected) => at.call(ctx, data2, code, expected, message);
|
|
267
|
+
try {
|
|
268
|
+
return checker(data, ctx);
|
|
269
|
+
} finally {
|
|
270
|
+
ctx._e = at;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
Object.assign(said, checker);
|
|
274
|
+
said.x = message;
|
|
275
|
+
return said;
|
|
276
|
+
});
|
|
277
|
+
var failsValue = (ctx, checker, data, k, value) => ctx?._e ? appliesValues && checker.e ? checker.e(ctx, checker, value, k) : appliesValues && checker.t?.e ? checker.t.e(ctx, checker, value, k) : (!checker.t || !(appliesValues && checker.a ? (
|
|
278
|
+
// as arktype, a value reading its ctx is applied once where
|
|
279
|
+
// one only checks, as Allows does
|
|
280
|
+
!ctx.chkOnly && checker.a(value, ctx, k)
|
|
281
|
+
) : checker(value))) && ctx._k(checker, data, k) : !checker(value);
|
|
282
|
+
var props = ((declared) => {
|
|
283
|
+
const checker = (data, ctx) => {
|
|
284
|
+
if (!objectCheck.test(data))
|
|
285
|
+
return !failsAt(ctx, objectCheck, data);
|
|
286
|
+
for (const k in declared) {
|
|
287
|
+
const value = data[k];
|
|
288
|
+
if (value === void 0 && !(k in data) ? (
|
|
289
|
+
// entered by the ctx, which fails a key missing from data as
|
|
290
|
+
// required with what it's passed: what its checker holds for
|
|
291
|
+
// it, the description it expects, the message it says and
|
|
292
|
+
// what notes one that's its code's
|
|
293
|
+
!declared[k].o && (!ctx?._e || ctx._k(declared[k], data, k, declared[k].description, declared[k].x, declared[k].text))
|
|
294
|
+
) : failsValue(ctx, declared[k], data, k, value))
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
return true;
|
|
298
|
+
};
|
|
299
|
+
checker.description = objectCheck.description;
|
|
300
|
+
return checker;
|
|
301
|
+
});
|
|
302
|
+
var closedProps = ((declared, description = "removed") => {
|
|
303
|
+
const removed = siteOf("undeclared", description);
|
|
304
|
+
const walks = props(declared);
|
|
305
|
+
const checker = (data, ctx) => {
|
|
306
|
+
if (!objectCheck.test(data))
|
|
307
|
+
return !failsAt(ctx, objectCheck, data);
|
|
308
|
+
if (!walks(data, ctx))
|
|
309
|
+
return false;
|
|
310
|
+
for (const k in data) {
|
|
311
|
+
if (!hasOwn(declared, k) && hasOwn(data, k) && failsAtKey(ctx, removed, data, k))
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
return true;
|
|
315
|
+
};
|
|
316
|
+
checker.description = objectCheck.description;
|
|
317
|
+
return checker;
|
|
318
|
+
});
|
|
319
|
+
var recordOf = ((value) => {
|
|
320
|
+
const checker = (data, ctx) => {
|
|
321
|
+
if (!objectCheck.test(data))
|
|
322
|
+
return !failsAt(ctx, objectCheck, data);
|
|
323
|
+
for (const k of Object.keys(data))
|
|
324
|
+
if (failsValue(ctx, value, data, k, data[k]))
|
|
325
|
+
return false;
|
|
326
|
+
return true;
|
|
327
|
+
};
|
|
328
|
+
checker.description = objectCheck.description;
|
|
329
|
+
return checker;
|
|
330
|
+
});
|
|
331
|
+
var matchesKey = (key, k, ctx) => key.a ? key.a(k, ctx) : key(k);
|
|
332
|
+
var indexed = ((signatures, declared = {}, removed) => {
|
|
333
|
+
const site = removed === void 0 ? void 0 : siteOf("undeclared", removed);
|
|
334
|
+
const walks = props(declared);
|
|
335
|
+
const checker = (data, ctx) => {
|
|
336
|
+
if (!objectCheck.test(data))
|
|
337
|
+
return !failsAt(ctx, objectCheck, data);
|
|
338
|
+
if (!walks(data, ctx))
|
|
339
|
+
return false;
|
|
340
|
+
for (const k of [
|
|
341
|
+
...Object.keys(data),
|
|
342
|
+
...Object.getOwnPropertySymbols(data)
|
|
343
|
+
]) {
|
|
344
|
+
for (const [key, value] of signatures) {
|
|
345
|
+
if (matchesKey(key, k, ctx) && failsValue(ctx, value, data, k, data[k]))
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
if (site && typeof k === "string" && !hasOwn(declared, k) && !signatures.some(([key]) => matchesKey(key, k, ctx)) && failsAtKey(ctx, site, data, k))
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
return true;
|
|
352
|
+
};
|
|
353
|
+
checker.description = objectCheck.description;
|
|
354
|
+
return checker;
|
|
355
|
+
});
|
|
356
|
+
var holdsValue = (checker, data, k) => checker.u ? data[k] !== void 0 : k in data;
|
|
357
|
+
var writtenProps = (declared, changing, data) => {
|
|
358
|
+
let out = data;
|
|
359
|
+
for (const k in changing) {
|
|
360
|
+
const holds = k in data;
|
|
361
|
+
const defaulted = changing[k].d;
|
|
362
|
+
const value = holds ? changing[k].t?.(data[k]) : defaulted?.[0];
|
|
363
|
+
if (holds ? value !== void 0 && value !== data[k] : defaulted?.length) {
|
|
364
|
+
if (out === data)
|
|
365
|
+
out = copyOf(data);
|
|
366
|
+
out[k] = value;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (out !== data) {
|
|
370
|
+
for (const k in declared)
|
|
371
|
+
if (!(k in out) && k in data)
|
|
372
|
+
out[k] = data[k];
|
|
373
|
+
}
|
|
374
|
+
return out;
|
|
375
|
+
};
|
|
376
|
+
var isDefaulted = ({ d, w }) => !!(w || d?.length);
|
|
377
|
+
var changingIn = (declared) => {
|
|
378
|
+
const changing = {};
|
|
379
|
+
for (const k in declared) {
|
|
380
|
+
const { t, d, w } = declared[k];
|
|
381
|
+
if (t || w || d?.length)
|
|
382
|
+
changing[k] = declared[k];
|
|
383
|
+
}
|
|
384
|
+
return changing;
|
|
385
|
+
};
|
|
386
|
+
var writtenValues = (declared, changing, data, values) => {
|
|
387
|
+
let out = data;
|
|
388
|
+
let defaults = false;
|
|
389
|
+
for (const k in changing) {
|
|
390
|
+
const checker = changing[k];
|
|
391
|
+
if (!holdsValue(checker, data, k)) {
|
|
392
|
+
defaults ||= isDefaulted(checker);
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (!checker.t)
|
|
396
|
+
continue;
|
|
397
|
+
const value = values.transformed(checker.t, data[k], k);
|
|
398
|
+
if (Object.is(value, data[k]))
|
|
399
|
+
continue;
|
|
400
|
+
if (out === data)
|
|
401
|
+
out = copyOf(data);
|
|
402
|
+
out[k] = value;
|
|
403
|
+
}
|
|
404
|
+
if (defaults && !values.failed()) {
|
|
405
|
+
for (const k in changing) {
|
|
406
|
+
const checker = changing[k];
|
|
407
|
+
if (holdsValue(checker, data, k) || !isDefaulted(checker))
|
|
408
|
+
continue;
|
|
409
|
+
if (out === data)
|
|
410
|
+
out = copyOf(data);
|
|
411
|
+
if (checker.w)
|
|
412
|
+
values.defaulted(checker.w, out);
|
|
413
|
+
else
|
|
414
|
+
out[k] = checker.d[0];
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (out !== data) {
|
|
418
|
+
for (const k in declared)
|
|
419
|
+
if (!(k in out) && k in data)
|
|
420
|
+
out[k] = data[k];
|
|
421
|
+
}
|
|
422
|
+
return out;
|
|
423
|
+
};
|
|
424
|
+
var transformingProps = ((declared, checker = props(declared)) => {
|
|
425
|
+
const changing = changingIn(declared);
|
|
426
|
+
checker.t = (data) => writtenProps(declared, changing, data);
|
|
427
|
+
return checker;
|
|
428
|
+
});
|
|
429
|
+
var transformingClosedProps = ((declared, description) => transformingProps(declared, closedProps(declared, description)));
|
|
430
|
+
var transformsFailing = (declared, checker, withCtx) => {
|
|
431
|
+
const changing = changingIn(declared);
|
|
432
|
+
checker.t = failingValues((data, values) => writtenValues(declared, changing, data, values), Object.values(declared), withCtx);
|
|
433
|
+
return checker;
|
|
434
|
+
};
|
|
435
|
+
var failingProps = ((declared, withCtx) => transformsFailing(declared, props(declared), withCtx));
|
|
436
|
+
var failingClosedProps = ((declared, description, withCtx) => transformsFailing(declared, closedProps(declared, description), withCtx));
|
|
437
|
+
var deletes = (declared, data, out) => {
|
|
438
|
+
for (const k of [
|
|
439
|
+
...Object.keys(data),
|
|
440
|
+
...Object.getOwnPropertySymbols(data)
|
|
441
|
+
]) {
|
|
442
|
+
if (hasOwn(declared, k))
|
|
443
|
+
continue;
|
|
444
|
+
if (out === data)
|
|
445
|
+
out = copyOf(data);
|
|
446
|
+
delete out[k];
|
|
447
|
+
}
|
|
448
|
+
return out;
|
|
449
|
+
};
|
|
450
|
+
var deletingProps = ((declared) => {
|
|
451
|
+
const checker = props(declared);
|
|
452
|
+
checker.t = (data) => {
|
|
453
|
+
if (Object.getPrototypeOf(data) !== Object.prototype)
|
|
454
|
+
return deletes(declared, data, writtenProps(declared, declared, data));
|
|
455
|
+
const result = {};
|
|
456
|
+
for (const k in declared) {
|
|
457
|
+
const { t, d: defaulted } = declared[k];
|
|
458
|
+
if (k in data)
|
|
459
|
+
result[k] = t ? t(data[k]) : data[k];
|
|
460
|
+
else if (defaulted?.length)
|
|
461
|
+
result[k] = defaulted[0];
|
|
462
|
+
}
|
|
463
|
+
return result;
|
|
464
|
+
};
|
|
465
|
+
return checker;
|
|
466
|
+
});
|
|
467
|
+
var failingDeletingProps = ((declared, withCtx) => {
|
|
468
|
+
const checker = props(declared);
|
|
469
|
+
checker.t = failingValues((data, values) => {
|
|
470
|
+
if (Object.getPrototypeOf(data) !== Object.prototype) {
|
|
471
|
+
return deletes(declared, data, writtenValues(declared, declared, data, values));
|
|
472
|
+
}
|
|
473
|
+
const result = {};
|
|
474
|
+
let defaults = false;
|
|
475
|
+
for (const k in declared) {
|
|
476
|
+
const { t, d: defaulted, w } = declared[k];
|
|
477
|
+
if (holdsValue(declared[k], data, k))
|
|
478
|
+
result[k] = t ? values.transformed(t, data[k], k) : data[k];
|
|
479
|
+
else if (defaulted?.length)
|
|
480
|
+
result[k] = defaulted[0];
|
|
481
|
+
else if (w) {
|
|
482
|
+
result[k] = void 0;
|
|
483
|
+
defaults = true;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (defaults && !values.failed()) {
|
|
487
|
+
for (const k in declared) {
|
|
488
|
+
const { w } = declared[k];
|
|
489
|
+
if (w && !holdsValue(declared[k], data, k))
|
|
490
|
+
values.defaulted(w, result);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return result;
|
|
494
|
+
}, Object.values(declared), withCtx);
|
|
495
|
+
return checker;
|
|
496
|
+
});
|
|
497
|
+
var sitedKeeps = (declared, checkers, write) => (data, values) => {
|
|
498
|
+
const out = write(data, checkers, values, copyOf);
|
|
499
|
+
if (out !== data) {
|
|
500
|
+
for (const k in declared)
|
|
501
|
+
if (!(k in out) && k in data)
|
|
502
|
+
out[k] = data[k];
|
|
503
|
+
}
|
|
504
|
+
return out;
|
|
505
|
+
};
|
|
506
|
+
var sitedProps = ((allows, declared, write, walks = props(declared)) => {
|
|
507
|
+
const checkers = Object.values(declared);
|
|
508
|
+
const checker = (data, ctx) => !objectCheck.test(data) ? !failsAt(ctx, objectCheck, data) : ctx?._e ? walks(data, ctx) : allows(data, checkers);
|
|
509
|
+
checker.description = objectCheck.description;
|
|
510
|
+
if (write) {
|
|
511
|
+
const written = sitedKeeps(declared, checkers, write);
|
|
512
|
+
checker.t = (data) => written(data);
|
|
513
|
+
}
|
|
514
|
+
return checker;
|
|
515
|
+
});
|
|
516
|
+
var sited = ((allows, declared, write, writes, removed, withCtx) => {
|
|
517
|
+
const checker = sitedProps(allows, declared, 0, removed ? closedProps(declared, removed) : void 0);
|
|
518
|
+
if (!write)
|
|
519
|
+
return checker;
|
|
520
|
+
const checkers = Object.values(declared);
|
|
521
|
+
const changing = changingIn(declared);
|
|
522
|
+
const keeps = sitedKeeps(declared, checkers, write);
|
|
523
|
+
const written = (data, values) => writes < 3 ? keeps(data, values) : Object.getPrototypeOf(data) === Object.prototype ? write(data, checkers, values, copyOf) : deletes(declared, data, values ? writtenValues(declared, changing, data, values) : writtenProps(declared, changing, data));
|
|
524
|
+
checker.t = writes % 2 ? (data) => written(data) : readingValues((data, ctx) => {
|
|
525
|
+
const values = writtenFor(ctx);
|
|
526
|
+
try {
|
|
527
|
+
return values.resolved(data, written(data, values));
|
|
528
|
+
} finally {
|
|
529
|
+
freed(values);
|
|
530
|
+
}
|
|
531
|
+
}, checkers, withCtx);
|
|
532
|
+
return checker;
|
|
533
|
+
});
|
|
534
|
+
var elementsOf = ((element) => (data, ctx) => {
|
|
535
|
+
for (let i = 0; i < data.length; i++)
|
|
536
|
+
if (failsValue(ctx, element, data, i, data[i]))
|
|
537
|
+
return false;
|
|
538
|
+
return true;
|
|
539
|
+
});
|
|
540
|
+
var transformingElementsOf = ((element) => {
|
|
541
|
+
const checker = elementsOf(element);
|
|
542
|
+
checker.t = (data) => {
|
|
543
|
+
let out = data;
|
|
544
|
+
for (let i = 0; i < data.length; i++) {
|
|
545
|
+
const value = element.t(data[i]);
|
|
546
|
+
if (value === data[i])
|
|
547
|
+
continue;
|
|
548
|
+
if (out === data)
|
|
549
|
+
out = copyOf(data);
|
|
550
|
+
out[i] = value;
|
|
551
|
+
}
|
|
552
|
+
return out;
|
|
553
|
+
};
|
|
554
|
+
return checker;
|
|
555
|
+
});
|
|
556
|
+
var failingElements = (element, withCtx) => failingValues((data, values) => {
|
|
557
|
+
let out = data;
|
|
558
|
+
const { t } = element;
|
|
559
|
+
for (let i = 0; i < data.length; i++) {
|
|
560
|
+
const value = values.transformed(t, data[i], i);
|
|
561
|
+
if (Object.is(value, data[i]))
|
|
562
|
+
continue;
|
|
563
|
+
if (out === data)
|
|
564
|
+
out = copyOf(data);
|
|
565
|
+
out[i] = value;
|
|
566
|
+
}
|
|
567
|
+
return out;
|
|
568
|
+
}, [element], withCtx, 1);
|
|
569
|
+
var failingElementsOf = ((element, withCtx) => {
|
|
570
|
+
const checker = elementsOf(element);
|
|
571
|
+
checker.t = failingElements(element, withCtx);
|
|
572
|
+
return checker;
|
|
573
|
+
});
|
|
574
|
+
var failingArrayOf = ((element, max2, min2, withCtx) => {
|
|
575
|
+
const checker = arrayOf(element, max2, min2);
|
|
576
|
+
checker.t = failingElements(element, withCtx);
|
|
577
|
+
return checker;
|
|
578
|
+
});
|
|
579
|
+
var Written = class {
|
|
580
|
+
constructor(ctx) {
|
|
581
|
+
this.ctx = ctx;
|
|
582
|
+
this.issues = ctx?.errN;
|
|
583
|
+
this.gathered = void 0;
|
|
584
|
+
}
|
|
585
|
+
gather(errors, k) {
|
|
586
|
+
if (this.ctx)
|
|
587
|
+
addMorphErrs(this.ctx, errors, k);
|
|
588
|
+
else
|
|
589
|
+
this.gathered = errors.addTo(this.gathered, k);
|
|
590
|
+
}
|
|
591
|
+
failed() {
|
|
592
|
+
return this.gathered ?? this.ctx?.errN > this.issues;
|
|
593
|
+
}
|
|
594
|
+
// what a t returns of out where a value failed: with no ctx, what failed
|
|
595
|
+
resolved(data, out) {
|
|
596
|
+
return this.gathered ?? (this.ctx?.errN > this.issues ? data : out);
|
|
597
|
+
}
|
|
598
|
+
transformed(t, value, k) {
|
|
599
|
+
let result;
|
|
600
|
+
if (t.c) {
|
|
601
|
+
this.ctx.path.push(k);
|
|
602
|
+
result = t(value, this.ctx);
|
|
603
|
+
this.ctx.path.pop();
|
|
604
|
+
} else
|
|
605
|
+
result = t(value);
|
|
606
|
+
if (result === value || !(result instanceof TransformErrors))
|
|
607
|
+
return result;
|
|
608
|
+
this.gather(result, k);
|
|
609
|
+
return value;
|
|
610
|
+
}
|
|
611
|
+
defaulted(write, out) {
|
|
612
|
+
const written = write(out, this.ctx);
|
|
613
|
+
if (written !== out)
|
|
614
|
+
this.gather(written);
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
var writtenAtDepth = [];
|
|
618
|
+
var depth = 0;
|
|
619
|
+
var writtenFor = (ctx) => {
|
|
620
|
+
if (ctx)
|
|
621
|
+
return new Written(ctx);
|
|
622
|
+
const values = writtenAtDepth[depth] ??= new Written();
|
|
623
|
+
depth++;
|
|
624
|
+
return values;
|
|
625
|
+
};
|
|
626
|
+
var freed = (values) => {
|
|
627
|
+
if (values.ctx)
|
|
628
|
+
return;
|
|
629
|
+
depth--;
|
|
630
|
+
values.gathered = void 0;
|
|
631
|
+
};
|
|
632
|
+
var readingValues = (t, held, withCtx) => {
|
|
633
|
+
if (withCtx || held.some(({ w }) => w?.length === 2))
|
|
634
|
+
t.c = 1;
|
|
635
|
+
return holdingMorphs(t, held);
|
|
636
|
+
};
|
|
637
|
+
var failingValues = (write, held, withCtx, elements) => readingValues((data, ctx) => {
|
|
638
|
+
if (elements && !data.length)
|
|
639
|
+
return data;
|
|
640
|
+
const values = writtenFor(ctx);
|
|
641
|
+
try {
|
|
642
|
+
return values.resolved(data, write(data, values));
|
|
643
|
+
} finally {
|
|
644
|
+
freed(values);
|
|
645
|
+
}
|
|
646
|
+
}, held, withCtx);
|
|
647
|
+
var applyMorphAt = (ctx, checker, value, k) => {
|
|
648
|
+
ctx.path.push(k);
|
|
649
|
+
const passes = transformsValid(ctx) && (checker.a ? checker.a(value, ctx) : checker(value)) ? (transformedInApply(ctx, transformedBy(checker, value, ctx)), true) : checker(value, ctx);
|
|
650
|
+
ctx.path.pop();
|
|
651
|
+
return !passes;
|
|
652
|
+
};
|
|
653
|
+
var piped = ((checker, reports) => {
|
|
654
|
+
const node = {
|
|
655
|
+
allows: checker,
|
|
656
|
+
allowsCtx: !!(checker.a || reports),
|
|
657
|
+
tApply: checker,
|
|
658
|
+
tTransform: (data, ctx) => transformedBy(checker, data, ctx)
|
|
659
|
+
};
|
|
660
|
+
const pipe2 = checker.t ? pipeTransformed : checker.a || reports ? pipeChecked : pipeApplied;
|
|
661
|
+
const step = (data, ctx) => pipe2(ctx, node, data);
|
|
662
|
+
step.p = 1;
|
|
663
|
+
return step;
|
|
664
|
+
});
|
|
665
|
+
var morphing = ((head, steps) => {
|
|
666
|
+
const checker = (data, ctx) => !head || head(data, ctx);
|
|
667
|
+
if (head)
|
|
668
|
+
checker.description = head.description;
|
|
669
|
+
const headT = head ? head.t : void 0;
|
|
670
|
+
const headReadsCtx = headT?.c;
|
|
671
|
+
const pipes = steps.map((step) => step.p);
|
|
672
|
+
const t = (data, ctx) => {
|
|
673
|
+
let result = data;
|
|
674
|
+
if (headT) {
|
|
675
|
+
const issues = ctx?.errN;
|
|
676
|
+
result = headReadsCtx ? headT(data, ctx) : headT(data);
|
|
677
|
+
if (result instanceof TransformErrors) {
|
|
678
|
+
if (!ctx)
|
|
679
|
+
return result;
|
|
680
|
+
addMorphErrs(ctx, result);
|
|
681
|
+
return data;
|
|
682
|
+
}
|
|
683
|
+
if (ctx?.errN > issues)
|
|
684
|
+
return data;
|
|
685
|
+
}
|
|
686
|
+
for (let i = 0; i < steps.length; i++) {
|
|
687
|
+
const step = steps[i];
|
|
688
|
+
const morphed = step(result, ctx);
|
|
689
|
+
if (pipes[i] ? ctx._errors !== void 0 && morphed === ctx._errors : morphed instanceof ArkErrors) {
|
|
690
|
+
if (!ctx)
|
|
691
|
+
return new TransformErrors(morphed, result);
|
|
692
|
+
addErrors(ctx, morphed);
|
|
693
|
+
return data;
|
|
694
|
+
}
|
|
695
|
+
result = morphed;
|
|
696
|
+
}
|
|
697
|
+
return result;
|
|
698
|
+
};
|
|
699
|
+
t.e = applyMorphAt;
|
|
700
|
+
if (pipes.includes(1) || headReadsCtx)
|
|
701
|
+
t.c = 1;
|
|
702
|
+
checker.t = t;
|
|
703
|
+
return checker;
|
|
704
|
+
});
|
|
705
|
+
var transformOf = ((checker) => checker.t);
|
|
706
|
+
var checkerNode = ((checker, reportsPred) => Object.freeze({
|
|
707
|
+
tfs: true,
|
|
708
|
+
reportsPred,
|
|
709
|
+
tApply: checker,
|
|
710
|
+
tTransform: checker.t,
|
|
711
|
+
allows: checker
|
|
712
|
+
}));
|
|
713
|
+
var ctxNode = ((flags, tAllows, tApply, tTransform, declared = {}) => {
|
|
714
|
+
const node = Object.freeze(Object.assign(declared, flags, {
|
|
715
|
+
allowsCtx: true,
|
|
716
|
+
tAllows,
|
|
717
|
+
tApply,
|
|
718
|
+
tTransform,
|
|
719
|
+
allows: (data) => allowsUntracked(node, data) ?? allowsInContext(node, data, runtimeConfig),
|
|
720
|
+
$: runtimeScope
|
|
721
|
+
}));
|
|
722
|
+
return node;
|
|
723
|
+
});
|
|
724
|
+
var readingCtxNode = ((tApply, reportsPred) => ctxNode(reportsPred ? { checksCtx: true, reportsPred } : { checksCtx: true }, allowsReadingCtx(tApply), tApply));
|
|
725
|
+
var failingBranches = ((branchOf, branches) => holdingMorphs((data, ctx) => transformedBy(branchOf(data), data, ctx), branches));
|
|
726
|
+
var units = ((values, code = "discriminant", description = describeValues(values)) => check(code, description, (data) => values.includes(data)));
|
|
727
|
+
var describeDomains = (cases) => listed(Object.keys(cases).map((domain) => {
|
|
728
|
+
const branch = cases[domain];
|
|
729
|
+
return branch !== 1 ? `${branch.description}` : domain === "undefined" || domain === "null" ? domain : `${domain === "object" ? "an" : "a"} ${domain}`;
|
|
730
|
+
}));
|
|
731
|
+
var domains = ((cases, description = describeDomains(cases), fails) => {
|
|
732
|
+
const site = { code: "discriminant", description };
|
|
733
|
+
const caseOf = (data) => cases[data === null ? "null" : typeof data === "function" ? "object" : typeof data];
|
|
734
|
+
const checker = (data, ctx) => {
|
|
735
|
+
const branch = caseOf(data);
|
|
736
|
+
return branch ? branch === 1 || branch(data, ctx) : !failsAt(ctx, site, data);
|
|
737
|
+
};
|
|
738
|
+
checker.description = description;
|
|
739
|
+
if (transformsBranches && Object.values(cases).some((branch) => branch.t)) {
|
|
740
|
+
checker.t = failsInBranches && fails ? fails(caseOf, Object.values(cases)) : (data) => caseOf(data).t?.(data) ?? data;
|
|
741
|
+
}
|
|
742
|
+
return checker;
|
|
743
|
+
});
|
|
744
|
+
var nullableDescriptionOf = (domain) => `${domain === "object" ? "an" : "a"} ${domain} or null`;
|
|
745
|
+
var nullable = ((checker, domain = "string") => {
|
|
746
|
+
const description = nullableDescriptionOf(domain);
|
|
747
|
+
const site = { code: "discriminant", description };
|
|
748
|
+
const wrapped = (data, ctx) => data === null || (typeof data === domain ? checker === 1 || checker(data, ctx) : !failsAt(ctx, site, data));
|
|
749
|
+
wrapped.description = description;
|
|
750
|
+
return wrapped;
|
|
751
|
+
});
|
|
752
|
+
var nullableObject = ((checker) => {
|
|
753
|
+
const site = {
|
|
754
|
+
code: "discriminant",
|
|
755
|
+
description: "an object or null"
|
|
756
|
+
};
|
|
757
|
+
const wrapped = (data, ctx) => data === null || (objectCheck.test(data) ? checker(data, ctx) : !failsAt(ctx, site, data));
|
|
758
|
+
wrapped.description = site.description;
|
|
759
|
+
const { t } = checker;
|
|
760
|
+
if (transformsBranches && t)
|
|
761
|
+
wrapped.t = (data) => data === null ? data : t(data) ?? data;
|
|
762
|
+
return wrapped;
|
|
763
|
+
});
|
|
764
|
+
var discriminate = ((key, cases, description = describeValues(Object.keys(cases)), missed = { code: "union", description: "an object" }, isOwn, areBooleans, fails) => {
|
|
765
|
+
const byValue = new Map(discriminatesBooleans && areBooleans ? [
|
|
766
|
+
[true, cases.true],
|
|
767
|
+
[false, cases.false]
|
|
768
|
+
] : Object.entries(cases));
|
|
769
|
+
const site = { code: "discriminant", description };
|
|
770
|
+
const checker = (data, ctx) => {
|
|
771
|
+
const branch = byValue.get(data?.[key]);
|
|
772
|
+
return branch ? branch === 1 || branch(data, ctx) : objectCheck.test(data) ? !(isOwn ? failsAt(ctx, site, data) : failsAtKey(ctx, site, data, key)) : !failsAt(ctx, missed, data);
|
|
773
|
+
};
|
|
774
|
+
checker.description = missed.description;
|
|
775
|
+
if (transformsBranches && Object.values(cases).some((branch) => branch.t)) {
|
|
776
|
+
checker.t = failsInBranches && fails ? fails((data) => byValue.get(data[key]), Object.values(cases)) : (data) => byValue.get(data[key]).t?.(data) ?? data;
|
|
777
|
+
}
|
|
778
|
+
return checker;
|
|
779
|
+
});
|
|
780
|
+
var discriminateOr = ((otherwise, key, cases, description, missed = { code: "union", description: "an object" }, fails) => {
|
|
781
|
+
const byValue = new Map(Object.entries(cases));
|
|
782
|
+
const site = { code: "discriminant", description };
|
|
783
|
+
const miss = (data, ctx) => !failsAtKey(ctx, site, data, key);
|
|
784
|
+
const checker = (data, ctx) => {
|
|
785
|
+
const branch = byValue.get(data?.[key]);
|
|
786
|
+
return branch ? branch === 1 || branch(data, ctx) : otherwise(data) || (objectCheck.test(data) ? !failsBranches(ctx, [miss, otherwise], data, listedIssue) : !failsAt(ctx, missed, data));
|
|
787
|
+
};
|
|
788
|
+
checker.description = missed.description;
|
|
789
|
+
const branches = [...byValue.values(), otherwise];
|
|
790
|
+
if (transformsBranches && branches.some((branch) => branch.t)) {
|
|
791
|
+
checker.t = failsInBranches && fails ? fails((data) => byValue.get(data[key]) ?? otherwise, branches) : (data) => (byValue.get(data[key]) ?? otherwise).t?.(data) ?? data;
|
|
792
|
+
}
|
|
793
|
+
return checker;
|
|
794
|
+
});
|
|
795
|
+
var union = ((branches, description, issueOf, fails) => {
|
|
796
|
+
const checker = (data, ctx) => branches.some((branch) => branch(data)) || !failsBranches(ctx, branches, data, issueOf);
|
|
797
|
+
checker.description = description;
|
|
798
|
+
if (transformsBranches && branches.some((branch) => branch.t)) {
|
|
799
|
+
checker.t = failsInBranches && fails ? fails((data) => branches.find((branch) => branch(data)), branches) : (data) => branches.find((branch) => branch(data)).t?.(data) ?? data;
|
|
800
|
+
}
|
|
801
|
+
return checker;
|
|
802
|
+
});
|
|
803
|
+
|
|
804
|
+
// out/runtime.js
|
|
805
|
+
var precompiledForArktype_3_0_0_beta_1 = true;
|
|
806
|
+
var assign = /* @__PURE__ */ (() => Object.assign)();
|
|
807
|
+
var is = /* @__PURE__ */ (() => Object.is)();
|
|
808
|
+
var freeze = /* @__PURE__ */ (() => Object.freeze)();
|
|
809
|
+
var setPrototypeOf = /* @__PURE__ */ (() => Object.setPrototypeOf)();
|
|
810
|
+
var Validator = class {
|
|
811
|
+
traverse(data, pipedFromCtx) {
|
|
812
|
+
return this(data, pipedFromCtx, null);
|
|
813
|
+
}
|
|
814
|
+
from(input) {
|
|
815
|
+
return this.assert(input);
|
|
816
|
+
}
|
|
817
|
+
// a build without the expression member has none to print, and one whose
|
|
818
|
+
// validators all lack it ships no read of it
|
|
819
|
+
toString() {
|
|
820
|
+
return holdsExpression && this.expression ? `Type<${this.expression}>` : "Type";
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
var getOwnPropertyDescriptors = /* @__PURE__ */ (() => Object.getOwnPropertyDescriptors)();
|
|
824
|
+
var own = (validator, attributes) => Object.defineProperties(validator, getOwnPropertyDescriptors(attributes));
|
|
825
|
+
var bakeInto = (validator, { "~standard": standard, ...attributes }) => {
|
|
826
|
+
if (validator instanceof Validator) {
|
|
827
|
+
const prior = Reflect.getOwnPropertyDescriptor(validator, "toJsonSchema")?.value;
|
|
828
|
+
const baked = attributes.toJsonSchema;
|
|
829
|
+
if (prior && baked) {
|
|
830
|
+
attributes.toJsonSchema = freeze((opts) => {
|
|
831
|
+
try {
|
|
832
|
+
return baked(opts);
|
|
833
|
+
} catch {
|
|
834
|
+
return prior(opts);
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
for (const member in attributes) {
|
|
839
|
+
if (member !== "toJsonSchema" && Reflect.getOwnPropertyDescriptor(validator, member))
|
|
840
|
+
delete attributes[member];
|
|
841
|
+
}
|
|
842
|
+
own(validator, attributes);
|
|
843
|
+
if (standard && !Reflect.getOwnPropertyDescriptor(validator["~standard"], "jsonSchema")?.value)
|
|
844
|
+
own(validator["~standard"], standard);
|
|
845
|
+
}
|
|
846
|
+
return validator;
|
|
847
|
+
};
|
|
848
|
+
var failureMessage = {
|
|
849
|
+
get() {
|
|
850
|
+
return this._s();
|
|
851
|
+
},
|
|
852
|
+
enumerable: true
|
|
853
|
+
};
|
|
854
|
+
var standardResultOf = (out) => out instanceof ArkErrors2 ? Object.defineProperty(Object.defineProperty({ issues: out.issues }, "_s", {
|
|
855
|
+
value: () => out.summary,
|
|
856
|
+
writable: true
|
|
857
|
+
}), "message", failureMessage) : { value: out };
|
|
858
|
+
var siteOf = ((code, description, message) => ({ code, description, x: message }));
|
|
859
|
+
var requiredSiteOf = ((description) => ({
|
|
860
|
+
m: { code: "required", description }
|
|
861
|
+
}));
|
|
862
|
+
var keySiteOf = ((code, description, missing = description) => ({
|
|
863
|
+
v: siteOf(code, description),
|
|
864
|
+
m: { code: "required", description: missing }
|
|
865
|
+
}));
|
|
866
|
+
var standardOf = (validator, attributes) => freeze({
|
|
867
|
+
vendor: "arktype",
|
|
868
|
+
version: 1,
|
|
869
|
+
validate: freeze((input) => standardResultOf(validator(input))),
|
|
870
|
+
...attributes["~standard"]
|
|
871
|
+
});
|
|
872
|
+
var createValidator = ((rootApply, allows, attributes, id, holes) => createValidatorWith((_, configuredOnFail) => ((data, pipedFromCtx, onFail = configuredOnFail) => pipedFromCtx ? rootApply(data, pipedInto(pipedFromCtx)) : rootApply(data, onFail)), [allows], id, attributes, holes));
|
|
873
|
+
var createValidatorWith = ((make, parts, id, attributes = { meta: emptyMeta }, holes) => {
|
|
874
|
+
const validator = setPrototypeOf(
|
|
875
|
+
// a meta's onFail (e.g. a matcher's) overrides the configured one
|
|
876
|
+
make(parts, attributes.meta.onFail ?? runtimeConfig2.onFail),
|
|
877
|
+
freeze(Validator.prototype)
|
|
878
|
+
);
|
|
879
|
+
validator.assert = freeze((data, pipedFromCtx) => validator(data, pipedFromCtx, throwOnDefault));
|
|
880
|
+
own(validator, attributes);
|
|
881
|
+
validator.allows = freeze(parts[0]);
|
|
882
|
+
validator["~standard"] = standardOf(validator, attributes);
|
|
883
|
+
return holdHoles(freeze(validator), id, holes);
|
|
884
|
+
});
|
|
885
|
+
var pipedInto = (ctx) => (errors) => ctx.piped(errors);
|
|
886
|
+
var pipedIntoUndetailed = (pipedFromCtx, out) => {
|
|
887
|
+
if (!(out instanceof ArkErrors2))
|
|
888
|
+
return out;
|
|
889
|
+
const errors = errorsOf(pipedFromCtx);
|
|
890
|
+
if (errors._merge)
|
|
891
|
+
errors._merge(out, pipedFromCtx.path);
|
|
892
|
+
else {
|
|
893
|
+
for (const issue of out._)
|
|
894
|
+
errors._.push({ ...issue, path: [...pipedFromCtx.path, ...issue.path] });
|
|
895
|
+
}
|
|
896
|
+
return errors;
|
|
897
|
+
};
|
|
898
|
+
var callingRootApply = (([, rootApply], configuredOnFail) => ((data, ...args) => !args.length ? rootApply(data, configuredOnFail) : args[0] ? rootApply(data, pipedInto(args[0])) : rootApply(data, args[1] === void 0 ? configuredOnFail : args[1])));
|
|
899
|
+
var deferred = (load) => {
|
|
900
|
+
let parts;
|
|
901
|
+
const partAt = (i) => (data, arg) => (parts ??= load())[i](data, arg);
|
|
902
|
+
return [partAt(0), partAt(1)];
|
|
903
|
+
};
|
|
904
|
+
var once = (load) => {
|
|
905
|
+
let loaded;
|
|
906
|
+
return () => loaded ??= load();
|
|
907
|
+
};
|
|
908
|
+
var callingDeferredRootApply = ((parts, configuredOnFail) => {
|
|
909
|
+
const bind = () => [allows, rootApply] = parts[1]();
|
|
910
|
+
var allows = (data) => (bind(), allows(data));
|
|
911
|
+
var rootApply = (data, onFail) => (bind(), rootApply(data, onFail));
|
|
912
|
+
parts[0] = (data) => allows(data);
|
|
913
|
+
return ((data, ...args) => !args.length ? rootApply(data, configuredOnFail) : args[0] ? rootApply(data, pipedInto(args[0])) : rootApply(data, args[1] === void 0 ? configuredOnFail : args[1]));
|
|
914
|
+
});
|
|
915
|
+
var copiesByParts = /* @__PURE__ */ new WeakMap();
|
|
916
|
+
var rekeyed = (parts, holes) => {
|
|
917
|
+
let copies = copiesByParts.get(parts);
|
|
918
|
+
if (!copies)
|
|
919
|
+
copiesByParts.set(parts, copies = new InternTable());
|
|
920
|
+
return intern(copies, holes, () => createValidator(...parts, holes));
|
|
921
|
+
};
|
|
922
|
+
var bakedJsonSchema = (write, byTarget, ignoresFallback) => freeze((opts) => {
|
|
923
|
+
const keys = [];
|
|
924
|
+
for (const k in opts)
|
|
925
|
+
if (!ignoresFallback || k !== "fallback")
|
|
926
|
+
keys.push(k);
|
|
927
|
+
if (!keys.length)
|
|
928
|
+
return write();
|
|
929
|
+
const written = keys.length === 1 && keys[0] === "target" && byTarget[supportedJsonSchemaTargets.indexOf(opts.target)];
|
|
930
|
+
return written ? written() : throwError(bakedJsonSchemaOptionsMessage);
|
|
931
|
+
});
|
|
932
|
+
var replayedJsonSchema = (write, byTarget, replays) => freeze((opts) => {
|
|
933
|
+
let target;
|
|
934
|
+
for (const k in opts) {
|
|
935
|
+
if (k === "target")
|
|
936
|
+
target = supportedJsonSchemaTargets.indexOf(opts.target);
|
|
937
|
+
else if (k !== "fallback")
|
|
938
|
+
throwError(bakedJsonSchemaOptionsMessage);
|
|
939
|
+
}
|
|
940
|
+
const fallback = opts?.fallback;
|
|
941
|
+
if (fallback === void 0 || fallback === null) {
|
|
942
|
+
const written = target === void 0 ? write : byTarget[target];
|
|
943
|
+
return written ? written() : throwError(bakedJsonSchemaOptionsMessage);
|
|
944
|
+
}
|
|
945
|
+
const replay = replays[target ?? byTarget.length];
|
|
946
|
+
return replay ? replay(fallingBackTo(fallback)) : throwError(bakedJsonSchemaOptionsMessage);
|
|
947
|
+
});
|
|
948
|
+
var fallingBackTo = (fallback) => {
|
|
949
|
+
const byCode = typeof fallback === "function" ? { default: fallback } : fallback;
|
|
950
|
+
return (code, ctx, configured) => {
|
|
951
|
+
const handler = byCode[code] ?? byCode.default ?? configured;
|
|
952
|
+
return handler ? handler(ctx) : throwError(bakedJsonSchemaOptionsMessage);
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
var bakedStandardJsonSchema = (input, output) => freeze({
|
|
956
|
+
input: freeze((opts) => writeStandardJsonSchema(input, opts)),
|
|
957
|
+
output: freeze((opts) => writeStandardJsonSchema(output, opts))
|
|
958
|
+
});
|
|
959
|
+
var writeStandardJsonSchema = (writers, opts) => {
|
|
960
|
+
const i = supportedJsonSchemaTargets.indexOf(validateStandardJsonSchemaTarget(opts.target));
|
|
961
|
+
if (opts.libraryOptions && Object.keys(opts.libraryOptions).length)
|
|
962
|
+
throwError(bakedJsonSchemaOptionsMessage);
|
|
963
|
+
return writers[i]();
|
|
964
|
+
};
|
|
965
|
+
var ToJsonSchemaError = class extends Error {
|
|
966
|
+
name = "ToJsonSchemaError";
|
|
967
|
+
code;
|
|
968
|
+
context;
|
|
969
|
+
constructor(code, message, context) {
|
|
970
|
+
super(message);
|
|
971
|
+
this.code = code;
|
|
972
|
+
this.context = context;
|
|
973
|
+
}
|
|
974
|
+
hasCode(code) {
|
|
975
|
+
return this.code === code;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
var throwJsonSchemaError = (code, message, context) => {
|
|
979
|
+
throw new ToJsonSchemaError(code, message, context);
|
|
980
|
+
};
|
|
981
|
+
var fallbackThrower = (code, header) => (ctx) => throwJsonSchemaError(code, header + printable(ctx, { quoteKeys: false, indent: 4 }), ctx);
|
|
982
|
+
var throwUnbaked = (reason) => throwError(writeUnbakedMessage(reason));
|
|
983
|
+
var typedFn = (raw, params, returns) => freeze(new InternalTypedFn(raw, params, returns));
|
|
984
|
+
var type = /* @__PURE__ */ freeze({
|
|
985
|
+
errors: ArkErrors2
|
|
986
|
+
});
|
|
987
|
+
var canParseUrl = ((s) => URL.canParse(s));
|
|
988
|
+
var codeSiteOf = ((code, description, message) => ({
|
|
989
|
+
code,
|
|
990
|
+
description,
|
|
991
|
+
x: message,
|
|
992
|
+
text: codedIssue
|
|
993
|
+
}));
|
|
994
|
+
var defineProperty = /* @__PURE__ */ (() => Object.defineProperty)();
|
|
995
|
+
var writeIssue = (issue, context, [expected, actual, message], keeps) => {
|
|
996
|
+
const text = {
|
|
997
|
+
expected: issue.expected,
|
|
998
|
+
// one supplied where it's raised, which is its own
|
|
999
|
+
message: context.message
|
|
1000
|
+
};
|
|
1001
|
+
if (keeps & 2 && text.message === void 0)
|
|
1002
|
+
codedIssue(issue);
|
|
1003
|
+
const writeText = () => {
|
|
1004
|
+
const error = {
|
|
1005
|
+
data: issue.data,
|
|
1006
|
+
path: issue.path,
|
|
1007
|
+
...context,
|
|
1008
|
+
propString: stringifyPath(issue.path)
|
|
1009
|
+
};
|
|
1010
|
+
const write = (writer, ...args) => typeof writer === "function" ? writer(...args, enInfo) : writer;
|
|
1011
|
+
error.expected = context.expected ?? write(expected, error) ?? text.expected;
|
|
1012
|
+
if (context.actual !== void 0)
|
|
1013
|
+
error.actual = context.actual;
|
|
1014
|
+
else {
|
|
1015
|
+
if (keeps & 4)
|
|
1016
|
+
describeActual(error);
|
|
1017
|
+
error.actual = write(actual, issue.data, error);
|
|
1018
|
+
}
|
|
1019
|
+
if (keeps & 1)
|
|
1020
|
+
text.expected = error.expected;
|
|
1021
|
+
text.message ??= write(message, error);
|
|
1022
|
+
for (const k in text) {
|
|
1023
|
+
defineProperty(issue, k, {
|
|
1024
|
+
value: text[k],
|
|
1025
|
+
writable: true,
|
|
1026
|
+
enumerable: true,
|
|
1027
|
+
configurable: true
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
for (const k in text) {
|
|
1032
|
+
defineProperty(issue, k, {
|
|
1033
|
+
get: () => (writeText(), issue[k]),
|
|
1034
|
+
enumerable: true,
|
|
1035
|
+
configurable: true
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
var writtenSiteOf = ((code, description, context, writers, keeps = 0) => ({
|
|
1040
|
+
code,
|
|
1041
|
+
description,
|
|
1042
|
+
text: (issue) => writeIssue(issue, context, writers, keeps)
|
|
1043
|
+
}));
|
|
1044
|
+
var raisingTraversalOf = (Base, writtenByCode) => class extends Base {
|
|
1045
|
+
raise(input) {
|
|
1046
|
+
const issue = super.raise(input);
|
|
1047
|
+
const written = writtenByCode[issue.code];
|
|
1048
|
+
if (written) {
|
|
1049
|
+
const context = { ...input, path: issue.path };
|
|
1050
|
+
writeIssue(issue, context, ...written);
|
|
1051
|
+
}
|
|
1052
|
+
return issue;
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
var failsAt = ((ctx, site, data) => !ctx?._e || failsSite(ctx, site, data));
|
|
1056
|
+
var failsWith = ((ctx, ...failure) => !ctx?._e || ctx._e(...failure));
|
|
1057
|
+
var failsKeyWith = ((ctx, ...failure) => !ctx?._e || failsKey(ctx, ...failure));
|
|
1058
|
+
var failsAtKey = ((ctx, site, data, key) => !ctx?._e || failsKeySite(ctx, site, data, key));
|
|
1059
|
+
var failsAtPath = ((ctx, site, data, [k, ...deeper]) => !ctx?._e || (deeper.length ? ctx._k((value, ctx2) => !failsAtPath(ctx2, site, value, deeper), data, k) : failsKeySite(ctx, site, data, k)));
|
|
1060
|
+
var failsIn = ((ctx, apply, data, key, ...missing) => ctx?._e ? ctx._k(apply, data, key, ...missing) : !apply(data[key]));
|
|
1061
|
+
var ownIssue = ((site) => (path, data, errors) => {
|
|
1062
|
+
const issue = issueAt(path, site, data, void 0);
|
|
1063
|
+
const listed2 = writeListed(errors);
|
|
1064
|
+
issue.expected ??= path.length ? writeFromPath(path, errors, writeListed) : listed2;
|
|
1065
|
+
const shared = isCustomIssue(issue) ? void 0 : sharedMessageOf(errors);
|
|
1066
|
+
if (shared !== void 0)
|
|
1067
|
+
issue.message = shared;
|
|
1068
|
+
issue.errors = errors;
|
|
1069
|
+
return issue;
|
|
1070
|
+
});
|
|
1071
|
+
var failsListed = ((ctx, firsts, data, issueOf) => {
|
|
1072
|
+
const path = traversesUnions ? ctx._p ?? ctx.path : ctx._p;
|
|
1073
|
+
const errors = [
|
|
1074
|
+
...new Set(firsts.flatMap((first) => first.errors?.length ? first.errors : first))
|
|
1075
|
+
];
|
|
1076
|
+
const issue = issueOf(path, data, errors);
|
|
1077
|
+
if (traversesUnions && !ctx._p)
|
|
1078
|
+
ctx.addError(issue);
|
|
1079
|
+
else
|
|
1080
|
+
ctx._.push(issue);
|
|
1081
|
+
return ctx.failFast;
|
|
1082
|
+
});
|
|
1083
|
+
var failsBranches = ((ctx, branches, data, issueOf) => {
|
|
1084
|
+
if (!ctx?._e)
|
|
1085
|
+
return true;
|
|
1086
|
+
const firsts = [];
|
|
1087
|
+
for (const branch of branches) {
|
|
1088
|
+
let first;
|
|
1089
|
+
if (traversesUnions && !ctx._p) {
|
|
1090
|
+
ctx.pushBr();
|
|
1091
|
+
branch(data, ctx);
|
|
1092
|
+
first = ctx.popBr().error;
|
|
1093
|
+
} else {
|
|
1094
|
+
const issues = new FirstIssues();
|
|
1095
|
+
issues._p = ctx._p.slice();
|
|
1096
|
+
branch(data, issues);
|
|
1097
|
+
first = issues._[0];
|
|
1098
|
+
}
|
|
1099
|
+
if (!first)
|
|
1100
|
+
return;
|
|
1101
|
+
firsts.push(first);
|
|
1102
|
+
}
|
|
1103
|
+
return failsListed(ctx, firsts, data, issueOf);
|
|
1104
|
+
});
|
|
1105
|
+
var applyErrors = (apply, data, config, onFail, Ctx) => {
|
|
1106
|
+
const ctx = new Ctx(data, config);
|
|
1107
|
+
apply(data, ctx);
|
|
1108
|
+
const errors = ctx instanceof ArkErrors2 ? ctx : ctx._errors;
|
|
1109
|
+
return !errors?.count ? data : onFail ? onFail(errors) : errors;
|
|
1110
|
+
};
|
|
1111
|
+
var applyNodeErrors = (node, data, config, onFail, Ctx) => applyErrors(node.tApply, data, config, onFail, Ctx);
|
|
1112
|
+
var elementsFrom = (allows, apply, i, data) => (_, ctx) => {
|
|
1113
|
+
for (let j = i; j < data.length; j++)
|
|
1114
|
+
if (!allows(data[j]) && ctx._k(apply, data, j))
|
|
1115
|
+
return false;
|
|
1116
|
+
return true;
|
|
1117
|
+
};
|
|
1118
|
+
var applyElements = (allows, apply, i, data, args, onFail, Ctx) => applyCallErrors(elementsFrom(allows, apply, i, data), data, args, onFail, Ctx);
|
|
1119
|
+
var applyCallErrors = (apply, data, args, onFail, Ctx) => {
|
|
1120
|
+
const ctx = new Ctx(data, runtimeConfig2);
|
|
1121
|
+
apply(data, ctx);
|
|
1122
|
+
const errors = ctx instanceof ArkErrors2 ? ctx : ctx._errors;
|
|
1123
|
+
if (!errors?.count)
|
|
1124
|
+
return data;
|
|
1125
|
+
if (args.length) {
|
|
1126
|
+
if (args[0])
|
|
1127
|
+
return args[0].piped(errors);
|
|
1128
|
+
if (args[1] !== void 0)
|
|
1129
|
+
onFail = args[1];
|
|
1130
|
+
}
|
|
1131
|
+
return onFail ? onFail(errors) : errors;
|
|
1132
|
+
};
|
|
1133
|
+
var unreadClassOf = (Ctx) => {
|
|
1134
|
+
class Unread {
|
|
1135
|
+
constructor(data, config, apply) {
|
|
1136
|
+
this._a = apply;
|
|
1137
|
+
this._d = data;
|
|
1138
|
+
}
|
|
1139
|
+
get _() {
|
|
1140
|
+
return this._f ??= issuesOf(this._a, this._d, new Ctx());
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
setPrototypeOf(Unread.prototype, Ctx.prototype);
|
|
1144
|
+
Unread.prototype.constructor = Ctx;
|
|
1145
|
+
return Unread;
|
|
1146
|
+
};
|
|
1147
|
+
var unreadArkErrors;
|
|
1148
|
+
var unreadClasses = /* @__PURE__ */ new Map();
|
|
1149
|
+
var unreadOf = (Ctx) => {
|
|
1150
|
+
if (Ctx === ArkErrors2)
|
|
1151
|
+
return unreadArkErrors ??= unreadClassOf(Ctx);
|
|
1152
|
+
let unread = unreadClasses.get(Ctx);
|
|
1153
|
+
if (!unread)
|
|
1154
|
+
unreadClasses.set(Ctx, unread = unreadClassOf(Ctx));
|
|
1155
|
+
return unread;
|
|
1156
|
+
};
|
|
1157
|
+
var unreadErrors = (apply, data, onFail, Ctx = ArkErrors2) => {
|
|
1158
|
+
const errors = new (findsOnRead ? Ctx : unreadOf(Ctx))(data, 0, apply);
|
|
1159
|
+
return onFail ? onFail(errors) : errors;
|
|
1160
|
+
};
|
|
1161
|
+
var unreadCallErrors = (apply, data, args, onFail, Ctx = ArkErrors2) => {
|
|
1162
|
+
const errors = new (findsOnRead ? Ctx : unreadOf(Ctx))(data, 0, apply);
|
|
1163
|
+
if (args.length) {
|
|
1164
|
+
if (args[0])
|
|
1165
|
+
return args[0].piped(errors);
|
|
1166
|
+
if (args[1] !== void 0)
|
|
1167
|
+
onFail = args[1];
|
|
1168
|
+
}
|
|
1169
|
+
return onFail ? onFail(errors) : errors;
|
|
1170
|
+
};
|
|
1171
|
+
var emptyMeta = /* @__PURE__ */ freeze({});
|
|
1172
|
+
var firstIssue = (errors) => {
|
|
1173
|
+
const unread = errors;
|
|
1174
|
+
if (unread._1)
|
|
1175
|
+
return unread._1;
|
|
1176
|
+
if (!unread._a || unread._f)
|
|
1177
|
+
return errors.issues[0];
|
|
1178
|
+
const ctx = new FirstIssues();
|
|
1179
|
+
issuesOf(unread._a, unread._d, ctx);
|
|
1180
|
+
return unread._1 = ctx.issues[0];
|
|
1181
|
+
};
|
|
1182
|
+
var InvalidErrors = /* @__PURE__ */ (() => {
|
|
1183
|
+
class Invalid {
|
|
1184
|
+
constructor(data) {
|
|
1185
|
+
this._d = data;
|
|
1186
|
+
}
|
|
1187
|
+
get _() {
|
|
1188
|
+
return this._f ??= [
|
|
1189
|
+
{ code: "predicate", path: [], data: this._d }
|
|
1190
|
+
];
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
setPrototypeOf(Invalid.prototype, ArkErrors2.prototype);
|
|
1194
|
+
Invalid.prototype.constructor = ArkErrors2;
|
|
1195
|
+
return Invalid;
|
|
1196
|
+
})();
|
|
1197
|
+
var unreadElements = (allows, apply, i, data, args, onFail, Ctx) => unreadCallErrors(elementsFrom(allows, apply, i, data), data, args, onFail, Ctx);
|
|
1198
|
+
var factOfHole = (hole, kind = "function", classes = {}) => {
|
|
1199
|
+
if (kind === "symbol" || typeof hole !== "function" || isValidator(hole))
|
|
1200
|
+
return describeValue(hole);
|
|
1201
|
+
if (kind === "function")
|
|
1202
|
+
return Math.min(hole.length, 2);
|
|
1203
|
+
const builtinName = getBuiltinNameOfConstructor(hole);
|
|
1204
|
+
if (builtinName)
|
|
1205
|
+
return `the builtin ${builtinName}`;
|
|
1206
|
+
const { prototype } = hole;
|
|
1207
|
+
if (!hasDomain(prototype, "object"))
|
|
1208
|
+
return "a function without a prototype";
|
|
1209
|
+
const ancestors = [];
|
|
1210
|
+
for (let ancestor = prototypeOf(prototype); ancestor; ancestor = prototypeOf(ancestor)) {
|
|
1211
|
+
const { constructor } = ancestor;
|
|
1212
|
+
const ancestorName = typeof constructor === "function" && constructor.prototype === ancestor && getBuiltinNameOfConstructor(constructor);
|
|
1213
|
+
if (ancestorName)
|
|
1214
|
+
ancestors.push(ancestorName);
|
|
1215
|
+
for (const label in classes) {
|
|
1216
|
+
if (classes[label].prototype === ancestor)
|
|
1217
|
+
ancestors.push(label);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
return ancestors.length ? `a class extending ${ancestors.join(", ")}` : "a class";
|
|
1221
|
+
};
|
|
1222
|
+
var describeShape = (value) => {
|
|
1223
|
+
if (!hasDomain(value, "object"))
|
|
1224
|
+
return describeValue(value);
|
|
1225
|
+
if (value instanceof Date)
|
|
1226
|
+
return `a Date at ${dateGetTime.call(value)}`;
|
|
1227
|
+
if (value instanceof RegExp)
|
|
1228
|
+
return `the RegExp ${value}`;
|
|
1229
|
+
if (Array.isArray(value))
|
|
1230
|
+
return `an array of length ${value.length}`;
|
|
1231
|
+
const prototype = prototypeOf(value);
|
|
1232
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
1233
|
+
return describeValue(value);
|
|
1234
|
+
const kind = prototype ? "object" : "null-prototype object";
|
|
1235
|
+
const keys = Reflect.ownKeys(value);
|
|
1236
|
+
return keys.length ? `${prototype ? "an" : "a"} ${kind} with keys ${keys.map(String).join(", ")}` : `an empty ${kind}`;
|
|
1237
|
+
};
|
|
1238
|
+
var digestOf = (value) => {
|
|
1239
|
+
let low = 3735928559;
|
|
1240
|
+
let high = 1103547991;
|
|
1241
|
+
const add = (part) => {
|
|
1242
|
+
for (let i = 0; i <= part.length; i++) {
|
|
1243
|
+
const code = i < part.length ? part.charCodeAt(i) : 1114111;
|
|
1244
|
+
low = Math.imul(low ^ code, 2654435761);
|
|
1245
|
+
high = Math.imul(high ^ code, 1597334677);
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
const prototype = prototypeOf(value);
|
|
1249
|
+
add(Array.isArray(value) ? "array" : prototype === Object.prototype ? "object" : prototype === null ? "null" : "instance");
|
|
1250
|
+
for (const k of Reflect.ownKeys(value)) {
|
|
1251
|
+
if (k === "length" && Array.isArray(value))
|
|
1252
|
+
continue;
|
|
1253
|
+
const v = Reflect.get(value, k);
|
|
1254
|
+
add(String(k));
|
|
1255
|
+
add(typeof v);
|
|
1256
|
+
add(Object.is(v, -0) ? "-0" : String(v));
|
|
1257
|
+
}
|
|
1258
|
+
low = Math.imul(low ^ low >>> 16, 2246822507) ^ Math.imul(high ^ high >>> 13, 3266489909);
|
|
1259
|
+
high = Math.imul(high ^ high >>> 16, 2246822507) ^ Math.imul(low ^ low >>> 13, 3266489909);
|
|
1260
|
+
return (4294967296 * (2097151 & high) + (low >>> 0)).toString(36);
|
|
1261
|
+
};
|
|
1262
|
+
var writeDigestMismatchMessage = (label) => `${label} holds other keys or values than it was precompiled with`;
|
|
1263
|
+
var unnamed2 = "A value a validator reads";
|
|
1264
|
+
var checkDigest = (value, expected, label = unnamed2) => {
|
|
1265
|
+
if (!hasDomain(value, "object") || digestOf(value) !== expected)
|
|
1266
|
+
throwError(writeDigestMismatchMessage(label));
|
|
1267
|
+
};
|
|
1268
|
+
var checkFacts = (actual, expected, label = unnamed2) => {
|
|
1269
|
+
if (actual !== expected) {
|
|
1270
|
+
throwError(writeCreationMismatchMessage(label, describeFact(actual), describeFact(expected)));
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
var checkArity = (value, expected, label) => checkFacts(typeof value !== "function" || isValidator(value) ? describeValue(value) : Math.min(value.length, 2), expected, label);
|
|
1274
|
+
var describeFact = (fact) => typeof fact === "string" ? fact : `a function of ${fact === 0 ? "no parameters" : fact === 1 ? "1 parameter" : "2 or more parameters"}`;
|
|
1275
|
+
var checkIdentity = (value, expected, label = unnamed2, expectedLabel = "another it reads") => {
|
|
1276
|
+
if (value !== expected)
|
|
1277
|
+
throwError(writeIdentityMismatchMessage(label, expectedLabel));
|
|
1278
|
+
};
|
|
1279
|
+
var checkedDefaultOf = ([id, holes]) => {
|
|
1280
|
+
let table = checkedDefaults.next(id);
|
|
1281
|
+
for (const hole of holes)
|
|
1282
|
+
table = table.next(hole);
|
|
1283
|
+
return table;
|
|
1284
|
+
};
|
|
1285
|
+
var checkDefault = (validator, value, key, defaultKey) => {
|
|
1286
|
+
const checked = checkedDefaultOf(defaultKey);
|
|
1287
|
+
if (checked.value)
|
|
1288
|
+
return;
|
|
1289
|
+
const out = validator.traverse(value);
|
|
1290
|
+
if (out instanceof ArkErrors2) {
|
|
1291
|
+
if (key === null)
|
|
1292
|
+
throwParseError(`Default ${out.summary}`);
|
|
1293
|
+
const atPath = new ArkErrors2();
|
|
1294
|
+
mergeIssues(atPath, out, [key]);
|
|
1295
|
+
throwParseError(`Default for ${atPath.summary}`);
|
|
1296
|
+
}
|
|
1297
|
+
checked.value = true;
|
|
1298
|
+
};
|
|
1299
|
+
var checkInput = (value, expected, label = unnamed2) => {
|
|
1300
|
+
if (!is(value, expected)) {
|
|
1301
|
+
throwError(writeCreationMismatchMessage(label, describeValue(value), describeValue(expected)));
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
var checkProgress = (progress, at, name) => {
|
|
1305
|
+
if (progress === void 0 || progress < at)
|
|
1306
|
+
throw new ReferenceError(`Cannot access '${name}' before initialization`);
|
|
1307
|
+
};
|
|
1308
|
+
var checkFunction = (value, label = unnamed2) => {
|
|
1309
|
+
if (typeof value !== "function") {
|
|
1310
|
+
throwError(writeCreationMismatchMessage(label, describeValue(value), "a function"));
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
var checkHeld = (value, label = unnamed2, kind = "Type") => {
|
|
1314
|
+
if (value === void 0) {
|
|
1315
|
+
throwError(writeCreationMismatchMessage(label, describeValue(value), `the ${kind} it was at build`));
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
var holesByValue = /* @__PURE__ */ new WeakMap();
|
|
1319
|
+
var holdHoles = ((value, id, holes = []) => {
|
|
1320
|
+
holesByValue.set(value, [id, freeze(holes)]);
|
|
1321
|
+
return value;
|
|
1322
|
+
});
|
|
1323
|
+
var holesOf = ((holder, id, label = unnamed2, kind = "Type") => {
|
|
1324
|
+
const created = holesByValue.get(holder);
|
|
1325
|
+
if (created?.[0] !== id) {
|
|
1326
|
+
return throwError(writeCreationMismatchMessage(label, created ? `another ${kind}` : describeValue(holder), `the ${kind} it was at build`));
|
|
1327
|
+
}
|
|
1328
|
+
return created[1];
|
|
1329
|
+
});
|
|
1330
|
+
var receiverOf = ((id, label, kind) => ((holder) => holesOf(holder, id, label, kind)));
|
|
1331
|
+
var InternTable = class InternTable {
|
|
1332
|
+
value = void 0;
|
|
1333
|
+
tablesByObject = /* @__PURE__ */ new WeakMap();
|
|
1334
|
+
// a symbol is a WeakMap key only in engines since ES2023
|
|
1335
|
+
tablesByValue = /* @__PURE__ */ new Map();
|
|
1336
|
+
next(hole) {
|
|
1337
|
+
const tables = hasDomain(hole, "object") ? this.tablesByObject : this.tablesByValue;
|
|
1338
|
+
let next = tables.get(hole);
|
|
1339
|
+
if (!next)
|
|
1340
|
+
tables.set(hole, next = new InternTable());
|
|
1341
|
+
return next;
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
var internTable = () => new InternTable();
|
|
1345
|
+
var tablesByKey = /* @__PURE__ */ new Map();
|
|
1346
|
+
var internedTable = (key) => {
|
|
1347
|
+
let table = tablesByKey.get(key);
|
|
1348
|
+
if (!table)
|
|
1349
|
+
tablesByKey.set(key, table = new InternTable());
|
|
1350
|
+
return table;
|
|
1351
|
+
};
|
|
1352
|
+
var checkedDefaults = /* @__PURE__ */ new InternTable();
|
|
1353
|
+
var intern = (table, holes, create, defaults = []) => {
|
|
1354
|
+
for (const hole of holes)
|
|
1355
|
+
table = table.next(hole);
|
|
1356
|
+
if (table.value !== void 0 && defaults.some((key) => !checkedDefaultOf(key).value))
|
|
1357
|
+
create();
|
|
1358
|
+
return table.value ??= create();
|
|
1359
|
+
};
|
|
1360
|
+
var tablesByHolder = /* @__PURE__ */ new InternTable();
|
|
1361
|
+
var internIn = (holder, holes, create, defaults) => intern(tablesByHolder.next(holder), holes, create, defaults);
|
|
1362
|
+
var interned = (key, create, ...args) => intern(internedTable(key), [], () => create(...args));
|
|
1363
|
+
var helpersKey = /* @__PURE__ */ Symbol.for("arktype.helpers");
|
|
1364
|
+
var checkHelper = (helper, file, name, label) => {
|
|
1365
|
+
const registered = Reflect.get(globalThis, helpersKey)?.[file];
|
|
1366
|
+
if (!registered || !(name in registered) || registered[name] !== helper) {
|
|
1367
|
+
throwError(writeCreationMismatchMessage(label, describeValue(helper), `the function ${file} exports as \`${name}\``));
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
var isValidator = (value) => value instanceof Validator;
|
|
1371
|
+
var describeValue = (value) => isValidator(value) ? Reflect.getOwnPropertyDescriptor(value, "expression") ? String(value) : "a Type" : typeof value === "string" ? JSON.stringify(value) : typeof value === "function" ? "a function" : value !== null && typeof value === "object" ? "an object" : String(value);
|
|
1372
|
+
var writeCreationMismatchMessage = (label, actual, expected) => `${label} is ${actual}, but was precompiled as ${expected}`;
|
|
1373
|
+
var writeIdentityMismatchMessage = (label, expectedLabel) => `${label} is not ${expectedLabel}, which it was at build`;
|
|
1374
|
+
var bakedJsonSchemaOptionsMessage = `A standalone validator's JSON Schema takes only a target it was built with, and a fallback only where it was built to apply one; set members["toJsonSchema"] true, or build with runtime: "arktype"`;
|
|
1375
|
+
var writeUnbakedMessage = (reason) => `${reason}. Build with runtime: "arktype" to write it where it's read.`;
|
|
1376
|
+
var deepFreeze = (value) => {
|
|
1377
|
+
if (value && typeof value === "object" && !Object.isFrozen(value))
|
|
1378
|
+
for (const k in freeze(value))
|
|
1379
|
+
deepFreeze(value[k]);
|
|
1380
|
+
return value;
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
export {
|
|
1384
|
+
check,
|
|
1385
|
+
narrowedBy,
|
|
1386
|
+
narrowedWithCtx,
|
|
1387
|
+
readingCtx,
|
|
1388
|
+
allowsReadingCtx,
|
|
1389
|
+
compiled,
|
|
1390
|
+
aliasedValue,
|
|
1391
|
+
aliasedMember,
|
|
1392
|
+
holdingAlias,
|
|
1393
|
+
narrowedInCtx,
|
|
1394
|
+
narrowedAfter,
|
|
1395
|
+
transformingNarrowedAfter,
|
|
1396
|
+
narrowedByEach,
|
|
1397
|
+
narrowed,
|
|
1398
|
+
unnamed,
|
|
1399
|
+
rejecting,
|
|
1400
|
+
rejectsWith,
|
|
1401
|
+
narrowedRejecting,
|
|
1402
|
+
allowsOf,
|
|
1403
|
+
stringCheck,
|
|
1404
|
+
numberCheck,
|
|
1405
|
+
objectCheck,
|
|
1406
|
+
arrayCheck,
|
|
1407
|
+
min,
|
|
1408
|
+
moreThan,
|
|
1409
|
+
max,
|
|
1410
|
+
lessThan,
|
|
1411
|
+
minLength,
|
|
1412
|
+
maxLength,
|
|
1413
|
+
exactLength,
|
|
1414
|
+
divisor,
|
|
1415
|
+
integerCheck,
|
|
1416
|
+
pattern,
|
|
1417
|
+
stringRange,
|
|
1418
|
+
integerRange,
|
|
1419
|
+
arrayOf,
|
|
1420
|
+
describeValues,
|
|
1421
|
+
unit,
|
|
1422
|
+
booleanChecker,
|
|
1423
|
+
intersection,
|
|
1424
|
+
optional,
|
|
1425
|
+
writtenBy,
|
|
1426
|
+
replacingUndefined,
|
|
1427
|
+
required,
|
|
1428
|
+
sayingMissing,
|
|
1429
|
+
saying,
|
|
1430
|
+
props,
|
|
1431
|
+
closedProps,
|
|
1432
|
+
recordOf,
|
|
1433
|
+
indexed,
|
|
1434
|
+
transformingProps,
|
|
1435
|
+
transformingClosedProps,
|
|
1436
|
+
failingProps,
|
|
1437
|
+
failingClosedProps,
|
|
1438
|
+
deletingProps,
|
|
1439
|
+
failingDeletingProps,
|
|
1440
|
+
sitedProps,
|
|
1441
|
+
sited,
|
|
1442
|
+
elementsOf,
|
|
1443
|
+
transformingElementsOf,
|
|
1444
|
+
failingElementsOf,
|
|
1445
|
+
failingArrayOf,
|
|
1446
|
+
piped,
|
|
1447
|
+
morphing,
|
|
1448
|
+
transformOf,
|
|
1449
|
+
checkerNode,
|
|
1450
|
+
ctxNode,
|
|
1451
|
+
readingCtxNode,
|
|
1452
|
+
failingBranches,
|
|
1453
|
+
units,
|
|
1454
|
+
describeDomains,
|
|
1455
|
+
domains,
|
|
1456
|
+
nullableDescriptionOf,
|
|
1457
|
+
nullable,
|
|
1458
|
+
nullableObject,
|
|
1459
|
+
discriminate,
|
|
1460
|
+
discriminateOr,
|
|
1461
|
+
union,
|
|
1462
|
+
precompiledForArktype_3_0_0_beta_1,
|
|
1463
|
+
assign,
|
|
1464
|
+
is,
|
|
1465
|
+
freeze,
|
|
1466
|
+
setPrototypeOf,
|
|
1467
|
+
Validator,
|
|
1468
|
+
own,
|
|
1469
|
+
bakeInto,
|
|
1470
|
+
standardResultOf,
|
|
1471
|
+
siteOf,
|
|
1472
|
+
requiredSiteOf,
|
|
1473
|
+
keySiteOf,
|
|
1474
|
+
createValidator,
|
|
1475
|
+
createValidatorWith,
|
|
1476
|
+
pipedIntoUndetailed,
|
|
1477
|
+
callingRootApply,
|
|
1478
|
+
deferred,
|
|
1479
|
+
once,
|
|
1480
|
+
callingDeferredRootApply,
|
|
1481
|
+
rekeyed,
|
|
1482
|
+
bakedJsonSchema,
|
|
1483
|
+
replayedJsonSchema,
|
|
1484
|
+
bakedStandardJsonSchema,
|
|
1485
|
+
throwJsonSchemaError,
|
|
1486
|
+
fallbackThrower,
|
|
1487
|
+
throwUnbaked,
|
|
1488
|
+
typedFn,
|
|
1489
|
+
type,
|
|
1490
|
+
canParseUrl,
|
|
1491
|
+
codeSiteOf,
|
|
1492
|
+
writtenSiteOf,
|
|
1493
|
+
raisingTraversalOf,
|
|
1494
|
+
failsAt,
|
|
1495
|
+
failsWith,
|
|
1496
|
+
failsKeyWith,
|
|
1497
|
+
failsAtKey,
|
|
1498
|
+
failsAtPath,
|
|
1499
|
+
failsIn,
|
|
1500
|
+
ownIssue,
|
|
1501
|
+
failsListed,
|
|
1502
|
+
failsBranches,
|
|
1503
|
+
applyErrors,
|
|
1504
|
+
applyNodeErrors,
|
|
1505
|
+
applyElements,
|
|
1506
|
+
applyCallErrors,
|
|
1507
|
+
unreadErrors,
|
|
1508
|
+
unreadCallErrors,
|
|
1509
|
+
emptyMeta,
|
|
1510
|
+
firstIssue,
|
|
1511
|
+
InvalidErrors,
|
|
1512
|
+
unreadElements,
|
|
1513
|
+
factOfHole,
|
|
1514
|
+
describeShape,
|
|
1515
|
+
digestOf,
|
|
1516
|
+
writeDigestMismatchMessage,
|
|
1517
|
+
checkDigest,
|
|
1518
|
+
checkFacts,
|
|
1519
|
+
checkArity,
|
|
1520
|
+
checkIdentity,
|
|
1521
|
+
checkDefault,
|
|
1522
|
+
checkInput,
|
|
1523
|
+
checkProgress,
|
|
1524
|
+
checkFunction,
|
|
1525
|
+
checkHeld,
|
|
1526
|
+
holdHoles,
|
|
1527
|
+
holesOf,
|
|
1528
|
+
receiverOf,
|
|
1529
|
+
internTable,
|
|
1530
|
+
internedTable,
|
|
1531
|
+
intern,
|
|
1532
|
+
internIn,
|
|
1533
|
+
interned,
|
|
1534
|
+
checkHelper,
|
|
1535
|
+
writeCreationMismatchMessage,
|
|
1536
|
+
writeIdentityMismatchMessage,
|
|
1537
|
+
bakedJsonSchemaOptionsMessage,
|
|
1538
|
+
writeUnbakedMessage,
|
|
1539
|
+
deepFreeze,
|
|
1540
|
+
addErrors,
|
|
1541
|
+
addMorphErrs,
|
|
1542
|
+
allowsInBranchBy,
|
|
1543
|
+
allowsInContext,
|
|
1544
|
+
allowsUntracked,
|
|
1545
|
+
appliesValues,
|
|
1546
|
+
ArkErrors,
|
|
1547
|
+
copyOf,
|
|
1548
|
+
describePredicate,
|
|
1549
|
+
discriminatesBooleans,
|
|
1550
|
+
enterApplied,
|
|
1551
|
+
exitApplied,
|
|
1552
|
+
failsInBranches,
|
|
1553
|
+
pipeApplied,
|
|
1554
|
+
pipeChecked,
|
|
1555
|
+
pipeTransformed,
|
|
1556
|
+
runtimeConfig,
|
|
1557
|
+
runtimeScope,
|
|
1558
|
+
silentCtx,
|
|
1559
|
+
TransformErrors,
|
|
1560
|
+
transformed,
|
|
1561
|
+
transformedInApply,
|
|
1562
|
+
transformIfAllowed,
|
|
1563
|
+
transformResolution,
|
|
1564
|
+
transformsBranches,
|
|
1565
|
+
transformsValid
|
|
1566
|
+
};
|