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,101 @@
|
|
|
1
|
+
import { type array, type propValueOf, type satisfy } from "../../util/index.js";
|
|
2
|
+
import { InternalPrimitiveConstraint } from "../constraint.ts";
|
|
3
|
+
import type { nodeOfKind } from "../kinds.ts";
|
|
4
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
5
|
+
import type { BaseNodeDeclaration, BaseNodeInput } from "../shared/declare.ts";
|
|
6
|
+
import type { RangeKind } from "./kinds.ts";
|
|
7
|
+
export interface BaseRangeDeclaration extends BaseNodeDeclaration {
|
|
8
|
+
kind: RangeKind;
|
|
9
|
+
inner: BaseRangeInner;
|
|
10
|
+
}
|
|
11
|
+
export declare abstract class BaseRange<d extends BaseRangeDeclaration> extends InternalPrimitiveConstraint<d> {
|
|
12
|
+
readonly exclusive?: true;
|
|
13
|
+
readonly expression: string;
|
|
14
|
+
constructor(...args: ConstructorParameters<typeof InternalPrimitiveConstraint>);
|
|
15
|
+
sameInner(r: BaseRange<d>): boolean | undefined;
|
|
16
|
+
/** the kind of data its bound applies to: a value, a length or a date */
|
|
17
|
+
get opKind(): OperandKindsByBoundKind[d["kind"]];
|
|
18
|
+
get comparator(): RelativeComparator;
|
|
19
|
+
/** its rule as a number, a Date's time where it's a Date */
|
|
20
|
+
get numRule(): number;
|
|
21
|
+
get limitKind(): LimitKind;
|
|
22
|
+
jsCond(js: NodeCompiler, data: string): string;
|
|
23
|
+
get stringLimit(): string;
|
|
24
|
+
isStricterThan(r: nodeOfKind<d["kind"] | pairedRangeKind<d["kind"]>>): boolean;
|
|
25
|
+
overlapsRange(r: nodeOfKind<pairedRangeKind<d["kind"]>>): boolean;
|
|
26
|
+
overlapIsUnit(r: nodeOfKind<pairedRangeKind<d["kind"]>>): boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface BaseRangeInner {
|
|
29
|
+
readonly rule: LimitValue;
|
|
30
|
+
}
|
|
31
|
+
export type LimitValue = Date | number;
|
|
32
|
+
export type LimitSchemaValue = Date | number | string;
|
|
33
|
+
export type LimitInnerValue<kind extends RangeKind = RangeKind> = kind extends "before" | "after" ? Date : number;
|
|
34
|
+
export interface UnknownExpandedRangeSchema extends BaseNodeInput {
|
|
35
|
+
readonly rule: LimitSchemaValue;
|
|
36
|
+
readonly exclusive?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type UnknownRangeSchema = LimitSchemaValue | UnknownExpandedRangeSchema;
|
|
39
|
+
export interface ExclusiveExpandedDateRangeSchema extends BaseNodeInput {
|
|
40
|
+
rule: LimitSchemaValue;
|
|
41
|
+
exclusive?: true;
|
|
42
|
+
}
|
|
43
|
+
export type ExclusiveDateRangeSchema = LimitSchemaValue | ExclusiveExpandedDateRangeSchema;
|
|
44
|
+
export interface InclusiveExpandedDateRangeSchema extends BaseNodeInput {
|
|
45
|
+
rule: LimitSchemaValue;
|
|
46
|
+
exclusive?: false;
|
|
47
|
+
}
|
|
48
|
+
export type InclusiveDateRangeSchema = LimitSchemaValue | InclusiveExpandedDateRangeSchema;
|
|
49
|
+
export interface ExclusiveNormalizedNumericRangeSchema extends BaseNodeInput {
|
|
50
|
+
rule: number;
|
|
51
|
+
exclusive?: true;
|
|
52
|
+
}
|
|
53
|
+
export type ExclusiveNumericRangeSchema = number | ExclusiveNormalizedNumericRangeSchema;
|
|
54
|
+
export interface InclusiveNormalizedNumericRangeSchema extends BaseNodeInput {
|
|
55
|
+
rule: number;
|
|
56
|
+
exclusive?: false;
|
|
57
|
+
}
|
|
58
|
+
export type InclusiveNumericRangeSchema = number | InclusiveNormalizedNumericRangeSchema;
|
|
59
|
+
export type LimitKind = "lower" | "upper";
|
|
60
|
+
export type RelativeComparator<kind extends LimitKind = LimitKind> = {
|
|
61
|
+
lower: ">" | ">=";
|
|
62
|
+
upper: "<" | "<=";
|
|
63
|
+
}[kind];
|
|
64
|
+
export declare const boundKindPairsByLower: BoundKindPairsByLower;
|
|
65
|
+
type BoundKindPairsByLower = {
|
|
66
|
+
min: "max";
|
|
67
|
+
minLength: "maxLength";
|
|
68
|
+
after: "before";
|
|
69
|
+
};
|
|
70
|
+
type BoundKindPairsByUpper = {
|
|
71
|
+
max: "min";
|
|
72
|
+
maxLength: "minLength";
|
|
73
|
+
before: "after";
|
|
74
|
+
};
|
|
75
|
+
export type pairedRangeKind<kind extends RangeKind> = kind extends LowerBoundKind ? BoundKindPairsByLower[kind] : BoundKindPairsByUpper[kind & UpperBoundKind];
|
|
76
|
+
export type LowerBoundKind = keyof typeof boundKindPairsByLower;
|
|
77
|
+
export type LowerNode = nodeOfKind<LowerBoundKind>;
|
|
78
|
+
export type UpperBoundKind = propValueOf<typeof boundKindPairsByLower>;
|
|
79
|
+
export type UpperNode = nodeOfKind<UpperBoundKind>;
|
|
80
|
+
export type NumericallyBoundable = string | number | array;
|
|
81
|
+
export type Boundable = NumericallyBoundable | Date;
|
|
82
|
+
export type LengthBoundKind = "minLength" | "maxLength" | "exactLength" | "notEqualLength";
|
|
83
|
+
export declare const writeInvalidLengthBoundMessage: (kind: LengthBoundKind, limit: number) => string;
|
|
84
|
+
export declare const writeInvalidRangeRuleMessage: (kind: RangeKind, limit: unknown) => string;
|
|
85
|
+
export declare const assertLengthRule: (kind: LengthBoundKind, rule: number) => void;
|
|
86
|
+
type OperandKindsByBoundKind = satisfy<Record<RangeKind, BoundOperandKind>, {
|
|
87
|
+
min: "value";
|
|
88
|
+
max: "value";
|
|
89
|
+
minLength: "length";
|
|
90
|
+
maxLength: "length";
|
|
91
|
+
after: "date";
|
|
92
|
+
before: "date";
|
|
93
|
+
}>;
|
|
94
|
+
export declare const compileComparator: (kind: RangeKind, exclusive: boolean | undefined) => RelativeComparator;
|
|
95
|
+
export type BoundOperandKind = "value" | "length" | "date";
|
|
96
|
+
export type LengthBoundableData = string | array;
|
|
97
|
+
export type DateRangeKind = "before" | "after";
|
|
98
|
+
export declare const dateLimitToString: (limit: LimitSchemaValue) => string;
|
|
99
|
+
export declare const writeUnboundableMessage: <root extends string>(root: root) => writeUnboundableMessage<root>;
|
|
100
|
+
export type writeUnboundableMessage<root extends string> = `Bounded expression ${root} must be exactly one of number, string, Array, or Date`;
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type array, type join } from "../../util/index.js";
|
|
2
|
+
import { type BaseNode } from "../node.ts";
|
|
3
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
4
|
+
import type { declareNode } from "../shared/declare.ts";
|
|
5
|
+
import { type nodeImplementationOf } from "../shared/implement.ts";
|
|
6
|
+
import { type AliasDepth, type InternalTraversal } from "../shared/traversal.ts";
|
|
7
|
+
import { BaseRoot } from "./root.ts";
|
|
8
|
+
export declare namespace Alias {
|
|
9
|
+
interface Inner<alias extends string = string> {
|
|
10
|
+
readonly reference: alias;
|
|
11
|
+
readonly resolve?: () => BaseRoot;
|
|
12
|
+
readonly operator?: string;
|
|
13
|
+
readonly operands?: readonly BaseRoot[];
|
|
14
|
+
}
|
|
15
|
+
interface Declaration extends declareNode<{
|
|
16
|
+
kind: "alias";
|
|
17
|
+
inner: Inner;
|
|
18
|
+
}> {
|
|
19
|
+
}
|
|
20
|
+
type Node = AliasNode;
|
|
21
|
+
}
|
|
22
|
+
export declare class AliasNode extends BaseRoot<Alias.Declaration> {
|
|
23
|
+
readonly expression: string;
|
|
24
|
+
constructor(...args: ConstructorParameters<typeof BaseRoot>);
|
|
25
|
+
readonly structure: undefined;
|
|
26
|
+
closes: boolean;
|
|
27
|
+
private _resolution;
|
|
28
|
+
get resolution(): BaseRoot;
|
|
29
|
+
protected _resolve(): BaseRoot;
|
|
30
|
+
get isIo(): boolean;
|
|
31
|
+
get hasResolvableOperands(): boolean;
|
|
32
|
+
operandsBesides(node: BaseNode): BaseRoot[] | undefined;
|
|
33
|
+
get brief(): string;
|
|
34
|
+
getIo(ioKind: "in" | "out"): BaseRoot;
|
|
35
|
+
get nestedExpr(): string;
|
|
36
|
+
tAllows(data: unknown, ctx: InternalTraversal | AliasDepth): boolean;
|
|
37
|
+
tApply(data: unknown, ctx: InternalTraversal): void;
|
|
38
|
+
tTransform(data: unknown, ctx: InternalTraversal): unknown;
|
|
39
|
+
compile(js: NodeCompiler): void;
|
|
40
|
+
}
|
|
41
|
+
export declare const resolveShallowAliases: (node: BaseRoot) => BaseRoot;
|
|
42
|
+
export declare const identityOf: (node: BaseNode) => string;
|
|
43
|
+
export declare const isResolvable: (node: BaseRoot) => boolean;
|
|
44
|
+
export declare const writeShallowCycleErrorMessage: <name extends string, seen extends array<string>>(name: name, seen: seen) => writeShallowCycleErrorMessage<name, seen>;
|
|
45
|
+
export type writeShallowCycleErrorMessage<name extends string, seen extends array<string>> = `Alias '${name}' has a shallow resolution cycle: ${join<[...seen, name], "->">}`;
|
|
46
|
+
export declare const Alias: {
|
|
47
|
+
impl: nodeImplementationOf<Alias.Declaration>;
|
|
48
|
+
Node: typeof AliasNode;
|
|
49
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
2
|
+
import type { InternalTraversal } from "../shared/traversal.ts";
|
|
3
|
+
import { BaseRoot, type InternalRootDeclaration } from "./root.ts";
|
|
4
|
+
export declare abstract class InternalBasis<d extends InternalRootDeclaration = InternalRootDeclaration> extends BaseRoot<d> {
|
|
5
|
+
abstract jsCond(js: NodeCompiler, data: string): string;
|
|
6
|
+
structure: undefined;
|
|
7
|
+
tApply(data: d["prerequisite"], ctx: InternalTraversal): void;
|
|
8
|
+
private _errorCtx;
|
|
9
|
+
get errorCtx(): d["errorCtx"];
|
|
10
|
+
get jsErrorCtx(): string;
|
|
11
|
+
compile(js: NodeCompiler): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type Domain as _Domain } from "../../util/index.js";
|
|
2
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
3
|
+
import type { BaseErrorContext, declareNode } from "../shared/declare.ts";
|
|
4
|
+
import { type nodeImplementationOf } from "../shared/implement.ts";
|
|
5
|
+
import type { TraverseAllows } from "../shared/traversal.ts";
|
|
6
|
+
import { InternalBasis } from "./basis.ts";
|
|
7
|
+
export type Domain = _Domain;
|
|
8
|
+
export declare namespace Domain {
|
|
9
|
+
type Enumerable = "undefined" | "null" | "boolean";
|
|
10
|
+
type NonEnumerable = Exclude<Domain, Enumerable>;
|
|
11
|
+
interface Inner<domain extends NonEnumerable = NonEnumerable> {
|
|
12
|
+
readonly domain: domain;
|
|
13
|
+
readonly numberAllowsNaN?: boolean;
|
|
14
|
+
readonly numberAllowsInfinity?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ErrorContext extends BaseErrorContext<"domain">, Inner {
|
|
17
|
+
}
|
|
18
|
+
interface Declaration extends declareNode<{
|
|
19
|
+
kind: "domain";
|
|
20
|
+
inner: Inner;
|
|
21
|
+
errorCtx: ErrorContext;
|
|
22
|
+
}> {
|
|
23
|
+
}
|
|
24
|
+
type Node = DomainNode;
|
|
25
|
+
}
|
|
26
|
+
export declare class DomainNode extends InternalBasis<Domain.Declaration> {
|
|
27
|
+
constructor(...args: ConstructorParameters<typeof InternalBasis>);
|
|
28
|
+
sameInner(r: DomainNode): boolean;
|
|
29
|
+
/** whether it rejects NaN, as the number domain does unless `numberAllowsNaN` */
|
|
30
|
+
private readonly checksNaN;
|
|
31
|
+
/** whether it checks a number is finite */
|
|
32
|
+
private readonly checksInf;
|
|
33
|
+
readonly tAllows: TraverseAllows;
|
|
34
|
+
jsCond(js: NodeCompiler, data: string): string;
|
|
35
|
+
readonly expression: string;
|
|
36
|
+
get nestedExpr(): string;
|
|
37
|
+
get brief(): string;
|
|
38
|
+
}
|
|
39
|
+
export declare const Domain: {
|
|
40
|
+
impl: nodeImplementationOf<Domain.Declaration>;
|
|
41
|
+
Node: typeof DomainNode;
|
|
42
|
+
writeInvalidDomainMessage: (actual: unknown) => string;
|
|
43
|
+
writeBadAllowNanMessage: (actual: Exclude<Domain.NonEnumerable, "number">) => string;
|
|
44
|
+
writeBadAllowInfinityMessage: (actual: Exclude<Domain.NonEnumerable, "number">) => string;
|
|
45
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type array } from "../../util/index.js";
|
|
2
|
+
import type { nodeOfKind } from "../kinds.ts";
|
|
3
|
+
import type { PredicateNode } from "../predicate.ts";
|
|
4
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
5
|
+
import type { declareNode } from "../shared/declare.ts";
|
|
6
|
+
import { type nodeImplementationOf, type OpenNodeKind, type PrestructuralKind, type RefinementKind, type StructuralKind } from "../shared/implement.ts";
|
|
7
|
+
import { type AliasDepth, type InternalTraversal } from "../shared/traversal.ts";
|
|
8
|
+
import { type makeRootAndArrayPropertiesMutable } from "../shared/utils.ts";
|
|
9
|
+
import type { Structure } from "../structure/structure.ts";
|
|
10
|
+
import type { Domain } from "./domain.ts";
|
|
11
|
+
import type { Morph } from "./morph.ts";
|
|
12
|
+
import type { Proto } from "./proto.ts";
|
|
13
|
+
import { BaseRoot } from "./root.ts";
|
|
14
|
+
export declare namespace Intersection {
|
|
15
|
+
type BasisKind = "domain" | "proto";
|
|
16
|
+
type ChildKind = BasisKind | RefinementKind;
|
|
17
|
+
type FlattenedChildKind = ChildKind | StructuralKind;
|
|
18
|
+
type RefinementsInner = {
|
|
19
|
+
[k in RefinementKind]?: intersectionChildInnerValueOf<k>;
|
|
20
|
+
};
|
|
21
|
+
interface Inner extends RefinementsInner {
|
|
22
|
+
domain?: Domain.Node;
|
|
23
|
+
proto?: Proto.Node;
|
|
24
|
+
structure?: Structure.Node;
|
|
25
|
+
predicate?: array<PredicateNode>;
|
|
26
|
+
}
|
|
27
|
+
namespace Inner {
|
|
28
|
+
type mutable = makeRootAndArrayPropertiesMutable<Inner>;
|
|
29
|
+
}
|
|
30
|
+
type Declaration = declareNode<{
|
|
31
|
+
kind: "intersection";
|
|
32
|
+
inner: Inner;
|
|
33
|
+
reducibleTo: "intersection" | BasisKind;
|
|
34
|
+
childKind: ChildKind;
|
|
35
|
+
}>;
|
|
36
|
+
type Node = IntersectionNode;
|
|
37
|
+
}
|
|
38
|
+
export declare class IntersectionNode extends BaseRoot<Intersection.Declaration> {
|
|
39
|
+
basis: nodeOfKind<Intersection.BasisKind> | null;
|
|
40
|
+
refinements: array<nodeOfKind<RefinementKind>>;
|
|
41
|
+
/** its refinements checked before its structure */
|
|
42
|
+
preStruct: array<nodeOfKind<PrestructuralKind>>;
|
|
43
|
+
structure: Structure.Node | undefined;
|
|
44
|
+
get expression(): string;
|
|
45
|
+
sameInner(r: IntersectionNode): boolean | undefined;
|
|
46
|
+
get nestedExpr(): string;
|
|
47
|
+
get topMorphs(): array<Morph>;
|
|
48
|
+
get brief(): string;
|
|
49
|
+
tAllows(data: unknown, ctx: InternalTraversal | AliasDepth): boolean;
|
|
50
|
+
tApply(data: unknown, ctx: InternalTraversal): void;
|
|
51
|
+
tTransform(data: unknown, ctx: InternalTraversal): unknown;
|
|
52
|
+
private get inlinedSequence();
|
|
53
|
+
compile(js: NodeCompiler): void;
|
|
54
|
+
/** writes its Allows: each child's check, a basis's folded into the first key read */
|
|
55
|
+
private jsAllows;
|
|
56
|
+
/** writes its Apply: a failed basis or prestructural stops it, then its structure and predicates run in turn */
|
|
57
|
+
private jsApply;
|
|
58
|
+
}
|
|
59
|
+
export declare const Intersection: {
|
|
60
|
+
impl: nodeImplementationOf<{
|
|
61
|
+
stacks: false;
|
|
62
|
+
prerequisite: unknown;
|
|
63
|
+
errorCtx: null;
|
|
64
|
+
kind: "intersection";
|
|
65
|
+
inner: Intersection.Inner;
|
|
66
|
+
reducibleTo: "intersection" | Intersection.BasisKind;
|
|
67
|
+
childKind: Intersection.ChildKind;
|
|
68
|
+
}>;
|
|
69
|
+
Node: typeof IntersectionNode;
|
|
70
|
+
};
|
|
71
|
+
type intersectionChildInnerValueOf<k extends Intersection.FlattenedChildKind> = k extends OpenNodeKind ? readonly nodeOfKind<k>[] : nodeOfKind<k>;
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type array } from "../../util/index.js";
|
|
2
|
+
import type { BaseNode } from "../node.ts";
|
|
3
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
4
|
+
import type { declareNode } from "../shared/declare.ts";
|
|
5
|
+
import { type nodeImplementationOf, type RootKind } from "../shared/implement.ts";
|
|
6
|
+
import { type AliasDepth, type InternalTraversal, type Traversal } from "../shared/traversal.ts";
|
|
7
|
+
import { BaseRoot } from "./root.ts";
|
|
8
|
+
export declare namespace Morph {
|
|
9
|
+
interface Inner {
|
|
10
|
+
/** its pipeline: the node data must allow first, if any, then each morph or node it pipes to */
|
|
11
|
+
readonly morphs: array<Morph | BaseRoot>;
|
|
12
|
+
/** the input `_in` returns in place of its head's, e.g. a string `Date` can parse */
|
|
13
|
+
readonly declaredIn?: BaseRoot;
|
|
14
|
+
/** the output `_out` returns in place of its tail's or `unknown` */
|
|
15
|
+
readonly declaredOut?: BaseRoot;
|
|
16
|
+
readonly inverse?: Morph;
|
|
17
|
+
}
|
|
18
|
+
interface Declaration extends declareNode<{
|
|
19
|
+
kind: "morph";
|
|
20
|
+
inner: Inner;
|
|
21
|
+
childKind: RootKind;
|
|
22
|
+
}> {
|
|
23
|
+
}
|
|
24
|
+
type Node = MorphNode;
|
|
25
|
+
type In<morph extends Morph> = morph extends Morph<infer i> ? i : never;
|
|
26
|
+
type Out<morph extends Morph> = morph extends Morph<never, infer o> ? o : never;
|
|
27
|
+
type ContextFree<i = never, o = unknown> = (In: i) => o;
|
|
28
|
+
}
|
|
29
|
+
export type Morph<i = never, o = unknown> = (In: i, ctx: Traversal) => o;
|
|
30
|
+
export declare class MorphNode extends BaseRoot<Morph.Declaration> {
|
|
31
|
+
/** the node its pipeline starts with, which data must allow before any morph runs, its own morphs included */
|
|
32
|
+
head: BaseRoot | undefined;
|
|
33
|
+
/** the node its pipeline ends with, besides its head: the one its output is piped to */
|
|
34
|
+
tail: BaseRoot | undefined;
|
|
35
|
+
/** what its head pipes to: its morphs and the nodes they pipe to */
|
|
36
|
+
piped: array<Morph | BaseRoot>;
|
|
37
|
+
contextFree: boolean[];
|
|
38
|
+
private _traversedMorphs;
|
|
39
|
+
get travMorphs(): array<Morph | BaseRoot>;
|
|
40
|
+
private includePiped;
|
|
41
|
+
get otherRefs(): readonly BaseNode[];
|
|
42
|
+
get topMorphs(): array<Morph>;
|
|
43
|
+
get _in(): BaseRoot;
|
|
44
|
+
get _out(): BaseRoot;
|
|
45
|
+
declareOut(declaredOut: BaseRoot): MorphNode;
|
|
46
|
+
get expression(): string;
|
|
47
|
+
get brief(): string;
|
|
48
|
+
compile(js: NodeCompiler): void;
|
|
49
|
+
private jsTf;
|
|
50
|
+
tAllows(data: unknown, ctx: InternalTraversal | AliasDepth): boolean;
|
|
51
|
+
tApply(data: unknown, ctx: InternalTraversal): void;
|
|
52
|
+
tTransform(data: unknown, ctx: InternalTraversal): unknown;
|
|
53
|
+
/** Check if the morphs of r are equal to those of this node */
|
|
54
|
+
sameMorphs(r: MorphNode): boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare const Morph: {
|
|
57
|
+
impl: nodeImplementationOf<Morph.Declaration>;
|
|
58
|
+
Node: typeof MorphNode;
|
|
59
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type BuiltinObjectKind, type Constructor } from "../../util/index.js";
|
|
2
|
+
import type { NodeCompiler } from "../shared/compile.ts";
|
|
3
|
+
import type { BaseErrorContext, declareNode } from "../shared/declare.ts";
|
|
4
|
+
import { type nodeImplementationOf } from "../shared/implement.ts";
|
|
5
|
+
import type { TraverseAllows } from "../shared/traversal.ts";
|
|
6
|
+
import { InternalBasis } from "./basis.ts";
|
|
7
|
+
export declare namespace Proto {
|
|
8
|
+
type Reference = Constructor | BuiltinObjectKind;
|
|
9
|
+
interface Inner<proto extends Constructor = Constructor> {
|
|
10
|
+
readonly proto: proto;
|
|
11
|
+
readonly dateAllowsInvalid?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface ErrorContext extends BaseErrorContext<"proto">, Inner {
|
|
14
|
+
}
|
|
15
|
+
interface Declaration extends declareNode<{
|
|
16
|
+
kind: "proto";
|
|
17
|
+
inner: Inner;
|
|
18
|
+
errorCtx: ErrorContext;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
type Node = ProtoNode;
|
|
22
|
+
}
|
|
23
|
+
export declare class ProtoNode extends InternalBasis<Proto.Declaration> {
|
|
24
|
+
constructor(...args: ConstructorParameters<typeof InternalBasis>);
|
|
25
|
+
sameInner(r: ProtoNode): boolean;
|
|
26
|
+
builtinName: BuiltinObjectKind | null;
|
|
27
|
+
/** whether it rejects an invalid Date, as `Date` does unless `dateAllowsInvalid` */
|
|
28
|
+
private readonly checksInvalid;
|
|
29
|
+
private readonly isArrayProto;
|
|
30
|
+
tAllows: TraverseAllows;
|
|
31
|
+
jsCond(js: NodeCompiler, data: string): string;
|
|
32
|
+
expression: string;
|
|
33
|
+
get nestedExpr(): string;
|
|
34
|
+
readonly domain = "object";
|
|
35
|
+
get brief(): string;
|
|
36
|
+
}
|
|
37
|
+
export declare const Proto: {
|
|
38
|
+
impl: nodeImplementationOf<Proto.Declaration>;
|
|
39
|
+
Node: typeof ProtoNode;
|
|
40
|
+
writeBadInvalidDateMessage: (actual: Constructor) => string;
|
|
41
|
+
writeInvalidSchemaMessage: (actual: unknown) => string;
|
|
42
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { arkKind, inferred, type array } from "../../util/index.js";
|
|
2
|
+
import { type Constraint } from "../constraint.ts";
|
|
3
|
+
import type { nodeOfKind, reducibleKindOf } from "../kinds.ts";
|
|
4
|
+
import { BaseNode, type DeepNodeTransformContext, type DeepNodeTransformation, type GettableKeyOrNode, type KeyOrKeyNode, type NodeSelector } from "../node.ts";
|
|
5
|
+
import type { Predicate } from "../predicate.ts";
|
|
6
|
+
import type { Divisor } from "../refinements/divisor.ts";
|
|
7
|
+
import type { ExactLength } from "../refinements/exactLength.ts";
|
|
8
|
+
import type { Pattern } from "../refinements/pattern.ts";
|
|
9
|
+
import type { ExclusiveDateRangeSchema, ExclusiveNumericRangeSchema, InclusiveDateRangeSchema, InclusiveNumericRangeSchema, LimitSchemaValue, UnknownRangeSchema } from "../refinements/range.ts";
|
|
10
|
+
import type { ArkEnv, BaseNodeDeclaration, TypeMeta } from "../shared/declare.ts";
|
|
11
|
+
import { Disjoint } from "../shared/disjoint.ts";
|
|
12
|
+
import { type MessageConfig } from "../shared/errors.ts";
|
|
13
|
+
import { type NodeKind, type RootKind, type kindRightOf } from "../shared/implement.ts";
|
|
14
|
+
import { type JsonSchema } from "../shared/jsonSchema.ts";
|
|
15
|
+
import type { StandardJSONSchemaV1, StandardSchemaV1 } from "../shared/standardSchema.ts";
|
|
16
|
+
import { ToJsonSchema } from "../shared/toJsonSchema.ts";
|
|
17
|
+
import { type ContextualTarget } from "../shared/traversal.ts";
|
|
18
|
+
import type { Prop } from "../structure/prop.ts";
|
|
19
|
+
import type { PropFlatMapper, UndeclaredKeyBehavior } from "../structure/structure.ts";
|
|
20
|
+
import type { Morph } from "./morph.ts";
|
|
21
|
+
import type { Union } from "./union.ts";
|
|
22
|
+
export declare const encodeWithoutCodecsMessage = ".encode requires import \"arktype/codecs\"";
|
|
23
|
+
export interface InternalRootDeclaration extends BaseNodeDeclaration {
|
|
24
|
+
kind: RootKind;
|
|
25
|
+
}
|
|
26
|
+
export declare abstract class BaseRoot<
|
|
27
|
+
/** @ts-ignore cast variance */
|
|
28
|
+
out d extends InternalRootDeclaration = InternalRootDeclaration> extends BaseNode<d> implements StandardSchemaV1, StandardJSONSchemaV1 {
|
|
29
|
+
readonly [inferred]: unknown;
|
|
30
|
+
get [arkKind](): "root";
|
|
31
|
+
get _in(): BaseRoot;
|
|
32
|
+
get _out(): BaseRoot;
|
|
33
|
+
get internal(): this;
|
|
34
|
+
private _standard?;
|
|
35
|
+
get "~standard"(): StandardSchemaV1.ArkTypeProps;
|
|
36
|
+
as(): this;
|
|
37
|
+
brand(name: string): this;
|
|
38
|
+
readonly(): this;
|
|
39
|
+
readonly branches: readonly nodeOfKind<Union.ChildKind>[];
|
|
40
|
+
distribute<mapOut, reduceOut = mapOut[]>(mapBranch: (branch: nodeOfKind<Union.ChildKind>, i: number, branches: array<nodeOfKind<Union.ChildKind>>) => mapOut, reduceMapped?: (mappedBranches: mapOut[]) => reduceOut): reduceOut;
|
|
41
|
+
/** its description when none is configured */
|
|
42
|
+
abstract get brief(): string;
|
|
43
|
+
toJsonSchema(opts?: ToJsonSchema.Options): JsonSchema;
|
|
44
|
+
toJsonSchemaRecurse(ctx: ToJsonSchema.Context): JsonSchema;
|
|
45
|
+
get alwaysExpandJsonSchema(): boolean;
|
|
46
|
+
intersect(r: unknown, jit?: boolean): BaseRoot | Disjoint;
|
|
47
|
+
rawIntersect(r: BaseRoot): BaseRoot;
|
|
48
|
+
toNeverIfDisjoint(): BaseRoot;
|
|
49
|
+
and(r: unknown): BaseRoot;
|
|
50
|
+
rawAnd(r: BaseRoot): BaseRoot;
|
|
51
|
+
or(r: unknown): BaseRoot;
|
|
52
|
+
rawOr(r: BaseRoot): BaseRoot;
|
|
53
|
+
private rootOfBranches;
|
|
54
|
+
map(flatMapEntry: PropFlatMapper): BaseRoot;
|
|
55
|
+
pick(...keys: KeyOrKeyNode[]): BaseRoot;
|
|
56
|
+
omit(...keys: KeyOrKeyNode[]): BaseRoot;
|
|
57
|
+
required(): BaseRoot;
|
|
58
|
+
partial(): BaseRoot;
|
|
59
|
+
private _keyof?;
|
|
60
|
+
keyof(): BaseRoot;
|
|
61
|
+
get props(): Prop.Node[];
|
|
62
|
+
merge(r: unknown): BaseRoot;
|
|
63
|
+
/** applies a structural operation like pick or omit to each branch's structure */
|
|
64
|
+
private applyStruct;
|
|
65
|
+
get(...path: GettableKeyOrNode[]): BaseRoot;
|
|
66
|
+
extract(r: unknown): BaseRoot;
|
|
67
|
+
exclude(r: unknown): BaseRoot;
|
|
68
|
+
array(): BaseRoot;
|
|
69
|
+
rawArray(): BaseRoot;
|
|
70
|
+
overlaps(r: unknown): boolean;
|
|
71
|
+
extends(r: unknown): boolean;
|
|
72
|
+
/** transforms this root inside an enclosing transform, sharing its cycle state */
|
|
73
|
+
transformWithin(mapper: DeepNodeTransformation, ctx: DeepNodeTransformContext): BaseRoot | null;
|
|
74
|
+
ifExtends(r: unknown): BaseRoot | undefined;
|
|
75
|
+
subsumes(r: unknown): boolean;
|
|
76
|
+
configure(meta: TypeMeta.MappableInput, selector?: NodeSelector): this;
|
|
77
|
+
describe(description: string, selector?: NodeSelector): this;
|
|
78
|
+
message(message: MessageConfig, selector?: NodeSelector): this;
|
|
79
|
+
optional(): [this, "?"];
|
|
80
|
+
default(thunkableValue: unknown): [this, "=", unknown];
|
|
81
|
+
from(input: unknown): unknown;
|
|
82
|
+
withContext(context: ArkEnv.context): ContextualTarget;
|
|
83
|
+
protected _pipe(...morphs: Morph[]): BaseRoot;
|
|
84
|
+
protected tryPipe(...morphs: Morph[]): BaseRoot;
|
|
85
|
+
get pipe(): ((...morphs: Morph[]) => BaseRoot) & {
|
|
86
|
+
try: (...morphs: Morph[]) => BaseRoot;
|
|
87
|
+
};
|
|
88
|
+
to(def: unknown): BaseRoot;
|
|
89
|
+
private toNode;
|
|
90
|
+
get encode(): BaseRoot;
|
|
91
|
+
rawPipeOnce(morph: Morph): BaseRoot;
|
|
92
|
+
narrow(predicate: Predicate): BaseRoot;
|
|
93
|
+
constrain<kind extends Constraint.PrimitiveKind>(kind: kind, schema: Constraint.Schema<kind>): BaseRoot;
|
|
94
|
+
constrainIn<kind extends Constraint.PrimitiveKind>(kind: kind, schema: Constraint.Schema<kind>): BaseRoot;
|
|
95
|
+
constrainOut<kind extends Constraint.PrimitiveKind>(kind: kind, schema: Constraint.Schema<kind>): BaseRoot;
|
|
96
|
+
rawConstrain<kind extends Constraint.PrimitiveKind>(kind: kind, schema: Constraint.Schema<kind>): BaseRoot;
|
|
97
|
+
/** constrains its output, like constrainOut, without finalizing it */
|
|
98
|
+
rawConstrainOut<kind extends Constraint.PrimitiveKind>(kind: kind, schema: Constraint.Schema<kind>): BaseRoot;
|
|
99
|
+
private _constrain;
|
|
100
|
+
onUndeclaredKey(cfg: UndeclaredKeyBehavior | UndeclaredKeyConfig): BaseRoot;
|
|
101
|
+
/** whether the morphs of `r` are the same as its own */
|
|
102
|
+
sameMorphs(r: BaseRoot): boolean;
|
|
103
|
+
onDeepUndeclaredKey(behavior: UndeclaredKeyBehavior): BaseRoot;
|
|
104
|
+
filter(predicate: Predicate): BaseRoot;
|
|
105
|
+
divisibleBy(schema: Divisor.Schema, message?: MessageConfig): BaseRoot;
|
|
106
|
+
matching(schema: Pattern.Schema, message?: MessageConfig): BaseRoot;
|
|
107
|
+
atLeast(schema: InclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
108
|
+
atMost(schema: InclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
109
|
+
moreThan(schema: ExclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
110
|
+
lessThan(schema: ExclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
111
|
+
atLeastLength(schema: InclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
112
|
+
atMostLength(schema: InclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
113
|
+
moreThanLength(schema: ExclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
114
|
+
lessThanLength(schema: ExclusiveNumericRangeSchema, message?: MessageConfig): BaseRoot;
|
|
115
|
+
exactlyLength(schema: ExactLength.Schema, message?: MessageConfig): BaseRoot;
|
|
116
|
+
atOrAfter(schema: InclusiveDateRangeSchema, message?: MessageConfig): BaseRoot;
|
|
117
|
+
atOrBefore(schema: InclusiveDateRangeSchema, message?: MessageConfig): BaseRoot;
|
|
118
|
+
laterThan(schema: ExclusiveDateRangeSchema, message?: MessageConfig): BaseRoot;
|
|
119
|
+
earlierThan(schema: ExclusiveDateRangeSchema, message?: MessageConfig): BaseRoot;
|
|
120
|
+
}
|
|
121
|
+
export type MadeMorph = [
|
|
122
|
+
make: (...args: never[]) => Morph,
|
|
123
|
+
args: readonly unknown[]
|
|
124
|
+
];
|
|
125
|
+
export declare const madeMorphs: WeakMap<Morph, MadeMorph>;
|
|
126
|
+
export declare const makeMorph: <args extends unknown[]>(make: (...args: args) => Morph, ...args: args) => Morph;
|
|
127
|
+
export type UndeclaredKeyConfig = {
|
|
128
|
+
rule: UndeclaredKeyBehavior;
|
|
129
|
+
deep?: boolean;
|
|
130
|
+
};
|
|
131
|
+
export declare const emptyBrandNameMessage = "Expected a non-empty brand name after #";
|
|
132
|
+
export type emptyBrandNameMessage = typeof emptyBrandNameMessage;
|
|
133
|
+
export declare const exclusivizeRangeSchema: <schema extends UnknownRangeSchema>(schema: schema) => schema;
|
|
134
|
+
export type exclusivizeRangeSchema<schema extends UnknownRangeSchema> = schema extends LimitSchemaValue ? {
|
|
135
|
+
rule: schema;
|
|
136
|
+
exclusive: true;
|
|
137
|
+
} : schema;
|
|
138
|
+
export declare const typeOrTermExtends: (t: unknown, base: unknown) => boolean;
|
|
139
|
+
export type intersectRoot<l extends RootKind, r extends NodeKind> = [
|
|
140
|
+
l,
|
|
141
|
+
r
|
|
142
|
+
] extends [r, l] ? l : asymmetricIntersectionOf<l, r> | asymmetricIntersectionOf<r, l>;
|
|
143
|
+
type asymmetricIntersectionOf<l extends NodeKind, r extends NodeKind> = l extends unknown ? r extends kindRightOf<l> ? l | reducibleKindOf<l> : never : never;
|
|
144
|
+
export type schemaKindRightOf<kind extends RootKind> = Extract<kindRightOf<kind>, RootKind>;
|
|
145
|
+
export type schemaKindOrRightOf<kind extends RootKind> = kind | schemaKindRightOf<kind>;
|
|
146
|
+
export type StructuralOperationBranchResultByName = {
|
|
147
|
+
keyof: Union.ChildNode;
|
|
148
|
+
pick: Union.ChildNode;
|
|
149
|
+
omit: Union.ChildNode;
|
|
150
|
+
get: Union.ChildNode;
|
|
151
|
+
map: Union.ChildNode;
|
|
152
|
+
required: Union.ChildNode;
|
|
153
|
+
partial: Union.ChildNode;
|
|
154
|
+
merge: Union.ChildNode;
|
|
155
|
+
props: array<Prop.Node>;
|
|
156
|
+
};
|
|
157
|
+
export type StructuralOperationName = keyof StructuralOperationBranchResultByName;
|
|
158
|
+
export declare const writeLiteralUnionEntriesMessage: (expression: string) => string;
|
|
159
|
+
export declare const writeNonStructuralOperandMessage: <operation extends StructuralOperationName, operand extends string>(operation: operation, operand: operand) => writeNonStructuralOperandMessage<operation, operand>;
|
|
160
|
+
export declare const writeInvalidMergeOperandMessage: <operand extends string>(operand: operand) => writeInvalidMergeOperandMessage<operand>;
|
|
161
|
+
export type writeInvalidMergeOperandMessage<operand extends string> = `merge operand must resolve to an object literal type (was ${operand})`;
|
|
162
|
+
export type writeNonStructuralOperandMessage<operation extends StructuralOperationName, operand extends string> = `${operation} operand must be an object (was ${operand})`;
|
|
163
|
+
export {};
|