@sinclair/typebox 0.32.0-dev-4 → 0.32.0-dev-5
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/build/import/compiler/compiler.mjs +571 -0
- package/build/import/compiler/index.mjs +2 -0
- package/build/import/errors/errors.mjs +531 -0
- package/build/import/errors/index.mjs +1 -0
- package/build/import/index.mjs +69 -0
- package/build/import/system/errors.mjs +150 -0
- package/build/import/system/index.mjs +4 -0
- package/build/import/system/policy.mjs +31 -0
- package/build/import/system/system.mjs +30 -0
- package/build/import/type/any/any.mjs +4 -0
- package/build/import/type/any/index.mjs +1 -0
- package/build/import/type/array/array.mjs +10 -0
- package/build/import/type/array/index.mjs +1 -0
- package/build/import/type/async-iterator/async-iterator.mjs +10 -0
- package/build/import/type/async-iterator/index.mjs +1 -0
- package/build/import/type/awaited/awaited.mjs +28 -0
- package/build/import/type/awaited/index.mjs +1 -0
- package/build/import/type/bigint/bigint.mjs +8 -0
- package/build/import/type/bigint/index.mjs +1 -0
- package/build/import/type/boolean/boolean.mjs +8 -0
- package/build/import/type/boolean/index.mjs +1 -0
- package/build/import/type/clone/index.mjs +2 -0
- package/build/import/type/clone/type.mjs +7 -0
- package/build/import/type/clone/value.mjs +25 -0
- package/build/import/type/composite/composite.mjs +14 -0
- package/build/import/type/composite/index.mjs +1 -0
- package/build/import/type/const/const.mjs +49 -0
- package/build/import/type/const/index.mjs +1 -0
- package/build/import/type/constructor/constructor.mjs +11 -0
- package/build/import/type/constructor/index.mjs +1 -0
- package/build/import/type/constructor-parameters/constructor-parameters.mjs +5 -0
- package/build/import/type/constructor-parameters/index.mjs +1 -0
- package/build/import/type/date/date.mjs +8 -0
- package/build/import/type/date/index.mjs +1 -0
- package/build/import/type/deref/deref.mjs +90 -0
- package/build/import/type/deref/index.mjs +1 -0
- package/build/import/type/discard/discard.mjs +7 -0
- package/build/import/type/discard/index.mjs +1 -0
- package/build/import/type/enum/enum.mjs +14 -0
- package/build/import/type/enum/index.mjs +1 -0
- package/build/import/type/exclude/exclude.mjs +20 -0
- package/build/import/type/exclude/index.mjs +1 -0
- package/build/import/type/extends/extends-check.mjs +450 -0
- package/build/import/type/extends/extends-undefined.mjs +17 -0
- package/build/import/type/extends/extends.mjs +13 -0
- package/build/import/type/extends/index.mjs +3 -0
- package/build/import/type/extract/extract.mjs +20 -0
- package/build/import/type/extract/index.mjs +1 -0
- package/build/import/type/function/function.mjs +11 -0
- package/build/import/type/function/index.mjs +1 -0
- package/build/import/type/guard/index.mjs +2 -0
- package/build/import/type/guard/type.mjs +366 -0
- package/build/import/type/guard/value.mjs +42 -0
- package/build/import/type/helpers/helpers.mjs +3 -0
- package/build/import/type/helpers/index.mjs +1 -0
- package/build/import/type/index.mjs +70 -0
- package/build/import/type/indexed/index.mjs +3 -0
- package/build/import/type/indexed/indexed-key.mjs +29 -0
- package/build/import/type/indexed/indexed-type.mjs +64 -0
- package/build/import/type/indexed/indexed.mjs +9 -0
- package/build/import/type/instance-type/index.mjs +1 -0
- package/build/import/type/instance-type/instance-type.mjs +4 -0
- package/build/import/type/integer/index.mjs +1 -0
- package/build/import/type/integer/integer.mjs +8 -0
- package/build/import/type/intersect/index.mjs +1 -0
- package/build/import/type/intersect/intersect.mjs +25 -0
- package/build/import/type/intrinsic/index.mjs +1 -0
- package/build/import/type/intrinsic/intrinsic.mjs +59 -0
- package/build/import/type/iterator/index.mjs +1 -0
- package/build/import/type/iterator/iterator.mjs +10 -0
- package/build/import/type/keyof/index.mjs +3 -0
- package/build/import/type/keyof/keyof-string.mjs +55 -0
- package/build/import/type/keyof/keyof-type.mjs +15 -0
- package/build/import/type/keyof/keyof.mjs +6 -0
- package/build/import/type/literal/index.mjs +1 -0
- package/build/import/type/literal/literal.mjs +9 -0
- package/build/import/type/mapped/index.mjs +1 -0
- package/build/import/type/mapped/mapped.mjs +14 -0
- package/build/import/type/modifiers/index.mjs +1 -0
- package/build/import/type/modifiers/modifiers.mjs +40 -0
- package/build/import/type/never/index.mjs +1 -0
- package/build/import/type/never/never.mjs +8 -0
- package/build/import/type/not/index.mjs +1 -0
- package/build/import/type/not/not.mjs +9 -0
- package/build/import/type/null/index.mjs +1 -0
- package/build/import/type/null/null.mjs +8 -0
- package/build/import/type/number/index.mjs +1 -0
- package/build/import/type/number/number.mjs +8 -0
- package/build/import/type/object/index.mjs +1 -0
- package/build/import/type/object/object.mjs +14 -0
- package/build/import/type/omit/index.mjs +1 -0
- package/build/import/type/omit/omit.mjs +35 -0
- package/build/import/type/operators/index.mjs +1 -0
- package/build/import/type/operators/operators.mjs +66 -0
- package/build/import/type/optional/index.mjs +1 -0
- package/build/import/type/optional/optional.mjs +5 -0
- package/build/import/type/parameters/index.mjs +1 -0
- package/build/import/type/parameters/parameters.mjs +5 -0
- package/build/import/type/partial/index.mjs +1 -0
- package/build/import/type/partial/partial.mjs +36 -0
- package/build/import/type/patterns/index.mjs +1 -0
- package/build/import/type/patterns/patterns.mjs +6 -0
- package/build/import/type/pick/index.mjs +1 -0
- package/build/import/type/pick/pick.mjs +31 -0
- package/build/import/type/promise/index.mjs +1 -0
- package/build/import/type/promise/promise.mjs +10 -0
- package/build/import/type/readonly/index.mjs +1 -0
- package/build/import/type/readonly/readonly.mjs +5 -0
- package/build/import/type/readonly-optional/index.mjs +1 -0
- package/build/import/type/readonly-optional/readonly-optional.mjs +5 -0
- package/build/import/type/record/index.mjs +1 -0
- package/build/import/type/record/record.mjs +51 -0
- package/build/import/type/recursive/index.mjs +1 -0
- package/build/import/type/recursive/recursive.mjs +15 -0
- package/build/import/type/ref/index.mjs +1 -0
- package/build/import/type/ref/ref.mjs +13 -0
- package/build/import/type/regexp/index.mjs +1 -0
- package/build/import/type/regexp/regexp.mjs +6 -0
- package/build/import/type/registry/format.mjs +19 -0
- package/build/import/type/registry/index.mjs +2 -0
- package/build/import/type/registry/type.mjs +19 -0
- package/build/import/type/required/index.mjs +1 -0
- package/build/import/type/required/required.mjs +35 -0
- package/build/import/type/rest/index.mjs +1 -0
- package/build/import/type/rest/rest.mjs +8 -0
- package/build/import/type/return-type/index.mjs +1 -0
- package/build/import/type/return-type/return-type.mjs +4 -0
- package/build/import/type/schema/anyschema.mjs +1 -0
- package/build/import/type/schema/index.mjs +2 -0
- package/build/import/type/schema/schema.mjs +1 -0
- package/build/import/type/static/index.mjs +1 -0
- package/build/import/type/static/static.mjs +1 -0
- package/build/import/type/strict/index.mjs +1 -0
- package/build/import/type/strict/strict.mjs +3 -0
- package/build/import/type/string/index.mjs +1 -0
- package/build/import/type/string/string.mjs +4 -0
- package/build/import/type/symbol/index.mjs +1 -0
- package/build/import/type/symbol/symbol.mjs +4 -0
- package/build/import/type/symbols/index.mjs +1 -0
- package/build/import/type/symbols/symbols.mjs +5 -0
- package/build/import/type/template-literal/finite.mjs +29 -0
- package/build/import/type/template-literal/generate.mjs +32 -0
- package/build/import/type/template-literal/index.mjs +7 -0
- package/build/import/type/template-literal/parser.mjs +125 -0
- package/build/import/type/template-literal/pattern.mjs +22 -0
- package/build/import/type/template-literal/syntax.mjs +48 -0
- package/build/import/type/template-literal/template-literal.mjs +10 -0
- package/build/import/type/template-literal/union.mjs +13 -0
- package/build/import/type/transform/index.mjs +1 -0
- package/build/import/type/transform/transform.mjs +37 -0
- package/build/import/type/tuple/index.mjs +1 -0
- package/build/import/type/tuple/tuple.mjs +8 -0
- package/build/import/type/type/index.mjs +6 -0
- package/build/import/type/type/javascript.mjs +71 -0
- package/build/import/type/type/json.mjs +171 -0
- package/build/import/type/type/type.mjs +58 -0
- package/build/import/type/uint8array/index.mjs +1 -0
- package/build/import/type/uint8array/uint8array.mjs +4 -0
- package/build/import/type/undefined/index.mjs +1 -0
- package/build/import/type/undefined/undefined.mjs +4 -0
- package/build/import/type/union/index.mjs +1 -0
- package/build/import/type/union/union.mjs +15 -0
- package/build/import/type/unknown/index.mjs +1 -0
- package/build/import/type/unknown/unknown.mjs +7 -0
- package/build/import/type/unsafe/index.mjs +1 -0
- package/build/import/type/unsafe/unsafe.mjs +7 -0
- package/build/import/type/void/index.mjs +1 -0
- package/build/import/type/void/void.mjs +8 -0
- package/build/import/value/cast/cast.mjs +205 -0
- package/build/import/value/cast/index.mjs +1 -0
- package/build/import/value/check/check.mjs +419 -0
- package/build/import/value/check/index.mjs +1 -0
- package/build/import/value/clean/clean.mjs +125 -0
- package/build/import/value/clean/index.mjs +1 -0
- package/build/import/value/clone/clone.mjs +30 -0
- package/build/import/value/clone/index.mjs +1 -0
- package/build/import/value/convert/convert.mjs +231 -0
- package/build/import/value/convert/index.mjs +1 -0
- package/build/import/value/create/create.mjs +460 -0
- package/build/import/value/create/index.mjs +1 -0
- package/build/import/value/default/default.mjs +125 -0
- package/build/import/value/default/index.mjs +1 -0
- package/build/import/value/delta/delta.mjs +152 -0
- package/build/import/value/delta/index.mjs +1 -0
- package/build/import/value/deref/deref.mjs +13 -0
- package/build/import/value/deref/index.mjs +1 -0
- package/build/import/value/equal/equal.mjs +39 -0
- package/build/import/value/equal/index.mjs +1 -0
- package/build/import/value/guard/guard.mjs +66 -0
- package/build/import/value/guard/index.mjs +1 -0
- package/build/import/value/hash/hash.mjs +127 -0
- package/build/import/value/hash/index.mjs +1 -0
- package/build/import/value/index.mjs +18 -0
- package/build/import/value/mutate/index.mjs +1 -0
- package/build/import/value/mutate/mutate.mjs +85 -0
- package/build/import/value/pointer/index.mjs +1 -0
- package/build/import/value/pointer/pointer.mjs +101 -0
- package/build/import/value/transform/decode.mjs +160 -0
- package/build/import/value/transform/encode.mjs +166 -0
- package/build/import/value/transform/has.mjs +99 -0
- package/build/import/value/transform/index.mjs +3 -0
- package/build/import/value/value/index.mjs +1 -0
- package/build/import/value/value/value.mjs +65 -0
- package/compiler/package.json +4 -0
- package/errors/package.json +4 -0
- package/package.json +52 -53
- package/system/package.json +4 -0
- package/type/package.json +4 -0
- package/value/package.json +4 -0
- /package/{compiler → build/default/compiler}/compiler.js +0 -0
- /package/{compiler → build/default/compiler}/index.js +0 -0
- /package/{errors → build/default/errors}/errors.js +0 -0
- /package/{errors → build/default/errors}/index.js +0 -0
- /package/{index.js → build/default/index.js} +0 -0
- /package/{system → build/default/system}/errors.js +0 -0
- /package/{system → build/default/system}/index.js +0 -0
- /package/{system → build/default/system}/policy.js +0 -0
- /package/{system → build/default/system}/system.js +0 -0
- /package/{type → build/default/type}/any/any.js +0 -0
- /package/{type → build/default/type}/any/index.js +0 -0
- /package/{type → build/default/type}/array/array.js +0 -0
- /package/{type → build/default/type}/array/index.js +0 -0
- /package/{type → build/default/type}/async-iterator/async-iterator.js +0 -0
- /package/{type → build/default/type}/async-iterator/index.js +0 -0
- /package/{type → build/default/type}/awaited/awaited.js +0 -0
- /package/{type → build/default/type}/awaited/index.js +0 -0
- /package/{type → build/default/type}/bigint/bigint.js +0 -0
- /package/{type → build/default/type}/bigint/index.js +0 -0
- /package/{type → build/default/type}/boolean/boolean.js +0 -0
- /package/{type → build/default/type}/boolean/index.js +0 -0
- /package/{type → build/default/type}/clone/index.js +0 -0
- /package/{type → build/default/type}/clone/type.js +0 -0
- /package/{type → build/default/type}/clone/value.js +0 -0
- /package/{type → build/default/type}/composite/composite.js +0 -0
- /package/{type → build/default/type}/composite/index.js +0 -0
- /package/{type → build/default/type}/const/const.js +0 -0
- /package/{type → build/default/type}/const/index.js +0 -0
- /package/{type → build/default/type}/constructor/constructor.js +0 -0
- /package/{type → build/default/type}/constructor/index.js +0 -0
- /package/{type → build/default/type}/constructor-parameters/constructor-parameters.js +0 -0
- /package/{type → build/default/type}/constructor-parameters/index.js +0 -0
- /package/{type → build/default/type}/date/date.js +0 -0
- /package/{type → build/default/type}/date/index.js +0 -0
- /package/{type → build/default/type}/deref/deref.js +0 -0
- /package/{type → build/default/type}/deref/index.js +0 -0
- /package/{type → build/default/type}/discard/discard.js +0 -0
- /package/{type → build/default/type}/discard/index.js +0 -0
- /package/{type → build/default/type}/enum/enum.js +0 -0
- /package/{type → build/default/type}/enum/index.js +0 -0
- /package/{type → build/default/type}/exclude/exclude.js +0 -0
- /package/{type → build/default/type}/exclude/index.js +0 -0
- /package/{type → build/default/type}/extends/extends-check.js +0 -0
- /package/{type → build/default/type}/extends/extends-undefined.js +0 -0
- /package/{type → build/default/type}/extends/extends.js +0 -0
- /package/{type → build/default/type}/extends/index.js +0 -0
- /package/{type → build/default/type}/extract/extract.js +0 -0
- /package/{type → build/default/type}/extract/index.js +0 -0
- /package/{type → build/default/type}/function/function.js +0 -0
- /package/{type → build/default/type}/function/index.js +0 -0
- /package/{type → build/default/type}/guard/index.js +0 -0
- /package/{type → build/default/type}/guard/type.js +0 -0
- /package/{type → build/default/type}/guard/value.js +0 -0
- /package/{type → build/default/type}/helpers/helpers.js +0 -0
- /package/{type → build/default/type}/helpers/index.js +0 -0
- /package/{type → build/default/type}/index.js +0 -0
- /package/{type → build/default/type}/indexed/index.js +0 -0
- /package/{type → build/default/type}/indexed/indexed-key.js +0 -0
- /package/{type → build/default/type}/indexed/indexed-type.js +0 -0
- /package/{type → build/default/type}/indexed/indexed.js +0 -0
- /package/{type → build/default/type}/instance-type/index.js +0 -0
- /package/{type → build/default/type}/instance-type/instance-type.js +0 -0
- /package/{type → build/default/type}/integer/index.js +0 -0
- /package/{type → build/default/type}/integer/integer.js +0 -0
- /package/{type → build/default/type}/intersect/index.js +0 -0
- /package/{type → build/default/type}/intersect/intersect.js +0 -0
- /package/{type → build/default/type}/intrinsic/index.js +0 -0
- /package/{type → build/default/type}/intrinsic/intrinsic.js +0 -0
- /package/{type → build/default/type}/iterator/index.js +0 -0
- /package/{type → build/default/type}/iterator/iterator.js +0 -0
- /package/{type → build/default/type}/keyof/index.js +0 -0
- /package/{type → build/default/type}/keyof/keyof-string.js +0 -0
- /package/{type → build/default/type}/keyof/keyof-type.js +0 -0
- /package/{type → build/default/type}/keyof/keyof.js +0 -0
- /package/{type → build/default/type}/literal/index.js +0 -0
- /package/{type → build/default/type}/literal/literal.js +0 -0
- /package/{type → build/default/type}/mapped/index.js +0 -0
- /package/{type → build/default/type}/mapped/mapped.js +0 -0
- /package/{type → build/default/type}/modifiers/index.js +0 -0
- /package/{type → build/default/type}/modifiers/modifiers.js +0 -0
- /package/{type → build/default/type}/never/index.js +0 -0
- /package/{type → build/default/type}/never/never.js +0 -0
- /package/{type → build/default/type}/not/index.js +0 -0
- /package/{type → build/default/type}/not/not.js +0 -0
- /package/{type → build/default/type}/null/index.js +0 -0
- /package/{type → build/default/type}/null/null.js +0 -0
- /package/{type → build/default/type}/number/index.js +0 -0
- /package/{type → build/default/type}/number/number.js +0 -0
- /package/{type → build/default/type}/object/index.js +0 -0
- /package/{type → build/default/type}/object/object.js +0 -0
- /package/{type → build/default/type}/omit/index.js +0 -0
- /package/{type → build/default/type}/omit/omit.js +0 -0
- /package/{type → build/default/type}/operators/index.js +0 -0
- /package/{type → build/default/type}/operators/operators.js +0 -0
- /package/{type → build/default/type}/optional/index.js +0 -0
- /package/{type → build/default/type}/optional/optional.js +0 -0
- /package/{type → build/default/type}/parameters/index.js +0 -0
- /package/{type → build/default/type}/parameters/parameters.js +0 -0
- /package/{type → build/default/type}/partial/index.js +0 -0
- /package/{type → build/default/type}/partial/partial.js +0 -0
- /package/{type → build/default/type}/patterns/index.js +0 -0
- /package/{type → build/default/type}/patterns/patterns.js +0 -0
- /package/{type → build/default/type}/pick/index.js +0 -0
- /package/{type → build/default/type}/pick/pick.js +0 -0
- /package/{type → build/default/type}/promise/index.js +0 -0
- /package/{type → build/default/type}/promise/promise.js +0 -0
- /package/{type → build/default/type}/readonly/index.js +0 -0
- /package/{type → build/default/type}/readonly/readonly.js +0 -0
- /package/{type → build/default/type}/readonly-optional/index.js +0 -0
- /package/{type → build/default/type}/readonly-optional/readonly-optional.js +0 -0
- /package/{type → build/default/type}/record/index.js +0 -0
- /package/{type → build/default/type}/record/record.js +0 -0
- /package/{type → build/default/type}/recursive/index.js +0 -0
- /package/{type → build/default/type}/recursive/recursive.js +0 -0
- /package/{type → build/default/type}/ref/index.js +0 -0
- /package/{type → build/default/type}/ref/ref.js +0 -0
- /package/{type → build/default/type}/regexp/index.js +0 -0
- /package/{type → build/default/type}/regexp/regexp.js +0 -0
- /package/{type → build/default/type}/registry/format.js +0 -0
- /package/{type → build/default/type}/registry/index.js +0 -0
- /package/{type → build/default/type}/registry/type.js +0 -0
- /package/{type → build/default/type}/required/index.js +0 -0
- /package/{type → build/default/type}/required/required.js +0 -0
- /package/{type → build/default/type}/rest/index.js +0 -0
- /package/{type → build/default/type}/rest/rest.js +0 -0
- /package/{type → build/default/type}/return-type/index.js +0 -0
- /package/{type → build/default/type}/return-type/return-type.js +0 -0
- /package/{type → build/default/type}/schema/anyschema.js +0 -0
- /package/{type → build/default/type}/schema/index.js +0 -0
- /package/{type → build/default/type}/schema/schema.js +0 -0
- /package/{type → build/default/type}/static/index.js +0 -0
- /package/{type → build/default/type}/static/static.js +0 -0
- /package/{type → build/default/type}/strict/index.js +0 -0
- /package/{type → build/default/type}/strict/strict.js +0 -0
- /package/{type → build/default/type}/string/index.js +0 -0
- /package/{type → build/default/type}/string/string.js +0 -0
- /package/{type → build/default/type}/symbol/index.js +0 -0
- /package/{type → build/default/type}/symbol/symbol.js +0 -0
- /package/{type → build/default/type}/symbols/index.js +0 -0
- /package/{type → build/default/type}/symbols/symbols.js +0 -0
- /package/{type → build/default/type}/template-literal/finite.js +0 -0
- /package/{type → build/default/type}/template-literal/generate.js +0 -0
- /package/{type → build/default/type}/template-literal/index.js +0 -0
- /package/{type → build/default/type}/template-literal/parser.js +0 -0
- /package/{type → build/default/type}/template-literal/pattern.js +0 -0
- /package/{type → build/default/type}/template-literal/syntax.js +0 -0
- /package/{type → build/default/type}/template-literal/template-literal.js +0 -0
- /package/{type → build/default/type}/template-literal/union.js +0 -0
- /package/{type → build/default/type}/transform/index.js +0 -0
- /package/{type → build/default/type}/transform/transform.js +0 -0
- /package/{type → build/default/type}/tuple/index.js +0 -0
- /package/{type → build/default/type}/tuple/tuple.js +0 -0
- /package/{type → build/default/type}/type/index.js +0 -0
- /package/{type → build/default/type}/type/javascript.js +0 -0
- /package/{type → build/default/type}/type/json.js +0 -0
- /package/{type → build/default/type}/type/type.js +0 -0
- /package/{type → build/default/type}/uint8array/index.js +0 -0
- /package/{type → build/default/type}/uint8array/uint8array.js +0 -0
- /package/{type → build/default/type}/undefined/index.js +0 -0
- /package/{type → build/default/type}/undefined/undefined.js +0 -0
- /package/{type → build/default/type}/union/index.js +0 -0
- /package/{type → build/default/type}/union/union.js +0 -0
- /package/{type → build/default/type}/unknown/index.js +0 -0
- /package/{type → build/default/type}/unknown/unknown.js +0 -0
- /package/{type → build/default/type}/unsafe/index.js +0 -0
- /package/{type → build/default/type}/unsafe/unsafe.js +0 -0
- /package/{type → build/default/type}/void/index.js +0 -0
- /package/{type → build/default/type}/void/void.js +0 -0
- /package/{value → build/default/value}/cast/cast.js +0 -0
- /package/{value → build/default/value}/cast/index.js +0 -0
- /package/{value → build/default/value}/check/check.js +0 -0
- /package/{value → build/default/value}/check/index.js +0 -0
- /package/{value → build/default/value}/clean/clean.js +0 -0
- /package/{value → build/default/value}/clean/index.js +0 -0
- /package/{value → build/default/value}/clone/clone.js +0 -0
- /package/{value → build/default/value}/clone/index.js +0 -0
- /package/{value → build/default/value}/convert/convert.js +0 -0
- /package/{value → build/default/value}/convert/index.js +0 -0
- /package/{value → build/default/value}/create/create.js +0 -0
- /package/{value → build/default/value}/create/index.js +0 -0
- /package/{value → build/default/value}/default/default.js +0 -0
- /package/{value → build/default/value}/default/index.js +0 -0
- /package/{value → build/default/value}/delta/delta.js +0 -0
- /package/{value → build/default/value}/delta/index.js +0 -0
- /package/{value → build/default/value}/deref/deref.js +0 -0
- /package/{value → build/default/value}/deref/index.js +0 -0
- /package/{value → build/default/value}/equal/equal.js +0 -0
- /package/{value → build/default/value}/equal/index.js +0 -0
- /package/{value → build/default/value}/guard/guard.js +0 -0
- /package/{value → build/default/value}/guard/index.js +0 -0
- /package/{value → build/default/value}/hash/hash.js +0 -0
- /package/{value → build/default/value}/hash/index.js +0 -0
- /package/{value → build/default/value}/index.js +0 -0
- /package/{value → build/default/value}/mutate/index.js +0 -0
- /package/{value → build/default/value}/mutate/mutate.js +0 -0
- /package/{value → build/default/value}/pointer/index.js +0 -0
- /package/{value → build/default/value}/pointer/pointer.js +0 -0
- /package/{value → build/default/value}/transform/decode.js +0 -0
- /package/{value → build/default/value}/transform/encode.js +0 -0
- /package/{value → build/default/value}/transform/has.js +0 -0
- /package/{value → build/default/value}/transform/index.js +0 -0
- /package/{value → build/default/value}/value/index.js +0 -0
- /package/{value → build/default/value}/value/value.js +0 -0
- /package/{compiler → build/types/compiler}/compiler.d.ts +0 -0
- /package/{compiler → build/types/compiler}/index.d.ts +0 -0
- /package/{errors → build/types/errors}/errors.d.ts +0 -0
- /package/{errors → build/types/errors}/index.d.ts +0 -0
- /package/{index.d.ts → build/types/index.d.ts} +0 -0
- /package/{system → build/types/system}/errors.d.ts +0 -0
- /package/{system → build/types/system}/index.d.ts +0 -0
- /package/{system → build/types/system}/policy.d.ts +0 -0
- /package/{system → build/types/system}/system.d.ts +0 -0
- /package/{type → build/types/type}/any/any.d.ts +0 -0
- /package/{type → build/types/type}/any/index.d.ts +0 -0
- /package/{type → build/types/type}/array/array.d.ts +0 -0
- /package/{type → build/types/type}/array/index.d.ts +0 -0
- /package/{type → build/types/type}/async-iterator/async-iterator.d.ts +0 -0
- /package/{type → build/types/type}/async-iterator/index.d.ts +0 -0
- /package/{type → build/types/type}/awaited/awaited.d.ts +0 -0
- /package/{type → build/types/type}/awaited/index.d.ts +0 -0
- /package/{type → build/types/type}/bigint/bigint.d.ts +0 -0
- /package/{type → build/types/type}/bigint/index.d.ts +0 -0
- /package/{type → build/types/type}/boolean/boolean.d.ts +0 -0
- /package/{type → build/types/type}/boolean/index.d.ts +0 -0
- /package/{type → build/types/type}/clone/index.d.ts +0 -0
- /package/{type → build/types/type}/clone/type.d.ts +0 -0
- /package/{type → build/types/type}/clone/value.d.ts +0 -0
- /package/{type → build/types/type}/composite/composite.d.ts +0 -0
- /package/{type → build/types/type}/composite/index.d.ts +0 -0
- /package/{type → build/types/type}/const/const.d.ts +0 -0
- /package/{type → build/types/type}/const/index.d.ts +0 -0
- /package/{type → build/types/type}/constructor/constructor.d.ts +0 -0
- /package/{type → build/types/type}/constructor/index.d.ts +0 -0
- /package/{type → build/types/type}/constructor-parameters/constructor-parameters.d.ts +0 -0
- /package/{type → build/types/type}/constructor-parameters/index.d.ts +0 -0
- /package/{type → build/types/type}/date/date.d.ts +0 -0
- /package/{type → build/types/type}/date/index.d.ts +0 -0
- /package/{type → build/types/type}/deref/deref.d.ts +0 -0
- /package/{type → build/types/type}/deref/index.d.ts +0 -0
- /package/{type → build/types/type}/discard/discard.d.ts +0 -0
- /package/{type → build/types/type}/discard/index.d.ts +0 -0
- /package/{type → build/types/type}/enum/enum.d.ts +0 -0
- /package/{type → build/types/type}/enum/index.d.ts +0 -0
- /package/{type → build/types/type}/exclude/exclude.d.ts +0 -0
- /package/{type → build/types/type}/exclude/index.d.ts +0 -0
- /package/{type → build/types/type}/extends/extends-check.d.ts +0 -0
- /package/{type → build/types/type}/extends/extends-undefined.d.ts +0 -0
- /package/{type → build/types/type}/extends/extends.d.ts +0 -0
- /package/{type → build/types/type}/extends/index.d.ts +0 -0
- /package/{type → build/types/type}/extract/extract.d.ts +0 -0
- /package/{type → build/types/type}/extract/index.d.ts +0 -0
- /package/{type → build/types/type}/function/function.d.ts +0 -0
- /package/{type → build/types/type}/function/index.d.ts +0 -0
- /package/{type → build/types/type}/guard/index.d.ts +0 -0
- /package/{type → build/types/type}/guard/type.d.ts +0 -0
- /package/{type → build/types/type}/guard/value.d.ts +0 -0
- /package/{type → build/types/type}/helpers/helpers.d.ts +0 -0
- /package/{type → build/types/type}/helpers/index.d.ts +0 -0
- /package/{type → build/types/type}/index.d.ts +0 -0
- /package/{type → build/types/type}/indexed/index.d.ts +0 -0
- /package/{type → build/types/type}/indexed/indexed-key.d.ts +0 -0
- /package/{type → build/types/type}/indexed/indexed-type.d.ts +0 -0
- /package/{type → build/types/type}/indexed/indexed.d.ts +0 -0
- /package/{type → build/types/type}/instance-type/index.d.ts +0 -0
- /package/{type → build/types/type}/instance-type/instance-type.d.ts +0 -0
- /package/{type → build/types/type}/integer/index.d.ts +0 -0
- /package/{type → build/types/type}/integer/integer.d.ts +0 -0
- /package/{type → build/types/type}/intersect/index.d.ts +0 -0
- /package/{type → build/types/type}/intersect/intersect.d.ts +0 -0
- /package/{type → build/types/type}/intrinsic/index.d.ts +0 -0
- /package/{type → build/types/type}/intrinsic/intrinsic.d.ts +0 -0
- /package/{type → build/types/type}/iterator/index.d.ts +0 -0
- /package/{type → build/types/type}/iterator/iterator.d.ts +0 -0
- /package/{type → build/types/type}/keyof/index.d.ts +0 -0
- /package/{type → build/types/type}/keyof/keyof-string.d.ts +0 -0
- /package/{type → build/types/type}/keyof/keyof-type.d.ts +0 -0
- /package/{type → build/types/type}/keyof/keyof.d.ts +0 -0
- /package/{type → build/types/type}/literal/index.d.ts +0 -0
- /package/{type → build/types/type}/literal/literal.d.ts +0 -0
- /package/{type → build/types/type}/mapped/index.d.ts +0 -0
- /package/{type → build/types/type}/mapped/mapped.d.ts +0 -0
- /package/{type → build/types/type}/modifiers/index.d.ts +0 -0
- /package/{type → build/types/type}/modifiers/modifiers.d.ts +0 -0
- /package/{type → build/types/type}/never/index.d.ts +0 -0
- /package/{type → build/types/type}/never/never.d.ts +0 -0
- /package/{type → build/types/type}/not/index.d.ts +0 -0
- /package/{type → build/types/type}/not/not.d.ts +0 -0
- /package/{type → build/types/type}/null/index.d.ts +0 -0
- /package/{type → build/types/type}/null/null.d.ts +0 -0
- /package/{type → build/types/type}/number/index.d.ts +0 -0
- /package/{type → build/types/type}/number/number.d.ts +0 -0
- /package/{type → build/types/type}/object/index.d.ts +0 -0
- /package/{type → build/types/type}/object/object.d.ts +0 -0
- /package/{type → build/types/type}/omit/index.d.ts +0 -0
- /package/{type → build/types/type}/omit/omit.d.ts +0 -0
- /package/{type → build/types/type}/operators/index.d.ts +0 -0
- /package/{type → build/types/type}/operators/operators.d.ts +0 -0
- /package/{type → build/types/type}/optional/index.d.ts +0 -0
- /package/{type → build/types/type}/optional/optional.d.ts +0 -0
- /package/{type → build/types/type}/parameters/index.d.ts +0 -0
- /package/{type → build/types/type}/parameters/parameters.d.ts +0 -0
- /package/{type → build/types/type}/partial/index.d.ts +0 -0
- /package/{type → build/types/type}/partial/partial.d.ts +0 -0
- /package/{type → build/types/type}/patterns/index.d.ts +0 -0
- /package/{type → build/types/type}/patterns/patterns.d.ts +0 -0
- /package/{type → build/types/type}/pick/index.d.ts +0 -0
- /package/{type → build/types/type}/pick/pick.d.ts +0 -0
- /package/{type → build/types/type}/promise/index.d.ts +0 -0
- /package/{type → build/types/type}/promise/promise.d.ts +0 -0
- /package/{type → build/types/type}/readonly/index.d.ts +0 -0
- /package/{type → build/types/type}/readonly/readonly.d.ts +0 -0
- /package/{type → build/types/type}/readonly-optional/index.d.ts +0 -0
- /package/{type → build/types/type}/readonly-optional/readonly-optional.d.ts +0 -0
- /package/{type → build/types/type}/record/index.d.ts +0 -0
- /package/{type → build/types/type}/record/record.d.ts +0 -0
- /package/{type → build/types/type}/recursive/index.d.ts +0 -0
- /package/{type → build/types/type}/recursive/recursive.d.ts +0 -0
- /package/{type → build/types/type}/ref/index.d.ts +0 -0
- /package/{type → build/types/type}/ref/ref.d.ts +0 -0
- /package/{type → build/types/type}/regexp/index.d.ts +0 -0
- /package/{type → build/types/type}/regexp/regexp.d.ts +0 -0
- /package/{type → build/types/type}/registry/format.d.ts +0 -0
- /package/{type → build/types/type}/registry/index.d.ts +0 -0
- /package/{type → build/types/type}/registry/type.d.ts +0 -0
- /package/{type → build/types/type}/required/index.d.ts +0 -0
- /package/{type → build/types/type}/required/required.d.ts +0 -0
- /package/{type → build/types/type}/rest/index.d.ts +0 -0
- /package/{type → build/types/type}/rest/rest.d.ts +0 -0
- /package/{type → build/types/type}/return-type/index.d.ts +0 -0
- /package/{type → build/types/type}/return-type/return-type.d.ts +0 -0
- /package/{type → build/types/type}/schema/anyschema.d.ts +0 -0
- /package/{type → build/types/type}/schema/index.d.ts +0 -0
- /package/{type → build/types/type}/schema/schema.d.ts +0 -0
- /package/{type → build/types/type}/static/index.d.ts +0 -0
- /package/{type → build/types/type}/static/static.d.ts +0 -0
- /package/{type → build/types/type}/strict/index.d.ts +0 -0
- /package/{type → build/types/type}/strict/strict.d.ts +0 -0
- /package/{type → build/types/type}/string/index.d.ts +0 -0
- /package/{type → build/types/type}/string/string.d.ts +0 -0
- /package/{type → build/types/type}/symbol/index.d.ts +0 -0
- /package/{type → build/types/type}/symbol/symbol.d.ts +0 -0
- /package/{type → build/types/type}/symbols/index.d.ts +0 -0
- /package/{type → build/types/type}/symbols/symbols.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/finite.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/generate.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/index.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/parser.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/pattern.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/syntax.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/template-literal.d.ts +0 -0
- /package/{type → build/types/type}/template-literal/union.d.ts +0 -0
- /package/{type → build/types/type}/transform/index.d.ts +0 -0
- /package/{type → build/types/type}/transform/transform.d.ts +0 -0
- /package/{type → build/types/type}/tuple/index.d.ts +0 -0
- /package/{type → build/types/type}/tuple/tuple.d.ts +0 -0
- /package/{type → build/types/type}/type/index.d.ts +0 -0
- /package/{type → build/types/type}/type/javascript.d.ts +0 -0
- /package/{type → build/types/type}/type/json.d.ts +0 -0
- /package/{type → build/types/type}/type/type.d.ts +0 -0
- /package/{type → build/types/type}/uint8array/index.d.ts +0 -0
- /package/{type → build/types/type}/uint8array/uint8array.d.ts +0 -0
- /package/{type → build/types/type}/undefined/index.d.ts +0 -0
- /package/{type → build/types/type}/undefined/undefined.d.ts +0 -0
- /package/{type → build/types/type}/union/index.d.ts +0 -0
- /package/{type → build/types/type}/union/union.d.ts +0 -0
- /package/{type → build/types/type}/unknown/index.d.ts +0 -0
- /package/{type → build/types/type}/unknown/unknown.d.ts +0 -0
- /package/{type → build/types/type}/unsafe/index.d.ts +0 -0
- /package/{type → build/types/type}/unsafe/unsafe.d.ts +0 -0
- /package/{type → build/types/type}/void/index.d.ts +0 -0
- /package/{type → build/types/type}/void/void.d.ts +0 -0
- /package/{value → build/types/value}/cast/cast.d.ts +0 -0
- /package/{value → build/types/value}/cast/index.d.ts +0 -0
- /package/{value → build/types/value}/check/check.d.ts +0 -0
- /package/{value → build/types/value}/check/index.d.ts +0 -0
- /package/{value → build/types/value}/clean/clean.d.ts +0 -0
- /package/{value → build/types/value}/clean/index.d.ts +0 -0
- /package/{value → build/types/value}/clone/clone.d.ts +0 -0
- /package/{value → build/types/value}/clone/index.d.ts +0 -0
- /package/{value → build/types/value}/convert/convert.d.ts +0 -0
- /package/{value → build/types/value}/convert/index.d.ts +0 -0
- /package/{value → build/types/value}/create/create.d.ts +0 -0
- /package/{value → build/types/value}/create/index.d.ts +0 -0
- /package/{value → build/types/value}/default/default.d.ts +0 -0
- /package/{value → build/types/value}/default/index.d.ts +0 -0
- /package/{value → build/types/value}/delta/delta.d.ts +0 -0
- /package/{value → build/types/value}/delta/index.d.ts +0 -0
- /package/{value → build/types/value}/deref/deref.d.ts +0 -0
- /package/{value → build/types/value}/deref/index.d.ts +0 -0
- /package/{value → build/types/value}/equal/equal.d.ts +0 -0
- /package/{value → build/types/value}/equal/index.d.ts +0 -0
- /package/{value → build/types/value}/guard/guard.d.ts +0 -0
- /package/{value → build/types/value}/guard/index.d.ts +0 -0
- /package/{value → build/types/value}/hash/hash.d.ts +0 -0
- /package/{value → build/types/value}/hash/index.d.ts +0 -0
- /package/{value → build/types/value}/index.d.ts +0 -0
- /package/{value → build/types/value}/mutate/index.d.ts +0 -0
- /package/{value → build/types/value}/mutate/mutate.d.ts +0 -0
- /package/{value → build/types/value}/pointer/index.d.ts +0 -0
- /package/{value → build/types/value}/pointer/pointer.d.ts +0 -0
- /package/{value → build/types/value}/transform/decode.d.ts +0 -0
- /package/{value → build/types/value}/transform/encode.d.ts +0 -0
- /package/{value → build/types/value}/transform/has.d.ts +0 -0
- /package/{value → build/types/value}/transform/index.d.ts +0 -0
- /package/{value → build/types/value}/value/index.d.ts +0 -0
- /package/{value → build/types/value}/value/value.d.ts +0 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { TemplateLiteral, TemplateLiteralParseExact, IsTemplateLiteralFinite, TemplateLiteralGenerate } from '../template-literal/index.mjs';
|
|
2
|
+
import { Literal } from '../literal/index.mjs';
|
|
3
|
+
import { Union } from '../union/index.mjs';
|
|
4
|
+
import { TTemplateLiteral as IsTemplateLiteralType, TUnion as IsUnionType, TLiteral as IsLiteralType } from '../guard/type.mjs';
|
|
5
|
+
import { CloneType } from '../clone/type.mjs';
|
|
6
|
+
function ApplyUncapitalize(value) {
|
|
7
|
+
const [first, rest] = [value.slice(0, 1), value.slice(1)];
|
|
8
|
+
return [first.toLowerCase(), rest].join('');
|
|
9
|
+
}
|
|
10
|
+
function ApplyCapitalize(value) {
|
|
11
|
+
const [first, rest] = [value.slice(0, 1), value.slice(1)];
|
|
12
|
+
return [first.toUpperCase(), rest].join('');
|
|
13
|
+
}
|
|
14
|
+
function ApplyUppercase(value) {
|
|
15
|
+
return value.toUpperCase();
|
|
16
|
+
}
|
|
17
|
+
function ApplyLowercase(value) {
|
|
18
|
+
return value.toLowerCase();
|
|
19
|
+
}
|
|
20
|
+
function FromTemplateLiteral(schema, mode) {
|
|
21
|
+
const expression = TemplateLiteralParseExact(schema.pattern);
|
|
22
|
+
const finite = IsTemplateLiteralFinite(expression);
|
|
23
|
+
if (!finite)
|
|
24
|
+
return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
|
|
25
|
+
const strings = [...TemplateLiteralGenerate(expression)];
|
|
26
|
+
const literals = strings.map((value) => Literal(value));
|
|
27
|
+
const mapped = FromRest(literals, mode);
|
|
28
|
+
const union = Union(mapped);
|
|
29
|
+
return TemplateLiteral([union]);
|
|
30
|
+
}
|
|
31
|
+
function FromLiteralValue(value, mode) {
|
|
32
|
+
return (typeof value === 'string' ? (mode === 'Uncapitalize' ? ApplyUncapitalize(value) :
|
|
33
|
+
mode === 'Capitalize' ? ApplyCapitalize(value) :
|
|
34
|
+
mode === 'Uppercase' ? ApplyUppercase(value) :
|
|
35
|
+
mode === 'Lowercase' ? ApplyLowercase(value) :
|
|
36
|
+
value) : value.toString());
|
|
37
|
+
}
|
|
38
|
+
function FromRest(T, mode) {
|
|
39
|
+
const [L, ...R] = T;
|
|
40
|
+
return (T.length > 0 ? [IntrinsicResolve(L, mode), ...FromRest(R, mode)] : []);
|
|
41
|
+
}
|
|
42
|
+
export function IntrinsicResolve(schema, mode) {
|
|
43
|
+
return (IsTemplateLiteralType(schema) ? FromTemplateLiteral(schema, mode) :
|
|
44
|
+
IsUnionType(schema) ? Union(FromRest(schema.anyOf, mode)) :
|
|
45
|
+
IsLiteralType(schema) ? Literal(FromLiteralValue(schema.const, mode)) :
|
|
46
|
+
schema);
|
|
47
|
+
}
|
|
48
|
+
export function Uncapitalize(T, options = {}) {
|
|
49
|
+
return CloneType(IntrinsicResolve(T, 'Uncapitalize'), options);
|
|
50
|
+
}
|
|
51
|
+
export function Uppercase(T, options = {}) {
|
|
52
|
+
return CloneType(IntrinsicResolve(T, 'Uppercase'), options);
|
|
53
|
+
}
|
|
54
|
+
export function Lowercase(T, options = {}) {
|
|
55
|
+
return CloneType(IntrinsicResolve(T, 'Lowercase'), options);
|
|
56
|
+
}
|
|
57
|
+
export function Capitalize(T, options = {}) {
|
|
58
|
+
return CloneType(IntrinsicResolve(T, 'Capitalize'), options);
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './iterator.mjs';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Increment } from '../helpers/index.mjs';
|
|
2
|
+
import { OperatorUnionMany, OperatorIntersectMany } from '../operators/index.mjs';
|
|
3
|
+
import { TIntersect as IsIntersectType, TUnion as IsUnionType, TTuple as IsTupleType, TArray as IsArrayType, TObject as IsObjectType, TRecord as IsRecordType } from '../guard/type.mjs';
|
|
4
|
+
function FromRest(T) {
|
|
5
|
+
const [L, ...R] = T;
|
|
6
|
+
return (T.length > 0
|
|
7
|
+
? [KeyOfStringResolve(L), ...FromRest(R)]
|
|
8
|
+
: []);
|
|
9
|
+
}
|
|
10
|
+
function FromIntersect(T, C = FromRest(T)) {
|
|
11
|
+
return OperatorUnionMany(C);
|
|
12
|
+
}
|
|
13
|
+
function FromUnion(T) {
|
|
14
|
+
const C = FromRest(T);
|
|
15
|
+
return OperatorIntersectMany(C);
|
|
16
|
+
}
|
|
17
|
+
function FromTuple(T, I = '0') {
|
|
18
|
+
const [_, ...R] = T;
|
|
19
|
+
return (T.length > 0
|
|
20
|
+
? [I, ...FromTuple(R, Increment(I))]
|
|
21
|
+
: []);
|
|
22
|
+
}
|
|
23
|
+
function FromArray(_) {
|
|
24
|
+
return (['[number]']);
|
|
25
|
+
}
|
|
26
|
+
function FromProperties(T) {
|
|
27
|
+
return (globalThis.Object.getOwnPropertyNames(T));
|
|
28
|
+
}
|
|
29
|
+
function FromPatternProperties(patternProperties) {
|
|
30
|
+
if (!includePatternProperties)
|
|
31
|
+
return [];
|
|
32
|
+
const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
|
|
33
|
+
return patternPropertyKeys.map(key => {
|
|
34
|
+
return (key[0] === '^' && key[key.length - 1] === '$')
|
|
35
|
+
? key.slice(1, key.length - 1)
|
|
36
|
+
: key;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export function KeyOfStringResolve(T) {
|
|
40
|
+
return (IsIntersectType(T) ? FromIntersect(T.allOf) :
|
|
41
|
+
IsUnionType(T) ? FromUnion(T.anyOf) :
|
|
42
|
+
IsTupleType(T) ? FromTuple(T.items ?? []) :
|
|
43
|
+
IsArrayType(T) ? FromArray(T.items) :
|
|
44
|
+
IsObjectType(T) ? FromProperties(T.properties) :
|
|
45
|
+
IsRecordType(T) ? FromPatternProperties(T.patternProperties) :
|
|
46
|
+
[]);
|
|
47
|
+
}
|
|
48
|
+
let includePatternProperties = false;
|
|
49
|
+
export function KeyOfStringResolvePattern(schema) {
|
|
50
|
+
includePatternProperties = true;
|
|
51
|
+
const keys = KeyOfStringResolve(schema);
|
|
52
|
+
includePatternProperties = false;
|
|
53
|
+
const pattern = keys.map((key) => `(${key})`);
|
|
54
|
+
return `^(${pattern.join('|')})$`;
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Literal } from '../literal/index.mjs';
|
|
2
|
+
import { Number } from '../number/index.mjs';
|
|
3
|
+
import { KeyOfStringResolve } from './keyof-string.mjs';
|
|
4
|
+
import { UnionResolve } from '../union/index.mjs';
|
|
5
|
+
function FromLiterals(T) {
|
|
6
|
+
const [L, ...R] = T;
|
|
7
|
+
return (T.length > 0
|
|
8
|
+
? L === '[number]'
|
|
9
|
+
? [Number(), ...FromLiterals(R)]
|
|
10
|
+
: [Literal(L), ...FromLiterals(R)]
|
|
11
|
+
: []);
|
|
12
|
+
}
|
|
13
|
+
export function KeyOfTypeResolve(T) {
|
|
14
|
+
return (UnionResolve(FromLiterals(KeyOfStringResolve(T))));
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './literal.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './mapped.mjs';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Object } from '../object/index.mjs';
|
|
2
|
+
import { Literal } from '../literal/index.mjs';
|
|
3
|
+
import { IndexedKeyResolve } from '../indexed/indexed-key.mjs';
|
|
4
|
+
import { TSchema as IsSchemaType } from '../guard/type.mjs';
|
|
5
|
+
import { Kind } from '../symbols/index.mjs';
|
|
6
|
+
export function Mapped(key, map) {
|
|
7
|
+
const keys = IsSchemaType(key) ? IndexedKeyResolve(key) : key;
|
|
8
|
+
const anyOf = keys.map(key => Literal(key));
|
|
9
|
+
const mapped = { [Kind]: 'MappedKey', anyOf };
|
|
10
|
+
const properties = keys.reduce((acc, key) => {
|
|
11
|
+
return { ...acc, [key]: map(mapped) };
|
|
12
|
+
}, {});
|
|
13
|
+
return Object(properties);
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modifiers.mjs';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Intersect } from '../intersect/index.mjs';
|
|
2
|
+
import { Union } from '../union/index.mjs';
|
|
3
|
+
import { Optional } from '../optional/index.mjs';
|
|
4
|
+
import { Discard } from '../discard/index.mjs';
|
|
5
|
+
import { OptionalKind } from '../symbols/index.mjs';
|
|
6
|
+
import { TOptional as IsOptionalType } from '../guard/type.mjs';
|
|
7
|
+
function IsOptionalFromIntersect(T) {
|
|
8
|
+
const [L, ...R] = T;
|
|
9
|
+
return (T.length > 0
|
|
10
|
+
? IsOptionalType(L)
|
|
11
|
+
? IsOptionalFromIntersect(R)
|
|
12
|
+
: false
|
|
13
|
+
: true);
|
|
14
|
+
}
|
|
15
|
+
function IsOptionalFromUnion(T) {
|
|
16
|
+
const [L, ...R] = T;
|
|
17
|
+
return (T.length > 0
|
|
18
|
+
? IsOptionalType(L)
|
|
19
|
+
? true
|
|
20
|
+
: IsOptionalFromUnion(R)
|
|
21
|
+
: false);
|
|
22
|
+
}
|
|
23
|
+
function RemoveOptionalFromRest(T) {
|
|
24
|
+
return (T.map(T => RemoveOptionalFromSchema(T)));
|
|
25
|
+
}
|
|
26
|
+
function RemoveOptionalFromSchema(T) {
|
|
27
|
+
return (Discard(T, [OptionalKind]));
|
|
28
|
+
}
|
|
29
|
+
export function OptionalFromIntersect(T) {
|
|
30
|
+
const D = RemoveOptionalFromRest(T);
|
|
31
|
+
return (IsOptionalFromIntersect(T)
|
|
32
|
+
? Optional(Intersect(D))
|
|
33
|
+
: Intersect(T));
|
|
34
|
+
}
|
|
35
|
+
export function OptionalFromUnion(T) {
|
|
36
|
+
const D = RemoveOptionalFromRest(T);
|
|
37
|
+
return (IsOptionalFromUnion(T)
|
|
38
|
+
? Optional(Union(D))
|
|
39
|
+
: Union(T));
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './never.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './not.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './null.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './number.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './object.mjs';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CloneType } from '../clone/type.mjs';
|
|
2
|
+
import { Kind } from '../symbols/index.mjs';
|
|
3
|
+
import { TOptional as IsOptionalType, TSchema as IsSchemaType } from '../guard/type.mjs';
|
|
4
|
+
export function _Object(properties, options = {}) {
|
|
5
|
+
const propertyKeys = globalThis.Object.getOwnPropertyNames(properties);
|
|
6
|
+
const optionalKeys = propertyKeys.filter((key) => IsOptionalType(properties[key]));
|
|
7
|
+
const requiredKeys = propertyKeys.filter((name) => !optionalKeys.includes(name));
|
|
8
|
+
const clonedAdditionalProperties = IsSchemaType(options.additionalProperties) ? { additionalProperties: CloneType(options.additionalProperties) } : {};
|
|
9
|
+
const clonedProperties = propertyKeys.reduce((acc, key) => ({ ...acc, [key]: CloneType(properties[key]) }), {});
|
|
10
|
+
return (requiredKeys.length > 0
|
|
11
|
+
? { ...options, ...clonedAdditionalProperties, [Kind]: 'Object', type: 'object', properties: clonedProperties, required: requiredKeys }
|
|
12
|
+
: { ...options, ...clonedAdditionalProperties, [Kind]: 'Object', type: 'object', properties: clonedProperties });
|
|
13
|
+
}
|
|
14
|
+
export const Object = _Object;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './omit.mjs';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Intersect } from '../intersect/index.mjs';
|
|
2
|
+
import { Union } from '../union/index.mjs';
|
|
3
|
+
import { Object } from '../object/index.mjs';
|
|
4
|
+
import { IndexedKeyResolve } from '../indexed/index.mjs';
|
|
5
|
+
import { Discard } from '../discard/index.mjs';
|
|
6
|
+
import { TransformKind } from '../symbols/index.mjs';
|
|
7
|
+
import { CloneType } from '../clone/type.mjs';
|
|
8
|
+
import { TIntersect as IsIntersectType, TUnion as IsUnionType, TObject as IsObjectType, TSchema as IsSchemaType } from '../guard/type.mjs';
|
|
9
|
+
function FromIntersect(T, K) {
|
|
10
|
+
return T.map((T) => OmitResolve(T, K));
|
|
11
|
+
}
|
|
12
|
+
function FromUnion(T, K) {
|
|
13
|
+
return T.map((T) => OmitResolve(T, K));
|
|
14
|
+
}
|
|
15
|
+
function FromProperty(T, K) {
|
|
16
|
+
const { [K]: _, ...R } = T;
|
|
17
|
+
return R;
|
|
18
|
+
}
|
|
19
|
+
function FromProperties(T, K) {
|
|
20
|
+
return K.reduce((T, K2) => {
|
|
21
|
+
return FromProperty(T, K2);
|
|
22
|
+
}, T);
|
|
23
|
+
}
|
|
24
|
+
export function OmitResolve(T, K) {
|
|
25
|
+
return (IsIntersectType(T) ? Intersect(FromIntersect(T.allOf, K)) :
|
|
26
|
+
IsUnionType(T) ? Union(FromUnion(T.anyOf, K)) :
|
|
27
|
+
IsObjectType(T) ? Object(FromProperties(T.properties, K)) :
|
|
28
|
+
Object({}));
|
|
29
|
+
}
|
|
30
|
+
export function Omit(T, K, options = {}) {
|
|
31
|
+
const I = IsSchemaType(K) ? IndexedKeyResolve(K) : K;
|
|
32
|
+
const D = Discard(T, [TransformKind, '$id', 'required']);
|
|
33
|
+
const R = CloneType(OmitResolve(T, I), options);
|
|
34
|
+
return { ...D, ...R };
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './operators.mjs';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export function OperatorIncludes(T, S) {
|
|
2
|
+
const [L, ...R] = T;
|
|
3
|
+
return (T.length > 0
|
|
4
|
+
? S === L
|
|
5
|
+
? true
|
|
6
|
+
: OperatorIncludes(R, S)
|
|
7
|
+
: false);
|
|
8
|
+
}
|
|
9
|
+
export function OperatorSubset(T, S) {
|
|
10
|
+
const [L, ...R] = T;
|
|
11
|
+
return (T.length > 0
|
|
12
|
+
? OperatorIncludes(S, L) === true
|
|
13
|
+
? OperatorSubset(R, S)
|
|
14
|
+
: false
|
|
15
|
+
: true);
|
|
16
|
+
}
|
|
17
|
+
export function OperatorDistinct(T, Acc = []) {
|
|
18
|
+
const [L, ...R] = T;
|
|
19
|
+
return (T.length > 0
|
|
20
|
+
? OperatorIncludes(Acc, L) === false
|
|
21
|
+
? OperatorDistinct(R, [...Acc, L])
|
|
22
|
+
: OperatorDistinct(R, [...Acc])
|
|
23
|
+
: Acc);
|
|
24
|
+
}
|
|
25
|
+
export function OperatorIntersect(T, S) {
|
|
26
|
+
const [L, ...R] = T;
|
|
27
|
+
return (T.length > 0
|
|
28
|
+
? OperatorIncludes(S, L) === true
|
|
29
|
+
? [L, ...OperatorIntersect(R, S)]
|
|
30
|
+
: [...OperatorIntersect(R, S)]
|
|
31
|
+
: []);
|
|
32
|
+
}
|
|
33
|
+
export function OperatorUnion(T, S) {
|
|
34
|
+
const [L, ...R] = T;
|
|
35
|
+
return (T.length > 0
|
|
36
|
+
? OperatorIncludes(S, L) === true
|
|
37
|
+
? [...OperatorUnion(R, S)]
|
|
38
|
+
: [L, ...OperatorUnion(R, S)]
|
|
39
|
+
: S);
|
|
40
|
+
}
|
|
41
|
+
export function OperatorComplement(T, S) {
|
|
42
|
+
const [L, ...R] = T;
|
|
43
|
+
return (T.length > 0
|
|
44
|
+
? OperatorIncludes(S, L) === true
|
|
45
|
+
? [...OperatorComplement(R, S)]
|
|
46
|
+
: [L, ...OperatorComplement(R, S)]
|
|
47
|
+
: []);
|
|
48
|
+
}
|
|
49
|
+
export function OperatorIntersectMany(T) {
|
|
50
|
+
return (T.length === 1
|
|
51
|
+
? T[0]
|
|
52
|
+
: (() => {
|
|
53
|
+
const [L, ...R] = T;
|
|
54
|
+
return (L.length > 0
|
|
55
|
+
? OperatorIntersect(L, OperatorIntersectMany(R))
|
|
56
|
+
: []);
|
|
57
|
+
})());
|
|
58
|
+
}
|
|
59
|
+
export function OperatorUnionMany(T) {
|
|
60
|
+
return (T.length === 1
|
|
61
|
+
? T[0]
|
|
62
|
+
: (() => {
|
|
63
|
+
const [L, ...R] = T;
|
|
64
|
+
return T.length > 0 ? OperatorUnion(L, OperatorUnionMany(R)) : [];
|
|
65
|
+
})());
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './optional.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './parameters.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './partial.mjs';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Optional } from '../optional/index.mjs';
|
|
2
|
+
import { Object } from '../object/index.mjs';
|
|
3
|
+
import { Intersect } from '../intersect/index.mjs';
|
|
4
|
+
import { Union } from '../union/index.mjs';
|
|
5
|
+
import { Discard } from '../discard/index.mjs';
|
|
6
|
+
import { TransformKind } from '../symbols/index.mjs';
|
|
7
|
+
import { CloneType } from '../clone/type.mjs';
|
|
8
|
+
import { TIntersect as IsIntersectType, TUnion as IsUnionType, TObject as IsObjectType } from '../guard/type.mjs';
|
|
9
|
+
function FromIntersect(T) {
|
|
10
|
+
const [L, ...R] = T;
|
|
11
|
+
return (T.length > 0
|
|
12
|
+
? [PartialResolve(L), ...FromIntersect(R)]
|
|
13
|
+
: []);
|
|
14
|
+
}
|
|
15
|
+
function FromUnion(T) {
|
|
16
|
+
const [L, ...R] = T;
|
|
17
|
+
return (T.length > 0
|
|
18
|
+
? [PartialResolve(L), ...FromUnion(R)]
|
|
19
|
+
: []);
|
|
20
|
+
}
|
|
21
|
+
function FromProperties(T) {
|
|
22
|
+
return globalThis.Object.getOwnPropertyNames(T).reduce((Acc, K) => {
|
|
23
|
+
return { ...Acc, [K]: Optional(T[K]) };
|
|
24
|
+
}, {});
|
|
25
|
+
}
|
|
26
|
+
export function PartialResolve(T) {
|
|
27
|
+
return (IsIntersectType(T) ? Intersect(FromIntersect(T.allOf)) :
|
|
28
|
+
IsUnionType(T) ? Union(FromUnion(T.anyOf)) :
|
|
29
|
+
IsObjectType(T) ? Object(FromProperties(T.properties)) :
|
|
30
|
+
Object({}));
|
|
31
|
+
}
|
|
32
|
+
export function Partial(T, options = {}) {
|
|
33
|
+
const D = Discard(T, [TransformKind, '$id', 'required']);
|
|
34
|
+
const R = CloneType(PartialResolve(T), options);
|
|
35
|
+
return { ...D, ...R };
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './patterns.mjs';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const PatternBoolean = '(true|false)';
|
|
2
|
+
export const PatternNumber = '(0|[1-9][0-9]*)';
|
|
3
|
+
export const PatternString = '(.*)';
|
|
4
|
+
export const PatternBooleanExact = `^${PatternBoolean}$`;
|
|
5
|
+
export const PatternNumberExact = `^${PatternNumber}$`;
|
|
6
|
+
export const PatternStringExact = `^${PatternString}$`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pick.mjs';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Intersect } from '../intersect/index.mjs';
|
|
2
|
+
import { Union } from '../union/index.mjs';
|
|
3
|
+
import { Object } from '../object/index.mjs';
|
|
4
|
+
import { IndexedKeyResolve } from '../indexed/index.mjs';
|
|
5
|
+
import { Discard } from '../discard/index.mjs';
|
|
6
|
+
import { TransformKind } from '../symbols/index.mjs';
|
|
7
|
+
import { CloneType } from '../clone/type.mjs';
|
|
8
|
+
import { TIntersect as IsIntersectType, TUnion as IsUnionType, TObject as IsObjectType, TSchema as IsSchemaType } from '../guard/type.mjs';
|
|
9
|
+
function FromIntersect(T, K) {
|
|
10
|
+
return T.map((T) => PickResolve(T, K));
|
|
11
|
+
}
|
|
12
|
+
function FromUnion(T, K) {
|
|
13
|
+
return T.map((T) => PickResolve(T, K));
|
|
14
|
+
}
|
|
15
|
+
function FromProperties(T, K) {
|
|
16
|
+
return K.reduce((Acc, K) => {
|
|
17
|
+
return K in T ? { ...Acc, [K]: T[K] } : Acc;
|
|
18
|
+
}, {});
|
|
19
|
+
}
|
|
20
|
+
export function PickResolve(T, K) {
|
|
21
|
+
return (IsIntersectType(T) ? Intersect(FromIntersect(T.allOf, K)) :
|
|
22
|
+
IsUnionType(T) ? Union(FromUnion(T.anyOf, K)) :
|
|
23
|
+
IsObjectType(T) ? Object(FromProperties(T.properties, K)) :
|
|
24
|
+
Object({}));
|
|
25
|
+
}
|
|
26
|
+
export function Pick(T, K, options = {}) {
|
|
27
|
+
const I = IsSchemaType(K) ? IndexedKeyResolve(K) : K;
|
|
28
|
+
const D = Discard(T, [TransformKind, '$id', 'required']);
|
|
29
|
+
const R = CloneType(PickResolve(T, I), options);
|
|
30
|
+
return { ...D, ...R };
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './promise.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './readonly.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './readonly-optional.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './record.mjs';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Object } from '../object/index.mjs';
|
|
2
|
+
import { Never } from '../never/index.mjs';
|
|
3
|
+
import { Union } from '../union/index.mjs';
|
|
4
|
+
import { IsTemplateLiteralFinite, TemplateLiteralParseExact } from '../template-literal/index.mjs';
|
|
5
|
+
import { PatternStringExact, PatternNumberExact } from '../patterns/index.mjs';
|
|
6
|
+
import { IndexedKeyResolve } from '../indexed/index.mjs';
|
|
7
|
+
import { Kind, Hint } from '../symbols/index.mjs';
|
|
8
|
+
import { CloneType } from '../clone/type.mjs';
|
|
9
|
+
import { IsUndefined } from '../guard/value.mjs';
|
|
10
|
+
import { TUnion as IsUnionType, TTemplateLiteral as IsTemplateLiteralType, TLiteral as IsLiteralType, TString as IsStringType, TInteger as IsIntegerType, TNumber as IsNumberType } from '../guard/type.mjs';
|
|
11
|
+
function FromPattern(pattern, T) {
|
|
12
|
+
return { [Kind]: 'Record', type: 'object', patternProperties: { [pattern]: CloneType(T) } };
|
|
13
|
+
}
|
|
14
|
+
function FromKeys(keys, T) {
|
|
15
|
+
const properties = keys.reduce((acc, key) => ({ ...acc, [key]: CloneType(T) }), {});
|
|
16
|
+
return Object(properties, { [Hint]: 'Record' });
|
|
17
|
+
}
|
|
18
|
+
function FromTemplateLiteralKey(K, T) {
|
|
19
|
+
const expression = TemplateLiteralParseExact(K.pattern);
|
|
20
|
+
return (IsTemplateLiteralFinite(expression)
|
|
21
|
+
? FromKeys(IndexedKeyResolve(K), T)
|
|
22
|
+
: FromPattern(K.pattern, T));
|
|
23
|
+
}
|
|
24
|
+
function FromUnionKey(K, T) {
|
|
25
|
+
return FromKeys(IndexedKeyResolve(Union(K)), T);
|
|
26
|
+
}
|
|
27
|
+
function FromLiteralKey(K, T) {
|
|
28
|
+
return FromKeys([K.toString()], T);
|
|
29
|
+
}
|
|
30
|
+
function FromStringKey(K, T) {
|
|
31
|
+
const pattern = IsUndefined(K.pattern) ? PatternStringExact : K.pattern;
|
|
32
|
+
return FromPattern(pattern, T);
|
|
33
|
+
}
|
|
34
|
+
function FromIntegerKey(_, T) {
|
|
35
|
+
return FromPattern(PatternNumberExact, T);
|
|
36
|
+
}
|
|
37
|
+
function FromNumberKey(_, T) {
|
|
38
|
+
return FromPattern(PatternNumberExact, T);
|
|
39
|
+
}
|
|
40
|
+
export function RecordResolve(K, T) {
|
|
41
|
+
return (IsUnionType(K) ? FromUnionKey(K.anyOf, T) :
|
|
42
|
+
IsTemplateLiteralType(K) ? FromTemplateLiteralKey(K, T) :
|
|
43
|
+
IsLiteralType(K) ? FromLiteralKey(K.const, T) :
|
|
44
|
+
IsStringType(K) ? FromStringKey(K, T) :
|
|
45
|
+
IsIntegerType(K) ? FromIntegerKey(K, T) :
|
|
46
|
+
IsNumberType(K) ? FromNumberKey(K, T) :
|
|
47
|
+
Never());
|
|
48
|
+
}
|
|
49
|
+
export function Record(K, T, options = {}) {
|
|
50
|
+
return CloneType(RecordResolve(K, T), options);
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './recursive.mjs';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CloneType } from '../clone/type.mjs';
|
|
2
|
+
import { IsUndefined } from '../guard/value.mjs';
|
|
3
|
+
import { Kind, Hint } from '../symbols/index.mjs';
|
|
4
|
+
let Ordinal = 0;
|
|
5
|
+
export function Recursive(callback, options = {}) {
|
|
6
|
+
if (IsUndefined(options.$id))
|
|
7
|
+
options.$id = `T${Ordinal++}`;
|
|
8
|
+
const thisType = callback({ [Kind]: 'This', $ref: `${options.$id}` });
|
|
9
|
+
thisType.$id = options.$id;
|
|
10
|
+
return CloneType({
|
|
11
|
+
...options,
|
|
12
|
+
[Hint]: 'Recursive',
|
|
13
|
+
...thisType,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ref.mjs';
|