arktype 2.0.0-dev.4 → 2.0.0-dev.6
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/__tests__/array.test.ts +176 -236
- package/__tests__/badDefinitionType.test.ts +10 -3
- package/__tests__/basis.test.ts +6 -2
- package/__tests__/bounds.test.ts +282 -352
- package/__tests__/cast.test.ts +7 -2
- package/__tests__/completions.test.ts +8 -3
- package/__tests__/config.test.ts +16 -8
- package/__tests__/cyclic.test.ts +141 -137
- package/__tests__/dateLiteral.test.ts +8 -4
- package/__tests__/declared.test.ts +2 -2
- package/__tests__/discrimination.test.ts +1 -1
- package/__tests__/divisor.test.ts +45 -25
- package/__tests__/enclosed.test.ts +39 -25
- package/__tests__/examples.test.ts +56 -56
- package/__tests__/expressions.test.ts +184 -112
- package/__tests__/generic.test.ts +307 -288
- package/__tests__/group.test.ts +67 -54
- package/__tests__/imports.test.ts +44 -37
- package/__tests__/instanceof.test.ts +17 -15
- package/__tests__/intersection.test.ts +50 -46
- package/__tests__/keyTraversal.test.ts +6 -3
- package/__tests__/keyof.test.ts +68 -52
- package/__tests__/keywords.test.ts +149 -136
- package/__tests__/literal.test.ts +38 -15
- package/__tests__/match.test.ts +234 -224
- package/__tests__/morph.test.ts +300 -269
- package/__tests__/narrow.test.ts +46 -42
- package/__tests__/objectLiteral.test.ts +228 -210
- package/__tests__/realWorld.test.ts +63 -0
- package/__tests__/regex.test.ts +17 -7
- package/__tests__/scope.bench.ts +1 -1
- package/__tests__/scope.test.ts +65 -18
- package/__tests__/serialization.test.ts +19 -0
- package/__tests__/string.test.ts +11 -7
- package/__tests__/submodule.test.ts +26 -39
- package/__tests__/this.test.ts +83 -57
- package/__tests__/thunk.test.ts +13 -7
- package/__tests__/traverse.test.ts +50 -37
- package/__tests__/tsGenerics.test.ts +12 -12
- package/__tests__/type.test.ts +38 -0
- package/__tests__/typeReference.test.ts +7 -7
- package/__tests__/unenclosed.test.ts +116 -100
- package/__tests__/union.test.ts +171 -104
- package/ark.ts +18 -65
- package/generic.ts +67 -0
- package/main.ts +6 -18
- package/match.ts +53 -67
- package/module.ts +15 -0
- package/out/ark.d.ts +12 -36
- package/out/ark.d.ts.map +1 -1
- package/out/ark.js +9 -17
- package/out/ark.js.map +1 -1
- package/out/base.d.ts +205 -0
- package/out/base.d.ts.map +1 -0
- package/out/base.js +320 -0
- package/out/base.js.map +1 -0
- package/out/builtins/builtins.d.ts +23 -0
- package/out/builtins/builtins.d.ts.map +1 -0
- package/out/builtins/builtins.js +15 -0
- package/out/builtins/builtins.js.map +1 -0
- package/out/builtins/jsObjects.d.ts +19 -0
- package/out/builtins/jsObjects.d.ts.map +1 -0
- package/out/builtins/jsObjects.js +18 -0
- package/out/builtins/jsObjects.js.map +1 -0
- package/out/builtins/parsing.d.ts +16 -0
- package/out/builtins/parsing.d.ts.map +1 -0
- package/out/builtins/parsing.js +62 -0
- package/out/builtins/parsing.js.map +1 -0
- package/out/builtins/tsGenerics.d.ts +2 -0
- package/out/builtins/tsGenerics.d.ts.map +1 -0
- package/out/builtins/tsGenerics.js +26 -0
- package/out/builtins/tsGenerics.js.map +1 -0
- package/out/builtins/tsKeywords.d.ts +23 -0
- package/out/builtins/tsKeywords.d.ts.map +1 -0
- package/out/builtins/tsKeywords.js +23 -0
- package/out/builtins/tsKeywords.js.map +1 -0
- package/out/builtins/utils/creditCard.d.ts +3 -0
- package/out/builtins/utils/creditCard.d.ts.map +1 -0
- package/out/builtins/utils/creditCard.js +35 -0
- package/out/builtins/utils/creditCard.js.map +1 -0
- package/out/builtins/utils/date.d.ts +41 -0
- package/out/builtins/utils/date.d.ts.map +1 -0
- package/out/builtins/utils/date.js +56 -0
- package/out/builtins/utils/date.js.map +1 -0
- package/out/builtins/validation.d.ts +19 -0
- package/out/builtins/validation.d.ts.map +1 -0
- package/out/builtins/validation.js +74 -0
- package/out/builtins/validation.js.map +1 -0
- package/out/config.d.ts +9 -0
- package/out/config.d.ts.map +1 -0
- package/out/config.js +18 -0
- package/out/config.js.map +1 -0
- package/out/constraints/ast.d.ts +287 -0
- package/out/constraints/ast.d.ts.map +1 -0
- package/out/constraints/ast.js +2 -0
- package/out/constraints/ast.js.map +1 -0
- package/out/constraints/constraint.d.ts +200 -0
- package/out/constraints/constraint.d.ts.map +1 -0
- package/out/constraints/constraint.js +25 -0
- package/out/constraints/constraint.js.map +1 -0
- package/out/constraints/predicate.d.ts +64 -0
- package/out/constraints/predicate.d.ts.map +1 -0
- package/out/constraints/predicate.js +52 -0
- package/out/constraints/predicate.js.map +1 -0
- package/out/constraints/props/index.d.ts +42 -0
- package/out/constraints/props/index.d.ts.map +1 -0
- package/out/constraints/props/index.js +56 -0
- package/out/constraints/props/index.js.map +1 -0
- package/out/constraints/props/optional.d.ts +37 -0
- package/out/constraints/props/optional.d.ts.map +1 -0
- package/out/constraints/props/optional.js +56 -0
- package/out/constraints/props/optional.js.map +1 -0
- package/out/constraints/props/prop.d.ts +49 -0
- package/out/constraints/props/prop.d.ts.map +1 -0
- package/out/constraints/props/prop.js +106 -0
- package/out/constraints/props/prop.js.map +1 -0
- package/out/constraints/props/props.d.ts +37 -0
- package/out/constraints/props/props.d.ts.map +1 -0
- package/out/constraints/props/props.js +121 -0
- package/out/constraints/props/props.js.map +1 -0
- package/out/constraints/props/required.d.ts +46 -0
- package/out/constraints/props/required.d.ts.map +1 -0
- package/out/constraints/props/required.js +81 -0
- package/out/constraints/props/required.js.map +1 -0
- package/out/constraints/props/sequence.d.ts +82 -0
- package/out/constraints/props/sequence.d.ts.map +1 -0
- package/out/constraints/props/sequence.js +376 -0
- package/out/constraints/props/sequence.js.map +1 -0
- package/out/constraints/props/shared.d.ts +3 -0
- package/out/constraints/props/shared.d.ts.map +1 -0
- package/out/constraints/props/shared.js +4 -0
- package/out/constraints/props/shared.js.map +1 -0
- package/out/constraints/refinements/after.d.ts +33 -0
- package/out/constraints/refinements/after.d.ts.map +1 -0
- package/out/constraints/refinements/after.js +36 -0
- package/out/constraints/refinements/after.js.map +1 -0
- package/out/constraints/refinements/before.d.ts +33 -0
- package/out/constraints/refinements/before.d.ts.map +1 -0
- package/out/constraints/refinements/before.js +43 -0
- package/out/constraints/refinements/before.js.map +1 -0
- package/out/constraints/refinements/divisor.d.ts +52 -0
- package/out/constraints/refinements/divisor.d.ts.map +1 -0
- package/out/constraints/refinements/divisor.js +52 -0
- package/out/constraints/refinements/divisor.js.map +1 -0
- package/out/constraints/refinements/exactLength.d.ts +45 -0
- package/out/constraints/refinements/exactLength.d.ts.map +1 -0
- package/out/constraints/refinements/exactLength.js +52 -0
- package/out/constraints/refinements/exactLength.js.map +1 -0
- package/out/constraints/refinements/kinds.d.ts +29 -0
- package/out/constraints/refinements/kinds.d.ts.map +1 -0
- package/out/constraints/refinements/kinds.js +17 -0
- package/out/constraints/refinements/kinds.js.map +1 -0
- package/out/constraints/refinements/length.d.ts +48 -0
- package/out/constraints/refinements/length.d.ts.map +1 -0
- package/out/constraints/refinements/length.js +53 -0
- package/out/constraints/refinements/length.js.map +1 -0
- package/out/constraints/refinements/max.d.ts +31 -0
- package/out/constraints/refinements/max.d.ts.map +1 -0
- package/out/constraints/refinements/max.js +35 -0
- package/out/constraints/refinements/max.js.map +1 -0
- package/out/constraints/refinements/maxLength.d.ts +32 -0
- package/out/constraints/refinements/maxLength.d.ts.map +1 -0
- package/out/constraints/refinements/maxLength.js +36 -0
- package/out/constraints/refinements/maxLength.js.map +1 -0
- package/out/constraints/refinements/min.d.ts +31 -0
- package/out/constraints/refinements/min.d.ts.map +1 -0
- package/out/constraints/refinements/min.js +28 -0
- package/out/constraints/refinements/min.js.map +1 -0
- package/out/constraints/refinements/minLength.d.ts +32 -0
- package/out/constraints/refinements/minLength.d.ts.map +1 -0
- package/out/constraints/refinements/minLength.js +33 -0
- package/out/constraints/refinements/minLength.js.map +1 -0
- package/out/constraints/refinements/range.d.ts +119 -0
- package/out/constraints/refinements/range.d.ts.map +1 -0
- package/out/constraints/refinements/range.js +89 -0
- package/out/constraints/refinements/range.js.map +1 -0
- package/out/constraints/refinements/regex.d.ts +47 -0
- package/out/constraints/refinements/regex.d.ts.map +1 -0
- package/out/constraints/refinements/regex.js +37 -0
- package/out/constraints/refinements/regex.js.map +1 -0
- package/out/constraints/refinements/shared.d.ts +20 -0
- package/out/constraints/refinements/shared.d.ts.map +1 -0
- package/out/constraints/refinements/shared.js +10 -0
- package/out/constraints/refinements/shared.js.map +1 -0
- package/out/generic.d.ts +22 -0
- package/out/generic.d.ts.map +1 -0
- package/out/generic.js +23 -0
- package/out/generic.js.map +1 -0
- package/out/inference.d.ts +137 -0
- package/out/inference.d.ts.map +1 -0
- package/out/inference.js +73 -0
- package/out/inference.js.map +1 -0
- package/out/keywords/ark.d.ts +70 -0
- package/out/keywords/ark.d.ts.map +1 -0
- package/out/keywords/ark.js +29 -0
- package/out/keywords/ark.js.map +1 -0
- package/out/keywords/internal.d.ts +13 -0
- package/out/keywords/internal.d.ts.map +1 -0
- package/out/keywords/internal.js +13 -0
- package/out/keywords/internal.js.map +1 -0
- package/out/keywords/jsObject.d.ts +20 -0
- package/out/keywords/jsObject.d.ts.map +1 -0
- package/out/keywords/jsObject.js +18 -0
- package/out/keywords/jsObject.js.map +1 -0
- package/out/keywords/parsing.d.ts +17 -0
- package/out/keywords/parsing.d.ts.map +1 -0
- package/out/keywords/parsing.js +64 -0
- package/out/keywords/parsing.js.map +1 -0
- package/out/keywords/root.d.ts +7 -0
- package/out/keywords/root.d.ts.map +1 -0
- package/out/keywords/root.js +4 -0
- package/out/keywords/root.js.map +1 -0
- package/out/keywords/tsGenerics.d.ts +2 -0
- package/out/keywords/tsGenerics.d.ts.map +1 -0
- package/out/keywords/tsGenerics.js +26 -0
- package/out/keywords/tsGenerics.js.map +1 -0
- package/out/keywords/tsPrimitive.d.ts +24 -0
- package/out/keywords/tsPrimitive.d.ts.map +1 -0
- package/out/keywords/tsPrimitive.js +25 -0
- package/out/keywords/tsPrimitive.js.map +1 -0
- package/out/keywords/utils/creditCard.d.ts +11 -0
- package/out/keywords/utils/creditCard.d.ts.map +1 -0
- package/out/keywords/utils/creditCard.js +35 -0
- package/out/keywords/utils/creditCard.js.map +1 -0
- package/out/keywords/utils/date.d.ts +45 -0
- package/out/keywords/utils/date.d.ts.map +1 -0
- package/out/keywords/utils/date.js +56 -0
- package/out/keywords/utils/date.js.map +1 -0
- package/out/keywords/validation.d.ts +20 -0
- package/out/keywords/validation.d.ts.map +1 -0
- package/out/keywords/validation.js +80 -0
- package/out/keywords/validation.js.map +1 -0
- package/out/kinds.d.ts +102 -0
- package/out/kinds.d.ts.map +1 -0
- package/out/kinds.js +29 -0
- package/out/kinds.js.map +1 -0
- package/out/main.d.ts +6 -6
- package/out/main.d.ts.map +1 -1
- package/out/main.js +4 -3
- package/out/main.js.map +1 -1
- package/out/match.d.ts +18 -23
- package/out/match.d.ts.map +1 -1
- package/out/match.js +3 -4
- package/out/match.js.map +1 -1
- package/out/module.d.ts +11 -0
- package/out/module.d.ts.map +1 -0
- package/out/module.js +4 -0
- package/out/module.js.map +1 -0
- package/out/parse.d.ts +29 -0
- package/out/parse.d.ts.map +1 -0
- package/out/parse.js +161 -0
- package/out/parse.js.map +1 -0
- package/out/parser/definition.d.ts +9 -12
- package/out/parser/definition.d.ts.map +1 -1
- package/out/parser/definition.js +10 -12
- package/out/parser/definition.js.map +1 -1
- package/out/parser/generic.d.ts +3 -4
- package/out/parser/generic.d.ts.map +1 -1
- package/out/parser/generic.js +6 -8
- package/out/parser/generic.js.map +1 -1
- package/out/parser/objectLiteral.d.ts +44 -12
- package/out/parser/objectLiteral.d.ts.map +1 -1
- package/out/parser/objectLiteral.js +43 -36
- package/out/parser/objectLiteral.js.map +1 -1
- package/out/parser/semantic/bounds.d.ts +9 -6
- package/out/parser/semantic/bounds.d.ts.map +1 -1
- package/out/parser/semantic/bounds.js.map +1 -1
- package/out/parser/semantic/divisor.d.ts +5 -6
- package/out/parser/semantic/divisor.d.ts.map +1 -1
- package/out/parser/semantic/infer.d.ts +25 -0
- package/out/parser/semantic/infer.d.ts.map +1 -0
- package/out/parser/semantic/infer.js +2 -0
- package/out/parser/semantic/infer.js.map +1 -0
- package/out/parser/semantic/utils.d.ts +3 -6
- package/out/parser/semantic/utils.d.ts.map +1 -1
- package/out/parser/semantic/validate.d.ts +14 -12
- package/out/parser/semantic/validate.d.ts.map +1 -1
- package/out/parser/semantic/validate.js +1 -0
- package/out/parser/semantic/validate.js.map +1 -1
- package/out/parser/string/reduce/dynamic.d.ts +13 -12
- package/out/parser/string/reduce/dynamic.d.ts.map +1 -1
- package/out/parser/string/reduce/dynamic.js +27 -17
- package/out/parser/string/reduce/dynamic.js.map +1 -1
- package/out/parser/string/reduce/shared.d.ts +1 -2
- package/out/parser/string/reduce/shared.d.ts.map +1 -1
- package/out/parser/string/reduce/shared.js.map +1 -1
- package/out/parser/string/reduce/static.d.ts +26 -22
- package/out/parser/string/reduce/static.d.ts.map +1 -1
- package/out/parser/string/shift/operand/date.d.ts +2 -1
- package/out/parser/string/shift/operand/date.d.ts.map +1 -1
- package/out/parser/string/shift/operand/date.js +2 -2
- package/out/parser/string/shift/operand/date.js.map +1 -1
- package/out/parser/string/shift/operand/enclosed.d.ts +2 -2
- package/out/parser/string/shift/operand/enclosed.d.ts.map +1 -1
- package/out/parser/string/shift/operand/enclosed.js +6 -4
- package/out/parser/string/shift/operand/enclosed.js.map +1 -1
- package/out/parser/string/shift/operand/genericArgs.d.ts +9 -9
- package/out/parser/string/shift/operand/genericArgs.d.ts.map +1 -1
- package/out/parser/string/shift/operand/genericArgs.js +6 -8
- package/out/parser/string/shift/operand/genericArgs.js.map +1 -1
- package/out/parser/string/shift/operand/operand.d.ts +3 -3
- package/out/parser/string/shift/operand/operand.d.ts.map +1 -1
- package/out/parser/string/shift/operand/operand.js +8 -11
- package/out/parser/string/shift/operand/operand.js.map +1 -1
- package/out/parser/string/shift/operand/unenclosed.d.ts +13 -20
- package/out/parser/string/shift/operand/unenclosed.d.ts.map +1 -1
- package/out/parser/string/shift/operand/unenclosed.js +21 -26
- package/out/parser/string/shift/operand/unenclosed.js.map +1 -1
- package/out/parser/string/shift/operator/bounds.d.ts +15 -12
- package/out/parser/string/shift/operator/bounds.d.ts.map +1 -1
- package/out/parser/string/shift/operator/bounds.js +42 -48
- package/out/parser/string/shift/operator/bounds.js.map +1 -1
- package/out/parser/string/shift/operator/divisor.d.ts +1 -2
- package/out/parser/string/shift/operator/divisor.d.ts.map +1 -1
- package/out/parser/string/shift/operator/divisor.js.map +1 -1
- package/out/parser/string/shift/operator/operator.d.ts +1 -1
- package/out/parser/string/shift/operator/operator.d.ts.map +1 -1
- package/out/parser/string/shift/operator/operator.js +12 -18
- package/out/parser/string/shift/operator/operator.js.map +1 -1
- package/out/parser/string/shift/scanner.d.ts +2 -1
- package/out/parser/string/shift/scanner.d.ts.map +1 -1
- package/out/parser/string/shift/scanner.js +12 -11
- package/out/parser/string/shift/scanner.js.map +1 -1
- package/out/parser/string/string.d.ts +8 -5
- package/out/parser/string/string.d.ts.map +1 -1
- package/out/parser/string/string.js.map +1 -1
- package/out/parser/tuple.d.ts +96 -37
- package/out/parser/tuple.d.ts.map +1 -1
- package/out/parser/tuple.js +61 -66
- package/out/parser/tuple.js.map +1 -1
- package/out/schema.d.ts +175 -0
- package/out/schema.d.ts.map +1 -0
- package/out/schema.js +73 -0
- package/out/schema.js.map +1 -0
- package/out/schemaScope.d.ts +180 -0
- package/out/schemaScope.d.ts.map +1 -0
- package/out/schemaScope.js +235 -0
- package/out/schemaScope.js.map +1 -0
- package/out/scope.d.ts +42 -114
- package/out/scope.d.ts.map +1 -1
- package/out/scope.js +51 -181
- package/out/scope.js.map +1 -1
- package/out/shared/compile.d.ts +22 -0
- package/out/shared/compile.d.ts.map +1 -0
- package/out/shared/compile.js +79 -0
- package/out/shared/compile.js.map +1 -0
- package/out/shared/context.d.ts +54 -0
- package/out/shared/context.d.ts.map +1 -0
- package/out/shared/context.js +53 -0
- package/out/shared/context.js.map +1 -0
- package/out/shared/declare.d.ts +69 -0
- package/out/shared/declare.d.ts.map +1 -0
- package/out/shared/declare.js +2 -0
- package/out/shared/declare.js.map +1 -0
- package/out/shared/disjoint.d.ts +91 -0
- package/out/shared/disjoint.d.ts.map +1 -0
- package/out/shared/disjoint.js +110 -0
- package/out/shared/disjoint.js.map +1 -0
- package/out/shared/errors.d.ts +99 -0
- package/out/shared/errors.d.ts.map +1 -0
- package/out/shared/errors.js +108 -0
- package/out/shared/errors.js.map +1 -0
- package/out/shared/implement.d.ts +363 -0
- package/out/shared/implement.d.ts.map +1 -0
- package/out/shared/implement.js +68 -0
- package/out/shared/implement.js.map +1 -0
- package/out/shared/inference.d.ts +6 -0
- package/out/shared/inference.d.ts.map +1 -0
- package/out/shared/inference.js +5 -0
- package/out/shared/inference.js.map +1 -0
- package/out/shared/intersections.d.ts +60 -0
- package/out/shared/intersections.d.ts.map +1 -0
- package/out/shared/intersections.js +2 -0
- package/out/shared/intersections.js.map +1 -0
- package/out/shared/traversal.d.ts +62 -0
- package/out/shared/traversal.d.ts.map +1 -0
- package/out/shared/traversal.js +97 -0
- package/out/shared/traversal.js.map +1 -0
- package/out/shared/utils.d.ts +24 -0
- package/out/shared/utils.d.ts.map +1 -0
- package/out/shared/utils.js +15 -0
- package/out/shared/utils.js.map +1 -0
- package/out/type.d.ts +23 -59
- package/out/type.d.ts.map +1 -1
- package/out/type.js +2 -137
- package/out/type.js.map +1 -1
- package/out/types/basis.d.ts +47 -0
- package/out/types/basis.d.ts.map +1 -0
- package/out/types/basis.js +15 -0
- package/out/types/basis.js.map +1 -0
- package/out/types/discriminate.d.ts +34 -0
- package/out/types/discriminate.d.ts.map +1 -0
- package/out/types/discriminate.js +120 -0
- package/out/types/discriminate.js.map +1 -0
- package/out/types/domain.d.ts +57 -0
- package/out/types/domain.d.ts.map +1 -0
- package/out/types/domain.js +41 -0
- package/out/types/domain.js.map +1 -0
- package/out/types/intersection.d.ts +127 -0
- package/out/types/intersection.d.ts.map +1 -0
- package/out/types/intersection.js +379 -0
- package/out/types/intersection.js.map +1 -0
- package/out/types/morph.d.ts +157 -0
- package/out/types/morph.d.ts.map +1 -0
- package/out/types/morph.js +99 -0
- package/out/types/morph.js.map +1 -0
- package/out/types/proto.d.ts +51 -0
- package/out/types/proto.d.ts.map +1 -0
- package/out/types/proto.js +60 -0
- package/out/types/proto.js.map +1 -0
- package/out/types/type.d.ts +143 -0
- package/out/types/type.d.ts.map +1 -0
- package/out/types/type.js +123 -0
- package/out/types/type.js.map +1 -0
- package/out/types/union.d.ts +71 -0
- package/out/types/union.d.ts.map +1 -0
- package/out/types/union.js +379 -0
- package/out/types/union.js.map +1 -0
- package/out/types/unit.d.ts +45 -0
- package/out/types/unit.d.ts.map +1 -0
- package/out/types/unit.js +56 -0
- package/out/types/unit.js.map +1 -0
- package/out/util.d.ts +30 -18
- package/out/util.d.ts.map +1 -1
- package/out/util.js +8 -7
- package/out/util.js.map +1 -1
- package/package.json +7 -3
- package/parser/definition.ts +73 -89
- package/parser/generic.ts +35 -36
- package/parser/objectLiteral.ts +143 -117
- package/parser/semantic/bounds.ts +33 -32
- package/parser/semantic/divisor.ts +8 -10
- package/parser/semantic/infer.ts +141 -0
- package/parser/semantic/utils.ts +12 -23
- package/parser/semantic/validate.ts +82 -73
- package/parser/string/reduce/dynamic.ts +61 -46
- package/parser/string/reduce/shared.ts +1 -3
- package/parser/string/reduce/static.ts +65 -67
- package/parser/string/shift/operand/date.ts +12 -8
- package/parser/string/shift/operand/enclosed.ts +22 -17
- package/parser/string/shift/operand/genericArgs.ts +46 -45
- package/parser/string/shift/operand/operand.ts +32 -38
- package/parser/string/shift/operand/unenclosed.ts +106 -147
- package/parser/string/shift/operator/bounds.ts +114 -106
- package/parser/string/shift/operator/divisor.ts +12 -14
- package/parser/string/shift/operator/operator.ts +35 -46
- package/parser/string/shift/scanner.ts +49 -46
- package/parser/string/string.ts +28 -32
- package/parser/tuple.ts +288 -308
- package/scope.ts +183 -425
- package/type.ts +82 -281
- package/__tests__/astUtils.test.ts +0 -17
- package/__tests__/jsdoc.test.ts +0 -64
- package/__tests__/nodeDefinitions.test.ts +0 -190
- package/__tests__/typeMethods.test.ts +0 -69
- package/out/arkConfig.d.ts +0 -2
- package/out/arkConfig.d.ts.map +0 -1
- package/out/arkConfig.js +0 -10
- package/out/arkConfig.js.map +0 -1
- package/out/parser/semantic/intersections.d.ts +0 -14
- package/out/parser/semantic/intersections.d.ts.map +0 -1
- package/out/parser/semantic/intersections.js +0 -2
- package/out/parser/semantic/intersections.js.map +0 -1
- package/out/parser/semantic/semantic.d.ts +0 -32
- package/out/parser/semantic/semantic.d.ts.map +0 -1
- package/out/parser/semantic/semantic.js +0 -2
- package/out/parser/semantic/semantic.js.map +0 -1
- package/out/parser/shared.d.ts +0 -62
- package/out/parser/shared.d.ts.map +0 -1
- package/out/parser/shared.js +0 -56
- package/out/parser/shared.js.map +0 -1
- package/out/test.d.ts +0 -2
- package/out/test.d.ts.map +0 -1
- package/out/test.js +0 -7
- package/out/test.js.map +0 -1
- package/out/tsconfig.build.tsbuildinfo +0 -1
- package/parser/semantic/semantic.ts +0 -143
- package/parser/shared.ts +0 -170
- package/util.ts +0 -36
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BasePrimitiveConstraint,
|
|
3
|
+
writeInvalidOperandMessage
|
|
4
|
+
} from "../constraint.js"
|
|
5
|
+
export class DivisorNode extends BasePrimitiveConstraint {
|
|
6
|
+
static implementation = this.implement({
|
|
7
|
+
collapsibleKey: "rule",
|
|
8
|
+
keys: {
|
|
9
|
+
rule: {}
|
|
10
|
+
},
|
|
11
|
+
normalize: (schema) =>
|
|
12
|
+
typeof schema === "number" ? { rule: schema } : schema,
|
|
13
|
+
intersections: {
|
|
14
|
+
divisor: (l, r, $) =>
|
|
15
|
+
$.node("divisor", {
|
|
16
|
+
rule: Math.abs(
|
|
17
|
+
(l.rule * r.rule) /
|
|
18
|
+
greatestCommonDivisor(l.rule, r.rule)
|
|
19
|
+
)
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
hasAssociatedError: true,
|
|
23
|
+
defaults: {
|
|
24
|
+
description(node) {
|
|
25
|
+
return node.rule === 1
|
|
26
|
+
? "an integer"
|
|
27
|
+
: `a multiple of ${node.rule}`
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
traverseAllows = (data) => data % this.rule === 0
|
|
32
|
+
compiledCondition = `data % ${this.rule} === 0`
|
|
33
|
+
compiledNegation = `data % ${this.rule} !== 0`
|
|
34
|
+
impliedBasis = this.$.keywords.number
|
|
35
|
+
errorContext = this.createErrorContext(this.inner)
|
|
36
|
+
expression = `% ${this.rule}`
|
|
37
|
+
}
|
|
38
|
+
export const writeIndivisibleMessage = (t) =>
|
|
39
|
+
writeInvalidOperandMessage("divisor", t.$.keywords.number, t)
|
|
40
|
+
// https://en.wikipedia.org/wiki/Euclidean_algorithm
|
|
41
|
+
const greatestCommonDivisor = (l, r) => {
|
|
42
|
+
let previous
|
|
43
|
+
let greatestCommonDivisor = l
|
|
44
|
+
let current = r
|
|
45
|
+
while (current !== 0) {
|
|
46
|
+
previous = current
|
|
47
|
+
current = greatestCommonDivisor % current
|
|
48
|
+
greatestCommonDivisor = previous
|
|
49
|
+
}
|
|
50
|
+
return greatestCommonDivisor
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=divisor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divisor.js","sourceRoot":"","sources":["../../../constraints/refinements/divisor.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,uBAAuB,EACvB,0BAA0B,EAC1B,MAAM,kBAAkB,CAAA;AAiBzB,MAAM,OAAO,WAAY,SAAQ,uBAA2C;IAC3E,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;QACtC,cAAc,EAAE,MAAM;QACtB,IAAI,EAAE;YACL,IAAI,EAAE,EAAE;SACR;QACD,SAAS,EAAE,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C,CAAA;AAK9D,oDAAoD;AACpD,MAAM,qBAAqB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;IACtD,IAAI,QAAgB,CAAA;IACpB,IAAI,qBAAqB,GAAG,CAAC,CAAA;IAC7B,IAAI,OAAO,GAAG,CAAC,CAAA;IACf,OAAO,OAAO,KAAK,CAAC,EAAE,CAAC;QACtB,QAAQ,GAAG,OAAO,CAAA;QAClB,OAAO,GAAG,qBAAqB,GAAG,OAAO,CAAA;QACzC,qBAAqB,GAAG,QAAQ,CAAA;IACjC,CAAC;IACD,OAAO,qBAAqB,CAAA;AAC7B,CAAC,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BaseMeta, declareNode } from "../../shared/declare.js"
|
|
2
|
+
import type { TraverseAllows } from "../../shared/traversal.js"
|
|
3
|
+
import { BasePrimitiveConstraint } from "../constraint.js"
|
|
4
|
+
import type { LengthBoundableData } from "./range.js"
|
|
5
|
+
export interface ExactLengthInner extends BaseMeta {
|
|
6
|
+
readonly rule: number
|
|
7
|
+
}
|
|
8
|
+
export type NormalizedExactLengthSchema = ExactLengthInner
|
|
9
|
+
export type ExactLengthSchema = NormalizedExactLengthSchema | number
|
|
10
|
+
export type ExactLengthDeclaration = declareNode<{
|
|
11
|
+
kind: "exactLength"
|
|
12
|
+
schema: ExactLengthSchema
|
|
13
|
+
normalizedSchema: NormalizedExactLengthSchema
|
|
14
|
+
inner: ExactLengthInner
|
|
15
|
+
prerequisite: LengthBoundableData
|
|
16
|
+
errorContext: ExactLengthInner
|
|
17
|
+
}>
|
|
18
|
+
export declare class ExactLengthNode extends BasePrimitiveConstraint<ExactLengthDeclaration> {
|
|
19
|
+
static implementation: import("../../shared/implement.js").nodeImplementationOf<{
|
|
20
|
+
reducibleTo: "exactLength"
|
|
21
|
+
intersectionIsOpen: false
|
|
22
|
+
childKind: never
|
|
23
|
+
kind: "exactLength"
|
|
24
|
+
schema: ExactLengthSchema
|
|
25
|
+
normalizedSchema: ExactLengthInner
|
|
26
|
+
inner: ExactLengthInner
|
|
27
|
+
prerequisite: LengthBoundableData
|
|
28
|
+
errorContext: ExactLengthInner &
|
|
29
|
+
import("../../shared/declare.js").BaseErrorContext<"exactLength">
|
|
30
|
+
}>
|
|
31
|
+
traverseAllows: TraverseAllows<LengthBoundableData>
|
|
32
|
+
readonly compiledCondition: string
|
|
33
|
+
readonly compiledNegation: string
|
|
34
|
+
readonly impliedBasis: import("../../main.js").Type<
|
|
35
|
+
string | unknown[],
|
|
36
|
+
import("../../keywords/internal.js").internalPrimitive.exports
|
|
37
|
+
>
|
|
38
|
+
readonly errorContext: {
|
|
39
|
+
code: "exactLength"
|
|
40
|
+
readonly rule: number
|
|
41
|
+
readonly description?: string
|
|
42
|
+
}
|
|
43
|
+
readonly expression: string
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=exactLength.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exactLength.d.ts","sourceRoot":"","sources":["../../../constraints/refinements/exactLength.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,2BAA2B,GAAG,gBAAgB,CAAA;AAE1D,MAAM,MAAM,iBAAiB,GAAG,2BAA2B,GAAG,MAAM,CAAA;AAEpE,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;IAChD,IAAI,EAAE,aAAa,CAAA;IACnB,MAAM,EAAE,iBAAiB,CAAA;IACzB,gBAAgB,EAAE,2BAA2B,CAAA;IAC7C,KAAK,EAAE,gBAAgB,CAAA;IACvB,YAAY,EAAE,mBAAmB,CAAA;IACjC,YAAY,EAAE,gBAAgB,CAAA;CAC9B,CAAC,CAAA;AAEF,qBAAa,eAAgB,SAAQ,uBAAuB,CAAC,sBAAsB,CAAC;IACnF,MAAM,CAAC,cAAc;;;;;;;;;;OAwCnB;IAEF,cAAc,EAAE,cAAc,CAAC,mBAAmB,CAAC,CACzB;IAE1B,QAAQ,CAAC,iBAAiB,SAAiC;IAC3D,QAAQ,CAAC,gBAAgB,SAAiC;IAC1D,QAAQ,CAAC,YAAY,mHAAkC;IACvD,QAAQ,CAAC,YAAY;;;;MAAsC;IAC3D,QAAQ,CAAC,UAAU,SAA6B;CAChD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Disjoint } from "../../shared/disjoint.js"
|
|
2
|
+
import { BasePrimitiveConstraint } from "../constraint.js"
|
|
3
|
+
export class ExactLengthNode extends BasePrimitiveConstraint {
|
|
4
|
+
static implementation = this.implement({
|
|
5
|
+
collapsibleKey: "rule",
|
|
6
|
+
keys: {
|
|
7
|
+
rule: {}
|
|
8
|
+
},
|
|
9
|
+
normalize: (schema) =>
|
|
10
|
+
typeof schema === "number" ? { rule: schema } : schema,
|
|
11
|
+
intersections: {
|
|
12
|
+
exactLength: (l, r) =>
|
|
13
|
+
new Disjoint({
|
|
14
|
+
"[length]": {
|
|
15
|
+
unit: {
|
|
16
|
+
l: l.$.node("unit", { unit: l.rule }),
|
|
17
|
+
r: r.$.node("unit", { unit: r.rule })
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
minLength: (exactLength, minLength) =>
|
|
22
|
+
(
|
|
23
|
+
minLength.exclusive
|
|
24
|
+
? exactLength.rule > minLength.rule
|
|
25
|
+
: exactLength.rule >= minLength.rule
|
|
26
|
+
)
|
|
27
|
+
? exactLength
|
|
28
|
+
: Disjoint.from("range", exactLength, minLength),
|
|
29
|
+
maxLength: (exactLength, maxLength) =>
|
|
30
|
+
(
|
|
31
|
+
maxLength.exclusive
|
|
32
|
+
? exactLength.rule < maxLength.rule
|
|
33
|
+
: exactLength.rule <= maxLength.rule
|
|
34
|
+
)
|
|
35
|
+
? exactLength
|
|
36
|
+
: Disjoint.from("range", exactLength, maxLength)
|
|
37
|
+
},
|
|
38
|
+
hasAssociatedError: true,
|
|
39
|
+
defaults: {
|
|
40
|
+
description(node) {
|
|
41
|
+
return `exactly length ${node.rule}`
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
traverseAllows = (data) => data.length === this.rule
|
|
46
|
+
compiledCondition = `data.length === ${this.rule}`
|
|
47
|
+
compiledNegation = `data.length !== ${this.rule}`
|
|
48
|
+
impliedBasis = this.$.keywords.lengthBoundable
|
|
49
|
+
errorContext = this.createErrorContext(this.inner)
|
|
50
|
+
expression = `{ length: ${this.rule} }`
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=exactLength.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exactLength.js","sourceRoot":"","sources":["../../../constraints/refinements/exactLength.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAoB1D,MAAM,OAAO,eAAgB,SAAQ,uBAA+C;IACnF,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;QACtC,cAAc,EAAE,MAAM;QACtB,IAAI,EAAE;YACL,IAAI,EAAE,EAAE;SACR;QACD,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CACrB,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM;QACvD,aAAa,EAAE;YACd,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACrB,IAAI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,IAAI,EAAE,CAAA;IAClD,gBAAgB,GAAG,mBAAmB,IAAI,CAAC,IAAI,EAAE,CAAA;IACjD,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAA;IAC9C,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClD,UAAU,GAAG,aAAa,IAAI,CAAC,IAAI,IAAI,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AfterNode, type AfterDeclaration } from "./after.js"
|
|
2
|
+
import { BeforeNode, type BeforeDeclaration } from "./before.js"
|
|
3
|
+
import { ExactLengthNode, type ExactLengthDeclaration } from "./exactLength.js"
|
|
4
|
+
import { MaxNode, type MaxDeclaration } from "./max.js"
|
|
5
|
+
import { MaxLengthNode, type MaxLengthDeclaration } from "./maxLength.js"
|
|
6
|
+
import { MinNode, type MinDeclaration } from "./min.js"
|
|
7
|
+
import { MinLengthNode, type MinLengthDeclaration } from "./minLength.js"
|
|
8
|
+
export interface BoundDeclarations {
|
|
9
|
+
min: MinDeclaration
|
|
10
|
+
max: MaxDeclaration
|
|
11
|
+
minLength: MinLengthDeclaration
|
|
12
|
+
maxLength: MaxLengthDeclaration
|
|
13
|
+
exactLength: ExactLengthDeclaration
|
|
14
|
+
after: AfterDeclaration
|
|
15
|
+
before: BeforeDeclaration
|
|
16
|
+
}
|
|
17
|
+
export declare const BoundNodes: {
|
|
18
|
+
min: typeof MinNode
|
|
19
|
+
max: typeof MaxNode
|
|
20
|
+
minLength: typeof MinLengthNode
|
|
21
|
+
maxLength: typeof MaxLengthNode
|
|
22
|
+
exactLength: typeof ExactLengthNode
|
|
23
|
+
after: typeof AfterNode
|
|
24
|
+
before: typeof BeforeNode
|
|
25
|
+
}
|
|
26
|
+
export type BoundNodesByKind = {
|
|
27
|
+
[k in keyof typeof BoundNodes]: InstanceType<(typeof BoundNodes)[k]>
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../../constraints/refinements/kinds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAEzE,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,cAAc,CAAA;IACnB,GAAG,EAAE,cAAc,CAAA;IACnB,SAAS,EAAE,oBAAoB,CAAA;IAC/B,SAAS,EAAE,oBAAoB,CAAA;IAC/B,WAAW,EAAE,sBAAsB,CAAA;IACnC,KAAK,EAAE,gBAAgB,CAAA;IACvB,MAAM,EAAE,iBAAiB,CAAA;CACzB;AAED,eAAO,MAAM,UAAU;;;;;;;;CAQtB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;KAC7B,CAAC,IAAI,MAAM,OAAO,UAAU,GAAG,YAAY,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;CACpE,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AfterNode } from "./after.js"
|
|
2
|
+
import { BeforeNode } from "./before.js"
|
|
3
|
+
import { ExactLengthNode } from "./exactLength.js"
|
|
4
|
+
import { MaxNode } from "./max.js"
|
|
5
|
+
import { MaxLengthNode } from "./maxLength.js"
|
|
6
|
+
import { MinNode } from "./min.js"
|
|
7
|
+
import { MinLengthNode } from "./minLength.js"
|
|
8
|
+
export const BoundNodes = {
|
|
9
|
+
min: MinNode,
|
|
10
|
+
max: MaxNode,
|
|
11
|
+
minLength: MinLengthNode,
|
|
12
|
+
maxLength: MaxLengthNode,
|
|
13
|
+
exactLength: ExactLengthNode,
|
|
14
|
+
after: AfterNode,
|
|
15
|
+
before: BeforeNode
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=kinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinds.js","sourceRoot":"","sources":["../../../constraints/refinements/kinds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,YAAY,CAAA;AAC7D,OAAO,EAAE,UAAU,EAA0B,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,eAAe,EAA+B,MAAM,kBAAkB,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAuB,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,aAAa,EAA6B,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAuB,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,aAAa,EAA6B,MAAM,gBAAgB,CAAA;AAYzE,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,aAAa;IACxB,WAAW,EAAE,eAAe;IAC5B,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,UAAU;CAClB,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { declareNode } from "../../shared/declare.js"
|
|
2
|
+
import {
|
|
3
|
+
BasePrimitiveConstraint,
|
|
4
|
+
type PrimitiveConstraintInner
|
|
5
|
+
} from "../constraint.js"
|
|
6
|
+
import type { LengthBoundableData } from "./range.js"
|
|
7
|
+
export interface LengthInner extends PrimitiveConstraintInner<number> {}
|
|
8
|
+
export type length<n extends number> = {
|
|
9
|
+
"==": n
|
|
10
|
+
}
|
|
11
|
+
export type NormalizedLengthSchema = LengthInner
|
|
12
|
+
export type LengthSchema = NormalizedLengthSchema | number
|
|
13
|
+
export type LengthDeclaration = declareNode<{
|
|
14
|
+
kind: "length"
|
|
15
|
+
schema: LengthSchema
|
|
16
|
+
normalizedSchema: NormalizedLengthSchema
|
|
17
|
+
inner: LengthInner
|
|
18
|
+
prerequisite: LengthBoundableData
|
|
19
|
+
errorContext: LengthInner
|
|
20
|
+
}>
|
|
21
|
+
export declare class LengthNode extends BasePrimitiveConstraint<
|
|
22
|
+
LengthDeclaration,
|
|
23
|
+
typeof LengthNode
|
|
24
|
+
> {
|
|
25
|
+
static implementation: import("../../shared/implement.js").nodeImplementationOf<{
|
|
26
|
+
intersectionIsOpen: false
|
|
27
|
+
childKind: never
|
|
28
|
+
reducibleTo: "length"
|
|
29
|
+
kind: "length"
|
|
30
|
+
schema: LengthSchema
|
|
31
|
+
normalizedSchema: LengthInner
|
|
32
|
+
inner: LengthInner
|
|
33
|
+
prerequisite: LengthBoundableData
|
|
34
|
+
errorContext: LengthInner &
|
|
35
|
+
import("../../shared/declare.js").BaseErrorContext<"length">
|
|
36
|
+
}>
|
|
37
|
+
traverseAllows: (data: LengthBoundableData) => boolean
|
|
38
|
+
readonly compiledCondition: string
|
|
39
|
+
readonly compiledNegation: string
|
|
40
|
+
readonly impliedBasis: import("../../types/union.js").UnionNode<LengthBoundableData>
|
|
41
|
+
readonly errorContext: {
|
|
42
|
+
code: "length"
|
|
43
|
+
description: string
|
|
44
|
+
readonly rule: number
|
|
45
|
+
}
|
|
46
|
+
readonly expression: string
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=length.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["../../../constraints/refinements/length.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EACN,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD,MAAM,WAAW,WAAY,SAAQ,wBAAwB,CAAC,MAAM,CAAC;CAAG;AAExE,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,MAAM,IAAI;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAA;AAElD,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAEhD,MAAM,MAAM,YAAY,GAAG,sBAAsB,GAAG,MAAM,CAAA;AAE1D,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC;IAC3C,IAAI,EAAE,QAAQ,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;IACpB,gBAAgB,EAAE,sBAAsB,CAAA;IACxC,KAAK,EAAE,WAAW,CAAA;IAClB,YAAY,EAAE,mBAAmB,CAAA;IACjC,YAAY,EAAE,WAAW,CAAA;CACzB,CAAC,CAAA;AAEF,qBAAa,UAAW,SAAQ,uBAAuB,CACtD,iBAAiB,EACjB,OAAO,UAAU,CACjB;IACA,MAAM,CAAC,cAAc;;;;;;;;;;OAwCnB;IAEF,cAAc,SAAU,mBAAmB,aAA8B;IAEzE,QAAQ,CAAC,iBAAiB,SAAsC;IAChE,QAAQ,CAAC,gBAAgB,SAAsC;IAC/D,QAAQ,CAAC,YAAY,gEAAyB;IAC9C,QAAQ,CAAC,YAAY;;;;MAAsC;IAC3D,QAAQ,CAAC,UAAU,SAA4B;CAC/C"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsData } from "../../shared/compile.js"
|
|
2
|
+
import { Disjoint } from "../../shared/disjoint.js"
|
|
3
|
+
import { BasePrimitiveConstraint } from "../constraint.js"
|
|
4
|
+
export class LengthNode extends BasePrimitiveConstraint {
|
|
5
|
+
static implementation = this.implement({
|
|
6
|
+
collapseKey: "rule",
|
|
7
|
+
keys: {
|
|
8
|
+
rule: {}
|
|
9
|
+
},
|
|
10
|
+
normalize: (schema) =>
|
|
11
|
+
typeof schema === "number" ? { rule: schema } : schema,
|
|
12
|
+
intersections: {
|
|
13
|
+
length: (l, r) =>
|
|
14
|
+
new Disjoint({
|
|
15
|
+
"[length]": {
|
|
16
|
+
unit: {
|
|
17
|
+
l: l.$.parse("unit", { unit: l.rule }),
|
|
18
|
+
r: r.$.parse("unit", { unit: r.rule })
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
minLength: (length, minLength) =>
|
|
23
|
+
(
|
|
24
|
+
minLength.exclusive
|
|
25
|
+
? length.rule > minLength.rule
|
|
26
|
+
: length.rule >= minLength.rule
|
|
27
|
+
)
|
|
28
|
+
? length
|
|
29
|
+
: Disjoint.from("range", length, minLength),
|
|
30
|
+
maxLength: (length, maxLength) =>
|
|
31
|
+
(
|
|
32
|
+
maxLength.exclusive
|
|
33
|
+
? length.rule < maxLength.rule
|
|
34
|
+
: length.rule <= maxLength.rule
|
|
35
|
+
)
|
|
36
|
+
? length
|
|
37
|
+
: Disjoint.from("range", length, maxLength)
|
|
38
|
+
},
|
|
39
|
+
hasAssociatedError: true,
|
|
40
|
+
defaults: {
|
|
41
|
+
description(node) {
|
|
42
|
+
return `exactly length ${node.rule}`
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
traverseAllows = (data) => data.length === this.rule
|
|
47
|
+
compiledCondition = `${jsData}.length === ${this.rule}`
|
|
48
|
+
compiledNegation = `${jsData}.length !== ${this.rule}`
|
|
49
|
+
impliedBasis = this.$.lengthBoundable
|
|
50
|
+
errorContext = this.createErrorContext(this.inner)
|
|
51
|
+
expression = `{ length: ${this.rule}}`
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=length.js.map
|
|
@@ -0,0 +1 @@
|
|
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SAAS,CAAC;YAC7C,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAChC,CACC,SAAS,CAAC,SAAS;gBAClB,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI;gBAC9B,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAChC;gBACA,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;SAC7C;QACD,kBAAkB,EAAE,IAAI;QACxB,QAAQ,EAAE;YACT,WAAW,CAAC,IAAI;gBACf,OAAO,kBAAkB,IAAI,CAAC,IAAI,EAAE,CAAA;YACrC,CAAC;SACD;KACD,CAAC,CAAA;IAEF,cAAc,GAAG,CAAC,IAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAA;IAEhE,iBAAiB,GAAG,GAAG,MAAM,eAAe,IAAI,CAAC,IAAI,EAAE,CAAA;IACvD,gBAAgB,GAAG,GAAG,MAAM,eAAe,IAAI,CAAC,IAAI,EAAE,CAAA;IACtD,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,eAAe,CAAA;IACrC,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClD,UAAU,GAAG,aAAa,IAAI,CAAC,IAAI,GAAG,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { declareNode } from "../../shared/declare.js"
|
|
2
|
+
import type { nodeImplementationOf } from "../../shared/implement.js"
|
|
3
|
+
import {
|
|
4
|
+
BaseRange,
|
|
5
|
+
type BaseNormalizedRangeSchema,
|
|
6
|
+
type BaseRangeInner
|
|
7
|
+
} from "./range.js"
|
|
8
|
+
export interface MaxInner extends BaseRangeInner {
|
|
9
|
+
rule: number
|
|
10
|
+
}
|
|
11
|
+
export interface NormalizedMaxSchema extends BaseNormalizedRangeSchema {
|
|
12
|
+
rule: number
|
|
13
|
+
}
|
|
14
|
+
export type MaxSchema = NormalizedMaxSchema | number
|
|
15
|
+
export type MaxDeclaration = declareNode<{
|
|
16
|
+
kind: "max"
|
|
17
|
+
schema: MaxSchema
|
|
18
|
+
normalizedSchema: NormalizedMaxSchema
|
|
19
|
+
inner: MaxInner
|
|
20
|
+
prerequisite: number
|
|
21
|
+
errorContext: MaxInner
|
|
22
|
+
}>
|
|
23
|
+
export declare class MaxNode extends BaseRange<MaxDeclaration> {
|
|
24
|
+
static implementation: nodeImplementationOf<MaxDeclaration>
|
|
25
|
+
readonly impliedBasis: import("../../main.js").Type<
|
|
26
|
+
number,
|
|
27
|
+
import("../../keywords/tsPrimitive.js").tsPrimitive.exports
|
|
28
|
+
>
|
|
29
|
+
traverseAllows: (data: number) => boolean
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=max.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"max.d.ts","sourceRoot":"","sources":["../../../constraints/refinements/max.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EACN,SAAS,EAET,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,QAAS,SAAQ,cAAc;IAC/C,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,mBAAoB,SAAQ,yBAAyB;IACrE,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,SAAS,GAAG,mBAAmB,GAAG,MAAM,CAAA;AAEpD,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;IACxC,IAAI,EAAE,KAAK,CAAA;IACX,MAAM,EAAE,SAAS,CAAA;IACjB,gBAAgB,EAAE,mBAAmB,CAAA;IACrC,KAAK,EAAE,QAAQ,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,QAAQ,CAAA;CACtB,CAAC,CAAA;AAEF,qBAAa,OAAQ,SAAQ,SAAS,CAAC,cAAc,CAAC;IACrD,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAuBzD;IAEF,QAAQ,CAAC,YAAY,oGAAyB;IAE9C,cAAc,SACJ,MAAM,aACsB;CACtC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Disjoint } from "../../shared/disjoint.js"
|
|
2
|
+
import { BaseRange, parseExclusiveKey } from "./range.js"
|
|
3
|
+
export class MaxNode extends BaseRange {
|
|
4
|
+
static implementation = this.implement({
|
|
5
|
+
collapsibleKey: "rule",
|
|
6
|
+
hasAssociatedError: true,
|
|
7
|
+
keys: {
|
|
8
|
+
rule: {},
|
|
9
|
+
exclusive: parseExclusiveKey
|
|
10
|
+
},
|
|
11
|
+
normalize: (schema) =>
|
|
12
|
+
typeof schema === "number" ? { rule: schema } : schema,
|
|
13
|
+
defaults: {
|
|
14
|
+
description(node) {
|
|
15
|
+
return `${node.exclusive ? "less than" : "at most"} ${
|
|
16
|
+
node.rule
|
|
17
|
+
}`
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
intersections: {
|
|
21
|
+
max: (l, r) => (l.isStricterThan(r) ? l : r),
|
|
22
|
+
min: (max, min, $) =>
|
|
23
|
+
max.overlapsRange(min)
|
|
24
|
+
? max.overlapIsUnit(min)
|
|
25
|
+
? $.node("unit", { unit: max.rule })
|
|
26
|
+
: null
|
|
27
|
+
: Disjoint.from("range", max, min)
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
impliedBasis = this.$.keywords.number
|
|
31
|
+
traverseAllows = this.exclusive
|
|
32
|
+
? (data) => data < this.rule
|
|
33
|
+
: (data) => data <= this.rule
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=max.js.map
|
|
@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,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC;SACpC;KACD,CAAC,CAAA;IAEO,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAA;IAE9C,cAAc,GAAG,IAAI,CAAC,SAAS;QAC9B,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;QACpC,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { declareNode } from "../../shared/declare.js"
|
|
2
|
+
import type { nodeImplementationOf } from "../../shared/implement.js"
|
|
3
|
+
import {
|
|
4
|
+
BaseRange,
|
|
5
|
+
type BaseNormalizedRangeSchema,
|
|
6
|
+
type BaseRangeInner,
|
|
7
|
+
type LengthBoundableData
|
|
8
|
+
} from "./range.js"
|
|
9
|
+
export interface MaxLengthInner extends BaseRangeInner {
|
|
10
|
+
rule: number
|
|
11
|
+
}
|
|
12
|
+
export interface NormalizedMaxLengthSchema extends BaseNormalizedRangeSchema {
|
|
13
|
+
rule: number
|
|
14
|
+
}
|
|
15
|
+
export type MaxLengthSchema = NormalizedMaxLengthSchema | number
|
|
16
|
+
export type MaxLengthDeclaration = declareNode<{
|
|
17
|
+
kind: "maxLength"
|
|
18
|
+
schema: MaxLengthSchema
|
|
19
|
+
normalizedSchema: NormalizedMaxLengthSchema
|
|
20
|
+
inner: MaxLengthInner
|
|
21
|
+
prerequisite: LengthBoundableData
|
|
22
|
+
errorContext: MaxLengthInner
|
|
23
|
+
}>
|
|
24
|
+
export declare class MaxLengthNode extends BaseRange<MaxLengthDeclaration> {
|
|
25
|
+
static implementation: nodeImplementationOf<MaxLengthDeclaration>
|
|
26
|
+
readonly impliedBasis: import("../../main.js").Type<
|
|
27
|
+
string | unknown[],
|
|
28
|
+
import("../../keywords/internal.js").internalPrimitive.exports
|
|
29
|
+
>
|
|
30
|
+
traverseAllows: (data: LengthBoundableData) => boolean
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=maxLength.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maxLength.d.ts","sourceRoot":"","sources":["../../../constraints/refinements/maxLength.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EACN,SAAS,EAET,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,cAAe,SAAQ,cAAc;IACrD,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC3E,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,eAAe,GAAG,yBAAyB,GAAG,MAAM,CAAA;AAEhE,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC;IAC9C,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,eAAe,CAAA;IACvB,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,KAAK,EAAE,cAAc,CAAA;IACrB,YAAY,EAAE,mBAAmB,CAAA;IACjC,YAAY,EAAE,cAAc,CAAA;CAC5B,CAAC,CAAA;AAEF,qBAAa,aAAc,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,oBAAoB,CAAC,CA2B9D;IAEH,QAAQ,CAAC,YAAY,mHAAkC;IAEvD,cAAc,SACJ,mBAAmB,aAC6B;CAC1D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Disjoint } from "../../shared/disjoint.js"
|
|
2
|
+
import { BaseRange, parseExclusiveKey } from "./range.js"
|
|
3
|
+
export class MaxLengthNode extends BaseRange {
|
|
4
|
+
static implementation = this.implement({
|
|
5
|
+
collapsibleKey: "rule",
|
|
6
|
+
hasAssociatedError: true,
|
|
7
|
+
keys: {
|
|
8
|
+
rule: {},
|
|
9
|
+
exclusive: parseExclusiveKey
|
|
10
|
+
},
|
|
11
|
+
normalize: (schema) =>
|
|
12
|
+
typeof schema === "number" ? { rule: schema } : schema,
|
|
13
|
+
defaults: {
|
|
14
|
+
description(node) {
|
|
15
|
+
return node.exclusive
|
|
16
|
+
? `less than length ${node.rule}`
|
|
17
|
+
: `at most length ${node.rule}`
|
|
18
|
+
},
|
|
19
|
+
actual: (data) => `${data.length}`
|
|
20
|
+
},
|
|
21
|
+
intersections: {
|
|
22
|
+
maxLength: (l, r) => (l.isStricterThan(r) ? l : r),
|
|
23
|
+
minLength: (max, min, $) =>
|
|
24
|
+
max.overlapsRange(min)
|
|
25
|
+
? max.overlapIsUnit(min)
|
|
26
|
+
? $.node("exactLength", { rule: max.rule })
|
|
27
|
+
: null
|
|
28
|
+
: Disjoint.from("range", max, min)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
impliedBasis = this.$.keywords.lengthBoundable
|
|
32
|
+
traverseAllows = this.exclusive
|
|
33
|
+
? (data) => data.length < this.rule
|
|
34
|
+
: (data) => data.length <= this.rule
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=maxLength.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maxLength.js","sourceRoot":"","sources":["../../../constraints/refinements/maxLength.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EACN,SAAS,EACT,iBAAiB,EAIjB,MAAM,YAAY,CAAA;AAqBnB,MAAM,OAAO,aAAc,SAAQ,SAA+B;IACjE,MAAM,CAAC,cAAc,GACpB,IAAI,CAAC,SAAS,CAAC;QACd,cAAc,EAAE,MAAM;QACtB,kBAAkB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IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI;QACxD,CAAC,CAAC,CAAC,IAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { declareNode } from "../../shared/declare.js"
|
|
2
|
+
import type { nodeImplementationOf } from "../../shared/implement.js"
|
|
3
|
+
import {
|
|
4
|
+
BaseRange,
|
|
5
|
+
type BaseNormalizedRangeSchema,
|
|
6
|
+
type BaseRangeInner
|
|
7
|
+
} from "./range.js"
|
|
8
|
+
export interface MinInner extends BaseRangeInner {
|
|
9
|
+
rule: number
|
|
10
|
+
}
|
|
11
|
+
export interface NormalizedMinSchema extends BaseNormalizedRangeSchema {
|
|
12
|
+
rule: number
|
|
13
|
+
}
|
|
14
|
+
export type MinSchema = NormalizedMinSchema | number
|
|
15
|
+
export type MinDeclaration = declareNode<{
|
|
16
|
+
kind: "min"
|
|
17
|
+
schema: MinSchema
|
|
18
|
+
normalizedSchema: NormalizedMinSchema
|
|
19
|
+
inner: MinInner
|
|
20
|
+
prerequisite: number
|
|
21
|
+
errorContext: MinInner
|
|
22
|
+
}>
|
|
23
|
+
export declare class MinNode extends BaseRange<MinDeclaration> {
|
|
24
|
+
static implementation: nodeImplementationOf<MinDeclaration>
|
|
25
|
+
readonly impliedBasis: import("../../main.js").Type<
|
|
26
|
+
number,
|
|
27
|
+
import("../../keywords/tsPrimitive.js").tsPrimitive.exports
|
|
28
|
+
>
|
|
29
|
+
traverseAllows: (data: number) => boolean
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=min.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"min.d.ts","sourceRoot":"","sources":["../../../constraints/refinements/min.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EACN,SAAS,EAET,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,QAAS,SAAQ,cAAc;IAC/C,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,mBAAoB,SAAQ,yBAAyB;IACrE,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,SAAS,GAAG,mBAAmB,GAAG,MAAM,CAAA;AAEpD,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;IACxC,IAAI,EAAE,KAAK,CAAA;IACX,MAAM,EAAE,SAAS,CAAA;IACjB,gBAAgB,EAAE,mBAAmB,CAAA;IACrC,KAAK,EAAE,QAAQ,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,QAAQ,CAAA;CACtB,CAAC,CAAA;AAEF,qBAAa,OAAQ,SAAQ,SAAS,CAAC,cAAc,CAAC;IACrD,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,cAAc,CAAC,CAiBzD;IAEF,QAAQ,CAAC,YAAY,oGAAyB;IAE9C,cAAc,SACJ,MAAM,aACsB;CACtC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseRange, parseExclusiveKey } from "./range.js"
|
|
2
|
+
export class MinNode extends BaseRange {
|
|
3
|
+
static implementation = this.implement({
|
|
4
|
+
collapsibleKey: "rule",
|
|
5
|
+
hasAssociatedError: true,
|
|
6
|
+
keys: {
|
|
7
|
+
rule: {},
|
|
8
|
+
exclusive: parseExclusiveKey
|
|
9
|
+
},
|
|
10
|
+
normalize: (schema) =>
|
|
11
|
+
typeof schema === "number" ? { rule: schema } : schema,
|
|
12
|
+
intersections: {
|
|
13
|
+
min: (l, r) => (l.isStricterThan(r) ? l : r)
|
|
14
|
+
},
|
|
15
|
+
defaults: {
|
|
16
|
+
description(node) {
|
|
17
|
+
return `${node.exclusive ? "more than" : "at least"} ${
|
|
18
|
+
node.rule
|
|
19
|
+
}`
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
impliedBasis = this.$.keywords.number
|
|
24
|
+
traverseAllows = this.exclusive
|
|
25
|
+
? (data) => data > this.rule
|
|
26
|
+
: (data) => data >= this.rule
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"min.js","sourceRoot":"","sources":["../../../constraints/refinements/min.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,SAAS,EACT,iBAAiB,EAGjB,MAAM,YAAY,CAAA;AAqBnB,MAAM,OAAO,OAAQ,SAAQ,SAAyB;IACrD,MAAM,CAAC,cAAc,GAAyC,IAAI,CAAC,SAAS,CAAC;QAC5E,cAAc,EAAE,MAAM;QACtB,kBAAkB,EAAE,IAAI;QACxB,IAAI,EAAE;YACL,IAAI,EAAE,EAAE;YACR,SAAS,EAAE,iBAAiB;SAC5B;QACD,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CACrB,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM;QACvD,aAAa,EAAE;YACd,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5C;QACD,QAAQ,EAAE;YACT,WAAW,CAAC,IAAI;gBACf,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,CAAA;YACnE,CAAC;SACD;KACD,CAAC,CAAA;IAEO,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAA;IAE9C,cAAc,GAAG,IAAI,CAAC,SAAS;QAC9B,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;QACpC,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { declareNode } from "../../shared/declare.js"
|
|
2
|
+
import type { nodeImplementationOf } from "../../shared/implement.js"
|
|
3
|
+
import {
|
|
4
|
+
BaseRange,
|
|
5
|
+
type BaseNormalizedRangeSchema,
|
|
6
|
+
type BaseRangeInner,
|
|
7
|
+
type LengthBoundableData
|
|
8
|
+
} from "./range.js"
|
|
9
|
+
export interface MinLengthInner extends BaseRangeInner {
|
|
10
|
+
rule: number
|
|
11
|
+
}
|
|
12
|
+
export interface NormalizedMinLengthSchema extends BaseNormalizedRangeSchema {
|
|
13
|
+
rule: number
|
|
14
|
+
}
|
|
15
|
+
export type MinLengthSchema = NormalizedMinLengthSchema | number
|
|
16
|
+
export type MinLengthDeclaration = declareNode<{
|
|
17
|
+
kind: "minLength"
|
|
18
|
+
schema: MinLengthSchema
|
|
19
|
+
normalizedSchema: NormalizedMinLengthSchema
|
|
20
|
+
inner: MinLengthInner
|
|
21
|
+
prerequisite: LengthBoundableData
|
|
22
|
+
errorContext: MinLengthInner
|
|
23
|
+
}>
|
|
24
|
+
export declare class MinLengthNode extends BaseRange<MinLengthDeclaration> {
|
|
25
|
+
static implementation: nodeImplementationOf<MinLengthDeclaration>
|
|
26
|
+
traverseAllows: (data: LengthBoundableData) => boolean
|
|
27
|
+
readonly impliedBasis: import("../../main.js").Type<
|
|
28
|
+
string | unknown[],
|
|
29
|
+
import("../../keywords/internal.js").internalPrimitive.exports
|
|
30
|
+
>
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=minLength.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minLength.d.ts","sourceRoot":"","sources":["../../../constraints/refinements/minLength.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EACN,SAAS,EAET,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,cAAe,SAAQ,cAAc;IACrD,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC3E,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,eAAe,GAAG,yBAAyB,GAAG,MAAM,CAAA;AAEhE,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC;IAC9C,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,eAAe,CAAA;IACvB,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,KAAK,EAAE,cAAc,CAAA;IACrB,YAAY,EAAE,mBAAmB,CAAA;IACjC,YAAY,EAAE,cAAc,CAAA;CAC5B,CAAC,CAAA;AAEF,qBAAa,aAAc,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IACjE,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC,oBAAoB,CAAC,CAyB9D;IAEH,cAAc,SACJ,mBAAmB,aAC6B;IAE1D,QAAQ,CAAC,YAAY,mHAAkC;CACvD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseRange, parseExclusiveKey } from "./range.js"
|
|
2
|
+
export class MinLengthNode extends BaseRange {
|
|
3
|
+
static implementation = this.implement({
|
|
4
|
+
collapsibleKey: "rule",
|
|
5
|
+
hasAssociatedError: true,
|
|
6
|
+
keys: {
|
|
7
|
+
rule: {},
|
|
8
|
+
exclusive: parseExclusiveKey
|
|
9
|
+
},
|
|
10
|
+
normalize: (schema) =>
|
|
11
|
+
typeof schema === "number" ? { rule: schema } : schema,
|
|
12
|
+
defaults: {
|
|
13
|
+
description(node) {
|
|
14
|
+
return node.exclusive
|
|
15
|
+
? node.rule === 0
|
|
16
|
+
? "non-empty"
|
|
17
|
+
: `more than length ${node.rule}`
|
|
18
|
+
: node.rule === 1
|
|
19
|
+
? "non-empty"
|
|
20
|
+
: `at least length ${node.rule}`
|
|
21
|
+
},
|
|
22
|
+
actual: (data) => `${data.length}`
|
|
23
|
+
},
|
|
24
|
+
intersections: {
|
|
25
|
+
minLength: (l, r) => (l.isStricterThan(r) ? l : r)
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
traverseAllows = this.exclusive
|
|
29
|
+
? (data) => data.length > this.rule
|
|
30
|
+
: (data) => data.length >= this.rule
|
|
31
|
+
impliedBasis = this.$.keywords.lengthBoundable
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=minLength.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minLength.js","sourceRoot":"","sources":["../../../constraints/refinements/minLength.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,SAAS,EACT,iBAAiB,EAIjB,MAAM,YAAY,CAAA;AAqBnB,MAAM,OAAO,aAAc,SAAQ,SAA+B;IACjE,MAAM,CAAC,cAAc,GACpB,IAAI,CAAC,SAAS,CAAC;QACd,cAAc,EAAE,MAAM;QACtB,kBAAkB,EAAE,IAAI;QACxB,IAAI,EAAE;YACL,IAAI,EAAE,EAAE;YACR,SAAS,EAAE,iBAAiB;SAC5B;QACD,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CACrB,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM;QACvD,QAAQ,EAAE;YACT,WAAW,CAAC,IAAI;gBACf,OAAO,IAAI,CAAC,SAAS;oBACpB,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;wBAChB,CAAC,CAAC,WAA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