@sinclair/typebox 0.32.0-dev-16 → 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.mjs +36 -0
- 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 +7 -0
- 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 +1 -0
- 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 +2 -0
- 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 +34 -0
- 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 +2 -0
- 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 +1 -0
- 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.mjs +42 -0
- package/build/import/type/indexed/indexed.d.mts +3 -0
- package/build/import/type/indexed/indexed.mjs +33 -0
- 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.mjs +27 -0
- package/build/import/type/intersect/intersect-create.mjs +35 -0
- package/build/import/type/intersect/intersect-evaluated.d.mts +1 -0
- package/build/import/type/intersect/intersect-evaluated.mjs +36 -0
- package/build/import/type/intersect/intersect-type.mjs +27 -0
- package/build/import/type/intersect/intersect.d.mts +1 -0
- package/build/import/type/intersect/intersect.mjs +32 -0
- 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 +2 -0
- package/build/import/type/keyof/keyof.mjs +33 -0
- 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 +46 -1
- 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 +5 -0
- 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 -0
- package/build/import/type/record/record.mjs +48 -0
- package/build/import/type/recursive/index.mjs +27 -0
- package/build/import/type/recursive/recursive.d.mts +1 -0
- package/build/import/type/recursive/recursive.mjs +30 -0
- 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 +1 -0
- package/build/import/type/template-literal/syntax.mjs +35 -0
- package/build/import/type/template-literal/template-literal.d.mts +2 -0
- 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 +1 -0
- package/build/import/type/transform/transform.mjs +36 -0
- package/build/import/type/tuple/index.mjs +27 -0
- package/build/import/type/tuple/tuple.d.mts +1 -0
- 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 +62 -1
- 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.mjs +27 -0
- package/build/import/type/union/union-create.mjs +27 -0
- package/build/import/type/union/union-evaluated.d.mts +1 -0
- package/build/import/type/union/union-evaluated.mjs +37 -0
- package/build/import/type/union/union-type.mjs +27 -0
- package/build/import/type/union/union.d.mts +1 -0
- package/build/import/type/union/union.mjs +29 -0
- 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.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.js +36 -0
- 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 +7 -0
- 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 +1 -0
- 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 +2 -0
- 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 +34 -0
- 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 +2 -0
- 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 +1 -0
- 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.js +42 -0
- package/build/require/type/indexed/indexed.d.ts +3 -0
- package/build/require/type/indexed/indexed.js +33 -0
- 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.js +27 -0
- package/build/require/type/intersect/intersect-create.js +35 -0
- package/build/require/type/intersect/intersect-evaluated.d.ts +1 -0
- package/build/require/type/intersect/intersect-evaluated.js +36 -0
- package/build/require/type/intersect/intersect-type.js +27 -0
- package/build/require/type/intersect/intersect.d.ts +1 -0
- package/build/require/type/intersect/intersect.js +32 -0
- 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 +2 -0
- package/build/require/type/keyof/keyof.js +33 -0
- 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 +46 -1
- 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 +5 -0
- 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 -0
- package/build/require/type/record/record.js +48 -0
- package/build/require/type/recursive/index.js +27 -0
- package/build/require/type/recursive/recursive.d.ts +1 -0
- package/build/require/type/recursive/recursive.js +30 -0
- 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 +1 -0
- package/build/require/type/template-literal/syntax.js +35 -0
- package/build/require/type/template-literal/template-literal.d.ts +2 -0
- 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 +1 -0
- package/build/require/type/transform/transform.js +36 -0
- package/build/require/type/tuple/index.js +27 -0
- package/build/require/type/tuple/tuple.d.ts +1 -0
- 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 +62 -1
- 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.js +27 -0
- package/build/require/type/union/union-create.js +27 -0
- package/build/require/type/union/union-evaluated.d.ts +1 -0
- package/build/require/type/union/union-evaluated.js +37 -0
- package/build/require/type/union/union-type.js +27 -0
- package/build/require/type/union/union.d.ts +1 -0
- package/build/require/type/union/union.js +29 -0
- 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.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 +2 -3
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
30
|
exports.Mutate = exports.ValueMutateInvalidRootMutationError = exports.ValueMutateTypeMismatchError = void 0;
|
|
4
31
|
const index_1 = require("../guard/index");
|
|
5
32
|
const index_2 = require("../pointer/index");
|
|
6
33
|
const index_3 = require("../clone/index");
|
|
34
|
+
// ------------------------------------------------------------------
|
|
35
|
+
// Errors
|
|
36
|
+
// ------------------------------------------------------------------
|
|
7
37
|
class ValueMutateTypeMismatchError extends Error {
|
|
8
38
|
constructor() {
|
|
9
39
|
super('Cannot assign due type mismatch of assignable values');
|
|
@@ -74,13 +104,21 @@ function Visit(root, path, current, next) {
|
|
|
74
104
|
if ((0, index_1.IsValueType)(next))
|
|
75
105
|
return ValueType(root, path, current, next);
|
|
76
106
|
}
|
|
107
|
+
// ------------------------------------------------------------------
|
|
108
|
+
// IsNonMutableValue
|
|
109
|
+
// ------------------------------------------------------------------
|
|
77
110
|
function IsNonMutableValue(value) {
|
|
78
111
|
return (0, index_1.IsTypedArray)(value) || (0, index_1.IsValueType)(value);
|
|
79
112
|
}
|
|
80
113
|
function IsMismatchedValue(current, next) {
|
|
114
|
+
// prettier-ignore
|
|
81
115
|
return (((0, index_1.IsPlainObject)(current) && (0, index_1.IsArray)(next)) ||
|
|
82
116
|
((0, index_1.IsArray)(current) && (0, index_1.IsPlainObject)(next)));
|
|
83
117
|
}
|
|
118
|
+
// ------------------------------------------------------------------
|
|
119
|
+
// Mutate
|
|
120
|
+
// ------------------------------------------------------------------
|
|
121
|
+
/** `[Mutable]` Performs a deep mutable value assignment while retaining internal references */
|
|
84
122
|
function Mutate(current, next) {
|
|
85
123
|
if (IsNonMutableValue(current) || IsNonMutableValue(next))
|
|
86
124
|
throw new ValueMutateInvalidRootMutationError();
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
30
|
exports.ValuePointer = void 0;
|
|
4
31
|
exports.ValuePointer = require("./pointer");
|
|
@@ -9,8 +9,13 @@ export declare class ValuePointerRootDeleteError extends Error {
|
|
|
9
9
|
readonly path: string;
|
|
10
10
|
constructor(value: unknown, path: string);
|
|
11
11
|
}
|
|
12
|
+
/** Formats the given pointer into navigable key components */
|
|
12
13
|
export declare function Format(pointer: string): IterableIterator<string>;
|
|
14
|
+
/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */
|
|
13
15
|
export declare function Set(value: any, pointer: string, update: unknown): void;
|
|
16
|
+
/** Deletes a value at the given pointer */
|
|
14
17
|
export declare function Delete(value: any, pointer: string): void;
|
|
18
|
+
/** Returns true if a value exists at the given pointer */
|
|
15
19
|
export declare function Has(value: any, pointer: string): boolean;
|
|
20
|
+
/** Gets the value at the given pointer */
|
|
16
21
|
export declare function Get(value: any, pointer: string): any;
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
30
|
exports.Get = exports.Has = exports.Delete = exports.Set = exports.Format = exports.ValuePointerRootDeleteError = exports.ValuePointerRootSetError = void 0;
|
|
31
|
+
// ------------------------------------------------------------------
|
|
32
|
+
// Errors
|
|
33
|
+
// ------------------------------------------------------------------
|
|
4
34
|
class ValuePointerRootSetError extends Error {
|
|
5
35
|
constructor(value, path, update) {
|
|
6
36
|
super('Cannot set root value');
|
|
@@ -18,9 +48,16 @@ class ValuePointerRootDeleteError extends Error {
|
|
|
18
48
|
}
|
|
19
49
|
}
|
|
20
50
|
exports.ValuePointerRootDeleteError = ValuePointerRootDeleteError;
|
|
51
|
+
// ------------------------------------------------------------------
|
|
52
|
+
// ValuePointer
|
|
53
|
+
// ------------------------------------------------------------------
|
|
54
|
+
/** Provides functionality to update values through RFC6901 string pointers */
|
|
55
|
+
// prettier-ignore
|
|
21
56
|
function Escape(component) {
|
|
22
57
|
return component.indexOf('~') === -1 ? component : component.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
23
58
|
}
|
|
59
|
+
/** Formats the given pointer into navigable key components */
|
|
60
|
+
// prettier-ignore
|
|
24
61
|
function* Format(pointer) {
|
|
25
62
|
if (pointer === '')
|
|
26
63
|
return;
|
|
@@ -44,6 +81,8 @@ function* Format(pointer) {
|
|
|
44
81
|
yield Escape(pointer.slice(start));
|
|
45
82
|
}
|
|
46
83
|
exports.Format = Format;
|
|
84
|
+
/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */
|
|
85
|
+
// prettier-ignore
|
|
47
86
|
function Set(value, pointer, update) {
|
|
48
87
|
if (pointer === '')
|
|
49
88
|
throw new ValuePointerRootSetError(value, pointer, update);
|
|
@@ -58,6 +97,8 @@ function Set(value, pointer, update) {
|
|
|
58
97
|
owner[key] = update;
|
|
59
98
|
}
|
|
60
99
|
exports.Set = Set;
|
|
100
|
+
/** Deletes a value at the given pointer */
|
|
101
|
+
// prettier-ignore
|
|
61
102
|
function Delete(value, pointer) {
|
|
62
103
|
if (pointer === '')
|
|
63
104
|
throw new ValuePointerRootDeleteError(value, pointer);
|
|
@@ -78,6 +119,8 @@ function Delete(value, pointer) {
|
|
|
78
119
|
}
|
|
79
120
|
}
|
|
80
121
|
exports.Delete = Delete;
|
|
122
|
+
/** Returns true if a value exists at the given pointer */
|
|
123
|
+
// prettier-ignore
|
|
81
124
|
function Has(value, pointer) {
|
|
82
125
|
if (pointer === '')
|
|
83
126
|
return true;
|
|
@@ -92,6 +135,8 @@ function Has(value, pointer) {
|
|
|
92
135
|
return Object.getOwnPropertyNames(owner).includes(key);
|
|
93
136
|
}
|
|
94
137
|
exports.Has = Has;
|
|
138
|
+
/** Gets the value at the given pointer */
|
|
139
|
+
// prettier-ignore
|
|
95
140
|
function Get(value, pointer) {
|
|
96
141
|
if (pointer === '')
|
|
97
142
|
return value;
|
|
@@ -11,4 +11,9 @@ export declare class TransformDecodeError extends Error {
|
|
|
11
11
|
readonly value: unknown;
|
|
12
12
|
constructor(schema: TSchema, value: unknown, error: any);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* `[Internal]` Decodes the value and returns the result. This function requires that
|
|
16
|
+
* the caller `Check` the value before use. Passing unchecked values may result in
|
|
17
|
+
* undefined behavior. Refer to the `Value.Decode()` for implementation details.
|
|
18
|
+
*/
|
|
14
19
|
export declare function TransformDecode(schema: TSchema, references: TSchema[], value: unknown): unknown;
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
30
|
exports.TransformDecode = exports.TransformDecodeError = exports.TransformDecodeCheckError = void 0;
|
|
4
31
|
const type_1 = require("../../type/guard/type");
|
|
@@ -8,6 +35,10 @@ const index_3 = require("../../type/keyof/index");
|
|
|
8
35
|
const index_4 = require("../../type/indexed/index");
|
|
9
36
|
const index_5 = require("../deref/index");
|
|
10
37
|
const index_6 = require("../check/index");
|
|
38
|
+
// ------------------------------------------------------------------
|
|
39
|
+
// Errors
|
|
40
|
+
// ------------------------------------------------------------------
|
|
41
|
+
// thrown externally
|
|
11
42
|
class TransformDecodeCheckError extends Error {
|
|
12
43
|
constructor(schema, value, error) {
|
|
13
44
|
super(`Unable to decode due to invalid value`);
|
|
@@ -25,6 +56,10 @@ class TransformDecodeError extends Error {
|
|
|
25
56
|
}
|
|
26
57
|
}
|
|
27
58
|
exports.TransformDecodeError = TransformDecodeError;
|
|
59
|
+
// ------------------------------------------------------------------
|
|
60
|
+
// Decode
|
|
61
|
+
// ------------------------------------------------------------------
|
|
62
|
+
// prettier-ignore
|
|
28
63
|
function Default(schema, value) {
|
|
29
64
|
try {
|
|
30
65
|
return (0, type_1.TTransform)(schema) ? schema[index_1.TransformKind].Decode(value) : value;
|
|
@@ -33,11 +68,13 @@ function Default(schema, value) {
|
|
|
33
68
|
throw new TransformDecodeError(schema, value, error);
|
|
34
69
|
}
|
|
35
70
|
}
|
|
71
|
+
// prettier-ignore
|
|
36
72
|
function TArray(schema, references, value) {
|
|
37
73
|
return ((0, index_2.IsArray)(value))
|
|
38
74
|
? Default(schema, value.map((value) => Visit(schema.items, references, value)))
|
|
39
75
|
: Default(schema, value);
|
|
40
76
|
}
|
|
77
|
+
// prettier-ignore
|
|
41
78
|
function TIntersect(schema, references, value) {
|
|
42
79
|
if (!(0, index_2.IsPlainObject)(value) || (0, index_2.IsValueType)(value))
|
|
43
80
|
return Default(schema, value);
|
|
@@ -62,6 +99,7 @@ function TIntersect(schema, references, value) {
|
|
|
62
99
|
function TNot(schema, references, value) {
|
|
63
100
|
return Default(schema, Visit(schema.not, references, value));
|
|
64
101
|
}
|
|
102
|
+
// prettier-ignore
|
|
65
103
|
function TObject(schema, references, value) {
|
|
66
104
|
if (!(0, index_2.IsPlainObject)(value))
|
|
67
105
|
return Default(schema, value);
|
|
@@ -83,6 +121,7 @@ function TObject(schema, references, value) {
|
|
|
83
121
|
}, knownProperties);
|
|
84
122
|
return Default(schema, unknownProperties);
|
|
85
123
|
}
|
|
124
|
+
// prettier-ignore
|
|
86
125
|
function TRecord(schema, references, value) {
|
|
87
126
|
if (!(0, index_2.IsPlainObject)(value))
|
|
88
127
|
return Default(schema, value);
|
|
@@ -105,28 +144,34 @@ function TRecord(schema, references, value) {
|
|
|
105
144
|
}, knownProperties);
|
|
106
145
|
return Default(schema, unknownProperties);
|
|
107
146
|
}
|
|
147
|
+
// prettier-ignore
|
|
108
148
|
function TRef(schema, references, value) {
|
|
109
149
|
const target = (0, index_5.Deref)(schema, references);
|
|
110
150
|
return Default(schema, Visit(target, references, value));
|
|
111
151
|
}
|
|
152
|
+
// prettier-ignore
|
|
112
153
|
function TThis(schema, references, value) {
|
|
113
154
|
const target = (0, index_5.Deref)(schema, references);
|
|
114
155
|
return Default(schema, Visit(target, references, value));
|
|
115
156
|
}
|
|
157
|
+
// prettier-ignore
|
|
116
158
|
function TTuple(schema, references, value) {
|
|
117
159
|
return ((0, index_2.IsArray)(value) && (0, index_2.IsArray)(schema.items))
|
|
118
160
|
? Default(schema, schema.items.map((schema, index) => Visit(schema, references, value[index])))
|
|
119
161
|
: Default(schema, value);
|
|
120
162
|
}
|
|
163
|
+
// prettier-ignore
|
|
121
164
|
function TUnion(schema, references, value) {
|
|
122
165
|
for (const subschema of schema.anyOf) {
|
|
123
166
|
if (!(0, index_6.Check)(subschema, references, value))
|
|
124
167
|
continue;
|
|
168
|
+
// note: ensure interior is decoded first
|
|
125
169
|
const decoded = Visit(subschema, references, value);
|
|
126
170
|
return Default(schema, decoded);
|
|
127
171
|
}
|
|
128
172
|
return Default(schema, value);
|
|
129
173
|
}
|
|
174
|
+
// prettier-ignore
|
|
130
175
|
function Visit(schema, references, value) {
|
|
131
176
|
const references_ = typeof schema.$id === 'string' ? [...references, schema] : references;
|
|
132
177
|
const schema_ = schema;
|
|
@@ -155,6 +200,11 @@ function Visit(schema, references, value) {
|
|
|
155
200
|
return Default(schema_, value);
|
|
156
201
|
}
|
|
157
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* `[Internal]` Decodes the value and returns the result. This function requires that
|
|
205
|
+
* the caller `Check` the value before use. Passing unchecked values may result in
|
|
206
|
+
* undefined behavior. Refer to the `Value.Decode()` for implementation details.
|
|
207
|
+
*/
|
|
158
208
|
function TransformDecode(schema, references, value) {
|
|
159
209
|
return Visit(schema, references, value);
|
|
160
210
|
}
|
|
@@ -11,4 +11,10 @@ export declare class TransformEncodeError extends Error {
|
|
|
11
11
|
readonly value: unknown;
|
|
12
12
|
constructor(schema: TSchema, value: unknown, error: any);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* `[Internal]` Encodes the value and returns the result. This function expects the
|
|
16
|
+
* caller to pass a statically checked value. This function does not check the encoded
|
|
17
|
+
* result, meaning the result should be passed to `Check` before use. Refer to the
|
|
18
|
+
* `Value.Encode()` function for implementation details.
|
|
19
|
+
*/
|
|
14
20
|
export declare function TransformEncode(schema: TSchema, references: TSchema[], value: unknown): unknown;
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
30
|
exports.TransformEncode = exports.TransformEncodeError = exports.TransformEncodeCheckError = void 0;
|
|
4
31
|
const type_1 = require("../../type/guard/type");
|
|
@@ -8,6 +35,9 @@ const index_3 = require("../../type/keyof/index");
|
|
|
8
35
|
const index_4 = require("../../type/indexed/index");
|
|
9
36
|
const index_5 = require("../deref/index");
|
|
10
37
|
const index_6 = require("../check/index");
|
|
38
|
+
// ------------------------------------------------------------------
|
|
39
|
+
// Errors
|
|
40
|
+
// ------------------------------------------------------------------
|
|
11
41
|
class TransformEncodeCheckError extends Error {
|
|
12
42
|
constructor(schema, value, error) {
|
|
13
43
|
super(`Unable to encode due to invalid value`);
|
|
@@ -25,6 +55,10 @@ class TransformEncodeError extends Error {
|
|
|
25
55
|
}
|
|
26
56
|
}
|
|
27
57
|
exports.TransformEncodeError = TransformEncodeError;
|
|
58
|
+
// ------------------------------------------------------------------
|
|
59
|
+
// Encode
|
|
60
|
+
// ------------------------------------------------------------------
|
|
61
|
+
// prettier-ignore
|
|
28
62
|
function Default(schema, value) {
|
|
29
63
|
try {
|
|
30
64
|
return (0, type_1.TTransform)(schema) ? schema[index_1.TransformKind].Encode(value) : value;
|
|
@@ -33,12 +67,14 @@ function Default(schema, value) {
|
|
|
33
67
|
throw new TransformEncodeError(schema, value, error);
|
|
34
68
|
}
|
|
35
69
|
}
|
|
70
|
+
// prettier-ignore
|
|
36
71
|
function TArray(schema, references, value) {
|
|
37
72
|
const defaulted = Default(schema, value);
|
|
38
73
|
return (0, index_2.IsArray)(defaulted)
|
|
39
74
|
? defaulted.map((value) => Visit(schema.items, references, value))
|
|
40
75
|
: defaulted;
|
|
41
76
|
}
|
|
77
|
+
// prettier-ignore
|
|
42
78
|
function TIntersect(schema, references, value) {
|
|
43
79
|
const defaulted = Default(schema, value);
|
|
44
80
|
if (!(0, index_2.IsPlainObject)(value) || (0, index_2.IsValueType)(value))
|
|
@@ -60,9 +96,11 @@ function TIntersect(schema, references, value) {
|
|
|
60
96
|
: value;
|
|
61
97
|
}, knownProperties);
|
|
62
98
|
}
|
|
99
|
+
// prettier-ignore
|
|
63
100
|
function TNot(schema, references, value) {
|
|
64
101
|
return Default(schema.not, Default(schema, value));
|
|
65
102
|
}
|
|
103
|
+
// prettier-ignore
|
|
66
104
|
function TObject(schema, references, value) {
|
|
67
105
|
const defaulted = Default(schema, value);
|
|
68
106
|
if (!(0, index_2.IsPlainObject)(value))
|
|
@@ -84,6 +122,7 @@ function TObject(schema, references, value) {
|
|
|
84
122
|
: value;
|
|
85
123
|
}, knownProperties);
|
|
86
124
|
}
|
|
125
|
+
// prettier-ignore
|
|
87
126
|
function TRecord(schema, references, value) {
|
|
88
127
|
const defaulted = Default(schema, value);
|
|
89
128
|
if (!(0, index_2.IsPlainObject)(value))
|
|
@@ -106,27 +145,33 @@ function TRecord(schema, references, value) {
|
|
|
106
145
|
: value;
|
|
107
146
|
}, knownProperties);
|
|
108
147
|
}
|
|
148
|
+
// prettier-ignore
|
|
109
149
|
function TRef(schema, references, value) {
|
|
110
150
|
const target = (0, index_5.Deref)(schema, references);
|
|
111
151
|
const resolved = Visit(target, references, value);
|
|
112
152
|
return Default(schema, resolved);
|
|
113
153
|
}
|
|
154
|
+
// prettier-ignore
|
|
114
155
|
function TThis(schema, references, value) {
|
|
115
156
|
const target = (0, index_5.Deref)(schema, references);
|
|
116
157
|
const resolved = Visit(target, references, value);
|
|
117
158
|
return Default(schema, resolved);
|
|
118
159
|
}
|
|
160
|
+
// prettier-ignore
|
|
119
161
|
function TTuple(schema, references, value) {
|
|
120
162
|
const value1 = Default(schema, value);
|
|
121
163
|
return (0, index_2.IsArray)(schema.items) ? schema.items.map((schema, index) => Visit(schema, references, value1[index])) : [];
|
|
122
164
|
}
|
|
165
|
+
// prettier-ignore
|
|
123
166
|
function TUnion(schema, references, value) {
|
|
167
|
+
// test value against union variants
|
|
124
168
|
for (const subschema of schema.anyOf) {
|
|
125
169
|
if (!(0, index_6.Check)(subschema, references, value))
|
|
126
170
|
continue;
|
|
127
171
|
const value1 = Visit(subschema, references, value);
|
|
128
172
|
return Default(schema, value1);
|
|
129
173
|
}
|
|
174
|
+
// test transformed value against union variants
|
|
130
175
|
for (const subschema of schema.anyOf) {
|
|
131
176
|
const value1 = Visit(subschema, references, value);
|
|
132
177
|
if (!(0, index_6.Check)(schema, references, value1))
|
|
@@ -135,6 +180,7 @@ function TUnion(schema, references, value) {
|
|
|
135
180
|
}
|
|
136
181
|
return Default(schema, value);
|
|
137
182
|
}
|
|
183
|
+
// prettier-ignore
|
|
138
184
|
function Visit(schema, references, value) {
|
|
139
185
|
const references_ = typeof schema.$id === 'string' ? [...references, schema] : references;
|
|
140
186
|
const schema_ = schema;
|
|
@@ -161,6 +207,12 @@ function Visit(schema, references, value) {
|
|
|
161
207
|
return Default(schema_, value);
|
|
162
208
|
}
|
|
163
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* `[Internal]` Encodes the value and returns the result. This function expects the
|
|
212
|
+
* caller to pass a statically checked value. This function does not check the encoded
|
|
213
|
+
* result, meaning the result should be passed to `Check` before use. Refer to the
|
|
214
|
+
* `Value.Encode()` function for implementation details.
|
|
215
|
+
*/
|
|
164
216
|
function TransformEncode(schema, references, value) {
|
|
165
217
|
return Visit(schema, references, value);
|
|
166
218
|
}
|
|
@@ -1,60 +1,102 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
30
|
exports.HasTransform = void 0;
|
|
4
31
|
const type_1 = require("../../type/guard/type");
|
|
5
32
|
const index_1 = require("../guard/index");
|
|
6
33
|
const index_2 = require("../deref/index");
|
|
7
34
|
const index_3 = require("../../type/symbols/index");
|
|
35
|
+
// prettier-ignore
|
|
8
36
|
function TArray(schema, references) {
|
|
9
37
|
return (0, type_1.TTransform)(schema) || Visit(schema.items, references);
|
|
10
38
|
}
|
|
39
|
+
// prettier-ignore
|
|
11
40
|
function TAsyncIterator(schema, references) {
|
|
12
41
|
return (0, type_1.TTransform)(schema) || Visit(schema.items, references);
|
|
13
42
|
}
|
|
43
|
+
// prettier-ignore
|
|
14
44
|
function TConstructor(schema, references) {
|
|
15
45
|
return (0, type_1.TTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references));
|
|
16
46
|
}
|
|
47
|
+
// prettier-ignore
|
|
17
48
|
function TFunction(schema, references) {
|
|
18
49
|
return (0, type_1.TTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references));
|
|
19
50
|
}
|
|
51
|
+
// prettier-ignore
|
|
20
52
|
function TIntersect(schema, references) {
|
|
21
53
|
return (0, type_1.TTransform)(schema) || (0, type_1.TTransform)(schema.unevaluatedProperties) || schema.allOf.some((schema) => Visit(schema, references));
|
|
22
54
|
}
|
|
55
|
+
// prettier-ignore
|
|
23
56
|
function TIterator(schema, references) {
|
|
24
57
|
return (0, type_1.TTransform)(schema) || Visit(schema.items, references);
|
|
25
58
|
}
|
|
59
|
+
// prettier-ignore
|
|
26
60
|
function TNot(schema, references) {
|
|
27
61
|
return (0, type_1.TTransform)(schema) || Visit(schema.not, references);
|
|
28
62
|
}
|
|
63
|
+
// prettier-ignore
|
|
29
64
|
function TObject(schema, references) {
|
|
30
65
|
return ((0, type_1.TTransform)(schema) ||
|
|
31
66
|
Object.values(schema.properties).some((schema) => Visit(schema, references)) ||
|
|
32
67
|
((0, type_1.TSchema)(schema.additionalProperties) && Visit(schema.additionalProperties, references)));
|
|
33
68
|
}
|
|
69
|
+
// prettier-ignore
|
|
34
70
|
function TPromise(schema, references) {
|
|
35
71
|
return (0, type_1.TTransform)(schema) || Visit(schema.item, references);
|
|
36
72
|
}
|
|
73
|
+
// prettier-ignore
|
|
37
74
|
function TRecord(schema, references) {
|
|
38
75
|
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
39
76
|
const property = schema.patternProperties[pattern];
|
|
40
77
|
return (0, type_1.TTransform)(schema) || Visit(property, references) || ((0, type_1.TSchema)(schema.additionalProperties) && (0, type_1.TTransform)(schema.additionalProperties));
|
|
41
78
|
}
|
|
79
|
+
// prettier-ignore
|
|
42
80
|
function TRef(schema, references) {
|
|
43
81
|
if ((0, type_1.TTransform)(schema))
|
|
44
82
|
return true;
|
|
45
83
|
return Visit((0, index_2.Deref)(schema, references), references);
|
|
46
84
|
}
|
|
85
|
+
// prettier-ignore
|
|
47
86
|
function TThis(schema, references) {
|
|
48
87
|
if ((0, type_1.TTransform)(schema))
|
|
49
88
|
return true;
|
|
50
89
|
return Visit((0, index_2.Deref)(schema, references), references);
|
|
51
90
|
}
|
|
91
|
+
// prettier-ignore
|
|
52
92
|
function TTuple(schema, references) {
|
|
53
93
|
return (0, type_1.TTransform)(schema) || (!(0, index_1.IsUndefined)(schema.items) && schema.items.some((schema) => Visit(schema, references)));
|
|
54
94
|
}
|
|
95
|
+
// prettier-ignore
|
|
55
96
|
function TUnion(schema, references) {
|
|
56
97
|
return (0, type_1.TTransform)(schema) || schema.anyOf.some((schema) => Visit(schema, references));
|
|
57
98
|
}
|
|
99
|
+
// prettier-ignore
|
|
58
100
|
function Visit(schema, references) {
|
|
59
101
|
const references_ = (0, index_1.IsString)(schema.$id) ? [...references, schema] : references;
|
|
60
102
|
const schema_ = schema;
|
|
@@ -96,6 +138,7 @@ function Visit(schema, references) {
|
|
|
96
138
|
}
|
|
97
139
|
}
|
|
98
140
|
const visited = new Set();
|
|
141
|
+
/** Returns true if this schema contains a transform codec */
|
|
99
142
|
function HasTransform(schema, references) {
|
|
100
143
|
visited.clear();
|
|
101
144
|
return Visit(schema, references);
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
30
|
if (k2 === undefined) k2 = k;
|
|
4
31
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*--------------------------------------------------------------------------
|
|
3
|
+
|
|
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
|
+
---------------------------------------------------------------------------*/
|
|
2
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
30
|
exports.Value = void 0;
|
|
4
31
|
exports.Value = require("./value");
|