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
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import {
|
|
2
|
+
precompileInPlace
|
|
3
|
+
} from "./chunk-KXOC3JEX.js";
|
|
4
|
+
import {
|
|
5
|
+
arrayIndexMatcher
|
|
6
|
+
} from "./chunk-CWSF57VM.js";
|
|
7
|
+
import {
|
|
8
|
+
$ark
|
|
9
|
+
} from "./chunk-PDLTEX6Z.js";
|
|
10
|
+
import {
|
|
11
|
+
hasArkKind
|
|
12
|
+
} from "./chunk-3KBOPH3J.js";
|
|
13
|
+
import {
|
|
14
|
+
arityOf
|
|
15
|
+
} from "./chunk-3HZC67MT.js";
|
|
16
|
+
|
|
17
|
+
// ../schema/out/shared/inPlace.js
|
|
18
|
+
var keys = () => ({ every: false, indices: false, named: /* @__PURE__ */ new Set() });
|
|
19
|
+
var isEmpty = (k) => !k.every && !k.indices && !k.named.size;
|
|
20
|
+
var isIndexKey = (key) => key === "length" || typeof key === "string" && arrayIndexMatcher.test(key);
|
|
21
|
+
var meet = function (l, r) {
|
|
22
|
+
if (l.every && !isEmpty(r) || r.every && !isEmpty(l))
|
|
23
|
+
return true;
|
|
24
|
+
if (l.indices && (r.indices || [...r.named].some(isIndexKey)))
|
|
25
|
+
return true;
|
|
26
|
+
if (r.indices && [...l.named].some(isIndexKey))
|
|
27
|
+
return true;
|
|
28
|
+
for (const key of l.named)
|
|
29
|
+
if (r.named.has(key))
|
|
30
|
+
return true;
|
|
31
|
+
return false;
|
|
32
|
+
};
|
|
33
|
+
var canBeObject = (node) => node.overlaps($ark.kw.object.internal);
|
|
34
|
+
var writerOf = function (node) {
|
|
35
|
+
const structure = node.is("intersection") ? node.structure : void 0;
|
|
36
|
+
if (!structure?.tfs)
|
|
37
|
+
return;
|
|
38
|
+
if (structure.undeclared !== "delete" || structure.sequence?.tfs && !structure.slicesSeq)
|
|
39
|
+
return structure;
|
|
40
|
+
};
|
|
41
|
+
var returnsInput = function (node, seen = /* @__PURE__ */ new Set()) {
|
|
42
|
+
if (!node.tfs || seen.has(node))
|
|
43
|
+
return true;
|
|
44
|
+
seen.add(node);
|
|
45
|
+
if (node.is("alias"))
|
|
46
|
+
return returnsInput(node.resolution, seen);
|
|
47
|
+
if (node.is("union"))
|
|
48
|
+
return node.branches.every((branch) => returnsInput(branch, seen));
|
|
49
|
+
if (node.is("intersection"))
|
|
50
|
+
return !!node.structure && node.structure.undeclared !== "delete";
|
|
51
|
+
return false;
|
|
52
|
+
};
|
|
53
|
+
var writesOf = function (structure) {
|
|
54
|
+
const writes = {
|
|
55
|
+
values: keys(),
|
|
56
|
+
added: keys(),
|
|
57
|
+
addsOnlyDefaults: true
|
|
58
|
+
};
|
|
59
|
+
const sequence = structure.sequence;
|
|
60
|
+
if (sequence?.children.some((element) => !returnsInput(element)))
|
|
61
|
+
writes.values.indices = true;
|
|
62
|
+
if (structure.undeclared === "delete")
|
|
63
|
+
return writes;
|
|
64
|
+
for (const prop of structure.props) {
|
|
65
|
+
if (!returnsInput(prop.value))
|
|
66
|
+
writes.values.named.add(prop.key);
|
|
67
|
+
if (prop.hasDef()) {
|
|
68
|
+
writes.added.named.add(prop.key);
|
|
69
|
+
if (prop.value.tfs)
|
|
70
|
+
writes.addsOnlyDefaults = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (structure.index?.some((index) => !returnsInput(index.value)))
|
|
74
|
+
writes.values.every = true;
|
|
75
|
+
if (sequence?.defaultables) {
|
|
76
|
+
writes.added.indices = true;
|
|
77
|
+
if (sequence.defaultables.some(([node]) => node.tfs))
|
|
78
|
+
writes.addsOnlyDefaults = false;
|
|
79
|
+
}
|
|
80
|
+
return writes;
|
|
81
|
+
};
|
|
82
|
+
var readsOf = function (node) {
|
|
83
|
+
if (node.is("morph"))
|
|
84
|
+
return canBeObject(node._in) ? everyRead() : void 0;
|
|
85
|
+
if (!node.is("intersection"))
|
|
86
|
+
return;
|
|
87
|
+
if (node.inner.predicate)
|
|
88
|
+
return everyRead();
|
|
89
|
+
const structure = node.structure;
|
|
90
|
+
const readsLength = !!(node.inner.exactLength || node.inner.minLength || node.inner.maxLength);
|
|
91
|
+
if (!structure && !readsLength)
|
|
92
|
+
return;
|
|
93
|
+
const reads = { values: keys(), everyPresence: false };
|
|
94
|
+
if (readsLength)
|
|
95
|
+
reads.values.indices = true;
|
|
96
|
+
if (!structure)
|
|
97
|
+
return reads;
|
|
98
|
+
for (const prop of structure.props)
|
|
99
|
+
reads.values.named.add(prop.key);
|
|
100
|
+
if (structure.index)
|
|
101
|
+
reads.values.every = true;
|
|
102
|
+
if (structure.sequence)
|
|
103
|
+
reads.values.indices = true;
|
|
104
|
+
if (structure.handlesUndeclared)
|
|
105
|
+
reads.everyPresence = true;
|
|
106
|
+
return reads;
|
|
107
|
+
};
|
|
108
|
+
var everyRead = () => ({
|
|
109
|
+
values: { every: true, indices: true, named: /* @__PURE__ */ new Set() },
|
|
110
|
+
everyPresence: true
|
|
111
|
+
});
|
|
112
|
+
var placesOf = function (root) {
|
|
113
|
+
const places = /* @__PURE__ */ new Map();
|
|
114
|
+
let positions = 0;
|
|
115
|
+
const enter = (node, count, position, afterFunction) => {
|
|
116
|
+
const place = places.get(node.id);
|
|
117
|
+
if (place) {
|
|
118
|
+
const entered = Math.min(2, place.count + count);
|
|
119
|
+
if (entered === place.count && (place.afterFunction || !afterFunction))
|
|
120
|
+
return;
|
|
121
|
+
place.count = entered;
|
|
122
|
+
place.afterFunction ||= afterFunction;
|
|
123
|
+
return visit(node, place.count, place.position, place.afterFunction);
|
|
124
|
+
}
|
|
125
|
+
places.set(node.id, { node, count, position, afterFunction });
|
|
126
|
+
visit(node, count, position, afterFunction);
|
|
127
|
+
};
|
|
128
|
+
const enterNew = (node, count, afterFunction) => enter(node, count, ++positions, afterFunction);
|
|
129
|
+
const visit = (node, count, position, afterFunction) => {
|
|
130
|
+
if (node.is("alias"))
|
|
131
|
+
return enter(node.resolution, count, position, afterFunction);
|
|
132
|
+
if (node.is("union")) {
|
|
133
|
+
for (const branch of node.branches)
|
|
134
|
+
enter(branch, count, position, afterFunction);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (node.is("morph")) {
|
|
138
|
+
let piped = false;
|
|
139
|
+
for (const morph of node.morphs) {
|
|
140
|
+
if (!hasArkKind(morph, "root"))
|
|
141
|
+
piped = true;
|
|
142
|
+
else if (!piped)
|
|
143
|
+
enter(morph, count, position, afterFunction);
|
|
144
|
+
else
|
|
145
|
+
enterNew(morph, count, true);
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const structure = node.is("intersection") ? node.structure : void 0;
|
|
150
|
+
if (!structure)
|
|
151
|
+
return;
|
|
152
|
+
for (const prop of structure.props)
|
|
153
|
+
enterNew(prop.value, count, afterFunction);
|
|
154
|
+
for (const index of structure.index ?? [])
|
|
155
|
+
enterNew(index.value, 2, afterFunction);
|
|
156
|
+
const sequence = structure.sequence;
|
|
157
|
+
if (!sequence)
|
|
158
|
+
return;
|
|
159
|
+
for (const element of sequence.leading)
|
|
160
|
+
enterNew(element.node, count, afterFunction);
|
|
161
|
+
if (sequence.variadic)
|
|
162
|
+
enterNew(sequence.variadic, 2, afterFunction);
|
|
163
|
+
for (const element of sequence.postfix ?? [])
|
|
164
|
+
enterNew(element, count, afterFunction);
|
|
165
|
+
};
|
|
166
|
+
enterNew(root, 1, false);
|
|
167
|
+
return places;
|
|
168
|
+
};
|
|
169
|
+
var transformsKeyTwice = function (structure) {
|
|
170
|
+
const writes = (node) => node.hasAlias || node.references.some((reference) => reference.is("structure") && reference.tfs);
|
|
171
|
+
const index = structure.index?.filter((index2) => index2.value.tfs) ?? [];
|
|
172
|
+
if (!index.length)
|
|
173
|
+
return false;
|
|
174
|
+
if (index.length > 1 && index.some((index2) => writes(index2.value)))
|
|
175
|
+
return true;
|
|
176
|
+
return structure.props.some((prop) => {
|
|
177
|
+
const steps = structure.tfsOf(prop);
|
|
178
|
+
return steps.length > 1 && steps.some((step) => writes(step.node));
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
var overlaps = function (writer, reader) {
|
|
182
|
+
try {
|
|
183
|
+
return writer._in.overlaps(reader._in) || writer._out.overlaps(reader._in);
|
|
184
|
+
} catch {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
var holdsWriter = (places) => {
|
|
189
|
+
for (const { node } of places.values())
|
|
190
|
+
if (writerOf(node))
|
|
191
|
+
return true;
|
|
192
|
+
return false;
|
|
193
|
+
};
|
|
194
|
+
var writesSoundly = function (places) {
|
|
195
|
+
for (const { node } of places.values()) {
|
|
196
|
+
const structure = node.is("intersection") ? node.structure : void 0;
|
|
197
|
+
if (structure && transformsKeyTwice(structure))
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
};
|
|
202
|
+
var writesUnread = function (places) {
|
|
203
|
+
const readers = [];
|
|
204
|
+
for (const place of places.values()) {
|
|
205
|
+
const reads = readsOf(place.node);
|
|
206
|
+
if (reads)
|
|
207
|
+
readers.push([place, reads]);
|
|
208
|
+
}
|
|
209
|
+
for (const place of places.values()) {
|
|
210
|
+
const writer = writerOf(place.node);
|
|
211
|
+
if (!writer)
|
|
212
|
+
continue;
|
|
213
|
+
if (place.afterFunction)
|
|
214
|
+
return false;
|
|
215
|
+
const writes = writesOf(writer);
|
|
216
|
+
if (place.count > 1 && (!isEmpty(writes.values) || !isEmpty(writes.added) && !writes.addsOnlyDefaults))
|
|
217
|
+
return false;
|
|
218
|
+
for (const [reader, reads] of readers) {
|
|
219
|
+
if (reader === place || reader.count === 1 && place.count === 1 && reader.position === place.position)
|
|
220
|
+
continue;
|
|
221
|
+
if ((meet(writes.values, reads.values) || meet(writes.added, reads.values) || reads.everyPresence && !isEmpty(writes.added)) && overlaps(place.node, reader.node))
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
};
|
|
227
|
+
var inputOnlyMorphs = /* @__PURE__ */ new WeakSet();
|
|
228
|
+
var passesContext = function (places) {
|
|
229
|
+
for (const { node } of places.values()) {
|
|
230
|
+
if (node.is("morph") && node.morphs.some((morph) => !hasArkKind(morph, "root") && arityOf(morph) !== 1 && !inputOnlyMorphs.has(morph)))
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
return false;
|
|
234
|
+
};
|
|
235
|
+
var writesInPlaceByMode = {
|
|
236
|
+
true: /* @__PURE__ */ new WeakMap(),
|
|
237
|
+
always: /* @__PURE__ */ new WeakMap()
|
|
238
|
+
};
|
|
239
|
+
var writesInPlace = function (root, mutatesInput) {
|
|
240
|
+
if (!mutatesInput || !root.tfs)
|
|
241
|
+
return false;
|
|
242
|
+
const cache = writesInPlaceByMode[mutatesInput === true ? "true" : "always"];
|
|
243
|
+
let writes = cache.get(root);
|
|
244
|
+
if (writes === void 0) {
|
|
245
|
+
const places = placesOf(root);
|
|
246
|
+
writes = holdsWriter(places) && writesSoundly(places) && (mutatesInput !== true || !passesContext(places) && writesUnread(places));
|
|
247
|
+
cache.set(root, writes);
|
|
248
|
+
}
|
|
249
|
+
return writes;
|
|
250
|
+
};
|
|
251
|
+
var inPlaceRuntimes = /* @__PURE__ */ new WeakMap();
|
|
252
|
+
var inPlaceRuntimeOf = (runtime) => {
|
|
253
|
+
let inPlace = inPlaceRuntimes.get(runtime);
|
|
254
|
+
if (!inPlace) {
|
|
255
|
+
class InPlaceTraversal extends runtime.Traversal {
|
|
256
|
+
}
|
|
257
|
+
InPlaceTraversal.prototype.inPlace = true;
|
|
258
|
+
inPlace = { ...runtime, Traversal: InPlaceTraversal };
|
|
259
|
+
inPlaceRuntimes.set(runtime, inPlace);
|
|
260
|
+
}
|
|
261
|
+
return inPlace;
|
|
262
|
+
};
|
|
263
|
+
var writesInPlaceAsConfigured = (root) => writesInPlace(root, root.$.cfg.mutatesInput);
|
|
264
|
+
var isWriter = (node) => (node.is("structure") || node.is("sequence")) && node.tfs;
|
|
265
|
+
var copiesCompiled = (node) => node.tfs && node.unitFn !== void 0 && (node.hasAlias || isWriter(node) || node.references.some(isWriter));
|
|
266
|
+
var transformsCalledBy = function (root) {
|
|
267
|
+
const called = [];
|
|
268
|
+
const call = (node) => {
|
|
269
|
+
const structure = node.is("intersection") ? node.structure : void 0;
|
|
270
|
+
for (const reached of [node, structure, structure?.sequence])
|
|
271
|
+
if (reached?.tfs)
|
|
272
|
+
called.push(reached);
|
|
273
|
+
};
|
|
274
|
+
for (const { node } of placesOf(root).values()) {
|
|
275
|
+
call(node);
|
|
276
|
+
if (node.is("union"))
|
|
277
|
+
for (const caseNode of node.caseNodes)
|
|
278
|
+
call(caseNode);
|
|
279
|
+
}
|
|
280
|
+
return called;
|
|
281
|
+
};
|
|
282
|
+
var checking;
|
|
283
|
+
var inPlaceTransforms = {
|
|
284
|
+
checksUncompiled: (root) => checking?.has(root) || !root.c.usedPreJit,
|
|
285
|
+
checkedUncompiled: function (root, apply) {
|
|
286
|
+
if (!writesInPlaceAsConfigured(root))
|
|
287
|
+
return apply;
|
|
288
|
+
const called = transformsCalledBy(root);
|
|
289
|
+
if (called.some(copiesCompiled))
|
|
290
|
+
return;
|
|
291
|
+
return (data, onFail) => {
|
|
292
|
+
const outer = checking;
|
|
293
|
+
checking = /* @__PURE__ */ new Set([...outer ?? [], ...called]);
|
|
294
|
+
try {
|
|
295
|
+
return apply(data, onFail);
|
|
296
|
+
} finally {
|
|
297
|
+
checking = outer;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
},
|
|
301
|
+
get checking() {
|
|
302
|
+
return checking;
|
|
303
|
+
},
|
|
304
|
+
applied: function (root) {
|
|
305
|
+
const { unbound } = root.c;
|
|
306
|
+
root.c.unbound = void 0;
|
|
307
|
+
if (!writesInPlaceAsConfigured(root))
|
|
308
|
+
return root;
|
|
309
|
+
if (!root.c.applyInPlace)
|
|
310
|
+
precompileInPlace(root, unbound);
|
|
311
|
+
return Object.assign(Object.create(root), {
|
|
312
|
+
tApply: root.c.applyInPlace,
|
|
313
|
+
tTransform: root.c.transformInPlace
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
runtimeOf: (root, runtime) => writesInPlaceAsConfigured(root) ? inPlaceRuntimeOf(runtime) : runtime
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
export {
|
|
320
|
+
inputOnlyMorphs,
|
|
321
|
+
writesInPlace,
|
|
322
|
+
inPlaceTransforms
|
|
323
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$ark,
|
|
3
|
+
configuredMessageOf,
|
|
4
|
+
defaultConfig,
|
|
5
|
+
keywordWriterOf,
|
|
6
|
+
registerLocaleRenderer,
|
|
7
|
+
suppliedText,
|
|
8
|
+
unrenderedLocaleMessage,
|
|
9
|
+
unwrittenError,
|
|
10
|
+
writeActual,
|
|
11
|
+
writeInvalidLocaleObjectMessage,
|
|
12
|
+
writeKeywordExpected,
|
|
13
|
+
writeText
|
|
14
|
+
} from "./chunk-PDLTEX6Z.js";
|
|
15
|
+
import {
|
|
16
|
+
describeActual
|
|
17
|
+
} from "./chunk-3KBOPH3J.js";
|
|
18
|
+
import {
|
|
19
|
+
omit,
|
|
20
|
+
stringifyPath,
|
|
21
|
+
throwError,
|
|
22
|
+
throwParseError
|
|
23
|
+
} from "./chunk-3HZC67MT.js";
|
|
24
|
+
|
|
25
|
+
// ../schema/out/shared/render.js
|
|
26
|
+
var defaultLocale;
|
|
27
|
+
var selector;
|
|
28
|
+
var configured;
|
|
29
|
+
var configureLocale = function (locale, base) {
|
|
30
|
+
defaultLocale = base.locale;
|
|
31
|
+
if (typeof locale === "function") {
|
|
32
|
+
selector = locale;
|
|
33
|
+
configured = defaultLocale;
|
|
34
|
+
} else {
|
|
35
|
+
selector = void 0;
|
|
36
|
+
configured = locale === void 0 ? defaultLocale : normalizeLocale(locale);
|
|
37
|
+
}
|
|
38
|
+
return configured;
|
|
39
|
+
};
|
|
40
|
+
var isStandalone = (config) => !("cite" in config.locale);
|
|
41
|
+
var select = function (config) {
|
|
42
|
+
if (isStandalone(config))
|
|
43
|
+
return config.locale;
|
|
44
|
+
if (selector === void 0)
|
|
45
|
+
return configured;
|
|
46
|
+
try {
|
|
47
|
+
const locale = selector();
|
|
48
|
+
return locale === void 0 ? defaultLocale : normalizeLocale(locale);
|
|
49
|
+
} catch {
|
|
50
|
+
return defaultLocale;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var write = function (error, config, locale) {
|
|
54
|
+
if (isStandalone(config)) {
|
|
55
|
+
if (locale !== config.locale)
|
|
56
|
+
throwError(unrenderedLocaleMessage);
|
|
57
|
+
return writeText(error, config, locale);
|
|
58
|
+
}
|
|
59
|
+
locale = normalizeLocale(locale);
|
|
60
|
+
if (locale === defaultLocale)
|
|
61
|
+
return writeText(error, config, locale);
|
|
62
|
+
const supplied = suppliedText(error, "expected");
|
|
63
|
+
const expected = supplied ?? configOf(error, "expected", config);
|
|
64
|
+
const cited = citesDescription(error) ? error.description : void 0;
|
|
65
|
+
if (error.expected === supplied) {
|
|
66
|
+
error.expected = expected === defaultConfig[error.code].expected ? localeExpected(error, cited, config, locale) : writeSlot(error, "expected", expected, locale);
|
|
67
|
+
}
|
|
68
|
+
error.actual ??= render(error, "actual", expected, cited, config, locale);
|
|
69
|
+
error.message ??= render(error, "message", expected, cited, config, locale);
|
|
70
|
+
};
|
|
71
|
+
var render = function (error, slot, expected, cited, config, locale) {
|
|
72
|
+
const slotConfig = configOf(error, slot, config);
|
|
73
|
+
const isDefault = slotConfig === defaultConfig[error.code][slot];
|
|
74
|
+
if (isDefault && slot === "actual" && error.code !== "required")
|
|
75
|
+
describeActual(error);
|
|
76
|
+
return writeSlot(error, slot, isDefault ? localeWriter(error, slot, expected, cited, locale) : slotConfig, locale);
|
|
77
|
+
};
|
|
78
|
+
var configOf = function (error, slot, config) { return (slot === "message" ? configuredMessageOf(error) : error.meta?.[slot]) ?? config[error.code][slot] ?? defaultConfig[error.code][slot] };
|
|
79
|
+
var citesDescription = function (error) { return (error.code !== "discriminant" || !error.onKey && error.meta?.description !== void 0 && error.meta.keyword === void 0) && error.description !== void 0 && !isDefaultDescription(error, error.description) };
|
|
80
|
+
var writeSlot = function (error, slot, config, locale) { return typeof config === "string" ? slot === "expected" ? locale.cite(config) : config : slot === "actual" ? writeActual(error, config, locale) : config(error, locale) };
|
|
81
|
+
var localeWriter = function (error, slot, expected, cited, locale) {
|
|
82
|
+
if (cited !== void 0) {
|
|
83
|
+
const keywordWriter = keywordWriterOf(error, locale, slot);
|
|
84
|
+
if (keywordWriter !== void 0)
|
|
85
|
+
return keywordWriter;
|
|
86
|
+
}
|
|
87
|
+
const writer = locale[error.code]?.[slot];
|
|
88
|
+
if (writer === void 0)
|
|
89
|
+
return locale[slot];
|
|
90
|
+
if (error.code === "union") {
|
|
91
|
+
const framesErrors = cited === void 0 && error.meta?.expected === void 0;
|
|
92
|
+
return framesErrors || slot === "actual" ? writer : locale[slot];
|
|
93
|
+
}
|
|
94
|
+
if (slot !== "message")
|
|
95
|
+
return writer;
|
|
96
|
+
return cited !== void 0 || expected !== defaultConfig[error.code].expected ? locale.message : writer;
|
|
97
|
+
};
|
|
98
|
+
var localeExpected = function (error, cited, config, locale) {
|
|
99
|
+
if (cited !== void 0)
|
|
100
|
+
return writeKeywordExpected(error, locale) ?? locale.cite(cited);
|
|
101
|
+
const expected = locale[error.code]?.expected;
|
|
102
|
+
if (expected !== void 0)
|
|
103
|
+
return writeExpected(error, expected, locale);
|
|
104
|
+
const inEn = unwrittenError(error);
|
|
105
|
+
writeInEn(inEn, config, "expected");
|
|
106
|
+
return inEn.expected;
|
|
107
|
+
};
|
|
108
|
+
var writeInEn = function (error, config, last) {
|
|
109
|
+
if (error.code === "union")
|
|
110
|
+
for (const e of error.errors)
|
|
111
|
+
writeInEn(e, config, "actual");
|
|
112
|
+
error.propString ??= stringifyPath(error.path);
|
|
113
|
+
const expected = configOf(error, "expected", config);
|
|
114
|
+
error.expected ??= writeExpected(error, expected, defaultLocale);
|
|
115
|
+
if (last === "expected")
|
|
116
|
+
return;
|
|
117
|
+
error.actual ??= writeActual(error, configOf(error, "actual", config), defaultLocale);
|
|
118
|
+
};
|
|
119
|
+
var writeExpected = (error, expected, locale) => typeof expected === "string" ? expected : expected(error, locale);
|
|
120
|
+
var isDefaultDescription = function (error, description) {
|
|
121
|
+
const meta = error.meta;
|
|
122
|
+
return meta !== void 0 && meta.description === void 0 && meta.keyword === void 0 && description === // en has a fragment for every code
|
|
123
|
+
writeExpected(error, defaultLocale[error.code].expected, defaultLocale);
|
|
124
|
+
};
|
|
125
|
+
var normalizedLocales = /* @__PURE__ */ new WeakMap();
|
|
126
|
+
var normalizeLocale = function (locale) {
|
|
127
|
+
if (typeof locale !== "object" || locale === null || Array.isArray(locale))
|
|
128
|
+
throwParseError(writeInvalidLocaleObjectMessage(locale));
|
|
129
|
+
const en = defaultLocale ??= $ark.defaultConfig.locale;
|
|
130
|
+
if (locale === en)
|
|
131
|
+
return en;
|
|
132
|
+
let normalized = normalizedLocales.get(locale);
|
|
133
|
+
if (normalized === void 0) {
|
|
134
|
+
normalized = completeFrom(en, locale);
|
|
135
|
+
normalizedLocales.set(locale, normalized);
|
|
136
|
+
}
|
|
137
|
+
return normalized;
|
|
138
|
+
};
|
|
139
|
+
var completeFrom = function (en, locale) {
|
|
140
|
+
let completed;
|
|
141
|
+
const fill = (k2, entry) => {
|
|
142
|
+
completed ??= { ...locale };
|
|
143
|
+
completed[k2] = entry;
|
|
144
|
+
};
|
|
145
|
+
let k;
|
|
146
|
+
for (k in en) {
|
|
147
|
+
const entry = locale[k];
|
|
148
|
+
if (entry === void 0) {
|
|
149
|
+
const fallback = en[k];
|
|
150
|
+
fill(k, k === "keywordPhrases" ? {} : typeof fallback === "object" ? omit(fallback, { expected: 1 }) : fallback);
|
|
151
|
+
} else if (k === "nouns" && Object.keys(en.nouns).some((id) => entry[id] === void 0))
|
|
152
|
+
fill(k, { ...en.nouns, ...entry });
|
|
153
|
+
}
|
|
154
|
+
return completed ?? locale;
|
|
155
|
+
};
|
|
156
|
+
registerLocaleRenderer({
|
|
157
|
+
get en() {
|
|
158
|
+
return defaultLocale;
|
|
159
|
+
},
|
|
160
|
+
configure: configureLocale,
|
|
161
|
+
select,
|
|
162
|
+
write,
|
|
163
|
+
normalize: normalizeLocale
|
|
164
|
+
});
|
|
165
|
+
if ($ark.cfg)
|
|
166
|
+
configureLocale($ark.config.locale, $ark.defaultConfig);
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
normalizeLocale
|
|
170
|
+
};
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
actualAtPathOf,
|
|
3
|
+
describeCause,
|
|
4
|
+
describeMissing,
|
|
5
|
+
groupByPath,
|
|
6
|
+
labelOf,
|
|
7
|
+
writeKeywordExpected
|
|
8
|
+
} from "./chunk-PDLTEX6Z.js";
|
|
9
|
+
import {
|
|
10
|
+
printedActualOf
|
|
11
|
+
} from "./chunk-3KBOPH3J.js";
|
|
12
|
+
import {
|
|
13
|
+
listPattern
|
|
14
|
+
} from "./chunk-3SH2BQ4T.js";
|
|
15
|
+
import {
|
|
16
|
+
domainOf,
|
|
17
|
+
getBuiltinNameOfConstructor,
|
|
18
|
+
isValidDate,
|
|
19
|
+
objectKindOrDomainOf,
|
|
20
|
+
printable,
|
|
21
|
+
timeOf
|
|
22
|
+
} from "./chunk-3HZC67MT.js";
|
|
23
|
+
|
|
1
24
|
// out/locales/de.js
|
|
2
|
-
import { actualAtPathOf, describeCause, describeMissing, distinctExpectedOf, groupByPath, labelOf, printedActualOf, writeKeywordExpected } from "@ark/schema/i18n";
|
|
3
|
-
import { domainOf, getBuiltinNameOfConstructor, isValidDate, timeOf, listPattern, objectKindOrDomainOf, printable } from "@ark/util";
|
|
4
25
|
var listSeparatedBy = (middle) => listPattern({ two: " oder ", middle, end: " oder " }, { two: " und ", middle, end: " und " });
|
|
5
26
|
var commaList = /* @__PURE__ */ listSeparatedBy(", ");
|
|
6
27
|
var semicolonList = /* @__PURE__ */ listSeparatedBy("; ");
|
|
@@ -39,7 +60,7 @@ var date = function (d) {
|
|
|
39
60
|
return `${day}. ${months[month]} ${year}, ${time} UTC`;
|
|
40
61
|
};
|
|
41
62
|
var theDate = (date2, locale) => `der ${locale.date(date2)}`;
|
|
42
|
-
var print = function (value, locale) { return value instanceof Date && isValidDate(value) ? theDate(value, locale) : locale.verbatim(typeof value === "number" ? locale.number(value) : printable(value)) };
|
|
63
|
+
var print = function (value, locale) { return value instanceof Date && isValidDate(value) ? theDate(value, locale) : locale.verbatim(typeof value === "number" ? locale.number(value) : typeof value === "bigint" ? `${locale.number(value)}n` : printable(value)) };
|
|
43
64
|
var printKind = function (data, locale) { return typeof data === "function" ? locale.nouns.Function : typeof data !== "object" || data === null ? print(data, locale) : locale.nouns[Array.isArray(data) ? "Array" : "object"] };
|
|
44
65
|
var was = (e) => {
|
|
45
66
|
const actual = printedActualOf(e);
|
|
@@ -69,7 +90,10 @@ var lengthWriters = {
|
|
|
69
90
|
actual: lengthActual,
|
|
70
91
|
message: lengthMessage
|
|
71
92
|
};
|
|
72
|
-
var subjectOf = function (propString, label, locale) {
|
|
93
|
+
var subjectOf = function (propString, label, locale) {
|
|
94
|
+
const path = propString[0] === "[" ? `Wert an ${locale.verbatim(propString)}` : locale.verbatim(propString);
|
|
95
|
+
return label === void 0 ? path : `${path} („${locale.verbatim(label)}“)`;
|
|
96
|
+
};
|
|
73
97
|
var bound = function (e, locale) { return e.rule === 0 && e.exclusive ? e.code === "min" ? "positiv" : "negativ" : e.code === "min" ? `${e.exclusive ? "größer als" : "mindestens"} ${locale.number(e.rule)}` : `${e.exclusive ? "kleiner als" : "höchstens"} ${locale.number(e.rule)}` };
|
|
74
98
|
var boundMessage = function (e, locale) { return e.rule === 0 && !e.exclusive ? `darf nicht ${e.code === "min" ? "negativ" : "positiv"} sein${was(e)}` : mustBe(bound(e, locale), e) };
|
|
75
99
|
var dateWriters = function (relation) {
|
|
@@ -90,7 +114,7 @@ var describeProto = function (proto, locale) {
|
|
|
90
114
|
const builtinName = getBuiltinNameOfConstructor(proto);
|
|
91
115
|
return builtinName ? locale.nouns[builtinName] : `eine Instanz von ${locale.verbatim(proto.name)}`;
|
|
92
116
|
};
|
|
93
|
-
var
|
|
117
|
+
var causeOf = (cause, locale) => locale.verbatim(describeCause(cause));
|
|
94
118
|
var epoch = "ein gültiger Unix-Zeitstempel als ganze Zahl";
|
|
95
119
|
var keywordPhrases = {
|
|
96
120
|
"FormData.parsed": "ein Objekt mit geparsten Formulardaten",
|
|
@@ -118,11 +142,10 @@ var keywordPhrases = {
|
|
|
118
142
|
"string.ip": "eine IP-Adresse",
|
|
119
143
|
"string.ip.v4": "eine IPv4-Adresse",
|
|
120
144
|
"string.ip.v6": "eine IPv6-Adresse",
|
|
121
|
-
"string.json":
|
|
145
|
+
"string.json": "eine JSON-Zeichenkette",
|
|
122
146
|
"string.json.parse": {
|
|
123
147
|
noun: "eine JSON-Zeichenkette",
|
|
124
|
-
actual: (data, e, locale) => data === "" ? "leer" : print(data, locale)
|
|
125
|
-
message: jsonMessage
|
|
148
|
+
actual: (data, e, locale) => data === "" ? "leer" : print(data, locale)
|
|
126
149
|
},
|
|
127
150
|
"string.lower.preformatted": "kleingeschrieben",
|
|
128
151
|
"string.normalize.NFC.preformatted": "NFC-normalisiert",
|
|
@@ -131,10 +154,7 @@ var keywordPhrases = {
|
|
|
131
154
|
"string.normalize.NFKD.preformatted": "NFKD-normalisiert",
|
|
132
155
|
"string.numeric": "eine wohlgeformte numerische Zeichenkette",
|
|
133
156
|
"string.numeric.parse": "endlich",
|
|
134
|
-
"string.regex":
|
|
135
|
-
noun: "ein Regex-Muster",
|
|
136
|
-
message: function (e, locale) { return e.code === "predicate" && e.cause !== void 0 ? `muss ein Regex-Muster sein (${describeCause(e.cause)})` : locale.message(e, locale) }
|
|
137
|
-
},
|
|
157
|
+
"string.regex": "ein Regex-Muster",
|
|
138
158
|
"string.semver": "eine semantische Version (siehe https://semver.org/)",
|
|
139
159
|
"string.trim.preformatted": "ohne Leerraum am Anfang und Ende",
|
|
140
160
|
"string.upper.preformatted": "durchgehend großgeschrieben",
|
|
@@ -247,11 +267,6 @@ var de = {
|
|
|
247
267
|
actual: (data, e, locale) => actualAtPathOf(e) ?? printKind(data, locale),
|
|
248
268
|
message: (e) => e.errors.length ? e.expected : mustBe(e.expected, e)
|
|
249
269
|
},
|
|
250
|
-
intersection: {
|
|
251
|
-
expected: (e) => distinctExpectedOf(e.errors).length > 1 ? ` ◦ ${distinctExpectedOf(e.errors).join("\n ◦ ")}` : e.errors[0].expected,
|
|
252
|
-
message: function (e) { return distinctExpectedOf(e.errors).length > 1 ? `(${printedActualOf(e)}) muss alles Folgende sein:
|
|
253
|
-
${e.expected}` : mustBe(e.expected, e) }
|
|
254
|
-
},
|
|
255
270
|
min: { expected: bound, message: boundMessage },
|
|
256
271
|
max: { expected: bound, message: boundMessage },
|
|
257
272
|
minLength: lengthWriters,
|
|
@@ -282,13 +297,13 @@ ${e.expected}` : mustBe(e.expected, e) }
|
|
|
282
297
|
predicate: {
|
|
283
298
|
expected: predicateOf,
|
|
284
299
|
actual: (data, e, locale) => e.morph ? `wegen eines Fehlers abgebrochen:
|
|
285
|
-
${
|
|
300
|
+
${causeOf(e.cause, locale)}` : printKind(data, locale),
|
|
286
301
|
message: function (e, locale) {
|
|
287
302
|
if (!e.morph)
|
|
288
303
|
return mustBe(predicateOf(e, locale), e);
|
|
289
304
|
const name = e.morph.name && `von ${locale.verbatim(e.morph.name)} `;
|
|
290
305
|
return `konnte ${name}nicht verarbeitet werden:
|
|
291
|
-
${
|
|
306
|
+
${causeOf(e.cause, locale)}`;
|
|
292
307
|
}
|
|
293
308
|
},
|
|
294
309
|
required: {
|