@sinclair/typebox 0.32.0-dev-17 → 0.32.0-dev-19
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 +14 -35
- package/build/import/compiler/index.mjs +0 -27
- package/build/import/errors/errors.mjs +15 -38
- package/build/import/errors/function.mjs +0 -27
- package/build/import/errors/index.mjs +0 -27
- package/build/import/index.mjs +0 -27
- package/build/import/system/index.mjs +0 -27
- package/build/import/system/policy.mjs +0 -27
- package/build/import/system/system.mjs +0 -27
- package/build/import/type/any/any.mjs +0 -27
- package/build/import/type/any/index.mjs +0 -27
- package/build/import/type/array/array.mjs +0 -27
- package/build/import/type/array/index.mjs +0 -27
- package/build/import/type/async-iterator/async-iterator.mjs +0 -27
- package/build/import/type/async-iterator/index.mjs +0 -27
- package/build/import/type/awaited/awaited.d.mts +6 -6
- package/build/import/type/awaited/awaited.mjs +14 -41
- package/build/import/type/awaited/index.mjs +0 -27
- package/build/import/type/bigint/bigint.mjs +0 -27
- package/build/import/type/bigint/index.mjs +0 -27
- package/build/import/type/boolean/boolean.mjs +0 -27
- package/build/import/type/boolean/index.mjs +0 -27
- package/build/import/type/clone/index.mjs +0 -27
- package/build/import/type/clone/type.mjs +0 -27
- package/build/import/type/clone/value.mjs +0 -27
- package/build/import/type/composite/composite.mjs +0 -27
- package/build/import/type/composite/index.mjs +0 -27
- package/build/import/type/const/const.mjs +0 -27
- package/build/import/type/const/index.mjs +0 -27
- package/build/import/type/constructor/constructor.mjs +0 -27
- package/build/import/type/constructor/index.mjs +0 -27
- package/build/import/type/constructor-parameters/constructor-parameters.mjs +0 -27
- package/build/import/type/constructor-parameters/index.mjs +0 -27
- package/build/import/type/date/date.mjs +0 -27
- package/build/import/type/date/index.mjs +0 -27
- package/build/import/type/deref/deref.mjs +12 -39
- package/build/import/type/deref/index.mjs +0 -27
- package/build/import/type/discard/discard.mjs +0 -27
- package/build/import/type/discard/index.mjs +0 -27
- package/build/import/type/enum/enum.mjs +0 -27
- package/build/import/type/enum/index.mjs +0 -27
- package/build/import/type/exclude/exclude-from-mapped-result.mjs +0 -27
- package/build/import/type/exclude/exclude.mjs +8 -32
- package/build/import/type/exclude/index.mjs +0 -27
- package/build/import/type/extends/extends-check.mjs +167 -194
- package/build/import/type/extends/extends-from-mapped-key.mjs +0 -27
- package/build/import/type/extends/extends-from-mapped-result.mjs +0 -27
- package/build/import/type/extends/extends-undefined.mjs +0 -27
- package/build/import/type/extends/extends.mjs +3 -30
- package/build/import/type/extends/index.mjs +0 -27
- package/build/import/type/extract/extract-from-mapped-result.mjs +0 -27
- package/build/import/type/extract/extract.mjs +5 -32
- package/build/import/type/extract/index.mjs +0 -27
- package/build/import/type/function/function.mjs +0 -27
- package/build/import/type/function/index.mjs +0 -27
- package/build/import/type/guard/index.mjs +0 -27
- package/build/import/type/guard/type.d.mts +50 -50
- package/build/import/type/guard/type.mjs +136 -163
- package/build/import/type/guard/value.mjs +0 -27
- package/build/import/type/helpers/helpers.mjs +0 -27
- package/build/import/type/helpers/index.mjs +0 -27
- package/build/import/type/index.mjs +0 -27
- package/build/import/type/indexed/index.d.mts +0 -1
- package/build/import/type/indexed/index.mjs +0 -28
- package/build/import/type/indexed/indexed-from-mapped-key.d.mts +2 -2
- package/build/import/type/indexed/indexed-from-mapped-key.mjs +2 -29
- package/build/import/type/indexed/indexed-property-keys.mjs +7 -34
- package/build/import/type/indexed/indexed.d.mts +38 -5
- package/build/import/type/indexed/indexed.mjs +78 -32
- package/build/import/type/instance-type/index.mjs +0 -27
- package/build/import/type/instance-type/instance-type.mjs +0 -27
- package/build/import/type/integer/index.mjs +0 -27
- package/build/import/type/integer/integer.mjs +0 -27
- package/build/import/type/intersect/index.mjs +0 -27
- package/build/import/type/intersect/intersect-create.mjs +4 -31
- package/build/import/type/intersect/intersect-evaluated.mjs +1 -28
- package/build/import/type/intersect/intersect-type.mjs +0 -27
- package/build/import/type/intersect/intersect.mjs +2 -29
- package/build/import/type/intrinsic/capitalize.mjs +0 -27
- package/build/import/type/intrinsic/index.mjs +0 -27
- package/build/import/type/intrinsic/intrinsic-from-mapped-key.mjs +0 -27
- package/build/import/type/intrinsic/intrinsic.mjs +5 -32
- package/build/import/type/intrinsic/lowercase.mjs +0 -27
- package/build/import/type/intrinsic/uncapitalize.mjs +0 -27
- package/build/import/type/intrinsic/uppercase.mjs +0 -27
- package/build/import/type/iterator/index.mjs +0 -27
- package/build/import/type/iterator/iterator.mjs +0 -27
- package/build/import/type/keyof/index.mjs +0 -27
- package/build/import/type/keyof/keyof-from-mapped-result.mjs +0 -27
- package/build/import/type/keyof/keyof-property-keys.mjs +7 -34
- package/build/import/type/keyof/keyof.mjs +2 -29
- package/build/import/type/literal/index.mjs +0 -27
- package/build/import/type/literal/literal.mjs +0 -27
- package/build/import/type/mapped/index.mjs +0 -27
- package/build/import/type/mapped/mapped-key.mjs +0 -27
- package/build/import/type/mapped/mapped-result.mjs +0 -27
- package/build/import/type/mapped/mapped.mjs +16 -43
- package/build/import/type/modifiers/index.mjs +0 -27
- package/build/import/type/modifiers/modifiers.mjs +3 -30
- package/build/import/type/never/index.mjs +0 -27
- package/build/import/type/never/never.mjs +0 -27
- package/build/import/type/not/index.mjs +0 -27
- package/build/import/type/not/not.mjs +0 -27
- package/build/import/type/null/index.mjs +0 -27
- package/build/import/type/null/null.mjs +0 -27
- package/build/import/type/number/index.mjs +0 -27
- package/build/import/type/number/number.mjs +0 -27
- package/build/import/type/object/index.mjs +0 -27
- package/build/import/type/object/object.mjs +3 -30
- package/build/import/type/omit/index.mjs +0 -27
- package/build/import/type/omit/omit-from-mapped-key.mjs +0 -27
- package/build/import/type/omit/omit.mjs +6 -33
- package/build/import/type/operators/index.mjs +0 -27
- package/build/import/type/operators/operators.mjs +0 -27
- package/build/import/type/optional/index.mjs +0 -27
- package/build/import/type/optional/optional.mjs +0 -27
- package/build/import/type/parameters/index.mjs +0 -27
- package/build/import/type/parameters/parameters.mjs +0 -27
- package/build/import/type/partial/index.mjs +0 -27
- package/build/import/type/partial/partial-from-mapped-result.mjs +0 -27
- package/build/import/type/partial/partial.mjs +5 -32
- package/build/import/type/patterns/index.mjs +0 -27
- package/build/import/type/patterns/patterns.mjs +0 -27
- package/build/import/type/pick/index.mjs +0 -27
- package/build/import/type/pick/pick-from-mapped-key.mjs +0 -27
- package/build/import/type/pick/pick.mjs +6 -33
- package/build/import/type/promise/index.mjs +0 -27
- package/build/import/type/promise/promise.mjs +0 -27
- package/build/import/type/readonly/index.mjs +0 -27
- package/build/import/type/readonly/readonly.mjs +0 -27
- package/build/import/type/readonly-optional/index.mjs +0 -27
- package/build/import/type/readonly-optional/readonly-optional.mjs +0 -27
- package/build/import/type/record/index.mjs +0 -27
- package/build/import/type/record/record.d.mts +10 -9
- package/build/import/type/record/record.mjs +37 -60
- package/build/import/type/recursive/index.mjs +0 -27
- package/build/import/type/recursive/recursive.mjs +0 -27
- package/build/import/type/ref/index.mjs +0 -27
- package/build/import/type/ref/ref.mjs +0 -27
- package/build/import/type/regexp/index.mjs +0 -27
- package/build/import/type/regexp/regexp.mjs +0 -27
- package/build/import/type/registry/format.mjs +0 -27
- package/build/import/type/registry/index.mjs +0 -27
- package/build/import/type/registry/type.mjs +0 -27
- package/build/import/type/required/index.mjs +0 -27
- package/build/import/type/required/required-from-mapped-result.mjs +0 -27
- package/build/import/type/required/required.mjs +5 -32
- package/build/import/type/rest/index.mjs +0 -27
- package/build/import/type/rest/rest.mjs +6 -29
- package/build/import/type/return-type/index.mjs +0 -27
- package/build/import/type/return-type/return-type.mjs +0 -27
- package/build/import/type/schema/anyschema.mjs +0 -27
- package/build/import/type/schema/index.mjs +0 -27
- package/build/import/type/schema/schema.mjs +0 -27
- package/build/import/type/static/index.mjs +0 -27
- package/build/import/type/static/static.mjs +0 -27
- package/build/import/type/strict/index.mjs +0 -27
- package/build/import/type/strict/strict.mjs +0 -27
- package/build/import/type/string/index.mjs +0 -27
- package/build/import/type/string/string.mjs +0 -27
- package/build/import/type/symbol/index.mjs +0 -27
- package/build/import/type/symbol/symbol.mjs +0 -27
- package/build/import/type/symbols/index.mjs +0 -27
- package/build/import/type/symbols/symbols.mjs +0 -27
- package/build/import/type/template-literal/finite.mjs +0 -27
- package/build/import/type/template-literal/generate.mjs +0 -27
- package/build/import/type/template-literal/index.mjs +0 -27
- package/build/import/type/template-literal/parser.mjs +0 -27
- package/build/import/type/template-literal/pattern.mjs +9 -36
- package/build/import/type/template-literal/syntax.mjs +0 -27
- package/build/import/type/template-literal/template-literal.mjs +0 -27
- package/build/import/type/template-literal/union.mjs +0 -27
- package/build/import/type/transform/index.mjs +0 -27
- package/build/import/type/transform/transform.mjs +1 -28
- package/build/import/type/tuple/index.mjs +0 -27
- package/build/import/type/tuple/tuple.mjs +0 -27
- package/build/import/type/type/index.mjs +0 -27
- package/build/import/type/type/javascript.mjs +0 -27
- package/build/import/type/type/json.d.mts +2 -2
- package/build/import/type/type/json.mjs +0 -27
- package/build/import/type/type/type.mjs +0 -27
- package/build/import/type/uint8array/index.mjs +0 -27
- package/build/import/type/uint8array/uint8array.mjs +0 -27
- package/build/import/type/undefined/index.mjs +0 -27
- package/build/import/type/undefined/undefined.mjs +0 -27
- package/build/import/type/union/index.mjs +0 -27
- package/build/import/type/union/union-create.mjs +0 -27
- package/build/import/type/union/union-evaluated.mjs +2 -29
- package/build/import/type/union/union-type.mjs +0 -27
- package/build/import/type/union/union.mjs +0 -27
- package/build/import/type/unknown/index.mjs +0 -27
- package/build/import/type/unknown/unknown.mjs +0 -27
- package/build/import/type/unsafe/index.mjs +0 -27
- package/build/import/type/unsafe/unsafe.mjs +0 -27
- package/build/import/type/void/index.mjs +0 -27
- package/build/import/type/void/void.mjs +0 -27
- package/build/import/value/cast/cast.mjs +0 -27
- package/build/import/value/cast/index.mjs +0 -27
- package/build/import/value/check/check.mjs +18 -38
- package/build/import/value/check/index.mjs +0 -27
- package/build/import/value/clean/clean.mjs +9 -34
- package/build/import/value/clean/index.mjs +0 -27
- package/build/import/value/clone/clone.mjs +7 -31
- package/build/import/value/clone/index.mjs +0 -27
- package/build/import/value/convert/convert.mjs +6 -29
- package/build/import/value/convert/index.mjs +0 -27
- package/build/import/value/create/create.mjs +0 -27
- package/build/import/value/create/index.mjs +0 -27
- package/build/import/value/default/default.mjs +12 -31
- package/build/import/value/default/index.mjs +0 -27
- package/build/import/value/delta/delta.mjs +0 -27
- package/build/import/value/delta/index.mjs +0 -27
- package/build/import/value/deref/deref.mjs +0 -27
- package/build/import/value/deref/index.mjs +0 -27
- package/build/import/value/equal/equal.mjs +0 -27
- package/build/import/value/equal/index.mjs +0 -27
- package/build/import/value/guard/guard.mjs +0 -27
- package/build/import/value/guard/index.mjs +0 -27
- package/build/import/value/hash/hash.mjs +0 -27
- package/build/import/value/hash/index.mjs +0 -27
- package/build/import/value/index.mjs +0 -27
- package/build/import/value/mutate/index.mjs +0 -27
- package/build/import/value/mutate/mutate.mjs +0 -27
- package/build/import/value/pointer/index.mjs +0 -27
- package/build/import/value/pointer/pointer.mjs +0 -27
- package/build/import/value/transform/decode.mjs +12 -33
- package/build/import/value/transform/encode.mjs +12 -33
- package/build/import/value/transform/has.mjs +24 -45
- package/build/import/value/transform/index.mjs +0 -27
- package/build/import/value/value/index.mjs +0 -27
- package/build/import/value/value/value.mjs +0 -27
- package/build/require/compiler/compiler.js +77 -97
- package/build/require/compiler/index.js +0 -26
- package/build/require/errors/errors.js +58 -80
- package/build/require/errors/function.js +0 -26
- package/build/require/errors/index.js +0 -26
- package/build/require/index.js +0 -26
- package/build/require/system/index.js +0 -26
- package/build/require/system/policy.js +0 -26
- package/build/require/system/system.js +0 -26
- package/build/require/type/any/any.js +0 -26
- package/build/require/type/any/index.js +0 -26
- package/build/require/type/array/array.js +0 -26
- package/build/require/type/array/index.js +0 -26
- package/build/require/type/async-iterator/async-iterator.js +0 -26
- package/build/require/type/async-iterator/index.js +0 -26
- package/build/require/type/awaited/awaited.d.ts +6 -6
- package/build/require/type/awaited/awaited.js +14 -41
- package/build/require/type/awaited/index.js +0 -26
- package/build/require/type/bigint/bigint.js +0 -26
- package/build/require/type/bigint/index.js +0 -26
- package/build/require/type/boolean/boolean.js +0 -26
- package/build/require/type/boolean/index.js +0 -26
- package/build/require/type/clone/index.js +0 -26
- package/build/require/type/clone/type.js +0 -26
- package/build/require/type/clone/value.js +0 -26
- package/build/require/type/composite/composite.js +0 -26
- package/build/require/type/composite/index.js +0 -26
- package/build/require/type/const/const.js +0 -26
- package/build/require/type/const/index.js +0 -26
- package/build/require/type/constructor/constructor.js +0 -26
- package/build/require/type/constructor/index.js +0 -26
- package/build/require/type/constructor-parameters/constructor-parameters.js +0 -26
- package/build/require/type/constructor-parameters/index.js +0 -26
- package/build/require/type/date/date.js +0 -26
- package/build/require/type/date/index.js +0 -26
- package/build/require/type/deref/deref.js +11 -37
- package/build/require/type/deref/index.js +0 -26
- package/build/require/type/discard/discard.js +0 -26
- package/build/require/type/discard/index.js +0 -26
- package/build/require/type/enum/enum.js +0 -26
- package/build/require/type/enum/index.js +0 -26
- package/build/require/type/exclude/exclude-from-mapped-result.js +0 -26
- package/build/require/type/exclude/exclude.js +7 -30
- package/build/require/type/exclude/index.js +0 -26
- package/build/require/type/extends/extends-check.js +167 -193
- package/build/require/type/extends/extends-from-mapped-key.js +0 -26
- package/build/require/type/extends/extends-from-mapped-result.js +0 -26
- package/build/require/type/extends/extends-undefined.js +0 -26
- package/build/require/type/extends/extends.js +2 -28
- package/build/require/type/extends/index.js +0 -26
- package/build/require/type/extract/extract-from-mapped-result.js +0 -26
- package/build/require/type/extract/extract.js +4 -30
- package/build/require/type/extract/index.js +0 -26
- package/build/require/type/function/function.js +0 -26
- package/build/require/type/function/index.js +0 -26
- package/build/require/type/guard/index.js +0 -26
- package/build/require/type/guard/type.d.ts +50 -50
- package/build/require/type/guard/type.js +184 -210
- package/build/require/type/guard/value.js +0 -26
- package/build/require/type/helpers/helpers.js +0 -26
- package/build/require/type/helpers/index.js +0 -26
- package/build/require/type/index.js +0 -26
- package/build/require/type/indexed/index.d.ts +0 -1
- package/build/require/type/indexed/index.js +0 -27
- package/build/require/type/indexed/indexed-from-mapped-key.d.ts +2 -2
- package/build/require/type/indexed/indexed-from-mapped-key.js +2 -28
- package/build/require/type/indexed/indexed-property-keys.js +6 -32
- package/build/require/type/indexed/indexed.d.ts +38 -5
- package/build/require/type/indexed/indexed.js +78 -31
- package/build/require/type/instance-type/index.js +0 -26
- package/build/require/type/instance-type/instance-type.js +0 -26
- package/build/require/type/integer/index.js +0 -26
- package/build/require/type/integer/integer.js +0 -26
- package/build/require/type/intersect/index.js +0 -26
- package/build/require/type/intersect/intersect-create.js +3 -29
- package/build/require/type/intersect/intersect-evaluated.js +2 -28
- package/build/require/type/intersect/intersect-type.js +0 -26
- package/build/require/type/intersect/intersect.js +1 -27
- package/build/require/type/intrinsic/capitalize.js +0 -26
- package/build/require/type/intrinsic/index.js +0 -26
- package/build/require/type/intrinsic/intrinsic-from-mapped-key.js +0 -26
- package/build/require/type/intrinsic/intrinsic.js +4 -30
- package/build/require/type/intrinsic/lowercase.js +0 -26
- package/build/require/type/intrinsic/uncapitalize.js +0 -26
- package/build/require/type/intrinsic/uppercase.js +0 -26
- package/build/require/type/iterator/index.js +0 -26
- package/build/require/type/iterator/iterator.js +0 -26
- package/build/require/type/keyof/index.js +0 -26
- package/build/require/type/keyof/keyof-from-mapped-result.js +0 -26
- package/build/require/type/keyof/keyof-property-keys.js +6 -32
- package/build/require/type/keyof/keyof.js +1 -27
- package/build/require/type/literal/index.js +0 -26
- package/build/require/type/literal/literal.js +0 -26
- package/build/require/type/mapped/index.js +0 -26
- package/build/require/type/mapped/mapped-key.js +0 -26
- package/build/require/type/mapped/mapped-result.js +0 -26
- package/build/require/type/mapped/mapped.js +15 -41
- package/build/require/type/modifiers/index.js +0 -26
- package/build/require/type/modifiers/modifiers.js +2 -28
- package/build/require/type/never/index.js +0 -26
- package/build/require/type/never/never.js +0 -26
- package/build/require/type/not/index.js +0 -26
- package/build/require/type/not/not.js +0 -26
- package/build/require/type/null/index.js +0 -26
- package/build/require/type/null/null.js +0 -26
- package/build/require/type/number/index.js +0 -26
- package/build/require/type/number/number.js +0 -26
- package/build/require/type/object/index.js +0 -26
- package/build/require/type/object/object.js +2 -28
- package/build/require/type/omit/index.js +0 -26
- package/build/require/type/omit/omit-from-mapped-key.js +0 -26
- package/build/require/type/omit/omit.js +5 -31
- package/build/require/type/operators/index.js +0 -26
- package/build/require/type/operators/operators.js +0 -26
- package/build/require/type/optional/index.js +0 -26
- package/build/require/type/optional/optional.js +0 -26
- package/build/require/type/parameters/index.js +0 -26
- package/build/require/type/parameters/parameters.js +0 -26
- package/build/require/type/partial/index.js +0 -26
- package/build/require/type/partial/partial-from-mapped-result.js +0 -26
- package/build/require/type/partial/partial.js +4 -30
- package/build/require/type/patterns/index.js +0 -26
- package/build/require/type/patterns/patterns.js +0 -26
- package/build/require/type/pick/index.js +0 -26
- package/build/require/type/pick/pick-from-mapped-key.js +0 -26
- package/build/require/type/pick/pick.js +5 -31
- package/build/require/type/promise/index.js +0 -26
- package/build/require/type/promise/promise.js +0 -26
- package/build/require/type/readonly/index.js +0 -26
- package/build/require/type/readonly/readonly.js +0 -26
- package/build/require/type/readonly-optional/index.js +0 -26
- package/build/require/type/readonly-optional/readonly-optional.js +0 -26
- package/build/require/type/record/index.js +0 -26
- package/build/require/type/record/record.d.ts +10 -9
- package/build/require/type/record/record.js +36 -58
- package/build/require/type/recursive/index.js +0 -26
- package/build/require/type/recursive/recursive.js +0 -26
- package/build/require/type/ref/index.js +0 -26
- package/build/require/type/ref/ref.js +0 -26
- package/build/require/type/regexp/index.js +0 -26
- package/build/require/type/regexp/regexp.js +0 -26
- package/build/require/type/registry/format.js +0 -26
- package/build/require/type/registry/index.js +0 -26
- package/build/require/type/registry/type.js +0 -26
- package/build/require/type/required/index.js +0 -26
- package/build/require/type/required/required-from-mapped-result.js +0 -26
- package/build/require/type/required/required.js +4 -30
- package/build/require/type/rest/index.js +0 -26
- package/build/require/type/rest/rest.js +5 -27
- package/build/require/type/return-type/index.js +0 -26
- package/build/require/type/return-type/return-type.js +0 -26
- package/build/require/type/schema/anyschema.js +0 -26
- package/build/require/type/schema/index.js +0 -26
- package/build/require/type/schema/schema.js +0 -26
- package/build/require/type/static/index.js +0 -26
- package/build/require/type/static/static.js +0 -26
- package/build/require/type/strict/index.js +0 -26
- package/build/require/type/strict/strict.js +0 -26
- package/build/require/type/string/index.js +0 -26
- package/build/require/type/string/string.js +0 -26
- package/build/require/type/symbol/index.js +0 -26
- package/build/require/type/symbol/symbol.js +0 -26
- package/build/require/type/symbols/index.js +0 -26
- package/build/require/type/symbols/symbols.js +0 -26
- package/build/require/type/template-literal/finite.js +0 -26
- package/build/require/type/template-literal/generate.js +0 -26
- package/build/require/type/template-literal/index.js +0 -26
- package/build/require/type/template-literal/parser.js +0 -26
- package/build/require/type/template-literal/pattern.js +8 -34
- package/build/require/type/template-literal/syntax.js +0 -26
- package/build/require/type/template-literal/template-literal.js +0 -26
- package/build/require/type/template-literal/union.js +0 -26
- package/build/require/type/transform/index.js +0 -26
- package/build/require/type/transform/transform.js +1 -27
- package/build/require/type/tuple/index.js +0 -26
- package/build/require/type/tuple/tuple.js +0 -26
- package/build/require/type/type/index.js +0 -26
- package/build/require/type/type/javascript.js +0 -26
- package/build/require/type/type/json.d.ts +2 -2
- package/build/require/type/type/json.js +0 -26
- package/build/require/type/type/type.js +0 -26
- package/build/require/type/uint8array/index.js +0 -26
- package/build/require/type/uint8array/uint8array.js +0 -26
- package/build/require/type/undefined/index.js +0 -26
- package/build/require/type/undefined/undefined.js +0 -26
- package/build/require/type/union/index.js +0 -26
- package/build/require/type/union/union-create.js +0 -26
- package/build/require/type/union/union-evaluated.js +1 -27
- package/build/require/type/union/union-type.js +0 -26
- package/build/require/type/union/union.js +0 -26
- package/build/require/type/unknown/index.js +0 -26
- package/build/require/type/unknown/unknown.js +0 -26
- package/build/require/type/unsafe/index.js +0 -26
- package/build/require/type/unsafe/unsafe.js +0 -26
- package/build/require/type/void/index.js +0 -26
- package/build/require/type/void/void.js +0 -26
- package/build/require/value/cast/cast.js +0 -26
- package/build/require/value/cast/index.js +0 -26
- package/build/require/value/check/check.js +63 -82
- package/build/require/value/check/index.js +0 -26
- package/build/require/value/clean/clean.js +31 -55
- package/build/require/value/clean/index.js +0 -26
- package/build/require/value/clone/clone.js +7 -30
- package/build/require/value/clone/index.js +0 -26
- package/build/require/value/convert/convert.js +42 -64
- package/build/require/value/convert/index.js +0 -26
- package/build/require/value/create/create.js +0 -26
- package/build/require/value/create/index.js +0 -26
- package/build/require/value/default/default.js +24 -42
- package/build/require/value/default/index.js +0 -26
- package/build/require/value/delta/delta.js +0 -26
- package/build/require/value/delta/index.js +0 -26
- package/build/require/value/deref/deref.js +0 -26
- package/build/require/value/deref/index.js +0 -26
- package/build/require/value/equal/equal.js +0 -26
- package/build/require/value/equal/index.js +0 -26
- package/build/require/value/guard/guard.js +0 -26
- package/build/require/value/guard/index.js +0 -26
- package/build/require/value/hash/hash.js +0 -26
- package/build/require/value/hash/index.js +0 -26
- package/build/require/value/index.js +0 -26
- package/build/require/value/mutate/index.js +0 -26
- package/build/require/value/mutate/mutate.js +0 -26
- package/build/require/value/pointer/index.js +0 -26
- package/build/require/value/pointer/pointer.js +0 -26
- package/build/require/value/transform/decode.js +27 -47
- package/build/require/value/transform/encode.js +28 -48
- package/build/require/value/transform/has.js +29 -49
- package/build/require/value/transform/index.js +0 -26
- package/build/require/value/value/index.js +0 -26
- package/build/require/value/value/value.js +0 -26
- package/license +3 -1
- package/package.json +1 -1
- package/readme.md +7 -7
- package/build/import/type/indexed/indexed-result.d.mts +0 -33
- package/build/import/type/indexed/indexed-result.mjs +0 -107
- package/build/require/type/indexed/indexed-result.d.ts +0 -33
- package/build/require/type/indexed/indexed-result.js +0 -111
|
@@ -1,46 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
2
|
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
4
|
exports.Check = exports.ValueCheckUnknownTypeError = void 0;
|
|
31
|
-
const index_1 = require("
|
|
32
|
-
const index_2 = require("
|
|
33
|
-
const index_3 = require("../
|
|
34
|
-
const index_4 = require("
|
|
35
|
-
const index_5 = require("../../type/
|
|
36
|
-
const index_6 = require("../../type/
|
|
37
|
-
const index_7 = require("../../type/
|
|
5
|
+
const index_1 = require("../../system/index");
|
|
6
|
+
const index_2 = require("../deref/index");
|
|
7
|
+
const index_3 = require("../hash/index");
|
|
8
|
+
const index_4 = require("../../type/symbols/index");
|
|
9
|
+
const index_5 = require("../../type/keyof/index");
|
|
10
|
+
const index_6 = require("../../type/extends/index");
|
|
11
|
+
const index_7 = require("../../type/registry/index");
|
|
12
|
+
const index_8 = require("../../type/never/index");
|
|
13
|
+
// ------------------------------------------------------------------
|
|
14
|
+
// ValueGuard
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
const index_9 = require("../guard/index");
|
|
18
|
+
// ------------------------------------------------------------------
|
|
19
|
+
// TypeGuard
|
|
20
|
+
// ------------------------------------------------------------------
|
|
38
21
|
const type_1 = require("../../type/guard/type");
|
|
39
|
-
|
|
40
|
-
const index_9 = require("../../type/never/index");
|
|
41
|
-
// --------------------------------------------------------------------------
|
|
22
|
+
// ------------------------------------------------------------------
|
|
42
23
|
// Errors
|
|
43
|
-
//
|
|
24
|
+
// ------------------------------------------------------------------
|
|
44
25
|
class ValueCheckUnknownTypeError extends Error {
|
|
45
26
|
constructor(schema) {
|
|
46
27
|
super(`Unknown type`);
|
|
@@ -48,26 +29,26 @@ class ValueCheckUnknownTypeError extends Error {
|
|
|
48
29
|
}
|
|
49
30
|
}
|
|
50
31
|
exports.ValueCheckUnknownTypeError = ValueCheckUnknownTypeError;
|
|
51
|
-
//
|
|
32
|
+
// ------------------------------------------------------------------
|
|
52
33
|
// TypeGuards
|
|
53
|
-
//
|
|
34
|
+
// ------------------------------------------------------------------
|
|
54
35
|
function IsAnyOrUnknown(schema) {
|
|
55
|
-
return schema[
|
|
36
|
+
return schema[index_4.Kind] === 'Any' || schema[index_4.Kind] === 'Unknown';
|
|
56
37
|
}
|
|
57
|
-
//
|
|
38
|
+
// ------------------------------------------------------------------
|
|
58
39
|
// Guards
|
|
59
|
-
//
|
|
40
|
+
// ------------------------------------------------------------------
|
|
60
41
|
function IsDefined(value) {
|
|
61
42
|
return value !== undefined;
|
|
62
43
|
}
|
|
63
|
-
//
|
|
44
|
+
// ------------------------------------------------------------------
|
|
64
45
|
// Types
|
|
65
|
-
//
|
|
46
|
+
// ------------------------------------------------------------------
|
|
66
47
|
function TAny(schema, references, value) {
|
|
67
48
|
return true;
|
|
68
49
|
}
|
|
69
50
|
function TArray(schema, references, value) {
|
|
70
|
-
if (!(0,
|
|
51
|
+
if (!(0, index_9.IsArray)(value))
|
|
71
52
|
return false;
|
|
72
53
|
if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) {
|
|
73
54
|
return false;
|
|
@@ -80,7 +61,7 @@ function TArray(schema, references, value) {
|
|
|
80
61
|
}
|
|
81
62
|
// prettier-ignore
|
|
82
63
|
if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) {
|
|
83
|
-
const hashed = (0,
|
|
64
|
+
const hashed = (0, index_3.Hash)(element);
|
|
84
65
|
if (set.has(hashed)) {
|
|
85
66
|
return false;
|
|
86
67
|
}
|
|
@@ -91,27 +72,27 @@ function TArray(schema, references, value) {
|
|
|
91
72
|
return false;
|
|
92
73
|
}
|
|
93
74
|
// contains
|
|
94
|
-
if (!(IsDefined(schema.contains) || (0,
|
|
75
|
+
if (!(IsDefined(schema.contains) || (0, index_9.IsNumber)(schema.minContains) || (0, index_9.IsNumber)(schema.maxContains))) {
|
|
95
76
|
return true; // exit
|
|
96
77
|
}
|
|
97
|
-
const containsSchema = IsDefined(schema.contains) ? schema.contains : (0,
|
|
78
|
+
const containsSchema = IsDefined(schema.contains) ? schema.contains : (0, index_8.Never)();
|
|
98
79
|
const containsCount = value.reduce((acc, value) => (Visit(containsSchema, references, value) ? acc + 1 : acc), 0);
|
|
99
80
|
if (containsCount === 0) {
|
|
100
81
|
return false;
|
|
101
82
|
}
|
|
102
|
-
if ((0,
|
|
83
|
+
if ((0, index_9.IsNumber)(schema.minContains) && containsCount < schema.minContains) {
|
|
103
84
|
return false;
|
|
104
85
|
}
|
|
105
|
-
if ((0,
|
|
86
|
+
if ((0, index_9.IsNumber)(schema.maxContains) && containsCount > schema.maxContains) {
|
|
106
87
|
return false;
|
|
107
88
|
}
|
|
108
89
|
return true;
|
|
109
90
|
}
|
|
110
91
|
function TAsyncIterator(schema, references, value) {
|
|
111
|
-
return (0,
|
|
92
|
+
return (0, index_9.IsAsyncIterator)(value);
|
|
112
93
|
}
|
|
113
94
|
function TBigInt(schema, references, value) {
|
|
114
|
-
if (!(0,
|
|
95
|
+
if (!(0, index_9.IsBigInt)(value))
|
|
115
96
|
return false;
|
|
116
97
|
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
117
98
|
return false;
|
|
@@ -131,13 +112,13 @@ function TBigInt(schema, references, value) {
|
|
|
131
112
|
return true;
|
|
132
113
|
}
|
|
133
114
|
function TBoolean(schema, references, value) {
|
|
134
|
-
return (0,
|
|
115
|
+
return (0, index_9.IsBoolean)(value);
|
|
135
116
|
}
|
|
136
117
|
function TConstructor(schema, references, value) {
|
|
137
118
|
return Visit(schema.returns, references, value.prototype);
|
|
138
119
|
}
|
|
139
120
|
function TDate(schema, references, value) {
|
|
140
|
-
if (!(0,
|
|
121
|
+
if (!(0, index_9.IsDate)(value))
|
|
141
122
|
return false;
|
|
142
123
|
if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) {
|
|
143
124
|
return false;
|
|
@@ -157,10 +138,10 @@ function TDate(schema, references, value) {
|
|
|
157
138
|
return true;
|
|
158
139
|
}
|
|
159
140
|
function TFunction(schema, references, value) {
|
|
160
|
-
return (0,
|
|
141
|
+
return (0, index_9.IsFunction)(value);
|
|
161
142
|
}
|
|
162
143
|
function TInteger(schema, references, value) {
|
|
163
|
-
if (!(0,
|
|
144
|
+
if (!(0, index_9.IsInteger)(value)) {
|
|
164
145
|
return false;
|
|
165
146
|
}
|
|
166
147
|
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
@@ -183,12 +164,12 @@ function TInteger(schema, references, value) {
|
|
|
183
164
|
function TIntersect(schema, references, value) {
|
|
184
165
|
const check1 = schema.allOf.every((schema) => Visit(schema, references, value));
|
|
185
166
|
if (schema.unevaluatedProperties === false) {
|
|
186
|
-
const keyPattern = new RegExp((0,
|
|
167
|
+
const keyPattern = new RegExp((0, index_5.KeyOfPattern)(schema));
|
|
187
168
|
const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key));
|
|
188
169
|
return check1 && check2;
|
|
189
170
|
}
|
|
190
|
-
else if ((0, type_1.
|
|
191
|
-
const keyCheck = new RegExp((0,
|
|
171
|
+
else if ((0, type_1.IsSchema)(schema.unevaluatedProperties)) {
|
|
172
|
+
const keyCheck = new RegExp((0, index_5.KeyOfPattern)(schema));
|
|
192
173
|
const check2 = Object.getOwnPropertyNames(value).every((key) => keyCheck.test(key) || Visit(schema.unevaluatedProperties, references, value[key]));
|
|
193
174
|
return check1 && check2;
|
|
194
175
|
}
|
|
@@ -197,7 +178,7 @@ function TIntersect(schema, references, value) {
|
|
|
197
178
|
}
|
|
198
179
|
}
|
|
199
180
|
function TIterator(schema, references, value) {
|
|
200
|
-
return (0,
|
|
181
|
+
return (0, index_9.IsIterator)(value);
|
|
201
182
|
}
|
|
202
183
|
function TLiteral(schema, references, value) {
|
|
203
184
|
return value === schema.const;
|
|
@@ -209,10 +190,10 @@ function TNot(schema, references, value) {
|
|
|
209
190
|
return !Visit(schema.not, references, value);
|
|
210
191
|
}
|
|
211
192
|
function TNull(schema, references, value) {
|
|
212
|
-
return (0,
|
|
193
|
+
return (0, index_9.IsNull)(value);
|
|
213
194
|
}
|
|
214
195
|
function TNumber(schema, references, value) {
|
|
215
|
-
if (!
|
|
196
|
+
if (!index_1.TypeSystemPolicy.IsNumberLike(value))
|
|
216
197
|
return false;
|
|
217
198
|
if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) {
|
|
218
199
|
return false;
|
|
@@ -232,7 +213,7 @@ function TNumber(schema, references, value) {
|
|
|
232
213
|
return true;
|
|
233
214
|
}
|
|
234
215
|
function TObject(schema, references, value) {
|
|
235
|
-
if (!
|
|
216
|
+
if (!index_1.TypeSystemPolicy.IsObjectLike(value))
|
|
236
217
|
return false;
|
|
237
218
|
if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
238
219
|
return false;
|
|
@@ -247,12 +228,12 @@ function TObject(schema, references, value) {
|
|
|
247
228
|
if (!Visit(property, references, value[knownKey])) {
|
|
248
229
|
return false;
|
|
249
230
|
}
|
|
250
|
-
if (((0,
|
|
231
|
+
if (((0, index_6.ExtendsUndefinedCheck)(property) || IsAnyOrUnknown(property)) && !(knownKey in value)) {
|
|
251
232
|
return false;
|
|
252
233
|
}
|
|
253
234
|
}
|
|
254
235
|
else {
|
|
255
|
-
if (
|
|
236
|
+
if (index_1.TypeSystemPolicy.IsExactOptionalProperty(value, knownKey) && !Visit(property, references, value[knownKey])) {
|
|
256
237
|
return false;
|
|
257
238
|
}
|
|
258
239
|
}
|
|
@@ -276,10 +257,10 @@ function TObject(schema, references, value) {
|
|
|
276
257
|
}
|
|
277
258
|
}
|
|
278
259
|
function TPromise(schema, references, value) {
|
|
279
|
-
return (0,
|
|
260
|
+
return (0, index_9.IsPromise)(value);
|
|
280
261
|
}
|
|
281
262
|
function TRecord(schema, references, value) {
|
|
282
|
-
if (!
|
|
263
|
+
if (!index_1.TypeSystemPolicy.IsRecordLike(value)) {
|
|
283
264
|
return false;
|
|
284
265
|
}
|
|
285
266
|
if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) {
|
|
@@ -306,10 +287,10 @@ function TRecord(schema, references, value) {
|
|
|
306
287
|
return check1 && check2 && check3;
|
|
307
288
|
}
|
|
308
289
|
function TRef(schema, references, value) {
|
|
309
|
-
return Visit((0,
|
|
290
|
+
return Visit((0, index_2.Deref)(schema, references), references, value);
|
|
310
291
|
}
|
|
311
292
|
function TString(schema, references, value) {
|
|
312
|
-
if (!(0,
|
|
293
|
+
if (!(0, index_9.IsString)(value)) {
|
|
313
294
|
return false;
|
|
314
295
|
}
|
|
315
296
|
if (IsDefined(schema.minLength)) {
|
|
@@ -326,24 +307,24 @@ function TString(schema, references, value) {
|
|
|
326
307
|
return false;
|
|
327
308
|
}
|
|
328
309
|
if (IsDefined(schema.format)) {
|
|
329
|
-
if (!
|
|
310
|
+
if (!index_7.FormatRegistry.Has(schema.format))
|
|
330
311
|
return false;
|
|
331
|
-
const func =
|
|
312
|
+
const func = index_7.FormatRegistry.Get(schema.format);
|
|
332
313
|
return func(value);
|
|
333
314
|
}
|
|
334
315
|
return true;
|
|
335
316
|
}
|
|
336
317
|
function TSymbol(schema, references, value) {
|
|
337
|
-
return (0,
|
|
318
|
+
return (0, index_9.IsSymbol)(value);
|
|
338
319
|
}
|
|
339
320
|
function TTemplateLiteral(schema, references, value) {
|
|
340
|
-
return (0,
|
|
321
|
+
return (0, index_9.IsString)(value) && new RegExp(schema.pattern).test(value);
|
|
341
322
|
}
|
|
342
323
|
function TThis(schema, references, value) {
|
|
343
|
-
return Visit((0,
|
|
324
|
+
return Visit((0, index_2.Deref)(schema, references), references, value);
|
|
344
325
|
}
|
|
345
326
|
function TTuple(schema, references, value) {
|
|
346
|
-
if (!(0,
|
|
327
|
+
if (!(0, index_9.IsArray)(value)) {
|
|
347
328
|
return false;
|
|
348
329
|
}
|
|
349
330
|
if (schema.items === undefined && !(value.length === 0)) {
|
|
@@ -362,13 +343,13 @@ function TTuple(schema, references, value) {
|
|
|
362
343
|
return true;
|
|
363
344
|
}
|
|
364
345
|
function TUndefined(schema, references, value) {
|
|
365
|
-
return (0,
|
|
346
|
+
return (0, index_9.IsUndefined)(value);
|
|
366
347
|
}
|
|
367
348
|
function TUnion(schema, references, value) {
|
|
368
349
|
return schema.anyOf.some((inner) => Visit(inner, references, value));
|
|
369
350
|
}
|
|
370
351
|
function TUint8Array(schema, references, value) {
|
|
371
|
-
if (!(0,
|
|
352
|
+
if (!(0, index_9.IsUint8Array)(value)) {
|
|
372
353
|
return false;
|
|
373
354
|
}
|
|
374
355
|
if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) {
|
|
@@ -383,18 +364,18 @@ function TUnknown(schema, references, value) {
|
|
|
383
364
|
return true;
|
|
384
365
|
}
|
|
385
366
|
function TVoid(schema, references, value) {
|
|
386
|
-
return
|
|
367
|
+
return index_1.TypeSystemPolicy.IsVoidLike(value);
|
|
387
368
|
}
|
|
388
369
|
function TKind(schema, references, value) {
|
|
389
|
-
if (!
|
|
370
|
+
if (!index_7.TypeRegistry.Has(schema[index_4.Kind]))
|
|
390
371
|
return false;
|
|
391
|
-
const func =
|
|
372
|
+
const func = index_7.TypeRegistry.Get(schema[index_4.Kind]);
|
|
392
373
|
return func(schema, value);
|
|
393
374
|
}
|
|
394
375
|
function Visit(schema, references, value) {
|
|
395
376
|
const references_ = IsDefined(schema.$id) ? [...references, schema] : references;
|
|
396
377
|
const schema_ = schema;
|
|
397
|
-
switch (schema_[
|
|
378
|
+
switch (schema_[index_4.Kind]) {
|
|
398
379
|
case 'Any':
|
|
399
380
|
return TAny(schema_, references_, value);
|
|
400
381
|
case 'Array':
|
|
@@ -456,7 +437,7 @@ function Visit(schema, references, value) {
|
|
|
456
437
|
case 'Void':
|
|
457
438
|
return TVoid(schema_, references_, value);
|
|
458
439
|
default:
|
|
459
|
-
if (!
|
|
440
|
+
if (!index_7.TypeRegistry.Has(schema_[index_4.Kind]))
|
|
460
441
|
throw new ValueCheckUnknownTypeError(schema_);
|
|
461
442
|
return TKind(schema_, references_, value);
|
|
462
443
|
}
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
2
|
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
4
|
if (k2 === undefined) k2 = k;
|
|
31
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,78 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
2
|
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
4
|
exports.Clean = void 0;
|
|
31
|
-
const index_1 = require("
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const index_5 = require("../deref/index");
|
|
37
|
-
const index_6 = require("../../type/symbols/index");
|
|
5
|
+
const index_1 = require("../../type/keyof/index");
|
|
6
|
+
const index_2 = require("../check/index");
|
|
7
|
+
const index_3 = require("../clone/index");
|
|
8
|
+
const index_4 = require("../deref/index");
|
|
9
|
+
const index_5 = require("../../type/symbols/index");
|
|
38
10
|
// ------------------------------------------------------------------
|
|
39
|
-
//
|
|
11
|
+
// ValueGuard
|
|
40
12
|
// ------------------------------------------------------------------
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
const index_6 = require("../guard/index");
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
// TypeGuard
|
|
17
|
+
// ------------------------------------------------------------------
|
|
18
|
+
// prettier-ignore
|
|
19
|
+
const type_1 = require("../../type/guard/type");
|
|
44
20
|
// ------------------------------------------------------------------
|
|
45
21
|
// IsCheckable
|
|
46
22
|
// ------------------------------------------------------------------
|
|
47
23
|
function IsCheckable(schema) {
|
|
48
|
-
return (0, type_1.
|
|
24
|
+
return (0, type_1.IsSchema)(schema) && schema[index_5.Kind] !== 'Unsafe';
|
|
49
25
|
}
|
|
50
26
|
// ------------------------------------------------------------------
|
|
51
27
|
// Types
|
|
52
28
|
// ------------------------------------------------------------------
|
|
53
29
|
function TArray(schema, references, value) {
|
|
54
|
-
if (!(0,
|
|
30
|
+
if (!(0, index_6.IsArray)(value))
|
|
55
31
|
return value;
|
|
56
32
|
return value.map((value) => Visit(schema.items, references, value));
|
|
57
33
|
}
|
|
58
34
|
function TIntersect(schema, references, value) {
|
|
59
35
|
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
60
|
-
const intersections = schema.allOf.map((schema) => Visit(schema, references, (0,
|
|
61
|
-
const composite = intersections.reduce((acc, value) => ((0,
|
|
62
|
-
if (!(0,
|
|
36
|
+
const intersections = schema.allOf.map((schema) => Visit(schema, references, (0, index_3.Clone)(value)));
|
|
37
|
+
const composite = intersections.reduce((acc, value) => ((0, index_6.IsObject)(value) ? { ...acc, ...value } : value), {});
|
|
38
|
+
if (!(0, index_6.IsObject)(value) || !(0, index_6.IsObject)(composite) || !(0, type_1.IsSchema)(unevaluatedProperties))
|
|
63
39
|
return composite;
|
|
64
|
-
const knownkeys = (0,
|
|
40
|
+
const knownkeys = (0, index_1.KeyOfPropertyKeys)(schema);
|
|
65
41
|
for (const key of Object.getOwnPropertyNames(value)) {
|
|
66
42
|
if (knownkeys.includes(key))
|
|
67
43
|
continue;
|
|
68
|
-
if ((0,
|
|
44
|
+
if ((0, index_2.Check)(unevaluatedProperties, references, value[key])) {
|
|
69
45
|
composite[key] = Visit(unevaluatedProperties, references, value[key]);
|
|
70
46
|
}
|
|
71
47
|
}
|
|
72
48
|
return composite;
|
|
73
49
|
}
|
|
74
50
|
function TObject(schema, references, value) {
|
|
75
|
-
if (!(0,
|
|
51
|
+
if (!(0, index_6.IsObject)(value) || (0, index_6.IsArray)(value))
|
|
76
52
|
return value; // Check IsArray for AllowArrayObject configuration
|
|
77
53
|
const additionalProperties = schema.additionalProperties;
|
|
78
54
|
for (const key of Object.getOwnPropertyNames(value)) {
|
|
@@ -80,7 +56,7 @@ function TObject(schema, references, value) {
|
|
|
80
56
|
value[key] = Visit(schema.properties[key], references, value[key]);
|
|
81
57
|
continue;
|
|
82
58
|
}
|
|
83
|
-
if (IsSchema(additionalProperties) && (0,
|
|
59
|
+
if ((0, type_1.IsSchema)(additionalProperties) && (0, index_2.Check)(additionalProperties, references, value[key])) {
|
|
84
60
|
value[key] = Visit(additionalProperties, references, value[key]);
|
|
85
61
|
continue;
|
|
86
62
|
}
|
|
@@ -89,7 +65,7 @@ function TObject(schema, references, value) {
|
|
|
89
65
|
return value;
|
|
90
66
|
}
|
|
91
67
|
function TRecord(schema, references, value) {
|
|
92
|
-
if (!(0,
|
|
68
|
+
if (!(0, index_6.IsObject)(value))
|
|
93
69
|
return value;
|
|
94
70
|
const additionalProperties = schema.additionalProperties;
|
|
95
71
|
const propertyKeys = Object.keys(value);
|
|
@@ -100,7 +76,7 @@ function TRecord(schema, references, value) {
|
|
|
100
76
|
value[key] = Visit(propertySchema, references, value[key]);
|
|
101
77
|
continue;
|
|
102
78
|
}
|
|
103
|
-
if (IsSchema(additionalProperties) && (0,
|
|
79
|
+
if ((0, type_1.IsSchema)(additionalProperties) && (0, index_2.Check)(additionalProperties, references, value[key])) {
|
|
104
80
|
value[key] = Visit(additionalProperties, references, value[key]);
|
|
105
81
|
continue;
|
|
106
82
|
}
|
|
@@ -109,15 +85,15 @@ function TRecord(schema, references, value) {
|
|
|
109
85
|
return value;
|
|
110
86
|
}
|
|
111
87
|
function TRef(schema, references, value) {
|
|
112
|
-
return Visit((0,
|
|
88
|
+
return Visit((0, index_4.Deref)(schema, references), references, value);
|
|
113
89
|
}
|
|
114
90
|
function TThis(schema, references, value) {
|
|
115
|
-
return Visit((0,
|
|
91
|
+
return Visit((0, index_4.Deref)(schema, references), references, value);
|
|
116
92
|
}
|
|
117
93
|
function TTuple(schema, references, value) {
|
|
118
|
-
if (!(0,
|
|
94
|
+
if (!(0, index_6.IsArray)(value))
|
|
119
95
|
return value;
|
|
120
|
-
if ((0,
|
|
96
|
+
if ((0, index_6.IsUndefined)(schema.items))
|
|
121
97
|
return [];
|
|
122
98
|
const length = Math.min(value.length, schema.items.length);
|
|
123
99
|
for (let i = 0; i < length; i++) {
|
|
@@ -130,16 +106,16 @@ function TTuple(schema, references, value) {
|
|
|
130
106
|
}
|
|
131
107
|
function TUnion(schema, references, value) {
|
|
132
108
|
for (const inner of schema.anyOf) {
|
|
133
|
-
if (IsCheckable(inner) && (0,
|
|
109
|
+
if (IsCheckable(inner) && (0, index_2.Check)(inner, value)) {
|
|
134
110
|
return Visit(inner, references, value);
|
|
135
111
|
}
|
|
136
112
|
}
|
|
137
113
|
return value;
|
|
138
114
|
}
|
|
139
115
|
function Visit(schema, references, value) {
|
|
140
|
-
const references_ = (0,
|
|
116
|
+
const references_ = (0, index_6.IsString)(schema.$id) ? [...references, schema] : references;
|
|
141
117
|
const schema_ = schema;
|
|
142
|
-
switch (schema_[
|
|
118
|
+
switch (schema_[index_5.Kind]) {
|
|
143
119
|
case 'Array':
|
|
144
120
|
return TArray(schema_, references_, value);
|
|
145
121
|
case 'Intersect':
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
2
|
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
4
|
if (k2 === undefined) k2 = k;
|
|
31
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
2
|
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
4
|
exports.Clone = void 0;
|
|
5
|
+
// ------------------------------------------------------------------
|
|
6
|
+
// ValueGuard
|
|
7
|
+
// ------------------------------------------------------------------
|
|
31
8
|
const index_1 = require("../guard/index");
|
|
32
|
-
//
|
|
9
|
+
// ------------------------------------------------------------------
|
|
33
10
|
// Clonable
|
|
34
|
-
//
|
|
11
|
+
// ------------------------------------------------------------------
|
|
35
12
|
function ObjectType(value) {
|
|
36
13
|
const keys = [...Object.getOwnPropertyNames(value), ...Object.getOwnPropertySymbols(value)];
|
|
37
14
|
return keys.reduce((acc, key) => ({ ...acc, [key]: Clone(value[key]) }), {});
|
|
@@ -48,9 +25,9 @@ function DateType(value) {
|
|
|
48
25
|
function ValueType(value) {
|
|
49
26
|
return value;
|
|
50
27
|
}
|
|
51
|
-
//
|
|
28
|
+
// ------------------------------------------------------------------
|
|
52
29
|
// Clone
|
|
53
|
-
//
|
|
30
|
+
// ------------------------------------------------------------------
|
|
54
31
|
/** Returns a clone of the given value */
|
|
55
32
|
function Clone(value) {
|
|
56
33
|
if ((0, index_1.IsArray)(value))
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*--------------------------------------------------------------------------
|
|
3
2
|
|
|
4
|
-
@sinclair/typebox/value
|
|
5
|
-
|
|
6
|
-
The MIT License (MIT)
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2017-2023 Haydn Paterson (sinclair) <haydn.developer@gmail.com>
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in
|
|
18
|
-
all copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
-
THE SOFTWARE.
|
|
27
|
-
|
|
28
|
-
---------------------------------------------------------------------------*/
|
|
29
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
4
|
if (k2 === undefined) k2 = k;
|
|
31
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|