@sinclair/typebox 0.32.0-dev-15 → 0.32.0-dev-17
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.d.mts +9 -0
- package/build/import/compiler/compiler.mjs +87 -6
- package/build/import/compiler/index.mjs +27 -0
- package/build/import/errors/errors.d.mts +3 -0
- package/build/import/errors/errors.mjs +55 -3
- package/build/import/errors/function.d.mts +3 -0
- package/build/import/errors/function.mjs +31 -0
- package/build/import/errors/index.mjs +27 -0
- package/build/import/index.d.mts +2 -2
- package/build/import/index.mjs +38 -2
- package/build/import/system/index.mjs +27 -0
- package/build/import/system/policy.d.mts +10 -0
- package/build/import/system/policy.mjs +40 -0
- package/build/import/system/system.d.mts +3 -0
- package/build/import/system/system.mjs +36 -0
- package/build/import/type/any/any.d.mts +1 -0
- package/build/import/type/any/any.mjs +28 -0
- package/build/import/type/any/index.mjs +27 -0
- package/build/import/type/array/array.d.mts +8 -1
- package/build/import/type/array/array.mjs +28 -0
- package/build/import/type/array/index.mjs +27 -0
- package/build/import/type/async-iterator/async-iterator.d.mts +1 -0
- package/build/import/type/async-iterator/async-iterator.mjs +28 -0
- package/build/import/type/async-iterator/index.mjs +27 -0
- package/build/import/type/awaited/awaited.d.mts +1 -0
- package/build/import/type/awaited/awaited.mjs +37 -0
- package/build/import/type/awaited/index.mjs +27 -0
- package/build/import/type/bigint/bigint.d.mts +1 -0
- package/build/import/type/bigint/bigint.mjs +28 -0
- package/build/import/type/bigint/index.mjs +27 -0
- package/build/import/type/boolean/boolean.d.mts +1 -0
- package/build/import/type/boolean/boolean.mjs +28 -0
- package/build/import/type/boolean/index.mjs +27 -0
- package/build/import/type/clone/index.mjs +27 -0
- package/build/import/type/clone/type.d.mts +2 -0
- package/build/import/type/clone/type.mjs +29 -0
- package/build/import/type/clone/value.d.mts +1 -0
- package/build/import/type/clone/value.mjs +29 -0
- package/build/import/type/composite/composite.d.mts +1 -0
- package/build/import/type/composite/composite.mjs +28 -0
- package/build/import/type/composite/index.mjs +27 -0
- package/build/import/type/const/const.d.mts +2 -1
- package/build/import/type/const/const.mjs +32 -1
- package/build/import/type/const/index.mjs +27 -0
- package/build/import/type/constructor/constructor.d.mts +5 -4
- package/build/import/type/constructor/constructor.mjs +28 -0
- package/build/import/type/constructor/index.mjs +27 -0
- package/build/import/type/constructor-parameters/constructor-parameters.d.mts +1 -0
- package/build/import/type/constructor-parameters/constructor-parameters.mjs +28 -0
- package/build/import/type/constructor-parameters/index.mjs +27 -0
- package/build/import/type/date/date.d.mts +6 -0
- package/build/import/type/date/date.mjs +28 -0
- package/build/import/type/date/index.mjs +27 -0
- package/build/import/type/deref/deref.d.mts +1 -0
- package/build/import/type/deref/deref.mjs +45 -0
- package/build/import/type/deref/index.mjs +27 -0
- package/build/import/type/discard/discard.mjs +27 -0
- package/build/import/type/discard/index.mjs +27 -0
- package/build/import/type/enum/enum.d.mts +1 -0
- package/build/import/type/enum/enum.mjs +28 -0
- package/build/import/type/enum/index.mjs +27 -0
- package/build/import/type/exclude/exclude-from-mapped-result.mjs +30 -0
- package/build/import/type/exclude/exclude.d.mts +5 -3
- package/build/import/type/exclude/exclude.mjs +30 -0
- package/build/import/type/exclude/index.mjs +27 -0
- package/build/import/type/extends/extends-check.mjs +200 -1
- package/build/import/type/extends/extends-from-mapped-key.mjs +31 -0
- package/build/import/type/extends/extends-from-mapped-result.mjs +30 -0
- package/build/import/type/extends/extends-undefined.d.mts +1 -0
- package/build/import/type/extends/extends-undefined.mjs +30 -0
- package/build/import/type/extends/extends.d.mts +3 -0
- package/build/import/type/extends/extends.mjs +35 -1
- package/build/import/type/extends/index.mjs +27 -0
- package/build/import/type/extract/extract-from-mapped-result.mjs +30 -0
- package/build/import/type/extract/extract.d.mts +5 -3
- package/build/import/type/extract/extract.mjs +30 -0
- package/build/import/type/extract/index.mjs +27 -0
- package/build/import/type/function/function.d.mts +5 -4
- package/build/import/type/function/function.mjs +28 -0
- package/build/import/type/function/index.mjs +27 -0
- package/build/import/type/guard/index.mjs +27 -0
- package/build/import/type/guard/type.d.mts +46 -0
- package/build/import/type/guard/type.mjs +111 -1
- package/build/import/type/guard/value.d.mts +14 -0
- package/build/import/type/guard/value.mjs +41 -0
- package/build/import/type/helpers/helpers.d.mts +1 -0
- package/build/import/type/helpers/helpers.mjs +28 -0
- package/build/import/type/helpers/index.mjs +27 -0
- package/build/import/type/index.mjs +27 -0
- package/build/import/type/indexed/index.mjs +27 -0
- package/build/import/type/indexed/indexed-from-mapped-key.mjs +35 -1
- package/build/import/type/indexed/indexed-property-keys.d.mts +1 -0
- package/build/import/type/indexed/indexed-property-keys.mjs +36 -0
- package/build/import/type/indexed/indexed-result.d.mts +6 -6
- package/build/import/type/indexed/indexed-result.mjs +49 -7
- package/build/import/type/indexed/indexed.d.mts +3 -0
- package/build/import/type/indexed/indexed.mjs +34 -1
- package/build/import/type/instance-type/index.mjs +27 -0
- package/build/import/type/instance-type/instance-type.d.mts +1 -0
- package/build/import/type/instance-type/instance-type.mjs +28 -0
- package/build/import/type/integer/index.mjs +27 -0
- package/build/import/type/integer/integer.d.mts +1 -0
- package/build/import/type/integer/integer.mjs +28 -0
- package/build/import/type/intersect/index.d.mts +2 -0
- package/build/import/type/intersect/index.mjs +29 -0
- package/build/import/type/intersect/intersect-create.d.mts +3 -0
- package/build/import/type/intersect/intersect-create.mjs +47 -0
- package/build/import/type/intersect/intersect-evaluated.d.mts +17 -0
- package/build/import/type/intersect/intersect-evaluated.mjs +71 -0
- package/build/import/type/intersect/intersect-type.d.mts +15 -0
- package/build/import/type/intersect/intersect-type.mjs +28 -0
- package/build/import/type/intersect/intersect.d.mts +5 -20
- package/build/import/type/intersect/intersect.mjs +37 -17
- package/build/import/type/intrinsic/capitalize.d.mts +1 -0
- package/build/import/type/intrinsic/capitalize.mjs +28 -0
- package/build/import/type/intrinsic/index.mjs +27 -0
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +31 -0
- package/build/import/type/intrinsic/intrinsic.d.mts +2 -0
- package/build/import/type/intrinsic/intrinsic.mjs +43 -1
- package/build/import/type/intrinsic/lowercase.d.mts +1 -0
- package/build/import/type/intrinsic/lowercase.mjs +28 -0
- package/build/import/type/intrinsic/uncapitalize.d.mts +1 -0
- package/build/import/type/intrinsic/uncapitalize.mjs +28 -0
- package/build/import/type/intrinsic/uppercase.d.mts +1 -0
- package/build/import/type/intrinsic/uppercase.mjs +28 -0
- package/build/import/type/iterator/index.mjs +27 -0
- package/build/import/type/iterator/iterator.d.mts +1 -0
- package/build/import/type/iterator/iterator.mjs +28 -0
- package/build/import/type/keyof/index.mjs +27 -0
- package/build/import/type/keyof/keyof-from-mapped-result.mjs +30 -0
- package/build/import/type/keyof/keyof-property-keys.d.mts +2 -0
- package/build/import/type/keyof/keyof-property-keys.mjs +47 -0
- package/build/import/type/keyof/keyof.d.mts +4 -2
- package/build/import/type/keyof/keyof.mjs +35 -2
- package/build/import/type/literal/index.mjs +27 -0
- package/build/import/type/literal/literal.d.mts +1 -0
- package/build/import/type/literal/literal.mjs +28 -0
- package/build/import/type/mapped/index.mjs +27 -0
- package/build/import/type/mapped/mapped-key.mjs +28 -0
- package/build/import/type/mapped/mapped-result.mjs +28 -0
- package/build/import/type/mapped/mapped.d.mts +2 -0
- package/build/import/type/mapped/mapped.mjs +47 -3
- package/build/import/type/modifiers/index.mjs +27 -0
- package/build/import/type/modifiers/modifiers.mjs +37 -0
- package/build/import/type/never/index.mjs +27 -0
- package/build/import/type/never/never.d.mts +1 -0
- package/build/import/type/never/never.mjs +28 -0
- package/build/import/type/not/index.mjs +27 -0
- package/build/import/type/not/not.d.mts +1 -0
- package/build/import/type/not/not.mjs +28 -0
- package/build/import/type/null/index.mjs +27 -0
- package/build/import/type/null/null.d.mts +1 -0
- package/build/import/type/null/null.mjs +28 -0
- package/build/import/type/number/index.mjs +27 -0
- package/build/import/type/number/number.d.mts +1 -0
- package/build/import/type/number/number.mjs +28 -0
- package/build/import/type/object/index.mjs +27 -0
- package/build/import/type/object/object.d.mts +10 -5
- package/build/import/type/object/object.mjs +33 -0
- package/build/import/type/omit/index.mjs +27 -0
- package/build/import/type/omit/omit-from-mapped-key.mjs +31 -0
- package/build/import/type/omit/omit.d.mts +3 -0
- package/build/import/type/omit/omit.mjs +39 -0
- package/build/import/type/operators/index.mjs +27 -0
- package/build/import/type/operators/operators.d.mts +8 -0
- package/build/import/type/operators/operators.mjs +42 -0
- package/build/import/type/optional/index.mjs +27 -0
- package/build/import/type/optional/optional.d.mts +1 -0
- package/build/import/type/optional/optional.mjs +28 -0
- package/build/import/type/parameters/index.mjs +27 -0
- package/build/import/type/parameters/parameters.d.mts +1 -0
- package/build/import/type/parameters/parameters.mjs +28 -0
- package/build/import/type/partial/index.mjs +27 -0
- package/build/import/type/partial/partial-from-mapped-result.mjs +30 -0
- package/build/import/type/partial/partial.d.mts +2 -0
- package/build/import/type/partial/partial.mjs +36 -0
- package/build/import/type/patterns/index.mjs +27 -0
- package/build/import/type/patterns/patterns.mjs +27 -0
- package/build/import/type/pick/index.mjs +27 -0
- package/build/import/type/pick/pick-from-mapped-key.mjs +31 -0
- package/build/import/type/pick/pick.d.mts +3 -0
- package/build/import/type/pick/pick.mjs +34 -0
- package/build/import/type/promise/index.mjs +27 -0
- package/build/import/type/promise/promise.d.mts +1 -0
- package/build/import/type/promise/promise.mjs +28 -0
- package/build/import/type/readonly/index.mjs +27 -0
- package/build/import/type/readonly/readonly.d.mts +1 -0
- package/build/import/type/readonly/readonly.mjs +28 -0
- package/build/import/type/readonly-optional/index.mjs +27 -0
- package/build/import/type/readonly-optional/readonly-optional.d.mts +1 -0
- package/build/import/type/readonly-optional/readonly-optional.mjs +28 -0
- package/build/import/type/record/index.mjs +27 -0
- package/build/import/type/record/record.d.mts +1 -1
- package/build/import/type/record/record.mjs +49 -1
- package/build/import/type/recursive/index.mjs +27 -0
- package/build/import/type/recursive/recursive.d.mts +4 -2
- package/build/import/type/recursive/recursive.mjs +31 -5
- package/build/import/type/ref/index.mjs +27 -0
- package/build/import/type/ref/ref.d.mts +2 -0
- package/build/import/type/ref/ref.mjs +28 -0
- package/build/import/type/regexp/index.mjs +27 -0
- package/build/import/type/regexp/regexp.d.mts +2 -0
- package/build/import/type/regexp/regexp.mjs +28 -0
- package/build/import/type/registry/format.d.mts +6 -0
- package/build/import/type/registry/format.mjs +34 -0
- package/build/import/type/registry/index.mjs +27 -0
- package/build/import/type/registry/type.d.mts +6 -0
- package/build/import/type/registry/type.mjs +34 -0
- package/build/import/type/required/index.mjs +27 -0
- package/build/import/type/required/required-from-mapped-result.mjs +30 -0
- package/build/import/type/required/required.d.mts +2 -0
- package/build/import/type/required/required.mjs +36 -0
- package/build/import/type/rest/index.mjs +27 -0
- package/build/import/type/rest/rest.d.mts +1 -0
- package/build/import/type/rest/rest.mjs +32 -0
- package/build/import/type/return-type/index.mjs +27 -0
- package/build/import/type/return-type/return-type.d.mts +1 -0
- package/build/import/type/return-type/return-type.mjs +28 -0
- package/build/import/type/schema/anyschema.mjs +27 -0
- package/build/import/type/schema/index.mjs +27 -0
- package/build/import/type/schema/schema.d.mts +7 -0
- package/build/import/type/schema/schema.mjs +27 -0
- package/build/import/type/static/index.mjs +27 -0
- package/build/import/type/static/static.d.mts +3 -0
- package/build/import/type/static/static.mjs +27 -0
- package/build/import/type/strict/index.mjs +27 -0
- package/build/import/type/strict/strict.d.mts +1 -0
- package/build/import/type/strict/strict.mjs +28 -0
- package/build/import/type/string/index.mjs +27 -0
- package/build/import/type/string/string.d.mts +7 -0
- package/build/import/type/string/string.mjs +28 -0
- package/build/import/type/symbol/index.mjs +27 -0
- package/build/import/type/symbol/symbol.d.mts +1 -0
- package/build/import/type/symbol/symbol.mjs +28 -0
- package/build/import/type/symbols/index.mjs +27 -0
- package/build/import/type/symbols/symbols.d.mts +5 -0
- package/build/import/type/symbols/symbols.mjs +32 -0
- package/build/import/type/template-literal/finite.mjs +37 -0
- package/build/import/type/template-literal/generate.mjs +37 -0
- package/build/import/type/template-literal/index.mjs +27 -0
- package/build/import/type/template-literal/parser.d.mts +2 -0
- package/build/import/type/template-literal/parser.mjs +44 -0
- package/build/import/type/template-literal/pattern.mjs +38 -0
- package/build/import/type/template-literal/syntax.d.mts +5 -4
- package/build/import/type/template-literal/syntax.mjs +35 -0
- package/build/import/type/template-literal/template-literal.d.mts +6 -4
- package/build/import/type/template-literal/template-literal.mjs +29 -0
- package/build/import/type/template-literal/union.d.mts +1 -0
- package/build/import/type/template-literal/union.mjs +31 -0
- package/build/import/type/transform/index.mjs +27 -0
- package/build/import/type/transform/transform.d.mts +4 -2
- package/build/import/type/transform/transform.mjs +37 -1
- package/build/import/type/tuple/index.mjs +27 -0
- package/build/import/type/tuple/tuple.d.mts +4 -3
- package/build/import/type/tuple/tuple.mjs +30 -0
- package/build/import/type/type/index.d.mts +1 -0
- package/build/import/type/type/index.mjs +34 -0
- package/build/import/type/type/javascript.d.mts +19 -0
- package/build/import/type/type/javascript.mjs +45 -0
- package/build/import/type/type/json.d.mts +66 -5
- package/build/import/type/type/json.mjs +82 -1
- package/build/import/type/type/type.mjs +30 -0
- package/build/import/type/uint8array/index.mjs +27 -0
- package/build/import/type/uint8array/uint8array.d.mts +1 -0
- package/build/import/type/uint8array/uint8array.mjs +28 -0
- package/build/import/type/undefined/index.mjs +27 -0
- package/build/import/type/undefined/undefined.d.mts +1 -0
- package/build/import/type/undefined/undefined.mjs +28 -0
- package/build/import/type/union/index.d.mts +2 -0
- package/build/import/type/union/index.mjs +29 -0
- package/build/import/type/union/union-create.d.mts +3 -0
- package/build/import/type/union/union-create.mjs +32 -0
- package/build/import/type/union/union-evaluated.d.mts +17 -0
- package/build/import/type/union/union-evaluated.mjs +68 -0
- package/build/import/type/union/union-type.d.mts +12 -0
- package/build/import/type/union/union-type.mjs +28 -0
- package/build/import/type/union/union.d.mts +4 -13
- package/build/import/type/union/union.mjs +32 -10
- package/build/import/type/unknown/index.mjs +27 -0
- package/build/import/type/unknown/unknown.d.mts +1 -0
- package/build/import/type/unknown/unknown.mjs +28 -0
- package/build/import/type/unsafe/index.mjs +27 -0
- package/build/import/type/unsafe/unsafe.d.mts +1 -0
- package/build/import/type/unsafe/unsafe.mjs +28 -0
- package/build/import/type/void/index.mjs +27 -0
- package/build/import/type/void/void.d.mts +1 -0
- package/build/import/type/void/void.mjs +28 -0
- package/build/import/value/cast/cast.d.mts +2 -0
- package/build/import/value/cast/cast.mjs +55 -0
- package/build/import/value/cast/index.mjs +27 -0
- package/build/import/value/check/check.d.mts +2 -0
- package/build/import/value/check/check.mjs +46 -1
- package/build/import/value/check/index.mjs +27 -0
- package/build/import/value/clean/clean.d.mts +2 -0
- package/build/import/value/clean/clean.mjs +39 -1
- package/build/import/value/clean/index.mjs +27 -0
- package/build/import/value/clone/clone.d.mts +1 -0
- package/build/import/value/clone/clone.mjs +34 -0
- package/build/import/value/clone/index.mjs +27 -0
- package/build/import/value/convert/convert.d.mts +2 -0
- package/build/import/value/convert/convert.mjs +57 -1
- package/build/import/value/convert/index.mjs +27 -0
- package/build/import/value/create/create.d.mts +2 -0
- package/build/import/value/create/create.mjs +44 -0
- package/build/import/value/create/index.mjs +27 -0
- package/build/import/value/default/default.d.mts +2 -0
- package/build/import/value/default/default.mjs +46 -0
- package/build/import/value/default/index.mjs +27 -0
- package/build/import/value/delta/delta.d.mts +1 -1
- package/build/import/value/delta/delta.mjs +42 -0
- package/build/import/value/delta/index.mjs +27 -0
- package/build/import/value/deref/deref.d.mts +1 -0
- package/build/import/value/deref/deref.mjs +28 -0
- package/build/import/value/deref/index.mjs +27 -0
- package/build/import/value/equal/equal.d.mts +1 -0
- package/build/import/value/equal/equal.mjs +34 -0
- package/build/import/value/equal/index.mjs +27 -0
- package/build/import/value/guard/guard.d.mts +20 -0
- package/build/import/value/guard/guard.mjs +57 -0
- package/build/import/value/guard/index.mjs +27 -0
- package/build/import/value/hash/hash.d.mts +1 -0
- package/build/import/value/hash/hash.mjs +46 -0
- package/build/import/value/hash/index.mjs +27 -0
- package/build/import/value/index.mjs +39 -0
- package/build/import/value/mutate/index.mjs +27 -0
- package/build/import/value/mutate/mutate.d.mts +1 -0
- package/build/import/value/mutate/mutate.mjs +38 -0
- package/build/import/value/pointer/index.mjs +27 -0
- package/build/import/value/pointer/pointer.d.mts +5 -0
- package/build/import/value/pointer/pointer.mjs +45 -0
- package/build/import/value/transform/decode.d.mts +5 -0
- package/build/import/value/transform/decode.mjs +50 -0
- package/build/import/value/transform/encode.d.mts +6 -0
- package/build/import/value/transform/encode.mjs +52 -0
- package/build/import/value/transform/has.d.mts +1 -0
- package/build/import/value/transform/has.mjs +43 -0
- package/build/import/value/transform/index.mjs +27 -0
- package/build/import/value/value/index.mjs +27 -0
- package/build/import/value/value/value.d.mts +24 -0
- package/build/import/value/value/value.mjs +42 -0
- package/build/require/compiler/compiler.d.ts +9 -0
- package/build/require/compiler/compiler.js +87 -6
- package/build/require/compiler/index.js +27 -0
- package/build/require/errors/errors.d.ts +3 -0
- package/build/require/errors/errors.js +55 -3
- package/build/require/errors/function.d.ts +3 -0
- package/build/require/errors/function.js +31 -0
- package/build/require/errors/index.js +27 -0
- package/build/require/index.d.ts +2 -2
- package/build/require/index.js +41 -2
- package/build/require/system/index.js +27 -0
- package/build/require/system/policy.d.ts +10 -0
- package/build/require/system/policy.js +40 -0
- package/build/require/system/system.d.ts +3 -0
- package/build/require/system/system.js +36 -0
- package/build/require/type/any/any.d.ts +1 -0
- package/build/require/type/any/any.js +28 -0
- package/build/require/type/any/index.js +27 -0
- package/build/require/type/array/array.d.ts +8 -1
- package/build/require/type/array/array.js +28 -0
- package/build/require/type/array/index.js +27 -0
- package/build/require/type/async-iterator/async-iterator.d.ts +1 -0
- package/build/require/type/async-iterator/async-iterator.js +28 -0
- package/build/require/type/async-iterator/index.js +27 -0
- package/build/require/type/awaited/awaited.d.ts +1 -0
- package/build/require/type/awaited/awaited.js +37 -0
- package/build/require/type/awaited/index.js +27 -0
- package/build/require/type/bigint/bigint.d.ts +1 -0
- package/build/require/type/bigint/bigint.js +28 -0
- package/build/require/type/bigint/index.js +27 -0
- package/build/require/type/boolean/boolean.d.ts +1 -0
- package/build/require/type/boolean/boolean.js +28 -0
- package/build/require/type/boolean/index.js +27 -0
- package/build/require/type/clone/index.js +27 -0
- package/build/require/type/clone/type.d.ts +2 -0
- package/build/require/type/clone/type.js +29 -0
- package/build/require/type/clone/value.d.ts +1 -0
- package/build/require/type/clone/value.js +29 -0
- package/build/require/type/composite/composite.d.ts +1 -0
- package/build/require/type/composite/composite.js +28 -0
- package/build/require/type/composite/index.js +27 -0
- package/build/require/type/const/const.d.ts +2 -1
- package/build/require/type/const/const.js +32 -1
- package/build/require/type/const/index.js +27 -0
- package/build/require/type/constructor/constructor.d.ts +5 -4
- package/build/require/type/constructor/constructor.js +28 -0
- package/build/require/type/constructor/index.js +27 -0
- package/build/require/type/constructor-parameters/constructor-parameters.d.ts +1 -0
- package/build/require/type/constructor-parameters/constructor-parameters.js +28 -0
- package/build/require/type/constructor-parameters/index.js +27 -0
- package/build/require/type/date/date.d.ts +6 -0
- package/build/require/type/date/date.js +28 -0
- package/build/require/type/date/index.js +27 -0
- package/build/require/type/deref/deref.d.ts +1 -0
- package/build/require/type/deref/deref.js +45 -0
- package/build/require/type/deref/index.js +27 -0
- package/build/require/type/discard/discard.js +27 -0
- package/build/require/type/discard/index.js +27 -0
- package/build/require/type/enum/enum.d.ts +1 -0
- package/build/require/type/enum/enum.js +28 -0
- package/build/require/type/enum/index.js +27 -0
- package/build/require/type/exclude/exclude-from-mapped-result.js +30 -0
- package/build/require/type/exclude/exclude.d.ts +5 -3
- package/build/require/type/exclude/exclude.js +30 -0
- package/build/require/type/exclude/index.js +27 -0
- package/build/require/type/extends/extends-check.js +200 -1
- package/build/require/type/extends/extends-from-mapped-key.js +31 -0
- package/build/require/type/extends/extends-from-mapped-result.js +30 -0
- package/build/require/type/extends/extends-undefined.d.ts +1 -0
- package/build/require/type/extends/extends-undefined.js +30 -0
- package/build/require/type/extends/extends.d.ts +3 -0
- package/build/require/type/extends/extends.js +39 -5
- package/build/require/type/extends/index.js +27 -0
- package/build/require/type/extract/extract-from-mapped-result.js +30 -0
- package/build/require/type/extract/extract.d.ts +5 -3
- package/build/require/type/extract/extract.js +30 -0
- package/build/require/type/extract/index.js +27 -0
- package/build/require/type/function/function.d.ts +5 -4
- package/build/require/type/function/function.js +28 -0
- package/build/require/type/function/index.js +27 -0
- package/build/require/type/guard/index.js +27 -0
- package/build/require/type/guard/type.d.ts +46 -0
- package/build/require/type/guard/type.js +111 -1
- package/build/require/type/guard/value.d.ts +14 -0
- package/build/require/type/guard/value.js +41 -0
- package/build/require/type/helpers/helpers.d.ts +1 -0
- package/build/require/type/helpers/helpers.js +28 -0
- package/build/require/type/helpers/index.js +27 -0
- package/build/require/type/index.js +27 -0
- package/build/require/type/indexed/index.js +27 -0
- package/build/require/type/indexed/indexed-from-mapped-key.js +35 -1
- package/build/require/type/indexed/indexed-property-keys.d.ts +1 -0
- package/build/require/type/indexed/indexed-property-keys.js +36 -0
- package/build/require/type/indexed/indexed-result.d.ts +6 -6
- package/build/require/type/indexed/indexed-result.js +46 -4
- package/build/require/type/indexed/indexed.d.ts +3 -0
- package/build/require/type/indexed/indexed.js +37 -4
- package/build/require/type/instance-type/index.js +27 -0
- package/build/require/type/instance-type/instance-type.d.ts +1 -0
- package/build/require/type/instance-type/instance-type.js +28 -0
- package/build/require/type/integer/index.js +27 -0
- package/build/require/type/integer/integer.d.ts +1 -0
- package/build/require/type/integer/integer.js +28 -0
- package/build/require/type/intersect/index.d.ts +2 -0
- package/build/require/type/intersect/index.js +29 -0
- package/build/require/type/intersect/intersect-create.d.ts +3 -0
- package/build/require/type/intersect/intersect-create.js +51 -0
- package/build/require/type/intersect/intersect-evaluated.d.ts +17 -0
- package/build/require/type/intersect/intersect-evaluated.js +75 -0
- package/build/require/type/intersect/intersect-type.d.ts +15 -0
- package/build/require/type/intersect/intersect-type.js +30 -0
- package/build/require/type/intersect/intersect.d.ts +5 -20
- package/build/require/type/intersect/intersect.js +37 -18
- package/build/require/type/intrinsic/capitalize.d.ts +1 -0
- package/build/require/type/intrinsic/capitalize.js +28 -0
- package/build/require/type/intrinsic/index.js +27 -0
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +31 -0
- package/build/require/type/intrinsic/intrinsic.d.ts +2 -0
- package/build/require/type/intrinsic/intrinsic.js +43 -1
- package/build/require/type/intrinsic/lowercase.d.ts +1 -0
- package/build/require/type/intrinsic/lowercase.js +28 -0
- package/build/require/type/intrinsic/uncapitalize.d.ts +1 -0
- package/build/require/type/intrinsic/uncapitalize.js +28 -0
- package/build/require/type/intrinsic/uppercase.d.ts +1 -0
- package/build/require/type/intrinsic/uppercase.js +28 -0
- package/build/require/type/iterator/index.js +27 -0
- package/build/require/type/iterator/iterator.d.ts +1 -0
- package/build/require/type/iterator/iterator.js +28 -0
- package/build/require/type/keyof/index.js +27 -0
- package/build/require/type/keyof/keyof-from-mapped-result.js +30 -0
- package/build/require/type/keyof/keyof-property-keys.d.ts +2 -0
- package/build/require/type/keyof/keyof-property-keys.js +47 -0
- package/build/require/type/keyof/keyof.d.ts +4 -2
- package/build/require/type/keyof/keyof.js +34 -1
- package/build/require/type/literal/index.js +27 -0
- package/build/require/type/literal/literal.d.ts +1 -0
- package/build/require/type/literal/literal.js +28 -0
- package/build/require/type/mapped/index.js +27 -0
- package/build/require/type/mapped/mapped-key.js +28 -0
- package/build/require/type/mapped/mapped-result.js +28 -0
- package/build/require/type/mapped/mapped.d.ts +2 -0
- package/build/require/type/mapped/mapped.js +63 -19
- package/build/require/type/modifiers/index.js +27 -0
- package/build/require/type/modifiers/modifiers.js +37 -0
- package/build/require/type/never/index.js +27 -0
- package/build/require/type/never/never.d.ts +1 -0
- package/build/require/type/never/never.js +28 -0
- package/build/require/type/not/index.js +27 -0
- package/build/require/type/not/not.d.ts +1 -0
- package/build/require/type/not/not.js +28 -0
- package/build/require/type/null/index.js +27 -0
- package/build/require/type/null/null.d.ts +1 -0
- package/build/require/type/null/null.js +28 -0
- package/build/require/type/number/index.js +27 -0
- package/build/require/type/number/number.d.ts +1 -0
- package/build/require/type/number/number.js +28 -0
- package/build/require/type/object/index.js +27 -0
- package/build/require/type/object/object.d.ts +10 -5
- package/build/require/type/object/object.js +33 -0
- package/build/require/type/omit/index.js +27 -0
- package/build/require/type/omit/omit-from-mapped-key.js +31 -0
- package/build/require/type/omit/omit.d.ts +3 -0
- package/build/require/type/omit/omit.js +39 -0
- package/build/require/type/operators/index.js +27 -0
- package/build/require/type/operators/operators.d.ts +8 -0
- package/build/require/type/operators/operators.js +42 -0
- package/build/require/type/optional/index.js +27 -0
- package/build/require/type/optional/optional.d.ts +1 -0
- package/build/require/type/optional/optional.js +28 -0
- package/build/require/type/parameters/index.js +27 -0
- package/build/require/type/parameters/parameters.d.ts +1 -0
- package/build/require/type/parameters/parameters.js +28 -0
- package/build/require/type/partial/index.js +27 -0
- package/build/require/type/partial/partial-from-mapped-result.js +30 -0
- package/build/require/type/partial/partial.d.ts +2 -0
- package/build/require/type/partial/partial.js +36 -0
- package/build/require/type/patterns/index.js +27 -0
- package/build/require/type/patterns/patterns.js +27 -0
- package/build/require/type/pick/index.js +27 -0
- package/build/require/type/pick/pick-from-mapped-key.js +31 -0
- package/build/require/type/pick/pick.d.ts +3 -0
- package/build/require/type/pick/pick.js +34 -0
- package/build/require/type/promise/index.js +27 -0
- package/build/require/type/promise/promise.d.ts +1 -0
- package/build/require/type/promise/promise.js +28 -0
- package/build/require/type/readonly/index.js +27 -0
- package/build/require/type/readonly/readonly.d.ts +1 -0
- package/build/require/type/readonly/readonly.js +28 -0
- package/build/require/type/readonly-optional/index.js +27 -0
- package/build/require/type/readonly-optional/readonly-optional.d.ts +1 -0
- package/build/require/type/readonly-optional/readonly-optional.js +28 -0
- package/build/require/type/record/index.js +27 -0
- package/build/require/type/record/record.d.ts +1 -1
- package/build/require/type/record/record.js +49 -2
- package/build/require/type/recursive/index.js +27 -0
- package/build/require/type/recursive/recursive.d.ts +4 -2
- package/build/require/type/recursive/recursive.js +31 -5
- package/build/require/type/ref/index.js +27 -0
- package/build/require/type/ref/ref.d.ts +2 -0
- package/build/require/type/ref/ref.js +28 -0
- package/build/require/type/regexp/index.js +27 -0
- package/build/require/type/regexp/regexp.d.ts +2 -0
- package/build/require/type/regexp/regexp.js +28 -0
- package/build/require/type/registry/format.d.ts +6 -0
- package/build/require/type/registry/format.js +34 -0
- package/build/require/type/registry/index.js +27 -0
- package/build/require/type/registry/type.d.ts +6 -0
- package/build/require/type/registry/type.js +34 -0
- package/build/require/type/required/index.js +27 -0
- package/build/require/type/required/required-from-mapped-result.js +30 -0
- package/build/require/type/required/required.d.ts +2 -0
- package/build/require/type/required/required.js +36 -0
- package/build/require/type/rest/index.js +27 -0
- package/build/require/type/rest/rest.d.ts +1 -0
- package/build/require/type/rest/rest.js +32 -0
- package/build/require/type/return-type/index.js +27 -0
- package/build/require/type/return-type/return-type.d.ts +1 -0
- package/build/require/type/return-type/return-type.js +28 -0
- package/build/require/type/schema/anyschema.js +27 -0
- package/build/require/type/schema/index.js +27 -0
- package/build/require/type/schema/schema.d.ts +7 -0
- package/build/require/type/schema/schema.js +27 -0
- package/build/require/type/static/index.js +27 -0
- package/build/require/type/static/static.d.ts +3 -0
- package/build/require/type/static/static.js +27 -0
- package/build/require/type/strict/index.js +27 -0
- package/build/require/type/strict/strict.d.ts +1 -0
- package/build/require/type/strict/strict.js +28 -0
- package/build/require/type/string/index.js +27 -0
- package/build/require/type/string/string.d.ts +7 -0
- package/build/require/type/string/string.js +28 -0
- package/build/require/type/symbol/index.js +27 -0
- package/build/require/type/symbol/symbol.d.ts +1 -0
- package/build/require/type/symbol/symbol.js +28 -0
- package/build/require/type/symbols/index.js +27 -0
- package/build/require/type/symbols/symbols.d.ts +5 -0
- package/build/require/type/symbols/symbols.js +32 -0
- package/build/require/type/template-literal/finite.js +37 -0
- package/build/require/type/template-literal/generate.js +37 -0
- package/build/require/type/template-literal/index.js +27 -0
- package/build/require/type/template-literal/parser.d.ts +2 -0
- package/build/require/type/template-literal/parser.js +44 -0
- package/build/require/type/template-literal/pattern.js +38 -0
- package/build/require/type/template-literal/syntax.d.ts +5 -4
- package/build/require/type/template-literal/syntax.js +35 -0
- package/build/require/type/template-literal/template-literal.d.ts +6 -4
- package/build/require/type/template-literal/template-literal.js +29 -0
- package/build/require/type/template-literal/union.d.ts +1 -0
- package/build/require/type/template-literal/union.js +31 -0
- package/build/require/type/transform/index.js +27 -0
- package/build/require/type/transform/transform.d.ts +4 -2
- package/build/require/type/transform/transform.js +40 -4
- package/build/require/type/tuple/index.js +27 -0
- package/build/require/type/tuple/tuple.d.ts +4 -3
- package/build/require/type/tuple/tuple.js +30 -0
- package/build/require/type/type/index.d.ts +1 -0
- package/build/require/type/type/index.js +34 -0
- package/build/require/type/type/javascript.d.ts +19 -0
- package/build/require/type/type/javascript.js +45 -0
- package/build/require/type/type/json.d.ts +66 -5
- package/build/require/type/type/json.js +82 -1
- package/build/require/type/type/type.js +30 -0
- package/build/require/type/uint8array/index.js +27 -0
- package/build/require/type/uint8array/uint8array.d.ts +1 -0
- package/build/require/type/uint8array/uint8array.js +28 -0
- package/build/require/type/undefined/index.js +27 -0
- package/build/require/type/undefined/undefined.d.ts +1 -0
- package/build/require/type/undefined/undefined.js +28 -0
- package/build/require/type/union/index.d.ts +2 -0
- package/build/require/type/union/index.js +29 -0
- package/build/require/type/union/union-create.d.ts +3 -0
- package/build/require/type/union/union-create.js +36 -0
- package/build/require/type/union/union-evaluated.d.ts +17 -0
- package/build/require/type/union/union-evaluated.js +72 -0
- package/build/require/type/union/union-type.d.ts +12 -0
- package/build/require/type/union/union-type.js +30 -0
- package/build/require/type/union/union.d.ts +4 -13
- package/build/require/type/union/union.js +32 -11
- package/build/require/type/unknown/index.js +27 -0
- package/build/require/type/unknown/unknown.d.ts +1 -0
- package/build/require/type/unknown/unknown.js +28 -0
- package/build/require/type/unsafe/index.js +27 -0
- package/build/require/type/unsafe/unsafe.d.ts +1 -0
- package/build/require/type/unsafe/unsafe.js +28 -0
- package/build/require/type/void/index.js +27 -0
- package/build/require/type/void/void.d.ts +1 -0
- package/build/require/type/void/void.js +28 -0
- package/build/require/value/cast/cast.d.ts +2 -0
- package/build/require/value/cast/cast.js +55 -0
- package/build/require/value/cast/index.js +27 -0
- package/build/require/value/check/check.d.ts +2 -0
- package/build/require/value/check/check.js +46 -1
- package/build/require/value/check/index.js +27 -0
- package/build/require/value/clean/clean.d.ts +2 -0
- package/build/require/value/clean/clean.js +39 -1
- package/build/require/value/clean/index.js +27 -0
- package/build/require/value/clone/clone.d.ts +1 -0
- package/build/require/value/clone/clone.js +34 -0
- package/build/require/value/clone/index.js +27 -0
- package/build/require/value/convert/convert.d.ts +2 -0
- package/build/require/value/convert/convert.js +57 -1
- package/build/require/value/convert/index.js +27 -0
- package/build/require/value/create/create.d.ts +2 -0
- package/build/require/value/create/create.js +44 -0
- package/build/require/value/create/index.js +27 -0
- package/build/require/value/default/default.d.ts +2 -0
- package/build/require/value/default/default.js +46 -0
- package/build/require/value/default/index.js +27 -0
- package/build/require/value/delta/delta.d.ts +1 -1
- package/build/require/value/delta/delta.js +42 -0
- package/build/require/value/delta/index.js +27 -0
- package/build/require/value/deref/deref.d.ts +1 -0
- package/build/require/value/deref/deref.js +28 -0
- package/build/require/value/deref/index.js +27 -0
- package/build/require/value/equal/equal.d.ts +1 -0
- package/build/require/value/equal/equal.js +34 -0
- package/build/require/value/equal/index.js +27 -0
- package/build/require/value/guard/guard.d.ts +20 -0
- package/build/require/value/guard/guard.js +57 -0
- package/build/require/value/guard/index.js +27 -0
- package/build/require/value/hash/hash.d.ts +1 -0
- package/build/require/value/hash/hash.js +46 -0
- package/build/require/value/hash/index.js +27 -0
- package/build/require/value/index.js +39 -0
- package/build/require/value/mutate/index.js +27 -0
- package/build/require/value/mutate/mutate.d.ts +1 -0
- package/build/require/value/mutate/mutate.js +38 -0
- package/build/require/value/pointer/index.js +27 -0
- package/build/require/value/pointer/pointer.d.ts +5 -0
- package/build/require/value/pointer/pointer.js +45 -0
- package/build/require/value/transform/decode.d.ts +5 -0
- package/build/require/value/transform/decode.js +50 -0
- package/build/require/value/transform/encode.d.ts +6 -0
- package/build/require/value/transform/encode.js +52 -0
- package/build/require/value/transform/has.d.ts +1 -0
- package/build/require/value/transform/has.js +43 -0
- package/build/require/value/transform/index.js +27 -0
- package/build/require/value/value/index.js +27 -0
- package/build/require/value/value/value.d.ts +24 -0
- package/build/require/value/value/value.js +42 -0
- package/package.json +1 -1
- package/readme.md +27 -20
|
@@ -9,10 +9,15 @@ export declare class TypeCheck<T extends TSchema> {
|
|
|
9
9
|
private readonly code;
|
|
10
10
|
private readonly hasTransform;
|
|
11
11
|
constructor(schema: T, references: TSchema[], checkFunc: CheckFunction, code: string);
|
|
12
|
+
/** Returns the generated assertion code used to validate this type. */
|
|
12
13
|
Code(): string;
|
|
14
|
+
/** Returns an iterator for each error in this value. */
|
|
13
15
|
Errors(value: unknown): ValueErrorIterator;
|
|
16
|
+
/** Returns true if the value matches the compiled type. */
|
|
14
17
|
Check(value: unknown): value is Static<T>;
|
|
18
|
+
/** Decodes a value or throws if error */
|
|
15
19
|
Decode(value: unknown): StaticDecode<T>;
|
|
20
|
+
/** Encodes a value or throws if error */
|
|
16
21
|
Encode(value: unknown): StaticEncode<T>;
|
|
17
22
|
}
|
|
18
23
|
export declare class TypeCompilerUnknownTypeError extends Error {
|
|
@@ -34,8 +39,12 @@ export type TypeCompilerLanguageOption = 'typescript' | 'javascript';
|
|
|
34
39
|
export interface TypeCompilerCodegenOptions {
|
|
35
40
|
language?: TypeCompilerLanguageOption;
|
|
36
41
|
}
|
|
42
|
+
/** Compiles Types for Runtime Type Checking */
|
|
37
43
|
export declare namespace TypeCompiler {
|
|
44
|
+
/** Generates the code used to assert this type and returns it as a string */
|
|
38
45
|
function Code<T extends TSchema>(schema: T, references: TSchema[], options?: TypeCompilerCodegenOptions): string;
|
|
46
|
+
/** Generates the code used to assert this type and returns it as a string */
|
|
39
47
|
function Code<T extends TSchema>(schema: T, options?: TypeCompilerCodegenOptions): string;
|
|
48
|
+
/** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */
|
|
40
49
|
function Compile<T extends TSchema>(schema: T, references?: TSchema[]): TypeCheck<T>;
|
|
41
50
|
}
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox/compiler
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
1
28
|
import { TransformEncode, TransformDecode, HasTransform, TransformDecodeCheckError, TransformEncodeCheckError } from '../value/transform/index.mjs';
|
|
2
29
|
import { IsArray, IsString, IsNumber, IsBigInt } from '../value/guard/index.mjs';
|
|
3
30
|
import { Errors } from '../errors/index.mjs';
|
|
@@ -10,6 +37,9 @@ import { TypeRegistry, FormatRegistry } from '../type/registry/index.mjs';
|
|
|
10
37
|
import { KeyOfPattern } from '../type/keyof/index.mjs';
|
|
11
38
|
import { ExtendsUndefinedCheck } from '../type/extends/extends-undefined.mjs';
|
|
12
39
|
import { Never } from '../type/never/index.mjs';
|
|
40
|
+
// ------------------------------------------------------------------
|
|
41
|
+
// TypeCheck
|
|
42
|
+
// ------------------------------------------------------------------
|
|
13
43
|
export class TypeCheck {
|
|
14
44
|
schema;
|
|
15
45
|
references;
|
|
@@ -23,20 +53,25 @@ export class TypeCheck {
|
|
|
23
53
|
this.code = code;
|
|
24
54
|
this.hasTransform = HasTransform(schema, references);
|
|
25
55
|
}
|
|
56
|
+
/** Returns the generated assertion code used to validate this type. */
|
|
26
57
|
Code() {
|
|
27
58
|
return this.code;
|
|
28
59
|
}
|
|
60
|
+
/** Returns an iterator for each error in this value. */
|
|
29
61
|
Errors(value) {
|
|
30
62
|
return Errors(this.schema, this.references, value);
|
|
31
63
|
}
|
|
64
|
+
/** Returns true if the value matches the compiled type. */
|
|
32
65
|
Check(value) {
|
|
33
66
|
return this.checkFunc(value);
|
|
34
67
|
}
|
|
68
|
+
/** Decodes a value or throws if error */
|
|
35
69
|
Decode(value) {
|
|
36
70
|
if (!this.checkFunc(value))
|
|
37
71
|
throw new TransformDecodeCheckError(this.schema, value, this.Errors(value).First());
|
|
38
72
|
return this.hasTransform ? TransformDecode(this.schema, this.references, value) : value;
|
|
39
73
|
}
|
|
74
|
+
/** Encodes a value or throws if error */
|
|
40
75
|
Encode(value) {
|
|
41
76
|
const encoded = this.hasTransform ? TransformEncode(this.schema, this.references, value) : value;
|
|
42
77
|
if (!this.checkFunc(encoded))
|
|
@@ -44,6 +79,9 @@ export class TypeCheck {
|
|
|
44
79
|
return encoded;
|
|
45
80
|
}
|
|
46
81
|
}
|
|
82
|
+
// ------------------------------------------------------------------
|
|
83
|
+
// Character
|
|
84
|
+
// ------------------------------------------------------------------
|
|
47
85
|
var Character;
|
|
48
86
|
(function (Character) {
|
|
49
87
|
function DollarSign(code) {
|
|
@@ -63,6 +101,9 @@ var Character;
|
|
|
63
101
|
}
|
|
64
102
|
Character.IsNumeric = IsNumeric;
|
|
65
103
|
})(Character || (Character = {}));
|
|
104
|
+
// ------------------------------------------------------------------
|
|
105
|
+
// MemberExpression
|
|
106
|
+
// ------------------------------------------------------------------
|
|
66
107
|
var MemberExpression;
|
|
67
108
|
(function (MemberExpression) {
|
|
68
109
|
function IsFirstCharacterNumeric(value) {
|
|
@@ -89,6 +130,9 @@ var MemberExpression;
|
|
|
89
130
|
}
|
|
90
131
|
MemberExpression.Encode = Encode;
|
|
91
132
|
})(MemberExpression || (MemberExpression = {}));
|
|
133
|
+
// ------------------------------------------------------------------
|
|
134
|
+
// Identifier
|
|
135
|
+
// ------------------------------------------------------------------
|
|
92
136
|
var Identifier;
|
|
93
137
|
(function (Identifier) {
|
|
94
138
|
function Encode($id) {
|
|
@@ -106,6 +150,9 @@ var Identifier;
|
|
|
106
150
|
}
|
|
107
151
|
Identifier.Encode = Encode;
|
|
108
152
|
})(Identifier || (Identifier = {}));
|
|
153
|
+
// ------------------------------------------------------------------
|
|
154
|
+
// LiteralString
|
|
155
|
+
// ------------------------------------------------------------------
|
|
109
156
|
var LiteralString;
|
|
110
157
|
(function (LiteralString) {
|
|
111
158
|
function Escape(content) {
|
|
@@ -113,6 +160,9 @@ var LiteralString;
|
|
|
113
160
|
}
|
|
114
161
|
LiteralString.Escape = Escape;
|
|
115
162
|
})(LiteralString || (LiteralString = {}));
|
|
163
|
+
// ------------------------------------------------------------------
|
|
164
|
+
// Errors
|
|
165
|
+
// ------------------------------------------------------------------
|
|
116
166
|
export class TypeCompilerUnknownTypeError extends Error {
|
|
117
167
|
schema;
|
|
118
168
|
constructor(schema) {
|
|
@@ -127,6 +177,9 @@ export class TypeCompilerTypeGuardError extends Error {
|
|
|
127
177
|
this.schema = schema;
|
|
128
178
|
}
|
|
129
179
|
}
|
|
180
|
+
// ------------------------------------------------------------------
|
|
181
|
+
// Policy
|
|
182
|
+
// ------------------------------------------------------------------
|
|
130
183
|
export var Policy;
|
|
131
184
|
(function (Policy) {
|
|
132
185
|
function IsExactOptionalProperty(value, key, expression) {
|
|
@@ -152,11 +205,18 @@ export var Policy;
|
|
|
152
205
|
}
|
|
153
206
|
Policy.IsVoidLike = IsVoidLike;
|
|
154
207
|
})(Policy || (Policy = {}));
|
|
208
|
+
/** Compiles Types for Runtime Type Checking */
|
|
155
209
|
export var TypeCompiler;
|
|
156
210
|
(function (TypeCompiler) {
|
|
211
|
+
// ----------------------------------------------------------------
|
|
212
|
+
// Guards
|
|
213
|
+
// ----------------------------------------------------------------
|
|
157
214
|
function IsAnyOrUnknown(schema) {
|
|
158
215
|
return schema[Kind] === 'Any' || schema[Kind] === 'Unknown';
|
|
159
216
|
}
|
|
217
|
+
// ----------------------------------------------------------------
|
|
218
|
+
// Types
|
|
219
|
+
// ----------------------------------------------------------------
|
|
160
220
|
function* TAny(schema, references, value) {
|
|
161
221
|
yield 'true';
|
|
162
222
|
}
|
|
@@ -338,6 +398,8 @@ export var TypeCompiler;
|
|
|
338
398
|
}
|
|
339
399
|
function* TRef(schema, references, value) {
|
|
340
400
|
const target = Deref(schema, references);
|
|
401
|
+
// Reference: If we have seen this reference before we can just yield and return the function call.
|
|
402
|
+
// If this isn't the case we defer to visit to generate and set the function for subsequent passes.
|
|
341
403
|
if (state.functions.has(schema.$ref))
|
|
342
404
|
return yield `${CreateFunctionName(schema.$ref)}(${value})`;
|
|
343
405
|
yield* Visit(target, references, value);
|
|
@@ -365,6 +427,7 @@ export var TypeCompiler;
|
|
|
365
427
|
yield `${variable}.test(${value})`;
|
|
366
428
|
}
|
|
367
429
|
function* TThis(schema, references, value) {
|
|
430
|
+
// Note: This types are assured to be hoisted prior to this call. Just yield the function.
|
|
368
431
|
yield `${CreateFunctionName(schema.$ref)}(${value})`;
|
|
369
432
|
}
|
|
370
433
|
function* TTuple(schema, references, value) {
|
|
@@ -405,6 +468,9 @@ export var TypeCompiler;
|
|
|
405
468
|
function* Visit(schema, references, value, useHoisting = true) {
|
|
406
469
|
const references_ = IsString(schema.$id) ? [...references, schema] : references;
|
|
407
470
|
const schema_ = schema;
|
|
471
|
+
// --------------------------------------------------------------
|
|
472
|
+
// Hoisting
|
|
473
|
+
// --------------------------------------------------------------
|
|
408
474
|
if (useHoisting && IsString(schema.$id)) {
|
|
409
475
|
const functionName = CreateFunctionName(schema.$id);
|
|
410
476
|
if (state.functions.has(functionName)) {
|
|
@@ -483,12 +549,19 @@ export var TypeCompiler;
|
|
|
483
549
|
return yield* TKind(schema_, references_, value);
|
|
484
550
|
}
|
|
485
551
|
}
|
|
552
|
+
// ----------------------------------------------------------------
|
|
553
|
+
// Compiler State
|
|
554
|
+
// ----------------------------------------------------------------
|
|
555
|
+
// prettier-ignore
|
|
486
556
|
const state = {
|
|
487
|
-
language: 'javascript',
|
|
488
|
-
functions: new Map(),
|
|
489
|
-
variables: new Map(),
|
|
490
|
-
instances: new Map()
|
|
557
|
+
language: 'javascript', // target language
|
|
558
|
+
functions: new Map(), // local functions
|
|
559
|
+
variables: new Map(), // local variables
|
|
560
|
+
instances: new Map() // exterior kind instances
|
|
491
561
|
};
|
|
562
|
+
// ----------------------------------------------------------------
|
|
563
|
+
// Compiler Factory
|
|
564
|
+
// ----------------------------------------------------------------
|
|
492
565
|
function CreateExpression(schema, references, value, useHoisting = true) {
|
|
493
566
|
return `(${[...Visit(schema, references, value, useHoisting)].join(' && ')})`;
|
|
494
567
|
}
|
|
@@ -514,24 +587,31 @@ export var TypeCompiler;
|
|
|
514
587
|
function CreateReturns(type) {
|
|
515
588
|
return state.language === 'typescript' ? `: ${type}` : '';
|
|
516
589
|
}
|
|
590
|
+
// ----------------------------------------------------------------
|
|
591
|
+
// Compile
|
|
592
|
+
// ----------------------------------------------------------------
|
|
517
593
|
function Build(schema, references, options) {
|
|
518
|
-
const functionCode = CreateFunction('check', schema, references, 'value');
|
|
594
|
+
const functionCode = CreateFunction('check', schema, references, 'value'); // will populate functions and variables
|
|
519
595
|
const parameter = CreateParameter('value', 'any');
|
|
520
596
|
const returns = CreateReturns('boolean');
|
|
521
597
|
const functions = [...state.functions.values()];
|
|
522
598
|
const variables = [...state.variables.values()];
|
|
523
|
-
|
|
599
|
+
// prettier-ignore
|
|
600
|
+
const checkFunction = IsString(schema.$id) // ensure top level schemas with $id's are hoisted
|
|
524
601
|
? `return function check(${parameter})${returns} {\n return ${CreateFunctionName(schema.$id)}(value)\n}`
|
|
525
602
|
: `return ${functionCode}`;
|
|
526
603
|
return [...variables, ...functions, checkFunction].join('\n');
|
|
527
604
|
}
|
|
605
|
+
/** Generates the code used to assert this type and returns it as a string */
|
|
528
606
|
function Code(...args) {
|
|
529
607
|
const defaults = { language: 'javascript' };
|
|
608
|
+
// prettier-ignore
|
|
530
609
|
const [schema, references, options] = (args.length === 2 && IsArray(args[1]) ? [args[0], args[1], defaults] :
|
|
531
610
|
args.length === 2 && !IsArray(args[1]) ? [args[0], [], args[1]] :
|
|
532
611
|
args.length === 3 ? [args[0], args[1], args[2]] :
|
|
533
612
|
args.length === 1 ? [args[0], [], defaults] :
|
|
534
613
|
[null, [], defaults]);
|
|
614
|
+
// compiler-reset
|
|
535
615
|
state.language = options.language;
|
|
536
616
|
state.variables.clear();
|
|
537
617
|
state.functions.clear();
|
|
@@ -544,6 +624,7 @@ export var TypeCompiler;
|
|
|
544
624
|
return Build(schema, references, options);
|
|
545
625
|
}
|
|
546
626
|
TypeCompiler.Code = Code;
|
|
627
|
+
/** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */
|
|
547
628
|
function Compile(schema, references = []) {
|
|
548
629
|
const generatedCode = Code(schema, references, { language: 'javascript' });
|
|
549
630
|
const compiledFunction = globalThis.Function('kind', 'format', 'hash', generatedCode);
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox/compiler
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
1
28
|
export { ValueErrorType, ValueErrorIterator } from '../errors/index.mjs';
|
|
2
29
|
export { TypeCompiler, TypeCheck, TypeCompilerTypeGuardError, TypeCompilerUnknownTypeError } from './compiler.mjs';
|
|
@@ -79,7 +79,10 @@ export declare class ValueErrorIterator {
|
|
|
79
79
|
private readonly iterator;
|
|
80
80
|
constructor(iterator: IterableIterator<ValueError>);
|
|
81
81
|
[Symbol.iterator](): IterableIterator<ValueError>;
|
|
82
|
+
/** Returns the first value error or undefined if no errors */
|
|
82
83
|
First(): ValueError | undefined;
|
|
83
84
|
}
|
|
85
|
+
/** Returns an iterator for each error in this value. */
|
|
84
86
|
export declare function Errors<T extends TSchema>(schema: T, references: TSchema[], value: unknown): ValueErrorIterator;
|
|
87
|
+
/** Returns an iterator for each error in this value. */
|
|
85
88
|
export declare function Errors<T extends TSchema>(schema: T, value: unknown): ValueErrorIterator;
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox/errors
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
1
28
|
import { IsArray, IsUint8Array, IsDate, IsPromise, IsFunction, IsAsyncIterator, IsIterator, IsBoolean, IsNumber, IsBigInt, IsString, IsSymbol, IsInteger, IsNull, IsUndefined } from '../value/guard/index.mjs';
|
|
2
29
|
import { TypeSystemPolicy } from '../system/index.mjs';
|
|
3
30
|
import { KeyOfPattern } from '../type/keyof/index.mjs';
|
|
@@ -8,6 +35,9 @@ import { Deref } from '../value/deref/index.mjs';
|
|
|
8
35
|
import { Hash } from '../value/hash/index.mjs';
|
|
9
36
|
import { Kind } from '../type/symbols/index.mjs';
|
|
10
37
|
import { Never } from '../type/never/index.mjs';
|
|
38
|
+
// --------------------------------------------------------------------------
|
|
39
|
+
// ValueErrorType
|
|
40
|
+
// --------------------------------------------------------------------------
|
|
11
41
|
export var ValueErrorType;
|
|
12
42
|
(function (ValueErrorType) {
|
|
13
43
|
ValueErrorType[ValueErrorType["ArrayContains"] = 0] = "ArrayContains";
|
|
@@ -74,6 +104,9 @@ export var ValueErrorType;
|
|
|
74
104
|
ValueErrorType[ValueErrorType["Union"] = 61] = "Union";
|
|
75
105
|
ValueErrorType[ValueErrorType["Void"] = 62] = "Void";
|
|
76
106
|
})(ValueErrorType || (ValueErrorType = {}));
|
|
107
|
+
// --------------------------------------------------------------------------
|
|
108
|
+
// ValueErrors
|
|
109
|
+
// --------------------------------------------------------------------------
|
|
77
110
|
export class ValueErrorsUnknownTypeError extends Error {
|
|
78
111
|
schema;
|
|
79
112
|
constructor(schema) {
|
|
@@ -81,12 +114,21 @@ export class ValueErrorsUnknownTypeError extends Error {
|
|
|
81
114
|
this.schema = schema;
|
|
82
115
|
}
|
|
83
116
|
}
|
|
117
|
+
// --------------------------------------------------------------------------
|
|
118
|
+
// EscapeKey
|
|
119
|
+
// --------------------------------------------------------------------------
|
|
84
120
|
function EscapeKey(key) {
|
|
85
|
-
return key.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
121
|
+
return key.replace(/~/g, '~0').replace(/\//g, '~1'); // RFC6901 Path
|
|
86
122
|
}
|
|
123
|
+
// --------------------------------------------------------------------------
|
|
124
|
+
// Guards
|
|
125
|
+
// --------------------------------------------------------------------------
|
|
87
126
|
function IsDefined(value) {
|
|
88
127
|
return value !== undefined;
|
|
89
128
|
}
|
|
129
|
+
// --------------------------------------------------------------------------
|
|
130
|
+
// ValueErrorIterator
|
|
131
|
+
// --------------------------------------------------------------------------
|
|
90
132
|
export class ValueErrorIterator {
|
|
91
133
|
iterator;
|
|
92
134
|
constructor(iterator) {
|
|
@@ -95,14 +137,21 @@ export class ValueErrorIterator {
|
|
|
95
137
|
[Symbol.iterator]() {
|
|
96
138
|
return this.iterator;
|
|
97
139
|
}
|
|
140
|
+
/** Returns the first value error or undefined if no errors */
|
|
98
141
|
First() {
|
|
99
142
|
const next = this.iterator.next();
|
|
100
143
|
return next.done ? undefined : next.value;
|
|
101
144
|
}
|
|
102
145
|
}
|
|
146
|
+
// --------------------------------------------------------------------------
|
|
147
|
+
// Create
|
|
148
|
+
// --------------------------------------------------------------------------
|
|
103
149
|
function Create(type, schema, path, value) {
|
|
104
150
|
return { type, schema, path, value, message: GetErrorFunction()(schema, type) };
|
|
105
151
|
}
|
|
152
|
+
// --------------------------------------------------------------------------
|
|
153
|
+
// Types
|
|
154
|
+
// --------------------------------------------------------------------------
|
|
106
155
|
function* TAny(schema, references, path, value) { }
|
|
107
156
|
function* TArray(schema, references, path, value) {
|
|
108
157
|
if (!IsArray(value)) {
|
|
@@ -117,6 +166,7 @@ function* TArray(schema, references, path, value) {
|
|
|
117
166
|
for (let i = 0; i < value.length; i++) {
|
|
118
167
|
yield* Visit(schema.items, references, `${path}/${i}`, value[i]);
|
|
119
168
|
}
|
|
169
|
+
// prettier-ignore
|
|
120
170
|
if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) {
|
|
121
171
|
const hashed = Hash(element);
|
|
122
172
|
if (set.has(hashed)) {
|
|
@@ -128,6 +178,7 @@ function* TArray(schema, references, path, value) {
|
|
|
128
178
|
} return true; })())) {
|
|
129
179
|
yield Create(ValueErrorType.ArrayUniqueItems, schema, path, value);
|
|
130
180
|
}
|
|
181
|
+
// contains
|
|
131
182
|
if (!(IsDefined(schema.contains) || IsDefined(schema.minContains) || IsDefined(schema.maxContains))) {
|
|
132
183
|
return;
|
|
133
184
|
}
|
|
@@ -237,7 +288,7 @@ function* TIntersect(schema, references, path, value) {
|
|
|
237
288
|
if (!keyCheck.test(valueKey)) {
|
|
238
289
|
const next = Visit(schema.unevaluatedProperties, references, `${path}/${valueKey}`, value[valueKey]).next();
|
|
239
290
|
if (!next.done)
|
|
240
|
-
yield next.value;
|
|
291
|
+
yield next.value; // yield interior
|
|
241
292
|
}
|
|
242
293
|
}
|
|
243
294
|
}
|
|
@@ -429,7 +480,7 @@ function* TUnion(schema, references, path, value) {
|
|
|
429
480
|
for (const subschema of schema.anyOf) {
|
|
430
481
|
const errors = [...Visit(subschema, references, path, value)];
|
|
431
482
|
if (errors.length === 0)
|
|
432
|
-
return;
|
|
483
|
+
return; // matched
|
|
433
484
|
count += errors.length;
|
|
434
485
|
}
|
|
435
486
|
if (count > 0) {
|
|
@@ -526,6 +577,7 @@ function* Visit(schema, references, path, value) {
|
|
|
526
577
|
return yield* TKind(schema_, references_, path, value);
|
|
527
578
|
}
|
|
528
579
|
}
|
|
580
|
+
/** Returns an iterator for each error in this value. */
|
|
529
581
|
export function Errors(...args) {
|
|
530
582
|
const iterator = args.length === 3 ? Visit(args[0], args[1], '', args[2]) : Visit(args[0], [], '', args[1]);
|
|
531
583
|
return new ValueErrorIterator(iterator);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { TSchema } from '../type/schema/index.mjs';
|
|
2
2
|
import { ValueErrorType } from './errors.mjs';
|
|
3
|
+
/** Creates an error message using en-US as the default locale */
|
|
3
4
|
export declare function DefaultErrorFunction(schema: TSchema, errorType: ValueErrorType): string;
|
|
4
5
|
export type ErrorFunction = (schema: TSchema, type: ValueErrorType) => string;
|
|
6
|
+
/** Sets the error function used to generate error messages */
|
|
5
7
|
export declare function SetErrorFunction(callback: ErrorFunction): void;
|
|
8
|
+
/** Gets the error function used to generate error messages */
|
|
6
9
|
export declare function GetErrorFunction(): ErrorFunction;
|
|
@@ -1,5 +1,33 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox/system
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
1
28
|
import { Kind } from '../type/symbols/index.mjs';
|
|
2
29
|
import { ValueErrorType } from './errors.mjs';
|
|
30
|
+
/** Creates an error message using en-US as the default locale */
|
|
3
31
|
export function DefaultErrorFunction(schema, errorType) {
|
|
4
32
|
switch (errorType) {
|
|
5
33
|
case ValueErrorType.ArrayContains:
|
|
@@ -132,10 +160,13 @@ export function DefaultErrorFunction(schema, errorType) {
|
|
|
132
160
|
return 'Unknown error type';
|
|
133
161
|
}
|
|
134
162
|
}
|
|
163
|
+
/** Manages error message providers */
|
|
135
164
|
let errorFunction = DefaultErrorFunction;
|
|
165
|
+
/** Sets the error function used to generate error messages */
|
|
136
166
|
export function SetErrorFunction(callback) {
|
|
137
167
|
errorFunction = callback;
|
|
138
168
|
}
|
|
169
|
+
/** Gets the error function used to generate error messages */
|
|
139
170
|
export function GetErrorFunction() {
|
|
140
171
|
return errorFunction;
|
|
141
172
|
}
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox/errors
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
1
28
|
export { Errors, ValueErrorIterator, ValueErrorType, ValueErrorsUnknownTypeError } from './errors.mjs';
|
|
2
29
|
export { DefaultErrorFunction, GetErrorFunction, SetErrorFunction } from './function.mjs';
|
package/build/import/index.d.mts
CHANGED
|
@@ -24,7 +24,7 @@ export { Increment, type Assert, type AssertType, type AssertRest, type AssertPr
|
|
|
24
24
|
export { Index, IndexPropertyKeys, IndexFromMappedKey, type TIndex, type TIndexPropertyKeys, type TIndexFromMappedKey } from './type/indexed/index.mjs';
|
|
25
25
|
export { InstanceType, type TInstanceType } from './type/instance-type/index.mjs';
|
|
26
26
|
export { Integer, type TInteger, type IntegerOptions } from './type/integer/index.mjs';
|
|
27
|
-
export { Intersect, type TIntersect, type IntersectOptions } from './type/intersect/index.mjs';
|
|
27
|
+
export { Intersect, IntersectEvaluated, type TIntersect, type IntersectOptions } from './type/intersect/index.mjs';
|
|
28
28
|
export { Iterator, type TIterator } from './type/iterator/index.mjs';
|
|
29
29
|
export { Intrinsic, IntrinsicFromMappedKey, type TIntrinsic, Capitalize, type TCapitalize, Lowercase, type TLowercase, Uncapitalize, type TUncapitalize, Uppercase, type TUppercase } from './type/intrinsic/index.mjs';
|
|
30
30
|
export { KeyOf, type TKeyOf, type KeyOfFromMappedResult, KeyOfPropertyKeys, KeyOfPattern } from './type/keyof/index.mjs';
|
|
@@ -60,7 +60,7 @@ export { Transform, type TTransform, type TransformOptions, type TransformFuncti
|
|
|
60
60
|
export { Tuple, type TTuple } from './type/tuple/index.mjs';
|
|
61
61
|
export { Uint8Array, type TUint8Array, type Uint8ArrayOptions } from './type/uint8array/index.mjs';
|
|
62
62
|
export { Undefined, type TUndefined } from './type/undefined/index.mjs';
|
|
63
|
-
export { Union, type TUnion } from './type/union/index.mjs';
|
|
63
|
+
export { Union, UnionEvaluated, type TUnion } from './type/union/index.mjs';
|
|
64
64
|
export { Unknown, type TUnknown } from './type/unknown/index.mjs';
|
|
65
65
|
export { Unsafe, type TUnsafe } from './type/unsafe/index.mjs';
|
|
66
66
|
export { Void, type TVoid } from './type/void/index.mjs';
|
package/build/import/index.mjs
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
28
|
+
// ------------------------------------------------------------------
|
|
29
|
+
// Infrastructure
|
|
30
|
+
// ------------------------------------------------------------------
|
|
1
31
|
export { Kind, Hint, ReadonlyKind, OptionalKind, TransformKind } from './type/symbols/index.mjs';
|
|
2
32
|
export { PatternBoolean, PatternBooleanExact, PatternNumber, PatternNumberExact, PatternString, PatternStringExact } from './type/patterns/index.mjs';
|
|
3
33
|
export { TypeRegistry, FormatRegistry } from './type/registry/index.mjs';
|
|
4
34
|
export { TypeGuard, ValueGuard } from './type/guard/index.mjs';
|
|
5
35
|
export { CloneType, CloneRest } from './type/clone/type.mjs';
|
|
36
|
+
// ------------------------------------------------------------------
|
|
37
|
+
// Type
|
|
38
|
+
// ------------------------------------------------------------------
|
|
6
39
|
export { Any } from './type/any/index.mjs';
|
|
7
40
|
export { Array } from './type/array/index.mjs';
|
|
8
41
|
export { AsyncIterator } from './type/async-iterator/index.mjs';
|
|
@@ -24,7 +57,7 @@ export { Increment } from './type/helpers/index.mjs';
|
|
|
24
57
|
export { Index, IndexPropertyKeys, IndexFromMappedKey } from './type/indexed/index.mjs';
|
|
25
58
|
export { InstanceType } from './type/instance-type/index.mjs';
|
|
26
59
|
export { Integer } from './type/integer/index.mjs';
|
|
27
|
-
export { Intersect } from './type/intersect/index.mjs';
|
|
60
|
+
export { Intersect, IntersectEvaluated } from './type/intersect/index.mjs';
|
|
28
61
|
export { Iterator } from './type/iterator/index.mjs';
|
|
29
62
|
export { Intrinsic, IntrinsicFromMappedKey, Capitalize, Lowercase, Uncapitalize, Uppercase } from './type/intrinsic/index.mjs';
|
|
30
63
|
export { KeyOf, KeyOfPropertyKeys, KeyOfPattern } from './type/keyof/index.mjs';
|
|
@@ -58,8 +91,11 @@ export { Transform, TransformDecodeBuilder, TransformEncodeBuilder } from './typ
|
|
|
58
91
|
export { Tuple } from './type/tuple/index.mjs';
|
|
59
92
|
export { Uint8Array } from './type/uint8array/index.mjs';
|
|
60
93
|
export { Undefined } from './type/undefined/index.mjs';
|
|
61
|
-
export { Union } from './type/union/index.mjs';
|
|
94
|
+
export { Union, UnionEvaluated } from './type/union/index.mjs';
|
|
62
95
|
export { Unknown } from './type/unknown/index.mjs';
|
|
63
96
|
export { Unsafe } from './type/unsafe/index.mjs';
|
|
64
97
|
export { Void } from './type/void/index.mjs';
|
|
98
|
+
// ------------------------------------------------------------------
|
|
99
|
+
// Namespace
|
|
100
|
+
// ------------------------------------------------------------------
|
|
65
101
|
export { Type, JsonTypeBuilder, JavaScriptTypeBuilder } from './type/type/index.mjs';
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
+
/*--------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
@sinclair/typebox/system
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
---------------------------------------------------------------------------*/
|
|
1
28
|
export { TypeSystemPolicy } from './policy.mjs';
|
|
2
29
|
export { TypeSystem, TypeSystemDuplicateFormat, TypeSystemDuplicateTypeKind } from './system.mjs';
|