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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { writeUnboundableMessage } from "
|
|
2
|
-
import type { ErrorMessage, array, typeToString } from "
|
|
1
|
+
import type { writeUnboundableMessage } from "../../_internal/schema/index.js";
|
|
2
|
+
import type { ErrorMessage, array, typeToString } from "../../_internal/util/index.js";
|
|
3
3
|
import type { InferredMorph, LimitLiteral } from "../../attributes.ts";
|
|
4
4
|
import type { Comparator } from "../reduce/shared.ts";
|
|
5
5
|
import type { BoundExpressionKind, writeInvalidLimitMessage } from "../shift/operator/bounds.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { writeUnassignableDefaultValueMessage } from "
|
|
2
|
-
import type { EmptyObject, ErrorMessage } from "
|
|
1
|
+
import type { writeUnassignableDefaultValueMessage } from "../../_internal/schema/index.js";
|
|
2
|
+
import type { EmptyObject, ErrorMessage } from "../../_internal/util/index.js";
|
|
3
3
|
import type { DefaultLiteral, inferDefaultLiteral } from "../shift/operator/default.ts";
|
|
4
4
|
import type { inferAstIn } from "./infer.ts";
|
|
5
5
|
import type { astToString } from "./utils.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { writeIndivisibleMessage } from "
|
|
2
|
-
import type { ErrorMessage } from "
|
|
1
|
+
import type { writeIndivisibleMessage } from "../../_internal/schema/index.js";
|
|
2
|
+
import type { ErrorMessage } from "../../_internal/util/index.js";
|
|
3
3
|
import type { InferredMorph } from "../../attributes.ts";
|
|
4
4
|
import type { inferAstRoot } from "./infer.ts";
|
|
5
5
|
import type { writeConstrainedMorphMessage } from "./utils.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GenericAst, GenericParamAst, writeUnsatisfiedParameterConstraintMessage } from "
|
|
2
|
-
import type { array, ErrorMessage, Hkt, Key, typeToString } from "
|
|
1
|
+
import type { GenericAst, GenericParamAst, writeUnsatisfiedParameterConstraintMessage } from "../../_internal/schema/index.js";
|
|
2
|
+
import type { array, ErrorMessage, Hkt, Key, typeToString } from "../../_internal/util/index.js";
|
|
3
3
|
import type { RecordHkt } from "../../keywords/ts.ts";
|
|
4
4
|
import type { UnparsedScope } from "../../scope.ts";
|
|
5
5
|
import type { inferDefinition } from "../definition.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { arkKeyOf, array } from "
|
|
1
|
+
import type { arkKeyOf, array } from "../../_internal/util/index.js";
|
|
2
2
|
import type { distill, inferIntersection, inferPipe, LimitLiteral, withDefault } from "../../attributes.ts";
|
|
3
3
|
import type { type } from "../../keywords/keywords.ts";
|
|
4
4
|
import type { inferDefinition } from "../definition.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { writeNonStructuralOperandMessage } from "
|
|
2
|
-
import type { ErrorMessage, typeToString } from "
|
|
1
|
+
import type { writeNonStructuralOperandMessage } from "../../_internal/schema/index.js";
|
|
2
|
+
import type { ErrorMessage, typeToString } from "../../_internal/util/index.js";
|
|
3
3
|
import type { inferAstRoot } from "./infer.ts";
|
|
4
4
|
import type { validateAst } from "./validate.ts";
|
|
5
5
|
export type validateKeyof<operandAst, $, args> = inferAstRoot<operandAst, $, args> extends infer data ? [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { satisfy, Stringifiable } from "
|
|
1
|
+
import type { satisfy, Stringifiable } from "../../_internal/util/index.js";
|
|
2
2
|
import type { Comparator } from "../reduce/shared.ts";
|
|
3
3
|
import type { OperatorToken } from "../shift/tokens.ts";
|
|
4
4
|
import type { DefAst, InferredAst, InfixExpression, PostfixExpression } from "./infer.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { arkKind, PrivateDeclaration, writeMissingSubmoduleAccessMessage } from "
|
|
2
|
-
import type { anyOrNever, array, BigintLiteral, Completion, ErrorMessage, NumberLiteral, writeMalformedNumericLiteralMessage } from "
|
|
1
|
+
import type { arkKind, PrivateDeclaration, writeMissingSubmoduleAccessMessage } from "../../_internal/schema/index.js";
|
|
2
|
+
import type { anyOrNever, array, BigintLiteral, Completion, ErrorMessage, NumberLiteral, writeMalformedNumericLiteralMessage } from "../../_internal/util/index.js";
|
|
3
3
|
import type { Generic } from "../../generic.ts";
|
|
4
4
|
import type { BranchOperator, Comparator } from "../reduce/shared.ts";
|
|
5
5
|
import type { writeInvalidGenericArgCountMessage } from "../shift/operand/genericArgs.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseRoot, type BaseParseContext, type StandardSchemaV1 } from "
|
|
2
|
-
import { type anyOrNever, type array, type Constructor, type ErrorMessage, type Fn, type ifEmptyObjectLiteral, type inferred, type objectKindOrDomainOf, type Primitive } from "
|
|
1
|
+
import { BaseRoot, type BaseParseContext, type StandardSchemaV1 } from "../_internal/schema/index.js";
|
|
2
|
+
import { type anyOrNever, type array, type Constructor, type ErrorMessage, type Fn, type ifEmptyObjectLiteral, type inferred, type objectKindOrDomainOf, type Primitive } from "../_internal/util/index.js";
|
|
3
3
|
import type { Out } from "../attributes.ts";
|
|
4
4
|
import type { type } from "../keywords/keywords.ts";
|
|
5
|
-
import type { InnerParseResult } from "../scope.ts";
|
|
5
|
+
import type { bindThis, InnerParseResult } from "../scope.ts";
|
|
6
6
|
import type { instantiateType } from "../variants/instantiate.ts";
|
|
7
7
|
import type { ObjectType } from "../variants/object.ts";
|
|
8
8
|
import type { shallowDefaultableMessage, shallowOptionalMessage, validateString } from "./ast/validate.ts";
|
|
@@ -14,7 +14,7 @@ import { type inferTupleLiteral, type validateTupleLiteral } from "./tupleLitera
|
|
|
14
14
|
export declare const parseInnerDefinition: (def: unknown, ctx: BaseParseContext) => InnerParseResult;
|
|
15
15
|
export declare const parseObject: (def: object, ctx: BaseParseContext) => BaseRoot;
|
|
16
16
|
export declare const writeAsyncStandardSchemaMessage: (vendor: string) => string;
|
|
17
|
-
export type inferDefinition<def,
|
|
17
|
+
export type inferDefinition<def, $ = {}, args = bindThis<def>> = [
|
|
18
18
|
def
|
|
19
19
|
] extends [anyOrNever] ? def : def extends type.cast<infer t> ? def extends {
|
|
20
20
|
[inferred]: infer t;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BaseParseContext, type BaseRoot, type writeInvalidPropertyKeyMessage } from "
|
|
2
|
-
import { Backslash, type anyOrNever, type Dict, type ErrorMessage, type ErrorType, type Key, type merge, type show } from "
|
|
1
|
+
import { type BaseParseContext, type BaseRoot, type writeInvalidPropertyKeyMessage } from "../_internal/schema/index.js";
|
|
2
|
+
import { Backslash, type anyOrNever, type Dict, type ErrorMessage, type ErrorType, type Key, type merge, type show } from "../_internal/util/index.js";
|
|
3
3
|
import type { validateString } from "./ast/validate.ts";
|
|
4
4
|
import type { inferDefinition } from "./definition.ts";
|
|
5
5
|
import { type OptionalPropertyDefinition, type OptionalPropertyString, type validateProperty } from "./property.ts";
|
package/out/parser/property.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseParseContext, BaseRoot, TypeMeta, UndeclaredKeyBehavior } from "
|
|
2
|
-
import { type anyOrNever, type ErrorMessage, type ErrorType, type typeToString } from "
|
|
1
|
+
import type { BaseParseContext, BaseRoot, TypeMeta, UndeclaredKeyBehavior } from "../_internal/schema/index.js";
|
|
2
|
+
import { type anyOrNever, type ErrorMessage, type ErrorType, type typeToString } from "../_internal/util/index.js";
|
|
3
3
|
import { type inferDefinition, type validateInnerDefinition } from "./definition.ts";
|
|
4
4
|
import type { ParsedKeyKind, writeInvalidSpreadTypeMessage } from "./objectLiteral.ts";
|
|
5
5
|
import type { ParsedDefaultableProperty } from "./shift/operator/default.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseParseContext, BaseRoot } from "
|
|
2
|
-
import { type requireKeys, type Scanner } from "
|
|
1
|
+
import type { BaseParseContext, BaseRoot } from "../../_internal/schema/index.js";
|
|
2
|
+
import { type requireKeys, type Scanner } from "../../_internal/util/index.js";
|
|
3
3
|
import type { LimitLiteral } from "../../attributes.ts";
|
|
4
4
|
import type { FinalizingLookahead, InfixToken } from "../shift/tokens.ts";
|
|
5
5
|
import { type BranchOperator, type Comparator, type MaxComparator, type OpenLeftBound, type StringifiablePrefixOperator } from "./shared.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Completion, ErrorMessage, defined, writeUnclosedGroupMessage, writeUnmatchedGroupCloseMessage } from "
|
|
1
|
+
import type { Completion, ErrorMessage, defined, writeUnclosedGroupMessage, writeUnmatchedGroupCloseMessage } from "../../_internal/util/index.js";
|
|
2
2
|
import type { LimitLiteral } from "../../attributes.ts";
|
|
3
3
|
import type { FinalizingLookahead } from "../shift/tokens.ts";
|
|
4
4
|
import type { BranchOperator, Comparator, InvertedComparators, MaxComparator, MinComparator, OpenLeftBound, StringifiablePrefixOperator, writeMultipleLeftBoundsMessage, writeOpenRangeMessage, writeUnpairableComparatorMessage } from "./shared.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Backslash, type ErrorMessage, type Scanner } from "
|
|
2
|
-
import type { Regex, regex } from "
|
|
1
|
+
import { Backslash, type ErrorMessage, type Scanner } from "../../../_internal/util/index.js";
|
|
2
|
+
import type { Regex, regex } from "../../../_internal/regex/index.js";
|
|
3
3
|
import type { Out } from "../../../attributes.ts";
|
|
4
4
|
import type { InferredAst } from "../../ast/infer.ts";
|
|
5
5
|
import type { RuntimeState } from "../../reduce/dynamic.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseRoot, GenericAst, genericParamNames, GenericRoot } from "
|
|
2
|
-
import { writeUnclosedGroupMessage, type array, type ErrorMessage, type join } from "
|
|
1
|
+
import type { BaseRoot, GenericAst, genericParamNames, GenericRoot } from "../../../_internal/schema/index.js";
|
|
2
|
+
import { writeUnclosedGroupMessage, type array, type ErrorMessage, type join } from "../../../_internal/util/index.js";
|
|
3
3
|
import type { RuntimeState } from "../../reduce/dynamic.ts";
|
|
4
4
|
import type { s, StaticState } from "../../reduce/static.ts";
|
|
5
5
|
import type { parseUntilFinalizer } from "../../string.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Scanner, type WhitespaceChar } from "
|
|
1
|
+
import { type Scanner, type WhitespaceChar } from "../../../_internal/util/index.js";
|
|
2
2
|
import type { InferredAst } from "../../ast/infer.ts";
|
|
3
3
|
import type { RuntimeState } from "../../reduce/dynamic.ts";
|
|
4
4
|
import type { StaticState, s } from "../../reduce/static.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { writeUnresolvableMessage, type BaseRoot, type GenericAst, type GenericRoot, type arkKind, type genericParamNames, type resolvableReferenceIn, type writeNonSubmoduleDotMessage } from "
|
|
2
|
-
import { type BigintLiteral, type NonFiniteNumberLiteral, type NumberLiteral, type Scanner, type join, type lastOf } from "
|
|
1
|
+
import { writeUnresolvableMessage, type BaseRoot, type GenericAst, type GenericRoot, type arkKind, type genericParamNames, type resolvableReferenceIn, type writeNonSubmoduleDotMessage } from "../../../_internal/schema/index.js";
|
|
2
|
+
import { type BigintLiteral, type NonFiniteNumberLiteral, type NumberLiteral, type Scanner, type join, type lastOf } from "../../../_internal/util/index.js";
|
|
3
3
|
import type { ArkAmbient } from "../../../config.ts";
|
|
4
4
|
import type { resolutionToAst } from "../../../scope.ts";
|
|
5
5
|
import type { GenericInstantiationAst } from "../../ast/generic.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BaseScope } from "
|
|
2
|
-
import { type Dict } from "
|
|
1
|
+
import { type BaseScope } from "../../../_internal/schema/index.js";
|
|
2
|
+
import { type Dict } from "../../../_internal/util/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* What a name from Zod, TypeScript or JSON Schema is written as here. Every key
|
|
5
5
|
* is unresolvable in the default scope, and every value parses in it
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type BaseRoot, type BoundKind } from "
|
|
2
|
-
import { type KeySet, type Scanner } from "
|
|
1
|
+
import { type BaseRoot, type BoundKind } from "../../../_internal/schema/index.js";
|
|
2
|
+
import { type KeySet, type Scanner } from "../../../_internal/util/index.js";
|
|
3
3
|
import type { DateLiteral } from "../../../attributes.ts";
|
|
4
4
|
import type { InferredAst } from "../../ast/infer.ts";
|
|
5
5
|
import type { RootedRuntimeState, RuntimeState } from "../../reduce/dynamic.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { emptyBrandNameMessage } from "
|
|
2
|
-
import type { Scanner } from "
|
|
1
|
+
import type { emptyBrandNameMessage } from "../../../_internal/schema/index.js";
|
|
2
|
+
import type { Scanner } from "../../../_internal/util/index.js";
|
|
3
3
|
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
4
4
|
import type { StaticState, s } from "../../reduce/static.ts";
|
|
5
5
|
import { shiftUntilTerminator } from "../tokens.ts";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { BaseRoot } from "
|
|
2
|
-
import { type BigintLiteral, type ErrorMessage, type NonFiniteNumberLiteral, type NumberLiteral, type Scanner, type trim } from "
|
|
3
|
-
import type { type } from "../../../keywords/keywords.ts";
|
|
1
|
+
import type { BaseRoot } from "../../../_internal/schema/index.js";
|
|
2
|
+
import { type BigintLiteral, type ErrorMessage, type NonFiniteNumberLiteral, type NumberLiteral, type Scanner, type trim } from "../../../_internal/util/index.js";
|
|
4
3
|
import type { DateLiteral } from "../../../attributes.ts";
|
|
4
|
+
import type { inferDefinition } from "../../definition.ts";
|
|
5
5
|
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
6
6
|
import type { EnclosingLiteralStartToken, EnclosingLiteralTokens, StringLiteral } from "../operand/enclosed.ts";
|
|
7
7
|
type UnitLiteralKeyword = "null" | "undefined" | "true" | "false";
|
|
@@ -15,7 +15,7 @@ export type EnclosedUnitLiteral = StringLiteral | DateLiteral;
|
|
|
15
15
|
*/
|
|
16
16
|
export type EmptyCollectionLiteral = "[]" | "{}";
|
|
17
17
|
export type DefaultLiteral = UnitLiteral | EmptyCollectionLiteral;
|
|
18
|
-
export type inferDefaultLiteral<literal> = literal extends "[]" ? [] : literal extends "{}" ? {} :
|
|
18
|
+
export type inferDefaultLiteral<literal> = literal extends "[]" ? [] : literal extends "{}" ? {} : inferDefinition<literal, {}, {}>;
|
|
19
19
|
export type ParsedDefaultableProperty = readonly [BaseRoot, "=", unknown];
|
|
20
20
|
export declare const parseDefault: (s: RootedRuntimeState) => ParsedDefaultableProperty;
|
|
21
21
|
export type parseDefault<root, unscanned extends string> = trim<unscanned> extends infer defaultExpression extends string ? defaultExpression extends UnenclosedUnitLiteral | EmptyCollectionLiteral ? [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Scanner } from "
|
|
1
|
+
import { type Scanner } from "../../../_internal/util/index.js";
|
|
2
2
|
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
3
3
|
import type { StaticState, s } from "../../reduce/static.ts";
|
|
4
4
|
import { shiftUntilTerminator } from "../tokens.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Scanner, type WhitespaceChar } from "
|
|
1
|
+
import { type Scanner, type WhitespaceChar } from "../../../_internal/util/index.js";
|
|
2
2
|
import type { RootedRuntimeState } from "../../reduce/dynamic.ts";
|
|
3
3
|
import type { StaticState, s } from "../../reduce/static.ts";
|
|
4
4
|
import { lookaheadIsFinalizing, type FinalizingLookahead } from "../tokens.ts";
|
package/out/parser/string.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { arkKind, BaseParseContext, GenericAst, resolvableReferenceIn } from "
|
|
2
|
-
import { type anyOrNever, type Backslash, type BigintLiteral, type ErrorMessage, type NumberLiteral, type WhitespaceChar } from "
|
|
1
|
+
import type { arkKind, BaseParseContext, GenericAst, resolvableReferenceIn } from "../_internal/schema/index.js";
|
|
2
|
+
import { type anyOrNever, type Backslash, type BigintLiteral, type ErrorMessage, type NumberLiteral, type WhitespaceChar } from "../_internal/util/index.js";
|
|
3
3
|
import type { DateLiteral } from "../attributes.ts";
|
|
4
4
|
import type { ArkAmbient } from "../config.ts";
|
|
5
5
|
import type { InnerParseResult, resolutionToAst } from "../scope.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type BaseParseContext, type BaseRoot, type Morph, type NodeSelector, type Predicate, type TypeMeta, type unwrapDefault } from "
|
|
2
|
-
import { type
|
|
3
|
-
import type { defaultFor, distill, inferIntersection, inferMorphOut, inferPipe, inferPredicate,
|
|
1
|
+
import { type BaseParseContext, type BaseRoot, type Morph, type NodeSelector, type Predicate, type TypeMeta, type unwrapDefault } from "../_internal/schema/index.js";
|
|
2
|
+
import { type array, type BuiltinObjectKind, type Constructor, type Domain, type show } from "../_internal/util/index.js";
|
|
3
|
+
import type { defaultFor, distill, inferIntersection, inferMorphOut, inferPipe, inferPredicate, Out, withDefault } from "../attributes.ts";
|
|
4
4
|
import type { type } from "../keywords/keywords.ts";
|
|
5
5
|
import type { inferDefinition, validateDefinition } from "./definition.ts";
|
|
6
6
|
import { writeMissingRightOperandMessage } from "./shift/operand/unenclosed.ts";
|
|
@@ -16,7 +16,7 @@ export type validatePrefixExpression<def extends IndexZeroExpression, $, args> =
|
|
|
16
16
|
export type validateIndexOneExpression<def extends IndexOneExpression, $, args> = def[1] extends TuplePostfixOperator ? readonly [validateDefinition<def[0], $, args>, def[1]] : readonly [
|
|
17
17
|
validateDefinition<def[0], $, args>,
|
|
18
18
|
def["length"] extends 2 ? writeMissingRightOperandMessage<def[1]> : def[1],
|
|
19
|
-
def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ?
|
|
19
|
+
def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ? Predicate<type.infer.Out<def[0], $, args>> : def[1] extends "=>" ? Morph<type.infer.Out<def[0], $, args>> : def[1] extends "|>" ? validateDefinition<def[2], $, args> : def[1] extends "=" ? defaultFor<type.infer.In<def[0], $, args>> : def[1] extends "@" ? TypeMeta.MappableInput : validateDefinition<def[2], $, args>,
|
|
20
20
|
...(def[1] extends "@" ? [NodeSelector?] : [])
|
|
21
21
|
];
|
|
22
22
|
export type UnparsedTupleExpressionInput = {
|
|
@@ -24,6 +24,7 @@ export type UnparsedTupleExpressionInput = {
|
|
|
24
24
|
"===": unknown;
|
|
25
25
|
};
|
|
26
26
|
export type UnparsedTupleOperator = show<keyof UnparsedTupleExpressionInput>;
|
|
27
|
+
export declare const assertTupleArity: (def: array, operator: TupleExpressionOperator, min: number, max?: number) => void;
|
|
27
28
|
export declare const parseKeyOfTuple: IndexZeroParser<"keyof">;
|
|
28
29
|
export type inferKeyOfExpression<operandDef, $, args> = show<keyof inferDefinition<operandDef, $, args>>;
|
|
29
30
|
export type TupleExpression = IndexZeroExpression | IndexOneExpression;
|
|
@@ -33,10 +34,6 @@ export declare const parseMorphTuple: IndexOneParser<"=>">;
|
|
|
33
34
|
export declare const writeMalformedFunctionalExpressionMessage: (operator: ":" | "=>", value: unknown) => string;
|
|
34
35
|
export type parseTo<inDef, outDef, $, args> = inferPipe<inferDefinition<inDef, $, args>, inferDefinition<outDef, $, args>>;
|
|
35
36
|
export type parseMorph<inDef, morph, $, args> = morph extends Morph ? inferMorphOut<morph> extends infer out ? (In: distill.In<inferDefinition<inDef, $, args>>) => Out<out> : never : never;
|
|
36
|
-
export type validatePredicate<operand, data> = [
|
|
37
|
-
operand
|
|
38
|
-
] extends [anyOrNever] ? Predicate<data> : [operand] extends [InferredMorph] ? ErrorMessage<narrowedMorphMessage> : Predicate<data>;
|
|
39
|
-
export type narrowedMorphMessage = "Predicate operand must be unknown (was a morph)";
|
|
40
37
|
export declare const parseNarrowTuple: IndexOneParser<":">;
|
|
41
38
|
export type IndexOneExpression<token extends string = IndexOneOperator> = readonly [unknown, token, ...unknown[]];
|
|
42
39
|
type IndexOneParser<token extends string> = (def: IndexOneExpression<token>, ctx: BaseParseContext) => BaseRoot;
|
|
@@ -80,4 +77,5 @@ declare const indexZeroParsers: {
|
|
|
80
77
|
};
|
|
81
78
|
export type IndexZeroOperator = keyof typeof indexZeroParsers;
|
|
82
79
|
export declare const writeInvalidConstructorMessage: <actual extends Domain | BuiltinObjectKind>(actual: actual) => string;
|
|
80
|
+
export declare const writeUnexpectedTupleElementsMessage: (operator: TupleExpressionOperator, expected: number | string, actual: number) => string;
|
|
83
81
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { postfixAfterOptionalOrDefaultableMessage, type BaseParseContext, type BaseRoot, type Sequence } from "
|
|
2
|
-
import { type array, type conform, type ErrorMessage, type satisfy } from "
|
|
1
|
+
import { postfixAfterOptionalOrDefaultableMessage, type BaseParseContext, type BaseRoot, type Sequence } from "../_internal/schema/index.js";
|
|
2
|
+
import { type array, type conform, type ErrorMessage, type satisfy } from "../_internal/util/index.js";
|
|
3
3
|
import type { inferDefinition, validateInnerDefinition } from "./definition.ts";
|
|
4
4
|
import { type DefaultablePropertyTuple, type isDefaultable, type OptionalPropertyDefinition } from "./property.ts";
|
|
5
5
|
export declare const parseTupleLiteral: (def: array, ctx: BaseParseContext) => BaseRoot;
|
package/out/precompiled.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { registerPrecompiledUnits } from "
|
|
1
|
+
export { registerPrecompiledUnits } from "./_internal/schema/index.js";
|
package/out/precompiled.js
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import "./chunk-LHNEY6QW.js";
|
|
2
|
+
export { registerPrecompiledUnits } from "./chunk-KXOC3JEX.js";
|
|
3
|
+
import "./chunk-CWSF57VM.js";
|
|
4
|
+
import "./chunk-UJJGG4VQ.js";
|
|
5
|
+
import "./chunk-US6BWOGJ.js";
|
|
6
|
+
import "./chunk-KXOSUYRA.js";
|
|
7
|
+
import "./chunk-W2XOI5DY.js";
|
|
8
|
+
import "./chunk-TACLEIDM.js";
|
|
9
|
+
import "./chunk-K7SLP5D2.js";
|
|
10
|
+
import "./chunk-VYMXHSFR.js";
|
|
11
|
+
import "./chunk-PDLTEX6Z.js";
|
|
12
|
+
import "./chunk-3KBOPH3J.js";
|
|
13
|
+
import "./chunk-ZRYEHGSG.js";
|
|
14
|
+
import "./chunk-3SH2BQ4T.js";
|
|
15
|
+
import "./chunk-3HZC67MT.js";
|
|
16
|
+
import "./chunk-I2KLQ2HA.js";
|
package/out/regex.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./_internal/regex/index.js";
|
package/out/regex.js
ADDED
package/out/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { JsonSchema, RootApply, StandardJSONSchemaV1, StandardSchemaV1 } from "
|
|
2
|
-
import { ArkErrors, type ArkErrorCode, type ArkIssue, type CompactApply, type UnionIssueOf, type FailHandler, type FailureContext, type FailureSite, type InternalTraversal, type IssuesClass, type SiteContext, type Traversal } from "
|
|
3
|
-
import { type Fn, type inferred, type JsonStructure } from "
|
|
1
|
+
import type { ArkEnv, JsonSchema, RootApply, StandardJSONSchemaV1, StandardSchemaV1, ToJsonSchema } from "./_internal/schema/index.js";
|
|
2
|
+
import { ArkErrors, type ArkErrorCode, type ArkIssue, type CompactApply, type ContextualTarget, type UnionIssueOf, type FailHandler, type FailureContext, type FailureSite, type InternalTraversal, type IssuesClass, type SiteContext, type Traversal } from "./_internal/schema/runtime.js";
|
|
3
|
+
import { type Fn, type inferred, type JsonStructure } from "./_internal/util/index.js";
|
|
4
4
|
import { InternalTypedFn } from "./fn.ts";
|
|
5
5
|
import type { introspectionMembers } from "./standalone.ts";
|
|
6
6
|
import type { ArrayType } from "./variants/array.ts";
|
|
@@ -8,8 +8,8 @@ import type { DateType } from "./variants/date.ts";
|
|
|
8
8
|
import type { NumberType } from "./variants/number.ts";
|
|
9
9
|
import type { ObjectType } from "./variants/object.ts";
|
|
10
10
|
import type { StringType } from "./variants/string.ts";
|
|
11
|
-
export { addErrors, addMorphErrs, aliasVisits, allowsAcyclic, allowsInBranch, allowsInBranchBy, allowsInContext, allowsUntracked, appliesValues, applyCyclic, applyIssues, applyRejected, ArkErrors, arrayIndexMatcher, callMorph, codedIssue, computeDefaultValueMorph, configure, configuredFallbackOf, configuredWriterOf, copyDeclared, copyOf, alikeIssue, describeCollapsibleDate, describePredicate, disallowed, discriminatesBooleans, enInfo, enterApplied, enterResolution, execMorph, exitResolution, exitApplied, failsInBranches, failsKey, failsKeySite, failsSite, FirstIssues, FirstIssueTraversal, fixConfig, foundErrors, fixConfigured, holdsOnlyIndices, keepOwn, InternalTraversal, listedIssue, matchesRepeated, mergeTransformed, missingTextOf, pipe, pipeApplied, pipeChecked, pipeTransformed, printKind, rejected, rejects, runtimeConfig, runtimeScope, silentCtx, throwIssues, throwOnDefault, TransformErrors, transformed, transformedInApply, transformIfAllowed, transformResolution, transformsBranches, transformsValid, Traversal, TraversalError, tryMorph, writeDomainActual, writeLengthActual, writeMessage, writeNotEqualActual, writeProtoActual, writeNullableJsonSchema, writeUnionJsonSchema, writeUnitActual, writeUnitMessage, type ArkError } from "
|
|
12
|
-
export { baseNameOf, functionNameOf, isIpv4, isIpv6, isIso8601, isNumericString, isPlainObjectOrArray, isUuid, isValidDate, isWellFormedInteger, jsTypeOfDescriptions, liftArray, ParseError, printable, throwParseError, timeOf } from "
|
|
11
|
+
export { addErrors, addMorphErrs, aliasVisits, allowsAcyclic, allowsInBranch, allowsInBranchBy, allowsInContext, allowsUntracked, appliesValues, applyCyclic, applyIssues, applyRejected, ArkErrors, arrayIndexMatcher, callMorph, codedIssue, computeDefaultValueMorph, configure, configuredFallbackOf, configuredWriterOf, copyDeclared, copyOf, alikeIssue, describeCollapsibleDate, describePredicate, disallowed, discriminatesBooleans, enInfo, enterApplied, enterResolution, execMorph, exitResolution, exitApplied, failsInBranches, failsKey, failsKeySite, failsSite, FirstIssues, FirstIssueTraversal, fixConfig, foundErrors, fixConfigured, holdsOnlyIndices, keepOwn, InternalTraversal, listedIssue, matchesRepeated, mergeTransformed, missingTextOf, pipe, pipeApplied, pipeChecked, pipeTransformed, printKind, rejected, rejects, runtimeConfig, runtimeScope, silentCtx, throwIssues, throwOnDefault, TransformErrors, transformed, transformedInApply, transformIfAllowed, transformResolution, transformsBranches, transformsValid, Traversal, TraversalError, tryMorph, withContextOf, writeDomainActual, writeLengthActual, writeMessage, writeNotEqualActual, writeProtoActual, writeNullableJsonSchema, writeUnionJsonSchema, writeUnitActual, writeUnitMessage, type ArkError } from "./_internal/schema/runtime.js";
|
|
12
|
+
export { baseNameOf, functionNameOf, isIpv4, isIpv6, isIso8601, isNumericString, isPlainObjectOrArray, isUuid, isValidDate, isWellFormedInteger, jsTypeOfDescriptions, liftArray, ParseError, printable, throwParseError, timeOf } from "./_internal/util/index.js";
|
|
13
13
|
export * from "./checkers.ts";
|
|
14
14
|
export * from "./keywords/functions.ts";
|
|
15
15
|
export interface ValidatorAttributes {
|
|
@@ -22,7 +22,7 @@ export interface ValidatorAttributes {
|
|
|
22
22
|
"~standard"?: Pick<StandardJSONSchemaV1.Props, "jsonSchema">;
|
|
23
23
|
}
|
|
24
24
|
export type IntrospectionMember = (typeof introspectionMembers)[number];
|
|
25
|
-
export declare const
|
|
25
|
+
export declare const precompiledForArktype_3_0_0_rc_0 = true;
|
|
26
26
|
export declare const assign: {
|
|
27
27
|
<T extends {}, U>(target: T, source: U): T & U;
|
|
28
28
|
<T extends {}, U, V>(target: T, source1: U, source2: V): T & U & V;
|
|
@@ -49,6 +49,7 @@ export declare class Validator {
|
|
|
49
49
|
allows: (data: unknown) => boolean;
|
|
50
50
|
assert: (data: unknown, pipedFromCtx?: Traversal) => unknown;
|
|
51
51
|
"~standard": StandardSchemaV1.Props;
|
|
52
|
+
withContext: (context: ArkEnv.context) => ContextualTarget;
|
|
52
53
|
expression: string;
|
|
53
54
|
description: string;
|
|
54
55
|
json: JsonStructure;
|
|
@@ -61,6 +62,7 @@ export declare class Validator {
|
|
|
61
62
|
export declare const own: <t extends object>(validator: t, attributes: object) => t;
|
|
62
63
|
export declare const bakeInto: <t>(validator: t, { "~standard": standard, ...attributes }: Omit<ValidatorAttributes, "meta">) => t;
|
|
63
64
|
export declare const standardResultOf: (out: unknown) => StandardSchemaV1.Result<unknown>;
|
|
65
|
+
export declare const standardValidated: (validator: Validator, input: unknown, options: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<unknown>;
|
|
64
66
|
export declare const siteOf: (code: ArkErrorCode, description?: string, message?: string) => SiteContext;
|
|
65
67
|
export declare const requiredSiteOf: (description?: string) => FailureSite;
|
|
66
68
|
export declare const keySiteOf: (code: ArkErrorCode, description?: string, missing?: any) => FailureSite;
|
|
@@ -95,8 +97,8 @@ interface JsonSchemaOptions {
|
|
|
95
97
|
export declare const replayedJsonSchema: (write: () => JsonSchema, byTarget: readonly ((() => JsonSchema) | 0)[], replays: readonly (((fallBack: FallBack) => JsonSchema) | 0)[]) => ((opts?: JsonSchemaOptions) => JsonSchema);
|
|
96
98
|
type JsonSchemaWritersByTarget = readonly (() => JsonSchema)[];
|
|
97
99
|
export declare const bakedStandardJsonSchema: (input: JsonSchemaWritersByTarget, output: JsonSchemaWritersByTarget) => StandardJSONSchemaV1.Converter;
|
|
98
|
-
export declare const throwJsonSchemaError: (code:
|
|
99
|
-
export declare const fallbackThrower: (code:
|
|
100
|
+
export declare const throwJsonSchemaError: (code: ToJsonSchema.Code, message: string, context: object) => never;
|
|
101
|
+
export declare const fallbackThrower: (code: ToJsonSchema.Code, header: string) => (ctx: object) => never;
|
|
100
102
|
export declare const throwUnbaked: (reason: string) => never;
|
|
101
103
|
export declare const typedFn: (raw: Fn, params: Validator, returns: Validator) => InternalTypedFn;
|
|
102
104
|
export declare const type: {
|
package/out/runtime.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { ArkErrors, FirstIssueTraversal, FirstIssues, InternalTraversal, InvalidErrors,
|
|
2
|
-
import "./chunk-
|
|
3
|
-
export { capitalizeString, emptyCollectionDefaults, epochDescriptions, isEpochString, isJsonString, isLuhnValid, isParsableDate, isParsableUrl, isRegexPattern, keepFormatted, lowercaseString, maxEpoch, normalizationsByForm, parseDate, parseEpoch, parseFormData, parseInteger, parseIsoDate, parseJson, parseNumeric, parseUrl, parsesFinite, raisedErrorPhrases, stringifyJson, trimString, uppercaseString, writeEpoch, writeIsoDate,
|
|
4
|
-
|
|
1
|
+
export { ArkErrors, FirstIssueTraversal, FirstIssues, InternalTraversal, InvalidErrors, TransformErrors, Traversal, TraversalError, Validator, addErrors, addMorphErrs, aliasVisits, aliasedMember, aliasedValue, alikeIssue, allowsAcyclic, allowsInBranch, allowsInBranchBy, allowsInContext, allowsOf, allowsReadingCtx, allowsUntracked, appliesValues, applyCallErrors, applyCyclic, applyElements, applyErrors, applyIssues, applyNodeErrors, applyRejected, arrayCheck, arrayIndexMatcher, arrayOf, assign, bakeInto, bakedJsonSchema, bakedJsonSchemaOptionsMessage, bakedStandardJsonSchema, booleanChecker, callMorph, callingDeferredRootApply, callingRootApply, canParseUrl, check, checkArity, checkDefault, checkDigest, checkFacts, checkFunction, checkHeld, checkHelper, checkIdentity, checkInput, checkProgress, checkerNode, closedProps, codeSiteOf, codedIssue, compiled, computeDefaultValueMorph, configure, configuredFallbackOf, configuredWriterOf, copyDeclared, copyOf, createValidator, createValidatorWith, ctxNode, deepFreeze, deferred, deletingProps, describeCollapsibleDate, describeDomains, describePredicate, describeShape, describeValues, digestOf, disallowed, discriminate, discriminateOr, discriminatesBooleans, divisor, domains, elementsOf, emptyMeta, enInfo, enterApplied, enterResolution, exactLength, execMorph, exitApplied, exitResolution, factOfHole, failingArrayOf, failingBranches, failingClosedProps, failingDeletingProps, failingElementsOf, failingProps, failsAt, failsAtKey, failsAtPath, failsBranches, failsIn, failsInBranches, failsKey, failsKeySite, failsKeyWith, failsListed, failsSite, failsWith, fallbackThrower, firstIssue, fixConfig, fixConfigured, foundErrors, freeze, holdHoles, holdingAlias, holdsOnlyIndices, holesOf, indexed, integerCheck, integerRange, intern, internIn, internTable, interned, internedTable, intersection, is, keepOwn, keySiteOf, lessThan, listedIssue, matchesRepeated, max, maxLength, mergeTransformed, min, minLength, missingTextOf, moreThan, morphing, narrowed, narrowedAfter, narrowedBy, narrowedByEach, narrowedInCtx, narrowedRejecting, narrowedWithCtx, nullable, nullableDescriptionOf, nullableObject, numberCheck, objectCheck, once, optional, own, ownIssue, pattern, pipe, pipeApplied, pipeChecked, pipeTransformed, piped, pipedIntoUndetailed, precompiledForArktype_3_0_0_rc_0, printKind, props, raisingTraversalOf, readingCtx, readingCtxNode, receiverOf, recordOf, rejected, rejecting, rejects, rejectsWith, rekeyed, replacingUndefined, replayedJsonSchema, required, requiredSiteOf, runtimeConfig, runtimeScope, saying, sayingMissing, setPrototypeOf, silentCtx, siteOf, sited, sitedProps, standardResultOf, standardValidated, stringCheck, stringRange, throwIssues, throwJsonSchemaError, throwOnDefault, throwUnbaked, transformIfAllowed, transformOf, transformResolution, transformed, transformedInApply, transformingClosedProps, transformingElementsOf, transformingNarrowedAfter, transformingProps, transformsBranches, transformsValid, tryMorph, type, typedFn, union, unit, units, unnamed, unreadCallErrors, unreadElements, unreadErrors, withContextOf, writeCreationMismatchMessage, writeDigestMismatchMessage, writeDomainActual, writeIdentityMismatchMessage, writeLengthActual, writeMessage, writeNotEqualActual, writeNullableJsonSchema, writeProtoActual, writeUnbakedMessage, writeUnionJsonSchema, writeUnitActual, writeUnitMessage, writtenBy, writtenSiteOf } from "./chunk-XNUAQSJ4.js";
|
|
2
|
+
import "./chunk-4FTHWK63.js";
|
|
3
|
+
export { capitalizeString, emptyCollectionDefaults, epochDescriptions, isEpochString, isJsonString, isLuhnValid, isParsableDate, isParsableUrl, isRegexPattern, keepFormatted, lowercaseString, maxEpoch, normalizationsByForm, parseDate, parseEpoch, parseFormData, parseInteger, parseIsoDate, parseJson, parseNumeric, parseUrl, parsesFinite, raisedErrorPhrases, stringifyJson, trimString, uppercaseString, writeEpoch, writeIsoDate, writeUrl } from "./chunk-4HREHNIV.js";
|
|
4
|
+
export { isIpv4, isIpv6, isIso8601, isUuid } from "./chunk-US6BWOGJ.js";
|
|
5
|
+
export { ParseError, baseNameOf, functionNameOf, isNumericString, isPlainObjectOrArray, isValidDate, isWellFormedInteger, jsTypeOfDescriptions, liftArray, printable, throwParseError, timeOf } from "./chunk-3HZC67MT.js";
|
|
6
|
+
import "./chunk-I2KLQ2HA.js";
|
|
@@ -9,10 +9,12 @@ Object.defineProperty(ArkErrors.prototype, Symbol.for("nodejs.util.inspect.custo
|
|
|
9
9
|
return "[ArkErrors]";
|
|
10
10
|
// one level more, so an issue prints as deep as it did in a bare array
|
|
11
11
|
return `ArkErrors ${inspect(shown, { ...options, depth: depth === null ? null : depth + 1 })}`;
|
|
12
|
-
}
|
|
12
|
+
},
|
|
13
|
+
configurable: true
|
|
13
14
|
});
|
|
14
|
-
// a Type
|
|
15
|
-
|
|
15
|
+
// what a Type has but a validator never does, which a library may read, e.g.
|
|
16
|
+
// `schema.in.toJsonSchema()`
|
|
17
|
+
const typeMembers = new Set([
|
|
16
18
|
"in",
|
|
17
19
|
"out",
|
|
18
20
|
"encode",
|
|
@@ -29,6 +31,7 @@ for (const member of [
|
|
|
29
31
|
"brand",
|
|
30
32
|
"configure",
|
|
31
33
|
"describe",
|
|
34
|
+
"message",
|
|
32
35
|
"onUndeclaredKey",
|
|
33
36
|
"onDeepUndeclaredKey",
|
|
34
37
|
"keyof",
|
|
@@ -68,66 +71,81 @@ for (const member of [
|
|
|
68
71
|
"props",
|
|
69
72
|
"internal",
|
|
70
73
|
"$"
|
|
71
|
-
])
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
throw new Error(`${member} is a Type's, which this standalone validator lacks. Put // @ark-runtime before the definition it's read off, so arktype defines it, or build with runtime: "arktype".`);
|
|
75
|
-
},
|
|
76
|
-
configurable: true
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
// a member a build didn't bake, which reads undefined in production
|
|
80
|
-
const lacks = (member) => new Error(`${member} isn't precompiled: set members["${member}"] true in the precompile options`);
|
|
81
|
-
// one a build bakes is the validator's own, defined over these
|
|
82
|
-
for (const member of [
|
|
74
|
+
]);
|
|
75
|
+
// what a build bakes as the validator's own where it sees code read it
|
|
76
|
+
const introspectionMembers = new Set([
|
|
83
77
|
"expression",
|
|
84
78
|
"description",
|
|
85
79
|
"json",
|
|
86
80
|
"toJSON",
|
|
87
81
|
"toJsonSchema"
|
|
88
|
-
])
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
82
|
+
]);
|
|
83
|
+
// a member a build didn't bake, which reads undefined in production
|
|
84
|
+
const lacks = (member) => `${member} isn't precompiled: set members["${member}"] true in the precompile options`;
|
|
85
|
+
const warned = new Set();
|
|
86
|
+
// set while a validator prints, which reads its expression where it has one
|
|
87
|
+
let printing = false;
|
|
88
|
+
// once for each member, with the stack of the code reading it. Counted once
|
|
89
|
+
// logged, so where console.warn throws, as a test's may, each read throws
|
|
90
|
+
const warnOnce = (member, message) => {
|
|
91
|
+
if (printing || warned.has(member))
|
|
92
|
+
return;
|
|
93
|
+
console.warn(new Error(message));
|
|
94
|
+
warned.add(member);
|
|
95
|
+
};
|
|
96
|
+
// A read of a member a validator lacks warns rather than throws, and reads
|
|
97
|
+
// undefined as in production, so code testing whether a validator has a
|
|
98
|
+
// member, like JSON.stringify reading toJSON or a Standard Schema library
|
|
99
|
+
// asking whether `"jsonSchema" in schema["~standard"]`, behaves as it does
|
|
100
|
+
// there. A getter on Validator.prototype would answer `in` and throw where
|
|
101
|
+
// it's read, so the read is caught past it, by what Validator.prototype
|
|
102
|
+
// inherits: a proxy of an object, whose own prototype is Object.prototype as
|
|
103
|
+
// Validator.prototype's is in production, so what has no such member, like
|
|
104
|
+
// `instanceof Object` or a read of hasOwnProperty, finds what it would there
|
|
105
|
+
Object.setPrototypeOf(Validator.prototype, new Proxy({}, {
|
|
106
|
+
get: (target, k, receiver) => {
|
|
107
|
+
if (typeof k === "string") {
|
|
108
|
+
if (typeMembers.has(k)) {
|
|
109
|
+
warnOnce(k, `${k} is a Type's, which this standalone validator lacks. Put // @ark-runtime before the definition it's read off, so arktype defines it, or build with runtime: "arktype".`);
|
|
110
|
+
}
|
|
111
|
+
else if (introspectionMembers.has(k))
|
|
112
|
+
warnOnce(k, lacks(k));
|
|
113
|
+
}
|
|
114
|
+
return Reflect.get(target, k, receiver);
|
|
115
|
+
},
|
|
116
|
+
// a validator is assigned its `~standard` as it's created, which this
|
|
117
|
+
// receives as the validator has none of its own: one with no
|
|
118
|
+
// jsonSchema baked warns where its jsonSchema is read
|
|
119
|
+
set: (target, k, value, receiver) => (k === "~standard" &&
|
|
120
|
+
typeof value === "object" &&
|
|
121
|
+
value !== null &&
|
|
122
|
+
!("jsonSchema" in value)) ?
|
|
123
|
+
Reflect.defineProperty(receiver, k, {
|
|
124
|
+
value: new Proxy(value, {
|
|
125
|
+
get: (standard, k, receiver) => {
|
|
126
|
+
// a module importing the validator may bake it later
|
|
127
|
+
if (k === "jsonSchema" && !(k in standard)) {
|
|
128
|
+
warnOnce("~standard.jsonSchema", lacks("~standard.jsonSchema"));
|
|
129
|
+
}
|
|
130
|
+
return Reflect.get(standard, k, receiver);
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
writable: true,
|
|
134
|
+
enumerable: true,
|
|
135
|
+
configurable: true
|
|
136
|
+
})
|
|
137
|
+
: Reflect.set(target, k, value, receiver)
|
|
138
|
+
}));
|
|
96
139
|
// what prints a validator reads its expression, and one without prints as it
|
|
97
|
-
// does in production
|
|
140
|
+
// does in production, without warning
|
|
98
141
|
const { toString } = Validator.prototype;
|
|
99
142
|
Validator.prototype.toString = function () {
|
|
143
|
+
printing = true;
|
|
100
144
|
try {
|
|
101
145
|
return toString.call(this);
|
|
102
146
|
}
|
|
103
|
-
|
|
104
|
-
|
|
147
|
+
finally {
|
|
148
|
+
printing = false;
|
|
105
149
|
}
|
|
106
150
|
};
|
|
107
|
-
// a validator is assigned its `~standard` as it's created, which this
|
|
108
|
-
// receives: one with no jsonSchema baked is held as a copy whose jsonSchema
|
|
109
|
-
// throws, frozen if what was assigned is
|
|
110
|
-
Object.defineProperty(Validator.prototype, "~standard", {
|
|
111
|
-
set(standard) {
|
|
112
|
-
let held = standard;
|
|
113
|
-
if (!("jsonSchema" in standard)) {
|
|
114
|
-
held = Object.defineProperty({ ...standard }, "jsonSchema", {
|
|
115
|
-
get: () => {
|
|
116
|
-
throw lacks("~standard.jsonSchema");
|
|
117
|
-
},
|
|
118
|
-
enumerable: true,
|
|
119
|
-
configurable: true
|
|
120
|
-
});
|
|
121
|
-
if (Object.isFrozen(standard))
|
|
122
|
-
Object.freeze(held);
|
|
123
|
-
}
|
|
124
|
-
Object.defineProperty(this, "~standard", {
|
|
125
|
-
value: held,
|
|
126
|
-
writable: true,
|
|
127
|
-
enumerable: true,
|
|
128
|
-
configurable: true
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
configurable: true
|
|
132
|
-
});
|
|
133
151
|
export * from "./runtime.js";
|
package/out/schema.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./_internal/schema/index.js";
|