arktype 2.0.0-dev.8 → 2.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/LICENSE +7 -0
- package/out/config.d.ts +25 -9
- package/out/config.js +2 -18
- package/out/generic.d.ts +154 -19
- package/out/generic.js +37 -24
- package/out/index.d.ts +7 -0
- package/out/index.js +6 -0
- package/out/intersect.d.ts +28 -0
- package/out/intersect.js +1 -0
- package/out/keys.d.ts +16 -0
- package/out/keys.js +1 -0
- package/out/keywords/ark.d.ts +29 -66
- package/out/keywords/ark.js +18 -29
- package/out/keywords/ast.d.ts +193 -0
- package/out/keywords/ast.js +2 -0
- package/out/keywords/builtin.d.ts +13 -0
- package/out/keywords/builtin.js +10 -0
- package/out/keywords/constructors/Array.d.ts +16 -0
- package/out/keywords/constructors/Array.js +19 -0
- package/out/keywords/constructors/FormData.d.ts +9 -0
- package/out/keywords/constructors/FormData.js +25 -0
- package/out/keywords/constructors/TypedArray.d.ts +15 -0
- package/out/keywords/constructors/TypedArray.js +14 -0
- package/out/keywords/constructors/constructors.d.ts +41 -0
- package/out/keywords/constructors/constructors.js +31 -0
- package/out/keywords/number/epoch.d.ts +10 -0
- package/out/keywords/number/epoch.js +26 -0
- package/out/keywords/number/integer.d.ts +3 -0
- package/out/keywords/number/integer.js +5 -0
- package/out/keywords/number/number.d.ts +26 -0
- package/out/keywords/number/number.js +9 -0
- package/out/keywords/string/alpha.d.ts +7 -0
- package/out/keywords/string/alpha.js +2 -0
- package/out/keywords/string/alphanumeric.d.ts +7 -0
- package/out/keywords/string/alphanumeric.js +2 -0
- package/out/keywords/string/capitalize.d.ts +14 -0
- package/out/keywords/string/capitalize.js +12 -0
- package/out/keywords/string/creditCard.d.ts +8 -0
- package/out/keywords/string/creditCard.js +37 -0
- package/out/keywords/string/date.d.ts +54 -0
- package/out/keywords/string/date.js +98 -0
- package/out/keywords/string/digits.d.ts +7 -0
- package/out/keywords/string/digits.js +2 -0
- package/out/keywords/string/email.d.ts +7 -0
- package/out/keywords/string/email.js +4 -0
- package/out/keywords/string/integer.d.ts +15 -0
- package/out/keywords/string/integer.js +16 -0
- package/out/keywords/string/ip.d.ts +20 -0
- package/out/keywords/string/ip.js +23 -0
- package/out/keywords/string/json.d.ts +14 -0
- package/out/keywords/string/json.js +45 -0
- package/out/keywords/string/lower.d.ts +14 -0
- package/out/keywords/string/lower.js +12 -0
- package/out/keywords/string/normalize.d.ts +72 -0
- package/out/keywords/string/normalize.js +43 -0
- package/out/keywords/string/numeric.d.ts +14 -0
- package/out/keywords/string/numeric.js +13 -0
- package/out/keywords/string/semver.d.ts +7 -0
- package/out/keywords/string/semver.js +4 -0
- package/out/keywords/string/string.d.ts +57 -0
- package/out/keywords/string/string.js +41 -0
- package/out/keywords/string/trim.d.ts +14 -0
- package/out/keywords/string/trim.js +14 -0
- package/out/keywords/string/upper.d.ts +14 -0
- package/out/keywords/string/upper.js +12 -0
- package/out/keywords/string/url.d.ts +14 -0
- package/out/keywords/string/url.js +37 -0
- package/out/keywords/string/utils.d.ts +2 -0
- package/out/keywords/string/utils.js +10 -0
- package/out/keywords/string/uuid.d.ts +38 -0
- package/out/keywords/string/uuid.js +19 -0
- package/out/keywords/ts.d.ts +53 -0
- package/out/keywords/ts.js +51 -0
- package/out/keywords/utils.d.ts +1 -0
- package/out/keywords/utils.js +2 -0
- package/out/module.d.ts +21 -10
- package/out/module.js +3 -4
- package/out/parser/definition.d.ts +21 -17
- package/out/parser/definition.js +5 -6
- package/out/parser/objectLiteral.d.ts +54 -37
- package/out/parser/objectLiteral.js +75 -43
- package/out/parser/semantic/bounds.d.ts +11 -11
- package/out/parser/semantic/bounds.js +0 -1
- package/out/parser/semantic/default.d.ts +8 -0
- package/out/parser/semantic/default.js +1 -0
- package/out/parser/semantic/divisor.d.ts +5 -6
- package/out/parser/semantic/divisor.js +0 -1
- package/out/parser/semantic/infer.d.ts +21 -13
- package/out/parser/semantic/infer.js +0 -1
- package/out/parser/semantic/keyof.d.ts +7 -0
- package/out/parser/semantic/keyof.js +1 -0
- package/out/parser/semantic/utils.d.ts +3 -4
- package/out/parser/semantic/utils.js +0 -1
- package/out/parser/semantic/validate.d.ts +21 -18
- package/out/parser/semantic/validate.js +0 -2
- package/out/parser/string/reduce/dynamic.d.ts +16 -15
- package/out/parser/string/reduce/dynamic.js +8 -8
- package/out/parser/string/reduce/shared.d.ts +17 -30
- package/out/parser/string/reduce/shared.js +4 -3
- package/out/parser/string/reduce/static.d.ts +22 -24
- package/out/parser/string/reduce/static.js +0 -1
- package/out/parser/string/shift/operand/date.d.ts +3 -6
- package/out/parser/string/shift/operand/date.js +1 -2
- package/out/parser/string/shift/operand/enclosed.d.ts +5 -16
- package/out/parser/string/shift/operand/enclosed.js +5 -5
- package/out/parser/string/shift/operand/genericArgs.d.ts +13 -14
- package/out/parser/string/shift/operand/genericArgs.js +7 -13
- package/out/parser/string/shift/operand/operand.d.ts +8 -8
- package/out/parser/string/shift/operand/operand.js +5 -7
- package/out/parser/string/shift/operand/unenclosed.d.ts +31 -19
- package/out/parser/string/shift/operand/unenclosed.js +10 -15
- package/out/parser/string/shift/operator/bounds.d.ts +15 -27
- package/out/parser/string/shift/operator/bounds.js +11 -17
- package/out/parser/string/shift/operator/default.d.ts +19 -0
- package/out/parser/string/shift/operator/default.js +17 -0
- package/out/parser/string/shift/operator/divisor.d.ts +4 -5
- package/out/parser/string/shift/operator/divisor.js +1 -2
- package/out/parser/string/shift/operator/operator.d.ts +8 -8
- package/out/parser/string/shift/operator/operator.js +1 -2
- package/out/parser/string/shift/scanner.d.ts +26 -31
- package/out/parser/string/shift/scanner.js +23 -21
- package/out/parser/string/string.d.ts +14 -12
- package/out/parser/string/string.js +5 -3
- package/out/parser/tuple.d.ts +22 -21
- package/out/parser/tuple.js +12 -24
- package/out/scope.d.ts +102 -55
- package/out/scope.js +61 -60
- package/out/subtypes/array.d.ts +13 -0
- package/out/subtypes/array.js +1 -0
- package/out/subtypes/base.d.ts +84 -0
- package/out/subtypes/base.js +1 -0
- package/out/subtypes/date.d.ts +11 -0
- package/out/subtypes/date.js +1 -0
- package/out/subtypes/instantiate.d.ts +16 -0
- package/out/subtypes/instantiate.js +1 -0
- package/out/subtypes/morph.d.ts +13 -0
- package/out/subtypes/morph.js +1 -0
- package/out/subtypes/number.d.ts +12 -0
- package/out/subtypes/number.js +1 -0
- package/out/subtypes/object.d.ts +33 -0
- package/out/subtypes/object.js +1 -0
- package/out/subtypes/string.d.ts +13 -0
- package/out/subtypes/string.js +1 -0
- package/out/subtypes/validator.d.ts +11 -0
- package/out/subtypes/validator.js +1 -0
- package/out/type.d.ts +30 -50
- package/out/type.js +19 -15
- package/package.json +46 -43
- package/__tests__/array.test.ts +0 -391
- package/__tests__/badDefinitionType.test.ts +0 -58
- package/__tests__/basis.test.ts +0 -50
- package/__tests__/bounds.test.ts +0 -318
- package/__tests__/cast.test.ts +0 -37
- package/__tests__/completions.test.ts +0 -51
- package/__tests__/config.test.ts +0 -85
- package/__tests__/cyclic.test.ts +0 -148
- package/__tests__/dateLiteral.test.ts +0 -36
- package/__tests__/declared.test.ts +0 -124
- package/__tests__/discrimination.test.ts +0 -74
- package/__tests__/divisor.test.ts +0 -114
- package/__tests__/enclosed.test.ts +0 -107
- package/__tests__/examples.test.ts +0 -56
- package/__tests__/expressions.test.ts +0 -210
- package/__tests__/generateBenchData.ts +0 -89
- package/__tests__/generated/cyclic.ts +0 -3058
- package/__tests__/generic.test.ts +0 -313
- package/__tests__/group.test.ts +0 -85
- package/__tests__/hkt.test.ts +0 -22
- package/__tests__/imports.test.ts +0 -120
- package/__tests__/instanceof.test.ts +0 -104
- package/__tests__/intersection.test.ts +0 -108
- package/__tests__/keyTraversal.test.ts +0 -77
- package/__tests__/keyof.test.ts +0 -150
- package/__tests__/keywords.test.ts +0 -214
- package/__tests__/literal.test.ts +0 -74
- package/__tests__/match.bench.ts +0 -31
- package/__tests__/match.test.ts +0 -234
- package/__tests__/methods.bench.ts +0 -22
- package/__tests__/narrow.test.ts +0 -100
- package/__tests__/object.bench.ts +0 -28
- package/__tests__/objectLiteral.test.ts +0 -319
- package/__tests__/operand.bench.ts +0 -45
- package/__tests__/operator.bench.ts +0 -130
- package/__tests__/pipe.test.ts +0 -501
- package/__tests__/realWorld.test.ts +0 -63
- package/__tests__/regex.test.ts +0 -68
- package/__tests__/scope.bench.ts +0 -39
- package/__tests__/scope.test.ts +0 -177
- package/__tests__/serialization.test.ts +0 -19
- package/__tests__/string.test.ts +0 -52
- package/__tests__/submodule.test.ts +0 -86
- package/__tests__/this.test.ts +0 -83
- package/__tests__/thunk.test.ts +0 -86
- package/__tests__/traverse.test.ts +0 -133
- package/__tests__/tsGenerics.test.ts +0 -12
- package/__tests__/type.test.ts +0 -36
- package/__tests__/typeReference.test.ts +0 -39
- package/__tests__/unenclosed.test.ts +0 -136
- package/__tests__/union.test.ts +0 -214
- package/ark.ts +0 -47
- package/generic.ts +0 -69
- package/main.ts +0 -6
- package/match.ts +0 -218
- package/module.ts +0 -15
- package/out/ark.d.ts +0 -29
- package/out/ark.d.ts.map +0 -1
- package/out/ark.js +0 -11
- package/out/ark.js.map +0 -1
- package/out/base.d.ts +0 -205
- package/out/base.d.ts.map +0 -1
- package/out/base.js +0 -320
- package/out/base.js.map +0 -1
- package/out/builtins/builtins.d.ts +0 -23
- package/out/builtins/builtins.d.ts.map +0 -1
- package/out/builtins/builtins.js +0 -15
- package/out/builtins/builtins.js.map +0 -1
- package/out/builtins/jsObjects.d.ts +0 -19
- package/out/builtins/jsObjects.d.ts.map +0 -1
- package/out/builtins/jsObjects.js +0 -18
- package/out/builtins/jsObjects.js.map +0 -1
- package/out/builtins/parsing.d.ts +0 -16
- package/out/builtins/parsing.d.ts.map +0 -1
- package/out/builtins/parsing.js +0 -62
- package/out/builtins/parsing.js.map +0 -1
- package/out/builtins/tsGenerics.d.ts +0 -2
- package/out/builtins/tsGenerics.d.ts.map +0 -1
- package/out/builtins/tsGenerics.js +0 -26
- package/out/builtins/tsGenerics.js.map +0 -1
- package/out/builtins/tsKeywords.d.ts +0 -23
- package/out/builtins/tsKeywords.d.ts.map +0 -1
- package/out/builtins/tsKeywords.js +0 -23
- package/out/builtins/tsKeywords.js.map +0 -1
- package/out/builtins/utils/creditCard.d.ts +0 -3
- package/out/builtins/utils/creditCard.d.ts.map +0 -1
- package/out/builtins/utils/creditCard.js +0 -35
- package/out/builtins/utils/creditCard.js.map +0 -1
- package/out/builtins/utils/date.d.ts +0 -41
- package/out/builtins/utils/date.d.ts.map +0 -1
- package/out/builtins/utils/date.js +0 -56
- package/out/builtins/utils/date.js.map +0 -1
- package/out/builtins/validation.d.ts +0 -19
- package/out/builtins/validation.d.ts.map +0 -1
- package/out/builtins/validation.js +0 -74
- package/out/builtins/validation.js.map +0 -1
- package/out/config.d.ts.map +0 -1
- package/out/config.js.map +0 -1
- package/out/constraints/ast.d.ts +0 -287
- package/out/constraints/ast.d.ts.map +0 -1
- package/out/constraints/ast.js +0 -2
- package/out/constraints/ast.js.map +0 -1
- package/out/constraints/constraint.d.ts +0 -200
- package/out/constraints/constraint.d.ts.map +0 -1
- package/out/constraints/constraint.js +0 -25
- package/out/constraints/constraint.js.map +0 -1
- package/out/constraints/predicate.d.ts +0 -64
- package/out/constraints/predicate.d.ts.map +0 -1
- package/out/constraints/predicate.js +0 -52
- package/out/constraints/predicate.js.map +0 -1
- package/out/constraints/props/index.d.ts +0 -42
- package/out/constraints/props/index.d.ts.map +0 -1
- package/out/constraints/props/index.js +0 -56
- package/out/constraints/props/index.js.map +0 -1
- package/out/constraints/props/optional.d.ts +0 -37
- package/out/constraints/props/optional.d.ts.map +0 -1
- package/out/constraints/props/optional.js +0 -56
- package/out/constraints/props/optional.js.map +0 -1
- package/out/constraints/props/prop.d.ts +0 -49
- package/out/constraints/props/prop.d.ts.map +0 -1
- package/out/constraints/props/prop.js +0 -106
- package/out/constraints/props/prop.js.map +0 -1
- package/out/constraints/props/props.d.ts +0 -37
- package/out/constraints/props/props.d.ts.map +0 -1
- package/out/constraints/props/props.js +0 -121
- package/out/constraints/props/props.js.map +0 -1
- package/out/constraints/props/required.d.ts +0 -46
- package/out/constraints/props/required.d.ts.map +0 -1
- package/out/constraints/props/required.js +0 -81
- package/out/constraints/props/required.js.map +0 -1
- package/out/constraints/props/sequence.d.ts +0 -82
- package/out/constraints/props/sequence.d.ts.map +0 -1
- package/out/constraints/props/sequence.js +0 -376
- package/out/constraints/props/sequence.js.map +0 -1
- package/out/constraints/props/shared.d.ts +0 -3
- package/out/constraints/props/shared.d.ts.map +0 -1
- package/out/constraints/props/shared.js +0 -4
- package/out/constraints/props/shared.js.map +0 -1
- package/out/constraints/refinements/after.d.ts +0 -33
- package/out/constraints/refinements/after.d.ts.map +0 -1
- package/out/constraints/refinements/after.js +0 -36
- package/out/constraints/refinements/after.js.map +0 -1
- package/out/constraints/refinements/before.d.ts +0 -33
- package/out/constraints/refinements/before.d.ts.map +0 -1
- package/out/constraints/refinements/before.js +0 -43
- package/out/constraints/refinements/before.js.map +0 -1
- package/out/constraints/refinements/divisor.d.ts +0 -52
- package/out/constraints/refinements/divisor.d.ts.map +0 -1
- package/out/constraints/refinements/divisor.js +0 -52
- package/out/constraints/refinements/divisor.js.map +0 -1
- package/out/constraints/refinements/exactLength.d.ts +0 -45
- package/out/constraints/refinements/exactLength.d.ts.map +0 -1
- package/out/constraints/refinements/exactLength.js +0 -52
- package/out/constraints/refinements/exactLength.js.map +0 -1
- package/out/constraints/refinements/kinds.d.ts +0 -29
- package/out/constraints/refinements/kinds.d.ts.map +0 -1
- package/out/constraints/refinements/kinds.js +0 -17
- package/out/constraints/refinements/kinds.js.map +0 -1
- package/out/constraints/refinements/length.d.ts +0 -48
- package/out/constraints/refinements/length.d.ts.map +0 -1
- package/out/constraints/refinements/length.js +0 -53
- package/out/constraints/refinements/length.js.map +0 -1
- package/out/constraints/refinements/max.d.ts +0 -31
- package/out/constraints/refinements/max.d.ts.map +0 -1
- package/out/constraints/refinements/max.js +0 -35
- package/out/constraints/refinements/max.js.map +0 -1
- package/out/constraints/refinements/maxLength.d.ts +0 -32
- package/out/constraints/refinements/maxLength.d.ts.map +0 -1
- package/out/constraints/refinements/maxLength.js +0 -36
- package/out/constraints/refinements/maxLength.js.map +0 -1
- package/out/constraints/refinements/min.d.ts +0 -31
- package/out/constraints/refinements/min.d.ts.map +0 -1
- package/out/constraints/refinements/min.js +0 -28
- package/out/constraints/refinements/min.js.map +0 -1
- package/out/constraints/refinements/minLength.d.ts +0 -32
- package/out/constraints/refinements/minLength.d.ts.map +0 -1
- package/out/constraints/refinements/minLength.js +0 -33
- package/out/constraints/refinements/minLength.js.map +0 -1
- package/out/constraints/refinements/range.d.ts +0 -119
- package/out/constraints/refinements/range.d.ts.map +0 -1
- package/out/constraints/refinements/range.js +0 -89
- package/out/constraints/refinements/range.js.map +0 -1
- package/out/constraints/refinements/regex.d.ts +0 -47
- package/out/constraints/refinements/regex.d.ts.map +0 -1
- package/out/constraints/refinements/regex.js +0 -37
- package/out/constraints/refinements/regex.js.map +0 -1
- package/out/constraints/refinements/shared.d.ts +0 -20
- package/out/constraints/refinements/shared.d.ts.map +0 -1
- package/out/constraints/refinements/shared.js +0 -10
- package/out/constraints/refinements/shared.js.map +0 -1
- package/out/generic.d.ts.map +0 -1
- package/out/generic.js.map +0 -1
- package/out/inference.d.ts +0 -137
- package/out/inference.d.ts.map +0 -1
- package/out/inference.js +0 -73
- package/out/inference.js.map +0 -1
- package/out/keywords/ark.d.ts.map +0 -1
- package/out/keywords/ark.js.map +0 -1
- package/out/keywords/internal.d.ts +0 -13
- package/out/keywords/internal.d.ts.map +0 -1
- package/out/keywords/internal.js +0 -13
- package/out/keywords/internal.js.map +0 -1
- package/out/keywords/jsObject.d.ts +0 -20
- package/out/keywords/jsObject.d.ts.map +0 -1
- package/out/keywords/jsObject.js +0 -18
- package/out/keywords/jsObject.js.map +0 -1
- package/out/keywords/parsing.d.ts +0 -17
- package/out/keywords/parsing.d.ts.map +0 -1
- package/out/keywords/parsing.js +0 -64
- package/out/keywords/parsing.js.map +0 -1
- package/out/keywords/root.d.ts +0 -7
- package/out/keywords/root.d.ts.map +0 -1
- package/out/keywords/root.js +0 -4
- package/out/keywords/root.js.map +0 -1
- package/out/keywords/tsGenerics.d.ts +0 -2
- package/out/keywords/tsGenerics.d.ts.map +0 -1
- package/out/keywords/tsGenerics.js +0 -26
- package/out/keywords/tsGenerics.js.map +0 -1
- package/out/keywords/tsPrimitive.d.ts +0 -24
- package/out/keywords/tsPrimitive.d.ts.map +0 -1
- package/out/keywords/tsPrimitive.js +0 -25
- package/out/keywords/tsPrimitive.js.map +0 -1
- package/out/keywords/utils/creditCard.d.ts +0 -11
- package/out/keywords/utils/creditCard.d.ts.map +0 -1
- package/out/keywords/utils/creditCard.js +0 -35
- package/out/keywords/utils/creditCard.js.map +0 -1
- package/out/keywords/utils/date.d.ts +0 -45
- package/out/keywords/utils/date.d.ts.map +0 -1
- package/out/keywords/utils/date.js +0 -56
- package/out/keywords/utils/date.js.map +0 -1
- package/out/keywords/validation.d.ts +0 -20
- package/out/keywords/validation.d.ts.map +0 -1
- package/out/keywords/validation.js +0 -80
- package/out/keywords/validation.js.map +0 -1
- package/out/kinds.d.ts +0 -102
- package/out/kinds.d.ts.map +0 -1
- package/out/kinds.js +0 -29
- package/out/kinds.js.map +0 -1
- package/out/main.d.ts +0 -7
- package/out/main.d.ts.map +0 -1
- package/out/main.js +0 -6
- package/out/main.js.map +0 -1
- package/out/match.d.ts +0 -72
- package/out/match.d.ts.map +0 -1
- package/out/match.js +0 -53
- package/out/match.js.map +0 -1
- package/out/module.d.ts.map +0 -1
- package/out/module.js.map +0 -1
- package/out/parse.d.ts +0 -29
- package/out/parse.d.ts.map +0 -1
- package/out/parse.js +0 -161
- package/out/parse.js.map +0 -1
- package/out/parser/definition.d.ts.map +0 -1
- package/out/parser/definition.js.map +0 -1
- package/out/parser/generic.d.ts +0 -17
- package/out/parser/generic.d.ts.map +0 -1
- package/out/parser/generic.js +0 -16
- package/out/parser/generic.js.map +0 -1
- package/out/parser/objectLiteral.d.ts.map +0 -1
- package/out/parser/objectLiteral.js.map +0 -1
- package/out/parser/semantic/bounds.d.ts.map +0 -1
- package/out/parser/semantic/bounds.js.map +0 -1
- package/out/parser/semantic/divisor.d.ts.map +0 -1
- package/out/parser/semantic/divisor.js.map +0 -1
- package/out/parser/semantic/infer.d.ts.map +0 -1
- package/out/parser/semantic/infer.js.map +0 -1
- package/out/parser/semantic/utils.d.ts.map +0 -1
- package/out/parser/semantic/utils.js.map +0 -1
- package/out/parser/semantic/validate.d.ts.map +0 -1
- package/out/parser/semantic/validate.js.map +0 -1
- package/out/parser/string/reduce/dynamic.d.ts.map +0 -1
- package/out/parser/string/reduce/dynamic.js.map +0 -1
- package/out/parser/string/reduce/shared.d.ts.map +0 -1
- package/out/parser/string/reduce/shared.js.map +0 -1
- package/out/parser/string/reduce/static.d.ts.map +0 -1
- package/out/parser/string/reduce/static.js.map +0 -1
- package/out/parser/string/shift/operand/date.d.ts.map +0 -1
- package/out/parser/string/shift/operand/date.js.map +0 -1
- package/out/parser/string/shift/operand/enclosed.d.ts.map +0 -1
- package/out/parser/string/shift/operand/enclosed.js.map +0 -1
- package/out/parser/string/shift/operand/genericArgs.d.ts.map +0 -1
- package/out/parser/string/shift/operand/genericArgs.js.map +0 -1
- package/out/parser/string/shift/operand/operand.d.ts.map +0 -1
- package/out/parser/string/shift/operand/operand.js.map +0 -1
- package/out/parser/string/shift/operand/unenclosed.d.ts.map +0 -1
- package/out/parser/string/shift/operand/unenclosed.js.map +0 -1
- package/out/parser/string/shift/operator/bounds.d.ts.map +0 -1
- package/out/parser/string/shift/operator/bounds.js.map +0 -1
- package/out/parser/string/shift/operator/divisor.d.ts.map +0 -1
- package/out/parser/string/shift/operator/divisor.js.map +0 -1
- package/out/parser/string/shift/operator/operator.d.ts.map +0 -1
- package/out/parser/string/shift/operator/operator.js.map +0 -1
- package/out/parser/string/shift/scanner.d.ts.map +0 -1
- package/out/parser/string/shift/scanner.js.map +0 -1
- package/out/parser/string/string.d.ts.map +0 -1
- package/out/parser/string/string.js.map +0 -1
- package/out/parser/tuple.d.ts.map +0 -1
- package/out/parser/tuple.js.map +0 -1
- package/out/schema.d.ts +0 -175
- package/out/schema.d.ts.map +0 -1
- package/out/schema.js +0 -73
- package/out/schema.js.map +0 -1
- package/out/schemaScope.d.ts +0 -180
- package/out/schemaScope.d.ts.map +0 -1
- package/out/schemaScope.js +0 -235
- package/out/schemaScope.js.map +0 -1
- package/out/scope.d.ts.map +0 -1
- package/out/scope.js.map +0 -1
- package/out/shared/compile.d.ts +0 -22
- package/out/shared/compile.d.ts.map +0 -1
- package/out/shared/compile.js +0 -79
- package/out/shared/compile.js.map +0 -1
- package/out/shared/context.d.ts +0 -54
- package/out/shared/context.d.ts.map +0 -1
- package/out/shared/context.js +0 -53
- package/out/shared/context.js.map +0 -1
- package/out/shared/declare.d.ts +0 -69
- package/out/shared/declare.d.ts.map +0 -1
- package/out/shared/declare.js +0 -2
- package/out/shared/declare.js.map +0 -1
- package/out/shared/disjoint.d.ts +0 -91
- package/out/shared/disjoint.d.ts.map +0 -1
- package/out/shared/disjoint.js +0 -110
- package/out/shared/disjoint.js.map +0 -1
- package/out/shared/errors.d.ts +0 -99
- package/out/shared/errors.d.ts.map +0 -1
- package/out/shared/errors.js +0 -108
- package/out/shared/errors.js.map +0 -1
- package/out/shared/implement.d.ts +0 -363
- package/out/shared/implement.d.ts.map +0 -1
- package/out/shared/implement.js +0 -68
- package/out/shared/implement.js.map +0 -1
- package/out/shared/inference.d.ts +0 -6
- package/out/shared/inference.d.ts.map +0 -1
- package/out/shared/inference.js +0 -5
- package/out/shared/inference.js.map +0 -1
- package/out/shared/intersections.d.ts +0 -60
- package/out/shared/intersections.d.ts.map +0 -1
- package/out/shared/intersections.js +0 -2
- package/out/shared/intersections.js.map +0 -1
- package/out/shared/traversal.d.ts +0 -62
- package/out/shared/traversal.d.ts.map +0 -1
- package/out/shared/traversal.js +0 -97
- package/out/shared/traversal.js.map +0 -1
- package/out/shared/utils.d.ts +0 -24
- package/out/shared/utils.d.ts.map +0 -1
- package/out/shared/utils.js +0 -15
- package/out/shared/utils.js.map +0 -1
- package/out/type.d.ts.map +0 -1
- package/out/type.js.map +0 -1
- package/out/types/basis.d.ts +0 -47
- package/out/types/basis.d.ts.map +0 -1
- package/out/types/basis.js +0 -15
- package/out/types/basis.js.map +0 -1
- package/out/types/discriminate.d.ts +0 -34
- package/out/types/discriminate.d.ts.map +0 -1
- package/out/types/discriminate.js +0 -120
- package/out/types/discriminate.js.map +0 -1
- package/out/types/domain.d.ts +0 -57
- package/out/types/domain.d.ts.map +0 -1
- package/out/types/domain.js +0 -41
- package/out/types/domain.js.map +0 -1
- package/out/types/intersection.d.ts +0 -127
- package/out/types/intersection.d.ts.map +0 -1
- package/out/types/intersection.js +0 -379
- package/out/types/intersection.js.map +0 -1
- package/out/types/morph.d.ts +0 -157
- package/out/types/morph.d.ts.map +0 -1
- package/out/types/morph.js +0 -99
- package/out/types/morph.js.map +0 -1
- package/out/types/proto.d.ts +0 -51
- package/out/types/proto.d.ts.map +0 -1
- package/out/types/proto.js +0 -60
- package/out/types/proto.js.map +0 -1
- package/out/types/type.d.ts +0 -143
- package/out/types/type.d.ts.map +0 -1
- package/out/types/type.js +0 -123
- package/out/types/type.js.map +0 -1
- package/out/types/union.d.ts +0 -71
- package/out/types/union.d.ts.map +0 -1
- package/out/types/union.js +0 -379
- package/out/types/union.js.map +0 -1
- package/out/types/unit.d.ts +0 -45
- package/out/types/unit.d.ts.map +0 -1
- package/out/types/unit.js +0 -56
- package/out/types/unit.js.map +0 -1
- package/out/util.d.ts +0 -31
- package/out/util.d.ts.map +0 -1
- package/out/util.js +0 -8
- package/out/util.js.map +0 -1
- package/parser/definition.ts +0 -143
- package/parser/generic.ts +0 -66
- package/parser/objectLiteral.ts +0 -217
- package/parser/semantic/bounds.ts +0 -62
- package/parser/semantic/divisor.ts +0 -11
- package/parser/semantic/infer.ts +0 -141
- package/parser/semantic/utils.ts +0 -15
- package/parser/semantic/validate.ts +0 -117
- package/parser/string/reduce/dynamic.ts +0 -208
- package/parser/string/reduce/shared.ts +0 -99
- package/parser/string/reduce/static.ts +0 -296
- package/parser/string/shift/operand/date.ts +0 -55
- package/parser/string/shift/operand/enclosed.ts +0 -123
- package/parser/string/shift/operand/genericArgs.ts +0 -128
- package/parser/string/shift/operand/operand.ts +0 -42
- package/parser/string/shift/operand/unenclosed.ts +0 -218
- package/parser/string/shift/operator/bounds.ts +0 -270
- package/parser/string/shift/operator/divisor.ts +0 -33
- package/parser/string/shift/operator/operator.ts +0 -71
- package/parser/string/shift/scanner.ts +0 -210
- package/parser/string/string.ts +0 -85
- package/parser/tuple.ts +0 -542
- package/scope.ts +0 -285
- package/type.ts +0 -265
package/out/shared/context.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { literalPropAccess } from "@arktype/util"
|
|
2
|
-
import { ArkErrors } from "./errors.js"
|
|
3
|
-
export const pathToPropString = (path) => {
|
|
4
|
-
const propAccessChain = path.reduce(
|
|
5
|
-
(s, segment) => s + literalPropAccess(segment),
|
|
6
|
-
""
|
|
7
|
-
)
|
|
8
|
-
return propAccessChain[0] === "."
|
|
9
|
-
? propAccessChain.slice(1)
|
|
10
|
-
: propAccessChain
|
|
11
|
-
}
|
|
12
|
-
export class TraversalContext {
|
|
13
|
-
root
|
|
14
|
-
config
|
|
15
|
-
path = []
|
|
16
|
-
errorsStack
|
|
17
|
-
// TODO: add morphs here
|
|
18
|
-
entriesToPrune = []
|
|
19
|
-
// Qualified
|
|
20
|
-
seen = {}
|
|
21
|
-
constructor(root, config) {
|
|
22
|
-
this.root = root
|
|
23
|
-
this.config = config
|
|
24
|
-
this.errorsStack = [new ArkErrors(this)]
|
|
25
|
-
}
|
|
26
|
-
get currentErrors() {
|
|
27
|
-
return this.errorsStack.at(-1)
|
|
28
|
-
}
|
|
29
|
-
get error() {
|
|
30
|
-
return this.currentErrors.add.bind(this.currentErrors)
|
|
31
|
-
}
|
|
32
|
-
get data() {
|
|
33
|
-
let result = this.root
|
|
34
|
-
for (const segment of this.path) {
|
|
35
|
-
result = result?.[segment]
|
|
36
|
-
}
|
|
37
|
-
return result
|
|
38
|
-
}
|
|
39
|
-
invalid(input) {
|
|
40
|
-
this.error(input)
|
|
41
|
-
return false
|
|
42
|
-
}
|
|
43
|
-
pushUnion() {
|
|
44
|
-
this.errorsStack.push(new ArkErrors(this))
|
|
45
|
-
}
|
|
46
|
-
popUnion(branchCount, data, path) {
|
|
47
|
-
const branchProblems = this.errorsStack.pop()
|
|
48
|
-
if (branchProblems.count === branchCount) {
|
|
49
|
-
// this.addError("union", { data: this.data, errors: branchProblems })
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../shared/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAsB,MAAM,aAAa,CAAA;AAK3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAmB,EAAE,EAAE;IACvD,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAC9C,EAAE,CACF,CAAA;IACD,OAAO,eAAe,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAA;AAC/E,CAAC,CAAA;AAED,MAAM,OAAO,gBAAgB;IAUpB;IACA;IAVR,IAAI,GAAkB,EAAE,CAAA;IACxB,WAAW,CAAa;IACxB,wBAAwB;IACxB,cAAc,GAAmD,EAAE,C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from "../base.js"
|
|
3
|
-
import type { reducibleKindOf } from "../kinds.js"
|
|
4
|
-
import type { Disjoint } from "./disjoint.js"
|
|
5
|
-
import type { NodeKind } from "./implement.js"
|
|
6
|
-
export interface BaseMeta {
|
|
7
|
-
readonly description?: string
|
|
8
|
-
}
|
|
9
|
-
export declare const metaKeys: {
|
|
10
|
-
[k in keyof BaseMeta]: 1
|
|
11
|
-
}
|
|
12
|
-
interface DeclarationInput {
|
|
13
|
-
kind: NodeKind
|
|
14
|
-
schema: unknown
|
|
15
|
-
normalizedSchema: BaseMeta
|
|
16
|
-
inner: BaseMeta
|
|
17
|
-
reducibleTo?: NodeKind
|
|
18
|
-
intersectionIsOpen?: true
|
|
19
|
-
errorContext?: object
|
|
20
|
-
prerequisite?: unknown
|
|
21
|
-
childKind?: NodeKind
|
|
22
|
-
}
|
|
23
|
-
export interface BaseErrorContext<kind extends NodeKind = NodeKind> {
|
|
24
|
-
code: kind
|
|
25
|
-
}
|
|
26
|
-
export type defaultErrorContext<d extends DeclarationInput> = evaluate<
|
|
27
|
-
BaseErrorContext<d["kind"]> & d["inner"]
|
|
28
|
-
>
|
|
29
|
-
export type declareNode<
|
|
30
|
-
d extends {
|
|
31
|
-
[k in keyof d]: k extends keyof DeclarationInput
|
|
32
|
-
? DeclarationInput[k]
|
|
33
|
-
: never
|
|
34
|
-
} & DeclarationInput
|
|
35
|
-
> = merge<
|
|
36
|
-
{
|
|
37
|
-
intersectionIsOpen: false
|
|
38
|
-
prerequisite: prerequisiteOf<d>
|
|
39
|
-
childKind: never
|
|
40
|
-
reducibleTo: d["kind"]
|
|
41
|
-
errorContext: null
|
|
42
|
-
},
|
|
43
|
-
d & {
|
|
44
|
-
errorContext: d["errorContext"] extends {}
|
|
45
|
-
? BaseErrorContext<d["kind"]>
|
|
46
|
-
: null
|
|
47
|
-
}
|
|
48
|
-
>
|
|
49
|
-
type prerequisiteOf<d extends DeclarationInput> = "prerequisite" extends keyof d
|
|
50
|
-
? d["prerequisite"]
|
|
51
|
-
: unknown
|
|
52
|
-
export type BaseAttachmentsOf<d extends BaseNodeDeclaration> =
|
|
53
|
-
NarrowedAttachments<d> & d["inner"]
|
|
54
|
-
export type BaseNodeDeclaration = {
|
|
55
|
-
kind: NodeKind
|
|
56
|
-
schema: unknown
|
|
57
|
-
normalizedSchema: BaseMeta
|
|
58
|
-
inner: BaseMeta
|
|
59
|
-
reducibleTo: NodeKind
|
|
60
|
-
prerequisite: any
|
|
61
|
-
intersectionIsOpen: boolean
|
|
62
|
-
childKind: NodeKind
|
|
63
|
-
errorContext: BaseErrorContext | null
|
|
64
|
-
}
|
|
65
|
-
export type ownIntersectionResult<d extends BaseNodeDeclaration> =
|
|
66
|
-
| Node<reducibleKindOf<d["kind"]>>
|
|
67
|
-
| Disjoint
|
|
68
|
-
export {}
|
|
69
|
-
//# sourceMappingURL=declare.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"declare.d.ts","sourceRoot":"","sources":["../../shared/declare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,eAAO,MAAM,QAAQ,EAAE;KAAG,CAAC,IAAI,MAAM,QAAQ,GAAG,CAAC;CAAuB,CAAA;AAExE,UAAU,gBAAgB;IACzB,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,gBAAgB,EAAE,QAAQ,CAAA;I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,CAAC,OAAO,CAAC,CAAA;AAEpC,MAAM,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,gBAAgB,EAAE,QAAQ,CAAA;IAC1B,KAAK,EAAE,QAAQ,CAAA;IACf,WAAW,EAAE,QAAQ,CAAA;IACrB,YAAY,EAAE,GAAG,CAAA;IACjB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,SAAS,EAAE,QAAQ,CAAA;IACnB,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,mBAAmB,IAC5D,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAChC,QAAQ,CAAA"}
|
package/out/shared/declare.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"declare.js","sourceRoot":"","sources":["../../shared/declare.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,QAAQ,GAAiC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAA"}
|
package/out/shared/disjoint.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { type entryOf } from "@arktype/util"
|
|
2
|
-
import type { Node } from "../base.js"
|
|
3
|
-
import type {
|
|
4
|
-
BoundKind,
|
|
5
|
-
IntersectionChildKind,
|
|
6
|
-
kindRightOf
|
|
7
|
-
} from "./implement.js"
|
|
8
|
-
type DisjointKinds = {
|
|
9
|
-
domain?: {
|
|
10
|
-
l: Node<"domain">
|
|
11
|
-
r: Node<"domain">
|
|
12
|
-
}
|
|
13
|
-
unit?: {
|
|
14
|
-
l: Node<"unit">
|
|
15
|
-
r: Node<"unit">
|
|
16
|
-
}
|
|
17
|
-
proto?: {
|
|
18
|
-
l: Node<"proto">
|
|
19
|
-
r: Node<"proto">
|
|
20
|
-
}
|
|
21
|
-
presence?:
|
|
22
|
-
| {
|
|
23
|
-
l: true
|
|
24
|
-
r: false
|
|
25
|
-
}
|
|
26
|
-
| {
|
|
27
|
-
l: false
|
|
28
|
-
r: true
|
|
29
|
-
}
|
|
30
|
-
range?: {
|
|
31
|
-
l: Node<BoundKind>
|
|
32
|
-
r: Node<BoundKind>
|
|
33
|
-
}
|
|
34
|
-
assignability?:
|
|
35
|
-
| {
|
|
36
|
-
l: unknown
|
|
37
|
-
r: Node<IntersectionChildKind>
|
|
38
|
-
}
|
|
39
|
-
| {
|
|
40
|
-
l: Node<IntersectionChildKind>
|
|
41
|
-
r: unknown
|
|
42
|
-
}
|
|
43
|
-
union?: {
|
|
44
|
-
l: readonly Node<kindRightOf<"union">>[]
|
|
45
|
-
r: readonly Node<kindRightOf<"union">>[]
|
|
46
|
-
}
|
|
47
|
-
indiscriminableMorphs?: {
|
|
48
|
-
l: Node<"union">
|
|
49
|
-
r: Node<"union">
|
|
50
|
-
}
|
|
51
|
-
interesectedMorphs?: {
|
|
52
|
-
l: Node<"morph">
|
|
53
|
-
r: Node<"morph">
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export type DisjointKindEntries = entryOf<DisjointKinds>[]
|
|
57
|
-
export type SerializedPath = `[${string}]`
|
|
58
|
-
export type DisjointsSources = {
|
|
59
|
-
[k in `${SerializedPath}`]: DisjointsAtPath
|
|
60
|
-
}
|
|
61
|
-
export type DisjointsAtPath = {
|
|
62
|
-
[kind in DisjointKind]?: DisjointKinds[kind]
|
|
63
|
-
}
|
|
64
|
-
export type DisjointSourceEntry = entryOf<DisjointsSources>
|
|
65
|
-
export type FlatDisjointEntry = {
|
|
66
|
-
path: SerializedPath
|
|
67
|
-
kind: DisjointKind
|
|
68
|
-
disjoint: Required<DisjointKinds>[DisjointKind]
|
|
69
|
-
}
|
|
70
|
-
export type DisjointKind = keyof DisjointKinds
|
|
71
|
-
export declare class Disjoint {
|
|
72
|
-
sources: DisjointsSources
|
|
73
|
-
constructor(sources: DisjointsSources)
|
|
74
|
-
clone(): Disjoint
|
|
75
|
-
static from<kind extends DisjointKind>(
|
|
76
|
-
kind: kind,
|
|
77
|
-
l: Required<DisjointKinds>[kind]["l"],
|
|
78
|
-
r: Required<DisjointKinds>[kind]["r"]
|
|
79
|
-
): Disjoint
|
|
80
|
-
static fromEntries(entries: DisjointKindEntries): Disjoint
|
|
81
|
-
get flat(): FlatDisjointEntry[]
|
|
82
|
-
describeReasons(): string
|
|
83
|
-
isEmpty(): boolean
|
|
84
|
-
throw(): never
|
|
85
|
-
invert(): Disjoint
|
|
86
|
-
add(input: Disjoint): void
|
|
87
|
-
withPrefixKey(key: string): Disjoint
|
|
88
|
-
toString(): string
|
|
89
|
-
}
|
|
90
|
-
export {}
|
|
91
|
-
//# sourceMappingURL=disjoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disjoint.d.ts","sourceRoot":"","sources":["../../shared/disjoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,KAAK,OAAO,EACZ,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,OAAO,KAAK,EACX,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,MAAM,gBAAgB,CAAA;AAEvB,KAAK,aAAa,GAAG;IACpB,MAAM,CAAC,EAAE;QACR,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjB,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;KACjB,CAAA;IACD,IAAI,CAAC,EAAE;QACN,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACf,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;KACf,CAAA;IACD,KAAK,CAAC,EAAE;QACP,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QAChB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;KAChB,CAAA;IAED,QAAQ,CAAC,EACN;QACA,CAAC,EAAE,IA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|
-
import { hasArkKind } from "../util.js"
|
|
11
|
-
export class Disjoint {
|
|
12
|
-
sources
|
|
13
|
-
constructor(sources) {
|
|
14
|
-
this.sources = sources
|
|
15
|
-
}
|
|
16
|
-
clone() {
|
|
17
|
-
return new Disjoint(this.sources)
|
|
18
|
-
}
|
|
19
|
-
static from(kind, l, r) {
|
|
20
|
-
return new Disjoint({
|
|
21
|
-
"[]": {
|
|
22
|
-
[kind]: {
|
|
23
|
-
l,
|
|
24
|
-
r
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
static fromEntries(entries) {
|
|
30
|
-
if (!entries.length) {
|
|
31
|
-
return throwInternalError(
|
|
32
|
-
`Unexpected attempt to create a disjoint from no entries`
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
return new Disjoint({ "[]": fromEntries(entries) })
|
|
36
|
-
}
|
|
37
|
-
get flat() {
|
|
38
|
-
return entriesOf(this.sources).flatMap(([path, disjointKinds]) =>
|
|
39
|
-
entriesOf(disjointKinds).map(([kind, disjoint]) => ({
|
|
40
|
-
path,
|
|
41
|
-
kind,
|
|
42
|
-
disjoint
|
|
43
|
-
}))
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
describeReasons() {
|
|
47
|
-
const reasons = this.flat
|
|
48
|
-
if (reasons.length === 1) {
|
|
49
|
-
const { path, disjoint } = reasons[0]
|
|
50
|
-
const pathString = JSON.parse(path).join(".")
|
|
51
|
-
return `Intersection${
|
|
52
|
-
pathString && ` at ${pathString}`
|
|
53
|
-
} of ${describeReason(disjoint.l)} and ${describeReason(
|
|
54
|
-
disjoint.r
|
|
55
|
-
)} results in an unsatisfiable type`
|
|
56
|
-
}
|
|
57
|
-
return `The following intersections result in unsatisfiable types:\n• ${reasons
|
|
58
|
-
.map(
|
|
59
|
-
({ path, disjoint }) =>
|
|
60
|
-
`${path}: ${describeReason(
|
|
61
|
-
disjoint.l
|
|
62
|
-
)} and ${describeReason(disjoint.r)}`
|
|
63
|
-
)
|
|
64
|
-
.join("\n• ")}`
|
|
65
|
-
}
|
|
66
|
-
isEmpty() {
|
|
67
|
-
return this.flat.length === 0
|
|
68
|
-
}
|
|
69
|
-
throw() {
|
|
70
|
-
return throwParseError(this.describeReasons())
|
|
71
|
-
}
|
|
72
|
-
invert() {
|
|
73
|
-
const invertedEntries = entriesOf(this.sources).map(
|
|
74
|
-
([path, disjoints]) => [
|
|
75
|
-
path,
|
|
76
|
-
flatMorph(disjoints, (kind, disjoint) => [
|
|
77
|
-
kind,
|
|
78
|
-
{ l: disjoint.r, r: disjoint.l }
|
|
79
|
-
])
|
|
80
|
-
]
|
|
81
|
-
)
|
|
82
|
-
return new Disjoint(fromEntries(invertedEntries))
|
|
83
|
-
}
|
|
84
|
-
add(input) {
|
|
85
|
-
entriesOf(input.sources).forEach(([path, disjoints]) =>
|
|
86
|
-
Object.assign(this.sources[path] ?? {}, disjoints)
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
withPrefixKey(key) {
|
|
90
|
-
const entriesWithPrefix = entriesOf(this.sources).map(
|
|
91
|
-
([path, disjoints]) => {
|
|
92
|
-
const segments = JSON.parse(path)
|
|
93
|
-
segments.unshift(key)
|
|
94
|
-
const pathWithPrefix = JSON.stringify(segments)
|
|
95
|
-
return [pathWithPrefix, disjoints]
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
return new Disjoint(fromEntries(entriesWithPrefix))
|
|
99
|
-
}
|
|
100
|
-
toString() {
|
|
101
|
-
return printable(this.sources)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
const describeReason = (value) =>
|
|
105
|
-
hasArkKind(value, "node")
|
|
106
|
-
? value.expression
|
|
107
|
-
: isArray(value)
|
|
108
|
-
? value.map(describeReason).join(" | ")
|
|
109
|
-
: String(value)
|
|
110
|
-
//# sourceMappingURL=disjoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disjoint.js","sourceR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-
type evaluate,
|
|
4
|
-
type optionalizeKeys,
|
|
5
|
-
type propwiseXor
|
|
6
|
-
} from "@arktype/util"
|
|
7
|
-
import type { Prerequisite, errorContext } from "../kinds.js"
|
|
8
|
-
import type { NodeKind } from "./implement.js"
|
|
9
|
-
import type { TraversalContext } from "./traversal.js"
|
|
10
|
-
import { type TraversalPath } from "./utils.js"
|
|
11
|
-
export declare const throwArkError: (
|
|
12
|
-
message?: string | undefined,
|
|
13
|
-
options?: ErrorOptions | undefined
|
|
14
|
-
) => never
|
|
15
|
-
export declare class ArkError extends TypeError {
|
|
16
|
-
toString(): string
|
|
17
|
-
throw(): never
|
|
18
|
-
}
|
|
19
|
-
export type ArkTypeError<code extends ArkErrorCode = ArkErrorCode> = ArkError &
|
|
20
|
-
ArkErrorContext<code>
|
|
21
|
-
export declare const ArkTypeError: new <
|
|
22
|
-
code extends ArkErrorCode = ArkErrorCode
|
|
23
|
-
>(
|
|
24
|
-
context: ArkErrorContext<code>
|
|
25
|
-
) => ArkTypeError<code>
|
|
26
|
-
export declare class ArkErrors extends ReadonlyArray<ArkTypeError> {
|
|
27
|
-
protected ctx: TraversalContext
|
|
28
|
-
constructor(ctx: TraversalContext)
|
|
29
|
-
byPath: Record<string, ArkTypeError>
|
|
30
|
-
count: number
|
|
31
|
-
private mutable
|
|
32
|
-
add(error: ArkTypeError): void
|
|
33
|
-
get summary(): string
|
|
34
|
-
toString(): string
|
|
35
|
-
throw(): never
|
|
36
|
-
}
|
|
37
|
-
export declare const createError: (
|
|
38
|
-
ctx: TraversalContext,
|
|
39
|
-
input: ArkErrorInput
|
|
40
|
-
) => ArkTypeError
|
|
41
|
-
export interface DerivableErrorContext<data = unknown> {
|
|
42
|
-
expected: string
|
|
43
|
-
actual: string | null
|
|
44
|
-
problem: string
|
|
45
|
-
message: string
|
|
46
|
-
data: data
|
|
47
|
-
path: TraversalPath
|
|
48
|
-
propString: string
|
|
49
|
-
}
|
|
50
|
-
export type ArkErrorCode = {
|
|
51
|
-
[kind in NodeKind]: errorContext<kind> extends null ? never : kind
|
|
52
|
-
}[NodeKind]
|
|
53
|
-
export type ArkErrorContext<code extends ArkErrorCode = ArkErrorCode> =
|
|
54
|
-
errorContext<code> & DerivableErrorContext<Prerequisite<code>>
|
|
55
|
-
export type MessageContext<code extends ArkErrorCode = ArkErrorCode> = Omit<
|
|
56
|
-
ArkErrorContext<code>,
|
|
57
|
-
"message"
|
|
58
|
-
>
|
|
59
|
-
export type ProblemContext<code extends ArkErrorCode = ArkErrorCode> = Omit<
|
|
60
|
-
MessageContext<code>,
|
|
61
|
-
"problem"
|
|
62
|
-
>
|
|
63
|
-
type ErrorInputByCode = {
|
|
64
|
-
[code in ArkErrorCode]: optionalizeKeys<
|
|
65
|
-
ArkErrorContext<code>,
|
|
66
|
-
keyof DerivableErrorContext
|
|
67
|
-
>
|
|
68
|
-
}
|
|
69
|
-
export type CustomErrorInput = evaluate<
|
|
70
|
-
{
|
|
71
|
-
code?: undefined
|
|
72
|
-
} & Partial<DerivableErrorContext>
|
|
73
|
-
>
|
|
74
|
-
export type ArkErrorInput =
|
|
75
|
-
| string
|
|
76
|
-
| ErrorInputByCode[ArkErrorCode]
|
|
77
|
-
| CustomErrorInput
|
|
78
|
-
export type ProblemWriter<code extends ArkErrorCode = ArkErrorCode> = (
|
|
79
|
-
context: ProblemContext<code>
|
|
80
|
-
) => string
|
|
81
|
-
export type MessageWriter<code extends ArkErrorCode = ArkErrorCode> = (
|
|
82
|
-
context: MessageContext<code>
|
|
83
|
-
) => string
|
|
84
|
-
export type getAssociatedDataForError<code extends ArkErrorCode> =
|
|
85
|
-
code extends NodeKind ? Prerequisite<code> : unknown
|
|
86
|
-
export type ExpectedWriter<code extends ArkErrorCode = ArkErrorCode> = (
|
|
87
|
-
source: errorContext<code>
|
|
88
|
-
) => string
|
|
89
|
-
export type ActualWriter<code extends ArkErrorCode = ArkErrorCode> = (
|
|
90
|
-
data: getAssociatedDataForError<code>
|
|
91
|
-
) => string | null
|
|
92
|
-
export type ArkResult<data = unknown, out = data> = propwiseXor<{
|
|
93
|
-
data: data;
|
|
94
|
-
out: out;
|
|
95
|
-
}, {
|
|
96
|
-
errors: ArkErrors;
|
|
97
|
-
}>;
|
|
98
|
-
export {}
|
|
99
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../shared/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EAEb,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAEjE,eAAO,MAAM,aAAa,wEAEvB,KAEF,CAAA;AAED,qBAAa,QAAS,SAAQ,SAAS;IACtC,QAAQ,IAAI,MAAM;IAIlB,KAAK,IAAI,KAAK;CAGd;AAED,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,YAAY,GAAG,YAAY,IAAI,QAAQ,GAC5E,eAAe,CAAC,IAAI,CAAC,CAAA;AAEtB,eAAO,MAAM,YAAY,EAAE,KAAK,IAAI,SAAS,YAAY,GAAG,YAAY,EACvE,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,KAC1B,YAAY,CAAC,IAAI,CAOZ,CAAA;AAEV,qBAAa,SAAU,SAAQ,aAAa,CAAC,YAAY,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE,gBAAgB;gBAArB,GAAG,EAAE,gBAAgB;IAI3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAK;IACzC,KAAK,SAAI;IACT,OAAO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C;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CACrD,CAAA;AAED,MAAM,MAAM,aAAa,GACtB,MAAM,GACN,gBAAgB,CAAC,YAAY,CAAC,GAC9B,gBAAgB,CAAA;AAEnB,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,YAAY,GAAG,YAAY,IAAI,CACrE,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,KACzB,MAAM,CAAA;AAEX,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,YAAY,GAAG,YAAY,IAAI,CACrE,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,KACzB,MAAM,CAAA;AAEX,MAAM,MAAM,yBAAyB,CAAC,IAAI,SAAS,YAAY,IAC9D,IAAI,SAAS,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;AAErD,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,YAAY,GAAG,YAAY,IAAI,CACtE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,KACtB,MAAM,CAAA;AAEX,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,YAAY,GAAG,YAAY,IAAI,CACpE,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC,KACjC,MAAM,GAAG,IAAI,CAAA;AAElB,MAAM,MAAM,SAAS,CAAC,IAAI,GAAG,OAAO,EAAE,GAAG,GAAG,IAAI,IAAI,WAAW,CAC9D;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,EACxB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CACrB,CAAA"}
|
package/out/shared/errors.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { ReadonlyArray, hasDefinedKey } from "@arktype/util"
|
|
2
|
-
import { arkKind } from "../util.js"
|
|
3
|
-
import { pathToPropString } from "./utils.js"
|
|
4
|
-
export const throwArkError = (...args) => {
|
|
5
|
-
throw new ArkError(...args)
|
|
6
|
-
}
|
|
7
|
-
export class ArkError extends TypeError {
|
|
8
|
-
toString() {
|
|
9
|
-
return this.message
|
|
10
|
-
}
|
|
11
|
-
throw() {
|
|
12
|
-
throw this
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export const ArkTypeError = class extends ArkError {
|
|
16
|
-
[arkKind] = "error"
|
|
17
|
-
constructor(context) {
|
|
18
|
-
super(context.message)
|
|
19
|
-
Object.assign(this, context)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export class ArkErrors extends ReadonlyArray {
|
|
23
|
-
ctx
|
|
24
|
-
constructor(ctx) {
|
|
25
|
-
super()
|
|
26
|
-
this.ctx = ctx
|
|
27
|
-
}
|
|
28
|
-
byPath = {}
|
|
29
|
-
count = 0
|
|
30
|
-
mutable = this
|
|
31
|
-
add(error) {
|
|
32
|
-
const pathKey = error.path.join(".")
|
|
33
|
-
const existing = this.byPath[pathKey]
|
|
34
|
-
if (existing) {
|
|
35
|
-
const errorIntersection = createError(this.ctx, {
|
|
36
|
-
code: "intersection",
|
|
37
|
-
errors:
|
|
38
|
-
existing.code === "intersection"
|
|
39
|
-
? [...existing.errors, error]
|
|
40
|
-
: [existing, error]
|
|
41
|
-
})
|
|
42
|
-
const existingIndex = this.indexOf(existing)
|
|
43
|
-
// If existing is found (which it always should be unless this was externally mutated),
|
|
44
|
-
// replace it with the new problem intersection. In case it isn't for whatever reason,
|
|
45
|
-
// just append the intersection.
|
|
46
|
-
this.mutable[existingIndex === -1 ? this.length : existingIndex] =
|
|
47
|
-
errorIntersection
|
|
48
|
-
this.byPath[pathKey] = errorIntersection
|
|
49
|
-
} else {
|
|
50
|
-
this.byPath[pathKey] = error
|
|
51
|
-
this.mutable.push(error)
|
|
52
|
-
}
|
|
53
|
-
this.count++
|
|
54
|
-
}
|
|
55
|
-
get summary() {
|
|
56
|
-
return this.toString()
|
|
57
|
-
}
|
|
58
|
-
toString() {
|
|
59
|
-
return this.join("\n")
|
|
60
|
-
}
|
|
61
|
-
throw() {
|
|
62
|
-
throw new ArkError(`${this}`, { cause: this })
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export const createError = (ctx, input) => {
|
|
66
|
-
let errCtx
|
|
67
|
-
const data = ctx.data
|
|
68
|
-
const nodeConfig = ctx.config.predicate
|
|
69
|
-
if (typeof input === "string") {
|
|
70
|
-
errCtx = {
|
|
71
|
-
code: "predicate",
|
|
72
|
-
path: [...ctx.path],
|
|
73
|
-
propString: pathToPropString(ctx.path),
|
|
74
|
-
data,
|
|
75
|
-
actual: nodeConfig.actual(data),
|
|
76
|
-
expected: input
|
|
77
|
-
}
|
|
78
|
-
errCtx.problem = nodeConfig.problem(errCtx)
|
|
79
|
-
errCtx.message = nodeConfig.message(errCtx)
|
|
80
|
-
} else {
|
|
81
|
-
const code = input.code ?? "predicate"
|
|
82
|
-
const nodeConfig = ctx.config[code]
|
|
83
|
-
const expected = input.expected ?? nodeConfig.expected?.(input)
|
|
84
|
-
const path = input.path ?? [...ctx.path]
|
|
85
|
-
errCtx = {
|
|
86
|
-
...input,
|
|
87
|
-
// prioritize these over the raw user provided values so we can
|
|
88
|
-
// check for keys with values like undefined
|
|
89
|
-
code,
|
|
90
|
-
path,
|
|
91
|
-
propString: pathToPropString(path),
|
|
92
|
-
data: "data" in input ? input.data : data,
|
|
93
|
-
actual:
|
|
94
|
-
input.actual !== undefined
|
|
95
|
-
? input.actual
|
|
96
|
-
: nodeConfig.actual?.(data),
|
|
97
|
-
expected
|
|
98
|
-
}
|
|
99
|
-
errCtx.problem = hasDefinedKey(input, "problem")
|
|
100
|
-
? input.problem
|
|
101
|
-
: nodeConfig.problem(errCtx)
|
|
102
|
-
errCtx.message = hasDefinedKey(input, "message")
|
|
103
|
-
? input.message
|
|
104
|
-
: nodeConfig.message(errCtx)
|
|
105
|
-
}
|
|
106
|
-
return new ArkTypeError(errCtx)
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=err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