From 46f63ef9aee114f7fdf3c8e3031b0f018e392c1e Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 23 Feb 2026 21:58:16 -0500 Subject: [PATCH 01/12] add blobstream rpc, contracts, and UI demo --- Cargo.lock | 2460 +++++++++++++++-- Cargo.toml | 2 + README.md | 117 + contracts/cache/solidity-files-cache.json | 1 + contracts/foundry.toml | 4 + contracts/lib/DataRootTuple.sol | 15 + contracts/lib/IBlobstreamX.sol | 45 + contracts/lib/tree/Constants.sol | 23 + contracts/lib/tree/Types.sol | 37 + contracts/lib/tree/Utils.sol | 106 + .../tree/binary/BinaryMerkleMultiproof.sol | 12 + .../lib/tree/binary/BinaryMerkleProof.sol | 12 + .../lib/tree/binary/BinaryMerkleTree.sol | 256 ++ contracts/lib/tree/binary/TreeHasher.sol | 23 + .../BinaryMerkleTree.json | 1 + contracts/out/Constants.sol/Constants.json | 1 + .../out/IBlobstreamX.sol/IBlobstreamX.json | 1 + .../out/MockBlobstream.sol/Mockstream.json | 1 + .../out/build-info/9b5d39574bb3a56d.json | 1 + contracts/remappings.txt | 1 + contracts/scripts/deploy_mock_blobstream.sh | 45 + contracts/src/MockBlobstream.sol | 61 + scripts/setup_anvil.sh | 51 + src/bin/blobstream_relayer.rs | 7 + src/cli.rs | 755 +++++ src/lib.rs | 1 + src/main.rs | 115 +- src/relayer.rs | 172 ++ src/rpc/blob.rs | 53 - src/rpc/blobstream.rs | 120 + src/rpc/mod.rs | 1 + tests/compat_blobstream.rs | 253 ++ tests/compat_report.rs | 13 + tests/process_server.rs | 9 + tests/utils/mod.rs | 7 +- ui/bun.lock | 47 + .../@borewit/text-codec/LICENSE.txt | 9 + ui/node_modules/@borewit/text-codec/README.md | 96 + .../@borewit/text-codec/lib/index.d.ts | 8 + .../@borewit/text-codec/lib/index.js | 236 ++ .../@borewit/text-codec/package.json | 70 + .../typebox/build/cjs/compiler/compiler.d.ts | 55 + .../typebox/build/cjs/compiler/compiler.js | 670 +++++ .../typebox/build/cjs/compiler/index.d.ts | 2 + .../typebox/build/cjs/compiler/index.js | 22 + .../typebox/build/cjs/errors/errors.d.ts | 91 + .../typebox/build/cjs/errors/errors.js | 599 ++++ .../typebox/build/cjs/errors/function.d.ts | 21 + .../typebox/build/cjs/errors/function.js | 153 + .../typebox/build/cjs/errors/index.d.ts | 2 + .../typebox/build/cjs/errors/index.js | 19 + .../@sinclair/typebox/build/cjs/index.d.ts | 71 + .../@sinclair/typebox/build/cjs/index.js | 97 + .../typebox/build/cjs/parser/index.d.ts | 2 + .../typebox/build/cjs/parser/index.js | 39 + .../build/cjs/parser/runtime/guard.d.ts | 23 + .../typebox/build/cjs/parser/runtime/guard.js | 86 + .../build/cjs/parser/runtime/index.d.ts | 5 + .../typebox/build/cjs/parser/runtime/index.js | 45 + .../build/cjs/parser/runtime/module.d.ts | 9 + .../build/cjs/parser/runtime/module.js | 22 + .../build/cjs/parser/runtime/parse.d.ts | 9 + .../typebox/build/cjs/parser/runtime/parse.js | 160 ++ .../build/cjs/parser/runtime/token.d.ts | 8 + .../typebox/build/cjs/parser/runtime/token.js | 230 ++ .../build/cjs/parser/runtime/types.d.ts | 98 + .../typebox/build/cjs/parser/runtime/types.js | 71 + .../build/cjs/parser/static/index.d.ts | 3 + .../typebox/build/cjs/parser/static/index.js | 43 + .../build/cjs/parser/static/parse.d.ts | 20 + .../typebox/build/cjs/parser/static/parse.js | 3 + .../build/cjs/parser/static/token.d.ts | 108 + .../typebox/build/cjs/parser/static/token.js | 3 + .../build/cjs/parser/static/types.d.ts | 69 + .../typebox/build/cjs/parser/static/types.js | 3 + .../typebox/build/cjs/syntax/index.d.ts | 1 + .../typebox/build/cjs/syntax/index.js | 18 + .../typebox/build/cjs/syntax/mapping.d.ts | 167 ++ .../typebox/build/cjs/syntax/mapping.js | 491 ++++ .../typebox/build/cjs/syntax/parser.d.ts | 162 ++ .../typebox/build/cjs/syntax/parser.js | 191 ++ .../typebox/build/cjs/syntax/syntax.d.ts | 12 + .../typebox/build/cjs/syntax/syntax.js | 54 + .../typebox/build/cjs/system/index.d.ts | 2 + .../typebox/build/cjs/system/index.js | 19 + .../typebox/build/cjs/system/policy.d.ts | 29 + .../typebox/build/cjs/system/policy.js | 58 + .../typebox/build/cjs/system/system.d.ts | 16 + .../typebox/build/cjs/system/system.js | 43 + .../typebox/build/cjs/type/any/any.d.ts | 8 + .../typebox/build/cjs/type/any/any.js | 10 + .../typebox/build/cjs/type/any/index.d.ts | 1 + .../typebox/build/cjs/type/any/index.js | 18 + .../build/cjs/type/argument/argument.d.ts | 9 + .../build/cjs/type/argument/argument.js | 10 + .../build/cjs/type/argument/index.d.ts | 1 + .../typebox/build/cjs/type/argument/index.js | 18 + .../typebox/build/cjs/type/array/array.d.ts | 28 + .../typebox/build/cjs/type/array/array.js | 10 + .../typebox/build/cjs/type/array/index.d.ts | 1 + .../typebox/build/cjs/type/array/index.js | 18 + .../type/async-iterator/async-iterator.d.ts | 11 + .../cjs/type/async-iterator/async-iterator.js | 10 + .../build/cjs/type/async-iterator/index.d.ts | 1 + .../build/cjs/type/async-iterator/index.js | 18 + .../build/cjs/type/awaited/awaited.d.ts | 14 + .../typebox/build/cjs/type/awaited/awaited.js | 41 + .../typebox/build/cjs/type/awaited/index.d.ts | 1 + .../typebox/build/cjs/type/awaited/index.js | 18 + .../typebox/build/cjs/type/bigint/bigint.d.ts | 16 + .../typebox/build/cjs/type/bigint/bigint.js | 10 + .../typebox/build/cjs/type/bigint/index.d.ts | 1 + .../typebox/build/cjs/type/bigint/index.js | 18 + .../build/cjs/type/boolean/boolean.d.ts | 9 + .../typebox/build/cjs/type/boolean/boolean.js | 10 + .../typebox/build/cjs/type/boolean/index.d.ts | 1 + .../typebox/build/cjs/type/boolean/index.js | 18 + .../typebox/build/cjs/type/clone/index.d.ts | 2 + .../typebox/build/cjs/type/clone/index.js | 19 + .../typebox/build/cjs/type/clone/type.d.ts | 5 + .../typebox/build/cjs/type/clone/type.js | 14 + .../typebox/build/cjs/type/clone/value.d.ts | 2 + .../typebox/build/cjs/type/clone/value.js | 73 + .../build/cjs/type/composite/composite.d.ts | 18 + .../build/cjs/type/composite/composite.js | 46 + .../build/cjs/type/composite/index.d.ts | 1 + .../typebox/build/cjs/type/composite/index.js | 18 + .../build/cjs/type/computed/computed.d.ts | 9 + .../build/cjs/type/computed/computed.js | 10 + .../build/cjs/type/computed/index.d.ts | 1 + .../typebox/build/cjs/type/computed/index.js | 18 + .../typebox/build/cjs/type/const/const.d.ts | 27 + .../typebox/build/cjs/type/const/const.js | 58 + .../typebox/build/cjs/type/const/index.d.ts | 1 + .../typebox/build/cjs/type/const/index.js | 18 + .../constructor-parameters.d.ts | 7 + .../constructor-parameters.js | 44 + .../type/constructor-parameters/index.d.ts | 1 + .../cjs/type/constructor-parameters/index.js | 18 + .../cjs/type/constructor/constructor.d.ts | 23 + .../build/cjs/type/constructor/constructor.js | 10 + .../build/cjs/type/constructor/index.d.ts | 1 + .../build/cjs/type/constructor/index.js | 18 + .../build/cjs/type/create/immutable.d.ts | 2 + .../build/cjs/type/create/immutable.js | 70 + .../typebox/build/cjs/type/create/index.d.ts | 1 + .../typebox/build/cjs/type/create/index.js | 18 + .../typebox/build/cjs/type/create/type.d.ts | 3 + .../typebox/build/cjs/type/create/type.js | 19 + .../typebox/build/cjs/type/date/date.d.ts | 21 + .../typebox/build/cjs/type/date/date.js | 10 + .../typebox/build/cjs/type/date/index.d.ts | 1 + .../typebox/build/cjs/type/date/index.js | 18 + .../build/cjs/type/discard/discard.d.ts | 2 + .../typebox/build/cjs/type/discard/discard.js | 12 + .../typebox/build/cjs/type/discard/index.d.ts | 1 + .../typebox/build/cjs/type/discard/index.js | 18 + .../typebox/build/cjs/type/enum/enum.d.ts | 14 + .../typebox/build/cjs/type/enum/enum.js | 22 + .../typebox/build/cjs/type/enum/index.d.ts | 1 + .../typebox/build/cjs/type/enum/index.js | 18 + .../typebox/build/cjs/type/error/error.d.ts | 4 + .../typebox/build/cjs/type/error/error.js | 11 + .../typebox/build/cjs/type/error/index.d.ts | 1 + .../typebox/build/cjs/type/error/index.js | 18 + .../exclude/exclude-from-mapped-result.d.ts | 11 + .../exclude/exclude-from-mapped-result.js | 22 + .../exclude-from-template-literal.d.ts | 5 + .../exclude/exclude-from-template-literal.js | 9 + .../build/cjs/type/exclude/exclude.d.ts | 21 + .../typebox/build/cjs/type/exclude/exclude.js | 29 + .../typebox/build/cjs/type/exclude/index.d.ts | 3 + .../typebox/build/cjs/type/exclude/index.js | 20 + .../build/cjs/type/extends/extends-check.d.ts | 10 + .../build/cjs/type/extends/extends-check.js | 641 +++++ .../type/extends/extends-from-mapped-key.d.ts | 14 + .../type/extends/extends-from-mapped-key.js | 29 + .../extends/extends-from-mapped-result.d.ts | 11 + .../extends/extends-from-mapped-result.js | 23 + .../cjs/type/extends/extends-undefined.d.ts | 3 + .../cjs/type/extends/extends-undefined.js | 24 + .../build/cjs/type/extends/extends.d.ts | 16 + .../typebox/build/cjs/type/extends/extends.js | 27 + .../typebox/build/cjs/type/extends/index.d.ts | 5 + .../typebox/build/cjs/type/extends/index.js | 22 + .../extract/extract-from-mapped-result.d.ts | 11 + .../extract/extract-from-mapped-result.js | 22 + .../extract-from-template-literal.d.ts | 5 + .../extract/extract-from-template-literal.js | 9 + .../build/cjs/type/extract/extract.d.ts | 21 + .../typebox/build/cjs/type/extract/extract.js | 29 + .../typebox/build/cjs/type/extract/index.d.ts | 3 + .../typebox/build/cjs/type/extract/index.js | 20 + .../build/cjs/type/function/function.d.ts | 23 + .../build/cjs/type/function/function.js | 10 + .../build/cjs/type/function/index.d.ts | 1 + .../typebox/build/cjs/type/function/index.js | 18 + .../typebox/build/cjs/type/guard/index.d.ts | 3 + .../typebox/build/cjs/type/guard/index.js | 40 + .../typebox/build/cjs/type/guard/kind.d.ts | 147 + .../typebox/build/cjs/type/guard/kind.js | 320 +++ .../typebox/build/cjs/type/guard/type.d.ts | 152 + .../typebox/build/cjs/type/guard/type.js | 597 ++++ .../typebox/build/cjs/type/guard/value.d.ts | 34 + .../typebox/build/cjs/type/guard/value.js | 89 + .../build/cjs/type/helpers/helpers.d.ts | 42 + .../typebox/build/cjs/type/helpers/helpers.js | 8 + .../typebox/build/cjs/type/helpers/index.d.ts | 1 + .../typebox/build/cjs/type/helpers/index.js | 18 + .../typebox/build/cjs/type/index.d.ts | 71 + .../@sinclair/typebox/build/cjs/type/index.js | 88 + .../typebox/build/cjs/type/indexed/index.d.ts | 4 + .../typebox/build/cjs/type/indexed/index.js | 21 + .../type/indexed/indexed-from-mapped-key.d.ts | 13 + .../type/indexed/indexed-from-mapped-key.js | 26 + .../indexed/indexed-from-mapped-result.d.ts | 12 + .../indexed/indexed-from-mapped-result.js | 24 + .../type/indexed/indexed-property-keys.d.ts | 14 + .../cjs/type/indexed/indexed-property-keys.js | 36 + .../build/cjs/type/indexed/indexed.d.ts | 52 + .../typebox/build/cjs/type/indexed/indexed.js | 98 + .../build/cjs/type/instance-type/index.d.ts | 1 + .../build/cjs/type/instance-type/index.js | 18 + .../cjs/type/instance-type/instance-type.d.ts | 6 + .../cjs/type/instance-type/instance-type.js | 44 + .../build/cjs/type/instantiate/index.d.ts | 1 + .../build/cjs/type/instantiate/index.js | 18 + .../cjs/type/instantiate/instantiate.d.ts | 50 + .../build/cjs/type/instantiate/instantiate.js | 153 + .../typebox/build/cjs/type/integer/index.d.ts | 1 + .../typebox/build/cjs/type/integer/index.js | 18 + .../build/cjs/type/integer/integer.d.ts | 16 + .../typebox/build/cjs/type/integer/integer.js | 10 + .../build/cjs/type/intersect/index.d.ts | 3 + .../typebox/build/cjs/type/intersect/index.js | 20 + .../cjs/type/intersect/intersect-create.d.ts | 3 + .../cjs/type/intersect/intersect-create.js | 23 + .../type/intersect/intersect-evaluated.d.ts | 13 + .../cjs/type/intersect/intersect-evaluated.js | 42 + .../cjs/type/intersect/intersect-type.d.ts | 15 + .../cjs/type/intersect/intersect-type.js | 4 + .../build/cjs/type/intersect/intersect.d.ts | 6 + .../build/cjs/type/intersect/intersect.js | 21 + .../build/cjs/type/intrinsic/capitalize.d.ts | 5 + .../build/cjs/type/intrinsic/capitalize.js | 9 + .../build/cjs/type/intrinsic/index.d.ts | 6 + .../typebox/build/cjs/type/intrinsic/index.js | 23 + .../intrinsic/intrinsic-from-mapped-key.d.ts | 14 + .../intrinsic/intrinsic-from-mapped-key.js | 30 + .../build/cjs/type/intrinsic/intrinsic.d.ts | 16 + .../build/cjs/type/intrinsic/intrinsic.js | 68 + .../build/cjs/type/intrinsic/lowercase.d.ts | 5 + .../build/cjs/type/intrinsic/lowercase.js | 9 + .../cjs/type/intrinsic/uncapitalize.d.ts | 5 + .../build/cjs/type/intrinsic/uncapitalize.js | 9 + .../build/cjs/type/intrinsic/uppercase.d.ts | 5 + .../build/cjs/type/intrinsic/uppercase.js | 9 + .../build/cjs/type/iterator/index.d.ts | 1 + .../typebox/build/cjs/type/iterator/index.js | 18 + .../build/cjs/type/iterator/iterator.d.ts | 11 + .../build/cjs/type/iterator/iterator.js | 10 + .../typebox/build/cjs/type/keyof/index.d.ts | 4 + .../typebox/build/cjs/type/keyof/index.js | 21 + .../type/keyof/keyof-from-mapped-result.d.ts | 12 + .../type/keyof/keyof-from-mapped-result.js | 23 + .../type/keyof/keyof-property-entries.d.ts | 7 + .../cjs/type/keyof/keyof-property-entries.js | 16 + .../cjs/type/keyof/keyof-property-keys.d.ts | 24 + .../cjs/type/keyof/keyof-property-keys.js | 78 + .../typebox/build/cjs/type/keyof/keyof.d.ts | 21 + .../typebox/build/cjs/type/keyof/keyof.js | 40 + .../typebox/build/cjs/type/literal/index.d.ts | 1 + .../typebox/build/cjs/type/literal/index.js | 18 + .../build/cjs/type/literal/literal.d.ts | 10 + .../typebox/build/cjs/type/literal/literal.js | 14 + .../typebox/build/cjs/type/mapped/index.d.ts | 3 + .../typebox/build/cjs/type/mapped/index.js | 20 + .../build/cjs/type/mapped/mapped-key.d.ts | 8 + .../build/cjs/type/mapped/mapped-key.js | 13 + .../build/cjs/type/mapped/mapped-result.d.ts | 9 + .../build/cjs/type/mapped/mapped-result.js | 13 + .../typebox/build/cjs/type/mapped/mapped.d.ts | 47 + .../typebox/build/cjs/type/mapped/mapped.js | 107 + .../build/cjs/type/module/compute.d.ts | 59 + .../typebox/build/cjs/type/module/compute.js | 205 ++ .../typebox/build/cjs/type/module/index.d.ts | 1 + .../typebox/build/cjs/type/module/index.js | 18 + .../typebox/build/cjs/type/module/infer.d.ts | 49 + .../typebox/build/cjs/type/module/infer.js | 3 + .../typebox/build/cjs/type/module/module.d.ts | 27 + .../typebox/build/cjs/type/module/module.js | 38 + .../typebox/build/cjs/type/never/index.d.ts | 1 + .../typebox/build/cjs/type/never/index.js | 18 + .../typebox/build/cjs/type/never/never.d.ts | 9 + .../typebox/build/cjs/type/never/never.js | 10 + .../typebox/build/cjs/type/not/index.d.ts | 1 + .../typebox/build/cjs/type/not/index.js | 18 + .../typebox/build/cjs/type/not/not.d.ts | 10 + .../typebox/build/cjs/type/not/not.js | 10 + .../typebox/build/cjs/type/null/index.d.ts | 1 + .../typebox/build/cjs/type/null/index.js | 18 + .../typebox/build/cjs/type/null/null.d.ts | 9 + .../typebox/build/cjs/type/null/null.js | 10 + .../typebox/build/cjs/type/number/index.d.ts | 1 + .../typebox/build/cjs/type/number/index.js | 18 + .../typebox/build/cjs/type/number/number.d.ts | 16 + .../typebox/build/cjs/type/number/number.js | 10 + .../typebox/build/cjs/type/object/index.d.ts | 1 + .../typebox/build/cjs/type/object/index.js | 18 + .../typebox/build/cjs/type/object/object.d.ts | 51 + .../typebox/build/cjs/type/object/object.js | 22 + .../typebox/build/cjs/type/omit/index.d.ts | 3 + .../typebox/build/cjs/type/omit/index.js | 20 + .../cjs/type/omit/omit-from-mapped-key.d.ts | 12 + .../cjs/type/omit/omit-from-mapped-key.js | 26 + .../type/omit/omit-from-mapped-result.d.ts | 12 + .../cjs/type/omit/omit-from-mapped-result.js | 23 + .../typebox/build/cjs/type/omit/omit.d.ts | 36 + .../typebox/build/cjs/type/omit/omit.js | 75 + .../build/cjs/type/optional/index.d.ts | 2 + .../typebox/build/cjs/type/optional/index.js | 19 + .../optional/optional-from-mapped-result.d.ts | 10 + .../optional/optional-from-mapped-result.js | 22 + .../build/cjs/type/optional/optional.d.ts | 20 + .../build/cjs/type/optional/optional.js | 26 + .../build/cjs/type/parameters/index.d.ts | 1 + .../build/cjs/type/parameters/index.js | 18 + .../build/cjs/type/parameters/parameters.d.ts | 7 + .../build/cjs/type/parameters/parameters.js | 44 + .../typebox/build/cjs/type/partial/index.d.ts | 2 + .../typebox/build/cjs/type/partial/index.js | 19 + .../partial/partial-from-mapped-result.d.ts | 12 + .../partial/partial-from-mapped-result.js | 23 + .../build/cjs/type/partial/partial.d.ts | 35 + .../typebox/build/cjs/type/partial/partial.js | 111 + .../build/cjs/type/patterns/index.d.ts | 1 + .../typebox/build/cjs/type/patterns/index.js | 18 + .../build/cjs/type/patterns/patterns.d.ts | 8 + .../build/cjs/type/patterns/patterns.js | 12 + .../typebox/build/cjs/type/pick/index.d.ts | 3 + .../typebox/build/cjs/type/pick/index.js | 20 + .../cjs/type/pick/pick-from-mapped-key.d.ts | 12 + .../cjs/type/pick/pick-from-mapped-key.js | 28 + .../type/pick/pick-from-mapped-result.d.ts | 12 + .../cjs/type/pick/pick-from-mapped-result.js | 23 + .../typebox/build/cjs/type/pick/pick.d.ts | 36 + .../typebox/build/cjs/type/pick/pick.js | 70 + .../typebox/build/cjs/type/promise/index.d.ts | 1 + .../typebox/build/cjs/type/promise/index.js | 18 + .../build/cjs/type/promise/promise.d.ts | 11 + .../typebox/build/cjs/type/promise/promise.js | 10 + .../cjs/type/readonly-optional/index.d.ts | 1 + .../build/cjs/type/readonly-optional/index.js | 18 + .../readonly-optional/readonly-optional.d.ts | 6 + .../readonly-optional/readonly-optional.js | 10 + .../build/cjs/type/readonly/index.d.ts | 2 + .../typebox/build/cjs/type/readonly/index.js | 19 + .../readonly/readonly-from-mapped-result.d.ts | 10 + .../readonly/readonly-from-mapped-result.js | 22 + .../build/cjs/type/readonly/readonly.d.ts | 20 + .../build/cjs/type/readonly/readonly.js | 26 + .../typebox/build/cjs/type/record/index.d.ts | 1 + .../typebox/build/cjs/type/record/index.js | 18 + .../typebox/build/cjs/type/record/record.d.ts | 71 + .../typebox/build/cjs/type/record/record.js | 123 + .../build/cjs/type/recursive/index.d.ts | 1 + .../typebox/build/cjs/type/recursive/index.js | 18 + .../build/cjs/type/recursive/recursive.d.ts | 16 + .../build/cjs/type/recursive/recursive.js | 19 + .../typebox/build/cjs/type/ref/index.d.ts | 1 + .../typebox/build/cjs/type/ref/index.js | 18 + .../typebox/build/cjs/type/ref/ref.d.ts | 41 + .../typebox/build/cjs/type/ref/ref.js | 14 + .../typebox/build/cjs/type/regexp/index.d.ts | 1 + .../typebox/build/cjs/type/regexp/index.js | 18 + .../typebox/build/cjs/type/regexp/regexp.d.ts | 20 + .../typebox/build/cjs/type/regexp/regexp.js | 12 + .../build/cjs/type/registry/format.d.ts | 13 + .../typebox/build/cjs/type/registry/format.js | 35 + .../build/cjs/type/registry/index.d.ts | 2 + .../typebox/build/cjs/type/registry/index.js | 39 + .../typebox/build/cjs/type/registry/type.d.ts | 13 + .../typebox/build/cjs/type/registry/type.js | 35 + .../build/cjs/type/required/index.d.ts | 2 + .../typebox/build/cjs/type/required/index.js | 19 + .../required/required-from-mapped-result.d.ts | 12 + .../required/required-from-mapped-result.js | 22 + .../build/cjs/type/required/required.d.ts | 35 + .../build/cjs/type/required/required.js | 110 + .../typebox/build/cjs/type/rest/index.d.ts | 1 + .../typebox/build/cjs/type/rest/index.js | 18 + .../typebox/build/cjs/type/rest/rest.d.ts | 10 + .../typebox/build/cjs/type/rest/rest.js | 19 + .../build/cjs/type/return-type/index.d.ts | 1 + .../build/cjs/type/return-type/index.js | 18 + .../cjs/type/return-type/return-type.d.ts | 6 + .../build/cjs/type/return-type/return-type.js | 44 + .../build/cjs/type/schema/anyschema.d.ts | 33 + .../build/cjs/type/schema/anyschema.js | 3 + .../typebox/build/cjs/type/schema/index.d.ts | 2 + .../typebox/build/cjs/type/schema/index.js | 19 + .../typebox/build/cjs/type/schema/schema.d.ts | 29 + .../typebox/build/cjs/type/schema/schema.js | 4 + .../typebox/build/cjs/type/sets/index.d.ts | 1 + .../typebox/build/cjs/type/sets/index.js | 18 + .../typebox/build/cjs/type/sets/set.d.ts | 28 + .../typebox/build/cjs/type/sets/set.js | 59 + .../typebox/build/cjs/type/static/index.d.ts | 1 + .../typebox/build/cjs/type/static/index.js | 18 + .../typebox/build/cjs/type/static/static.d.ts | 39 + .../typebox/build/cjs/type/static/static.js | 3 + .../typebox/build/cjs/type/string/index.d.ts | 1 + .../typebox/build/cjs/type/string/index.js | 18 + .../typebox/build/cjs/type/string/string.d.ts | 25 + .../typebox/build/cjs/type/string/string.js | 10 + .../typebox/build/cjs/type/symbol/index.d.ts | 1 + .../typebox/build/cjs/type/symbol/index.js | 18 + .../typebox/build/cjs/type/symbol/symbol.d.ts | 10 + .../typebox/build/cjs/type/symbol/symbol.js | 10 + .../typebox/build/cjs/type/symbols/index.d.ts | 1 + .../typebox/build/cjs/type/symbols/index.js | 18 + .../build/cjs/type/symbols/symbols.d.ts | 10 + .../typebox/build/cjs/type/symbols/symbols.js | 14 + .../cjs/type/template-literal/finite.d.ts | 19 + .../build/cjs/type/template-literal/finite.js | 56 + .../cjs/type/template-literal/generate.d.ts | 21 + .../cjs/type/template-literal/generate.js | 60 + .../cjs/type/template-literal/index.d.ts | 7 + .../build/cjs/type/template-literal/index.js | 24 + .../cjs/type/template-literal/parse.d.ts | 20 + .../build/cjs/type/template-literal/parse.js | 174 ++ .../cjs/type/template-literal/pattern.d.ts | 5 + .../cjs/type/template-literal/pattern.js | 39 + .../cjs/type/template-literal/syntax.d.ts | 20 + .../build/cjs/type/template-literal/syntax.js | 59 + .../template-literal/template-literal.d.ts | 30 + .../type/template-literal/template-literal.js | 17 + .../cjs/type/template-literal/union.d.ts | 9 + .../build/cjs/type/template-literal/union.js | 13 + .../build/cjs/type/transform/index.d.ts | 1 + .../typebox/build/cjs/type/transform/index.js | 18 + .../build/cjs/type/transform/transform.d.ts | 30 + .../build/cjs/type/transform/transform.js | 47 + .../typebox/build/cjs/type/tuple/index.d.ts | 1 + .../typebox/build/cjs/type/tuple/index.js | 18 + .../typebox/build/cjs/type/tuple/tuple.d.ts | 16 + .../typebox/build/cjs/type/tuple/tuple.js | 13 + .../typebox/build/cjs/type/type/index.d.ts | 6 + .../typebox/build/cjs/type/type/index.js | 51 + .../build/cjs/type/type/javascript.d.ts | 64 + .../typebox/build/cjs/type/type/javascript.js | 104 + .../typebox/build/cjs/type/type/json.d.ts | 208 ++ .../typebox/build/cjs/type/type/json.js | 226 ++ .../typebox/build/cjs/type/type/type.d.ts | 59 + .../typebox/build/cjs/type/type/type.js | 129 + .../build/cjs/type/uint8array/index.d.ts | 1 + .../build/cjs/type/uint8array/index.js | 18 + .../build/cjs/type/uint8array/uint8array.d.ts | 13 + .../build/cjs/type/uint8array/uint8array.js | 10 + .../build/cjs/type/undefined/index.d.ts | 1 + .../typebox/build/cjs/type/undefined/index.js | 18 + .../build/cjs/type/undefined/undefined.d.ts | 9 + .../build/cjs/type/undefined/undefined.js | 10 + .../typebox/build/cjs/type/union/index.d.ts | 3 + .../typebox/build/cjs/type/union/index.js | 20 + .../build/cjs/type/union/union-create.d.ts | 3 + .../build/cjs/type/union/union-create.js | 9 + .../build/cjs/type/union/union-evaluated.d.ts | 13 + .../build/cjs/type/union/union-evaluated.js | 40 + .../build/cjs/type/union/union-type.d.ts | 12 + .../build/cjs/type/union/union-type.js | 4 + .../typebox/build/cjs/type/union/union.d.ts | 6 + .../typebox/build/cjs/type/union/union.js | 14 + .../typebox/build/cjs/type/unknown/index.d.ts | 1 + .../typebox/build/cjs/type/unknown/index.js | 18 + .../build/cjs/type/unknown/unknown.d.ts | 8 + .../typebox/build/cjs/type/unknown/unknown.js | 10 + .../typebox/build/cjs/type/unsafe/index.d.ts | 1 + .../typebox/build/cjs/type/unsafe/index.js | 18 + .../typebox/build/cjs/type/unsafe/unsafe.d.ts | 11 + .../typebox/build/cjs/type/unsafe/unsafe.js | 10 + .../typebox/build/cjs/type/void/index.d.ts | 1 + .../typebox/build/cjs/type/void/index.js | 18 + .../typebox/build/cjs/type/void/void.d.ts | 9 + .../typebox/build/cjs/type/void/void.js | 10 + .../build/cjs/value/assert/assert.d.ts | 15 + .../typebox/build/cjs/value/assert/assert.js | 55 + .../typebox/build/cjs/value/assert/index.d.ts | 1 + .../typebox/build/cjs/value/assert/index.js | 18 + .../typebox/build/cjs/value/cast/cast.d.ts | 11 + .../typebox/build/cjs/value/cast/cast.js | 241 ++ .../typebox/build/cjs/value/cast/index.d.ts | 1 + .../typebox/build/cjs/value/cast/index.js | 18 + .../typebox/build/cjs/value/check/check.d.ts | 11 + .../typebox/build/cjs/value/check/check.js | 476 ++++ .../typebox/build/cjs/value/check/index.d.ts | 1 + .../typebox/build/cjs/value/check/index.js | 18 + .../typebox/build/cjs/value/clean/clean.d.ts | 5 + .../typebox/build/cjs/value/clean/clean.js | 149 + .../typebox/build/cjs/value/clean/index.d.ts | 1 + .../typebox/build/cjs/value/clean/index.js | 18 + .../typebox/build/cjs/value/clone/clone.d.ts | 2 + .../typebox/build/cjs/value/clone/clone.js | 60 + .../typebox/build/cjs/value/clone/index.d.ts | 1 + .../typebox/build/cjs/value/clone/index.js | 18 + .../build/cjs/value/convert/convert.d.ts | 5 + .../build/cjs/value/convert/convert.js | 264 ++ .../build/cjs/value/convert/index.d.ts | 1 + .../typebox/build/cjs/value/convert/index.js | 18 + .../build/cjs/value/create/create.d.ts | 11 + .../typebox/build/cjs/value/create/create.js | 474 ++++ .../typebox/build/cjs/value/create/index.d.ts | 1 + .../typebox/build/cjs/value/create/index.js | 18 + .../build/cjs/value/decode/decode.d.ts | 6 + .../typebox/build/cjs/value/decode/decode.js | 14 + .../typebox/build/cjs/value/decode/index.d.ts | 1 + .../typebox/build/cjs/value/decode/index.js | 18 + .../build/cjs/value/default/default.d.ts | 5 + .../build/cjs/value/default/default.js | 176 ++ .../build/cjs/value/default/index.d.ts | 1 + .../typebox/build/cjs/value/default/index.js | 18 + .../typebox/build/cjs/value/delta/delta.d.ts | 32 + .../typebox/build/cjs/value/delta/delta.js | 178 ++ .../typebox/build/cjs/value/delta/index.d.ts | 1 + .../typebox/build/cjs/value/delta/index.js | 18 + .../typebox/build/cjs/value/deref/deref.d.ts | 12 + .../typebox/build/cjs/value/deref/deref.js | 36 + .../typebox/build/cjs/value/deref/index.d.ts | 1 + .../typebox/build/cjs/value/deref/index.js | 18 + .../build/cjs/value/encode/encode.d.ts | 6 + .../typebox/build/cjs/value/encode/encode.js | 15 + .../typebox/build/cjs/value/encode/index.d.ts | 1 + .../typebox/build/cjs/value/encode/index.js | 18 + .../typebox/build/cjs/value/equal/equal.d.ts | 2 + .../typebox/build/cjs/value/equal/equal.js | 50 + .../typebox/build/cjs/value/equal/index.d.ts | 1 + .../typebox/build/cjs/value/equal/index.js | 18 + .../typebox/build/cjs/value/guard/guard.d.ts | 74 + .../typebox/build/cjs/value/guard/guard.js | 195 ++ .../typebox/build/cjs/value/guard/index.d.ts | 1 + .../typebox/build/cjs/value/guard/index.js | 18 + .../typebox/build/cjs/value/hash/hash.d.ts | 7 + .../typebox/build/cjs/value/hash/hash.js | 152 + .../typebox/build/cjs/value/hash/index.d.ts | 1 + .../typebox/build/cjs/value/hash/index.js | 18 + .../typebox/build/cjs/value/index.d.ts | 20 + .../typebox/build/cjs/value/index.js | 53 + .../typebox/build/cjs/value/mutate/index.d.ts | 1 + .../typebox/build/cjs/value/mutate/index.js | 18 + .../build/cjs/value/mutate/mutate.d.ts | 9 + .../typebox/build/cjs/value/mutate/mutate.js | 104 + .../typebox/build/cjs/value/parse/index.d.ts | 1 + .../typebox/build/cjs/value/parse/index.js | 18 + .../typebox/build/cjs/value/parse/parse.d.ts | 22 + .../typebox/build/cjs/value/parse/parse.js | 87 + .../build/cjs/value/pointer/index.d.ts | 1 + .../typebox/build/cjs/value/pointer/index.js | 38 + .../build/cjs/value/pointer/pointer.d.ts | 22 + .../build/cjs/value/pointer/pointer.js | 126 + .../build/cjs/value/transform/decode.d.ts | 22 + .../build/cjs/value/transform/decode.js | 214 ++ .../build/cjs/value/transform/encode.d.ts | 23 + .../build/cjs/value/transform/encode.js | 225 ++ .../build/cjs/value/transform/has.d.ts | 3 + .../typebox/build/cjs/value/transform/has.js | 133 + .../build/cjs/value/transform/index.d.ts | 3 + .../build/cjs/value/transform/index.js | 20 + .../typebox/build/cjs/value/value/index.d.ts | 1 + .../typebox/build/cjs/value/value/index.js | 38 + .../typebox/build/cjs/value/value/value.d.ts | 16 + .../typebox/build/cjs/value/value/value.js | 39 + .../typebox/build/esm/compiler/compiler.d.mts | 55 + .../typebox/build/esm/compiler/compiler.mjs | 663 +++++ .../typebox/build/esm/compiler/index.d.mts | 2 + .../typebox/build/esm/compiler/index.mjs | 2 + .../typebox/build/esm/errors/errors.d.mts | 91 + .../typebox/build/esm/errors/errors.mjs | 592 ++++ .../typebox/build/esm/errors/function.d.mts | 21 + .../typebox/build/esm/errors/function.mjs | 147 + .../typebox/build/esm/errors/index.d.mts | 2 + .../typebox/build/esm/errors/index.mjs | 2 + .../@sinclair/typebox/build/esm/index.d.mts | 71 + .../@sinclair/typebox/build/esm/index.mjs | 80 + .../typebox/build/esm/parser/index.d.mts | 2 + .../typebox/build/esm/parser/index.mjs | 2 + .../build/esm/parser/runtime/guard.d.mts | 23 + .../build/esm/parser/runtime/guard.mjs | 72 + .../build/esm/parser/runtime/index.d.mts | 5 + .../build/esm/parser/runtime/index.mjs | 5 + .../build/esm/parser/runtime/module.d.mts | 9 + .../build/esm/parser/runtime/module.mjs | 17 + .../build/esm/parser/runtime/parse.d.mts | 9 + .../build/esm/parser/runtime/parse.mjs | 123 + .../build/esm/parser/runtime/token.d.mts | 8 + .../build/esm/parser/runtime/token.mjs | 223 ++ .../build/esm/parser/runtime/types.d.mts | 98 + .../build/esm/parser/runtime/types.mjs | 55 + .../build/esm/parser/static/index.d.mts | 3 + .../typebox/build/esm/parser/static/index.mjs | 3 + .../build/esm/parser/static/parse.d.mts | 20 + .../typebox/build/esm/parser/static/parse.mjs | 1 + .../build/esm/parser/static/token.d.mts | 108 + .../typebox/build/esm/parser/static/token.mjs | 1 + .../build/esm/parser/static/types.d.mts | 69 + .../typebox/build/esm/parser/static/types.mjs | 1 + .../typebox/build/esm/syntax/index.d.mts | 1 + .../typebox/build/esm/syntax/index.mjs | 1 + .../typebox/build/esm/syntax/mapping.d.mts | 167 ++ .../typebox/build/esm/syntax/mapping.mjs | 386 +++ .../typebox/build/esm/syntax/parser.d.mts | 162 ++ .../typebox/build/esm/syntax/parser.mjs | 78 + .../typebox/build/esm/syntax/syntax.d.mts | 12 + .../typebox/build/esm/syntax/syntax.mjs | 16 + .../typebox/build/esm/system/index.d.mts | 2 + .../typebox/build/esm/system/index.mjs | 2 + .../typebox/build/esm/system/policy.d.mts | 29 + .../typebox/build/esm/system/policy.mjs | 54 + .../typebox/build/esm/system/system.d.mts | 16 + .../typebox/build/esm/system/system.mjs | 37 + .../typebox/build/esm/type/any/any.d.mts | 8 + .../typebox/build/esm/type/any/any.mjs | 6 + .../typebox/build/esm/type/any/index.d.mts | 1 + .../typebox/build/esm/type/any/index.mjs | 1 + .../build/esm/type/argument/argument.d.mts | 9 + .../build/esm/type/argument/argument.mjs | 6 + .../build/esm/type/argument/index.d.mts | 1 + .../typebox/build/esm/type/argument/index.mjs | 1 + .../typebox/build/esm/type/array/array.d.mts | 28 + .../typebox/build/esm/type/array/array.mjs | 6 + .../typebox/build/esm/type/array/index.d.mts | 1 + .../typebox/build/esm/type/array/index.mjs | 1 + .../type/async-iterator/async-iterator.d.mts | 11 + .../type/async-iterator/async-iterator.mjs | 6 + .../build/esm/type/async-iterator/index.d.mts | 1 + .../build/esm/type/async-iterator/index.mjs | 1 + .../build/esm/type/awaited/awaited.d.mts | 14 + .../build/esm/type/awaited/awaited.mjs | 37 + .../build/esm/type/awaited/index.d.mts | 1 + .../typebox/build/esm/type/awaited/index.mjs | 1 + .../build/esm/type/bigint/bigint.d.mts | 16 + .../typebox/build/esm/type/bigint/bigint.mjs | 6 + .../typebox/build/esm/type/bigint/index.d.mts | 1 + .../typebox/build/esm/type/bigint/index.mjs | 1 + .../build/esm/type/boolean/boolean.d.mts | 9 + .../build/esm/type/boolean/boolean.mjs | 6 + .../build/esm/type/boolean/index.d.mts | 1 + .../typebox/build/esm/type/boolean/index.mjs | 1 + .../typebox/build/esm/type/clone/index.d.mts | 2 + .../typebox/build/esm/type/clone/index.mjs | 2 + .../typebox/build/esm/type/clone/type.d.mts | 5 + .../typebox/build/esm/type/clone/type.mjs | 9 + .../typebox/build/esm/type/clone/value.d.mts | 2 + .../typebox/build/esm/type/clone/value.mjs | 36 + .../build/esm/type/composite/composite.d.mts | 18 + .../build/esm/type/composite/composite.mjs | 42 + .../build/esm/type/composite/index.d.mts | 1 + .../build/esm/type/composite/index.mjs | 1 + .../build/esm/type/computed/computed.d.mts | 9 + .../build/esm/type/computed/computed.mjs | 6 + .../build/esm/type/computed/index.d.mts | 1 + .../typebox/build/esm/type/computed/index.mjs | 1 + .../typebox/build/esm/type/const/const.d.mts | 27 + .../typebox/build/esm/type/const/const.mjs | 54 + .../typebox/build/esm/type/const/index.d.mts | 1 + .../typebox/build/esm/type/const/index.mjs | 1 + .../constructor-parameters.d.mts | 7 + .../constructor-parameters.mjs | 7 + .../type/constructor-parameters/index.d.mts | 1 + .../esm/type/constructor-parameters/index.mjs | 1 + .../esm/type/constructor/constructor.d.mts | 23 + .../esm/type/constructor/constructor.mjs | 6 + .../build/esm/type/constructor/index.d.mts | 1 + .../build/esm/type/constructor/index.mjs | 1 + .../build/esm/type/create/immutable.d.mts | 2 + .../build/esm/type/create/immutable.mjs | 33 + .../typebox/build/esm/type/create/index.d.mts | 1 + .../typebox/build/esm/type/create/index.mjs | 1 + .../typebox/build/esm/type/create/type.d.mts | 3 + .../typebox/build/esm/type/create/type.mjs | 15 + .../typebox/build/esm/type/date/date.d.mts | 21 + .../typebox/build/esm/type/date/date.mjs | 6 + .../typebox/build/esm/type/date/index.d.mts | 1 + .../typebox/build/esm/type/date/index.mjs | 1 + .../build/esm/type/discard/discard.d.mts | 2 + .../build/esm/type/discard/discard.mjs | 8 + .../build/esm/type/discard/index.d.mts | 1 + .../typebox/build/esm/type/discard/index.mjs | 1 + .../typebox/build/esm/type/enum/enum.d.mts | 14 + .../typebox/build/esm/type/enum/enum.mjs | 18 + .../typebox/build/esm/type/enum/index.d.mts | 1 + .../typebox/build/esm/type/enum/index.mjs | 1 + .../typebox/build/esm/type/error/error.d.mts | 4 + .../typebox/build/esm/type/error/error.mjs | 6 + .../typebox/build/esm/type/error/index.d.mts | 1 + .../typebox/build/esm/type/error/index.mjs | 1 + .../exclude/exclude-from-mapped-result.d.mts | 11 + .../exclude/exclude-from-mapped-result.mjs | 18 + .../exclude-from-template-literal.d.mts | 5 + .../exclude/exclude-from-template-literal.mjs | 5 + .../build/esm/type/exclude/exclude.d.mts | 21 + .../build/esm/type/exclude/exclude.mjs | 25 + .../build/esm/type/exclude/index.d.mts | 3 + .../typebox/build/esm/type/exclude/index.mjs | 3 + .../esm/type/extends/extends-check.d.mts | 10 + .../build/esm/type/extends/extends-check.mjs | 635 +++++ .../extends/extends-from-mapped-key.d.mts | 14 + .../type/extends/extends-from-mapped-key.mjs | 25 + .../extends/extends-from-mapped-result.d.mts | 11 + .../extends/extends-from-mapped-result.mjs | 19 + .../esm/type/extends/extends-undefined.d.mts | 3 + .../esm/type/extends/extends-undefined.mjs | 20 + .../build/esm/type/extends/extends.d.mts | 16 + .../build/esm/type/extends/extends.mjs | 23 + .../build/esm/type/extends/index.d.mts | 5 + .../typebox/build/esm/type/extends/index.mjs | 5 + .../extract/extract-from-mapped-result.d.mts | 11 + .../extract/extract-from-mapped-result.mjs | 18 + .../extract-from-template-literal.d.mts | 5 + .../extract/extract-from-template-literal.mjs | 5 + .../build/esm/type/extract/extract.d.mts | 21 + .../build/esm/type/extract/extract.mjs | 25 + .../build/esm/type/extract/index.d.mts | 3 + .../typebox/build/esm/type/extract/index.mjs | 3 + .../build/esm/type/function/function.d.mts | 23 + .../build/esm/type/function/function.mjs | 6 + .../build/esm/type/function/index.d.mts | 1 + .../typebox/build/esm/type/function/index.mjs | 1 + .../typebox/build/esm/type/guard/index.d.mts | 3 + .../typebox/build/esm/type/guard/index.mjs | 3 + .../typebox/build/esm/type/guard/kind.d.mts | 147 + .../typebox/build/esm/type/guard/kind.mjs | 235 ++ .../typebox/build/esm/type/guard/type.d.mts | 152 + .../typebox/build/esm/type/guard/type.mjs | 509 ++++ .../typebox/build/esm/type/guard/value.d.mts | 34 + .../typebox/build/esm/type/guard/value.mjs | 70 + .../build/esm/type/helpers/helpers.d.mts | 42 + .../build/esm/type/helpers/helpers.mjs | 4 + .../build/esm/type/helpers/index.d.mts | 1 + .../typebox/build/esm/type/helpers/index.mjs | 1 + .../typebox/build/esm/type/index.d.mts | 71 + .../typebox/build/esm/type/index.mjs | 71 + .../build/esm/type/indexed/index.d.mts | 4 + .../typebox/build/esm/type/indexed/index.mjs | 4 + .../indexed/indexed-from-mapped-key.d.mts | 13 + .../type/indexed/indexed-from-mapped-key.mjs | 22 + .../indexed/indexed-from-mapped-result.d.mts | 12 + .../indexed/indexed-from-mapped-result.mjs | 20 + .../type/indexed/indexed-property-keys.d.mts | 14 + .../type/indexed/indexed-property-keys.mjs | 32 + .../build/esm/type/indexed/indexed.d.mts | 52 + .../build/esm/type/indexed/indexed.mjs | 91 + .../build/esm/type/instance-type/index.d.mts | 1 + .../build/esm/type/instance-type/index.mjs | 1 + .../type/instance-type/instance-type.d.mts | 6 + .../esm/type/instance-type/instance-type.mjs | 7 + .../build/esm/type/instantiate/index.d.mts | 1 + .../build/esm/type/instantiate/index.mjs | 1 + .../esm/type/instantiate/instantiate.d.mts | 50 + .../esm/type/instantiate/instantiate.mjs | 115 + .../build/esm/type/integer/index.d.mts | 1 + .../typebox/build/esm/type/integer/index.mjs | 1 + .../build/esm/type/integer/integer.d.mts | 16 + .../build/esm/type/integer/integer.mjs | 6 + .../build/esm/type/intersect/index.d.mts | 3 + .../build/esm/type/intersect/index.mjs | 3 + .../esm/type/intersect/intersect-create.d.mts | 3 + .../esm/type/intersect/intersect-create.mjs | 19 + .../type/intersect/intersect-evaluated.d.mts | 13 + .../type/intersect/intersect-evaluated.mjs | 38 + .../esm/type/intersect/intersect-type.d.mts | 15 + .../esm/type/intersect/intersect-type.mjs | 1 + .../build/esm/type/intersect/intersect.d.mts | 6 + .../build/esm/type/intersect/intersect.mjs | 17 + .../build/esm/type/intrinsic/capitalize.d.mts | 5 + .../build/esm/type/intrinsic/capitalize.mjs | 5 + .../build/esm/type/intrinsic/index.d.mts | 6 + .../build/esm/type/intrinsic/index.mjs | 6 + .../intrinsic/intrinsic-from-mapped-key.d.mts | 14 + .../intrinsic/intrinsic-from-mapped-key.mjs | 26 + .../build/esm/type/intrinsic/intrinsic.d.mts | 16 + .../build/esm/type/intrinsic/intrinsic.mjs | 64 + .../build/esm/type/intrinsic/lowercase.d.mts | 5 + .../build/esm/type/intrinsic/lowercase.mjs | 5 + .../esm/type/intrinsic/uncapitalize.d.mts | 5 + .../build/esm/type/intrinsic/uncapitalize.mjs | 5 + .../build/esm/type/intrinsic/uppercase.d.mts | 5 + .../build/esm/type/intrinsic/uppercase.mjs | 5 + .../build/esm/type/iterator/index.d.mts | 1 + .../typebox/build/esm/type/iterator/index.mjs | 1 + .../build/esm/type/iterator/iterator.d.mts | 11 + .../build/esm/type/iterator/iterator.mjs | 6 + .../typebox/build/esm/type/keyof/index.d.mts | 4 + .../typebox/build/esm/type/keyof/index.mjs | 4 + .../type/keyof/keyof-from-mapped-result.d.mts | 12 + .../type/keyof/keyof-from-mapped-result.mjs | 19 + .../type/keyof/keyof-property-entries.d.mts | 7 + .../esm/type/keyof/keyof-property-entries.mjs | 12 + .../esm/type/keyof/keyof-property-keys.d.mts | 24 + .../esm/type/keyof/keyof-property-keys.mjs | 73 + .../typebox/build/esm/type/keyof/keyof.d.mts | 21 + .../typebox/build/esm/type/keyof/keyof.mjs | 35 + .../build/esm/type/literal/index.d.mts | 1 + .../typebox/build/esm/type/literal/index.mjs | 1 + .../build/esm/type/literal/literal.d.mts | 10 + .../build/esm/type/literal/literal.mjs | 10 + .../typebox/build/esm/type/mapped/index.d.mts | 3 + .../typebox/build/esm/type/mapped/index.mjs | 3 + .../build/esm/type/mapped/mapped-key.d.mts | 8 + .../build/esm/type/mapped/mapped-key.mjs | 9 + .../build/esm/type/mapped/mapped-result.d.mts | 9 + .../build/esm/type/mapped/mapped-result.mjs | 9 + .../build/esm/type/mapped/mapped.d.mts | 47 + .../typebox/build/esm/type/mapped/mapped.mjs | 102 + .../build/esm/type/module/compute.d.mts | 59 + .../typebox/build/esm/type/module/compute.mjs | 166 ++ .../typebox/build/esm/type/module/index.d.mts | 1 + .../typebox/build/esm/type/module/index.mjs | 1 + .../typebox/build/esm/type/module/infer.d.mts | 49 + .../typebox/build/esm/type/module/infer.mjs | 1 + .../build/esm/type/module/module.d.mts | 27 + .../typebox/build/esm/type/module/module.mjs | 32 + .../typebox/build/esm/type/never/index.d.mts | 1 + .../typebox/build/esm/type/never/index.mjs | 1 + .../typebox/build/esm/type/never/never.d.mts | 9 + .../typebox/build/esm/type/never/never.mjs | 6 + .../typebox/build/esm/type/not/index.d.mts | 1 + .../typebox/build/esm/type/not/index.mjs | 1 + .../typebox/build/esm/type/not/not.d.mts | 10 + .../typebox/build/esm/type/not/not.mjs | 6 + .../typebox/build/esm/type/null/index.d.mts | 1 + .../typebox/build/esm/type/null/index.mjs | 1 + .../typebox/build/esm/type/null/null.d.mts | 9 + .../typebox/build/esm/type/null/null.mjs | 6 + .../typebox/build/esm/type/number/index.d.mts | 1 + .../typebox/build/esm/type/number/index.mjs | 1 + .../build/esm/type/number/number.d.mts | 16 + .../typebox/build/esm/type/number/number.mjs | 6 + .../typebox/build/esm/type/object/index.d.mts | 1 + .../typebox/build/esm/type/object/index.mjs | 1 + .../build/esm/type/object/object.d.mts | 51 + .../typebox/build/esm/type/object/object.mjs | 18 + .../typebox/build/esm/type/omit/index.d.mts | 3 + .../typebox/build/esm/type/omit/index.mjs | 3 + .../esm/type/omit/omit-from-mapped-key.d.mts | 12 + .../esm/type/omit/omit-from-mapped-key.mjs | 22 + .../type/omit/omit-from-mapped-result.d.mts | 12 + .../esm/type/omit/omit-from-mapped-result.mjs | 19 + .../typebox/build/esm/type/omit/omit.d.mts | 36 + .../typebox/build/esm/type/omit/omit.mjs | 71 + .../build/esm/type/optional/index.d.mts | 2 + .../typebox/build/esm/type/optional/index.mjs | 2 + .../optional-from-mapped-result.d.mts | 10 + .../optional/optional-from-mapped-result.mjs | 18 + .../build/esm/type/optional/optional.d.mts | 20 + .../build/esm/type/optional/optional.mjs | 22 + .../build/esm/type/parameters/index.d.mts | 1 + .../build/esm/type/parameters/index.mjs | 1 + .../esm/type/parameters/parameters.d.mts | 7 + .../build/esm/type/parameters/parameters.mjs | 7 + .../build/esm/type/partial/index.d.mts | 2 + .../typebox/build/esm/type/partial/index.mjs | 2 + .../partial/partial-from-mapped-result.d.mts | 12 + .../partial/partial-from-mapped-result.mjs | 19 + .../build/esm/type/partial/partial.d.mts | 35 + .../build/esm/type/partial/partial.mjs | 74 + .../build/esm/type/patterns/index.d.mts | 1 + .../typebox/build/esm/type/patterns/index.mjs | 1 + .../build/esm/type/patterns/patterns.d.mts | 8 + .../build/esm/type/patterns/patterns.mjs | 8 + .../typebox/build/esm/type/pick/index.d.mts | 3 + .../typebox/build/esm/type/pick/index.mjs | 3 + .../esm/type/pick/pick-from-mapped-key.d.mts | 12 + .../esm/type/pick/pick-from-mapped-key.mjs | 24 + .../type/pick/pick-from-mapped-result.d.mts | 12 + .../esm/type/pick/pick-from-mapped-result.mjs | 19 + .../typebox/build/esm/type/pick/pick.d.mts | 36 + .../typebox/build/esm/type/pick/pick.mjs | 66 + .../build/esm/type/promise/index.d.mts | 1 + .../typebox/build/esm/type/promise/index.mjs | 1 + .../build/esm/type/promise/promise.d.mts | 11 + .../build/esm/type/promise/promise.mjs | 6 + .../esm/type/readonly-optional/index.d.mts | 1 + .../esm/type/readonly-optional/index.mjs | 1 + .../readonly-optional/readonly-optional.d.mts | 6 + .../readonly-optional/readonly-optional.mjs | 6 + .../build/esm/type/readonly/index.d.mts | 2 + .../typebox/build/esm/type/readonly/index.mjs | 2 + .../readonly-from-mapped-result.d.mts | 10 + .../readonly/readonly-from-mapped-result.mjs | 18 + .../build/esm/type/readonly/readonly.d.mts | 20 + .../build/esm/type/readonly/readonly.mjs | 22 + .../typebox/build/esm/type/record/index.d.mts | 1 + .../typebox/build/esm/type/record/index.mjs | 1 + .../build/esm/type/record/record.d.mts | 71 + .../typebox/build/esm/type/record/record.mjs | 116 + .../build/esm/type/recursive/index.d.mts | 1 + .../build/esm/type/recursive/index.mjs | 1 + .../build/esm/type/recursive/recursive.d.mts | 16 + .../build/esm/type/recursive/recursive.mjs | 15 + .../typebox/build/esm/type/ref/index.d.mts | 1 + .../typebox/build/esm/type/ref/index.mjs | 1 + .../typebox/build/esm/type/ref/ref.d.mts | 41 + .../typebox/build/esm/type/ref/ref.mjs | 10 + .../typebox/build/esm/type/regexp/index.d.mts | 1 + .../typebox/build/esm/type/regexp/index.mjs | 1 + .../build/esm/type/regexp/regexp.d.mts | 20 + .../typebox/build/esm/type/regexp/regexp.mjs | 8 + .../build/esm/type/registry/format.d.mts | 13 + .../build/esm/type/registry/format.mjs | 26 + .../build/esm/type/registry/index.d.mts | 2 + .../typebox/build/esm/type/registry/index.mjs | 2 + .../build/esm/type/registry/type.d.mts | 13 + .../typebox/build/esm/type/registry/type.mjs | 26 + .../build/esm/type/required/index.d.mts | 2 + .../typebox/build/esm/type/required/index.mjs | 2 + .../required-from-mapped-result.d.mts | 12 + .../required/required-from-mapped-result.mjs | 18 + .../build/esm/type/required/required.d.mts | 35 + .../build/esm/type/required/required.mjs | 73 + .../typebox/build/esm/type/rest/index.d.mts | 1 + .../typebox/build/esm/type/rest/index.mjs | 1 + .../typebox/build/esm/type/rest/rest.d.mts | 10 + .../typebox/build/esm/type/rest/rest.mjs | 15 + .../build/esm/type/return-type/index.d.mts | 1 + .../build/esm/type/return-type/index.mjs | 1 + .../esm/type/return-type/return-type.d.mts | 6 + .../esm/type/return-type/return-type.mjs | 7 + .../build/esm/type/schema/anyschema.d.mts | 33 + .../build/esm/type/schema/anyschema.mjs | 1 + .../typebox/build/esm/type/schema/index.d.mts | 2 + .../typebox/build/esm/type/schema/index.mjs | 2 + .../build/esm/type/schema/schema.d.mts | 29 + .../typebox/build/esm/type/schema/schema.mjs | 1 + .../typebox/build/esm/type/sets/index.d.mts | 1 + .../typebox/build/esm/type/sets/index.mjs | 1 + .../typebox/build/esm/type/sets/set.d.mts | 28 + .../typebox/build/esm/type/sets/set.mjs | 48 + .../typebox/build/esm/type/static/index.d.mts | 1 + .../typebox/build/esm/type/static/index.mjs | 1 + .../build/esm/type/static/static.d.mts | 39 + .../typebox/build/esm/type/static/static.mjs | 1 + .../typebox/build/esm/type/string/index.d.mts | 1 + .../typebox/build/esm/type/string/index.mjs | 1 + .../build/esm/type/string/string.d.mts | 25 + .../typebox/build/esm/type/string/string.mjs | 6 + .../typebox/build/esm/type/symbol/index.d.mts | 1 + .../typebox/build/esm/type/symbol/index.mjs | 1 + .../build/esm/type/symbol/symbol.d.mts | 10 + .../typebox/build/esm/type/symbol/symbol.mjs | 6 + .../build/esm/type/symbols/index.d.mts | 1 + .../typebox/build/esm/type/symbols/index.mjs | 1 + .../build/esm/type/symbols/symbols.d.mts | 10 + .../build/esm/type/symbols/symbols.mjs | 10 + .../esm/type/template-literal/finite.d.mts | 19 + .../esm/type/template-literal/finite.mjs | 49 + .../esm/type/template-literal/generate.d.mts | 21 + .../esm/type/template-literal/generate.mjs | 53 + .../esm/type/template-literal/index.d.mts | 7 + .../build/esm/type/template-literal/index.mjs | 7 + .../esm/type/template-literal/parse.d.mts | 20 + .../build/esm/type/template-literal/parse.mjs | 167 ++ .../esm/type/template-literal/pattern.d.mts | 5 + .../esm/type/template-literal/pattern.mjs | 33 + .../esm/type/template-literal/syntax.d.mts | 20 + .../esm/type/template-literal/syntax.mjs | 55 + .../template-literal/template-literal.d.mts | 30 + .../template-literal/template-literal.mjs | 13 + .../esm/type/template-literal/union.d.mts | 9 + .../build/esm/type/template-literal/union.mjs | 9 + .../build/esm/type/transform/index.d.mts | 1 + .../build/esm/type/transform/index.mjs | 1 + .../build/esm/type/transform/transform.d.mts | 30 + .../build/esm/type/transform/transform.mjs | 40 + .../typebox/build/esm/type/tuple/index.d.mts | 1 + .../typebox/build/esm/type/tuple/index.mjs | 1 + .../typebox/build/esm/type/tuple/tuple.d.mts | 16 + .../typebox/build/esm/type/tuple/tuple.mjs | 9 + .../typebox/build/esm/type/type/index.d.mts | 6 + .../typebox/build/esm/type/type/index.mjs | 13 + .../build/esm/type/type/javascript.d.mts | 64 + .../build/esm/type/type/javascript.mjs | 99 + .../typebox/build/esm/type/type/json.d.mts | 208 ++ .../typebox/build/esm/type/type/json.mjs | 221 ++ .../typebox/build/esm/type/type/type.d.mts | 59 + .../typebox/build/esm/type/type/type.mjs | 62 + .../build/esm/type/uint8array/index.d.mts | 1 + .../build/esm/type/uint8array/index.mjs | 1 + .../esm/type/uint8array/uint8array.d.mts | 13 + .../build/esm/type/uint8array/uint8array.mjs | 6 + .../build/esm/type/undefined/index.d.mts | 1 + .../build/esm/type/undefined/index.mjs | 1 + .../build/esm/type/undefined/undefined.d.mts | 9 + .../build/esm/type/undefined/undefined.mjs | 6 + .../typebox/build/esm/type/union/index.d.mts | 3 + .../typebox/build/esm/type/union/index.mjs | 3 + .../build/esm/type/union/union-create.d.mts | 3 + .../build/esm/type/union/union-create.mjs | 5 + .../esm/type/union/union-evaluated.d.mts | 13 + .../build/esm/type/union/union-evaluated.mjs | 36 + .../build/esm/type/union/union-type.d.mts | 12 + .../build/esm/type/union/union-type.mjs | 1 + .../typebox/build/esm/type/union/union.d.mts | 6 + .../typebox/build/esm/type/union/union.mjs | 10 + .../build/esm/type/unknown/index.d.mts | 1 + .../typebox/build/esm/type/unknown/index.mjs | 1 + .../build/esm/type/unknown/unknown.d.mts | 8 + .../build/esm/type/unknown/unknown.mjs | 6 + .../typebox/build/esm/type/unsafe/index.d.mts | 1 + .../typebox/build/esm/type/unsafe/index.mjs | 1 + .../build/esm/type/unsafe/unsafe.d.mts | 11 + .../typebox/build/esm/type/unsafe/unsafe.mjs | 6 + .../typebox/build/esm/type/void/index.d.mts | 1 + .../typebox/build/esm/type/void/index.mjs | 1 + .../typebox/build/esm/type/void/void.d.mts | 9 + .../typebox/build/esm/type/void/void.mjs | 6 + .../build/esm/value/assert/assert.d.mts | 15 + .../typebox/build/esm/value/assert/assert.mjs | 49 + .../build/esm/value/assert/index.d.mts | 1 + .../typebox/build/esm/value/assert/index.mjs | 1 + .../typebox/build/esm/value/cast/cast.d.mts | 11 + .../typebox/build/esm/value/cast/cast.mjs | 235 ++ .../typebox/build/esm/value/cast/index.d.mts | 1 + .../typebox/build/esm/value/cast/index.mjs | 1 + .../typebox/build/esm/value/check/check.d.mts | 11 + .../typebox/build/esm/value/check/check.mjs | 470 ++++ .../typebox/build/esm/value/check/index.d.mts | 1 + .../typebox/build/esm/value/check/index.mjs | 1 + .../typebox/build/esm/value/clean/clean.d.mts | 5 + .../typebox/build/esm/value/clean/clean.mjs | 145 + .../typebox/build/esm/value/clean/index.d.mts | 1 + .../typebox/build/esm/value/clean/index.mjs | 1 + .../typebox/build/esm/value/clone/clone.d.mts | 2 + .../typebox/build/esm/value/clone/clone.mjs | 56 + .../typebox/build/esm/value/clone/index.d.mts | 1 + .../typebox/build/esm/value/clone/index.mjs | 1 + .../build/esm/value/convert/convert.d.mts | 5 + .../build/esm/value/convert/convert.mjs | 260 ++ .../build/esm/value/convert/index.d.mts | 1 + .../typebox/build/esm/value/convert/index.mjs | 1 + .../build/esm/value/create/create.d.mts | 11 + .../typebox/build/esm/value/create/create.mjs | 468 ++++ .../build/esm/value/create/index.d.mts | 1 + .../typebox/build/esm/value/create/index.mjs | 1 + .../build/esm/value/decode/decode.d.mts | 6 + .../typebox/build/esm/value/decode/decode.mjs | 10 + .../build/esm/value/decode/index.d.mts | 1 + .../typebox/build/esm/value/decode/index.mjs | 1 + .../build/esm/value/default/default.d.mts | 5 + .../build/esm/value/default/default.mjs | 172 ++ .../build/esm/value/default/index.d.mts | 1 + .../typebox/build/esm/value/default/index.mjs | 1 + .../typebox/build/esm/value/delta/delta.d.mts | 32 + .../typebox/build/esm/value/delta/delta.mjs | 171 ++ .../typebox/build/esm/value/delta/index.d.mts | 1 + .../typebox/build/esm/value/delta/index.mjs | 1 + .../typebox/build/esm/value/deref/deref.d.mts | 12 + .../typebox/build/esm/value/deref/deref.mjs | 29 + .../typebox/build/esm/value/deref/index.d.mts | 1 + .../typebox/build/esm/value/deref/index.mjs | 1 + .../build/esm/value/encode/encode.d.mts | 6 + .../typebox/build/esm/value/encode/encode.mjs | 11 + .../build/esm/value/encode/index.d.mts | 1 + .../typebox/build/esm/value/encode/index.mjs | 1 + .../typebox/build/esm/value/equal/equal.d.mts | 2 + .../typebox/build/esm/value/equal/equal.mjs | 46 + .../typebox/build/esm/value/equal/index.d.mts | 1 + .../typebox/build/esm/value/equal/index.mjs | 1 + .../typebox/build/esm/value/guard/guard.d.mts | 74 + .../typebox/build/esm/value/guard/guard.mjs | 158 ++ .../typebox/build/esm/value/guard/index.d.mts | 1 + .../typebox/build/esm/value/guard/index.mjs | 1 + .../typebox/build/esm/value/hash/hash.d.mts | 7 + .../typebox/build/esm/value/hash/hash.mjs | 146 + .../typebox/build/esm/value/hash/index.d.mts | 1 + .../typebox/build/esm/value/hash/index.mjs | 1 + .../typebox/build/esm/value/index.d.mts | 20 + .../typebox/build/esm/value/index.mjs | 32 + .../build/esm/value/mutate/index.d.mts | 1 + .../typebox/build/esm/value/mutate/index.mjs | 1 + .../build/esm/value/mutate/mutate.d.mts | 9 + .../typebox/build/esm/value/mutate/mutate.mjs | 98 + .../typebox/build/esm/value/parse/index.d.mts | 1 + .../typebox/build/esm/value/parse/index.mjs | 1 + .../typebox/build/esm/value/parse/parse.d.mts | 22 + .../typebox/build/esm/value/parse/parse.mjs | 81 + .../build/esm/value/pointer/index.d.mts | 1 + .../typebox/build/esm/value/pointer/index.mjs | 1 + .../build/esm/value/pointer/pointer.d.mts | 22 + .../build/esm/value/pointer/pointer.mjs | 115 + .../build/esm/value/transform/decode.d.mts | 22 + .../build/esm/value/transform/decode.mjs | 207 ++ .../build/esm/value/transform/encode.d.mts | 23 + .../build/esm/value/transform/encode.mjs | 218 ++ .../build/esm/value/transform/has.d.mts | 3 + .../typebox/build/esm/value/transform/has.mjs | 129 + .../build/esm/value/transform/index.d.mts | 3 + .../build/esm/value/transform/index.mjs | 3 + .../typebox/build/esm/value/value/index.d.mts | 1 + .../typebox/build/esm/value/value/index.mjs | 1 + .../typebox/build/esm/value/value/value.d.mts | 16 + .../typebox/build/esm/value/value/value.mjs | 16 + .../@sinclair/typebox/compiler/package.json | 4 + .../@sinclair/typebox/errors/package.json | 4 + ui/node_modules/@sinclair/typebox/license | 25 + .../@sinclair/typebox/package.json | 116 + .../@sinclair/typebox/parser/package.json | 4 + ui/node_modules/@sinclair/typebox/readme.md | 1865 +++++++++++++ .../@sinclair/typebox/syntax/package.json | 4 + .../@sinclair/typebox/system/package.json | 4 + .../@sinclair/typebox/type/package.json | 4 + .../@sinclair/typebox/value/package.json | 4 + ui/node_modules/@tokenizer/inflate/LICENSE | 15 + ui/node_modules/@tokenizer/inflate/README.md | 114 + .../@tokenizer/inflate/lib/GzipHandler.d.ts | 6 + .../@tokenizer/inflate/lib/GzipHandler.js | 19 + .../@tokenizer/inflate/lib/ZipHandler.d.ts | 26 + .../@tokenizer/inflate/lib/ZipHandler.js | 233 ++ .../@tokenizer/inflate/lib/ZipToken.d.ts | 94 + .../@tokenizer/inflate/lib/ZipToken.js | 117 + .../@tokenizer/inflate/lib/index.d.ts | 3 + .../@tokenizer/inflate/lib/index.js | 2 + .../@tokenizer/inflate/package.json | 76 + ui/node_modules/@tokenizer/token/README.md | 19 + ui/node_modules/@tokenizer/token/index.d.ts | 30 + ui/node_modules/@tokenizer/token/package.json | 33 + ui/node_modules/cookie/LICENSE | 24 + ui/node_modules/cookie/README.md | 295 ++ ui/node_modules/cookie/dist/index.d.ts | 148 + ui/node_modules/cookie/dist/index.js | 350 +++ ui/node_modules/cookie/dist/index.js.map | 1 + ui/node_modules/cookie/package.json | 47 + ui/node_modules/debug/LICENSE | 20 + ui/node_modules/debug/README.md | 481 ++++ ui/node_modules/debug/package.json | 64 + ui/node_modules/debug/src/browser.js | 272 ++ ui/node_modules/debug/src/common.js | 292 ++ ui/node_modules/debug/src/index.js | 10 + ui/node_modules/debug/src/node.js | 263 ++ ui/node_modules/elysia/LICENSE | 7 + ui/node_modules/elysia/README.md | 36 + ui/node_modules/elysia/bunfig.toml | 2 + .../elysia/dist/adapter/bun/compose.d.ts | 3 + .../elysia/dist/adapter/bun/compose.js | 90 + .../elysia/dist/adapter/bun/compose.mjs | 74 + .../dist/adapter/bun/handler-native.d.ts | 3 + .../elysia/dist/adapter/bun/handler-native.js | 40 + .../dist/adapter/bun/handler-native.mjs | 20 + .../elysia/dist/adapter/bun/handler.d.ts | 7 + .../elysia/dist/adapter/bun/handler.js | 405 +++ .../elysia/dist/adapter/bun/handler.mjs | 388 +++ .../elysia/dist/adapter/bun/index.d.ts | 3 + .../elysia/dist/adapter/bun/index.js | 379 +++ .../elysia/dist/adapter/bun/index.mjs | 382 +++ .../dist/adapter/cloudflare-worker/index.d.ts | 20 + .../dist/adapter/cloudflare-worker/index.js | 59 + .../dist/adapter/cloudflare-worker/index.mjs | 39 + .../elysia/dist/adapter/index.d.ts | 1 + ui/node_modules/elysia/dist/adapter/index.js | 14 + ui/node_modules/elysia/dist/adapter/index.mjs | 0 .../elysia/dist/adapter/types.d.ts | 130 + ui/node_modules/elysia/dist/adapter/types.js | 14 + ui/node_modules/elysia/dist/adapter/types.mjs | 0 .../elysia/dist/adapter/utils.d.ts | 22 + ui/node_modules/elysia/dist/adapter/utils.js | 267 ++ ui/node_modules/elysia/dist/adapter/utils.mjs | 240 ++ .../dist/adapter/web-standard/handler.d.ts | 9 + .../dist/adapter/web-standard/handler.js | 417 +++ .../dist/adapter/web-standard/handler.mjs | 401 +++ .../dist/adapter/web-standard/index.d.ts | 2 + .../elysia/dist/adapter/web-standard/index.js | 164 ++ .../dist/adapter/web-standard/index.mjs | 148 + ui/node_modules/elysia/dist/bun/index.js | 411 +++ ui/node_modules/elysia/dist/bun/index.js.map | 38 + ui/node_modules/elysia/dist/compose.d.ts | 30 + ui/node_modules/elysia/dist/compose.js | 1324 +++++++++ ui/node_modules/elysia/dist/compose.mjs | 1336 +++++++++ ui/node_modules/elysia/dist/context.d.ts | 135 + ui/node_modules/elysia/dist/context.js | 14 + ui/node_modules/elysia/dist/context.mjs | 0 ui/node_modules/elysia/dist/cookies.d.ts | 158 ++ ui/node_modules/elysia/dist/cookies.js | 251 ++ ui/node_modules/elysia/dist/cookies.mjs | 222 ++ .../elysia/dist/dynamic-handle.d.ts | 15 + ui/node_modules/elysia/dist/dynamic-handle.js | 521 ++++ .../elysia/dist/dynamic-handle.mjs | 509 ++++ ui/node_modules/elysia/dist/error.d.ts | 197 ++ ui/node_modules/elysia/dist/error.js | 366 +++ ui/node_modules/elysia/dist/error.mjs | 335 +++ ui/node_modules/elysia/dist/formats.d.ts | 79 + ui/node_modules/elysia/dist/formats.js | 153 + ui/node_modules/elysia/dist/formats.mjs | 132 + ui/node_modules/elysia/dist/index.d.ts | 2198 +++++++++++++++ ui/node_modules/elysia/dist/index.js | 1922 +++++++++++++ ui/node_modules/elysia/dist/index.mjs | 1959 +++++++++++++ ui/node_modules/elysia/dist/manifest.d.ts | 0 ui/node_modules/elysia/dist/manifest.js | 1 + ui/node_modules/elysia/dist/manifest.mjs | 0 ui/node_modules/elysia/dist/parse-query.d.ts | 15 + ui/node_modules/elysia/dist/parse-query.js | 168 ++ ui/node_modules/elysia/dist/parse-query.mjs | 137 + .../elysia/dist/replace-schema.d.ts | 60 + ui/node_modules/elysia/dist/replace-schema.js | 140 + .../elysia/dist/replace-schema.mjs | 115 + ui/node_modules/elysia/dist/schema.d.ts | 102 + ui/node_modules/elysia/dist/schema.js | 817 ++++++ ui/node_modules/elysia/dist/schema.mjs | 798 ++++++ ui/node_modules/elysia/dist/sucrose.d.ts | 109 + ui/node_modules/elysia/dist/sucrose.js | 308 +++ ui/node_modules/elysia/dist/sucrose.mjs | 275 ++ ui/node_modules/elysia/dist/trace.d.ts | 135 + ui/node_modules/elysia/dist/trace.js | 137 + ui/node_modules/elysia/dist/trace.mjs | 115 + .../elysia/dist/type-system/format.d.ts | 55 + .../elysia/dist/type-system/format.js | 197 ++ .../elysia/dist/type-system/format.mjs | 175 ++ .../elysia/dist/type-system/index.d.ts | 45 + .../elysia/dist/type-system/index.js | 406 +++ .../elysia/dist/type-system/index.mjs | 394 +++ .../elysia/dist/type-system/types.d.ts | 128 + .../elysia/dist/type-system/types.js | 14 + .../elysia/dist/type-system/types.mjs | 0 .../elysia/dist/type-system/utils.d.ts | 62 + .../elysia/dist/type-system/utils.js | 141 + .../elysia/dist/type-system/utils.mjs | 111 + ui/node_modules/elysia/dist/types.d.ts | 1268 +++++++++ ui/node_modules/elysia/dist/types.js | 14 + ui/node_modules/elysia/dist/types.mjs | 0 .../elysia/dist/universal/env.d.ts | 1 + ui/node_modules/elysia/dist/universal/env.js | 26 + ui/node_modules/elysia/dist/universal/env.mjs | 5 + .../elysia/dist/universal/file.d.ts | 88 + ui/node_modules/elysia/dist/universal/file.js | 159 ++ .../elysia/dist/universal/file.mjs | 135 + .../elysia/dist/universal/index.d.ts | 3 + .../elysia/dist/universal/index.js | 27 + .../elysia/dist/universal/index.mjs | 6 + .../elysia/dist/universal/request.d.ts | 29 + .../elysia/dist/universal/request.js | 126 + .../elysia/dist/universal/request.mjs | 105 + .../elysia/dist/universal/server.d.ts | 322 +++ .../elysia/dist/universal/server.js | 14 + .../elysia/dist/universal/server.mjs | 0 .../elysia/dist/universal/types.d.ts | 124 + .../elysia/dist/universal/types.js | 41 + .../elysia/dist/universal/types.mjs | 19 + .../elysia/dist/universal/utils.d.ts | 3 + .../elysia/dist/universal/utils.js | 41 + .../elysia/dist/universal/utils.mjs | 18 + ui/node_modules/elysia/dist/utils.d.ts | 209 ++ ui/node_modules/elysia/dist/utils.js | 697 +++++ ui/node_modules/elysia/dist/utils.mjs | 635 +++++ ui/node_modules/elysia/dist/ws/bun.d.ts | 419 +++ ui/node_modules/elysia/dist/ws/bun.js | 14 + ui/node_modules/elysia/dist/ws/bun.mjs | 0 ui/node_modules/elysia/dist/ws/index.d.ts | 77 + ui/node_modules/elysia/dist/ws/index.js | 180 ++ ui/node_modules/elysia/dist/ws/index.mjs | 157 ++ ui/node_modules/elysia/dist/ws/types.d.ts | 60 + ui/node_modules/elysia/dist/ws/types.js | 14 + ui/node_modules/elysia/dist/ws/types.mjs | 0 ui/node_modules/elysia/knip.json | 22 + ui/node_modules/elysia/package.json | 238 ++ ui/node_modules/exact-mirror/LICENSE | 7 + ui/node_modules/exact-mirror/README.md | 52 + ui/node_modules/exact-mirror/bunfig.toml | 2 + .../exact-mirror/dist/cjs/index.d.ts | 43 + .../exact-mirror/dist/cjs/index.js | 396 +++ ui/node_modules/exact-mirror/dist/index.d.ts | 43 + ui/node_modules/exact-mirror/dist/index.mjs | 369 +++ ui/node_modules/exact-mirror/package.json | 58 + .../fast-decode-uri-component/.travis.yml | 12 + .../fast-decode-uri-component/LICENSE | 23 + .../fast-decode-uri-component/README.md | 43 + .../fast-decode-uri-component/bench.js | 35 + .../fast-decode-uri-component/index.js | 115 + .../fast-decode-uri-component/package.json | 33 + .../fast-decode-uri-component/test.js | 32 + ui/node_modules/file-type/core.d.ts | 253 ++ ui/node_modules/file-type/core.js | 1938 +++++++++++++ ui/node_modules/file-type/index.d.ts | 98 + ui/node_modules/file-type/index.js | 86 + ui/node_modules/file-type/license | 9 + ui/node_modules/file-type/package.json | 290 ++ ui/node_modules/file-type/readme.md | 662 +++++ ui/node_modules/file-type/supported.js | 360 +++ ui/node_modules/file-type/util.js | 60 + ui/node_modules/ieee754/LICENSE | 11 + ui/node_modules/ieee754/README.md | 51 + ui/node_modules/ieee754/index.d.ts | 10 + ui/node_modules/ieee754/index.js | 85 + ui/node_modules/ieee754/package.json | 52 + .../memoirist/.github/FUNDING.yaml | 1 + .../.github/ISSUE_TEMPLATE/2-bug-report.yml | 49 + .../ISSUE_TEMPLATE/3-feature-request.yml | 24 + .../.github/ISSUE_TEMPLATE/config.yml | 8 + .../memoirist/.github/dependabot.yml | 11 + .../memoirist/.github/workflows/ci.yml | 32 + .../memoirist/.github/workflows/publish.yml | 50 + ui/node_modules/memoirist/LICENSE | 8 + ui/node_modules/memoirist/README.md | 4 + ui/node_modules/memoirist/bunfig.toml | 2 + ui/node_modules/memoirist/dist/bun/index.d.ts | 49 + ui/node_modules/memoirist/dist/bun/index.js | 4 + .../memoirist/dist/bun/index.js.map | 10 + ui/node_modules/memoirist/dist/cjs/index.d.ts | 49 + ui/node_modules/memoirist/dist/cjs/index.js | 332 +++ ui/node_modules/memoirist/dist/index.d.ts | 49 + ui/node_modules/memoirist/dist/index.mjs | 307 ++ ui/node_modules/memoirist/package.json | 56 + ui/node_modules/memoirist/src/index.ts | 435 +++ ui/node_modules/ms/index.js | 162 ++ ui/node_modules/ms/license.md | 21 + ui/node_modules/ms/package.json | 38 + ui/node_modules/ms/readme.md | 59 + ui/node_modules/openapi-types/CHANGELOG.md | 41 + ui/node_modules/openapi-types/LICENSE | 21 + ui/node_modules/openapi-types/README.md | 46 + ui/node_modules/openapi-types/dist/index.d.ts | 735 +++++ ui/node_modules/openapi-types/dist/index.js | 39 + .../openapi-types/dist/index.js.map | 1 + ui/node_modules/openapi-types/package.json | 25 + ui/node_modules/strtok3/LICENSE.txt | 21 + ui/node_modules/strtok3/README.md | 399 +++ .../strtok3/lib/AbstractTokenizer.d.ts | 76 + .../strtok3/lib/AbstractTokenizer.js | 108 + .../strtok3/lib/BlobTokenizer.d.ts | 29 + ui/node_modules/strtok3/lib/BlobTokenizer.js | 53 + .../strtok3/lib/BufferTokenizer.d.ts | 29 + .../strtok3/lib/BufferTokenizer.js | 52 + .../strtok3/lib/FileTokenizer.d.ts | 37 + ui/node_modules/strtok3/lib/FileTokenizer.js | 61 + .../strtok3/lib/ReadStreamTokenizer.d.ts | 31 + .../strtok3/lib/ReadStreamTokenizer.js | 102 + ui/node_modules/strtok3/lib/core.d.ts | 40 + ui/node_modules/strtok3/lib/core.js | 62 + ui/node_modules/strtok3/lib/index.d.ts | 16 + ui/node_modules/strtok3/lib/index.js | 22 + .../lib/stream/AbstractStreamReader.d.ts | 54 + .../lib/stream/AbstractStreamReader.js | 71 + .../strtok3/lib/stream/Deferred.d.ts | 6 + .../strtok3/lib/stream/Deferred.js | 10 + .../strtok3/lib/stream/Errors.d.ts | 10 + ui/node_modules/strtok3/lib/stream/Errors.js | 16 + .../strtok3/lib/stream/StreamReader.d.ts | 29 + .../strtok3/lib/stream/StreamReader.js | 83 + .../lib/stream/WebStreamByobReader.d.ts | 14 + .../strtok3/lib/stream/WebStreamByobReader.js | 27 + .../lib/stream/WebStreamDefaultReader.d.ts | 19 + .../lib/stream/WebStreamDefaultReader.js | 62 + .../strtok3/lib/stream/WebStreamReader.d.ts | 14 + .../strtok3/lib/stream/WebStreamReader.js | 13 + .../lib/stream/WebStreamReaderFactory.d.ts | 5 + .../lib/stream/WebStreamReaderFactory.js | 19 + ui/node_modules/strtok3/lib/stream/index.d.ts | 6 + ui/node_modules/strtok3/lib/stream/index.js | 5 + ui/node_modules/strtok3/lib/types.d.ts | 139 + ui/node_modules/strtok3/lib/types.js | 1 + ui/node_modules/strtok3/package.json | 94 + ui/node_modules/token-types/LICENSE.txt | 9 + ui/node_modules/token-types/README.md | 120 + ui/node_modules/token-types/lib/index.d.ts | 135 + ui/node_modules/token-types/lib/index.js | 401 +++ ui/node_modules/token-types/package.json | 81 + ui/node_modules/uint8array-extras/index.d.ts | 331 +++ ui/node_modules/uint8array-extras/index.js | 318 +++ ui/node_modules/uint8array-extras/license | 9 + .../uint8array-extras/package.json | 54 + ui/node_modules/uint8array-extras/readme.md | 318 +++ ui/package.json | 11 + ui/src/index.ts | 289 ++ 1370 files changed, 81827 insertions(+), 333 deletions(-) create mode 100644 contracts/cache/solidity-files-cache.json create mode 100644 contracts/foundry.toml create mode 100644 contracts/lib/DataRootTuple.sol create mode 100644 contracts/lib/IBlobstreamX.sol create mode 100644 contracts/lib/tree/Constants.sol create mode 100644 contracts/lib/tree/Types.sol create mode 100644 contracts/lib/tree/Utils.sol create mode 100644 contracts/lib/tree/binary/BinaryMerkleMultiproof.sol create mode 100644 contracts/lib/tree/binary/BinaryMerkleProof.sol create mode 100644 contracts/lib/tree/binary/BinaryMerkleTree.sol create mode 100644 contracts/lib/tree/binary/TreeHasher.sol create mode 100644 contracts/out/BinaryMerkleTree.sol/BinaryMerkleTree.json create mode 100644 contracts/out/Constants.sol/Constants.json create mode 100644 contracts/out/IBlobstreamX.sol/IBlobstreamX.json create mode 100644 contracts/out/MockBlobstream.sol/Mockstream.json create mode 100644 contracts/out/build-info/9b5d39574bb3a56d.json create mode 100644 contracts/remappings.txt create mode 100755 contracts/scripts/deploy_mock_blobstream.sh create mode 100644 contracts/src/MockBlobstream.sol create mode 100755 scripts/setup_anvil.sh create mode 100644 src/bin/blobstream_relayer.rs create mode 100644 src/cli.rs create mode 100644 src/relayer.rs create mode 100644 src/rpc/blobstream.rs create mode 100644 tests/compat_blobstream.rs create mode 100644 ui/bun.lock create mode 100644 ui/node_modules/@borewit/text-codec/LICENSE.txt create mode 100644 ui/node_modules/@borewit/text-codec/README.md create mode 100644 ui/node_modules/@borewit/text-codec/lib/index.d.ts create mode 100644 ui/node_modules/@borewit/text-codec/lib/index.js create mode 100644 ui/node_modules/@borewit/text-codec/package.json create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/errors/function.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/errors/function.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/errors/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/errors/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/system/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/system/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/system/policy.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/system/policy.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/system/system.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/system/system.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.js create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.d.ts create mode 100644 ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.js create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/compiler/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/compiler/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/errors/errors.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/errors/errors.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/errors/function.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/errors/function.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/errors/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/errors/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/system/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/system/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/system/policy.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/system/policy.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/system/system.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/system/system.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/any/any.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/any/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/any/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/array/array.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/array/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/array/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/const/const.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/const/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/const/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/create/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/create/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/create/type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/date/date.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/date/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/date/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/error/error.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/error/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/error/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/function/function.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/function/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/function/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/module.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/never/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/never/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/never/never.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/not/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/not/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/not/not.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/null/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/null/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/null/null.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/number/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/number/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/number/number.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/object/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/object/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/object/object.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/record/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/record/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/record/record.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/required/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/required/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/required/required.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/static/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/static/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/static/static.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/static/static.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/string/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/string/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/string/string.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/json.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/json.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/void/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/void/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/void/void.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/check/check.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/check/check.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/check/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/check/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/create/create.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/create/create.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/create/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/create/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/default/default.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/default/default.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/default/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/default/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/value/index.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/value/index.mjs create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/value/value.d.mts create mode 100644 ui/node_modules/@sinclair/typebox/build/esm/value/value/value.mjs create mode 100644 ui/node_modules/@sinclair/typebox/compiler/package.json create mode 100644 ui/node_modules/@sinclair/typebox/errors/package.json create mode 100644 ui/node_modules/@sinclair/typebox/license create mode 100644 ui/node_modules/@sinclair/typebox/package.json create mode 100644 ui/node_modules/@sinclair/typebox/parser/package.json create mode 100644 ui/node_modules/@sinclair/typebox/readme.md create mode 100644 ui/node_modules/@sinclair/typebox/syntax/package.json create mode 100644 ui/node_modules/@sinclair/typebox/system/package.json create mode 100644 ui/node_modules/@sinclair/typebox/type/package.json create mode 100644 ui/node_modules/@sinclair/typebox/value/package.json create mode 100644 ui/node_modules/@tokenizer/inflate/LICENSE create mode 100644 ui/node_modules/@tokenizer/inflate/README.md create mode 100644 ui/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts create mode 100644 ui/node_modules/@tokenizer/inflate/lib/GzipHandler.js create mode 100644 ui/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts create mode 100644 ui/node_modules/@tokenizer/inflate/lib/ZipHandler.js create mode 100644 ui/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts create mode 100644 ui/node_modules/@tokenizer/inflate/lib/ZipToken.js create mode 100644 ui/node_modules/@tokenizer/inflate/lib/index.d.ts create mode 100644 ui/node_modules/@tokenizer/inflate/lib/index.js create mode 100644 ui/node_modules/@tokenizer/inflate/package.json create mode 100644 ui/node_modules/@tokenizer/token/README.md create mode 100644 ui/node_modules/@tokenizer/token/index.d.ts create mode 100644 ui/node_modules/@tokenizer/token/package.json create mode 100644 ui/node_modules/cookie/LICENSE create mode 100644 ui/node_modules/cookie/README.md create mode 100644 ui/node_modules/cookie/dist/index.d.ts create mode 100644 ui/node_modules/cookie/dist/index.js create mode 100644 ui/node_modules/cookie/dist/index.js.map create mode 100644 ui/node_modules/cookie/package.json create mode 100644 ui/node_modules/debug/LICENSE create mode 100644 ui/node_modules/debug/README.md create mode 100644 ui/node_modules/debug/package.json create mode 100644 ui/node_modules/debug/src/browser.js create mode 100644 ui/node_modules/debug/src/common.js create mode 100644 ui/node_modules/debug/src/index.js create mode 100644 ui/node_modules/debug/src/node.js create mode 100644 ui/node_modules/elysia/LICENSE create mode 100644 ui/node_modules/elysia/README.md create mode 100644 ui/node_modules/elysia/bunfig.toml create mode 100644 ui/node_modules/elysia/dist/adapter/bun/compose.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/bun/compose.js create mode 100644 ui/node_modules/elysia/dist/adapter/bun/compose.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/bun/handler-native.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/bun/handler-native.js create mode 100644 ui/node_modules/elysia/dist/adapter/bun/handler-native.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/bun/handler.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/bun/handler.js create mode 100644 ui/node_modules/elysia/dist/adapter/bun/handler.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/bun/index.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/bun/index.js create mode 100644 ui/node_modules/elysia/dist/adapter/bun/index.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/cloudflare-worker/index.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/cloudflare-worker/index.js create mode 100644 ui/node_modules/elysia/dist/adapter/cloudflare-worker/index.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/index.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/index.js create mode 100644 ui/node_modules/elysia/dist/adapter/index.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/types.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/types.js create mode 100644 ui/node_modules/elysia/dist/adapter/types.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/utils.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/utils.js create mode 100644 ui/node_modules/elysia/dist/adapter/utils.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/web-standard/handler.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/web-standard/handler.js create mode 100644 ui/node_modules/elysia/dist/adapter/web-standard/handler.mjs create mode 100644 ui/node_modules/elysia/dist/adapter/web-standard/index.d.ts create mode 100644 ui/node_modules/elysia/dist/adapter/web-standard/index.js create mode 100644 ui/node_modules/elysia/dist/adapter/web-standard/index.mjs create mode 100644 ui/node_modules/elysia/dist/bun/index.js create mode 100644 ui/node_modules/elysia/dist/bun/index.js.map create mode 100644 ui/node_modules/elysia/dist/compose.d.ts create mode 100644 ui/node_modules/elysia/dist/compose.js create mode 100644 ui/node_modules/elysia/dist/compose.mjs create mode 100644 ui/node_modules/elysia/dist/context.d.ts create mode 100644 ui/node_modules/elysia/dist/context.js create mode 100644 ui/node_modules/elysia/dist/context.mjs create mode 100644 ui/node_modules/elysia/dist/cookies.d.ts create mode 100644 ui/node_modules/elysia/dist/cookies.js create mode 100644 ui/node_modules/elysia/dist/cookies.mjs create mode 100644 ui/node_modules/elysia/dist/dynamic-handle.d.ts create mode 100644 ui/node_modules/elysia/dist/dynamic-handle.js create mode 100644 ui/node_modules/elysia/dist/dynamic-handle.mjs create mode 100644 ui/node_modules/elysia/dist/error.d.ts create mode 100644 ui/node_modules/elysia/dist/error.js create mode 100644 ui/node_modules/elysia/dist/error.mjs create mode 100644 ui/node_modules/elysia/dist/formats.d.ts create mode 100644 ui/node_modules/elysia/dist/formats.js create mode 100644 ui/node_modules/elysia/dist/formats.mjs create mode 100644 ui/node_modules/elysia/dist/index.d.ts create mode 100644 ui/node_modules/elysia/dist/index.js create mode 100644 ui/node_modules/elysia/dist/index.mjs create mode 100644 ui/node_modules/elysia/dist/manifest.d.ts create mode 100644 ui/node_modules/elysia/dist/manifest.js create mode 100644 ui/node_modules/elysia/dist/manifest.mjs create mode 100644 ui/node_modules/elysia/dist/parse-query.d.ts create mode 100644 ui/node_modules/elysia/dist/parse-query.js create mode 100644 ui/node_modules/elysia/dist/parse-query.mjs create mode 100644 ui/node_modules/elysia/dist/replace-schema.d.ts create mode 100644 ui/node_modules/elysia/dist/replace-schema.js create mode 100644 ui/node_modules/elysia/dist/replace-schema.mjs create mode 100644 ui/node_modules/elysia/dist/schema.d.ts create mode 100644 ui/node_modules/elysia/dist/schema.js create mode 100644 ui/node_modules/elysia/dist/schema.mjs create mode 100644 ui/node_modules/elysia/dist/sucrose.d.ts create mode 100644 ui/node_modules/elysia/dist/sucrose.js create mode 100644 ui/node_modules/elysia/dist/sucrose.mjs create mode 100644 ui/node_modules/elysia/dist/trace.d.ts create mode 100644 ui/node_modules/elysia/dist/trace.js create mode 100644 ui/node_modules/elysia/dist/trace.mjs create mode 100644 ui/node_modules/elysia/dist/type-system/format.d.ts create mode 100644 ui/node_modules/elysia/dist/type-system/format.js create mode 100644 ui/node_modules/elysia/dist/type-system/format.mjs create mode 100644 ui/node_modules/elysia/dist/type-system/index.d.ts create mode 100644 ui/node_modules/elysia/dist/type-system/index.js create mode 100644 ui/node_modules/elysia/dist/type-system/index.mjs create mode 100644 ui/node_modules/elysia/dist/type-system/types.d.ts create mode 100644 ui/node_modules/elysia/dist/type-system/types.js create mode 100644 ui/node_modules/elysia/dist/type-system/types.mjs create mode 100644 ui/node_modules/elysia/dist/type-system/utils.d.ts create mode 100644 ui/node_modules/elysia/dist/type-system/utils.js create mode 100644 ui/node_modules/elysia/dist/type-system/utils.mjs create mode 100644 ui/node_modules/elysia/dist/types.d.ts create mode 100644 ui/node_modules/elysia/dist/types.js create mode 100644 ui/node_modules/elysia/dist/types.mjs create mode 100644 ui/node_modules/elysia/dist/universal/env.d.ts create mode 100644 ui/node_modules/elysia/dist/universal/env.js create mode 100644 ui/node_modules/elysia/dist/universal/env.mjs create mode 100644 ui/node_modules/elysia/dist/universal/file.d.ts create mode 100644 ui/node_modules/elysia/dist/universal/file.js create mode 100644 ui/node_modules/elysia/dist/universal/file.mjs create mode 100644 ui/node_modules/elysia/dist/universal/index.d.ts create mode 100644 ui/node_modules/elysia/dist/universal/index.js create mode 100644 ui/node_modules/elysia/dist/universal/index.mjs create mode 100644 ui/node_modules/elysia/dist/universal/request.d.ts create mode 100644 ui/node_modules/elysia/dist/universal/request.js create mode 100644 ui/node_modules/elysia/dist/universal/request.mjs create mode 100644 ui/node_modules/elysia/dist/universal/server.d.ts create mode 100644 ui/node_modules/elysia/dist/universal/server.js create mode 100644 ui/node_modules/elysia/dist/universal/server.mjs create mode 100644 ui/node_modules/elysia/dist/universal/types.d.ts create mode 100644 ui/node_modules/elysia/dist/universal/types.js create mode 100644 ui/node_modules/elysia/dist/universal/types.mjs create mode 100644 ui/node_modules/elysia/dist/universal/utils.d.ts create mode 100644 ui/node_modules/elysia/dist/universal/utils.js create mode 100644 ui/node_modules/elysia/dist/universal/utils.mjs create mode 100644 ui/node_modules/elysia/dist/utils.d.ts create mode 100644 ui/node_modules/elysia/dist/utils.js create mode 100644 ui/node_modules/elysia/dist/utils.mjs create mode 100644 ui/node_modules/elysia/dist/ws/bun.d.ts create mode 100644 ui/node_modules/elysia/dist/ws/bun.js create mode 100644 ui/node_modules/elysia/dist/ws/bun.mjs create mode 100644 ui/node_modules/elysia/dist/ws/index.d.ts create mode 100644 ui/node_modules/elysia/dist/ws/index.js create mode 100644 ui/node_modules/elysia/dist/ws/index.mjs create mode 100644 ui/node_modules/elysia/dist/ws/types.d.ts create mode 100644 ui/node_modules/elysia/dist/ws/types.js create mode 100644 ui/node_modules/elysia/dist/ws/types.mjs create mode 100644 ui/node_modules/elysia/knip.json create mode 100644 ui/node_modules/elysia/package.json create mode 100644 ui/node_modules/exact-mirror/LICENSE create mode 100644 ui/node_modules/exact-mirror/README.md create mode 100644 ui/node_modules/exact-mirror/bunfig.toml create mode 100644 ui/node_modules/exact-mirror/dist/cjs/index.d.ts create mode 100644 ui/node_modules/exact-mirror/dist/cjs/index.js create mode 100644 ui/node_modules/exact-mirror/dist/index.d.ts create mode 100644 ui/node_modules/exact-mirror/dist/index.mjs create mode 100644 ui/node_modules/exact-mirror/package.json create mode 100644 ui/node_modules/fast-decode-uri-component/.travis.yml create mode 100644 ui/node_modules/fast-decode-uri-component/LICENSE create mode 100644 ui/node_modules/fast-decode-uri-component/README.md create mode 100644 ui/node_modules/fast-decode-uri-component/bench.js create mode 100644 ui/node_modules/fast-decode-uri-component/index.js create mode 100644 ui/node_modules/fast-decode-uri-component/package.json create mode 100644 ui/node_modules/fast-decode-uri-component/test.js create mode 100644 ui/node_modules/file-type/core.d.ts create mode 100644 ui/node_modules/file-type/core.js create mode 100644 ui/node_modules/file-type/index.d.ts create mode 100644 ui/node_modules/file-type/index.js create mode 100644 ui/node_modules/file-type/license create mode 100644 ui/node_modules/file-type/package.json create mode 100644 ui/node_modules/file-type/readme.md create mode 100644 ui/node_modules/file-type/supported.js create mode 100644 ui/node_modules/file-type/util.js create mode 100644 ui/node_modules/ieee754/LICENSE create mode 100644 ui/node_modules/ieee754/README.md create mode 100644 ui/node_modules/ieee754/index.d.ts create mode 100644 ui/node_modules/ieee754/index.js create mode 100644 ui/node_modules/ieee754/package.json create mode 100644 ui/node_modules/memoirist/.github/FUNDING.yaml create mode 100644 ui/node_modules/memoirist/.github/ISSUE_TEMPLATE/2-bug-report.yml create mode 100644 ui/node_modules/memoirist/.github/ISSUE_TEMPLATE/3-feature-request.yml create mode 100644 ui/node_modules/memoirist/.github/ISSUE_TEMPLATE/config.yml create mode 100644 ui/node_modules/memoirist/.github/dependabot.yml create mode 100644 ui/node_modules/memoirist/.github/workflows/ci.yml create mode 100644 ui/node_modules/memoirist/.github/workflows/publish.yml create mode 100644 ui/node_modules/memoirist/LICENSE create mode 100644 ui/node_modules/memoirist/README.md create mode 100644 ui/node_modules/memoirist/bunfig.toml create mode 100644 ui/node_modules/memoirist/dist/bun/index.d.ts create mode 100644 ui/node_modules/memoirist/dist/bun/index.js create mode 100644 ui/node_modules/memoirist/dist/bun/index.js.map create mode 100644 ui/node_modules/memoirist/dist/cjs/index.d.ts create mode 100644 ui/node_modules/memoirist/dist/cjs/index.js create mode 100644 ui/node_modules/memoirist/dist/index.d.ts create mode 100644 ui/node_modules/memoirist/dist/index.mjs create mode 100644 ui/node_modules/memoirist/package.json create mode 100644 ui/node_modules/memoirist/src/index.ts create mode 100644 ui/node_modules/ms/index.js create mode 100644 ui/node_modules/ms/license.md create mode 100644 ui/node_modules/ms/package.json create mode 100644 ui/node_modules/ms/readme.md create mode 100644 ui/node_modules/openapi-types/CHANGELOG.md create mode 100644 ui/node_modules/openapi-types/LICENSE create mode 100644 ui/node_modules/openapi-types/README.md create mode 100644 ui/node_modules/openapi-types/dist/index.d.ts create mode 100644 ui/node_modules/openapi-types/dist/index.js create mode 100644 ui/node_modules/openapi-types/dist/index.js.map create mode 100644 ui/node_modules/openapi-types/package.json create mode 100644 ui/node_modules/strtok3/LICENSE.txt create mode 100644 ui/node_modules/strtok3/README.md create mode 100644 ui/node_modules/strtok3/lib/AbstractTokenizer.d.ts create mode 100644 ui/node_modules/strtok3/lib/AbstractTokenizer.js create mode 100644 ui/node_modules/strtok3/lib/BlobTokenizer.d.ts create mode 100644 ui/node_modules/strtok3/lib/BlobTokenizer.js create mode 100644 ui/node_modules/strtok3/lib/BufferTokenizer.d.ts create mode 100644 ui/node_modules/strtok3/lib/BufferTokenizer.js create mode 100644 ui/node_modules/strtok3/lib/FileTokenizer.d.ts create mode 100644 ui/node_modules/strtok3/lib/FileTokenizer.js create mode 100644 ui/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts create mode 100644 ui/node_modules/strtok3/lib/ReadStreamTokenizer.js create mode 100644 ui/node_modules/strtok3/lib/core.d.ts create mode 100644 ui/node_modules/strtok3/lib/core.js create mode 100644 ui/node_modules/strtok3/lib/index.d.ts create mode 100644 ui/node_modules/strtok3/lib/index.js create mode 100644 ui/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/AbstractStreamReader.js create mode 100644 ui/node_modules/strtok3/lib/stream/Deferred.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/Deferred.js create mode 100644 ui/node_modules/strtok3/lib/stream/Errors.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/Errors.js create mode 100644 ui/node_modules/strtok3/lib/stream/StreamReader.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/StreamReader.js create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamByobReader.js create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamReader.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamReader.js create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js create mode 100644 ui/node_modules/strtok3/lib/stream/index.d.ts create mode 100644 ui/node_modules/strtok3/lib/stream/index.js create mode 100644 ui/node_modules/strtok3/lib/types.d.ts create mode 100644 ui/node_modules/strtok3/lib/types.js create mode 100644 ui/node_modules/strtok3/package.json create mode 100644 ui/node_modules/token-types/LICENSE.txt create mode 100644 ui/node_modules/token-types/README.md create mode 100644 ui/node_modules/token-types/lib/index.d.ts create mode 100644 ui/node_modules/token-types/lib/index.js create mode 100644 ui/node_modules/token-types/package.json create mode 100644 ui/node_modules/uint8array-extras/index.d.ts create mode 100644 ui/node_modules/uint8array-extras/index.js create mode 100644 ui/node_modules/uint8array-extras/license create mode 100644 ui/node_modules/uint8array-extras/package.json create mode 100644 ui/node_modules/uint8array-extras/readme.md create mode 100644 ui/package.json create mode 100644 ui/src/index.ts diff --git a/Cargo.lock b/Cargo.lock index f2c7ca4..183626f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,33 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -11,6 +38,56 @@ dependencies = [ "memchr", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "anyhow" version = "1.0.97" @@ -29,6 +106,15 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + [[package]] name = "async-stream" version = "0.3.6" @@ -48,7 +134,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -59,7 +145,18 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version", ] [[package]] @@ -68,6 +165,17 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "auto_impl" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "autocfg" version = "1.4.0" @@ -86,6 +194,18 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -98,6 +218,12 @@ version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bech32" version = "0.11.0" @@ -110,6 +236,27 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.9.0" @@ -178,7 +325,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -187,6 +334,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ + "sha2 0.10.8", "tinyvec", ] @@ -196,6 +344,12 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +[[package]] +name = "byte-slice-cast" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" + [[package]] name = "byteorder" version = "1.5.0" @@ -211,6 +365,58 @@ dependencies = [ "serde", ] +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.13+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" +dependencies = [ + "cc", + "pkg-config", +] + +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 1.0.69", +] + [[package]] name = "cc" version = "1.2.55" @@ -218,6 +424,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -242,17 +450,17 @@ version = "0.16.2" source = "git+https://github.com/Ferret-san/lumina.git?rev=9d2c673#9d2c67332103efe6f7c4a3818db4630fa408af05" dependencies = [ "async-stream", - "base64", + "base64 0.22.1", "celestia-proto", "celestia-types", "futures-util", "gloo-net", - "gloo-timers", + "gloo-timers 0.3.0", "http 1.4.0", "jsonrpsee", "libp2p-identity", "multiaddr", - "send_wrapper", + "send_wrapper 0.6.0", "serde", "serde_json", "serde_repr", @@ -268,8 +476,8 @@ name = "celestia-types" version = "0.20.0" source = "git+https://github.com/Ferret-san/lumina.git?rev=9d2c673#9d2c67332103efe6f7c4a3818db4630fa408af05" dependencies = [ - "base64", - "bech32", + "base64 0.22.1", + "bech32 0.11.0", "bitvec", "blockstore", "bytes", @@ -312,6 +520,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "num-traits", +] + [[package]] name = "cid" version = "0.11.1" @@ -324,6 +541,114 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.5.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "clap_lex" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" + +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58", + "coins-core", + "digest 0.10.7", + "hmac", + "k256", + "serde", + "sha2 0.10.8", + "thiserror 1.0.69", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand 0.8.5", + "sha2 0.10.8", + "thiserror 1.0.69", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.7", + "bech32 0.9.1", + "bs58", + "digest 0.10.7", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2 0.10.8", + "sha3", + "thiserror 1.0.69", +] + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "combine" version = "4.6.7" @@ -338,6 +663,18 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "const-hex" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bb320cac8a0750d7f25280aa97b09c26edfe161164238ecbbb31092b079e735" +dependencies = [ + "cfg-if", + "cpufeatures", + "proptest", + "serde_core", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -364,6 +701,22 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation" version = "0.10.1" @@ -398,12 +751,46 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -426,6 +813,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek-ng" version = "4.1.1" @@ -476,7 +872,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18e4fdb82bd54a12e42fb58a800dcae6b9e13982238ce2296dc3570b92148e1f" dependencies = [ "data-encoding", - "syn", + "syn 2.0.100", ] [[package]] @@ -491,13 +887,33 @@ dependencies = [ [[package]] name = "deranged" -version = "0.4.1" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cfac68e08048ae1883171632c2aef3ebc555621ae56fbccce1cbf22dd7f058" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "digest" version = "0.9.0" @@ -519,6 +935,48 @@ dependencies = [ "subtle", ] +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -527,9 +985,15 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "ecdsa" version = "0.16.9" @@ -555,71 +1019,435 @@ dependencies = [ ] [[package]] -name = "ed25519-consensus" -version = "2.1.0" +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core 0.6.4", + "serde", + "sha2 0.9.9", + "thiserror 1.0.69", + "zeroize", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "ena" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1" +dependencies = [ + "log", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enr" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" +dependencies = [ + "base64 0.21.7", + "bytes", + "hex", + "k256", + "log", + "rand 0.8.5", + "rlp", + "serde", + "sha3", + "zeroize", +] + +[[package]] +name = "enum_dispatch" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand 0.8.5", + "scrypt", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3", + "thiserror 1.0.69", + "uuid 0.8.2", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror 1.0.69", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", +] + +[[package]] +name = "ethers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" +dependencies = [ + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "ethers-etherscan", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn 2.0.100", + "toml", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.100", +] + +[[package]] +name = "ethers-core" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" +dependencies = [ + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", + "generic-array", + "k256", + "num_enum", + "once_cell", + "open-fastrlp", + "rand 0.8.5", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.100", + "tempfile", + "thiserror 1.0.69", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "ethers-etherscan" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" +dependencies = [ + "chrono", + "ethers-core", + "reqwest", + "semver", + "serde", + "serde_json", + "thiserror 1.0.69", + "tracing", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" dependencies = [ - "curve25519-dalek-ng", - "hex", - "rand_core 0.6.4", + "async-trait", + "auto_impl", + "base64 0.21.7", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http 0.2.12", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest", "serde", - "sha2 0.9.9", + "serde_json", "thiserror 1.0.69", - "zeroize", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", ] [[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "elliptic-curve" -version = "0.13.8" +name = "ethers-signers" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand 0.8.5", + "sha2 0.10.8", + "thiserror 1.0.69", + "tracing", ] [[package]] -name = "enum_dispatch" -version = "0.3.13" +name = "ethers-solc" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" +checksum = "66244a771d9163282646dbeffe0e6eca4dda4146b6498644e678ac6089b11edd" dependencies = [ + "cfg-if", + "const-hex", + "dirs", + "dunce", + "ethers-core", + "glob", + "home", + "md-5", + "num_cpus", "once_cell", - "proc-macro2", - "quote", - "syn", + "path-slash", + "rayon", + "regex", + "semver", + "serde", + "serde_json", + "solang-parser", + "svm-rs", + "thiserror 1.0.69", + "tiny-keccak", + "tokio", + "tracing", + "walkdir", + "yansi", ] [[package]] -name = "equivalent" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.10" +name = "eyre" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ - "libc", - "windows-sys 0.59.0", + "indenter", + "once_cell", ] [[package]] @@ -644,12 +1472,34 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + [[package]] name = "fixedbitset" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "flex-error" version = "0.4.4" @@ -674,6 +1524,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "funty" version = "2.0.0" @@ -688,6 +1548,7 @@ checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", + "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -710,12 +1571,33 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + [[package]] name = "futures-macro" version = "0.3.31" @@ -724,7 +1606,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -744,6 +1626,10 @@ name = "futures-timer" version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +dependencies = [ + "gloo-timers 0.2.6", + "send_wrapper 0.4.0", +] [[package]] name = "futures-util" @@ -763,6 +1649,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -799,6 +1694,12 @@ dependencies = [ "wasi 0.14.2+wasi-0.2.4", ] +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + [[package]] name = "gloo-net" version = "0.6.0" @@ -816,6 +1717,18 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "gloo-timers" version = "0.3.0" @@ -852,6 +1765,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "h2" version = "0.4.13" @@ -883,12 +1815,27 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + [[package]] name = "hex" version = "0.4.3" @@ -913,6 +1860,15 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "http" version = "0.2.12" @@ -986,6 +1942,30 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.5.9", + "tokio", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "1.8.1" @@ -996,7 +1976,7 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2", + "h2 0.4.13", "http 1.4.0", "http-body 1.0.1", "httparse", @@ -1009,6 +1989,20 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http 0.2.12", + "hyper 0.14.32", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", +] + [[package]] name = "hyper-rustls" version = "0.27.7" @@ -1016,13 +2010,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ "http 1.4.0", - "hyper", + "hyper 1.8.1", "hyper-util", "log", - "rustls", + "rustls 0.23.36", "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.26.4", "tower-service", ] @@ -1037,10 +2031,10 @@ dependencies = [ "futures-util", "http 1.4.0", "http-body 1.0.1", - "hyper", + "hyper 1.8.1", "libc", "pin-project-lite", - "socket2 0.5.9", + "socket2 0.6.2", "tokio", "tower-service", "tracing", @@ -1154,45 +2148,128 @@ dependencies = [ ] [[package]] -name = "icu_provider_macros" -version = "1.5.0" +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] -name = "idna" -version = "1.0.3" +name = "indenter" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" + +[[package]] +name = "indexmap" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", + "equivalent", + "hashbrown 0.15.2", ] [[package]] -name = "idna_adapter" -version = "1.2.0" +name = "inout" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "icu_normalizer", - "icu_properties", + "generic-array", ] [[package]] -name = "indexmap" -version = "2.8.0" +name = "instant" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ - "equivalent", - "hashbrown 0.15.2", + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", ] [[package]] @@ -1232,6 +2309,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.2", + "libc", +] + [[package]] name = "js-sys" version = "0.3.83" @@ -1264,18 +2351,18 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf36eb27f8e13fa93dcb50ccb44c417e25b818cfa1a481b5470cd07b19c60b98" dependencies = [ - "base64", + "base64 0.22.1", "futures-util", "http 1.4.0", "jsonrpsee-core", "pin-project", - "rustls", + "rustls 0.23.36", "rustls-pki-types", "rustls-platform-verifier", "soketto", "thiserror 2.0.12", "tokio", - "tokio-rustls", + "tokio-rustls 0.26.4", "tokio-util", "tracing", "url", @@ -1314,14 +2401,14 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790bedefcec85321e007ff3af84b4e417540d5c87b3c9779b9e247d1bcc3dab8" dependencies = [ - "base64", + "base64 0.22.1", "http-body 1.0.1", - "hyper", - "hyper-rustls", + "hyper 1.8.1", + "hyper-rustls 0.27.7", "hyper-util", "jsonrpsee-core", "jsonrpsee-types", - "rustls", + "rustls 0.23.36", "rustls-platform-verifier", "serde", "serde_json", @@ -1341,7 +2428,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -1354,7 +2441,7 @@ dependencies = [ "http 1.4.0", "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.8.1", "hyper-util", "jsonrpsee-core", "jsonrpsee-types", @@ -1397,6 +2484,20 @@ dependencies = [ "url", ] +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.7", + "pem", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "k256" version = "0.13.4" @@ -1411,6 +2512,45 @@ dependencies = [ "signature", ] +[[package]] +name = "keccak" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lalrpop" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" +dependencies = [ + "ascii-canvas", + "bit-set", + "ena", + "itertools 0.11.0", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", + "walkdir", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" +dependencies = [ + "regex-automata", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -1448,6 +2588,16 @@ dependencies = [ "tracing", ] +[[package]] +name = "libredox" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +dependencies = [ + "bitflags 2.9.0", + "libc", +] + [[package]] name = "linux-raw-sys" version = "0.9.3" @@ -1468,7 +2618,9 @@ dependencies = [ "async-trait", "celestia-rpc", "celestia-types", + "clap", "ed25519-consensus", + "ethers", "hex", "jsonrpsee", "jsonrpsee-core", @@ -1486,7 +2638,7 @@ dependencies = [ "tower-http", "tracing", "tracing-subscriber", - "uuid", + "uuid 1.16.0", ] [[package]] @@ -1527,7 +2679,7 @@ dependencies = [ "quote", "regex-syntax", "rustc_version", - "syn", + "syn 2.0.100", ] [[package]] @@ -1547,6 +2699,16 @@ dependencies = [ "js-sys", ] +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest 0.10.7", +] + [[package]] name = "memchr" version = "2.7.4" @@ -1573,7 +2735,23 @@ checksum = "bf45bf44ab49be92fd1227a3be6fc6f617f1a337c06af54981048574d8783147" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", ] [[package]] @@ -1633,6 +2811,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "nmt-rs" version = "0.2.3" @@ -1655,11 +2839,30 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" + +[[package]] +name = "num-integer" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] [[package]] name = "num-traits" @@ -1670,30 +2873,127 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "openssl-probe" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "overload" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "parity-scale-codec" +version = "3.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799781ae679d79a948e13d4824a40970bfa500058d245760dd857301059810fa" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "const_format", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "rustversion", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "parking_lot" version = "0.12.3" @@ -1717,6 +3017,17 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "paste" version = "1.0.15" @@ -1724,19 +3035,108 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] -name = "percent-encoding" -version = "2.3.1" +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", + "hmac", + "password-hash", + "sha2 0.10.8", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.100", +] [[package]] -name = "petgraph" -version = "0.6.5" +name = "phf_shared" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "fixedbitset", - "indexmap", + "siphasher", ] [[package]] @@ -1756,7 +3156,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -1781,6 +3181,12 @@ dependencies = [ "spki", ] +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + [[package]] name = "powerfmt" version = "0.2.0" @@ -1796,6 +3202,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "prettyplease" version = "0.2.31" @@ -1803,7 +3215,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.100", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "uint", ] [[package]] @@ -1817,13 +3243,28 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags 2.9.0", + "num-traits", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_xorshift", + "regex-syntax", + "unarray", +] + [[package]] name = "prost" version = "0.13.5" @@ -1841,7 +3282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" dependencies = [ "heck", - "itertools", + "itertools 0.12.1", "log", "multimap", "once_cell", @@ -1850,7 +3291,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn", + "syn 2.0.100", "tempfile", ] @@ -1861,10 +3302,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools", + "itertools 0.12.1", "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -2004,6 +3445,35 @@ dependencies = [ "getrandom 0.3.2", ] +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "redis" version = "0.22.3" @@ -2030,7 +3500,18 @@ version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags", + "bitflags 2.9.0", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror 1.0.69", ] [[package]] @@ -2062,6 +3543,47 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-rustls 0.24.2", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.21.12", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-rustls 0.24.1", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -2072,6 +3594,21 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + [[package]] name = "ring" version = "0.17.14" @@ -2082,7 +3619,7 @@ dependencies = [ "cfg-if", "getrandom 0.2.15", "libc", - "untrusted", + "untrusted 0.9.0", "windows-sys 0.52.0", ] @@ -2095,6 +3632,28 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "route-recognizer" version = "0.3.1" @@ -2118,6 +3677,12 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + [[package]] name = "rustc_version" version = "0.4.1" @@ -2133,13 +3698,25 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" dependencies = [ - "bitflags", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.59.0", ] +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring 0.17.14", + "rustls-webpki 0.101.7", + "sct", +] + [[package]] name = "rustls" version = "0.23.36" @@ -2148,9 +3725,9 @@ checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" dependencies = [ "log", "once_cell", - "ring", + "ring 0.17.14", "rustls-pki-types", - "rustls-webpki", + "rustls-webpki 0.103.9", "subtle", "zeroize", ] @@ -2167,6 +3744,15 @@ dependencies = [ "security-framework", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "rustls-pki-types" version = "1.14.0" @@ -2182,15 +3768,15 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19787cda76408ec5404443dc8b31795c87cd8fec49762dc75fa727740d34acc1" dependencies = [ - "core-foundation", + "core-foundation 0.10.1", "core-foundation-sys", "jni", "log", "once_cell", - "rustls", + "rustls 0.23.36", "rustls-native-certs", "rustls-platform-verifier-android", - "rustls-webpki", + "rustls-webpki 0.103.9", "security-framework", "security-framework-sys", "webpki-root-certs 0.26.11", @@ -2203,15 +3789,25 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring 0.17.14", + "untrusted 0.9.0", +] + [[package]] name = "rustls-webpki" version = "0.103.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" dependencies = [ - "ring", + "ring 0.17.14", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] @@ -2226,6 +3822,15 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + [[package]] name = "same-file" version = "1.0.6" @@ -2235,6 +3840,30 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scale-info" +version = "2.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346a3b32eba2640d17a9cb5927056b08f3de90f65b72fe09402c2ad07d684d0b" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "schannel" version = "0.1.28" @@ -2250,6 +3879,28 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2 0.10.8", +] + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring 0.17.14", + "untrusted 0.9.0", +] + [[package]] name = "sec1" version = "0.7.3" @@ -2270,8 +3921,8 @@ version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" dependencies = [ - "bitflags", - "core-foundation", + "bitflags 2.9.0", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -2292,6 +3943,15 @@ name = "semver" version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +dependencies = [ + "serde", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "send_wrapper" @@ -2338,7 +3998,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -2362,7 +4022,28 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", ] [[package]] @@ -2406,6 +4087,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -2440,6 +4131,30 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + +[[package]] +name = "simple_asn1" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d585997b0ac10be3c5ee635f1bab02d512760d14b7c468801ac8a01d9ae5f1d" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror 2.0.12", + "time", +] + +[[package]] +name = "siphasher" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" + [[package]] name = "slab" version = "0.4.9" @@ -2481,7 +4196,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures", "http 1.4.0", @@ -2492,26 +4207,86 @@ dependencies = [ ] [[package]] -name = "spki" -version = "0.7.3" +name = "solang-parser" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" +dependencies = [ + "itertools 0.11.0", + "lalrpop", + "lalrpop-util", + "phf", + "thiserror 1.0.69", + "unicode-xid", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "base64ct", - "der", + "strum_macros", ] [[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" +name = "strum_macros" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.100", +] [[package]] name = "subtle" @@ -2534,6 +4309,37 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" +[[package]] +name = "svm-rs" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4" +dependencies = [ + "dirs", + "fs2", + "hex", + "once_cell", + "reqwest", + "semver", + "serde", + "serde_json", + "sha2 0.10.8", + "thiserror 1.0.69", + "url", + "zip", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.100" @@ -2545,6 +4351,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sync_wrapper" version = "1.0.2" @@ -2559,7 +4371,28 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -2626,6 +4459,17 @@ dependencies = [ "time", ] +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -2652,7 +4496,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -2663,7 +4507,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -2678,34 +4522,44 @@ dependencies = [ [[package]] name = "time" -version = "0.3.41" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinystr" version = "0.7.6" @@ -2756,7 +4610,17 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.12", + "tokio", ] [[package]] @@ -2765,7 +4629,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls", + "rustls 0.23.36", "tokio", ] @@ -2781,6 +4645,21 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "tokio-tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +dependencies = [ + "futures-util", + "log", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", + "tungstenite", + "webpki-roots", +] + [[package]] name = "tokio-util" version = "0.7.14" @@ -2795,11 +4674,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -2808,6 +4702,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -2832,7 +4728,7 @@ dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper", + "sync_wrapper 1.0.2", "tower-layer", "tower-service", ] @@ -2843,7 +4739,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags", + "bitflags 2.9.0", "bytes", "futures-core", "futures-util", @@ -2889,7 +4785,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -2902,6 +4798,16 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -2933,12 +4839,50 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 0.2.12", + "httparse", + "log", + "rand 0.8.5", + "rustls 0.21.12", + "sha1", + "thiserror 1.0.69", + "url", + "utf-8", +] + [[package]] name = "typenum" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -2963,6 +4907,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -2980,6 +4930,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf16_iter" version = "1.0.5" @@ -2992,6 +4948,22 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.15", + "serde", +] + [[package]] name = "uuid" version = "1.16.0" @@ -3092,7 +5064,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -3133,6 +5105,12 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + [[package]] name = "winapi" version = "0.3.9" @@ -3155,7 +5133,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3179,6 +5157,15 @@ dependencies = [ "windows-targets 0.42.2", ] +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -3230,6 +5217,21 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -3269,6 +5271,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -3287,6 +5295,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -3305,6 +5319,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -3335,6 +5355,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -3353,6 +5379,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -3371,6 +5403,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -3389,6 +5427,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -3410,13 +5454,23 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "wit-bindgen-rt" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags", + "bitflags 2.9.0", ] [[package]] @@ -3431,6 +5485,25 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +[[package]] +name = "ws_stream_wasm" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c173014acad22e83f16403ee360115b38846fe754e735c5d9d3803fe70c6abc" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version", + "send_wrapper 0.6.0", + "thiserror 2.0.12", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "wyz" version = "0.5.1" @@ -3440,6 +5513,12 @@ dependencies = [ "tap", ] +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + [[package]] name = "yoke" version = "0.7.5" @@ -3460,7 +5539,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", "synstructure", ] @@ -3481,7 +5560,7 @@ checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -3501,7 +5580,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", "synstructure", ] @@ -3522,7 +5601,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", ] [[package]] @@ -3544,7 +5623,27 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.100", +] + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2 0.11.0", + "sha1", + "time", + "zstd", ] [[package]] @@ -3552,3 +5651,32 @@ name = "zmij" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4de98dfa5d5b7fef4ee834d0073d560c9ca7b6c46a71d058c48db7960f8cfaf7" + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 52851b6..3f58eb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,8 @@ anyhow = "1.0.86" sha2 = { version = "0.10.8", default-features = false } tower-http = { version = "0.4", features = ["cors", "trace", "timeout"] } tower = "0.4" +ethers = "2.0" +clap = { version = "4.5.20", features = ["derive"] } [dev-dependencies] jsonrpsee-core = "0.26" diff --git a/README.md b/README.md index 91b5de8..7288283 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ cargo run - Redis running locally or reachable via `REDIS_URL` (install via your package manager or `docker run --rm -p 6379:6379 redis:7`) - curl installed (required for CLI-based integration tests; install via your package manager) - Docker (optional, only needed for `LOCALESTIA_REDIS_MODE=docker` test runs) +- Foundry (`forge`, `anvil`) for mock contract deployment and demo +- Bun (for the demo UI) ## Build @@ -29,6 +31,42 @@ cargo build --release REDIS_URL=redis://127.0.0.1:6379 LISTEN_ADDR=127.0.0.1:26658 cargo run ``` +## CLI Commands + +### Deploy the Mock Blobstream Contract + +```bash +localestia blobstream deploy \ + --eth-rpc-url http://127.0.0.1:8545 \ + --private-key 0x... +``` + +Optional: + +```bash + --chain-id 31337 +``` + +### Run the Full Demo Stack + +```bash +localestia demo --relayer-interval-ms 1000 --ui-port 3030 +``` + +This command starts Redis, Anvil, Localestia, deploys the mock contract, starts the relayer, +and serves the UI. + +It also auto-submits blobs (and generates headers) every 1500ms by default. To tune or disable: + +```bash +localestia demo --auto-blob-interval-ms 2000 +# set to 0 to disable auto-submission +localestia demo --auto-blob-interval-ms 0 +``` + +If `REDIS_URL` is not set, the demo command starts Redis via Docker. If `anvil` is not installed, +it attempts to run Anvil via Docker. + Defaults if unset: - `REDIS_URL=redis://127.0.0.1:6379` @@ -52,6 +90,36 @@ LOCALESTIA_REDIS_MODE=docker cargo test You can also use `LOCALESTIA_REDIS_MODE=auto` to prefer a local `REDIS_URL` if set and fall back to Docker when available. +### Anvil + Foundry (required for blobstream contract test) + +The blobstream contract compatibility test deploys the mock Blobstream contract to Anvil and +verifies proofs on-chain. It requires `anvil` and `forge` to be available. + +Preferred (Docker Anvil + local Foundry install): + +```bash +./scripts/setup_anvil.sh +# then export the values printed by the script +export ANVIL_RPC_URL=http://127.0.0.1:8545 +export ANVIL_PRIVATE_KEY=0x... +``` + +If Docker is not available, the script installs Foundry locally. Tests will spawn a local `anvil` +binary automatically. + +### Demo UI + +The demo command runs the UI using Bun + ElysiaJS. You can run it manually: + +```bash +cd ui +bun install +CELESTIA_HTTP_URL=http://127.0.0.1:26658 \ +ETH_RPC_URL=http://127.0.0.1:8545 \ +BLOBSTREAM_CONTRACT_ADDRESS=0x... \ +bun src/index.ts +``` + ## Supported RPC Methods Localestia implements the following JSON-RPC methods: @@ -80,6 +148,13 @@ Localestia implements the following JSON-RPC methods: | `share.GetEDS` | Gets the Extended Data Square at a height | `height: u64` | | `share.GetRange` | Gets a range of shares | `height: u64`, `start: u64`, `end: u64` | +### Blobstream Methods + +| Method | Description | Parameters | +| ------ | ----------- | ---------- | +| `blobstream.GetDataRootTupleRoot` | Computes a merkle root of data root tuples over a block range | `start: u64`, `end: u64` | +| `blobstream.GetDataRootTupleInclusionProof` | Creates an inclusion proof for a data root tuple within a range | `height: u64`, `start: u64`, `end: u64` | + ## Usage Examples ### Submit a Blob @@ -139,3 +214,45 @@ curl -X POST "http://localhost:26658" \ ## Docker Setup See the [Docker Usage Guide](DOCKER.md) for instructions on running Localestia with Docker. + +## Blobstream Mock Contract + Relayer + +Localestia ships a mock Blobstream contract and a relayer that submits data root tuple roots +to an EVM chain for local testing. + +### Deploy the Mock Contract (Foundry) + +Prerequisites: + +- Foundry installed (`forge`, `cast`) + +From the repo root: + +```bash +cd contracts +ETH_RPC_URL=http://127.0.0.1:8545 \ +ETH_PRIVATE_KEY=... \ +./scripts/deploy_mock_blobstream.sh +``` + +This script deploys and initializes the contract. It prints the deployed address; export it as: + +```bash +export BLOBSTREAM_CONTRACT_ADDRESS=0x... +``` + +### Run the Relayer + +The relayer submits one header at a time (no batching) as headers appear in Localestia. + +```bash +ETH_RPC_URL=http://127.0.0.1:8545 \ +ETH_PRIVATE_KEY=... \ +BLOBSTREAM_CONTRACT_ADDRESS=0x... \ +CELESTIA_RPC_URL=ws://127.0.0.1:26658 \ +cargo run --bin blobstream_relayer +``` + +Optional environment variables: + +- `RELAYER_POLL_MS` (default: 1000) diff --git a/contracts/cache/solidity-files-cache.json b/contracts/cache/solidity-files-cache.json new file mode 100644 index 0000000..fc68404 --- /dev/null +++ b/contracts/cache/solidity-files-cache.json @@ -0,0 +1 @@ +{"_format":"","paths":{"artifacts":"out","build_infos":"out/build-info","sources":"src","tests":"test","scripts":"script","libraries":["lib"]},"files":{"lib/DataRootTuple.sol":{"lastModificationDate":1771883590872,"contentHash":"16b4eaed7e515ec2","interfaceReprHash":null,"sourceName":"lib/DataRootTuple.sol","imports":[],"versionRequirement":"^0.8.22","artifacts":{},"seenByCompiler":true},"lib/IBlobstreamX.sol":{"lastModificationDate":1771883601263,"contentHash":"77809a6540cfd332","interfaceReprHash":null,"sourceName":"lib/IBlobstreamX.sol","imports":["lib/DataRootTuple.sol","lib/tree/binary/BinaryMerkleProof.sol"],"versionRequirement":"^0.8.19","artifacts":{"IBlobstreamX":{"0.8.24":{"default":{"path":"IBlobstreamX.sol/IBlobstreamX.json","build_id":"9b5d39574bb3a56d"}}}},"seenByCompiler":true},"lib/tree/Constants.sol":{"lastModificationDate":1771883614231,"contentHash":"331037bb4b55b9d4","interfaceReprHash":null,"sourceName":"lib/tree/Constants.sol","imports":["lib/tree/Types.sol"],"versionRequirement":"^0.8.22","artifacts":{"Constants":{"0.8.24":{"default":{"path":"Constants.sol/Constants.json","build_id":"9b5d39574bb3a56d"}}}},"seenByCompiler":true},"lib/tree/Types.sol":{"lastModificationDate":1771883609211,"contentHash":"417c0880f30caef5","interfaceReprHash":null,"sourceName":"lib/tree/Types.sol","imports":[],"versionRequirement":"^0.8.22","artifacts":{},"seenByCompiler":true},"lib/tree/Utils.sol":{"lastModificationDate":1771883632760,"contentHash":"3d3f6ff8dc040ab0","interfaceReprHash":null,"sourceName":"lib/tree/Utils.sol","imports":["lib/tree/Constants.sol","lib/tree/Types.sol"],"versionRequirement":"^0.8.22","artifacts":{},"seenByCompiler":true},"lib/tree/binary/BinaryMerkleMultiproof.sol":{"lastModificationDate":1771883640730,"contentHash":"05f688e8a68eee88","interfaceReprHash":null,"sourceName":"lib/tree/binary/BinaryMerkleMultiproof.sol","imports":[],"versionRequirement":"^0.8.22","artifacts":{},"seenByCompiler":true},"lib/tree/binary/BinaryMerkleProof.sol":{"lastModificationDate":1771883636760,"contentHash":"28cdb2024316959b","interfaceReprHash":null,"sourceName":"lib/tree/binary/BinaryMerkleProof.sol","imports":[],"versionRequirement":"^0.8.22","artifacts":{},"seenByCompiler":true},"lib/tree/binary/BinaryMerkleTree.sol":{"lastModificationDate":1771883691873,"contentHash":"0f924e5016086951","interfaceReprHash":null,"sourceName":"lib/tree/binary/BinaryMerkleTree.sol","imports":["lib/tree/Constants.sol","lib/tree/Types.sol","lib/tree/Utils.sol","lib/tree/binary/BinaryMerkleMultiproof.sol","lib/tree/binary/BinaryMerkleProof.sol","lib/tree/binary/TreeHasher.sol"],"versionRequirement":"^0.8.22","artifacts":{"BinaryMerkleTree":{"0.8.24":{"default":{"path":"BinaryMerkleTree.sol/BinaryMerkleTree.json","build_id":"9b5d39574bb3a56d"}}}},"seenByCompiler":true},"lib/tree/binary/TreeHasher.sol":{"lastModificationDate":1771883648255,"contentHash":"763c140d1238ed8d","interfaceReprHash":null,"sourceName":"lib/tree/binary/TreeHasher.sol","imports":["lib/tree/Constants.sol","lib/tree/Types.sol"],"versionRequirement":"^0.8.22","artifacts":{},"seenByCompiler":true},"src/MockBlobstream.sol":{"lastModificationDate":1771883583504,"contentHash":"22df1171844ff51f","interfaceReprHash":null,"sourceName":"src/MockBlobstream.sol","imports":["lib/DataRootTuple.sol","lib/IBlobstreamX.sol","lib/tree/Constants.sol","lib/tree/Types.sol","lib/tree/Utils.sol","lib/tree/binary/BinaryMerkleMultiproof.sol","lib/tree/binary/BinaryMerkleProof.sol","lib/tree/binary/BinaryMerkleTree.sol","lib/tree/binary/TreeHasher.sol"],"versionRequirement":"^0.8.19","artifacts":{"Mockstream":{"0.8.24":{"default":{"path":"MockBlobstream.sol/Mockstream.json","build_id":"9b5d39574bb3a56d"}}}},"seenByCompiler":true}},"builds":["9b5d39574bb3a56d"],"profiles":{"default":{"solc":{"optimizer":{"enabled":false,"runs":200},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"outputSelection":{"*":{"*":["abi","evm.bytecode.object","evm.bytecode.sourceMap","evm.bytecode.linkReferences","evm.deployedBytecode.object","evm.deployedBytecode.sourceMap","evm.deployedBytecode.linkReferences","evm.deployedBytecode.immutableReferences","evm.methodIdentifiers","metadata"]}},"evmVersion":"prague","viaIR":false,"libraries":{}},"vyper":{"evmVersion":"prague","outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode"]}}}}},"preprocessed":false,"mocks":[]} \ No newline at end of file diff --git a/contracts/foundry.toml b/contracts/foundry.toml new file mode 100644 index 0000000..2bc70ba --- /dev/null +++ b/contracts/foundry.toml @@ -0,0 +1,4 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] diff --git a/contracts/lib/DataRootTuple.sol b/contracts/lib/DataRootTuple.sol new file mode 100644 index 0000000..cb06bb8 --- /dev/null +++ b/contracts/lib/DataRootTuple.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +/// @notice A tuple of data root with metadata. Each data root is associated +/// with a Celestia block height. +/// @dev `availableDataRoot` in +/// https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#header +struct DataRootTuple { + // Celestia block height the data root was included in. + // Genesis block is height = 0. + // First queryable block is height = 1. + uint256 height; + // Data root. + bytes32 dataRoot; +} diff --git a/contracts/lib/IBlobstreamX.sol b/contracts/lib/IBlobstreamX.sol new file mode 100644 index 0000000..074aab6 --- /dev/null +++ b/contracts/lib/IBlobstreamX.sol @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import "./DataRootTuple.sol"; +import "./tree/binary/BinaryMerkleProof.sol"; + +interface IBlobstreamX { + /// @notice Contract is frozen. + error ContractFrozen(); + + /// @notice Data commitment stored for the block range [startBlock, endBlock) with proof nonce. + /// @param proofNonce The nonce of the proof. + /// @param startBlock The start block of the block range. + /// @param endBlock The end block of the block range. + /// @param dataCommitment The data commitment for the block range. + event DataCommitmentStored( + uint256 proofNonce, + uint64 indexed startBlock, + uint64 indexed endBlock, + bytes32 indexed dataCommitment + ); + + /// @dev Latest height published to the BlobstreamX contract. + function latestBlock() external view returns (uint64); + + /// @dev Nonce for proof events. Must be incremented sequentially. + function state_proofNonce() external view returns (uint256); + + /// @dev Is the BlobstreamX contract forzen or not. + function frozen() external view returns (bool); + + /// @dev fetches data commitment from BlobstreamX state. + function state_dataCommitments(uint256) external view returns (bytes32); + + /// @notice Verify a Data Availability attestation. + /// @param _tupleRootNonce Nonce of the tuple root to prove against. + /// @param _tuple Data root tuple to prove inclusion of. + /// @param _proof Binary Merkle tree proof that `tuple` is in the root at `_tupleRootNonce`. + /// @return `true` is proof is valid, `false` otherwise. + function verifyAttestation( + uint256 _tupleRootNonce, + DataRootTuple memory _tuple, + BinaryMerkleProof memory _proof + ) external view returns (bool); +} diff --git a/contracts/lib/tree/Constants.sol b/contracts/lib/tree/Constants.sol new file mode 100644 index 0000000..d7aa2ed --- /dev/null +++ b/contracts/lib/tree/Constants.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +import "./Types.sol"; + +library Constants { + /////////////// + // Constants // + /////////////// + + /// @dev Maximum tree height + uint256 internal constant MAX_HEIGHT = 256; + + /// @dev The prefixes of leaves and nodes + bytes1 internal constant LEAF_PREFIX = 0x00; + bytes1 internal constant NODE_PREFIX = 0x01; +} + +/// @dev Parity share namespace. +/// utility function to provide the parity share namespace as a Namespace struct. +function PARITY_SHARE_NAMESPACE() pure returns (Namespace memory) { + return Namespace(0xFF, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); +} diff --git a/contracts/lib/tree/Types.sol b/contracts/lib/tree/Types.sol new file mode 100644 index 0000000..bff9eb8 --- /dev/null +++ b/contracts/lib/tree/Types.sol @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +/// @notice A representation of the Celestia-app namespace ID and its version. +/// See: https://celestiaorg.github.io/celestia-app/specs/namespace.html +struct Namespace { + // The namespace version. + bytes1 version; + // The namespace ID. + bytes28 id; +} + +using {equalTo, lessThan, greaterThan, toBytes} for Namespace global; + +function equalTo(Namespace memory l, Namespace memory r) pure returns (bool) { + return l.toBytes() == r.toBytes(); +} + +function lessThan(Namespace memory l, Namespace memory r) pure returns (bool) { + return l.toBytes() < r.toBytes(); +} + +function greaterThan(Namespace memory l, Namespace memory r) pure returns (bool) { + return l.toBytes() > r.toBytes(); +} + +function toBytes(Namespace memory n) pure returns (bytes29) { + return bytes29(abi.encodePacked(n.version, n.id)); +} + +function toNamespace(bytes29 n) pure returns (Namespace memory) { + bytes memory id = new bytes(28); + for (uint256 i = 1; i < 29; i++) { + id[i - 1] = n[i]; + } + return Namespace(n[0], bytes28(id)); +} diff --git a/contracts/lib/tree/Utils.sol b/contracts/lib/tree/Utils.sol new file mode 100644 index 0000000..b95677b --- /dev/null +++ b/contracts/lib/tree/Utils.sol @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +import "./Constants.sol"; + +/// @notice Calculate the starting bit of the path to a leaf +/// @param numLeaves : The total number of leaves in the tree +/// @return startingBit : The starting bit of the path +// solhint-disable-next-line func-visibility +function getStartingBit(uint256 numLeaves) pure returns (uint256 startingBit) { + // Determine height of the left subtree. This is the maximum path length, so all paths start at this offset from the right-most bit + startingBit = 0; + while ((1 << startingBit) < numLeaves) { + startingBit += 1; + } + return Constants.MAX_HEIGHT - startingBit; +} + +/// @notice Calculate the length of the path to a leaf +/// @param key: The key of the leaf +/// @param numLeaves: The total number of leaves in the tree +/// @return pathLength : The length of the path to the leaf +// solhint-disable-next-line func-visibility +function pathLengthFromKey(uint256 key, uint256 numLeaves) pure returns (uint256 pathLength) { + if (numLeaves <= 1) { + // if the number of leaves of the tree is 1 or 0, the path always is 0. + return 0; + } + // Get the height of the left subtree. This is equal to the offset of the starting bit of the path + pathLength = Constants.MAX_HEIGHT - getStartingBit(numLeaves); + + // Determine the number of leaves in the left subtree + uint256 numLeavesLeftSubTree = (1 << (pathLength - 1)); + + // If leaf is in left subtree, path length is full height of left subtree + if (key <= numLeavesLeftSubTree - 1) { + return pathLength; + } + // If left sub tree has only one leaf but key is not there, path has one additional step + else if (numLeavesLeftSubTree == 1) { + return 1; + } + // Otherwise, add 1 to height and recurse into right subtree + else { + return 1 + pathLengthFromKey(key - numLeavesLeftSubTree, numLeaves - numLeavesLeftSubTree); + } +} + +/// @notice Returns the minimum number of bits required to represent `x`; the +/// result is 0 for `x` == 0. +/// @param x Number. +function _bitsLen(uint256 x) pure returns (uint256) { + uint256 count = 0; + + while (x != 0) { + count++; + x >>= 1; + } + + return count; +} + +/// @notice Returns the largest power of 2 less than `x`. +/// @param x Number. +function _getSplitPoint(uint256 x) pure returns (uint256) { + // Note: since `x` is always an unsigned int * 2, the only way for this + // to be violated is if the input == 0. Since the input is the end + // index exclusive, an input of 0 is guaranteed to be invalid (it would + // be a proof of inclusion of nothing, which is vacuous). + require(x >= 1); + + uint256 bitLen = _bitsLen(x); + uint256 k = 1 << (bitLen - 1); + if (k == x) { + k >>= 1; + } + return k; +} + +/// @notice Returns the size of the subtree adjacent to `begin` that does +/// not overlap `end`. +/// @param begin Begin index, inclusive. +/// @param end End index, exclusive. +function _nextSubtreeSize(uint256 begin, uint256 end) pure returns (uint256) { + uint256 ideal = _bitsTrailingZeroes(begin); + uint256 max = _bitsLen(end - begin) - 1; + if (ideal > max) { + return 1 << max; + } + return 1 << ideal; +} + +/// @notice Returns the number of trailing zero bits in `x`; the result is +/// 256 for `x` == 0. +/// @param x Number. +function _bitsTrailingZeroes(uint256 x) pure returns (uint256) { + uint256 mask = 1; + uint256 count = 0; + + while (x != 0 && mask & x == 0) { + count++; + x >>= 1; + } + + return count; +} diff --git a/contracts/lib/tree/binary/BinaryMerkleMultiproof.sol b/contracts/lib/tree/binary/BinaryMerkleMultiproof.sol new file mode 100644 index 0000000..105e41d --- /dev/null +++ b/contracts/lib/tree/binary/BinaryMerkleMultiproof.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +/// @notice Merkle Tree Proof structure. +struct BinaryMerkleMultiproof { + // List of side nodes to verify and calculate tree. + bytes32[] sideNodes; + // The (included) beginning key of the leaves to verify. + uint256 beginKey; + // The (excluded) ending key of the leaves to verify. + uint256 endKey; +} diff --git a/contracts/lib/tree/binary/BinaryMerkleProof.sol b/contracts/lib/tree/binary/BinaryMerkleProof.sol new file mode 100644 index 0000000..a7354ba --- /dev/null +++ b/contracts/lib/tree/binary/BinaryMerkleProof.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +/// @notice Merkle Tree Proof structure. +struct BinaryMerkleProof { + // List of side nodes to verify and calculate tree. + bytes32[] sideNodes; + // The key of the leaf to verify. + uint256 key; + // The number of leaves in the tree + uint256 numLeaves; +} diff --git a/contracts/lib/tree/binary/BinaryMerkleTree.sol b/contracts/lib/tree/binary/BinaryMerkleTree.sol new file mode 100644 index 0000000..fe2770a --- /dev/null +++ b/contracts/lib/tree/binary/BinaryMerkleTree.sol @@ -0,0 +1,256 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +import "../Constants.sol"; +import "../Utils.sol"; +import "./TreeHasher.sol"; +import "./BinaryMerkleProof.sol"; +import "./BinaryMerkleMultiproof.sol"; + +/// @title Binary Merkle Tree. +library BinaryMerkleTree { + ///////////////// + // Error codes // + ///////////////// + + enum ErrorCodes { + NoError, + /// @notice The provided side nodes count is invalid for the proof. + InvalidNumberOfSideNodes, + /// @notice The provided proof key is not part of the tree. + KeyNotInTree, + /// @notice Invalid number of leaves in proof. + InvalidNumberOfLeavesInProof, + /// @notice The proof contains unexpected side nodes. + UnexpectedInnerHashes, + /// @notice The proof verification expected at least one inner hash. + ExpectedAtLeastOneInnerHash + } + + /////////////// + // Functions // + /////////////// + + /// @notice Verify if element exists in Merkle tree, given data, proof, and root. + /// @param root The root of the tree in which to verify the given leaf. + /// @param proof Binary Merkle proof for the leaf. + /// @param data The data of the leaf to verify. + /// @return `true` if proof is valid, `false` otherwise. + /// @dev proof.numLeaves is necessary to determine height of subtree containing the data to prove. + function verify(bytes32 root, BinaryMerkleProof memory proof, bytes memory data) + internal + pure + returns (bool, ErrorCodes) + { + // Check proof is correct length for the key it is proving + if (proof.numLeaves <= 1) { + if (proof.sideNodes.length != 0) { + return (false, ErrorCodes.InvalidNumberOfSideNodes); + } + } else if (proof.sideNodes.length != pathLengthFromKey(proof.key, proof.numLeaves)) { + return (false, ErrorCodes.InvalidNumberOfSideNodes); + } + + // Check key is in tree + if (proof.key >= proof.numLeaves) { + return (false, ErrorCodes.KeyNotInTree); + } + + // A sibling at height 1 is created by getting the hash of the data to prove. + bytes32 digest = leafDigest(data); + + // Null proof is only valid if numLeaves = 1 + // If so, just verify hash(data) is root + if (proof.sideNodes.length == 0) { + if (proof.numLeaves == 1) { + return (root == digest, ErrorCodes.NoError); + } else { + return (false, ErrorCodes.NoError); + } + } + + (bytes32 computedHash, ErrorCodes error) = computeRootHash(proof.key, proof.numLeaves, digest, proof.sideNodes); + + if (error != ErrorCodes.NoError) { + return (false, error); + } + + return (computedHash == root, ErrorCodes.NoError); + } + + function verifyMulti(bytes32 root, BinaryMerkleMultiproof memory proof, bytes[] memory data) + internal + pure + returns (bool) + { + bytes32[] memory nodes = new bytes32[](data.length); + for (uint256 i = 0; i < data.length; i++) { + nodes[i] = leafDigest(data[i]); + } + + return verifyMultiHashes(root, proof, nodes); + } + + function verifyMultiHashes(bytes32 root, BinaryMerkleMultiproof memory proof, bytes32[] memory leafNodes) + internal + pure + returns (bool) + { + uint256 leafIndex = 0; + bytes32[] memory leftSubtrees = new bytes32[](proof.sideNodes.length); + + for (uint256 i = 0; leafIndex != proof.beginKey && i < proof.sideNodes.length; ++i) { + uint256 subtreeSize = _nextSubtreeSize(leafIndex, proof.beginKey); + leftSubtrees[i] = proof.sideNodes[i]; + leafIndex += subtreeSize; + } + + uint256 proofRangeSubtreeEstimate = _getSplitPoint(proof.endKey) * 2; + if (proofRangeSubtreeEstimate < 1) { + proofRangeSubtreeEstimate = 1; + } + + (bytes32 rootHash, uint256 proofHead,,) = + _computeRootMulti(proof, leafNodes, 0, proofRangeSubtreeEstimate, 0, 0); + for (uint256 i = proofHead; i < proof.sideNodes.length; ++i) { + rootHash = nodeDigest(rootHash, proof.sideNodes[i]); + } + + return (rootHash == root); + } + + function _computeRootMulti( + BinaryMerkleMultiproof memory proof, + bytes32[] memory leafNodes, + uint256 begin, + uint256 end, + uint256 headProof, + uint256 headLeaves + ) private pure returns (bytes32, uint256, uint256, bool) { + // reached a leaf + if (end - begin == 1) { + // if current range overlaps with proof range, pop and return a leaf + if (proof.beginKey <= begin && begin < proof.endKey) { + // Note: second return value is guaranteed to be `false` by + // construction. + return _popLeavesIfNonEmpty(leafNodes, headLeaves, leafNodes.length, headProof); + } + + // if current range does not overlap with proof range, + // pop and return a proof node (leaf) if present, + // else return nil because leaf doesn't exist + return _popProofIfNonEmpty(proof.sideNodes, headProof, end, headLeaves); + } + + // if current range does not overlap with proof range, + // pop and return a proof node if present, + // else return nil because subtree doesn't exist + if (end <= proof.beginKey || begin >= proof.endKey) { + return _popProofIfNonEmpty(proof.sideNodes, headProof, end, headLeaves); + } + + // Recursively get left and right subtree + uint256 k = _getSplitPoint(end - begin); + (bytes32 left, uint256 newHeadProofLeft, uint256 newHeadLeavesLeft,) = + _computeRootMulti(proof, leafNodes, begin, begin + k, headProof, headLeaves); + (bytes32 right, uint256 newHeadProof, uint256 newHeadLeaves, bool rightIsNil) = + _computeRootMulti(proof, leafNodes, begin + k, end, newHeadProofLeft, newHeadLeavesLeft); + + // only right leaf/subtree can be non-existent + if (rightIsNil == true) { + return (left, newHeadProof, newHeadLeaves, false); + } + bytes32 hash = nodeDigest(left, right); + return (hash, newHeadProof, newHeadLeaves, false); + } + + function _popProofIfNonEmpty(bytes32[] memory nodes, uint256 headProof, uint256 end, uint256 headLeaves) + private + pure + returns (bytes32, uint256, uint256, bool) + { + (bytes32 node, uint256 newHead, bool isNil) = _popIfNonEmpty(nodes, headProof, end); + return (node, newHead, headLeaves, isNil); + } + + function _popLeavesIfNonEmpty(bytes32[] memory nodes, uint256 headLeaves, uint256 end, uint256 headProof) + private + pure + returns (bytes32, uint256, uint256, bool) + { + (bytes32 node, uint256 newHead, bool isNil) = _popIfNonEmpty(nodes, headLeaves, end); + return (node, headProof, newHead, isNil); + } + + function _popIfNonEmpty(bytes32[] memory nodes, uint256 head, uint256 end) + private + pure + returns (bytes32, uint256, bool) + { + if (nodes.length == 0 || head >= nodes.length || head >= end) { + bytes32 node; + return (node, head, true); + } + return (nodes[head], head + 1, false); + } + + /// @notice Use the leafHash and innerHashes to get the root merkle hash. + /// If the length of the innerHashes slice isn't exactly correct, the result is nil. + /// Recursive impl. + function computeRootHash(uint256 key, uint256 numLeaves, bytes32 leafHash, bytes32[] memory sideNodes) + private + pure + returns (bytes32, ErrorCodes) + { + if (numLeaves == 0) { + return (leafHash, ErrorCodes.InvalidNumberOfLeavesInProof); + } + if (numLeaves == 1) { + if (sideNodes.length != 0) { + return (leafHash, ErrorCodes.UnexpectedInnerHashes); + } + return (leafHash, ErrorCodes.NoError); + } + if (sideNodes.length == 0) { + return (leafHash, ErrorCodes.ExpectedAtLeastOneInnerHash); + } + uint256 numLeft = _getSplitPoint(numLeaves); + bytes32[] memory sideNodesLeft = slice(sideNodes, 0, sideNodes.length - 1); + ErrorCodes error; + if (key < numLeft) { + bytes32 leftHash; + (leftHash, error) = computeRootHash(key, numLeft, leafHash, sideNodesLeft); + if (error != ErrorCodes.NoError) { + return (leafHash, error); + } + return (nodeDigest(leftHash, sideNodes[sideNodes.length - 1]), ErrorCodes.NoError); + } + bytes32 rightHash; + (rightHash, error) = computeRootHash(key - numLeft, numLeaves - numLeft, leafHash, sideNodesLeft); + if (error != ErrorCodes.NoError) { + return (leafHash, error); + } + return (nodeDigest(sideNodes[sideNodes.length - 1], rightHash), ErrorCodes.NoError); + } + + /// @notice creates a slice of bytes32 from the data slice of bytes32 containing the elements + /// that correspond to the provided range. + /// It selects a half-open range which includes the begin element, but excludes the end one. + /// @param _data The slice that we want to select data from. + /// @param _begin The beginning of the range (inclusive). + /// @param _end The ending of the range (exclusive). + /// @return _ the sliced data. + function slice(bytes32[] memory _data, uint256 _begin, uint256 _end) internal pure returns (bytes32[] memory) { + if (_begin > _end) { + revert("Invalid range: _begin is greater than _end"); + } + if (_begin > _data.length || _end > _data.length) { + revert("Invalid range: _begin or _end are out of bounds"); + } + bytes32[] memory out = new bytes32[](_end - _begin); + for (uint256 i = _begin; i < _end; i++) { + out[i - _begin] = _data[i]; + } + return out; + } +} diff --git a/contracts/lib/tree/binary/TreeHasher.sol b/contracts/lib/tree/binary/TreeHasher.sol new file mode 100644 index 0000000..f3ee4b3 --- /dev/null +++ b/contracts/lib/tree/binary/TreeHasher.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity ^0.8.22; + +import "../Constants.sol"; + +/// @notice Calculate the digest of a node. +/// @param left The left child. +/// @param right The right child. +/// @return digest The node digest. +/// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#binary-merkle-tree +// solhint-disable-next-line func-visibility +function nodeDigest(bytes32 left, bytes32 right) pure returns (bytes32 digest) { + digest = sha256(abi.encodePacked(Constants.NODE_PREFIX, left, right)); +} + +/// @notice Calculate the digest of a leaf. +/// @param data The data of the leaf. +/// @return digest The leaf digest. +/// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#binary-merkle-tree +// solhint-disable-next-line func-visibility +function leafDigest(bytes memory data) pure returns (bytes32 digest) { + digest = sha256(abi.encodePacked(Constants.LEAF_PREFIX, data)); +} diff --git a/contracts/out/BinaryMerkleTree.sol/BinaryMerkleTree.json b/contracts/out/BinaryMerkleTree.sol/BinaryMerkleTree.json new file mode 100644 index 0000000..3a6142c --- /dev/null +++ b/contracts/out/BinaryMerkleTree.sol/BinaryMerkleTree.json @@ -0,0 +1 @@ +{"abi":[],"bytecode":{"object":"0x6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220630337d64c2daa3c1029b1ce1637a7c5c4682113fb3115929f28d5eb7a03b1ab64736f6c63430008180033","sourceMap":"247:9787:7:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x730000000000000000000000000000000000000000301460806040525f80fdfea2646970667358221220630337d64c2daa3c1029b1ce1637a7c5c4682113fb3115929f28d5eb7a03b1ab64736f6c63430008180033","sourceMap":"247:9787:7:-:0;;;;;;;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"title\":\"Binary Merkle Tree.\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"lib/tree/binary/BinaryMerkleTree.sol\":\"BinaryMerkleTree\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@celestia/lib/=lib/\",\":tree/=lib/tree/\"]},\"sources\":{\"lib/tree/Constants.sol\":{\"keccak256\":\"0x2050b2be8a739ce250cc5cea1556936c7937915b5d7fde269dd70e8e7eb660c4\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://946ea30d1001048a800f60bb24d2ab7ecf5f92ae2abd212f3f855e37a6840ce7\",\"dweb:/ipfs/QmW2PnhAB5h2eCCM6Vafg8ZUpBttjLTbBhtXjJh3SSrYEN\"]},\"lib/tree/Types.sol\":{\"keccak256\":\"0xa47e9e20fef88264acdf1fc6bc0b3bb9f23c7022f5de8d203a1014895a606958\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://d480249b6adf8730bffcf26eed5902eb9fd1d56d11f931b35a9e19c6415b3f47\",\"dweb:/ipfs/QmPCrcMmQdNMYG232WxEg2zZRFvXQqdEZgwQNMaDJ2oNab\"]},\"lib/tree/Utils.sol\":{\"keccak256\":\"0xee3f228310a87022dbff84e35bc1c0b281fa1bb3722d3c5e43e578a76a98d234\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://f59a41b4286c04a3382345b989a4536fa41b35af8babeabd40887bdbe44c77f6\",\"dweb:/ipfs/QmQTbyLnRY977aCidNGAUQi577qf7ABXe3xoR6yYa6xcVc\"]},\"lib/tree/binary/BinaryMerkleMultiproof.sol\":{\"keccak256\":\"0xbb0e2cc90b98961f000ee8ecec9a4af22f1fbabd01fd4f6da4366261caa95bcd\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://db56e64e241915f98a47991c512d61ed13bbc444f602b3f445e8635055dcd32c\",\"dweb:/ipfs/QmQxBdpnsqXaC81QXwar8AY9XroSWL7VxLCkdc3qtPLo6J\"]},\"lib/tree/binary/BinaryMerkleProof.sol\":{\"keccak256\":\"0x9fb953284b455b544091f058fdb11ac73928093517333909c0744d9319410688\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://938230a60210345fe7cc661708c4fe0db663a5f5b5306f05fe4023b44f104b6e\",\"dweb:/ipfs/QmUvcJuDmwnbRzXX5qgV4Mckg6ujvMeo46SrTPvgpPhFSF\"]},\"lib/tree/binary/BinaryMerkleTree.sol\":{\"keccak256\":\"0x8989e192de4c02f2ff9ee986e446a8edf7756a2bae14d0e8ce757d491fd5cbe9\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://effaa37425f2867eb63d5ee32ab9225717c36225630797a57859841318fef257\",\"dweb:/ipfs/QmRBNLhYuhfrsBm8D9bBR1eRfCuZTWMy3vVKuLHPoPTwqg\"]},\"lib/tree/binary/TreeHasher.sol\":{\"keccak256\":\"0x2f16501eac14f6e2a61de29d3aa10e3aaf8e0a594fc9cf8dc2d955bb2f6d54e0\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://984a2e5d52cfdd38f2c597bddc4a2de8ad1e4dd9c81008376569a29c74fa963e\",\"dweb:/ipfs/QmaXhfHD58Jv4nSw3qw2hGwbDSPKDjFzPNYWm9Y4KWiigm\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@celestia/lib/=lib/","tree/=lib/tree/"],"optimizer":{"enabled":false,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"lib/tree/binary/BinaryMerkleTree.sol":"BinaryMerkleTree"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/tree/Constants.sol":{"keccak256":"0x2050b2be8a739ce250cc5cea1556936c7937915b5d7fde269dd70e8e7eb660c4","urls":["bzz-raw://946ea30d1001048a800f60bb24d2ab7ecf5f92ae2abd212f3f855e37a6840ce7","dweb:/ipfs/QmW2PnhAB5h2eCCM6Vafg8ZUpBttjLTbBhtXjJh3SSrYEN"],"license":"Apache-2.0"},"lib/tree/Types.sol":{"keccak256":"0xa47e9e20fef88264acdf1fc6bc0b3bb9f23c7022f5de8d203a1014895a606958","urls":["bzz-raw://d480249b6adf8730bffcf26eed5902eb9fd1d56d11f931b35a9e19c6415b3f47","dweb:/ipfs/QmPCrcMmQdNMYG232WxEg2zZRFvXQqdEZgwQNMaDJ2oNab"],"license":"Apache-2.0"},"lib/tree/Utils.sol":{"keccak256":"0xee3f228310a87022dbff84e35bc1c0b281fa1bb3722d3c5e43e578a76a98d234","urls":["bzz-raw://f59a41b4286c04a3382345b989a4536fa41b35af8babeabd40887bdbe44c77f6","dweb:/ipfs/QmQTbyLnRY977aCidNGAUQi577qf7ABXe3xoR6yYa6xcVc"],"license":"Apache-2.0"},"lib/tree/binary/BinaryMerkleMultiproof.sol":{"keccak256":"0xbb0e2cc90b98961f000ee8ecec9a4af22f1fbabd01fd4f6da4366261caa95bcd","urls":["bzz-raw://db56e64e241915f98a47991c512d61ed13bbc444f602b3f445e8635055dcd32c","dweb:/ipfs/QmQxBdpnsqXaC81QXwar8AY9XroSWL7VxLCkdc3qtPLo6J"],"license":"Apache-2.0"},"lib/tree/binary/BinaryMerkleProof.sol":{"keccak256":"0x9fb953284b455b544091f058fdb11ac73928093517333909c0744d9319410688","urls":["bzz-raw://938230a60210345fe7cc661708c4fe0db663a5f5b5306f05fe4023b44f104b6e","dweb:/ipfs/QmUvcJuDmwnbRzXX5qgV4Mckg6ujvMeo46SrTPvgpPhFSF"],"license":"Apache-2.0"},"lib/tree/binary/BinaryMerkleTree.sol":{"keccak256":"0x8989e192de4c02f2ff9ee986e446a8edf7756a2bae14d0e8ce757d491fd5cbe9","urls":["bzz-raw://effaa37425f2867eb63d5ee32ab9225717c36225630797a57859841318fef257","dweb:/ipfs/QmRBNLhYuhfrsBm8D9bBR1eRfCuZTWMy3vVKuLHPoPTwqg"],"license":"Apache-2.0"},"lib/tree/binary/TreeHasher.sol":{"keccak256":"0x2f16501eac14f6e2a61de29d3aa10e3aaf8e0a594fc9cf8dc2d955bb2f6d54e0","urls":["bzz-raw://984a2e5d52cfdd38f2c597bddc4a2de8ad1e4dd9c81008376569a29c74fa963e","dweb:/ipfs/QmaXhfHD58Jv4nSw3qw2hGwbDSPKDjFzPNYWm9Y4KWiigm"],"license":"Apache-2.0"}},"version":1},"id":7} \ No newline at end of file diff --git a/contracts/out/Constants.sol/Constants.json b/contracts/out/Constants.sol/Constants.json new file mode 100644 index 0000000..f795627 --- /dev/null +++ b/contracts/out/Constants.sol/Constants.json @@ -0,0 +1 @@ +{"abi":[],"bytecode":{"object":"0x6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea264697066735822122045d7f5b852da248d59ec758a9737fcee9dc8a2f9832a02eff220e2e01310752564736f6c63430008180033","sourceMap":"88:308:2:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x730000000000000000000000000000000000000000301460806040525f80fdfea264697066735822122045d7f5b852da248d59ec758a9737fcee9dc8a2f9832a02eff220e2e01310752564736f6c63430008180033","sourceMap":"88:308:2:-:0;;;;;;;;","linkReferences":{}},"methodIdentifiers":{},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"stateVariables\":{\"LEAF_PREFIX\":{\"details\":\"The prefixes of leaves and nodes\"},\"MAX_HEIGHT\":{\"details\":\"Maximum tree height\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"lib/tree/Constants.sol\":\"Constants\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@celestia/lib/=lib/\",\":tree/=lib/tree/\"]},\"sources\":{\"lib/tree/Constants.sol\":{\"keccak256\":\"0x2050b2be8a739ce250cc5cea1556936c7937915b5d7fde269dd70e8e7eb660c4\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://946ea30d1001048a800f60bb24d2ab7ecf5f92ae2abd212f3f855e37a6840ce7\",\"dweb:/ipfs/QmW2PnhAB5h2eCCM6Vafg8ZUpBttjLTbBhtXjJh3SSrYEN\"]},\"lib/tree/Types.sol\":{\"keccak256\":\"0xa47e9e20fef88264acdf1fc6bc0b3bb9f23c7022f5de8d203a1014895a606958\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://d480249b6adf8730bffcf26eed5902eb9fd1d56d11f931b35a9e19c6415b3f47\",\"dweb:/ipfs/QmPCrcMmQdNMYG232WxEg2zZRFvXQqdEZgwQNMaDJ2oNab\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@celestia/lib/=lib/","tree/=lib/tree/"],"optimizer":{"enabled":false,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"lib/tree/Constants.sol":"Constants"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/tree/Constants.sol":{"keccak256":"0x2050b2be8a739ce250cc5cea1556936c7937915b5d7fde269dd70e8e7eb660c4","urls":["bzz-raw://946ea30d1001048a800f60bb24d2ab7ecf5f92ae2abd212f3f855e37a6840ce7","dweb:/ipfs/QmW2PnhAB5h2eCCM6Vafg8ZUpBttjLTbBhtXjJh3SSrYEN"],"license":"Apache-2.0"},"lib/tree/Types.sol":{"keccak256":"0xa47e9e20fef88264acdf1fc6bc0b3bb9f23c7022f5de8d203a1014895a606958","urls":["bzz-raw://d480249b6adf8730bffcf26eed5902eb9fd1d56d11f931b35a9e19c6415b3f47","dweb:/ipfs/QmPCrcMmQdNMYG232WxEg2zZRFvXQqdEZgwQNMaDJ2oNab"],"license":"Apache-2.0"}},"version":1},"id":2} \ No newline at end of file diff --git a/contracts/out/IBlobstreamX.sol/IBlobstreamX.json b/contracts/out/IBlobstreamX.sol/IBlobstreamX.json new file mode 100644 index 0000000..f71d13c --- /dev/null +++ b/contracts/out/IBlobstreamX.sol/IBlobstreamX.json @@ -0,0 +1 @@ +{"abi":[{"type":"function","name":"frozen","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"latestBlock","inputs":[],"outputs":[{"name":"","type":"uint64","internalType":"uint64"}],"stateMutability":"view"},{"type":"function","name":"state_dataCommitments","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"state_proofNonce","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"verifyAttestation","inputs":[{"name":"_tupleRootNonce","type":"uint256","internalType":"uint256"},{"name":"_tuple","type":"tuple","internalType":"struct DataRootTuple","components":[{"name":"height","type":"uint256","internalType":"uint256"},{"name":"dataRoot","type":"bytes32","internalType":"bytes32"}]},{"name":"_proof","type":"tuple","internalType":"struct BinaryMerkleProof","components":[{"name":"sideNodes","type":"bytes32[]","internalType":"bytes32[]"},{"name":"key","type":"uint256","internalType":"uint256"},{"name":"numLeaves","type":"uint256","internalType":"uint256"}]}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"event","name":"DataCommitmentStored","inputs":[{"name":"proofNonce","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"startBlock","type":"uint64","indexed":true,"internalType":"uint64"},{"name":"endBlock","type":"uint64","indexed":true,"internalType":"uint64"},{"name":"dataCommitment","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"error","name":"ContractFrozen","inputs":[]}],"bytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"deployedBytecode":{"object":"0x","sourceMap":"","linkReferences":{}},"methodIdentifiers":{"frozen()":"054f7d9c","latestBlock()":"07e2da96","state_dataCommitments(uint256)":"aeeed33e","state_proofNonce()":"55ae3f22","verifyAttestation(uint256,(uint256,bytes32),(bytes32[],uint256,uint256))":"1f3302a9"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ContractFrozen\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proofNonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"startBlock\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"endBlock\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"dataCommitment\",\"type\":\"bytes32\"}],\"name\":\"DataCommitmentStored\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"frozen\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlock\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"state_dataCommitments\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_proofNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tupleRootNonce\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"dataRoot\",\"type\":\"bytes32\"}],\"internalType\":\"struct DataRootTuple\",\"name\":\"_tuple\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes32[]\",\"name\":\"sideNodes\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256\",\"name\":\"key\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numLeaves\",\"type\":\"uint256\"}],\"internalType\":\"struct BinaryMerkleProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"verifyAttestation\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"DataCommitmentStored(uint256,uint64,uint64,bytes32)\":{\"params\":{\"dataCommitment\":\"The data commitment for the block range.\",\"endBlock\":\"The end block of the block range.\",\"proofNonce\":\"The nonce of the proof.\",\"startBlock\":\"The start block of the block range.\"}}},\"kind\":\"dev\",\"methods\":{\"frozen()\":{\"details\":\"Is the BlobstreamX contract forzen or not.\"},\"latestBlock()\":{\"details\":\"Latest height published to the BlobstreamX contract.\"},\"state_dataCommitments(uint256)\":{\"details\":\"fetches data commitment from BlobstreamX state.\"},\"state_proofNonce()\":{\"details\":\"Nonce for proof events. Must be incremented sequentially.\"},\"verifyAttestation(uint256,(uint256,bytes32),(bytes32[],uint256,uint256))\":{\"params\":{\"_proof\":\"Binary Merkle tree proof that `tuple` is in the root at `_tupleRootNonce`.\",\"_tuple\":\"Data root tuple to prove inclusion of.\",\"_tupleRootNonce\":\"Nonce of the tuple root to prove against.\"},\"returns\":{\"_0\":\"`true` is proof is valid, `false` otherwise.\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"ContractFrozen()\":[{\"notice\":\"Contract is frozen.\"}]},\"events\":{\"DataCommitmentStored(uint256,uint64,uint64,bytes32)\":{\"notice\":\"Data commitment stored for the block range [startBlock, endBlock) with proof nonce.\"}},\"kind\":\"user\",\"methods\":{\"verifyAttestation(uint256,(uint256,bytes32),(bytes32[],uint256,uint256))\":{\"notice\":\"Verify a Data Availability attestation.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"lib/IBlobstreamX.sol\":\"IBlobstreamX\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@celestia/lib/=lib/\",\":tree/=lib/tree/\"]},\"sources\":{\"lib/DataRootTuple.sol\":{\"keccak256\":\"0x0526597d14a6d7f258ec48e434a9b60c9a8781764a8f23c878d49926daeb5d1c\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://06ee253f8d0f58dbe66c64cb5d2945182ba3bced088167472d8f953cec421916\",\"dweb:/ipfs/QmUF9jjr6bH3pPgjGAZqYhsUn7EevqU7kZn8RBqQ4EoU2w\"]},\"lib/IBlobstreamX.sol\":{\"keccak256\":\"0xfd584d2a72655bec197ef2de47ed5a792e6be7dc4226d57587a5b17c741a6b54\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a7d5b5f547ffef5c0d8765d7875cf1baba2e2fac1a4f86239687aa571dc9a883\",\"dweb:/ipfs/Qmc6vw7S1dP3n71qqRKeetE5j16XLii5gRdGi4DNpsfmv1\"]},\"lib/tree/binary/BinaryMerkleProof.sol\":{\"keccak256\":\"0x9fb953284b455b544091f058fdb11ac73928093517333909c0744d9319410688\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://938230a60210345fe7cc661708c4fe0db663a5f5b5306f05fe4023b44f104b6e\",\"dweb:/ipfs/QmUvcJuDmwnbRzXX5qgV4Mckg6ujvMeo46SrTPvgpPhFSF\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[{"inputs":[],"type":"error","name":"ContractFrozen"},{"inputs":[{"internalType":"uint256","name":"proofNonce","type":"uint256","indexed":false},{"internalType":"uint64","name":"startBlock","type":"uint64","indexed":true},{"internalType":"uint64","name":"endBlock","type":"uint64","indexed":true},{"internalType":"bytes32","name":"dataCommitment","type":"bytes32","indexed":true}],"type":"event","name":"DataCommitmentStored","anonymous":false},{"inputs":[],"stateMutability":"view","type":"function","name":"frozen","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"latestBlock","outputs":[{"internalType":"uint64","name":"","type":"uint64"}]},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","name":"state_dataCommitments","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"state_proofNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"uint256","name":"_tupleRootNonce","type":"uint256"},{"internalType":"struct DataRootTuple","name":"_tuple","type":"tuple","components":[{"internalType":"uint256","name":"height","type":"uint256"},{"internalType":"bytes32","name":"dataRoot","type":"bytes32"}]},{"internalType":"struct BinaryMerkleProof","name":"_proof","type":"tuple","components":[{"internalType":"bytes32[]","name":"sideNodes","type":"bytes32[]"},{"internalType":"uint256","name":"key","type":"uint256"},{"internalType":"uint256","name":"numLeaves","type":"uint256"}]}],"stateMutability":"view","type":"function","name":"verifyAttestation","outputs":[{"internalType":"bool","name":"","type":"bool"}]}],"devdoc":{"kind":"dev","methods":{"frozen()":{"details":"Is the BlobstreamX contract forzen or not."},"latestBlock()":{"details":"Latest height published to the BlobstreamX contract."},"state_dataCommitments(uint256)":{"details":"fetches data commitment from BlobstreamX state."},"state_proofNonce()":{"details":"Nonce for proof events. Must be incremented sequentially."},"verifyAttestation(uint256,(uint256,bytes32),(bytes32[],uint256,uint256))":{"params":{"_proof":"Binary Merkle tree proof that `tuple` is in the root at `_tupleRootNonce`.","_tuple":"Data root tuple to prove inclusion of.","_tupleRootNonce":"Nonce of the tuple root to prove against."},"returns":{"_0":"`true` is proof is valid, `false` otherwise."}}},"version":1},"userdoc":{"kind":"user","methods":{"verifyAttestation(uint256,(uint256,bytes32),(bytes32[],uint256,uint256))":{"notice":"Verify a Data Availability attestation."}},"version":1}},"settings":{"remappings":["@celestia/lib/=lib/","tree/=lib/tree/"],"optimizer":{"enabled":false,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"lib/IBlobstreamX.sol":"IBlobstreamX"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/DataRootTuple.sol":{"keccak256":"0x0526597d14a6d7f258ec48e434a9b60c9a8781764a8f23c878d49926daeb5d1c","urls":["bzz-raw://06ee253f8d0f58dbe66c64cb5d2945182ba3bced088167472d8f953cec421916","dweb:/ipfs/QmUF9jjr6bH3pPgjGAZqYhsUn7EevqU7kZn8RBqQ4EoU2w"],"license":"Apache-2.0"},"lib/IBlobstreamX.sol":{"keccak256":"0xfd584d2a72655bec197ef2de47ed5a792e6be7dc4226d57587a5b17c741a6b54","urls":["bzz-raw://a7d5b5f547ffef5c0d8765d7875cf1baba2e2fac1a4f86239687aa571dc9a883","dweb:/ipfs/Qmc6vw7S1dP3n71qqRKeetE5j16XLii5gRdGi4DNpsfmv1"],"license":"MIT"},"lib/tree/binary/BinaryMerkleProof.sol":{"keccak256":"0x9fb953284b455b544091f058fdb11ac73928093517333909c0744d9319410688","urls":["bzz-raw://938230a60210345fe7cc661708c4fe0db663a5f5b5306f05fe4023b44f104b6e","dweb:/ipfs/QmUvcJuDmwnbRzXX5qgV4Mckg6ujvMeo46SrTPvgpPhFSF"],"license":"Apache-2.0"}},"version":1},"id":1} \ No newline at end of file diff --git a/contracts/out/MockBlobstream.sol/Mockstream.json b/contracts/out/MockBlobstream.sol/Mockstream.json new file mode 100644 index 0000000..d39d6db --- /dev/null +++ b/contracts/out/MockBlobstream.sol/Mockstream.json @@ -0,0 +1 @@ +{"abi":[{"type":"function","name":"frozen","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"initialize","inputs":[{"name":"_latestBlock","type":"uint64","internalType":"uint64"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"latestBlock","inputs":[],"outputs":[{"name":"","type":"uint64","internalType":"uint64"}],"stateMutability":"view"},{"type":"function","name":"state_dataCommitments","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"state_proofNonce","inputs":[],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"submitDataCommitment","inputs":[{"name":"_dataCommitment","type":"bytes32","internalType":"bytes32"},{"name":"_beginBlock","type":"uint64","internalType":"uint64"},{"name":"_endBlock","type":"uint64","internalType":"uint64"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"updateFreeze","inputs":[{"name":"_freeze","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"updateGenesisState","inputs":[{"name":"_height","type":"uint64","internalType":"uint64"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"verifyAttestation","inputs":[{"name":"_proofNonce","type":"uint256","internalType":"uint256"},{"name":"_tuple","type":"tuple","internalType":"struct DataRootTuple","components":[{"name":"height","type":"uint256","internalType":"uint256"},{"name":"dataRoot","type":"bytes32","internalType":"bytes32"}]},{"name":"_proof","type":"tuple","internalType":"struct BinaryMerkleProof","components":[{"name":"sideNodes","type":"bytes32[]","internalType":"bytes32[]"},{"name":"key","type":"uint256","internalType":"uint256"},{"name":"numLeaves","type":"uint256","internalType":"uint256"}]}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"event","name":"DataCommitmentStored","inputs":[{"name":"proofNonce","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"startBlock","type":"uint64","indexed":true,"internalType":"uint64"},{"name":"endBlock","type":"uint64","indexed":true,"internalType":"uint64"},{"name":"dataCommitment","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"error","name":"ContractFrozen","inputs":[]}],"bytecode":{"object":"0x608060405234801561000f575f80fd5b506114b98061001d5f395ff3fe608060405234801561000f575f80fd5b5060043610610091575f3560e01c806382e0cf6b1161006457806382e0cf6b1461011f578063aeeed33e1461013b578063e098f57d1461016b578063eb92db2714610187578063fb0f4368146101a357610091565b8063054f7d9c1461009557806307e2da96146100b35780631f3302a9146100d157806355ae3f2214610101575b5f80fd5b61009d6101bf565b6040516100aa9190610afa565b60405180910390f35b6100bb6101d1565b6040516100c89190610b35565b60405180910390f35b6100eb60048036038101906100e69190610de7565b6101e8565b6040516100f89190610afa565b60405180910390f35b61010961029c565b6040516101169190610e62565b60405180910390f35b61013960048036038101906101349190610ea5565b6102a2565b005b61015560048036038101906101509190610ed0565b6102be565b6040516101629190610f0a565b60405180910390f35b61018560048036038101906101809190610f4d565b6102d3565b005b6101a1600480360381019061019c9190610f9d565b610406565b005b6101bd60048036038101906101b89190610f9d565b610450565b005b60035f9054906101000a900460ff1681565b5f8054906101000a900467ffffffffffffffff1681565b5f60035f9054906101000a900460ff161561022f576040517f4051e96100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f84148061023f57506001548410155b1561024c575f9050610295565b5f60025f8681526020019081526020015f205490505f61028c8285876040516020016102789190611013565b60405160208183030381529060405261047a565b50905080925050505b9392505050565b60015481565b8060035f6101000a81548160ff02191690831515021790555050565b6002602052805f5260405f205f915090505481565b8167ffffffffffffffff165f8054906101000a900467ffffffffffffffff1667ffffffffffffffff16118061031b57508067ffffffffffffffff168267ffffffffffffffff16115b1561035b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035290611086565b60405180910390fd5b8260025f60015481526020019081526020015f2081905550828167ffffffffffffffff168367ffffffffffffffff167f34dd3689f5bd77a60a3ff2e09483dcab032fa2f1fd7227af3e24bed21beab1cb6001546040516103bb9190610e62565b60405180910390a460015f8154809291906103d5906110d1565b9190505550805f806101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050565b5f60035f6101000a81548160ff021916908315150217905550805f806101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506001808190555050565b805f806101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b5f8060018460400151116104a4575f845f0151511461049f575f600191509150610587565b6104cd565b6104b68460200151856040015161058f565b845f015151146104cc575f600191509150610587565b5b83604001518460200151106104e8575f600291509150610587565b5f6104f28461062d565b90505f855f01515103610525576001856040015103610519578086145f9250925050610587565b5f809250925050610587565b5f8061053e87602001518860400151858a5f01516106a7565b915091505f600581111561055557610554611118565b5b81600581111561056857610567611118565b5b1461057b575f8194509450505050610587565b8782145f945094505050505b935093915050565b5f600182116105a0575f9050610627565b6105a98261085e565b6101006105b69190611145565b90505f6001826105c69190611145565b6001901b90506001816105d99190611145565b84116105e55750610627565b600181036105f7576001915050610627565b61061781856106069190611145565b82856106129190611145565b61058f565b60016106239190611178565b9150505b92915050565b5f60025f60f81b83604051602001610646929190611262565b6040516020818303038152906040526040516106629190611289565b602060405180830381855afa15801561067d573d5f803e3d5ffd5b5050506040513d601f19601f820116820180604052508101906106a091906112b3565b9050919050565b5f805f85036106bc5783600391509150610855565b600185036106e3575f8351146106d85783600491509150610855565b835f91509150610855565b5f8351036106f75783600591509150610855565b5f61070186610895565b90505f61071c855f600188516107179190611145565b6108dc565b90505f828910156107b5575f6107348a858a866106a7565b80935081925050505f600581111561074f5761074e611118565b5b82600581111561076257610761611118565b5b146107765787829550955050505050610855565b6107a7818860018a516107899190611145565b8151811061079a576107996112de565b5b6020026020010151610a32565b5f9550955050505050610855565b5f6107d8848b6107c59190611145565b858b6107d19190611145565b8a866106a7565b80935081925050505f60058111156107f3576107f2611118565b5b82600581111561080657610805611118565b5b1461081a5787829550955050505050610855565b61084b876001895161082c9190611145565b8151811061083d5761083c6112de565b5b602002602001015182610a32565b5f95509550505050505b94509492505050565b5f5b81816001901b1015610880576001816108799190611178565b9050610860565b8061010061088e9190611145565b9050919050565b5f60018210156108a3575f80fd5b5f6108ad83610ab0565b90505f6001826108bd9190611145565b6001901b90508381036108d257600181901c90505b8092505050919050565b606081831115610921576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109189061137b565b60405180910390fd5b83518311806109305750835182115b15610970576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096790611409565b60405180910390fd5b5f838361097d9190611145565b67ffffffffffffffff81111561099657610995610ba6565b5b6040519080825280602002602001820160405280156109c45781602001602082028036833780820191505090505b5090505f8490505b83811015610a26578581815181106109e7576109e66112de565b5b60200260200101518286836109fc9190611145565b81518110610a0d57610a0c6112de565b5b60200260200101818152505080806001019150506109cc565b50809150509392505050565b5f6002600160f81b8484604051602001610a4e93929190611447565b604051602081830303815290604052604051610a6a9190611289565b602060405180830381855afa158015610a85573d5f803e3d5ffd5b5050506040513d601f19601f82011682018060405250810190610aa891906112b3565b905092915050565b5f805f90505b5f8314610ad7578080610ac8906110d1565b915050600183901c9250610ab6565b80915050919050565b5f8115159050919050565b610af481610ae0565b82525050565b5f602082019050610b0d5f830184610aeb565b92915050565b5f67ffffffffffffffff82169050919050565b610b2f81610b13565b82525050565b5f602082019050610b485f830184610b26565b92915050565b5f604051905090565b5f80fd5b5f80fd5b5f819050919050565b610b7181610b5f565b8114610b7b575f80fd5b50565b5f81359050610b8c81610b68565b92915050565b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610bdc82610b96565b810181811067ffffffffffffffff82111715610bfb57610bfa610ba6565b5b80604052505050565b5f610c0d610b4e565b9050610c198282610bd3565b919050565b5f80fd5b5f819050919050565b610c3481610c22565b8114610c3e575f80fd5b50565b5f81359050610c4f81610c2b565b92915050565b5f60408284031215610c6a57610c69610b92565b5b610c746040610c04565b90505f610c8384828501610b7e565b5f830152506020610c9684828501610c41565b60208301525092915050565b5f80fd5b5f67ffffffffffffffff821115610cc057610cbf610ba6565b5b602082029050602081019050919050565b5f80fd5b5f610ce7610ce284610ca6565b610c04565b90508083825260208201905060208402830185811115610d0a57610d09610cd1565b5b835b81811015610d335780610d1f8882610c41565b845260208401935050602081019050610d0c565b5050509392505050565b5f82601f830112610d5157610d50610ca2565b5b8135610d61848260208601610cd5565b91505092915050565b5f60608284031215610d7f57610d7e610b92565b5b610d896060610c04565b90505f82013567ffffffffffffffff811115610da857610da7610c1e565b5b610db484828501610d3d565b5f830152506020610dc784828501610b7e565b6020830152506040610ddb84828501610b7e565b60408301525092915050565b5f805f60808486031215610dfe57610dfd610b57565b5b5f610e0b86828701610b7e565b9350506020610e1c86828701610c55565b925050606084013567ffffffffffffffff811115610e3d57610e3c610b5b565b5b610e4986828701610d6a565b9150509250925092565b610e5c81610b5f565b82525050565b5f602082019050610e755f830184610e53565b92915050565b610e8481610ae0565b8114610e8e575f80fd5b50565b5f81359050610e9f81610e7b565b92915050565b5f60208284031215610eba57610eb9610b57565b5b5f610ec784828501610e91565b91505092915050565b5f60208284031215610ee557610ee4610b57565b5b5f610ef284828501610b7e565b91505092915050565b610f0481610c22565b82525050565b5f602082019050610f1d5f830184610efb565b92915050565b610f2c81610b13565b8114610f36575f80fd5b50565b5f81359050610f4781610f23565b92915050565b5f805f60608486031215610f6457610f63610b57565b5b5f610f7186828701610c41565b9350506020610f8286828701610f39565b9250506040610f9386828701610f39565b9150509250925092565b5f60208284031215610fb257610fb1610b57565b5b5f610fbf84828501610f39565b91505092915050565b610fd181610b5f565b82525050565b610fe081610c22565b82525050565b604082015f820151610ffa5f850182610fc8565b50602082015161100d6020850182610fd7565b50505050565b5f6040820190506110265f830184610fe6565b92915050565b5f82825260208201905092915050565b7f494e56414c49442052414e4745000000000000000000000000000000000000005f82015250565b5f611070600d8361102c565b915061107b8261103c565b602082019050919050565b5f6020820190508181035f83015261109d81611064565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6110db82610b5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361110d5761110c6110a4565b5b600182019050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f61114f82610b5f565b915061115a83610b5f565b9250828203905081811115611172576111716110a4565b5b92915050565b5f61118282610b5f565b915061118d83610b5f565b92508282019050808211156111a5576111a46110a4565b5b92915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b5f819050919050565b6111f06111eb826111ab565b6111d6565b82525050565b5f81519050919050565b5f81905092915050565b5f5b8381101561122757808201518184015260208101905061120c565b5f8484015250505050565b5f61123c826111f6565b6112468185611200565b935061125681856020860161120a565b80840191505092915050565b5f61126d82856111df565b60018201915061127d8284611232565b91508190509392505050565b5f6112948284611232565b915081905092915050565b5f815190506112ad81610c2b565b92915050565b5f602082840312156112c8576112c7610b57565b5b5f6112d58482850161129f565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f496e76616c69642072616e67653a205f626567696e20697320677265617465725f8201527f207468616e205f656e6400000000000000000000000000000000000000000000602082015250565b5f611365602a8361102c565b91506113708261130b565b604082019050919050565b5f6020820190508181035f83015261139281611359565b9050919050565b7f496e76616c69642072616e67653a205f626567696e206f72205f656e642061725f8201527f65206f7574206f6620626f756e64730000000000000000000000000000000000602082015250565b5f6113f3602f8361102c565b91506113fe82611399565b604082019050919050565b5f6020820190508181035f830152611420816113e7565b9050919050565b5f819050919050565b61144161143c82610c22565b611427565b82525050565b5f61145282866111df565b6001820191506114628285611430565b6020820191506114728284611430565b60208201915081905094935050505056fea2646970667358221220cdeadca7272a9bc293d13c25b7774822288ff55ce75dfddae5307f698848109164736f6c63430008180033","sourceMap":"199:1546:9:-:0;;;;;;;;;;;;;;;;;;;","linkReferences":{}},"deployedBytecode":{"object":"0x608060405234801561000f575f80fd5b5060043610610091575f3560e01c806382e0cf6b1161006457806382e0cf6b1461011f578063aeeed33e1461013b578063e098f57d1461016b578063eb92db2714610187578063fb0f4368146101a357610091565b8063054f7d9c1461009557806307e2da96146100b35780631f3302a9146100d157806355ae3f2214610101575b5f80fd5b61009d6101bf565b6040516100aa9190610afa565b60405180910390f35b6100bb6101d1565b6040516100c89190610b35565b60405180910390f35b6100eb60048036038101906100e69190610de7565b6101e8565b6040516100f89190610afa565b60405180910390f35b61010961029c565b6040516101169190610e62565b60405180910390f35b61013960048036038101906101349190610ea5565b6102a2565b005b61015560048036038101906101509190610ed0565b6102be565b6040516101629190610f0a565b60405180910390f35b61018560048036038101906101809190610f4d565b6102d3565b005b6101a1600480360381019061019c9190610f9d565b610406565b005b6101bd60048036038101906101b89190610f9d565b610450565b005b60035f9054906101000a900460ff1681565b5f8054906101000a900467ffffffffffffffff1681565b5f60035f9054906101000a900460ff161561022f576040517f4051e96100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f84148061023f57506001548410155b1561024c575f9050610295565b5f60025f8681526020019081526020015f205490505f61028c8285876040516020016102789190611013565b60405160208183030381529060405261047a565b50905080925050505b9392505050565b60015481565b8060035f6101000a81548160ff02191690831515021790555050565b6002602052805f5260405f205f915090505481565b8167ffffffffffffffff165f8054906101000a900467ffffffffffffffff1667ffffffffffffffff16118061031b57508067ffffffffffffffff168267ffffffffffffffff16115b1561035b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161035290611086565b60405180910390fd5b8260025f60015481526020019081526020015f2081905550828167ffffffffffffffff168367ffffffffffffffff167f34dd3689f5bd77a60a3ff2e09483dcab032fa2f1fd7227af3e24bed21beab1cb6001546040516103bb9190610e62565b60405180910390a460015f8154809291906103d5906110d1565b9190505550805f806101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505050565b5f60035f6101000a81548160ff021916908315150217905550805f806101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506001808190555050565b805f806101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b5f8060018460400151116104a4575f845f0151511461049f575f600191509150610587565b6104cd565b6104b68460200151856040015161058f565b845f015151146104cc575f600191509150610587565b5b83604001518460200151106104e8575f600291509150610587565b5f6104f28461062d565b90505f855f01515103610525576001856040015103610519578086145f9250925050610587565b5f809250925050610587565b5f8061053e87602001518860400151858a5f01516106a7565b915091505f600581111561055557610554611118565b5b81600581111561056857610567611118565b5b1461057b575f8194509450505050610587565b8782145f945094505050505b935093915050565b5f600182116105a0575f9050610627565b6105a98261085e565b6101006105b69190611145565b90505f6001826105c69190611145565b6001901b90506001816105d99190611145565b84116105e55750610627565b600181036105f7576001915050610627565b61061781856106069190611145565b82856106129190611145565b61058f565b60016106239190611178565b9150505b92915050565b5f60025f60f81b83604051602001610646929190611262565b6040516020818303038152906040526040516106629190611289565b602060405180830381855afa15801561067d573d5f803e3d5ffd5b5050506040513d601f19601f820116820180604052508101906106a091906112b3565b9050919050565b5f805f85036106bc5783600391509150610855565b600185036106e3575f8351146106d85783600491509150610855565b835f91509150610855565b5f8351036106f75783600591509150610855565b5f61070186610895565b90505f61071c855f600188516107179190611145565b6108dc565b90505f828910156107b5575f6107348a858a866106a7565b80935081925050505f600581111561074f5761074e611118565b5b82600581111561076257610761611118565b5b146107765787829550955050505050610855565b6107a7818860018a516107899190611145565b8151811061079a576107996112de565b5b6020026020010151610a32565b5f9550955050505050610855565b5f6107d8848b6107c59190611145565b858b6107d19190611145565b8a866106a7565b80935081925050505f60058111156107f3576107f2611118565b5b82600581111561080657610805611118565b5b1461081a5787829550955050505050610855565b61084b876001895161082c9190611145565b8151811061083d5761083c6112de565b5b602002602001015182610a32565b5f95509550505050505b94509492505050565b5f5b81816001901b1015610880576001816108799190611178565b9050610860565b8061010061088e9190611145565b9050919050565b5f60018210156108a3575f80fd5b5f6108ad83610ab0565b90505f6001826108bd9190611145565b6001901b90508381036108d257600181901c90505b8092505050919050565b606081831115610921576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109189061137b565b60405180910390fd5b83518311806109305750835182115b15610970576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096790611409565b60405180910390fd5b5f838361097d9190611145565b67ffffffffffffffff81111561099657610995610ba6565b5b6040519080825280602002602001820160405280156109c45781602001602082028036833780820191505090505b5090505f8490505b83811015610a26578581815181106109e7576109e66112de565b5b60200260200101518286836109fc9190611145565b81518110610a0d57610a0c6112de565b5b60200260200101818152505080806001019150506109cc565b50809150509392505050565b5f6002600160f81b8484604051602001610a4e93929190611447565b604051602081830303815290604052604051610a6a9190611289565b602060405180830381855afa158015610a85573d5f803e3d5ffd5b5050506040513d601f19601f82011682018060405250810190610aa891906112b3565b905092915050565b5f805f90505b5f8314610ad7578080610ac8906110d1565b915050600183901c9250610ab6565b80915050919050565b5f8115159050919050565b610af481610ae0565b82525050565b5f602082019050610b0d5f830184610aeb565b92915050565b5f67ffffffffffffffff82169050919050565b610b2f81610b13565b82525050565b5f602082019050610b485f830184610b26565b92915050565b5f604051905090565b5f80fd5b5f80fd5b5f819050919050565b610b7181610b5f565b8114610b7b575f80fd5b50565b5f81359050610b8c81610b68565b92915050565b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b610bdc82610b96565b810181811067ffffffffffffffff82111715610bfb57610bfa610ba6565b5b80604052505050565b5f610c0d610b4e565b9050610c198282610bd3565b919050565b5f80fd5b5f819050919050565b610c3481610c22565b8114610c3e575f80fd5b50565b5f81359050610c4f81610c2b565b92915050565b5f60408284031215610c6a57610c69610b92565b5b610c746040610c04565b90505f610c8384828501610b7e565b5f830152506020610c9684828501610c41565b60208301525092915050565b5f80fd5b5f67ffffffffffffffff821115610cc057610cbf610ba6565b5b602082029050602081019050919050565b5f80fd5b5f610ce7610ce284610ca6565b610c04565b90508083825260208201905060208402830185811115610d0a57610d09610cd1565b5b835b81811015610d335780610d1f8882610c41565b845260208401935050602081019050610d0c565b5050509392505050565b5f82601f830112610d5157610d50610ca2565b5b8135610d61848260208601610cd5565b91505092915050565b5f60608284031215610d7f57610d7e610b92565b5b610d896060610c04565b90505f82013567ffffffffffffffff811115610da857610da7610c1e565b5b610db484828501610d3d565b5f830152506020610dc784828501610b7e565b6020830152506040610ddb84828501610b7e565b60408301525092915050565b5f805f60808486031215610dfe57610dfd610b57565b5b5f610e0b86828701610b7e565b9350506020610e1c86828701610c55565b925050606084013567ffffffffffffffff811115610e3d57610e3c610b5b565b5b610e4986828701610d6a565b9150509250925092565b610e5c81610b5f565b82525050565b5f602082019050610e755f830184610e53565b92915050565b610e8481610ae0565b8114610e8e575f80fd5b50565b5f81359050610e9f81610e7b565b92915050565b5f60208284031215610eba57610eb9610b57565b5b5f610ec784828501610e91565b91505092915050565b5f60208284031215610ee557610ee4610b57565b5b5f610ef284828501610b7e565b91505092915050565b610f0481610c22565b82525050565b5f602082019050610f1d5f830184610efb565b92915050565b610f2c81610b13565b8114610f36575f80fd5b50565b5f81359050610f4781610f23565b92915050565b5f805f60608486031215610f6457610f63610b57565b5b5f610f7186828701610c41565b9350506020610f8286828701610f39565b9250506040610f9386828701610f39565b9150509250925092565b5f60208284031215610fb257610fb1610b57565b5b5f610fbf84828501610f39565b91505092915050565b610fd181610b5f565b82525050565b610fe081610c22565b82525050565b604082015f820151610ffa5f850182610fc8565b50602082015161100d6020850182610fd7565b50505050565b5f6040820190506110265f830184610fe6565b92915050565b5f82825260208201905092915050565b7f494e56414c49442052414e4745000000000000000000000000000000000000005f82015250565b5f611070600d8361102c565b915061107b8261103c565b602082019050919050565b5f6020820190508181035f83015261109d81611064565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6110db82610b5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361110d5761110c6110a4565b5b600182019050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b5f61114f82610b5f565b915061115a83610b5f565b9250828203905081811115611172576111716110a4565b5b92915050565b5f61118282610b5f565b915061118d83610b5f565b92508282019050808211156111a5576111a46110a4565b5b92915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b5f819050919050565b6111f06111eb826111ab565b6111d6565b82525050565b5f81519050919050565b5f81905092915050565b5f5b8381101561122757808201518184015260208101905061120c565b5f8484015250505050565b5f61123c826111f6565b6112468185611200565b935061125681856020860161120a565b80840191505092915050565b5f61126d82856111df565b60018201915061127d8284611232565b91508190509392505050565b5f6112948284611232565b915081905092915050565b5f815190506112ad81610c2b565b92915050565b5f602082840312156112c8576112c7610b57565b5b5f6112d58482850161129f565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f496e76616c69642072616e67653a205f626567696e20697320677265617465725f8201527f207468616e205f656e6400000000000000000000000000000000000000000000602082015250565b5f611365602a8361102c565b91506113708261130b565b604082019050919050565b5f6020820190508181035f83015261139281611359565b9050919050565b7f496e76616c69642072616e67653a205f626567696e206f72205f656e642061725f8201527f65206f7574206f6620626f756e64730000000000000000000000000000000000602082015250565b5f6113f3602f8361102c565b91506113fe82611399565b604082019050919050565b5f6020820190508181035f830152611420816113e7565b9050919050565b5f819050919050565b61144161143c82610c22565b611427565b82525050565b5f61145282866111df565b6001820191506114628285611430565b6020820191506114728284611430565b60208201915081905094935050505056fea2646970667358221220cdeadca7272a9bc293d13c25b7774822288ff55ce75dfddae5307f698848109164736f6c63430008180033","sourceMap":"199:1546:9:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;371:18;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;241:25;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1214:529;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;272:31;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;549:78;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;309:56;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;730:478;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;396:147;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;633:91;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;371:18;;;;;;;;;;;;;:::o;241:25::-;;;;;;;;;;;;:::o;1214:529::-;1377:4;1397:6;;;;;;;;;;;1393:60;;;1426:16;;;;;;;;;;;;;;1393:60;1482:1;1467:11;:16;:51;;;;1502:16;;1487:11;:31;;1467:51;1463:94;;;1541:5;1534:12;;;;1463:94;1567:12;1582:21;:34;1604:11;1582:34;;;;;;;;;;;;1567:49;;1627:17;1650:57;1674:4;1680:6;1699;1688:18;;;;;;;;:::i;:::-;;;;;;;;;;;;;1650:23;:57::i;:::-;1626:81;;;1724:12;1717:19;;;;1214:529;;;;;;:::o;272:31::-;;;;:::o;549:78::-;613:7;604:6;;:16;;;;;;;;;;;;;;;;;;549:78;:::o;309:56::-;;;;;;;;;;;;;;;;;:::o;730:478::-;890:11;876:25;;:11;;;;;;;;;;:25;;;:52;;;;919:9;905:23;;:11;:23;;;876:52;872:106;;;944:23;;;;;;;;;;:::i;:::-;;;;;;;;872:106;1029:15;987:21;:39;1009:16;;987:39;;;;;;;;;;;:57;;;;1123:15;1112:9;1060:79;;1099:11;1060:79;;;1081:16;;1060:79;;;;;;:::i;:::-;;;;;;;;1150:16;;:18;;;;;;;;;:::i;:::-;;;;;;1192:9;1178:11;;:23;;;;;;;;;;;;;;;;;;730:478;;;:::o;396:147::-;465:5;456:6;;:14;;;;;;;;;;;;;;;;;;494:12;480:11;;:26;;;;;;;;;;;;;;;;;;535:1;516:16;:20;;;;396:147;:::o;633:91::-;710:7;696:11;;:21;;;;;;;;;;;;;;;;;;633:91;:::o;1384:1444:7:-;1512:4;1518:10;1634:1;1615:5;:15;;;:20;1611:326;;1681:1;1655:5;:15;;;:22;:27;1651:117;;1710:5;1717:35;1702:51;;;;;;1651:117;1611:326;;;1814:45;1832:5;:9;;;1843:5;:15;;;1814:17;:45::i;:::-;1788:5;:15;;;:22;:71;1784:153;;1883:5;1890:35;1875:51;;;;;;1784:153;1611:326;1996:5;:15;;;1983:5;:9;;;:28;1979:98;;2035:5;2042:23;2027:39;;;;;;1979:98;2173:14;2190:16;2201:4;2190:10;:16::i;:::-;2173:33;;2349:1;2323:5;:15;;;:22;:27;2319:232;;2389:1;2370:5;:15;;;:20;2366:175;;2426:6;2418:4;:14;2434:18;2410:43;;;;;;;2366:175;2500:5;2507:18;2492:34;;;;;;;2319:232;2562:20;2584:16;2604:68;2620:5;:9;;;2631:5;:15;;;2648:6;2656:5;:15;;;2604;:68::i;:::-;2561:111;;;;2696:18;2687:27;;;;;;;;:::i;:::-;;:5;:27;;;;;;;;:::i;:::-;;;2683:79;;2738:5;2745;2730:21;;;;;;;;;2683:79;2796:4;2780:12;:20;2802:18;2772:49;;;;;;;1384:1444;;;;;;;:::o;936:1011:4:-;1009:18;1052:1;1039:9;:14;1035:125;;1152:1;1145:8;;;;1035:125;1304:25;1319:9;1304:14;:25::i;:::-;245:3:2;1281:48:4;;;;:::i;:::-;1268:61;;1394:28;1445:1;1432:10;:14;;;;:::i;:::-;1426:1;:21;;1394:54;;1567:1;1544:20;:24;;;;:::i;:::-;1537:3;:31;1533:412;;1580:17;;;1533:412;1735:1;1711:20;:25;1707:238;;1755:1;1748:8;;;;;1707:238;1859:79;1883:20;1877:3;:26;;;;:::i;:::-;1917:20;1905:9;:32;;;;:::i;:::-;1859:17;:79::i;:::-;1855:1;:83;;;;:::i;:::-;1848:90;;;936:1011;;;;;:::o;868:140:8:-;921:14;952:53;340:4:2;976:21:8;;999:4;959:45;;;;;;;;;:::i;:::-;;;;;;;;;;;;;952:53;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;943:62;;868:140;;;:::o;7558:1463:7:-;7707:7;7716:10;7759:1;7746:9;:14;7742:103;;7784:8;7794:39;7776:58;;;;;;7742:103;7871:1;7858:9;:14;7854:206;;7912:1;7892:9;:16;:21;7888:111;;7941:8;7951:32;7933:51;;;;;;7888:111;8020:8;8030:18;8012:37;;;;;;7854:206;8093:1;8073:9;:16;:21;8069:109;;8118:8;8128:38;8110:57;;;;;;8069:109;8187:15;8205:25;8220:9;8205:14;:25::i;:::-;8187:43;;8240:30;8273:41;8279:9;8290:1;8312;8293:9;:16;:20;;;;:::i;:::-;8273:5;:41::i;:::-;8240:74;;8324:16;8360:7;8354:3;:13;8350:347;;;8383:16;8433:54;8449:3;8454:7;8463:8;8473:13;8433:15;:54::i;:::-;8413:74;;;;;;;;8514:18;8505:27;;;;;;;;:::i;:::-;;:5;:27;;;;;;;;:::i;:::-;;;8501:90;;8560:8;8570:5;8552:24;;;;;;;;;;8501:90;8612:53;8623:8;8633:9;8662:1;8643:9;:16;:20;;;;:::i;:::-;8633:31;;;;;;;;:::i;:::-;;;;;;;;8612:10;:53::i;:::-;8667:18;8604:82;;;;;;;;;;8350:347;8706:17;8754:76;8776:7;8770:3;:13;;;;:::i;:::-;8797:7;8785:9;:19;;;;:::i;:::-;8806:8;8816:13;8754:15;:76::i;:::-;8733:97;;;;;;;;8853:18;8844:27;;;;;;;;:::i;:::-;;:5;:27;;;;;;;;:::i;:::-;;;8840:82;;8895:8;8905:5;8887:24;;;;;;;;;;8840:82;8939:54;8950:9;8979:1;8960:9;:16;:20;;;;:::i;:::-;8950:31;;;;;;;;:::i;:::-;;;;;;;;8983:9;8939:10;:54::i;:::-;8995:18;8931:83;;;;;;;;7558:1463;;;;;;;;:::o;315:362:4:-;372:19;556:72;584:9;569:11;564:1;:16;;563:30;556:72;;;620:1;605:16;;;;;:::i;:::-;;;556:72;;;663:11;245:3:2;640:34:4;;;;:::i;:::-;633:41;;315:362;;;:::o;2318:492::-;2367:7;2680:1;2675;:6;;2667:15;;;;;;2689:14;2706:11;2715:1;2706:8;:11::i;:::-;2689:28;;2723:9;2750:1;2741:6;:10;;;;:::i;:::-;2735:1;:17;;2723:29;;2767:1;2762;:6;2758:36;;2786:1;2780:7;;;;;2758:36;2806:1;2799:8;;;;2318:492;;;:::o;9488:544:7:-;9580:16;9621:4;9612:6;:13;9608:96;;;9641:52;;;;;;;;;;:::i;:::-;;;;;;;;9608:96;9726:5;:12;9717:6;:21;:44;;;;9749:5;:12;9742:4;:19;9717:44;9713:132;;;9777:57;;;;;;;;;;:::i;:::-;;;;;;;;9713:132;9854:20;9898:6;9891:4;:13;;;;:::i;:::-;9877:28;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9854:51;;9920:9;9932:6;9920:18;;9915:91;9944:4;9940:1;:8;9915:91;;;9987:5;9993:1;9987:8;;;;;;;;:::i;:::-;;;;;;;;9969:3;9977:6;9973:1;:10;;;;:::i;:::-;9969:15;;;;;;;;:::i;:::-;;;;;;;:26;;;;;9950:3;;;;;;;9915:91;;;;10022:3;10015:10;;;9488:544;;;;;:::o;415:157:8:-;478:14;509:60;389:4:2;533:21:8;;556:4;562:5;516:52;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;509:60;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;500:69;;415:157;;;;:::o;2078:159:4:-;2121:7;2136:13;2152:1;2136:17;;2160:56;2172:1;2167;:6;2160:56;;2185:7;;;;;:::i;:::-;;;;2208:1;2202:7;;;;;2160:56;;;2229:5;2222:12;;;2078:159;;;:::o;7:90:10:-;41:7;84:5;77:13;70:21;59:32;;7:90;;;:::o;103:109::-;184:21;199:5;184:21;:::i;:::-;179:3;172:34;103:109;;:::o;218:210::-;305:4;343:2;332:9;328:18;320:26;;356:65;418:1;407:9;403:17;394:6;356:65;:::i;:::-;218:210;;;;:::o;434:101::-;470:7;510:18;503:5;499:30;488:41;;434:101;;;:::o;541:115::-;626:23;643:5;626:23;:::i;:::-;621:3;614:36;541:115;;:::o;662:218::-;753:4;791:2;780:9;776:18;768:26;;804:69;870:1;859:9;855:17;846:6;804:69;:::i;:::-;662:218;;;;:::o;886:75::-;919:6;952:2;946:9;936:19;;886:75;:::o;967:117::-;1076:1;1073;1066:12;1090:117;1199:1;1196;1189:12;1213:77;1250:7;1279:5;1268:16;;1213:77;;;:::o;1296:122::-;1369:24;1387:5;1369:24;:::i;:::-;1362:5;1359:35;1349:63;;1408:1;1405;1398:12;1349:63;1296:122;:::o;1424:139::-;1470:5;1508:6;1495:20;1486:29;;1524:33;1551:5;1524:33;:::i;:::-;1424:139;;;;:::o;1569:117::-;1678:1;1675;1668:12;1692:102;1733:6;1784:2;1780:7;1775:2;1768:5;1764:14;1760:28;1750:38;;1692:102;;;:::o;1800:180::-;1848:77;1845:1;1838:88;1945:4;1942:1;1935:15;1969:4;1966:1;1959:15;1986:281;2069:27;2091:4;2069:27;:::i;:::-;2061:6;2057:40;2199:6;2187:10;2184:22;2163:18;2151:10;2148:34;2145:62;2142:88;;;2210:18;;:::i;:::-;2142:88;2250:10;2246:2;2239:22;2029:238;1986:281;;:::o;2273:129::-;2307:6;2334:20;;:::i;:::-;2324:30;;2363:33;2391:4;2383:6;2363:33;:::i;:::-;2273:129;;;:::o;2408:117::-;2517:1;2514;2507:12;2531:77;2568:7;2597:5;2586:16;;2531:77;;;:::o;2614:122::-;2687:24;2705:5;2687:24;:::i;:::-;2680:5;2677:35;2667:63;;2726:1;2723;2716:12;2667:63;2614:122;:::o;2742:139::-;2788:5;2826:6;2813:20;2804:29;;2842:33;2869:5;2842:33;:::i;:::-;2742:139;;;;:::o;2915:583::-;2992:5;3036:4;3024:9;3019:3;3015:19;3011:30;3008:117;;;3044:79;;:::i;:::-;3008:117;3143:21;3159:4;3143:21;:::i;:::-;3134:30;;3225:1;3265:49;3310:3;3301:6;3290:9;3286:22;3265:49;:::i;:::-;3258:4;3251:5;3247:16;3240:75;3174:152;3389:2;3430:49;3475:3;3466:6;3455:9;3451:22;3430:49;:::i;:::-;3423:4;3416:5;3412:16;3405:75;3336:155;2915:583;;;;:::o;3504:117::-;3613:1;3610;3603:12;3627:311;3704:4;3794:18;3786:6;3783:30;3780:56;;;3816:18;;:::i;:::-;3780:56;3866:4;3858:6;3854:17;3846:25;;3926:4;3920;3916:15;3908:23;;3627:311;;;:::o;3944:117::-;4053:1;4050;4043:12;4084:710;4180:5;4205:81;4221:64;4278:6;4221:64;:::i;:::-;4205:81;:::i;:::-;4196:90;;4306:5;4335:6;4328:5;4321:21;4369:4;4362:5;4358:16;4351:23;;4422:4;4414:6;4410:17;4402:6;4398:30;4451:3;4443:6;4440:15;4437:122;;;4470:79;;:::i;:::-;4437:122;4585:6;4568:220;4602:6;4597:3;4594:15;4568:220;;;4677:3;4706:37;4739:3;4727:10;4706:37;:::i;:::-;4701:3;4694:50;4773:4;4768:3;4764:14;4757:21;;4644:144;4628:4;4623:3;4619:14;4612:21;;4568:220;;;4572:21;4186:608;;4084:710;;;;;:::o;4817:370::-;4888:5;4937:3;4930:4;4922:6;4918:17;4914:27;4904:122;;4945:79;;:::i;:::-;4904:122;5062:6;5049:20;5087:94;5177:3;5169:6;5162:4;5154:6;5150:17;5087:94;:::i;:::-;5078:103;;4894:293;4817:370;;;;:::o;5225:938::-;5308:5;5352:4;5340:9;5335:3;5331:19;5327:30;5324:117;;;5360:79;;:::i;:::-;5324:117;5459:21;5475:4;5459:21;:::i;:::-;5450:30;;5572:1;5561:9;5557:17;5544:31;5602:18;5594:6;5591:30;5588:117;;;5624:79;;:::i;:::-;5588:117;5744:74;5814:3;5805:6;5794:9;5790:22;5744:74;:::i;:::-;5737:4;5730:5;5726:16;5719:100;5490:340;5888:2;5929:49;5974:3;5965:6;5954:9;5950:22;5929:49;:::i;:::-;5922:4;5915:5;5911:16;5904:75;5840:150;6054:2;6095:49;6140:3;6131:6;6120:9;6116:22;6095:49;:::i;:::-;6088:4;6081:5;6077:16;6070:75;6000:156;5225:938;;;;:::o;6169:904::-;6308:6;6316;6324;6373:3;6361:9;6352:7;6348:23;6344:33;6341:120;;;6380:79;;:::i;:::-;6341:120;6500:1;6525:53;6570:7;6561:6;6550:9;6546:22;6525:53;:::i;:::-;6515:63;;6471:117;6627:2;6653:81;6726:7;6717:6;6706:9;6702:22;6653:81;:::i;:::-;6643:91;;6598:146;6811:2;6800:9;6796:18;6783:32;6842:18;6834:6;6831:30;6828:117;;;6864:79;;:::i;:::-;6828:117;6969:87;7048:7;7039:6;7028:9;7024:22;6969:87;:::i;:::-;6959:97;;6754:312;6169:904;;;;;:::o;7079:118::-;7166:24;7184:5;7166:24;:::i;:::-;7161:3;7154:37;7079:118;;:::o;7203:222::-;7296:4;7334:2;7323:9;7319:18;7311:26;;7347:71;7415:1;7404:9;7400:17;7391:6;7347:71;:::i;:::-;7203:222;;;;:::o;7431:116::-;7501:21;7516:5;7501:21;:::i;:::-;7494:5;7491:32;7481:60;;7537:1;7534;7527:12;7481:60;7431:116;:::o;7553:133::-;7596:5;7634:6;7621:20;7612:29;;7650:30;7674:5;7650:30;:::i;:::-;7553:133;;;;:::o;7692:323::-;7748:6;7797:2;7785:9;7776:7;7772:23;7768:32;7765:119;;;7803:79;;:::i;:::-;7765:119;7923:1;7948:50;7990:7;7981:6;7970:9;7966:22;7948:50;:::i;:::-;7938:60;;7894:114;7692:323;;;;:::o;8021:329::-;8080:6;8129:2;8117:9;8108:7;8104:23;8100:32;8097:119;;;8135:79;;:::i;:::-;8097:119;8255:1;8280:53;8325:7;8316:6;8305:9;8301:22;8280:53;:::i;:::-;8270:63;;8226:117;8021:329;;;;:::o;8356:118::-;8443:24;8461:5;8443:24;:::i;:::-;8438:3;8431:37;8356:118;;:::o;8480:222::-;8573:4;8611:2;8600:9;8596:18;8588:26;;8624:71;8692:1;8681:9;8677:17;8668:6;8624:71;:::i;:::-;8480:222;;;;:::o;8708:120::-;8780:23;8797:5;8780:23;:::i;:::-;8773:5;8770:34;8760:62;;8818:1;8815;8808:12;8760:62;8708:120;:::o;8834:137::-;8879:5;8917:6;8904:20;8895:29;;8933:32;8959:5;8933:32;:::i;:::-;8834:137;;;;:::o;8977:615::-;9052:6;9060;9068;9117:2;9105:9;9096:7;9092:23;9088:32;9085:119;;;9123:79;;:::i;:::-;9085:119;9243:1;9268:53;9313:7;9304:6;9293:9;9289:22;9268:53;:::i;:::-;9258:63;;9214:117;9370:2;9396:52;9440:7;9431:6;9420:9;9416:22;9396:52;:::i;:::-;9386:62;;9341:117;9497:2;9523:52;9567:7;9558:6;9547:9;9543:22;9523:52;:::i;:::-;9513:62;;9468:117;8977:615;;;;;:::o;9598:327::-;9656:6;9705:2;9693:9;9684:7;9680:23;9676:32;9673:119;;;9711:79;;:::i;:::-;9673:119;9831:1;9856:52;9900:7;9891:6;9880:9;9876:22;9856:52;:::i;:::-;9846:62;;9802:116;9598:327;;;;:::o;9931:108::-;10008:24;10026:5;10008:24;:::i;:::-;10003:3;9996:37;9931:108;;:::o;10045:::-;10122:24;10140:5;10122:24;:::i;:::-;10117:3;10110:37;10045:108;;:::o;10211:519::-;10364:4;10359:3;10355:14;10453:4;10446:5;10442:16;10436:23;10472:63;10529:4;10524:3;10520:14;10506:12;10472:63;:::i;:::-;10379:166;10631:4;10624:5;10620:16;10614:23;10650:63;10707:4;10702:3;10698:14;10684:12;10650:63;:::i;:::-;10555:168;10333:397;10211:519;;:::o;10736:334::-;10885:4;10923:2;10912:9;10908:18;10900:26;;10936:127;11060:1;11049:9;11045:17;11036:6;10936:127;:::i;:::-;10736:334;;;;:::o;11076:169::-;11160:11;11194:6;11189:3;11182:19;11234:4;11229:3;11225:14;11210:29;;11076:169;;;;:::o;11251:163::-;11391:15;11387:1;11379:6;11375:14;11368:39;11251:163;:::o;11420:366::-;11562:3;11583:67;11647:2;11642:3;11583:67;:::i;:::-;11576:74;;11659:93;11748:3;11659:93;:::i;:::-;11777:2;11772:3;11768:12;11761:19;;11420:366;;;:::o;11792:419::-;11958:4;11996:2;11985:9;11981:18;11973:26;;12045:9;12039:4;12035:20;12031:1;12020:9;12016:17;12009:47;12073:131;12199:4;12073:131;:::i;:::-;12065:139;;11792:419;;;:::o;12217:180::-;12265:77;12262:1;12255:88;12362:4;12359:1;12352:15;12386:4;12383:1;12376:15;12403:233;12442:3;12465:24;12483:5;12465:24;:::i;:::-;12456:33;;12511:66;12504:5;12501:77;12498:103;;12581:18;;:::i;:::-;12498:103;12628:1;12621:5;12617:13;12610:20;;12403:233;;;:::o;12642:180::-;12690:77;12687:1;12680:88;12787:4;12784:1;12777:15;12811:4;12808:1;12801:15;12828:194;12868:4;12888:20;12906:1;12888:20;:::i;:::-;12883:25;;12922:20;12940:1;12922:20;:::i;:::-;12917:25;;12966:1;12963;12959:9;12951:17;;12990:1;12984:4;12981:11;12978:37;;;12995:18;;:::i;:::-;12978:37;12828:194;;;;:::o;13028:191::-;13068:3;13087:20;13105:1;13087:20;:::i;:::-;13082:25;;13121:20;13139:1;13121:20;:::i;:::-;13116:25;;13164:1;13161;13157:9;13150:16;;13185:3;13182:1;13179:10;13176:36;;;13192:18;;:::i;:::-;13176:36;13028:191;;;;:::o;13225:149::-;13261:7;13301:66;13294:5;13290:78;13279:89;;13225:149;;;:::o;13380:78::-;13418:7;13447:5;13436:16;;13380:78;;;:::o;13464:153::-;13567:43;13586:23;13603:5;13586:23;:::i;:::-;13567:43;:::i;:::-;13562:3;13555:56;13464:153;;:::o;13623:98::-;13674:6;13708:5;13702:12;13692:22;;13623:98;;;:::o;13727:147::-;13828:11;13865:3;13850:18;;13727:147;;;;:::o;13880:246::-;13961:1;13971:113;13985:6;13982:1;13979:13;13971:113;;;14070:1;14065:3;14061:11;14055:18;14051:1;14046:3;14042:11;14035:39;14007:2;14004:1;14000:10;13995:15;;13971:113;;;14118:1;14109:6;14104:3;14100:16;14093:27;13942:184;13880:246;;;:::o;14132:386::-;14236:3;14264:38;14296:5;14264:38;:::i;:::-;14318:88;14399:6;14394:3;14318:88;:::i;:::-;14311:95;;14415:65;14473:6;14468:3;14461:4;14454:5;14450:16;14415:65;:::i;:::-;14505:6;14500:3;14496:16;14489:23;;14240:278;14132:386;;;;:::o;14524:407::-;14680:3;14695:73;14764:3;14755:6;14695:73;:::i;:::-;14793:1;14788:3;14784:11;14777:18;;14812:93;14901:3;14892:6;14812:93;:::i;:::-;14805:100;;14922:3;14915:10;;14524:407;;;;;:::o;14937:271::-;15067:3;15089:93;15178:3;15169:6;15089:93;:::i;:::-;15082:100;;15199:3;15192:10;;14937:271;;;;:::o;15214:143::-;15271:5;15302:6;15296:13;15287:22;;15318:33;15345:5;15318:33;:::i;:::-;15214:143;;;;:::o;15363:351::-;15433:6;15482:2;15470:9;15461:7;15457:23;15453:32;15450:119;;;15488:79;;:::i;:::-;15450:119;15608:1;15633:64;15689:7;15680:6;15669:9;15665:22;15633:64;:::i;:::-;15623:74;;15579:128;15363:351;;;;:::o;15720:180::-;15768:77;15765:1;15758:88;15865:4;15862:1;15855:15;15889:4;15886:1;15879:15;15906:229;16046:34;16042:1;16034:6;16030:14;16023:58;16115:12;16110:2;16102:6;16098:15;16091:37;15906:229;:::o;16141:366::-;16283:3;16304:67;16368:2;16363:3;16304:67;:::i;:::-;16297:74;;16380:93;16469:3;16380:93;:::i;:::-;16498:2;16493:3;16489:12;16482:19;;16141:366;;;:::o;16513:419::-;16679:4;16717:2;16706:9;16702:18;16694:26;;16766:9;16760:4;16756:20;16752:1;16741:9;16737:17;16730:47;16794:131;16920:4;16794:131;:::i;:::-;16786:139;;16513:419;;;:::o;16938:234::-;17078:34;17074:1;17066:6;17062:14;17055:58;17147:17;17142:2;17134:6;17130:15;17123:42;16938:234;:::o;17178:366::-;17320:3;17341:67;17405:2;17400:3;17341:67;:::i;:::-;17334:74;;17417:93;17506:3;17417:93;:::i;:::-;17535:2;17530:3;17526:12;17519:19;;17178:366;;;:::o;17550:419::-;17716:4;17754:2;17743:9;17739:18;17731:26;;17803:9;17797:4;17793:20;17789:1;17778:9;17774:17;17767:47;17831:131;17957:4;17831:131;:::i;:::-;17823:139;;17550:419;;;:::o;17975:79::-;18014:7;18043:5;18032:16;;17975:79;;;:::o;18060:157::-;18165:45;18185:24;18203:5;18185:24;:::i;:::-;18165:45;:::i;:::-;18160:3;18153:58;18060:157;;:::o;18223:533::-;18389:3;18404:73;18473:3;18464:6;18404:73;:::i;:::-;18502:1;18497:3;18493:11;18486:18;;18514:75;18585:3;18576:6;18514:75;:::i;:::-;18614:2;18609:3;18605:12;18598:19;;18627:75;18698:3;18689:6;18627:75;:::i;:::-;18727:2;18722:3;18718:12;18711:19;;18747:3;18740:10;;18223:533;;;;;;:::o","linkReferences":{}},"methodIdentifiers":{"frozen()":"054f7d9c","initialize(uint64)":"eb92db27","latestBlock()":"07e2da96","state_dataCommitments(uint256)":"aeeed33e","state_proofNonce()":"55ae3f22","submitDataCommitment(bytes32,uint64,uint64)":"e098f57d","updateFreeze(bool)":"82e0cf6b","updateGenesisState(uint64)":"fb0f4368","verifyAttestation(uint256,(uint256,bytes32),(bytes32[],uint256,uint256))":"1f3302a9"},"rawMetadata":"{\"compiler\":{\"version\":\"0.8.24+commit.e11b9ed9\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ContractFrozen\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proofNonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"startBlock\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"endBlock\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"dataCommitment\",\"type\":\"bytes32\"}],\"name\":\"DataCommitmentStored\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"frozen\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_latestBlock\",\"type\":\"uint64\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlock\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"state_dataCommitments\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state_proofNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_dataCommitment\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"_beginBlock\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_endBlock\",\"type\":\"uint64\"}],\"name\":\"submitDataCommitment\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_freeze\",\"type\":\"bool\"}],\"name\":\"updateFreeze\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_height\",\"type\":\"uint64\"}],\"name\":\"updateGenesisState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_proofNonce\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"height\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"dataRoot\",\"type\":\"bytes32\"}],\"internalType\":\"struct DataRootTuple\",\"name\":\"_tuple\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes32[]\",\"name\":\"sideNodes\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint256\",\"name\":\"key\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numLeaves\",\"type\":\"uint256\"}],\"internalType\":\"struct BinaryMerkleProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"verifyAttestation\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"DataCommitmentStored(uint256,uint64,uint64,bytes32)\":{\"params\":{\"dataCommitment\":\"The data commitment for the block range.\",\"endBlock\":\"The end block of the block range.\",\"proofNonce\":\"The nonce of the proof.\",\"startBlock\":\"The start block of the block range.\"}}},\"kind\":\"dev\",\"methods\":{},\"stateVariables\":{\"frozen\":{\"details\":\"Is the BlobstreamX contract forzen or not.\"},\"latestBlock\":{\"details\":\"Latest height published to the BlobstreamX contract.\"},\"state_dataCommitments\":{\"details\":\"fetches data commitment from BlobstreamX state.\"},\"state_proofNonce\":{\"details\":\"Nonce for proof events. Must be incremented sequentially.\"}},\"version\":1},\"userdoc\":{\"errors\":{\"ContractFrozen()\":[{\"notice\":\"Contract is frozen.\"}]},\"events\":{\"DataCommitmentStored(uint256,uint64,uint64,bytes32)\":{\"notice\":\"Data commitment stored for the block range [startBlock, endBlock) with proof nonce.\"}},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/MockBlobstream.sol\":\"Mockstream\"},\"evmVersion\":\"cancun\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@celestia/lib/=lib/\",\":tree/=lib/tree/\"]},\"sources\":{\"lib/DataRootTuple.sol\":{\"keccak256\":\"0x0526597d14a6d7f258ec48e434a9b60c9a8781764a8f23c878d49926daeb5d1c\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://06ee253f8d0f58dbe66c64cb5d2945182ba3bced088167472d8f953cec421916\",\"dweb:/ipfs/QmUF9jjr6bH3pPgjGAZqYhsUn7EevqU7kZn8RBqQ4EoU2w\"]},\"lib/IBlobstreamX.sol\":{\"keccak256\":\"0xfd584d2a72655bec197ef2de47ed5a792e6be7dc4226d57587a5b17c741a6b54\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a7d5b5f547ffef5c0d8765d7875cf1baba2e2fac1a4f86239687aa571dc9a883\",\"dweb:/ipfs/Qmc6vw7S1dP3n71qqRKeetE5j16XLii5gRdGi4DNpsfmv1\"]},\"lib/tree/Constants.sol\":{\"keccak256\":\"0x2050b2be8a739ce250cc5cea1556936c7937915b5d7fde269dd70e8e7eb660c4\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://946ea30d1001048a800f60bb24d2ab7ecf5f92ae2abd212f3f855e37a6840ce7\",\"dweb:/ipfs/QmW2PnhAB5h2eCCM6Vafg8ZUpBttjLTbBhtXjJh3SSrYEN\"]},\"lib/tree/Types.sol\":{\"keccak256\":\"0xa47e9e20fef88264acdf1fc6bc0b3bb9f23c7022f5de8d203a1014895a606958\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://d480249b6adf8730bffcf26eed5902eb9fd1d56d11f931b35a9e19c6415b3f47\",\"dweb:/ipfs/QmPCrcMmQdNMYG232WxEg2zZRFvXQqdEZgwQNMaDJ2oNab\"]},\"lib/tree/Utils.sol\":{\"keccak256\":\"0xee3f228310a87022dbff84e35bc1c0b281fa1bb3722d3c5e43e578a76a98d234\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://f59a41b4286c04a3382345b989a4536fa41b35af8babeabd40887bdbe44c77f6\",\"dweb:/ipfs/QmQTbyLnRY977aCidNGAUQi577qf7ABXe3xoR6yYa6xcVc\"]},\"lib/tree/binary/BinaryMerkleMultiproof.sol\":{\"keccak256\":\"0xbb0e2cc90b98961f000ee8ecec9a4af22f1fbabd01fd4f6da4366261caa95bcd\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://db56e64e241915f98a47991c512d61ed13bbc444f602b3f445e8635055dcd32c\",\"dweb:/ipfs/QmQxBdpnsqXaC81QXwar8AY9XroSWL7VxLCkdc3qtPLo6J\"]},\"lib/tree/binary/BinaryMerkleProof.sol\":{\"keccak256\":\"0x9fb953284b455b544091f058fdb11ac73928093517333909c0744d9319410688\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://938230a60210345fe7cc661708c4fe0db663a5f5b5306f05fe4023b44f104b6e\",\"dweb:/ipfs/QmUvcJuDmwnbRzXX5qgV4Mckg6ujvMeo46SrTPvgpPhFSF\"]},\"lib/tree/binary/BinaryMerkleTree.sol\":{\"keccak256\":\"0x8989e192de4c02f2ff9ee986e446a8edf7756a2bae14d0e8ce757d491fd5cbe9\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://effaa37425f2867eb63d5ee32ab9225717c36225630797a57859841318fef257\",\"dweb:/ipfs/QmRBNLhYuhfrsBm8D9bBR1eRfCuZTWMy3vVKuLHPoPTwqg\"]},\"lib/tree/binary/TreeHasher.sol\":{\"keccak256\":\"0x2f16501eac14f6e2a61de29d3aa10e3aaf8e0a594fc9cf8dc2d955bb2f6d54e0\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://984a2e5d52cfdd38f2c597bddc4a2de8ad1e4dd9c81008376569a29c74fa963e\",\"dweb:/ipfs/QmaXhfHD58Jv4nSw3qw2hGwbDSPKDjFzPNYWm9Y4KWiigm\"]},\"src/MockBlobstream.sol\":{\"keccak256\":\"0x374ff3046ddab786368c4dae6a77f15e4a82bb395ce3c325199018bb03286c03\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a9011b54035f58cee971d7ea83926035d28eb8b2803b2126eabbeb0493de3175\",\"dweb:/ipfs/QmZ9ASzhBGzpHQ3RZynt1UdwxFEoXum7miPgnq56oSU1UM\"]}},\"version\":1}","metadata":{"compiler":{"version":"0.8.24+commit.e11b9ed9"},"language":"Solidity","output":{"abi":[{"inputs":[],"type":"error","name":"ContractFrozen"},{"inputs":[{"internalType":"uint256","name":"proofNonce","type":"uint256","indexed":false},{"internalType":"uint64","name":"startBlock","type":"uint64","indexed":true},{"internalType":"uint64","name":"endBlock","type":"uint64","indexed":true},{"internalType":"bytes32","name":"dataCommitment","type":"bytes32","indexed":true}],"type":"event","name":"DataCommitmentStored","anonymous":false},{"inputs":[],"stateMutability":"view","type":"function","name":"frozen","outputs":[{"internalType":"bool","name":"","type":"bool"}]},{"inputs":[{"internalType":"uint64","name":"_latestBlock","type":"uint64"}],"stateMutability":"nonpayable","type":"function","name":"initialize"},{"inputs":[],"stateMutability":"view","type":"function","name":"latestBlock","outputs":[{"internalType":"uint64","name":"","type":"uint64"}]},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function","name":"state_dataCommitments","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}]},{"inputs":[],"stateMutability":"view","type":"function","name":"state_proofNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}]},{"inputs":[{"internalType":"bytes32","name":"_dataCommitment","type":"bytes32"},{"internalType":"uint64","name":"_beginBlock","type":"uint64"},{"internalType":"uint64","name":"_endBlock","type":"uint64"}],"stateMutability":"nonpayable","type":"function","name":"submitDataCommitment"},{"inputs":[{"internalType":"bool","name":"_freeze","type":"bool"}],"stateMutability":"nonpayable","type":"function","name":"updateFreeze"},{"inputs":[{"internalType":"uint64","name":"_height","type":"uint64"}],"stateMutability":"nonpayable","type":"function","name":"updateGenesisState"},{"inputs":[{"internalType":"uint256","name":"_proofNonce","type":"uint256"},{"internalType":"struct DataRootTuple","name":"_tuple","type":"tuple","components":[{"internalType":"uint256","name":"height","type":"uint256"},{"internalType":"bytes32","name":"dataRoot","type":"bytes32"}]},{"internalType":"struct BinaryMerkleProof","name":"_proof","type":"tuple","components":[{"internalType":"bytes32[]","name":"sideNodes","type":"bytes32[]"},{"internalType":"uint256","name":"key","type":"uint256"},{"internalType":"uint256","name":"numLeaves","type":"uint256"}]}],"stateMutability":"view","type":"function","name":"verifyAttestation","outputs":[{"internalType":"bool","name":"","type":"bool"}]}],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"remappings":["@celestia/lib/=lib/","tree/=lib/tree/"],"optimizer":{"enabled":false,"runs":200},"metadata":{"bytecodeHash":"ipfs"},"compilationTarget":{"src/MockBlobstream.sol":"Mockstream"},"evmVersion":"cancun","libraries":{}},"sources":{"lib/DataRootTuple.sol":{"keccak256":"0x0526597d14a6d7f258ec48e434a9b60c9a8781764a8f23c878d49926daeb5d1c","urls":["bzz-raw://06ee253f8d0f58dbe66c64cb5d2945182ba3bced088167472d8f953cec421916","dweb:/ipfs/QmUF9jjr6bH3pPgjGAZqYhsUn7EevqU7kZn8RBqQ4EoU2w"],"license":"Apache-2.0"},"lib/IBlobstreamX.sol":{"keccak256":"0xfd584d2a72655bec197ef2de47ed5a792e6be7dc4226d57587a5b17c741a6b54","urls":["bzz-raw://a7d5b5f547ffef5c0d8765d7875cf1baba2e2fac1a4f86239687aa571dc9a883","dweb:/ipfs/Qmc6vw7S1dP3n71qqRKeetE5j16XLii5gRdGi4DNpsfmv1"],"license":"MIT"},"lib/tree/Constants.sol":{"keccak256":"0x2050b2be8a739ce250cc5cea1556936c7937915b5d7fde269dd70e8e7eb660c4","urls":["bzz-raw://946ea30d1001048a800f60bb24d2ab7ecf5f92ae2abd212f3f855e37a6840ce7","dweb:/ipfs/QmW2PnhAB5h2eCCM6Vafg8ZUpBttjLTbBhtXjJh3SSrYEN"],"license":"Apache-2.0"},"lib/tree/Types.sol":{"keccak256":"0xa47e9e20fef88264acdf1fc6bc0b3bb9f23c7022f5de8d203a1014895a606958","urls":["bzz-raw://d480249b6adf8730bffcf26eed5902eb9fd1d56d11f931b35a9e19c6415b3f47","dweb:/ipfs/QmPCrcMmQdNMYG232WxEg2zZRFvXQqdEZgwQNMaDJ2oNab"],"license":"Apache-2.0"},"lib/tree/Utils.sol":{"keccak256":"0xee3f228310a87022dbff84e35bc1c0b281fa1bb3722d3c5e43e578a76a98d234","urls":["bzz-raw://f59a41b4286c04a3382345b989a4536fa41b35af8babeabd40887bdbe44c77f6","dweb:/ipfs/QmQTbyLnRY977aCidNGAUQi577qf7ABXe3xoR6yYa6xcVc"],"license":"Apache-2.0"},"lib/tree/binary/BinaryMerkleMultiproof.sol":{"keccak256":"0xbb0e2cc90b98961f000ee8ecec9a4af22f1fbabd01fd4f6da4366261caa95bcd","urls":["bzz-raw://db56e64e241915f98a47991c512d61ed13bbc444f602b3f445e8635055dcd32c","dweb:/ipfs/QmQxBdpnsqXaC81QXwar8AY9XroSWL7VxLCkdc3qtPLo6J"],"license":"Apache-2.0"},"lib/tree/binary/BinaryMerkleProof.sol":{"keccak256":"0x9fb953284b455b544091f058fdb11ac73928093517333909c0744d9319410688","urls":["bzz-raw://938230a60210345fe7cc661708c4fe0db663a5f5b5306f05fe4023b44f104b6e","dweb:/ipfs/QmUvcJuDmwnbRzXX5qgV4Mckg6ujvMeo46SrTPvgpPhFSF"],"license":"Apache-2.0"},"lib/tree/binary/BinaryMerkleTree.sol":{"keccak256":"0x8989e192de4c02f2ff9ee986e446a8edf7756a2bae14d0e8ce757d491fd5cbe9","urls":["bzz-raw://effaa37425f2867eb63d5ee32ab9225717c36225630797a57859841318fef257","dweb:/ipfs/QmRBNLhYuhfrsBm8D9bBR1eRfCuZTWMy3vVKuLHPoPTwqg"],"license":"Apache-2.0"},"lib/tree/binary/TreeHasher.sol":{"keccak256":"0x2f16501eac14f6e2a61de29d3aa10e3aaf8e0a594fc9cf8dc2d955bb2f6d54e0","urls":["bzz-raw://984a2e5d52cfdd38f2c597bddc4a2de8ad1e4dd9c81008376569a29c74fa963e","dweb:/ipfs/QmaXhfHD58Jv4nSw3qw2hGwbDSPKDjFzPNYWm9Y4KWiigm"],"license":"Apache-2.0"},"src/MockBlobstream.sol":{"keccak256":"0x374ff3046ddab786368c4dae6a77f15e4a82bb395ce3c325199018bb03286c03","urls":["bzz-raw://a9011b54035f58cee971d7ea83926035d28eb8b2803b2126eabbeb0493de3175","dweb:/ipfs/QmZ9ASzhBGzpHQ3RZynt1UdwxFEoXum7miPgnq56oSU1UM"],"license":"MIT"}},"version":1},"id":9} \ No newline at end of file diff --git a/contracts/out/build-info/9b5d39574bb3a56d.json b/contracts/out/build-info/9b5d39574bb3a56d.json new file mode 100644 index 0000000..0206f44 --- /dev/null +++ b/contracts/out/build-info/9b5d39574bb3a56d.json @@ -0,0 +1 @@ +{"id":"9b5d39574bb3a56d","source_id_to_path":{"0":"lib/DataRootTuple.sol","1":"lib/IBlobstreamX.sol","2":"lib/tree/Constants.sol","3":"lib/tree/Types.sol","4":"lib/tree/Utils.sol","5":"lib/tree/binary/BinaryMerkleMultiproof.sol","6":"lib/tree/binary/BinaryMerkleProof.sol","7":"lib/tree/binary/BinaryMerkleTree.sol","8":"lib/tree/binary/TreeHasher.sol","9":"src/MockBlobstream.sol"},"language":"Solidity"} \ No newline at end of file diff --git a/contracts/remappings.txt b/contracts/remappings.txt new file mode 100644 index 0000000..7c033af --- /dev/null +++ b/contracts/remappings.txt @@ -0,0 +1 @@ +@celestia/lib/=lib/ diff --git a/contracts/scripts/deploy_mock_blobstream.sh b/contracts/scripts/deploy_mock_blobstream.sh new file mode 100755 index 0000000..760f8c4 --- /dev/null +++ b/contracts/scripts/deploy_mock_blobstream.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +set -euo pipefail + +if ! command -v forge >/dev/null 2>&1; then + echo "forge is required; install Foundry first" + exit 1 +fi + +if ! command -v cast >/dev/null 2>&1; then + echo "cast is required; install Foundry first" + exit 1 +fi + +if [[ -z "${ETH_RPC_URL:-}" ]]; then + echo "ETH_RPC_URL is required" + exit 1 +fi + +if [[ -z "${ETH_PRIVATE_KEY:-}" ]]; then + echo "ETH_PRIVATE_KEY is required" + exit 1 +fi + +INITIAL_LATEST_BLOCK=${INITIAL_LATEST_BLOCK:-0} + +forge build + +OUTPUT=$(forge create --rpc-url "$ETH_RPC_URL" --private-key "$ETH_PRIVATE_KEY" --json src/MockBlobstream.sol:Mockstream) +echo "$OUTPUT" + +if command -v jq >/dev/null 2>&1; then + ADDRESS=$(echo "$OUTPUT" | jq -r '.deployedTo') + if [[ -z "$ADDRESS" || "$ADDRESS" == "null" ]]; then + echo "failed to read deployed address" + exit 1 + fi +else + echo "jq not found; install jq to auto-extract the deployed address" + exit 0 +fi + +cast send --rpc-url "$ETH_RPC_URL" --private-key "$ETH_PRIVATE_KEY" "$ADDRESS" "initialize(uint64)" "$INITIAL_LATEST_BLOCK" + +echo "Mockstream deployed at $ADDRESS" +echo "export BLOBSTREAM_CONTRACT_ADDRESS=$ADDRESS" diff --git a/contracts/src/MockBlobstream.sol b/contracts/src/MockBlobstream.sol new file mode 100644 index 0000000..3890ea8 --- /dev/null +++ b/contracts/src/MockBlobstream.sol @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.19; + +import "@celestia/lib/DataRootTuple.sol"; +import "@celestia/lib/tree/binary/BinaryMerkleTree.sol"; +import "@celestia/lib/IBlobstreamX.sol"; + +contract Mockstream is IBlobstreamX { + uint64 public latestBlock; + uint256 public state_proofNonce; + mapping(uint256 => bytes32) public state_dataCommitments; + bool public frozen; + + function initialize(uint64 _latestBlock) external { + frozen = false; + latestBlock = _latestBlock; + state_proofNonce = 1; + } + + function updateFreeze(bool _freeze) external { + frozen = _freeze; + } + + function updateGenesisState(uint64 _height) external { + latestBlock = _height; + } + + function submitDataCommitment( + bytes32 _dataCommitment, + uint64 _beginBlock, + uint64 _endBlock + ) external { + if (latestBlock > _beginBlock || _beginBlock > _endBlock) { + revert("INVALID RANGE"); + } + state_dataCommitments[state_proofNonce] = _dataCommitment; + + emit DataCommitmentStored(state_proofNonce, _beginBlock, _endBlock, _dataCommitment); + + state_proofNonce++; + latestBlock = _endBlock; + } + + function verifyAttestation( + uint256 _proofNonce, + DataRootTuple memory _tuple, + BinaryMerkleProof memory _proof + ) external view returns (bool) { + if (frozen) { + revert ContractFrozen(); + } + + if (_proofNonce == 0 || _proofNonce >= state_proofNonce) { + return false; + } + + bytes32 root = state_dataCommitments[_proofNonce]; + (bool isProofValid, ) = BinaryMerkleTree.verify(root, _proof, abi.encode(_tuple)); + return isProofValid; + } +} diff --git a/scripts/setup_anvil.sh b/scripts/setup_anvil.sh new file mode 100755 index 0000000..f7c9bde --- /dev/null +++ b/scripts/setup_anvil.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -euo pipefail + +ANVIL_PORT=${ANVIL_PORT:-8545} +ANVIL_CONTAINER_NAME=${ANVIL_CONTAINER_NAME:-localestia-anvil} +ANVIL_IMAGE=${ANVIL_IMAGE:-ghcr.io/foundry-rs/foundry:latest} +ANVIL_MNEMONIC=${ANVIL_MNEMONIC:-"test test test test test test test test test test test junk"} + +install_foundry() { + if ! command -v foundryup >/dev/null 2>&1; then + curl -L https://foundry.paradigm.xyz | bash + fi + + export PATH="$HOME/.foundry/bin:$PATH" + foundryup +} + +ensure_foundry() { + if ! command -v forge >/dev/null 2>&1; then + install_foundry + fi +} + +if command -v docker >/dev/null 2>&1; then + ensure_foundry + + docker rm -f "$ANVIL_CONTAINER_NAME" >/dev/null 2>&1 || true + docker run -d --name "$ANVIL_CONTAINER_NAME" -p "$ANVIL_PORT:8545" "$ANVIL_IMAGE" \ + anvil --host 0.0.0.0 --port 8545 -m "$ANVIL_MNEMONIC" >/dev/null + + for _ in {1..50}; do + if docker logs "$ANVIL_CONTAINER_NAME" 2>&1 | grep -q "Listening on"; then + break + fi + sleep 0.1 + done + + PRIVATE_KEY=$(docker logs "$ANVIL_CONTAINER_NAME" 2>&1 | awk '/Private Keys/{found=1;next} found && $1 ~ /^\(0\)/ {print $2; exit}') + if [[ -z "$PRIVATE_KEY" ]]; then + echo "failed to read the first Anvil private key from docker logs" + exit 1 + fi + + echo "Anvil is running in docker as $ANVIL_CONTAINER_NAME" + echo "export ANVIL_RPC_URL=http://127.0.0.1:${ANVIL_PORT}" + echo "export ANVIL_PRIVATE_KEY=$PRIVATE_KEY" + exit 0 +fi + +ensure_foundry +echo "Foundry installed. Run tests and local Anvil will be spawned automatically." diff --git a/src/bin/blobstream_relayer.rs b/src/bin/blobstream_relayer.rs new file mode 100644 index 0000000..c147912 --- /dev/null +++ b/src/bin/blobstream_relayer.rs @@ -0,0 +1,7 @@ +use anyhow::Result; +use localestia::relayer; + +#[tokio::main] +async fn main() -> Result<()> { + relayer::run_from_env().await +} diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..5970ce4 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,755 @@ +use std::env; +use std::fs; +use std::io::{BufRead, BufReader}; +use std::net::SocketAddr; +use std::path::PathBuf; +use std::process::{Child, Command, Stdio}; +use std::sync::Arc; +use std::time::{Duration, Instant}; + +use clap::{Args, Parser, Subcommand}; +use ethers::abi::Abi; +use ethers::contract::ContractFactory; +use ethers::middleware::SignerMiddleware; +use ethers::providers::{Http, Middleware, Provider}; +use ethers::signers::{LocalWallet, Signer}; +use ethers::types::Bytes; +use jsonrpsee::server::{ServerBuilder, ServerHandle}; +use rand::RngCore; +use serde::Deserialize; +use tokio::sync::watch; +use tokio::time::sleep; +use tracing::{error, info, warn}; +use uuid::Uuid; + +use crate::error::LocalError; +use localestia::relayer::{self, RelayerConfig}; +use crate::rpc::LocalestiaServer; +use crate::storage::RedisStorage; +use celestia_rpc::{BlobClient, BlobRpcServer, BlobstreamRpcServer, Client, HeaderRpcServer, ShareRpcServer, TxConfig}; +use celestia_types::nmt::Namespace; +use celestia_types::{AppVersion, Blob}; + +const DEFAULT_LISTEN_ADDR: &str = "127.0.0.1:26658"; +const DEFAULT_REDIS_URL: &str = "redis://127.0.0.1:6379"; +const DEFAULT_ANVIL_PORT: u16 = 8545; +const DEFAULT_UI_PORT: u16 = 3030; +const DEFAULT_REDIS_IMAGE: &str = "redis:7"; +const DEFAULT_ANVIL_IMAGE: &str = "ghcr.io/foundry-rs/foundry:latest"; +const DEFAULT_ANVIL_MNEMONIC: &str = "test test test test test test test test test test test junk"; + +#[derive(Parser)] +#[command(name = "localestia", version, about = "Local Celestia JSON-RPC emulator")] +struct Cli { + #[command(subcommand)] + command: Option, +} + +#[derive(Subcommand)] +enum Commands { + Blobstream { + #[command(subcommand)] + command: BlobstreamCommands, + }, + Demo(DemoArgs), +} + +#[derive(Subcommand)] +enum BlobstreamCommands { + Deploy(DeployArgs), +} + +#[derive(Args)] +struct DeployArgs { + #[arg(long)] + eth_rpc_url: String, + #[arg(long)] + private_key: String, + #[arg(long)] + chain_id: Option, +} + +#[derive(Args)] +struct DemoArgs { + #[arg(long, default_value = DEFAULT_LISTEN_ADDR)] + listen_addr: String, + #[arg(long)] + redis_url: Option, + #[arg(long, default_value_t = DEFAULT_ANVIL_PORT)] + anvil_port: u16, + #[arg(long, default_value = DEFAULT_ANVIL_MNEMONIC)] + anvil_mnemonic: String, + #[arg(long, default_value_t = DEFAULT_UI_PORT)] + ui_port: u16, + #[arg(long, default_value_t = 1000)] + relayer_interval_ms: u64, + #[arg(long, default_value_t = 1500)] + auto_blob_interval_ms: u64, +} + +#[derive(Deserialize)] +struct ForgeArtifact { + abi: serde_json::Value, + bytecode: ForgeBytecode, +} + +#[derive(Deserialize)] +struct ForgeBytecode { + object: String, +} + +pub async fn run() -> Result<(), Box> { + tracing_subscriber::fmt::init(); + + let cli = Cli::parse(); + match cli.command { + None => run_server_from_env().await, + Some(Commands::Blobstream { command: BlobstreamCommands::Deploy(args) }) => { + deploy_command(args).await + } + Some(Commands::Demo(args)) => run_demo(args).await, + } +} + +async fn run_server_from_env() -> Result<(), Box> { + let redis_url = env::var("REDIS_URL").unwrap_or_else(|_| DEFAULT_REDIS_URL.to_string()); + let listen_addr = env::var("LISTEN_ADDR").unwrap_or_else(|_| DEFAULT_LISTEN_ADDR.to_string()); + let server_handle = start_rpc_server(&redis_url, &listen_addr).await?; + + info!("Server started successfully"); + info!("The server is ready to accept RPC calls at ws://{listen_addr}"); + info!("Connect using: celestia-rpc::Client::new(\"ws://{listen_addr}\", None)"); + + match tokio::signal::ctrl_c().await { + Ok(_) => info!("Received shutdown signal"), + Err(e) => error!("Failed to listen for ctrl-c: {e}"), + } + + info!("Shutting down server..."); + if let Err(e) = server_handle.stop() { + error!("Error stopping server: {e}"); + } + + info!("Server shutdown complete"); + Ok(()) +} + +async fn deploy_command(args: DeployArgs) -> Result<(), Box> { + let address = deploy_mockstream(&args.eth_rpc_url, &args.private_key, args.chain_id).await?; + println!("{address}"); + Ok(()) +} + +async fn run_demo(args: DemoArgs) -> Result<(), Box> { + let redis_env = env::var("REDIS_URL").ok(); + let redis_url = args.redis_url.or(redis_env).unwrap_or_default(); + let mut redis_guard = None; + let redis_url = if redis_url.is_empty() { + let guard = start_redis_docker()?; + let url = guard.url.clone(); + redis_guard = Some(guard); + url + } else { + redis_url + }; + wait_for_redis(&redis_url).await?; + + let anvil_guard = start_anvil(args.anvil_port, &args.anvil_mnemonic)?; + let anvil_rpc_url = anvil_guard.endpoint.clone(); + let anvil_private_key = anvil_guard.private_key.clone(); + + let server_handle = start_rpc_server(&redis_url, &args.listen_addr).await?; + + let contract_address = deploy_mockstream(&anvil_rpc_url, &anvil_private_key, Some(anvil_guard.chain_id)).await?; + + let (shutdown_tx, shutdown_rx) = watch::channel(false); + let relayer_handle = tokio::spawn(relayer::run_with_shutdown( + RelayerConfig { + celestia_ws_url: format!("ws://{}", args.listen_addr), + eth_rpc_url: anvil_rpc_url.clone(), + eth_private_key: anvil_private_key.clone(), + contract_address: contract_address.clone(), + poll_ms: args.relayer_interval_ms, + }, + shutdown_rx, + )); + + let auto_blob_handle = if args.auto_blob_interval_ms > 0 { + Some(tokio::spawn(auto_blob_loop( + format!("ws://{}", args.listen_addr), + args.auto_blob_interval_ms, + shutdown_tx.subscribe(), + ))) + } else { + None + }; + + let mut ui_child = start_ui_server( + &args.listen_addr, + &anvil_rpc_url, + &contract_address, + args.ui_port, + )?; + + info!("Demo ready:"); + info!("Localestia WS: ws://{}", args.listen_addr); + info!("Localestia HTTP: http://{}", args.listen_addr); + info!("Anvil RPC: {anvil_rpc_url}"); + info!("Mock contract: {contract_address}"); + info!("UI: http://127.0.0.1:{}", args.ui_port); + + match tokio::signal::ctrl_c().await { + Ok(_) => info!("Received shutdown signal"), + Err(e) => error!("Failed to listen for ctrl-c: {e}"), + } + + let _ = shutdown_tx.send(true); + relayer_handle.abort(); + if let Some(handle) = auto_blob_handle { + handle.abort(); + } + + if let Err(e) = server_handle.stop() { + error!("Error stopping server: {e}"); + } + + if let Err(err) = ui_child.kill() { + warn!("Failed to stop UI server: {err}"); + } + + drop(redis_guard); + drop(anvil_guard); + + Ok(()) +} + +async fn auto_blob_loop(ws_url: String, interval_ms: u64, mut shutdown: watch::Receiver) { + let mut client: Option = None; + let mut counter = 0u64; + + loop { + if *shutdown.borrow() { + break; + } + + if client.is_none() { + match Client::new(&ws_url, None, None, None).await { + Ok(new_client) => client = Some(new_client), + Err(err) => { + warn!("auto-blob: failed to connect to Localestia: {err}"); + sleep(Duration::from_millis(interval_ms)).await; + continue; + } + } + } + + if let Some(client) = &client { + let mut namespace_bytes = [0u8; 8]; + rand::thread_rng().fill_bytes(&mut namespace_bytes); + let namespace = match Namespace::new_v0(&namespace_bytes) { + Ok(namespace) => namespace, + Err(err) => { + warn!("auto-blob: failed to create namespace: {err}"); + continue; + } + }; + + counter += 1; + let data = format!("demo blob {counter}").into_bytes(); + let blob = match Blob::new(namespace, data, None, AppVersion::V3) { + Ok(blob) => blob, + Err(err) => { + warn!("auto-blob: failed to build blob: {err}"); + continue; + } + }; + + if let Err(err) = client + .blob_submit(std::slice::from_ref(&blob), TxConfig::default()) + .await + { + warn!("auto-blob: submit failed: {err}"); + } + } + + tokio::select! { + _ = shutdown.changed() => {}, + _ = sleep(Duration::from_millis(interval_ms)) => {}, + } + } +} + +async fn start_rpc_server(redis_url: &str, listen_addr: &str) -> Result> { + let addr: SocketAddr = listen_addr.parse().map_err(|e| { + Box::new(LocalError::TransactionError(format!( + "Failed to parse address: {e}" + ))) + })?; + + info!("Starting local Celestia Blob RPC server..."); + info!("Redis URL: {redis_url}"); + info!("Listening on: {listen_addr}"); + + let storage = match RedisStorage::new(redis_url) { + Ok(storage) => Arc::new(storage), + Err(e) => { + error!("Failed to initialize Redis storage: {e}"); + return Err(Box::new(e)); + } + }; + + if let Err(e) = storage.connect().await { + error!("Failed to connect to Redis: {e}"); + return Err(Box::new(e)); + } + + if let Err(e) = storage.clear_database().await { + error!("Failed to clear Redis database: {e}"); + return Err(Box::new(e)); + } + + let rpc_server = LocalestiaServer::new(storage.clone()); + let mut module = BlobRpcServer::into_rpc(rpc_server.clone()); + module + .merge(HeaderRpcServer::into_rpc(rpc_server.clone())) + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to merge header RPC: {e}"))))?; + module + .merge(ShareRpcServer::into_rpc(rpc_server.clone())) + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to merge share RPC: {e}"))))?; + module + .merge(BlobstreamRpcServer::into_rpc(rpc_server)) + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to merge blobstream RPC: {e}"))))?; + + let server = ServerBuilder::default().build(addr).await.map_err(|e| { + Box::new(LocalError::TransactionError(format!("Failed to build server: {e}"))) + })?; + + Ok(server.start(module)) +} + +async fn deploy_mockstream( + eth_rpc_url: &str, + private_key: &str, + chain_id: Option, +) -> Result> { + ensure_forge_artifact()?; + let (abi, bytecode) = load_mockstream_artifact()?; + + let provider = Provider::::try_from(eth_rpc_url).map_err(|e| { + Box::new(LocalError::TransactionError(format!("Failed to connect to ETH RPC: {e}"))) + })?; + let chain_id = match chain_id { + Some(chain_id) => chain_id, + None => provider.get_chainid().await.map_err(|e| { + Box::new(LocalError::TransactionError(format!("Failed to fetch chain id: {e}"))) + })?.as_u64(), + }; + + let wallet: LocalWallet = private_key.parse::().map_err(|e| { + Box::new(LocalError::TransactionError(format!("Failed to parse private key: {e}"))) + })?.with_chain_id(chain_id); + let client = Arc::new(SignerMiddleware::new(provider, wallet)); + let factory = ContractFactory::new(abi, bytecode, client); + + let contract = factory + .deploy(()) + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to deploy contract: {e}"))))? + .send() + .await + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to send deploy tx: {e}"))))?; + + let init_call = contract + .method::<_, ()>("initialize", 0u64) + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to build initialize call: {e}"))))?; + let init = init_call + .send() + .await + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to initialize contract: {e}"))))?; + init.await.map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to confirm initialize: {e}"))))?; + + Ok(format!("0x{}", hex::encode(contract.address().as_bytes()))) +} + +fn ensure_forge_artifact() -> Result<(), Box> { + let artifact_path = contracts_dir() + .join("out") + .join("MockBlobstream.sol") + .join("Mockstream.json"); + if artifact_path.exists() { + return Ok(()); + } + + let status = Command::new("forge") + .arg("build") + .current_dir(contracts_dir()) + .status() + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to run forge build: {e}"))))?; + + if !status.success() { + return Err(Box::new(LocalError::TransactionError(format!( + "forge build failed with status {status}" + )))); + } + + Ok(()) +} + +fn load_mockstream_artifact() -> Result<(Abi, Bytes), Box> { + let artifact_path = contracts_dir() + .join("out") + .join("MockBlobstream.sol") + .join("Mockstream.json"); + let bytes = fs::read(&artifact_path).map_err(|e| { + Box::new(LocalError::TransactionError(format!( + "Failed to read {artifact_path:?}: {e}" + ))) + })?; + let artifact: ForgeArtifact = serde_json::from_slice(&bytes) + .map_err(|e| Box::new(LocalError::SerializationError(e)))?; + let abi: Abi = serde_json::from_value(artifact.abi) + .map_err(|e| Box::new(LocalError::SerializationError(e)))?; + + let object = artifact.bytecode.object; + if object.is_empty() { + return Err(Box::new(LocalError::TransactionError( + "Forge artifact bytecode is empty".to_string(), + ))); + } + let object = object.strip_prefix("0x").unwrap_or(&object); + let bytes = hex::decode(object).map_err(|e| { + Box::new(LocalError::TransactionError(format!("Invalid bytecode hex: {e}"))) + })?; + + Ok((abi, Bytes::from(bytes))) +} + +fn contracts_dir() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("contracts") +} + +fn start_ui_server( + listen_addr: &str, + eth_rpc_url: &str, + contract_address: &str, + ui_port: u16, +) -> Result> { + let ui_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("ui"); + if !ui_dir.exists() { + return Err(Box::new(LocalError::TransactionError( + "UI directory not found; expected ./ui".to_string(), + ))); + } + + let node_modules = ui_dir.join("node_modules"); + if !node_modules.exists() { + let status = Command::new("bun") + .arg("install") + .current_dir(&ui_dir) + .status() + .map_err(|e| { + Box::new(LocalError::TransactionError(format!( + "Failed to run bun install: {e}" + ))) + })?; + if !status.success() { + return Err(Box::new(LocalError::TransactionError(format!( + "bun install failed with status {status}" + )))); + } + } + + let child = Command::new("bun") + .arg("src/index.ts") + .current_dir(ui_dir) + .env("CELESTIA_HTTP_URL", format!("http://{listen_addr}")) + .env("ETH_RPC_URL", eth_rpc_url) + .env("BLOBSTREAM_CONTRACT_ADDRESS", contract_address) + .env("UI_PORT", ui_port.to_string()) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .spawn() + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to start UI server: {e}"))))?; + + Ok(child) +} + +struct RedisGuard { + url: String, + container_name: String, +} + +impl Drop for RedisGuard { + fn drop(&mut self) { + let _ = Command::new("docker") + .arg("rm") + .arg("-f") + .arg(&self.container_name) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .status(); + } +} + +fn start_redis_docker() -> Result> { + if !docker_available() { + return Err(Box::new(LocalError::TransactionError( + "Docker is required to start Redis automatically".to_string(), + ))); + } + + let name = format!("localestia-demo-redis-{}", Uuid::new_v4()); + let output = Command::new("docker") + .arg("run") + .arg("-d") + .arg("-P") + .arg("--name") + .arg(&name) + .arg(DEFAULT_REDIS_IMAGE) + .output() + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to start Redis docker: {e}"))))?; + + if !output.status.success() { + return Err(Box::new(LocalError::TransactionError(format!( + "Docker run failed: {}", + String::from_utf8_lossy(&output.stderr) + )))); + } + + let port = docker_host_port(&name, "6379/tcp")?; + Ok(RedisGuard { + url: format!("redis://127.0.0.1:{port}"), + container_name: name, + }) +} + +struct AnvilGuard { + endpoint: String, + private_key: String, + chain_id: u64, + container_name: Option, + child: Option, +} + +impl Drop for AnvilGuard { + fn drop(&mut self) { + if let Some(mut child) = self.child.take() { + let _ = child.kill(); + let _ = child.wait(); + } + + if let Some(name) = self.container_name.take() { + let _ = Command::new("docker") + .arg("rm") + .arg("-f") + .arg(name) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .status(); + } + } +} + +fn start_anvil(port: u16, mnemonic: &str) -> Result> { + if Command::new("anvil").arg("--version").output().is_ok() { + return start_anvil_local(port, mnemonic); + } + + if docker_available() { + return start_anvil_docker(port, mnemonic); + } + + Err(Box::new(LocalError::TransactionError( + "Anvil not found; install Foundry or enable Docker".to_string(), + ))) +} + +fn start_anvil_local(port: u16, mnemonic: &str) -> Result> { + let mut child = Command::new("anvil") + .arg("--port") + .arg(port.to_string()) + .arg("--mnemonic") + .arg(mnemonic) + .stdout(Stdio::piped()) + .stderr(Stdio::inherit()) + .spawn() + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to start anvil: {e}"))))?; + + let stdout = child.stdout.take().ok_or_else(|| { + Box::new(LocalError::TransactionError("Failed to capture anvil stdout".to_string())) + })?; + let reader = BufReader::new(stdout); + let mut private_key = None; + let mut chain_id = None; + let mut in_keys = false; + + let start = Instant::now(); + for line in reader.lines() { + let line = line.map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to read anvil output: {e}"))))?; + if line.contains("Listening on") { + break; + } + if line.starts_with("Private Keys") { + in_keys = true; + continue; + } + if in_keys && line.trim_start().starts_with("(0)") { + if let Some(key) = line.split("0x").last() { + private_key = Some(format!("0x{}", key.trim())); + } + } + if let Some(idx) = line.find("Chain ID:") { + let rest = &line[idx + "Chain ID:".len()..]; + if let Ok(value) = rest.trim().split_whitespace().next().unwrap_or("").parse::() { + chain_id = Some(value); + } + } + + if start.elapsed() > Duration::from_secs(10) { + return Err(Box::new(LocalError::TransactionError( + "Timed out waiting for anvil to start".to_string(), + ))); + } + } + + let private_key = private_key.ok_or_else(|| { + Box::new(LocalError::TransactionError("Failed to parse anvil private key".to_string())) + })?; + let chain_id = chain_id.unwrap_or(31337); + + Ok(AnvilGuard { + endpoint: format!("http://127.0.0.1:{port}"), + private_key, + chain_id, + container_name: None, + child: Some(child), + }) +} + +fn start_anvil_docker(port: u16, mnemonic: &str) -> Result> { + let name = format!("localestia-demo-anvil-{}", Uuid::new_v4()); + let output = Command::new("docker") + .arg("run") + .arg("-d") + .arg("--name") + .arg(&name) + .arg("-p") + .arg(format!("{port}:8545")) + .arg(DEFAULT_ANVIL_IMAGE) + .arg("anvil") + .arg("--host") + .arg("0.0.0.0") + .arg("--port") + .arg("8545") + .arg("--mnemonic") + .arg(mnemonic) + .output() + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to start anvil docker: {e}"))))?; + + if !output.status.success() { + return Err(Box::new(LocalError::TransactionError(format!( + "Docker run failed: {}", + String::from_utf8_lossy(&output.stderr) + )))); + } + + let mut private_key = None; + let start = Instant::now(); + loop { + let logs = Command::new("docker") + .arg("logs") + .arg(&name) + .output() + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to read anvil logs: {e}"))))?; + let logs = String::from_utf8_lossy(&logs.stdout); + if logs.contains("Listening on") { + for line in logs.lines() { + if line.trim_start().starts_with("(0)") { + if let Some(key) = line.split("0x").last() { + private_key = Some(format!("0x{}", key.trim())); + break; + } + } + } + if private_key.is_some() { + break; + } + } + + if start.elapsed() > Duration::from_secs(10) { + return Err(Box::new(LocalError::TransactionError( + "Timed out waiting for anvil docker".to_string(), + ))); + } + std::thread::sleep(Duration::from_millis(200)); + } + + let private_key = private_key.ok_or_else(|| { + Box::new(LocalError::TransactionError("Failed to parse anvil docker private key".to_string())) + })?; + + Ok(AnvilGuard { + endpoint: format!("http://127.0.0.1:{port}"), + private_key, + chain_id: 31337, + container_name: Some(name), + child: None, + }) +} + +fn docker_available() -> bool { + Command::new("docker").arg("info").output().map(|output| output.status.success()).unwrap_or(false) +} + +fn docker_host_port(name: &str, port: &str) -> Result> { + let output = Command::new("docker") + .arg("inspect") + .arg("-f") + .arg(format!("{{{{(index (index .NetworkSettings.Ports \"{}\") 0).HostPort}}}}", port)) + .arg(name) + .output() + .map_err(|e| Box::new(LocalError::TransactionError(format!("Failed to inspect docker port: {e}"))))?; + + if !output.status.success() { + return Err(Box::new(LocalError::TransactionError( + String::from_utf8_lossy(&output.stderr).to_string(), + ))); + } + + let port = String::from_utf8_lossy(&output.stdout).trim().to_string(); + if port.is_empty() { + return Err(Box::new(LocalError::TransactionError("Docker inspect returned empty port".to_string()))); + } + + Ok(port) +} + +async fn wait_for_redis(redis_url: &str) -> Result<(), Box> { + let start = Instant::now(); + let timeout = Duration::from_secs(10); + + loop { + match redis::Client::open(redis_url) { + Ok(client) => match client.get_async_connection().await { + Ok(mut conn) => { + let pong: redis::RedisResult = + redis::cmd("PING").query_async(&mut conn).await; + if let Ok(pong) = pong { + if pong == "PONG" { + return Ok(()); + } + } + } + Err(_) => {} + }, + Err(_) => {} + } + + if start.elapsed() > timeout { + return Err(Box::new(LocalError::TransactionError(format!( + "Redis is not reachable at {redis_url}" + )))); + } + + sleep(Duration::from_millis(200)).await; + } +} diff --git a/src/lib.rs b/src/lib.rs index 75d24d4..6aa381f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ pub mod error; +pub mod relayer; pub mod rpc; pub mod storage; pub mod types; diff --git a/src/main.rs b/src/main.rs index f9128e3..97309de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,120 +1,11 @@ -use jsonrpsee::server::ServerBuilder; -use std::net::SocketAddr; -use std::sync::Arc; -use tracing::{error, info}; - +mod cli; mod error; mod rpc; mod storage; mod types; mod utils; -use celestia_rpc::BlobRpcServer; -use celestia_rpc::HeaderRpcServer; -use celestia_rpc::ShareRpcServer; -use error::LocalError; -use rpc::LocalestiaServer; -use storage::RedisStorage; - #[tokio::main] -async fn main() -> Result<(), Box> { - // Initialize logging - tracing_subscriber::fmt::init(); - - // Parse command line arguments - let redis_url = - std::env::var("REDIS_URL").unwrap_or_else(|_| "redis://127.0.0.1:6379".to_string()); - let listen_addr = - std::env::var("LISTEN_ADDR").unwrap_or_else(|_| "127.0.0.1:26658".to_string()); - - // Create a new error variant for AddrParseError - let addr: SocketAddr = listen_addr.parse().map_err(|e| { - Box::new(LocalError::TransactionError(format!( - "Failed to parse address: {}", - e - ))) - })?; - - info!("Starting local Celestia Blob RPC server..."); - info!("Redis URL: {}", redis_url); - info!("Listening on: {}", listen_addr); - - // Initialize Redis storage - let storage = match RedisStorage::new(&redis_url) { - Ok(storage) => Arc::new(storage), - Err(e) => { - error!("Failed to initialize Redis storage: {}", e); - return Err(Box::new(e)); - } - }; - - // Connect to Redis - if let Err(e) = storage.connect().await { - error!("Failed to connect to Redis: {}", e); - return Err(Box::new(e)); - } - - if let Err(e) = storage.clear_database().await { - error!("Failed to clear Redis database: {}", e); - return Err(Box::new(e)); - } - - // Create our RPC services - let rpc_server = LocalestiaServer::new(storage.clone()); - - let mut module = BlobRpcServer::into_rpc(rpc_server.clone()); - module - .merge(HeaderRpcServer::into_rpc(rpc_server.clone())) - .map_err(|e| { - Box::new(LocalError::TransactionError(format!( - "Failed to merge header RPC: {}", - e - ))) - })?; - module - .merge(ShareRpcServer::into_rpc(rpc_server)) - .map_err(|e| { - Box::new(LocalError::TransactionError(format!( - "Failed to merge share RPC: {}", - e - ))) - })?; - - // Build and start the JSON-RPC server - let server = ServerBuilder::default().build(addr).await.map_err(|e| { - Box::new(LocalError::TransactionError(format!( - "Failed to build server: {}", - e - ))) - })?; - - // Register our RPC methods (both Blob and Header) - let server_handle = server.start(module); - - info!("Server started successfully"); - info!( - "The server is ready to accept RPC calls at ws://{}", - listen_addr - ); - info!( - "Connect using: celestia-rpc::Client::new(\"ws://{}\", None)", - listen_addr - ); - - // Keep the server running until Ctrl+C - match tokio::signal::ctrl_c().await { - Ok(_) => info!("Received shutdown signal"), - Err(e) => error!("Failed to listen for ctrl-c: {}", e), - } - - info!("Shutting down server..."); - - // Stop the server - if let Err(e) = server_handle.stop() { - error!("Error stopping server: {}", e); - } - - info!("Server shutdown complete"); - - Ok(()) +async fn main() -> Result<(), Box> { + cli::run().await } diff --git a/src/relayer.rs b/src/relayer.rs new file mode 100644 index 0000000..1eb0051 --- /dev/null +++ b/src/relayer.rs @@ -0,0 +1,172 @@ +use std::sync::Arc; +use std::time::Duration; + +use anyhow::{Context, Result}; +use celestia_rpc::blobstream::BlobstreamClient; +use celestia_rpc::{Client, HeaderClient}; +use celestia_types::hash::Hash as CelestiaHash; +use ethers::prelude::*; +use tokio::sync::watch; +use tokio::time::sleep; +use tracing::{info, warn}; + +abigen!( + MockBlobstream, + r#"[ + function latestBlock() view returns (uint64) + function submitDataCommitment(bytes32,uint64,uint64) + ]"# +); + +pub struct RelayerConfig { + pub celestia_ws_url: String, + pub eth_rpc_url: String, + pub eth_private_key: String, + pub contract_address: String, + pub poll_ms: u64, +} + +pub async fn run_from_env() -> Result<()> { + let celestia_ws_url = + std::env::var("CELESTIA_RPC_URL").unwrap_or_else(|_| "ws://127.0.0.1:26658".to_string()); + let eth_rpc_url = std::env::var("ETH_RPC_URL").context("ETH_RPC_URL is required")?; + let eth_private_key = std::env::var("ETH_PRIVATE_KEY").context("ETH_PRIVATE_KEY is required")?; + let contract_address = std::env::var("BLOBSTREAM_CONTRACT_ADDRESS") + .context("BLOBSTREAM_CONTRACT_ADDRESS is required")?; + let poll_ms: u64 = std::env::var("RELAYER_POLL_MS") + .ok() + .and_then(|value| value.parse().ok()) + .unwrap_or(1000); + + run(RelayerConfig { + celestia_ws_url, + eth_rpc_url, + eth_private_key, + contract_address, + poll_ms, + }) + .await +} + +pub async fn run(config: RelayerConfig) -> Result<()> { + let (shutdown_tx, shutdown_rx) = watch::channel(false); + let run = run_with_shutdown(config, shutdown_rx); + tokio::pin!(run); + tokio::select! { + result = &mut run => result, + _ = tokio::signal::ctrl_c() => { + let _ = shutdown_tx.send(true); + Ok(()) + } + } +} + +pub async fn run_with_shutdown(config: RelayerConfig, mut shutdown: watch::Receiver) -> Result<()> { + let _ = tracing_subscriber::fmt::try_init(); + + let local_client = Client::new(&config.celestia_ws_url, None, None, None) + .await + .context("failed to connect to Localestia RPC")?; + + let provider = Provider::::try_from(config.eth_rpc_url) + .context("failed to create ETH RPC provider")?; + let chain_id = provider + .get_chainid() + .await + .context("failed to fetch chain id")?; + let wallet: LocalWallet = config + .eth_private_key + .parse::() + .context("failed to parse ETH_PRIVATE_KEY")? + .with_chain_id(chain_id.as_u64()); + let address: Address = config + .contract_address + .parse() + .context("failed to parse BLOBSTREAM_CONTRACT_ADDRESS")?; + + let provider = Arc::new(provider); + let signer = Arc::new(SignerMiddleware::new(provider, wallet)); + let contract = MockBlobstream::new(address, signer); + + info!("starting blobstream relayer"); + + loop { + if *shutdown.borrow() { + break; + } + + if let Err(err) = relay_once(&local_client, &contract).await { + warn!("relayer error: {err}"); + } + + tokio::select! { + _ = shutdown.changed() => {}, + _ = sleep(Duration::from_millis(config.poll_ms)) => {}, + } + } + + Ok(()) +} + +async fn relay_once(local_client: &Client, contract: &MockBlobstream) -> Result<()> { + let local_head = match local_client.header_local_head().await { + Ok(header) => header.height(), + Err(err) => { + let msg = err.to_string(); + if msg.contains("Header not found") { + return Ok(()); + } + warn!("failed to read local head: {err}"); + return Ok(()); + } + }; + + let contract_latest = match contract.latest_block().call().await { + Ok(value) => value, + Err(err) => { + warn!("failed to read contract latestBlock: {err}"); + return Ok(()); + } + }; + + let mut next_height = if contract_latest == 0 { 1 } else { contract_latest }; + + if next_height > local_head { + return Ok(()); + } + + while next_height <= local_head { + let end = next_height + 1; + let tuple_root = local_client + .blobstream_get_data_root_tuple_root(next_height, end) + .await + .with_context(|| format!("failed to fetch data root tuple root for {next_height}"))?; + let tuple_root = hash_to_bytes32(tuple_root)?; + + let call = contract.submit_data_commitment(tuple_root, next_height, end); + let pending = call + .send() + .await + .with_context(|| format!("failed to submit data commitment for {next_height}"))?; + + let receipt = pending + .await + .context("failed to fetch transaction receipt")?; + if let Some(receipt) = receipt { + info!("relayed height {next_height} in tx {:#x}", receipt.transaction_hash); + } else { + warn!("relayed height {next_height} but receipt missing"); + } + + next_height = end; + } + + Ok(()) +} + +fn hash_to_bytes32(hash: CelestiaHash) -> Result<[u8; 32]> { + match hash { + CelestiaHash::Sha256(bytes) => Ok(bytes), + CelestiaHash::None => Err(anyhow::anyhow!("empty tuple root hash")), + } +} diff --git a/src/rpc/blob.rs b/src/rpc/blob.rs index 4104928..c4af0ff 100644 --- a/src/rpc/blob.rs +++ b/src/rpc/blob.rs @@ -67,56 +67,3 @@ impl BlobRpcServer for LocalestiaServer { .map_err(|e| rpc_error(format!("Failed to get blob proof: {}", e))) } } - -// // Header methods implementation -// async fn header_get_by_hash(&self, hash: Hash) -> RpcResult { -// self.storage -// .get_header_by_hash(&hash) -// .await -// .map_err(|e| jsonrpsee::core::Error::Custom(format!("Failed to get header: {}", e))) -// } - -// async fn header_get_by_height(&self, height: u64) -> RpcResult { -// self.storage -// .get_header_by_height(height) -// .await -// .map_err(|e| jsonrpsee::core::Error::Custom(format!("Failed to get header: {}", e))) -// } - -// async fn header_get_range_by_height( -// &self, -// from: u64, -// to: u64, -// ) -> RpcResult> { -// self.storage -// .get_headers_by_range(from, to) -// .await -// .map_err(|e| jsonrpsee::core::Error::Custom(format!("Failed to get headers: {}", e))) -// } - -// async fn header_wait_for_height(&self, height: u64) -> RpcResult { -// self.storage.wait_for_header(height).await.map_err(|e| { -// jsonrpsee::core::Error::Custom(format!("Failed to wait for header: {}", e)) -// }) -// } - -// async fn share_get_eds(&self, height: u64) -> RpcResult { -// self.storage -// .get_eds_at_height(height) -// .await -// .map_err(|e| jsonrpsee::core::Error::Custom(format!("Failed to get EDS: {}", e))) -// } - -// async fn share_get_range( -// &self, -// height: u64, -// start: u64, -// end: u64, -// ) -> RpcResult { -// self.storage -// .get_share_range(height, start, end) -// .await -// .map_err(|e| { -// jsonrpsee::core::Error::Custom(format!("Failed to get share range: {}", e)) -// }) -// } diff --git a/src/rpc/blobstream.rs b/src/rpc/blobstream.rs new file mode 100644 index 0000000..65bd29b --- /dev/null +++ b/src/rpc/blobstream.rs @@ -0,0 +1,120 @@ +use celestia_rpc::BlobstreamRpcServer; +use celestia_types::MerkleProof; +use celestia_types::hash::Hash; +use jsonrpsee::core::{async_trait as jsonrpsee_async_trait, RpcResult}; + +use crate::rpc::{rpc_error, LocalestiaServer}; + +const DATA_ROOT_TUPLE_ROOT_BLOCKS_LIMIT: u64 = 10_000; + +fn encode_data_root_tuple(height: u64, data_root: Hash) -> Result, String> { + let data_root = match data_root { + Hash::Sha256(bytes) => bytes, + Hash::None => return Err("data root hash is empty".to_string()), + }; + + let mut encoded = vec![0u8; 32]; + encoded[24..].copy_from_slice(&height.to_be_bytes()); + encoded.extend_from_slice(&data_root); + Ok(encoded) +} + +async fn validate_data_root_tuple_root_range( + server: &LocalestiaServer, + start: u64, + end: u64, +) -> Result<(), String> { + if start == 0 { + return Err("start height must be greater than zero".to_string()); + } + if start >= end { + return Err("end block is smaller or equal to the start block".to_string()); + } + + let heights_range = end - start; + if heights_range > DATA_ROOT_TUPLE_ROOT_BLOCKS_LIMIT { + return Err(format!( + "the query exceeds the limit of allowed blocks {}", + DATA_ROOT_TUPLE_ROOT_BLOCKS_LIMIT + )); + } + + let current_height = server.storage.get_current_height().await.map_err(|e| { + format!("could not get local head to validate the data root tuple range: {e}") + })?; + + if end > current_height.saturating_add(1) { + return Err(format!( + "end block {end} is higher than local chain height {current_height}. Wait for the node until it syncs up to {end}", + )); + } + + Ok(()) +} + +async fn fetch_encoded_data_root_tuples( + server: &LocalestiaServer, + start: u64, + end: u64, +) -> Result>, String> { + let mut encoded = Vec::with_capacity((end - start) as usize); + for height in start..end { + let header = server + .storage + .get_header_by_height(height) + .await + .map_err(|e| format!("failed to get header at height {height}: {e}"))?; + let tuple = encode_data_root_tuple(height, header.dah.hash())?; + encoded.push(tuple); + } + + Ok(encoded) +} + +#[jsonrpsee_async_trait] +impl BlobstreamRpcServer for LocalestiaServer { + async fn blobstream_get_data_root_tuple_root(&self, start: u64, end: u64) -> RpcResult { + validate_data_root_tuple_root_range(self, start, end) + .await + .map_err(rpc_error)?; + + let encoded = fetch_encoded_data_root_tuples(self, start, end) + .await + .map_err(rpc_error)?; + + let (_, root) = MerkleProof::new(0, &encoded) + .map_err(|e| rpc_error(format!("failed to compute data root tuple root: {e}")))?; + + Ok(hex::encode_upper(root)) + } + + async fn blobstream_get_data_root_tuple_inclusion_proof( + &self, + height: u64, + start: u64, + end: u64, + ) -> RpcResult { + validate_data_root_tuple_root_range(self, start, end) + .await + .map_err(rpc_error)?; + + if height < start || height >= end { + return Err(rpc_error(format!( + "height {height} should be in the end exclusive interval first_block {start} last_block {end}", + ))); + } + + let encoded = fetch_encoded_data_root_tuples(self, start, end) + .await + .map_err(rpc_error)?; + + // test and double check this logic + let index = usize::try_from(height - start) + .map_err(|_| rpc_error("height offset is out of range"))?; + + let (proof, _) = MerkleProof::new(index, &encoded) + .map_err(|e| rpc_error(format!("failed to compute data root tuple proof: {e}")))?; + + Ok(proof) + } +} diff --git a/src/rpc/mod.rs b/src/rpc/mod.rs index 1bd3731..bb6f0ea 100644 --- a/src/rpc/mod.rs +++ b/src/rpc/mod.rs @@ -1,4 +1,5 @@ mod blob; +mod blobstream; mod header; pub mod server; mod share; diff --git a/tests/compat_blobstream.rs b/tests/compat_blobstream.rs new file mode 100644 index 0000000..a2e8a79 --- /dev/null +++ b/tests/compat_blobstream.rs @@ -0,0 +1,253 @@ +mod utils; + +use celestia_rpc::prelude::*; +use celestia_types::hash::Hash; +use ethers::abi::Abi; +use ethers::contract::{Contract, ContractFactory}; +use ethers::core::utils::{Anvil, AnvilInstance}; +use ethers::middleware::SignerMiddleware; +use ethers::providers::{Middleware, Provider}; +use ethers::signers::{LocalWallet, Signer}; +use ethers::types::{Bytes, H256, U256}; +use serde::Deserialize; +use std::env; +use std::fs; +use std::path::PathBuf; +use std::process::Command; +use std::sync::{Arc, Once}; + +use utils::{make_blob, make_namespace, setup, submit_blob}; + +#[tokio::test] +async fn blobstream_get_root_and_proof_roundtrip() { + let ctx = setup().await; + let namespace = make_namespace(50); + + let height_a = submit_blob(&ctx.client, &make_blob(namespace, b"tuple a".to_vec())).await; + let height_b = submit_blob(&ctx.client, &make_blob(namespace, b"tuple b".to_vec())).await; + let height_c = submit_blob(&ctx.client, &make_blob(namespace, b"tuple c".to_vec())).await; + + let start = height_a; + let end = height_c + 1; + let target_height = height_b; + + let tuple_root = ctx + .client + .blobstream_get_data_root_tuple_root(start, end) + .await + .expect("blobstream_get_data_root_tuple_root failed"); + + let proof = ctx + .client + .blobstream_get_data_root_tuple_inclusion_proof(target_height, start, end) + .await + .expect("blobstream_get_data_root_tuple_inclusion_proof failed"); + + let data_root = ctx + .client + .header_get_by_height(target_height) + .await + .expect("header_get_by_height failed") + .dah + .hash(); + + let leaf = encode_data_root_tuple(target_height, &data_root); + let root = hash_to_bytes(tuple_root); + + proof + .verify(leaf, root) + .expect("failed to verify data root tuple proof"); +} + +#[tokio::test] +async fn blobstream_proof_verifies_on_mock_contract() { + let ctx = setup().await; + let namespace = make_namespace(51); + + let height = submit_blob(&ctx.client, &make_blob(namespace, b"contract proof".to_vec())).await; + + let (anvil, contract) = deploy_mockstream_contract().await; + + let tuple_root = ctx + .client + .blobstream_get_data_root_tuple_root(height, height + 1) + .await + .expect("blobstream_get_data_root_tuple_root failed"); + let tuple_root = hash_to_h256(tuple_root); + + let submit_call = contract + .method::<_, ()>("submitDataCommitment", (tuple_root, height, height + 1)) + .expect("failed to build submitDataCommitment call"); + let pending_tx = submit_call + .send() + .await + .expect("submitDataCommitment transaction failed"); + let _ = pending_tx + .await + .expect("failed to confirm submitDataCommitment"); + + let proof = ctx + .client + .blobstream_get_data_root_tuple_inclusion_proof(height, height, height + 1) + .await + .expect("blobstream_get_data_root_tuple_inclusion_proof failed"); + let data_root = ctx + .client + .header_get_by_height(height) + .await + .expect("header_get_by_height failed") + .dah + .hash(); + + let tuple = (U256::from(height), hash_to_h256(data_root)); + let side_nodes: Vec = proof.aunts.iter().map(|hash| H256::from_slice(hash)).collect(); + let proof_tuple = ( + side_nodes, + U256::from(proof.index as u64), + U256::from(proof.total as u64), + ); + + let verified: bool = contract + .method("verifyAttestation", (U256::from(1u64), tuple, proof_tuple)) + .expect("failed to build verifyAttestation call") + .call() + .await + .expect("verifyAttestation call failed"); + assert!(verified, "verifyAttestation returned false"); + + drop(anvil); +} + +#[derive(Deserialize)] +struct ForgeArtifact { + abi: serde_json::Value, + bytecode: ForgeBytecode, +} + +#[derive(Deserialize)] +struct ForgeBytecode { + object: String, +} + +static FORGE_BUILD: Once = Once::new(); + +fn ensure_forge_build() { + FORGE_BUILD.call_once(|| { + let status = Command::new("forge") + .arg("build") + .current_dir(contracts_dir()) + .status() + .unwrap_or_else(|err| { + panic!("failed to execute forge build: {err}"); + }); + + if !status.success() { + panic!("forge build failed with status {status}"); + } + }); +} + +async fn deploy_mockstream_contract( +) -> (Option, Contract, LocalWallet>>) { + ensure_forge_build(); + + let (anvil, client) = anvil_client().await; + + let (abi, bytecode) = load_mockstream_artifact(); + let factory = ContractFactory::new(abi, bytecode, client.clone()); + let contract = factory + .deploy(()) + .expect("failed to build mock contract deployment") + .send() + .await + .expect("failed to deploy mock contract"); + + let init_call = contract + .method::<_, ()>("initialize", 0u64) + .expect("failed to build initialize call"); + let pending_tx = init_call + .send() + .await + .expect("initialize transaction failed"); + let _ = pending_tx.await.expect("failed to confirm initialize tx"); + + (anvil, contract) +} + +async fn anvil_client( +) -> (Option, Arc, LocalWallet>>) { + if let Ok(rpc_url) = env::var("ANVIL_RPC_URL") { + let private_key = env::var("ANVIL_PRIVATE_KEY") + .expect("ANVIL_PRIVATE_KEY is required when ANVIL_RPC_URL is set"); + let provider = Provider::try_from(rpc_url) + .expect("failed to create provider from ANVIL_RPC_URL"); + let chain_id = provider + .get_chainid() + .await + .expect("failed to fetch chain id from ANVIL_RPC_URL"); + let wallet: LocalWallet = private_key + .parse::() + .expect("failed to parse ANVIL_PRIVATE_KEY") + .with_chain_id(chain_id.as_u64()); + let client = Arc::new(SignerMiddleware::new(provider, wallet)); + return (None, client); + } + + let anvil = Anvil::new().spawn(); + let wallet: LocalWallet = anvil.keys()[0].clone().into(); + let wallet = wallet.with_chain_id(anvil.chain_id()); + let provider = Provider::try_from(anvil.endpoint()).expect("failed to create Anvil provider"); + let client = Arc::new(SignerMiddleware::new(provider, wallet)); + + (Some(anvil), client) +} + +fn load_mockstream_artifact() -> (Abi, Bytes) { + let artifact_path = contracts_dir() + .join("out") + .join("MockBlobstream.sol") + .join("Mockstream.json"); + let bytes = fs::read(&artifact_path) + .unwrap_or_else(|err| panic!("failed to read {artifact_path:?}: {err}")); + let artifact: ForgeArtifact = serde_json::from_slice(&bytes) + .unwrap_or_else(|err| panic!("failed to parse forge artifact: {err}")); + + let abi: Abi = serde_json::from_value(artifact.abi) + .unwrap_or_else(|err| panic!("failed to parse contract ABI: {err}")); + let bytecode = artifact.bytecode.object; + if bytecode.is_empty() { + panic!("forge artifact bytecode is empty"); + } + let bytecode = bytecode.strip_prefix("0x").unwrap_or(&bytecode); + let bytecode = hex::decode(bytecode) + .unwrap_or_else(|err| panic!("failed to decode bytecode hex: {err}")); + + (abi, Bytes::from(bytecode)) +} + +fn contracts_dir() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("contracts") +} + +fn encode_data_root_tuple(height: u64, data_root: &Hash) -> Vec { + let mut result = vec![0u8; 32]; + result[24..].copy_from_slice(&height.to_be_bytes()); + + match data_root { + Hash::Sha256(bytes) => result.extend_from_slice(bytes), + Hash::None => panic!("empty data root hash"), + } + + result +} + +fn hash_to_bytes(hash: Hash) -> [u8; 32] { + match hash { + Hash::Sha256(bytes) => bytes, + Hash::None => panic!("empty tuple root hash"), + } +} + +fn hash_to_h256(hash: Hash) -> H256 { + H256::from(hash_to_bytes(hash)) +} diff --git a/tests/compat_report.rs b/tests/compat_report.rs index a41561d..3a01aca 100644 --- a/tests/compat_report.rs +++ b/tests/compat_report.rs @@ -108,6 +108,19 @@ async fn compatibility_report() { } } + results.push(record( + "blobstream.GetDataRootTupleRoot", + ctx.client + .blobstream_get_data_root_tuple_root(height, height + 1) + .await, + )); + results.push(record( + "blobstream.GetDataRootTupleInclusionProof", + ctx.client + .blobstream_get_data_root_tuple_inclusion_proof(height, height, height + 1) + .await, + )); + results.push(record( "share.GetEDS", ctx.client.share_get_eds(height, AppVersion::V3).await, diff --git a/tests/process_server.rs b/tests/process_server.rs index 70a393f..35b9d8c 100644 --- a/tests/process_server.rs +++ b/tests/process_server.rs @@ -74,6 +74,15 @@ async fn process_server_supports_all_methods() { .expect("blob_included failed"); assert!(included, "blob_included reported false for stored blob"); + ctx.client + .blobstream_get_data_root_tuple_root(height, height + 1) + .await + .expect("blobstream_get_data_root_tuple_root failed"); + ctx.client + .blobstream_get_data_root_tuple_inclusion_proof(height, height, height + 1) + .await + .expect("blobstream_get_data_root_tuple_inclusion_proof failed"); + ctx.client .share_get_eds(height, AppVersion::V3) .await diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs index 99fbb9d..a157ddf 100644 --- a/tests/utils/mod.rs +++ b/tests/utils/mod.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] use celestia_rpc::prelude::*; -use celestia_rpc::{BlobRpcServer, HeaderRpcServer, ShareRpcServer}; +use celestia_rpc::{BlobRpcServer, BlobstreamRpcServer, HeaderRpcServer, ShareRpcServer}; use celestia_rpc::{Client, TxConfig}; use celestia_types::nmt::Namespace; use celestia_types::{AppVersion, Blob}; @@ -82,8 +82,11 @@ pub async fn setup() -> TestContext { .merge(HeaderRpcServer::into_rpc(rpc_server.clone())) .expect("failed to merge header RPC module"); module - .merge(ShareRpcServer::into_rpc(rpc_server)) + .merge(ShareRpcServer::into_rpc(rpc_server.clone())) .expect("failed to merge share RPC module"); + module + .merge(BlobstreamRpcServer::into_rpc(rpc_server)) + .expect("failed to merge blobstream RPC module"); let server_handle = server.start(module); let ws_url = format!("ws://{}", local_addr); diff --git a/ui/bun.lock b/ui/bun.lock new file mode 100644 index 0000000..94fdc43 --- /dev/null +++ b/ui/bun.lock @@ -0,0 +1,47 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "localestia-ui", + "dependencies": { + "elysia": "^1.0.0", + }, + }, + }, + "packages": { + "@borewit/text-codec": ["@borewit/text-codec@0.2.1", "", {}, "sha512-k7vvKPbf7J2fZ5klGRD9AeKfUvojuZIQ3BT5u7Jfv+puwXkUBUT5PVyMDfJZpy30CBDXGMgw7fguK/lpOMBvgw=="], + + "@sinclair/typebox": ["@sinclair/typebox@0.34.48", "", {}, "sha512-kKJTNuK3AQOrgjjotVxMrCn1sUJwM76wMszfq1kdU4uYVJjvEWuFQ6HgvLt4Xz3fSmZlTOxJ/Ie13KnIcWQXFA=="], + + "@tokenizer/inflate": ["@tokenizer/inflate@0.4.1", "", { "dependencies": { "debug": "^4.4.3", "token-types": "^6.1.1" } }, "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA=="], + + "@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="], + + "cookie": ["cookie@1.1.1", "", {}, "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ=="], + + "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + + "elysia": ["elysia@1.4.25", "", { "dependencies": { "cookie": "^1.1.1", "exact-mirror": "^0.2.7", "fast-decode-uri-component": "^1.0.1", "memoirist": "^0.4.0" }, "peerDependencies": { "@sinclair/typebox": ">= 0.34.0 < 1", "@types/bun": ">= 1.2.0", "file-type": ">= 20.0.0", "openapi-types": ">= 12.0.0", "typescript": ">= 5.0.0" }, "optionalPeers": ["@types/bun", "typescript"] }, "sha512-liKjavH99Gpzrv9cDil6uYWmPuqESfPFV1FIaFSd3iNqo3y7e29sN43VxFIK8tWWnyi6eDAmi2SZk8hNAMQMyg=="], + + "exact-mirror": ["exact-mirror@0.2.7", "", { "peerDependencies": { "@sinclair/typebox": "^0.34.15" }, "optionalPeers": ["@sinclair/typebox"] }, "sha512-+MeEmDcLA4o/vjK2zujgk+1VTxPR4hdp23qLqkWfStbECtAq9gmsvQa3LW6z/0GXZyHJobrCnmy1cdeE7BjsYg=="], + + "fast-decode-uri-component": ["fast-decode-uri-component@1.0.1", "", {}, "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg=="], + + "file-type": ["file-type@21.3.0", "", { "dependencies": { "@tokenizer/inflate": "^0.4.1", "strtok3": "^10.3.4", "token-types": "^6.1.1", "uint8array-extras": "^1.4.0" } }, "sha512-8kPJMIGz1Yt/aPEwOsrR97ZyZaD1Iqm8PClb1nYFclUCkBi0Ma5IsYNQzvSFS9ib51lWyIw5mIT9rWzI/xjpzA=="], + + "ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="], + + "memoirist": ["memoirist@0.4.0", "", {}, "sha512-zxTgA0mSYELa66DimuNQDvyLq36AwDlTuVRbnQtB+VuTcKWm5Qc4z3WkSpgsFWHNhexqkIooqpv4hdcqrX5Nmg=="], + + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + + "openapi-types": ["openapi-types@12.1.3", "", {}, "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="], + + "strtok3": ["strtok3@10.3.4", "", { "dependencies": { "@tokenizer/token": "^0.3.0" } }, "sha512-KIy5nylvC5le1OdaaoCJ07L+8iQzJHGH6pWDuzS+d07Cu7n1MZ2x26P8ZKIWfbK02+XIL8Mp4RkWeqdUCrDMfg=="], + + "token-types": ["token-types@6.1.2", "", { "dependencies": { "@borewit/text-codec": "^0.2.1", "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" } }, "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww=="], + + "uint8array-extras": ["uint8array-extras@1.5.0", "", {}, "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A=="], + } +} diff --git a/ui/node_modules/@borewit/text-codec/LICENSE.txt b/ui/node_modules/@borewit/text-codec/LICENSE.txt new file mode 100644 index 0000000..6780b3c --- /dev/null +++ b/ui/node_modules/@borewit/text-codec/LICENSE.txt @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright © 2025 Borewit + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ui/node_modules/@borewit/text-codec/README.md b/ui/node_modules/@borewit/text-codec/README.md new file mode 100644 index 0000000..2c34eec --- /dev/null +++ b/ui/node_modules/@borewit/text-codec/README.md @@ -0,0 +1,96 @@ +[![CI](https://github.com/Borewit/text-codec/actions/workflows/ci.yml/badge.svg)](https://github.com/Borewit/text-codec/actions/workflows/ci.yml) +[![npm version](https://img.shields.io/npm/v/%40borewit%2Ftext-codec.svg)](https://www.npmjs.com/package/@borewit/text-codec) +[![npm downloads](http://img.shields.io/npm/dm/@borewit/text-codec.svg)](https://npmcharts.com/compare/@borewit/text-codec?interval=30) +![bundlejs](https://deno.bundlejs.com/?q=@borewit/text-codec&badge) +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?logo=open-source-initiative&logoColor=white)](LICENSE.txt) + +# `@borewit/text-codec` + +A **lightweight alternative implementation** of `TextEncoder` / `TextDecoder` supporting common encodings missing in some JavaScript engines and Node.js builds. +Works in environments like **Hermes** (React Native) or **Small-ICU Node.js** where only UTF-8 and UTF-16LE are available. + +| Encoding | Hermes — **Encode** | Hermes — **Decode** | Small-ICU Node.js — **Encode** | Small-ICU Node.js — **Decode** | +|---------------------------|---------------------|---------------------|--------------------------------|--------------------------------| +| **utf-8** / `utf8` | ➕ | Native | Native | Native | +| **utf-16le** | ➕ | ➕ | Native | Native | +| **ascii** | ➕ | ➕ | ➕ | ➕ | +| **latin1** / `iso-8859-1` | ➕ | ➕ | ➕ | Native (sometimes) | +| **windows-1252** | ➕ | ➕ | ➕ | ➕ | + +**Legend:** +- **Native** — Supported natively by the JavaScript engine. +- **➕** — Support added by this module. +- **Native (sometimes)** — Available in some builds (e.g., certain Small-ICU Node.js builds). +--- + +When your project needs to handle encodings like `latin1` / `iso-8859-1` or `windows-1252` in these environments, +native `TextDecoder` / `TextEncoder` may throw an error or return incorrect results. + +## ✨ Features + +- Decoding and encoding +- Lightweight +- Typed + +### Supported encodings: +- `utf-8` / `utf8` +- `utf-16le` +- `ascii` +- `latin1` / `iso-8859-1` +- `windows-1252` + +--- + +## 📦 Installation + +```sh +npm install @borewit/text-codec +``` + + +# 📚 API Documentation + +## `textDecode(bytes, encoding): string` + +Decodes binary data into a JavaScript string using the specified encoding. + +**Parameters** +- `bytes` (`Uint8Array`) — The binary data to decode. +- `encoding` (`SupportedEncoding`, optional) — Encoding type. Defaults to `"utf-8"`. + +**Returns** +- `string` — The decoded text. + +**Example** +```js +import { textDecode } from "@borewit/text-encode"; + +const bytes = new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f]); +const text = textDecode(bytes, "ascii"); +console.log(text); // "Hello" +``` +Encodes a JavaScript string into binary form using the specified encoding. + +## `textEncode(input, encoding): Uint8Array` + +**Parameters** + +- `input` (`string`) — The string to encode. +- `encoding` (`SupportedEncoding`, optional) — Encoding type. Defaults to `"utf-8"`. + +**Returns** + +`Uint8Array` — The encoded binary data. + +Example: +```js +import { textEncode } from "@borewit/text-encode"; + +const bytes = textEncode("Hello", "utf-16le"); +console.log(bytes); // Uint8Array([...]) +``` + +## 📜 Licence + +This project is licensed under the [MIT License](LICENSE.txt). Feel free to use, modify, and distribute as needed. + \ No newline at end of file diff --git a/ui/node_modules/@borewit/text-codec/lib/index.d.ts b/ui/node_modules/@borewit/text-codec/lib/index.d.ts new file mode 100644 index 0000000..48f2d6d --- /dev/null +++ b/ui/node_modules/@borewit/text-codec/lib/index.d.ts @@ -0,0 +1,8 @@ +export type SupportedEncoding = "utf-8" | "utf8" | "utf-16le" | "us-ascii" | "ascii" | "latin1" | "iso-8859-1" | "windows-1252"; +/** + * Decode text from binary data + * @param bytes Binary data + * @param encoding Encoding + */ +export declare function textDecode(bytes: Uint8Array, encoding?: SupportedEncoding): string; +export declare function textEncode(input?: string, encoding?: SupportedEncoding): Uint8Array; diff --git a/ui/node_modules/@borewit/text-codec/lib/index.js b/ui/node_modules/@borewit/text-codec/lib/index.js new file mode 100644 index 0000000..f05b7b4 --- /dev/null +++ b/ui/node_modules/@borewit/text-codec/lib/index.js @@ -0,0 +1,236 @@ +const WINDOWS_1252_EXTRA = { + 0x80: "€", 0x82: "‚", 0x83: "ƒ", 0x84: "„", 0x85: "…", 0x86: "†", + 0x87: "‡", 0x88: "ˆ", 0x89: "‰", 0x8a: "Š", 0x8b: "‹", 0x8c: "Œ", + 0x8e: "Ž", 0x91: "‘", 0x92: "’", 0x93: "“", 0x94: "”", 0x95: "•", + 0x96: "–", 0x97: "—", 0x98: "˜", 0x99: "™", 0x9a: "š", 0x9b: "›", + 0x9c: "œ", 0x9e: "ž", 0x9f: "Ÿ", +}; +const WINDOWS_1252_REVERSE = {}; +for (const [code, char] of Object.entries(WINDOWS_1252_EXTRA)) { + WINDOWS_1252_REVERSE[char] = Number.parseInt(code, 10); +} +// ---------- Cached decoders/encoders ---------- +let _utf8Decoder; +let _utf8Encoder; +function utf8Decoder() { + if (typeof globalThis.TextDecoder === "undefined") + return undefined; + return (_utf8Decoder !== null && _utf8Decoder !== void 0 ? _utf8Decoder : (_utf8Decoder = new globalThis.TextDecoder("utf-8"))); +} +function utf8Encoder() { + if (typeof globalThis.TextEncoder === "undefined") + return undefined; + return (_utf8Encoder !== null && _utf8Encoder !== void 0 ? _utf8Encoder : (_utf8Encoder = new globalThis.TextEncoder())); +} +// Safe chunk size well under your measured ~105k cliff. +// 32k keeps memory reasonable and is plenty fast. +const CHUNK = 32 * 1024; +/** + * Decode text from binary data + * @param bytes Binary data + * @param encoding Encoding + */ +export function textDecode(bytes, encoding = "utf-8") { + switch (encoding.toLowerCase()) { + case "utf-8": + case "utf8": { + const dec = utf8Decoder(); + return dec ? dec.decode(bytes) : decodeUTF8(bytes); + } + case "utf-16le": + return decodeUTF16LE(bytes); + case "us-ascii": + case "ascii": + return decodeASCII(bytes); + case "latin1": + case "iso-8859-1": + return decodeLatin1(bytes); + case "windows-1252": + return decodeWindows1252(bytes); + default: + throw new RangeError(`Encoding '${encoding}' not supported`); + } +} +export function textEncode(input = "", encoding = "utf-8") { + switch (encoding.toLowerCase()) { + case "utf-8": + case "utf8": { + const enc = utf8Encoder(); + return enc ? enc.encode(input) : encodeUTF8(input); + } + case "utf-16le": + return encodeUTF16LE(input); + case "us-ascii": + case "ascii": + return encodeASCII(input); + case "latin1": + case "iso-8859-1": + return encodeLatin1(input); + case "windows-1252": + return encodeWindows1252(input); + default: + throw new RangeError(`Encoding '${encoding}' not supported`); + } +} +// --- Internal helpers --- +function decodeUTF8(bytes) { + const parts = []; + let out = ""; + let i = 0; + while (i < bytes.length) { + const b1 = bytes[i++]; + if (b1 < 0x80) { + out += String.fromCharCode(b1); + } + else if (b1 < 0xe0) { + const b2 = bytes[i++] & 0x3f; + out += String.fromCharCode(((b1 & 0x1f) << 6) | b2); + } + else if (b1 < 0xf0) { + const b2 = bytes[i++] & 0x3f; + const b3 = bytes[i++] & 0x3f; + out += String.fromCharCode(((b1 & 0x0f) << 12) | (b2 << 6) | b3); + } + else { + const b2 = bytes[i++] & 0x3f; + const b3 = bytes[i++] & 0x3f; + const b4 = bytes[i++] & 0x3f; + let cp = ((b1 & 0x07) << 18) | (b2 << 12) | (b3 << 6) | b4; + cp -= 0x10000; + out += String.fromCharCode(0xd800 + ((cp >> 10) & 0x3ff), 0xdc00 + (cp & 0x3ff)); + } + if (out.length >= CHUNK) { + parts.push(out); + out = ""; + } + } + if (out) + parts.push(out); + return parts.join(""); +} +function decodeUTF16LE(bytes) { + // Use chunked fromCharCode on 16-bit code units. + // If odd length, ignore trailing byte (common behavior). + const len = bytes.length & ~1; + if (len === 0) + return ""; + const parts = []; + // Build a temporary code-unit array per chunk. + const maxUnits = CHUNK; // CHUNK code units per chunk + for (let i = 0; i < len;) { + const unitsThis = Math.min(maxUnits, (len - i) >> 1); + const units = new Array(unitsThis); + for (let j = 0; j < unitsThis; j++, i += 2) { + units[j] = bytes[i] | (bytes[i + 1] << 8); + } + parts.push(String.fromCharCode.apply(null, units)); + } + return parts.join(""); +} +function decodeASCII(bytes) { + // 7-bit ASCII: mask high bit. (Kept to match your original semantics.) + const parts = []; + for (let i = 0; i < bytes.length; i += CHUNK) { + const end = Math.min(bytes.length, i + CHUNK); + const codes = new Array(end - i); + for (let j = i, k = 0; j < end; j++, k++) { + codes[k] = bytes[j] & 0x7f; + } + parts.push(String.fromCharCode.apply(null, codes)); + } + return parts.join(""); +} +function decodeLatin1(bytes) { + // Latin-1 is 0x00..0xFF direct mapping; avoid spread. + const parts = []; + for (let i = 0; i < bytes.length; i += CHUNK) { + const end = Math.min(bytes.length, i + CHUNK); + const codes = new Array(end - i); + for (let j = i, k = 0; j < end; j++, k++) { + codes[k] = bytes[j]; + } + parts.push(String.fromCharCode.apply(null, codes)); + } + return parts.join(""); +} +function decodeWindows1252(bytes) { + // Only 0x80..0x9F need mapping; others are direct 1-byte codes. + const parts = []; + let out = ""; + for (let i = 0; i < bytes.length; i++) { + const b = bytes[i]; + const extra = b >= 0x80 && b <= 0x9f ? WINDOWS_1252_EXTRA[b] : undefined; + out += extra !== null && extra !== void 0 ? extra : String.fromCharCode(b); + if (out.length >= CHUNK) { + parts.push(out); + out = ""; + } + } + if (out) + parts.push(out); + return parts.join(""); +} +function encodeUTF8(str) { + const out = []; + for (let i = 0; i < str.length; i++) { + let cp = str.charCodeAt(i); + // surrogate pair + if (cp >= 0xd800 && cp <= 0xdbff && i + 1 < str.length) { + const lo = str.charCodeAt(i + 1); + if (lo >= 0xdc00 && lo <= 0xdfff) { + cp = 0x10000 + ((cp - 0xd800) << 10) + (lo - 0xdc00); + i++; + } + } + if (cp < 0x80) { + out.push(cp); + } + else if (cp < 0x800) { + out.push(0xc0 | (cp >> 6), 0x80 | (cp & 0x3f)); + } + else if (cp < 0x10000) { + out.push(0xe0 | (cp >> 12), 0x80 | ((cp >> 6) & 0x3f), 0x80 | (cp & 0x3f)); + } + else { + out.push(0xf0 | (cp >> 18), 0x80 | ((cp >> 12) & 0x3f), 0x80 | ((cp >> 6) & 0x3f), 0x80 | (cp & 0x3f)); + } + } + return new Uint8Array(out); +} +function encodeUTF16LE(str) { + const out = new Uint8Array(str.length * 2); + for (let i = 0; i < str.length; i++) { + const code = str.charCodeAt(i); + const o = i * 2; + out[o] = code & 0xff; + out[o + 1] = code >>> 8; + } + return out; +} +function encodeASCII(str) { + // 7-bit ASCII: mask high bit + const out = new Uint8Array(str.length); + for (let i = 0; i < str.length; i++) + out[i] = str.charCodeAt(i) & 0x7f; + return out; +} +function encodeLatin1(str) { + const out = new Uint8Array(str.length); + for (let i = 0; i < str.length; i++) + out[i] = str.charCodeAt(i) & 0xff; + return out; +} +function encodeWindows1252(str) { + const out = new Uint8Array(str.length); + for (let i = 0; i < str.length; i++) { + const ch = str[i]; + const code = ch.charCodeAt(0); + if (code <= 0xff) { + out[i] = code; + continue; + } + const mapped = WINDOWS_1252_REVERSE[ch]; + out[i] = mapped !== undefined ? mapped : 0x3f; // '?' + } + return out; +} diff --git a/ui/node_modules/@borewit/text-codec/package.json b/ui/node_modules/@borewit/text-codec/package.json new file mode 100644 index 0000000..0ad2427 --- /dev/null +++ b/ui/node_modules/@borewit/text-codec/package.json @@ -0,0 +1,70 @@ +{ + "name": "@borewit/text-codec", + "version": "0.2.1", + "description": "Text Decoder", + "type": "module", + "exports": "./lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib/index.js", + "lib/index.d.ts" + ], + "scripts": { + "clean": "del-cli lib/**/*.js lib/***.js.map test/**/*.d.ts test/**/*.js test/**/*.js.map", + "build": "npm run compile", + "prepublishOnly": "npm run build", + "compile:src": "tsc --p lib --sourceMap false", + "compile:test": "tsc --p test", + "compile": "npm run compile:src && npm run compile:test", + "lint": "biome check", + "test": "mocha", + "update-biome": "npm install --save-dev --save-exact @biomejs/biome@latest && npx @biomejs/biome migrate --write" + }, + "devDependencies": { + "@biomejs/biome": "2.3.10", + "@types/chai": "^5.2.2", + "@types/mocha": "^10.0.10", + "chai": "^5.2.1", + "mocha": "^11.7.5", + "ts-node": "^10.9.2", + "typescript": "^5.9.3" + }, + "keywords": [ + "TextDecoder", + "TextEncoder", + "decoder", + "decoding", + "encod", + "encoding", + "decode", + "text", + "ascii", + "utf-8", + "utf8", + "utf-16le", + "latin1", + "iso-8859-1", + "windows-1252", + "charset", + "encoding", + "decoding", + "polyfill", + "character-set", + "latin", + "hermes", + "react" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/Borewit/text-codec.git" + }, + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "license": "MIT" +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.d.ts new file mode 100644 index 0000000..7e4474d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.d.ts @@ -0,0 +1,55 @@ +import { ValueErrorIterator } from '../errors/index'; +import { TypeBoxError } from '../type/error/index'; +import type { TSchema } from '../type/schema/index'; +import type { Static, StaticDecode, StaticEncode } from '../type/static/index'; +export type CheckFunction = (value: unknown) => boolean; +export declare class TypeCheck { + private readonly schema; + private readonly references; + private readonly checkFunc; + private readonly code; + private readonly hasTransform; + constructor(schema: T, references: TSchema[], checkFunc: CheckFunction, code: string); + /** Returns the generated assertion code used to validate this type. */ + Code(): string; + /** Returns the schema type used to validate */ + Schema(): T; + /** Returns reference types used to validate */ + References(): TSchema[]; + /** Returns an iterator for each error in this value. */ + Errors(value: unknown): ValueErrorIterator; + /** Returns true if the value matches the compiled type. */ + Check(value: unknown): value is Static; + /** Decodes a value or throws if error */ + Decode, Result extends Static = Static>(value: unknown): Result; + /** Encodes a value or throws if error */ + Encode, Result extends Static = Static>(value: unknown): Result; +} +export declare class TypeCompilerUnknownTypeError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +export declare class TypeCompilerTypeGuardError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +export declare namespace Policy { + function IsExactOptionalProperty(value: string, key: string, expression: string): string; + function IsObjectLike(value: string): string; + function IsRecordLike(value: string): string; + function IsNumberLike(value: string): string; + function IsVoidLike(value: string): string; +} +export type TypeCompilerLanguageOption = 'typescript' | 'javascript'; +export interface TypeCompilerCodegenOptions { + language?: TypeCompilerLanguageOption; +} +/** Compiles Types for Runtime Type Checking */ +export declare namespace TypeCompiler { + /** Generates the code used to assert this type and returns it as a string */ + function Code(schema: T, references: TSchema[], options?: TypeCompilerCodegenOptions): string; + /** Generates the code used to assert this type and returns it as a string */ + function Code(schema: T, options?: TypeCompilerCodegenOptions): string; + /** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */ + function Compile(schema: T, references?: TSchema[]): TypeCheck; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.js b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.js new file mode 100644 index 0000000..4743db5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/compiler.js @@ -0,0 +1,670 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypeCompiler = exports.Policy = exports.TypeCompilerTypeGuardError = exports.TypeCompilerUnknownTypeError = exports.TypeCheck = void 0; +const index_1 = require("../value/transform/index"); +const index_2 = require("../errors/index"); +const index_3 = require("../system/index"); +const index_4 = require("../type/error/index"); +const index_5 = require("../value/deref/index"); +const index_6 = require("../value/hash/index"); +const index_7 = require("../type/symbols/index"); +const index_8 = require("../type/registry/index"); +const index_9 = require("../type/keyof/index"); +const extends_undefined_1 = require("../type/extends/extends-undefined"); +const index_10 = require("../type/never/index"); +const index_11 = require("../type/ref/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_12 = require("../value/guard/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const type_1 = require("../type/guard/type"); +// ------------------------------------------------------------------ +// TypeCheck +// ------------------------------------------------------------------ +class TypeCheck { + constructor(schema, references, checkFunc, code) { + this.schema = schema; + this.references = references; + this.checkFunc = checkFunc; + this.code = code; + this.hasTransform = (0, index_1.HasTransform)(schema, references); + } + /** Returns the generated assertion code used to validate this type. */ + Code() { + return this.code; + } + /** Returns the schema type used to validate */ + Schema() { + return this.schema; + } + /** Returns reference types used to validate */ + References() { + return this.references; + } + /** Returns an iterator for each error in this value. */ + Errors(value) { + return (0, index_2.Errors)(this.schema, this.references, value); + } + /** Returns true if the value matches the compiled type. */ + Check(value) { + return this.checkFunc(value); + } + /** Decodes a value or throws if error */ + Decode(value) { + if (!this.checkFunc(value)) + throw new index_1.TransformDecodeCheckError(this.schema, value, this.Errors(value).First()); + return (this.hasTransform ? (0, index_1.TransformDecode)(this.schema, this.references, value) : value); + } + /** Encodes a value or throws if error */ + Encode(value) { + const encoded = this.hasTransform ? (0, index_1.TransformEncode)(this.schema, this.references, value) : value; + if (!this.checkFunc(encoded)) + throw new index_1.TransformEncodeCheckError(this.schema, value, this.Errors(value).First()); + return encoded; + } +} +exports.TypeCheck = TypeCheck; +// ------------------------------------------------------------------ +// Character +// ------------------------------------------------------------------ +var Character; +(function (Character) { + function DollarSign(code) { + return code === 36; + } + Character.DollarSign = DollarSign; + function IsUnderscore(code) { + return code === 95; + } + Character.IsUnderscore = IsUnderscore; + function IsAlpha(code) { + return (code >= 65 && code <= 90) || (code >= 97 && code <= 122); + } + Character.IsAlpha = IsAlpha; + function IsNumeric(code) { + return code >= 48 && code <= 57; + } + Character.IsNumeric = IsNumeric; +})(Character || (Character = {})); +// ------------------------------------------------------------------ +// MemberExpression +// ------------------------------------------------------------------ +var MemberExpression; +(function (MemberExpression) { + function IsFirstCharacterNumeric(value) { + if (value.length === 0) + return false; + return Character.IsNumeric(value.charCodeAt(0)); + } + function IsAccessor(value) { + if (IsFirstCharacterNumeric(value)) + return false; + for (let i = 0; i < value.length; i++) { + const code = value.charCodeAt(i); + const check = Character.IsAlpha(code) || Character.IsNumeric(code) || Character.DollarSign(code) || Character.IsUnderscore(code); + if (!check) + return false; + } + return true; + } + function EscapeHyphen(key) { + return key.replace(/'/g, "\\'"); + } + function Encode(object, key) { + return IsAccessor(key) ? `${object}.${key}` : `${object}['${EscapeHyphen(key)}']`; + } + MemberExpression.Encode = Encode; +})(MemberExpression || (MemberExpression = {})); +// ------------------------------------------------------------------ +// Identifier +// ------------------------------------------------------------------ +var Identifier; +(function (Identifier) { + function Encode($id) { + const buffer = []; + for (let i = 0; i < $id.length; i++) { + const code = $id.charCodeAt(i); + if (Character.IsNumeric(code) || Character.IsAlpha(code)) { + buffer.push($id.charAt(i)); + } + else { + buffer.push(`_${code}_`); + } + } + return buffer.join('').replace(/__/g, '_'); + } + Identifier.Encode = Encode; +})(Identifier || (Identifier = {})); +// ------------------------------------------------------------------ +// LiteralString +// ------------------------------------------------------------------ +var LiteralString; +(function (LiteralString) { + function Escape(content) { + return content.replace(/'/g, "\\'"); + } + LiteralString.Escape = Escape; +})(LiteralString || (LiteralString = {})); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class TypeCompilerUnknownTypeError extends index_4.TypeBoxError { + constructor(schema) { + super('Unknown type'); + this.schema = schema; + } +} +exports.TypeCompilerUnknownTypeError = TypeCompilerUnknownTypeError; +class TypeCompilerTypeGuardError extends index_4.TypeBoxError { + constructor(schema) { + super('Preflight validation check failed to guard for the given schema'); + this.schema = schema; + } +} +exports.TypeCompilerTypeGuardError = TypeCompilerTypeGuardError; +// ------------------------------------------------------------------ +// Policy +// ------------------------------------------------------------------ +var Policy; +(function (Policy) { + function IsExactOptionalProperty(value, key, expression) { + return index_3.TypeSystemPolicy.ExactOptionalPropertyTypes ? `('${key}' in ${value} ? ${expression} : true)` : `(${MemberExpression.Encode(value, key)} !== undefined ? ${expression} : true)`; + } + Policy.IsExactOptionalProperty = IsExactOptionalProperty; + function IsObjectLike(value) { + return !index_3.TypeSystemPolicy.AllowArrayObject ? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}))` : `(typeof ${value} === 'object' && ${value} !== null)`; + } + Policy.IsObjectLike = IsObjectLike; + function IsRecordLike(value) { + return !index_3.TypeSystemPolicy.AllowArrayObject + ? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}) && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))` + : `(typeof ${value} === 'object' && ${value} !== null && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))`; + } + Policy.IsRecordLike = IsRecordLike; + function IsNumberLike(value) { + return index_3.TypeSystemPolicy.AllowNaN ? `typeof ${value} === 'number'` : `Number.isFinite(${value})`; + } + Policy.IsNumberLike = IsNumberLike; + function IsVoidLike(value) { + return index_3.TypeSystemPolicy.AllowNullVoid ? `(${value} === undefined || ${value} === null)` : `${value} === undefined`; + } + Policy.IsVoidLike = IsVoidLike; +})(Policy || (exports.Policy = Policy = {})); +/** Compiles Types for Runtime Type Checking */ +var TypeCompiler; +(function (TypeCompiler) { + // ---------------------------------------------------------------- + // Guards + // ---------------------------------------------------------------- + function IsAnyOrUnknown(schema) { + return schema[index_7.Kind] === 'Any' || schema[index_7.Kind] === 'Unknown'; + } + // ---------------------------------------------------------------- + // Types + // ---------------------------------------------------------------- + function* FromAny(schema, references, value) { + yield 'true'; + } + function* FromArgument(schema, references, value) { + yield 'true'; + } + function* FromArray(schema, references, value) { + yield `Array.isArray(${value})`; + const [parameter, accumulator] = [CreateParameter('value', 'any'), CreateParameter('acc', 'number')]; + if ((0, index_12.IsNumber)(schema.maxItems)) + yield `${value}.length <= ${schema.maxItems}`; + if ((0, index_12.IsNumber)(schema.minItems)) + yield `${value}.length >= ${schema.minItems}`; + const elementExpression = CreateExpression(schema.items, references, 'value'); + // yield `${value}.every((${parameter}) => ${elementExpression})` // issue: 1519 + yield `((array) => { for(const ${parameter} of array) if(!(${elementExpression})) { return false }; return true; })(${value})`; + if ((0, type_1.IsSchema)(schema.contains) || (0, index_12.IsNumber)(schema.minContains) || (0, index_12.IsNumber)(schema.maxContains)) { + const containsSchema = (0, type_1.IsSchema)(schema.contains) ? schema.contains : (0, index_10.Never)(); + const checkExpression = CreateExpression(containsSchema, references, 'value'); + const checkMinContains = (0, index_12.IsNumber)(schema.minContains) ? [`(count >= ${schema.minContains})`] : []; + const checkMaxContains = (0, index_12.IsNumber)(schema.maxContains) ? [`(count <= ${schema.maxContains})`] : []; + const checkCount = `const count = value.reduce((${accumulator}, ${parameter}) => ${checkExpression} ? acc + 1 : acc, 0)`; + const check = [`(count > 0)`, ...checkMinContains, ...checkMaxContains].join(' && '); + yield `((${parameter}) => { ${checkCount}; return ${check}})(${value})`; + } + if (schema.uniqueItems === true) { + const check = `const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true`; + const block = `const set = new Set(); for(const element of value) { ${check} }`; + yield `((${parameter}) => { ${block} )(${value})`; + } + } + function* FromAsyncIterator(schema, references, value) { + yield `(typeof value === 'object' && Symbol.asyncIterator in ${value})`; + } + function* FromBigInt(schema, references, value) { + yield `(typeof ${value} === 'bigint')`; + if ((0, index_12.IsBigInt)(schema.exclusiveMaximum)) + yield `${value} < BigInt(${schema.exclusiveMaximum})`; + if ((0, index_12.IsBigInt)(schema.exclusiveMinimum)) + yield `${value} > BigInt(${schema.exclusiveMinimum})`; + if ((0, index_12.IsBigInt)(schema.maximum)) + yield `${value} <= BigInt(${schema.maximum})`; + if ((0, index_12.IsBigInt)(schema.minimum)) + yield `${value} >= BigInt(${schema.minimum})`; + if ((0, index_12.IsBigInt)(schema.multipleOf)) + yield `(${value} % BigInt(${schema.multipleOf})) === 0`; + } + function* FromBoolean(schema, references, value) { + yield `(typeof ${value} === 'boolean')`; + } + function* FromConstructor(schema, references, value) { + yield* Visit(schema.returns, references, `${value}.prototype`); + } + function* FromDate(schema, references, value) { + yield `(${value} instanceof Date) && Number.isFinite(${value}.getTime())`; + if ((0, index_12.IsNumber)(schema.exclusiveMaximumTimestamp)) + yield `${value}.getTime() < ${schema.exclusiveMaximumTimestamp}`; + if ((0, index_12.IsNumber)(schema.exclusiveMinimumTimestamp)) + yield `${value}.getTime() > ${schema.exclusiveMinimumTimestamp}`; + if ((0, index_12.IsNumber)(schema.maximumTimestamp)) + yield `${value}.getTime() <= ${schema.maximumTimestamp}`; + if ((0, index_12.IsNumber)(schema.minimumTimestamp)) + yield `${value}.getTime() >= ${schema.minimumTimestamp}`; + if ((0, index_12.IsNumber)(schema.multipleOfTimestamp)) + yield `(${value}.getTime() % ${schema.multipleOfTimestamp}) === 0`; + } + function* FromFunction(schema, references, value) { + yield `(typeof ${value} === 'function')`; + } + function* FromImport(schema, references, value) { + const members = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => { + return [...result, schema.$defs[key]]; + }, []); + yield* Visit((0, index_11.Ref)(schema.$ref), [...references, ...members], value); + } + function* FromInteger(schema, references, value) { + yield `Number.isInteger(${value})`; + if ((0, index_12.IsNumber)(schema.exclusiveMaximum)) + yield `${value} < ${schema.exclusiveMaximum}`; + if ((0, index_12.IsNumber)(schema.exclusiveMinimum)) + yield `${value} > ${schema.exclusiveMinimum}`; + if ((0, index_12.IsNumber)(schema.maximum)) + yield `${value} <= ${schema.maximum}`; + if ((0, index_12.IsNumber)(schema.minimum)) + yield `${value} >= ${schema.minimum}`; + if ((0, index_12.IsNumber)(schema.multipleOf)) + yield `(${value} % ${schema.multipleOf}) === 0`; + } + function* FromIntersect(schema, references, value) { + const check1 = schema.allOf.map((schema) => CreateExpression(schema, references, value)).join(' && '); + if (schema.unevaluatedProperties === false) { + const keyCheck = CreateVariable(`${new RegExp((0, index_9.KeyOfPattern)(schema))};`); + const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key))`; + yield `(${check1} && ${check2})`; + } + else if ((0, type_1.IsSchema)(schema.unevaluatedProperties)) { + const keyCheck = CreateVariable(`${new RegExp((0, index_9.KeyOfPattern)(schema))};`); + const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key) || ${CreateExpression(schema.unevaluatedProperties, references, `${value}[key]`)})`; + yield `(${check1} && ${check2})`; + } + else { + yield `(${check1})`; + } + } + function* FromIterator(schema, references, value) { + yield `(typeof value === 'object' && Symbol.iterator in ${value})`; + } + function* FromLiteral(schema, references, value) { + if (typeof schema.const === 'number' || typeof schema.const === 'boolean') { + yield `(${value} === ${schema.const})`; + } + else { + yield `(${value} === '${LiteralString.Escape(schema.const)}')`; + } + } + function* FromNever(schema, references, value) { + yield `false`; + } + function* FromNot(schema, references, value) { + const expression = CreateExpression(schema.not, references, value); + yield `(!${expression})`; + } + function* FromNull(schema, references, value) { + yield `(${value} === null)`; + } + function* FromNumber(schema, references, value) { + yield Policy.IsNumberLike(value); + if ((0, index_12.IsNumber)(schema.exclusiveMaximum)) + yield `${value} < ${schema.exclusiveMaximum}`; + if ((0, index_12.IsNumber)(schema.exclusiveMinimum)) + yield `${value} > ${schema.exclusiveMinimum}`; + if ((0, index_12.IsNumber)(schema.maximum)) + yield `${value} <= ${schema.maximum}`; + if ((0, index_12.IsNumber)(schema.minimum)) + yield `${value} >= ${schema.minimum}`; + if ((0, index_12.IsNumber)(schema.multipleOf)) + yield `(${value} % ${schema.multipleOf}) === 0`; + } + function* FromObject(schema, references, value) { + yield Policy.IsObjectLike(value); + if ((0, index_12.IsNumber)(schema.minProperties)) + yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`; + if ((0, index_12.IsNumber)(schema.maxProperties)) + yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`; + const knownKeys = Object.getOwnPropertyNames(schema.properties); + for (const knownKey of knownKeys) { + const memberExpression = MemberExpression.Encode(value, knownKey); + const property = schema.properties[knownKey]; + if (schema.required && schema.required.includes(knownKey)) { + yield* Visit(property, references, memberExpression); + if ((0, extends_undefined_1.ExtendsUndefinedCheck)(property) || IsAnyOrUnknown(property)) + yield `('${knownKey}' in ${value})`; + } + else { + const expression = CreateExpression(property, references, memberExpression); + yield Policy.IsExactOptionalProperty(value, knownKey, expression); + } + } + if (schema.additionalProperties === false) { + if (schema.required && schema.required.length === knownKeys.length) { + yield `Object.getOwnPropertyNames(${value}).length === ${knownKeys.length}`; + } + else { + const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`; + yield `Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key))`; + } + } + if (typeof schema.additionalProperties === 'object') { + const expression = CreateExpression(schema.additionalProperties, references, `${value}[key]`); + const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`; + yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key) || ${expression}))`; + } + } + function* FromPromise(schema, references, value) { + yield `${value} instanceof Promise`; + } + function* FromRecord(schema, references, value) { + yield Policy.IsRecordLike(value); + if ((0, index_12.IsNumber)(schema.minProperties)) + yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`; + if ((0, index_12.IsNumber)(schema.maxProperties)) + yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`; + const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0]; + const variable = CreateVariable(`${new RegExp(patternKey)}`); + const check1 = CreateExpression(patternSchema, references, 'value'); + const check2 = (0, type_1.IsSchema)(schema.additionalProperties) ? CreateExpression(schema.additionalProperties, references, value) : schema.additionalProperties === false ? 'false' : 'true'; + const expression = `(${variable}.test(key) ? ${check1} : ${check2})`; + yield `(Object.entries(${value}).every(([key, value]) => ${expression}))`; + } + function* FromRef(schema, references, value) { + const target = (0, index_5.Deref)(schema, references); + // Reference: If we have seen this reference before we can just yield and return the function call. + // If this isn't the case we defer to visit to generate and set the function for subsequent passes. + if (state.functions.has(schema.$ref)) + return yield `${CreateFunctionName(schema.$ref)}(${value})`; + yield* Visit(target, references, value); + } + function* FromRegExp(schema, references, value) { + const variable = CreateVariable(`${new RegExp(schema.source, schema.flags)};`); + yield `(typeof ${value} === 'string')`; + if ((0, index_12.IsNumber)(schema.maxLength)) + yield `${value}.length <= ${schema.maxLength}`; + if ((0, index_12.IsNumber)(schema.minLength)) + yield `${value}.length >= ${schema.minLength}`; + yield `${variable}.test(${value})`; + } + function* FromString(schema, references, value) { + yield `(typeof ${value} === 'string')`; + if ((0, index_12.IsNumber)(schema.maxLength)) + yield `${value}.length <= ${schema.maxLength}`; + if ((0, index_12.IsNumber)(schema.minLength)) + yield `${value}.length >= ${schema.minLength}`; + if (schema.pattern !== undefined) { + const variable = CreateVariable(`${new RegExp(schema.pattern)};`); + yield `${variable}.test(${value})`; + } + if (schema.format !== undefined) { + yield `format('${schema.format}', ${value})`; + } + } + function* FromSymbol(schema, references, value) { + yield `(typeof ${value} === 'symbol')`; + } + function* FromTemplateLiteral(schema, references, value) { + yield `(typeof ${value} === 'string')`; + const variable = CreateVariable(`${new RegExp(schema.pattern)};`); + yield `${variable}.test(${value})`; + } + function* FromThis(schema, references, value) { + // Note: This types are assured to be hoisted prior to this call. Just yield the function. + yield `${CreateFunctionName(schema.$ref)}(${value})`; + } + function* FromTuple(schema, references, value) { + yield `Array.isArray(${value})`; + if (schema.items === undefined) + return yield `${value}.length === 0`; + yield `(${value}.length === ${schema.maxItems})`; + for (let i = 0; i < schema.items.length; i++) { + const expression = CreateExpression(schema.items[i], references, `${value}[${i}]`); + yield `${expression}`; + } + } + function* FromUndefined(schema, references, value) { + yield `${value} === undefined`; + } + function* FromUnion(schema, references, value) { + const expressions = schema.anyOf.map((schema) => CreateExpression(schema, references, value)); + yield `(${expressions.join(' || ')})`; + } + function* FromUint8Array(schema, references, value) { + yield `${value} instanceof Uint8Array`; + if ((0, index_12.IsNumber)(schema.maxByteLength)) + yield `(${value}.length <= ${schema.maxByteLength})`; + if ((0, index_12.IsNumber)(schema.minByteLength)) + yield `(${value}.length >= ${schema.minByteLength})`; + } + function* FromUnknown(schema, references, value) { + yield 'true'; + } + function* FromVoid(schema, references, value) { + yield Policy.IsVoidLike(value); + } + function* FromKind(schema, references, value) { + const instance = state.instances.size; + state.instances.set(instance, schema); + yield `kind('${schema[index_7.Kind]}', ${instance}, ${value})`; + } + function* Visit(schema, references, value, useHoisting = true) { + const references_ = (0, index_12.IsString)(schema.$id) ? [...references, schema] : references; + const schema_ = schema; + // -------------------------------------------------------------- + // Hoisting + // -------------------------------------------------------------- + if (useHoisting && (0, index_12.IsString)(schema.$id)) { + const functionName = CreateFunctionName(schema.$id); + if (state.functions.has(functionName)) { + return yield `${functionName}(${value})`; + } + else { + // Note: In the case of cyclic types, we need to create a 'functions' record + // to prevent infinitely re-visiting the CreateFunction. Subsequent attempts + // to visit will be caught by the above condition. + state.functions.set(functionName, ''); + const functionCode = CreateFunction(functionName, schema, references, 'value', false); + state.functions.set(functionName, functionCode); + return yield `${functionName}(${value})`; + } + } + switch (schema_[index_7.Kind]) { + case 'Any': + return yield* FromAny(schema_, references_, value); + case 'Argument': + return yield* FromArgument(schema_, references_, value); + case 'Array': + return yield* FromArray(schema_, references_, value); + case 'AsyncIterator': + return yield* FromAsyncIterator(schema_, references_, value); + case 'BigInt': + return yield* FromBigInt(schema_, references_, value); + case 'Boolean': + return yield* FromBoolean(schema_, references_, value); + case 'Constructor': + return yield* FromConstructor(schema_, references_, value); + case 'Date': + return yield* FromDate(schema_, references_, value); + case 'Function': + return yield* FromFunction(schema_, references_, value); + case 'Import': + return yield* FromImport(schema_, references_, value); + case 'Integer': + return yield* FromInteger(schema_, references_, value); + case 'Intersect': + return yield* FromIntersect(schema_, references_, value); + case 'Iterator': + return yield* FromIterator(schema_, references_, value); + case 'Literal': + return yield* FromLiteral(schema_, references_, value); + case 'Never': + return yield* FromNever(schema_, references_, value); + case 'Not': + return yield* FromNot(schema_, references_, value); + case 'Null': + return yield* FromNull(schema_, references_, value); + case 'Number': + return yield* FromNumber(schema_, references_, value); + case 'Object': + return yield* FromObject(schema_, references_, value); + case 'Promise': + return yield* FromPromise(schema_, references_, value); + case 'Record': + return yield* FromRecord(schema_, references_, value); + case 'Ref': + return yield* FromRef(schema_, references_, value); + case 'RegExp': + return yield* FromRegExp(schema_, references_, value); + case 'String': + return yield* FromString(schema_, references_, value); + case 'Symbol': + return yield* FromSymbol(schema_, references_, value); + case 'TemplateLiteral': + return yield* FromTemplateLiteral(schema_, references_, value); + case 'This': + return yield* FromThis(schema_, references_, value); + case 'Tuple': + return yield* FromTuple(schema_, references_, value); + case 'Undefined': + return yield* FromUndefined(schema_, references_, value); + case 'Union': + return yield* FromUnion(schema_, references_, value); + case 'Uint8Array': + return yield* FromUint8Array(schema_, references_, value); + case 'Unknown': + return yield* FromUnknown(schema_, references_, value); + case 'Void': + return yield* FromVoid(schema_, references_, value); + default: + if (!index_8.TypeRegistry.Has(schema_[index_7.Kind])) + throw new TypeCompilerUnknownTypeError(schema); + return yield* FromKind(schema_, references_, value); + } + } + // ---------------------------------------------------------------- + // Compiler State + // ---------------------------------------------------------------- + // prettier-ignore + const state = { + language: 'javascript', // target language + functions: new Map(), // local functions + variables: new Map(), // local variables + instances: new Map() // exterior kind instances + }; + // ---------------------------------------------------------------- + // Compiler Factory + // ---------------------------------------------------------------- + function CreateExpression(schema, references, value, useHoisting = true) { + return `(${[...Visit(schema, references, value, useHoisting)].join(' && ')})`; + } + function CreateFunctionName($id) { + return `check_${Identifier.Encode($id)}`; + } + function CreateVariable(expression) { + const variableName = `local_${state.variables.size}`; + state.variables.set(variableName, `const ${variableName} = ${expression}`); + return variableName; + } + function CreateFunction(name, schema, references, value, useHoisting = true) { + const [newline, pad] = ['\n', (length) => ''.padStart(length, ' ')]; + const parameter = CreateParameter('value', 'any'); + const returns = CreateReturns('boolean'); + const expression = [...Visit(schema, references, value, useHoisting)].map((expression) => `${pad(4)}${expression}`).join(` &&${newline}`); + return `function ${name}(${parameter})${returns} {${newline}${pad(2)}return (${newline}${expression}${newline}${pad(2)})\n}`; + } + function CreateParameter(name, type) { + const annotation = state.language === 'typescript' ? `: ${type}` : ''; + return `${name}${annotation}`; + } + function CreateReturns(type) { + return state.language === 'typescript' ? `: ${type}` : ''; + } + // ---------------------------------------------------------------- + // Compile + // ---------------------------------------------------------------- + function Build(schema, references, options) { + const functionCode = CreateFunction('check', schema, references, 'value'); // will populate functions and variables + const parameter = CreateParameter('value', 'any'); + const returns = CreateReturns('boolean'); + const functions = [...state.functions.values()]; + const variables = [...state.variables.values()]; + // prettier-ignore + const checkFunction = (0, index_12.IsString)(schema.$id) // ensure top level schemas with $id's are hoisted + ? `return function check(${parameter})${returns} {\n return ${CreateFunctionName(schema.$id)}(value)\n}` + : `return ${functionCode}`; + return [...variables, ...functions, checkFunction].join('\n'); + } + /** Generates the code used to assert this type and returns it as a string */ + function Code(...args) { + const defaults = { language: 'javascript' }; + // prettier-ignore + const [schema, references, options] = (args.length === 2 && (0, index_12.IsArray)(args[1]) ? [args[0], args[1], defaults] : + args.length === 2 && !(0, index_12.IsArray)(args[1]) ? [args[0], [], args[1]] : + args.length === 3 ? [args[0], args[1], args[2]] : + args.length === 1 ? [args[0], [], defaults] : + [null, [], defaults]); + // compiler-reset + state.language = options.language; + state.variables.clear(); + state.functions.clear(); + state.instances.clear(); + if (!(0, type_1.IsSchema)(schema)) + throw new TypeCompilerTypeGuardError(schema); + for (const schema of references) + if (!(0, type_1.IsSchema)(schema)) + throw new TypeCompilerTypeGuardError(schema); + return Build(schema, references, options); + } + TypeCompiler.Code = Code; + /** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */ + function Compile(schema, references = []) { + const generatedCode = Code(schema, references, { language: 'javascript' }); + const compiledFunction = globalThis.Function('kind', 'format', 'hash', generatedCode); + const instances = new Map(state.instances); + function typeRegistryFunction(kind, instance, value) { + if (!index_8.TypeRegistry.Has(kind) || !instances.has(instance)) + return false; + const checkFunc = index_8.TypeRegistry.Get(kind); + const schema = instances.get(instance); + return checkFunc(schema, value); + } + function formatRegistryFunction(format, value) { + if (!index_8.FormatRegistry.Has(format)) + return false; + const checkFunc = index_8.FormatRegistry.Get(format); + return checkFunc(value); + } + function hashFunction(value) { + return (0, index_6.Hash)(value); + } + const checkFunction = compiledFunction(typeRegistryFunction, formatRegistryFunction, hashFunction); + return new TypeCheck(schema, references, checkFunction, generatedCode); + } + TypeCompiler.Compile = Compile; +})(TypeCompiler || (exports.TypeCompiler = TypeCompiler = {})); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.d.ts new file mode 100644 index 0000000..3da87a4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.d.ts @@ -0,0 +1,2 @@ +export { ValueError, ValueErrorType, ValueErrorIterator } from '../errors/index'; +export * from './compiler'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.js new file mode 100644 index 0000000..73d726f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/compiler/index.js @@ -0,0 +1,22 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueErrorIterator = exports.ValueErrorType = void 0; +var index_1 = require("../errors/index"); +Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } }); +Object.defineProperty(exports, "ValueErrorIterator", { enumerable: true, get: function () { return index_1.ValueErrorIterator; } }); +__exportStar(require("./compiler"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.d.ts new file mode 100644 index 0000000..2416b99 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.d.ts @@ -0,0 +1,91 @@ +import { TypeBoxError } from '../type/error/index'; +import type { TSchema } from '../type/schema/index'; +export declare enum ValueErrorType { + ArrayContains = 0, + ArrayMaxContains = 1, + ArrayMaxItems = 2, + ArrayMinContains = 3, + ArrayMinItems = 4, + ArrayUniqueItems = 5, + Array = 6, + AsyncIterator = 7, + BigIntExclusiveMaximum = 8, + BigIntExclusiveMinimum = 9, + BigIntMaximum = 10, + BigIntMinimum = 11, + BigIntMultipleOf = 12, + BigInt = 13, + Boolean = 14, + DateExclusiveMaximumTimestamp = 15, + DateExclusiveMinimumTimestamp = 16, + DateMaximumTimestamp = 17, + DateMinimumTimestamp = 18, + DateMultipleOfTimestamp = 19, + Date = 20, + Function = 21, + IntegerExclusiveMaximum = 22, + IntegerExclusiveMinimum = 23, + IntegerMaximum = 24, + IntegerMinimum = 25, + IntegerMultipleOf = 26, + Integer = 27, + IntersectUnevaluatedProperties = 28, + Intersect = 29, + Iterator = 30, + Kind = 31, + Literal = 32, + Never = 33, + Not = 34, + Null = 35, + NumberExclusiveMaximum = 36, + NumberExclusiveMinimum = 37, + NumberMaximum = 38, + NumberMinimum = 39, + NumberMultipleOf = 40, + Number = 41, + ObjectAdditionalProperties = 42, + ObjectMaxProperties = 43, + ObjectMinProperties = 44, + ObjectRequiredProperty = 45, + Object = 46, + Promise = 47, + RegExp = 48, + StringFormatUnknown = 49, + StringFormat = 50, + StringMaxLength = 51, + StringMinLength = 52, + StringPattern = 53, + String = 54, + Symbol = 55, + TupleLength = 56, + Tuple = 57, + Uint8ArrayMaxByteLength = 58, + Uint8ArrayMinByteLength = 59, + Uint8Array = 60, + Undefined = 61, + Union = 62, + Void = 63 +} +export interface ValueError { + type: ValueErrorType; + schema: TSchema; + path: string; + value: unknown; + message: string; + errors: ValueErrorIterator[]; +} +export declare class ValueErrorsUnknownTypeError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +export declare class ValueErrorIterator { + private readonly iterator; + constructor(iterator: IterableIterator); + [Symbol.iterator](): IterableIterator; + /** Returns the first value error or undefined if no errors */ + First(): ValueError | undefined; +} +/** Returns an iterator for each error in this value. */ +export declare function Errors(schema: T, references: TSchema[], value: unknown): ValueErrorIterator; +/** Returns an iterator for each error in this value. */ +export declare function Errors(schema: T, value: unknown): ValueErrorIterator; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.js b/ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.js new file mode 100644 index 0000000..b42ef70 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/errors/errors.js @@ -0,0 +1,599 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueErrorIterator = exports.ValueErrorsUnknownTypeError = exports.ValueErrorType = void 0; +exports.Errors = Errors; +const index_1 = require("../system/index"); +const index_2 = require("../type/keyof/index"); +const index_3 = require("../type/registry/index"); +const extends_undefined_1 = require("../type/extends/extends-undefined"); +const function_1 = require("./function"); +const index_4 = require("../type/error/index"); +const index_5 = require("../value/deref/index"); +const index_6 = require("../value/hash/index"); +const index_7 = require("../value/check/index"); +const index_8 = require("../type/symbols/index"); +const index_9 = require("../type/never/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +// prettier-ignore +const index_10 = require("../value/guard/index"); +// ------------------------------------------------------------------ +// ValueErrorType +// ------------------------------------------------------------------ +var ValueErrorType; +(function (ValueErrorType) { + ValueErrorType[ValueErrorType["ArrayContains"] = 0] = "ArrayContains"; + ValueErrorType[ValueErrorType["ArrayMaxContains"] = 1] = "ArrayMaxContains"; + ValueErrorType[ValueErrorType["ArrayMaxItems"] = 2] = "ArrayMaxItems"; + ValueErrorType[ValueErrorType["ArrayMinContains"] = 3] = "ArrayMinContains"; + ValueErrorType[ValueErrorType["ArrayMinItems"] = 4] = "ArrayMinItems"; + ValueErrorType[ValueErrorType["ArrayUniqueItems"] = 5] = "ArrayUniqueItems"; + ValueErrorType[ValueErrorType["Array"] = 6] = "Array"; + ValueErrorType[ValueErrorType["AsyncIterator"] = 7] = "AsyncIterator"; + ValueErrorType[ValueErrorType["BigIntExclusiveMaximum"] = 8] = "BigIntExclusiveMaximum"; + ValueErrorType[ValueErrorType["BigIntExclusiveMinimum"] = 9] = "BigIntExclusiveMinimum"; + ValueErrorType[ValueErrorType["BigIntMaximum"] = 10] = "BigIntMaximum"; + ValueErrorType[ValueErrorType["BigIntMinimum"] = 11] = "BigIntMinimum"; + ValueErrorType[ValueErrorType["BigIntMultipleOf"] = 12] = "BigIntMultipleOf"; + ValueErrorType[ValueErrorType["BigInt"] = 13] = "BigInt"; + ValueErrorType[ValueErrorType["Boolean"] = 14] = "Boolean"; + ValueErrorType[ValueErrorType["DateExclusiveMaximumTimestamp"] = 15] = "DateExclusiveMaximumTimestamp"; + ValueErrorType[ValueErrorType["DateExclusiveMinimumTimestamp"] = 16] = "DateExclusiveMinimumTimestamp"; + ValueErrorType[ValueErrorType["DateMaximumTimestamp"] = 17] = "DateMaximumTimestamp"; + ValueErrorType[ValueErrorType["DateMinimumTimestamp"] = 18] = "DateMinimumTimestamp"; + ValueErrorType[ValueErrorType["DateMultipleOfTimestamp"] = 19] = "DateMultipleOfTimestamp"; + ValueErrorType[ValueErrorType["Date"] = 20] = "Date"; + ValueErrorType[ValueErrorType["Function"] = 21] = "Function"; + ValueErrorType[ValueErrorType["IntegerExclusiveMaximum"] = 22] = "IntegerExclusiveMaximum"; + ValueErrorType[ValueErrorType["IntegerExclusiveMinimum"] = 23] = "IntegerExclusiveMinimum"; + ValueErrorType[ValueErrorType["IntegerMaximum"] = 24] = "IntegerMaximum"; + ValueErrorType[ValueErrorType["IntegerMinimum"] = 25] = "IntegerMinimum"; + ValueErrorType[ValueErrorType["IntegerMultipleOf"] = 26] = "IntegerMultipleOf"; + ValueErrorType[ValueErrorType["Integer"] = 27] = "Integer"; + ValueErrorType[ValueErrorType["IntersectUnevaluatedProperties"] = 28] = "IntersectUnevaluatedProperties"; + ValueErrorType[ValueErrorType["Intersect"] = 29] = "Intersect"; + ValueErrorType[ValueErrorType["Iterator"] = 30] = "Iterator"; + ValueErrorType[ValueErrorType["Kind"] = 31] = "Kind"; + ValueErrorType[ValueErrorType["Literal"] = 32] = "Literal"; + ValueErrorType[ValueErrorType["Never"] = 33] = "Never"; + ValueErrorType[ValueErrorType["Not"] = 34] = "Not"; + ValueErrorType[ValueErrorType["Null"] = 35] = "Null"; + ValueErrorType[ValueErrorType["NumberExclusiveMaximum"] = 36] = "NumberExclusiveMaximum"; + ValueErrorType[ValueErrorType["NumberExclusiveMinimum"] = 37] = "NumberExclusiveMinimum"; + ValueErrorType[ValueErrorType["NumberMaximum"] = 38] = "NumberMaximum"; + ValueErrorType[ValueErrorType["NumberMinimum"] = 39] = "NumberMinimum"; + ValueErrorType[ValueErrorType["NumberMultipleOf"] = 40] = "NumberMultipleOf"; + ValueErrorType[ValueErrorType["Number"] = 41] = "Number"; + ValueErrorType[ValueErrorType["ObjectAdditionalProperties"] = 42] = "ObjectAdditionalProperties"; + ValueErrorType[ValueErrorType["ObjectMaxProperties"] = 43] = "ObjectMaxProperties"; + ValueErrorType[ValueErrorType["ObjectMinProperties"] = 44] = "ObjectMinProperties"; + ValueErrorType[ValueErrorType["ObjectRequiredProperty"] = 45] = "ObjectRequiredProperty"; + ValueErrorType[ValueErrorType["Object"] = 46] = "Object"; + ValueErrorType[ValueErrorType["Promise"] = 47] = "Promise"; + ValueErrorType[ValueErrorType["RegExp"] = 48] = "RegExp"; + ValueErrorType[ValueErrorType["StringFormatUnknown"] = 49] = "StringFormatUnknown"; + ValueErrorType[ValueErrorType["StringFormat"] = 50] = "StringFormat"; + ValueErrorType[ValueErrorType["StringMaxLength"] = 51] = "StringMaxLength"; + ValueErrorType[ValueErrorType["StringMinLength"] = 52] = "StringMinLength"; + ValueErrorType[ValueErrorType["StringPattern"] = 53] = "StringPattern"; + ValueErrorType[ValueErrorType["String"] = 54] = "String"; + ValueErrorType[ValueErrorType["Symbol"] = 55] = "Symbol"; + ValueErrorType[ValueErrorType["TupleLength"] = 56] = "TupleLength"; + ValueErrorType[ValueErrorType["Tuple"] = 57] = "Tuple"; + ValueErrorType[ValueErrorType["Uint8ArrayMaxByteLength"] = 58] = "Uint8ArrayMaxByteLength"; + ValueErrorType[ValueErrorType["Uint8ArrayMinByteLength"] = 59] = "Uint8ArrayMinByteLength"; + ValueErrorType[ValueErrorType["Uint8Array"] = 60] = "Uint8Array"; + ValueErrorType[ValueErrorType["Undefined"] = 61] = "Undefined"; + ValueErrorType[ValueErrorType["Union"] = 62] = "Union"; + ValueErrorType[ValueErrorType["Void"] = 63] = "Void"; +})(ValueErrorType || (exports.ValueErrorType = ValueErrorType = {})); +// ------------------------------------------------------------------ +// ValueErrors +// ------------------------------------------------------------------ +class ValueErrorsUnknownTypeError extends index_4.TypeBoxError { + constructor(schema) { + super('Unknown type'); + this.schema = schema; + } +} +exports.ValueErrorsUnknownTypeError = ValueErrorsUnknownTypeError; +// ------------------------------------------------------------------ +// EscapeKey +// ------------------------------------------------------------------ +function EscapeKey(key) { + return key.replace(/~/g, '~0').replace(/\//g, '~1'); // RFC6901 Path +} +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +function IsDefined(value) { + return value !== undefined; +} +// ------------------------------------------------------------------ +// ValueErrorIterator +// ------------------------------------------------------------------ +class ValueErrorIterator { + constructor(iterator) { + this.iterator = iterator; + } + [Symbol.iterator]() { + return this.iterator; + } + /** Returns the first value error or undefined if no errors */ + First() { + const next = this.iterator.next(); + return next.done ? undefined : next.value; + } +} +exports.ValueErrorIterator = ValueErrorIterator; +// -------------------------------------------------------------------------- +// Create +// -------------------------------------------------------------------------- +function Create(errorType, schema, path, value, errors = []) { + return { + type: errorType, + schema, + path, + value, + message: (0, function_1.GetErrorFunction)()({ errorType, path, schema, value, errors }), + errors, + }; +} +// -------------------------------------------------------------------------- +// Types +// -------------------------------------------------------------------------- +function* FromAny(schema, references, path, value) { } +function* FromArgument(schema, references, path, value) { } +function* FromArray(schema, references, path, value) { + if (!(0, index_10.IsArray)(value)) { + return yield Create(ValueErrorType.Array, schema, path, value); + } + if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) { + yield Create(ValueErrorType.ArrayMinItems, schema, path, value); + } + if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) { + yield Create(ValueErrorType.ArrayMaxItems, schema, path, value); + } + for (let i = 0; i < value.length; i++) { + yield* Visit(schema.items, references, `${path}/${i}`, value[i]); + } + // prettier-ignore + if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) { + const hashed = (0, index_6.Hash)(element); + if (set.has(hashed)) { + return false; + } + else { + set.add(hashed); + } + } return true; })())) { + yield Create(ValueErrorType.ArrayUniqueItems, schema, path, value); + } + // contains + if (!(IsDefined(schema.contains) || IsDefined(schema.minContains) || IsDefined(schema.maxContains))) { + return; + } + const containsSchema = IsDefined(schema.contains) ? schema.contains : (0, index_9.Never)(); + const containsCount = value.reduce((acc, value, index) => (Visit(containsSchema, references, `${path}${index}`, value).next().done === true ? acc + 1 : acc), 0); + if (containsCount === 0) { + yield Create(ValueErrorType.ArrayContains, schema, path, value); + } + if ((0, index_10.IsNumber)(schema.minContains) && containsCount < schema.minContains) { + yield Create(ValueErrorType.ArrayMinContains, schema, path, value); + } + if ((0, index_10.IsNumber)(schema.maxContains) && containsCount > schema.maxContains) { + yield Create(ValueErrorType.ArrayMaxContains, schema, path, value); + } +} +function* FromAsyncIterator(schema, references, path, value) { + if (!(0, index_10.IsAsyncIterator)(value)) + yield Create(ValueErrorType.AsyncIterator, schema, path, value); +} +function* FromBigInt(schema, references, path, value) { + if (!(0, index_10.IsBigInt)(value)) + return yield Create(ValueErrorType.BigInt, schema, path, value); + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path, value); + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + yield Create(ValueErrorType.BigIntMaximum, schema, path, value); + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + yield Create(ValueErrorType.BigIntMinimum, schema, path, value); + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) { + yield Create(ValueErrorType.BigIntMultipleOf, schema, path, value); + } +} +function* FromBoolean(schema, references, path, value) { + if (!(0, index_10.IsBoolean)(value)) + yield Create(ValueErrorType.Boolean, schema, path, value); +} +function* FromConstructor(schema, references, path, value) { + yield* Visit(schema.returns, references, path, value.prototype); +} +function* FromDate(schema, references, path, value) { + if (!(0, index_10.IsDate)(value)) + return yield Create(ValueErrorType.Date, schema, path, value); + if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) { + yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) { + yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path, value); + } + if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) { + yield Create(ValueErrorType.DateMaximumTimestamp, schema, path, value); + } + if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) { + yield Create(ValueErrorType.DateMinimumTimestamp, schema, path, value); + } + if (IsDefined(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) { + yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path, value); + } +} +function* FromFunction(schema, references, path, value) { + if (!(0, index_10.IsFunction)(value)) + yield Create(ValueErrorType.Function, schema, path, value); +} +function* FromImport(schema, references, path, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + yield* Visit(target, [...references, ...definitions], path, value); +} +function* FromInteger(schema, references, path, value) { + if (!(0, index_10.IsInteger)(value)) + return yield Create(ValueErrorType.Integer, schema, path, value); + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path, value); + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + yield Create(ValueErrorType.IntegerMaximum, schema, path, value); + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + yield Create(ValueErrorType.IntegerMinimum, schema, path, value); + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + yield Create(ValueErrorType.IntegerMultipleOf, schema, path, value); + } +} +function* FromIntersect(schema, references, path, value) { + let hasError = false; + for (const inner of schema.allOf) { + for (const error of Visit(inner, references, path, value)) { + hasError = true; + yield error; + } + } + if (hasError) { + return yield Create(ValueErrorType.Intersect, schema, path, value); + } + if (schema.unevaluatedProperties === false) { + const keyCheck = new RegExp((0, index_2.KeyOfPattern)(schema)); + for (const valueKey of Object.getOwnPropertyNames(value)) { + if (!keyCheck.test(valueKey)) { + yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path}/${valueKey}`, value); + } + } + } + if (typeof schema.unevaluatedProperties === 'object') { + const keyCheck = new RegExp((0, index_2.KeyOfPattern)(schema)); + for (const valueKey of Object.getOwnPropertyNames(value)) { + if (!keyCheck.test(valueKey)) { + const next = Visit(schema.unevaluatedProperties, references, `${path}/${valueKey}`, value[valueKey]).next(); + if (!next.done) + yield next.value; // yield interior + } + } + } +} +function* FromIterator(schema, references, path, value) { + if (!(0, index_10.IsIterator)(value)) + yield Create(ValueErrorType.Iterator, schema, path, value); +} +function* FromLiteral(schema, references, path, value) { + if (!(value === schema.const)) + yield Create(ValueErrorType.Literal, schema, path, value); +} +function* FromNever(schema, references, path, value) { + yield Create(ValueErrorType.Never, schema, path, value); +} +function* FromNot(schema, references, path, value) { + if (Visit(schema.not, references, path, value).next().done === true) + yield Create(ValueErrorType.Not, schema, path, value); +} +function* FromNull(schema, references, path, value) { + if (!(0, index_10.IsNull)(value)) + yield Create(ValueErrorType.Null, schema, path, value); +} +function* FromNumber(schema, references, path, value) { + if (!index_1.TypeSystemPolicy.IsNumberLike(value)) + return yield Create(ValueErrorType.Number, schema, path, value); + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path, value); + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + yield Create(ValueErrorType.NumberMaximum, schema, path, value); + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + yield Create(ValueErrorType.NumberMinimum, schema, path, value); + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + yield Create(ValueErrorType.NumberMultipleOf, schema, path, value); + } +} +function* FromObject(schema, references, path, value) { + if (!index_1.TypeSystemPolicy.IsObjectLike(value)) + return yield Create(ValueErrorType.Object, schema, path, value); + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + yield Create(ValueErrorType.ObjectMinProperties, schema, path, value); + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + yield Create(ValueErrorType.ObjectMaxProperties, schema, path, value); + } + const requiredKeys = Array.isArray(schema.required) ? schema.required : []; + const knownKeys = Object.getOwnPropertyNames(schema.properties); + const unknownKeys = Object.getOwnPropertyNames(value); + for (const requiredKey of requiredKeys) { + if (unknownKeys.includes(requiredKey)) + continue; + yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path}/${EscapeKey(requiredKey)}`, undefined); + } + if (schema.additionalProperties === false) { + for (const valueKey of unknownKeys) { + if (!knownKeys.includes(valueKey)) { + yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path}/${EscapeKey(valueKey)}`, value[valueKey]); + } + } + } + if (typeof schema.additionalProperties === 'object') { + for (const valueKey of unknownKeys) { + if (knownKeys.includes(valueKey)) + continue; + yield* Visit(schema.additionalProperties, references, `${path}/${EscapeKey(valueKey)}`, value[valueKey]); + } + } + for (const knownKey of knownKeys) { + const property = schema.properties[knownKey]; + if (schema.required && schema.required.includes(knownKey)) { + yield* Visit(property, references, `${path}/${EscapeKey(knownKey)}`, value[knownKey]); + if ((0, extends_undefined_1.ExtendsUndefinedCheck)(schema) && !(knownKey in value)) { + yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path}/${EscapeKey(knownKey)}`, undefined); + } + } + else { + if (index_1.TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) { + yield* Visit(property, references, `${path}/${EscapeKey(knownKey)}`, value[knownKey]); + } + } + } +} +function* FromPromise(schema, references, path, value) { + if (!(0, index_10.IsPromise)(value)) + yield Create(ValueErrorType.Promise, schema, path, value); +} +function* FromRecord(schema, references, path, value) { + if (!index_1.TypeSystemPolicy.IsRecordLike(value)) + return yield Create(ValueErrorType.Object, schema, path, value); + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + yield Create(ValueErrorType.ObjectMinProperties, schema, path, value); + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + yield Create(ValueErrorType.ObjectMaxProperties, schema, path, value); + } + const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0]; + const regex = new RegExp(patternKey); + for (const [propertyKey, propertyValue] of Object.entries(value)) { + if (regex.test(propertyKey)) + yield* Visit(patternSchema, references, `${path}/${EscapeKey(propertyKey)}`, propertyValue); + } + if (typeof schema.additionalProperties === 'object') { + for (const [propertyKey, propertyValue] of Object.entries(value)) { + if (!regex.test(propertyKey)) + yield* Visit(schema.additionalProperties, references, `${path}/${EscapeKey(propertyKey)}`, propertyValue); + } + } + if (schema.additionalProperties === false) { + for (const [propertyKey, propertyValue] of Object.entries(value)) { + if (regex.test(propertyKey)) + continue; + return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path}/${EscapeKey(propertyKey)}`, propertyValue); + } + } +} +function* FromRef(schema, references, path, value) { + yield* Visit((0, index_5.Deref)(schema, references), references, path, value); +} +function* FromRegExp(schema, references, path, value) { + if (!(0, index_10.IsString)(value)) + return yield Create(ValueErrorType.String, schema, path, value); + if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) { + yield Create(ValueErrorType.StringMinLength, schema, path, value); + } + if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) { + yield Create(ValueErrorType.StringMaxLength, schema, path, value); + } + const regex = new RegExp(schema.source, schema.flags); + if (!regex.test(value)) { + return yield Create(ValueErrorType.RegExp, schema, path, value); + } +} +function* FromString(schema, references, path, value) { + if (!(0, index_10.IsString)(value)) + return yield Create(ValueErrorType.String, schema, path, value); + if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) { + yield Create(ValueErrorType.StringMinLength, schema, path, value); + } + if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) { + yield Create(ValueErrorType.StringMaxLength, schema, path, value); + } + if ((0, index_10.IsString)(schema.pattern)) { + const regex = new RegExp(schema.pattern); + if (!regex.test(value)) { + yield Create(ValueErrorType.StringPattern, schema, path, value); + } + } + if ((0, index_10.IsString)(schema.format)) { + if (!index_3.FormatRegistry.Has(schema.format)) { + yield Create(ValueErrorType.StringFormatUnknown, schema, path, value); + } + else { + const format = index_3.FormatRegistry.Get(schema.format); + if (!format(value)) { + yield Create(ValueErrorType.StringFormat, schema, path, value); + } + } + } +} +function* FromSymbol(schema, references, path, value) { + if (!(0, index_10.IsSymbol)(value)) + yield Create(ValueErrorType.Symbol, schema, path, value); +} +function* FromTemplateLiteral(schema, references, path, value) { + if (!(0, index_10.IsString)(value)) + return yield Create(ValueErrorType.String, schema, path, value); + const regex = new RegExp(schema.pattern); + if (!regex.test(value)) { + yield Create(ValueErrorType.StringPattern, schema, path, value); + } +} +function* FromThis(schema, references, path, value) { + yield* Visit((0, index_5.Deref)(schema, references), references, path, value); +} +function* FromTuple(schema, references, path, value) { + if (!(0, index_10.IsArray)(value)) + return yield Create(ValueErrorType.Tuple, schema, path, value); + if (schema.items === undefined && !(value.length === 0)) { + return yield Create(ValueErrorType.TupleLength, schema, path, value); + } + if (!(value.length === schema.maxItems)) { + return yield Create(ValueErrorType.TupleLength, schema, path, value); + } + if (!schema.items) { + return; + } + for (let i = 0; i < schema.items.length; i++) { + yield* Visit(schema.items[i], references, `${path}/${i}`, value[i]); + } +} +function* FromUndefined(schema, references, path, value) { + if (!(0, index_10.IsUndefined)(value)) + yield Create(ValueErrorType.Undefined, schema, path, value); +} +function* FromUnion(schema, references, path, value) { + if ((0, index_7.Check)(schema, references, value)) + return; + const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit(variant, references, path, value))); + yield Create(ValueErrorType.Union, schema, path, value, errors); +} +function* FromUint8Array(schema, references, path, value) { + if (!(0, index_10.IsUint8Array)(value)) + return yield Create(ValueErrorType.Uint8Array, schema, path, value); + if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) { + yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path, value); + } + if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) { + yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path, value); + } +} +function* FromUnknown(schema, references, path, value) { } +function* FromVoid(schema, references, path, value) { + if (!index_1.TypeSystemPolicy.IsVoidLike(value)) + yield Create(ValueErrorType.Void, schema, path, value); +} +function* FromKind(schema, references, path, value) { + const check = index_3.TypeRegistry.Get(schema[index_8.Kind]); + if (!check(schema, value)) + yield Create(ValueErrorType.Kind, schema, path, value); +} +function* Visit(schema, references, path, value) { + const references_ = IsDefined(schema.$id) ? [...references, schema] : references; + const schema_ = schema; + switch (schema_[index_8.Kind]) { + case 'Any': + return yield* FromAny(schema_, references_, path, value); + case 'Argument': + return yield* FromArgument(schema_, references_, path, value); + case 'Array': + return yield* FromArray(schema_, references_, path, value); + case 'AsyncIterator': + return yield* FromAsyncIterator(schema_, references_, path, value); + case 'BigInt': + return yield* FromBigInt(schema_, references_, path, value); + case 'Boolean': + return yield* FromBoolean(schema_, references_, path, value); + case 'Constructor': + return yield* FromConstructor(schema_, references_, path, value); + case 'Date': + return yield* FromDate(schema_, references_, path, value); + case 'Function': + return yield* FromFunction(schema_, references_, path, value); + case 'Import': + return yield* FromImport(schema_, references_, path, value); + case 'Integer': + return yield* FromInteger(schema_, references_, path, value); + case 'Intersect': + return yield* FromIntersect(schema_, references_, path, value); + case 'Iterator': + return yield* FromIterator(schema_, references_, path, value); + case 'Literal': + return yield* FromLiteral(schema_, references_, path, value); + case 'Never': + return yield* FromNever(schema_, references_, path, value); + case 'Not': + return yield* FromNot(schema_, references_, path, value); + case 'Null': + return yield* FromNull(schema_, references_, path, value); + case 'Number': + return yield* FromNumber(schema_, references_, path, value); + case 'Object': + return yield* FromObject(schema_, references_, path, value); + case 'Promise': + return yield* FromPromise(schema_, references_, path, value); + case 'Record': + return yield* FromRecord(schema_, references_, path, value); + case 'Ref': + return yield* FromRef(schema_, references_, path, value); + case 'RegExp': + return yield* FromRegExp(schema_, references_, path, value); + case 'String': + return yield* FromString(schema_, references_, path, value); + case 'Symbol': + return yield* FromSymbol(schema_, references_, path, value); + case 'TemplateLiteral': + return yield* FromTemplateLiteral(schema_, references_, path, value); + case 'This': + return yield* FromThis(schema_, references_, path, value); + case 'Tuple': + return yield* FromTuple(schema_, references_, path, value); + case 'Undefined': + return yield* FromUndefined(schema_, references_, path, value); + case 'Union': + return yield* FromUnion(schema_, references_, path, value); + case 'Uint8Array': + return yield* FromUint8Array(schema_, references_, path, value); + case 'Unknown': + return yield* FromUnknown(schema_, references_, path, value); + case 'Void': + return yield* FromVoid(schema_, references_, path, value); + default: + if (!index_3.TypeRegistry.Has(schema_[index_8.Kind])) + throw new ValueErrorsUnknownTypeError(schema); + return yield* FromKind(schema_, references_, path, value); + } +} +/** Returns an iterator for each error in this value. */ +function Errors(...args) { + const iterator = args.length === 3 ? Visit(args[0], args[1], '', args[2]) : Visit(args[0], [], '', args[1]); + return new ValueErrorIterator(iterator); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/errors/function.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/errors/function.d.ts new file mode 100644 index 0000000..bfe0c33 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/errors/function.d.ts @@ -0,0 +1,21 @@ +import { TSchema } from '../type/schema/index'; +import { ValueErrorIterator, ValueErrorType } from './errors'; +/** Creates an error message using en-US as the default locale */ +export declare function DefaultErrorFunction(error: ErrorFunctionParameter): string; +export type ErrorFunctionParameter = { + /** The type of validation error */ + errorType: ValueErrorType; + /** The path of the error */ + path: string; + /** The schema associated with the error */ + schema: TSchema; + /** The value associated with the error */ + value: unknown; + /** Interior errors for this error */ + errors: ValueErrorIterator[]; +}; +export type ErrorFunction = (parameter: ErrorFunctionParameter) => string; +/** Sets the error function used to generate error messages. */ +export declare function SetErrorFunction(callback: ErrorFunction): void; +/** Gets the error function used to generate error messages */ +export declare function GetErrorFunction(): ErrorFunction; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/errors/function.js b/ui/node_modules/@sinclair/typebox/build/cjs/errors/function.js new file mode 100644 index 0000000..8dee6aa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/errors/function.js @@ -0,0 +1,153 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DefaultErrorFunction = DefaultErrorFunction; +exports.SetErrorFunction = SetErrorFunction; +exports.GetErrorFunction = GetErrorFunction; +const index_1 = require("../type/symbols/index"); +const errors_1 = require("./errors"); +/** Creates an error message using en-US as the default locale */ +function DefaultErrorFunction(error) { + switch (error.errorType) { + case errors_1.ValueErrorType.ArrayContains: + return 'Expected array to contain at least one matching value'; + case errors_1.ValueErrorType.ArrayMaxContains: + return `Expected array to contain no more than ${error.schema.maxContains} matching values`; + case errors_1.ValueErrorType.ArrayMinContains: + return `Expected array to contain at least ${error.schema.minContains} matching values`; + case errors_1.ValueErrorType.ArrayMaxItems: + return `Expected array length to be less or equal to ${error.schema.maxItems}`; + case errors_1.ValueErrorType.ArrayMinItems: + return `Expected array length to be greater or equal to ${error.schema.minItems}`; + case errors_1.ValueErrorType.ArrayUniqueItems: + return 'Expected array elements to be unique'; + case errors_1.ValueErrorType.Array: + return 'Expected array'; + case errors_1.ValueErrorType.AsyncIterator: + return 'Expected AsyncIterator'; + case errors_1.ValueErrorType.BigIntExclusiveMaximum: + return `Expected bigint to be less than ${error.schema.exclusiveMaximum}`; + case errors_1.ValueErrorType.BigIntExclusiveMinimum: + return `Expected bigint to be greater than ${error.schema.exclusiveMinimum}`; + case errors_1.ValueErrorType.BigIntMaximum: + return `Expected bigint to be less or equal to ${error.schema.maximum}`; + case errors_1.ValueErrorType.BigIntMinimum: + return `Expected bigint to be greater or equal to ${error.schema.minimum}`; + case errors_1.ValueErrorType.BigIntMultipleOf: + return `Expected bigint to be a multiple of ${error.schema.multipleOf}`; + case errors_1.ValueErrorType.BigInt: + return 'Expected bigint'; + case errors_1.ValueErrorType.Boolean: + return 'Expected boolean'; + case errors_1.ValueErrorType.DateExclusiveMinimumTimestamp: + return `Expected Date timestamp to be greater than ${error.schema.exclusiveMinimumTimestamp}`; + case errors_1.ValueErrorType.DateExclusiveMaximumTimestamp: + return `Expected Date timestamp to be less than ${error.schema.exclusiveMaximumTimestamp}`; + case errors_1.ValueErrorType.DateMinimumTimestamp: + return `Expected Date timestamp to be greater or equal to ${error.schema.minimumTimestamp}`; + case errors_1.ValueErrorType.DateMaximumTimestamp: + return `Expected Date timestamp to be less or equal to ${error.schema.maximumTimestamp}`; + case errors_1.ValueErrorType.DateMultipleOfTimestamp: + return `Expected Date timestamp to be a multiple of ${error.schema.multipleOfTimestamp}`; + case errors_1.ValueErrorType.Date: + return 'Expected Date'; + case errors_1.ValueErrorType.Function: + return 'Expected function'; + case errors_1.ValueErrorType.IntegerExclusiveMaximum: + return `Expected integer to be less than ${error.schema.exclusiveMaximum}`; + case errors_1.ValueErrorType.IntegerExclusiveMinimum: + return `Expected integer to be greater than ${error.schema.exclusiveMinimum}`; + case errors_1.ValueErrorType.IntegerMaximum: + return `Expected integer to be less or equal to ${error.schema.maximum}`; + case errors_1.ValueErrorType.IntegerMinimum: + return `Expected integer to be greater or equal to ${error.schema.minimum}`; + case errors_1.ValueErrorType.IntegerMultipleOf: + return `Expected integer to be a multiple of ${error.schema.multipleOf}`; + case errors_1.ValueErrorType.Integer: + return 'Expected integer'; + case errors_1.ValueErrorType.IntersectUnevaluatedProperties: + return 'Unexpected property'; + case errors_1.ValueErrorType.Intersect: + return 'Expected all values to match'; + case errors_1.ValueErrorType.Iterator: + return 'Expected Iterator'; + case errors_1.ValueErrorType.Literal: + return `Expected ${typeof error.schema.const === 'string' ? `'${error.schema.const}'` : error.schema.const}`; + case errors_1.ValueErrorType.Never: + return 'Never'; + case errors_1.ValueErrorType.Not: + return 'Value should not match'; + case errors_1.ValueErrorType.Null: + return 'Expected null'; + case errors_1.ValueErrorType.NumberExclusiveMaximum: + return `Expected number to be less than ${error.schema.exclusiveMaximum}`; + case errors_1.ValueErrorType.NumberExclusiveMinimum: + return `Expected number to be greater than ${error.schema.exclusiveMinimum}`; + case errors_1.ValueErrorType.NumberMaximum: + return `Expected number to be less or equal to ${error.schema.maximum}`; + case errors_1.ValueErrorType.NumberMinimum: + return `Expected number to be greater or equal to ${error.schema.minimum}`; + case errors_1.ValueErrorType.NumberMultipleOf: + return `Expected number to be a multiple of ${error.schema.multipleOf}`; + case errors_1.ValueErrorType.Number: + return 'Expected number'; + case errors_1.ValueErrorType.Object: + return 'Expected object'; + case errors_1.ValueErrorType.ObjectAdditionalProperties: + return 'Unexpected property'; + case errors_1.ValueErrorType.ObjectMaxProperties: + return `Expected object to have no more than ${error.schema.maxProperties} properties`; + case errors_1.ValueErrorType.ObjectMinProperties: + return `Expected object to have at least ${error.schema.minProperties} properties`; + case errors_1.ValueErrorType.ObjectRequiredProperty: + return 'Expected required property'; + case errors_1.ValueErrorType.Promise: + return 'Expected Promise'; + case errors_1.ValueErrorType.RegExp: + return 'Expected string to match regular expression'; + case errors_1.ValueErrorType.StringFormatUnknown: + return `Unknown format '${error.schema.format}'`; + case errors_1.ValueErrorType.StringFormat: + return `Expected string to match '${error.schema.format}' format`; + case errors_1.ValueErrorType.StringMaxLength: + return `Expected string length less or equal to ${error.schema.maxLength}`; + case errors_1.ValueErrorType.StringMinLength: + return `Expected string length greater or equal to ${error.schema.minLength}`; + case errors_1.ValueErrorType.StringPattern: + return `Expected string to match '${error.schema.pattern}'`; + case errors_1.ValueErrorType.String: + return 'Expected string'; + case errors_1.ValueErrorType.Symbol: + return 'Expected symbol'; + case errors_1.ValueErrorType.TupleLength: + return `Expected tuple to have ${error.schema.maxItems || 0} elements`; + case errors_1.ValueErrorType.Tuple: + return 'Expected tuple'; + case errors_1.ValueErrorType.Uint8ArrayMaxByteLength: + return `Expected byte length less or equal to ${error.schema.maxByteLength}`; + case errors_1.ValueErrorType.Uint8ArrayMinByteLength: + return `Expected byte length greater or equal to ${error.schema.minByteLength}`; + case errors_1.ValueErrorType.Uint8Array: + return 'Expected Uint8Array'; + case errors_1.ValueErrorType.Undefined: + return 'Expected undefined'; + case errors_1.ValueErrorType.Union: + return 'Expected union value'; + case errors_1.ValueErrorType.Void: + return 'Expected void'; + case errors_1.ValueErrorType.Kind: + return `Expected kind '${error.schema[index_1.Kind]}'`; + default: + return 'Unknown error type'; + } +} +/** Manages error message providers */ +let errorFunction = DefaultErrorFunction; +/** Sets the error function used to generate error messages. */ +function SetErrorFunction(callback) { + errorFunction = callback; +} +/** Gets the error function used to generate error messages */ +function GetErrorFunction() { + return errorFunction; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/errors/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/errors/index.d.ts new file mode 100644 index 0000000..9c36fce --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/errors/index.d.ts @@ -0,0 +1,2 @@ +export * from './errors'; +export * from './function'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/errors/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/errors/index.js new file mode 100644 index 0000000..65d0c5a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/errors/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./errors"), exports); +__exportStar(require("./function"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/index.d.ts new file mode 100644 index 0000000..46146e4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/index.d.ts @@ -0,0 +1,71 @@ +export * from './type/clone/index'; +export * from './type/create/index'; +export * from './type/error/index'; +export * from './type/guard/index'; +export * from './type/helpers/index'; +export * from './type/patterns/index'; +export * from './type/registry/index'; +export * from './type/sets/index'; +export * from './type/symbols/index'; +export * from './type/any/index'; +export * from './type/array/index'; +export * from './type/argument/index'; +export * from './type/async-iterator/index'; +export * from './type/awaited/index'; +export * from './type/bigint/index'; +export * from './type/boolean/index'; +export * from './type/composite/index'; +export * from './type/const/index'; +export * from './type/constructor/index'; +export * from './type/constructor-parameters/index'; +export * from './type/date/index'; +export * from './type/enum/index'; +export * from './type/exclude/index'; +export * from './type/extends/index'; +export * from './type/extract/index'; +export * from './type/function/index'; +export * from './type/indexed/index'; +export * from './type/instance-type/index'; +export * from './type/instantiate/index'; +export * from './type/integer/index'; +export * from './type/intersect/index'; +export * from './type/iterator/index'; +export * from './type/intrinsic/index'; +export * from './type/keyof/index'; +export * from './type/literal/index'; +export * from './type/module/index'; +export * from './type/mapped/index'; +export * from './type/never/index'; +export * from './type/not/index'; +export * from './type/null/index'; +export * from './type/number/index'; +export * from './type/object/index'; +export * from './type/omit/index'; +export * from './type/optional/index'; +export * from './type/parameters/index'; +export * from './type/partial/index'; +export * from './type/pick/index'; +export * from './type/promise/index'; +export * from './type/readonly/index'; +export * from './type/readonly-optional/index'; +export * from './type/record/index'; +export * from './type/recursive/index'; +export * from './type/ref/index'; +export * from './type/regexp/index'; +export * from './type/required/index'; +export * from './type/rest/index'; +export * from './type/return-type/index'; +export * from './type/schema/index'; +export * from './type/static/index'; +export * from './type/string/index'; +export * from './type/symbol/index'; +export * from './type/template-literal/index'; +export * from './type/transform/index'; +export * from './type/tuple/index'; +export * from './type/uint8array/index'; +export * from './type/undefined/index'; +export * from './type/union/index'; +export * from './type/unknown/index'; +export * from './type/unsafe/index'; +export * from './type/void/index'; +export * from './type/type/index'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/index.js new file mode 100644 index 0000000..f278dec --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/index.js @@ -0,0 +1,97 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +// ------------------------------------------------------------------ +// Infrastructure +// ------------------------------------------------------------------ +__exportStar(require("./type/clone/index"), exports); +__exportStar(require("./type/create/index"), exports); +__exportStar(require("./type/error/index"), exports); +__exportStar(require("./type/guard/index"), exports); +__exportStar(require("./type/helpers/index"), exports); +__exportStar(require("./type/patterns/index"), exports); +__exportStar(require("./type/registry/index"), exports); +__exportStar(require("./type/sets/index"), exports); +__exportStar(require("./type/symbols/index"), exports); +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +__exportStar(require("./type/any/index"), exports); +__exportStar(require("./type/array/index"), exports); +__exportStar(require("./type/argument/index"), exports); +__exportStar(require("./type/async-iterator/index"), exports); +__exportStar(require("./type/awaited/index"), exports); +__exportStar(require("./type/bigint/index"), exports); +__exportStar(require("./type/boolean/index"), exports); +__exportStar(require("./type/composite/index"), exports); +__exportStar(require("./type/const/index"), exports); +__exportStar(require("./type/constructor/index"), exports); +__exportStar(require("./type/constructor-parameters/index"), exports); +__exportStar(require("./type/date/index"), exports); +__exportStar(require("./type/enum/index"), exports); +__exportStar(require("./type/exclude/index"), exports); +__exportStar(require("./type/extends/index"), exports); +__exportStar(require("./type/extract/index"), exports); +__exportStar(require("./type/function/index"), exports); +__exportStar(require("./type/indexed/index"), exports); +__exportStar(require("./type/instance-type/index"), exports); +__exportStar(require("./type/instantiate/index"), exports); +__exportStar(require("./type/integer/index"), exports); +__exportStar(require("./type/intersect/index"), exports); +__exportStar(require("./type/iterator/index"), exports); +__exportStar(require("./type/intrinsic/index"), exports); +__exportStar(require("./type/keyof/index"), exports); +__exportStar(require("./type/literal/index"), exports); +__exportStar(require("./type/module/index"), exports); +__exportStar(require("./type/mapped/index"), exports); +__exportStar(require("./type/never/index"), exports); +__exportStar(require("./type/not/index"), exports); +__exportStar(require("./type/null/index"), exports); +__exportStar(require("./type/number/index"), exports); +__exportStar(require("./type/object/index"), exports); +__exportStar(require("./type/omit/index"), exports); +__exportStar(require("./type/optional/index"), exports); +__exportStar(require("./type/parameters/index"), exports); +__exportStar(require("./type/partial/index"), exports); +__exportStar(require("./type/pick/index"), exports); +__exportStar(require("./type/promise/index"), exports); +__exportStar(require("./type/readonly/index"), exports); +__exportStar(require("./type/readonly-optional/index"), exports); +__exportStar(require("./type/record/index"), exports); +__exportStar(require("./type/recursive/index"), exports); +__exportStar(require("./type/ref/index"), exports); +__exportStar(require("./type/regexp/index"), exports); +__exportStar(require("./type/required/index"), exports); +__exportStar(require("./type/rest/index"), exports); +__exportStar(require("./type/return-type/index"), exports); +__exportStar(require("./type/schema/index"), exports); +__exportStar(require("./type/static/index"), exports); +__exportStar(require("./type/string/index"), exports); +__exportStar(require("./type/symbol/index"), exports); +__exportStar(require("./type/template-literal/index"), exports); +__exportStar(require("./type/transform/index"), exports); +__exportStar(require("./type/tuple/index"), exports); +__exportStar(require("./type/uint8array/index"), exports); +__exportStar(require("./type/undefined/index"), exports); +__exportStar(require("./type/union/index"), exports); +__exportStar(require("./type/unknown/index"), exports); +__exportStar(require("./type/unsafe/index"), exports); +__exportStar(require("./type/void/index"), exports); +// ------------------------------------------------------------------ +// Type.* +// ------------------------------------------------------------------ +__exportStar(require("./type/type/index"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/index.d.ts new file mode 100644 index 0000000..2198e56 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/index.d.ts @@ -0,0 +1,2 @@ +export * as Runtime from './runtime/index'; +export * as Static from './static/index'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/index.js new file mode 100644 index 0000000..1e0ad78 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/index.js @@ -0,0 +1,39 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Static = exports.Runtime = void 0; +exports.Runtime = __importStar(require("./runtime/index")); +exports.Static = __importStar(require("./static/index")); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.d.ts new file mode 100644 index 0000000..9698911 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.d.ts @@ -0,0 +1,23 @@ +import { IArray, IConst, IContext, IIdent, INumber, IOptional, IRef, IString, ITuple, IUnion } from './types'; +/** Returns true if the value is a Array Parser */ +export declare function IsArray(value: unknown): value is IArray; +/** Returns true if the value is a Const Parser */ +export declare function IsConst(value: unknown): value is IConst; +/** Returns true if the value is a Context Parser */ +export declare function IsContext(value: unknown): value is IContext; +/** Returns true if the value is a Ident Parser */ +export declare function IsIdent(value: unknown): value is IIdent; +/** Returns true if the value is a Number Parser */ +export declare function IsNumber(value: unknown): value is INumber; +/** Returns true if the value is a Optional Parser */ +export declare function IsOptional(value: unknown): value is IOptional; +/** Returns true if the value is a Ref Parser */ +export declare function IsRef(value: unknown): value is IRef; +/** Returns true if the value is a String Parser */ +export declare function IsString(value: unknown): value is IString; +/** Returns true if the value is a Tuple Parser */ +export declare function IsTuple(value: unknown): value is ITuple; +/** Returns true if the value is a Union Parser */ +export declare function IsUnion(value: unknown): value is IUnion; +/** Returns true if the value is a Parser */ +export declare function IsParser(value: unknown): value is IContext | IUnion | IArray | IConst | IIdent | INumber | IOptional | IRef | IString | ITuple; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.js new file mode 100644 index 0000000..30b0673 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/guard.js @@ -0,0 +1,86 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsArray = IsArray; +exports.IsConst = IsConst; +exports.IsContext = IsContext; +exports.IsIdent = IsIdent; +exports.IsNumber = IsNumber; +exports.IsOptional = IsOptional; +exports.IsRef = IsRef; +exports.IsString = IsString; +exports.IsTuple = IsTuple; +exports.IsUnion = IsUnion; +exports.IsParser = IsParser; +// ------------------------------------------------------------------ +// Value Guard +// ------------------------------------------------------------------ +// prettier-ignore +function HasPropertyKey(value, key) { + return key in value; +} +// prettier-ignore +function IsObjectValue(value) { + return typeof value === 'object' && value !== null; +} +// prettier-ignore +function IsArrayValue(value) { + return globalThis.Array.isArray(value); +} +// ------------------------------------------------------------------ +// Parser Guard +// ------------------------------------------------------------------ +/** Returns true if the value is a Array Parser */ +function IsArray(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Array' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser); +} +/** Returns true if the value is a Const Parser */ +function IsConst(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Const' && HasPropertyKey(value, 'value') && typeof value.value === 'string'; +} +/** Returns true if the value is a Context Parser */ +function IsContext(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Context' && HasPropertyKey(value, 'left') && IsParser(value.left) && HasPropertyKey(value, 'right') && IsParser(value.right); +} +/** Returns true if the value is a Ident Parser */ +function IsIdent(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ident'; +} +/** Returns true if the value is a Number Parser */ +function IsNumber(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Number'; +} +/** Returns true if the value is a Optional Parser */ +function IsOptional(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Optional' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser); +} +/** Returns true if the value is a Ref Parser */ +function IsRef(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ref' && HasPropertyKey(value, 'ref') && typeof value.ref === 'string'; +} +/** Returns true if the value is a String Parser */ +function IsString(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'String' && HasPropertyKey(value, 'options') && IsArrayValue(value.options); +} +/** Returns true if the value is a Tuple Parser */ +function IsTuple(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Tuple' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers); +} +/** Returns true if the value is a Union Parser */ +function IsUnion(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Union' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers); +} +/** Returns true if the value is a Parser */ +function IsParser(value) { + // prettier-ignore + return (IsArray(value) || + IsConst(value) || + IsContext(value) || + IsIdent(value) || + IsNumber(value) || + IsOptional(value) || + IsRef(value) || + IsString(value) || + IsTuple(value) || + IsUnion(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.d.ts new file mode 100644 index 0000000..1f149ed --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.d.ts @@ -0,0 +1,5 @@ +export * as Guard from './guard'; +export * as Token from './token'; +export * from './types'; +export * from './module'; +export * from './parse'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.js new file mode 100644 index 0000000..cb90e00 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/index.js @@ -0,0 +1,45 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Token = exports.Guard = void 0; +exports.Guard = __importStar(require("./guard")); +exports.Token = __importStar(require("./token")); +__exportStar(require("./types"), exports); +__exportStar(require("./module"), exports); +__exportStar(require("./parse"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.d.ts new file mode 100644 index 0000000..747a12b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.d.ts @@ -0,0 +1,9 @@ +import * as Types from './types'; +export declare class Module { + private readonly properties; + constructor(properties: Properties); + /** Parses using one of the parsers defined on this instance */ + Parse(key: Key, content: string, context: unknown): [] | [Types.StaticParser, string]; + /** Parses using one of the parsers defined on this instance */ + Parse(key: Key, content: string): [] | [Types.StaticParser, string]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.js new file mode 100644 index 0000000..ca8d663 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/module.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Module = void 0; +const parse_1 = require("./parse"); +// ------------------------------------------------------------------ +// Module +// ------------------------------------------------------------------ +class Module { + constructor(properties) { + this.properties = properties; + } + /** Parses using one of the parsers defined on this instance */ + Parse(...args) { + // prettier-ignore + const [key, content, context] = (args.length === 3 ? [args[0], args[1], args[2]] : + args.length === 2 ? [args[0], args[1], undefined] : + (() => { throw Error('Invalid parse arguments'); })()); + return (0, parse_1.Parse)(this.properties, this.properties[key], content, context); + } +} +exports.Module = Module; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.d.ts new file mode 100644 index 0000000..90cb311 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.d.ts @@ -0,0 +1,9 @@ +import * as Types from './types'; +/** Parses content using the given Parser */ +export declare function Parse(moduleProperties: Types.IModuleProperties, parser: Parser, code: string, context: unknown): [] | [Types.StaticParser, string]; +/** Parses content using the given Parser */ +export declare function Parse(moduleProperties: Types.IModuleProperties, parser: Parser, code: string): [] | [Types.StaticParser, string]; +/** Parses content using the given Parser */ +export declare function Parse(parser: Parser, content: string, context: unknown): [] | [Types.StaticParser, string]; +/** Parses content using the given Parser */ +export declare function Parse(parser: Parser, content: string): [] | [Types.StaticParser, string]; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.js new file mode 100644 index 0000000..e692e69 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/parse.js @@ -0,0 +1,160 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Parse = Parse; +const Guard = __importStar(require("./guard")); +const Token = __importStar(require("./token")); +// ------------------------------------------------------------------ +// Context +// ------------------------------------------------------------------ +function ParseContext(moduleProperties, left, right, code, context) { + const result = ParseParser(moduleProperties, left, code, context); + return result.length === 2 ? ParseParser(moduleProperties, right, result[1], result[0]) : []; +} +// ------------------------------------------------------------------ +// Array +// ------------------------------------------------------------------ +function ParseArray(moduleProperties, parser, code, context) { + const buffer = []; + let rest = code; + while (rest.length > 0) { + const result = ParseParser(moduleProperties, parser, rest, context); + if (result.length === 0) + return [buffer, rest]; + buffer.push(result[0]); + rest = result[1]; + } + return [buffer, rest]; +} +// ------------------------------------------------------------------ +// Const +// ------------------------------------------------------------------ +function ParseConst(value, code, context) { + return Token.Const(value, code); +} +// ------------------------------------------------------------------ +// Ident +// ------------------------------------------------------------------ +function ParseIdent(code, _context) { + return Token.Ident(code); +} +// ------------------------------------------------------------------ +// Number +// ------------------------------------------------------------------ +// prettier-ignore +function ParseNumber(code, _context) { + return Token.Number(code); +} +// ------------------------------------------------------------------ +// Optional +// ------------------------------------------------------------------ +function ParseOptional(moduleProperties, parser, code, context) { + const result = ParseParser(moduleProperties, parser, code, context); + return (result.length === 2 ? [[result[0]], result[1]] : [[], code]); +} +// ------------------------------------------------------------------ +// Ref +// ------------------------------------------------------------------ +function ParseRef(moduleProperties, ref, code, context) { + const parser = moduleProperties[ref]; + if (!Guard.IsParser(parser)) + throw Error(`Cannot dereference Parser '${ref}'`); + return ParseParser(moduleProperties, parser, code, context); +} +// ------------------------------------------------------------------ +// String +// ------------------------------------------------------------------ +// prettier-ignore +function ParseString(options, code, _context) { + return Token.String(options, code); +} +// ------------------------------------------------------------------ +// Tuple +// ------------------------------------------------------------------ +function ParseTuple(moduleProperties, parsers, code, context) { + const buffer = []; + let rest = code; + for (const parser of parsers) { + const result = ParseParser(moduleProperties, parser, rest, context); + if (result.length === 0) + return []; + buffer.push(result[0]); + rest = result[1]; + } + return [buffer, rest]; +} +// ------------------------------------------------------------------ +// Union +// ------------------------------------------------------------------ +// prettier-ignore +function ParseUnion(moduleProperties, parsers, code, context) { + for (const parser of parsers) { + const result = ParseParser(moduleProperties, parser, code, context); + if (result.length === 0) + continue; + return result; + } + return []; +} +// ------------------------------------------------------------------ +// Parser +// ------------------------------------------------------------------ +// prettier-ignore +function ParseParser(moduleProperties, parser, code, context) { + const result = (Guard.IsContext(parser) ? ParseContext(moduleProperties, parser.left, parser.right, code, context) : + Guard.IsArray(parser) ? ParseArray(moduleProperties, parser.parser, code, context) : + Guard.IsConst(parser) ? ParseConst(parser.value, code, context) : + Guard.IsIdent(parser) ? ParseIdent(code, context) : + Guard.IsNumber(parser) ? ParseNumber(code, context) : + Guard.IsOptional(parser) ? ParseOptional(moduleProperties, parser.parser, code, context) : + Guard.IsRef(parser) ? ParseRef(moduleProperties, parser.ref, code, context) : + Guard.IsString(parser) ? ParseString(parser.options, code, context) : + Guard.IsTuple(parser) ? ParseTuple(moduleProperties, parser.parsers, code, context) : + Guard.IsUnion(parser) ? ParseUnion(moduleProperties, parser.parsers, code, context) : + []); + return (result.length === 2 + ? [parser.mapping(result[0], context), result[1]] + : result); +} +/** Parses content using the given parser */ +// prettier-ignore +function Parse(...args) { + const withModuleProperties = typeof args[1] === 'string' ? false : true; + const [moduleProperties, parser, content, context] = withModuleProperties + ? [args[0], args[1], args[2], args[3]] + : [{}, args[0], args[1], args[2]]; + return ParseParser(moduleProperties, parser, content, context); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.d.ts new file mode 100644 index 0000000..47a2d4c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.d.ts @@ -0,0 +1,8 @@ +/** Takes the next constant string value skipping any whitespace */ +export declare function Const(value: string, code: string): [] | [string, string]; +/** Scans for the next Ident token */ +export declare function Ident(code: string): [] | [string, string]; +/** Scans for the next number token */ +export declare function Number(code: string): [string, string] | []; +/** Scans the next Literal String value */ +export declare function String(options: string[], code: string): [string, string] | []; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.js new file mode 100644 index 0000000..daece39 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/token.js @@ -0,0 +1,230 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Const = Const; +exports.Ident = Ident; +exports.Number = Number; +exports.String = String; +// ------------------------------------------------------------------ +// Chars +// ------------------------------------------------------------------ +// prettier-ignore +var Chars; +(function (Chars) { + /** Returns true if the char code is a whitespace */ + function IsWhitespace(value) { + return value === 32; + } + Chars.IsWhitespace = IsWhitespace; + /** Returns true if the char code is a newline */ + function IsNewline(value) { + return value === 10; + } + Chars.IsNewline = IsNewline; + /** Returns true if the char code is a alpha */ + function IsAlpha(value) { + return ((value >= 65 && value <= 90) || // A-Z + (value >= 97 && value <= 122) // a-z + ); + } + Chars.IsAlpha = IsAlpha; + /** Returns true if the char code is zero */ + function IsZero(value) { + return value === 48; + } + Chars.IsZero = IsZero; + /** Returns true if the char code is non-zero */ + function IsNonZero(value) { + return value >= 49 && value <= 57; + } + Chars.IsNonZero = IsNonZero; + /** Returns true if the char code is a digit */ + function IsDigit(value) { + return (IsNonZero(value) || + IsZero(value)); + } + Chars.IsDigit = IsDigit; + /** Returns true if the char code is a dot */ + function IsDot(value) { + return value === 46; + } + Chars.IsDot = IsDot; + /** Returns true if this char code is a underscore */ + function IsUnderscore(value) { + return value === 95; + } + Chars.IsUnderscore = IsUnderscore; + /** Returns true if this char code is a dollar sign */ + function IsDollarSign(value) { + return value === 36; + } + Chars.IsDollarSign = IsDollarSign; +})(Chars || (Chars = {})); +// ------------------------------------------------------------------ +// Trim +// ------------------------------------------------------------------ +// prettier-ignore +var Trim; +(function (Trim) { + /** Trims Whitespace and retains Newline, Tabspaces, etc. */ + function TrimWhitespaceOnly(code) { + for (let i = 0; i < code.length; i++) { + if (Chars.IsWhitespace(code.charCodeAt(i))) + continue; + return code.slice(i); + } + return code; + } + Trim.TrimWhitespaceOnly = TrimWhitespaceOnly; + /** Trims Whitespace including Newline, Tabspaces, etc. */ + function TrimAll(code) { + return code.trimStart(); + } + Trim.TrimAll = TrimAll; +})(Trim || (Trim = {})); +// ------------------------------------------------------------------ +// Const +// ------------------------------------------------------------------ +/** Checks the value matches the next string */ +// prettier-ignore +function NextTokenCheck(value, code) { + if (value.length > code.length) + return false; + for (let i = 0; i < value.length; i++) { + if (value.charCodeAt(i) !== code.charCodeAt(i)) + return false; + } + return true; +} +/** Gets the next constant string value or empty if no match */ +// prettier-ignore +function NextConst(value, code) { + return NextTokenCheck(value, code) + ? [code.slice(0, value.length), code.slice(value.length)] + : []; +} +/** Takes the next constant string value skipping any whitespace */ +// prettier-ignore +function Const(value, code) { + if (value.length === 0) + return ['', code]; + const char_0 = value.charCodeAt(0); + return (Chars.IsNewline(char_0) ? NextConst(value, Trim.TrimWhitespaceOnly(code)) : + Chars.IsWhitespace(char_0) ? NextConst(value, code) : + NextConst(value, Trim.TrimAll(code))); +} +// ------------------------------------------------------------------ +// Ident +// ------------------------------------------------------------------ +// prettier-ignore +function IdentIsFirst(char) { + return (Chars.IsAlpha(char) || + Chars.IsDollarSign(char) || + Chars.IsUnderscore(char)); +} +// prettier-ignore +function IdentIsRest(char) { + return (Chars.IsAlpha(char) || + Chars.IsDigit(char) || + Chars.IsDollarSign(char) || + Chars.IsUnderscore(char)); +} +// prettier-ignore +function NextIdent(code) { + if (!IdentIsFirst(code.charCodeAt(0))) + return []; + for (let i = 1; i < code.length; i++) { + const char = code.charCodeAt(i); + if (IdentIsRest(char)) + continue; + const slice = code.slice(0, i); + const rest = code.slice(i); + return [slice, rest]; + } + return [code, '']; +} +/** Scans for the next Ident token */ +// prettier-ignore +function Ident(code) { + return NextIdent(Trim.TrimAll(code)); +} +// ------------------------------------------------------------------ +// Number +// ------------------------------------------------------------------ +/** Checks that the next number is not a leading zero */ +// prettier-ignore +function NumberLeadingZeroCheck(code, index) { + const char_0 = code.charCodeAt(index + 0); + const char_1 = code.charCodeAt(index + 1); + return (( + // 1-9 + Chars.IsNonZero(char_0)) || ( + // 0 + Chars.IsZero(char_0) && + !Chars.IsDigit(char_1)) || ( + // 0. + Chars.IsZero(char_0) && + Chars.IsDot(char_1)) || ( + // .0 + Chars.IsDot(char_0) && + Chars.IsDigit(char_1))); +} +/** Gets the next number token */ +// prettier-ignore +function NextNumber(code) { + const negated = code.charAt(0) === '-'; + const index = negated ? 1 : 0; + if (!NumberLeadingZeroCheck(code, index)) { + return []; + } + const dash = negated ? '-' : ''; + let hasDot = false; + for (let i = index; i < code.length; i++) { + const char_i = code.charCodeAt(i); + if (Chars.IsDigit(char_i)) { + continue; + } + if (Chars.IsDot(char_i)) { + if (hasDot) { + const slice = code.slice(index, i); + const rest = code.slice(i); + return [`${dash}${slice}`, rest]; + } + hasDot = true; + continue; + } + const slice = code.slice(index, i); + const rest = code.slice(i); + return [`${dash}${slice}`, rest]; + } + return [code, '']; +} +/** Scans for the next number token */ +// prettier-ignore +function Number(code) { + return NextNumber(Trim.TrimAll(code)); +} +// ------------------------------------------------------------------ +// String +// ------------------------------------------------------------------ +// prettier-ignore +function NextString(options, code) { + const first = code.charAt(0); + if (!options.includes(first)) + return []; + const quote = first; + for (let i = 1; i < code.length; i++) { + const char = code.charAt(i); + if (char === quote) { + const slice = code.slice(1, i); + const rest = code.slice(i + 1); + return [slice, rest]; + } + } + return []; +} +/** Scans the next Literal String value */ +// prettier-ignore +function String(options, code) { + return NextString(options, Trim.TrimAll(code)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.d.ts new file mode 100644 index 0000000..4200962 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.d.ts @@ -0,0 +1,98 @@ +export type IModuleProperties = Record; +/** Force output static type evaluation for Arrays */ +export type StaticEnsure = T extends infer R ? R : never; +/** Infers the Output Parameter for a Parser */ +export type StaticParser = Parser extends IParser ? Output : unknown; +export type IMapping = (input: Input, context: any) => Output; +/** Maps input to output. This is the default Mapping */ +export declare const Identity: (value: unknown) => unknown; +/** Maps the output as the given parameter T */ +export declare const As: (mapping: T) => ((value: unknown) => T); +export interface IParser { + type: string; + mapping: IMapping; +} +export type ContextParameter<_Left extends IParser, Right extends IParser> = (StaticParser); +export interface IContext extends IParser { + type: 'Context'; + left: IParser; + right: IParser; +} +/** `[Context]` Creates a Context Parser */ +export declare function Context>>(left: Left, right: Right, mapping: Mapping): IContext>; +/** `[Context]` Creates a Context Parser */ +export declare function Context(left: Left, right: Right): IContext>; +export type ArrayParameter = StaticEnsure[]>; +export interface IArray extends IParser { + type: 'Array'; + parser: IParser; +} +/** `[EBNF]` Creates an Array Parser */ +export declare function Array>>(parser: Parser, mapping: Mapping): IArray>; +/** `[EBNF]` Creates an Array Parser */ +export declare function Array(parser: Parser): IArray>; +export interface IConst extends IParser { + type: 'Const'; + value: string; +} +/** `[TERM]` Creates a Const Parser */ +export declare function Const>(value: Value, mapping: Mapping): IConst>; +/** `[TERM]` Creates a Const Parser */ +export declare function Const(value: Value): IConst; +export interface IRef extends IParser { + type: 'Ref'; + ref: string; +} +/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */ +export declare function Ref>(ref: string, mapping: Mapping): IRef>; +/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */ +export declare function Ref(ref: string): IRef; +export interface IString extends IParser { + type: 'String'; + options: string[]; +} +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +export declare function String>(options: string[], mapping: Mapping): IString>; +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +export declare function String(options: string[]): IString; +export interface IIdent extends IParser { + type: 'Ident'; +} +/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */ +export declare function Ident>(mapping: Mapping): IIdent>; +/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */ +export declare function Ident(): IIdent; +export interface INumber extends IParser { + type: 'Number'; +} +/** `[TERM]` Creates an Number Parser */ +export declare function Number>(mapping: Mapping): INumber>; +/** `[TERM]` Creates an Number Parser */ +export declare function Number(): INumber; +export type OptionalParameter] | []> = (Result); +export interface IOptional extends IParser { + type: 'Optional'; + parser: IParser; +} +/** `[EBNF]` Creates an Optional Parser */ +export declare function Optional>>(parser: Parser, mapping: Mapping): IOptional>; +/** `[EBNF]` Creates an Optional Parser */ +export declare function Optional(parser: Parser): IOptional>; +export type TupleParameter = StaticEnsure>]> : Result>; +export interface ITuple extends IParser { + type: 'Tuple'; + parsers: IParser[]; +} +/** `[BNF]` Creates a Tuple Parser */ +export declare function Tuple>>(parsers: [...Parsers], mapping: Mapping): ITuple>; +/** `[BNF]` Creates a Tuple Parser */ +export declare function Tuple(parsers: [...Parsers]): ITuple>; +export type UnionParameter = StaticEnsure> : Result>; +export interface IUnion extends IParser { + type: 'Union'; + parsers: IParser[]; +} +/** `[BNF]` Creates a Union parser */ +export declare function Union>>(parsers: [...Parsers], mapping: Mapping): IUnion>; +/** `[BNF]` Creates a Union parser */ +export declare function Union(parsers: [...Parsers]): IUnion>; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.js new file mode 100644 index 0000000..488775d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/runtime/types.js @@ -0,0 +1,71 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.As = exports.Identity = void 0; +exports.Context = Context; +exports.Array = Array; +exports.Const = Const; +exports.Ref = Ref; +exports.String = String; +exports.Ident = Ident; +exports.Number = Number; +exports.Optional = Optional; +exports.Tuple = Tuple; +exports.Union = Union; +/** Maps input to output. This is the default Mapping */ +const Identity = (value) => value; +exports.Identity = Identity; +/** Maps the output as the given parameter T */ +// prettier-ignore +const As = (mapping) => (_) => mapping; +exports.As = As; +/** `[Context]` Creates a Context Parser */ +function Context(...args) { + const [left, right, mapping] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], args[1], exports.Identity]; + return { type: 'Context', left, right, mapping }; +} +/** `[EBNF]` Creates an Array Parser */ +function Array(...args) { + const [parser, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity]; + return { type: 'Array', parser, mapping }; +} +/** `[TERM]` Creates a Const Parser */ +function Const(...args) { + const [value, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity]; + return { type: 'Const', value, mapping }; +} +/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */ +function Ref(...args) { + const [ref, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity]; + return { type: 'Ref', ref, mapping }; +} +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +function String(...params) { + const [options, mapping] = params.length === 2 ? [params[0], params[1]] : [params[0], exports.Identity]; + return { type: 'String', options, mapping }; +} +/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */ +function Ident(...params) { + const mapping = params.length === 1 ? params[0] : exports.Identity; + return { type: 'Ident', mapping }; +} +/** `[TERM]` Creates an Number Parser */ +function Number(...params) { + const mapping = params.length === 1 ? params[0] : exports.Identity; + return { type: 'Number', mapping }; +} +/** `[EBNF]` Creates an Optional Parser */ +function Optional(...args) { + const [parser, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity]; + return { type: 'Optional', parser, mapping }; +} +/** `[BNF]` Creates a Tuple Parser */ +function Tuple(...args) { + const [parsers, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity]; + return { type: 'Tuple', parsers, mapping }; +} +/** `[BNF]` Creates a Union parser */ +function Union(...args) { + const [parsers, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], exports.Identity]; + return { type: 'Union', parsers, mapping }; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.d.ts new file mode 100644 index 0000000..05bf7e2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.d.ts @@ -0,0 +1,3 @@ +export * as Token from './token'; +export * from './parse'; +export * from './types'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.js new file mode 100644 index 0000000..28c2927 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/index.js @@ -0,0 +1,43 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Token = void 0; +exports.Token = __importStar(require("./token")); +__exportStar(require("./parse"), exports); +__exportStar(require("./types"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.d.ts new file mode 100644 index 0000000..75a3d9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.d.ts @@ -0,0 +1,20 @@ +import * as Tokens from './token'; +import * as Types from './types'; +type ContextParser = (Parse extends [infer Context extends unknown, infer Rest extends string] ? Parse : []); +type ArrayParser = (Parse extends [infer Value1 extends unknown, infer Rest extends string] ? ArrayParser : [Result, Code]); +type ConstParser = (Tokens.Const extends [infer Match extends Value, infer Rest extends string] ? [Match, Rest] : []); +type IdentParser = (Tokens.Ident extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []); +type NumberParser = (Tokens.Number extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []); +type OptionalParser = (Parse extends [infer Value extends unknown, infer Rest extends string] ? [[Value], Rest] : [[], Code]); +type StringParser = (Tokens.String extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []); +type TupleParser = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse extends [infer Value extends unknown, infer Rest extends string] ? TupleParser : [] : [Result, Code]); +type UnionParser = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse extends [infer Value extends unknown, infer Rest extends string] ? [Value, Rest] : UnionParser : []); +type ParseCode = (Type extends Types.Context ? ContextParser : Type extends Types.Array ? ArrayParser : Type extends Types.Const ? ConstParser : Type extends Types.Ident ? IdentParser : Type extends Types.Number ? NumberParser : Type extends Types.Optional ? OptionalParser : Type extends Types.String ? StringParser : Type extends Types.Tuple ? TupleParser : Type extends Types.Union ? UnionParser : [ +]); +type ParseMapping = ((Parser['mapping'] & { + input: Result; + context: Context; +})['output']); +/** Parses code with the given parser */ +export type Parse = (ParseCode extends [infer L extends unknown, infer R extends string] ? [ParseMapping, R] : []); +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.js new file mode 100644 index 0000000..dc999c1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/parse.js @@ -0,0 +1,3 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.d.ts new file mode 100644 index 0000000..003f854 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.d.ts @@ -0,0 +1,108 @@ +declare namespace Chars { + type Empty = ''; + type Space = ' '; + type Newline = '\n'; + type Dot = '.'; + type Hyphen = '-'; + type Digit = [ + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9' + ]; + type Alpha = [ + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z' + ]; +} +declare namespace Trim { + type W4 = `${W3}${W3}`; + type W3 = `${W2}${W2}`; + type W2 = `${W1}${W1}`; + type W1 = `${W0}${W0}`; + type W0 = ` `; + /** Trims whitespace only */ + export type TrimWhitespace = (Code extends `${W4}${infer Rest extends string}` ? TrimWhitespace : Code extends `${W3}${infer Rest extends string}` ? TrimWhitespace : Code extends `${W1}${infer Rest extends string}` ? TrimWhitespace : Code extends `${W0}${infer Rest extends string}` ? TrimWhitespace : Code); + /** Trims Whitespace and Newline */ + export type TrimAll = (Code extends `${W4}${infer Rest extends string}` ? TrimAll : Code extends `${W3}${infer Rest extends string}` ? TrimAll : Code extends `${W1}${infer Rest extends string}` ? TrimAll : Code extends `${W0}${infer Rest extends string}` ? TrimAll : Code extends `${Chars.Newline}${infer Rest extends string}` ? TrimAll : Code); + export {}; +} +/** Scans for the next match union */ +type NextUnion = (Variants extends [infer Variant extends string, ...infer Rest1 extends string[]] ? NextConst extends [infer Match extends string, infer Rest2 extends string] ? [Match, Rest2] : NextUnion : []); +type NextConst = (Code extends `${Value}${infer Rest extends string}` ? [Value, Rest] : []); +/** Scans for the next constant value */ +export type Const = (Value extends '' ? ['', Code] : Value extends `${infer First extends string}${string}` ? (First extends Chars.Newline ? NextConst> : First extends Chars.Space ? NextConst : NextConst>) : never); +type NextNumberNegate = (Code extends `${Chars.Hyphen}${infer Rest extends string}` ? [Chars.Hyphen, Rest] : [Chars.Empty, Code]); +type NextNumberZeroCheck = (Code extends `0${infer Rest}` ? NextUnion extends [string, string] ? false : true : true); +type NextNumberScan = (NextUnion<[...Chars.Digit, Chars.Dot], Code> extends [infer Char extends string, infer Rest extends string] ? Char extends Chars.Dot ? HasDecimal extends false ? NextNumberScan : [Result, `.${Rest}`] : NextNumberScan : [Result, Code]); +export type NextNumber = (NextNumberNegate extends [infer Negate extends string, infer Rest extends string] ? NextNumberZeroCheck extends true ? NextNumberScan extends [infer Number extends string, infer Rest2 extends string] ? Number extends Chars.Empty ? [] : [`${Negate}${Number}`, Rest2] : [] : [] : []); +/** Scans for the next literal number */ +export type Number = NextNumber>; +type NextStringQuote = NextUnion; +type NextStringBody = (Code extends `${infer Char extends string}${infer Rest extends string}` ? Char extends Quote ? [Result, Rest] : NextStringBody : []); +type NextString = (NextStringQuote extends [infer Quote extends string, infer Rest extends string] ? NextStringBody extends [infer String extends string, infer Rest extends string] ? [String, Rest] : [] : []); +/** Scans for the next literal string */ +export type String = NextString>; +type IdentLeft = [...Chars.Alpha, '_', '$']; +type IdentRight = [...Chars.Digit, ...IdentLeft]; +type NextIdentScan = (NextUnion extends [infer Char extends string, infer Rest extends string] ? NextIdentScan : [Result, Code]); +type NextIdent = (NextUnion extends [infer Left extends string, infer Rest1 extends string] ? NextIdentScan extends [infer Right extends string, infer Rest2 extends string] ? [`${Left}${Right}`, Rest2] : [] : []); +/** Scans for the next Ident */ +export type Ident = NextIdent>; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.js new file mode 100644 index 0000000..dc999c1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/token.js @@ -0,0 +1,3 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.d.ts new file mode 100644 index 0000000..ec60c9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.d.ts @@ -0,0 +1,69 @@ +/** + * `[ACTION]` Inference mapping base type. Used to specify semantic actions for + * Parser productions. This type is implemented as a higher-kinded type where + * productions are received on the `input` property with mapping assigned + * the `output` property. The parsing context is available on the `context` + * property. + */ +export interface IMapping { + context: unknown; + input: unknown; + output: unknown; +} +/** `[ACTION]` Default inference mapping. */ +export interface Identity extends IMapping { + output: this['input']; +} +/** `[ACTION]` Maps the given argument `T` as the mapping output */ +export interface As extends IMapping { + output: T; +} +/** Base type Parser implemented by all other parsers */ +export interface IParser { + type: string; + mapping: Mapping; +} +/** `[Context]` Creates a Context Parser */ +export interface Context extends IParser { + type: 'Context'; + left: Left; + right: Right; +} +/** `[EBNF]` Creates an Array Parser */ +export interface Array extends IParser { + type: 'Array'; + parser: Parser; +} +/** `[TERM]` Creates a Const Parser */ +export interface Const extends IParser { + type: 'Const'; + value: Value; +} +/** `[TERM]` Creates an Ident Parser. */ +export interface Ident extends IParser { + type: 'Ident'; +} +/** `[TERM]` Creates a Number Parser. */ +export interface Number extends IParser { + type: 'Number'; +} +/** `[EBNF]` Creates a Optional Parser */ +export interface Optional extends IParser { + type: 'Optional'; + parser: Parser; +} +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +export interface String extends IParser { + type: 'String'; + quote: Options; +} +/** `[BNF]` Creates a Tuple Parser */ +export interface Tuple extends IParser { + type: 'Tuple'; + parsers: [...Parsers]; +} +/** `[BNF]` Creates a Union Parser */ +export interface Union extends IParser { + type: 'Union'; + parsers: [...Parsers]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.js b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.js new file mode 100644 index 0000000..dc999c1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/parser/static/types.js @@ -0,0 +1,3 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.d.ts new file mode 100644 index 0000000..6108552 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.d.ts @@ -0,0 +1 @@ +export * from './syntax'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.js new file mode 100644 index 0000000..7a05b20 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./syntax"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.d.ts new file mode 100644 index 0000000..a250640 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.d.ts @@ -0,0 +1,167 @@ +import * as T from '../type/index'; +type TDereference = (Key extends keyof Context ? Context[Key] : T.TRef); +type TDelimitedDecode = (Input extends [infer Left, ...infer Right] ? Left extends [infer Item, infer _] ? TDelimitedDecode : TDelimitedDecode : Result); +type TDelimited = Input extends [infer Left extends unknown[], infer Right extends unknown[]] ? TDelimitedDecode<[...Left, ...Right]> : []; +export type TGenericReferenceParameterListMapping = TDelimited; +export declare function GenericReferenceParameterListMapping(input: [unknown, unknown], context: unknown): unknown[]; +export type TGenericReferenceMapping'] ? T.TInstantiate, Args> : never : never> = Result; +export declare function GenericReferenceMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TGenericArgumentsListMapping = TDelimited; +export declare function GenericArgumentsListMapping(input: [unknown, unknown], context: unknown): unknown[]; +type GenericArgumentsContext = (Arguments extends [...infer Left extends string[], infer Right extends string] ? GenericArgumentsContext; +}> : T.Evaluate); +export type TGenericArgumentsMapping = Input extends ['<', infer Arguments extends string[], '>'] ? Context extends infer Context extends T.TProperties ? GenericArgumentsContext : never : never; +declare const GenericArgumentsContext: (_arguments: string[], context: T.TProperties) => T.TProperties; +export declare function GenericArgumentsMapping(input: [unknown, unknown, unknown], context: unknown): T.TProperties; +export type TKeywordStringMapping = T.TString; +export declare function KeywordStringMapping(input: 'string', context: unknown): T.TString; +export type TKeywordNumberMapping = T.TNumber; +export declare function KeywordNumberMapping(input: 'number', context: unknown): T.TNumber; +export type TKeywordBooleanMapping = T.TBoolean; +export declare function KeywordBooleanMapping(input: 'boolean', context: unknown): T.TBoolean; +export type TKeywordUndefinedMapping = T.TUndefined; +export declare function KeywordUndefinedMapping(input: 'undefined', context: unknown): T.TUndefined; +export type TKeywordNullMapping = T.TNull; +export declare function KeywordNullMapping(input: 'null', context: unknown): T.TNull; +export type TKeywordIntegerMapping = T.TInteger; +export declare function KeywordIntegerMapping(input: 'integer', context: unknown): T.TInteger; +export type TKeywordBigIntMapping = T.TBigInt; +export declare function KeywordBigIntMapping(input: 'bigint', context: unknown): T.TBigInt; +export type TKeywordUnknownMapping = T.TUnknown; +export declare function KeywordUnknownMapping(input: 'unknown', context: unknown): T.TUnknown; +export type TKeywordAnyMapping = T.TAny; +export declare function KeywordAnyMapping(input: 'any', context: unknown): T.TAny; +export type TKeywordNeverMapping = T.TNever; +export declare function KeywordNeverMapping(input: 'never', context: unknown): T.TNever; +export type TKeywordSymbolMapping = T.TSymbol; +export declare function KeywordSymbolMapping(input: 'symbol', context: unknown): T.TSymbol; +export type TKeywordVoidMapping = T.TVoid; +export declare function KeywordVoidMapping(input: 'void', context: unknown): T.TVoid; +export type TKeywordMapping = Input; +export declare function KeywordMapping(input: unknown, context: unknown): unknown; +export type TLiteralStringMapping = Input extends T.TLiteralValue ? T.TLiteral : never; +export declare function LiteralStringMapping(input: string, context: unknown): T.TLiteral; +export type TLiteralNumberMapping = Input extends `${infer Value extends number}` ? T.TLiteral : never; +export declare function LiteralNumberMapping(input: string, context: unknown): T.TLiteral; +export type TLiteralBooleanMapping = Input extends 'true' ? T.TLiteral : T.TLiteral; +export declare function LiteralBooleanMapping(input: 'true' | 'false', context: unknown): T.TLiteral; +export type TLiteralMapping = Input; +export declare function LiteralMapping(input: unknown, context: unknown): unknown; +export type TKeyOfMapping = Input extends [unknown] ? true : false; +export declare function KeyOfMapping(input: [unknown] | [], context: unknown): boolean; +type TIndexArrayMappingReduce = (Input extends [infer Left extends unknown, ...infer Right extends unknown[]] ? Left extends ['[', infer Type extends T.TSchema, ']'] ? TIndexArrayMappingReduce : TIndexArrayMappingReduce : Result); +export type TIndexArrayMapping = Input extends unknown[] ? TIndexArrayMappingReduce : []; +export declare function IndexArrayMapping(input: ([unknown, unknown, unknown] | [unknown, unknown])[], context: unknown): unknown[]; +export type TExtendsMapping = Input extends ['extends', infer Type extends T.TSchema, '?', infer True extends T.TSchema, ':', infer False extends T.TSchema] ? [Type, True, False] : []; +export declare function ExtendsMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown] | [], context: unknown): unknown[]; +export type TBaseMapping = (Input extends ['(', infer Type extends T.TSchema, ')'] ? Type : Input extends infer Type extends T.TSchema ? Type : never); +export declare function BaseMapping(input: [unknown, unknown, unknown] | unknown, context: unknown): unknown; +type TFactorIndexArray = (IndexArray extends [...infer Left extends unknown[], infer Right extends T.TSchema[]] ? (Right extends [infer Indexer extends T.TSchema] ? T.TIndex, T.TIndexPropertyKeys> : Right extends [] ? T.TArray> : T.TNever) : Type); +type TFactorExtends = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? T.TExtends : Type); +export type TFactorMapping = Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extends extends unknown[]] ? KeyOf extends true ? TFactorExtends>, Extends> : TFactorExtends, Extends> : never; +export declare function FactorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +type TExprBinaryMapping = (Rest extends [infer Operator extends unknown, infer Right extends T.TSchema, infer Next extends unknown[]] ? (TExprBinaryMapping extends infer Schema extends T.TSchema ? (Operator extends '&' ? (Schema extends T.TIntersect ? T.TIntersect<[Left, ...Types]> : T.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends T.TUnion ? T.TUnion<[Left, ...Types]> : T.TUnion<[Left, Schema]>) : never) : never) : Left); +export type TExprTermTailMapping = Input; +export declare function ExprTermTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown]; +export type TExprTermMapping = (Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping : []); +export declare function ExprTermMapping(input: [unknown, unknown], context: unknown): T.TSchema; +export type TExprTailMapping = Input; +export declare function ExprTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown]; +export type TExprMapping = Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping : []; +export declare function ExprMapping(input: [unknown, unknown], context: unknown): T.TSchema; +export type TTypeMapping = Input; +export declare function TypeMapping(input: unknown, context: unknown): unknown; +export type TPropertyKeyMapping = Input; +export declare function PropertyKeyMapping(input: string, context: unknown): string; +export type TReadonlyMapping = Input extends [unknown] ? true : false; +export declare function ReadonlyMapping(input: [unknown] | [], context: unknown): boolean; +export type TOptionalMapping = Input extends [unknown] ? true : false; +export declare function OptionalMapping(input: [unknown] | [], context: unknown): boolean; +export type TPropertyMapping = Input extends [infer IsReadonly extends boolean, infer Key extends string, infer IsOptional extends boolean, string, infer Type extends T.TSchema] ? { + [_ in Key]: ([ + IsReadonly, + IsOptional + ] extends [true, true] ? T.TReadonlyOptional : [ + IsReadonly, + IsOptional + ] extends [true, false] ? T.TReadonly : [ + IsReadonly, + IsOptional + ] extends [false, true] ? T.TOptional : Type); +} : never; +export declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): { + [x: string]: T.TSchema; +}; +export type TPropertyDelimiterMapping = Input; +export declare function PropertyDelimiterMapping(input: [unknown, unknown] | [unknown], context: unknown): [unknown] | [unknown, unknown]; +export type TPropertyListMapping = TDelimited; +export declare function PropertyListMapping(input: [unknown, unknown], context: unknown): unknown[]; +type TObjectMappingReduce = (PropertiesList extends [infer Left extends T.TProperties, ...infer Right extends T.TProperties[]] ? TObjectMappingReduce : { + [Key in keyof Result]: Result[Key]; +}); +export type TObjectMapping = Input extends ['{', infer PropertyList extends T.TProperties[], '}'] ? T.TObject> : never; +export declare function ObjectMapping(input: [unknown, unknown, unknown], context: unknown): T.TObject; +export type TElementListMapping = TDelimited; +export declare function ElementListMapping(input: [unknown, unknown], context: unknown): unknown[]; +export type TTupleMapping = Input extends ['[', infer Types extends T.TSchema[], ']'] ? T.TTuple : never; +export declare function TupleMapping(input: [unknown, unknown, unknown], context: unknown): T.TTuple; +export type TParameterMapping = Input extends [string, ':', infer Type extends T.TSchema] ? Type : never; +export declare function ParameterMapping(input: [unknown, unknown, unknown], context: unknown): T.TSchema; +export type TParameterListMapping = TDelimited; +export declare function ParameterListMapping(input: [unknown, unknown], context: unknown): unknown[]; +export type TFunctionMapping = Input extends ['(', infer ParameterList extends T.TSchema[], ')', '=>', infer ReturnType extends T.TSchema] ? T.TFunction : never; +export declare function FunctionMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): T.TFunction; +export type TConstructorMapping = Input extends ['new', '(', infer ParameterList extends T.TSchema[], ')', '=>', infer InstanceType extends T.TSchema] ? T.TConstructor : never; +export declare function ConstructorMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TConstructor; +export type TMappedMapping = Input extends ['{', '[', infer _Key extends string, 'in', infer _Right extends T.TSchema, ']', ':', infer _Type extends T.TSchema, '}'] ? T.TLiteral<'Mapped types not supported'> : never; +export declare function MappedMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TLiteral<"Mapped types not supported">; +export type TAsyncIteratorMapping = Input extends ['AsyncIterator', '<', infer Type extends T.TSchema, '>'] ? T.TAsyncIterator : never; +export declare function AsyncIteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TAsyncIterator; +export type TIteratorMapping = Input extends ['Iterator', '<', infer Type extends T.TSchema, '>'] ? T.TIterator : never; +export declare function IteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TIterator; +export type TArgumentMapping = Input extends ['Argument', '<', infer Type extends T.TSchema, '>'] ? Type extends T.TLiteral ? T.TArgument : T.TNever : never; +export declare function ArgumentMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever | T.TArgument; +export type TAwaitedMapping = Input extends ['Awaited', '<', infer Type extends T.TSchema, '>'] ? T.TAwaited : never; +export declare function AwaitedMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TArrayMapping = Input extends ['Array', '<', infer Type extends T.TSchema, '>'] ? T.TArray : never; +export declare function ArrayMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TArray; +export type TRecordMapping = Input extends ['Record', '<', infer Key extends T.TSchema, ',', infer Type extends T.TSchema, '>'] ? T.TRecordOrObject : never; +export declare function RecordMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TPromiseMapping = Input extends ['Promise', '<', infer Type extends T.TSchema, '>'] ? T.TPromise : never; +export declare function PromiseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TPromise; +export type TConstructorParametersMapping = Input extends ['ConstructorParameters', '<', infer Type extends T.TSchema, '>'] ? T.TConstructorParameters : never; +export declare function ConstructorParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TFunctionParametersMapping = Input extends ['Parameters', '<', infer Type extends T.TSchema, '>'] ? T.TParameters : never; +export declare function FunctionParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TInstanceTypeMapping = Input extends ['InstanceType', '<', infer Type extends T.TSchema, '>'] ? T.TInstanceType : never; +export declare function InstanceTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TReturnTypeMapping = Input extends ['ReturnType', '<', infer Type extends T.TSchema, '>'] ? T.TReturnType : never; +export declare function ReturnTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TPartialMapping = Input extends ['Partial', '<', infer Type extends T.TSchema, '>'] ? T.TPartial : never; +export declare function PartialMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TRequiredMapping = Input extends ['Required', '<', infer Type extends T.TSchema, '>'] ? T.TRequired : never; +export declare function RequiredMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TPickMapping = Input extends ['Pick', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TPick : never; +export declare function PickMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TOmitMapping = Input extends ['Omit', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TOmit : never; +export declare function OmitMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TExcludeMapping = Input extends ['Exclude', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExclude : never; +export declare function ExcludeMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TExtractMapping = Input extends ['Extract', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExtract : never; +export declare function ExtractMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TUppercaseMapping = Input extends ['Uppercase', '<', infer Type extends T.TSchema, '>'] ? T.TUppercase : never; +export declare function UppercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TLowercaseMapping = Input extends ['Lowercase', '<', infer Type extends T.TSchema, '>'] ? T.TLowercase : never; +export declare function LowercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TCapitalizeMapping = Input extends ['Capitalize', '<', infer Type extends T.TSchema, '>'] ? T.TCapitalize : never; +export declare function CapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TUncapitalizeMapping = Input extends ['Uncapitalize', '<', infer Type extends T.TSchema, '>'] ? T.TUncapitalize : never; +export declare function UncapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TDateMapping = T.TDate; +export declare function DateMapping(input: 'Date', context: unknown): T.TDate; +export type TUint8ArrayMapping = T.TUint8Array; +export declare function Uint8ArrayMapping(input: 'Uint8Array', context: unknown): T.TUint8Array; +export type TReferenceMapping = Context extends T.TProperties ? Input extends string ? TDereference : never : never; +export declare function ReferenceMapping(input: string, context: unknown): T.TSchema; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.js b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.js new file mode 100644 index 0000000..4bf0dfa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/mapping.js @@ -0,0 +1,491 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GenericReferenceParameterListMapping = GenericReferenceParameterListMapping; +exports.GenericReferenceMapping = GenericReferenceMapping; +exports.GenericArgumentsListMapping = GenericArgumentsListMapping; +exports.GenericArgumentsMapping = GenericArgumentsMapping; +exports.KeywordStringMapping = KeywordStringMapping; +exports.KeywordNumberMapping = KeywordNumberMapping; +exports.KeywordBooleanMapping = KeywordBooleanMapping; +exports.KeywordUndefinedMapping = KeywordUndefinedMapping; +exports.KeywordNullMapping = KeywordNullMapping; +exports.KeywordIntegerMapping = KeywordIntegerMapping; +exports.KeywordBigIntMapping = KeywordBigIntMapping; +exports.KeywordUnknownMapping = KeywordUnknownMapping; +exports.KeywordAnyMapping = KeywordAnyMapping; +exports.KeywordNeverMapping = KeywordNeverMapping; +exports.KeywordSymbolMapping = KeywordSymbolMapping; +exports.KeywordVoidMapping = KeywordVoidMapping; +exports.KeywordMapping = KeywordMapping; +exports.LiteralStringMapping = LiteralStringMapping; +exports.LiteralNumberMapping = LiteralNumberMapping; +exports.LiteralBooleanMapping = LiteralBooleanMapping; +exports.LiteralMapping = LiteralMapping; +exports.KeyOfMapping = KeyOfMapping; +exports.IndexArrayMapping = IndexArrayMapping; +exports.ExtendsMapping = ExtendsMapping; +exports.BaseMapping = BaseMapping; +exports.FactorMapping = FactorMapping; +exports.ExprTermTailMapping = ExprTermTailMapping; +exports.ExprTermMapping = ExprTermMapping; +exports.ExprTailMapping = ExprTailMapping; +exports.ExprMapping = ExprMapping; +exports.TypeMapping = TypeMapping; +exports.PropertyKeyMapping = PropertyKeyMapping; +exports.ReadonlyMapping = ReadonlyMapping; +exports.OptionalMapping = OptionalMapping; +exports.PropertyMapping = PropertyMapping; +exports.PropertyDelimiterMapping = PropertyDelimiterMapping; +exports.PropertyListMapping = PropertyListMapping; +exports.ObjectMapping = ObjectMapping; +exports.ElementListMapping = ElementListMapping; +exports.TupleMapping = TupleMapping; +exports.ParameterMapping = ParameterMapping; +exports.ParameterListMapping = ParameterListMapping; +exports.FunctionMapping = FunctionMapping; +exports.ConstructorMapping = ConstructorMapping; +exports.MappedMapping = MappedMapping; +exports.AsyncIteratorMapping = AsyncIteratorMapping; +exports.IteratorMapping = IteratorMapping; +exports.ArgumentMapping = ArgumentMapping; +exports.AwaitedMapping = AwaitedMapping; +exports.ArrayMapping = ArrayMapping; +exports.RecordMapping = RecordMapping; +exports.PromiseMapping = PromiseMapping; +exports.ConstructorParametersMapping = ConstructorParametersMapping; +exports.FunctionParametersMapping = FunctionParametersMapping; +exports.InstanceTypeMapping = InstanceTypeMapping; +exports.ReturnTypeMapping = ReturnTypeMapping; +exports.PartialMapping = PartialMapping; +exports.RequiredMapping = RequiredMapping; +exports.PickMapping = PickMapping; +exports.OmitMapping = OmitMapping; +exports.ExcludeMapping = ExcludeMapping; +exports.ExtractMapping = ExtractMapping; +exports.UppercaseMapping = UppercaseMapping; +exports.LowercaseMapping = LowercaseMapping; +exports.CapitalizeMapping = CapitalizeMapping; +exports.UncapitalizeMapping = UncapitalizeMapping; +exports.DateMapping = DateMapping; +exports.Uint8ArrayMapping = Uint8ArrayMapping; +exports.ReferenceMapping = ReferenceMapping; +const T = __importStar(require("../type/index")); +// prettier-ignore +const Dereference = (context, key) => { + return key in context ? context[key] : T.Ref(key); +}; +// prettier-ignore +const DelimitedDecode = (input, result = []) => { + return input.reduce((result, left) => { + return T.ValueGuard.IsArray(left) && left.length === 2 + ? [...result, left[0]] + : [...result, left]; + }, []); +}; +// prettier-ignore +const Delimited = (input) => { + const [left, right] = input; + return DelimitedDecode([...left, ...right]); +}; +// prettier-ignore +function GenericReferenceParameterListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +function GenericReferenceMapping(input, context) { + const type = Dereference(context, input[0]); + const args = input[2]; + return T.Instantiate(type, args); +} +// prettier-ignore +function GenericArgumentsListMapping(input, context) { + return Delimited(input); +} +// ... +// prettier-ignore +const GenericArgumentsContext = (_arguments, context) => { + return _arguments.reduce((result, arg, index) => { + return { ...result, [arg]: T.Argument(index) }; + }, context); +}; +// prettier-ignore +function GenericArgumentsMapping(input, context) { + return input.length === 3 + ? GenericArgumentsContext(input[1], context) + : {}; +} +// prettier-ignore +function KeywordStringMapping(input, context) { + return T.String(); +} +// prettier-ignore +function KeywordNumberMapping(input, context) { + return T.Number(); +} +// prettier-ignore +function KeywordBooleanMapping(input, context) { + return T.Boolean(); +} +// prettier-ignore +function KeywordUndefinedMapping(input, context) { + return T.Undefined(); +} +// prettier-ignore +function KeywordNullMapping(input, context) { + return T.Null(); +} +// prettier-ignore +function KeywordIntegerMapping(input, context) { + return T.Integer(); +} +// prettier-ignore +function KeywordBigIntMapping(input, context) { + return T.BigInt(); +} +// prettier-ignore +function KeywordUnknownMapping(input, context) { + return T.Unknown(); +} +// prettier-ignore +function KeywordAnyMapping(input, context) { + return T.Any(); +} +// prettier-ignore +function KeywordNeverMapping(input, context) { + return T.Never(); +} +// prettier-ignore +function KeywordSymbolMapping(input, context) { + return T.Symbol(); +} +// prettier-ignore +function KeywordVoidMapping(input, context) { + return T.Void(); +} +// prettier-ignore +function KeywordMapping(input, context) { + return input; +} +// prettier-ignore +function LiteralStringMapping(input, context) { + return T.Literal(input); +} +// prettier-ignore +function LiteralNumberMapping(input, context) { + return T.Literal(parseFloat(input)); +} +// prettier-ignore +function LiteralBooleanMapping(input, context) { + return T.Literal(input === 'true'); +} +// prettier-ignore +function LiteralMapping(input, context) { + return input; +} +// prettier-ignore +function KeyOfMapping(input, context) { + return input.length > 0; +} +// prettier-ignore +function IndexArrayMapping(input, context) { + return input.reduce((result, current) => { + return current.length === 3 + ? [...result, [current[1]]] + : [...result, []]; + }, []); +} +// prettier-ignore +function ExtendsMapping(input, context) { + return input.length === 6 + ? [input[1], input[3], input[5]] + : []; +} +// prettier-ignore +function BaseMapping(input, context) { + return T.ValueGuard.IsArray(input) && input.length === 3 ? input[1] : input; +} +// ... +// prettier-ignore +const FactorIndexArray = (Type, indexArray) => { + return indexArray.reduceRight((result, right) => { + const _right = right; + return (_right.length === 1 ? T.Index(result, _right[0]) : + _right.length === 0 ? T.Array(result, _right[0]) : + T.Never()); + }, Type); +}; +// prettier-ignore +const FactorExtends = (Type, Extends) => { + return Extends.length === 3 + ? T.Extends(Type, Extends[0], Extends[1], Extends[2]) + : Type; +}; +// prettier-ignore +function FactorMapping(input, context) { + const [KeyOf, Type, IndexArray, Extends] = input; + return KeyOf + ? FactorExtends(T.KeyOf(FactorIndexArray(Type, IndexArray)), Extends) + : FactorExtends(FactorIndexArray(Type, IndexArray), Extends); +} +// prettier-ignore +function ExprBinaryMapping(Left, Rest) { + return (Rest.length === 3 ? (() => { + const [Operator, Right, Next] = Rest; + const Schema = ExprBinaryMapping(Right, Next); + if (Operator === '&') { + return T.TypeGuard.IsIntersect(Schema) + ? T.Intersect([Left, ...Schema.allOf]) + : T.Intersect([Left, Schema]); + } + if (Operator === '|') { + return T.TypeGuard.IsUnion(Schema) + ? T.Union([Left, ...Schema.anyOf]) + : T.Union([Left, Schema]); + } + throw 1; + })() : Left); +} +// prettier-ignore +function ExprTermTailMapping(input, context) { + return input; +} +// prettier-ignore +function ExprTermMapping(input, context) { + const [left, rest] = input; + return ExprBinaryMapping(left, rest); +} +// prettier-ignore +function ExprTailMapping(input, context) { + return input; +} +// prettier-ignore +function ExprMapping(input, context) { + const [left, rest] = input; + return ExprBinaryMapping(left, rest); +} +// prettier-ignore +function TypeMapping(input, context) { + return input; +} +// prettier-ignore +function PropertyKeyMapping(input, context) { + return input; +} +// prettier-ignore +function ReadonlyMapping(input, context) { + return input.length > 0; +} +// prettier-ignore +function OptionalMapping(input, context) { + return input.length > 0; +} +// prettier-ignore +function PropertyMapping(input, context) { + const [isReadonly, key, isOptional, _colon, type] = input; + return { + [key]: (isReadonly && isOptional ? T.ReadonlyOptional(type) : + isReadonly && !isOptional ? T.Readonly(type) : + !isReadonly && isOptional ? T.Optional(type) : + type) + }; +} +// prettier-ignore +function PropertyDelimiterMapping(input, context) { + return input; +} +// prettier-ignore +function PropertyListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +function ObjectMapping(input, context) { + const propertyList = input[1]; + return T.Object(propertyList.reduce((result, property) => { + return { ...result, ...property }; + }, {})); +} +// prettier-ignore +function ElementListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +function TupleMapping(input, context) { + return T.Tuple(input[1]); +} +// prettier-ignore +function ParameterMapping(input, context) { + const [_ident, _colon, type] = input; + return type; +} +// prettier-ignore +function ParameterListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +function FunctionMapping(input, context) { + const [_lparan, parameterList, _rparan, _arrow, returnType] = input; + return T.Function(parameterList, returnType); +} +// prettier-ignore +function ConstructorMapping(input, context) { + const [_new, _lparan, parameterList, _rparan, _arrow, instanceType] = input; + return T.Constructor(parameterList, instanceType); +} +// prettier-ignore +function MappedMapping(input, context) { + const [_lbrace, _lbracket, _key, _in, _right, _rbracket, _colon, _type] = input; + return T.Literal('Mapped types not supported'); +} +// prettier-ignore +function AsyncIteratorMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.AsyncIterator(type); +} +// prettier-ignore +function IteratorMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Iterator(type); +} +// prettier-ignore +function ArgumentMapping(input, context) { + return T.KindGuard.IsLiteralNumber(input[2]) + ? T.Argument(Math.trunc(input[2].const)) + : T.Never(); +} +// prettier-ignore +function AwaitedMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Awaited(type); +} +// prettier-ignore +function ArrayMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Array(type); +} +// prettier-ignore +function RecordMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Record(key, type); +} +// prettier-ignore +function PromiseMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Promise(type); +} +// prettier-ignore +function ConstructorParametersMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.ConstructorParameters(type); +} +// prettier-ignore +function FunctionParametersMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Parameters(type); +} +// prettier-ignore +function InstanceTypeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.InstanceType(type); +} +// prettier-ignore +function ReturnTypeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.ReturnType(type); +} +// prettier-ignore +function PartialMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Partial(type); +} +// prettier-ignore +function RequiredMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Required(type); +} +// prettier-ignore +function PickMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Pick(key, type); +} +// prettier-ignore +function OmitMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Omit(key, type); +} +// prettier-ignore +function ExcludeMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Exclude(key, type); +} +// prettier-ignore +function ExtractMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Extract(key, type); +} +// prettier-ignore +function UppercaseMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Uppercase(type); +} +// prettier-ignore +function LowercaseMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Lowercase(type); +} +// prettier-ignore +function CapitalizeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Capitalize(type); +} +// prettier-ignore +function UncapitalizeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Uncapitalize(type); +} +// prettier-ignore +function DateMapping(input, context) { + return T.Date(); +} +// prettier-ignore +function Uint8ArrayMapping(input, context) { + return T.Uint8Array(); +} +// prettier-ignore +function ReferenceMapping(input, context) { + const target = Dereference(context, input); + return target; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.d.ts new file mode 100644 index 0000000..a931513 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.d.ts @@ -0,0 +1,162 @@ +import { Static } from '../parser/index'; +import * as T from '../type/index'; +import * as S from './mapping'; +export type TGenericReferenceParameterList_0 = (TType extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TGenericReferenceParameterList_0 : [Result, Input]; +export type TGenericReferenceParameterList = (TGenericReferenceParameterList_0 extends [infer _0, infer Input extends string] ? ((TType extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TGenericReferenceParameterListMapping<_0, Context>, Input] : []; +export type TGenericReference = (Static.Token.Ident extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TGenericReferenceParameterList extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TGenericReferenceMapping<_0, Context>, Input] : []; +export type TGenericArgumentsList_0 = (Static.Token.Ident extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TGenericArgumentsList_0 : [Result, Input]; +export type TGenericArgumentsList = (TGenericArgumentsList_0 extends [infer _0, infer Input extends string] ? ((Static.Token.Ident extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TGenericArgumentsListMapping<_0, Context>, Input] : []; +export type TGenericArguments = (Static.Token.Const<'<', Input> extends [infer _0, infer Input extends string] ? TGenericArgumentsList extends [infer _1, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TGenericArgumentsMapping<_0, Context>, Input] : []; +export type TKeywordString = Static.Token.Const<'string', Input> extends [infer _0 extends 'string', infer Input extends string] ? [S.TKeywordStringMapping<_0, Context>, Input] : []; +export type TKeywordNumber = Static.Token.Const<'number', Input> extends [infer _0 extends 'number', infer Input extends string] ? [S.TKeywordNumberMapping<_0, Context>, Input] : []; +export type TKeywordBoolean = Static.Token.Const<'boolean', Input> extends [infer _0 extends 'boolean', infer Input extends string] ? [S.TKeywordBooleanMapping<_0, Context>, Input] : []; +export type TKeywordUndefined = Static.Token.Const<'undefined', Input> extends [infer _0 extends 'undefined', infer Input extends string] ? [S.TKeywordUndefinedMapping<_0, Context>, Input] : []; +export type TKeywordNull = Static.Token.Const<'null', Input> extends [infer _0 extends 'null', infer Input extends string] ? [S.TKeywordNullMapping<_0, Context>, Input] : []; +export type TKeywordInteger = Static.Token.Const<'integer', Input> extends [infer _0 extends 'integer', infer Input extends string] ? [S.TKeywordIntegerMapping<_0, Context>, Input] : []; +export type TKeywordBigInt = Static.Token.Const<'bigint', Input> extends [infer _0 extends 'bigint', infer Input extends string] ? [S.TKeywordBigIntMapping<_0, Context>, Input] : []; +export type TKeywordUnknown = Static.Token.Const<'unknown', Input> extends [infer _0 extends 'unknown', infer Input extends string] ? [S.TKeywordUnknownMapping<_0, Context>, Input] : []; +export type TKeywordAny = Static.Token.Const<'any', Input> extends [infer _0 extends 'any', infer Input extends string] ? [S.TKeywordAnyMapping<_0, Context>, Input] : []; +export type TKeywordNever = Static.Token.Const<'never', Input> extends [infer _0 extends 'never', infer Input extends string] ? [S.TKeywordNeverMapping<_0, Context>, Input] : []; +export type TKeywordSymbol = Static.Token.Const<'symbol', Input> extends [infer _0 extends 'symbol', infer Input extends string] ? [S.TKeywordSymbolMapping<_0, Context>, Input] : []; +export type TKeywordVoid = Static.Token.Const<'void', Input> extends [infer _0 extends 'void', infer Input extends string] ? [S.TKeywordVoidMapping<_0, Context>, Input] : []; +export type TKeyword = (TKeywordString extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNumber extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordBoolean extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordUndefined extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNull extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordInteger extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordBigInt extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordUnknown extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordAny extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNever extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordSymbol extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordVoid extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TKeywordMapping<_0, Context>, Input] : []; +export type TLiteralString = Static.Token.String<["'", '"', '`'], Input> extends [infer _0 extends string, infer Input extends string] ? [S.TLiteralStringMapping<_0, Context>, Input] : []; +export type TLiteralNumber = Static.Token.Number extends [infer _0 extends string, infer Input extends string] ? [S.TLiteralNumberMapping<_0, Context>, Input] : []; +export type TLiteralBoolean = (Static.Token.Const<'true', Input> extends [infer _0, infer Input extends string] ? [_0, Input] : Static.Token.Const<'false', Input> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends 'true' | 'false', infer Input extends string] ? [S.TLiteralBooleanMapping<_0, Context>, Input] : []; +export type TLiteral = (TLiteralBoolean extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteralNumber extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteralString extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TLiteralMapping<_0, Context>, Input] : []; +export type TKeyOf = ((Static.Token.Const<'keyof', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TKeyOfMapping<_0, Context>, Input] : []; +export type TIndexArray_0 = ((Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? TType extends [infer _1, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<']', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [ + infer _0, + infer Input extends string +] ? [_0, Input] : []) extends [infer _0, infer Input extends string] ? TIndexArray_0 : [Result, Input]; +export type TIndexArray = TIndexArray_0 extends [infer _0 extends ([unknown, unknown, unknown] | [unknown, unknown])[], infer Input extends string] ? [S.TIndexArrayMapping<_0, Context>, Input] : []; +export type TExtends = ((Static.Token.Const<'extends', Input> extends [infer _0, infer Input extends string] ? TType extends [infer _1, infer Input extends string] ? Static.Token.Const<'?', Input> extends [infer _2, infer Input extends string] ? TType extends [infer _3, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _4, infer Input extends string] ? TType extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExtendsMapping<_0, Context>, Input] : []; +export type TBase = ((Static.Token.Const<'(', Input> extends [infer _0, infer Input extends string] ? TType extends [infer _1, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : TKeyword extends [infer _0, infer Input extends string] ? [_0, Input] : TObject extends [infer _0, infer Input extends string] ? [_0, Input] : TTuple extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteral extends [infer _0, infer Input extends string] ? [_0, Input] : TConstructor extends [infer _0, infer Input extends string] ? [_0, Input] : TFunction extends [infer _0, infer Input extends string] ? [_0, Input] : TMapped extends [infer _0, infer Input extends string] ? [_0, Input] : TAsyncIterator extends [infer _0, infer Input extends string] ? [_0, Input] : TIterator extends [infer _0, infer Input extends string] ? [_0, Input] : TConstructorParameters extends [infer _0, infer Input extends string] ? [_0, Input] : TFunctionParameters extends [infer _0, infer Input extends string] ? [_0, Input] : TInstanceType extends [infer _0, infer Input extends string] ? [_0, Input] : TReturnType extends [infer _0, infer Input extends string] ? [_0, Input] : TArgument extends [infer _0, infer Input extends string] ? [_0, Input] : TAwaited extends [infer _0, infer Input extends string] ? [_0, Input] : TArray extends [infer _0, infer Input extends string] ? [_0, Input] : TRecord extends [infer _0, infer Input extends string] ? [_0, Input] : TPromise extends [infer _0, infer Input extends string] ? [_0, Input] : TPartial extends [infer _0, infer Input extends string] ? [_0, Input] : TRequired extends [infer _0, infer Input extends string] ? [_0, Input] : TPick extends [infer _0, infer Input extends string] ? [_0, Input] : TOmit extends [infer _0, infer Input extends string] ? [_0, Input] : TExclude extends [infer _0, infer Input extends string] ? [_0, Input] : TExtract extends [infer _0, infer Input extends string] ? [_0, Input] : TUppercase extends [infer _0, infer Input extends string] ? [_0, Input] : TLowercase extends [infer _0, infer Input extends string] ? [_0, Input] : TCapitalize extends [infer _0, infer Input extends string] ? [_0, Input] : TUncapitalize extends [infer _0, infer Input extends string] ? [_0, Input] : TDate extends [infer _0, infer Input extends string] ? [_0, Input] : TUint8Array extends [infer _0, infer Input extends string] ? [_0, Input] : TGenericReference extends [infer _0, infer Input extends string] ? [_0, Input] : TReference extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | unknown, infer Input extends string] ? [S.TBaseMapping<_0, Context>, Input] : []; +export type TFactor = (TKeyOf extends [infer _0, infer Input extends string] ? TBase extends [infer _1, infer Input extends string] ? TIndexArray extends [infer _2, infer Input extends string] ? TExtends extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFactorMapping<_0, Context>, Input] : []; +export type TExprTermTail = ((Static.Token.Const<'&', Input> extends [infer _0, infer Input extends string] ? TFactor extends [infer _1, infer Input extends string] ? TExprTermTail extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExprTermTailMapping<_0, Context>, Input] : []; +export type TExprTerm = (TFactor extends [infer _0, infer Input extends string] ? (TExprTermTail extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TExprTermMapping<_0, Context>, Input] : []; +export type TExprTail = ((Static.Token.Const<'|', Input> extends [infer _0, infer Input extends string] ? TExprTerm extends [infer _1, infer Input extends string] ? TExprTail extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExprTailMapping<_0, Context>, Input] : []; +export type TExpr = (TExprTerm extends [infer _0, infer Input extends string] ? (TExprTail extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TExprMapping<_0, Context>, Input] : []; +export type TType = (TGenericArguments extends [infer _0 extends T.TProperties, infer Input extends string] ? TExpr : [] extends [infer _0, infer Input extends string] ? [_0, Input] : TExpr extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TTypeMapping<_0, Context>, Input] : []; +export type TPropertyKey = (Static.Token.Ident extends [infer _0, infer Input extends string] ? [_0, Input] : Static.Token.String<["'", '"'], Input> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends string, infer Input extends string] ? [S.TPropertyKeyMapping<_0, Context>, Input] : []; +export type TReadonly = ((Static.Token.Const<'readonly', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TReadonlyMapping<_0, Context>, Input] : []; +export type TOptional = ((Static.Token.Const<'?', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TOptionalMapping<_0, Context>, Input] : []; +export type TProperty = (TReadonly extends [infer _0, infer Input extends string] ? TPropertyKey extends [infer _1, infer Input extends string] ? TOptional extends [infer _2, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? [[_0, _1, _2, _3, _4], Input] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPropertyMapping<_0, Context>, Input] : []; +export type TPropertyDelimiter = ((Static.Token.Const<',', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<'\n', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [ + infer _0, + infer Input extends string +] ? [_0, Input] : (Static.Token.Const<';', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<'\n', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [ + infer _0, + infer Input extends string +] ? [_0, Input] : (Static.Token.Const<',', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<';', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<'\n', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown] | [unknown], infer Input extends string] ? [S.TPropertyDelimiterMapping<_0, Context>, Input] : []; +export type TPropertyList_0 = (TProperty extends [infer _0, infer Input extends string] ? (TPropertyDelimiter extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TPropertyList_0 : [Result, Input]; +export type TPropertyList = (TPropertyList_0 extends [infer _0, infer Input extends string] ? ((TProperty extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TPropertyListMapping<_0, Context>, Input] : []; +export type TObject = (Static.Token.Const<'{', Input> extends [infer _0, infer Input extends string] ? TPropertyList extends [infer _1, infer Input extends string] ? Static.Token.Const<'}', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TObjectMapping<_0, Context>, Input] : []; +export type TElementList_0 = (TType extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TElementList_0 : [Result, Input]; +export type TElementList = (TElementList_0 extends [infer _0, infer Input extends string] ? ((TType extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TElementListMapping<_0, Context>, Input] : []; +export type TTuple = (Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? TElementList extends [infer _1, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TTupleMapping<_0, Context>, Input] : []; +export type TParameter = (Static.Token.Ident extends [infer _0, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TParameterMapping<_0, Context>, Input] : []; +export type TParameterList_0 = (TParameter extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TParameterList_0 : [Result, Input]; +export type TParameterList = (TParameterList_0 extends [infer _0, infer Input extends string] ? ((TParameter extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TParameterListMapping<_0, Context>, Input] : []; +export type TFunction = (Static.Token.Const<'(', Input> extends [infer _0, infer Input extends string] ? TParameterList extends [infer _1, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _2, infer Input extends string] ? Static.Token.Const<'=>', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? [[_0, _1, _2, _3, _4], Input] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFunctionMapping<_0, Context>, Input] : []; +export type TConstructor = (Static.Token.Const<'new', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'(', Input> extends [infer _1, infer Input extends string] ? TParameterList extends [infer _2, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _3, infer Input extends string] ? Static.Token.Const<'=>', Input> extends [infer _4, infer Input extends string] ? TType extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TConstructorMapping<_0, Context>, Input] : []; +export type TMapped = (Static.Token.Const<'{', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'[', Input> extends [infer _1, infer Input extends string] ? Static.Token.Ident extends [infer _2, infer Input extends string] ? Static.Token.Const<'in', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _5, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _6, infer Input extends string] ? TType extends [infer _7, infer Input extends string] ? Static.Token.Const<'}', Input> extends [infer _8, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5, _6, _7, _8], Input] : [] : [] : [] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TMappedMapping<_0, Context>, Input] : []; +export type TAsyncIterator = (Static.Token.Const<'AsyncIterator', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TAsyncIteratorMapping<_0, Context>, Input] : []; +export type TIterator = (Static.Token.Const<'Iterator', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TIteratorMapping<_0, Context>, Input] : []; +export type TArgument = (Static.Token.Const<'Argument', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TArgumentMapping<_0, Context>, Input] : []; +export type TAwaited = (Static.Token.Const<'Awaited', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TAwaitedMapping<_0, Context>, Input] : []; +export type TArray = (Static.Token.Const<'Array', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TArrayMapping<_0, Context>, Input] : []; +export type TRecord = (Static.Token.Const<'Record', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TRecordMapping<_0, Context>, Input] : []; +export type TPromise = (Static.Token.Const<'Promise', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPromiseMapping<_0, Context>, Input] : []; +export type TConstructorParameters = (Static.Token.Const<'ConstructorParameters', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TConstructorParametersMapping<_0, Context>, Input] : []; +export type TFunctionParameters = (Static.Token.Const<'Parameters', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFunctionParametersMapping<_0, Context>, Input] : []; +export type TInstanceType = (Static.Token.Const<'InstanceType', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TInstanceTypeMapping<_0, Context>, Input] : []; +export type TReturnType = (Static.Token.Const<'ReturnType', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TReturnTypeMapping<_0, Context>, Input] : []; +export type TPartial = (Static.Token.Const<'Partial', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPartialMapping<_0, Context>, Input] : []; +export type TRequired = (Static.Token.Const<'Required', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TRequiredMapping<_0, Context>, Input] : []; +export type TPick = (Static.Token.Const<'Pick', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPickMapping<_0, Context>, Input] : []; +export type TOmit = (Static.Token.Const<'Omit', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TOmitMapping<_0, Context>, Input] : []; +export type TExclude = (Static.Token.Const<'Exclude', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TExcludeMapping<_0, Context>, Input] : []; +export type TExtract = (Static.Token.Const<'Extract', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TExtractMapping<_0, Context>, Input] : []; +export type TUppercase = (Static.Token.Const<'Uppercase', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TUppercaseMapping<_0, Context>, Input] : []; +export type TLowercase = (Static.Token.Const<'Lowercase', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TLowercaseMapping<_0, Context>, Input] : []; +export type TCapitalize = (Static.Token.Const<'Capitalize', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TCapitalizeMapping<_0, Context>, Input] : []; +export type TUncapitalize = (Static.Token.Const<'Uncapitalize', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TUncapitalizeMapping<_0, Context>, Input] : []; +export type TDate = Static.Token.Const<'Date', Input> extends [infer _0 extends 'Date', infer Input extends string] ? [S.TDateMapping<_0, Context>, Input] : []; +export type TUint8Array = Static.Token.Const<'Uint8Array', Input> extends [infer _0 extends 'Uint8Array', infer Input extends string] ? [S.TUint8ArrayMapping<_0, Context>, Input] : []; +export type TReference = Static.Token.Ident extends [infer _0 extends string, infer Input extends string] ? [S.TReferenceMapping<_0, Context>, Input] : []; +export declare const GenericReferenceParameterList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const GenericReferenceParameterList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const GenericReference: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const GenericArgumentsList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const GenericArgumentsList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const GenericArguments: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordString: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordNumber: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordBoolean: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordUndefined: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordNull: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordInteger: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordBigInt: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordUnknown: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordAny: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordNever: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordSymbol: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordVoid: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Keyword: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const LiteralString: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const LiteralNumber: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const LiteralBoolean: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Literal: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeyOf: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const IndexArray_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const IndexArray: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Extends: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Base: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Factor: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ExprTermTail: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ExprTerm: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ExprTail: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Expr: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Type: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const PropertyKey: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Readonly: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Optional: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Property: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const PropertyDelimiter: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const PropertyList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const PropertyList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const _Object: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ElementList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const ElementList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Tuple: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Parameter: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ParameterList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const ParameterList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Function: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Constructor: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Mapped: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const AsyncIterator: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Iterator: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Argument: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Awaited: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Array: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Record: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Promise: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ConstructorParameters: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const FunctionParameters: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const InstanceType: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ReturnType: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Partial: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Required: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Pick: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Omit: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Exclude: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Extract: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Uppercase: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Lowercase: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Capitalize: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Uncapitalize: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Date: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Uint8Array: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Reference: (input: string, context?: T.TProperties) => [unknown, string] | []; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.js b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.js new file mode 100644 index 0000000..fafe220 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/parser.js @@ -0,0 +1,191 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Constructor = exports.Function = exports.ParameterList = exports.ParameterList_0 = exports.Parameter = exports.Tuple = exports.ElementList = exports.ElementList_0 = exports._Object = exports.PropertyList = exports.PropertyList_0 = exports.PropertyDelimiter = exports.Property = exports.Optional = exports.Readonly = exports.PropertyKey = exports.Type = exports.Expr = exports.ExprTail = exports.ExprTerm = exports.ExprTermTail = exports.Factor = exports.Base = exports.Extends = exports.IndexArray = exports.IndexArray_0 = exports.KeyOf = exports.Literal = exports.LiteralBoolean = exports.LiteralNumber = exports.LiteralString = exports.Keyword = exports.KeywordVoid = exports.KeywordSymbol = exports.KeywordNever = exports.KeywordAny = exports.KeywordUnknown = exports.KeywordBigInt = exports.KeywordInteger = exports.KeywordNull = exports.KeywordUndefined = exports.KeywordBoolean = exports.KeywordNumber = exports.KeywordString = exports.GenericArguments = exports.GenericArgumentsList = exports.GenericArgumentsList_0 = exports.GenericReference = exports.GenericReferenceParameterList = exports.GenericReferenceParameterList_0 = void 0; +exports.Reference = exports.Uint8Array = exports.Date = exports.Uncapitalize = exports.Capitalize = exports.Lowercase = exports.Uppercase = exports.Extract = exports.Exclude = exports.Omit = exports.Pick = exports.Required = exports.Partial = exports.ReturnType = exports.InstanceType = exports.FunctionParameters = exports.ConstructorParameters = exports.Promise = exports.Record = exports.Array = exports.Awaited = exports.Argument = exports.Iterator = exports.AsyncIterator = exports.Mapped = void 0; +const index_1 = require("../parser/index"); +const S = __importStar(require("./mapping")); +const If = (result, left, right = () => []) => (result.length === 2 ? left(result) : right()); +const GenericReferenceParameterList_0 = (input, context, result = []) => If(If((0, exports.Type)(input, context), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.GenericReferenceParameterList_0)(input, context, [...result, _0]), () => [result, input]); +exports.GenericReferenceParameterList_0 = GenericReferenceParameterList_0; +const GenericReferenceParameterList = (input, context = {}) => If(If((0, exports.GenericReferenceParameterList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Type)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.GenericReferenceParameterListMapping(_0, context), input]); +exports.GenericReferenceParameterList = GenericReferenceParameterList; +const GenericReference = (input, context = {}) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.GenericReferenceParameterList)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.GenericReferenceMapping(_0, context), input]); +exports.GenericReference = GenericReference; +const GenericArgumentsList_0 = (input, context, result = []) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.GenericArgumentsList_0)(input, context, [...result, _0]), () => [result, input]); +exports.GenericArgumentsList_0 = GenericArgumentsList_0; +const GenericArgumentsList = (input, context = {}) => If(If((0, exports.GenericArgumentsList_0)(input, context), ([_0, input]) => If(If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.GenericArgumentsListMapping(_0, context), input]); +exports.GenericArgumentsList = GenericArgumentsList; +const GenericArguments = (input, context = {}) => If(If(index_1.Runtime.Token.Const('<', input), ([_0, input]) => If((0, exports.GenericArgumentsList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const('>', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.GenericArgumentsMapping(_0, context), input]); +exports.GenericArguments = GenericArguments; +const KeywordString = (input, context = {}) => If(index_1.Runtime.Token.Const('string', input), ([_0, input]) => [S.KeywordStringMapping(_0, context), input]); +exports.KeywordString = KeywordString; +const KeywordNumber = (input, context = {}) => If(index_1.Runtime.Token.Const('number', input), ([_0, input]) => [S.KeywordNumberMapping(_0, context), input]); +exports.KeywordNumber = KeywordNumber; +const KeywordBoolean = (input, context = {}) => If(index_1.Runtime.Token.Const('boolean', input), ([_0, input]) => [S.KeywordBooleanMapping(_0, context), input]); +exports.KeywordBoolean = KeywordBoolean; +const KeywordUndefined = (input, context = {}) => If(index_1.Runtime.Token.Const('undefined', input), ([_0, input]) => [S.KeywordUndefinedMapping(_0, context), input]); +exports.KeywordUndefined = KeywordUndefined; +const KeywordNull = (input, context = {}) => If(index_1.Runtime.Token.Const('null', input), ([_0, input]) => [S.KeywordNullMapping(_0, context), input]); +exports.KeywordNull = KeywordNull; +const KeywordInteger = (input, context = {}) => If(index_1.Runtime.Token.Const('integer', input), ([_0, input]) => [S.KeywordIntegerMapping(_0, context), input]); +exports.KeywordInteger = KeywordInteger; +const KeywordBigInt = (input, context = {}) => If(index_1.Runtime.Token.Const('bigint', input), ([_0, input]) => [S.KeywordBigIntMapping(_0, context), input]); +exports.KeywordBigInt = KeywordBigInt; +const KeywordUnknown = (input, context = {}) => If(index_1.Runtime.Token.Const('unknown', input), ([_0, input]) => [S.KeywordUnknownMapping(_0, context), input]); +exports.KeywordUnknown = KeywordUnknown; +const KeywordAny = (input, context = {}) => If(index_1.Runtime.Token.Const('any', input), ([_0, input]) => [S.KeywordAnyMapping(_0, context), input]); +exports.KeywordAny = KeywordAny; +const KeywordNever = (input, context = {}) => If(index_1.Runtime.Token.Const('never', input), ([_0, input]) => [S.KeywordNeverMapping(_0, context), input]); +exports.KeywordNever = KeywordNever; +const KeywordSymbol = (input, context = {}) => If(index_1.Runtime.Token.Const('symbol', input), ([_0, input]) => [S.KeywordSymbolMapping(_0, context), input]); +exports.KeywordSymbol = KeywordSymbol; +const KeywordVoid = (input, context = {}) => If(index_1.Runtime.Token.Const('void', input), ([_0, input]) => [S.KeywordVoidMapping(_0, context), input]); +exports.KeywordVoid = KeywordVoid; +const Keyword = (input, context = {}) => If(If((0, exports.KeywordString)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordNumber)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordBoolean)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordUndefined)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordNull)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordInteger)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordBigInt)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordUnknown)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordAny)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordNever)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordSymbol)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.KeywordVoid)(input, context), ([_0, input]) => [_0, input], () => [])))))))))))), ([_0, input]) => [S.KeywordMapping(_0, context), input]); +exports.Keyword = Keyword; +const LiteralString = (input, context = {}) => If(index_1.Runtime.Token.String(["'", '"', '`'], input), ([_0, input]) => [S.LiteralStringMapping(_0, context), input]); +exports.LiteralString = LiteralString; +const LiteralNumber = (input, context = {}) => If(index_1.Runtime.Token.Number(input), ([_0, input]) => [S.LiteralNumberMapping(_0, context), input]); +exports.LiteralNumber = LiteralNumber; +const LiteralBoolean = (input, context = {}) => If(If(index_1.Runtime.Token.Const('true', input), ([_0, input]) => [_0, input], () => If(index_1.Runtime.Token.Const('false', input), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.LiteralBooleanMapping(_0, context), input]); +exports.LiteralBoolean = LiteralBoolean; +const Literal = (input, context = {}) => If(If((0, exports.LiteralBoolean)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.LiteralNumber)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.LiteralString)(input, context), ([_0, input]) => [_0, input], () => []))), ([_0, input]) => [S.LiteralMapping(_0, context), input]); +exports.Literal = Literal; +const KeyOf = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('keyof', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.KeyOfMapping(_0, context), input]); +exports.KeyOf = KeyOf; +const IndexArray_0 = (input, context, result = []) => If(If(If(index_1.Runtime.Token.Const('[', input), ([_0, input]) => If((0, exports.Type)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(']', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const('[', input), ([_0, input]) => If(index_1.Runtime.Token.Const(']', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => (0, exports.IndexArray_0)(input, context, [...result, _0]), () => [result, input]); +exports.IndexArray_0 = IndexArray_0; +const IndexArray = (input, context = {}) => If((0, exports.IndexArray_0)(input, context), ([_0, input]) => [S.IndexArrayMapping(_0, context), input]); +exports.IndexArray = IndexArray; +const Extends = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('extends', input), ([_0, input]) => If((0, exports.Type)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const('?', input), ([_2, input]) => If((0, exports.Type)(input, context), ([_3, input]) => If(index_1.Runtime.Token.Const(':', input), ([_4, input]) => If((0, exports.Type)(input, context), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExtendsMapping(_0, context), input]); +exports.Extends = Extends; +const Base = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('(', input), ([_0, input]) => If((0, exports.Type)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(')', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If((0, exports.Keyword)(input, context), ([_0, input]) => [_0, input], () => If((0, exports._Object)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Tuple)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Literal)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Constructor)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Function)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Mapped)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.AsyncIterator)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Iterator)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.ConstructorParameters)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.FunctionParameters)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.InstanceType)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.ReturnType)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Argument)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Awaited)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Array)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Record)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Promise)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Partial)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Required)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Pick)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Omit)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Exclude)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Extract)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Uppercase)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Lowercase)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Capitalize)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Uncapitalize)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Date)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Uint8Array)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.GenericReference)(input, context), ([_0, input]) => [_0, input], () => If((0, exports.Reference)(input, context), ([_0, input]) => [_0, input], () => []))))))))))))))))))))))))))))))))), ([_0, input]) => [S.BaseMapping(_0, context), input]); +exports.Base = Base; +const Factor = (input, context = {}) => If(If((0, exports.KeyOf)(input, context), ([_0, input]) => If((0, exports.Base)(input, context), ([_1, input]) => If((0, exports.IndexArray)(input, context), ([_2, input]) => If((0, exports.Extends)(input, context), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.FactorMapping(_0, context), input]); +exports.Factor = Factor; +const ExprTermTail = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('&', input), ([_0, input]) => If((0, exports.Factor)(input, context), ([_1, input]) => If((0, exports.ExprTermTail)(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExprTermTailMapping(_0, context), input]); +exports.ExprTermTail = ExprTermTail; +const ExprTerm = (input, context = {}) => If(If((0, exports.Factor)(input, context), ([_0, input]) => If((0, exports.ExprTermTail)(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ExprTermMapping(_0, context), input]); +exports.ExprTerm = ExprTerm; +const ExprTail = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('|', input), ([_0, input]) => If((0, exports.ExprTerm)(input, context), ([_1, input]) => If((0, exports.ExprTail)(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExprTailMapping(_0, context), input]); +exports.ExprTail = ExprTail; +const Expr = (input, context = {}) => If(If((0, exports.ExprTerm)(input, context), ([_0, input]) => If((0, exports.ExprTail)(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ExprMapping(_0, context), input]); +exports.Expr = Expr; +const Type = (input, context = {}) => If(If(If((0, exports.GenericArguments)(input, context), ([_0, input]) => (0, exports.Expr)(input, _0), () => []), ([_0, input]) => [_0, input], () => If((0, exports.Expr)(input, context), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.TypeMapping(_0, context), input]); +exports.Type = Type; +const PropertyKey = (input, context = {}) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => [_0, input], () => If(index_1.Runtime.Token.String(["'", '"'], input), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.PropertyKeyMapping(_0, context), input]); +exports.PropertyKey = PropertyKey; +const Readonly = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('readonly', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ReadonlyMapping(_0, context), input]); +exports.Readonly = Readonly; +const Optional = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const('?', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.OptionalMapping(_0, context), input]); +exports.Optional = Optional; +const Property = (input, context = {}) => If(If((0, exports.Readonly)(input, context), ([_0, input]) => If((0, exports.PropertyKey)(input, context), ([_1, input]) => If((0, exports.Optional)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(':', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => [[_0, _1, _2, _3, _4], input]))))), ([_0, input]) => [S.PropertyMapping(_0, context), input]); +exports.Property = Property; +const PropertyDelimiter = (input, context = {}) => If(If(If(index_1.Runtime.Token.Const(',', input), ([_0, input]) => If(index_1.Runtime.Token.Const('\n', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const(';', input), ([_0, input]) => If(index_1.Runtime.Token.Const('\n', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const(',', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const(';', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If(If(index_1.Runtime.Token.Const('\n', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => []))))), ([_0, input]) => [S.PropertyDelimiterMapping(_0, context), input]); +exports.PropertyDelimiter = PropertyDelimiter; +const PropertyList_0 = (input, context, result = []) => If(If((0, exports.Property)(input, context), ([_0, input]) => If((0, exports.PropertyDelimiter)(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.PropertyList_0)(input, context, [...result, _0]), () => [result, input]); +exports.PropertyList_0 = PropertyList_0; +const PropertyList = (input, context = {}) => If(If((0, exports.PropertyList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Property)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.PropertyListMapping(_0, context), input]); +exports.PropertyList = PropertyList; +const _Object = (input, context = {}) => If(If(index_1.Runtime.Token.Const('{', input), ([_0, input]) => If((0, exports.PropertyList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const('}', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.ObjectMapping(_0, context), input]); +exports._Object = _Object; +const ElementList_0 = (input, context, result = []) => If(If((0, exports.Type)(input, context), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.ElementList_0)(input, context, [...result, _0]), () => [result, input]); +exports.ElementList_0 = ElementList_0; +const ElementList = (input, context = {}) => If(If((0, exports.ElementList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Type)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ElementListMapping(_0, context), input]); +exports.ElementList = ElementList; +const Tuple = (input, context = {}) => If(If(index_1.Runtime.Token.Const('[', input), ([_0, input]) => If((0, exports.ElementList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(']', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.TupleMapping(_0, context), input]); +exports.Tuple = Tuple; +const Parameter = (input, context = {}) => If(If(index_1.Runtime.Token.Ident(input), ([_0, input]) => If(index_1.Runtime.Token.Const(':', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.ParameterMapping(_0, context), input]); +exports.Parameter = Parameter; +const ParameterList_0 = (input, context, result = []) => If(If((0, exports.Parameter)(input, context), ([_0, input]) => If(index_1.Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => (0, exports.ParameterList_0)(input, context, [...result, _0]), () => [result, input]); +exports.ParameterList_0 = ParameterList_0; +const ParameterList = (input, context = {}) => If(If((0, exports.ParameterList_0)(input, context), ([_0, input]) => If(If(If((0, exports.Parameter)(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ParameterListMapping(_0, context), input]); +exports.ParameterList = ParameterList; +const Function = (input, context = {}) => If(If(index_1.Runtime.Token.Const('(', input), ([_0, input]) => If((0, exports.ParameterList)(input, context), ([_1, input]) => If(index_1.Runtime.Token.Const(')', input), ([_2, input]) => If(index_1.Runtime.Token.Const('=>', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => [[_0, _1, _2, _3, _4], input]))))), ([_0, input]) => [S.FunctionMapping(_0, context), input]); +exports.Function = Function; +const Constructor = (input, context = {}) => If(If(index_1.Runtime.Token.Const('new', input), ([_0, input]) => If(index_1.Runtime.Token.Const('(', input), ([_1, input]) => If((0, exports.ParameterList)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(')', input), ([_3, input]) => If(index_1.Runtime.Token.Const('=>', input), ([_4, input]) => If((0, exports.Type)(input, context), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ConstructorMapping(_0, context), input]); +exports.Constructor = Constructor; +const Mapped = (input, context = {}) => If(If(index_1.Runtime.Token.Const('{', input), ([_0, input]) => If(index_1.Runtime.Token.Const('[', input), ([_1, input]) => If(index_1.Runtime.Token.Ident(input), ([_2, input]) => If(index_1.Runtime.Token.Const('in', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const(']', input), ([_5, input]) => If(index_1.Runtime.Token.Const(':', input), ([_6, input]) => If((0, exports.Type)(input, context), ([_7, input]) => If(index_1.Runtime.Token.Const('}', input), ([_8, input]) => [[_0, _1, _2, _3, _4, _5, _6, _7, _8], input]))))))))), ([_0, input]) => [S.MappedMapping(_0, context), input]); +exports.Mapped = Mapped; +const AsyncIterator = (input, context = {}) => If(If(index_1.Runtime.Token.Const('AsyncIterator', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.AsyncIteratorMapping(_0, context), input]); +exports.AsyncIterator = AsyncIterator; +const Iterator = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Iterator', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.IteratorMapping(_0, context), input]); +exports.Iterator = Iterator; +const Argument = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Argument', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ArgumentMapping(_0, context), input]); +exports.Argument = Argument; +const Awaited = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Awaited', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.AwaitedMapping(_0, context), input]); +exports.Awaited = Awaited; +const Array = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Array', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ArrayMapping(_0, context), input]); +exports.Array = Array; +const Record = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Record', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.RecordMapping(_0, context), input]); +exports.Record = Record; +const Promise = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Promise', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.PromiseMapping(_0, context), input]); +exports.Promise = Promise; +const ConstructorParameters = (input, context = {}) => If(If(index_1.Runtime.Token.Const('ConstructorParameters', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ConstructorParametersMapping(_0, context), input]); +exports.ConstructorParameters = ConstructorParameters; +const FunctionParameters = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Parameters', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.FunctionParametersMapping(_0, context), input]); +exports.FunctionParameters = FunctionParameters; +const InstanceType = (input, context = {}) => If(If(index_1.Runtime.Token.Const('InstanceType', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.InstanceTypeMapping(_0, context), input]); +exports.InstanceType = InstanceType; +const ReturnType = (input, context = {}) => If(If(index_1.Runtime.Token.Const('ReturnType', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ReturnTypeMapping(_0, context), input]); +exports.ReturnType = ReturnType; +const Partial = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Partial', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.PartialMapping(_0, context), input]); +exports.Partial = Partial; +const Required = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Required', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.RequiredMapping(_0, context), input]); +exports.Required = Required; +const Pick = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Pick', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.PickMapping(_0, context), input]); +exports.Pick = Pick; +const Omit = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Omit', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.OmitMapping(_0, context), input]); +exports.Omit = Omit; +const Exclude = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Exclude', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ExcludeMapping(_0, context), input]); +exports.Exclude = Exclude; +const Extract = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Extract', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const(',', input), ([_3, input]) => If((0, exports.Type)(input, context), ([_4, input]) => If(index_1.Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ExtractMapping(_0, context), input]); +exports.Extract = Extract; +const Uppercase = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Uppercase', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.UppercaseMapping(_0, context), input]); +exports.Uppercase = Uppercase; +const Lowercase = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Lowercase', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.LowercaseMapping(_0, context), input]); +exports.Lowercase = Lowercase; +const Capitalize = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Capitalize', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.CapitalizeMapping(_0, context), input]); +exports.Capitalize = Capitalize; +const Uncapitalize = (input, context = {}) => If(If(index_1.Runtime.Token.Const('Uncapitalize', input), ([_0, input]) => If(index_1.Runtime.Token.Const('<', input), ([_1, input]) => If((0, exports.Type)(input, context), ([_2, input]) => If(index_1.Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.UncapitalizeMapping(_0, context), input]); +exports.Uncapitalize = Uncapitalize; +const Date = (input, context = {}) => If(index_1.Runtime.Token.Const('Date', input), ([_0, input]) => [S.DateMapping(_0, context), input]); +exports.Date = Date; +const Uint8Array = (input, context = {}) => If(index_1.Runtime.Token.Const('Uint8Array', input), ([_0, input]) => [S.Uint8ArrayMapping(_0, context), input]); +exports.Uint8Array = Uint8Array; +const Reference = (input, context = {}) => If(index_1.Runtime.Token.Ident(input), ([_0, input]) => [S.ReferenceMapping(_0, context), input]); +exports.Reference = Reference; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.d.ts new file mode 100644 index 0000000..98df91e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.d.ts @@ -0,0 +1,12 @@ +import * as t from '../type/index'; +import { TType } from './parser'; +/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */ +export declare function NoInfer, Input extends string>(context: Context, input: Input, options?: t.SchemaOptions): t.TSchema; +/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */ +export declare function NoInfer(input: Input, options?: t.SchemaOptions): t.TSchema; +/** `[Experimental]` Parses type expressions into TypeBox types */ +export type TSyntax, Code extends string> = (TType extends [infer Type extends t.TSchema, string] ? Type : t.TNever); +/** `[Experimental]` Parses type expressions into TypeBox types */ +export declare function Syntax, Input extends string>(context: Context, input: Input, options?: t.SchemaOptions): TSyntax; +/** `[Experimental]` Parses type expressions into TypeBox types */ +export declare function Syntax(annotation: Input, options?: t.SchemaOptions): TSyntax<{}, Input>; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.js b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.js new file mode 100644 index 0000000..315e786 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/syntax/syntax.js @@ -0,0 +1,54 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NoInfer = NoInfer; +exports.Syntax = Syntax; +const t = __importStar(require("../type/index")); +const parser_1 = require("./parser"); +/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */ +// prettier-ignore +function NoInfer(...args) { + const withContext = typeof args[0] === 'string' ? false : true; + const [context, code, options] = withContext ? [args[0], args[1], args[2] || {}] : [{}, args[0], args[1] || {}]; + const result = (0, parser_1.Type)(code, context)[0]; + return t.KindGuard.IsSchema(result) + ? t.CloneType(result, options) + : t.Never(options); +} +/** `[Experimental]` Parses type expressions into TypeBox types */ +function Syntax(...args) { + return NoInfer.apply(null, args); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/system/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/system/index.d.ts new file mode 100644 index 0000000..c6ef9f1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/system/index.d.ts @@ -0,0 +1,2 @@ +export * from './policy'; +export * from './system'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/system/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/system/index.js new file mode 100644 index 0000000..4c56b5b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/system/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./policy"), exports); +__exportStar(require("./system"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/system/policy.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/system/policy.d.ts new file mode 100644 index 0000000..bb6307f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/system/policy.d.ts @@ -0,0 +1,29 @@ +export declare namespace TypeSystemPolicy { + /** + * Configures the instantiation behavior of TypeBox types. The `default` option assigns raw JavaScript + * references for embedded types, which may cause side effects if type properties are explicitly updated + * outside the TypeBox type builder. The `clone` option creates copies of any shared types upon creation, + * preventing unintended side effects. The `freeze` option applies `Object.freeze()` to the type, making + * it fully readonly and immutable. Implementations should use `default` whenever possible, as it is the + * fastest way to instantiate types. The default setting is `default`. + */ + let InstanceMode: 'default' | 'clone' | 'freeze'; + /** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */ + let ExactOptionalPropertyTypes: boolean; + /** Sets whether arrays should be treated as a kind of objects. The default is `false` */ + let AllowArrayObject: boolean; + /** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */ + let AllowNaN: boolean; + /** Sets whether `null` should validate for void types. The default is `false` */ + let AllowNullVoid: boolean; + /** Checks this value using the ExactOptionalPropertyTypes policy */ + function IsExactOptionalProperty(value: Record, key: string): boolean; + /** Checks this value using the AllowArrayObjects policy */ + function IsObjectLike(value: unknown): value is Record; + /** Checks this value as a record using the AllowArrayObjects policy */ + function IsRecordLike(value: unknown): value is Record; + /** Checks this value using the AllowNaN policy */ + function IsNumberLike(value: unknown): value is number; + /** Checks this value using the AllowVoidNull policy */ + function IsVoidLike(value: unknown): value is void; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/system/policy.js b/ui/node_modules/@sinclair/typebox/build/cjs/system/policy.js new file mode 100644 index 0000000..78c1651 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/system/policy.js @@ -0,0 +1,58 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypeSystemPolicy = void 0; +const index_1 = require("../value/guard/index"); +var TypeSystemPolicy; +(function (TypeSystemPolicy) { + // ------------------------------------------------------------------ + // TypeSystemPolicy: Instancing + // ------------------------------------------------------------------ + /** + * Configures the instantiation behavior of TypeBox types. The `default` option assigns raw JavaScript + * references for embedded types, which may cause side effects if type properties are explicitly updated + * outside the TypeBox type builder. The `clone` option creates copies of any shared types upon creation, + * preventing unintended side effects. The `freeze` option applies `Object.freeze()` to the type, making + * it fully readonly and immutable. Implementations should use `default` whenever possible, as it is the + * fastest way to instantiate types. The default setting is `default`. + */ + TypeSystemPolicy.InstanceMode = 'default'; + // ------------------------------------------------------------------ + // TypeSystemPolicy: Checking + // ------------------------------------------------------------------ + /** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */ + TypeSystemPolicy.ExactOptionalPropertyTypes = false; + /** Sets whether arrays should be treated as a kind of objects. The default is `false` */ + TypeSystemPolicy.AllowArrayObject = false; + /** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */ + TypeSystemPolicy.AllowNaN = false; + /** Sets whether `null` should validate for void types. The default is `false` */ + TypeSystemPolicy.AllowNullVoid = false; + /** Checks this value using the ExactOptionalPropertyTypes policy */ + function IsExactOptionalProperty(value, key) { + return TypeSystemPolicy.ExactOptionalPropertyTypes ? key in value : value[key] !== undefined; + } + TypeSystemPolicy.IsExactOptionalProperty = IsExactOptionalProperty; + /** Checks this value using the AllowArrayObjects policy */ + function IsObjectLike(value) { + const isObject = (0, index_1.IsObject)(value); + return TypeSystemPolicy.AllowArrayObject ? isObject : isObject && !(0, index_1.IsArray)(value); + } + TypeSystemPolicy.IsObjectLike = IsObjectLike; + /** Checks this value as a record using the AllowArrayObjects policy */ + function IsRecordLike(value) { + return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array); + } + TypeSystemPolicy.IsRecordLike = IsRecordLike; + /** Checks this value using the AllowNaN policy */ + function IsNumberLike(value) { + return TypeSystemPolicy.AllowNaN ? (0, index_1.IsNumber)(value) : Number.isFinite(value); + } + TypeSystemPolicy.IsNumberLike = IsNumberLike; + /** Checks this value using the AllowVoidNull policy */ + function IsVoidLike(value) { + const isUndefined = (0, index_1.IsUndefined)(value); + return TypeSystemPolicy.AllowNullVoid ? isUndefined || value === null : isUndefined; + } + TypeSystemPolicy.IsVoidLike = IsVoidLike; +})(TypeSystemPolicy || (exports.TypeSystemPolicy = TypeSystemPolicy = {})); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/system/system.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/system/system.d.ts new file mode 100644 index 0000000..924cae7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/system/system.d.ts @@ -0,0 +1,16 @@ +import { type TUnsafe } from '../type/unsafe/index'; +import { TypeBoxError } from '../type/error/index'; +export declare class TypeSystemDuplicateTypeKind extends TypeBoxError { + constructor(kind: string); +} +export declare class TypeSystemDuplicateFormat extends TypeBoxError { + constructor(kind: string); +} +export type TypeFactoryFunction> = (options?: Partial) => TUnsafe; +/** Creates user defined types and formats and provides overrides for value checking behaviours */ +export declare namespace TypeSystem { + /** Creates a new type */ + function Type>(kind: string, check: (options: Options, value: unknown) => boolean): TypeFactoryFunction; + /** Creates a new string format */ + function Format(format: F, check: (value: string) => boolean): F; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/system/system.js b/ui/node_modules/@sinclair/typebox/build/cjs/system/system.js new file mode 100644 index 0000000..d23cec6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/system/system.js @@ -0,0 +1,43 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypeSystem = exports.TypeSystemDuplicateFormat = exports.TypeSystemDuplicateTypeKind = void 0; +const index_1 = require("../type/registry/index"); +const index_2 = require("../type/unsafe/index"); +const index_3 = require("../type/symbols/index"); +const index_4 = require("../type/error/index"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class TypeSystemDuplicateTypeKind extends index_4.TypeBoxError { + constructor(kind) { + super(`Duplicate type kind '${kind}' detected`); + } +} +exports.TypeSystemDuplicateTypeKind = TypeSystemDuplicateTypeKind; +class TypeSystemDuplicateFormat extends index_4.TypeBoxError { + constructor(kind) { + super(`Duplicate string format '${kind}' detected`); + } +} +exports.TypeSystemDuplicateFormat = TypeSystemDuplicateFormat; +/** Creates user defined types and formats and provides overrides for value checking behaviours */ +var TypeSystem; +(function (TypeSystem) { + /** Creates a new type */ + function Type(kind, check) { + if (index_1.TypeRegistry.Has(kind)) + throw new TypeSystemDuplicateTypeKind(kind); + index_1.TypeRegistry.Set(kind, check); + return (options = {}) => (0, index_2.Unsafe)({ ...options, [index_3.Kind]: kind }); + } + TypeSystem.Type = Type; + /** Creates a new string format */ + function Format(format, check) { + if (index_1.FormatRegistry.Has(format)) + throw new TypeSystemDuplicateFormat(format); + index_1.FormatRegistry.Set(format, check); + return format; + } + TypeSystem.Format = Format; +})(TypeSystem || (exports.TypeSystem = TypeSystem = {})); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.d.ts new file mode 100644 index 0000000..b89a13b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.d.ts @@ -0,0 +1,8 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TAny extends TSchema { + [Kind]: 'Any'; + static: any; +} +/** `[Json]` Creates an Any type */ +export declare function Any(options?: SchemaOptions): TAny; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.js new file mode 100644 index 0000000..6467f04 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/any.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Any = Any; +const index_1 = require("../create/index"); +const index_2 = require("../symbols/index"); +/** `[Json]` Creates an Any type */ +function Any(options) { + return (0, index_1.CreateType)({ [index_2.Kind]: 'Any' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.d.ts new file mode 100644 index 0000000..a89969c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.d.ts @@ -0,0 +1 @@ +export * from './any'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.js new file mode 100644 index 0000000..8fccabe --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/any/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./any"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.d.ts new file mode 100644 index 0000000..bff6979 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.d.ts @@ -0,0 +1,9 @@ +import type { TSchema } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TArgument extends TSchema { + [Kind]: 'Argument'; + static: unknown; + index: Index; +} +/** `[JavaScript]` Creates an Argument Type. */ +export declare function Argument(index: Index): TArgument; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.js new file mode 100644 index 0000000..b2aac9c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/argument.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Argument = Argument; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates an Argument Type. */ +function Argument(index) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Argument', index }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.d.ts new file mode 100644 index 0000000..3f58c3e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.d.ts @@ -0,0 +1 @@ +export * from './argument'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.js new file mode 100644 index 0000000..1eec367 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/argument/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./argument"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.d.ts new file mode 100644 index 0000000..1b0e49b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.d.ts @@ -0,0 +1,28 @@ +import { Ensure } from '../helpers/index'; +import type { SchemaOptions, TSchema } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +export interface ArrayOptions extends SchemaOptions { + /** The minimum number of items in this array */ + minItems?: number; + /** The maximum number of items in this array */ + maxItems?: number; + /** Should this schema contain unique items */ + uniqueItems?: boolean; + /** A schema for which some elements should match */ + contains?: TSchema; + /** A minimum number of contains schema matches */ + minContains?: number; + /** A maximum number of contains schema matches */ + maxContains?: number; +} +type ArrayStatic = Ensure[]>; +export interface TArray extends TSchema, ArrayOptions { + [Kind]: 'Array'; + static: ArrayStatic; + type: 'array'; + items: T; +} +/** `[Json]` Creates an Array type */ +export declare function Array(items: Type, options?: ArrayOptions): TArray; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.js new file mode 100644 index 0000000..ffbac93 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/array.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Array = Array; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates an Array type */ +function Array(items, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Array', type: 'array', items }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.d.ts new file mode 100644 index 0000000..bd9a11d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.d.ts @@ -0,0 +1 @@ +export * from './array'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.js new file mode 100644 index 0000000..50527d7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/array/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./array"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.d.ts new file mode 100644 index 0000000..217a44b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.d.ts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +export interface TAsyncIterator extends TSchema { + [Kind]: 'AsyncIterator'; + static: AsyncIterableIterator>; + type: 'AsyncIterator'; + items: T; +} +/** `[JavaScript]` Creates a AsyncIterator type */ +export declare function AsyncIterator(items: T, options?: SchemaOptions): TAsyncIterator; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.js new file mode 100644 index 0000000..a307b15 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/async-iterator.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AsyncIterator = AsyncIterator; +const index_1 = require("../symbols/index"); +const type_1 = require("../create/type"); +/** `[JavaScript]` Creates a AsyncIterator type */ +function AsyncIterator(items, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'AsyncIterator', type: 'AsyncIterator', items }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.d.ts new file mode 100644 index 0000000..4003a17 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.d.ts @@ -0,0 +1 @@ +export * from './async-iterator'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.js new file mode 100644 index 0000000..c90dcb3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/async-iterator/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./async-iterator"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.d.ts new file mode 100644 index 0000000..61e3696 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.d.ts @@ -0,0 +1,14 @@ +import { Ensure } from '../helpers/index'; +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TComputed } from '../computed/index'; +import { type TIntersect } from '../intersect/index'; +import { type TUnion } from '../union/index'; +import { type TPromise } from '../promise/index'; +import { type TRef } from '../ref/index'; +type TFromComputed = Ensure<(TComputed<'Awaited', [TComputed]>)>; +type TFromRef = Ensure]>>; +type TFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest]> : Result); +export type TAwaited = (Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TPromise ? TAwaited : Type); +/** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ +export declare function Awaited(type: T, options?: SchemaOptions): TAwaited; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.js new file mode 100644 index 0000000..1010eb7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/awaited.js @@ -0,0 +1,41 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Awaited = Awaited; +const type_1 = require("../create/type"); +const index_1 = require("../computed/index"); +const index_2 = require("../intersect/index"); +const index_3 = require("../union/index"); +const index_4 = require("../ref/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function FromComputed(target, parameters) { + return (0, index_1.Computed)('Awaited', [(0, index_1.Computed)(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return (0, index_1.Computed)('Awaited', [(0, index_4.Ref)($ref)]); +} +// prettier-ignore +function FromIntersect(types) { + return (0, index_2.Intersect)(FromRest(types)); +} +// prettier-ignore +function FromUnion(types) { + return (0, index_3.Union)(FromRest(types)); +} +// prettier-ignore +function FromPromise(type) { + return Awaited(type); +} +// prettier-ignore +function FromRest(types) { + return types.map(type => Awaited(type)); +} +/** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ +function Awaited(type, options) { + return (0, type_1.CreateType)((0, kind_1.IsComputed)(type) ? FromComputed(type.target, type.parameters) : (0, kind_1.IsIntersect)(type) ? FromIntersect(type.allOf) : (0, kind_1.IsUnion)(type) ? FromUnion(type.anyOf) : (0, kind_1.IsPromise)(type) ? FromPromise(type.item) : (0, kind_1.IsRef)(type) ? FromRef(type.$ref) : type, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.d.ts new file mode 100644 index 0000000..57e4163 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.d.ts @@ -0,0 +1 @@ +export * from './awaited'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.js new file mode 100644 index 0000000..7537d67 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/awaited/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./awaited"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.d.ts new file mode 100644 index 0000000..f9b30d0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.d.ts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface BigIntOptions extends SchemaOptions { + exclusiveMaximum?: bigint; + exclusiveMinimum?: bigint; + maximum?: bigint; + minimum?: bigint; + multipleOf?: bigint; +} +export interface TBigInt extends TSchema, BigIntOptions { + [Kind]: 'BigInt'; + static: bigint; + type: 'bigint'; +} +/** `[JavaScript]` Creates a BigInt type */ +export declare function BigInt(options?: BigIntOptions): TBigInt; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.js new file mode 100644 index 0000000..d99a8de --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/bigint.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BigInt = BigInt; +const index_1 = require("../symbols/index"); +const index_2 = require("../create/index"); +/** `[JavaScript]` Creates a BigInt type */ +function BigInt(options) { + return (0, index_2.CreateType)({ [index_1.Kind]: 'BigInt', type: 'bigint' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.d.ts new file mode 100644 index 0000000..b5bcf27 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.d.ts @@ -0,0 +1 @@ +export * from './bigint'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.js new file mode 100644 index 0000000..ab93382 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/bigint/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./bigint"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.d.ts new file mode 100644 index 0000000..208b70d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.d.ts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TBoolean extends TSchema { + [Kind]: 'Boolean'; + static: boolean; + type: 'boolean'; +} +/** `[Json]` Creates a Boolean type */ +export declare function Boolean(options?: SchemaOptions): TBoolean; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.js new file mode 100644 index 0000000..9956ad1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/boolean.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Boolean = Boolean; +const index_1 = require("../symbols/index"); +const index_2 = require("../create/index"); +/** `[Json]` Creates a Boolean type */ +function Boolean(options) { + return (0, index_2.CreateType)({ [index_1.Kind]: 'Boolean', type: 'boolean' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.d.ts new file mode 100644 index 0000000..01af61b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.d.ts @@ -0,0 +1 @@ +export * from './boolean'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.js new file mode 100644 index 0000000..64f51d2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/boolean/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./boolean"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.d.ts new file mode 100644 index 0000000..5f14d55 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.d.ts @@ -0,0 +1,2 @@ +export * from './type'; +export * from './value'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.js new file mode 100644 index 0000000..02d86c7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./type"), exports); +__exportStar(require("./value"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.d.ts new file mode 100644 index 0000000..e423dea --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.d.ts @@ -0,0 +1,5 @@ +import { TSchema, SchemaOptions } from '../schema/index'; +/** Clones a Rest */ +export declare function CloneRest(schemas: T): T; +/** Clones a Type */ +export declare function CloneType(schema: T, options?: SchemaOptions): T; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.js new file mode 100644 index 0000000..8338bf1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/type.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CloneRest = CloneRest; +exports.CloneType = CloneType; +const value_1 = require("./value"); +/** Clones a Rest */ +function CloneRest(schemas) { + return schemas.map((schema) => CloneType(schema)); +} +/** Clones a Type */ +function CloneType(schema, options) { + return options === undefined ? (0, value_1.Clone)(schema) : (0, value_1.Clone)({ ...options, ...schema }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.d.ts new file mode 100644 index 0000000..30aa085 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.d.ts @@ -0,0 +1,2 @@ +/** Clones a value */ +export declare function Clone(value: T): T; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.js new file mode 100644 index 0000000..bd06b7c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/clone/value.js @@ -0,0 +1,73 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Clone = Clone; +const ValueGuard = __importStar(require("../guard/value")); +function ArrayType(value) { + return value.map((value) => Visit(value)); +} +function DateType(value) { + return new Date(value.getTime()); +} +function Uint8ArrayType(value) { + return new Uint8Array(value); +} +function RegExpType(value) { + return new RegExp(value.source, value.flags); +} +function ObjectType(value) { + const result = {}; + for (const key of Object.getOwnPropertyNames(value)) { + result[key] = Visit(value[key]); + } + for (const key of Object.getOwnPropertySymbols(value)) { + result[key] = Visit(value[key]); + } + return result; +} +// prettier-ignore +function Visit(value) { + return (ValueGuard.IsArray(value) ? ArrayType(value) : + ValueGuard.IsDate(value) ? DateType(value) : + ValueGuard.IsUint8Array(value) ? Uint8ArrayType(value) : + ValueGuard.IsRegExp(value) ? RegExpType(value) : + ValueGuard.IsObject(value) ? ObjectType(value) : + value); +} +/** Clones a value */ +function Clone(value) { + return Visit(value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.d.ts new file mode 100644 index 0000000..7b3d6f2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.d.ts @@ -0,0 +1,18 @@ +import type { TSchema } from '../schema/index'; +import type { Evaluate } from '../helpers/index'; +import { type TIntersectEvaluated } from '../intersect/index'; +import { type TIndexFromPropertyKeys } from '../indexed/index'; +import { type TKeyOfPropertyKeys } from '../keyof/index'; +import { type TNever } from '../never/index'; +import { type TObject, type TProperties, type ObjectOptions } from '../object/index'; +import { TSetDistinct } from '../sets/index'; +type TCompositeKeys = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeKeys]> : TSetDistinct); +type TFilterNever = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? TFilterNever : TFilterNever : Acc); +type TCompositeProperty = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeProperty]> : TFilterNever); +type TCompositeProperties = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TCompositeProperties>; +}> : Acc); +type TCompositeEvaluate, P extends TProperties = Evaluate>, R extends TSchema = TObject

> = R; +export type TComposite = TCompositeEvaluate; +export declare function Composite(T: [...T], options?: ObjectOptions): TComposite; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.js new file mode 100644 index 0000000..74b1d66 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/composite.js @@ -0,0 +1,46 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Composite = Composite; +const index_1 = require("../intersect/index"); +const index_2 = require("../indexed/index"); +const index_3 = require("../keyof/index"); +const index_4 = require("../object/index"); +const index_5 = require("../sets/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function CompositeKeys(T) { + const Acc = []; + for (const L of T) + Acc.push(...(0, index_3.KeyOfPropertyKeys)(L)); + return (0, index_5.SetDistinct)(Acc); +} +// prettier-ignore +function FilterNever(T) { + return T.filter(L => !(0, kind_1.IsNever)(L)); +} +// prettier-ignore +function CompositeProperty(T, K) { + const Acc = []; + for (const L of T) + Acc.push(...(0, index_2.IndexFromPropertyKeys)(L, [K])); + return FilterNever(Acc); +} +// prettier-ignore +function CompositeProperties(T, K) { + const Acc = {}; + for (const L of K) { + Acc[L] = (0, index_1.IntersectEvaluated)(CompositeProperty(T, L)); + } + return Acc; +} +// prettier-ignore +function Composite(T, options) { + const K = CompositeKeys(T); + const P = CompositeProperties(T, K); + const R = (0, index_4.Object)(P, options); + return R; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.d.ts new file mode 100644 index 0000000..30dfb13 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.d.ts @@ -0,0 +1 @@ +export * from './composite'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.js new file mode 100644 index 0000000..bf3a8ee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/composite/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./composite"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.d.ts new file mode 100644 index 0000000..51e8c18 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.d.ts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/symbols'; +export interface TComputed extends TSchema { + [Kind]: 'Computed'; + target: Target; + parameters: Parameters; +} +/** `[Internal]` Creates a deferred computed type. This type is used exclusively in modules to defer resolution of computable types that contain interior references */ +export declare function Computed(target: Target, parameters: [...Parameters], options?: SchemaOptions): TComputed; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.js new file mode 100644 index 0000000..a299e82 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/computed.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Computed = Computed; +const index_1 = require("../create/index"); +const symbols_1 = require("../symbols/symbols"); +/** `[Internal]` Creates a deferred computed type. This type is used exclusively in modules to defer resolution of computable types that contain interior references */ +function Computed(target, parameters, options) { + return (0, index_1.CreateType)({ [symbols_1.Kind]: 'Computed', target, parameters }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.d.ts new file mode 100644 index 0000000..ca21f6d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.d.ts @@ -0,0 +1 @@ +export * from './computed'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.js new file mode 100644 index 0000000..e060d11 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/computed/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./computed"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.d.ts new file mode 100644 index 0000000..62deab2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.d.ts @@ -0,0 +1,27 @@ +import type { AssertRest, Evaluate } from '../helpers/index'; +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TAny } from '../any/index'; +import { type TBigInt } from '../bigint/index'; +import { type TDate } from '../date/index'; +import { type TFunction } from '../function/index'; +import { type TLiteral } from '../literal/index'; +import { type TNever } from '../never/index'; +import { type TNull } from '../null/index'; +import { type TObject } from '../object/index'; +import { type TSymbol } from '../symbol/index'; +import { type TTuple } from '../tuple/index'; +import { type TReadonly } from '../readonly/index'; +import { type TUndefined } from '../undefined/index'; +import { type TUint8Array } from '../uint8array/index'; +import { type TUnknown } from '../unknown/index'; +type TFromArray = T extends readonly [infer L extends unknown, ...infer R extends unknown[]] ? [FromValue, ...TFromArray] : T; +type TFromProperties> = { + -readonly [K in keyof T]: FromValue extends infer R extends TSchema ? TReadonly : TReadonly; +}; +type TConditionalReadonly = Root extends true ? T : TReadonly; +type FromValue = T extends AsyncIterableIterator ? TConditionalReadonly : T extends IterableIterator ? TConditionalReadonly : T extends readonly unknown[] ? TReadonly>>> : T extends Uint8Array ? TUint8Array : T extends Date ? TDate : T extends Record ? TConditionalReadonly>>, Root> : T extends Function ? TConditionalReadonly, Root> : T extends undefined ? TUndefined : T extends null ? TNull : T extends symbol ? TSymbol : T extends number ? TLiteral : T extends boolean ? TLiteral : T extends string ? TLiteral : T extends bigint ? TBigInt : TObject<{}>; +declare function FromValue(value: T, root: Root): FromValue; +export type TConst = FromValue; +/** `[JavaScript]` Creates a readonly const type from the given value. */ +export declare function Const(T: T, options?: SchemaOptions): TConst; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.js new file mode 100644 index 0000000..83dbff6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/const.js @@ -0,0 +1,58 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Const = Const; +const index_1 = require("../any/index"); +const index_2 = require("../bigint/index"); +const index_3 = require("../date/index"); +const index_4 = require("../function/index"); +const index_5 = require("../literal/index"); +const index_6 = require("../null/index"); +const index_7 = require("../object/index"); +const index_8 = require("../symbol/index"); +const index_9 = require("../tuple/index"); +const index_10 = require("../readonly/index"); +const index_11 = require("../undefined/index"); +const index_12 = require("../uint8array/index"); +const index_13 = require("../unknown/index"); +const index_14 = require("../create/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const value_1 = require("../guard/value"); +// prettier-ignore +function FromArray(T) { + return T.map(L => FromValue(L, false)); +} +// prettier-ignore +function FromProperties(value) { + const Acc = {}; + for (const K of globalThis.Object.getOwnPropertyNames(value)) + Acc[K] = (0, index_10.Readonly)(FromValue(value[K], false)); + return Acc; +} +function ConditionalReadonly(T, root) { + return (root === true ? T : (0, index_10.Readonly)(T)); +} +// prettier-ignore +function FromValue(value, root) { + return ((0, value_1.IsAsyncIterator)(value) ? ConditionalReadonly((0, index_1.Any)(), root) : + (0, value_1.IsIterator)(value) ? ConditionalReadonly((0, index_1.Any)(), root) : + (0, value_1.IsArray)(value) ? (0, index_10.Readonly)((0, index_9.Tuple)(FromArray(value))) : + (0, value_1.IsUint8Array)(value) ? (0, index_12.Uint8Array)() : + (0, value_1.IsDate)(value) ? (0, index_3.Date)() : + (0, value_1.IsObject)(value) ? ConditionalReadonly((0, index_7.Object)(FromProperties(value)), root) : + (0, value_1.IsFunction)(value) ? ConditionalReadonly((0, index_4.Function)([], (0, index_13.Unknown)()), root) : + (0, value_1.IsUndefined)(value) ? (0, index_11.Undefined)() : + (0, value_1.IsNull)(value) ? (0, index_6.Null)() : + (0, value_1.IsSymbol)(value) ? (0, index_8.Symbol)() : + (0, value_1.IsBigInt)(value) ? (0, index_2.BigInt)() : + (0, value_1.IsNumber)(value) ? (0, index_5.Literal)(value) : + (0, value_1.IsBoolean)(value) ? (0, index_5.Literal)(value) : + (0, value_1.IsString)(value) ? (0, index_5.Literal)(value) : + (0, index_7.Object)({})); +} +/** `[JavaScript]` Creates a readonly const type from the given value. */ +function Const(T, options) { + return (0, index_14.CreateType)(FromValue(T, true), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.d.ts new file mode 100644 index 0000000..e47ea3a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.d.ts @@ -0,0 +1 @@ +export * from './const'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.js new file mode 100644 index 0000000..1865e8e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/const/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./const"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.d.ts new file mode 100644 index 0000000..5de851e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.d.ts @@ -0,0 +1,7 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TConstructor } from '../constructor/index'; +import { type TTuple } from '../tuple/index'; +import { type TNever } from '../never/index'; +export type TConstructorParameters = (Type extends TConstructor ? TTuple : TNever); +/** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ +export declare function ConstructorParameters(schema: Type, options?: SchemaOptions): TConstructorParameters; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.js new file mode 100644 index 0000000..fbc152d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/constructor-parameters.js @@ -0,0 +1,44 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ConstructorParameters = ConstructorParameters; +const index_1 = require("../tuple/index"); +const index_2 = require("../never/index"); +const KindGuard = __importStar(require("../guard/kind")); +/** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ +function ConstructorParameters(schema, options) { + return (KindGuard.IsConstructor(schema) ? (0, index_1.Tuple)(schema.parameters, options) : (0, index_2.Never)(options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.d.ts new file mode 100644 index 0000000..3bd3d11 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.d.ts @@ -0,0 +1 @@ +export * from './constructor-parameters'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.js new file mode 100644 index 0000000..3b96403 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor-parameters/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./constructor-parameters"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.d.ts new file mode 100644 index 0000000..b13b768 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.d.ts @@ -0,0 +1,23 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import type { Ensure } from '../helpers/index'; +import type { TReadonlyOptional } from '../readonly-optional/index'; +import type { TReadonly } from '../readonly/index'; +import type { TOptional } from '../optional/index'; +import { Kind } from '../symbols/index'; +type StaticReturnType = Static; +type StaticParameter = T extends TReadonlyOptional ? [Readonly>?] : T extends TReadonly ? [Readonly>] : T extends TOptional ? [Static?] : [ + Static +]; +type StaticParameters = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? StaticParameters]> : Acc); +type StaticConstructor = Ensure) => StaticReturnType>; +export interface TConstructor extends TSchema { + [Kind]: 'Constructor'; + static: StaticConstructor; + type: 'Constructor'; + parameters: T; + returns: U; +} +/** `[JavaScript]` Creates a Constructor type */ +export declare function Constructor(parameters: [...T], returns: U, options?: SchemaOptions): TConstructor; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.js new file mode 100644 index 0000000..8352736 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/constructor.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Constructor = Constructor; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a Constructor type */ +function Constructor(parameters, returns, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Constructor', type: 'Constructor', parameters, returns }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.d.ts new file mode 100644 index 0000000..077273d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.d.ts @@ -0,0 +1 @@ +export * from './constructor'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.js new file mode 100644 index 0000000..42eb80e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/constructor/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./constructor"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.d.ts new file mode 100644 index 0000000..8b90d40 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.d.ts @@ -0,0 +1,2 @@ +/** Specialized deep immutable value. Applies freeze recursively to the given value */ +export declare function Immutable(value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.js new file mode 100644 index 0000000..92ee1f5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/immutable.js @@ -0,0 +1,70 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Immutable = Immutable; +const ValueGuard = __importStar(require("../guard/value")); +function ImmutableArray(value) { + return globalThis.Object.freeze(value).map((value) => Immutable(value)); +} +function ImmutableDate(value) { + return value; +} +function ImmutableUint8Array(value) { + return value; +} +function ImmutableRegExp(value) { + return value; +} +function ImmutableObject(value) { + const result = {}; + for (const key of Object.getOwnPropertyNames(value)) { + result[key] = Immutable(value[key]); + } + for (const key of Object.getOwnPropertySymbols(value)) { + result[key] = Immutable(value[key]); + } + return globalThis.Object.freeze(result); +} +/** Specialized deep immutable value. Applies freeze recursively to the given value */ +// prettier-ignore +function Immutable(value) { + return (ValueGuard.IsArray(value) ? ImmutableArray(value) : + ValueGuard.IsDate(value) ? ImmutableDate(value) : + ValueGuard.IsUint8Array(value) ? ImmutableUint8Array(value) : + ValueGuard.IsRegExp(value) ? ImmutableRegExp(value) : + ValueGuard.IsObject(value) ? ImmutableObject(value) : + value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.d.ts new file mode 100644 index 0000000..b38ebc9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.d.ts @@ -0,0 +1 @@ +export * from './type'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.js new file mode 100644 index 0000000..cc3f825 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./type"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.d.ts new file mode 100644 index 0000000..b965697 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.d.ts @@ -0,0 +1,3 @@ +import { SchemaOptions } from '../schema/schema'; +/** Creates TypeBox schematics using the configured InstanceMode */ +export declare function CreateType(schema: Record, options?: SchemaOptions): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.js new file mode 100644 index 0000000..2df07dc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/create/type.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CreateType = CreateType; +const policy_1 = require("../../system/policy"); +const immutable_1 = require("./immutable"); +const value_1 = require("../clone/value"); +/** Creates TypeBox schematics using the configured InstanceMode */ +function CreateType(schema, options) { + const result = options !== undefined ? { ...options, ...schema } : schema; + switch (policy_1.TypeSystemPolicy.InstanceMode) { + case 'freeze': + return (0, immutable_1.Immutable)(result); + case 'clone': + return (0, value_1.Clone)(result); + default: + return result; + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.d.ts new file mode 100644 index 0000000..0bcd582 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.d.ts @@ -0,0 +1,21 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface DateOptions extends SchemaOptions { + /** The exclusive maximum timestamp value */ + exclusiveMaximumTimestamp?: number; + /** The exclusive minimum timestamp value */ + exclusiveMinimumTimestamp?: number; + /** The maximum timestamp value */ + maximumTimestamp?: number; + /** The minimum timestamp value */ + minimumTimestamp?: number; + /** The multiple of timestamp value */ + multipleOfTimestamp?: number; +} +export interface TDate extends TSchema, DateOptions { + [Kind]: 'Date'; + static: Date; + type: 'date'; +} +/** `[JavaScript]` Creates a Date type */ +export declare function Date(options?: DateOptions): TDate; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.js new file mode 100644 index 0000000..7151e7e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/date.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Date = Date; +const index_1 = require("../symbols/index"); +const type_1 = require("../create/type"); +/** `[JavaScript]` Creates a Date type */ +function Date(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Date', type: 'Date' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.d.ts new file mode 100644 index 0000000..05b562f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.d.ts @@ -0,0 +1 @@ +export * from './date'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.js new file mode 100644 index 0000000..02f66fd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/date/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./date"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.d.ts new file mode 100644 index 0000000..77e1c9a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.d.ts @@ -0,0 +1,2 @@ +/** Discards property keys from the given value. This function returns a shallow Clone. */ +export declare function Discard(value: Record, keys: PropertyKey[]): Record; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.js new file mode 100644 index 0000000..b21690c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/discard.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Discard = Discard; +function DiscardKey(value, key) { + const { [key]: _, ...rest } = value; + return rest; +} +/** Discards property keys from the given value. This function returns a shallow Clone. */ +function Discard(value, keys) { + return keys.reduce((acc, key) => DiscardKey(acc, key), value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.d.ts new file mode 100644 index 0000000..d4764d3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.d.ts @@ -0,0 +1 @@ +export * from './discard'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.js new file mode 100644 index 0000000..9b8e357 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/discard/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./discard"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.d.ts new file mode 100644 index 0000000..b23354e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.d.ts @@ -0,0 +1,14 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TLiteral } from '../literal/index'; +import { Kind, Hint } from '../symbols/index'; +export type TEnumRecord = Record; +export type TEnumValue = string | number; +export type TEnumKey = string; +export interface TEnum = Record> extends TSchema { + [Kind]: 'Union'; + [Hint]: 'Enum'; + static: T[keyof T]; + anyOf: TLiteral[]; +} +/** `[Json]` Creates a Enum type */ +export declare function Enum>(item: T, options?: SchemaOptions): TEnum; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.js new file mode 100644 index 0000000..810dc81 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/enum.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Enum = Enum; +const index_1 = require("../literal/index"); +const index_2 = require("../symbols/index"); +const index_3 = require("../union/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const value_1 = require("../guard/value"); +/** `[Json]` Creates a Enum type */ +function Enum(item, options) { + if ((0, value_1.IsUndefined)(item)) + throw new Error('Enum undefined or empty'); + const values1 = globalThis.Object.getOwnPropertyNames(item) + .filter((key) => isNaN(key)) + .map((key) => item[key]); + const values2 = [...new Set(values1)]; + const anyOf = values2.map((value) => (0, index_1.Literal)(value)); + return (0, index_3.Union)(anyOf, { ...options, [index_2.Hint]: 'Enum' }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.d.ts new file mode 100644 index 0000000..bdd505d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.d.ts @@ -0,0 +1 @@ +export * from './enum'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.js new file mode 100644 index 0000000..f25d13a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/enum/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./enum"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.d.ts new file mode 100644 index 0000000..4560532 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.d.ts @@ -0,0 +1,4 @@ +/** The base Error type thrown for all TypeBox exceptions */ +export declare class TypeBoxError extends Error { + constructor(message: string); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.js new file mode 100644 index 0000000..1859431 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/error.js @@ -0,0 +1,11 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypeBoxError = void 0; +/** The base Error type thrown for all TypeBox exceptions */ +class TypeBoxError extends Error { + constructor(message) { + super(message); + } +} +exports.TypeBoxError = TypeBoxError; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.d.ts new file mode 100644 index 0000000..93ae819 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.d.ts @@ -0,0 +1 @@ +export * from './error'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.js new file mode 100644 index 0000000..b2b930a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/error/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./error"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.d.ts new file mode 100644 index 0000000..e2f1056 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.d.ts @@ -0,0 +1,11 @@ +import type { TSchema } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TExclude } from './exclude'; +type TFromProperties = ({ + [K2 in keyof K]: TExclude; +}); +type TFromMappedResult = (TFromProperties); +export type TExcludeFromMappedResult> = (TMappedResult

); +export declare function ExcludeFromMappedResult>(R: R, T: T): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.js new file mode 100644 index 0000000..1a22a03 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-mapped-result.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExcludeFromMappedResult = ExcludeFromMappedResult; +const index_1 = require("../mapped/index"); +const exclude_1 = require("./exclude"); +// prettier-ignore +function FromProperties(P, U) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = (0, exclude_1.Exclude)(P[K2], U); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, T) { + return FromProperties(R.properties, T); +} +// prettier-ignore +function ExcludeFromMappedResult(R, T) { + const P = FromMappedResult(R, T); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.d.ts new file mode 100644 index 0000000..af7b467 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.d.ts @@ -0,0 +1,5 @@ +import type { TSchema } from '../schema/index'; +import { TExclude } from './exclude'; +import { type TTemplateLiteral, type TTemplateLiteralToUnion } from '../template-literal/index'; +export type TExcludeFromTemplateLiteral = (TExclude, R>); +export declare function ExcludeFromTemplateLiteral(L: L, R: R): TExcludeFromTemplateLiteral; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.js new file mode 100644 index 0000000..1f1767e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude-from-template-literal.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExcludeFromTemplateLiteral = ExcludeFromTemplateLiteral; +const exclude_1 = require("./exclude"); +const index_1 = require("../template-literal/index"); +function ExcludeFromTemplateLiteral(L, R) { + return (0, exclude_1.Exclude)((0, index_1.TemplateLiteralToUnion)(L), R); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.d.ts new file mode 100644 index 0000000..6cd7b4c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.d.ts @@ -0,0 +1,21 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { UnionToTuple, AssertRest, AssertType } from '../helpers/index'; +import type { TMappedResult } from '../mapped/index'; +import { type TTemplateLiteral } from '../template-literal/index'; +import { type TUnion } from '../union/index'; +import { type TNever } from '../never/index'; +import { type Static } from '../static/index'; +import { type TUnionEvaluated } from '../union/index'; +import { type TExcludeFromMappedResult } from './exclude-from-mapped-result'; +import { type TExcludeFromTemplateLiteral } from './exclude-from-template-literal'; +type TExcludeRest = AssertRest> extends Static ? never : L[K]; +}[number]>> extends infer R extends TSchema[] ? TUnionEvaluated : never; +export type TExclude = (L extends TUnion ? TExcludeRest : L extends R ? TNever : L); +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +export declare function Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult; +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +export declare function Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromTemplateLiteral; +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +export declare function Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.js new file mode 100644 index 0000000..b321303 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/exclude.js @@ -0,0 +1,29 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Exclude = Exclude; +const type_1 = require("../create/type"); +const index_1 = require("../union/index"); +const index_2 = require("../never/index"); +const index_3 = require("../extends/index"); +const exclude_from_mapped_result_1 = require("./exclude-from-mapped-result"); +const exclude_from_template_literal_1 = require("./exclude-from-template-literal"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +function ExcludeRest(L, R) { + const excluded = L.filter((inner) => (0, index_3.ExtendsCheck)(inner, R) === index_3.ExtendsResult.False); + return excluded.length === 1 ? excluded[0] : (0, index_1.Union)(excluded); +} +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +function Exclude(L, R, options = {}) { + // overloads + if ((0, kind_1.IsTemplateLiteral)(L)) + return (0, type_1.CreateType)((0, exclude_from_template_literal_1.ExcludeFromTemplateLiteral)(L, R), options); + if ((0, kind_1.IsMappedResult)(L)) + return (0, type_1.CreateType)((0, exclude_from_mapped_result_1.ExcludeFromMappedResult)(L, R), options); + // prettier-ignore + return (0, type_1.CreateType)((0, kind_1.IsUnion)(L) ? ExcludeRest(L.anyOf, R) : + (0, index_3.ExtendsCheck)(L, R) !== index_3.ExtendsResult.False ? (0, index_2.Never)() : L, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.d.ts new file mode 100644 index 0000000..5b18ece --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.d.ts @@ -0,0 +1,3 @@ +export * from './exclude-from-mapped-result'; +export * from './exclude-from-template-literal'; +export * from './exclude'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.js new file mode 100644 index 0000000..8d14ca6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/exclude/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./exclude-from-mapped-result"), exports); +__exportStar(require("./exclude-from-template-literal"), exports); +__exportStar(require("./exclude"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.d.ts new file mode 100644 index 0000000..6fbcbd5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.d.ts @@ -0,0 +1,10 @@ +import { type TSchema } from '../schema/index'; +import { TypeBoxError } from '../error/index'; +export declare class ExtendsResolverError extends TypeBoxError { +} +export declare enum ExtendsResult { + Union = 0, + True = 1, + False = 2 +} +export declare function ExtendsCheck(left: TSchema, right: TSchema): ExtendsResult; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.js new file mode 100644 index 0000000..dd08f04 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-check.js @@ -0,0 +1,641 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtendsResult = exports.ExtendsResolverError = void 0; +exports.ExtendsCheck = ExtendsCheck; +const index_1 = require("../any/index"); +const index_2 = require("../function/index"); +const index_3 = require("../number/index"); +const index_4 = require("../string/index"); +const index_5 = require("../unknown/index"); +const index_6 = require("../template-literal/index"); +const index_7 = require("../patterns/index"); +const index_8 = require("../symbols/index"); +const index_9 = require("../error/index"); +const index_10 = require("../guard/index"); +class ExtendsResolverError extends index_9.TypeBoxError { +} +exports.ExtendsResolverError = ExtendsResolverError; +var ExtendsResult; +(function (ExtendsResult) { + ExtendsResult[ExtendsResult["Union"] = 0] = "Union"; + ExtendsResult[ExtendsResult["True"] = 1] = "True"; + ExtendsResult[ExtendsResult["False"] = 2] = "False"; +})(ExtendsResult || (exports.ExtendsResult = ExtendsResult = {})); +// ------------------------------------------------------------------ +// IntoBooleanResult +// ------------------------------------------------------------------ +// prettier-ignore +function IntoBooleanResult(result) { + return result === ExtendsResult.False ? result : ExtendsResult.True; +} +// ------------------------------------------------------------------ +// Throw +// ------------------------------------------------------------------ +// prettier-ignore +function Throw(message) { + throw new ExtendsResolverError(message); +} +// ------------------------------------------------------------------ +// StructuralRight +// ------------------------------------------------------------------ +// prettier-ignore +function IsStructuralRight(right) { + return (index_10.TypeGuard.IsNever(right) || + index_10.TypeGuard.IsIntersect(right) || + index_10.TypeGuard.IsUnion(right) || + index_10.TypeGuard.IsUnknown(right) || + index_10.TypeGuard.IsAny(right)); +} +// prettier-ignore +function StructuralRight(left, right) { + return (index_10.TypeGuard.IsNever(right) ? FromNeverRight(left, right) : + index_10.TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + index_10.TypeGuard.IsUnion(right) ? FromUnionRight(left, right) : + index_10.TypeGuard.IsUnknown(right) ? FromUnknownRight(left, right) : + index_10.TypeGuard.IsAny(right) ? FromAnyRight(left, right) : + Throw('StructuralRight')); +} +// ------------------------------------------------------------------ +// Any +// ------------------------------------------------------------------ +// prettier-ignore +function FromAnyRight(left, right) { + return ExtendsResult.True; +} +// prettier-ignore +function FromAny(left, right) { + return (index_10.TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + (index_10.TypeGuard.IsUnion(right) && right.anyOf.some((schema) => index_10.TypeGuard.IsAny(schema) || index_10.TypeGuard.IsUnknown(schema))) ? ExtendsResult.True : + index_10.TypeGuard.IsUnion(right) ? ExtendsResult.Union : + index_10.TypeGuard.IsUnknown(right) ? ExtendsResult.True : + index_10.TypeGuard.IsAny(right) ? ExtendsResult.True : + ExtendsResult.Union); +} +// ------------------------------------------------------------------ +// Array +// ------------------------------------------------------------------ +// prettier-ignore +function FromArrayRight(left, right) { + return (index_10.TypeGuard.IsUnknown(left) ? ExtendsResult.False : + index_10.TypeGuard.IsAny(left) ? ExtendsResult.Union : + index_10.TypeGuard.IsNever(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromArray(left, right) { + return (index_10.TypeGuard.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : + IsStructuralRight(right) ? StructuralRight(left, right) : + !index_10.TypeGuard.IsArray(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.items, right.items))); +} +// ------------------------------------------------------------------ +// AsyncIterator +// ------------------------------------------------------------------ +// prettier-ignore +function FromAsyncIterator(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + !index_10.TypeGuard.IsAsyncIterator(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.items, right.items))); +} +// ------------------------------------------------------------------ +// BigInt +// ------------------------------------------------------------------ +// prettier-ignore +function FromBigInt(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsBigInt(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Boolean +// ------------------------------------------------------------------ +// prettier-ignore +function FromBooleanRight(left, right) { + return (index_10.TypeGuard.IsLiteralBoolean(left) ? ExtendsResult.True : + index_10.TypeGuard.IsBoolean(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromBoolean(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsBoolean(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Constructor +// ------------------------------------------------------------------ +// prettier-ignore +function FromConstructor(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + !index_10.TypeGuard.IsConstructor(right) ? ExtendsResult.False : + left.parameters.length > right.parameters.length ? ExtendsResult.False : + (!left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === ExtendsResult.True)) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.returns, right.returns))); +} +// ------------------------------------------------------------------ +// Date +// ------------------------------------------------------------------ +// prettier-ignore +function FromDate(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsDate(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Function +// ------------------------------------------------------------------ +// prettier-ignore +function FromFunction(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + !index_10.TypeGuard.IsFunction(right) ? ExtendsResult.False : + left.parameters.length > right.parameters.length ? ExtendsResult.False : + (!left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === ExtendsResult.True)) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.returns, right.returns))); +} +// ------------------------------------------------------------------ +// Integer +// ------------------------------------------------------------------ +// prettier-ignore +function FromIntegerRight(left, right) { + return (index_10.TypeGuard.IsLiteral(left) && index_10.ValueGuard.IsNumber(left.const) ? ExtendsResult.True : + index_10.TypeGuard.IsNumber(left) || index_10.TypeGuard.IsInteger(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromInteger(left, right) { + return (index_10.TypeGuard.IsInteger(right) || index_10.TypeGuard.IsNumber(right) ? ExtendsResult.True : + IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Intersect +// ------------------------------------------------------------------ +// prettier-ignore +function FromIntersectRight(left, right) { + return right.allOf.every((schema) => Visit(left, schema) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// prettier-ignore +function FromIntersect(left, right) { + return left.allOf.some((schema) => Visit(schema, right) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// ------------------------------------------------------------------ +// Iterator +// ------------------------------------------------------------------ +// prettier-ignore +function FromIterator(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + !index_10.TypeGuard.IsIterator(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.items, right.items))); +} +// ------------------------------------------------------------------ +// Literal +// ------------------------------------------------------------------ +// prettier-ignore +function FromLiteral(left, right) { + return (index_10.TypeGuard.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : + IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsString(right) ? FromStringRight(left, right) : + index_10.TypeGuard.IsNumber(right) ? FromNumberRight(left, right) : + index_10.TypeGuard.IsInteger(right) ? FromIntegerRight(left, right) : + index_10.TypeGuard.IsBoolean(right) ? FromBooleanRight(left, right) : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Never +// ------------------------------------------------------------------ +// prettier-ignore +function FromNeverRight(left, right) { + return ExtendsResult.False; +} +// prettier-ignore +function FromNever(left, right) { + return ExtendsResult.True; +} +// ------------------------------------------------------------------ +// Not +// ------------------------------------------------------------------ +// prettier-ignore +function UnwrapTNot(schema) { + let [current, depth] = [schema, 0]; + while (true) { + if (!index_10.TypeGuard.IsNot(current)) + break; + current = current.not; + depth += 1; + } + return depth % 2 === 0 ? current : (0, index_5.Unknown)(); +} +// prettier-ignore +function FromNot(left, right) { + // TypeScript has no concept of negated types, and attempts to correctly check the negated + // type at runtime would put TypeBox at odds with TypeScripts ability to statically infer + // the type. Instead we unwrap to either unknown or T and continue evaluating. + // prettier-ignore + return (index_10.TypeGuard.IsNot(left) ? Visit(UnwrapTNot(left), right) : + index_10.TypeGuard.IsNot(right) ? Visit(left, UnwrapTNot(right)) : + Throw('Invalid fallthrough for Not')); +} +// ------------------------------------------------------------------ +// Null +// ------------------------------------------------------------------ +// prettier-ignore +function FromNull(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsNull(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Number +// ------------------------------------------------------------------ +// prettier-ignore +function FromNumberRight(left, right) { + return (index_10.TypeGuard.IsLiteralNumber(left) ? ExtendsResult.True : + index_10.TypeGuard.IsNumber(left) || index_10.TypeGuard.IsInteger(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromNumber(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsInteger(right) || index_10.TypeGuard.IsNumber(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Object +// ------------------------------------------------------------------ +// prettier-ignore +function IsObjectPropertyCount(schema, count) { + return Object.getOwnPropertyNames(schema.properties).length === count; +} +// prettier-ignore +function IsObjectStringLike(schema) { + return IsObjectArrayLike(schema); +} +// prettier-ignore +function IsObjectSymbolLike(schema) { + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'description' in schema.properties && index_10.TypeGuard.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && ((index_10.TypeGuard.IsString(schema.properties.description.anyOf[0]) && + index_10.TypeGuard.IsUndefined(schema.properties.description.anyOf[1])) || (index_10.TypeGuard.IsString(schema.properties.description.anyOf[1]) && + index_10.TypeGuard.IsUndefined(schema.properties.description.anyOf[0])))); +} +// prettier-ignore +function IsObjectNumberLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectBooleanLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectBigIntLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectDateLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectUint8ArrayLike(schema) { + return IsObjectArrayLike(schema); +} +// prettier-ignore +function IsObjectFunctionLike(schema) { + const length = (0, index_3.Number)(); + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'length' in schema.properties && IntoBooleanResult(Visit(schema.properties['length'], length)) === ExtendsResult.True); +} +// prettier-ignore +function IsObjectConstructorLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectArrayLike(schema) { + const length = (0, index_3.Number)(); + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'length' in schema.properties && IntoBooleanResult(Visit(schema.properties['length'], length)) === ExtendsResult.True); +} +// prettier-ignore +function IsObjectPromiseLike(schema) { + const then = (0, index_2.Function)([(0, index_1.Any)()], (0, index_1.Any)()); + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'then' in schema.properties && IntoBooleanResult(Visit(schema.properties['then'], then)) === ExtendsResult.True); +} +// ------------------------------------------------------------------ +// Property +// ------------------------------------------------------------------ +// prettier-ignore +function Property(left, right) { + return (Visit(left, right) === ExtendsResult.False ? ExtendsResult.False : + index_10.TypeGuard.IsOptional(left) && !index_10.TypeGuard.IsOptional(right) ? ExtendsResult.False : + ExtendsResult.True); +} +// prettier-ignore +function FromObjectRight(left, right) { + return (index_10.TypeGuard.IsUnknown(left) ? ExtendsResult.False : + index_10.TypeGuard.IsAny(left) ? ExtendsResult.Union : (index_10.TypeGuard.IsNever(left) || + (index_10.TypeGuard.IsLiteralString(left) && IsObjectStringLike(right)) || + (index_10.TypeGuard.IsLiteralNumber(left) && IsObjectNumberLike(right)) || + (index_10.TypeGuard.IsLiteralBoolean(left) && IsObjectBooleanLike(right)) || + (index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right)) || + (index_10.TypeGuard.IsBigInt(left) && IsObjectBigIntLike(right)) || + (index_10.TypeGuard.IsString(left) && IsObjectStringLike(right)) || + (index_10.TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right)) || + (index_10.TypeGuard.IsNumber(left) && IsObjectNumberLike(right)) || + (index_10.TypeGuard.IsInteger(left) && IsObjectNumberLike(right)) || + (index_10.TypeGuard.IsBoolean(left) && IsObjectBooleanLike(right)) || + (index_10.TypeGuard.IsUint8Array(left) && IsObjectUint8ArrayLike(right)) || + (index_10.TypeGuard.IsDate(left) && IsObjectDateLike(right)) || + (index_10.TypeGuard.IsConstructor(left) && IsObjectConstructorLike(right)) || + (index_10.TypeGuard.IsFunction(left) && IsObjectFunctionLike(right))) ? ExtendsResult.True : + (index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsString(RecordKey(left))) ? (() => { + // When expressing a Record with literal key values, the Record is converted into a Object with + // the Hint assigned as `Record`. This is used to invert the extends logic. + return right[index_8.Hint] === 'Record' ? ExtendsResult.True : ExtendsResult.False; + })() : + (index_10.TypeGuard.IsRecord(left) && index_10.TypeGuard.IsNumber(RecordKey(left))) ? (() => { + return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False; + })() : + ExtendsResult.False); +} +// prettier-ignore +function FromObject(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + !index_10.TypeGuard.IsObject(right) ? ExtendsResult.False : + (() => { + for (const key of Object.getOwnPropertyNames(right.properties)) { + if (!(key in left.properties) && !index_10.TypeGuard.IsOptional(right.properties[key])) { + return ExtendsResult.False; + } + if (index_10.TypeGuard.IsOptional(right.properties[key])) { + return ExtendsResult.True; + } + if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) { + return ExtendsResult.False; + } + } + return ExtendsResult.True; + })()); +} +// ------------------------------------------------------------------ +// Promise +// ------------------------------------------------------------------ +// prettier-ignore +function FromPromise(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : + !index_10.TypeGuard.IsPromise(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.item, right.item))); +} +// ------------------------------------------------------------------ +// Record +// ------------------------------------------------------------------ +// prettier-ignore +function RecordKey(schema) { + return (index_7.PatternNumberExact in schema.patternProperties ? (0, index_3.Number)() : + index_7.PatternStringExact in schema.patternProperties ? (0, index_4.String)() : + Throw('Unknown record key pattern')); +} +// prettier-ignore +function RecordValue(schema) { + return (index_7.PatternNumberExact in schema.patternProperties ? schema.patternProperties[index_7.PatternNumberExact] : + index_7.PatternStringExact in schema.patternProperties ? schema.patternProperties[index_7.PatternStringExact] : + Throw('Unable to get record value schema')); +} +// prettier-ignore +function FromRecordRight(left, right) { + const [Key, Value] = [RecordKey(right), RecordValue(right)]; + return ((index_10.TypeGuard.IsLiteralString(left) && index_10.TypeGuard.IsNumber(Key) && IntoBooleanResult(Visit(left, Value)) === ExtendsResult.True) ? ExtendsResult.True : + index_10.TypeGuard.IsUint8Array(left) && index_10.TypeGuard.IsNumber(Key) ? Visit(left, Value) : + index_10.TypeGuard.IsString(left) && index_10.TypeGuard.IsNumber(Key) ? Visit(left, Value) : + index_10.TypeGuard.IsArray(left) && index_10.TypeGuard.IsNumber(Key) ? Visit(left, Value) : + index_10.TypeGuard.IsObject(left) ? (() => { + for (const key of Object.getOwnPropertyNames(left.properties)) { + if (Property(Value, left.properties[key]) === ExtendsResult.False) { + return ExtendsResult.False; + } + } + return ExtendsResult.True; + })() : + ExtendsResult.False); +} +// prettier-ignore +function FromRecord(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + !index_10.TypeGuard.IsRecord(right) ? ExtendsResult.False : + Visit(RecordValue(left), RecordValue(right))); +} +// ------------------------------------------------------------------ +// RegExp +// ------------------------------------------------------------------ +// prettier-ignore +function FromRegExp(left, right) { + // Note: RegExp types evaluate as strings, not RegExp objects. + // Here we remap either into string and continue evaluating. + const L = index_10.TypeGuard.IsRegExp(left) ? (0, index_4.String)() : left; + const R = index_10.TypeGuard.IsRegExp(right) ? (0, index_4.String)() : right; + return Visit(L, R); +} +// ------------------------------------------------------------------ +// String +// ------------------------------------------------------------------ +// prettier-ignore +function FromStringRight(left, right) { + return (index_10.TypeGuard.IsLiteral(left) && index_10.ValueGuard.IsString(left.const) ? ExtendsResult.True : + index_10.TypeGuard.IsString(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromString(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsString(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Symbol +// ------------------------------------------------------------------ +// prettier-ignore +function FromSymbol(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsSymbol(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// TemplateLiteral +// ------------------------------------------------------------------ +// prettier-ignore +function FromTemplateLiteral(left, right) { + // TemplateLiteral types are resolved to either unions for finite expressions or string + // for infinite expressions. Here we call to TemplateLiteralResolver to resolve for + // either type and continue evaluating. + return (index_10.TypeGuard.IsTemplateLiteral(left) ? Visit((0, index_6.TemplateLiteralToUnion)(left), right) : + index_10.TypeGuard.IsTemplateLiteral(right) ? Visit(left, (0, index_6.TemplateLiteralToUnion)(right)) : + Throw('Invalid fallthrough for TemplateLiteral')); +} +// ------------------------------------------------------------------ +// Tuple +// ------------------------------------------------------------------ +// prettier-ignore +function IsArrayOfTuple(left, right) { + return (index_10.TypeGuard.IsArray(right) && + left.items !== undefined && + left.items.every((schema) => Visit(schema, right.items) === ExtendsResult.True)); +} +// prettier-ignore +function FromTupleRight(left, right) { + return (index_10.TypeGuard.IsNever(left) ? ExtendsResult.True : + index_10.TypeGuard.IsUnknown(left) ? ExtendsResult.False : + index_10.TypeGuard.IsAny(left) ? ExtendsResult.Union : + ExtendsResult.False); +} +// prettier-ignore +function FromTuple(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : + index_10.TypeGuard.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : + !index_10.TypeGuard.IsTuple(right) ? ExtendsResult.False : + (index_10.ValueGuard.IsUndefined(left.items) && !index_10.ValueGuard.IsUndefined(right.items)) || (!index_10.ValueGuard.IsUndefined(left.items) && index_10.ValueGuard.IsUndefined(right.items)) ? ExtendsResult.False : + (index_10.ValueGuard.IsUndefined(left.items) && !index_10.ValueGuard.IsUndefined(right.items)) ? ExtendsResult.True : + left.items.every((schema, index) => Visit(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Uint8Array +// ------------------------------------------------------------------ +// prettier-ignore +function FromUint8Array(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsUint8Array(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Undefined +// ------------------------------------------------------------------ +// prettier-ignore +function FromUndefined(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + index_10.TypeGuard.IsVoid(right) ? FromVoidRight(left, right) : + index_10.TypeGuard.IsUndefined(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Union +// ------------------------------------------------------------------ +// prettier-ignore +function FromUnionRight(left, right) { + return right.anyOf.some((schema) => Visit(left, schema) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// prettier-ignore +function FromUnion(left, right) { + return left.anyOf.every((schema) => Visit(schema, right) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// ------------------------------------------------------------------ +// Unknown +// ------------------------------------------------------------------ +// prettier-ignore +function FromUnknownRight(left, right) { + return ExtendsResult.True; +} +// prettier-ignore +function FromUnknown(left, right) { + return (index_10.TypeGuard.IsNever(right) ? FromNeverRight(left, right) : + index_10.TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + index_10.TypeGuard.IsUnion(right) ? FromUnionRight(left, right) : + index_10.TypeGuard.IsAny(right) ? FromAnyRight(left, right) : + index_10.TypeGuard.IsString(right) ? FromStringRight(left, right) : + index_10.TypeGuard.IsNumber(right) ? FromNumberRight(left, right) : + index_10.TypeGuard.IsInteger(right) ? FromIntegerRight(left, right) : + index_10.TypeGuard.IsBoolean(right) ? FromBooleanRight(left, right) : + index_10.TypeGuard.IsArray(right) ? FromArrayRight(left, right) : + index_10.TypeGuard.IsTuple(right) ? FromTupleRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsUnknown(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Void +// ------------------------------------------------------------------ +// prettier-ignore +function FromVoidRight(left, right) { + return (index_10.TypeGuard.IsUndefined(left) ? ExtendsResult.True : + index_10.TypeGuard.IsUndefined(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromVoid(left, right) { + return (index_10.TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + index_10.TypeGuard.IsUnion(right) ? FromUnionRight(left, right) : + index_10.TypeGuard.IsUnknown(right) ? FromUnknownRight(left, right) : + index_10.TypeGuard.IsAny(right) ? FromAnyRight(left, right) : + index_10.TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + index_10.TypeGuard.IsVoid(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function Visit(left, right) { + return ( + // resolvable + (index_10.TypeGuard.IsTemplateLiteral(left) || index_10.TypeGuard.IsTemplateLiteral(right)) ? FromTemplateLiteral(left, right) : + (index_10.TypeGuard.IsRegExp(left) || index_10.TypeGuard.IsRegExp(right)) ? FromRegExp(left, right) : + (index_10.TypeGuard.IsNot(left) || index_10.TypeGuard.IsNot(right)) ? FromNot(left, right) : + // standard + index_10.TypeGuard.IsAny(left) ? FromAny(left, right) : + index_10.TypeGuard.IsArray(left) ? FromArray(left, right) : + index_10.TypeGuard.IsBigInt(left) ? FromBigInt(left, right) : + index_10.TypeGuard.IsBoolean(left) ? FromBoolean(left, right) : + index_10.TypeGuard.IsAsyncIterator(left) ? FromAsyncIterator(left, right) : + index_10.TypeGuard.IsConstructor(left) ? FromConstructor(left, right) : + index_10.TypeGuard.IsDate(left) ? FromDate(left, right) : + index_10.TypeGuard.IsFunction(left) ? FromFunction(left, right) : + index_10.TypeGuard.IsInteger(left) ? FromInteger(left, right) : + index_10.TypeGuard.IsIntersect(left) ? FromIntersect(left, right) : + index_10.TypeGuard.IsIterator(left) ? FromIterator(left, right) : + index_10.TypeGuard.IsLiteral(left) ? FromLiteral(left, right) : + index_10.TypeGuard.IsNever(left) ? FromNever(left, right) : + index_10.TypeGuard.IsNull(left) ? FromNull(left, right) : + index_10.TypeGuard.IsNumber(left) ? FromNumber(left, right) : + index_10.TypeGuard.IsObject(left) ? FromObject(left, right) : + index_10.TypeGuard.IsRecord(left) ? FromRecord(left, right) : + index_10.TypeGuard.IsString(left) ? FromString(left, right) : + index_10.TypeGuard.IsSymbol(left) ? FromSymbol(left, right) : + index_10.TypeGuard.IsTuple(left) ? FromTuple(left, right) : + index_10.TypeGuard.IsPromise(left) ? FromPromise(left, right) : + index_10.TypeGuard.IsUint8Array(left) ? FromUint8Array(left, right) : + index_10.TypeGuard.IsUndefined(left) ? FromUndefined(left, right) : + index_10.TypeGuard.IsUnion(left) ? FromUnion(left, right) : + index_10.TypeGuard.IsUnknown(left) ? FromUnknown(left, right) : + index_10.TypeGuard.IsVoid(left) ? FromVoid(left, right) : + Throw(`Unknown left type operand '${left[index_8.Kind]}'`)); +} +function ExtendsCheck(left, right) { + return Visit(left, right); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.d.ts new file mode 100644 index 0000000..fd13786 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.d.ts @@ -0,0 +1,14 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TProperties } from '../object/index'; +import type { Assert } from '../helpers/index'; +import { type TMappedResult, type TMappedKey } from '../mapped/index'; +import { type TLiteral, type TLiteralValue } from '../literal/index'; +import { type TExtends } from './extends'; +type TFromPropertyKey = { + [_ in K]: TExtends>, U, L, R>; +}; +type TFromPropertyKeys = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? TFromPropertyKeys> : Acc); +type TFromMappedKey = (TFromPropertyKeys); +export type TExtendsFromMappedKey> = (TMappedResult

); +export declare function ExtendsFromMappedKey>(T: T, U: U, L: L, R: R, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.js new file mode 100644 index 0000000..8c388f9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-key.js @@ -0,0 +1,29 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtendsFromMappedKey = ExtendsFromMappedKey; +const index_1 = require("../mapped/index"); +const index_2 = require("../literal/index"); +const extends_1 = require("./extends"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromPropertyKey(K, U, L, R, options) { + return { + [K]: (0, extends_1.Extends)((0, index_2.Literal)(K), U, L, R, (0, value_1.Clone)(options)) + }; +} +// prettier-ignore +function FromPropertyKeys(K, U, L, R, options) { + return K.reduce((Acc, LK) => { + return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) }; + }, {}); +} +// prettier-ignore +function FromMappedKey(K, U, L, R, options) { + return FromPropertyKeys(K.keys, U, L, R, options); +} +// prettier-ignore +function ExtendsFromMappedKey(T, U, L, R, options) { + const P = FromMappedKey(T, U, L, R, options); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.d.ts new file mode 100644 index 0000000..5c68a2f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.d.ts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TExtends } from './extends'; +type TFromProperties

= ({ + [K2 in keyof P]: TExtends; +}); +type TFromMappedResult = (TFromProperties); +export type TExtendsFromMappedResult> = (TMappedResult

); +export declare function ExtendsFromMappedResult>(Left: Left, Right: Right, True: True, False: False, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.js new file mode 100644 index 0000000..1585c11 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-from-mapped-result.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtendsFromMappedResult = ExtendsFromMappedResult; +const index_1 = require("../mapped/index"); +const extends_1 = require("./extends"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromProperties(P, Right, True, False, options) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = (0, extends_1.Extends)(P[K2], Right, True, False, (0, value_1.Clone)(options)); + return Acc; +} +// prettier-ignore +function FromMappedResult(Left, Right, True, False, options) { + return FromProperties(Left.properties, Right, True, False, options); +} +// prettier-ignore +function ExtendsFromMappedResult(Left, Right, True, False, options) { + const P = FromMappedResult(Left, Right, True, False, options); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.d.ts new file mode 100644 index 0000000..e6416ff --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.d.ts @@ -0,0 +1,3 @@ +import type { TSchema } from '../schema/index'; +/** Fast undefined check used for properties of type undefined */ +export declare function ExtendsUndefinedCheck(schema: TSchema): boolean; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.js new file mode 100644 index 0000000..f8f55db --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends-undefined.js @@ -0,0 +1,24 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtendsUndefinedCheck = ExtendsUndefinedCheck; +const index_1 = require("../symbols/index"); +/** Fast undefined check used for properties of type undefined */ +function Intersect(schema) { + return schema.allOf.every((schema) => ExtendsUndefinedCheck(schema)); +} +function Union(schema) { + return schema.anyOf.some((schema) => ExtendsUndefinedCheck(schema)); +} +function Not(schema) { + return !ExtendsUndefinedCheck(schema.not); +} +/** Fast undefined check used for properties of type undefined */ +// prettier-ignore +function ExtendsUndefinedCheck(schema) { + return (schema[index_1.Kind] === 'Intersect' ? Intersect(schema) : + schema[index_1.Kind] === 'Union' ? Union(schema) : + schema[index_1.Kind] === 'Not' ? Not(schema) : + schema[index_1.Kind] === 'Undefined' ? true : + false); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.d.ts new file mode 100644 index 0000000..6f05d9f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.d.ts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import { type TUnion } from '../union/index'; +import { TMappedKey, TMappedResult } from '../mapped/index'; +import { UnionToTuple } from '../helpers/index'; +import { type TExtendsFromMappedKey } from './extends-from-mapped-key'; +import { type TExtendsFromMappedResult } from './extends-from-mapped-result'; +type TExtendsResolve = ((Static extends Static ? T : U) extends infer O extends TSchema ? UnionToTuple extends [infer X extends TSchema, infer Y extends TSchema] ? TUnion<[X, Y]> : O : never); +export type TExtends = TExtendsResolve; +/** `[Json]` Creates a Conditional type */ +export declare function Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult; +/** `[Json]` Creates a Conditional type */ +export declare function Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey; +/** `[Json]` Creates a Conditional type */ +export declare function Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.js new file mode 100644 index 0000000..089bdbf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/extends.js @@ -0,0 +1,27 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Extends = Extends; +const type_1 = require("../create/type"); +const index_1 = require("../union/index"); +const extends_check_1 = require("./extends-check"); +const extends_from_mapped_key_1 = require("./extends-from-mapped-key"); +const extends_from_mapped_result_1 = require("./extends-from-mapped-result"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function ExtendsResolve(left, right, trueType, falseType) { + const R = (0, extends_check_1.ExtendsCheck)(left, right); + return (R === extends_check_1.ExtendsResult.Union ? (0, index_1.Union)([trueType, falseType]) : + R === extends_check_1.ExtendsResult.True ? trueType : + falseType); +} +/** `[Json]` Creates a Conditional type */ +function Extends(L, R, T, F, options) { + // prettier-ignore + return ((0, kind_1.IsMappedResult)(L) ? (0, extends_from_mapped_result_1.ExtendsFromMappedResult)(L, R, T, F, options) : + (0, kind_1.IsMappedKey)(L) ? (0, type_1.CreateType)((0, extends_from_mapped_key_1.ExtendsFromMappedKey)(L, R, T, F, options)) : + (0, type_1.CreateType)(ExtendsResolve(L, R, T, F), options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.d.ts new file mode 100644 index 0000000..47fd51d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.d.ts @@ -0,0 +1,5 @@ +export * from './extends-check'; +export * from './extends-from-mapped-key'; +export * from './extends-from-mapped-result'; +export * from './extends-undefined'; +export * from './extends'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.js new file mode 100644 index 0000000..515be08 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extends/index.js @@ -0,0 +1,22 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./extends-check"), exports); +__exportStar(require("./extends-from-mapped-key"), exports); +__exportStar(require("./extends-from-mapped-result"), exports); +__exportStar(require("./extends-undefined"), exports); +__exportStar(require("./extends"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.d.ts new file mode 100644 index 0000000..47feabb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.d.ts @@ -0,0 +1,11 @@ +import type { TSchema } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TExtract } from './extract'; +type TFromProperties

= ({ + [K2 in keyof P]: TExtract; +}); +type TFromMappedResult = (TFromProperties); +export type TExtractFromMappedResult> = (TMappedResult

); +export declare function ExtractFromMappedResult>(R: R, T: T): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.js new file mode 100644 index 0000000..797d9f9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-mapped-result.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtractFromMappedResult = ExtractFromMappedResult; +const index_1 = require("../mapped/index"); +const extract_1 = require("./extract"); +// prettier-ignore +function FromProperties(P, T) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = (0, extract_1.Extract)(P[K2], T); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, T) { + return FromProperties(R.properties, T); +} +// prettier-ignore +function ExtractFromMappedResult(R, T) { + const P = FromMappedResult(R, T); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.d.ts new file mode 100644 index 0000000..1711ebc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.d.ts @@ -0,0 +1,5 @@ +import type { TSchema } from '../schema/index'; +import { type TExtract } from './extract'; +import { type TTemplateLiteral, type TTemplateLiteralToUnion } from '../template-literal/index'; +export type TExtractFromTemplateLiteral = (TExtract, R>); +export declare function ExtractFromTemplateLiteral(L: L, R: R): TExtractFromTemplateLiteral; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.js new file mode 100644 index 0000000..e1a840e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract-from-template-literal.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ExtractFromTemplateLiteral = ExtractFromTemplateLiteral; +const extract_1 = require("./extract"); +const index_1 = require("../template-literal/index"); +function ExtractFromTemplateLiteral(L, R) { + return (0, extract_1.Extract)((0, index_1.TemplateLiteralToUnion)(L), R); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.d.ts new file mode 100644 index 0000000..dc0e24b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.d.ts @@ -0,0 +1,21 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { AssertRest, AssertType, UnionToTuple } from '../helpers/index'; +import type { TMappedResult } from '../mapped/index'; +import { type TUnion } from '../union/index'; +import { type Static } from '../static/index'; +import { type TNever } from '../never/index'; +import { type TUnionEvaluated } from '../union/index'; +import { type TTemplateLiteral } from '../template-literal/index'; +import { type TExtractFromMappedResult } from './extract-from-mapped-result'; +import { type TExtractFromTemplateLiteral } from './extract-from-template-literal'; +type TExtractRest = AssertRest> extends Static ? L[K] : never; +}[number]>> extends infer R extends TSchema[] ? TUnionEvaluated : never; +export type TExtract = (L extends TUnion ? TExtractRest : L extends U ? L : TNever); +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +export declare function Extract(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult; +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +export declare function Extract(type: L, union: R, options?: SchemaOptions): TExtractFromTemplateLiteral; +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +export declare function Extract(type: L, union: R, options?: SchemaOptions): TExtract; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.js new file mode 100644 index 0000000..bf8359a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/extract.js @@ -0,0 +1,29 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Extract = Extract; +const type_1 = require("../create/type"); +const index_1 = require("../union/index"); +const index_2 = require("../never/index"); +const index_3 = require("../extends/index"); +const extract_from_mapped_result_1 = require("./extract-from-mapped-result"); +const extract_from_template_literal_1 = require("./extract-from-template-literal"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +function ExtractRest(L, R) { + const extracted = L.filter((inner) => (0, index_3.ExtendsCheck)(inner, R) !== index_3.ExtendsResult.False); + return extracted.length === 1 ? extracted[0] : (0, index_1.Union)(extracted); +} +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +function Extract(L, R, options) { + // overloads + if ((0, kind_1.IsTemplateLiteral)(L)) + return (0, type_1.CreateType)((0, extract_from_template_literal_1.ExtractFromTemplateLiteral)(L, R), options); + if ((0, kind_1.IsMappedResult)(L)) + return (0, type_1.CreateType)((0, extract_from_mapped_result_1.ExtractFromMappedResult)(L, R), options); + // prettier-ignore + return (0, type_1.CreateType)((0, kind_1.IsUnion)(L) ? ExtractRest(L.anyOf, R) : + (0, index_3.ExtendsCheck)(L, R) !== index_3.ExtendsResult.False ? L : (0, index_2.Never)(), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.d.ts new file mode 100644 index 0000000..4ab0464 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.d.ts @@ -0,0 +1,3 @@ +export * from './extract-from-mapped-result'; +export * from './extract-from-template-literal'; +export * from './extract'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.js new file mode 100644 index 0000000..00b6395 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/extract/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./extract-from-mapped-result"), exports); +__exportStar(require("./extract-from-template-literal"), exports); +__exportStar(require("./extract"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.d.ts new file mode 100644 index 0000000..8b7ef9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.d.ts @@ -0,0 +1,23 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import type { Ensure } from '../helpers/index'; +import type { TReadonlyOptional } from '../readonly-optional/index'; +import type { TReadonly } from '../readonly/index'; +import type { TOptional } from '../optional/index'; +import { Kind } from '../symbols/index'; +type StaticReturnType = Static; +type StaticParameter = T extends TReadonlyOptional ? [Readonly>?] : T extends TReadonly ? [Readonly>] : T extends TOptional ? [Static?] : [ + Static +]; +type StaticParameters = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? StaticParameters]> : Acc); +type StaticFunction = Ensure<(...param: StaticParameters) => StaticReturnType>; +export interface TFunction extends TSchema { + [Kind]: 'Function'; + static: StaticFunction; + type: 'Function'; + parameters: T; + returns: U; +} +/** `[JavaScript]` Creates a Function type */ +export declare function Function(parameters: [...T], returns: U, options?: SchemaOptions): TFunction; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.js new file mode 100644 index 0000000..3e9a126 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/function.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Function = Function; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a Function type */ +function Function(parameters, returns, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Function', type: 'Function', parameters, returns }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.d.ts new file mode 100644 index 0000000..2653adb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.d.ts @@ -0,0 +1 @@ +export * from './function'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.js new file mode 100644 index 0000000..f822c4c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/function/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./function"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.d.ts new file mode 100644 index 0000000..8e914a2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.d.ts @@ -0,0 +1,3 @@ +export * as KindGuard from './kind'; +export * as TypeGuard from './type'; +export * as ValueGuard from './value'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.js new file mode 100644 index 0000000..d327b4f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/index.js @@ -0,0 +1,40 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueGuard = exports.TypeGuard = exports.KindGuard = void 0; +exports.KindGuard = __importStar(require("./kind")); +exports.TypeGuard = __importStar(require("./type")); +exports.ValueGuard = __importStar(require("./value")); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.d.ts new file mode 100644 index 0000000..aa5b6ad --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.d.ts @@ -0,0 +1,147 @@ +import { Kind, Hint, TransformKind } from '../symbols/index'; +import { TransformOptions } from '../transform/index'; +import type { TAny } from '../any/index'; +import type { TArgument } from '../argument/index'; +import type { TArray } from '../array/index'; +import type { TAsyncIterator } from '../async-iterator/index'; +import type { TBoolean } from '../boolean/index'; +import type { TComputed } from '../computed/index'; +import type { TBigInt } from '../bigint/index'; +import type { TConstructor } from '../constructor/index'; +import type { TFunction } from '../function/index'; +import type { TImport } from '../module/index'; +import type { TInteger } from '../integer/index'; +import type { TIntersect } from '../intersect/index'; +import type { TIterator } from '../iterator/index'; +import type { TLiteral, TLiteralValue } from '../literal/index'; +import type { TMappedKey, TMappedResult } from '../mapped/index'; +import type { TNever } from '../never/index'; +import type { TNot } from '../not/index'; +import type { TNull } from '../null/index'; +import type { TNumber } from '../number/index'; +import type { TObject, TProperties } from '../object/index'; +import type { TOptional } from '../optional/index'; +import type { TPromise } from '../promise/index'; +import type { TReadonly } from '../readonly/index'; +import type { TRecord } from '../record/index'; +import type { TRef } from '../ref/index'; +import type { TRegExp } from '../regexp/index'; +import type { TSchema } from '../schema/index'; +import type { TString } from '../string/index'; +import type { TSymbol } from '../symbol/index'; +import type { TTemplateLiteral } from '../template-literal/index'; +import type { TTuple } from '../tuple/index'; +import type { TUint8Array } from '../uint8array/index'; +import type { TUndefined } from '../undefined/index'; +import type { TUnknown } from '../unknown/index'; +import type { TUnion } from '../union/index'; +import type { TUnsafe } from '../unsafe/index'; +import type { TVoid } from '../void/index'; +import type { TDate } from '../date/index'; +import type { TThis } from '../recursive/index'; +/** `[Kind-Only]` Returns true if this value has a Readonly symbol */ +export declare function IsReadonly(value: T): value is TReadonly; +/** `[Kind-Only]` Returns true if this value has a Optional symbol */ +export declare function IsOptional(value: T): value is TOptional; +/** `[Kind-Only]` Returns true if the given value is TAny */ +export declare function IsAny(value: unknown): value is TAny; +/** `[Kind-Only]` Returns true if the given value is TArgument */ +export declare function IsArgument(value: unknown): value is TArgument; +/** `[Kind-Only]` Returns true if the given value is TArray */ +export declare function IsArray(value: unknown): value is TArray; +/** `[Kind-Only]` Returns true if the given value is TAsyncIterator */ +export declare function IsAsyncIterator(value: unknown): value is TAsyncIterator; +/** `[Kind-Only]` Returns true if the given value is TBigInt */ +export declare function IsBigInt(value: unknown): value is TBigInt; +/** `[Kind-Only]` Returns true if the given value is TBoolean */ +export declare function IsBoolean(value: unknown): value is TBoolean; +/** `[Kind-Only]` Returns true if the given value is TComputed */ +export declare function IsComputed(value: unknown): value is TComputed; +/** `[Kind-Only]` Returns true if the given value is TConstructor */ +export declare function IsConstructor(value: unknown): value is TConstructor; +/** `[Kind-Only]` Returns true if the given value is TDate */ +export declare function IsDate(value: unknown): value is TDate; +/** `[Kind-Only]` Returns true if the given value is TFunction */ +export declare function IsFunction(value: unknown): value is TFunction; +/** `[Kind-Only]` Returns true if the given value is TInteger */ +export declare function IsImport(value: unknown): value is TImport; +/** `[Kind-Only]` Returns true if the given value is TInteger */ +export declare function IsInteger(value: unknown): value is TInteger; +/** `[Kind-Only]` Returns true if the given schema is TProperties */ +export declare function IsProperties(value: unknown): value is TProperties; +/** `[Kind-Only]` Returns true if the given value is TIntersect */ +export declare function IsIntersect(value: unknown): value is TIntersect; +/** `[Kind-Only]` Returns true if the given value is TIterator */ +export declare function IsIterator(value: unknown): value is TIterator; +/** `[Kind-Only]` Returns true if the given value is a TKind with the given name. */ +export declare function IsKindOf(value: unknown, kind: T): value is Record & { + [Kind]: T; +}; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteralString(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteralNumber(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteralBoolean(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is TLiteralValue */ +export declare function IsLiteralValue(value: unknown): value is TLiteralValue; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteral(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is a TMappedKey */ +export declare function IsMappedKey(value: unknown): value is TMappedKey; +/** `[Kind-Only]` Returns true if the given value is TMappedResult */ +export declare function IsMappedResult(value: unknown): value is TMappedResult; +/** `[Kind-Only]` Returns true if the given value is TNever */ +export declare function IsNever(value: unknown): value is TNever; +/** `[Kind-Only]` Returns true if the given value is TNot */ +export declare function IsNot(value: unknown): value is TNot; +/** `[Kind-Only]` Returns true if the given value is TNull */ +export declare function IsNull(value: unknown): value is TNull; +/** `[Kind-Only]` Returns true if the given value is TNumber */ +export declare function IsNumber(value: unknown): value is TNumber; +/** `[Kind-Only]` Returns true if the given value is TObject */ +export declare function IsObject(value: unknown): value is TObject; +/** `[Kind-Only]` Returns true if the given value is TPromise */ +export declare function IsPromise(value: unknown): value is TPromise; +/** `[Kind-Only]` Returns true if the given value is TRecord */ +export declare function IsRecord(value: unknown): value is TRecord; +/** `[Kind-Only]` Returns true if this value is TRecursive */ +export declare function IsRecursive(value: unknown): value is { + [Hint]: 'Recursive'; +}; +/** `[Kind-Only]` Returns true if the given value is TRef */ +export declare function IsRef(value: unknown): value is TRef; +/** `[Kind-Only]` Returns true if the given value is TRegExp */ +export declare function IsRegExp(value: unknown): value is TRegExp; +/** `[Kind-Only]` Returns true if the given value is TString */ +export declare function IsString(value: unknown): value is TString; +/** `[Kind-Only]` Returns true if the given value is TSymbol */ +export declare function IsSymbol(value: unknown): value is TSymbol; +/** `[Kind-Only]` Returns true if the given value is TTemplateLiteral */ +export declare function IsTemplateLiteral(value: unknown): value is TTemplateLiteral; +/** `[Kind-Only]` Returns true if the given value is TThis */ +export declare function IsThis(value: unknown): value is TThis; +/** `[Kind-Only]` Returns true of this value is TTransform */ +export declare function IsTransform(value: unknown): value is { + [TransformKind]: TransformOptions; +}; +/** `[Kind-Only]` Returns true if the given value is TTuple */ +export declare function IsTuple(value: unknown): value is TTuple; +/** `[Kind-Only]` Returns true if the given value is TUndefined */ +export declare function IsUndefined(value: unknown): value is TUndefined; +/** `[Kind-Only]` Returns true if the given value is TUnion */ +export declare function IsUnion(value: unknown): value is TUnion; +/** `[Kind-Only]` Returns true if the given value is TUint8Array */ +export declare function IsUint8Array(value: unknown): value is TUint8Array; +/** `[Kind-Only]` Returns true if the given value is TUnknown */ +export declare function IsUnknown(value: unknown): value is TUnknown; +/** `[Kind-Only]` Returns true if the given value is a raw TUnsafe */ +export declare function IsUnsafe(value: unknown): value is TUnsafe; +/** `[Kind-Only]` Returns true if the given value is TVoid */ +export declare function IsVoid(value: unknown): value is TVoid; +/** `[Kind-Only]` Returns true if the given value is TKind */ +export declare function IsKind(value: unknown): value is Record & { + [Kind]: string; +}; +/** `[Kind-Only]` Returns true if the given value is TSchema */ +export declare function IsSchema(value: unknown): value is TSchema; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.js new file mode 100644 index 0000000..ec65509 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/kind.js @@ -0,0 +1,320 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsReadonly = IsReadonly; +exports.IsOptional = IsOptional; +exports.IsAny = IsAny; +exports.IsArgument = IsArgument; +exports.IsArray = IsArray; +exports.IsAsyncIterator = IsAsyncIterator; +exports.IsBigInt = IsBigInt; +exports.IsBoolean = IsBoolean; +exports.IsComputed = IsComputed; +exports.IsConstructor = IsConstructor; +exports.IsDate = IsDate; +exports.IsFunction = IsFunction; +exports.IsImport = IsImport; +exports.IsInteger = IsInteger; +exports.IsProperties = IsProperties; +exports.IsIntersect = IsIntersect; +exports.IsIterator = IsIterator; +exports.IsKindOf = IsKindOf; +exports.IsLiteralString = IsLiteralString; +exports.IsLiteralNumber = IsLiteralNumber; +exports.IsLiteralBoolean = IsLiteralBoolean; +exports.IsLiteralValue = IsLiteralValue; +exports.IsLiteral = IsLiteral; +exports.IsMappedKey = IsMappedKey; +exports.IsMappedResult = IsMappedResult; +exports.IsNever = IsNever; +exports.IsNot = IsNot; +exports.IsNull = IsNull; +exports.IsNumber = IsNumber; +exports.IsObject = IsObject; +exports.IsPromise = IsPromise; +exports.IsRecord = IsRecord; +exports.IsRecursive = IsRecursive; +exports.IsRef = IsRef; +exports.IsRegExp = IsRegExp; +exports.IsString = IsString; +exports.IsSymbol = IsSymbol; +exports.IsTemplateLiteral = IsTemplateLiteral; +exports.IsThis = IsThis; +exports.IsTransform = IsTransform; +exports.IsTuple = IsTuple; +exports.IsUndefined = IsUndefined; +exports.IsUnion = IsUnion; +exports.IsUint8Array = IsUint8Array; +exports.IsUnknown = IsUnknown; +exports.IsUnsafe = IsUnsafe; +exports.IsVoid = IsVoid; +exports.IsKind = IsKind; +exports.IsSchema = IsSchema; +const ValueGuard = __importStar(require("./value")); +const index_1 = require("../symbols/index"); +/** `[Kind-Only]` Returns true if this value has a Readonly symbol */ +function IsReadonly(value) { + return ValueGuard.IsObject(value) && value[index_1.ReadonlyKind] === 'Readonly'; +} +/** `[Kind-Only]` Returns true if this value has a Optional symbol */ +function IsOptional(value) { + return ValueGuard.IsObject(value) && value[index_1.OptionalKind] === 'Optional'; +} +/** `[Kind-Only]` Returns true if the given value is TAny */ +function IsAny(value) { + return IsKindOf(value, 'Any'); +} +/** `[Kind-Only]` Returns true if the given value is TArgument */ +function IsArgument(value) { + return IsKindOf(value, 'Argument'); +} +/** `[Kind-Only]` Returns true if the given value is TArray */ +function IsArray(value) { + return IsKindOf(value, 'Array'); +} +/** `[Kind-Only]` Returns true if the given value is TAsyncIterator */ +function IsAsyncIterator(value) { + return IsKindOf(value, 'AsyncIterator'); +} +/** `[Kind-Only]` Returns true if the given value is TBigInt */ +function IsBigInt(value) { + return IsKindOf(value, 'BigInt'); +} +/** `[Kind-Only]` Returns true if the given value is TBoolean */ +function IsBoolean(value) { + return IsKindOf(value, 'Boolean'); +} +/** `[Kind-Only]` Returns true if the given value is TComputed */ +function IsComputed(value) { + return IsKindOf(value, 'Computed'); +} +/** `[Kind-Only]` Returns true if the given value is TConstructor */ +function IsConstructor(value) { + return IsKindOf(value, 'Constructor'); +} +/** `[Kind-Only]` Returns true if the given value is TDate */ +function IsDate(value) { + return IsKindOf(value, 'Date'); +} +/** `[Kind-Only]` Returns true if the given value is TFunction */ +function IsFunction(value) { + return IsKindOf(value, 'Function'); +} +/** `[Kind-Only]` Returns true if the given value is TInteger */ +function IsImport(value) { + return IsKindOf(value, 'Import'); +} +/** `[Kind-Only]` Returns true if the given value is TInteger */ +function IsInteger(value) { + return IsKindOf(value, 'Integer'); +} +/** `[Kind-Only]` Returns true if the given schema is TProperties */ +function IsProperties(value) { + return ValueGuard.IsObject(value); +} +/** `[Kind-Only]` Returns true if the given value is TIntersect */ +function IsIntersect(value) { + return IsKindOf(value, 'Intersect'); +} +/** `[Kind-Only]` Returns true if the given value is TIterator */ +function IsIterator(value) { + return IsKindOf(value, 'Iterator'); +} +/** `[Kind-Only]` Returns true if the given value is a TKind with the given name. */ +function IsKindOf(value, kind) { + return ValueGuard.IsObject(value) && index_1.Kind in value && value[index_1.Kind] === kind; +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +function IsLiteralString(value) { + return IsLiteral(value) && ValueGuard.IsString(value.const); +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +function IsLiteralNumber(value) { + return IsLiteral(value) && ValueGuard.IsNumber(value.const); +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +function IsLiteralBoolean(value) { + return IsLiteral(value) && ValueGuard.IsBoolean(value.const); +} +/** `[Kind-Only]` Returns true if the given value is TLiteralValue */ +function IsLiteralValue(value) { + return ValueGuard.IsBoolean(value) || ValueGuard.IsNumber(value) || ValueGuard.IsString(value); +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +function IsLiteral(value) { + return IsKindOf(value, 'Literal'); +} +/** `[Kind-Only]` Returns true if the given value is a TMappedKey */ +function IsMappedKey(value) { + return IsKindOf(value, 'MappedKey'); +} +/** `[Kind-Only]` Returns true if the given value is TMappedResult */ +function IsMappedResult(value) { + return IsKindOf(value, 'MappedResult'); +} +/** `[Kind-Only]` Returns true if the given value is TNever */ +function IsNever(value) { + return IsKindOf(value, 'Never'); +} +/** `[Kind-Only]` Returns true if the given value is TNot */ +function IsNot(value) { + return IsKindOf(value, 'Not'); +} +/** `[Kind-Only]` Returns true if the given value is TNull */ +function IsNull(value) { + return IsKindOf(value, 'Null'); +} +/** `[Kind-Only]` Returns true if the given value is TNumber */ +function IsNumber(value) { + return IsKindOf(value, 'Number'); +} +/** `[Kind-Only]` Returns true if the given value is TObject */ +function IsObject(value) { + return IsKindOf(value, 'Object'); +} +/** `[Kind-Only]` Returns true if the given value is TPromise */ +function IsPromise(value) { + return IsKindOf(value, 'Promise'); +} +/** `[Kind-Only]` Returns true if the given value is TRecord */ +function IsRecord(value) { + return IsKindOf(value, 'Record'); +} +/** `[Kind-Only]` Returns true if this value is TRecursive */ +function IsRecursive(value) { + return ValueGuard.IsObject(value) && index_1.Hint in value && value[index_1.Hint] === 'Recursive'; +} +/** `[Kind-Only]` Returns true if the given value is TRef */ +function IsRef(value) { + return IsKindOf(value, 'Ref'); +} +/** `[Kind-Only]` Returns true if the given value is TRegExp */ +function IsRegExp(value) { + return IsKindOf(value, 'RegExp'); +} +/** `[Kind-Only]` Returns true if the given value is TString */ +function IsString(value) { + return IsKindOf(value, 'String'); +} +/** `[Kind-Only]` Returns true if the given value is TSymbol */ +function IsSymbol(value) { + return IsKindOf(value, 'Symbol'); +} +/** `[Kind-Only]` Returns true if the given value is TTemplateLiteral */ +function IsTemplateLiteral(value) { + return IsKindOf(value, 'TemplateLiteral'); +} +/** `[Kind-Only]` Returns true if the given value is TThis */ +function IsThis(value) { + return IsKindOf(value, 'This'); +} +/** `[Kind-Only]` Returns true of this value is TTransform */ +function IsTransform(value) { + return ValueGuard.IsObject(value) && index_1.TransformKind in value; +} +/** `[Kind-Only]` Returns true if the given value is TTuple */ +function IsTuple(value) { + return IsKindOf(value, 'Tuple'); +} +/** `[Kind-Only]` Returns true if the given value is TUndefined */ +function IsUndefined(value) { + return IsKindOf(value, 'Undefined'); +} +/** `[Kind-Only]` Returns true if the given value is TUnion */ +function IsUnion(value) { + return IsKindOf(value, 'Union'); +} +/** `[Kind-Only]` Returns true if the given value is TUint8Array */ +function IsUint8Array(value) { + return IsKindOf(value, 'Uint8Array'); +} +/** `[Kind-Only]` Returns true if the given value is TUnknown */ +function IsUnknown(value) { + return IsKindOf(value, 'Unknown'); +} +/** `[Kind-Only]` Returns true if the given value is a raw TUnsafe */ +function IsUnsafe(value) { + return IsKindOf(value, 'Unsafe'); +} +/** `[Kind-Only]` Returns true if the given value is TVoid */ +function IsVoid(value) { + return IsKindOf(value, 'Void'); +} +/** `[Kind-Only]` Returns true if the given value is TKind */ +function IsKind(value) { + return ValueGuard.IsObject(value) && index_1.Kind in value && ValueGuard.IsString(value[index_1.Kind]); +} +/** `[Kind-Only]` Returns true if the given value is TSchema */ +function IsSchema(value) { + // prettier-ignore + return (IsAny(value) || + IsArgument(value) || + IsArray(value) || + IsBoolean(value) || + IsBigInt(value) || + IsAsyncIterator(value) || + IsComputed(value) || + IsConstructor(value) || + IsDate(value) || + IsFunction(value) || + IsInteger(value) || + IsIntersect(value) || + IsIterator(value) || + IsLiteral(value) || + IsMappedKey(value) || + IsMappedResult(value) || + IsNever(value) || + IsNot(value) || + IsNull(value) || + IsNumber(value) || + IsObject(value) || + IsPromise(value) || + IsRecord(value) || + IsRef(value) || + IsRegExp(value) || + IsString(value) || + IsSymbol(value) || + IsTemplateLiteral(value) || + IsThis(value) || + IsTuple(value) || + IsUndefined(value) || + IsUnion(value) || + IsUint8Array(value) || + IsUnknown(value) || + IsUnsafe(value) || + IsVoid(value) || + IsKind(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.d.ts new file mode 100644 index 0000000..74bc313 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.d.ts @@ -0,0 +1,152 @@ +import { Kind, Hint, TransformKind } from '../symbols/index'; +import { TypeBoxError } from '../error/index'; +import { TransformOptions } from '../transform/index'; +import type { TAny } from '../any/index'; +import type { TArgument } from '../argument/index'; +import type { TArray } from '../array/index'; +import type { TAsyncIterator } from '../async-iterator/index'; +import type { TBoolean } from '../boolean/index'; +import type { TComputed } from '../computed/index'; +import type { TBigInt } from '../bigint/index'; +import type { TConstructor } from '../constructor/index'; +import type { TFunction } from '../function/index'; +import type { TImport } from '../module/index'; +import type { TInteger } from '../integer/index'; +import type { TIntersect } from '../intersect/index'; +import type { TIterator } from '../iterator/index'; +import type { TLiteral, TLiteralValue } from '../literal/index'; +import type { TMappedKey, TMappedResult } from '../mapped/index'; +import type { TNever } from '../never/index'; +import type { TNot } from '../not/index'; +import type { TNull } from '../null/index'; +import type { TNumber } from '../number/index'; +import type { TObject, TProperties } from '../object/index'; +import type { TOptional } from '../optional/index'; +import type { TPromise } from '../promise/index'; +import type { TReadonly } from '../readonly/index'; +import type { TRecord } from '../record/index'; +import type { TRef } from '../ref/index'; +import type { TRegExp } from '../regexp/index'; +import type { TSchema } from '../schema/index'; +import type { TString } from '../string/index'; +import type { TSymbol } from '../symbol/index'; +import type { TTemplateLiteral } from '../template-literal/index'; +import type { TTuple } from '../tuple/index'; +import type { TUint8Array } from '../uint8array/index'; +import type { TUndefined } from '../undefined/index'; +import type { TUnion } from '../union/index'; +import type { TUnknown } from '../unknown/index'; +import type { TUnsafe } from '../unsafe/index'; +import type { TVoid } from '../void/index'; +import type { TDate } from '../date/index'; +import type { TThis } from '../recursive/index'; +export declare class TypeGuardUnknownTypeError extends TypeBoxError { +} +/** Returns true if this value has a Readonly symbol */ +export declare function IsReadonly(value: T): value is TReadonly; +/** Returns true if this value has a Optional symbol */ +export declare function IsOptional(value: T): value is TOptional; +/** Returns true if the given value is TAny */ +export declare function IsAny(value: unknown): value is TAny; +/** Returns true if the given value is TArgument */ +export declare function IsArgument(value: unknown): value is TArgument; +/** Returns true if the given value is TArray */ +export declare function IsArray(value: unknown): value is TArray; +/** Returns true if the given value is TAsyncIterator */ +export declare function IsAsyncIterator(value: unknown): value is TAsyncIterator; +/** Returns true if the given value is TBigInt */ +export declare function IsBigInt(value: unknown): value is TBigInt; +/** Returns true if the given value is TBoolean */ +export declare function IsBoolean(value: unknown): value is TBoolean; +/** Returns true if the given value is TComputed */ +export declare function IsComputed(value: unknown): value is TComputed; +/** Returns true if the given value is TConstructor */ +export declare function IsConstructor(value: unknown): value is TConstructor; +/** Returns true if the given value is TDate */ +export declare function IsDate(value: unknown): value is TDate; +/** Returns true if the given value is TFunction */ +export declare function IsFunction(value: unknown): value is TFunction; +/** Returns true if the given value is TImport */ +export declare function IsImport(value: unknown): value is TImport; +/** Returns true if the given value is TInteger */ +export declare function IsInteger(value: unknown): value is TInteger; +/** Returns true if the given schema is TProperties */ +export declare function IsProperties(value: unknown): value is TProperties; +/** Returns true if the given value is TIntersect */ +export declare function IsIntersect(value: unknown): value is TIntersect; +/** Returns true if the given value is TIterator */ +export declare function IsIterator(value: unknown): value is TIterator; +/** Returns true if the given value is a TKind with the given name. */ +export declare function IsKindOf(value: unknown, kind: T): value is Record & { + [Kind]: T; +}; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteralString(value: unknown): value is TLiteral; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteralNumber(value: unknown): value is TLiteral; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteralBoolean(value: unknown): value is TLiteral; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteral(value: unknown): value is TLiteral; +/** Returns true if the given value is a TLiteralValue */ +export declare function IsLiteralValue(value: unknown): value is TLiteralValue; +/** Returns true if the given value is a TMappedKey */ +export declare function IsMappedKey(value: unknown): value is TMappedKey; +/** Returns true if the given value is TMappedResult */ +export declare function IsMappedResult(value: unknown): value is TMappedResult; +/** Returns true if the given value is TNever */ +export declare function IsNever(value: unknown): value is TNever; +/** Returns true if the given value is TNot */ +export declare function IsNot(value: unknown): value is TNot; +/** Returns true if the given value is TNull */ +export declare function IsNull(value: unknown): value is TNull; +/** Returns true if the given value is TNumber */ +export declare function IsNumber(value: unknown): value is TNumber; +/** Returns true if the given value is TObject */ +export declare function IsObject(value: unknown): value is TObject; +/** Returns true if the given value is TPromise */ +export declare function IsPromise(value: unknown): value is TPromise; +/** Returns true if the given value is TRecord */ +export declare function IsRecord(value: unknown): value is TRecord; +/** Returns true if this value is TRecursive */ +export declare function IsRecursive(value: unknown): value is { + [Hint]: 'Recursive'; +}; +/** Returns true if the given value is TRef */ +export declare function IsRef(value: unknown): value is TRef; +/** Returns true if the given value is TRegExp */ +export declare function IsRegExp(value: unknown): value is TRegExp; +/** Returns true if the given value is TString */ +export declare function IsString(value: unknown): value is TString; +/** Returns true if the given value is TSymbol */ +export declare function IsSymbol(value: unknown): value is TSymbol; +/** Returns true if the given value is TTemplateLiteral */ +export declare function IsTemplateLiteral(value: unknown): value is TTemplateLiteral; +/** Returns true if the given value is TThis */ +export declare function IsThis(value: unknown): value is TThis; +/** Returns true of this value is TTransform */ +export declare function IsTransform(value: unknown): value is { + [TransformKind]: TransformOptions; +}; +/** Returns true if the given value is TTuple */ +export declare function IsTuple(value: unknown): value is TTuple; +/** Returns true if the given value is TUndefined */ +export declare function IsUndefined(value: unknown): value is TUndefined; +/** Returns true if the given value is TUnion[]> */ +export declare function IsUnionLiteral(value: unknown): value is TUnion; +/** Returns true if the given value is TUnion */ +export declare function IsUnion(value: unknown): value is TUnion; +/** Returns true if the given value is TUint8Array */ +export declare function IsUint8Array(value: unknown): value is TUint8Array; +/** Returns true if the given value is TUnknown */ +export declare function IsUnknown(value: unknown): value is TUnknown; +/** Returns true if the given value is a raw TUnsafe */ +export declare function IsUnsafe(value: unknown): value is TUnsafe; +/** Returns true if the given value is TVoid */ +export declare function IsVoid(value: unknown): value is TVoid; +/** Returns true if the given value is TKind */ +export declare function IsKind(value: unknown): value is Record & { + [Kind]: string; +}; +/** Returns true if the given value is TSchema */ +export declare function IsSchema(value: unknown): value is TSchema; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.js new file mode 100644 index 0000000..b01182a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/type.js @@ -0,0 +1,597 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypeGuardUnknownTypeError = void 0; +exports.IsReadonly = IsReadonly; +exports.IsOptional = IsOptional; +exports.IsAny = IsAny; +exports.IsArgument = IsArgument; +exports.IsArray = IsArray; +exports.IsAsyncIterator = IsAsyncIterator; +exports.IsBigInt = IsBigInt; +exports.IsBoolean = IsBoolean; +exports.IsComputed = IsComputed; +exports.IsConstructor = IsConstructor; +exports.IsDate = IsDate; +exports.IsFunction = IsFunction; +exports.IsImport = IsImport; +exports.IsInteger = IsInteger; +exports.IsProperties = IsProperties; +exports.IsIntersect = IsIntersect; +exports.IsIterator = IsIterator; +exports.IsKindOf = IsKindOf; +exports.IsLiteralString = IsLiteralString; +exports.IsLiteralNumber = IsLiteralNumber; +exports.IsLiteralBoolean = IsLiteralBoolean; +exports.IsLiteral = IsLiteral; +exports.IsLiteralValue = IsLiteralValue; +exports.IsMappedKey = IsMappedKey; +exports.IsMappedResult = IsMappedResult; +exports.IsNever = IsNever; +exports.IsNot = IsNot; +exports.IsNull = IsNull; +exports.IsNumber = IsNumber; +exports.IsObject = IsObject; +exports.IsPromise = IsPromise; +exports.IsRecord = IsRecord; +exports.IsRecursive = IsRecursive; +exports.IsRef = IsRef; +exports.IsRegExp = IsRegExp; +exports.IsString = IsString; +exports.IsSymbol = IsSymbol; +exports.IsTemplateLiteral = IsTemplateLiteral; +exports.IsThis = IsThis; +exports.IsTransform = IsTransform; +exports.IsTuple = IsTuple; +exports.IsUndefined = IsUndefined; +exports.IsUnionLiteral = IsUnionLiteral; +exports.IsUnion = IsUnion; +exports.IsUint8Array = IsUint8Array; +exports.IsUnknown = IsUnknown; +exports.IsUnsafe = IsUnsafe; +exports.IsVoid = IsVoid; +exports.IsKind = IsKind; +exports.IsSchema = IsSchema; +const ValueGuard = __importStar(require("./value")); +const index_1 = require("../symbols/index"); +const index_2 = require("../error/index"); +class TypeGuardUnknownTypeError extends index_2.TypeBoxError { +} +exports.TypeGuardUnknownTypeError = TypeGuardUnknownTypeError; +const KnownTypes = [ + 'Argument', + 'Any', + 'Array', + 'AsyncIterator', + 'BigInt', + 'Boolean', + 'Computed', + 'Constructor', + 'Date', + 'Enum', + 'Function', + 'Integer', + 'Intersect', + 'Iterator', + 'Literal', + 'MappedKey', + 'MappedResult', + 'Not', + 'Null', + 'Number', + 'Object', + 'Promise', + 'Record', + 'Ref', + 'RegExp', + 'String', + 'Symbol', + 'TemplateLiteral', + 'This', + 'Tuple', + 'Undefined', + 'Union', + 'Uint8Array', + 'Unknown', + 'Void', +]; +function IsPattern(value) { + try { + new RegExp(value); + return true; + } + catch { + return false; + } +} +function IsControlCharacterFree(value) { + if (!ValueGuard.IsString(value)) + return false; + for (let i = 0; i < value.length; i++) { + const code = value.charCodeAt(i); + if ((code >= 7 && code <= 13) || code === 27 || code === 127) { + return false; + } + } + return true; +} +function IsAdditionalProperties(value) { + return IsOptionalBoolean(value) || IsSchema(value); +} +function IsOptionalBigInt(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsBigInt(value); +} +function IsOptionalNumber(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsNumber(value); +} +function IsOptionalBoolean(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsBoolean(value); +} +function IsOptionalString(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsString(value); +} +function IsOptionalPattern(value) { + return ValueGuard.IsUndefined(value) || (ValueGuard.IsString(value) && IsControlCharacterFree(value) && IsPattern(value)); +} +function IsOptionalFormat(value) { + return ValueGuard.IsUndefined(value) || (ValueGuard.IsString(value) && IsControlCharacterFree(value)); +} +function IsOptionalSchema(value) { + return ValueGuard.IsUndefined(value) || IsSchema(value); +} +// ------------------------------------------------------------------ +// Modifiers +// ------------------------------------------------------------------ +/** Returns true if this value has a Readonly symbol */ +function IsReadonly(value) { + return ValueGuard.IsObject(value) && value[index_1.ReadonlyKind] === 'Readonly'; +} +/** Returns true if this value has a Optional symbol */ +function IsOptional(value) { + return ValueGuard.IsObject(value) && value[index_1.OptionalKind] === 'Optional'; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +/** Returns true if the given value is TAny */ +function IsAny(value) { + // prettier-ignore + return (IsKindOf(value, 'Any') && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TArgument */ +function IsArgument(value) { + // prettier-ignore + return (IsKindOf(value, 'Argument') && + ValueGuard.IsNumber(value.index)); +} +/** Returns true if the given value is TArray */ +function IsArray(value) { + return (IsKindOf(value, 'Array') && + value.type === 'array' && + IsOptionalString(value.$id) && + IsSchema(value.items) && + IsOptionalNumber(value.minItems) && + IsOptionalNumber(value.maxItems) && + IsOptionalBoolean(value.uniqueItems) && + IsOptionalSchema(value.contains) && + IsOptionalNumber(value.minContains) && + IsOptionalNumber(value.maxContains)); +} +/** Returns true if the given value is TAsyncIterator */ +function IsAsyncIterator(value) { + // prettier-ignore + return (IsKindOf(value, 'AsyncIterator') && + value.type === 'AsyncIterator' && + IsOptionalString(value.$id) && + IsSchema(value.items)); +} +/** Returns true if the given value is TBigInt */ +function IsBigInt(value) { + // prettier-ignore + return (IsKindOf(value, 'BigInt') && + value.type === 'bigint' && + IsOptionalString(value.$id) && + IsOptionalBigInt(value.exclusiveMaximum) && + IsOptionalBigInt(value.exclusiveMinimum) && + IsOptionalBigInt(value.maximum) && + IsOptionalBigInt(value.minimum) && + IsOptionalBigInt(value.multipleOf)); +} +/** Returns true if the given value is TBoolean */ +function IsBoolean(value) { + // prettier-ignore + return (IsKindOf(value, 'Boolean') && + value.type === 'boolean' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TComputed */ +function IsComputed(value) { + // prettier-ignore + return (IsKindOf(value, 'Computed') && + ValueGuard.IsString(value.target) && + ValueGuard.IsArray(value.parameters) && + value.parameters.every((schema) => IsSchema(schema))); +} +/** Returns true if the given value is TConstructor */ +function IsConstructor(value) { + // prettier-ignore + return (IsKindOf(value, 'Constructor') && + value.type === 'Constructor' && + IsOptionalString(value.$id) && + ValueGuard.IsArray(value.parameters) && + value.parameters.every(schema => IsSchema(schema)) && + IsSchema(value.returns)); +} +/** Returns true if the given value is TDate */ +function IsDate(value) { + return (IsKindOf(value, 'Date') && + value.type === 'Date' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.exclusiveMaximumTimestamp) && + IsOptionalNumber(value.exclusiveMinimumTimestamp) && + IsOptionalNumber(value.maximumTimestamp) && + IsOptionalNumber(value.minimumTimestamp) && + IsOptionalNumber(value.multipleOfTimestamp)); +} +/** Returns true if the given value is TFunction */ +function IsFunction(value) { + // prettier-ignore + return (IsKindOf(value, 'Function') && + value.type === 'Function' && + IsOptionalString(value.$id) && + ValueGuard.IsArray(value.parameters) && + value.parameters.every(schema => IsSchema(schema)) && + IsSchema(value.returns)); +} +/** Returns true if the given value is TImport */ +function IsImport(value) { + // prettier-ignore + return (IsKindOf(value, 'Import') && + ValueGuard.HasPropertyKey(value, '$defs') && + ValueGuard.IsObject(value.$defs) && + IsProperties(value.$defs) && + ValueGuard.HasPropertyKey(value, '$ref') && + ValueGuard.IsString(value.$ref) && + value.$ref in value.$defs // required + ); +} +/** Returns true if the given value is TInteger */ +function IsInteger(value) { + return (IsKindOf(value, 'Integer') && + value.type === 'integer' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.exclusiveMaximum) && + IsOptionalNumber(value.exclusiveMinimum) && + IsOptionalNumber(value.maximum) && + IsOptionalNumber(value.minimum) && + IsOptionalNumber(value.multipleOf)); +} +/** Returns true if the given schema is TProperties */ +function IsProperties(value) { + // prettier-ignore + return (ValueGuard.IsObject(value) && + Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema(schema))); +} +/** Returns true if the given value is TIntersect */ +function IsIntersect(value) { + // prettier-ignore + return (IsKindOf(value, 'Intersect') && + (ValueGuard.IsString(value.type) && value.type !== 'object' ? false : true) && + ValueGuard.IsArray(value.allOf) && + value.allOf.every(schema => IsSchema(schema) && !IsTransform(schema)) && + IsOptionalString(value.type) && + (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TIterator */ +function IsIterator(value) { + // prettier-ignore + return (IsKindOf(value, 'Iterator') && + value.type === 'Iterator' && + IsOptionalString(value.$id) && + IsSchema(value.items)); +} +/** Returns true if the given value is a TKind with the given name. */ +function IsKindOf(value, kind) { + return ValueGuard.IsObject(value) && index_1.Kind in value && value[index_1.Kind] === kind; +} +/** Returns true if the given value is TLiteral */ +function IsLiteralString(value) { + return IsLiteral(value) && ValueGuard.IsString(value.const); +} +/** Returns true if the given value is TLiteral */ +function IsLiteralNumber(value) { + return IsLiteral(value) && ValueGuard.IsNumber(value.const); +} +/** Returns true if the given value is TLiteral */ +function IsLiteralBoolean(value) { + return IsLiteral(value) && ValueGuard.IsBoolean(value.const); +} +/** Returns true if the given value is TLiteral */ +function IsLiteral(value) { + // prettier-ignore + return (IsKindOf(value, 'Literal') && + IsOptionalString(value.$id) && IsLiteralValue(value.const)); +} +/** Returns true if the given value is a TLiteralValue */ +function IsLiteralValue(value) { + return ValueGuard.IsBoolean(value) || ValueGuard.IsNumber(value) || ValueGuard.IsString(value); +} +/** Returns true if the given value is a TMappedKey */ +function IsMappedKey(value) { + // prettier-ignore + return (IsKindOf(value, 'MappedKey') && + ValueGuard.IsArray(value.keys) && + value.keys.every(key => ValueGuard.IsNumber(key) || ValueGuard.IsString(key))); +} +/** Returns true if the given value is TMappedResult */ +function IsMappedResult(value) { + // prettier-ignore + return (IsKindOf(value, 'MappedResult') && + IsProperties(value.properties)); +} +/** Returns true if the given value is TNever */ +function IsNever(value) { + // prettier-ignore + return (IsKindOf(value, 'Never') && + ValueGuard.IsObject(value.not) && + Object.getOwnPropertyNames(value.not).length === 0); +} +/** Returns true if the given value is TNot */ +function IsNot(value) { + // prettier-ignore + return (IsKindOf(value, 'Not') && + IsSchema(value.not)); +} +/** Returns true if the given value is TNull */ +function IsNull(value) { + // prettier-ignore + return (IsKindOf(value, 'Null') && + value.type === 'null' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TNumber */ +function IsNumber(value) { + return (IsKindOf(value, 'Number') && + value.type === 'number' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.exclusiveMaximum) && + IsOptionalNumber(value.exclusiveMinimum) && + IsOptionalNumber(value.maximum) && + IsOptionalNumber(value.minimum) && + IsOptionalNumber(value.multipleOf)); +} +/** Returns true if the given value is TObject */ +function IsObject(value) { + // prettier-ignore + return (IsKindOf(value, 'Object') && + value.type === 'object' && + IsOptionalString(value.$id) && + IsProperties(value.properties) && + IsAdditionalProperties(value.additionalProperties) && + IsOptionalNumber(value.minProperties) && + IsOptionalNumber(value.maxProperties)); +} +/** Returns true if the given value is TPromise */ +function IsPromise(value) { + // prettier-ignore + return (IsKindOf(value, 'Promise') && + value.type === 'Promise' && + IsOptionalString(value.$id) && + IsSchema(value.item)); +} +/** Returns true if the given value is TRecord */ +function IsRecord(value) { + // prettier-ignore + return (IsKindOf(value, 'Record') && + value.type === 'object' && + IsOptionalString(value.$id) && + IsAdditionalProperties(value.additionalProperties) && + ValueGuard.IsObject(value.patternProperties) && + ((schema) => { + const keys = Object.getOwnPropertyNames(schema.patternProperties); + return (keys.length === 1 && + IsPattern(keys[0]) && + ValueGuard.IsObject(schema.patternProperties) && + IsSchema(schema.patternProperties[keys[0]])); + })(value)); +} +/** Returns true if this value is TRecursive */ +function IsRecursive(value) { + return ValueGuard.IsObject(value) && index_1.Hint in value && value[index_1.Hint] === 'Recursive'; +} +/** Returns true if the given value is TRef */ +function IsRef(value) { + // prettier-ignore + return (IsKindOf(value, 'Ref') && + IsOptionalString(value.$id) && + ValueGuard.IsString(value.$ref)); +} +/** Returns true if the given value is TRegExp */ +function IsRegExp(value) { + // prettier-ignore + return (IsKindOf(value, 'RegExp') && + IsOptionalString(value.$id) && + ValueGuard.IsString(value.source) && + ValueGuard.IsString(value.flags) && + IsOptionalNumber(value.maxLength) && + IsOptionalNumber(value.minLength)); +} +/** Returns true if the given value is TString */ +function IsString(value) { + // prettier-ignore + return (IsKindOf(value, 'String') && + value.type === 'string' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.minLength) && + IsOptionalNumber(value.maxLength) && + IsOptionalPattern(value.pattern) && + IsOptionalFormat(value.format)); +} +/** Returns true if the given value is TSymbol */ +function IsSymbol(value) { + // prettier-ignore + return (IsKindOf(value, 'Symbol') && + value.type === 'symbol' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TTemplateLiteral */ +function IsTemplateLiteral(value) { + // prettier-ignore + return (IsKindOf(value, 'TemplateLiteral') && + value.type === 'string' && + ValueGuard.IsString(value.pattern) && + value.pattern[0] === '^' && + value.pattern[value.pattern.length - 1] === '$'); +} +/** Returns true if the given value is TThis */ +function IsThis(value) { + // prettier-ignore + return (IsKindOf(value, 'This') && + IsOptionalString(value.$id) && + ValueGuard.IsString(value.$ref)); +} +/** Returns true of this value is TTransform */ +function IsTransform(value) { + return ValueGuard.IsObject(value) && index_1.TransformKind in value; +} +/** Returns true if the given value is TTuple */ +function IsTuple(value) { + // prettier-ignore + return (IsKindOf(value, 'Tuple') && + value.type === 'array' && + IsOptionalString(value.$id) && + ValueGuard.IsNumber(value.minItems) && + ValueGuard.IsNumber(value.maxItems) && + value.minItems === value.maxItems && + (( // empty + ValueGuard.IsUndefined(value.items) && + ValueGuard.IsUndefined(value.additionalItems) && + value.minItems === 0) || (ValueGuard.IsArray(value.items) && + value.items.every(schema => IsSchema(schema))))); +} +/** Returns true if the given value is TUndefined */ +function IsUndefined(value) { + // prettier-ignore + return (IsKindOf(value, 'Undefined') && + value.type === 'undefined' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TUnion[]> */ +function IsUnionLiteral(value) { + return IsUnion(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema)); +} +/** Returns true if the given value is TUnion */ +function IsUnion(value) { + // prettier-ignore + return (IsKindOf(value, 'Union') && + IsOptionalString(value.$id) && + ValueGuard.IsObject(value) && + ValueGuard.IsArray(value.anyOf) && + value.anyOf.every(schema => IsSchema(schema))); +} +/** Returns true if the given value is TUint8Array */ +function IsUint8Array(value) { + // prettier-ignore + return (IsKindOf(value, 'Uint8Array') && + value.type === 'Uint8Array' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.minByteLength) && + IsOptionalNumber(value.maxByteLength)); +} +/** Returns true if the given value is TUnknown */ +function IsUnknown(value) { + // prettier-ignore + return (IsKindOf(value, 'Unknown') && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is a raw TUnsafe */ +function IsUnsafe(value) { + return IsKindOf(value, 'Unsafe'); +} +/** Returns true if the given value is TVoid */ +function IsVoid(value) { + // prettier-ignore + return (IsKindOf(value, 'Void') && + value.type === 'void' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TKind */ +function IsKind(value) { + return ValueGuard.IsObject(value) && index_1.Kind in value && ValueGuard.IsString(value[index_1.Kind]) && !KnownTypes.includes(value[index_1.Kind]); +} +/** Returns true if the given value is TSchema */ +function IsSchema(value) { + // prettier-ignore + return (ValueGuard.IsObject(value)) && (IsAny(value) || + IsArgument(value) || + IsArray(value) || + IsBoolean(value) || + IsBigInt(value) || + IsAsyncIterator(value) || + IsComputed(value) || + IsConstructor(value) || + IsDate(value) || + IsFunction(value) || + IsInteger(value) || + IsIntersect(value) || + IsIterator(value) || + IsLiteral(value) || + IsMappedKey(value) || + IsMappedResult(value) || + IsNever(value) || + IsNot(value) || + IsNull(value) || + IsNumber(value) || + IsObject(value) || + IsPromise(value) || + IsRecord(value) || + IsRef(value) || + IsRegExp(value) || + IsString(value) || + IsSymbol(value) || + IsTemplateLiteral(value) || + IsThis(value) || + IsTuple(value) || + IsUndefined(value) || + IsUnion(value) || + IsUint8Array(value) || + IsUnknown(value) || + IsUnsafe(value) || + IsVoid(value) || + IsKind(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.d.ts new file mode 100644 index 0000000..f3d18d1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.d.ts @@ -0,0 +1,34 @@ +/** Returns true if this value has this property key */ +export declare function HasPropertyKey(value: Record, key: K): value is Record & { + [_ in K]: unknown; +}; +/** Returns true if this value is an async iterator */ +export declare function IsAsyncIterator(value: unknown): value is AsyncIterableIterator; +/** Returns true if this value is an array */ +export declare function IsArray(value: unknown): value is unknown[]; +/** Returns true if this value is bigint */ +export declare function IsBigInt(value: unknown): value is bigint; +/** Returns true if this value is a boolean */ +export declare function IsBoolean(value: unknown): value is boolean; +/** Returns true if this value is a Date object */ +export declare function IsDate(value: unknown): value is Date; +/** Returns true if this value is a function */ +export declare function IsFunction(value: unknown): value is Function; +/** Returns true if this value is an iterator */ +export declare function IsIterator(value: unknown): value is IterableIterator; +/** Returns true if this value is null */ +export declare function IsNull(value: unknown): value is null; +/** Returns true if this value is number */ +export declare function IsNumber(value: unknown): value is number; +/** Returns true if this value is an object */ +export declare function IsObject(value: unknown): value is Record; +/** Returns true if this value is RegExp */ +export declare function IsRegExp(value: unknown): value is RegExp; +/** Returns true if this value is string */ +export declare function IsString(value: unknown): value is string; +/** Returns true if this value is symbol */ +export declare function IsSymbol(value: unknown): value is symbol; +/** Returns true if this value is a Uint8Array */ +export declare function IsUint8Array(value: unknown): value is Uint8Array; +/** Returns true if this value is undefined */ +export declare function IsUndefined(value: unknown): value is undefined; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.js new file mode 100644 index 0000000..4be711e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/guard/value.js @@ -0,0 +1,89 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HasPropertyKey = HasPropertyKey; +exports.IsAsyncIterator = IsAsyncIterator; +exports.IsArray = IsArray; +exports.IsBigInt = IsBigInt; +exports.IsBoolean = IsBoolean; +exports.IsDate = IsDate; +exports.IsFunction = IsFunction; +exports.IsIterator = IsIterator; +exports.IsNull = IsNull; +exports.IsNumber = IsNumber; +exports.IsObject = IsObject; +exports.IsRegExp = IsRegExp; +exports.IsString = IsString; +exports.IsSymbol = IsSymbol; +exports.IsUint8Array = IsUint8Array; +exports.IsUndefined = IsUndefined; +// -------------------------------------------------------------------------- +// PropertyKey +// -------------------------------------------------------------------------- +/** Returns true if this value has this property key */ +function HasPropertyKey(value, key) { + return key in value; +} +// -------------------------------------------------------------------------- +// Object Instances +// -------------------------------------------------------------------------- +/** Returns true if this value is an async iterator */ +function IsAsyncIterator(value) { + return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value; +} +/** Returns true if this value is an array */ +function IsArray(value) { + return Array.isArray(value); +} +/** Returns true if this value is bigint */ +function IsBigInt(value) { + return typeof value === 'bigint'; +} +/** Returns true if this value is a boolean */ +function IsBoolean(value) { + return typeof value === 'boolean'; +} +/** Returns true if this value is a Date object */ +function IsDate(value) { + return value instanceof globalThis.Date; +} +/** Returns true if this value is a function */ +function IsFunction(value) { + return typeof value === 'function'; +} +/** Returns true if this value is an iterator */ +function IsIterator(value) { + return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value; +} +/** Returns true if this value is null */ +function IsNull(value) { + return value === null; +} +/** Returns true if this value is number */ +function IsNumber(value) { + return typeof value === 'number'; +} +/** Returns true if this value is an object */ +function IsObject(value) { + return typeof value === 'object' && value !== null; +} +/** Returns true if this value is RegExp */ +function IsRegExp(value) { + return value instanceof globalThis.RegExp; +} +/** Returns true if this value is string */ +function IsString(value) { + return typeof value === 'string'; +} +/** Returns true if this value is symbol */ +function IsSymbol(value) { + return typeof value === 'symbol'; +} +/** Returns true if this value is a Uint8Array */ +function IsUint8Array(value) { + return value instanceof globalThis.Uint8Array; +} +/** Returns true if this value is undefined */ +function IsUndefined(value) { + return value === undefined; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.d.ts new file mode 100644 index 0000000..f233de1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.d.ts @@ -0,0 +1,42 @@ +import type { TSchema } from '../schema/index'; +import type { TProperties } from '../object/index'; +import type { TNever } from '../never/index'; +export type TupleToIntersect = T extends [infer I] ? I : T extends [infer I, ...infer R] ? I & TupleToIntersect : never; +export type TupleToUnion = { + [K in keyof T]: T[K]; +}[number]; +export type UnionToIntersect = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never; +export type UnionLast = UnionToIntersect 0 : never> extends (x: infer L) => 0 ? L : never; +export type UnionToTuple> = [U] extends [never] ? Acc : UnionToTuple, [Extract, ...Acc]>; +export type Trim = T extends `${' '}${infer U}` ? Trim : T extends `${infer U}${' '}` ? Trim : T; +export type Assert = T extends E ? T : never; +export type Evaluate = T extends infer O ? { + [K in keyof O]: O[K]; +} : never; +export type Ensure = T extends infer U ? U : never; +export type EmptyString = ''; +export type ZeroString = '0'; +type IncrementBase = { + m: '9'; + t: '01'; + '0': '1'; + '1': '2'; + '2': '3'; + '3': '4'; + '4': '5'; + '5': '6'; + '6': '7'; + '7': '8'; + '8': '9'; + '9': '0'; +}; +type IncrementTake = IncrementBase[T]; +type IncrementStep = T extends IncrementBase['m'] ? IncrementBase['t'] : T extends `${infer L extends keyof IncrementBase}${infer R}` ? L extends IncrementBase['m'] ? `${IncrementTake}${IncrementStep}` : `${IncrementTake}${R}` : never; +type IncrementReverse = T extends `${infer L}${infer R}` ? `${IncrementReverse}${L}` : T; +export type TIncrement = IncrementReverse>>; +/** Increments the given string value + 1 */ +export declare function Increment(T: T): TIncrement; +export type AssertProperties = T extends TProperties ? T : TProperties; +export type AssertRest = T extends E ? T : []; +export type AssertType = T extends E ? T : TNever; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.js new file mode 100644 index 0000000..74eb087 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/helpers.js @@ -0,0 +1,8 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Increment = Increment; +/** Increments the given string value + 1 */ +function Increment(T) { + return (parseInt(T) + 1).toString(); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.d.ts new file mode 100644 index 0000000..c5f595c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.d.ts @@ -0,0 +1 @@ +export * from './helpers'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.js new file mode 100644 index 0000000..34ace62 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/helpers/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./helpers"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/index.d.ts new file mode 100644 index 0000000..0dd6613 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/index.d.ts @@ -0,0 +1,71 @@ +export * from './any/index'; +export * from './argument/index'; +export * from './array/index'; +export * from './async-iterator/index'; +export * from './awaited/index'; +export * from './bigint/index'; +export * from './boolean/index'; +export * from './clone/index'; +export * from './composite/index'; +export * from './const/index'; +export * from './constructor/index'; +export * from './constructor-parameters/index'; +export * from './date/index'; +export * from './discard/index'; +export * from './enum/index'; +export * from './error/index'; +export * from './exclude/index'; +export * from './extends/index'; +export * from './extract/index'; +export * from './function/index'; +export * from './guard/index'; +export * from './helpers/index'; +export * from './indexed/index'; +export * from './instance-type/index'; +export * from './instantiate/index'; +export * from './integer/index'; +export * from './intersect/index'; +export * from './intrinsic/index'; +export * from './iterator/index'; +export * from './keyof/index'; +export * from './literal/index'; +export * from './mapped/index'; +export * from './module/index'; +export * from './never/index'; +export * from './not/index'; +export * from './null/index'; +export * from './number/index'; +export * from './object/index'; +export * from './omit/index'; +export * from './optional/index'; +export * from './parameters/index'; +export * from './partial/index'; +export * from './patterns/index'; +export * from './pick/index'; +export * from './promise/index'; +export * from './readonly/index'; +export * from './readonly-optional/index'; +export * from './record/index'; +export * from './recursive/index'; +export * from './ref/index'; +export * from './regexp/index'; +export * from './registry/index'; +export * from './required/index'; +export * from './rest/index'; +export * from './return-type/index'; +export * from './schema/index'; +export * from './sets/index'; +export * from './static/index'; +export * from './string/index'; +export * from './symbol/index'; +export * from './symbols/index'; +export * from './template-literal/index'; +export * from './transform/index'; +export * from './tuple/index'; +export * from './type/index'; +export * from './uint8array/index'; +export * from './undefined/index'; +export * from './union/index'; +export * from './unknown/index'; +export * from './unsafe/index'; +export * from './void/index'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/index.js new file mode 100644 index 0000000..e752a59 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/index.js @@ -0,0 +1,88 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./any/index"), exports); +__exportStar(require("./argument/index"), exports); +__exportStar(require("./array/index"), exports); +__exportStar(require("./async-iterator/index"), exports); +__exportStar(require("./awaited/index"), exports); +__exportStar(require("./bigint/index"), exports); +__exportStar(require("./boolean/index"), exports); +__exportStar(require("./clone/index"), exports); +__exportStar(require("./composite/index"), exports); +__exportStar(require("./const/index"), exports); +__exportStar(require("./constructor/index"), exports); +__exportStar(require("./constructor-parameters/index"), exports); +__exportStar(require("./date/index"), exports); +__exportStar(require("./discard/index"), exports); +__exportStar(require("./enum/index"), exports); +__exportStar(require("./error/index"), exports); +__exportStar(require("./exclude/index"), exports); +__exportStar(require("./extends/index"), exports); +__exportStar(require("./extract/index"), exports); +__exportStar(require("./function/index"), exports); +__exportStar(require("./guard/index"), exports); +__exportStar(require("./helpers/index"), exports); +__exportStar(require("./indexed/index"), exports); +__exportStar(require("./instance-type/index"), exports); +__exportStar(require("./instantiate/index"), exports); +__exportStar(require("./integer/index"), exports); +__exportStar(require("./intersect/index"), exports); +__exportStar(require("./intrinsic/index"), exports); +__exportStar(require("./iterator/index"), exports); +__exportStar(require("./keyof/index"), exports); +__exportStar(require("./literal/index"), exports); +__exportStar(require("./mapped/index"), exports); +__exportStar(require("./module/index"), exports); +__exportStar(require("./never/index"), exports); +__exportStar(require("./not/index"), exports); +__exportStar(require("./null/index"), exports); +__exportStar(require("./number/index"), exports); +__exportStar(require("./object/index"), exports); +__exportStar(require("./omit/index"), exports); +__exportStar(require("./optional/index"), exports); +__exportStar(require("./parameters/index"), exports); +__exportStar(require("./partial/index"), exports); +__exportStar(require("./patterns/index"), exports); +__exportStar(require("./pick/index"), exports); +__exportStar(require("./promise/index"), exports); +__exportStar(require("./readonly/index"), exports); +__exportStar(require("./readonly-optional/index"), exports); +__exportStar(require("./record/index"), exports); +__exportStar(require("./recursive/index"), exports); +__exportStar(require("./ref/index"), exports); +__exportStar(require("./regexp/index"), exports); +__exportStar(require("./registry/index"), exports); +__exportStar(require("./required/index"), exports); +__exportStar(require("./rest/index"), exports); +__exportStar(require("./return-type/index"), exports); +__exportStar(require("./schema/index"), exports); +__exportStar(require("./sets/index"), exports); +__exportStar(require("./static/index"), exports); +__exportStar(require("./string/index"), exports); +__exportStar(require("./symbol/index"), exports); +__exportStar(require("./symbols/index"), exports); +__exportStar(require("./template-literal/index"), exports); +__exportStar(require("./transform/index"), exports); +__exportStar(require("./tuple/index"), exports); +__exportStar(require("./type/index"), exports); +__exportStar(require("./uint8array/index"), exports); +__exportStar(require("./undefined/index"), exports); +__exportStar(require("./union/index"), exports); +__exportStar(require("./unknown/index"), exports); +__exportStar(require("./unsafe/index"), exports); +__exportStar(require("./void/index"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.d.ts new file mode 100644 index 0000000..201b474 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.d.ts @@ -0,0 +1,4 @@ +export * from './indexed-from-mapped-key'; +export * from './indexed-from-mapped-result'; +export * from './indexed-property-keys'; +export * from './indexed'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.js new file mode 100644 index 0000000..a3f16d7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/index.js @@ -0,0 +1,21 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./indexed-from-mapped-key"), exports); +__exportStar(require("./indexed-from-mapped-result"), exports); +__exportStar(require("./indexed-property-keys"), exports); +__exportStar(require("./indexed"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.d.ts new file mode 100644 index 0000000..8ecf435 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.d.ts @@ -0,0 +1,13 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Ensure, Evaluate } from '../helpers/index'; +import type { TProperties } from '../object/index'; +import { type TIndex } from './indexed'; +import { type TMappedResult, type TMappedKey } from '../mapped/index'; +type TMappedIndexPropertyKey = { + [_ in Key]: TIndex; +}; +type TMappedIndexPropertyKeys = (PropertyKeys extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? TMappedIndexPropertyKeys> : Result); +type TMappedIndexProperties = Evaluate>; +export type TIndexFromMappedKey> = (Ensure>); +export declare function IndexFromMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.js new file mode 100644 index 0000000..2a2aaf4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-key.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IndexFromMappedKey = IndexFromMappedKey; +const indexed_1 = require("./indexed"); +const index_1 = require("../mapped/index"); +const value_1 = require("../clone/value"); +// prettier-ignore +function MappedIndexPropertyKey(type, key, options) { + return { [key]: (0, indexed_1.Index)(type, [key], (0, value_1.Clone)(options)) }; +} +// prettier-ignore +function MappedIndexPropertyKeys(type, propertyKeys, options) { + return propertyKeys.reduce((result, left) => { + return { ...result, ...MappedIndexPropertyKey(type, left, options) }; + }, {}); +} +// prettier-ignore +function MappedIndexProperties(type, mappedKey, options) { + return MappedIndexPropertyKeys(type, mappedKey.keys, options); +} +// prettier-ignore +function IndexFromMappedKey(type, mappedKey, options) { + const properties = MappedIndexProperties(type, mappedKey, options); + return (0, index_1.MappedResult)(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.d.ts new file mode 100644 index 0000000..d5f13a0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.d.ts @@ -0,0 +1,12 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TIndexPropertyKeys } from './indexed-property-keys'; +import { type TIndex } from './index'; +type TFromProperties = ({ + [K2 in keyof Properties]: TIndex>; +}); +type TFromMappedResult = (TFromProperties); +export type TIndexFromMappedResult> = (TMappedResult); +export declare function IndexFromMappedResult>(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.js new file mode 100644 index 0000000..1bbabeb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-from-mapped-result.js @@ -0,0 +1,24 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IndexFromMappedResult = IndexFromMappedResult; +const index_1 = require("../mapped/index"); +const indexed_property_keys_1 = require("./indexed-property-keys"); +const index_2 = require("./index"); +// prettier-ignore +function FromProperties(type, properties, options) { + const result = {}; + for (const K2 of Object.getOwnPropertyNames(properties)) { + result[K2] = (0, index_2.Index)(type, (0, indexed_property_keys_1.IndexPropertyKeys)(properties[K2]), options); + } + return result; +} +// prettier-ignore +function FromMappedResult(type, mappedResult, options) { + return FromProperties(type, mappedResult.properties, options); +} +// prettier-ignore +function IndexFromMappedResult(type, mappedResult, options) { + const properties = FromMappedResult(type, mappedResult, options); + return (0, index_1.MappedResult)(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.d.ts new file mode 100644 index 0000000..fe337bf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.d.ts @@ -0,0 +1,14 @@ +import { type TTemplateLiteralGenerate, type TTemplateLiteral } from '../template-literal/index'; +import type { TLiteral, TLiteralValue } from '../literal/index'; +import type { TInteger } from '../integer/index'; +import type { TNumber } from '../number/index'; +import type { TSchema } from '../schema/index'; +import type { TUnion } from '../union/index'; +type TFromTemplateLiteral> = (Keys); +type TFromUnion = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromUnion]> : Result); +type TFromLiteral = (LiteralValue extends PropertyKey ? [`${LiteralValue}`] : []); +export type TIndexPropertyKeys = (Type extends TTemplateLiteral ? TFromTemplateLiteral : Type extends TUnion ? TFromUnion : Type extends TLiteral ? TFromLiteral : Type extends TNumber ? ['[number]'] : Type extends TInteger ? ['[number]'] : [ +]); +/** Returns a tuple of PropertyKeys derived from the given TSchema */ +export declare function IndexPropertyKeys(type: Type): TIndexPropertyKeys; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.js new file mode 100644 index 0000000..c794ba0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed-property-keys.js @@ -0,0 +1,36 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IndexPropertyKeys = IndexPropertyKeys; +const index_1 = require("../template-literal/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function FromTemplateLiteral(templateLiteral) { + const keys = (0, index_1.TemplateLiteralGenerate)(templateLiteral); + return keys.map(key => key.toString()); +} +// prettier-ignore +function FromUnion(types) { + const result = []; + for (const type of types) + result.push(...IndexPropertyKeys(type)); + return result; +} +// prettier-ignore +function FromLiteral(literalValue) { + return ([literalValue.toString()] // TS 5.4 observes TLiteralValue as not having a toString() + ); +} +/** Returns a tuple of PropertyKeys derived from the given TSchema */ +// prettier-ignore +function IndexPropertyKeys(type) { + return [...new Set(((0, kind_1.IsTemplateLiteral)(type) ? FromTemplateLiteral(type) : + (0, kind_1.IsUnion)(type) ? FromUnion(type.anyOf) : + (0, kind_1.IsLiteral)(type) ? FromLiteral(type.const) : + (0, kind_1.IsNumber)(type) ? ['[number]'] : + (0, kind_1.IsInteger)(type) ? ['[number]'] : + []))]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.d.ts new file mode 100644 index 0000000..8a8d1d8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.d.ts @@ -0,0 +1,52 @@ +import { type TSchema, SchemaOptions } from '../schema/index'; +import { type Assert } from '../helpers/index'; +import { type TComputed } from '../computed/index'; +import { type TNever } from '../never/index'; +import { type TArray } from '../array/index'; +import { type TIntersect } from '../intersect/index'; +import { type TMappedResult, type TMappedKey } from '../mapped/index'; +import { type TObject, type TProperties } from '../object/index'; +import { type TUnion } from '../union/index'; +import { type TRecursive } from '../recursive/index'; +import { type TRef } from '../ref/index'; +import { type TTuple } from '../tuple/index'; +import { type TIntersectEvaluated } from '../intersect/index'; +import { type TUnionEvaluated } from '../union/index'; +import { type TIndexPropertyKeys } from './indexed-property-keys'; +import { type TIndexFromMappedKey } from './indexed-from-mapped-key'; +import { type TIndexFromMappedResult } from './indexed-from-mapped-result'; +type TFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest, TSchema>]> : Result); +type TFromIntersectRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? TFromIntersectRest : TFromIntersectRest : Result); +type TFromIntersect = (TIntersectEvaluated>>); +type TFromUnionRest = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? [] : TFromUnionRest : Result; +type TFromUnion = (TUnionEvaluated>>); +type TFromTuple = (Key extends keyof Types ? Types[Key] : Key extends '[number]' ? TUnionEvaluated : TNever); +type TFromArray = (Key extends '[number]' ? Type : TNever); +type AssertPropertyKey = Assert; +type TFromProperty = (Key extends keyof Properties ? Properties[Key] : `${AssertPropertyKey}` extends `${AssertPropertyKey}` ? Properties[AssertPropertyKey] : TNever); +export type TIndexFromPropertyKey = (Type extends TRecursive ? TIndexFromPropertyKey : Type extends TIntersect ? TFromIntersect : Type extends TUnion ? TFromUnion : Type extends TTuple ? TFromTuple : Type extends TArray ? TFromArray : Type extends TObject ? TFromProperty : TNever); +export declare function IndexFromPropertyKey(type: Type, propertyKey: Key): TIndexFromPropertyKey; +export type TIndexFromPropertyKeys = (PropertyKeys extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? TIndexFromPropertyKeys, TSchema>]> : Result); +export declare function IndexFromPropertyKeys(type: Type, propertyKeys: [...PropertyKeys]): TIndexFromPropertyKeys; +type FromSchema = (TUnionEvaluated>); +declare function FromSchema(type: Type, propertyKeys: [...PropertyKeys]): FromSchema; +export type TIndexFromComputed = (TComputed<'Index', [Type, Key]>); +export declare function IndexFromComputed(type: Type, key: Key): TIndexFromComputed; +export type TIndex = (FromSchema); +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TIndexFromMappedKey; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index>(T: Type, K: Key, options?: SchemaOptions): TIndex; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, propertyKeys: readonly [...PropertyKeys], options?: SchemaOptions): TIndex; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.js new file mode 100644 index 0000000..002596d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/indexed/indexed.js @@ -0,0 +1,98 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IndexFromPropertyKey = IndexFromPropertyKey; +exports.IndexFromPropertyKeys = IndexFromPropertyKeys; +exports.IndexFromComputed = IndexFromComputed; +exports.Index = Index; +const type_1 = require("../create/type"); +const index_1 = require("../error/index"); +const index_2 = require("../computed/index"); +const index_3 = require("../never/index"); +const index_4 = require("../intersect/index"); +const index_5 = require("../union/index"); +const indexed_property_keys_1 = require("./indexed-property-keys"); +const indexed_from_mapped_key_1 = require("./indexed-from-mapped-key"); +const indexed_from_mapped_result_1 = require("./indexed-from-mapped-result"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function FromRest(types, key) { + return types.map(type => IndexFromPropertyKey(type, key)); +} +// prettier-ignore +function FromIntersectRest(types) { + return types.filter(type => !(0, kind_1.IsNever)(type)); +} +// prettier-ignore +function FromIntersect(types, key) { + return ((0, index_4.IntersectEvaluated)(FromIntersectRest(FromRest(types, key)))); +} +// prettier-ignore +function FromUnionRest(types) { + return (types.some(L => (0, kind_1.IsNever)(L)) + ? [] + : types); +} +// prettier-ignore +function FromUnion(types, key) { + return ((0, index_5.UnionEvaluated)(FromUnionRest(FromRest(types, key)))); +} +// prettier-ignore +function FromTuple(types, key) { + return (key in types ? types[key] : + key === '[number]' ? (0, index_5.UnionEvaluated)(types) : + (0, index_3.Never)()); +} +// prettier-ignore +function FromArray(type, key) { + return (key === '[number]' + ? type + : (0, index_3.Never)()); +} +// prettier-ignore +function FromProperty(properties, propertyKey) { + return (propertyKey in properties ? properties[propertyKey] : (0, index_3.Never)()); +} +// prettier-ignore +function IndexFromPropertyKey(type, propertyKey) { + return ((0, kind_1.IsIntersect)(type) ? FromIntersect(type.allOf, propertyKey) : + (0, kind_1.IsUnion)(type) ? FromUnion(type.anyOf, propertyKey) : + (0, kind_1.IsTuple)(type) ? FromTuple(type.items ?? [], propertyKey) : + (0, kind_1.IsArray)(type) ? FromArray(type.items, propertyKey) : + (0, kind_1.IsObject)(type) ? FromProperty(type.properties, propertyKey) : + (0, index_3.Never)()); +} +// prettier-ignore +function IndexFromPropertyKeys(type, propertyKeys) { + return propertyKeys.map(propertyKey => IndexFromPropertyKey(type, propertyKey)); +} +// prettier-ignore +function FromSchema(type, propertyKeys) { + return ((0, index_5.UnionEvaluated)(IndexFromPropertyKeys(type, propertyKeys))); +} +// prettier-ignore +function IndexFromComputed(type, key) { + return (0, index_2.Computed)('Index', [type, key]); +} +/** `[Json]` Returns an Indexed property type for the given keys */ +function Index(type, key, options) { + // computed-type + if ((0, kind_1.IsRef)(type) || (0, kind_1.IsRef)(key)) { + const error = `Index types using Ref parameters require both Type and Key to be of TSchema`; + if (!(0, kind_1.IsSchema)(type) || !(0, kind_1.IsSchema)(key)) + throw new index_1.TypeBoxError(error); + return (0, index_2.Computed)('Index', [type, key]); + } + // mapped-types + if ((0, kind_1.IsMappedResult)(key)) + return (0, indexed_from_mapped_result_1.IndexFromMappedResult)(type, key, options); + if ((0, kind_1.IsMappedKey)(key)) + return (0, indexed_from_mapped_key_1.IndexFromMappedKey)(type, key, options); + // prettier-ignore + return (0, type_1.CreateType)((0, kind_1.IsSchema)(key) + ? FromSchema(type, (0, indexed_property_keys_1.IndexPropertyKeys)(key)) + : FromSchema(type, key), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.d.ts new file mode 100644 index 0000000..6f813f6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.d.ts @@ -0,0 +1 @@ +export * from './instance-type'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.js new file mode 100644 index 0000000..a2fad0f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./instance-type"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.d.ts new file mode 100644 index 0000000..525c176 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.d.ts @@ -0,0 +1,6 @@ +import { type TSchema, SchemaOptions } from '../schema/index'; +import { type TConstructor } from '../constructor/index'; +import { type TNever } from '../never/index'; +export type TInstanceType ? InstanceType : TNever> = Result; +/** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ +export declare function InstanceType(schema: Type, options?: SchemaOptions): TInstanceType; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.js new file mode 100644 index 0000000..2d14e36 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instance-type/instance-type.js @@ -0,0 +1,44 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InstanceType = InstanceType; +const type_1 = require("../create/type"); +const index_1 = require("../never/index"); +const KindGuard = __importStar(require("../guard/kind")); +/** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ +function InstanceType(schema, options) { + return (KindGuard.IsConstructor(schema) ? (0, type_1.CreateType)(schema.returns, options) : (0, index_1.Never)(options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.d.ts new file mode 100644 index 0000000..3371567 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.d.ts @@ -0,0 +1 @@ +export * from './instantiate'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.js new file mode 100644 index 0000000..2e6f35a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./instantiate"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.d.ts new file mode 100644 index 0000000..381fb6c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.d.ts @@ -0,0 +1,50 @@ +import { type TSchema } from '../schema/index'; +import { type TArgument } from '../argument/index'; +import { type TUnknown } from '../unknown/index'; +import { type TReadonlyOptional } from '../readonly-optional/index'; +import { type TReadonly } from '../readonly/index'; +import { type TOptional } from '../optional/index'; +import { type TConstructor } from '../constructor/index'; +import { type TFunction } from '../function/index'; +import { type TIntersect } from '../intersect/index'; +import { type TUnion } from '../union/index'; +import { type TTuple } from '../tuple/index'; +import { type TArray } from '../array/index'; +import { type TAsyncIterator } from '../async-iterator/index'; +import { type TIterator } from '../iterator/index'; +import { type TPromise } from '../promise/index'; +import { type TObject, type TProperties } from '../object/index'; +import { type TRecordOrObject, type TRecord } from '../record/index'; +type TFromConstructor, TFromType>> = Result; +type TFromFunction, TFromType>> = Result; +type TFromIntersect>> = Result; +type TFromUnion>> = Result; +type TFromTuple>> = Result; +type TFromArray>> = Result; +type TFromAsyncIterator>> = Result; +type TFromIterator>> = Result; +type TFromPromise>> = Result; +type TFromObject, Result extends TSchema = TObject> = Result; +type TFromRecord, MappedValue extends TSchema = TFromType, Result extends TSchema = TRecordOrObject> = Result; +type TFromArgument = Result; +type TFromProperty ? true : false, IsOptional extends boolean = Type extends TOptional ? true : false, Mapped extends TSchema = TFromType, Result extends TSchema = ([ + IsReadonly, + IsOptional +] extends [true, true] ? TReadonlyOptional : [ + IsReadonly, + IsOptional +] extends [true, false] ? TReadonly : [ + IsReadonly, + IsOptional +] extends [false, true] ? TOptional : Mapped)> = Result; +type TFromProperties; +}> = Result; +export type TFromTypes = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromTypes]> : Result); +export declare function FromTypes(args: [...Args], types: [...Types]): TFromTypes; +export type TFromType = (Type extends TConstructor ? TFromConstructor : Type extends TFunction ? TFromFunction : Type extends TIntersect ? TFromIntersect : Type extends TUnion ? TFromUnion : Type extends TTuple ? TFromTuple : Type extends TArray ? TFromArray : Type extends TAsyncIterator ? TFromAsyncIterator : Type extends TIterator ? TFromIterator : Type extends TPromise ? TFromPromise : Type extends TObject ? TFromObject : Type extends TRecord ? TFromRecord : Type extends TArgument ? TFromArgument : Type); +/** `[JavaScript]` Instantiates a type with the given parameters */ +export type TInstantiate> = Result; +/** `[JavaScript]` Instantiates a type with the given parameters */ +export declare function Instantiate(type: Type, args: [...Args]): TInstantiate; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.js new file mode 100644 index 0000000..c1c4970 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/instantiate/instantiate.js @@ -0,0 +1,153 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FromTypes = FromTypes; +exports.Instantiate = Instantiate; +const type_1 = require("../clone/type"); +const index_1 = require("../unknown/index"); +const index_2 = require("../readonly-optional/index"); +const index_3 = require("../readonly/index"); +const index_4 = require("../optional/index"); +const index_5 = require("../object/index"); +const index_6 = require("../record/index"); +const ValueGuard = __importStar(require("../guard/value")); +const KindGuard = __importStar(require("../guard/kind")); +// prettier-ignore +function FromConstructor(args, type) { + type.parameters = FromTypes(args, type.parameters); + type.returns = FromType(args, type.returns); + return type; +} +// prettier-ignore +function FromFunction(args, type) { + type.parameters = FromTypes(args, type.parameters); + type.returns = FromType(args, type.returns); + return type; +} +// prettier-ignore +function FromIntersect(args, type) { + type.allOf = FromTypes(args, type.allOf); + return type; +} +// prettier-ignore +function FromUnion(args, type) { + type.anyOf = FromTypes(args, type.anyOf); + return type; +} +// prettier-ignore +function FromTuple(args, type) { + if (ValueGuard.IsUndefined(type.items)) + return type; + type.items = FromTypes(args, type.items); + return type; +} +// prettier-ignore +function FromArray(args, type) { + type.items = FromType(args, type.items); + return type; +} +// prettier-ignore +function FromAsyncIterator(args, type) { + type.items = FromType(args, type.items); + return type; +} +// prettier-ignore +function FromIterator(args, type) { + type.items = FromType(args, type.items); + return type; +} +// prettier-ignore +function FromPromise(args, type) { + type.item = FromType(args, type.item); + return type; +} +// prettier-ignore +function FromObject(args, type) { + const mappedProperties = FromProperties(args, type.properties); + return { ...type, ...(0, index_5.Object)(mappedProperties) }; // retain options +} +// prettier-ignore +function FromRecord(args, type) { + const mappedKey = FromType(args, (0, index_6.RecordKey)(type)); + const mappedValue = FromType(args, (0, index_6.RecordValue)(type)); + const result = (0, index_6.Record)(mappedKey, mappedValue); + return { ...type, ...result }; // retain options +} +// prettier-ignore +function FromArgument(args, argument) { + return argument.index in args ? args[argument.index] : (0, index_1.Unknown)(); +} +// prettier-ignore +function FromProperty(args, type) { + const isReadonly = KindGuard.IsReadonly(type); + const isOptional = KindGuard.IsOptional(type); + const mapped = FromType(args, type); + return (isReadonly && isOptional ? (0, index_2.ReadonlyOptional)(mapped) : + isReadonly && !isOptional ? (0, index_3.Readonly)(mapped) : + !isReadonly && isOptional ? (0, index_4.Optional)(mapped) : + mapped); +} +// prettier-ignore +function FromProperties(args, properties) { + return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => { + return { ...result, [key]: FromProperty(args, properties[key]) }; + }, {}); +} +// prettier-ignore +function FromTypes(args, types) { + return types.map(type => FromType(args, type)); +} +// prettier-ignore +function FromType(args, type) { + return (KindGuard.IsConstructor(type) ? FromConstructor(args, type) : + KindGuard.IsFunction(type) ? FromFunction(args, type) : + KindGuard.IsIntersect(type) ? FromIntersect(args, type) : + KindGuard.IsUnion(type) ? FromUnion(args, type) : + KindGuard.IsTuple(type) ? FromTuple(args, type) : + KindGuard.IsArray(type) ? FromArray(args, type) : + KindGuard.IsAsyncIterator(type) ? FromAsyncIterator(args, type) : + KindGuard.IsIterator(type) ? FromIterator(args, type) : + KindGuard.IsPromise(type) ? FromPromise(args, type) : + KindGuard.IsObject(type) ? FromObject(args, type) : + KindGuard.IsRecord(type) ? FromRecord(args, type) : + KindGuard.IsArgument(type) ? FromArgument(args, type) : + type); +} +/** `[JavaScript]` Instantiates a type with the given parameters */ +// prettier-ignore +function Instantiate(type, args) { + return FromType(args, (0, type_1.CloneType)(type)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.d.ts new file mode 100644 index 0000000..3520152 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.d.ts @@ -0,0 +1 @@ +export * from './integer'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.js new file mode 100644 index 0000000..d9121bb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./integer"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.d.ts new file mode 100644 index 0000000..24e6f00 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.d.ts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface IntegerOptions extends SchemaOptions { + exclusiveMaximum?: number; + exclusiveMinimum?: number; + maximum?: number; + minimum?: number; + multipleOf?: number; +} +export interface TInteger extends TSchema, IntegerOptions { + [Kind]: 'Integer'; + static: number; + type: 'integer'; +} +/** `[Json]` Creates an Integer type */ +export declare function Integer(options?: IntegerOptions): TInteger; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.js new file mode 100644 index 0000000..93db750 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/integer/integer.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Integer = Integer; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates an Integer type */ +function Integer(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Integer', type: 'integer' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.d.ts new file mode 100644 index 0000000..2fc585c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.d.ts @@ -0,0 +1,3 @@ +export * from './intersect-evaluated'; +export * from './intersect-type'; +export * from './intersect'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.js new file mode 100644 index 0000000..da31641 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./intersect-evaluated"), exports); +__exportStar(require("./intersect-type"), exports); +__exportStar(require("./intersect"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.d.ts new file mode 100644 index 0000000..2877c26 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.d.ts @@ -0,0 +1,3 @@ +import type { TSchema } from '../schema/index'; +import type { TIntersect, IntersectOptions } from './intersect-type'; +export declare function IntersectCreate(T: [...T], options?: IntersectOptions): TIntersect; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.js new file mode 100644 index 0000000..4d72e7a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-create.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IntersectCreate = IntersectCreate; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// ------------------------------------------------------------------ +// IntersectCreate +// ------------------------------------------------------------------ +// prettier-ignore +function IntersectCreate(T, options = {}) { + const allObjects = T.every((schema) => (0, kind_1.IsObject)(schema)); + const clonedUnevaluatedProperties = (0, kind_1.IsSchema)(options.unevaluatedProperties) + ? { unevaluatedProperties: options.unevaluatedProperties } + : {}; + return (0, type_1.CreateType)((options.unevaluatedProperties === false || (0, kind_1.IsSchema)(options.unevaluatedProperties) || allObjects + ? { ...clonedUnevaluatedProperties, [index_1.Kind]: 'Intersect', type: 'object', allOf: T } + : { ...clonedUnevaluatedProperties, [index_1.Kind]: 'Intersect', allOf: T }), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.d.ts new file mode 100644 index 0000000..3216373 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.d.ts @@ -0,0 +1,13 @@ +import type { TSchema } from '../schema/index'; +import { type TNever } from '../never/index'; +import { type TOptional } from '../optional/index'; +import type { TReadonly } from '../readonly/index'; +import { TIntersect, IntersectOptions } from './intersect-type'; +type TIsIntersectOptional = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? TIsIntersectOptional : false : true); +type TRemoveOptionalFromType = (Type extends TReadonly ? TReadonly> : Type extends TOptional ? TRemoveOptionalFromType : Type); +type TRemoveOptionalFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? TRemoveOptionalFromRest]> : TRemoveOptionalFromRest : Result); +type TResolveIntersect = (TIsIntersectOptional extends true ? TOptional>> : TIntersect>); +export type TIntersectEvaluated = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TResolveIntersect); +/** `[Json]` Creates an evaluated Intersect type */ +export declare function IntersectEvaluated>(types: [...Types], options?: IntersectOptions): Result; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.js new file mode 100644 index 0000000..1167f52 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-evaluated.js @@ -0,0 +1,42 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IntersectEvaluated = IntersectEvaluated; +const index_1 = require("../symbols/index"); +const type_1 = require("../create/type"); +const index_2 = require("../discard/index"); +const index_3 = require("../never/index"); +const index_4 = require("../optional/index"); +const intersect_create_1 = require("./intersect-create"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function IsIntersectOptional(types) { + return types.every(left => (0, kind_1.IsOptional)(left)); +} +// prettier-ignore +function RemoveOptionalFromType(type) { + return ((0, index_2.Discard)(type, [index_1.OptionalKind])); +} +// prettier-ignore +function RemoveOptionalFromRest(types) { + return types.map(left => (0, kind_1.IsOptional)(left) ? RemoveOptionalFromType(left) : left); +} +// prettier-ignore +function ResolveIntersect(types, options) { + return (IsIntersectOptional(types) + ? (0, index_4.Optional)((0, intersect_create_1.IntersectCreate)(RemoveOptionalFromRest(types), options)) + : (0, intersect_create_1.IntersectCreate)(RemoveOptionalFromRest(types), options)); +} +/** `[Json]` Creates an evaluated Intersect type */ +function IntersectEvaluated(types, options = {}) { + if (types.length === 1) + return (0, type_1.CreateType)(types[0], options); + if (types.length === 0) + return (0, index_3.Never)(options); + if (types.some((schema) => (0, kind_1.IsTransform)(schema))) + throw new Error('Cannot intersect transform types'); + return ResolveIntersect(types, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.d.ts new file mode 100644 index 0000000..dc8f3d1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.d.ts @@ -0,0 +1,15 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +type TIntersectStatic = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TIntersectStatic> : Acc; +export type TUnevaluatedProperties = undefined | TSchema | boolean; +export interface IntersectOptions extends SchemaOptions { + unevaluatedProperties?: TUnevaluatedProperties; +} +export interface TIntersect extends TSchema, IntersectOptions { + [Kind]: 'Intersect'; + static: TIntersectStatic; + type?: 'object'; + allOf: [...T]; +} +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.js new file mode 100644 index 0000000..aca9239 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect-type.js @@ -0,0 +1,4 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const index_1 = require("../symbols/index"); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.d.ts new file mode 100644 index 0000000..f438cf5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.d.ts @@ -0,0 +1,6 @@ +import type { TSchema } from '../schema/index'; +import { type TNever } from '../never/index'; +import { TIntersect, IntersectOptions } from './intersect-type'; +export type Intersect = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TIntersect); +/** `[Json]` Creates an evaluated Intersect type */ +export declare function Intersect(types: [...Types], options?: IntersectOptions): Intersect; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.js new file mode 100644 index 0000000..10403f7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intersect/intersect.js @@ -0,0 +1,21 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Intersect = Intersect; +const type_1 = require("../create/type"); +const index_1 = require("../never/index"); +const intersect_create_1 = require("./intersect-create"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +/** `[Json]` Creates an evaluated Intersect type */ +function Intersect(types, options) { + if (types.length === 1) + return (0, type_1.CreateType)(types[0], options); + if (types.length === 0) + return (0, index_1.Never)(options); + if (types.some((schema) => (0, kind_1.IsTransform)(schema))) + throw new Error('Cannot intersect transform types'); + return (0, intersect_create_1.IntersectCreate)(types, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.d.ts new file mode 100644 index 0000000..274a5f7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.d.ts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TIntrinsic } from './intrinsic'; +export type TCapitalize = TIntrinsic; +/** `[Json]` Intrinsic function to Capitalize LiteralString types */ +export declare function Capitalize(T: T, options?: SchemaOptions): TCapitalize; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.js new file mode 100644 index 0000000..1e3782e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/capitalize.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Capitalize = Capitalize; +const intrinsic_1 = require("./intrinsic"); +/** `[Json]` Intrinsic function to Capitalize LiteralString types */ +function Capitalize(T, options = {}) { + return (0, intrinsic_1.Intrinsic)(T, 'Capitalize', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.d.ts new file mode 100644 index 0000000..baf64a7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.d.ts @@ -0,0 +1,6 @@ +export * from './capitalize'; +export * from './intrinsic-from-mapped-key'; +export * from './intrinsic'; +export * from './lowercase'; +export * from './uncapitalize'; +export * from './uppercase'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.js new file mode 100644 index 0000000..46fda88 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/index.js @@ -0,0 +1,23 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./capitalize"), exports); +__exportStar(require("./intrinsic-from-mapped-key"), exports); +__exportStar(require("./intrinsic"), exports); +__exportStar(require("./lowercase"), exports); +__exportStar(require("./uncapitalize"), exports); +__exportStar(require("./uppercase"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.d.ts new file mode 100644 index 0000000..9cca5a3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.d.ts @@ -0,0 +1,14 @@ +import type { SchemaOptions } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { Assert } from '../helpers/index'; +import { type TMappedResult, type TMappedKey } from '../mapped/index'; +import { type TIntrinsic, type IntrinsicMode } from './intrinsic'; +import { type TLiteral, type TLiteralValue } from '../literal/index'; +type TMappedIntrinsicPropertyKey = { + [_ in K]: TIntrinsic>, M>; +}; +type TMappedIntrinsicPropertyKeys = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedIntrinsicPropertyKeys> : Acc); +type TMappedIntrinsicProperties = (TMappedIntrinsicPropertyKeys); +export type TIntrinsicFromMappedKey> = (TMappedResult

); +export declare function IntrinsicFromMappedKey>(T: K, M: M, options: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js new file mode 100644 index 0000000..5a3226b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic-from-mapped-key.js @@ -0,0 +1,30 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IntrinsicFromMappedKey = IntrinsicFromMappedKey; +const index_1 = require("../mapped/index"); +const intrinsic_1 = require("./intrinsic"); +const index_2 = require("../literal/index"); +const value_1 = require("../clone/value"); +// prettier-ignore +function MappedIntrinsicPropertyKey(K, M, options) { + return { + [K]: (0, intrinsic_1.Intrinsic)((0, index_2.Literal)(K), M, (0, value_1.Clone)(options)) + }; +} +// prettier-ignore +function MappedIntrinsicPropertyKeys(K, M, options) { + const result = K.reduce((Acc, L) => { + return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) }; + }, {}); + return result; +} +// prettier-ignore +function MappedIntrinsicProperties(T, M, options) { + return MappedIntrinsicPropertyKeys(T['keys'], M, options); +} +// prettier-ignore +function IntrinsicFromMappedKey(T, M, options) { + const P = MappedIntrinsicProperties(T, M, options); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.d.ts new file mode 100644 index 0000000..8e25010 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.d.ts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TTemplateLiteral, type TTemplateLiteralKind } from '../template-literal/index'; +import { type TIntrinsicFromMappedKey } from './intrinsic-from-mapped-key'; +import { type TLiteral } from '../literal/index'; +import { type TUnion } from '../union/index'; +import { type TMappedKey } from '../mapped/index'; +export type IntrinsicMode = 'Uppercase' | 'Lowercase' | 'Capitalize' | 'Uncapitalize'; +type TFromTemplateLiteral = M extends IntrinsicMode ? T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? [TIntrinsic, ...TFromTemplateLiteral] : T : T; +type TFromLiteralValue = (T extends string ? M extends 'Uncapitalize' ? Uncapitalize : M extends 'Capitalize' ? Capitalize : M extends 'Uppercase' ? Uppercase : M extends 'Lowercase' ? Lowercase : string : T); +type TFromRest = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Acc; +export type TIntrinsic = T extends TMappedKey ? TIntrinsicFromMappedKey : T extends TTemplateLiteral ? TTemplateLiteral> : T extends TUnion ? TUnion> : T extends TLiteral ? TLiteral> : T; +/** Applies an intrinsic string manipulation to the given type. */ +export declare function Intrinsic(schema: T, mode: M, options?: SchemaOptions): TIntrinsicFromMappedKey; +/** Applies an intrinsic string manipulation to the given type. */ +export declare function Intrinsic(schema: T, mode: M, options?: SchemaOptions): TIntrinsic; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.js new file mode 100644 index 0000000..1f72f3d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/intrinsic.js @@ -0,0 +1,68 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Intrinsic = Intrinsic; +const type_1 = require("../create/type"); +const index_1 = require("../template-literal/index"); +const intrinsic_from_mapped_key_1 = require("./intrinsic-from-mapped-key"); +const index_2 = require("../literal/index"); +const index_3 = require("../union/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// ------------------------------------------------------------------ +// Apply +// ------------------------------------------------------------------ +function ApplyUncapitalize(value) { + const [first, rest] = [value.slice(0, 1), value.slice(1)]; + return [first.toLowerCase(), rest].join(''); +} +function ApplyCapitalize(value) { + const [first, rest] = [value.slice(0, 1), value.slice(1)]; + return [first.toUpperCase(), rest].join(''); +} +function ApplyUppercase(value) { + return value.toUpperCase(); +} +function ApplyLowercase(value) { + return value.toLowerCase(); +} +function FromTemplateLiteral(schema, mode, options) { + // note: template literals require special runtime handling as they are encoded in string patterns. + // This diverges from the mapped type which would otherwise map on the template literal kind. + const expression = (0, index_1.TemplateLiteralParseExact)(schema.pattern); + const finite = (0, index_1.IsTemplateLiteralExpressionFinite)(expression); + if (!finite) + return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) }; + const strings = [...(0, index_1.TemplateLiteralExpressionGenerate)(expression)]; + const literals = strings.map((value) => (0, index_2.Literal)(value)); + const mapped = FromRest(literals, mode); + const union = (0, index_3.Union)(mapped); + return (0, index_1.TemplateLiteral)([union], options); +} +// prettier-ignore +function FromLiteralValue(value, mode) { + return (typeof value === 'string' ? (mode === 'Uncapitalize' ? ApplyUncapitalize(value) : + mode === 'Capitalize' ? ApplyCapitalize(value) : + mode === 'Uppercase' ? ApplyUppercase(value) : + mode === 'Lowercase' ? ApplyLowercase(value) : + value) : value.toString()); +} +// prettier-ignore +function FromRest(T, M) { + return T.map(L => Intrinsic(L, M)); +} +/** Applies an intrinsic string manipulation to the given type. */ +function Intrinsic(schema, mode, options = {}) { + // prettier-ignore + return ( + // Intrinsic-Mapped-Inference + (0, kind_1.IsMappedKey)(schema) ? (0, intrinsic_from_mapped_key_1.IntrinsicFromMappedKey)(schema, mode, options) : + // Standard-Inference + (0, kind_1.IsTemplateLiteral)(schema) ? FromTemplateLiteral(schema, mode, options) : + (0, kind_1.IsUnion)(schema) ? (0, index_3.Union)(FromRest(schema.anyOf, mode), options) : + (0, kind_1.IsLiteral)(schema) ? (0, index_2.Literal)(FromLiteralValue(schema.const, mode), options) : + // Default Type + (0, type_1.CreateType)(schema, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.d.ts new file mode 100644 index 0000000..0e6a3ee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.d.ts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TIntrinsic } from './intrinsic'; +export type TLowercase = TIntrinsic; +/** `[Json]` Intrinsic function to Lowercase LiteralString types */ +export declare function Lowercase(T: T, options?: SchemaOptions): TLowercase; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.js new file mode 100644 index 0000000..1e41b25 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/lowercase.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Lowercase = Lowercase; +const intrinsic_1 = require("./intrinsic"); +/** `[Json]` Intrinsic function to Lowercase LiteralString types */ +function Lowercase(T, options = {}) { + return (0, intrinsic_1.Intrinsic)(T, 'Lowercase', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.d.ts new file mode 100644 index 0000000..2632073 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.d.ts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TIntrinsic } from './intrinsic'; +export type TUncapitalize = TIntrinsic; +/** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ +export declare function Uncapitalize(T: T, options?: SchemaOptions): TUncapitalize; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.js new file mode 100644 index 0000000..d204442 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uncapitalize.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uncapitalize = Uncapitalize; +const intrinsic_1 = require("./intrinsic"); +/** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ +function Uncapitalize(T, options = {}) { + return (0, intrinsic_1.Intrinsic)(T, 'Uncapitalize', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.d.ts new file mode 100644 index 0000000..b351511 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.d.ts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TIntrinsic } from './intrinsic'; +export type TUppercase = TIntrinsic; +/** `[Json]` Intrinsic function to Uppercase LiteralString types */ +export declare function Uppercase(T: T, options?: SchemaOptions): TUppercase; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.js new file mode 100644 index 0000000..aa0bd86 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/intrinsic/uppercase.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uppercase = Uppercase; +const intrinsic_1 = require("./intrinsic"); +/** `[Json]` Intrinsic function to Uppercase LiteralString types */ +function Uppercase(T, options = {}) { + return (0, intrinsic_1.Intrinsic)(T, 'Uppercase', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.d.ts new file mode 100644 index 0000000..9ffa4da --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.d.ts @@ -0,0 +1 @@ +export * from './iterator'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.js new file mode 100644 index 0000000..5bdc554 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./iterator"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.d.ts new file mode 100644 index 0000000..73aca9c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.d.ts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +export interface TIterator extends TSchema { + [Kind]: 'Iterator'; + static: IterableIterator>; + type: 'Iterator'; + items: T; +} +/** `[JavaScript]` Creates an Iterator type */ +export declare function Iterator(items: T, options?: SchemaOptions): TIterator; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.js new file mode 100644 index 0000000..d8a084f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/iterator/iterator.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Iterator = Iterator; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates an Iterator type */ +function Iterator(items, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Iterator', type: 'Iterator', items }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.d.ts new file mode 100644 index 0000000..ca87784 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.d.ts @@ -0,0 +1,4 @@ +export * from './keyof-from-mapped-result'; +export * from './keyof-property-entries'; +export * from './keyof-property-keys'; +export * from './keyof'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.js new file mode 100644 index 0000000..33e448d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/index.js @@ -0,0 +1,21 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./keyof-from-mapped-result"), exports); +__exportStar(require("./keyof-property-entries"), exports); +__exportStar(require("./keyof-property-keys"), exports); +__exportStar(require("./keyof"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.d.ts new file mode 100644 index 0000000..30faae1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.d.ts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index'; +import type { Ensure, Evaluate } from '../helpers/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TKeyOfFromType } from './keyof'; +type TFromProperties = ({ + [K2 in keyof Properties]: TKeyOfFromType; +}); +type TFromMappedResult = (Evaluate>); +export type TKeyOfFromMappedResult> = (Ensure>); +export declare function KeyOfFromMappedResult>(mappedResult: MappedResult, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.js new file mode 100644 index 0000000..0c5df45 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-from-mapped-result.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.KeyOfFromMappedResult = KeyOfFromMappedResult; +const index_1 = require("../mapped/index"); +const keyof_1 = require("./keyof"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromProperties(properties, options) { + const result = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(properties)) + result[K2] = (0, keyof_1.KeyOf)(properties[K2], (0, value_1.Clone)(options)); + return result; +} +// prettier-ignore +function FromMappedResult(mappedResult, options) { + return FromProperties(mappedResult.properties, options); +} +// prettier-ignore +function KeyOfFromMappedResult(mappedResult, options) { + const properties = FromMappedResult(mappedResult, options); + return (0, index_1.MappedResult)(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.d.ts new file mode 100644 index 0000000..0bb734b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.d.ts @@ -0,0 +1,7 @@ +import { TSchema } from '../schema/index'; +/** + * `[Utility]` Resolves an array of keys and schemas from the given schema. This method is faster + * than obtaining the keys and resolving each individually via indexing. This method was written + * accellerate Intersect and Union encoding. + */ +export declare function KeyOfPropertyEntries(schema: TSchema): [key: string, schema: TSchema][]; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.js new file mode 100644 index 0000000..10b5e4a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-entries.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.KeyOfPropertyEntries = KeyOfPropertyEntries; +const indexed_1 = require("../indexed/indexed"); +const keyof_property_keys_1 = require("./keyof-property-keys"); +/** + * `[Utility]` Resolves an array of keys and schemas from the given schema. This method is faster + * than obtaining the keys and resolving each individually via indexing. This method was written + * accellerate Intersect and Union encoding. + */ +function KeyOfPropertyEntries(schema) { + const keys = (0, keyof_property_keys_1.KeyOfPropertyKeys)(schema); + const schemas = (0, indexed_1.IndexFromPropertyKeys)(schema, keys); + return keys.map((_, index) => [keys[index], schemas[index]]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.d.ts new file mode 100644 index 0000000..2f029aa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.d.ts @@ -0,0 +1,24 @@ +import type { TSchema } from '../schema/index'; +import { type ZeroString, type UnionToTuple, type TIncrement } from '../helpers/index'; +import type { TRecursive } from '../recursive/index'; +import type { TIntersect } from '../intersect/index'; +import type { TUnion } from '../union/index'; +import type { TTuple } from '../tuple/index'; +import type { TArray } from '../array/index'; +import type { TObject, TProperties } from '../object/index'; +import { type TSetUnionMany, type TSetIntersectMany } from '../sets/index'; +type TFromRest = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Result); +type TFromIntersect, PropertyKeys extends PropertyKey[] = TSetUnionMany> = PropertyKeys; +type TFromUnion, PropertyKeys extends PropertyKey[] = TSetIntersectMany> = PropertyKeys; +type TFromTuple = Types extends [infer _ extends TSchema, ...infer R extends TSchema[]] ? TFromTuple, [...Acc, Indexer]> : Acc; +type TFromArray<_ extends TSchema> = ([ + '[number]' +]); +type TFromProperties = (UnionToTuple); +export type TKeyOfPropertyKeys = (Type extends TRecursive ? TKeyOfPropertyKeys : Type extends TIntersect ? TFromIntersect : Type extends TUnion ? TFromUnion : Type extends TTuple ? TFromTuple : Type extends TArray ? TFromArray : Type extends TObject ? TFromProperties : [ +]); +/** Returns a tuple of PropertyKeys derived from the given TSchema. */ +export declare function KeyOfPropertyKeys(type: Type): TKeyOfPropertyKeys; +/** Returns a regular expression pattern derived from the given TSchema */ +export declare function KeyOfPattern(schema: TSchema): string; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.js new file mode 100644 index 0000000..e9a8510 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof-property-keys.js @@ -0,0 +1,78 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.KeyOfPropertyKeys = KeyOfPropertyKeys; +exports.KeyOfPattern = KeyOfPattern; +const index_1 = require("../sets/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function FromRest(types) { + const result = []; + for (const L of types) + result.push(KeyOfPropertyKeys(L)); + return result; +} +// prettier-ignore +function FromIntersect(types) { + const propertyKeysArray = FromRest(types); + const propertyKeys = (0, index_1.SetUnionMany)(propertyKeysArray); + return propertyKeys; +} +// prettier-ignore +function FromUnion(types) { + const propertyKeysArray = FromRest(types); + const propertyKeys = (0, index_1.SetIntersectMany)(propertyKeysArray); + return propertyKeys; +} +// prettier-ignore +function FromTuple(types) { + return types.map((_, indexer) => indexer.toString()); +} +// prettier-ignore +function FromArray(_) { + return (['[number]']); +} +// prettier-ignore +function FromProperties(T) { + return (globalThis.Object.getOwnPropertyNames(T)); +} +// ------------------------------------------------------------------ +// FromPatternProperties +// ------------------------------------------------------------------ +// prettier-ignore +function FromPatternProperties(patternProperties) { + if (!includePatternProperties) + return []; + const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties); + return patternPropertyKeys.map(key => { + return (key[0] === '^' && key[key.length - 1] === '$') + ? key.slice(1, key.length - 1) + : key; + }); +} +/** Returns a tuple of PropertyKeys derived from the given TSchema. */ +// prettier-ignore +function KeyOfPropertyKeys(type) { + return ((0, kind_1.IsIntersect)(type) ? FromIntersect(type.allOf) : + (0, kind_1.IsUnion)(type) ? FromUnion(type.anyOf) : + (0, kind_1.IsTuple)(type) ? FromTuple(type.items ?? []) : + (0, kind_1.IsArray)(type) ? FromArray(type.items) : + (0, kind_1.IsObject)(type) ? FromProperties(type.properties) : + (0, kind_1.IsRecord)(type) ? FromPatternProperties(type.patternProperties) : + []); +} +// ---------------------------------------------------------------- +// KeyOfPattern +// ---------------------------------------------------------------- +let includePatternProperties = false; +/** Returns a regular expression pattern derived from the given TSchema */ +function KeyOfPattern(schema) { + includePatternProperties = true; + const keys = KeyOfPropertyKeys(schema); + includePatternProperties = false; + const pattern = keys.map((key) => `(${key})`); + return `^(${pattern.join('|')})$`; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.d.ts new file mode 100644 index 0000000..d28dac9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.d.ts @@ -0,0 +1,21 @@ +import type { TSchema } from '../schema/index'; +import type { Assert, Ensure } from '../helpers/index'; +import type { TMappedResult } from '../mapped/index'; +import type { SchemaOptions } from '../schema/index'; +import { type TLiteral, type TLiteralValue } from '../literal/index'; +import { type TNumber } from '../number/index'; +import { TComputed } from '../computed/index'; +import { type TRef } from '../ref/index'; +import { type TKeyOfPropertyKeys } from './keyof-property-keys'; +import { type TUnionEvaluated } from '../union/index'; +import { type TKeyOfFromMappedResult } from './keyof-from-mapped-result'; +type TFromComputed = Ensure]>>; +type TFromRef = Ensure]>>; +/** `[Internal]` Used by KeyOfFromMappedResult */ +export type TKeyOfFromType, PropertyKeyTypes extends TSchema[] = TKeyOfPropertyKeysToRest, Result = TUnionEvaluated> = Ensure; +export type TKeyOfPropertyKeysToRest = (PropertyKeys extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? L extends '[number]' ? TKeyOfPropertyKeysToRest : TKeyOfPropertyKeysToRest>]> : Result); +export declare function KeyOfPropertyKeysToRest(propertyKeys: [...PropertyKeys]): TKeyOfPropertyKeysToRest; +export type TKeyOf = (Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TMappedResult ? TKeyOfFromMappedResult : TKeyOfFromType); +/** `[Json]` Creates a KeyOf type */ +export declare function KeyOf(type: Type, options?: SchemaOptions): TKeyOf; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.js new file mode 100644 index 0000000..7b12990 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/keyof/keyof.js @@ -0,0 +1,40 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.KeyOfPropertyKeysToRest = KeyOfPropertyKeysToRest; +exports.KeyOf = KeyOf; +const type_1 = require("../create/type"); +const index_1 = require("../literal/index"); +const index_2 = require("../number/index"); +const index_3 = require("../computed/index"); +const index_4 = require("../ref/index"); +const keyof_property_keys_1 = require("./keyof-property-keys"); +const index_5 = require("../union/index"); +const keyof_from_mapped_result_1 = require("./keyof-from-mapped-result"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function FromComputed(target, parameters) { + return (0, index_3.Computed)('KeyOf', [(0, index_3.Computed)(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return (0, index_3.Computed)('KeyOf', [(0, index_4.Ref)($ref)]); +} +// prettier-ignore +function KeyOfFromType(type, options) { + const propertyKeys = (0, keyof_property_keys_1.KeyOfPropertyKeys)(type); + const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys); + const result = (0, index_5.UnionEvaluated)(propertyKeyTypes); + return (0, type_1.CreateType)(result, options); +} +// prettier-ignore +function KeyOfPropertyKeysToRest(propertyKeys) { + return propertyKeys.map(L => L === '[number]' ? (0, index_2.Number)() : (0, index_1.Literal)(L)); +} +/** `[Json]` Creates a KeyOf type */ +function KeyOf(type, options) { + return ((0, kind_1.IsComputed)(type) ? FromComputed(type.target, type.parameters) : (0, kind_1.IsRef)(type) ? FromRef(type.$ref) : (0, kind_1.IsMappedResult)(type) ? (0, keyof_from_mapped_result_1.KeyOfFromMappedResult)(type, options) : KeyOfFromType(type, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.d.ts new file mode 100644 index 0000000..2f83d93 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.d.ts @@ -0,0 +1 @@ +export * from './literal'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.js new file mode 100644 index 0000000..82e7250 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./literal"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.d.ts new file mode 100644 index 0000000..d2a5e4b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.d.ts @@ -0,0 +1,10 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export type TLiteralValue = boolean | number | string; +export interface TLiteral extends TSchema { + [Kind]: 'Literal'; + static: T; + const: T; +} +/** `[Json]` Creates a Literal type */ +export declare function Literal(value: T, options?: SchemaOptions): TLiteral; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.js new file mode 100644 index 0000000..9c5a0d0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/literal/literal.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Literal = Literal; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a Literal type */ +function Literal(value, options) { + return (0, type_1.CreateType)({ + [index_1.Kind]: 'Literal', + const: value, + type: typeof value, + }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.d.ts new file mode 100644 index 0000000..7e1dbf9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.d.ts @@ -0,0 +1,3 @@ +export * from './mapped-key'; +export * from './mapped-result'; +export * from './mapped'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.js new file mode 100644 index 0000000..a33e180 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./mapped-key"), exports); +__exportStar(require("./mapped-result"), exports); +__exportStar(require("./mapped"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.d.ts new file mode 100644 index 0000000..334487a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.d.ts @@ -0,0 +1,8 @@ +import type { TSchema } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TMappedKey extends TSchema { + [Kind]: 'MappedKey'; + static: T[number]; + keys: T; +} +export declare function MappedKey(T: [...T]): TMappedKey; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.js new file mode 100644 index 0000000..bebfee0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-key.js @@ -0,0 +1,13 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MappedKey = MappedKey; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +// prettier-ignore +function MappedKey(T) { + return (0, type_1.CreateType)({ + [index_1.Kind]: 'MappedKey', + keys: T + }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.d.ts new file mode 100644 index 0000000..5caf5e0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.d.ts @@ -0,0 +1,9 @@ +import type { TSchema } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { Kind } from '../symbols/index'; +export interface TMappedResult extends TSchema { + [Kind]: 'MappedResult'; + properties: T; + static: unknown; +} +export declare function MappedResult(properties: T): TMappedResult; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.js new file mode 100644 index 0000000..2dcb986 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped-result.js @@ -0,0 +1,13 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MappedResult = MappedResult; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +// prettier-ignore +function MappedResult(properties) { + return (0, type_1.CreateType)({ + [index_1.Kind]: 'MappedResult', + properties + }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.d.ts new file mode 100644 index 0000000..2ec92e1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.d.ts @@ -0,0 +1,47 @@ +import type { TSchema } from '../schema/index'; +import type { Ensure, Evaluate, Assert } from '../helpers/index'; +import { type TArray } from '../array/index'; +import { type TAsyncIterator } from '../async-iterator/index'; +import { type TConstructor } from '../constructor/index'; +import { type TEnum, type TEnumRecord } from '../enum/index'; +import { type TFunction } from '../function/index'; +import { type TIndexPropertyKeys } from '../indexed/index'; +import { type TIntersect } from '../intersect/index'; +import { type TIterator } from '../iterator/index'; +import { type TLiteral, type TLiteralValue } from '../literal/index'; +import { type TObject, type TProperties, type ObjectOptions } from '../object/index'; +import { type TOptional } from '../optional/index'; +import { type TPromise } from '../promise/index'; +import { type TReadonly } from '../readonly/index'; +import { type TTuple } from '../tuple/index'; +import { type TUnion } from '../union/index'; +import { type TSetIncludes } from '../sets/index'; +import { type TMappedResult } from './mapped-result'; +import type { TMappedKey } from './mapped-key'; +type TFromMappedResult = (K extends keyof P ? FromSchemaType : TMappedResult

); +type TMappedKeyToKnownMappedResultProperties = { + [_ in K]: TLiteral>; +}; +type TMappedKeyToUnknownMappedResultProperties

= (P extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedKeyToUnknownMappedResultProperties>; +}> : Acc); +type TMappedKeyToMappedResultProperties = (TSetIncludes extends true ? TMappedKeyToKnownMappedResultProperties : TMappedKeyToUnknownMappedResultProperties

); +type TFromMappedKey> = (TFromMappedResult); +type TFromRest = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Acc); +type FromProperties; +}>> = R; +declare function FromProperties(K: K, T: T): FromProperties; +type FromSchemaType = (T extends TReadonly ? TReadonly> : T extends TOptional ? TOptional> : T extends TMappedResult ? TFromMappedResult : T extends TMappedKey ? TFromMappedKey : T extends TConstructor ? TConstructor, FromSchemaType> : T extends TFunction ? TFunction, FromSchemaType> : T extends TAsyncIterator ? TAsyncIterator> : T extends TIterator ? TIterator> : T extends TIntersect ? TIntersect> : T extends TEnum ? TEnum : T extends TUnion ? TUnion> : T extends TTuple ? TTuple> : T extends TObject ? TObject> : T extends TArray ? TArray> : T extends TPromise ? TPromise> : T); +declare function FromSchemaType(K: K, T: T): FromSchemaType; +export type TMappedFunctionReturnType = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedFunctionReturnType; +}> : Acc); +export declare function MappedFunctionReturnType(K: [...K], T: T): TMappedFunctionReturnType; +export type TMappedFunction> = (T: I) => TSchema; +export type TMapped, R extends TProperties = Evaluate>>> = Ensure>; +/** `[Json]` Creates a Mapped object type */ +export declare function Mapped, F extends TMappedFunction = TMappedFunction, R extends TMapped = TMapped>(key: K, map: F, options?: ObjectOptions): R; +/** `[Json]` Creates a Mapped object type */ +export declare function Mapped = TMappedFunction, R extends TMapped = TMapped>(key: [...K], map: F, options?: ObjectOptions): R; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.js new file mode 100644 index 0000000..30dfcf2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/mapped/mapped.js @@ -0,0 +1,107 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MappedFunctionReturnType = MappedFunctionReturnType; +exports.Mapped = Mapped; +const index_1 = require("../symbols/index"); +const index_2 = require("../discard/index"); +// evaluation types +const index_3 = require("../array/index"); +const index_4 = require("../async-iterator/index"); +const index_5 = require("../constructor/index"); +const index_6 = require("../function/index"); +const index_7 = require("../indexed/index"); +const index_8 = require("../intersect/index"); +const index_9 = require("../iterator/index"); +const index_10 = require("../literal/index"); +const index_11 = require("../object/index"); +const index_12 = require("../optional/index"); +const index_13 = require("../promise/index"); +const index_14 = require("../readonly/index"); +const index_15 = require("../tuple/index"); +const index_16 = require("../union/index"); +// operator +const index_17 = require("../sets/index"); +// mapping types +const mapped_result_1 = require("./mapped-result"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function FromMappedResult(K, P) { + return (K in P + ? FromSchemaType(K, P[K]) + : (0, mapped_result_1.MappedResult)(P)); +} +// prettier-ignore +function MappedKeyToKnownMappedResultProperties(K) { + return { [K]: (0, index_10.Literal)(K) }; +} +// prettier-ignore +function MappedKeyToUnknownMappedResultProperties(P) { + const Acc = {}; + for (const L of P) + Acc[L] = (0, index_10.Literal)(L); + return Acc; +} +// prettier-ignore +function MappedKeyToMappedResultProperties(K, P) { + return ((0, index_17.SetIncludes)(P, K) + ? MappedKeyToKnownMappedResultProperties(K) + : MappedKeyToUnknownMappedResultProperties(P)); +} +// prettier-ignore +function FromMappedKey(K, P) { + const R = MappedKeyToMappedResultProperties(K, P); + return FromMappedResult(K, R); +} +// prettier-ignore +function FromRest(K, T) { + return T.map(L => FromSchemaType(K, L)); +} +// prettier-ignore +function FromProperties(K, T) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(T)) + Acc[K2] = FromSchemaType(K, T[K2]); + return Acc; +} +// prettier-ignore +function FromSchemaType(K, T) { + // required to retain user defined options for mapped type + const options = { ...T }; + return ( + // unevaluated modifier types + (0, kind_1.IsOptional)(T) ? (0, index_12.Optional)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.OptionalKind]))) : + (0, kind_1.IsReadonly)(T) ? (0, index_14.Readonly)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.ReadonlyKind]))) : + // unevaluated mapped types + (0, kind_1.IsMappedResult)(T) ? FromMappedResult(K, T.properties) : + (0, kind_1.IsMappedKey)(T) ? FromMappedKey(K, T.keys) : + // unevaluated types + (0, kind_1.IsConstructor)(T) ? (0, index_5.Constructor)(FromRest(K, T.parameters), FromSchemaType(K, T.returns), options) : + (0, kind_1.IsFunction)(T) ? (0, index_6.Function)(FromRest(K, T.parameters), FromSchemaType(K, T.returns), options) : + (0, kind_1.IsAsyncIterator)(T) ? (0, index_4.AsyncIterator)(FromSchemaType(K, T.items), options) : + (0, kind_1.IsIterator)(T) ? (0, index_9.Iterator)(FromSchemaType(K, T.items), options) : + (0, kind_1.IsIntersect)(T) ? (0, index_8.Intersect)(FromRest(K, T.allOf), options) : + (0, kind_1.IsUnion)(T) ? (0, index_16.Union)(FromRest(K, T.anyOf), options) : + (0, kind_1.IsTuple)(T) ? (0, index_15.Tuple)(FromRest(K, T.items ?? []), options) : + (0, kind_1.IsObject)(T) ? (0, index_11.Object)(FromProperties(K, T.properties), options) : + (0, kind_1.IsArray)(T) ? (0, index_3.Array)(FromSchemaType(K, T.items), options) : + (0, kind_1.IsPromise)(T) ? (0, index_13.Promise)(FromSchemaType(K, T.item), options) : + T); +} +// prettier-ignore +function MappedFunctionReturnType(K, T) { + const Acc = {}; + for (const L of K) + Acc[L] = FromSchemaType(L, T); + return Acc; +} +/** `[Json]` Creates a Mapped object type */ +function Mapped(key, map, options) { + const K = (0, kind_1.IsSchema)(key) ? (0, index_7.IndexPropertyKeys)(key) : key; + const RT = map({ [index_1.Kind]: 'MappedKey', keys: K }); + const R = MappedFunctionReturnType(K, RT); + return (0, index_11.Object)(R, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.d.ts new file mode 100644 index 0000000..ae3b05f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.d.ts @@ -0,0 +1,59 @@ +import { Ensure, Evaluate } from '../helpers/index'; +import { type TSchema } from '../schema/index'; +import { type TArray } from '../array/index'; +import { type TAwaited } from '../awaited/index'; +import { type TAsyncIterator } from '../async-iterator/index'; +import { TComputed } from '../computed/index'; +import { type TConstructor } from '../constructor/index'; +import { type TIndex, type TIndexPropertyKeys } from '../indexed/index'; +import { TEnum, type TEnumRecord } from '../enum/index'; +import { type TFunction } from '../function/index'; +import { type TIntersect, type TIntersectEvaluated } from '../intersect/index'; +import { type TIterator } from '../iterator/index'; +import { type TKeyOf } from '../keyof/index'; +import { type TObject, type TProperties } from '../object/index'; +import { type TOmit } from '../omit/index'; +import { type TOptional } from '../optional/index'; +import { type TPick } from '../pick/index'; +import { type TNever } from '../never/index'; +import { TPartial } from '../partial/index'; +import { type TReadonly } from '../readonly/index'; +import { type TRecordOrObject, type TRecord } from '../record/index'; +import { type TRef } from '../ref/index'; +import { type TRequired } from '../required/index'; +import { type TTransform } from '../transform/index'; +import { type TTuple } from '../tuple/index'; +import { type TUnion, type TUnionEvaluated } from '../union/index'; +type TDereferenceParameters = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TRef ? TDereferenceParameters]> : TDereferenceParameters]> : Result); +type TDereference ? TDereference : TFromType : TNever)> = Result; +type TFromAwaited = (Parameters extends [infer T0 extends TSchema] ? TAwaited : never); +type TFromIndex = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TIndex> extends infer Result extends TSchema ? Result : never : never); +type TFromKeyOf = (Parameters extends [infer T0 extends TSchema] ? TKeyOf : never); +type TFromPartial = (Parameters extends [infer T0 extends TSchema] ? TPartial : never); +type TFromOmit = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TOmit : never); +type TFromPick = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TPick : never); +type TFromRequired = (Parameters extends [infer T0 extends TSchema] ? TRequired : never); +type TFromComputed> = (Target extends 'Awaited' ? TFromAwaited : Target extends 'Index' ? TFromIndex : Target extends 'KeyOf' ? TFromKeyOf : Target extends 'Partial' ? TFromPartial : Target extends 'Omit' ? TFromOmit : Target extends 'Pick' ? TFromPick : Target extends 'Required' ? TFromRequired : TNever); +type TFromArray = (Ensure>>); +type TFromAsyncIterator = (TAsyncIterator>); +type TFromConstructor = (TConstructor, TFromType>); +type TFromFunction = Ensure, TFromType>>>; +type TFromIntersect = (Ensure>>); +type TFromIterator = (TIterator>); +type TFromObject = Ensure; +}>>>; +type TFromRecord>> = Result; +type TFromTransform ? TTransform, Output> : TTransform> = Result; +type TFromTuple = (Ensure>>); +type TFromUnion = (Ensure>>); +type TFromTypes = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromTypes]> : Result); +export type TFromType = (Type extends TOptional ? TOptional> : Type extends TReadonly ? TReadonly> : Type extends TTransform ? TFromTransform : Type extends TArray ? TFromArray : Type extends TAsyncIterator ? TFromAsyncIterator : Type extends TComputed ? TFromComputed : Type extends TConstructor ? TFromConstructor : Type extends TFunction ? TFromFunction : Type extends TIntersect ? TFromIntersect : Type extends TIterator ? TFromIterator : Type extends TObject ? TFromObject : Type extends TRecord ? TFromRecord : Type extends TTuple ? TFromTuple : Type extends TEnum ? Type : Type extends TUnion ? TFromUnion : Type); +export declare function FromType(moduleProperties: ModuleProperties, type: Type): TFromType; +export type TComputeType = (Key extends keyof ModuleProperties ? TFromType : TNever); +export declare function ComputeType(moduleProperties: ModuleProperties, key: Key): TComputeType; +export type TComputeModuleProperties = Evaluate<{ + [Key in keyof ModuleProperties]: TComputeType; +}>; +export declare function ComputeModuleProperties(moduleProperties: ModuleProperties): TComputeModuleProperties; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.js new file mode 100644 index 0000000..cd7c97b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/compute.js @@ -0,0 +1,205 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FromType = FromType; +exports.ComputeType = ComputeType; +exports.ComputeModuleProperties = ComputeModuleProperties; +const index_1 = require("../create/index"); +const index_2 = require("../clone/index"); +const index_3 = require("../discard/index"); +const index_4 = require("../array/index"); +const index_5 = require("../awaited/index"); +const index_6 = require("../async-iterator/index"); +const index_7 = require("../constructor/index"); +const index_8 = require("../indexed/index"); +const index_9 = require("../function/index"); +const index_10 = require("../intersect/index"); +const index_11 = require("../iterator/index"); +const index_12 = require("../keyof/index"); +const index_13 = require("../object/index"); +const index_14 = require("../omit/index"); +const index_15 = require("../pick/index"); +const index_16 = require("../never/index"); +const index_17 = require("../partial/index"); +const index_18 = require("../record/index"); +const index_19 = require("../required/index"); +const index_20 = require("../tuple/index"); +const index_21 = require("../union/index"); +// ------------------------------------------------------------------ +// Symbols +// ------------------------------------------------------------------ +const index_22 = require("../symbols/index"); +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +const KindGuard = __importStar(require("../guard/kind")); +// prettier-ignore +function DereferenceParameters(moduleProperties, types) { + return types.map((type) => { + return KindGuard.IsRef(type) + ? Dereference(moduleProperties, type.$ref) + : FromType(moduleProperties, type); + }); +} +// prettier-ignore +function Dereference(moduleProperties, ref) { + return (ref in moduleProperties + ? KindGuard.IsRef(moduleProperties[ref]) + ? Dereference(moduleProperties, moduleProperties[ref].$ref) + : FromType(moduleProperties, moduleProperties[ref]) + : (0, index_16.Never)()); +} +// prettier-ignore +function FromAwaited(parameters) { + return (0, index_5.Awaited)(parameters[0]); +} +// prettier-ignore +function FromIndex(parameters) { + return (0, index_8.Index)(parameters[0], parameters[1]); +} +// prettier-ignore +function FromKeyOf(parameters) { + return (0, index_12.KeyOf)(parameters[0]); +} +// prettier-ignore +function FromPartial(parameters) { + return (0, index_17.Partial)(parameters[0]); +} +// prettier-ignore +function FromOmit(parameters) { + return (0, index_14.Omit)(parameters[0], parameters[1]); +} +// prettier-ignore +function FromPick(parameters) { + return (0, index_15.Pick)(parameters[0], parameters[1]); +} +// prettier-ignore +function FromRequired(parameters) { + return (0, index_19.Required)(parameters[0]); +} +// prettier-ignore +function FromComputed(moduleProperties, target, parameters) { + const dereferenced = DereferenceParameters(moduleProperties, parameters); + return (target === 'Awaited' ? FromAwaited(dereferenced) : + target === 'Index' ? FromIndex(dereferenced) : + target === 'KeyOf' ? FromKeyOf(dereferenced) : + target === 'Partial' ? FromPartial(dereferenced) : + target === 'Omit' ? FromOmit(dereferenced) : + target === 'Pick' ? FromPick(dereferenced) : + target === 'Required' ? FromRequired(dereferenced) : + (0, index_16.Never)()); +} +function FromArray(moduleProperties, type) { + return (0, index_4.Array)(FromType(moduleProperties, type)); +} +function FromAsyncIterator(moduleProperties, type) { + return (0, index_6.AsyncIterator)(FromType(moduleProperties, type)); +} +// prettier-ignore +function FromConstructor(moduleProperties, parameters, instanceType) { + return (0, index_7.Constructor)(FromTypes(moduleProperties, parameters), FromType(moduleProperties, instanceType)); +} +// prettier-ignore +function FromFunction(moduleProperties, parameters, returnType) { + return (0, index_9.Function)(FromTypes(moduleProperties, parameters), FromType(moduleProperties, returnType)); +} +function FromIntersect(moduleProperties, types) { + return (0, index_10.Intersect)(FromTypes(moduleProperties, types)); +} +function FromIterator(moduleProperties, type) { + return (0, index_11.Iterator)(FromType(moduleProperties, type)); +} +function FromObject(moduleProperties, properties) { + return (0, index_13.Object)(globalThis.Object.keys(properties).reduce((result, key) => { + return { ...result, [key]: FromType(moduleProperties, properties[key]) }; + }, {})); +} +// prettier-ignore +function FromRecord(moduleProperties, type) { + const [value, pattern] = [FromType(moduleProperties, (0, index_18.RecordValue)(type)), (0, index_18.RecordPattern)(type)]; + const result = (0, index_2.CloneType)(type); + result.patternProperties[pattern] = value; + return result; +} +// prettier-ignore +function FromTransform(moduleProperties, transform) { + return (KindGuard.IsRef(transform)) + ? { ...Dereference(moduleProperties, transform.$ref), [index_22.TransformKind]: transform[index_22.TransformKind] } + : transform; +} +function FromTuple(moduleProperties, types) { + return (0, index_20.Tuple)(FromTypes(moduleProperties, types)); +} +function FromUnion(moduleProperties, types) { + return (0, index_21.Union)(FromTypes(moduleProperties, types)); +} +function FromTypes(moduleProperties, types) { + return types.map((type) => FromType(moduleProperties, type)); +} +// prettier-ignore +function FromType(moduleProperties, type) { + return ( + // Modifiers + KindGuard.IsOptional(type) ? (0, index_1.CreateType)(FromType(moduleProperties, (0, index_3.Discard)(type, [index_22.OptionalKind])), type) : + KindGuard.IsReadonly(type) ? (0, index_1.CreateType)(FromType(moduleProperties, (0, index_3.Discard)(type, [index_22.ReadonlyKind])), type) : + // Transform + KindGuard.IsTransform(type) ? (0, index_1.CreateType)(FromTransform(moduleProperties, type), type) : + // Types + KindGuard.IsArray(type) ? (0, index_1.CreateType)(FromArray(moduleProperties, type.items), type) : + KindGuard.IsAsyncIterator(type) ? (0, index_1.CreateType)(FromAsyncIterator(moduleProperties, type.items), type) : + KindGuard.IsComputed(type) ? (0, index_1.CreateType)(FromComputed(moduleProperties, type.target, type.parameters)) : + KindGuard.IsConstructor(type) ? (0, index_1.CreateType)(FromConstructor(moduleProperties, type.parameters, type.returns), type) : + KindGuard.IsFunction(type) ? (0, index_1.CreateType)(FromFunction(moduleProperties, type.parameters, type.returns), type) : + KindGuard.IsIntersect(type) ? (0, index_1.CreateType)(FromIntersect(moduleProperties, type.allOf), type) : + KindGuard.IsIterator(type) ? (0, index_1.CreateType)(FromIterator(moduleProperties, type.items), type) : + KindGuard.IsObject(type) ? (0, index_1.CreateType)(FromObject(moduleProperties, type.properties), type) : + KindGuard.IsRecord(type) ? (0, index_1.CreateType)(FromRecord(moduleProperties, type)) : + KindGuard.IsTuple(type) ? (0, index_1.CreateType)(FromTuple(moduleProperties, type.items || []), type) : + KindGuard.IsUnion(type) ? (0, index_1.CreateType)(FromUnion(moduleProperties, type.anyOf), type) : + type); +} +// prettier-ignore +function ComputeType(moduleProperties, key) { + return (key in moduleProperties + ? FromType(moduleProperties, moduleProperties[key]) + : (0, index_16.Never)()); +} +// prettier-ignore +function ComputeModuleProperties(moduleProperties) { + return globalThis.Object.getOwnPropertyNames(moduleProperties).reduce((result, key) => { + return { ...result, [key]: ComputeType(moduleProperties, key) }; + }, {}); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.d.ts new file mode 100644 index 0000000..20a96c9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.d.ts @@ -0,0 +1 @@ +export * from './module'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.js new file mode 100644 index 0000000..0cab86d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./module"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.d.ts new file mode 100644 index 0000000..62d01f5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.d.ts @@ -0,0 +1,49 @@ +import { Ensure, Evaluate } from '../helpers/index'; +import { TSchema } from '../schema/index'; +import { TArray } from '../array/index'; +import { TAsyncIterator } from '../async-iterator/index'; +import { TConstructor } from '../constructor/index'; +import { TEnum, TEnumRecord } from '../enum/index'; +import { TFunction } from '../function/index'; +import { TIntersect } from '../intersect/index'; +import { TIterator } from '../iterator/index'; +import { TObject, TProperties } from '../object/index'; +import { TOptional } from '../optional/index'; +import { TRecord } from '../record/index'; +import { TReadonly } from '../readonly/index'; +import { TRef } from '../ref/index'; +import { TTuple } from '../tuple/index'; +import { TUnion } from '../union/index'; +import { Static } from '../static/index'; +import { TRecursive } from '../recursive/index'; +type TInferArray = (Ensure>>); +type TInferAsyncIterator = (Ensure>>); +type TInferConstructor = Ensure) => TInfer>; +type TInferFunction = Ensure<(...args: TInferTuple) => TInfer>; +type TInferIterator = (Ensure>>); +type TInferIntersect = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TInferIntersect> : Result); +type ReadonlyOptionalPropertyKeys = { + [Key in keyof Properties]: Properties[Key] extends TReadonly ? (Properties[Key] extends TOptional ? Key : never) : never; +}[keyof Properties]; +type ReadonlyPropertyKeys = { + [Key in keyof Source]: Source[Key] extends TReadonly ? (Source[Key] extends TOptional ? never : Key) : never; +}[keyof Source]; +type OptionalPropertyKeys = { + [Key in keyof Source]: Source[Key] extends TOptional ? (Source[Key] extends TReadonly ? never : Key) : never; +}[keyof Source]; +type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys>; +type InferPropertiesWithModifiers> = Evaluate<(Readonly>>> & Readonly>> & Partial>> & Required>>)>; +type InferProperties = InferPropertiesWithModifiers; +}>; +type TInferObject = (InferProperties); +type TInferTuple = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TInferTuple]> : Result); +type TInferRecord extends infer Key extends PropertyKey ? Key : never, InferedType extends unknown = TInfer> = Ensure<{ + [_ in InferredKey]: InferedType; +}>; +type TInferRef = (Ref extends keyof ModuleProperties ? TInfer : unknown); +type TInferUnion = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TInferUnion> : Result); +type TInfer = (Type extends TArray ? TInferArray : Type extends TAsyncIterator ? TInferAsyncIterator : Type extends TConstructor ? TInferConstructor : Type extends TFunction ? TInferFunction : Type extends TIntersect ? TInferIntersect : Type extends TIterator ? TInferIterator : Type extends TObject ? TInferObject : Type extends TRecord ? TInferRecord : Type extends TRef ? TInferRef : Type extends TTuple ? TInferTuple : Type extends TEnum ? Static : Type extends TUnion ? TInferUnion : Type extends TRecursive ? TInfer : Static); +/** Inference Path for Imports. This type is used to compute TImport `static` */ +export type TInferFromModuleKey = (Key extends keyof ModuleProperties ? TInfer : never); +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.js new file mode 100644 index 0000000..dc999c1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/infer.js @@ -0,0 +1,3 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.d.ts new file mode 100644 index 0000000..e001886 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.d.ts @@ -0,0 +1,27 @@ +import { Kind } from '../symbols/index'; +import { SchemaOptions, TSchema } from '../schema/index'; +import { TProperties } from '../object/index'; +import { Static } from '../static/index'; +import { TComputeModuleProperties } from './compute'; +import { TInferFromModuleKey } from './infer'; +export interface TDefinitions extends TSchema { + static: { + [K in keyof ModuleProperties]: Static; + }; + $defs: ModuleProperties; +} +export interface TImport extends TSchema { + [Kind]: 'Import'; + static: TInferFromModuleKey; + $defs: ModuleProperties; + $ref: Key; +} +export declare class TModule> { + private readonly $defs; + constructor($defs: ModuleProperties); + /** `[Json]` Imports a Type by Key. */ + Import(key: Key, options?: SchemaOptions): TImport; + private WithIdentifiers; +} +/** `[Json]` Creates a Type Definition Module. */ +export declare function Module(properties: Properties): TModule; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.js new file mode 100644 index 0000000..fe3d7c5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/module/module.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TModule = void 0; +exports.Module = Module; +const index_1 = require("../create/index"); +const index_2 = require("../symbols/index"); +// ------------------------------------------------------------------ +// Module Infrastructure Types +// ------------------------------------------------------------------ +const compute_1 = require("./compute"); +// ------------------------------------------------------------------ +// Module +// ------------------------------------------------------------------ +// prettier-ignore +class TModule { + constructor($defs) { + const computed = (0, compute_1.ComputeModuleProperties)($defs); + const identified = this.WithIdentifiers(computed); + this.$defs = identified; + } + /** `[Json]` Imports a Type by Key. */ + Import(key, options) { + const $defs = { ...this.$defs, [key]: (0, index_1.CreateType)(this.$defs[key], options) }; + return (0, index_1.CreateType)({ [index_2.Kind]: 'Import', $defs, $ref: key }); + } + // prettier-ignore + WithIdentifiers($defs) { + return globalThis.Object.getOwnPropertyNames($defs).reduce((result, key) => { + return { ...result, [key]: { ...$defs[key], $id: key } }; + }, {}); + } +} +exports.TModule = TModule; +/** `[Json]` Creates a Type Definition Module. */ +function Module(properties) { + return new TModule(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.d.ts new file mode 100644 index 0000000..68647c2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.d.ts @@ -0,0 +1 @@ +export * from './never'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.js new file mode 100644 index 0000000..be0a93d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); + +__exportStar(require("./never"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.d.ts new file mode 100644 index 0000000..31ef65b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.d.ts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TNever extends TSchema { + [Kind]: 'Never'; + static: never; + not: {}; +} +/** `[Json]` Creates a Never type */ +export declare function Never(options?: SchemaOptions): TNever; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.js new file mode 100644 index 0000000..2722760 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/never/never.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Never = Never; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a Never type */ +function Never(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Never', not: {} }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.d.ts new file mode 100644 index 0000000..3900eac --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.d.ts @@ -0,0 +1 @@ +export * from './not'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.js new file mode 100644 index 0000000..782cfcd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./not"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.d.ts new file mode 100644 index 0000000..911f7ae --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.d.ts @@ -0,0 +1,10 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +export interface TNot extends TSchema { + [Kind]: 'Not'; + static: T extends TNot ? Static : unknown; + not: T; +} +/** `[Json]` Creates a Not type */ +export declare function Not(type: Type, options?: SchemaOptions): TNot; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.js new file mode 100644 index 0000000..f8aaf76 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/not/not.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Not = Not; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a Not type */ +function Not(type, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Not', not: type }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.d.ts new file mode 100644 index 0000000..9c22dea --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.d.ts @@ -0,0 +1 @@ +export * from './null'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.js new file mode 100644 index 0000000..7b5c147 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./null"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.d.ts new file mode 100644 index 0000000..39c4f13 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.d.ts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TNull extends TSchema { + [Kind]: 'Null'; + static: null; + type: 'null'; +} +/** `[Json]` Creates a Null type */ +export declare function Null(options?: SchemaOptions): TNull; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.js new file mode 100644 index 0000000..9077220 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/null/null.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Null = Null; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a Null type */ +function Null(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Null', type: 'null' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.d.ts new file mode 100644 index 0000000..3238b29 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.d.ts @@ -0,0 +1 @@ +export * from './number'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.js new file mode 100644 index 0000000..80cc104 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./number"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.d.ts new file mode 100644 index 0000000..08ffcc2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.d.ts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface NumberOptions extends SchemaOptions { + exclusiveMaximum?: number; + exclusiveMinimum?: number; + maximum?: number; + minimum?: number; + multipleOf?: number; +} +export interface TNumber extends TSchema, NumberOptions { + [Kind]: 'Number'; + static: number; + type: 'number'; +} +/** `[Json]` Creates a Number type */ +export declare function Number(options?: NumberOptions): TNumber; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.js new file mode 100644 index 0000000..93300ce --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/number/number.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Number = Number; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a Number type */ +function Number(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Number', type: 'number' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.d.ts new file mode 100644 index 0000000..1c19a11 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.d.ts @@ -0,0 +1 @@ +export * from './object'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.js new file mode 100644 index 0000000..52a6abd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./object"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.d.ts new file mode 100644 index 0000000..121169c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.d.ts @@ -0,0 +1,51 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import type { Evaluate, UnionToTuple } from '../helpers/index'; +import type { TReadonly } from '../readonly/index'; +import type { TOptional } from '../optional/index'; +import { Kind } from '../symbols/index'; +type ReadonlyOptionalPropertyKeys = { + [K in keyof T]: T[K] extends TReadonly ? (T[K] extends TOptional ? K : never) : never; +}[keyof T]; +type ReadonlyPropertyKeys = { + [K in keyof T]: T[K] extends TReadonly ? (T[K] extends TOptional ? never : K) : never; +}[keyof T]; +type OptionalPropertyKeys = { + [K in keyof T]: T[K] extends TOptional ? (T[K] extends TReadonly ? never : K) : never; +}[keyof T]; +type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys>; +type ObjectStaticProperties> = Evaluate<(Readonly>>> & Readonly>> & Partial>> & Required>>)>; +type ObjectStatic = ObjectStaticProperties; +}>; +export type TPropertyKey = string | number; +export type TProperties = Record; +type TIsLiteralString = ([ + Type +] extends [string] ? [string] extends [Type] ? false : true : false); +type IsRequiredArrayLiteralConstant = (RequiredTuple extends [infer Left extends string, ...infer _ extends string[]] ? TIsLiteralString : false); +type TRequiredArray ? never : Key]: Properties[Key]; +}, RequiredUnion extends string = Extract, RequiredTuple extends string[] = UnionToTuple, Result extends string[] | undefined = (IsRequiredArrayLiteralConstant extends true ? RequiredTuple : string[] | undefined)> = Result; +export type TAdditionalProperties = undefined | TSchema | boolean; +export interface ObjectOptions extends SchemaOptions { + /** Additional property constraints for this object */ + additionalProperties?: TAdditionalProperties; + /** The minimum number of properties allowed on this object */ + minProperties?: number; + /** The maximum number of properties allowed on this object */ + maxProperties?: number; +} +export interface TObject extends TSchema, ObjectOptions { + [Kind]: 'Object'; + static: ObjectStatic; + additionalProperties?: TAdditionalProperties; + type: 'object'; + properties: T; + required: TRequiredArray; +} +/** `[Json]` Creates an Object type */ +declare function _Object(properties: T, options?: ObjectOptions): TObject; +/** `[Json]` Creates an Object type */ +export declare var Object: typeof _Object; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.js new file mode 100644 index 0000000..5782a88 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/object/object.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Object = void 0; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +/** Creates a RequiredArray derived from the given TProperties value. */ +function RequiredArray(properties) { + return globalThis.Object.keys(properties).filter((key) => !(0, kind_1.IsOptional)(properties[key])); +} +/** `[Json]` Creates an Object type */ +function _Object(properties, options) { + const required = RequiredArray(properties); + const schema = required.length > 0 ? { [index_1.Kind]: 'Object', type: 'object', required, properties } : { [index_1.Kind]: 'Object', type: 'object', properties }; + return (0, type_1.CreateType)(schema, options); +} +/** `[Json]` Creates an Object type */ +exports.Object = _Object; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.d.ts new file mode 100644 index 0000000..0929ee7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.d.ts @@ -0,0 +1,3 @@ +export * from './omit-from-mapped-key'; +export * from './omit-from-mapped-result'; +export * from './omit'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.js new file mode 100644 index 0000000..5b9848b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./omit-from-mapped-key"), exports); +__exportStar(require("./omit-from-mapped-result"), exports); +__exportStar(require("./omit"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.d.ts new file mode 100644 index 0000000..e2a86dd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.d.ts @@ -0,0 +1,12 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult, type TMappedKey } from '../mapped/index'; +import { type TOmit } from './omit'; +type TFromPropertyKey = { + [_ in Key]: TOmit; +}; +type TFromPropertyKeys = (PropertyKeys extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? TFromPropertyKeys> : Result); +type TFromMappedKey = (TFromPropertyKeys); +export type TOmitFromMappedKey> = (TMappedResult); +export declare function OmitFromMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.js new file mode 100644 index 0000000..557d87a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-key.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OmitFromMappedKey = OmitFromMappedKey; +const index_1 = require("../mapped/index"); +const omit_1 = require("./omit"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromPropertyKey(type, key, options) { + return { [key]: (0, omit_1.Omit)(type, [key], (0, value_1.Clone)(options)) }; +} +// prettier-ignore +function FromPropertyKeys(type, propertyKeys, options) { + return propertyKeys.reduce((Acc, LK) => { + return { ...Acc, ...FromPropertyKey(type, LK, options) }; + }, {}); +} +// prettier-ignore +function FromMappedKey(type, mappedKey, options) { + return FromPropertyKeys(type, mappedKey.keys, options); +} +// prettier-ignore +function OmitFromMappedKey(type, mappedKey, options) { + const properties = FromMappedKey(type, mappedKey, options); + return (0, index_1.MappedResult)(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.d.ts new file mode 100644 index 0000000..a589303 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.d.ts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index'; +import type { Ensure, Evaluate } from '../helpers/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TOmit } from './omit'; +type TFromProperties = ({ + [K2 in keyof Properties]: TOmit; +}); +type TFromMappedResult = (Evaluate>); +export type TOmitFromMappedResult> = (Ensure>); +export declare function OmitFromMappedResult>(mappedResult: MappedResult, propertyKeys: [...PropertyKeys], options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.js new file mode 100644 index 0000000..df47ad2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit-from-mapped-result.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OmitFromMappedResult = OmitFromMappedResult; +const index_1 = require("../mapped/index"); +const omit_1 = require("./omit"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromProperties(properties, propertyKeys, options) { + const result = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(properties)) + result[K2] = (0, omit_1.Omit)(properties[K2], propertyKeys, (0, value_1.Clone)(options)); + return result; +} +// prettier-ignore +function FromMappedResult(mappedResult, propertyKeys, options) { + return FromProperties(mappedResult.properties, propertyKeys, options); +} +// prettier-ignore +function OmitFromMappedResult(mappedResult, propertyKeys, options) { + const properties = FromMappedResult(mappedResult, propertyKeys, options); + return (0, index_1.MappedResult)(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.d.ts new file mode 100644 index 0000000..273d287 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.d.ts @@ -0,0 +1,36 @@ +import type { SchemaOptions, TSchema } from '../schema/index'; +import type { TupleToUnion, Evaluate } from '../helpers/index'; +import { type TRecursive } from '../recursive/index'; +import type { TMappedKey, TMappedResult } from '../mapped/index'; +import { TComputed } from '../computed/index'; +import { TLiteral, TLiteralValue } from '../literal/index'; +import { type TIndexPropertyKeys } from '../indexed/index'; +import { type TIntersect } from '../intersect/index'; +import { type TUnion } from '../union/index'; +import { type TObject, type TProperties } from '../object/index'; +import { type TRef } from '../ref/index'; +import { type TOmitFromMappedKey } from './omit-from-mapped-key'; +import { type TOmitFromMappedResult } from './omit-from-mapped-result'; +type TFromIntersect = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect]> : Result); +type TFromUnion = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion]> : Result); +type TFromProperties> = (Evaluate>); +type TFromObject<_Type extends TObject, PropertyKeys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TUnionFromPropertyKeys = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys]> : TUnionFromPropertyKeys : TUnion); +export type TOmitResolve = (Properties extends TRecursive ? TRecursive> : Properties extends TIntersect ? TIntersect> : Properties extends TUnion ? TUnion> : Properties extends TObject ? TFromObject : TObject<{}>); +type TResolvePropertyKeys = Key extends TSchema ? TIndexPropertyKeys : Key; +type TResolveTypeKey = Key extends PropertyKey[] ? TUnionFromPropertyKeys : Key; +export type TOmit = (Type extends TMappedResult ? TOmitFromMappedResult> : Key extends TMappedKey ? TOmitFromMappedKey : [ + IsTypeRef, + IsKeyRef +] extends [true, true] ? TComputed<'Omit', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [false, true] ? TComputed<'Omit', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [true, false] ? TComputed<'Omit', [Type, TResolveTypeKey]> : TOmitResolve>); +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Omit(type: Type, key: readonly [...Key], options?: SchemaOptions): TOmit; +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Omit(type: Type, key: Key, options?: SchemaOptions): TOmit; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.js new file mode 100644 index 0000000..b2a7658 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/omit/omit.js @@ -0,0 +1,75 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Omit = Omit; +const type_1 = require("../create/type"); +const discard_1 = require("../discard/discard"); +const symbols_1 = require("../symbols/symbols"); +const index_1 = require("../computed/index"); +const index_2 = require("../literal/index"); +const index_3 = require("../indexed/index"); +const index_4 = require("../intersect/index"); +const index_5 = require("../union/index"); +const index_6 = require("../object/index"); +// ------------------------------------------------------------------ +// Mapped +// ------------------------------------------------------------------ +const omit_from_mapped_key_1 = require("./omit-from-mapped-key"); +const omit_from_mapped_result_1 = require("./omit-from-mapped-result"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +const value_1 = require("../guard/value"); +// prettier-ignore +function FromIntersect(types, propertyKeys) { + return types.map((type) => OmitResolve(type, propertyKeys)); +} +// prettier-ignore +function FromUnion(types, propertyKeys) { + return types.map((type) => OmitResolve(type, propertyKeys)); +} +// ------------------------------------------------------------------ +// FromProperty +// ------------------------------------------------------------------ +// prettier-ignore +function FromProperty(properties, key) { + const { [key]: _, ...R } = properties; + return R; +} +// prettier-ignore +function FromProperties(properties, propertyKeys) { + return propertyKeys.reduce((T, K2) => FromProperty(T, K2), properties); +} +// prettier-ignore +function FromObject(type, propertyKeys, properties) { + const options = (0, discard_1.Discard)(type, [symbols_1.TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties, propertyKeys); + return (0, index_6.Object)(mappedProperties, options); +} +// prettier-ignore +function UnionFromPropertyKeys(propertyKeys) { + const result = propertyKeys.reduce((result, key) => (0, kind_1.IsLiteralValue)(key) ? [...result, (0, index_2.Literal)(key)] : result, []); + return (0, index_5.Union)(result); +} +// prettier-ignore +function OmitResolve(type, propertyKeys) { + return ((0, kind_1.IsIntersect)(type) ? (0, index_4.Intersect)(FromIntersect(type.allOf, propertyKeys)) : + (0, kind_1.IsUnion)(type) ? (0, index_5.Union)(FromUnion(type.anyOf, propertyKeys)) : + (0, kind_1.IsObject)(type) ? FromObject(type, propertyKeys, type.properties) : + (0, index_6.Object)({})); +} +/** `[Json]` Constructs a type whose keys are picked from the given type */ +// prettier-ignore +function Omit(type, key, options) { + const typeKey = (0, value_1.IsArray)(key) ? UnionFromPropertyKeys(key) : key; + const propertyKeys = (0, kind_1.IsSchema)(key) ? (0, index_3.IndexPropertyKeys)(key) : key; + const isTypeRef = (0, kind_1.IsRef)(type); + const isKeyRef = (0, kind_1.IsRef)(key); + return ((0, kind_1.IsMappedResult)(type) ? (0, omit_from_mapped_result_1.OmitFromMappedResult)(type, propertyKeys, options) : + (0, kind_1.IsMappedKey)(key) ? (0, omit_from_mapped_key_1.OmitFromMappedKey)(type, key, options) : + (isTypeRef && isKeyRef) ? (0, index_1.Computed)('Omit', [type, typeKey], options) : + (!isTypeRef && isKeyRef) ? (0, index_1.Computed)('Omit', [type, typeKey], options) : + (isTypeRef && !isKeyRef) ? (0, index_1.Computed)('Omit', [type, typeKey], options) : + (0, type_1.CreateType)({ ...OmitResolve(type, propertyKeys), ...options })); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.d.ts new file mode 100644 index 0000000..6a8a724 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.d.ts @@ -0,0 +1,2 @@ +export * from './optional-from-mapped-result'; +export * from './optional'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.js new file mode 100644 index 0000000..a02240a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./optional-from-mapped-result"), exports); +__exportStar(require("./optional"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.d.ts new file mode 100644 index 0000000..c8ae94c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.d.ts @@ -0,0 +1,10 @@ +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TOptionalWithFlag } from './optional'; +type TFromProperties

= ({ + [K2 in keyof P]: TOptionalWithFlag; +}); +type TFromMappedResult = (TFromProperties); +export type TOptionalFromMappedResult> = (TMappedResult

); +export declare function OptionalFromMappedResult>(R: R, F: F): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.js new file mode 100644 index 0000000..1368005 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional-from-mapped-result.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OptionalFromMappedResult = OptionalFromMappedResult; +const index_1 = require("../mapped/index"); +const optional_1 = require("./optional"); +// prettier-ignore +function FromProperties(P, F) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = (0, optional_1.Optional)(P[K2], F); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, F) { + return FromProperties(R.properties, F); +} +// prettier-ignore +function OptionalFromMappedResult(R, F) { + const P = FromMappedResult(R, F); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.d.ts new file mode 100644 index 0000000..00dca56 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.d.ts @@ -0,0 +1,20 @@ +import type { TSchema } from '../schema/index'; +import type { Ensure } from '../helpers/index'; +import { OptionalKind } from '../symbols/index'; +import type { TMappedResult } from '../mapped/index'; +import { type TOptionalFromMappedResult } from './optional-from-mapped-result'; +type TRemoveOptional = T extends TOptional ? S : T; +type TAddOptional = T extends TOptional ? TOptional : Ensure>; +export type TOptionalWithFlag = F extends false ? TRemoveOptional : TAddOptional; +export type TOptional = T & { + [OptionalKind]: 'Optional'; +}; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T, enable: F): TOptionalFromMappedResult; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T, enable: F): TOptionalWithFlag; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T): TOptionalFromMappedResult; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T): TOptionalWithFlag; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.js new file mode 100644 index 0000000..99211a8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/optional/optional.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Optional = Optional; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +const index_2 = require("../discard/index"); +const optional_from_mapped_result_1 = require("./optional-from-mapped-result"); +const kind_1 = require("../guard/kind"); +function RemoveOptional(schema) { + return (0, type_1.CreateType)((0, index_2.Discard)(schema, [index_1.OptionalKind])); +} +function AddOptional(schema) { + return (0, type_1.CreateType)({ ...schema, [index_1.OptionalKind]: 'Optional' }); +} +// prettier-ignore +function OptionalWithFlag(schema, F) { + return (F === false + ? RemoveOptional(schema) + : AddOptional(schema)); +} +/** `[Json]` Creates a Optional property */ +function Optional(schema, enable) { + const F = enable ?? true; + return (0, kind_1.IsMappedResult)(schema) ? (0, optional_from_mapped_result_1.OptionalFromMappedResult)(schema, F) : OptionalWithFlag(schema, F); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.d.ts new file mode 100644 index 0000000..f7be6e6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.d.ts @@ -0,0 +1 @@ +export * from './parameters'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.js new file mode 100644 index 0000000..da30bef --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./parameters"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.d.ts new file mode 100644 index 0000000..849d0ad --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.d.ts @@ -0,0 +1,7 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TFunction } from '../function/index'; +import { type TTuple } from '../tuple/index'; +import { type TNever } from '../never/index'; +export type TParameters = (Type extends TFunction ? TTuple : TNever); +/** `[JavaScript]` Extracts the Parameters from the given Function type */ +export declare function Parameters(schema: Type, options?: SchemaOptions): TParameters; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.js new file mode 100644 index 0000000..1f9b7ff --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/parameters/parameters.js @@ -0,0 +1,44 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Parameters = Parameters; +const index_1 = require("../tuple/index"); +const index_2 = require("../never/index"); +const KindGuard = __importStar(require("../guard/kind")); +/** `[JavaScript]` Extracts the Parameters from the given Function type */ +function Parameters(schema, options) { + return (KindGuard.IsFunction(schema) ? (0, index_1.Tuple)(schema.parameters, options) : (0, index_2.Never)()); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.d.ts new file mode 100644 index 0000000..439f012 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.d.ts @@ -0,0 +1,2 @@ +export * from './partial-from-mapped-result'; +export * from './partial'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.js new file mode 100644 index 0000000..7ed3fc6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./partial-from-mapped-result"), exports); +__exportStar(require("./partial"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.d.ts new file mode 100644 index 0000000..6ff2bb7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.d.ts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index'; +import type { Ensure, Evaluate } from '../helpers/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TPartial } from './partial'; +type TFromProperties

= ({ + [K2 in keyof P]: TPartial; +}); +type TFromMappedResult = (Evaluate>); +export type TPartialFromMappedResult> = (Ensure>); +export declare function PartialFromMappedResult>(R: R, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.js new file mode 100644 index 0000000..84d8c4f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial-from-mapped-result.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PartialFromMappedResult = PartialFromMappedResult; +const index_1 = require("../mapped/index"); +const partial_1 = require("./partial"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromProperties(K, options) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(K)) + Acc[K2] = (0, partial_1.Partial)(K[K2], (0, value_1.Clone)(options)); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, options) { + return FromProperties(R.properties, options); +} +// prettier-ignore +function PartialFromMappedResult(R, options) { + const P = FromMappedResult(R, options); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.d.ts new file mode 100644 index 0000000..82a89a1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.d.ts @@ -0,0 +1,35 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Evaluate, Ensure } from '../helpers/index'; +import type { TMappedResult } from '../mapped/index'; +import { type TReadonlyOptional } from '../readonly-optional/index'; +import { type TComputed } from '../computed/index'; +import { type TOptional } from '../optional/index'; +import { type TReadonly } from '../readonly/index'; +import { type TRecursive } from '../recursive/index'; +import { type TObject, type TProperties } from '../object/index'; +import { type TIntersect } from '../intersect/index'; +import { type TUnion } from '../union/index'; +import { type TRef } from '../ref/index'; +import { type TBigInt } from '../bigint/index'; +import { type TBoolean } from '../boolean/index'; +import { type TInteger } from '../integer/index'; +import { type TLiteral } from '../literal/index'; +import { type TNull } from '../null/index'; +import { type TNumber } from '../number/index'; +import { type TString } from '../string/index'; +import { type TSymbol } from '../symbol/index'; +import { type TUndefined } from '../undefined/index'; +import { type TPartialFromMappedResult } from './partial-from-mapped-result'; +type TFromComputed = Ensure]>>; +type TFromRef = Ensure]>>; +type TFromProperties = Evaluate<{ + [K in keyof Properties]: Properties[K] extends (TReadonlyOptional) ? TReadonlyOptional : Properties[K] extends (TReadonly) ? TReadonlyOptional : Properties[K] extends (TOptional) ? TOptional : TOptional; +}>; +type TFromObject<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TFromRest = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Result); +export type TPartial = (Type extends TRecursive ? TRecursive> : Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TObject ? TFromObject : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>); +/** `[Json]` Constructs a type where all properties are optional */ +export declare function Partial(type: MappedResult, options?: SchemaOptions): TPartialFromMappedResult; +/** `[Json]` Constructs a type where all properties are optional */ +export declare function Partial(type: Type, options?: SchemaOptions): TPartial; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.js new file mode 100644 index 0000000..d7512e2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/partial/partial.js @@ -0,0 +1,111 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Partial = Partial; +const type_1 = require("../create/type"); +const index_1 = require("../computed/index"); +const index_2 = require("../optional/index"); +const index_3 = require("../object/index"); +const index_4 = require("../intersect/index"); +const index_5 = require("../union/index"); +const index_6 = require("../ref/index"); +const index_7 = require("../discard/index"); +const index_8 = require("../symbols/index"); +const partial_from_mapped_result_1 = require("./partial-from-mapped-result"); +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +const KindGuard = __importStar(require("../guard/kind")); +// prettier-ignore +function FromComputed(target, parameters) { + return (0, index_1.Computed)('Partial', [(0, index_1.Computed)(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return (0, index_1.Computed)('Partial', [(0, index_6.Ref)($ref)]); +} +// prettier-ignore +function FromProperties(properties) { + const partialProperties = {}; + for (const K of globalThis.Object.getOwnPropertyNames(properties)) + partialProperties[K] = (0, index_2.Optional)(properties[K]); + return partialProperties; +} +// prettier-ignore +function FromObject(type, properties) { + const options = (0, index_7.Discard)(type, [index_8.TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties); + return (0, index_3.Object)(mappedProperties, options); +} +// prettier-ignore +function FromRest(types) { + return types.map(type => PartialResolve(type)); +} +// ------------------------------------------------------------------ +// PartialResolve +// ------------------------------------------------------------------ +// prettier-ignore +function PartialResolve(type) { + return ( + // Mappable + KindGuard.IsComputed(type) ? FromComputed(type.target, type.parameters) : + KindGuard.IsRef(type) ? FromRef(type.$ref) : + KindGuard.IsIntersect(type) ? (0, index_4.Intersect)(FromRest(type.allOf)) : + KindGuard.IsUnion(type) ? (0, index_5.Union)(FromRest(type.anyOf)) : + KindGuard.IsObject(type) ? FromObject(type, type.properties) : + // Intrinsic + KindGuard.IsBigInt(type) ? type : + KindGuard.IsBoolean(type) ? type : + KindGuard.IsInteger(type) ? type : + KindGuard.IsLiteral(type) ? type : + KindGuard.IsNull(type) ? type : + KindGuard.IsNumber(type) ? type : + KindGuard.IsString(type) ? type : + KindGuard.IsSymbol(type) ? type : + KindGuard.IsUndefined(type) ? type : + // Passthrough + (0, index_3.Object)({})); +} +/** `[Json]` Constructs a type where all properties are optional */ +function Partial(type, options) { + if (KindGuard.IsMappedResult(type)) { + return (0, partial_from_mapped_result_1.PartialFromMappedResult)(type, options); + } + else { + // special: mapping types require overridable options + return (0, type_1.CreateType)({ ...PartialResolve(type), ...options }); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.d.ts new file mode 100644 index 0000000..99a3bc5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.d.ts @@ -0,0 +1 @@ +export * from './patterns'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.js new file mode 100644 index 0000000..7341fd4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./patterns"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.d.ts new file mode 100644 index 0000000..37e3ae2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.d.ts @@ -0,0 +1,8 @@ +export declare const PatternBoolean = "(true|false)"; +export declare const PatternNumber = "(0|[1-9][0-9]*)"; +export declare const PatternString = "(.*)"; +export declare const PatternNever = "(?!.*)"; +export declare const PatternBooleanExact = "^(true|false)$"; +export declare const PatternNumberExact = "^(0|[1-9][0-9]*)$"; +export declare const PatternStringExact = "^(.*)$"; +export declare const PatternNeverExact = "^(?!.*)$"; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.js new file mode 100644 index 0000000..cf47b53 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/patterns/patterns.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PatternNeverExact = exports.PatternStringExact = exports.PatternNumberExact = exports.PatternBooleanExact = exports.PatternNever = exports.PatternString = exports.PatternNumber = exports.PatternBoolean = void 0; +exports.PatternBoolean = '(true|false)'; +exports.PatternNumber = '(0|[1-9][0-9]*)'; +exports.PatternString = '(.*)'; +exports.PatternNever = '(?!.*)'; +exports.PatternBooleanExact = `^${exports.PatternBoolean}$`; +exports.PatternNumberExact = `^${exports.PatternNumber}$`; +exports.PatternStringExact = `^${exports.PatternString}$`; +exports.PatternNeverExact = `^${exports.PatternNever}$`; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.d.ts new file mode 100644 index 0000000..01e0114 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.d.ts @@ -0,0 +1,3 @@ +export * from './pick-from-mapped-key'; +export * from './pick-from-mapped-result'; +export * from './pick'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.js new file mode 100644 index 0000000..7ee603c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./pick-from-mapped-key"), exports); +__exportStar(require("./pick-from-mapped-result"), exports); +__exportStar(require("./pick"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.d.ts new file mode 100644 index 0000000..4c3d942 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.d.ts @@ -0,0 +1,12 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult, type TMappedKey } from '../mapped/index'; +import { type TPick } from './pick'; +type TFromPropertyKey = { + [_ in Key]: TPick; +}; +type TFromPropertyKeys = (PropertyKeys extends [infer LeftKey extends PropertyKey, ...infer RightKeys extends PropertyKey[]] ? TFromPropertyKeys> : Result); +type TFromMappedKey = (TFromPropertyKeys); +export type TPickFromMappedKey> = (TMappedResult); +export declare function PickFromMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.js new file mode 100644 index 0000000..5ca9b16 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-key.js @@ -0,0 +1,28 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PickFromMappedKey = PickFromMappedKey; +const index_1 = require("../mapped/index"); +const pick_1 = require("./pick"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromPropertyKey(type, key, options) { + return { + [key]: (0, pick_1.Pick)(type, [key], (0, value_1.Clone)(options)) + }; +} +// prettier-ignore +function FromPropertyKeys(type, propertyKeys, options) { + return propertyKeys.reduce((result, leftKey) => { + return { ...result, ...FromPropertyKey(type, leftKey, options) }; + }, {}); +} +// prettier-ignore +function FromMappedKey(type, mappedKey, options) { + return FromPropertyKeys(type, mappedKey.keys, options); +} +// prettier-ignore +function PickFromMappedKey(type, mappedKey, options) { + const properties = FromMappedKey(type, mappedKey, options); + return (0, index_1.MappedResult)(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.d.ts new file mode 100644 index 0000000..7a5be56 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.d.ts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index'; +import type { Ensure, Evaluate } from '../helpers/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TPick } from './pick'; +type TFromProperties = ({ + [K2 in keyof Properties]: TPick; +}); +type TFromMappedResult = (Evaluate>); +export type TPickFromMappedResult> = (Ensure>); +export declare function PickFromMappedResult>(mappedResult: MappedResult, propertyKeys: [...PropertyKeys], options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.js new file mode 100644 index 0000000..e64fa4a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick-from-mapped-result.js @@ -0,0 +1,23 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PickFromMappedResult = PickFromMappedResult; +const index_1 = require("../mapped/index"); +const pick_1 = require("./pick"); +const value_1 = require("../clone/value"); +// prettier-ignore +function FromProperties(properties, propertyKeys, options) { + const result = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(properties)) + result[K2] = (0, pick_1.Pick)(properties[K2], propertyKeys, (0, value_1.Clone)(options)); + return result; +} +// prettier-ignore +function FromMappedResult(mappedResult, propertyKeys, options) { + return FromProperties(mappedResult.properties, propertyKeys, options); +} +// prettier-ignore +function PickFromMappedResult(mappedResult, propertyKeys, options) { + const properties = FromMappedResult(mappedResult, propertyKeys, options); + return (0, index_1.MappedResult)(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.d.ts new file mode 100644 index 0000000..d1310cf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.d.ts @@ -0,0 +1,36 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { TupleToUnion, Evaluate } from '../helpers/index'; +import { type TRecursive } from '../recursive/index'; +import { type TComputed } from '../computed/index'; +import { type TIntersect } from '../intersect/index'; +import { type TLiteral, type TLiteralValue } from '../literal/index'; +import { type TObject, type TProperties } from '../object/index'; +import { type TUnion } from '../union/index'; +import { type TMappedKey, type TMappedResult } from '../mapped/index'; +import { type TRef } from '../ref/index'; +import { type TIndexPropertyKeys } from '../indexed/index'; +import { type TPickFromMappedKey } from './pick-from-mapped-key'; +import { type TPickFromMappedResult } from './pick-from-mapped-result'; +type TFromIntersect = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect]> : Result; +type TFromUnion = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion]> : Result; +type TFromProperties> = (Evaluate>); +type TFromObject<_Type extends TObject, Keys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TUnionFromPropertyKeys = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys]> : TUnionFromPropertyKeys : TUnion); +export type TPickResolve = (Type extends TRecursive ? TRecursive> : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TObject ? TFromObject : TObject<{}>); +type TResolvePropertyKeys = Key extends TSchema ? TIndexPropertyKeys : Key; +type TResolveTypeKey = Key extends PropertyKey[] ? TUnionFromPropertyKeys : Key; +export type TPick = (Type extends TMappedResult ? TPickFromMappedResult> : Key extends TMappedKey ? TPickFromMappedKey : [ + IsTypeRef, + IsKeyRef +] extends [true, true] ? TComputed<'Pick', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [false, true] ? TComputed<'Pick', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [true, false] ? TComputed<'Pick', [Type, TResolveTypeKey]> : TPickResolve>); +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Pick(type: Type, key: readonly [...Key], options?: SchemaOptions): TPick; +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Pick(type: Type, key: Key, options?: SchemaOptions): TPick; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.js new file mode 100644 index 0000000..a09080b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/pick/pick.js @@ -0,0 +1,70 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Pick = Pick; +const type_1 = require("../create/type"); +const discard_1 = require("../discard/discard"); +const index_1 = require("../computed/index"); +const index_2 = require("../intersect/index"); +const index_3 = require("../literal/index"); +const index_4 = require("../object/index"); +const index_5 = require("../union/index"); +const index_6 = require("../indexed/index"); +const symbols_1 = require("../symbols/symbols"); +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +const value_1 = require("../guard/value"); +// ------------------------------------------------------------------ +// Infrastructure +// ------------------------------------------------------------------ +const pick_from_mapped_key_1 = require("./pick-from-mapped-key"); +const pick_from_mapped_result_1 = require("./pick-from-mapped-result"); +function FromIntersect(types, propertyKeys) { + return types.map((type) => PickResolve(type, propertyKeys)); +} +// prettier-ignore +function FromUnion(types, propertyKeys) { + return types.map((type) => PickResolve(type, propertyKeys)); +} +// prettier-ignore +function FromProperties(properties, propertyKeys) { + const result = {}; + for (const K2 of propertyKeys) + if (K2 in properties) + result[K2] = properties[K2]; + return result; +} +// prettier-ignore +function FromObject(Type, keys, properties) { + const options = (0, discard_1.Discard)(Type, [symbols_1.TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties, keys); + return (0, index_4.Object)(mappedProperties, options); +} +// prettier-ignore +function UnionFromPropertyKeys(propertyKeys) { + const result = propertyKeys.reduce((result, key) => (0, kind_1.IsLiteralValue)(key) ? [...result, (0, index_3.Literal)(key)] : result, []); + return (0, index_5.Union)(result); +} +// prettier-ignore +function PickResolve(type, propertyKeys) { + return ((0, kind_1.IsIntersect)(type) ? (0, index_2.Intersect)(FromIntersect(type.allOf, propertyKeys)) : + (0, kind_1.IsUnion)(type) ? (0, index_5.Union)(FromUnion(type.anyOf, propertyKeys)) : + (0, kind_1.IsObject)(type) ? FromObject(type, propertyKeys, type.properties) : + (0, index_4.Object)({})); +} +/** `[Json]` Constructs a type whose keys are picked from the given type */ +// prettier-ignore +function Pick(type, key, options) { + const typeKey = (0, value_1.IsArray)(key) ? UnionFromPropertyKeys(key) : key; + const propertyKeys = (0, kind_1.IsSchema)(key) ? (0, index_6.IndexPropertyKeys)(key) : key; + const isTypeRef = (0, kind_1.IsRef)(type); + const isKeyRef = (0, kind_1.IsRef)(key); + return ((0, kind_1.IsMappedResult)(type) ? (0, pick_from_mapped_result_1.PickFromMappedResult)(type, propertyKeys, options) : + (0, kind_1.IsMappedKey)(key) ? (0, pick_from_mapped_key_1.PickFromMappedKey)(type, key, options) : + (isTypeRef && isKeyRef) ? (0, index_1.Computed)('Pick', [type, typeKey], options) : + (!isTypeRef && isKeyRef) ? (0, index_1.Computed)('Pick', [type, typeKey], options) : + (isTypeRef && !isKeyRef) ? (0, index_1.Computed)('Pick', [type, typeKey], options) : + (0, type_1.CreateType)({ ...PickResolve(type, propertyKeys), ...options })); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.d.ts new file mode 100644 index 0000000..b0a9756 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.d.ts @@ -0,0 +1 @@ +export * from './promise'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.js new file mode 100644 index 0000000..a66101a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./promise"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.d.ts new file mode 100644 index 0000000..456426d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.d.ts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +export interface TPromise extends TSchema { + [Kind]: 'Promise'; + static: Promise>; + type: 'Promise'; + item: TSchema; +} +/** `[JavaScript]` Creates a Promise type */ +export declare function Promise(item: T, options?: SchemaOptions): TPromise; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.js new file mode 100644 index 0000000..f2b5978 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/promise/promise.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Promise = Promise; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a Promise type */ +function Promise(item, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Promise', type: 'Promise', item }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.d.ts new file mode 100644 index 0000000..467744f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.d.ts @@ -0,0 +1 @@ +export * from './readonly-optional'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.js new file mode 100644 index 0000000..709b59d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./readonly-optional"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.d.ts new file mode 100644 index 0000000..b329201 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.d.ts @@ -0,0 +1,6 @@ +import type { TSchema } from '../schema/index'; +import { type TReadonly } from '../readonly/index'; +import { type TOptional } from '../optional/index'; +export type TReadonlyOptional = TOptional & TReadonly; +/** `[Json]` Creates a Readonly and Optional property */ +export declare function ReadonlyOptional(schema: T): TReadonly>; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.js new file mode 100644 index 0000000..e9324cb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly-optional/readonly-optional.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadonlyOptional = ReadonlyOptional; +const index_1 = require("../readonly/index"); +const index_2 = require("../optional/index"); +/** `[Json]` Creates a Readonly and Optional property */ +function ReadonlyOptional(schema) { + return (0, index_1.Readonly)((0, index_2.Optional)(schema)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.d.ts new file mode 100644 index 0000000..630b735 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.d.ts @@ -0,0 +1,2 @@ +export * from './readonly-from-mapped-result'; +export * from './readonly'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.js new file mode 100644 index 0000000..6d1c470 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./readonly-from-mapped-result"), exports); +__exportStar(require("./readonly"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.d.ts new file mode 100644 index 0000000..56cf185 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.d.ts @@ -0,0 +1,10 @@ +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TReadonlyWithFlag } from './readonly'; +type TFromProperties

= ({ + [K2 in keyof P]: TReadonlyWithFlag; +}); +type TFromMappedResult = (TFromProperties); +export type TReadonlyFromMappedResult> = (TMappedResult

); +export declare function ReadonlyFromMappedResult>(R: R, F: F): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.js new file mode 100644 index 0000000..8e69a3e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly-from-mapped-result.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadonlyFromMappedResult = ReadonlyFromMappedResult; +const index_1 = require("../mapped/index"); +const readonly_1 = require("./readonly"); +// prettier-ignore +function FromProperties(K, F) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(K)) + Acc[K2] = (0, readonly_1.Readonly)(K[K2], F); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, F) { + return FromProperties(R.properties, F); +} +// prettier-ignore +function ReadonlyFromMappedResult(R, F) { + const P = FromMappedResult(R, F); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.d.ts new file mode 100644 index 0000000..9e0de0b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.d.ts @@ -0,0 +1,20 @@ +import type { TSchema } from '../schema/index'; +import type { Ensure } from '../helpers/index'; +import { ReadonlyKind } from '../symbols/index'; +import type { TMappedResult } from '../mapped/index'; +import { type TReadonlyFromMappedResult } from './readonly-from-mapped-result'; +type TRemoveReadonly = T extends TReadonly ? S : T; +type TAddReadonly = T extends TReadonly ? TReadonly : Ensure>; +export type TReadonlyWithFlag = F extends false ? TRemoveReadonly : TAddReadonly; +export type TReadonly = T & { + [ReadonlyKind]: 'Readonly'; +}; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T, enable: F): TReadonlyFromMappedResult; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T, enable: F): TReadonlyWithFlag; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T): TReadonlyFromMappedResult; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T): TReadonlyWithFlag; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.js new file mode 100644 index 0000000..d66540c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/readonly/readonly.js @@ -0,0 +1,26 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Readonly = Readonly; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +const index_2 = require("../discard/index"); +const readonly_from_mapped_result_1 = require("./readonly-from-mapped-result"); +const kind_1 = require("../guard/kind"); +function RemoveReadonly(schema) { + return (0, type_1.CreateType)((0, index_2.Discard)(schema, [index_1.ReadonlyKind])); +} +function AddReadonly(schema) { + return (0, type_1.CreateType)({ ...schema, [index_1.ReadonlyKind]: 'Readonly' }); +} +// prettier-ignore +function ReadonlyWithFlag(schema, F) { + return (F === false + ? RemoveReadonly(schema) + : AddReadonly(schema)); +} +/** `[Json]` Creates a Readonly property */ +function Readonly(schema, enable) { + const F = enable ?? true; + return (0, kind_1.IsMappedResult)(schema) ? (0, readonly_from_mapped_result_1.ReadonlyFromMappedResult)(schema, F) : ReadonlyWithFlag(schema, F); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.d.ts new file mode 100644 index 0000000..96bb9f9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.d.ts @@ -0,0 +1 @@ +export * from './record'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.js new file mode 100644 index 0000000..ddabbb5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./record"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.d.ts new file mode 100644 index 0000000..997c6af --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.d.ts @@ -0,0 +1,71 @@ +import { Kind } from '../symbols/index'; +import type { TSchema } from '../schema/index'; +import type { Static } from '../static/index'; +import type { Evaluate, Ensure, Assert } from '../helpers/index'; +import { type TAny } from '../any/index'; +import { type TBoolean } from '../boolean/index'; +import { type TEnumRecord, type TEnum } from '../enum/index'; +import { type TInteger } from '../integer/index'; +import { type TLiteral, type TLiteralValue } from '../literal/index'; +import { type TNever } from '../never/index'; +import { type TNumber } from '../number/index'; +import { type TObject, type TProperties, type TAdditionalProperties, type ObjectOptions } from '../object/index'; +import { type TRegExp } from '../regexp/index'; +import { type TString } from '../string/index'; +import { type TUnion } from '../union/index'; +import { TIsTemplateLiteralFinite, type TTemplateLiteral } from '../template-literal/index'; +type TFromTemplateLiteralKeyInfinite = Ensure>; +type TFromTemplateLiteralKeyFinite> = (Ensure>>); +type TFromTemplateLiteralKey = TIsTemplateLiteralFinite extends false ? TFromTemplateLiteralKeyInfinite : TFromTemplateLiteralKeyFinite; +type TFromEnumKey, Type extends TSchema> = Ensure>; +type TFromUnionKeyLiteralString, Type extends TSchema> = { + [_ in Key['const']]: Type; +}; +type TFromUnionKeyLiteralNumber, Type extends TSchema> = { + [_ in Key['const']]: Type; +}; +type TFromUnionKeyVariants = Keys extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? (Left extends TUnion ? TFromUnionKeyVariants> : Left extends TLiteral ? TFromUnionKeyVariants> : Left extends TLiteral ? TFromUnionKeyVariants> : {}) : Result; +type TFromUnionKey> = (Ensure>>); +type TFromLiteralKey = (Ensure]: Type; +}>>); +type TFromRegExpKey<_Key extends TRegExp, Type extends TSchema> = (Ensure>); +type TFromStringKey<_Key extends TString, Type extends TSchema> = (Ensure>); +type TFromAnyKey<_Key extends TAny, Type extends TSchema> = (Ensure>); +type TFromNeverKey<_Key extends TNever, Type extends TSchema> = (Ensure>); +type TFromBooleanKey<_Key extends TBoolean, Type extends TSchema> = (Ensure>); +type TFromIntegerKey<_Key extends TSchema, Type extends TSchema> = (Ensure>); +type TFromNumberKey<_Key extends TSchema, Type extends TSchema> = (Ensure>); +type RecordStatic = (Evaluate<{ + [_ in Assert, PropertyKey>]: Static; +}>); +export interface TRecord extends TSchema { + [Kind]: 'Record'; + static: RecordStatic; + type: 'object'; + patternProperties: { + [pattern: string]: Type; + }; + additionalProperties: TAdditionalProperties; +} +export type TRecordOrObject = (Key extends TTemplateLiteral ? TFromTemplateLiteralKey : Key extends TEnum ? TFromEnumKey : Key extends TUnion ? TFromUnionKey : Key extends TLiteral ? TFromLiteralKey : Key extends TBoolean ? TFromBooleanKey : Key extends TInteger ? TFromIntegerKey : Key extends TNumber ? TFromNumberKey : Key extends TRegExp ? TFromRegExpKey : Key extends TString ? TFromStringKey : Key extends TAny ? TFromAnyKey : Key extends TNever ? TFromNeverKey : TNever); +/** `[Json]` Creates a Record type */ +export declare function Record(key: Key, type: Type, options?: ObjectOptions): TRecordOrObject; +/** Gets the Records Pattern */ +export declare function RecordPattern(record: TRecord): string; +/** Gets the Records Key Type */ +export type TRecordKey ? (Key extends TNumber ? TNumber : Key extends TString ? TString : TString) : TString> = Result; +/** Gets the Records Key Type */ +export declare function RecordKey(type: Type): TRecordKey; +/** Gets a Record Value Type */ +export type TRecordValue ? Value : TNever)> = Result; +/** Gets a Record Value Type */ +export declare function RecordValue(type: Type): TRecordValue; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.js new file mode 100644 index 0000000..2b4811a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/record/record.js @@ -0,0 +1,123 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Record = Record; +exports.RecordPattern = RecordPattern; +exports.RecordKey = RecordKey; +exports.RecordValue = RecordValue; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +const index_2 = require("../never/index"); +const index_3 = require("../number/index"); +const index_4 = require("../object/index"); +const index_5 = require("../string/index"); +const index_6 = require("../union/index"); +const index_7 = require("../template-literal/index"); +const index_8 = require("../patterns/index"); +const index_9 = require("../indexed/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const value_1 = require("../guard/value"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// ------------------------------------------------------------------ +// RecordCreateFromPattern +// ------------------------------------------------------------------ +// prettier-ignore +function RecordCreateFromPattern(pattern, T, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Record', type: 'object', patternProperties: { [pattern]: T } }, options); +} +// ------------------------------------------------------------------ +// RecordCreateFromKeys +// ------------------------------------------------------------------ +// prettier-ignore +function RecordCreateFromKeys(K, T, options) { + const result = {}; + for (const K2 of K) + result[K2] = T; + return (0, index_4.Object)(result, { ...options, [index_1.Hint]: 'Record' }); +} +// prettier-ignore +function FromTemplateLiteralKey(K, T, options) { + return ((0, index_7.IsTemplateLiteralFinite)(K) + ? RecordCreateFromKeys((0, index_9.IndexPropertyKeys)(K), T, options) + : RecordCreateFromPattern(K.pattern, T, options)); +} +// prettier-ignore +function FromUnionKey(key, type, options) { + return RecordCreateFromKeys((0, index_9.IndexPropertyKeys)((0, index_6.Union)(key)), type, options); +} +// prettier-ignore +function FromLiteralKey(key, type, options) { + return RecordCreateFromKeys([key.toString()], type, options); +} +// prettier-ignore +function FromRegExpKey(key, type, options) { + return RecordCreateFromPattern(key.source, type, options); +} +// prettier-ignore +function FromStringKey(key, type, options) { + const pattern = (0, value_1.IsUndefined)(key.pattern) ? index_8.PatternStringExact : key.pattern; + return RecordCreateFromPattern(pattern, type, options); +} +// prettier-ignore +function FromAnyKey(_, type, options) { + return RecordCreateFromPattern(index_8.PatternStringExact, type, options); +} +// prettier-ignore +function FromNeverKey(_key, type, options) { + return RecordCreateFromPattern(index_8.PatternNeverExact, type, options); +} +// prettier-ignore +function FromBooleanKey(_key, type, options) { + return (0, index_4.Object)({ true: type, false: type }, options); +} +// prettier-ignore +function FromIntegerKey(_key, type, options) { + return RecordCreateFromPattern(index_8.PatternNumberExact, type, options); +} +// prettier-ignore +function FromNumberKey(_, type, options) { + return RecordCreateFromPattern(index_8.PatternNumberExact, type, options); +} +// ------------------------------------------------------------------ +// TRecordOrObject +// ------------------------------------------------------------------ +/** `[Json]` Creates a Record type */ +function Record(key, type, options = {}) { + // prettier-ignore + return ((0, kind_1.IsUnion)(key) ? FromUnionKey(key.anyOf, type, options) : + (0, kind_1.IsTemplateLiteral)(key) ? FromTemplateLiteralKey(key, type, options) : + (0, kind_1.IsLiteral)(key) ? FromLiteralKey(key.const, type, options) : + (0, kind_1.IsBoolean)(key) ? FromBooleanKey(key, type, options) : + (0, kind_1.IsInteger)(key) ? FromIntegerKey(key, type, options) : + (0, kind_1.IsNumber)(key) ? FromNumberKey(key, type, options) : + (0, kind_1.IsRegExp)(key) ? FromRegExpKey(key, type, options) : + (0, kind_1.IsString)(key) ? FromStringKey(key, type, options) : + (0, kind_1.IsAny)(key) ? FromAnyKey(key, type, options) : + (0, kind_1.IsNever)(key) ? FromNeverKey(key, type, options) : + (0, index_2.Never)(options)); +} +// ------------------------------------------------------------------ +// Record Utilities +// ------------------------------------------------------------------ +/** Gets the Records Pattern */ +function RecordPattern(record) { + return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0]; +} +/** Gets the Records Key Type */ +// prettier-ignore +function RecordKey(type) { + const pattern = RecordPattern(type); + return (pattern === index_8.PatternStringExact ? (0, index_5.String)() : + pattern === index_8.PatternNumberExact ? (0, index_3.Number)() : + (0, index_5.String)({ pattern })); +} +/** Gets a Record Value Type */ +// prettier-ignore +function RecordValue(type) { + return type.patternProperties[RecordPattern(type)]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.d.ts new file mode 100644 index 0000000..940e73f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.d.ts @@ -0,0 +1 @@ +export * from './recursive'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.js new file mode 100644 index 0000000..33d7a78 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./recursive"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.d.ts new file mode 100644 index 0000000..a006a5b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.d.ts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind, Hint } from '../symbols/index'; +import { Static } from '../static/index'; +export interface TThis extends TSchema { + [Kind]: 'This'; + static: this['params'][0]; + $ref: string; +} +type RecursiveStatic = Static]>; +export interface TRecursive extends TSchema { + [Hint]: 'Recursive'; + static: RecursiveStatic; +} +/** `[Json]` Creates a Recursive type */ +export declare function Recursive(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.js new file mode 100644 index 0000000..affc3da --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/recursive/recursive.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Recursive = Recursive; +const type_1 = require("../clone/type"); +const type_2 = require("../create/type"); +const value_1 = require("../guard/value"); +const index_1 = require("../symbols/index"); +// Auto Tracked For Recursive Types without ID's +let Ordinal = 0; +/** `[Json]` Creates a Recursive type */ +function Recursive(callback, options = {}) { + if ((0, value_1.IsUndefined)(options.$id)) + options.$id = `T${Ordinal++}`; + const thisType = (0, type_1.CloneType)(callback({ [index_1.Kind]: 'This', $ref: `${options.$id}` })); + thisType.$id = options.$id; + // prettier-ignore + return (0, type_2.CreateType)({ [index_1.Hint]: 'Recursive', ...thisType }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.d.ts new file mode 100644 index 0000000..7806b32 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.d.ts @@ -0,0 +1 @@ +export * from './ref'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.js new file mode 100644 index 0000000..999b633 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./ref"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.d.ts new file mode 100644 index 0000000..964cd75 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.d.ts @@ -0,0 +1,41 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +import { TUnsafe } from '../unsafe/index'; +import { Static } from '../static/index'; +export interface TRef extends TSchema { + [Kind]: 'Ref'; + static: unknown; + $ref: Ref; +} +export type TRefUnsafe = TUnsafe>; +/** `[Json]` Creates a Ref type.*/ +export declare function Ref($ref: Ref, options?: SchemaOptions): TRef; +/** + * @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass + * a `string` value for the reference (and not a schema). + * + * To adhere to the 0.34.0 signature, Ref implementations should be updated to the following. + * + * ```typescript + * // pre-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Ref(T) + * ``` + * should be changed to the following + * + * ```typescript + * // post-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Unsafe>(Type.Ref('T')) + * ``` + * You can also create a generic function to replicate the pre-0.34.0 signature if required + * + * ```typescript + * const LegacyRef = (schema: T) => Type.Unsafe>(Type.Ref(schema.$id!)) + * ``` + */ +export declare function Ref(type: Type, options?: SchemaOptions): TRefUnsafe; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.js new file mode 100644 index 0000000..43adcf4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/ref/ref.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Ref = Ref; +const index_1 = require("../error/index"); +const type_1 = require("../create/type"); +const index_2 = require("../symbols/index"); +/** `[Json]` Creates a Ref type. The referenced type must contain a $id */ +function Ref(...args) { + const [$ref, options] = typeof args[0] === 'string' ? [args[0], args[1]] : [args[0].$id, args[1]]; + if (typeof $ref !== 'string') + throw new index_1.TypeBoxError('Ref: $ref must be a string'); + return (0, type_1.CreateType)({ [index_2.Kind]: 'Ref', $ref }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.d.ts new file mode 100644 index 0000000..bfec43b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.d.ts @@ -0,0 +1 @@ +export * from './regexp'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.js new file mode 100644 index 0000000..cb18af7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./regexp"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.d.ts new file mode 100644 index 0000000..2d20bff --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.d.ts @@ -0,0 +1,20 @@ +import type { SchemaOptions } from '../schema/index'; +import type { TSchema } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface RegExpOptions extends SchemaOptions { + /** The maximum length of the string */ + maxLength?: number; + /** The minimum length of the string */ + minLength?: number; +} +export interface TRegExp extends TSchema { + [Kind]: 'RegExp'; + static: `${string}`; + type: 'RegExp'; + source: string; + flags: string; +} +/** `[JavaScript]` Creates a RegExp type */ +export declare function RegExp(pattern: string, options?: RegExpOptions): TRegExp; +/** `[JavaScript]` Creates a RegExp type */ +export declare function RegExp(regex: RegExp, options?: RegExpOptions): TRegExp; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.js new file mode 100644 index 0000000..d80a2a6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/regexp/regexp.js @@ -0,0 +1,12 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RegExp = RegExp; +const type_1 = require("../create/type"); +const value_1 = require("../guard/value"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a RegExp type */ +function RegExp(unresolved, options) { + const expr = (0, value_1.IsString)(unresolved) ? new globalThis.RegExp(unresolved) : unresolved; + return (0, type_1.CreateType)({ [index_1.Kind]: 'RegExp', type: 'RegExp', source: expr.source, flags: expr.flags }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.d.ts new file mode 100644 index 0000000..6e7e222 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.d.ts @@ -0,0 +1,13 @@ +export type FormatRegistryValidationFunction = (value: string) => boolean; +/** Returns the entries in this registry */ +export declare function Entries(): Map; +/** Clears all user defined string formats */ +export declare function Clear(): void; +/** Deletes a registered format */ +export declare function Delete(format: string): boolean; +/** Returns true if the user defined string format exists */ +export declare function Has(format: string): boolean; +/** Sets a validation function for a user defined string format */ +export declare function Set(format: string, func: FormatRegistryValidationFunction): void; +/** Gets a validation function for a user defined string format */ +export declare function Get(format: string): FormatRegistryValidationFunction | undefined; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.js new file mode 100644 index 0000000..78a09f5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/format.js @@ -0,0 +1,35 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Entries = Entries; +exports.Clear = Clear; +exports.Delete = Delete; +exports.Has = Has; +exports.Set = Set; +exports.Get = Get; +/** A registry for user defined string formats */ +const map = new Map(); +/** Returns the entries in this registry */ +function Entries() { + return new Map(map); +} +/** Clears all user defined string formats */ +function Clear() { + return map.clear(); +} +/** Deletes a registered format */ +function Delete(format) { + return map.delete(format); +} +/** Returns true if the user defined string format exists */ +function Has(format) { + return map.has(format); +} +/** Sets a validation function for a user defined string format */ +function Set(format, func) { + map.set(format, func); +} +/** Gets a validation function for a user defined string format */ +function Get(format) { + return map.get(format); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.d.ts new file mode 100644 index 0000000..ab1291d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.d.ts @@ -0,0 +1,2 @@ +export * as FormatRegistry from './format'; +export * as TypeRegistry from './type'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.js new file mode 100644 index 0000000..720e300 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/index.js @@ -0,0 +1,39 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypeRegistry = exports.FormatRegistry = void 0; +exports.FormatRegistry = __importStar(require("./format")); +exports.TypeRegistry = __importStar(require("./type")); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.d.ts new file mode 100644 index 0000000..504cec7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.d.ts @@ -0,0 +1,13 @@ +export type TypeRegistryValidationFunction = (schema: TSchema, value: unknown) => boolean; +/** Returns the entries in this registry */ +export declare function Entries(): Map>; +/** Clears all user defined types */ +export declare function Clear(): void; +/** Deletes a registered type */ +export declare function Delete(kind: string): boolean; +/** Returns true if this registry contains this kind */ +export declare function Has(kind: string): boolean; +/** Sets a validation function for a user defined type */ +export declare function Set(kind: string, func: TypeRegistryValidationFunction): void; +/** Gets a custom validation function for a user defined type */ +export declare function Get(kind: string): TypeRegistryValidationFunction | undefined; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.js new file mode 100644 index 0000000..d8b90d6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/registry/type.js @@ -0,0 +1,35 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Entries = Entries; +exports.Clear = Clear; +exports.Delete = Delete; +exports.Has = Has; +exports.Set = Set; +exports.Get = Get; +/** A registry for user defined types */ +const map = new Map(); +/** Returns the entries in this registry */ +function Entries() { + return new Map(map); +} +/** Clears all user defined types */ +function Clear() { + return map.clear(); +} +/** Deletes a registered type */ +function Delete(kind) { + return map.delete(kind); +} +/** Returns true if this registry contains this kind */ +function Has(kind) { + return map.has(kind); +} +/** Sets a validation function for a user defined type */ +function Set(kind, func) { + map.set(kind, func); +} +/** Gets a custom validation function for a user defined type */ +function Get(kind) { + return map.get(kind); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.d.ts new file mode 100644 index 0000000..74b2a46 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.d.ts @@ -0,0 +1,2 @@ +export * from './required-from-mapped-result'; +export * from './required'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.js new file mode 100644 index 0000000..5ec78c8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./required-from-mapped-result"), exports); +__exportStar(require("./required"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.d.ts new file mode 100644 index 0000000..12ca926 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.d.ts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index'; +import type { Ensure, Evaluate } from '../helpers/index'; +import type { TProperties } from '../object/index'; +import { type TMappedResult } from '../mapped/index'; +import { type TRequired } from './required'; +type TFromProperties

= ({ + [K2 in keyof P]: TRequired; +}); +type TFromMappedResult = (Evaluate>); +export type TRequiredFromMappedResult> = (Ensure>); +export declare function RequiredFromMappedResult>(R: R, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.js new file mode 100644 index 0000000..f403191 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required-from-mapped-result.js @@ -0,0 +1,22 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RequiredFromMappedResult = RequiredFromMappedResult; +const index_1 = require("../mapped/index"); +const required_1 = require("./required"); +// prettier-ignore +function FromProperties(P, options) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = (0, required_1.Required)(P[K2], options); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, options) { + return FromProperties(R.properties, options); +} +// prettier-ignore +function RequiredFromMappedResult(R, options) { + const P = FromMappedResult(R, options); + return (0, index_1.MappedResult)(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.d.ts new file mode 100644 index 0000000..02c854c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.d.ts @@ -0,0 +1,35 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Evaluate, Ensure } from '../helpers/index'; +import type { TMappedResult } from '../mapped/index'; +import { type TReadonlyOptional } from '../readonly-optional/index'; +import { type TComputed } from '../computed/index'; +import { type TOptional } from '../optional/index'; +import { type TReadonly } from '../readonly/index'; +import { type TRecursive } from '../recursive/index'; +import { type TObject, type TProperties } from '../object/index'; +import { type TIntersect } from '../intersect/index'; +import { type TUnion } from '../union/index'; +import { type TRef } from '../ref/index'; +import { type TBigInt } from '../bigint/index'; +import { type TBoolean } from '../boolean/index'; +import { type TInteger } from '../integer/index'; +import { type TLiteral } from '../literal/index'; +import { type TNull } from '../null/index'; +import { type TNumber } from '../number/index'; +import { type TString } from '../string/index'; +import { type TSymbol } from '../symbol/index'; +import { type TUndefined } from '../undefined/index'; +import { type TRequiredFromMappedResult } from './required-from-mapped-result'; +type TFromComputed = Ensure]>>; +type TFromRef = Ensure]>>; +type TFromProperties = Evaluate<{ + [K in keyof Properties]: Properties[K] extends (TReadonlyOptional) ? TReadonly : Properties[K] extends (TReadonly) ? TReadonly : Properties[K] extends (TOptional) ? S : Properties[K]; +}>; +type TFromObject<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TFromRest = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Result); +export type TRequired = (Type extends TRecursive ? TRecursive> : Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TObject ? TFromObject : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>); +/** `[Json]` Constructs a type where all properties are required */ +export declare function Required(type: MappedResult, options?: SchemaOptions): TRequiredFromMappedResult; +/** `[Json]` Constructs a type where all properties are required */ +export declare function Required(type: Type, options?: SchemaOptions): TRequired; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.js new file mode 100644 index 0000000..5dd4a6a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/required/required.js @@ -0,0 +1,110 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Required = Required; +const type_1 = require("../create/type"); +const index_1 = require("../computed/index"); +const index_2 = require("../object/index"); +const index_3 = require("../intersect/index"); +const index_4 = require("../union/index"); +const index_5 = require("../ref/index"); +const index_6 = require("../symbols/index"); +const index_7 = require("../discard/index"); +const required_from_mapped_result_1 = require("./required-from-mapped-result"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const KindGuard = __importStar(require("../guard/kind")); +// prettier-ignore +function FromComputed(target, parameters) { + return (0, index_1.Computed)('Required', [(0, index_1.Computed)(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return (0, index_1.Computed)('Required', [(0, index_5.Ref)($ref)]); +} +// prettier-ignore +function FromProperties(properties) { + const requiredProperties = {}; + for (const K of globalThis.Object.getOwnPropertyNames(properties)) + requiredProperties[K] = (0, index_7.Discard)(properties[K], [index_6.OptionalKind]); + return requiredProperties; +} +// prettier-ignore +function FromObject(type, properties) { + const options = (0, index_7.Discard)(type, [index_6.TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties); + return (0, index_2.Object)(mappedProperties, options); +} +// prettier-ignore +function FromRest(types) { + return types.map(type => RequiredResolve(type)); +} +// ------------------------------------------------------------------ +// RequiredResolve +// ------------------------------------------------------------------ +// prettier-ignore +function RequiredResolve(type) { + return ( + // Mappable + KindGuard.IsComputed(type) ? FromComputed(type.target, type.parameters) : + KindGuard.IsRef(type) ? FromRef(type.$ref) : + KindGuard.IsIntersect(type) ? (0, index_3.Intersect)(FromRest(type.allOf)) : + KindGuard.IsUnion(type) ? (0, index_4.Union)(FromRest(type.anyOf)) : + KindGuard.IsObject(type) ? FromObject(type, type.properties) : + // Intrinsic + KindGuard.IsBigInt(type) ? type : + KindGuard.IsBoolean(type) ? type : + KindGuard.IsInteger(type) ? type : + KindGuard.IsLiteral(type) ? type : + KindGuard.IsNull(type) ? type : + KindGuard.IsNumber(type) ? type : + KindGuard.IsString(type) ? type : + KindGuard.IsSymbol(type) ? type : + KindGuard.IsUndefined(type) ? type : + // Passthrough + (0, index_2.Object)({})); +} +/** `[Json]` Constructs a type where all properties are required */ +function Required(type, options) { + if (KindGuard.IsMappedResult(type)) { + return (0, required_from_mapped_result_1.RequiredFromMappedResult)(type, options); + } + else { + // special: mapping types require overridable options + return (0, type_1.CreateType)({ ...RequiredResolve(type), ...options }); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.d.ts new file mode 100644 index 0000000..48a8ca0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.d.ts @@ -0,0 +1 @@ +export * from './rest'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.js new file mode 100644 index 0000000..2693649 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./rest"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.d.ts new file mode 100644 index 0000000..c49673b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.d.ts @@ -0,0 +1,10 @@ +import type { TSchema } from '../schema/index'; +import type { TIntersect } from '../intersect/index'; +import type { TUnion } from '../union/index'; +import type { TTuple } from '../tuple/index'; +type TRestResolve = T extends TIntersect ? S : T extends TUnion ? S : T extends TTuple ? S : [ +]; +export type TRest = TRestResolve; +/** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ +export declare function Rest(T: T): TRest; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.js new file mode 100644 index 0000000..750b3fc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/rest/rest.js @@ -0,0 +1,19 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Rest = Rest; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function RestResolve(T) { + return ((0, kind_1.IsIntersect)(T) ? T.allOf : + (0, kind_1.IsUnion)(T) ? T.anyOf : + (0, kind_1.IsTuple)(T) ? T.items ?? [] : + []); +} +/** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ +function Rest(T) { + return RestResolve(T); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.d.ts new file mode 100644 index 0000000..7c68223 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.d.ts @@ -0,0 +1 @@ +export * from './return-type'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.js new file mode 100644 index 0000000..0f04f36 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./return-type"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.d.ts new file mode 100644 index 0000000..f8b2be4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.d.ts @@ -0,0 +1,6 @@ +import { type TSchema, type SchemaOptions } from '../schema/index'; +import { type TFunction } from '../function/index'; +import { type TNever } from '../never/index'; +export type TReturnType ? ReturnType : TNever> = Result; +/** `[JavaScript]` Extracts the ReturnType from the given Function type */ +export declare function ReturnType(schema: Type, options?: SchemaOptions): TReturnType; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.js new file mode 100644 index 0000000..3f776ab --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/return-type/return-type.js @@ -0,0 +1,44 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReturnType = ReturnType; +const type_1 = require("../create/type"); +const index_1 = require("../never/index"); +const KindGuard = __importStar(require("../guard/kind")); +/** `[JavaScript]` Extracts the ReturnType from the given Function type */ +function ReturnType(schema, options) { + return (KindGuard.IsFunction(schema) ? (0, type_1.CreateType)(schema.returns, options) : (0, index_1.Never)(options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.d.ts new file mode 100644 index 0000000..0aa119e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.d.ts @@ -0,0 +1,33 @@ +import type { TAny } from '../any/index'; +import type { TArray } from '../array/index'; +import type { TAsyncIterator } from '../async-iterator/index'; +import type { TBigInt } from '../bigint/index'; +import type { TBoolean } from '../boolean/index'; +import type { TConstructor } from '../constructor/index'; +import type { TDate } from '../date/index'; +import type { TEnum } from '../enum/index'; +import type { TFunction } from '../function/index'; +import type { TInteger } from '../integer/index'; +import type { TIntersect } from '../intersect/index'; +import type { TIterator } from '../iterator/index'; +import type { TLiteral } from '../literal/index'; +import type { TNot } from '../not/index'; +import type { TNull } from '../null/index'; +import type { TNumber } from '../number/index'; +import type { TObject } from '../object/index'; +import type { TPromise } from '../promise/index'; +import type { TRecord } from '../record/index'; +import type { TThis } from '../recursive/index'; +import type { TRef } from '../ref/index'; +import type { TRegExp } from '../regexp/index'; +import type { TString } from '../string/index'; +import type { TSymbol } from '../symbol/index'; +import type { TTemplateLiteral } from '../template-literal/index'; +import type { TTuple } from '../tuple/index'; +import type { TUint8Array } from '../uint8array/index'; +import type { TUndefined } from '../undefined/index'; +import type { TUnion } from '../union/index'; +import type { TUnknown } from '../unknown/index'; +import type { TVoid } from '../void/index'; +import type { TSchema } from './schema'; +export type TAnySchema = TSchema | TAny | TArray | TAsyncIterator | TBigInt | TBoolean | TConstructor | TDate | TEnum | TFunction | TInteger | TIntersect | TIterator | TLiteral | TNot | TNull | TNumber | TObject | TPromise | TRecord | TRef | TRegExp | TString | TSymbol | TTemplateLiteral | TThis | TTuple | TUndefined | TUnion | TUint8Array | TUnknown | TVoid; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.js new file mode 100644 index 0000000..dc999c1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/anyschema.js @@ -0,0 +1,3 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.d.ts new file mode 100644 index 0000000..62a8578 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.d.ts @@ -0,0 +1,2 @@ +export * from './anyschema'; +export * from './schema'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.js new file mode 100644 index 0000000..3381bb9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/index.js @@ -0,0 +1,19 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./anyschema"), exports); +__exportStar(require("./schema"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.d.ts new file mode 100644 index 0000000..57e2e68 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.d.ts @@ -0,0 +1,29 @@ +import { Kind, Hint, ReadonlyKind, OptionalKind } from '../symbols/index'; +export interface SchemaOptions { + $schema?: string; + /** Id for this schema */ + $id?: string; + /** Title of this schema */ + title?: string; + /** Description of this schema */ + description?: string; + /** Default value for this schema */ + default?: any; + /** Example values matching this schema */ + examples?: any; + /** Optional annotation for readOnly */ + readOnly?: boolean; + /** Optional annotation for writeOnly */ + writeOnly?: boolean; + [prop: string]: any; +} +export interface TKind { + [Kind]: string; +} +export interface TSchema extends TKind, SchemaOptions { + [ReadonlyKind]?: string; + [OptionalKind]?: string; + [Hint]?: string; + params: unknown[]; + static: unknown; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.js new file mode 100644 index 0000000..aca9239 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/schema/schema.js @@ -0,0 +1,4 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const index_1 = require("../symbols/index"); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.d.ts new file mode 100644 index 0000000..cd406b2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.d.ts @@ -0,0 +1 @@ +export * from './set'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.js new file mode 100644 index 0000000..5dec05e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./set"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.d.ts new file mode 100644 index 0000000..11d704c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.d.ts @@ -0,0 +1,28 @@ +export type TSetIncludes = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? S extends L ? true : TSetIncludes : false); +/** Returns true if element right is in the set of left */ +export declare function SetIncludes(T: [...T], S: S): TSetIncludes; +export type TSetIsSubset = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends true ? TSetIsSubset : false : true); +/** Returns true if left is a subset of right */ +export declare function SetIsSubset(T: [...T], S: [...S]): TSetIsSubset; +export type TSetDistinct = T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends false ? TSetDistinct : TSetDistinct : Acc; +/** Returns a distinct set of elements */ +export declare function SetDistinct(T: [...T]): TSetDistinct; +export type TSetIntersect = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends true ? TSetIntersect : TSetIntersect : Acc); +/** Returns the Intersect of the given sets */ +export declare function SetIntersect(T: [...T], S: [...S]): TSetIntersect; +export type TSetUnion = ([ + ...T, + ...S +]); +/** Returns the Union of the given sets */ +export declare function SetUnion(T: [...T], S: [...S]): TSetUnion; +export type TSetComplement = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends true ? TSetComplement : TSetComplement : Acc); +/** Returns the Complement by omitting elements in T that are in S */ +export declare function SetComplement(T: [...T], S: [...S]): TSetComplement; +type TSetIntersectManyResolve = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve> : Acc); +export type TSetIntersectMany = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve : []); +export declare function SetIntersectMany(T: [...T]): TSetIntersectMany; +export type TSetUnionMany = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetUnionMany> : Acc); +/** Returns the Union of multiple sets */ +export declare function SetUnionMany(T: [...T]): TSetUnionMany; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.js new file mode 100644 index 0000000..4d4743f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/sets/set.js @@ -0,0 +1,59 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SetIncludes = SetIncludes; +exports.SetIsSubset = SetIsSubset; +exports.SetDistinct = SetDistinct; +exports.SetIntersect = SetIntersect; +exports.SetUnion = SetUnion; +exports.SetComplement = SetComplement; +exports.SetIntersectMany = SetIntersectMany; +exports.SetUnionMany = SetUnionMany; +/** Returns true if element right is in the set of left */ +// prettier-ignore +function SetIncludes(T, S) { + return T.includes(S); +} +/** Returns true if left is a subset of right */ +function SetIsSubset(T, S) { + return T.every((L) => SetIncludes(S, L)); +} +/** Returns a distinct set of elements */ +function SetDistinct(T) { + return [...new Set(T)]; +} +/** Returns the Intersect of the given sets */ +function SetIntersect(T, S) { + return T.filter((L) => S.includes(L)); +} +/** Returns the Union of the given sets */ +function SetUnion(T, S) { + return [...T, ...S]; +} +/** Returns the Complement by omitting elements in T that are in S */ +// prettier-ignore +function SetComplement(T, S) { + return T.filter(L => !S.includes(L)); +} +// prettier-ignore +function SetIntersectManyResolve(T, Init) { + return T.reduce((Acc, L) => { + return SetIntersect(Acc, L); + }, Init); +} +// prettier-ignore +function SetIntersectMany(T) { + return (T.length === 1 + ? T[0] + // Use left to initialize the accumulator for resolve + : T.length > 1 + ? SetIntersectManyResolve(T.slice(1), T[0]) + : []); +} +/** Returns the Union of multiple sets */ +function SetUnionMany(T) { + const Acc = []; + for (const L of T) + Acc.push(...L); + return Acc; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.d.ts new file mode 100644 index 0000000..26c827f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.d.ts @@ -0,0 +1 @@ +export * from './static'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.js new file mode 100644 index 0000000..3e9cc86 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./static"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.d.ts new file mode 100644 index 0000000..a1242ba --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.d.ts @@ -0,0 +1,39 @@ +import type { Evaluate } from '../helpers/index'; +import type { TOptional } from '../optional/index'; +import type { TReadonly } from '../readonly/index'; +import type { TArray } from '../array/index'; +import type { TAsyncIterator } from '../async-iterator/index'; +import type { TConstructor } from '../constructor/index'; +import type { TEnum } from '../enum/index'; +import type { TFunction } from '../function/index'; +import type { TIntersect } from '../intersect/index'; +import type { TImport } from '../module/index'; +import type { TIterator } from '../iterator/index'; +import type { TNot } from '../not/index'; +import type { TObject, TProperties } from '../object/index'; +import type { TPromise } from '../promise/index'; +import type { TRecursive } from '../recursive/index'; +import type { TRecord } from '../record/index'; +import type { TRef } from '../ref/index'; +import type { TTuple } from '../tuple/index'; +import type { TUnion } from '../union/index'; +import type { TUnsafe } from '../unsafe/index'; +import type { TSchema } from '../schema/index'; +import type { TTransform } from '../transform/index'; +import type { TNever } from '../never/index'; +type TDecodeImport = (Key extends keyof ModuleProperties ? TDecodeType extends infer Type extends TSchema ? Type extends TRef ? TDecodeImport : Type : TNever : TNever); +type TDecodeProperties = { + [Key in keyof Properties]: TDecodeType; +}; +type TDecodeTypes = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TDecodeTypes]> : Result); +export type TDecodeType = (Type extends TOptional ? TOptional> : Type extends TReadonly ? TReadonly> : Type extends TTransform ? TUnsafe : Type extends TArray ? TArray> : Type extends TAsyncIterator ? TAsyncIterator> : Type extends TConstructor ? TConstructor, TDecodeType> : Type extends TEnum ? TEnum : Type extends TFunction ? TFunction, TDecodeType> : Type extends TIntersect ? TIntersect> : Type extends TImport ? TDecodeImport : Type extends TIterator ? TIterator> : Type extends TNot ? TNot> : Type extends TObject ? TObject>> : Type extends TPromise ? TPromise> : Type extends TRecord ? TRecord> : Type extends TRecursive ? TRecursive> : Type extends TRef ? TRef : Type extends TTuple ? TTuple> : Type extends TUnion ? TUnion> : Type); +export type StaticDecodeIsAny = boolean extends (Type extends TSchema ? true : false) ? true : false; +/** Creates an decoded static type from a TypeBox type */ +export type StaticDecode extends true ? unknown : Static, Params>> = Result; +/** Creates an encoded static type from a TypeBox type */ +export type StaticEncode> = Result; +/** Creates a static type from a TypeBox type */ +export type Static = Result; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.js new file mode 100644 index 0000000..dc999c1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/static/static.js @@ -0,0 +1,3 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.d.ts new file mode 100644 index 0000000..57f9f48 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.d.ts @@ -0,0 +1 @@ +export * from './string'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.js new file mode 100644 index 0000000..320230d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./string"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.d.ts new file mode 100644 index 0000000..01127ee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.d.ts @@ -0,0 +1,25 @@ +import { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | ({} & string); +export type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string); +export interface StringOptions extends SchemaOptions { + /** The maximum string length */ + maxLength?: number; + /** The minimum string length */ + minLength?: number; + /** A regular expression pattern this string should match */ + pattern?: string; + /** A format this string should match */ + format?: StringFormatOption; + /** The content encoding for this string */ + contentEncoding?: StringContentEncodingOption; + /** The content media type for this string */ + contentMediaType?: string; +} +export interface TString extends TSchema, StringOptions { + [Kind]: 'String'; + static: string; + type: 'string'; +} +/** `[Json]` Creates a String type */ +export declare function String(options?: StringOptions): TString; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.js new file mode 100644 index 0000000..e50440b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/string/string.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.String = String; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a String type */ +function String(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'String', type: 'string' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.d.ts new file mode 100644 index 0000000..39ee91a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.d.ts @@ -0,0 +1 @@ +export * from './symbol'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.js new file mode 100644 index 0000000..b7e1a64 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./symbol"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.d.ts new file mode 100644 index 0000000..e5488ee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.d.ts @@ -0,0 +1,10 @@ +import { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export type TSymbolValue = string | number | undefined; +export interface TSymbol extends TSchema, SchemaOptions { + [Kind]: 'Symbol'; + static: symbol; + type: 'symbol'; +} +/** `[JavaScript]` Creates a Symbol type */ +export declare function Symbol(options?: SchemaOptions): TSymbol; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.js new file mode 100644 index 0000000..84c0fb9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbol/symbol.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Symbol = Symbol; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a Symbol type */ +function Symbol(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Symbol', type: 'symbol' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.d.ts new file mode 100644 index 0000000..c1c4b7b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.d.ts @@ -0,0 +1 @@ +export * from './symbols'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.js new file mode 100644 index 0000000..423576b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./symbols"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.d.ts new file mode 100644 index 0000000..2c0dad5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.d.ts @@ -0,0 +1,10 @@ +/** Symbol key applied to transform types */ +export declare const TransformKind: unique symbol; +/** Symbol key applied to readonly types */ +export declare const ReadonlyKind: unique symbol; +/** Symbol key applied to optional types */ +export declare const OptionalKind: unique symbol; +/** Symbol key applied to types */ +export declare const Hint: unique symbol; +/** Symbol key applied to types */ +export declare const Kind: unique symbol; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.js new file mode 100644 index 0000000..e264a78 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/symbols/symbols.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Kind = exports.Hint = exports.OptionalKind = exports.ReadonlyKind = exports.TransformKind = void 0; +/** Symbol key applied to transform types */ +exports.TransformKind = Symbol.for('TypeBox.Transform'); +/** Symbol key applied to readonly types */ +exports.ReadonlyKind = Symbol.for('TypeBox.Readonly'); +/** Symbol key applied to optional types */ +exports.OptionalKind = Symbol.for('TypeBox.Optional'); +/** Symbol key applied to types */ +exports.Hint = Symbol.for('TypeBox.Hint'); +/** Symbol key applied to types */ +exports.Kind = Symbol.for('TypeBox.Kind'); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.d.ts new file mode 100644 index 0000000..e38e308 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.d.ts @@ -0,0 +1,19 @@ +import { TypeBoxError } from '../error/index'; +import type { TTemplateLiteral, TTemplateLiteralKind } from './index'; +import type { TUnion } from '../union/index'; +import type { TString } from '../string/index'; +import type { TBoolean } from '../boolean/index'; +import type { TNumber } from '../number/index'; +import type { TInteger } from '../integer/index'; +import type { TBigInt } from '../bigint/index'; +import type { TLiteral } from '../literal/index'; +import type { Expression } from './parse'; +export declare class TemplateLiteralFiniteError extends TypeBoxError { +} +type TFromTemplateLiteralKind = T extends TTemplateLiteral ? TFromTemplateLiteralKinds : T extends TUnion ? TFromTemplateLiteralKinds : T extends TString ? false : T extends TNumber ? false : T extends TInteger ? false : T extends TBigInt ? false : T extends TBoolean ? true : T extends TLiteral ? true : false; +type TFromTemplateLiteralKinds = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? TFromTemplateLiteralKind extends false ? false : TFromTemplateLiteralKinds : true; +export declare function IsTemplateLiteralExpressionFinite(expression: Expression): boolean; +export type TIsTemplateLiteralFinite = T extends TTemplateLiteral ? TFromTemplateLiteralKinds : false; +/** Returns true if this TemplateLiteral resolves to a finite set of values */ +export declare function IsTemplateLiteralFinite(schema: T): boolean; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.js new file mode 100644 index 0000000..1cf2a25 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/finite.js @@ -0,0 +1,56 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateLiteralFiniteError = void 0; +exports.IsTemplateLiteralExpressionFinite = IsTemplateLiteralExpressionFinite; +exports.IsTemplateLiteralFinite = IsTemplateLiteralFinite; +const parse_1 = require("./parse"); +const index_1 = require("../error/index"); +// ------------------------------------------------------------------ +// TemplateLiteralFiniteError +// ------------------------------------------------------------------ +class TemplateLiteralFiniteError extends index_1.TypeBoxError { +} +exports.TemplateLiteralFiniteError = TemplateLiteralFiniteError; +// ------------------------------------------------------------------ +// IsTemplateLiteralFiniteCheck +// ------------------------------------------------------------------ +// prettier-ignore +function IsNumberExpression(expression) { + return (expression.type === 'or' && + expression.expr.length === 2 && + expression.expr[0].type === 'const' && + expression.expr[0].const === '0' && + expression.expr[1].type === 'const' && + expression.expr[1].const === '[1-9][0-9]*'); +} +// prettier-ignore +function IsBooleanExpression(expression) { + return (expression.type === 'or' && + expression.expr.length === 2 && + expression.expr[0].type === 'const' && + expression.expr[0].const === 'true' && + expression.expr[1].type === 'const' && + expression.expr[1].const === 'false'); +} +// prettier-ignore +function IsStringExpression(expression) { + return expression.type === 'const' && expression.const === '.*'; +} +// ------------------------------------------------------------------ +// IsTemplateLiteralExpressionFinite +// ------------------------------------------------------------------ +// prettier-ignore +function IsTemplateLiteralExpressionFinite(expression) { + return (IsNumberExpression(expression) || IsStringExpression(expression) ? false : + IsBooleanExpression(expression) ? true : + (expression.type === 'and') ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : + (expression.type === 'or') ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : + (expression.type === 'const') ? true : + (() => { throw new TemplateLiteralFiniteError(`Unknown expression type`); })()); +} +/** Returns true if this TemplateLiteral resolves to a finite set of values */ +function IsTemplateLiteralFinite(schema) { + const expression = (0, parse_1.TemplateLiteralParseExact)(schema.pattern); + return IsTemplateLiteralExpressionFinite(expression); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.d.ts new file mode 100644 index 0000000..da5d099 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.d.ts @@ -0,0 +1,21 @@ +import { TIsTemplateLiteralFinite } from './finite'; +import { TypeBoxError } from '../error/index'; +import type { Assert } from '../helpers/index'; +import type { TBoolean } from '../boolean/index'; +import type { TTemplateLiteral, TTemplateLiteralKind } from './index'; +import type { TLiteral, TLiteralValue } from '../literal/index'; +import type { Expression } from './parse'; +import type { TUnion } from '../union/index'; +export declare class TemplateLiteralGenerateError extends TypeBoxError { +} +type TStringReduceUnary = R extends [infer A extends string, ...infer B extends string[]] ? TStringReduceUnary : Acc; +type TStringReduceBinary = L extends [infer A extends string, ...infer B extends string[]] ? TStringReduceBinary]> : Acc; +type TStringReduceMany = T extends [infer L extends string[], infer R extends string[], ...infer Rest extends string[][]] ? TStringReduceMany<[TStringReduceBinary, ...Rest]> : T; +type TStringReduce> = 0 extends keyof O ? Assert : []; +type TFromTemplateLiteralUnionKinds = T extends [infer L extends TLiteral, ...infer R extends TLiteral[]] ? [`${L['const']}`, ...TFromTemplateLiteralUnionKinds] : []; +type TFromTemplateLiteralKinds = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? (L extends TTemplateLiteral ? TFromTemplateLiteralKinds<[...S, ...R], Acc> : L extends TLiteral ? TFromTemplateLiteralKinds : L extends TUnion ? TFromTemplateLiteralKinds]> : L extends TBoolean ? TFromTemplateLiteralKinds : Acc) : Acc; +export declare function TemplateLiteralExpressionGenerate(expression: Expression): IterableIterator; +export type TTemplateLiteralGenerate> = F extends true ? (T extends TTemplateLiteral ? TFromTemplateLiteralKinds extends infer R extends string[][] ? TStringReduce : [] : []) : []; +/** Generates a tuple of strings from the given TemplateLiteral. Returns an empty tuple if infinite. */ +export declare function TemplateLiteralGenerate(schema: T): TTemplateLiteralGenerate; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.js new file mode 100644 index 0000000..3c591fb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/generate.js @@ -0,0 +1,60 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateLiteralGenerateError = void 0; +exports.TemplateLiteralExpressionGenerate = TemplateLiteralExpressionGenerate; +exports.TemplateLiteralGenerate = TemplateLiteralGenerate; +const finite_1 = require("./finite"); +const parse_1 = require("./parse"); +const index_1 = require("../error/index"); +// ------------------------------------------------------------------ +// TemplateLiteralGenerateError +// ------------------------------------------------------------------ +class TemplateLiteralGenerateError extends index_1.TypeBoxError { +} +exports.TemplateLiteralGenerateError = TemplateLiteralGenerateError; +// ------------------------------------------------------------------ +// TemplateLiteralExpressionGenerate +// ------------------------------------------------------------------ +// prettier-ignore +function* GenerateReduce(buffer) { + if (buffer.length === 1) + return yield* buffer[0]; + for (const left of buffer[0]) { + for (const right of GenerateReduce(buffer.slice(1))) { + yield `${left}${right}`; + } + } +} +// prettier-ignore +function* GenerateAnd(expression) { + return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)])); +} +// prettier-ignore +function* GenerateOr(expression) { + for (const expr of expression.expr) + yield* TemplateLiteralExpressionGenerate(expr); +} +// prettier-ignore +function* GenerateConst(expression) { + return yield expression.const; +} +function* TemplateLiteralExpressionGenerate(expression) { + return expression.type === 'and' + ? yield* GenerateAnd(expression) + : expression.type === 'or' + ? yield* GenerateOr(expression) + : expression.type === 'const' + ? yield* GenerateConst(expression) + : (() => { + throw new TemplateLiteralGenerateError('Unknown expression'); + })(); +} +/** Generates a tuple of strings from the given TemplateLiteral. Returns an empty tuple if infinite. */ +function TemplateLiteralGenerate(schema) { + const expression = (0, parse_1.TemplateLiteralParseExact)(schema.pattern); + // prettier-ignore + return ((0, finite_1.IsTemplateLiteralExpressionFinite)(expression) + ? [...TemplateLiteralExpressionGenerate(expression)] + : []); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.d.ts new file mode 100644 index 0000000..83f0ab9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.d.ts @@ -0,0 +1,7 @@ +export * from './finite'; +export * from './generate'; +export * from './syntax'; +export * from './parse'; +export * from './pattern'; +export * from './union'; +export * from './template-literal'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.js new file mode 100644 index 0000000..12003fa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/index.js @@ -0,0 +1,24 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./finite"), exports); +__exportStar(require("./generate"), exports); +__exportStar(require("./syntax"), exports); +__exportStar(require("./parse"), exports); +__exportStar(require("./pattern"), exports); +__exportStar(require("./union"), exports); +__exportStar(require("./template-literal"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.d.ts new file mode 100644 index 0000000..585232a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.d.ts @@ -0,0 +1,20 @@ +import { TypeBoxError } from '../error/index'; +export declare class TemplateLiteralParserError extends TypeBoxError { +} +export type Expression = ExpressionAnd | ExpressionOr | ExpressionConst; +export type ExpressionConst = { + type: 'const'; + const: string; +}; +export type ExpressionAnd = { + type: 'and'; + expr: Expression[]; +}; +export type ExpressionOr = { + type: 'or'; + expr: Expression[]; +}; +/** Parses a pattern and returns an expression tree */ +export declare function TemplateLiteralParse(pattern: string): Expression; +/** Parses a pattern and strips forward and trailing ^ and $ */ +export declare function TemplateLiteralParseExact(pattern: string): Expression; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.js new file mode 100644 index 0000000..b1e1fa1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/parse.js @@ -0,0 +1,174 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateLiteralParserError = void 0; +exports.TemplateLiteralParse = TemplateLiteralParse; +exports.TemplateLiteralParseExact = TemplateLiteralParseExact; +const index_1 = require("../error/index"); +// ------------------------------------------------------------------ +// TemplateLiteralParserError +// ------------------------------------------------------------------ +class TemplateLiteralParserError extends index_1.TypeBoxError { +} +exports.TemplateLiteralParserError = TemplateLiteralParserError; +// ------------------------------------------------------------------- +// Unescape +// +// Unescape for these control characters specifically. Note that this +// function is only called on non union group content, and where we +// still want to allow the user to embed control characters in that +// content. For review. +// ------------------------------------------------------------------- +// prettier-ignore +function Unescape(pattern) { + return pattern + .replace(/\\\$/g, '$') + .replace(/\\\*/g, '*') + .replace(/\\\^/g, '^') + .replace(/\\\|/g, '|') + .replace(/\\\(/g, '(') + .replace(/\\\)/g, ')'); +} +// ------------------------------------------------------------------- +// Control Characters +// ------------------------------------------------------------------- +function IsNonEscaped(pattern, index, char) { + return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92; +} +function IsOpenParen(pattern, index) { + return IsNonEscaped(pattern, index, '('); +} +function IsCloseParen(pattern, index) { + return IsNonEscaped(pattern, index, ')'); +} +function IsSeparator(pattern, index) { + return IsNonEscaped(pattern, index, '|'); +} +// ------------------------------------------------------------------- +// Control Groups +// ------------------------------------------------------------------- +function IsGroup(pattern) { + if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1))) + return false; + let count = 0; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + count += 1; + if (IsCloseParen(pattern, index)) + count -= 1; + if (count === 0 && index !== pattern.length - 1) + return false; + } + return true; +} +// prettier-ignore +function InGroup(pattern) { + return pattern.slice(1, pattern.length - 1); +} +// prettier-ignore +function IsPrecedenceOr(pattern) { + let count = 0; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + count += 1; + if (IsCloseParen(pattern, index)) + count -= 1; + if (IsSeparator(pattern, index) && count === 0) + return true; + } + return false; +} +// prettier-ignore +function IsPrecedenceAnd(pattern) { + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + return true; + } + return false; +} +// prettier-ignore +function Or(pattern) { + let [count, start] = [0, 0]; + const expressions = []; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + count += 1; + if (IsCloseParen(pattern, index)) + count -= 1; + if (IsSeparator(pattern, index) && count === 0) { + const range = pattern.slice(start, index); + if (range.length > 0) + expressions.push(TemplateLiteralParse(range)); + start = index + 1; + } + } + const range = pattern.slice(start); + if (range.length > 0) + expressions.push(TemplateLiteralParse(range)); + if (expressions.length === 0) + return { type: 'const', const: '' }; + if (expressions.length === 1) + return expressions[0]; + return { type: 'or', expr: expressions }; +} +// prettier-ignore +function And(pattern) { + function Group(value, index) { + if (!IsOpenParen(value, index)) + throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`); + let count = 0; + for (let scan = index; scan < value.length; scan++) { + if (IsOpenParen(value, scan)) + count += 1; + if (IsCloseParen(value, scan)) + count -= 1; + if (count === 0) + return [index, scan]; + } + throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`); + } + function Range(pattern, index) { + for (let scan = index; scan < pattern.length; scan++) { + if (IsOpenParen(pattern, scan)) + return [index, scan]; + } + return [index, pattern.length]; + } + const expressions = []; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) { + const [start, end] = Group(pattern, index); + const range = pattern.slice(start, end + 1); + expressions.push(TemplateLiteralParse(range)); + index = end; + } + else { + const [start, end] = Range(pattern, index); + const range = pattern.slice(start, end); + if (range.length > 0) + expressions.push(TemplateLiteralParse(range)); + index = end - 1; + } + } + return ((expressions.length === 0) ? { type: 'const', const: '' } : + (expressions.length === 1) ? expressions[0] : + { type: 'and', expr: expressions }); +} +// ------------------------------------------------------------------ +// TemplateLiteralParse +// ------------------------------------------------------------------ +/** Parses a pattern and returns an expression tree */ +function TemplateLiteralParse(pattern) { + // prettier-ignore + return (IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : + IsPrecedenceOr(pattern) ? Or(pattern) : + IsPrecedenceAnd(pattern) ? And(pattern) : + { type: 'const', const: Unescape(pattern) }); +} +// ------------------------------------------------------------------ +// TemplateLiteralParseExact +// ------------------------------------------------------------------ +/** Parses a pattern and strips forward and trailing ^ and $ */ +function TemplateLiteralParseExact(pattern) { + return TemplateLiteralParse(pattern.slice(1, pattern.length - 1)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.d.ts new file mode 100644 index 0000000..3ce97e4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.d.ts @@ -0,0 +1,5 @@ +import type { TTemplateLiteralKind } from './index'; +import { TypeBoxError } from '../error/index'; +export declare class TemplateLiteralPatternError extends TypeBoxError { +} +export declare function TemplateLiteralPattern(kinds: TTemplateLiteralKind[]): string; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.js new file mode 100644 index 0000000..6e75a54 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/pattern.js @@ -0,0 +1,39 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateLiteralPatternError = void 0; +exports.TemplateLiteralPattern = TemplateLiteralPattern; +const index_1 = require("../patterns/index"); +const index_2 = require("../symbols/index"); +const index_3 = require("../error/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// ------------------------------------------------------------------ +// TemplateLiteralPatternError +// ------------------------------------------------------------------ +class TemplateLiteralPatternError extends index_3.TypeBoxError { +} +exports.TemplateLiteralPatternError = TemplateLiteralPatternError; +// ------------------------------------------------------------------ +// TemplateLiteralPattern +// ------------------------------------------------------------------ +function Escape(value) { + return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} +// prettier-ignore +function Visit(schema, acc) { + return ((0, kind_1.IsTemplateLiteral)(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : + (0, kind_1.IsUnion)(schema) ? `(${schema.anyOf.map((schema) => Visit(schema, acc)).join('|')})` : + (0, kind_1.IsNumber)(schema) ? `${acc}${index_1.PatternNumber}` : + (0, kind_1.IsInteger)(schema) ? `${acc}${index_1.PatternNumber}` : + (0, kind_1.IsBigInt)(schema) ? `${acc}${index_1.PatternNumber}` : + (0, kind_1.IsString)(schema) ? `${acc}${index_1.PatternString}` : + (0, kind_1.IsLiteral)(schema) ? `${acc}${Escape(schema.const.toString())}` : + (0, kind_1.IsBoolean)(schema) ? `${acc}${index_1.PatternBoolean}` : + (() => { throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[index_2.Kind]}'`); })()); +} +function TemplateLiteralPattern(kinds) { + return `^${kinds.map((schema) => Visit(schema, '')).join('')}\$`; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.d.ts new file mode 100644 index 0000000..b52e8ac --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.d.ts @@ -0,0 +1,20 @@ +import type { Assert, Trim } from '../helpers/index'; +import type { TTemplateLiteral, TTemplateLiteralKind } from './index'; +import { type TLiteral } from '../literal/index'; +import { type TBoolean } from '../boolean/index'; +import { type TBigInt } from '../bigint/index'; +import { type TNumber } from '../number/index'; +import { type TString } from '../string/index'; +import { type TUnionEvaluated } from '../union/index'; +declare function FromUnion(syntax: string): IterableIterator; +declare function FromTerminal(syntax: string): IterableIterator; +type FromUnionLiteral = T extends `${infer L}|${infer R}` ? [TLiteral>, ...FromUnionLiteral] : T extends `${infer L}` ? [TLiteral>] : [ +]; +type FromUnion = TUnionEvaluated>; +type FromTerminal = T extends 'boolean' ? TBoolean : T extends 'bigint' ? TBigInt : T extends 'number' ? TNumber : T extends 'string' ? TString : FromUnion; +type FromString = T extends `{${infer L}}${infer R}` ? [FromTerminal, ...FromString] : T extends `${infer L}$\{${infer R1}\}${infer R2}` ? [TLiteral, ...FromString<`{${R1}}`>, ...FromString] : T extends `${infer L}$\{${infer R1}\}` ? [TLiteral, ...FromString<`{${R1}}`>] : T extends `${infer L}` ? [TLiteral] : [ +]; +export type TTemplateLiteralSyntax = (TTemplateLiteral, TTemplateLiteralKind[]>>); +/** Parses TemplateLiteralSyntax and returns a tuple of TemplateLiteralKinds */ +export declare function TemplateLiteralSyntax(syntax: string): TTemplateLiteralKind[]; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.js new file mode 100644 index 0000000..f78b8af --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/syntax.js @@ -0,0 +1,59 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateLiteralSyntax = TemplateLiteralSyntax; +const index_1 = require("../literal/index"); +const index_2 = require("../boolean/index"); +const index_3 = require("../bigint/index"); +const index_4 = require("../number/index"); +const index_5 = require("../string/index"); +const index_6 = require("../union/index"); +const index_7 = require("../never/index"); +// ------------------------------------------------------------------ +// SyntaxParsers +// ------------------------------------------------------------------ +// prettier-ignore +function* FromUnion(syntax) { + const trim = syntax.trim().replace(/"|'/g, ''); + return (trim === 'boolean' ? yield (0, index_2.Boolean)() : + trim === 'number' ? yield (0, index_4.Number)() : + trim === 'bigint' ? yield (0, index_3.BigInt)() : + trim === 'string' ? yield (0, index_5.String)() : + yield (() => { + const literals = trim.split('|').map((literal) => (0, index_1.Literal)(literal.trim())); + return (literals.length === 0 ? (0, index_7.Never)() : + literals.length === 1 ? literals[0] : + (0, index_6.UnionEvaluated)(literals)); + })()); +} +// prettier-ignore +function* FromTerminal(syntax) { + if (syntax[1] !== '{') { + const L = (0, index_1.Literal)('$'); + const R = FromSyntax(syntax.slice(1)); + return yield* [L, ...R]; + } + for (let i = 2; i < syntax.length; i++) { + if (syntax[i] === '}') { + const L = FromUnion(syntax.slice(2, i)); + const R = FromSyntax(syntax.slice(i + 1)); + return yield* [...L, ...R]; + } + } + yield (0, index_1.Literal)(syntax); +} +// prettier-ignore +function* FromSyntax(syntax) { + for (let i = 0; i < syntax.length; i++) { + if (syntax[i] === '$') { + const L = (0, index_1.Literal)(syntax.slice(0, i)); + const R = FromTerminal(syntax.slice(i)); + return yield* [L, ...R]; + } + } + yield (0, index_1.Literal)(syntax); +} +/** Parses TemplateLiteralSyntax and returns a tuple of TemplateLiteralKinds */ +function TemplateLiteralSyntax(syntax) { + return [...FromSyntax(syntax)]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.d.ts new file mode 100644 index 0000000..d9ac951 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.d.ts @@ -0,0 +1,30 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Assert } from '../helpers/index'; +import type { TUnion } from '../union/index'; +import type { TLiteral } from '../literal/index'; +import type { TInteger } from '../integer/index'; +import type { TNumber } from '../number/index'; +import type { TBigInt } from '../bigint/index'; +import type { TString } from '../string/index'; +import type { TBoolean } from '../boolean/index'; +import type { TNever } from '../never/index'; +import type { Static } from '../static/index'; +import { type TTemplateLiteralSyntax } from './syntax'; +import { EmptyString } from '../helpers/index'; +import { Kind } from '../symbols/index'; +type TemplateLiteralStaticKind = T extends TUnion ? { + [K in keyof U]: TemplateLiteralStatic, Acc>; +}[number] : T extends TTemplateLiteral ? `${Static}` : T extends TLiteral ? `${U}` : T extends TString ? `${string}` : T extends TNumber ? `${number}` : T extends TBigInt ? `${bigint}` : T extends TBoolean ? `${boolean}` : never; +type TemplateLiteralStatic = T extends [infer L, ...infer R] ? `${TemplateLiteralStaticKind}${TemplateLiteralStatic, Acc>}` : Acc; +export type TTemplateLiteralKind = TTemplateLiteral | TUnion | TLiteral | TInteger | TNumber | TBigInt | TString | TBoolean | TNever; +export interface TTemplateLiteral extends TSchema { + [Kind]: 'TemplateLiteral'; + static: TemplateLiteralStatic; + type: 'string'; + pattern: string; +} +/** `[Json]` Creates a TemplateLiteral type from template dsl string */ +export declare function TemplateLiteral(syntax: T, options?: SchemaOptions): TTemplateLiteralSyntax; +/** `[Json]` Creates a TemplateLiteral type */ +export declare function TemplateLiteral(kinds: [...T], options?: SchemaOptions): TTemplateLiteral; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.js new file mode 100644 index 0000000..d785ec1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/template-literal.js @@ -0,0 +1,17 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateLiteral = TemplateLiteral; +const type_1 = require("../create/type"); +const syntax_1 = require("./syntax"); +const pattern_1 = require("./pattern"); +const value_1 = require("../guard/value"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a TemplateLiteral type */ +// prettier-ignore +function TemplateLiteral(unresolved, options) { + const pattern = (0, value_1.IsString)(unresolved) + ? (0, pattern_1.TemplateLiteralPattern)((0, syntax_1.TemplateLiteralSyntax)(unresolved)) + : (0, pattern_1.TemplateLiteralPattern)(unresolved); + return (0, type_1.CreateType)({ [index_1.Kind]: 'TemplateLiteral', type: 'string', pattern }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.d.ts new file mode 100644 index 0000000..66f8a61 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.d.ts @@ -0,0 +1,9 @@ +import type { Static } from '../static/index'; +import type { TTemplateLiteral } from './template-literal'; +import type { UnionToTuple } from '../helpers/index'; +import { type TUnionEvaluated } from '../union/index'; +import { type TLiteral } from '../literal/index'; +export type TTemplateLiteralToUnionLiteralArray = (T extends [infer L extends string, ...infer R extends string[]] ? TTemplateLiteralToUnionLiteralArray]> : Acc); +export type TTemplateLiteralToUnion>> = TUnionEvaluated>; +/** Returns a Union from the given TemplateLiteral */ +export declare function TemplateLiteralToUnion(schema: TTemplateLiteral): TTemplateLiteralToUnion; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.js new file mode 100644 index 0000000..fc66d12 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/template-literal/union.js @@ -0,0 +1,13 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateLiteralToUnion = TemplateLiteralToUnion; +const index_1 = require("../union/index"); +const index_2 = require("../literal/index"); +const generate_1 = require("./generate"); +/** Returns a Union from the given TemplateLiteral */ +function TemplateLiteralToUnion(schema) { + const R = (0, generate_1.TemplateLiteralGenerate)(schema); + const L = R.map((S) => (0, index_2.Literal)(S)); + return (0, index_1.UnionEvaluated)(L); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.d.ts new file mode 100644 index 0000000..d5e7ab1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.d.ts @@ -0,0 +1 @@ +export * from './transform'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.js new file mode 100644 index 0000000..ab77a47 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./transform"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.d.ts new file mode 100644 index 0000000..a3343c6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.d.ts @@ -0,0 +1,30 @@ +import type { TSchema } from '../schema/index'; +import type { Static, StaticDecode } from '../static/index'; +import { TransformKind } from '../symbols/index'; +export declare class TransformDecodeBuilder { + private readonly schema; + constructor(schema: T); + Decode, U>>(decode: D): TransformEncodeBuilder; +} +export declare class TransformEncodeBuilder { + private readonly schema; + private readonly decode; + constructor(schema: T, decode: D); + private EncodeTransform; + private EncodeSchema; + Encode, StaticDecode>>(encode: E): TTransform>; +} +type TransformStatic = T extends TTransform ? S : Static; +export type TransformFunction = (value: T) => U; +export interface TransformOptions { + Decode: TransformFunction, O>; + Encode: TransformFunction>; +} +export interface TTransform extends TSchema { + static: TransformStatic; + [TransformKind]: TransformOptions; + [key: string]: any; +} +/** `[Json]` Creates a Transform type */ +export declare function Transform(schema: I): TransformDecodeBuilder; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.js new file mode 100644 index 0000000..7fddc18 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/transform/transform.js @@ -0,0 +1,47 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TransformEncodeBuilder = exports.TransformDecodeBuilder = void 0; +exports.Transform = Transform; +const index_1 = require("../symbols/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// ------------------------------------------------------------------ +// TransformBuilders +// ------------------------------------------------------------------ +class TransformDecodeBuilder { + constructor(schema) { + this.schema = schema; + } + Decode(decode) { + return new TransformEncodeBuilder(this.schema, decode); + } +} +exports.TransformDecodeBuilder = TransformDecodeBuilder; +// prettier-ignore +class TransformEncodeBuilder { + constructor(schema, decode) { + this.schema = schema; + this.decode = decode; + } + EncodeTransform(encode, schema) { + const Encode = (value) => schema[index_1.TransformKind].Encode(encode(value)); + const Decode = (value) => this.decode(schema[index_1.TransformKind].Decode(value)); + const Codec = { Encode: Encode, Decode: Decode }; + return { ...schema, [index_1.TransformKind]: Codec }; + } + EncodeSchema(encode, schema) { + const Codec = { Decode: this.decode, Encode: encode }; + return { ...schema, [index_1.TransformKind]: Codec }; + } + Encode(encode) { + return ((0, kind_1.IsTransform)(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema)); + } +} +exports.TransformEncodeBuilder = TransformEncodeBuilder; +/** `[Json]` Creates a Transform type */ +function Transform(schema) { + return new TransformDecodeBuilder(schema); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.d.ts new file mode 100644 index 0000000..9bfe8c5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.d.ts @@ -0,0 +1 @@ +export * from './tuple'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.js new file mode 100644 index 0000000..216f273 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./tuple"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.d.ts new file mode 100644 index 0000000..c451773 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.d.ts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +type TupleStatic = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TupleStatic]> : Acc; +export interface TTuple extends TSchema { + [Kind]: 'Tuple'; + static: TupleStatic; + type: 'array'; + items: T; + additionalItems?: false; + minItems: T['length']; + maxItems: T['length']; +} +/** `[Json]` Creates a Tuple type */ +export declare function Tuple(types: [...Types], options?: SchemaOptions): TTuple; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.js new file mode 100644 index 0000000..b019581 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/tuple/tuple.js @@ -0,0 +1,13 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Tuple = Tuple; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a Tuple type */ +function Tuple(types, options) { + // prettier-ignore + return (0, type_1.CreateType)(types.length > 0 ? + { [index_1.Kind]: 'Tuple', type: 'array', items: types, additionalItems: false, minItems: types.length, maxItems: types.length } : + { [index_1.Kind]: 'Tuple', type: 'array', minItems: types.length, maxItems: types.length }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.d.ts new file mode 100644 index 0000000..f567d2a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.d.ts @@ -0,0 +1,6 @@ +export { JsonTypeBuilder } from './json'; +import { JavaScriptTypeBuilder } from './javascript'; +/** JavaScript Type Builder with Static Resolution for TypeScript */ +declare const Type: InstanceType; +export { JavaScriptTypeBuilder }; +export { Type }; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.js new file mode 100644 index 0000000..6e03859 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/index.js @@ -0,0 +1,51 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Type = exports.JavaScriptTypeBuilder = exports.JsonTypeBuilder = void 0; +// ------------------------------------------------------------------ +// JsonTypeBuilder +// ------------------------------------------------------------------ +var json_1 = require("./json"); +Object.defineProperty(exports, "JsonTypeBuilder", { enumerable: true, get: function () { return json_1.JsonTypeBuilder; } }); +// ------------------------------------------------------------------ +// JavaScriptTypeBuilder +// ------------------------------------------------------------------ +const TypeBuilder = __importStar(require("./type")); +const javascript_1 = require("./javascript"); +Object.defineProperty(exports, "JavaScriptTypeBuilder", { enumerable: true, get: function () { return javascript_1.JavaScriptTypeBuilder; } }); +/** JavaScript Type Builder with Static Resolution for TypeScript */ +const Type = TypeBuilder; +exports.Type = Type; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.d.ts new file mode 100644 index 0000000..6ccc80f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.d.ts @@ -0,0 +1,64 @@ +import { JsonTypeBuilder } from './json'; +import { type TArgument } from '../argument/index'; +import { type TAsyncIterator } from '../async-iterator/index'; +import { type TAwaited } from '../awaited/index'; +import { type TBigInt, type BigIntOptions } from '../bigint/index'; +import { type TConstructor } from '../constructor/index'; +import { type TConstructorParameters } from '../constructor-parameters/index'; +import { type TDate, type DateOptions } from '../date/index'; +import { type TFunction } from '../function/index'; +import { type TInstanceType } from '../instance-type/index'; +import { type TInstantiate } from '../instantiate/index'; +import { type TIterator } from '../iterator/index'; +import { type TParameters } from '../parameters/index'; +import { type TPromise } from '../promise/index'; +import { type TRegExp, RegExpOptions } from '../regexp/index'; +import { type TReturnType } from '../return-type/index'; +import { type TSchema, type SchemaOptions } from '../schema/index'; +import { type TSymbol } from '../symbol/index'; +import { type TUint8Array, type Uint8ArrayOptions } from '../uint8array/index'; +import { type TUndefined } from '../undefined/index'; +import { type TVoid } from '../void/index'; +/** JavaScript Type Builder with Static Resolution for TypeScript */ +export declare class JavaScriptTypeBuilder extends JsonTypeBuilder { + /** `[JavaScript]` Creates a Generic Argument Type */ + Argument(index: Index): TArgument; + /** `[JavaScript]` Creates a AsyncIterator type */ + AsyncIterator(items: Type, options?: SchemaOptions): TAsyncIterator; + /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ + Awaited(schema: Type, options?: SchemaOptions): TAwaited; + /** `[JavaScript]` Creates a BigInt type */ + BigInt(options?: BigIntOptions): TBigInt; + /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ + ConstructorParameters(schema: Type, options?: SchemaOptions): TConstructorParameters; + /** `[JavaScript]` Creates a Constructor type */ + Constructor(parameters: [...Parameters], instanceType: InstanceType, options?: SchemaOptions): TConstructor; + /** `[JavaScript]` Creates a Date type */ + Date(options?: DateOptions): TDate; + /** `[JavaScript]` Creates a Function type */ + Function(parameters: [...Parameters], returnType: ReturnType, options?: SchemaOptions): TFunction; + /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ + InstanceType(schema: Type, options?: SchemaOptions): TInstanceType; + /** `[JavaScript]` Instantiates a type with the given parameters */ + Instantiate(schema: Type, parameters: [...Parameters]): TInstantiate; + /** `[JavaScript]` Creates an Iterator type */ + Iterator(items: Type, options?: SchemaOptions): TIterator; + /** `[JavaScript]` Extracts the Parameters from the given Function type */ + Parameters(schema: Type, options?: SchemaOptions): TParameters; + /** `[JavaScript]` Creates a Promise type */ + Promise(item: Type, options?: SchemaOptions): TPromise; + /** `[JavaScript]` Creates a RegExp type */ + RegExp(pattern: string, options?: RegExpOptions): TRegExp; + /** `[JavaScript]` Creates a RegExp type */ + RegExp(regex: RegExp, options?: RegExpOptions): TRegExp; + /** `[JavaScript]` Extracts the ReturnType from the given Function type */ + ReturnType(type: Type, options?: SchemaOptions): TReturnType; + /** `[JavaScript]` Creates a Symbol type */ + Symbol(options?: SchemaOptions): TSymbol; + /** `[JavaScript]` Creates a Undefined type */ + Undefined(options?: SchemaOptions): TUndefined; + /** `[JavaScript]` Creates a Uint8Array type */ + Uint8Array(options?: Uint8ArrayOptions): TUint8Array; + /** `[JavaScript]` Creates a Void type */ + Void(options?: SchemaOptions): TVoid; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.js new file mode 100644 index 0000000..964879a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/javascript.js @@ -0,0 +1,104 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JavaScriptTypeBuilder = void 0; +const json_1 = require("./json"); +const index_1 = require("../argument/index"); +const index_2 = require("../async-iterator/index"); +const index_3 = require("../awaited/index"); +const index_4 = require("../bigint/index"); +const index_5 = require("../constructor/index"); +const index_6 = require("../constructor-parameters/index"); +const index_7 = require("../date/index"); +const index_8 = require("../function/index"); +const index_9 = require("../instance-type/index"); +const index_10 = require("../instantiate/index"); +const index_11 = require("../iterator/index"); +const index_12 = require("../parameters/index"); +const index_13 = require("../promise/index"); +const index_14 = require("../regexp/index"); +const index_15 = require("../return-type/index"); +const index_16 = require("../symbol/index"); +const index_17 = require("../uint8array/index"); +const index_18 = require("../undefined/index"); +const index_19 = require("../void/index"); +/** JavaScript Type Builder with Static Resolution for TypeScript */ +class JavaScriptTypeBuilder extends json_1.JsonTypeBuilder { + /** `[JavaScript]` Creates a Generic Argument Type */ + Argument(index) { + return (0, index_1.Argument)(index); + } + /** `[JavaScript]` Creates a AsyncIterator type */ + AsyncIterator(items, options) { + return (0, index_2.AsyncIterator)(items, options); + } + /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ + Awaited(schema, options) { + return (0, index_3.Awaited)(schema, options); + } + /** `[JavaScript]` Creates a BigInt type */ + BigInt(options) { + return (0, index_4.BigInt)(options); + } + /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ + ConstructorParameters(schema, options) { + return (0, index_6.ConstructorParameters)(schema, options); + } + /** `[JavaScript]` Creates a Constructor type */ + Constructor(parameters, instanceType, options) { + return (0, index_5.Constructor)(parameters, instanceType, options); + } + /** `[JavaScript]` Creates a Date type */ + Date(options = {}) { + return (0, index_7.Date)(options); + } + /** `[JavaScript]` Creates a Function type */ + Function(parameters, returnType, options) { + return (0, index_8.Function)(parameters, returnType, options); + } + /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ + InstanceType(schema, options) { + return (0, index_9.InstanceType)(schema, options); + } + /** `[JavaScript]` Instantiates a type with the given parameters */ + Instantiate(schema, parameters) { + return (0, index_10.Instantiate)(schema, parameters); + } + /** `[JavaScript]` Creates an Iterator type */ + Iterator(items, options) { + return (0, index_11.Iterator)(items, options); + } + /** `[JavaScript]` Extracts the Parameters from the given Function type */ + Parameters(schema, options) { + return (0, index_12.Parameters)(schema, options); + } + /** `[JavaScript]` Creates a Promise type */ + Promise(item, options) { + return (0, index_13.Promise)(item, options); + } + /** `[JavaScript]` Creates a RegExp type */ + RegExp(unresolved, options) { + return (0, index_14.RegExp)(unresolved, options); + } + /** `[JavaScript]` Extracts the ReturnType from the given Function type */ + ReturnType(type, options) { + return (0, index_15.ReturnType)(type, options); + } + /** `[JavaScript]` Creates a Symbol type */ + Symbol(options) { + return (0, index_16.Symbol)(options); + } + /** `[JavaScript]` Creates a Undefined type */ + Undefined(options) { + return (0, index_18.Undefined)(options); + } + /** `[JavaScript]` Creates a Uint8Array type */ + Uint8Array(options) { + return (0, index_17.Uint8Array)(options); + } + /** `[JavaScript]` Creates a Void type */ + Void(options) { + return (0, index_19.Void)(options); + } +} +exports.JavaScriptTypeBuilder = JavaScriptTypeBuilder; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.d.ts new file mode 100644 index 0000000..d7a70d5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.d.ts @@ -0,0 +1,208 @@ +import { type TAny } from '../any/index'; +import { type TArray, type ArrayOptions } from '../array/index'; +import { type TBoolean } from '../boolean/index'; +import { type TComposite } from '../composite/index'; +import { type TConst } from '../const/index'; +import { type TEnum, type TEnumKey, type TEnumValue } from '../enum/index'; +import { type TExclude, type TExcludeFromMappedResult, type TExcludeFromTemplateLiteral } from '../exclude/index'; +import { type TExtends, type TExtendsFromMappedKey, type TExtendsFromMappedResult } from '../extends/index'; +import { type TExtract, type TExtractFromMappedResult, type TExtractFromTemplateLiteral } from '../extract/index'; +import { TIndex, type TIndexPropertyKeys, type TIndexFromMappedKey, type TIndexFromMappedResult, type TIndexFromComputed } from '../indexed/index'; +import { type IntegerOptions, type TInteger } from '../integer/index'; +import { Intersect, type IntersectOptions } from '../intersect/index'; +import { type TCapitalize, type TUncapitalize, type TLowercase, type TUppercase } from '../intrinsic/index'; +import { type TKeyOf } from '../keyof/index'; +import { type TLiteral, type TLiteralValue } from '../literal/index'; +import { type TMappedFunction, type TMapped, type TMappedResult } from '../mapped/index'; +import { type TNever } from '../never/index'; +import { type TNot } from '../not/index'; +import { type TNull } from '../null/index'; +import { type TMappedKey } from '../mapped/index'; +import { TModule } from '../module/index'; +import { type TNumber, type NumberOptions } from '../number/index'; +import { type TObject, type TProperties, type ObjectOptions } from '../object/index'; +import { type TOmit } from '../omit/index'; +import { type TOptionalWithFlag, type TOptionalFromMappedResult } from '../optional/index'; +import { type TPartial, type TPartialFromMappedResult } from '../partial/index'; +import { type TPick } from '../pick/index'; +import { type TReadonlyWithFlag, type TReadonlyFromMappedResult } from '../readonly/index'; +import { type TReadonlyOptional } from '../readonly-optional/index'; +import { type TRecordOrObject } from '../record/index'; +import { type TRecursive, type TThis } from '../recursive/index'; +import { type TRef, type TRefUnsafe } from '../ref/index'; +import { type TRequired, type TRequiredFromMappedResult } from '../required/index'; +import { type TRest } from '../rest/index'; +import { type TSchema, type SchemaOptions } from '../schema/index'; +import { type TString, type StringOptions } from '../string/index'; +import { type TTemplateLiteral, type TTemplateLiteralKind, type TTemplateLiteralSyntax } from '../template-literal/index'; +import { TransformDecodeBuilder } from '../transform/index'; +import { type TTuple } from '../tuple/index'; +import { Union } from '../union/index'; +import { type TUnknown } from '../unknown/index'; +import { type TUnsafe, type UnsafeOptions } from '../unsafe/index'; +/** Json Type Builder with Static Resolution for TypeScript */ +export declare class JsonTypeBuilder { + /** `[Json]` Creates a Readonly and Optional property */ + ReadonlyOptional(type: Type): TReadonlyOptional; + /** `[Json]` Creates a Readonly property */ + Readonly(type: Type, enable: Flag): TReadonlyFromMappedResult; + /** `[Json]` Creates a Readonly property */ + Readonly(type: Type, enable: Flag): TReadonlyWithFlag; + /** `[Json]` Creates a Optional property */ + Readonly(type: Type): TReadonlyFromMappedResult; + /** `[Json]` Creates a Readonly property */ + Readonly(type: Type): TReadonlyWithFlag; + /** `[Json]` Creates a Optional property */ + Optional(type: Type, enable: Flag): TOptionalFromMappedResult; + /** `[Json]` Creates a Optional property */ + Optional(type: Type, enable: Flag): TOptionalWithFlag; + /** `[Json]` Creates a Optional property */ + Optional(type: Type): TOptionalFromMappedResult; + /** `[Json]` Creates a Optional property */ + Optional(type: Type): TOptionalWithFlag; + /** `[Json]` Creates an Any type */ + Any(options?: SchemaOptions): TAny; + /** `[Json]` Creates an Array type */ + Array(items: Type, options?: ArrayOptions): TArray; + /** `[Json]` Creates a Boolean type */ + Boolean(options?: SchemaOptions): TBoolean; + /** `[Json]` Intrinsic function to Capitalize LiteralString types */ + Capitalize(schema: T, options?: SchemaOptions): TCapitalize; + /** `[Json]` Creates a Composite object type */ + Composite(schemas: [...T], options?: ObjectOptions): TComposite; + /** `[JavaScript]` Creates a readonly const type from the given value. */ + Const(value: T, options?: SchemaOptions): TConst; + /** `[Json]` Creates a Enum type */ + Enum>(item: T, options?: SchemaOptions): TEnum; + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult; + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromTemplateLiteral; + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude; + /** `[Json]` Creates a Conditional type */ + Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult; + /** `[Json]` Creates a Conditional type */ + Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey; + /** `[Json]` Creates a Conditional type */ + Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends; + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult; + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type: L, union: R, options?: SchemaOptions): TExtractFromTemplateLiteral; + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type: L, union: R, options?: SchemaOptions): TExtract; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TIndexFromMappedKey; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index>(T: Type, K: Key, options?: SchemaOptions): TIndex; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, propertyKeys: readonly [...PropertyKeys], options?: SchemaOptions): TIndex; + /** `[Json]` Creates an Integer type */ + Integer(options?: IntegerOptions): TInteger; + /** `[Json]` Creates an Intersect type */ + Intersect(types: [...Types], options?: IntersectOptions): Intersect; + /** `[Json]` Creates a KeyOf type */ + KeyOf(type: Type, options?: SchemaOptions): TKeyOf; + /** `[Json]` Creates a Literal type */ + Literal(literalValue: LiteralValue, options?: SchemaOptions): TLiteral; + /** `[Json]` Intrinsic function to Lowercase LiteralString types */ + Lowercase(type: Type, options?: SchemaOptions): TLowercase; + /** `[Json]` Creates a Mapped object type */ + Mapped, F extends TMappedFunction = TMappedFunction, R extends TMapped = TMapped>(key: K, map: F, options?: ObjectOptions): R; + /** `[Json]` Creates a Mapped object type */ + Mapped = TMappedFunction, R extends TMapped = TMapped>(key: [...K], map: F, options?: ObjectOptions): R; + /** `[Json]` Creates a Type Definition Module. */ + Module(properties: Properties): TModule; + /** `[Json]` Creates a Never type */ + Never(options?: SchemaOptions): TNever; + /** `[Json]` Creates a Not type */ + Not(type: T, options?: SchemaOptions): TNot; + /** `[Json]` Creates a Null type */ + Null(options?: SchemaOptions): TNull; + /** `[Json]` Creates a Number type */ + Number(options?: NumberOptions): TNumber; + /** `[Json]` Creates an Object type */ + Object(properties: T, options?: ObjectOptions): TObject; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Omit(type: Type, key: readonly [...Key], options?: SchemaOptions): TOmit; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Omit(type: Type, key: Key, options?: SchemaOptions): TOmit; + /** `[Json]` Constructs a type where all properties are optional */ + Partial(type: MappedResult, options?: SchemaOptions): TPartialFromMappedResult; + /** `[Json]` Constructs a type where all properties are optional */ + Partial(type: Type, options?: SchemaOptions): TPartial; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Pick(type: Type, key: readonly [...Key], options?: SchemaOptions): TPick; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Pick(type: Type, key: Key, options?: SchemaOptions): TPick; + /** `[Json]` Creates a Record type */ + Record(key: Key, value: Value, options?: ObjectOptions): TRecordOrObject; + /** `[Json]` Creates a Recursive type */ + Recursive(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive; + /** `[Json]` Creates a Ref type.*/ + Ref($ref: Ref, options?: SchemaOptions): TRef; + /** + * @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass + * a `string` value for the reference (and not a schema). + * + * To adhere to the 0.34.0 signature, Ref implementations should be updated to the following. + * + * ```typescript + * // pre-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Ref(T) + * ``` + * should be changed to the following + * + * ```typescript + * // post-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Unsafe>(Type.Ref('T')) + * ``` + * You can also create a generic function to replicate the pre-0.34.0 signature if required + * + * ```typescript + * const LegacyRef = (schema: T) => Type.Unsafe>(Type.Ref(schema.$id!)) + * ``` + */ + Ref(type: Type, options?: SchemaOptions): TRefUnsafe; + /** `[Json]` Constructs a type where all properties are required */ + Required(type: MappedResult, options?: SchemaOptions): TRequiredFromMappedResult; + /** `[Json]` Constructs a type where all properties are required */ + Required(type: Type, options?: SchemaOptions): TRequired; + /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ + Rest(type: Type): TRest; + /** `[Json]` Creates a String type */ + String(options?: StringOptions): TString; + /** `[Json]` Creates a TemplateLiteral type from template dsl string */ + TemplateLiteral(syntax: Syntax, options?: SchemaOptions): TTemplateLiteralSyntax; + /** `[Json]` Creates a TemplateLiteral type */ + TemplateLiteral(kinds: [...Kinds], options?: SchemaOptions): TTemplateLiteral; + /** `[Json]` Creates a Transform type */ + Transform(type: Type): TransformDecodeBuilder; + /** `[Json]` Creates a Tuple type */ + Tuple(types: [...Types], options?: SchemaOptions): TTuple; + /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ + Uncapitalize(type: Type, options?: SchemaOptions): TUncapitalize; + /** `[Json]` Creates a Union type */ + Union(types: [...Types], options?: SchemaOptions): Union; + /** `[Json]` Creates an Unknown type */ + Unknown(options?: SchemaOptions): TUnknown; + /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ + Unsafe(options?: UnsafeOptions): TUnsafe; + /** `[Json]` Intrinsic function to Uppercase LiteralString types */ + Uppercase(schema: T, options?: SchemaOptions): TUppercase; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.js new file mode 100644 index 0000000..bb37658 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/json.js @@ -0,0 +1,226 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JsonTypeBuilder = void 0; +const index_1 = require("../any/index"); +const index_2 = require("../array/index"); +const index_3 = require("../boolean/index"); +const index_4 = require("../composite/index"); +const index_5 = require("../const/index"); +const index_6 = require("../enum/index"); +const index_7 = require("../exclude/index"); +const index_8 = require("../extends/index"); +const index_9 = require("../extract/index"); +const index_10 = require("../indexed/index"); +const index_11 = require("../integer/index"); +const index_12 = require("../intersect/index"); +const index_13 = require("../intrinsic/index"); +const index_14 = require("../keyof/index"); +const index_15 = require("../literal/index"); +const index_16 = require("../mapped/index"); +const index_17 = require("../never/index"); +const index_18 = require("../not/index"); +const index_19 = require("../null/index"); +const index_20 = require("../module/index"); +const index_21 = require("../number/index"); +const index_22 = require("../object/index"); +const index_23 = require("../omit/index"); +const index_24 = require("../optional/index"); +const index_25 = require("../partial/index"); +const index_26 = require("../pick/index"); +const index_27 = require("../readonly/index"); +const index_28 = require("../readonly-optional/index"); +const index_29 = require("../record/index"); +const index_30 = require("../recursive/index"); +const index_31 = require("../ref/index"); +const index_32 = require("../required/index"); +const index_33 = require("../rest/index"); +const index_34 = require("../string/index"); +const index_35 = require("../template-literal/index"); +const index_36 = require("../transform/index"); +const index_37 = require("../tuple/index"); +const index_38 = require("../union/index"); +const index_39 = require("../unknown/index"); +const index_40 = require("../unsafe/index"); +/** Json Type Builder with Static Resolution for TypeScript */ +class JsonTypeBuilder { + // ------------------------------------------------------------------------ + // Modifiers + // ------------------------------------------------------------------------ + /** `[Json]` Creates a Readonly and Optional property */ + ReadonlyOptional(type) { + return (0, index_28.ReadonlyOptional)(type); + } + /** `[Json]` Creates a Readonly property */ + Readonly(type, enable) { + return (0, index_27.Readonly)(type, enable ?? true); + } + /** `[Json]` Creates a Optional property */ + Optional(type, enable) { + return (0, index_24.Optional)(type, enable ?? true); + } + // ------------------------------------------------------------------------ + // Types + // ------------------------------------------------------------------------ + /** `[Json]` Creates an Any type */ + Any(options) { + return (0, index_1.Any)(options); + } + /** `[Json]` Creates an Array type */ + Array(items, options) { + return (0, index_2.Array)(items, options); + } + /** `[Json]` Creates a Boolean type */ + Boolean(options) { + return (0, index_3.Boolean)(options); + } + /** `[Json]` Intrinsic function to Capitalize LiteralString types */ + Capitalize(schema, options) { + return (0, index_13.Capitalize)(schema, options); + } + /** `[Json]` Creates a Composite object type */ + Composite(schemas, options) { + return (0, index_4.Composite)(schemas, options); // (error) TS 5.4.0-dev - review TComposite implementation + } + /** `[JavaScript]` Creates a readonly const type from the given value. */ + Const(value, options) { + return (0, index_5.Const)(value, options); + } + /** `[Json]` Creates a Enum type */ + Enum(item, options) { + return (0, index_6.Enum)(item, options); + } + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType, excludedMembers, options) { + return (0, index_7.Exclude)(unionType, excludedMembers, options); + } + /** `[Json]` Creates a Conditional type */ + Extends(L, R, T, F, options) { + return (0, index_8.Extends)(L, R, T, F, options); + } + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type, union, options) { + return (0, index_9.Extract)(type, union, options); + } + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type, key, options) { + return (0, index_10.Index)(type, key, options); + } + /** `[Json]` Creates an Integer type */ + Integer(options) { + return (0, index_11.Integer)(options); + } + /** `[Json]` Creates an Intersect type */ + Intersect(types, options) { + return (0, index_12.Intersect)(types, options); + } + /** `[Json]` Creates a KeyOf type */ + KeyOf(type, options) { + return (0, index_14.KeyOf)(type, options); + } + /** `[Json]` Creates a Literal type */ + Literal(literalValue, options) { + return (0, index_15.Literal)(literalValue, options); + } + /** `[Json]` Intrinsic function to Lowercase LiteralString types */ + Lowercase(type, options) { + return (0, index_13.Lowercase)(type, options); + } + /** `[Json]` Creates a Mapped object type */ + Mapped(key, map, options) { + return (0, index_16.Mapped)(key, map, options); + } + /** `[Json]` Creates a Type Definition Module. */ + Module(properties) { + return (0, index_20.Module)(properties); + } + /** `[Json]` Creates a Never type */ + Never(options) { + return (0, index_17.Never)(options); + } + /** `[Json]` Creates a Not type */ + Not(type, options) { + return (0, index_18.Not)(type, options); + } + /** `[Json]` Creates a Null type */ + Null(options) { + return (0, index_19.Null)(options); + } + /** `[Json]` Creates a Number type */ + Number(options) { + return (0, index_21.Number)(options); + } + /** `[Json]` Creates an Object type */ + Object(properties, options) { + return (0, index_22.Object)(properties, options); + } + /** `[Json]` Constructs a type whose keys are omitted from the given type */ + Omit(schema, selector, options) { + return (0, index_23.Omit)(schema, selector, options); + } + /** `[Json]` Constructs a type where all properties are optional */ + Partial(type, options) { + return (0, index_25.Partial)(type, options); + } + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Pick(type, key, options) { + return (0, index_26.Pick)(type, key, options); + } + /** `[Json]` Creates a Record type */ + Record(key, value, options) { + return (0, index_29.Record)(key, value, options); + } + /** `[Json]` Creates a Recursive type */ + Recursive(callback, options) { + return (0, index_30.Recursive)(callback, options); + } + /** `[Json]` Creates a Ref type. The referenced type must contain a $id */ + Ref(...args) { + return (0, index_31.Ref)(args[0], args[1]); + } + /** `[Json]` Constructs a type where all properties are required */ + Required(type, options) { + return (0, index_32.Required)(type, options); + } + /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ + Rest(type) { + return (0, index_33.Rest)(type); + } + /** `[Json]` Creates a String type */ + String(options) { + return (0, index_34.String)(options); + } + /** `[Json]` Creates a TemplateLiteral type */ + TemplateLiteral(unresolved, options) { + return (0, index_35.TemplateLiteral)(unresolved, options); + } + /** `[Json]` Creates a Transform type */ + Transform(type) { + return (0, index_36.Transform)(type); + } + /** `[Json]` Creates a Tuple type */ + Tuple(types, options) { + return (0, index_37.Tuple)(types, options); + } + /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ + Uncapitalize(type, options) { + return (0, index_13.Uncapitalize)(type, options); + } + /** `[Json]` Creates a Union type */ + Union(types, options) { + return (0, index_38.Union)(types, options); + } + /** `[Json]` Creates an Unknown type */ + Unknown(options) { + return (0, index_39.Unknown)(options); + } + /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ + Unsafe(options) { + return (0, index_40.Unsafe)(options); + } + /** `[Json]` Intrinsic function to Uppercase LiteralString types */ + Uppercase(schema, options) { + return (0, index_13.Uppercase)(schema, options); + } +} +exports.JsonTypeBuilder = JsonTypeBuilder; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.d.ts new file mode 100644 index 0000000..f10185d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.d.ts @@ -0,0 +1,59 @@ +export { Any } from '../any/index'; +export { Argument } from '../argument/index'; +export { Array } from '../array/index'; +export { AsyncIterator } from '../async-iterator/index'; +export { Awaited } from '../awaited/index'; +export { BigInt } from '../bigint/index'; +export { Boolean } from '../boolean/index'; +export { Composite } from '../composite/index'; +export { Const } from '../const/index'; +export { Constructor } from '../constructor/index'; +export { ConstructorParameters } from '../constructor-parameters/index'; +export { Date } from '../date/index'; +export { Enum } from '../enum/index'; +export { Exclude } from '../exclude/index'; +export { Extends } from '../extends/index'; +export { Extract } from '../extract/index'; +export { Function } from '../function/index'; +export { Index } from '../indexed/index'; +export { InstanceType } from '../instance-type/index'; +export { Instantiate } from '../instantiate/index'; +export { Integer } from '../integer/index'; +export { Intersect } from '../intersect/index'; +export { Capitalize, Uncapitalize, Lowercase, Uppercase } from '../intrinsic/index'; +export { Iterator } from '../iterator/index'; +export { KeyOf } from '../keyof/index'; +export { Literal } from '../literal/index'; +export { Mapped } from '../mapped/index'; +export { Module } from '../module/index'; +export { Never } from '../never/index'; +export { Not } from '../not/index'; +export { Null } from '../null/index'; +export { Number } from '../number/index'; +export { Object } from '../object/index'; +export { Omit } from '../omit/index'; +export { Optional } from '../optional/index'; +export { Parameters } from '../parameters/index'; +export { Partial } from '../partial/index'; +export { Pick } from '../pick/index'; +export { Promise } from '../promise/index'; +export { Readonly } from '../readonly/index'; +export { ReadonlyOptional } from '../readonly-optional/index'; +export { Record } from '../record/index'; +export { Recursive } from '../recursive/index'; +export { Ref } from '../ref/index'; +export { RegExp } from '../regexp/index'; +export { Required } from '../required/index'; +export { Rest } from '../rest/index'; +export { ReturnType } from '../return-type/index'; +export { String } from '../string/index'; +export { Symbol } from '../symbol/index'; +export { TemplateLiteral } from '../template-literal/index'; +export { Transform } from '../transform/index'; +export { Tuple } from '../tuple/index'; +export { Uint8Array } from '../uint8array/index'; +export { Undefined } from '../undefined/index'; +export { Union } from '../union/index'; +export { Unknown } from '../unknown/index'; +export { Unsafe } from '../unsafe/index'; +export { Void } from '../void/index'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.js new file mode 100644 index 0000000..1dfd445 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/type/type.js @@ -0,0 +1,129 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Rest = exports.Required = exports.RegExp = exports.Ref = exports.Recursive = exports.Record = exports.ReadonlyOptional = exports.Readonly = exports.Promise = exports.Pick = exports.Partial = exports.Parameters = exports.Optional = exports.Omit = exports.Object = exports.Number = exports.Null = exports.Not = exports.Never = exports.Module = exports.Mapped = exports.Literal = exports.KeyOf = exports.Iterator = exports.Uppercase = exports.Lowercase = exports.Uncapitalize = exports.Capitalize = exports.Intersect = exports.Integer = exports.Instantiate = exports.InstanceType = exports.Index = exports.Function = exports.Extract = exports.Extends = exports.Exclude = exports.Enum = exports.Date = exports.ConstructorParameters = exports.Constructor = exports.Const = exports.Composite = exports.Boolean = exports.BigInt = exports.Awaited = exports.AsyncIterator = exports.Array = exports.Argument = exports.Any = void 0; +exports.Void = exports.Unsafe = exports.Unknown = exports.Union = exports.Undefined = exports.Uint8Array = exports.Tuple = exports.Transform = exports.TemplateLiteral = exports.Symbol = exports.String = exports.ReturnType = void 0; +// ------------------------------------------------------------------ +// Type: Module +// ------------------------------------------------------------------ +var index_1 = require("../any/index"); +Object.defineProperty(exports, "Any", { enumerable: true, get: function () { return index_1.Any; } }); +var index_2 = require("../argument/index"); +Object.defineProperty(exports, "Argument", { enumerable: true, get: function () { return index_2.Argument; } }); +var index_3 = require("../array/index"); +Object.defineProperty(exports, "Array", { enumerable: true, get: function () { return index_3.Array; } }); +var index_4 = require("../async-iterator/index"); +Object.defineProperty(exports, "AsyncIterator", { enumerable: true, get: function () { return index_4.AsyncIterator; } }); +var index_5 = require("../awaited/index"); +Object.defineProperty(exports, "Awaited", { enumerable: true, get: function () { return index_5.Awaited; } }); +var index_6 = require("../bigint/index"); +Object.defineProperty(exports, "BigInt", { enumerable: true, get: function () { return index_6.BigInt; } }); +var index_7 = require("../boolean/index"); +Object.defineProperty(exports, "Boolean", { enumerable: true, get: function () { return index_7.Boolean; } }); +var index_8 = require("../composite/index"); +Object.defineProperty(exports, "Composite", { enumerable: true, get: function () { return index_8.Composite; } }); +var index_9 = require("../const/index"); +Object.defineProperty(exports, "Const", { enumerable: true, get: function () { return index_9.Const; } }); +var index_10 = require("../constructor/index"); +Object.defineProperty(exports, "Constructor", { enumerable: true, get: function () { return index_10.Constructor; } }); +var index_11 = require("../constructor-parameters/index"); +Object.defineProperty(exports, "ConstructorParameters", { enumerable: true, get: function () { return index_11.ConstructorParameters; } }); +var index_12 = require("../date/index"); +Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return index_12.Date; } }); +var index_13 = require("../enum/index"); +Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return index_13.Enum; } }); +var index_14 = require("../exclude/index"); +Object.defineProperty(exports, "Exclude", { enumerable: true, get: function () { return index_14.Exclude; } }); +var index_15 = require("../extends/index"); +Object.defineProperty(exports, "Extends", { enumerable: true, get: function () { return index_15.Extends; } }); +var index_16 = require("../extract/index"); +Object.defineProperty(exports, "Extract", { enumerable: true, get: function () { return index_16.Extract; } }); +var index_17 = require("../function/index"); +Object.defineProperty(exports, "Function", { enumerable: true, get: function () { return index_17.Function; } }); +var index_18 = require("../indexed/index"); +Object.defineProperty(exports, "Index", { enumerable: true, get: function () { return index_18.Index; } }); +var index_19 = require("../instance-type/index"); +Object.defineProperty(exports, "InstanceType", { enumerable: true, get: function () { return index_19.InstanceType; } }); +var index_20 = require("../instantiate/index"); +Object.defineProperty(exports, "Instantiate", { enumerable: true, get: function () { return index_20.Instantiate; } }); +var index_21 = require("../integer/index"); +Object.defineProperty(exports, "Integer", { enumerable: true, get: function () { return index_21.Integer; } }); +var index_22 = require("../intersect/index"); +Object.defineProperty(exports, "Intersect", { enumerable: true, get: function () { return index_22.Intersect; } }); +var index_23 = require("../intrinsic/index"); +Object.defineProperty(exports, "Capitalize", { enumerable: true, get: function () { return index_23.Capitalize; } }); +Object.defineProperty(exports, "Uncapitalize", { enumerable: true, get: function () { return index_23.Uncapitalize; } }); +Object.defineProperty(exports, "Lowercase", { enumerable: true, get: function () { return index_23.Lowercase; } }); +Object.defineProperty(exports, "Uppercase", { enumerable: true, get: function () { return index_23.Uppercase; } }); +var index_24 = require("../iterator/index"); +Object.defineProperty(exports, "Iterator", { enumerable: true, get: function () { return index_24.Iterator; } }); +var index_25 = require("../keyof/index"); +Object.defineProperty(exports, "KeyOf", { enumerable: true, get: function () { return index_25.KeyOf; } }); +var index_26 = require("../literal/index"); +Object.defineProperty(exports, "Literal", { enumerable: true, get: function () { return index_26.Literal; } }); +var index_27 = require("../mapped/index"); +Object.defineProperty(exports, "Mapped", { enumerable: true, get: function () { return index_27.Mapped; } }); +var index_28 = require("../module/index"); +Object.defineProperty(exports, "Module", { enumerable: true, get: function () { return index_28.Module; } }); +var index_29 = require("../never/index"); +Object.defineProperty(exports, "Never", { enumerable: true, get: function () { return index_29.Never; } }); +var index_30 = require("../not/index"); +Object.defineProperty(exports, "Not", { enumerable: true, get: function () { return index_30.Not; } }); +var index_31 = require("../null/index"); +Object.defineProperty(exports, "Null", { enumerable: true, get: function () { return index_31.Null; } }); +var index_32 = require("../number/index"); +Object.defineProperty(exports, "Number", { enumerable: true, get: function () { return index_32.Number; } }); +var index_33 = require("../object/index"); +Object.defineProperty(exports, "Object", { enumerable: true, get: function () { return index_33.Object; } }); +var index_34 = require("../omit/index"); +Object.defineProperty(exports, "Omit", { enumerable: true, get: function () { return index_34.Omit; } }); +var index_35 = require("../optional/index"); +Object.defineProperty(exports, "Optional", { enumerable: true, get: function () { return index_35.Optional; } }); +var index_36 = require("../parameters/index"); +Object.defineProperty(exports, "Parameters", { enumerable: true, get: function () { return index_36.Parameters; } }); +var index_37 = require("../partial/index"); +Object.defineProperty(exports, "Partial", { enumerable: true, get: function () { return index_37.Partial; } }); +var index_38 = require("../pick/index"); +Object.defineProperty(exports, "Pick", { enumerable: true, get: function () { return index_38.Pick; } }); +var index_39 = require("../promise/index"); +Object.defineProperty(exports, "Promise", { enumerable: true, get: function () { return index_39.Promise; } }); +var index_40 = require("../readonly/index"); +Object.defineProperty(exports, "Readonly", { enumerable: true, get: function () { return index_40.Readonly; } }); +var index_41 = require("../readonly-optional/index"); +Object.defineProperty(exports, "ReadonlyOptional", { enumerable: true, get: function () { return index_41.ReadonlyOptional; } }); +var index_42 = require("../record/index"); +Object.defineProperty(exports, "Record", { enumerable: true, get: function () { return index_42.Record; } }); +var index_43 = require("../recursive/index"); +Object.defineProperty(exports, "Recursive", { enumerable: true, get: function () { return index_43.Recursive; } }); +var index_44 = require("../ref/index"); +Object.defineProperty(exports, "Ref", { enumerable: true, get: function () { return index_44.Ref; } }); +var index_45 = require("../regexp/index"); +Object.defineProperty(exports, "RegExp", { enumerable: true, get: function () { return index_45.RegExp; } }); +var index_46 = require("../required/index"); +Object.defineProperty(exports, "Required", { enumerable: true, get: function () { return index_46.Required; } }); +var index_47 = require("../rest/index"); +Object.defineProperty(exports, "Rest", { enumerable: true, get: function () { return index_47.Rest; } }); +var index_48 = require("../return-type/index"); +Object.defineProperty(exports, "ReturnType", { enumerable: true, get: function () { return index_48.ReturnType; } }); +var index_49 = require("../string/index"); +Object.defineProperty(exports, "String", { enumerable: true, get: function () { return index_49.String; } }); +var index_50 = require("../symbol/index"); +Object.defineProperty(exports, "Symbol", { enumerable: true, get: function () { return index_50.Symbol; } }); +var index_51 = require("../template-literal/index"); +Object.defineProperty(exports, "TemplateLiteral", { enumerable: true, get: function () { return index_51.TemplateLiteral; } }); +var index_52 = require("../transform/index"); +Object.defineProperty(exports, "Transform", { enumerable: true, get: function () { return index_52.Transform; } }); +var index_53 = require("../tuple/index"); +Object.defineProperty(exports, "Tuple", { enumerable: true, get: function () { return index_53.Tuple; } }); +var index_54 = require("../uint8array/index"); +Object.defineProperty(exports, "Uint8Array", { enumerable: true, get: function () { return index_54.Uint8Array; } }); +var index_55 = require("../undefined/index"); +Object.defineProperty(exports, "Undefined", { enumerable: true, get: function () { return index_55.Undefined; } }); +var index_56 = require("../union/index"); +Object.defineProperty(exports, "Union", { enumerable: true, get: function () { return index_56.Union; } }); +var index_57 = require("../unknown/index"); +Object.defineProperty(exports, "Unknown", { enumerable: true, get: function () { return index_57.Unknown; } }); +var index_58 = require("../unsafe/index"); +Object.defineProperty(exports, "Unsafe", { enumerable: true, get: function () { return index_58.Unsafe; } }); +var index_59 = require("../void/index"); +Object.defineProperty(exports, "Void", { enumerable: true, get: function () { return index_59.Void; } }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.d.ts new file mode 100644 index 0000000..61605af --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.d.ts @@ -0,0 +1 @@ +export * from './uint8array'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.js new file mode 100644 index 0000000..aa9dce4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./uint8array"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.d.ts new file mode 100644 index 0000000..8d7dfda --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.d.ts @@ -0,0 +1,13 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface Uint8ArrayOptions extends SchemaOptions { + maxByteLength?: number; + minByteLength?: number; +} +export interface TUint8Array extends TSchema, Uint8ArrayOptions { + [Kind]: 'Uint8Array'; + static: Uint8Array; + type: 'uint8array'; +} +/** `[JavaScript]` Creates a Uint8Array type */ +export declare function Uint8Array(options?: Uint8ArrayOptions): TUint8Array; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.js new file mode 100644 index 0000000..dff545f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/uint8array/uint8array.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uint8Array = Uint8Array; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a Uint8Array type */ +function Uint8Array(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Uint8Array', type: 'Uint8Array' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.d.ts new file mode 100644 index 0000000..e872309 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.d.ts @@ -0,0 +1 @@ +export * from './undefined'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.js new file mode 100644 index 0000000..9572194 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./undefined"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.d.ts new file mode 100644 index 0000000..be776c0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.d.ts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TUndefined extends TSchema { + [Kind]: 'Undefined'; + static: undefined; + type: 'undefined'; +} +/** `[JavaScript]` Creates a Undefined type */ +export declare function Undefined(options?: SchemaOptions): TUndefined; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.js new file mode 100644 index 0000000..ae5c97c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/undefined/undefined.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Undefined = Undefined; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a Undefined type */ +function Undefined(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Undefined', type: 'undefined' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.d.ts new file mode 100644 index 0000000..e4c105d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.d.ts @@ -0,0 +1,3 @@ +export * from './union-evaluated'; +export * from './union-type'; +export * from './union'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.js new file mode 100644 index 0000000..b00c806 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./union-evaluated"), exports); +__exportStar(require("./union-type"), exports); +__exportStar(require("./union"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.d.ts new file mode 100644 index 0000000..967c790 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.d.ts @@ -0,0 +1,3 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { TUnion } from './union-type'; +export declare function UnionCreate(T: [...T], options?: SchemaOptions): TUnion; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.js new file mode 100644 index 0000000..d632d3d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-create.js @@ -0,0 +1,9 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnionCreate = UnionCreate; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +function UnionCreate(T, options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Union', anyOf: T }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.d.ts new file mode 100644 index 0000000..b68b963 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.d.ts @@ -0,0 +1,13 @@ +import type { SchemaOptions, TSchema } from '../schema/index'; +import { type TNever } from '../never/index'; +import { type TOptional } from '../optional/index'; +import type { TReadonly } from '../readonly/index'; +import type { TUnion } from './union-type'; +type TIsUnionOptional = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? true : TIsUnionOptional : false); +type TRemoveOptionalFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? TRemoveOptionalFromRest]> : TRemoveOptionalFromRest : Result); +type TRemoveOptionalFromType = (Type extends TReadonly ? TReadonly> : Type extends TOptional ? TRemoveOptionalFromType : Type); +type TResolveUnion, IsOptional extends boolean = TIsUnionOptional> = (IsOptional extends true ? TOptional> : TUnion); +export type TUnionEvaluated = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TResolveUnion); +/** `[Json]` Creates an evaluated Union type */ +export declare function UnionEvaluated>(T: [...Types], options?: SchemaOptions): Result; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.js new file mode 100644 index 0000000..803c067 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-evaluated.js @@ -0,0 +1,40 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnionEvaluated = UnionEvaluated; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +const index_2 = require("../discard/index"); +const index_3 = require("../never/index"); +const index_4 = require("../optional/index"); +const union_create_1 = require("./union-create"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../guard/kind"); +// prettier-ignore +function IsUnionOptional(types) { + return types.some(type => (0, kind_1.IsOptional)(type)); +} +// prettier-ignore +function RemoveOptionalFromRest(types) { + return types.map(left => (0, kind_1.IsOptional)(left) ? RemoveOptionalFromType(left) : left); +} +// prettier-ignore +function RemoveOptionalFromType(T) { + return ((0, index_2.Discard)(T, [index_1.OptionalKind])); +} +// prettier-ignore +function ResolveUnion(types, options) { + const isOptional = IsUnionOptional(types); + return (isOptional + ? (0, index_4.Optional)((0, union_create_1.UnionCreate)(RemoveOptionalFromRest(types), options)) + : (0, union_create_1.UnionCreate)(RemoveOptionalFromRest(types), options)); +} +/** `[Json]` Creates an evaluated Union type */ +function UnionEvaluated(T, options) { + // prettier-ignore + return (T.length === 1 ? (0, type_1.CreateType)(T[0], options) : + T.length === 0 ? (0, index_3.Never)(options) : + ResolveUnion(T, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.d.ts new file mode 100644 index 0000000..0ea080a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.d.ts @@ -0,0 +1,12 @@ +import type { TSchema } from '../schema/index'; +import type { Static } from '../static/index'; +import { Kind } from '../symbols/index'; +type UnionStatic = { + [K in keyof T]: T[K] extends TSchema ? Static : never; +}[number]; +export interface TUnion extends TSchema { + [Kind]: 'Union'; + static: UnionStatic; + anyOf: T; +} +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.js new file mode 100644 index 0000000..aca9239 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union-type.js @@ -0,0 +1,4 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const index_1 = require("../symbols/index"); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.d.ts new file mode 100644 index 0000000..3990e2f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.d.ts @@ -0,0 +1,6 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { type TNever } from '../never/index'; +import type { TUnion } from './union-type'; +export type Union = (T extends [] ? TNever : T extends [TSchema] ? T[0] : TUnion); +/** `[Json]` Creates a Union type */ +export declare function Union(types: [...Types], options?: SchemaOptions): Union; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.js new file mode 100644 index 0000000..cedaca0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/union/union.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Union = Union; +const index_1 = require("../never/index"); +const type_1 = require("../create/type"); +const union_create_1 = require("./union-create"); +/** `[Json]` Creates a Union type */ +function Union(types, options) { + // prettier-ignore + return (types.length === 0 ? (0, index_1.Never)(options) : + types.length === 1 ? (0, type_1.CreateType)(types[0], options) : + (0, union_create_1.UnionCreate)(types, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.d.ts new file mode 100644 index 0000000..e37c907 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.d.ts @@ -0,0 +1 @@ +export * from './unknown'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.js new file mode 100644 index 0000000..2caa920 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./unknown"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.d.ts new file mode 100644 index 0000000..e5fd1a8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.d.ts @@ -0,0 +1,8 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TUnknown extends TSchema { + [Kind]: 'Unknown'; + static: unknown; +} +/** `[Json]` Creates an Unknown type */ +export declare function Unknown(options?: SchemaOptions): TUnknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.js new file mode 100644 index 0000000..74752f8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unknown/unknown.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Unknown = Unknown; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates an Unknown type */ +function Unknown(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Unknown' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.d.ts new file mode 100644 index 0000000..88d357e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.d.ts @@ -0,0 +1 @@ +export * from './unsafe'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.js new file mode 100644 index 0000000..9cd8bc9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./unsafe"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.d.ts new file mode 100644 index 0000000..2a9cadf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.d.ts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface UnsafeOptions extends SchemaOptions { + [Kind]?: string; +} +export interface TUnsafe extends TSchema { + [Kind]: string; + static: T; +} +/** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ +export declare function Unsafe(options?: UnsafeOptions): TUnsafe; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.js new file mode 100644 index 0000000..830ebe2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/unsafe/unsafe.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Unsafe = Unsafe; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ +function Unsafe(options = {}) { + return (0, type_1.CreateType)({ [index_1.Kind]: options[index_1.Kind] ?? 'Unsafe' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.d.ts new file mode 100644 index 0000000..5a3f0de --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.d.ts @@ -0,0 +1 @@ +export * from './void'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.js new file mode 100644 index 0000000..3d41b64 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./void"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.d.ts new file mode 100644 index 0000000..24a6eee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.d.ts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index'; +import { Kind } from '../symbols/index'; +export interface TVoid extends TSchema { + [Kind]: 'Void'; + static: void; + type: 'void'; +} +/** `[JavaScript]` Creates a Void type */ +export declare function Void(options?: SchemaOptions): TVoid; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.js b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.js new file mode 100644 index 0000000..1707711 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/type/void/void.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Void = Void; +const type_1 = require("../create/type"); +const index_1 = require("../symbols/index"); +/** `[JavaScript]` Creates a Void type */ +function Void(options) { + return (0, type_1.CreateType)({ [index_1.Kind]: 'Void', type: 'void' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.d.ts new file mode 100644 index 0000000..875d190 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.d.ts @@ -0,0 +1,15 @@ +import { ValueErrorIterator, ValueError } from '../../errors/index'; +import { TypeBoxError } from '../../type/error/error'; +import { TSchema } from '../../type/schema/index'; +import { Static } from '../../type/static/index'; +export declare class AssertError extends TypeBoxError { + #private; + error: ValueError | undefined; + constructor(iterator: ValueErrorIterator); + /** Returns an iterator for each error in this value. */ + Errors(): ValueErrorIterator; +} +/** Asserts a value matches the given type or throws an `AssertError` if invalid */ +export declare function Assert(schema: T, references: TSchema[], value: unknown): asserts value is Static; +/** Asserts a value matches the given type or throws an `AssertError` if invalid */ +export declare function Assert(schema: T, value: unknown): asserts value is Static; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.js new file mode 100644 index 0000000..8069d6d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/assert.js @@ -0,0 +1,55 @@ +"use strict"; + +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _AssertError_instances, _AssertError_iterator, _AssertError_Iterator; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AssertError = void 0; +exports.Assert = Assert; +const index_1 = require("../../errors/index"); +const error_1 = require("../../type/error/error"); +const check_1 = require("../check/check"); +// ------------------------------------------------------------------ +// AssertError +// ------------------------------------------------------------------ +class AssertError extends error_1.TypeBoxError { + constructor(iterator) { + const error = iterator.First(); + super(error === undefined ? 'Invalid Value' : error.message); + _AssertError_instances.add(this); + _AssertError_iterator.set(this, void 0); + __classPrivateFieldSet(this, _AssertError_iterator, iterator, "f"); + this.error = error; + } + /** Returns an iterator for each error in this value. */ + Errors() { + return new index_1.ValueErrorIterator(__classPrivateFieldGet(this, _AssertError_instances, "m", _AssertError_Iterator).call(this)); + } +} +exports.AssertError = AssertError; +_AssertError_iterator = new WeakMap(), _AssertError_instances = new WeakSet(), _AssertError_Iterator = function* _AssertError_Iterator() { + if (this.error) + yield this.error; + yield* __classPrivateFieldGet(this, _AssertError_iterator, "f"); +}; +// ------------------------------------------------------------------ +// AssertValue +// ------------------------------------------------------------------ +function AssertValue(schema, references, value) { + if ((0, check_1.Check)(schema, references, value)) + return; + throw new AssertError((0, index_1.Errors)(schema, references, value)); +} +/** Asserts a value matches the given type or throws an `AssertError` if invalid */ +function Assert(...args) { + return args.length === 3 ? AssertValue(args[0], args[1], args[2]) : AssertValue(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.d.ts new file mode 100644 index 0000000..336b0ab --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.d.ts @@ -0,0 +1 @@ +export * from './assert'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.js new file mode 100644 index 0000000..731e0d3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/assert/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./assert"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.d.ts new file mode 100644 index 0000000..059fa40 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.d.ts @@ -0,0 +1,11 @@ +import { TypeBoxError } from '../../type/error/index'; +import type { TSchema } from '../../type/schema/index'; +import type { Static } from '../../type/static/index'; +export declare class ValueCastError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema, message: string); +} +/** Casts a value into a given type and references. The return value will retain as much information of the original value as possible. */ +export declare function Cast(schema: T, references: TSchema[], value: unknown): Static; +/** Casts a value into a given type. The return value will retain as much information of the original value as possible. */ +export declare function Cast(schema: T, value: unknown): Static; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.js new file mode 100644 index 0000000..0ef98bc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/cast.js @@ -0,0 +1,241 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueCastError = void 0; +exports.Cast = Cast; +const index_1 = require("../guard/index"); +const index_2 = require("../../type/error/index"); +const index_3 = require("../../type/symbols/index"); +const index_4 = require("../create/index"); +const index_5 = require("../check/index"); +const index_6 = require("../clone/index"); +const index_7 = require("../deref/index"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class ValueCastError extends index_2.TypeBoxError { + constructor(schema, message) { + super(message); + this.schema = schema; + } +} +exports.ValueCastError = ValueCastError; +// ------------------------------------------------------------------ +// The following logic assigns a score to a schema based on how well +// it matches a given value. For object types, the score is calculated +// by evaluating each property of the value against the schema's +// properties. To avoid bias towards objects with many properties, +// each property contributes equally to the total score. Properties +// that exactly match literal values receive the highest possible +// score, as literals are often used as discriminators in union types. +// ------------------------------------------------------------------ +function ScoreUnion(schema, references, value) { + if (schema[index_3.Kind] === 'Object' && typeof value === 'object' && !(0, index_1.IsNull)(value)) { + const object = schema; + const keys = Object.getOwnPropertyNames(value); + const entries = Object.entries(object.properties); + return entries.reduce((acc, [key, schema]) => { + const literal = schema[index_3.Kind] === 'Literal' && schema.const === value[key] ? 100 : 0; + const checks = (0, index_5.Check)(schema, references, value[key]) ? 10 : 0; + const exists = keys.includes(key) ? 1 : 0; + return acc + (literal + checks + exists); + }, 0); + } + else if (schema[index_3.Kind] === 'Union') { + const schemas = schema.anyOf.map((schema) => (0, index_7.Deref)(schema, references)); + const scores = schemas.map((schema) => ScoreUnion(schema, references, value)); + return Math.max(...scores); + } + else { + return (0, index_5.Check)(schema, references, value) ? 1 : 0; + } +} +function SelectUnion(union, references, value) { + const schemas = union.anyOf.map((schema) => (0, index_7.Deref)(schema, references)); + let [select, best] = [schemas[0], 0]; + for (const schema of schemas) { + const score = ScoreUnion(schema, references, value); + if (score > best) { + select = schema; + best = score; + } + } + return select; +} +function CastUnion(union, references, value) { + if ('default' in union) { + return typeof value === 'function' ? union.default : (0, index_6.Clone)(union.default); + } + else { + const schema = SelectUnion(union, references, value); + return Cast(schema, references, value); + } +} +// ------------------------------------------------------------------ +// Default +// ------------------------------------------------------------------ +function DefaultClone(schema, references, value) { + return (0, index_5.Check)(schema, references, value) ? (0, index_6.Clone)(value) : (0, index_4.Create)(schema, references); +} +function Default(schema, references, value) { + return (0, index_5.Check)(schema, references, value) ? value : (0, index_4.Create)(schema, references); +} +// ------------------------------------------------------------------ +// Cast +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + if ((0, index_5.Check)(schema, references, value)) + return (0, index_6.Clone)(value); + const created = (0, index_1.IsArray)(value) ? (0, index_6.Clone)(value) : (0, index_4.Create)(schema, references); + const minimum = (0, index_1.IsNumber)(schema.minItems) && created.length < schema.minItems ? [...created, ...Array.from({ length: schema.minItems - created.length }, () => null)] : created; + const maximum = (0, index_1.IsNumber)(schema.maxItems) && minimum.length > schema.maxItems ? minimum.slice(0, schema.maxItems) : minimum; + const casted = maximum.map((value) => Visit(schema.items, references, value)); + if (schema.uniqueItems !== true) + return casted; + const unique = [...new Set(casted)]; + if (!(0, index_5.Check)(schema, references, unique)) + throw new ValueCastError(schema, 'Array cast produced invalid data due to uniqueItems constraint'); + return unique; +} +function FromConstructor(schema, references, value) { + if ((0, index_5.Check)(schema, references, value)) + return (0, index_4.Create)(schema, references); + const required = new Set(schema.returns.required || []); + const result = function () { }; + for (const [key, property] of Object.entries(schema.returns.properties)) { + if (!required.has(key) && value.prototype[key] === undefined) + continue; + result.prototype[key] = Visit(property, references, value.prototype[key]); + } + return result; +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +// ------------------------------------------------------------------ +// Intersect +// ------------------------------------------------------------------ +function IntersectAssign(correct, value) { + // trust correct on mismatch | value on non-object + if (((0, index_1.IsObject)(correct) && !(0, index_1.IsObject)(value)) || (!(0, index_1.IsObject)(correct) && (0, index_1.IsObject)(value))) + return correct; + if (!(0, index_1.IsObject)(correct) || !(0, index_1.IsObject)(value)) + return value; + return globalThis.Object.getOwnPropertyNames(correct).reduce((result, key) => { + const property = key in value ? IntersectAssign(correct[key], value[key]) : correct[key]; + return { ...result, [key]: property }; + }, {}); +} +function FromIntersect(schema, references, value) { + if ((0, index_5.Check)(schema, references, value)) + return value; + const correct = (0, index_4.Create)(schema, references); + const assigned = IntersectAssign(correct, value); + return (0, index_5.Check)(schema, references, assigned) ? assigned : correct; +} +function FromNever(schema, references, value) { + throw new ValueCastError(schema, 'Never types cannot be cast'); +} +function FromObject(schema, references, value) { + if ((0, index_5.Check)(schema, references, value)) + return value; + if (value === null || typeof value !== 'object') + return (0, index_4.Create)(schema, references); + const required = new Set(schema.required || []); + const result = {}; + for (const [key, property] of Object.entries(schema.properties)) { + if (!required.has(key) && value[key] === undefined) + continue; + result[key] = Visit(property, references, value[key]); + } + // additional schema properties + if (typeof schema.additionalProperties === 'object') { + const propertyNames = Object.getOwnPropertyNames(schema.properties); + for (const propertyName of Object.getOwnPropertyNames(value)) { + if (propertyNames.includes(propertyName)) + continue; + result[propertyName] = Visit(schema.additionalProperties, references, value[propertyName]); + } + } + return result; +} +function FromRecord(schema, references, value) { + if ((0, index_5.Check)(schema, references, value)) + return (0, index_6.Clone)(value); + if (value === null || typeof value !== 'object' || Array.isArray(value) || value instanceof Date) + return (0, index_4.Create)(schema, references); + const subschemaPropertyName = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const subschema = schema.patternProperties[subschemaPropertyName]; + const result = {}; + for (const [propKey, propValue] of Object.entries(value)) { + result[propKey] = Visit(subschema, references, propValue); + } + return result; +} +function FromRef(schema, references, value) { + return Visit((0, index_7.Deref)(schema, references), references, value); +} +function FromThis(schema, references, value) { + return Visit((0, index_7.Deref)(schema, references), references, value); +} +function FromTuple(schema, references, value) { + if ((0, index_5.Check)(schema, references, value)) + return (0, index_6.Clone)(value); + if (!(0, index_1.IsArray)(value)) + return (0, index_4.Create)(schema, references); + if (schema.items === undefined) + return []; + return schema.items.map((schema, index) => Visit(schema, references, value[index])); +} +function FromUnion(schema, references, value) { + return (0, index_5.Check)(schema, references, value) ? (0, index_6.Clone)(value) : CastUnion(schema, references, value); +} +function Visit(schema, references, value) { + const references_ = (0, index_1.IsString)(schema.$id) ? (0, index_7.Pushref)(schema, references) : references; + const schema_ = schema; + switch (schema[index_3.Kind]) { + // -------------------------------------------------------------- + // Structural + // -------------------------------------------------------------- + case 'Array': + return FromArray(schema_, references_, value); + case 'Constructor': + return FromConstructor(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Never': + return FromNever(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + // -------------------------------------------------------------- + // DefaultClone + // -------------------------------------------------------------- + case 'Date': + case 'Symbol': + case 'Uint8Array': + return DefaultClone(schema, references, value); + // -------------------------------------------------------------- + // Default + // -------------------------------------------------------------- + default: + return Default(schema_, references_, value); + } +} +/** Casts a value into a given type. The return value will retain as much information of the original value as possible. */ +function Cast(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.d.ts new file mode 100644 index 0000000..f549ae7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.d.ts @@ -0,0 +1 @@ +export * from './cast'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.js new file mode 100644 index 0000000..ffd22f3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/cast/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./cast"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.d.ts new file mode 100644 index 0000000..415cee8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.d.ts @@ -0,0 +1,11 @@ +import { TypeBoxError } from '../../type/error/index'; +import type { TSchema } from '../../type/schema/index'; +import type { Static } from '../../type/static/index'; +export declare class ValueCheckUnknownTypeError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +/** Returns true if the value matches the given type. */ +export declare function Check(schema: T, references: TSchema[], value: unknown): value is Static; +/** Returns true if the value matches the given type. */ +export declare function Check(schema: T, value: unknown): value is Static; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.js new file mode 100644 index 0000000..e9c70e7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/check.js @@ -0,0 +1,476 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueCheckUnknownTypeError = void 0; +exports.Check = Check; +const index_1 = require("../../system/index"); +const index_2 = require("../deref/index"); +const index_3 = require("../hash/index"); +const index_4 = require("../../type/symbols/index"); +const index_5 = require("../../type/keyof/index"); +const index_6 = require("../../type/extends/index"); +const index_7 = require("../../type/registry/index"); +const index_8 = require("../../type/error/index"); +const index_9 = require("../../type/never/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_10 = require("../guard/index"); +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +const kind_1 = require("../../type/guard/kind"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class ValueCheckUnknownTypeError extends index_8.TypeBoxError { + constructor(schema) { + super(`Unknown type`); + this.schema = schema; + } +} +exports.ValueCheckUnknownTypeError = ValueCheckUnknownTypeError; +// ------------------------------------------------------------------ +// TypeGuards +// ------------------------------------------------------------------ +function IsAnyOrUnknown(schema) { + return schema[index_4.Kind] === 'Any' || schema[index_4.Kind] === 'Unknown'; +} +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +function IsDefined(value) { + return value !== undefined; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +function FromAny(schema, references, value) { + return true; +} +function FromArgument(schema, references, value) { + return true; +} +function FromArray(schema, references, value) { + if (!(0, index_10.IsArray)(value)) + return false; + if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) { + return false; + } + if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) { + return false; + } + for (const element of value) { + if (!Visit(schema.items, references, element)) + return false; + } + // prettier-ignore + if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) { + const hashed = (0, index_3.Hash)(element); + if (set.has(hashed)) { + return false; + } + else { + set.add(hashed); + } + } return true; })())) { + return false; + } + // contains + if (!(IsDefined(schema.contains) || (0, index_10.IsNumber)(schema.minContains) || (0, index_10.IsNumber)(schema.maxContains))) { + return true; // exit + } + const containsSchema = IsDefined(schema.contains) ? schema.contains : (0, index_9.Never)(); + const containsCount = value.reduce((acc, value) => (Visit(containsSchema, references, value) ? acc + 1 : acc), 0); + if (containsCount === 0) { + return false; + } + if ((0, index_10.IsNumber)(schema.minContains) && containsCount < schema.minContains) { + return false; + } + if ((0, index_10.IsNumber)(schema.maxContains) && containsCount > schema.maxContains) { + return false; + } + return true; +} +function FromAsyncIterator(schema, references, value) { + return (0, index_10.IsAsyncIterator)(value); +} +function FromBigInt(schema, references, value) { + if (!(0, index_10.IsBigInt)(value)) + return false; + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + return false; + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + return false; + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + return false; + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + return false; + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) { + return false; + } + return true; +} +function FromBoolean(schema, references, value) { + return (0, index_10.IsBoolean)(value); +} +function FromConstructor(schema, references, value) { + return Visit(schema.returns, references, value.prototype); +} +function FromDate(schema, references, value) { + if (!(0, index_10.IsDate)(value)) + return false; + if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) { + return false; + } + if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) { + return false; + } + if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) { + return false; + } + if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) { + return false; + } + if (IsDefined(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) { + return false; + } + return true; +} +function FromFunction(schema, references, value) { + return (0, index_10.IsFunction)(value); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromInteger(schema, references, value) { + if (!(0, index_10.IsInteger)(value)) { + return false; + } + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + return false; + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + return false; + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + return false; + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + return false; + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + return false; + } + return true; +} +function FromIntersect(schema, references, value) { + const check1 = schema.allOf.every((schema) => Visit(schema, references, value)); + if (schema.unevaluatedProperties === false) { + const keyPattern = new RegExp((0, index_5.KeyOfPattern)(schema)); + const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key)); + return check1 && check2; + } + else if ((0, kind_1.IsSchema)(schema.unevaluatedProperties)) { + const keyCheck = new RegExp((0, index_5.KeyOfPattern)(schema)); + const check2 = Object.getOwnPropertyNames(value).every((key) => keyCheck.test(key) || Visit(schema.unevaluatedProperties, references, value[key])); + return check1 && check2; + } + else { + return check1; + } +} +function FromIterator(schema, references, value) { + return (0, index_10.IsIterator)(value); +} +function FromLiteral(schema, references, value) { + return value === schema.const; +} +function FromNever(schema, references, value) { + return false; +} +function FromNot(schema, references, value) { + return !Visit(schema.not, references, value); +} +function FromNull(schema, references, value) { + return (0, index_10.IsNull)(value); +} +function FromNumber(schema, references, value) { + if (!index_1.TypeSystemPolicy.IsNumberLike(value)) + return false; + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + return false; + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + return false; + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + return false; + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + return false; + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + return false; + } + return true; +} +function FromObject(schema, references, value) { + if (!index_1.TypeSystemPolicy.IsObjectLike(value)) + return false; + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + return false; + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + return false; + } + const knownKeys = Object.getOwnPropertyNames(schema.properties); + for (const knownKey of knownKeys) { + const property = schema.properties[knownKey]; + if (schema.required && schema.required.includes(knownKey)) { + if (!Visit(property, references, value[knownKey])) { + return false; + } + if (((0, index_6.ExtendsUndefinedCheck)(property) || IsAnyOrUnknown(property)) && !(knownKey in value)) { + return false; + } + } + else { + if (index_1.TypeSystemPolicy.IsExactOptionalProperty(value, knownKey) && !Visit(property, references, value[knownKey])) { + return false; + } + } + } + if (schema.additionalProperties === false) { + const valueKeys = Object.getOwnPropertyNames(value); + // optimization: value is valid if schemaKey length matches the valueKey length + if (schema.required && schema.required.length === knownKeys.length && valueKeys.length === knownKeys.length) { + return true; + } + else { + return valueKeys.every((valueKey) => knownKeys.includes(valueKey)); + } + } + else if (typeof schema.additionalProperties === 'object') { + const valueKeys = Object.getOwnPropertyNames(value); + return valueKeys.every((key) => knownKeys.includes(key) || Visit(schema.additionalProperties, references, value[key])); + } + else { + return true; + } +} +function FromPromise(schema, references, value) { + return (0, index_10.IsPromise)(value); +} +function FromRecord(schema, references, value) { + if (!index_1.TypeSystemPolicy.IsRecordLike(value)) { + return false; + } + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + return false; + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + return false; + } + const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0]; + const regex = new RegExp(patternKey); + // prettier-ignore + const check1 = Object.entries(value).every(([key, value]) => { + return (regex.test(key)) ? Visit(patternSchema, references, value) : true; + }); + // prettier-ignore + const check2 = typeof schema.additionalProperties === 'object' ? Object.entries(value).every(([key, value]) => { + return (!regex.test(key)) ? Visit(schema.additionalProperties, references, value) : true; + }) : true; + const check3 = schema.additionalProperties === false + ? Object.getOwnPropertyNames(value).every((key) => { + return regex.test(key); + }) + : true; + return check1 && check2 && check3; +} +function FromRef(schema, references, value) { + return Visit((0, index_2.Deref)(schema, references), references, value); +} +function FromRegExp(schema, references, value) { + const regex = new RegExp(schema.source, schema.flags); + if (IsDefined(schema.minLength)) { + if (!(value.length >= schema.minLength)) + return false; + } + if (IsDefined(schema.maxLength)) { + if (!(value.length <= schema.maxLength)) + return false; + } + return regex.test(value); +} +function FromString(schema, references, value) { + if (!(0, index_10.IsString)(value)) { + return false; + } + if (IsDefined(schema.minLength)) { + if (!(value.length >= schema.minLength)) + return false; + } + if (IsDefined(schema.maxLength)) { + if (!(value.length <= schema.maxLength)) + return false; + } + if (IsDefined(schema.pattern)) { + const regex = new RegExp(schema.pattern); + if (!regex.test(value)) + return false; + } + if (IsDefined(schema.format)) { + if (!index_7.FormatRegistry.Has(schema.format)) + return false; + const func = index_7.FormatRegistry.Get(schema.format); + return func(value); + } + return true; +} +function FromSymbol(schema, references, value) { + return (0, index_10.IsSymbol)(value); +} +function FromTemplateLiteral(schema, references, value) { + return (0, index_10.IsString)(value) && new RegExp(schema.pattern).test(value); +} +function FromThis(schema, references, value) { + return Visit((0, index_2.Deref)(schema, references), references, value); +} +function FromTuple(schema, references, value) { + if (!(0, index_10.IsArray)(value)) { + return false; + } + if (schema.items === undefined && !(value.length === 0)) { + return false; + } + if (!(value.length === schema.maxItems)) { + return false; + } + if (!schema.items) { + return true; + } + for (let i = 0; i < schema.items.length; i++) { + if (!Visit(schema.items[i], references, value[i])) + return false; + } + return true; +} +function FromUndefined(schema, references, value) { + return (0, index_10.IsUndefined)(value); +} +function FromUnion(schema, references, value) { + return schema.anyOf.some((inner) => Visit(inner, references, value)); +} +function FromUint8Array(schema, references, value) { + if (!(0, index_10.IsUint8Array)(value)) { + return false; + } + if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) { + return false; + } + if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) { + return false; + } + return true; +} +function FromUnknown(schema, references, value) { + return true; +} +function FromVoid(schema, references, value) { + return index_1.TypeSystemPolicy.IsVoidLike(value); +} +function FromKind(schema, references, value) { + if (!index_7.TypeRegistry.Has(schema[index_4.Kind])) + return false; + const func = index_7.TypeRegistry.Get(schema[index_4.Kind]); + return func(schema, value); +} +function Visit(schema, references, value) { + const references_ = IsDefined(schema.$id) ? (0, index_2.Pushref)(schema, references) : references; + const schema_ = schema; + switch (schema_[index_4.Kind]) { + case 'Any': + return FromAny(schema_, references_, value); + case 'Argument': + return FromArgument(schema_, references_, value); + case 'Array': + return FromArray(schema_, references_, value); + case 'AsyncIterator': + return FromAsyncIterator(schema_, references_, value); + case 'BigInt': + return FromBigInt(schema_, references_, value); + case 'Boolean': + return FromBoolean(schema_, references_, value); + case 'Constructor': + return FromConstructor(schema_, references_, value); + case 'Date': + return FromDate(schema_, references_, value); + case 'Function': + return FromFunction(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Integer': + return FromInteger(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Iterator': + return FromIterator(schema_, references_, value); + case 'Literal': + return FromLiteral(schema_, references_, value); + case 'Never': + return FromNever(schema_, references_, value); + case 'Not': + return FromNot(schema_, references_, value); + case 'Null': + return FromNull(schema_, references_, value); + case 'Number': + return FromNumber(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Promise': + return FromPromise(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'RegExp': + return FromRegExp(schema_, references_, value); + case 'String': + return FromString(schema_, references_, value); + case 'Symbol': + return FromSymbol(schema_, references_, value); + case 'TemplateLiteral': + return FromTemplateLiteral(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Undefined': + return FromUndefined(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + case 'Uint8Array': + return FromUint8Array(schema_, references_, value); + case 'Unknown': + return FromUnknown(schema_, references_, value); + case 'Void': + return FromVoid(schema_, references_, value); + default: + if (!index_7.TypeRegistry.Has(schema_[index_4.Kind])) + throw new ValueCheckUnknownTypeError(schema_); + return FromKind(schema_, references_, value); + } +} +/** Returns true if the value matches the given type. */ +function Check(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.d.ts new file mode 100644 index 0000000..01a8e34 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.d.ts @@ -0,0 +1 @@ +export * from './check'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.js new file mode 100644 index 0000000..b971393 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/check/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./check"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.d.ts new file mode 100644 index 0000000..3d561ce --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.d.ts @@ -0,0 +1,5 @@ +import type { TSchema } from '../../type/schema/index'; +/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Clean(schema: TSchema, references: TSchema[], value: unknown): unknown; +/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Clean(schema: TSchema, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.js new file mode 100644 index 0000000..fe01e85 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/clean.js @@ -0,0 +1,149 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Clean = Clean; +const index_1 = require("../../type/keyof/index"); +const index_2 = require("../check/index"); +const index_3 = require("../clone/index"); +const index_4 = require("../deref/index"); +const index_5 = require("../../type/symbols/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +// prettier-ignore +const index_6 = require("../guard/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +// prettier-ignore +const kind_1 = require("../../type/guard/kind"); +// ------------------------------------------------------------------ +// IsCheckable +// ------------------------------------------------------------------ +function IsCheckable(schema) { + return (0, kind_1.IsKind)(schema) && schema[index_5.Kind] !== 'Unsafe'; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + if (!(0, index_6.IsArray)(value)) + return value; + return value.map((value) => Visit(schema.items, references, value)); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromIntersect(schema, references, value) { + const unevaluatedProperties = schema.unevaluatedProperties; + const intersections = schema.allOf.map((schema) => Visit(schema, references, (0, index_3.Clone)(value))); + const composite = intersections.reduce((acc, value) => ((0, index_6.IsObject)(value) ? { ...acc, ...value } : value), {}); + if (!(0, index_6.IsObject)(value) || !(0, index_6.IsObject)(composite) || !(0, kind_1.IsKind)(unevaluatedProperties)) + return composite; + const knownkeys = (0, index_1.KeyOfPropertyKeys)(schema); + for (const key of Object.getOwnPropertyNames(value)) { + if (knownkeys.includes(key)) + continue; + if ((0, index_2.Check)(unevaluatedProperties, references, value[key])) { + composite[key] = Visit(unevaluatedProperties, references, value[key]); + } + } + return composite; +} +function FromObject(schema, references, value) { + if (!(0, index_6.IsObject)(value) || (0, index_6.IsArray)(value)) + return value; // Check IsArray for AllowArrayObject configuration + const additionalProperties = schema.additionalProperties; + for (const key of Object.getOwnPropertyNames(value)) { + if ((0, index_6.HasPropertyKey)(schema.properties, key)) { + value[key] = Visit(schema.properties[key], references, value[key]); + continue; + } + if ((0, kind_1.IsKind)(additionalProperties) && (0, index_2.Check)(additionalProperties, references, value[key])) { + value[key] = Visit(additionalProperties, references, value[key]); + continue; + } + delete value[key]; + } + return value; +} +function FromRecord(schema, references, value) { + if (!(0, index_6.IsObject)(value)) + return value; + const additionalProperties = schema.additionalProperties; + const propertyKeys = Object.getOwnPropertyNames(value); + const [propertyKey, propertySchema] = Object.entries(schema.patternProperties)[0]; + const propertyKeyTest = new RegExp(propertyKey); + for (const key of propertyKeys) { + if (propertyKeyTest.test(key)) { + value[key] = Visit(propertySchema, references, value[key]); + continue; + } + if ((0, kind_1.IsKind)(additionalProperties) && (0, index_2.Check)(additionalProperties, references, value[key])) { + value[key] = Visit(additionalProperties, references, value[key]); + continue; + } + delete value[key]; + } + return value; +} +function FromRef(schema, references, value) { + return Visit((0, index_4.Deref)(schema, references), references, value); +} +function FromThis(schema, references, value) { + return Visit((0, index_4.Deref)(schema, references), references, value); +} +function FromTuple(schema, references, value) { + if (!(0, index_6.IsArray)(value)) + return value; + if ((0, index_6.IsUndefined)(schema.items)) + return []; + const length = Math.min(value.length, schema.items.length); + for (let i = 0; i < length; i++) { + value[i] = Visit(schema.items[i], references, value[i]); + } + // prettier-ignore + return value.length > length + ? value.slice(0, length) + : value; +} +function FromUnion(schema, references, value) { + for (const inner of schema.anyOf) { + if (IsCheckable(inner) && (0, index_2.Check)(inner, references, value)) { + return Visit(inner, references, value); + } + } + return value; +} +function Visit(schema, references, value) { + const references_ = (0, index_6.IsString)(schema.$id) ? (0, index_4.Pushref)(schema, references) : references; + const schema_ = schema; + switch (schema_[index_5.Kind]) { + case 'Array': + return FromArray(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + default: + return value; + } +} +/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ +function Clean(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.d.ts new file mode 100644 index 0000000..3916163 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.d.ts @@ -0,0 +1 @@ +export * from './clean'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.js new file mode 100644 index 0000000..0408bf0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clean/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./clean"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.d.ts new file mode 100644 index 0000000..06a609e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.d.ts @@ -0,0 +1,2 @@ +/** Returns a clone of the given value */ +export declare function Clone(value: T): T; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.js new file mode 100644 index 0000000..de410cc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/clone.js @@ -0,0 +1,60 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Clone = Clone; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_1 = require("../guard/index"); +// ------------------------------------------------------------------ +// Clonable +// ------------------------------------------------------------------ +function FromObject(value) { + const Acc = {}; + for (const key of Object.getOwnPropertyNames(value)) { + Acc[key] = Clone(value[key]); + } + for (const key of Object.getOwnPropertySymbols(value)) { + Acc[key] = Clone(value[key]); + } + return Acc; +} +function FromArray(value) { + return value.map((element) => Clone(element)); +} +function FromTypedArray(value) { + return value.slice(); +} +function FromMap(value) { + return new Map(Clone([...value.entries()])); +} +function FromSet(value) { + return new Set(Clone([...value.entries()])); +} +function FromDate(value) { + return new Date(value.toISOString()); +} +function FromValue(value) { + return value; +} +// ------------------------------------------------------------------ +// Clone +// ------------------------------------------------------------------ +/** Returns a clone of the given value */ +function Clone(value) { + if ((0, index_1.IsArray)(value)) + return FromArray(value); + if ((0, index_1.IsDate)(value)) + return FromDate(value); + if ((0, index_1.IsTypedArray)(value)) + return FromTypedArray(value); + if ((0, index_1.IsMap)(value)) + return FromMap(value); + if ((0, index_1.IsSet)(value)) + return FromSet(value); + if ((0, index_1.IsObject)(value)) + return FromObject(value); + if ((0, index_1.IsValueType)(value)) + return FromValue(value); + throw new Error('ValueClone: Unable to clone value'); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.d.ts new file mode 100644 index 0000000..f86973e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.d.ts @@ -0,0 +1 @@ +export * from './clone'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.js new file mode 100644 index 0000000..cea5715 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/clone/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./clone"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.d.ts new file mode 100644 index 0000000..10461a1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.d.ts @@ -0,0 +1,5 @@ +import type { TSchema } from '../../type/schema/index'; +/** `[Mutable]` Converts any type mismatched values to their target type if a reasonable conversion is possible. */ +export declare function Convert(schema: TSchema, references: TSchema[], value: unknown): unknown; +/** `[Mutable]` Converts any type mismatched values to their target type if a reasonable conversion is possible. */ +export declare function Convert(schema: TSchema, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.js new file mode 100644 index 0000000..f4ee204 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/convert.js @@ -0,0 +1,264 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Convert = Convert; +const index_1 = require("../clone/index"); +const index_2 = require("../check/index"); +const index_3 = require("../deref/index"); +const index_4 = require("../../type/symbols/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_5 = require("../guard/index"); +// ------------------------------------------------------------------ +// Conversions +// ------------------------------------------------------------------ +function IsStringNumeric(value) { + return (0, index_5.IsString)(value) && !isNaN(value) && !isNaN(parseFloat(value)); +} +function IsValueToString(value) { + return (0, index_5.IsBigInt)(value) || (0, index_5.IsBoolean)(value) || (0, index_5.IsNumber)(value); +} +function IsValueTrue(value) { + return value === true || ((0, index_5.IsNumber)(value) && value === 1) || ((0, index_5.IsBigInt)(value) && value === BigInt('1')) || ((0, index_5.IsString)(value) && (value.toLowerCase() === 'true' || value === '1')); +} +function IsValueFalse(value) { + return value === false || ((0, index_5.IsNumber)(value) && (value === 0 || Object.is(value, -0))) || ((0, index_5.IsBigInt)(value) && value === BigInt('0')) || ((0, index_5.IsString)(value) && (value.toLowerCase() === 'false' || value === '0' || value === '-0')); +} +function IsTimeStringWithTimeZone(value) { + return (0, index_5.IsString)(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value); +} +function IsTimeStringWithoutTimeZone(value) { + return (0, index_5.IsString)(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value); +} +function IsDateTimeStringWithTimeZone(value) { + return (0, index_5.IsString)(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value); +} +function IsDateTimeStringWithoutTimeZone(value) { + return (0, index_5.IsString)(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value); +} +function IsDateString(value) { + return (0, index_5.IsString)(value) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value); +} +// ------------------------------------------------------------------ +// Convert +// ------------------------------------------------------------------ +function TryConvertLiteralString(value, target) { + const conversion = TryConvertString(value); + return conversion === target ? conversion : value; +} +function TryConvertLiteralNumber(value, target) { + const conversion = TryConvertNumber(value); + return conversion === target ? conversion : value; +} +function TryConvertLiteralBoolean(value, target) { + const conversion = TryConvertBoolean(value); + return conversion === target ? conversion : value; +} +// prettier-ignore +function TryConvertLiteral(schema, value) { + return ((0, index_5.IsString)(schema.const) ? TryConvertLiteralString(value, schema.const) : + (0, index_5.IsNumber)(schema.const) ? TryConvertLiteralNumber(value, schema.const) : + (0, index_5.IsBoolean)(schema.const) ? TryConvertLiteralBoolean(value, schema.const) : + value); +} +function TryConvertBoolean(value) { + return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value; +} +function TryConvertBigInt(value) { + const truncateInteger = (value) => value.split('.')[0]; + return IsStringNumeric(value) ? BigInt(truncateInteger(value)) : (0, index_5.IsNumber)(value) ? BigInt(Math.trunc(value)) : IsValueFalse(value) ? BigInt(0) : IsValueTrue(value) ? BigInt(1) : value; +} +function TryConvertString(value) { + return (0, index_5.IsSymbol)(value) && value.description !== undefined ? value.description.toString() : IsValueToString(value) ? value.toString() : value; +} +function TryConvertNumber(value) { + return IsStringNumeric(value) ? parseFloat(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value; +} +function TryConvertInteger(value) { + return IsStringNumeric(value) ? parseInt(value) : (0, index_5.IsNumber)(value) ? Math.trunc(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value; +} +function TryConvertNull(value) { + return (0, index_5.IsString)(value) && value.toLowerCase() === 'null' ? null : value; +} +function TryConvertUndefined(value) { + return (0, index_5.IsString)(value) && value === 'undefined' ? undefined : value; +} +// ------------------------------------------------------------------ +// note: this function may return an invalid dates for the regex +// tests above. Invalid dates will however be checked during the +// casting function and will return a epoch date if invalid. +// Consider better string parsing for the iso dates in future +// revisions. +// ------------------------------------------------------------------ +// prettier-ignore +function TryConvertDate(value) { + return ((0, index_5.IsDate)(value) ? value : + (0, index_5.IsNumber)(value) ? new Date(value) : + IsValueTrue(value) ? new Date(1) : + IsValueFalse(value) ? new Date(0) : + IsStringNumeric(value) ? new Date(parseInt(value)) : + IsTimeStringWithoutTimeZone(value) ? new Date(`1970-01-01T${value}.000Z`) : + IsTimeStringWithTimeZone(value) ? new Date(`1970-01-01T${value}`) : + IsDateTimeStringWithoutTimeZone(value) ? new Date(`${value}.000Z`) : + IsDateTimeStringWithTimeZone(value) ? new Date(value) : + IsDateString(value) ? new Date(`${value}T00:00:00.000Z`) : + value); +} +// ------------------------------------------------------------------ +// Default +// ------------------------------------------------------------------ +function Default(value) { + return value; +} +// ------------------------------------------------------------------ +// Convert +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + const elements = (0, index_5.IsArray)(value) ? value : [value]; + return elements.map((element) => Visit(schema.items, references, element)); +} +function FromBigInt(schema, references, value) { + return TryConvertBigInt(value); +} +function FromBoolean(schema, references, value) { + return TryConvertBoolean(value); +} +function FromDate(schema, references, value) { + return TryConvertDate(value); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromInteger(schema, references, value) { + return TryConvertInteger(value); +} +function FromIntersect(schema, references, value) { + return schema.allOf.reduce((value, schema) => Visit(schema, references, value), value); +} +function FromLiteral(schema, references, value) { + return TryConvertLiteral(schema, value); +} +function FromNull(schema, references, value) { + return TryConvertNull(value); +} +function FromNumber(schema, references, value) { + return TryConvertNumber(value); +} +// prettier-ignore +function FromObject(schema, references, value) { + if (!(0, index_5.IsObject)(value) || (0, index_5.IsArray)(value)) + return value; + for (const propertyKey of Object.getOwnPropertyNames(schema.properties)) { + if (!(0, index_5.HasPropertyKey)(value, propertyKey)) + continue; + value[propertyKey] = Visit(schema.properties[propertyKey], references, value[propertyKey]); + } + return value; +} +function FromRecord(schema, references, value) { + const isConvertable = (0, index_5.IsObject)(value) && !(0, index_5.IsArray)(value); + if (!isConvertable) + return value; + const propertyKey = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const property = schema.patternProperties[propertyKey]; + for (const [propKey, propValue] of Object.entries(value)) { + value[propKey] = Visit(property, references, propValue); + } + return value; +} +function FromRef(schema, references, value) { + return Visit((0, index_3.Deref)(schema, references), references, value); +} +function FromString(schema, references, value) { + return TryConvertString(value); +} +function FromSymbol(schema, references, value) { + return (0, index_5.IsString)(value) || (0, index_5.IsNumber)(value) ? Symbol(value) : value; +} +function FromThis(schema, references, value) { + return Visit((0, index_3.Deref)(schema, references), references, value); +} +// prettier-ignore +function FromTuple(schema, references, value) { + const isConvertable = (0, index_5.IsArray)(value) && !(0, index_5.IsUndefined)(schema.items); + if (!isConvertable) + return value; + return value.map((value, index) => { + return (index < schema.items.length) + ? Visit(schema.items[index], references, value) + : value; + }); +} +function FromUndefined(schema, references, value) { + return TryConvertUndefined(value); +} +function FromUnion(schema, references, value) { + // Check if original value already matches one of the union variants + for (const subschema of schema.anyOf) { + if ((0, index_2.Check)(subschema, references, value)) { + return value; + } + } + // Attempt conversion for each variant + for (const subschema of schema.anyOf) { + const converted = Visit(subschema, references, (0, index_1.Clone)(value)); + if (!(0, index_2.Check)(subschema, references, converted)) + continue; + return converted; + } + return value; +} +function Visit(schema, references, value) { + const references_ = (0, index_3.Pushref)(schema, references); + const schema_ = schema; + switch (schema[index_4.Kind]) { + case 'Array': + return FromArray(schema_, references_, value); + case 'BigInt': + return FromBigInt(schema_, references_, value); + case 'Boolean': + return FromBoolean(schema_, references_, value); + case 'Date': + return FromDate(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Integer': + return FromInteger(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Literal': + return FromLiteral(schema_, references_, value); + case 'Null': + return FromNull(schema_, references_, value); + case 'Number': + return FromNumber(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'String': + return FromString(schema_, references_, value); + case 'Symbol': + return FromSymbol(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Undefined': + return FromUndefined(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + default: + return Default(value); + } +} +/** `[Mutable]` Converts any type mismatched values to their target type if a reasonable conversion is possible. */ +// prettier-ignore +function Convert(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.d.ts new file mode 100644 index 0000000..c5b7be7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.d.ts @@ -0,0 +1 @@ +export * from './convert'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.js new file mode 100644 index 0000000..1f664d7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/convert/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./convert"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.d.ts new file mode 100644 index 0000000..104aaaa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.d.ts @@ -0,0 +1,11 @@ +import { TypeBoxError } from '../../type/error/index'; +import type { TSchema } from '../../type/schema/index'; +import type { Static } from '../../type/static/index'; +export declare class ValueCreateError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema, message: string); +} +/** Creates a value from the given schema and references */ +export declare function Create(schema: T, references: TSchema[]): Static; +/** Creates a value from the given schema */ +export declare function Create(schema: T): Static; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.js new file mode 100644 index 0000000..945677d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/create.js @@ -0,0 +1,474 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueCreateError = void 0; +exports.Create = Create; +const index_1 = require("../guard/index"); +const index_2 = require("../check/index"); +const index_3 = require("../clone/index"); +const index_4 = require("../deref/index"); +const index_5 = require("../../type/template-literal/index"); +const index_6 = require("../../type/registry/index"); +const index_7 = require("../../type/symbols/index"); +const index_8 = require("../../type/error/index"); +const guard_1 = require("../guard/guard"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class ValueCreateError extends index_8.TypeBoxError { + constructor(schema, message) { + super(message); + this.schema = schema; + } +} +exports.ValueCreateError = ValueCreateError; +// ------------------------------------------------------------------ +// Default +// ------------------------------------------------------------------ +function FromDefault(value) { + return (0, guard_1.IsFunction)(value) ? value() : (0, index_3.Clone)(value); +} +// ------------------------------------------------------------------ +// Create +// ------------------------------------------------------------------ +function FromAny(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return {}; + } +} +function FromArgument(schema, references) { + return {}; +} +function FromArray(schema, references) { + if (schema.uniqueItems === true && !(0, index_1.HasPropertyKey)(schema, 'default')) { + throw new ValueCreateError(schema, 'Array with the uniqueItems constraint requires a default value'); + } + else if ('contains' in schema && !(0, index_1.HasPropertyKey)(schema, 'default')) { + throw new ValueCreateError(schema, 'Array with the contains constraint requires a default value'); + } + else if ('default' in schema) { + return FromDefault(schema.default); + } + else if (schema.minItems !== undefined) { + return Array.from({ length: schema.minItems }).map((item) => { + return Visit(schema.items, references); + }); + } + else { + return []; + } +} +function FromAsyncIterator(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return (async function* () { })(); + } +} +function FromBigInt(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return BigInt(0); + } +} +function FromBoolean(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return false; + } +} +function FromConstructor(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + const value = Visit(schema.returns, references); + if (typeof value === 'object' && !Array.isArray(value)) { + return class { + constructor() { + for (const [key, val] of Object.entries(value)) { + const self = this; + self[key] = val; + } + } + }; + } + else { + return class { + }; + } + } +} +function FromDate(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minimumTimestamp !== undefined) { + return new Date(schema.minimumTimestamp); + } + else { + return new Date(); + } +} +function FromFunction(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return () => Visit(schema.returns, references); + } +} +function FromImport(schema, references) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions]); +} +function FromInteger(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minimum !== undefined) { + return schema.minimum; + } + else { + return 0; + } +} +function FromIntersect(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + // -------------------------------------------------------------- + // Note: The best we can do here is attempt to instance each + // sub type and apply through object assign. For non-object + // sub types, we just escape the assignment and just return + // the value. In the latter case, this is typically going to + // be a consequence of an illogical intersection. + // -------------------------------------------------------------- + const value = schema.allOf.reduce((acc, schema) => { + const next = Visit(schema, references); + return typeof next === 'object' ? { ...acc, ...next } : next; + }, {}); + if (!(0, index_2.Check)(schema, references, value)) + throw new ValueCreateError(schema, 'Intersect produced invalid value. Consider using a default value.'); + return value; + } +} +function FromIterator(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return (function* () { })(); + } +} +function FromLiteral(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return schema.const; + } +} +function FromNever(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new ValueCreateError(schema, 'Never types cannot be created. Consider using a default value.'); + } +} +function FromNot(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new ValueCreateError(schema, 'Not types must have a default value'); + } +} +function FromNull(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return null; + } +} +function FromNumber(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minimum !== undefined) { + return schema.minimum; + } + else { + return 0; + } +} +function FromObject(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + const required = new Set(schema.required); + const Acc = {}; + for (const [key, subschema] of Object.entries(schema.properties)) { + if (!required.has(key)) + continue; + Acc[key] = Visit(subschema, references); + } + return Acc; + } +} +function FromPromise(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return Promise.resolve(Visit(schema.item, references)); + } +} +function FromRecord(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return {}; + } +} +function FromRef(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return Visit((0, index_4.Deref)(schema, references), references); + } +} +function FromRegExp(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new ValueCreateError(schema, 'RegExp types cannot be created. Consider using a default value.'); + } +} +function FromString(schema, references) { + if (schema.pattern !== undefined) { + if (!(0, index_1.HasPropertyKey)(schema, 'default')) { + throw new ValueCreateError(schema, 'String types with patterns must specify a default value'); + } + else { + return FromDefault(schema.default); + } + } + else if (schema.format !== undefined) { + if (!(0, index_1.HasPropertyKey)(schema, 'default')) { + throw new ValueCreateError(schema, 'String types with formats must specify a default value'); + } + else { + return FromDefault(schema.default); + } + } + else { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minLength !== undefined) { + // prettier-ignore + return Array.from({ length: schema.minLength }).map(() => ' ').join(''); + } + else { + return ''; + } + } +} +function FromSymbol(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else if ('value' in schema) { + return Symbol.for(schema.value); + } + else { + return Symbol(); + } +} +function FromTemplateLiteral(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + if (!(0, index_5.IsTemplateLiteralFinite)(schema)) + throw new ValueCreateError(schema, 'Can only create template literals that produce a finite variants. Consider using a default value.'); + const generated = (0, index_5.TemplateLiteralGenerate)(schema); + return generated[0]; +} +function FromThis(schema, references) { + if (recursiveDepth++ > recursiveMaxDepth) + throw new ValueCreateError(schema, 'Cannot create recursive type as it appears possibly infinite. Consider using a default.'); + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return Visit((0, index_4.Deref)(schema, references), references); + } +} +function FromTuple(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + if (schema.items === undefined) { + return []; + } + else { + return Array.from({ length: schema.minItems }).map((_, index) => Visit(schema.items[index], references)); + } +} +function FromUndefined(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return undefined; + } +} +function FromUnion(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.anyOf.length === 0) { + throw new Error('ValueCreate.Union: Cannot create Union with zero variants'); + } + else { + return Visit(schema.anyOf[0], references); + } +} +function FromUint8Array(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minByteLength !== undefined) { + return new Uint8Array(schema.minByteLength); + } + else { + return new Uint8Array(0); + } +} +function FromUnknown(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return {}; + } +} +function FromVoid(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return void 0; + } +} +function FromKind(schema, references) { + if ((0, index_1.HasPropertyKey)(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new Error('User defined types must specify a default value'); + } +} +function Visit(schema, references) { + const references_ = (0, index_4.Pushref)(schema, references); + const schema_ = schema; + switch (schema_[index_7.Kind]) { + case 'Any': + return FromAny(schema_, references_); + case 'Argument': + return FromArgument(schema_, references_); + case 'Array': + return FromArray(schema_, references_); + case 'AsyncIterator': + return FromAsyncIterator(schema_, references_); + case 'BigInt': + return FromBigInt(schema_, references_); + case 'Boolean': + return FromBoolean(schema_, references_); + case 'Constructor': + return FromConstructor(schema_, references_); + case 'Date': + return FromDate(schema_, references_); + case 'Function': + return FromFunction(schema_, references_); + case 'Import': + return FromImport(schema_, references_); + case 'Integer': + return FromInteger(schema_, references_); + case 'Intersect': + return FromIntersect(schema_, references_); + case 'Iterator': + return FromIterator(schema_, references_); + case 'Literal': + return FromLiteral(schema_, references_); + case 'Never': + return FromNever(schema_, references_); + case 'Not': + return FromNot(schema_, references_); + case 'Null': + return FromNull(schema_, references_); + case 'Number': + return FromNumber(schema_, references_); + case 'Object': + return FromObject(schema_, references_); + case 'Promise': + return FromPromise(schema_, references_); + case 'Record': + return FromRecord(schema_, references_); + case 'Ref': + return FromRef(schema_, references_); + case 'RegExp': + return FromRegExp(schema_, references_); + case 'String': + return FromString(schema_, references_); + case 'Symbol': + return FromSymbol(schema_, references_); + case 'TemplateLiteral': + return FromTemplateLiteral(schema_, references_); + case 'This': + return FromThis(schema_, references_); + case 'Tuple': + return FromTuple(schema_, references_); + case 'Undefined': + return FromUndefined(schema_, references_); + case 'Union': + return FromUnion(schema_, references_); + case 'Uint8Array': + return FromUint8Array(schema_, references_); + case 'Unknown': + return FromUnknown(schema_, references_); + case 'Void': + return FromVoid(schema_, references_); + default: + if (!index_6.TypeRegistry.Has(schema_[index_7.Kind])) + throw new ValueCreateError(schema_, 'Unknown type'); + return FromKind(schema_, references_); + } +} +// ------------------------------------------------------------------ +// State +// ------------------------------------------------------------------ +const recursiveMaxDepth = 512; +let recursiveDepth = 0; +/** Creates a value from the given schema */ +function Create(...args) { + recursiveDepth = 0; + return args.length === 2 ? Visit(args[0], args[1]) : Visit(args[0], []); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.d.ts new file mode 100644 index 0000000..1e03cce --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.d.ts @@ -0,0 +1 @@ +export * from './create'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.js new file mode 100644 index 0000000..03ff0b3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/create/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./create"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.d.ts new file mode 100644 index 0000000..3e1f16f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.d.ts @@ -0,0 +1,6 @@ +import type { TSchema } from '../../type/schema/index'; +import type { StaticDecode } from '../../type/static/index'; +/** Decodes a value or throws if error */ +export declare function Decode, Result extends Static = Static>(schema: T, references: TSchema[], value: unknown): Result; +/** Decodes a value or throws if error */ +export declare function Decode, Result extends Static = Static>(schema: T, value: unknown): Result; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.js new file mode 100644 index 0000000..5dd2749 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/decode.js @@ -0,0 +1,14 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Decode = Decode; +const index_1 = require("../transform/index"); +const index_2 = require("../check/index"); +const index_3 = require("../../errors/index"); +/** Decodes a value or throws if error */ +function Decode(...args) { + const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]]; + if (!(0, index_2.Check)(schema, references, value)) + throw new index_1.TransformDecodeCheckError(schema, value, (0, index_3.Errors)(schema, references, value).First()); + return (0, index_1.HasTransform)(schema, references) ? (0, index_1.TransformDecode)(schema, references, value) : value; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.d.ts new file mode 100644 index 0000000..92fccb9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.d.ts @@ -0,0 +1 @@ +export * from './decode'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.js new file mode 100644 index 0000000..beb28a1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/decode/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./decode"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.d.ts new file mode 100644 index 0000000..3b7d7db --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.d.ts @@ -0,0 +1,5 @@ +import type { TSchema } from '../../type/schema/index'; +/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Default(schema: TSchema, references: TSchema[], value: unknown): unknown; +/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Default(schema: TSchema, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.js new file mode 100644 index 0000000..7e71d11 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/default.js @@ -0,0 +1,176 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Default = Default; +const index_1 = require("../check/index"); +const index_2 = require("../clone/index"); +const index_3 = require("../deref/index"); +const index_4 = require("../../type/symbols/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_5 = require("../guard/index"); +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +const kind_1 = require("../../type/guard/kind"); +// ------------------------------------------------------------------ +// ValueOrDefault +// ------------------------------------------------------------------ +function ValueOrDefault(schema, value) { + const defaultValue = (0, index_5.HasPropertyKey)(schema, 'default') ? schema.default : undefined; + const clone = (0, index_5.IsFunction)(defaultValue) ? defaultValue() : (0, index_2.Clone)(defaultValue); + return (0, index_5.IsUndefined)(value) ? clone : (0, index_5.IsObject)(value) && (0, index_5.IsObject)(clone) ? Object.assign(clone, value) : value; +} +// ------------------------------------------------------------------ +// HasDefaultProperty +// ------------------------------------------------------------------ +function HasDefaultProperty(schema) { + return (0, kind_1.IsKind)(schema) && 'default' in schema; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + // if the value is an array, we attempt to initialize it's elements + if ((0, index_5.IsArray)(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = Visit(schema.items, references, value[i]); + } + return value; + } + // ... otherwise use default initialization + const defaulted = ValueOrDefault(schema, value); + if (!(0, index_5.IsArray)(defaulted)) + return defaulted; + for (let i = 0; i < defaulted.length; i++) { + defaulted[i] = Visit(schema.items, references, defaulted[i]); + } + return defaulted; +} +function FromDate(schema, references, value) { + // special case intercept for dates + return (0, index_5.IsDate)(value) ? value : ValueOrDefault(schema, value); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromIntersect(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + return schema.allOf.reduce((acc, schema) => { + const next = Visit(schema, references, defaulted); + return (0, index_5.IsObject)(next) ? { ...acc, ...next } : next; + }, {}); +} +function FromObject(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + // return defaulted + if (!(0, index_5.IsObject)(defaulted)) + return defaulted; + const knownPropertyKeys = Object.getOwnPropertyNames(schema.properties); + // properties + for (const key of knownPropertyKeys) { + // note: we need to traverse into the object and test if the return value + // yielded a non undefined result. Here we interpret an undefined result as + // a non assignable property and continue. + const propertyValue = Visit(schema.properties[key], references, defaulted[key]); + if ((0, index_5.IsUndefined)(propertyValue)) + continue; + defaulted[key] = Visit(schema.properties[key], references, defaulted[key]); + } + // return if not additional properties + if (!HasDefaultProperty(schema.additionalProperties)) + return defaulted; + // additional properties + for (const key of Object.getOwnPropertyNames(defaulted)) { + if (knownPropertyKeys.includes(key)) + continue; + defaulted[key] = Visit(schema.additionalProperties, references, defaulted[key]); + } + return defaulted; +} +function FromRecord(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + if (!(0, index_5.IsObject)(defaulted)) + return defaulted; + const additionalPropertiesSchema = schema.additionalProperties; + const [propertyKeyPattern, propertySchema] = Object.entries(schema.patternProperties)[0]; + const knownPropertyKey = new RegExp(propertyKeyPattern); + // properties + for (const key of Object.getOwnPropertyNames(defaulted)) { + if (!(knownPropertyKey.test(key) && HasDefaultProperty(propertySchema))) + continue; + defaulted[key] = Visit(propertySchema, references, defaulted[key]); + } + // return if not additional properties + if (!HasDefaultProperty(additionalPropertiesSchema)) + return defaulted; + // additional properties + for (const key of Object.getOwnPropertyNames(defaulted)) { + if (knownPropertyKey.test(key)) + continue; + defaulted[key] = Visit(additionalPropertiesSchema, references, defaulted[key]); + } + return defaulted; +} +function FromRef(schema, references, value) { + return Visit((0, index_3.Deref)(schema, references), references, ValueOrDefault(schema, value)); +} +function FromThis(schema, references, value) { + return Visit((0, index_3.Deref)(schema, references), references, value); +} +function FromTuple(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + if (!(0, index_5.IsArray)(defaulted) || (0, index_5.IsUndefined)(schema.items)) + return defaulted; + const [items, max] = [schema.items, Math.max(schema.items.length, defaulted.length)]; + for (let i = 0; i < max; i++) { + if (i < items.length) + defaulted[i] = Visit(items[i], references, defaulted[i]); + } + return defaulted; +} +function FromUnion(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + for (const inner of schema.anyOf) { + const result = Visit(inner, references, (0, index_2.Clone)(defaulted)); + if ((0, index_1.Check)(inner, references, result)) { + return result; + } + } + return defaulted; +} +function Visit(schema, references, value) { + const references_ = (0, index_3.Pushref)(schema, references); + const schema_ = schema; + switch (schema_[index_4.Kind]) { + case 'Array': + return FromArray(schema_, references_, value); + case 'Date': + return FromDate(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + default: + return ValueOrDefault(schema_, value); + } +} +/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ +function Default(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.d.ts new file mode 100644 index 0000000..acced89 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.d.ts @@ -0,0 +1 @@ +export * from './default'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.js new file mode 100644 index 0000000..8d122b0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/default/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./default"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.d.ts new file mode 100644 index 0000000..78f274a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.d.ts @@ -0,0 +1,32 @@ +import type { Static } from '../../type/static/index'; +import { TypeBoxError } from '../../type/error/index'; +import { type TLiteral } from '../../type/literal/index'; +import { type TObject } from '../../type/object/index'; +import { type TString } from '../../type/string/index'; +import { type TUnknown } from '../../type/unknown/index'; +import { type TUnion } from '../../type/union/index'; +export type Insert = Static; +export declare const Insert: TObject<{ + type: TLiteral<'insert'>; + path: TString; + value: TUnknown; +}>; +export type Update = Static; +export declare const Update: TObject<{ + type: TLiteral<'update'>; + path: TString; + value: TUnknown; +}>; +export type Delete = Static; +export declare const Delete: TObject<{ + type: TLiteral<'delete'>; + path: TString; +}>; +export type Edit = Static; +export declare const Edit: TUnion<[typeof Insert, typeof Update, typeof Delete]>; +export declare class ValueDiffError extends TypeBoxError { + readonly value: unknown; + constructor(value: unknown, message: string); +} +export declare function Diff(current: unknown, next: unknown): Edit[]; +export declare function Patch(current: unknown, edits: Edit[]): T; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.js new file mode 100644 index 0000000..3b4da63 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/delta.js @@ -0,0 +1,178 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueDiffError = exports.Edit = exports.Delete = exports.Update = exports.Insert = void 0; +exports.Diff = Diff; +exports.Patch = Patch; +const index_1 = require("../guard/index"); +const index_2 = require("../pointer/index"); +const index_3 = require("../clone/index"); +const equal_1 = require("../equal/equal"); +const index_4 = require("../../type/error/index"); +const index_5 = require("../../type/literal/index"); +const index_6 = require("../../type/object/index"); +const index_7 = require("../../type/string/index"); +const index_8 = require("../../type/unknown/index"); +const index_9 = require("../../type/union/index"); +exports.Insert = (0, index_6.Object)({ + type: (0, index_5.Literal)('insert'), + path: (0, index_7.String)(), + value: (0, index_8.Unknown)(), +}); +exports.Update = (0, index_6.Object)({ + type: (0, index_5.Literal)('update'), + path: (0, index_7.String)(), + value: (0, index_8.Unknown)(), +}); +exports.Delete = (0, index_6.Object)({ + type: (0, index_5.Literal)('delete'), + path: (0, index_7.String)(), +}); +exports.Edit = (0, index_9.Union)([exports.Insert, exports.Update, exports.Delete]); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class ValueDiffError extends index_4.TypeBoxError { + constructor(value, message) { + super(message); + this.value = value; + } +} +exports.ValueDiffError = ValueDiffError; +// ------------------------------------------------------------------ +// Command Factory +// ------------------------------------------------------------------ +function CreateUpdate(path, value) { + return { type: 'update', path, value }; +} +function CreateInsert(path, value) { + return { type: 'insert', path, value }; +} +function CreateDelete(path) { + return { type: 'delete', path }; +} +// ------------------------------------------------------------------ +// AssertDiffable +// ------------------------------------------------------------------ +function AssertDiffable(value) { + if (globalThis.Object.getOwnPropertySymbols(value).length > 0) + throw new ValueDiffError(value, 'Cannot diff objects with symbols'); +} +// ------------------------------------------------------------------ +// Diffing Generators +// ------------------------------------------------------------------ +function* ObjectType(path, current, next) { + AssertDiffable(current); + AssertDiffable(next); + if (!(0, index_1.IsStandardObject)(next)) + return yield CreateUpdate(path, next); + const currentKeys = globalThis.Object.getOwnPropertyNames(current); + const nextKeys = globalThis.Object.getOwnPropertyNames(next); + // ---------------------------------------------------------------- + // inserts + // ---------------------------------------------------------------- + for (const key of nextKeys) { + if ((0, index_1.HasPropertyKey)(current, key)) + continue; + yield CreateInsert(`${path}/${key}`, next[key]); + } + // ---------------------------------------------------------------- + // updates + // ---------------------------------------------------------------- + for (const key of currentKeys) { + if (!(0, index_1.HasPropertyKey)(next, key)) + continue; + if ((0, equal_1.Equal)(current, next)) + continue; + yield* Visit(`${path}/${key}`, current[key], next[key]); + } + // ---------------------------------------------------------------- + // deletes + // ---------------------------------------------------------------- + for (const key of currentKeys) { + if ((0, index_1.HasPropertyKey)(next, key)) + continue; + yield CreateDelete(`${path}/${key}`); + } +} +function* ArrayType(path, current, next) { + if (!(0, index_1.IsArray)(next)) + return yield CreateUpdate(path, next); + for (let i = 0; i < Math.min(current.length, next.length); i++) { + yield* Visit(`${path}/${i}`, current[i], next[i]); + } + for (let i = 0; i < next.length; i++) { + if (i < current.length) + continue; + yield CreateInsert(`${path}/${i}`, next[i]); + } + for (let i = current.length - 1; i >= 0; i--) { + if (i < next.length) + continue; + yield CreateDelete(`${path}/${i}`); + } +} +function* TypedArrayType(path, current, next) { + if (!(0, index_1.IsTypedArray)(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name) + return yield CreateUpdate(path, next); + for (let i = 0; i < Math.min(current.length, next.length); i++) { + yield* Visit(`${path}/${i}`, current[i], next[i]); + } +} +function* ValueType(path, current, next) { + if (current === next) + return; + yield CreateUpdate(path, next); +} +function* Visit(path, current, next) { + if ((0, index_1.IsStandardObject)(current)) + return yield* ObjectType(path, current, next); + if ((0, index_1.IsArray)(current)) + return yield* ArrayType(path, current, next); + if ((0, index_1.IsTypedArray)(current)) + return yield* TypedArrayType(path, current, next); + if ((0, index_1.IsValueType)(current)) + return yield* ValueType(path, current, next); + throw new ValueDiffError(current, 'Unable to diff value'); +} +// ------------------------------------------------------------------ +// Diff +// ------------------------------------------------------------------ +function Diff(current, next) { + return [...Visit('', current, next)]; +} +// ------------------------------------------------------------------ +// Patch +// ------------------------------------------------------------------ +function IsRootUpdate(edits) { + return edits.length > 0 && edits[0].path === '' && edits[0].type === 'update'; +} +function IsIdentity(edits) { + return edits.length === 0; +} +function Patch(current, edits) { + if (IsRootUpdate(edits)) { + return (0, index_3.Clone)(edits[0].value); + } + if (IsIdentity(edits)) { + return (0, index_3.Clone)(current); + } + const clone = (0, index_3.Clone)(current); + for (const edit of edits) { + switch (edit.type) { + case 'insert': { + index_2.ValuePointer.Set(clone, edit.path, edit.value); + break; + } + case 'update': { + index_2.ValuePointer.Set(clone, edit.path, edit.value); + break; + } + case 'delete': { + index_2.ValuePointer.Delete(clone, edit.path); + break; + } + } + } + return clone; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.d.ts new file mode 100644 index 0000000..30b4b95 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.d.ts @@ -0,0 +1 @@ +export * from './delta'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.js new file mode 100644 index 0000000..54f49ac --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/delta/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./delta"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.d.ts new file mode 100644 index 0000000..95cda81 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.d.ts @@ -0,0 +1,12 @@ +import type { TSchema } from '../../type/schema/index'; +import type { TRef } from '../../type/ref/index'; +import type { TThis } from '../../type/recursive/index'; +import { TypeBoxError } from '../../type/error/index'; +export declare class TypeDereferenceError extends TypeBoxError { + readonly schema: TRef | TThis; + constructor(schema: TRef | TThis); +} +/** `[Internal]` Pushes a schema onto references if the schema has an $id and does not exist on references */ +export declare function Pushref(schema: TSchema, references: TSchema[]): TSchema[]; +/** `[Internal]` Dereferences a schema from the references array or throws if not found */ +export declare function Deref(schema: TSchema, references: TSchema[]): TSchema; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.js new file mode 100644 index 0000000..421dd2d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/deref.js @@ -0,0 +1,36 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypeDereferenceError = void 0; +exports.Pushref = Pushref; +exports.Deref = Deref; +const index_1 = require("../../type/error/index"); +const index_2 = require("../../type/symbols/index"); +const guard_1 = require("../guard/guard"); +class TypeDereferenceError extends index_1.TypeBoxError { + constructor(schema) { + super(`Unable to dereference schema with $id '${schema.$ref}'`); + this.schema = schema; + } +} +exports.TypeDereferenceError = TypeDereferenceError; +function Resolve(schema, references) { + const target = references.find((target) => target.$id === schema.$ref); + if (target === undefined) + throw new TypeDereferenceError(schema); + return Deref(target, references); +} +/** `[Internal]` Pushes a schema onto references if the schema has an $id and does not exist on references */ +function Pushref(schema, references) { + if (!(0, guard_1.IsString)(schema.$id) || references.some((target) => target.$id === schema.$id)) + return references; + references.push(schema); + return references; +} +/** `[Internal]` Dereferences a schema from the references array or throws if not found */ +function Deref(schema, references) { + // prettier-ignore + return (schema[index_2.Kind] === 'This' || schema[index_2.Kind] === 'Ref') + ? Resolve(schema, references) + : schema; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.d.ts new file mode 100644 index 0000000..329a6ea --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.d.ts @@ -0,0 +1 @@ +export * from './deref'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.js new file mode 100644 index 0000000..6b8ba2e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/deref/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./deref"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.d.ts new file mode 100644 index 0000000..88d7145 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.d.ts @@ -0,0 +1,6 @@ +import type { TSchema } from '../../type/schema/index'; +import type { StaticEncode } from '../../type/static/index'; +/** Encodes a value or throws if error */ +export declare function Encode, Result extends Static = Static>(schema: T, references: TSchema[], value: unknown): Result; +/** Encodes a value or throws if error */ +export declare function Encode, Result extends Static = Static>(schema: T, value: unknown): Result; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.js new file mode 100644 index 0000000..daa465a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/encode.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Encode = Encode; +const index_1 = require("../transform/index"); +const index_2 = require("../check/index"); +const index_3 = require("../../errors/index"); +/** Encodes a value or throws if error */ +function Encode(...args) { + const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]]; + const encoded = (0, index_1.HasTransform)(schema, references) ? (0, index_1.TransformEncode)(schema, references, value) : value; + if (!(0, index_2.Check)(schema, references, encoded)) + throw new index_1.TransformEncodeCheckError(schema, encoded, (0, index_3.Errors)(schema, references, encoded).First()); + return encoded; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.d.ts new file mode 100644 index 0000000..a447c57 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.d.ts @@ -0,0 +1 @@ +export * from './encode'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.js new file mode 100644 index 0000000..39261de --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/encode/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./encode"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.d.ts new file mode 100644 index 0000000..d1095c4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.d.ts @@ -0,0 +1,2 @@ +/** Returns true if the left value deep-equals the right */ +export declare function Equal(left: T, right: unknown): right is T; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.js new file mode 100644 index 0000000..48e2010 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/equal.js @@ -0,0 +1,50 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Equal = Equal; +const index_1 = require("../guard/index"); +// ------------------------------------------------------------------ +// Equality Checks +// ------------------------------------------------------------------ +function ObjectType(left, right) { + if (!(0, index_1.IsObject)(right)) + return false; + const leftKeys = [...Object.keys(left), ...Object.getOwnPropertySymbols(left)]; + const rightKeys = [...Object.keys(right), ...Object.getOwnPropertySymbols(right)]; + if (leftKeys.length !== rightKeys.length) + return false; + return leftKeys.every((key) => Equal(left[key], right[key])); +} +function DateType(left, right) { + return (0, index_1.IsDate)(right) && left.getTime() === right.getTime(); +} +function ArrayType(left, right) { + if (!(0, index_1.IsArray)(right) || left.length !== right.length) + return false; + return left.every((value, index) => Equal(value, right[index])); +} +function TypedArrayType(left, right) { + if (!(0, index_1.IsTypedArray)(right) || left.length !== right.length || Object.getPrototypeOf(left).constructor.name !== Object.getPrototypeOf(right).constructor.name) + return false; + return left.every((value, index) => Equal(value, right[index])); +} +function ValueType(left, right) { + return left === right; +} +// ------------------------------------------------------------------ +// Equal +// ------------------------------------------------------------------ +/** Returns true if the left value deep-equals the right */ +function Equal(left, right) { + if ((0, index_1.IsDate)(left)) + return DateType(left, right); + if ((0, index_1.IsTypedArray)(left)) + return TypedArrayType(left, right); + if ((0, index_1.IsArray)(left)) + return ArrayType(left, right); + if ((0, index_1.IsObject)(left)) + return ObjectType(left, right); + if ((0, index_1.IsValueType)(left)) + return ValueType(left, right); + throw new Error('ValueEquals: Unable to compare value'); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.d.ts new file mode 100644 index 0000000..1dc2694 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.d.ts @@ -0,0 +1 @@ +export * from './equal'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.js new file mode 100644 index 0000000..73607b0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/equal/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./equal"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.d.ts new file mode 100644 index 0000000..0a5f115 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.d.ts @@ -0,0 +1,74 @@ +export type ObjectType = Record; +export type ArrayType = unknown[]; +export type ValueType = null | undefined | symbol | bigint | number | boolean | string; +export type TypedArrayType = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; +/** Returns true if this value is an async iterator */ +export declare function IsAsyncIterator(value: unknown): value is AsyncIterableIterator; +/** Returns true if this value is an iterator */ +export declare function IsIterator(value: unknown): value is IterableIterator; +/** Returns true if this value is not an instance of a class */ +export declare function IsStandardObject(value: unknown): value is ObjectType; +/** Returns true if this value is an instance of a class */ +export declare function IsInstanceObject(value: unknown): value is ObjectType; +/** Returns true if this value is a Promise */ +export declare function IsPromise(value: unknown): value is Promise; +/** Returns true if this value is a Date */ +export declare function IsDate(value: unknown): value is Date; +/** Returns true if this value is an instance of Map */ +export declare function IsMap(value: unknown): value is Map; +/** Returns true if this value is an instance of Set */ +export declare function IsSet(value: unknown): value is Set; +/** Returns true if this value is RegExp */ +export declare function IsRegExp(value: unknown): value is RegExp; +/** Returns true if this value is a typed array */ +export declare function IsTypedArray(value: unknown): value is TypedArrayType; +/** Returns true if the value is a Int8Array */ +export declare function IsInt8Array(value: unknown): value is Int8Array; +/** Returns true if the value is a Uint8Array */ +export declare function IsUint8Array(value: unknown): value is Uint8Array; +/** Returns true if the value is a Uint8ClampedArray */ +export declare function IsUint8ClampedArray(value: unknown): value is Uint8ClampedArray; +/** Returns true if the value is a Int16Array */ +export declare function IsInt16Array(value: unknown): value is Int16Array; +/** Returns true if the value is a Uint16Array */ +export declare function IsUint16Array(value: unknown): value is Uint16Array; +/** Returns true if the value is a Int32Array */ +export declare function IsInt32Array(value: unknown): value is Int32Array; +/** Returns true if the value is a Uint32Array */ +export declare function IsUint32Array(value: unknown): value is Uint32Array; +/** Returns true if the value is a Float32Array */ +export declare function IsFloat32Array(value: unknown): value is Float32Array; +/** Returns true if the value is a Float64Array */ +export declare function IsFloat64Array(value: unknown): value is Float64Array; +/** Returns true if the value is a BigInt64Array */ +export declare function IsBigInt64Array(value: unknown): value is BigInt64Array; +/** Returns true if the value is a BigUint64Array */ +export declare function IsBigUint64Array(value: unknown): value is BigUint64Array; +/** Returns true if this value has this property key */ +export declare function HasPropertyKey(value: Record, key: K): value is Record & { + [_ in K]: unknown; +}; +/** Returns true of this value is an object type */ +export declare function IsObject(value: unknown): value is ObjectType; +/** Returns true if this value is an array, but not a typed array */ +export declare function IsArray(value: unknown): value is ArrayType; +/** Returns true if this value is an undefined */ +export declare function IsUndefined(value: unknown): value is undefined; +/** Returns true if this value is an null */ +export declare function IsNull(value: unknown): value is null; +/** Returns true if this value is an boolean */ +export declare function IsBoolean(value: unknown): value is boolean; +/** Returns true if this value is an number */ +export declare function IsNumber(value: unknown): value is number; +/** Returns true if this value is an integer */ +export declare function IsInteger(value: unknown): value is number; +/** Returns true if this value is bigint */ +export declare function IsBigInt(value: unknown): value is bigint; +/** Returns true if this value is string */ +export declare function IsString(value: unknown): value is string; +/** Returns true if this value is a function */ +export declare function IsFunction(value: unknown): value is Function; +/** Returns true if this value is a symbol */ +export declare function IsSymbol(value: unknown): value is symbol; +/** Returns true if this value is a value type such as number, string, boolean */ +export declare function IsValueType(value: unknown): value is ValueType; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.js new file mode 100644 index 0000000..14acc38 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/guard.js @@ -0,0 +1,195 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsAsyncIterator = IsAsyncIterator; +exports.IsIterator = IsIterator; +exports.IsStandardObject = IsStandardObject; +exports.IsInstanceObject = IsInstanceObject; +exports.IsPromise = IsPromise; +exports.IsDate = IsDate; +exports.IsMap = IsMap; +exports.IsSet = IsSet; +exports.IsRegExp = IsRegExp; +exports.IsTypedArray = IsTypedArray; +exports.IsInt8Array = IsInt8Array; +exports.IsUint8Array = IsUint8Array; +exports.IsUint8ClampedArray = IsUint8ClampedArray; +exports.IsInt16Array = IsInt16Array; +exports.IsUint16Array = IsUint16Array; +exports.IsInt32Array = IsInt32Array; +exports.IsUint32Array = IsUint32Array; +exports.IsFloat32Array = IsFloat32Array; +exports.IsFloat64Array = IsFloat64Array; +exports.IsBigInt64Array = IsBigInt64Array; +exports.IsBigUint64Array = IsBigUint64Array; +exports.HasPropertyKey = HasPropertyKey; +exports.IsObject = IsObject; +exports.IsArray = IsArray; +exports.IsUndefined = IsUndefined; +exports.IsNull = IsNull; +exports.IsBoolean = IsBoolean; +exports.IsNumber = IsNumber; +exports.IsInteger = IsInteger; +exports.IsBigInt = IsBigInt; +exports.IsString = IsString; +exports.IsFunction = IsFunction; +exports.IsSymbol = IsSymbol; +exports.IsValueType = IsValueType; +// -------------------------------------------------------------------------- +// Iterators +// -------------------------------------------------------------------------- +/** Returns true if this value is an async iterator */ +function IsAsyncIterator(value) { + return IsObject(value) && globalThis.Symbol.asyncIterator in value; +} +/** Returns true if this value is an iterator */ +function IsIterator(value) { + return IsObject(value) && globalThis.Symbol.iterator in value; +} +// -------------------------------------------------------------------------- +// Object Instances +// -------------------------------------------------------------------------- +/** Returns true if this value is not an instance of a class */ +function IsStandardObject(value) { + return IsObject(value) && (globalThis.Object.getPrototypeOf(value) === Object.prototype || globalThis.Object.getPrototypeOf(value) === null); +} +/** Returns true if this value is an instance of a class */ +function IsInstanceObject(value) { + return IsObject(value) && !IsArray(value) && IsFunction(value.constructor) && value.constructor.name !== 'Object'; +} +// -------------------------------------------------------------------------- +// JavaScript +// -------------------------------------------------------------------------- +/** Returns true if this value is a Promise */ +function IsPromise(value) { + return value instanceof globalThis.Promise; +} +/** Returns true if this value is a Date */ +function IsDate(value) { + return value instanceof Date && globalThis.Number.isFinite(value.getTime()); +} +/** Returns true if this value is an instance of Map */ +function IsMap(value) { + return value instanceof globalThis.Map; +} +/** Returns true if this value is an instance of Set */ +function IsSet(value) { + return value instanceof globalThis.Set; +} +/** Returns true if this value is RegExp */ +function IsRegExp(value) { + return value instanceof globalThis.RegExp; +} +/** Returns true if this value is a typed array */ +function IsTypedArray(value) { + return globalThis.ArrayBuffer.isView(value); +} +/** Returns true if the value is a Int8Array */ +function IsInt8Array(value) { + return value instanceof globalThis.Int8Array; +} +/** Returns true if the value is a Uint8Array */ +function IsUint8Array(value) { + return value instanceof globalThis.Uint8Array; +} +/** Returns true if the value is a Uint8ClampedArray */ +function IsUint8ClampedArray(value) { + return value instanceof globalThis.Uint8ClampedArray; +} +/** Returns true if the value is a Int16Array */ +function IsInt16Array(value) { + return value instanceof globalThis.Int16Array; +} +/** Returns true if the value is a Uint16Array */ +function IsUint16Array(value) { + return value instanceof globalThis.Uint16Array; +} +/** Returns true if the value is a Int32Array */ +function IsInt32Array(value) { + return value instanceof globalThis.Int32Array; +} +/** Returns true if the value is a Uint32Array */ +function IsUint32Array(value) { + return value instanceof globalThis.Uint32Array; +} +/** Returns true if the value is a Float32Array */ +function IsFloat32Array(value) { + return value instanceof globalThis.Float32Array; +} +/** Returns true if the value is a Float64Array */ +function IsFloat64Array(value) { + return value instanceof globalThis.Float64Array; +} +/** Returns true if the value is a BigInt64Array */ +function IsBigInt64Array(value) { + return value instanceof globalThis.BigInt64Array; +} +/** Returns true if the value is a BigUint64Array */ +function IsBigUint64Array(value) { + return value instanceof globalThis.BigUint64Array; +} +// -------------------------------------------------------------------------- +// PropertyKey +// -------------------------------------------------------------------------- +/** Returns true if this value has this property key */ +function HasPropertyKey(value, key) { + return key in value; +} +// -------------------------------------------------------------------------- +// Standard +// -------------------------------------------------------------------------- +/** Returns true of this value is an object type */ +function IsObject(value) { + return value !== null && typeof value === 'object'; +} +/** Returns true if this value is an array, but not a typed array */ +function IsArray(value) { + return globalThis.Array.isArray(value) && !globalThis.ArrayBuffer.isView(value); +} +/** Returns true if this value is an undefined */ +function IsUndefined(value) { + return value === undefined; +} +/** Returns true if this value is an null */ +function IsNull(value) { + return value === null; +} +/** Returns true if this value is an boolean */ +function IsBoolean(value) { + return typeof value === 'boolean'; +} +/** Returns true if this value is an number */ +function IsNumber(value) { + return typeof value === 'number'; +} +/** Returns true if this value is an integer */ +function IsInteger(value) { + return globalThis.Number.isInteger(value); +} +/** Returns true if this value is bigint */ +function IsBigInt(value) { + return typeof value === 'bigint'; +} +/** Returns true if this value is string */ +function IsString(value) { + return typeof value === 'string'; +} +/** Returns true if this value is a function */ +function IsFunction(value) { + return typeof value === 'function'; +} +/** Returns true if this value is a symbol */ +function IsSymbol(value) { + return typeof value === 'symbol'; +} +/** Returns true if this value is a value type such as number, string, boolean */ +function IsValueType(value) { + // prettier-ignore + return (IsBigInt(value) || + IsBoolean(value) || + IsNull(value) || + IsNumber(value) || + IsString(value) || + IsSymbol(value) || + IsUndefined(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.d.ts new file mode 100644 index 0000000..def4962 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.d.ts @@ -0,0 +1 @@ +export * from './guard'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.js new file mode 100644 index 0000000..4735f3e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/guard/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./guard"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.d.ts new file mode 100644 index 0000000..f6fdc27 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.d.ts @@ -0,0 +1,7 @@ +import { TypeBoxError } from '../../type/error/index'; +export declare class ValueHashError extends TypeBoxError { + readonly value: unknown; + constructor(value: unknown); +} +/** Creates a FNV1A-64 non cryptographic hash of the given value */ +export declare function Hash(value: unknown): bigint; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.js new file mode 100644 index 0000000..2c1fcca --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/hash.js @@ -0,0 +1,152 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueHashError = void 0; +exports.Hash = Hash; +const index_1 = require("../guard/index"); +const index_2 = require("../../type/error/index"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class ValueHashError extends index_2.TypeBoxError { + constructor(value) { + super(`Unable to hash value`); + this.value = value; + } +} +exports.ValueHashError = ValueHashError; +// ------------------------------------------------------------------ +// ByteMarker +// ------------------------------------------------------------------ +var ByteMarker; +(function (ByteMarker) { + ByteMarker[ByteMarker["Undefined"] = 0] = "Undefined"; + ByteMarker[ByteMarker["Null"] = 1] = "Null"; + ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean"; + ByteMarker[ByteMarker["Number"] = 3] = "Number"; + ByteMarker[ByteMarker["String"] = 4] = "String"; + ByteMarker[ByteMarker["Object"] = 5] = "Object"; + ByteMarker[ByteMarker["Array"] = 6] = "Array"; + ByteMarker[ByteMarker["Date"] = 7] = "Date"; + ByteMarker[ByteMarker["Uint8Array"] = 8] = "Uint8Array"; + ByteMarker[ByteMarker["Symbol"] = 9] = "Symbol"; + ByteMarker[ByteMarker["BigInt"] = 10] = "BigInt"; +})(ByteMarker || (ByteMarker = {})); +// ------------------------------------------------------------------ +// State +// ------------------------------------------------------------------ +let Accumulator = BigInt('14695981039346656037'); +const [Prime, Size] = [BigInt('1099511628211'), BigInt('18446744073709551616' /* 2 ^ 64 */)]; +const Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i)); +const F64 = new Float64Array(1); +const F64In = new DataView(F64.buffer); +const F64Out = new Uint8Array(F64.buffer); +// ------------------------------------------------------------------ +// NumberToBytes +// ------------------------------------------------------------------ +function* NumberToBytes(value) { + const byteCount = value === 0 ? 1 : Math.ceil(Math.floor(Math.log2(value) + 1) / 8); + for (let i = 0; i < byteCount; i++) { + yield (value >> (8 * (byteCount - 1 - i))) & 0xff; + } +} +// ------------------------------------------------------------------ +// Hashing Functions +// ------------------------------------------------------------------ +function ArrayType(value) { + FNV1A64(ByteMarker.Array); + for (const item of value) { + Visit(item); + } +} +function BooleanType(value) { + FNV1A64(ByteMarker.Boolean); + FNV1A64(value ? 1 : 0); +} +function BigIntType(value) { + FNV1A64(ByteMarker.BigInt); + F64In.setBigInt64(0, value); + for (const byte of F64Out) { + FNV1A64(byte); + } +} +function DateType(value) { + FNV1A64(ByteMarker.Date); + Visit(value.getTime()); +} +function NullType(value) { + FNV1A64(ByteMarker.Null); +} +function NumberType(value) { + FNV1A64(ByteMarker.Number); + F64In.setFloat64(0, value); + for (const byte of F64Out) { + FNV1A64(byte); + } +} +function ObjectType(value) { + FNV1A64(ByteMarker.Object); + for (const key of globalThis.Object.getOwnPropertyNames(value).sort()) { + Visit(key); + Visit(value[key]); + } +} +function StringType(value) { + FNV1A64(ByteMarker.String); + for (let i = 0; i < value.length; i++) { + for (const byte of NumberToBytes(value.charCodeAt(i))) { + FNV1A64(byte); + } + } +} +function SymbolType(value) { + FNV1A64(ByteMarker.Symbol); + Visit(value.description); +} +function Uint8ArrayType(value) { + FNV1A64(ByteMarker.Uint8Array); + for (let i = 0; i < value.length; i++) { + FNV1A64(value[i]); + } +} +function UndefinedType(value) { + return FNV1A64(ByteMarker.Undefined); +} +function Visit(value) { + if ((0, index_1.IsArray)(value)) + return ArrayType(value); + if ((0, index_1.IsBoolean)(value)) + return BooleanType(value); + if ((0, index_1.IsBigInt)(value)) + return BigIntType(value); + if ((0, index_1.IsDate)(value)) + return DateType(value); + if ((0, index_1.IsNull)(value)) + return NullType(value); + if ((0, index_1.IsNumber)(value)) + return NumberType(value); + if ((0, index_1.IsObject)(value)) + return ObjectType(value); + if ((0, index_1.IsString)(value)) + return StringType(value); + if ((0, index_1.IsSymbol)(value)) + return SymbolType(value); + if ((0, index_1.IsUint8Array)(value)) + return Uint8ArrayType(value); + if ((0, index_1.IsUndefined)(value)) + return UndefinedType(value); + throw new ValueHashError(value); +} +function FNV1A64(byte) { + Accumulator = Accumulator ^ Bytes[byte]; + Accumulator = (Accumulator * Prime) % Size; +} +// ------------------------------------------------------------------ +// Hash +// ------------------------------------------------------------------ +/** Creates a FNV1A-64 non cryptographic hash of the given value */ +function Hash(value) { + Accumulator = BigInt('14695981039346656037'); + Visit(value); + return Accumulator; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.d.ts new file mode 100644 index 0000000..6719163 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.d.ts @@ -0,0 +1 @@ +export * from './hash'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.js new file mode 100644 index 0000000..789dfc0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/hash/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./hash"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/index.d.ts new file mode 100644 index 0000000..45a4d03 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/index.d.ts @@ -0,0 +1,20 @@ +export { ValueError, ValueErrorType, ValueErrorIterator } from '../errors/index'; +export * from './guard/index'; +export * from './assert/index'; +export * from './cast/index'; +export * from './check/index'; +export * from './clean/index'; +export * from './clone/index'; +export * from './convert/index'; +export * from './create/index'; +export * from './decode/index'; +export * from './default/index'; +export * from './delta/index'; +export * from './encode/index'; +export * from './equal/index'; +export * from './hash/index'; +export * from './mutate/index'; +export * from './parse/index'; +export * from './pointer/index'; +export * from './transform/index'; +export { Value } from './value/index'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/index.js new file mode 100644 index 0000000..3348788 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/index.js @@ -0,0 +1,53 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Value = exports.ValueErrorIterator = exports.ValueErrorType = void 0; +// ------------------------------------------------------------------ +// Errors (re-export) +// ------------------------------------------------------------------ +var index_1 = require("../errors/index"); +Object.defineProperty(exports, "ValueErrorType", { enumerable: true, get: function () { return index_1.ValueErrorType; } }); +Object.defineProperty(exports, "ValueErrorIterator", { enumerable: true, get: function () { return index_1.ValueErrorIterator; } }); +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +__exportStar(require("./guard/index"), exports); +// ------------------------------------------------------------------ +// Operators +// ------------------------------------------------------------------ +__exportStar(require("./assert/index"), exports); +__exportStar(require("./cast/index"), exports); +__exportStar(require("./check/index"), exports); +__exportStar(require("./clean/index"), exports); +__exportStar(require("./clone/index"), exports); +__exportStar(require("./convert/index"), exports); +__exportStar(require("./create/index"), exports); +__exportStar(require("./decode/index"), exports); +__exportStar(require("./default/index"), exports); +__exportStar(require("./delta/index"), exports); +__exportStar(require("./encode/index"), exports); +__exportStar(require("./equal/index"), exports); +__exportStar(require("./hash/index"), exports); +__exportStar(require("./mutate/index"), exports); +__exportStar(require("./parse/index"), exports); +__exportStar(require("./pointer/index"), exports); +__exportStar(require("./transform/index"), exports); +// ------------------------------------------------------------------ +// Namespace +// ------------------------------------------------------------------ +var index_2 = require("./value/index"); +Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return index_2.Value; } }); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.d.ts new file mode 100644 index 0000000..3e2a775 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.d.ts @@ -0,0 +1 @@ +export * from './mutate'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.js new file mode 100644 index 0000000..542c4ed --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./mutate"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.d.ts new file mode 100644 index 0000000..71a28a5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.d.ts @@ -0,0 +1,9 @@ +import { TypeBoxError } from '../../type/error/index'; +export declare class ValueMutateError extends TypeBoxError { + constructor(message: string); +} +export type Mutable = { + [key: string]: unknown; +} | unknown[]; +/** `[Mutable]` Performs a deep mutable value assignment while retaining internal references */ +export declare function Mutate(current: Mutable, next: Mutable): void; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.js new file mode 100644 index 0000000..0987922 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/mutate/mutate.js @@ -0,0 +1,104 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueMutateError = void 0; +exports.Mutate = Mutate; +const index_1 = require("../guard/index"); +const index_2 = require("../pointer/index"); +const index_3 = require("../clone/index"); +const index_4 = require("../../type/error/index"); +// ------------------------------------------------------------------ +// IsStandardObject +// ------------------------------------------------------------------ +function IsStandardObject(value) { + return (0, index_1.IsObject)(value) && !(0, index_1.IsArray)(value); +} +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class ValueMutateError extends index_4.TypeBoxError { + constructor(message) { + super(message); + } +} +exports.ValueMutateError = ValueMutateError; +function ObjectType(root, path, current, next) { + if (!IsStandardObject(current)) { + index_2.ValuePointer.Set(root, path, (0, index_3.Clone)(next)); + } + else { + const currentKeys = Object.getOwnPropertyNames(current); + const nextKeys = Object.getOwnPropertyNames(next); + for (const currentKey of currentKeys) { + if (!nextKeys.includes(currentKey)) { + delete current[currentKey]; + } + } + for (const nextKey of nextKeys) { + if (!currentKeys.includes(nextKey)) { + current[nextKey] = null; + } + } + for (const nextKey of nextKeys) { + Visit(root, `${path}/${nextKey}`, current[nextKey], next[nextKey]); + } + } +} +function ArrayType(root, path, current, next) { + if (!(0, index_1.IsArray)(current)) { + index_2.ValuePointer.Set(root, path, (0, index_3.Clone)(next)); + } + else { + for (let index = 0; index < next.length; index++) { + Visit(root, `${path}/${index}`, current[index], next[index]); + } + current.splice(next.length); + } +} +function TypedArrayType(root, path, current, next) { + if ((0, index_1.IsTypedArray)(current) && current.length === next.length) { + for (let i = 0; i < current.length; i++) { + current[i] = next[i]; + } + } + else { + index_2.ValuePointer.Set(root, path, (0, index_3.Clone)(next)); + } +} +function ValueType(root, path, current, next) { + if (current === next) + return; + index_2.ValuePointer.Set(root, path, next); +} +function Visit(root, path, current, next) { + if ((0, index_1.IsArray)(next)) + return ArrayType(root, path, current, next); + if ((0, index_1.IsTypedArray)(next)) + return TypedArrayType(root, path, current, next); + if (IsStandardObject(next)) + return ObjectType(root, path, current, next); + if ((0, index_1.IsValueType)(next)) + return ValueType(root, path, current, next); +} +// ------------------------------------------------------------------ +// IsNonMutableValue +// ------------------------------------------------------------------ +function IsNonMutableValue(value) { + return (0, index_1.IsTypedArray)(value) || (0, index_1.IsValueType)(value); +} +function IsMismatchedValue(current, next) { + // prettier-ignore + return ((IsStandardObject(current) && (0, index_1.IsArray)(next)) || + ((0, index_1.IsArray)(current) && IsStandardObject(next))); +} +// ------------------------------------------------------------------ +// Mutate +// ------------------------------------------------------------------ +/** `[Mutable]` Performs a deep mutable value assignment while retaining internal references */ +function Mutate(current, next) { + if (IsNonMutableValue(current) || IsNonMutableValue(next)) + throw new ValueMutateError('Only object and array types can be mutated at the root level'); + if (IsMismatchedValue(current, next)) + throw new ValueMutateError('Cannot assign due type mismatch of assignable values'); + Visit(current, '', current, next); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.d.ts new file mode 100644 index 0000000..dd1a55c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.d.ts @@ -0,0 +1 @@ +export * from './parse'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.js new file mode 100644 index 0000000..101a711 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/index.js @@ -0,0 +1,18 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./parse"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.d.ts new file mode 100644 index 0000000..c79c421 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.d.ts @@ -0,0 +1,22 @@ +import { TypeBoxError } from '../../type/error/index'; +import { TSchema } from '../../type/schema/index'; +import { StaticDecode } from '../../type/static/index'; +export declare class ParseError extends TypeBoxError { + constructor(message: string); +} +export type TParseOperation = 'Assert' | 'Cast' | 'Clean' | 'Clone' | 'Convert' | 'Decode' | 'Default' | 'Encode' | ({} & string); +export type TParseFunction = (type: TSchema, references: TSchema[], value: unknown) => unknown; +export declare namespace ParseRegistry { + function Delete(key: string): void; + function Set(key: string, callback: TParseFunction): void; + function Get(key: string): TParseFunction | undefined; +} +export declare const ParseDefault: readonly ["Clone", "Clean", "Default", "Convert", "Assert", "Decode"]; +/** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */ +export declare function Parse, Result extends Output = Output>(schema: Type, references: TSchema[], value: unknown): Result; +/** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */ +export declare function Parse, Result extends Output = Output>(schema: Type, value: unknown): Result; +/** Parses a value using the specified operations. */ +export declare function Parse(operations: TParseOperation[], schema: Type, references: TSchema[], value: unknown): unknown; +/** Parses a value using the specified operations. */ +export declare function Parse(operations: TParseOperation[], schema: Type, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.js new file mode 100644 index 0000000..5065576 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/parse/parse.js @@ -0,0 +1,87 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ParseDefault = exports.ParseRegistry = exports.ParseError = void 0; +exports.Parse = Parse; +const index_1 = require("../../type/error/index"); +const index_2 = require("../transform/index"); +const index_3 = require("../assert/index"); +const index_4 = require("../cast/index"); +const index_5 = require("../clean/index"); +const index_6 = require("../clone/index"); +const index_7 = require("../convert/index"); +const index_8 = require("../default/index"); +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +const index_9 = require("../guard/index"); +// ------------------------------------------------------------------ +// Error +// ------------------------------------------------------------------ +class ParseError extends index_1.TypeBoxError { + constructor(message) { + super(message); + } +} +exports.ParseError = ParseError; +// prettier-ignore +var ParseRegistry; +(function (ParseRegistry) { + const registry = new Map([ + ['Assert', (type, references, value) => { (0, index_3.Assert)(type, references, value); return value; }], + ['Cast', (type, references, value) => (0, index_4.Cast)(type, references, value)], + ['Clean', (type, references, value) => (0, index_5.Clean)(type, references, value)], + ['Clone', (_type, _references, value) => (0, index_6.Clone)(value)], + ['Convert', (type, references, value) => (0, index_7.Convert)(type, references, value)], + ['Decode', (type, references, value) => ((0, index_2.HasTransform)(type, references) ? (0, index_2.TransformDecode)(type, references, value) : value)], + ['Default', (type, references, value) => (0, index_8.Default)(type, references, value)], + ['Encode', (type, references, value) => ((0, index_2.HasTransform)(type, references) ? (0, index_2.TransformEncode)(type, references, value) : value)], + ]); + // Deletes an entry from the registry + function Delete(key) { + registry.delete(key); + } + ParseRegistry.Delete = Delete; + // Sets an entry in the registry + function Set(key, callback) { + registry.set(key, callback); + } + ParseRegistry.Set = Set; + // Gets an entry in the registry + function Get(key) { + return registry.get(key); + } + ParseRegistry.Get = Get; +})(ParseRegistry || (exports.ParseRegistry = ParseRegistry = {})); +// ------------------------------------------------------------------ +// Default Parse Pipeline +// ------------------------------------------------------------------ +// prettier-ignore +exports.ParseDefault = [ + 'Clone', + 'Clean', + 'Default', + 'Convert', + 'Assert', + 'Decode' +]; +// ------------------------------------------------------------------ +// ParseValue +// ------------------------------------------------------------------ +function ParseValue(operations, type, references, value) { + return operations.reduce((value, operationKey) => { + const operation = ParseRegistry.Get(operationKey); + if ((0, index_9.IsUndefined)(operation)) + throw new ParseError(`Unable to find Parse operation '${operationKey}'`); + return operation(type, references, value); + }, value); +} +/** Parses a value */ +function Parse(...args) { + // prettier-ignore + const [operations, schema, references, value] = (args.length === 4 ? [args[0], args[1], args[2], args[3]] : + args.length === 3 ? (0, index_9.IsArray)(args[0]) ? [args[0], args[1], [], args[2]] : [exports.ParseDefault, args[0], args[1], args[2]] : + args.length === 2 ? [exports.ParseDefault, args[0], [], args[1]] : + (() => { throw new ParseError('Invalid Arguments'); })()); + return ParseValue(operations, schema, references, value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.d.ts new file mode 100644 index 0000000..16fc13e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.d.ts @@ -0,0 +1 @@ +export * as ValuePointer from './pointer'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.js new file mode 100644 index 0000000..84c1e26 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/index.js @@ -0,0 +1,38 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValuePointer = void 0; +exports.ValuePointer = __importStar(require("./pointer")); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.d.ts new file mode 100644 index 0000000..8028655 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.d.ts @@ -0,0 +1,22 @@ +import { TypeBoxError } from '../../type/error/index'; +export declare class ValuePointerRootSetError extends TypeBoxError { + readonly value: unknown; + readonly path: string; + readonly update: unknown; + constructor(value: unknown, path: string, update: unknown); +} +export declare class ValuePointerRootDeleteError extends TypeBoxError { + readonly value: unknown; + readonly path: string; + constructor(value: unknown, path: string); +} +/** Formats the given pointer into navigable key components */ +export declare function Format(pointer: string): IterableIterator; +/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */ +export declare function Set(value: any, pointer: string, update: unknown): void; +/** Deletes a value at the given pointer */ +export declare function Delete(value: any, pointer: string): void; +/** Returns true if a value exists at the given pointer */ +export declare function Has(value: any, pointer: string): boolean; +/** Gets the value at the given pointer */ +export declare function Get(value: any, pointer: string): any; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.js new file mode 100644 index 0000000..af349ff --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/pointer/pointer.js @@ -0,0 +1,126 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValuePointerRootDeleteError = exports.ValuePointerRootSetError = void 0; +exports.Format = Format; +exports.Set = Set; +exports.Delete = Delete; +exports.Has = Has; +exports.Get = Get; +const index_1 = require("../../type/error/index"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +class ValuePointerRootSetError extends index_1.TypeBoxError { + constructor(value, path, update) { + super('Cannot set root value'); + this.value = value; + this.path = path; + this.update = update; + } +} +exports.ValuePointerRootSetError = ValuePointerRootSetError; +class ValuePointerRootDeleteError extends index_1.TypeBoxError { + constructor(value, path) { + super('Cannot delete root value'); + this.value = value; + this.path = path; + } +} +exports.ValuePointerRootDeleteError = ValuePointerRootDeleteError; +// ------------------------------------------------------------------ +// ValuePointer +// ------------------------------------------------------------------ +/** Provides functionality to update values through RFC6901 string pointers */ +// prettier-ignore +function Escape(component) { + return component.indexOf('~') === -1 ? component : component.replace(/~1/g, '/').replace(/~0/g, '~'); +} +/** Formats the given pointer into navigable key components */ +// prettier-ignore +function* Format(pointer) { + if (pointer === '') + return; + let [start, end] = [0, 0]; + for (let i = 0; i < pointer.length; i++) { + const char = pointer.charAt(i); + if (char === '/') { + if (i === 0) { + start = i + 1; + } + else { + end = i; + yield Escape(pointer.slice(start, end)); + start = i + 1; + } + } + else { + end = i; + } + } + yield Escape(pointer.slice(start)); +} +/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */ +// prettier-ignore +function Set(value, pointer, update) { + if (pointer === '') + throw new ValuePointerRootSetError(value, pointer, update); + let [owner, next, key] = [null, value, '']; + for (const component of Format(pointer)) { + if (next[component] === undefined) + next[component] = {}; + owner = next; + next = next[component]; + key = component; + } + owner[key] = update; +} +/** Deletes a value at the given pointer */ +// prettier-ignore +function Delete(value, pointer) { + if (pointer === '') + throw new ValuePointerRootDeleteError(value, pointer); + let [owner, next, key] = [null, value, '']; + for (const component of Format(pointer)) { + if (next[component] === undefined || next[component] === null) + return; + owner = next; + next = next[component]; + key = component; + } + if (Array.isArray(owner)) { + const index = parseInt(key); + owner.splice(index, 1); + } + else { + delete owner[key]; + } +} +/** Returns true if a value exists at the given pointer */ +// prettier-ignore +function Has(value, pointer) { + if (pointer === '') + return true; + let [owner, next, key] = [null, value, '']; + for (const component of Format(pointer)) { + if (next[component] === undefined) + return false; + owner = next; + next = next[component]; + key = component; + } + return Object.getOwnPropertyNames(owner).includes(key); +} +/** Gets the value at the given pointer */ +// prettier-ignore +function Get(value, pointer) { + if (pointer === '') + return value; + let current = value; + for (const component of Format(pointer)) { + if (current[component] === undefined) + return undefined; + current = current[component]; + } + return current; +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.d.ts new file mode 100644 index 0000000..79e3bed --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.d.ts @@ -0,0 +1,22 @@ +import { TypeBoxError } from '../../type/error/index'; +import { ValueError } from '../../errors/index'; +import type { TSchema } from '../../type/schema/index'; +export declare class TransformDecodeCheckError extends TypeBoxError { + readonly schema: TSchema; + readonly value: unknown; + readonly error: ValueError; + constructor(schema: TSchema, value: unknown, error: ValueError); +} +export declare class TransformDecodeError extends TypeBoxError { + readonly schema: TSchema; + readonly path: string; + readonly value: unknown; + readonly error: Error; + constructor(schema: TSchema, path: string, value: unknown, error: Error); +} +/** + * `[Internal]` Decodes the value and returns the result. This function requires that + * the caller `Check` the value before use. Passing unchecked values may result in + * undefined behavior. Refer to the `Value.Decode()` for implementation details. + */ +export declare function TransformDecode(schema: TSchema, references: TSchema[], value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.js new file mode 100644 index 0000000..cef4f0b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/decode.js @@ -0,0 +1,214 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TransformDecodeError = exports.TransformDecodeCheckError = void 0; +exports.TransformDecode = TransformDecode; +const policy_1 = require("../../system/policy"); +const index_1 = require("../../type/symbols/index"); +const index_2 = require("../../type/error/index"); +const index_3 = require("../../type/keyof/index"); +const index_4 = require("../deref/index"); +const index_5 = require("../check/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_6 = require("../guard/index"); +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +const kind_1 = require("../../type/guard/kind"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +// thrown externally +// prettier-ignore +class TransformDecodeCheckError extends index_2.TypeBoxError { + constructor(schema, value, error) { + super(`Unable to decode value as it does not match the expected schema`); + this.schema = schema; + this.value = value; + this.error = error; + } +} +exports.TransformDecodeCheckError = TransformDecodeCheckError; +// prettier-ignore +class TransformDecodeError extends index_2.TypeBoxError { + constructor(schema, path, value, error) { + super(error instanceof Error ? error.message : 'Unknown error'); + this.schema = schema; + this.path = path; + this.value = value; + this.error = error; + } +} +exports.TransformDecodeError = TransformDecodeError; +// ------------------------------------------------------------------ +// Decode +// ------------------------------------------------------------------ +// prettier-ignore +function Default(schema, path, value) { + try { + return (0, kind_1.IsTransform)(schema) ? schema[index_1.TransformKind].Decode(value) : value; + } + catch (error) { + throw new TransformDecodeError(schema, path, value, error); + } +} +// prettier-ignore +function FromArray(schema, references, path, value) { + return ((0, index_6.IsArray)(value)) + ? Default(schema, path, value.map((value, index) => Visit(schema.items, references, `${path}/${index}`, value))) + : Default(schema, path, value); +} +// prettier-ignore +function FromIntersect(schema, references, path, value) { + if (!(0, index_6.IsObject)(value) || (0, index_6.IsValueType)(value)) + return Default(schema, path, value); + const knownEntries = (0, index_3.KeyOfPropertyEntries)(schema); + const knownKeys = knownEntries.map(entry => entry[0]); + const knownProperties = { ...value }; + for (const [knownKey, knownSchema] of knownEntries) + if (knownKey in knownProperties) { + knownProperties[knownKey] = Visit(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]); + } + if (!(0, kind_1.IsTransform)(schema.unevaluatedProperties)) { + return Default(schema, path, knownProperties); + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const unevaluatedProperties = schema.unevaluatedProperties; + const unknownProperties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + unknownProperties[key] = Default(unevaluatedProperties, `${path}/${key}`, unknownProperties[key]); + } + return Default(schema, path, unknownProperties); +} +// prettier-ignore +function FromImport(schema, references, path, value) { + const additional = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + const result = Visit(target, [...references, ...additional], path, value); + return Default(schema, path, result); +} +function FromNot(schema, references, path, value) { + return Default(schema, path, Visit(schema.not, references, path, value)); +} +// prettier-ignore +function FromObject(schema, references, path, value) { + if (!(0, index_6.IsObject)(value)) + return Default(schema, path, value); + const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema); + const knownProperties = { ...value }; + for (const key of knownKeys) { + if (!(0, index_6.HasPropertyKey)(knownProperties, key)) + continue; + // if the property value is undefined, but the target is not, nor does it satisfy exact optional + // property policy, then we need to continue. This is a special case for optional property handling + // where a transforms wrapped in a optional modifiers should not run. + if ((0, index_6.IsUndefined)(knownProperties[key]) && (!(0, kind_1.IsUndefined)(schema.properties[key]) || + policy_1.TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key))) + continue; + // decode property + knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]); + } + if (!(0, kind_1.IsSchema)(schema.additionalProperties)) { + return Default(schema, path, knownProperties); + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const unknownProperties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]); + } + return Default(schema, path, unknownProperties); +} +// prettier-ignore +function FromRecord(schema, references, path, value) { + if (!(0, index_6.IsObject)(value)) + return Default(schema, path, value); + const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const knownKeys = new RegExp(pattern); + const knownProperties = { ...value }; + for (const key of Object.getOwnPropertyNames(value)) + if (knownKeys.test(key)) { + knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]); + } + if (!(0, kind_1.IsSchema)(schema.additionalProperties)) { + return Default(schema, path, knownProperties); + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const unknownProperties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.test(key)) { + unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]); + } + return Default(schema, path, unknownProperties); +} +// prettier-ignore +function FromRef(schema, references, path, value) { + const target = (0, index_4.Deref)(schema, references); + return Default(schema, path, Visit(target, references, path, value)); +} +// prettier-ignore +function FromThis(schema, references, path, value) { + const target = (0, index_4.Deref)(schema, references); + return Default(schema, path, Visit(target, references, path, value)); +} +// prettier-ignore +function FromTuple(schema, references, path, value) { + return ((0, index_6.IsArray)(value) && (0, index_6.IsArray)(schema.items)) + ? Default(schema, path, schema.items.map((schema, index) => Visit(schema, references, `${path}/${index}`, value[index]))) + : Default(schema, path, value); +} +// prettier-ignore +function FromUnion(schema, references, path, value) { + for (const subschema of schema.anyOf) { + if (!(0, index_5.Check)(subschema, references, value)) + continue; + // note: ensure interior is decoded first + const decoded = Visit(subschema, references, path, value); + return Default(schema, path, decoded); + } + return Default(schema, path, value); +} +// prettier-ignore +function Visit(schema, references, path, value) { + const references_ = (0, index_4.Pushref)(schema, references); + const schema_ = schema; + switch (schema[index_1.Kind]) { + case 'Array': + return FromArray(schema_, references_, path, value); + case 'Import': + return FromImport(schema_, references_, path, value); + case 'Intersect': + return FromIntersect(schema_, references_, path, value); + case 'Not': + return FromNot(schema_, references_, path, value); + case 'Object': + return FromObject(schema_, references_, path, value); + case 'Record': + return FromRecord(schema_, references_, path, value); + case 'Ref': + return FromRef(schema_, references_, path, value); + case 'Symbol': + return Default(schema_, path, value); + case 'This': + return FromThis(schema_, references_, path, value); + case 'Tuple': + return FromTuple(schema_, references_, path, value); + case 'Union': + return FromUnion(schema_, references_, path, value); + default: + return Default(schema_, path, value); + } +} +/** + * `[Internal]` Decodes the value and returns the result. This function requires that + * the caller `Check` the value before use. Passing unchecked values may result in + * undefined behavior. Refer to the `Value.Decode()` for implementation details. + */ +function TransformDecode(schema, references, value) { + return Visit(schema, references, '', value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.d.ts new file mode 100644 index 0000000..be21c68 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.d.ts @@ -0,0 +1,23 @@ +import { TypeBoxError } from '../../type/error/index'; +import { ValueError } from '../../errors/index'; +import type { TSchema } from '../../type/schema/index'; +export declare class TransformEncodeCheckError extends TypeBoxError { + readonly schema: TSchema; + readonly value: unknown; + readonly error: ValueError; + constructor(schema: TSchema, value: unknown, error: ValueError); +} +export declare class TransformEncodeError extends TypeBoxError { + readonly schema: TSchema; + readonly path: string; + readonly value: unknown; + readonly error: Error; + constructor(schema: TSchema, path: string, value: unknown, error: Error); +} +/** + * `[Internal]` Encodes the value and returns the result. This function expects the + * caller to pass a statically checked value. This function does not check the encoded + * result, meaning the result should be passed to `Check` before use. Refer to the + * `Value.Encode()` function for implementation details. + */ +export declare function TransformEncode(schema: TSchema, references: TSchema[], value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.js new file mode 100644 index 0000000..310a223 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/encode.js @@ -0,0 +1,225 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TransformEncodeError = exports.TransformEncodeCheckError = void 0; +exports.TransformEncode = TransformEncode; +const policy_1 = require("../../system/policy"); +const index_1 = require("../../type/symbols/index"); +const index_2 = require("../../type/error/index"); +const index_3 = require("../../type/keyof/index"); +const index_4 = require("../deref/index"); +const index_5 = require("../check/index"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_6 = require("../guard/index"); +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +const kind_1 = require("../../type/guard/kind"); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +// prettier-ignore +class TransformEncodeCheckError extends index_2.TypeBoxError { + constructor(schema, value, error) { + super(`The encoded value does not match the expected schema`); + this.schema = schema; + this.value = value; + this.error = error; + } +} +exports.TransformEncodeCheckError = TransformEncodeCheckError; +// prettier-ignore +class TransformEncodeError extends index_2.TypeBoxError { + constructor(schema, path, value, error) { + super(`${error instanceof Error ? error.message : 'Unknown error'}`); + this.schema = schema; + this.path = path; + this.value = value; + this.error = error; + } +} +exports.TransformEncodeError = TransformEncodeError; +// ------------------------------------------------------------------ +// Encode +// ------------------------------------------------------------------ +// prettier-ignore +function Default(schema, path, value) { + try { + return (0, kind_1.IsTransform)(schema) ? schema[index_1.TransformKind].Encode(value) : value; + } + catch (error) { + throw new TransformEncodeError(schema, path, value, error); + } +} +// prettier-ignore +function FromArray(schema, references, path, value) { + const defaulted = Default(schema, path, value); + return (0, index_6.IsArray)(defaulted) + ? defaulted.map((value, index) => Visit(schema.items, references, `${path}/${index}`, value)) + : defaulted; +} +// prettier-ignore +function FromImport(schema, references, path, value) { + const additional = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + const result = Default(schema, path, value); + return Visit(target, [...references, ...additional], path, result); +} +// prettier-ignore +function FromIntersect(schema, references, path, value) { + const defaulted = Default(schema, path, value); + if (!(0, index_6.IsObject)(value) || (0, index_6.IsValueType)(value)) + return defaulted; + const knownEntries = (0, index_3.KeyOfPropertyEntries)(schema); + const knownKeys = knownEntries.map(entry => entry[0]); + const knownProperties = { ...defaulted }; + for (const [knownKey, knownSchema] of knownEntries) + if (knownKey in knownProperties) { + knownProperties[knownKey] = Visit(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]); + } + if (!(0, kind_1.IsTransform)(schema.unevaluatedProperties)) { + return knownProperties; + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const unevaluatedProperties = schema.unevaluatedProperties; + const properties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + properties[key] = Default(unevaluatedProperties, `${path}/${key}`, properties[key]); + } + return properties; +} +// prettier-ignore +function FromNot(schema, references, path, value) { + return Default(schema.not, path, Default(schema, path, value)); +} +// prettier-ignore +function FromObject(schema, references, path, value) { + const defaulted = Default(schema, path, value); + if (!(0, index_6.IsObject)(defaulted)) + return defaulted; + const knownKeys = (0, index_3.KeyOfPropertyKeys)(schema); + const knownProperties = { ...defaulted }; + for (const key of knownKeys) { + if (!(0, index_6.HasPropertyKey)(knownProperties, key)) + continue; + // if the property value is undefined, but the target is not, nor does it satisfy exact optional + // property policy, then we need to continue. This is a special case for optional property handling + // where a transforms wrapped in a optional modifiers should not run. + if ((0, index_6.IsUndefined)(knownProperties[key]) && (!(0, kind_1.IsUndefined)(schema.properties[key]) || + policy_1.TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key))) + continue; + // encode property + knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]); + } + if (!(0, kind_1.IsSchema)(schema.additionalProperties)) { + return knownProperties; + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const properties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + properties[key] = Default(additionalProperties, `${path}/${key}`, properties[key]); + } + return properties; +} +// prettier-ignore +function FromRecord(schema, references, path, value) { + const defaulted = Default(schema, path, value); + if (!(0, index_6.IsObject)(value)) + return defaulted; + const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const knownKeys = new RegExp(pattern); + const knownProperties = { ...defaulted }; + for (const key of Object.getOwnPropertyNames(value)) + if (knownKeys.test(key)) { + knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]); + } + if (!(0, kind_1.IsSchema)(schema.additionalProperties)) { + return knownProperties; + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const properties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.test(key)) { + properties[key] = Default(additionalProperties, `${path}/${key}`, properties[key]); + } + return properties; +} +// prettier-ignore +function FromRef(schema, references, path, value) { + const target = (0, index_4.Deref)(schema, references); + const resolved = Visit(target, references, path, value); + return Default(schema, path, resolved); +} +// prettier-ignore +function FromThis(schema, references, path, value) { + const target = (0, index_4.Deref)(schema, references); + const resolved = Visit(target, references, path, value); + return Default(schema, path, resolved); +} +// prettier-ignore +function FromTuple(schema, references, path, value) { + const value1 = Default(schema, path, value); + return (0, index_6.IsArray)(schema.items) ? schema.items.map((schema, index) => Visit(schema, references, `${path}/${index}`, value1[index])) : []; +} +// prettier-ignore +function FromUnion(schema, references, path, value) { + // test value against union variants + for (const subschema of schema.anyOf) { + if (!(0, index_5.Check)(subschema, references, value)) + continue; + const value1 = Visit(subschema, references, path, value); + return Default(schema, path, value1); + } + // test transformed value against union variants + for (const subschema of schema.anyOf) { + const value1 = Visit(subschema, references, path, value); + if (!(0, index_5.Check)(schema, references, value1)) + continue; + return Default(schema, path, value1); + } + return Default(schema, path, value); +} +// prettier-ignore +function Visit(schema, references, path, value) { + const references_ = (0, index_4.Pushref)(schema, references); + const schema_ = schema; + switch (schema[index_1.Kind]) { + case 'Array': + return FromArray(schema_, references_, path, value); + case 'Import': + return FromImport(schema_, references_, path, value); + case 'Intersect': + return FromIntersect(schema_, references_, path, value); + case 'Not': + return FromNot(schema_, references_, path, value); + case 'Object': + return FromObject(schema_, references_, path, value); + case 'Record': + return FromRecord(schema_, references_, path, value); + case 'Ref': + return FromRef(schema_, references_, path, value); + case 'This': + return FromThis(schema_, references_, path, value); + case 'Tuple': + return FromTuple(schema_, references_, path, value); + case 'Union': + return FromUnion(schema_, references_, path, value); + default: + return Default(schema_, path, value); + } +} +/** + * `[Internal]` Encodes the value and returns the result. This function expects the + * caller to pass a statically checked value. This function does not check the encoded + * result, meaning the result should be passed to `Check` before use. Refer to the + * `Value.Encode()` function for implementation details. + */ +function TransformEncode(schema, references, value) { + return Visit(schema, references, '', value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.d.ts new file mode 100644 index 0000000..85c383c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.d.ts @@ -0,0 +1,3 @@ +import type { TSchema } from '../../type/schema/index'; +/** Returns true if this schema contains a transform codec */ +export declare function HasTransform(schema: TSchema, references: TSchema[]): boolean; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.js new file mode 100644 index 0000000..66c5f6e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/has.js @@ -0,0 +1,133 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.HasTransform = HasTransform; +const index_1 = require("../deref/index"); +const index_2 = require("../../type/symbols/index"); +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +const kind_1 = require("../../type/guard/kind"); +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +const index_3 = require("../guard/index"); +// prettier-ignore +function FromArray(schema, references) { + return (0, kind_1.IsTransform)(schema) || Visit(schema.items, references); +} +// prettier-ignore +function FromAsyncIterator(schema, references) { + return (0, kind_1.IsTransform)(schema) || Visit(schema.items, references); +} +// prettier-ignore +function FromConstructor(schema, references) { + return (0, kind_1.IsTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function FromFunction(schema, references) { + return (0, kind_1.IsTransform)(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function FromIntersect(schema, references) { + return (0, kind_1.IsTransform)(schema) || (0, kind_1.IsTransform)(schema.unevaluatedProperties) || schema.allOf.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function FromImport(schema, references) { + const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []); + const target = schema.$defs[schema.$ref]; + return (0, kind_1.IsTransform)(schema) || Visit(target, [...additional, ...references]); +} +// prettier-ignore +function FromIterator(schema, references) { + return (0, kind_1.IsTransform)(schema) || Visit(schema.items, references); +} +// prettier-ignore +function FromNot(schema, references) { + return (0, kind_1.IsTransform)(schema) || Visit(schema.not, references); +} +// prettier-ignore +function FromObject(schema, references) { + return ((0, kind_1.IsTransform)(schema) || + Object.values(schema.properties).some((schema) => Visit(schema, references)) || + ((0, kind_1.IsSchema)(schema.additionalProperties) && Visit(schema.additionalProperties, references))); +} +// prettier-ignore +function FromPromise(schema, references) { + return (0, kind_1.IsTransform)(schema) || Visit(schema.item, references); +} +// prettier-ignore +function FromRecord(schema, references) { + const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const property = schema.patternProperties[pattern]; + return (0, kind_1.IsTransform)(schema) || Visit(property, references) || ((0, kind_1.IsSchema)(schema.additionalProperties) && (0, kind_1.IsTransform)(schema.additionalProperties)); +} +// prettier-ignore +function FromRef(schema, references) { + if ((0, kind_1.IsTransform)(schema)) + return true; + return Visit((0, index_1.Deref)(schema, references), references); +} +// prettier-ignore +function FromThis(schema, references) { + if ((0, kind_1.IsTransform)(schema)) + return true; + return Visit((0, index_1.Deref)(schema, references), references); +} +// prettier-ignore +function FromTuple(schema, references) { + return (0, kind_1.IsTransform)(schema) || (!(0, index_3.IsUndefined)(schema.items) && schema.items.some((schema) => Visit(schema, references))); +} +// prettier-ignore +function FromUnion(schema, references) { + return (0, kind_1.IsTransform)(schema) || schema.anyOf.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function Visit(schema, references) { + const references_ = (0, index_1.Pushref)(schema, references); + const schema_ = schema; + if (schema.$id && visited.has(schema.$id)) + return false; + if (schema.$id) + visited.add(schema.$id); + switch (schema[index_2.Kind]) { + case 'Array': + return FromArray(schema_, references_); + case 'AsyncIterator': + return FromAsyncIterator(schema_, references_); + case 'Constructor': + return FromConstructor(schema_, references_); + case 'Function': + return FromFunction(schema_, references_); + case 'Import': + return FromImport(schema_, references_); + case 'Intersect': + return FromIntersect(schema_, references_); + case 'Iterator': + return FromIterator(schema_, references_); + case 'Not': + return FromNot(schema_, references_); + case 'Object': + return FromObject(schema_, references_); + case 'Promise': + return FromPromise(schema_, references_); + case 'Record': + return FromRecord(schema_, references_); + case 'Ref': + return FromRef(schema_, references_); + case 'This': + return FromThis(schema_, references_); + case 'Tuple': + return FromTuple(schema_, references_); + case 'Union': + return FromUnion(schema_, references_); + default: + return (0, kind_1.IsTransform)(schema); + } +} +const visited = new Set(); +/** Returns true if this schema contains a transform codec */ +function HasTransform(schema, references) { + visited.clear(); + return Visit(schema, references); +} diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.d.ts new file mode 100644 index 0000000..69c1450 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.d.ts @@ -0,0 +1,3 @@ +export * from './decode'; +export * from './encode'; +export * from './has'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.js new file mode 100644 index 0000000..d1b8db9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/transform/index.js @@ -0,0 +1,20 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./decode"), exports); +__exportStar(require("./encode"), exports); +__exportStar(require("./has"), exports); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.d.ts new file mode 100644 index 0000000..bae7b15 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.d.ts @@ -0,0 +1 @@ +export * as Value from './value'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.js new file mode 100644 index 0000000..bcaa68a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/index.js @@ -0,0 +1,38 @@ +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Value = void 0; +exports.Value = __importStar(require("./value")); diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.d.ts b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.d.ts new file mode 100644 index 0000000..1ee58f8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.d.ts @@ -0,0 +1,16 @@ +export { Errors, ValueErrorIterator } from '../../errors/index'; +export { Assert } from '../assert/index'; +export { Cast } from '../cast/index'; +export { Check } from '../check/index'; +export { Clean } from '../clean/index'; +export { Clone } from '../clone/index'; +export { Convert } from '../convert/index'; +export { Create } from '../create/index'; +export { Decode } from '../decode/index'; +export { Default } from '../default/index'; +export { Diff, Patch, Edit } from '../delta/index'; +export { Encode } from '../encode/index'; +export { Equal } from '../equal/index'; +export { Hash } from '../hash/index'; +export { Mutate, type Mutable } from '../mutate/index'; +export { Parse } from '../parse/index'; diff --git a/ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.js b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.js new file mode 100644 index 0000000..e72c589 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/cjs/value/value/value.js @@ -0,0 +1,39 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Parse = exports.Mutate = exports.Hash = exports.Equal = exports.Encode = exports.Edit = exports.Patch = exports.Diff = exports.Default = exports.Decode = exports.Create = exports.Convert = exports.Clone = exports.Clean = exports.Check = exports.Cast = exports.Assert = exports.ValueErrorIterator = exports.Errors = void 0; +var index_1 = require("../../errors/index"); +Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return index_1.Errors; } }); +Object.defineProperty(exports, "ValueErrorIterator", { enumerable: true, get: function () { return index_1.ValueErrorIterator; } }); +var index_2 = require("../assert/index"); +Object.defineProperty(exports, "Assert", { enumerable: true, get: function () { return index_2.Assert; } }); +var index_3 = require("../cast/index"); +Object.defineProperty(exports, "Cast", { enumerable: true, get: function () { return index_3.Cast; } }); +var index_4 = require("../check/index"); +Object.defineProperty(exports, "Check", { enumerable: true, get: function () { return index_4.Check; } }); +var index_5 = require("../clean/index"); +Object.defineProperty(exports, "Clean", { enumerable: true, get: function () { return index_5.Clean; } }); +var index_6 = require("../clone/index"); +Object.defineProperty(exports, "Clone", { enumerable: true, get: function () { return index_6.Clone; } }); +var index_7 = require("../convert/index"); +Object.defineProperty(exports, "Convert", { enumerable: true, get: function () { return index_7.Convert; } }); +var index_8 = require("../create/index"); +Object.defineProperty(exports, "Create", { enumerable: true, get: function () { return index_8.Create; } }); +var index_9 = require("../decode/index"); +Object.defineProperty(exports, "Decode", { enumerable: true, get: function () { return index_9.Decode; } }); +var index_10 = require("../default/index"); +Object.defineProperty(exports, "Default", { enumerable: true, get: function () { return index_10.Default; } }); +var index_11 = require("../delta/index"); +Object.defineProperty(exports, "Diff", { enumerable: true, get: function () { return index_11.Diff; } }); +Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return index_11.Patch; } }); +Object.defineProperty(exports, "Edit", { enumerable: true, get: function () { return index_11.Edit; } }); +var index_12 = require("../encode/index"); +Object.defineProperty(exports, "Encode", { enumerable: true, get: function () { return index_12.Encode; } }); +var index_13 = require("../equal/index"); +Object.defineProperty(exports, "Equal", { enumerable: true, get: function () { return index_13.Equal; } }); +var index_14 = require("../hash/index"); +Object.defineProperty(exports, "Hash", { enumerable: true, get: function () { return index_14.Hash; } }); +var index_15 = require("../mutate/index"); +Object.defineProperty(exports, "Mutate", { enumerable: true, get: function () { return index_15.Mutate; } }); +var index_16 = require("../parse/index"); +Object.defineProperty(exports, "Parse", { enumerable: true, get: function () { return index_16.Parse; } }); diff --git a/ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.d.mts new file mode 100644 index 0000000..eebbffa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.d.mts @@ -0,0 +1,55 @@ +import { ValueErrorIterator } from '../errors/index.mjs'; +import { TypeBoxError } from '../type/error/index.mjs'; +import type { TSchema } from '../type/schema/index.mjs'; +import type { Static, StaticDecode, StaticEncode } from '../type/static/index.mjs'; +export type CheckFunction = (value: unknown) => boolean; +export declare class TypeCheck { + private readonly schema; + private readonly references; + private readonly checkFunc; + private readonly code; + private readonly hasTransform; + constructor(schema: T, references: TSchema[], checkFunc: CheckFunction, code: string); + /** Returns the generated assertion code used to validate this type. */ + Code(): string; + /** Returns the schema type used to validate */ + Schema(): T; + /** Returns reference types used to validate */ + References(): TSchema[]; + /** Returns an iterator for each error in this value. */ + Errors(value: unknown): ValueErrorIterator; + /** Returns true if the value matches the compiled type. */ + Check(value: unknown): value is Static; + /** Decodes a value or throws if error */ + Decode, Result extends Static = Static>(value: unknown): Result; + /** Encodes a value or throws if error */ + Encode, Result extends Static = Static>(value: unknown): Result; +} +export declare class TypeCompilerUnknownTypeError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +export declare class TypeCompilerTypeGuardError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +export declare namespace Policy { + function IsExactOptionalProperty(value: string, key: string, expression: string): string; + function IsObjectLike(value: string): string; + function IsRecordLike(value: string): string; + function IsNumberLike(value: string): string; + function IsVoidLike(value: string): string; +} +export type TypeCompilerLanguageOption = 'typescript' | 'javascript'; +export interface TypeCompilerCodegenOptions { + language?: TypeCompilerLanguageOption; +} +/** Compiles Types for Runtime Type Checking */ +export declare namespace TypeCompiler { + /** Generates the code used to assert this type and returns it as a string */ + function Code(schema: T, references: TSchema[], options?: TypeCompilerCodegenOptions): string; + /** Generates the code used to assert this type and returns it as a string */ + function Code(schema: T, options?: TypeCompilerCodegenOptions): string; + /** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */ + function Compile(schema: T, references?: TSchema[]): TypeCheck; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.mjs b/ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.mjs new file mode 100644 index 0000000..331a186 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/compiler/compiler.mjs @@ -0,0 +1,663 @@ +import { TransformEncode, TransformDecode, HasTransform, TransformDecodeCheckError, TransformEncodeCheckError } from '../value/transform/index.mjs'; +import { Errors } from '../errors/index.mjs'; +import { TypeSystemPolicy } from '../system/index.mjs'; +import { TypeBoxError } from '../type/error/index.mjs'; +import { Deref } from '../value/deref/index.mjs'; +import { Hash } from '../value/hash/index.mjs'; +import { Kind } from '../type/symbols/index.mjs'; +import { TypeRegistry, FormatRegistry } from '../type/registry/index.mjs'; +import { KeyOfPattern } from '../type/keyof/index.mjs'; +import { ExtendsUndefinedCheck } from '../type/extends/extends-undefined.mjs'; +import { Never } from '../type/never/index.mjs'; +import { Ref } from '../type/ref/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsArray, IsString, IsNumber, IsBigInt } from '../value/guard/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsSchema } from '../type/guard/type.mjs'; +// ------------------------------------------------------------------ +// TypeCheck +// ------------------------------------------------------------------ +export class TypeCheck { + constructor(schema, references, checkFunc, code) { + this.schema = schema; + this.references = references; + this.checkFunc = checkFunc; + this.code = code; + this.hasTransform = HasTransform(schema, references); + } + /** Returns the generated assertion code used to validate this type. */ + Code() { + return this.code; + } + /** Returns the schema type used to validate */ + Schema() { + return this.schema; + } + /** Returns reference types used to validate */ + References() { + return this.references; + } + /** Returns an iterator for each error in this value. */ + Errors(value) { + return Errors(this.schema, this.references, value); + } + /** Returns true if the value matches the compiled type. */ + Check(value) { + return this.checkFunc(value); + } + /** Decodes a value or throws if error */ + Decode(value) { + if (!this.checkFunc(value)) + throw new TransformDecodeCheckError(this.schema, value, this.Errors(value).First()); + return (this.hasTransform ? TransformDecode(this.schema, this.references, value) : value); + } + /** Encodes a value or throws if error */ + Encode(value) { + const encoded = this.hasTransform ? TransformEncode(this.schema, this.references, value) : value; + if (!this.checkFunc(encoded)) + throw new TransformEncodeCheckError(this.schema, value, this.Errors(value).First()); + return encoded; + } +} +// ------------------------------------------------------------------ +// Character +// ------------------------------------------------------------------ +var Character; +(function (Character) { + function DollarSign(code) { + return code === 36; + } + Character.DollarSign = DollarSign; + function IsUnderscore(code) { + return code === 95; + } + Character.IsUnderscore = IsUnderscore; + function IsAlpha(code) { + return (code >= 65 && code <= 90) || (code >= 97 && code <= 122); + } + Character.IsAlpha = IsAlpha; + function IsNumeric(code) { + return code >= 48 && code <= 57; + } + Character.IsNumeric = IsNumeric; +})(Character || (Character = {})); +// ------------------------------------------------------------------ +// MemberExpression +// ------------------------------------------------------------------ +var MemberExpression; +(function (MemberExpression) { + function IsFirstCharacterNumeric(value) { + if (value.length === 0) + return false; + return Character.IsNumeric(value.charCodeAt(0)); + } + function IsAccessor(value) { + if (IsFirstCharacterNumeric(value)) + return false; + for (let i = 0; i < value.length; i++) { + const code = value.charCodeAt(i); + const check = Character.IsAlpha(code) || Character.IsNumeric(code) || Character.DollarSign(code) || Character.IsUnderscore(code); + if (!check) + return false; + } + return true; + } + function EscapeHyphen(key) { + return key.replace(/'/g, "\\'"); + } + function Encode(object, key) { + return IsAccessor(key) ? `${object}.${key}` : `${object}['${EscapeHyphen(key)}']`; + } + MemberExpression.Encode = Encode; +})(MemberExpression || (MemberExpression = {})); +// ------------------------------------------------------------------ +// Identifier +// ------------------------------------------------------------------ +var Identifier; +(function (Identifier) { + function Encode($id) { + const buffer = []; + for (let i = 0; i < $id.length; i++) { + const code = $id.charCodeAt(i); + if (Character.IsNumeric(code) || Character.IsAlpha(code)) { + buffer.push($id.charAt(i)); + } + else { + buffer.push(`_${code}_`); + } + } + return buffer.join('').replace(/__/g, '_'); + } + Identifier.Encode = Encode; +})(Identifier || (Identifier = {})); +// ------------------------------------------------------------------ +// LiteralString +// ------------------------------------------------------------------ +var LiteralString; +(function (LiteralString) { + function Escape(content) { + return content.replace(/'/g, "\\'"); + } + LiteralString.Escape = Escape; +})(LiteralString || (LiteralString = {})); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class TypeCompilerUnknownTypeError extends TypeBoxError { + constructor(schema) { + super('Unknown type'); + this.schema = schema; + } +} +export class TypeCompilerTypeGuardError extends TypeBoxError { + constructor(schema) { + super('Preflight validation check failed to guard for the given schema'); + this.schema = schema; + } +} +// ------------------------------------------------------------------ +// Policy +// ------------------------------------------------------------------ +export var Policy; +(function (Policy) { + function IsExactOptionalProperty(value, key, expression) { + return TypeSystemPolicy.ExactOptionalPropertyTypes ? `('${key}' in ${value} ? ${expression} : true)` : `(${MemberExpression.Encode(value, key)} !== undefined ? ${expression} : true)`; + } + Policy.IsExactOptionalProperty = IsExactOptionalProperty; + function IsObjectLike(value) { + return !TypeSystemPolicy.AllowArrayObject ? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}))` : `(typeof ${value} === 'object' && ${value} !== null)`; + } + Policy.IsObjectLike = IsObjectLike; + function IsRecordLike(value) { + return !TypeSystemPolicy.AllowArrayObject + ? `(typeof ${value} === 'object' && ${value} !== null && !Array.isArray(${value}) && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))` + : `(typeof ${value} === 'object' && ${value} !== null && !(${value} instanceof Date) && !(${value} instanceof Uint8Array))`; + } + Policy.IsRecordLike = IsRecordLike; + function IsNumberLike(value) { + return TypeSystemPolicy.AllowNaN ? `typeof ${value} === 'number'` : `Number.isFinite(${value})`; + } + Policy.IsNumberLike = IsNumberLike; + function IsVoidLike(value) { + return TypeSystemPolicy.AllowNullVoid ? `(${value} === undefined || ${value} === null)` : `${value} === undefined`; + } + Policy.IsVoidLike = IsVoidLike; +})(Policy || (Policy = {})); +/** Compiles Types for Runtime Type Checking */ +export var TypeCompiler; +(function (TypeCompiler) { + // ---------------------------------------------------------------- + // Guards + // ---------------------------------------------------------------- + function IsAnyOrUnknown(schema) { + return schema[Kind] === 'Any' || schema[Kind] === 'Unknown'; + } + // ---------------------------------------------------------------- + // Types + // ---------------------------------------------------------------- + function* FromAny(schema, references, value) { + yield 'true'; + } + function* FromArgument(schema, references, value) { + yield 'true'; + } + function* FromArray(schema, references, value) { + yield `Array.isArray(${value})`; + const [parameter, accumulator] = [CreateParameter('value', 'any'), CreateParameter('acc', 'number')]; + if (IsNumber(schema.maxItems)) + yield `${value}.length <= ${schema.maxItems}`; + if (IsNumber(schema.minItems)) + yield `${value}.length >= ${schema.minItems}`; + const elementExpression = CreateExpression(schema.items, references, 'value'); + // yield `${value}.every((${parameter}) => ${elementExpression})` // issue: 1519 + yield `((array) => { for(const ${parameter} of array) if(!(${elementExpression})) { return false }; return true; })(${value})`; + if (IsSchema(schema.contains) || IsNumber(schema.minContains) || IsNumber(schema.maxContains)) { + const containsSchema = IsSchema(schema.contains) ? schema.contains : Never(); + const checkExpression = CreateExpression(containsSchema, references, 'value'); + const checkMinContains = IsNumber(schema.minContains) ? [`(count >= ${schema.minContains})`] : []; + const checkMaxContains = IsNumber(schema.maxContains) ? [`(count <= ${schema.maxContains})`] : []; + const checkCount = `const count = value.reduce((${accumulator}, ${parameter}) => ${checkExpression} ? acc + 1 : acc, 0)`; + const check = [`(count > 0)`, ...checkMinContains, ...checkMaxContains].join(' && '); + yield `((${parameter}) => { ${checkCount}; return ${check}})(${value})`; + } + if (schema.uniqueItems === true) { + const check = `const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true`; + const block = `const set = new Set(); for(const element of value) { ${check} }`; + yield `((${parameter}) => { ${block} )(${value})`; + } + } + function* FromAsyncIterator(schema, references, value) { + yield `(typeof value === 'object' && Symbol.asyncIterator in ${value})`; + } + function* FromBigInt(schema, references, value) { + yield `(typeof ${value} === 'bigint')`; + if (IsBigInt(schema.exclusiveMaximum)) + yield `${value} < BigInt(${schema.exclusiveMaximum})`; + if (IsBigInt(schema.exclusiveMinimum)) + yield `${value} > BigInt(${schema.exclusiveMinimum})`; + if (IsBigInt(schema.maximum)) + yield `${value} <= BigInt(${schema.maximum})`; + if (IsBigInt(schema.minimum)) + yield `${value} >= BigInt(${schema.minimum})`; + if (IsBigInt(schema.multipleOf)) + yield `(${value} % BigInt(${schema.multipleOf})) === 0`; + } + function* FromBoolean(schema, references, value) { + yield `(typeof ${value} === 'boolean')`; + } + function* FromConstructor(schema, references, value) { + yield* Visit(schema.returns, references, `${value}.prototype`); + } + function* FromDate(schema, references, value) { + yield `(${value} instanceof Date) && Number.isFinite(${value}.getTime())`; + if (IsNumber(schema.exclusiveMaximumTimestamp)) + yield `${value}.getTime() < ${schema.exclusiveMaximumTimestamp}`; + if (IsNumber(schema.exclusiveMinimumTimestamp)) + yield `${value}.getTime() > ${schema.exclusiveMinimumTimestamp}`; + if (IsNumber(schema.maximumTimestamp)) + yield `${value}.getTime() <= ${schema.maximumTimestamp}`; + if (IsNumber(schema.minimumTimestamp)) + yield `${value}.getTime() >= ${schema.minimumTimestamp}`; + if (IsNumber(schema.multipleOfTimestamp)) + yield `(${value}.getTime() % ${schema.multipleOfTimestamp}) === 0`; + } + function* FromFunction(schema, references, value) { + yield `(typeof ${value} === 'function')`; + } + function* FromImport(schema, references, value) { + const members = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => { + return [...result, schema.$defs[key]]; + }, []); + yield* Visit(Ref(schema.$ref), [...references, ...members], value); + } + function* FromInteger(schema, references, value) { + yield `Number.isInteger(${value})`; + if (IsNumber(schema.exclusiveMaximum)) + yield `${value} < ${schema.exclusiveMaximum}`; + if (IsNumber(schema.exclusiveMinimum)) + yield `${value} > ${schema.exclusiveMinimum}`; + if (IsNumber(schema.maximum)) + yield `${value} <= ${schema.maximum}`; + if (IsNumber(schema.minimum)) + yield `${value} >= ${schema.minimum}`; + if (IsNumber(schema.multipleOf)) + yield `(${value} % ${schema.multipleOf}) === 0`; + } + function* FromIntersect(schema, references, value) { + const check1 = schema.allOf.map((schema) => CreateExpression(schema, references, value)).join(' && '); + if (schema.unevaluatedProperties === false) { + const keyCheck = CreateVariable(`${new RegExp(KeyOfPattern(schema))};`); + const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key))`; + yield `(${check1} && ${check2})`; + } + else if (IsSchema(schema.unevaluatedProperties)) { + const keyCheck = CreateVariable(`${new RegExp(KeyOfPattern(schema))};`); + const check2 = `Object.getOwnPropertyNames(${value}).every(key => ${keyCheck}.test(key) || ${CreateExpression(schema.unevaluatedProperties, references, `${value}[key]`)})`; + yield `(${check1} && ${check2})`; + } + else { + yield `(${check1})`; + } + } + function* FromIterator(schema, references, value) { + yield `(typeof value === 'object' && Symbol.iterator in ${value})`; + } + function* FromLiteral(schema, references, value) { + if (typeof schema.const === 'number' || typeof schema.const === 'boolean') { + yield `(${value} === ${schema.const})`; + } + else { + yield `(${value} === '${LiteralString.Escape(schema.const)}')`; + } + } + function* FromNever(schema, references, value) { + yield `false`; + } + function* FromNot(schema, references, value) { + const expression = CreateExpression(schema.not, references, value); + yield `(!${expression})`; + } + function* FromNull(schema, references, value) { + yield `(${value} === null)`; + } + function* FromNumber(schema, references, value) { + yield Policy.IsNumberLike(value); + if (IsNumber(schema.exclusiveMaximum)) + yield `${value} < ${schema.exclusiveMaximum}`; + if (IsNumber(schema.exclusiveMinimum)) + yield `${value} > ${schema.exclusiveMinimum}`; + if (IsNumber(schema.maximum)) + yield `${value} <= ${schema.maximum}`; + if (IsNumber(schema.minimum)) + yield `${value} >= ${schema.minimum}`; + if (IsNumber(schema.multipleOf)) + yield `(${value} % ${schema.multipleOf}) === 0`; + } + function* FromObject(schema, references, value) { + yield Policy.IsObjectLike(value); + if (IsNumber(schema.minProperties)) + yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`; + if (IsNumber(schema.maxProperties)) + yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`; + const knownKeys = Object.getOwnPropertyNames(schema.properties); + for (const knownKey of knownKeys) { + const memberExpression = MemberExpression.Encode(value, knownKey); + const property = schema.properties[knownKey]; + if (schema.required && schema.required.includes(knownKey)) { + yield* Visit(property, references, memberExpression); + if (ExtendsUndefinedCheck(property) || IsAnyOrUnknown(property)) + yield `('${knownKey}' in ${value})`; + } + else { + const expression = CreateExpression(property, references, memberExpression); + yield Policy.IsExactOptionalProperty(value, knownKey, expression); + } + } + if (schema.additionalProperties === false) { + if (schema.required && schema.required.length === knownKeys.length) { + yield `Object.getOwnPropertyNames(${value}).length === ${knownKeys.length}`; + } + else { + const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`; + yield `Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key))`; + } + } + if (typeof schema.additionalProperties === 'object') { + const expression = CreateExpression(schema.additionalProperties, references, `${value}[key]`); + const keys = `[${knownKeys.map((key) => `'${key}'`).join(', ')}]`; + yield `(Object.getOwnPropertyNames(${value}).every(key => ${keys}.includes(key) || ${expression}))`; + } + } + function* FromPromise(schema, references, value) { + yield `${value} instanceof Promise`; + } + function* FromRecord(schema, references, value) { + yield Policy.IsRecordLike(value); + if (IsNumber(schema.minProperties)) + yield `Object.getOwnPropertyNames(${value}).length >= ${schema.minProperties}`; + if (IsNumber(schema.maxProperties)) + yield `Object.getOwnPropertyNames(${value}).length <= ${schema.maxProperties}`; + const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0]; + const variable = CreateVariable(`${new RegExp(patternKey)}`); + const check1 = CreateExpression(patternSchema, references, 'value'); + const check2 = IsSchema(schema.additionalProperties) ? CreateExpression(schema.additionalProperties, references, value) : schema.additionalProperties === false ? 'false' : 'true'; + const expression = `(${variable}.test(key) ? ${check1} : ${check2})`; + yield `(Object.entries(${value}).every(([key, value]) => ${expression}))`; + } + function* FromRef(schema, references, value) { + const target = Deref(schema, references); + // Reference: If we have seen this reference before we can just yield and return the function call. + // If this isn't the case we defer to visit to generate and set the function for subsequent passes. + if (state.functions.has(schema.$ref)) + return yield `${CreateFunctionName(schema.$ref)}(${value})`; + yield* Visit(target, references, value); + } + function* FromRegExp(schema, references, value) { + const variable = CreateVariable(`${new RegExp(schema.source, schema.flags)};`); + yield `(typeof ${value} === 'string')`; + if (IsNumber(schema.maxLength)) + yield `${value}.length <= ${schema.maxLength}`; + if (IsNumber(schema.minLength)) + yield `${value}.length >= ${schema.minLength}`; + yield `${variable}.test(${value})`; + } + function* FromString(schema, references, value) { + yield `(typeof ${value} === 'string')`; + if (IsNumber(schema.maxLength)) + yield `${value}.length <= ${schema.maxLength}`; + if (IsNumber(schema.minLength)) + yield `${value}.length >= ${schema.minLength}`; + if (schema.pattern !== undefined) { + const variable = CreateVariable(`${new RegExp(schema.pattern)};`); + yield `${variable}.test(${value})`; + } + if (schema.format !== undefined) { + yield `format('${schema.format}', ${value})`; + } + } + function* FromSymbol(schema, references, value) { + yield `(typeof ${value} === 'symbol')`; + } + function* FromTemplateLiteral(schema, references, value) { + yield `(typeof ${value} === 'string')`; + const variable = CreateVariable(`${new RegExp(schema.pattern)};`); + yield `${variable}.test(${value})`; + } + function* FromThis(schema, references, value) { + // Note: This types are assured to be hoisted prior to this call. Just yield the function. + yield `${CreateFunctionName(schema.$ref)}(${value})`; + } + function* FromTuple(schema, references, value) { + yield `Array.isArray(${value})`; + if (schema.items === undefined) + return yield `${value}.length === 0`; + yield `(${value}.length === ${schema.maxItems})`; + for (let i = 0; i < schema.items.length; i++) { + const expression = CreateExpression(schema.items[i], references, `${value}[${i}]`); + yield `${expression}`; + } + } + function* FromUndefined(schema, references, value) { + yield `${value} === undefined`; + } + function* FromUnion(schema, references, value) { + const expressions = schema.anyOf.map((schema) => CreateExpression(schema, references, value)); + yield `(${expressions.join(' || ')})`; + } + function* FromUint8Array(schema, references, value) { + yield `${value} instanceof Uint8Array`; + if (IsNumber(schema.maxByteLength)) + yield `(${value}.length <= ${schema.maxByteLength})`; + if (IsNumber(schema.minByteLength)) + yield `(${value}.length >= ${schema.minByteLength})`; + } + function* FromUnknown(schema, references, value) { + yield 'true'; + } + function* FromVoid(schema, references, value) { + yield Policy.IsVoidLike(value); + } + function* FromKind(schema, references, value) { + const instance = state.instances.size; + state.instances.set(instance, schema); + yield `kind('${schema[Kind]}', ${instance}, ${value})`; + } + function* Visit(schema, references, value, useHoisting = true) { + const references_ = IsString(schema.$id) ? [...references, schema] : references; + const schema_ = schema; + // -------------------------------------------------------------- + // Hoisting + // -------------------------------------------------------------- + if (useHoisting && IsString(schema.$id)) { + const functionName = CreateFunctionName(schema.$id); + if (state.functions.has(functionName)) { + return yield `${functionName}(${value})`; + } + else { + // Note: In the case of cyclic types, we need to create a 'functions' record + // to prevent infinitely re-visiting the CreateFunction. Subsequent attempts + // to visit will be caught by the above condition. + state.functions.set(functionName, ''); + const functionCode = CreateFunction(functionName, schema, references, 'value', false); + state.functions.set(functionName, functionCode); + return yield `${functionName}(${value})`; + } + } + switch (schema_[Kind]) { + case 'Any': + return yield* FromAny(schema_, references_, value); + case 'Argument': + return yield* FromArgument(schema_, references_, value); + case 'Array': + return yield* FromArray(schema_, references_, value); + case 'AsyncIterator': + return yield* FromAsyncIterator(schema_, references_, value); + case 'BigInt': + return yield* FromBigInt(schema_, references_, value); + case 'Boolean': + return yield* FromBoolean(schema_, references_, value); + case 'Constructor': + return yield* FromConstructor(schema_, references_, value); + case 'Date': + return yield* FromDate(schema_, references_, value); + case 'Function': + return yield* FromFunction(schema_, references_, value); + case 'Import': + return yield* FromImport(schema_, references_, value); + case 'Integer': + return yield* FromInteger(schema_, references_, value); + case 'Intersect': + return yield* FromIntersect(schema_, references_, value); + case 'Iterator': + return yield* FromIterator(schema_, references_, value); + case 'Literal': + return yield* FromLiteral(schema_, references_, value); + case 'Never': + return yield* FromNever(schema_, references_, value); + case 'Not': + return yield* FromNot(schema_, references_, value); + case 'Null': + return yield* FromNull(schema_, references_, value); + case 'Number': + return yield* FromNumber(schema_, references_, value); + case 'Object': + return yield* FromObject(schema_, references_, value); + case 'Promise': + return yield* FromPromise(schema_, references_, value); + case 'Record': + return yield* FromRecord(schema_, references_, value); + case 'Ref': + return yield* FromRef(schema_, references_, value); + case 'RegExp': + return yield* FromRegExp(schema_, references_, value); + case 'String': + return yield* FromString(schema_, references_, value); + case 'Symbol': + return yield* FromSymbol(schema_, references_, value); + case 'TemplateLiteral': + return yield* FromTemplateLiteral(schema_, references_, value); + case 'This': + return yield* FromThis(schema_, references_, value); + case 'Tuple': + return yield* FromTuple(schema_, references_, value); + case 'Undefined': + return yield* FromUndefined(schema_, references_, value); + case 'Union': + return yield* FromUnion(schema_, references_, value); + case 'Uint8Array': + return yield* FromUint8Array(schema_, references_, value); + case 'Unknown': + return yield* FromUnknown(schema_, references_, value); + case 'Void': + return yield* FromVoid(schema_, references_, value); + default: + if (!TypeRegistry.Has(schema_[Kind])) + throw new TypeCompilerUnknownTypeError(schema); + return yield* FromKind(schema_, references_, value); + } + } + // ---------------------------------------------------------------- + // Compiler State + // ---------------------------------------------------------------- + // prettier-ignore + const state = { + language: 'javascript', // target language + functions: new Map(), // local functions + variables: new Map(), // local variables + instances: new Map() // exterior kind instances + }; + // ---------------------------------------------------------------- + // Compiler Factory + // ---------------------------------------------------------------- + function CreateExpression(schema, references, value, useHoisting = true) { + return `(${[...Visit(schema, references, value, useHoisting)].join(' && ')})`; + } + function CreateFunctionName($id) { + return `check_${Identifier.Encode($id)}`; + } + function CreateVariable(expression) { + const variableName = `local_${state.variables.size}`; + state.variables.set(variableName, `const ${variableName} = ${expression}`); + return variableName; + } + function CreateFunction(name, schema, references, value, useHoisting = true) { + const [newline, pad] = ['\n', (length) => ''.padStart(length, ' ')]; + const parameter = CreateParameter('value', 'any'); + const returns = CreateReturns('boolean'); + const expression = [...Visit(schema, references, value, useHoisting)].map((expression) => `${pad(4)}${expression}`).join(` &&${newline}`); + return `function ${name}(${parameter})${returns} {${newline}${pad(2)}return (${newline}${expression}${newline}${pad(2)})\n}`; + } + function CreateParameter(name, type) { + const annotation = state.language === 'typescript' ? `: ${type}` : ''; + return `${name}${annotation}`; + } + function CreateReturns(type) { + return state.language === 'typescript' ? `: ${type}` : ''; + } + // ---------------------------------------------------------------- + // Compile + // ---------------------------------------------------------------- + function Build(schema, references, options) { + const functionCode = CreateFunction('check', schema, references, 'value'); // will populate functions and variables + const parameter = CreateParameter('value', 'any'); + const returns = CreateReturns('boolean'); + const functions = [...state.functions.values()]; + const variables = [...state.variables.values()]; + // prettier-ignore + const checkFunction = IsString(schema.$id) // ensure top level schemas with $id's are hoisted + ? `return function check(${parameter})${returns} {\n return ${CreateFunctionName(schema.$id)}(value)\n}` + : `return ${functionCode}`; + return [...variables, ...functions, checkFunction].join('\n'); + } + /** Generates the code used to assert this type and returns it as a string */ + function Code(...args) { + const defaults = { language: 'javascript' }; + // prettier-ignore + const [schema, references, options] = (args.length === 2 && IsArray(args[1]) ? [args[0], args[1], defaults] : + args.length === 2 && !IsArray(args[1]) ? [args[0], [], args[1]] : + args.length === 3 ? [args[0], args[1], args[2]] : + args.length === 1 ? [args[0], [], defaults] : + [null, [], defaults]); + // compiler-reset + state.language = options.language; + state.variables.clear(); + state.functions.clear(); + state.instances.clear(); + if (!IsSchema(schema)) + throw new TypeCompilerTypeGuardError(schema); + for (const schema of references) + if (!IsSchema(schema)) + throw new TypeCompilerTypeGuardError(schema); + return Build(schema, references, options); + } + TypeCompiler.Code = Code; + /** Compiles a TypeBox type for optimal runtime type checking. Types must be valid TypeBox types of TSchema */ + function Compile(schema, references = []) { + const generatedCode = Code(schema, references, { language: 'javascript' }); + const compiledFunction = globalThis.Function('kind', 'format', 'hash', generatedCode); + const instances = new Map(state.instances); + function typeRegistryFunction(kind, instance, value) { + if (!TypeRegistry.Has(kind) || !instances.has(instance)) + return false; + const checkFunc = TypeRegistry.Get(kind); + const schema = instances.get(instance); + return checkFunc(schema, value); + } + function formatRegistryFunction(format, value) { + if (!FormatRegistry.Has(format)) + return false; + const checkFunc = FormatRegistry.Get(format); + return checkFunc(value); + } + function hashFunction(value) { + return Hash(value); + } + const checkFunction = compiledFunction(typeRegistryFunction, formatRegistryFunction, hashFunction); + return new TypeCheck(schema, references, checkFunction, generatedCode); + } + TypeCompiler.Compile = Compile; +})(TypeCompiler || (TypeCompiler = {})); diff --git a/ui/node_modules/@sinclair/typebox/build/esm/compiler/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/compiler/index.d.mts new file mode 100644 index 0000000..9c511bc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/compiler/index.d.mts @@ -0,0 +1,2 @@ +export { ValueError, ValueErrorType, ValueErrorIterator } from '../errors/index.mjs'; +export * from './compiler.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/compiler/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/compiler/index.mjs new file mode 100644 index 0000000..680a4bd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/compiler/index.mjs @@ -0,0 +1,2 @@ +export { ValueErrorType, ValueErrorIterator } from '../errors/index.mjs'; +export * from './compiler.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/errors/errors.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/errors/errors.d.mts new file mode 100644 index 0000000..4f50697 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/errors/errors.d.mts @@ -0,0 +1,91 @@ +import { TypeBoxError } from '../type/error/index.mjs'; +import type { TSchema } from '../type/schema/index.mjs'; +export declare enum ValueErrorType { + ArrayContains = 0, + ArrayMaxContains = 1, + ArrayMaxItems = 2, + ArrayMinContains = 3, + ArrayMinItems = 4, + ArrayUniqueItems = 5, + Array = 6, + AsyncIterator = 7, + BigIntExclusiveMaximum = 8, + BigIntExclusiveMinimum = 9, + BigIntMaximum = 10, + BigIntMinimum = 11, + BigIntMultipleOf = 12, + BigInt = 13, + Boolean = 14, + DateExclusiveMaximumTimestamp = 15, + DateExclusiveMinimumTimestamp = 16, + DateMaximumTimestamp = 17, + DateMinimumTimestamp = 18, + DateMultipleOfTimestamp = 19, + Date = 20, + Function = 21, + IntegerExclusiveMaximum = 22, + IntegerExclusiveMinimum = 23, + IntegerMaximum = 24, + IntegerMinimum = 25, + IntegerMultipleOf = 26, + Integer = 27, + IntersectUnevaluatedProperties = 28, + Intersect = 29, + Iterator = 30, + Kind = 31, + Literal = 32, + Never = 33, + Not = 34, + Null = 35, + NumberExclusiveMaximum = 36, + NumberExclusiveMinimum = 37, + NumberMaximum = 38, + NumberMinimum = 39, + NumberMultipleOf = 40, + Number = 41, + ObjectAdditionalProperties = 42, + ObjectMaxProperties = 43, + ObjectMinProperties = 44, + ObjectRequiredProperty = 45, + Object = 46, + Promise = 47, + RegExp = 48, + StringFormatUnknown = 49, + StringFormat = 50, + StringMaxLength = 51, + StringMinLength = 52, + StringPattern = 53, + String = 54, + Symbol = 55, + TupleLength = 56, + Tuple = 57, + Uint8ArrayMaxByteLength = 58, + Uint8ArrayMinByteLength = 59, + Uint8Array = 60, + Undefined = 61, + Union = 62, + Void = 63 +} +export interface ValueError { + type: ValueErrorType; + schema: TSchema; + path: string; + value: unknown; + message: string; + errors: ValueErrorIterator[]; +} +export declare class ValueErrorsUnknownTypeError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +export declare class ValueErrorIterator { + private readonly iterator; + constructor(iterator: IterableIterator); + [Symbol.iterator](): IterableIterator; + /** Returns the first value error or undefined if no errors */ + First(): ValueError | undefined; +} +/** Returns an iterator for each error in this value. */ +export declare function Errors(schema: T, references: TSchema[], value: unknown): ValueErrorIterator; +/** Returns an iterator for each error in this value. */ +export declare function Errors(schema: T, value: unknown): ValueErrorIterator; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/errors/errors.mjs b/ui/node_modules/@sinclair/typebox/build/esm/errors/errors.mjs new file mode 100644 index 0000000..7525b75 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/errors/errors.mjs @@ -0,0 +1,592 @@ +import { TypeSystemPolicy } from '../system/index.mjs'; +import { KeyOfPattern } from '../type/keyof/index.mjs'; +import { TypeRegistry, FormatRegistry } from '../type/registry/index.mjs'; +import { ExtendsUndefinedCheck } from '../type/extends/extends-undefined.mjs'; +import { GetErrorFunction } from './function.mjs'; +import { TypeBoxError } from '../type/error/index.mjs'; +import { Deref } from '../value/deref/index.mjs'; +import { Hash } from '../value/hash/index.mjs'; +import { Check } from '../value/check/index.mjs'; +import { Kind } from '../type/symbols/index.mjs'; +import { Never } from '../type/never/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +// prettier-ignore +import { IsArray, IsUint8Array, IsDate, IsPromise, IsFunction, IsAsyncIterator, IsIterator, IsBoolean, IsNumber, IsBigInt, IsString, IsSymbol, IsInteger, IsNull, IsUndefined } from '../value/guard/index.mjs'; +// ------------------------------------------------------------------ +// ValueErrorType +// ------------------------------------------------------------------ +export var ValueErrorType; +(function (ValueErrorType) { + ValueErrorType[ValueErrorType["ArrayContains"] = 0] = "ArrayContains"; + ValueErrorType[ValueErrorType["ArrayMaxContains"] = 1] = "ArrayMaxContains"; + ValueErrorType[ValueErrorType["ArrayMaxItems"] = 2] = "ArrayMaxItems"; + ValueErrorType[ValueErrorType["ArrayMinContains"] = 3] = "ArrayMinContains"; + ValueErrorType[ValueErrorType["ArrayMinItems"] = 4] = "ArrayMinItems"; + ValueErrorType[ValueErrorType["ArrayUniqueItems"] = 5] = "ArrayUniqueItems"; + ValueErrorType[ValueErrorType["Array"] = 6] = "Array"; + ValueErrorType[ValueErrorType["AsyncIterator"] = 7] = "AsyncIterator"; + ValueErrorType[ValueErrorType["BigIntExclusiveMaximum"] = 8] = "BigIntExclusiveMaximum"; + ValueErrorType[ValueErrorType["BigIntExclusiveMinimum"] = 9] = "BigIntExclusiveMinimum"; + ValueErrorType[ValueErrorType["BigIntMaximum"] = 10] = "BigIntMaximum"; + ValueErrorType[ValueErrorType["BigIntMinimum"] = 11] = "BigIntMinimum"; + ValueErrorType[ValueErrorType["BigIntMultipleOf"] = 12] = "BigIntMultipleOf"; + ValueErrorType[ValueErrorType["BigInt"] = 13] = "BigInt"; + ValueErrorType[ValueErrorType["Boolean"] = 14] = "Boolean"; + ValueErrorType[ValueErrorType["DateExclusiveMaximumTimestamp"] = 15] = "DateExclusiveMaximumTimestamp"; + ValueErrorType[ValueErrorType["DateExclusiveMinimumTimestamp"] = 16] = "DateExclusiveMinimumTimestamp"; + ValueErrorType[ValueErrorType["DateMaximumTimestamp"] = 17] = "DateMaximumTimestamp"; + ValueErrorType[ValueErrorType["DateMinimumTimestamp"] = 18] = "DateMinimumTimestamp"; + ValueErrorType[ValueErrorType["DateMultipleOfTimestamp"] = 19] = "DateMultipleOfTimestamp"; + ValueErrorType[ValueErrorType["Date"] = 20] = "Date"; + ValueErrorType[ValueErrorType["Function"] = 21] = "Function"; + ValueErrorType[ValueErrorType["IntegerExclusiveMaximum"] = 22] = "IntegerExclusiveMaximum"; + ValueErrorType[ValueErrorType["IntegerExclusiveMinimum"] = 23] = "IntegerExclusiveMinimum"; + ValueErrorType[ValueErrorType["IntegerMaximum"] = 24] = "IntegerMaximum"; + ValueErrorType[ValueErrorType["IntegerMinimum"] = 25] = "IntegerMinimum"; + ValueErrorType[ValueErrorType["IntegerMultipleOf"] = 26] = "IntegerMultipleOf"; + ValueErrorType[ValueErrorType["Integer"] = 27] = "Integer"; + ValueErrorType[ValueErrorType["IntersectUnevaluatedProperties"] = 28] = "IntersectUnevaluatedProperties"; + ValueErrorType[ValueErrorType["Intersect"] = 29] = "Intersect"; + ValueErrorType[ValueErrorType["Iterator"] = 30] = "Iterator"; + ValueErrorType[ValueErrorType["Kind"] = 31] = "Kind"; + ValueErrorType[ValueErrorType["Literal"] = 32] = "Literal"; + ValueErrorType[ValueErrorType["Never"] = 33] = "Never"; + ValueErrorType[ValueErrorType["Not"] = 34] = "Not"; + ValueErrorType[ValueErrorType["Null"] = 35] = "Null"; + ValueErrorType[ValueErrorType["NumberExclusiveMaximum"] = 36] = "NumberExclusiveMaximum"; + ValueErrorType[ValueErrorType["NumberExclusiveMinimum"] = 37] = "NumberExclusiveMinimum"; + ValueErrorType[ValueErrorType["NumberMaximum"] = 38] = "NumberMaximum"; + ValueErrorType[ValueErrorType["NumberMinimum"] = 39] = "NumberMinimum"; + ValueErrorType[ValueErrorType["NumberMultipleOf"] = 40] = "NumberMultipleOf"; + ValueErrorType[ValueErrorType["Number"] = 41] = "Number"; + ValueErrorType[ValueErrorType["ObjectAdditionalProperties"] = 42] = "ObjectAdditionalProperties"; + ValueErrorType[ValueErrorType["ObjectMaxProperties"] = 43] = "ObjectMaxProperties"; + ValueErrorType[ValueErrorType["ObjectMinProperties"] = 44] = "ObjectMinProperties"; + ValueErrorType[ValueErrorType["ObjectRequiredProperty"] = 45] = "ObjectRequiredProperty"; + ValueErrorType[ValueErrorType["Object"] = 46] = "Object"; + ValueErrorType[ValueErrorType["Promise"] = 47] = "Promise"; + ValueErrorType[ValueErrorType["RegExp"] = 48] = "RegExp"; + ValueErrorType[ValueErrorType["StringFormatUnknown"] = 49] = "StringFormatUnknown"; + ValueErrorType[ValueErrorType["StringFormat"] = 50] = "StringFormat"; + ValueErrorType[ValueErrorType["StringMaxLength"] = 51] = "StringMaxLength"; + ValueErrorType[ValueErrorType["StringMinLength"] = 52] = "StringMinLength"; + ValueErrorType[ValueErrorType["StringPattern"] = 53] = "StringPattern"; + ValueErrorType[ValueErrorType["String"] = 54] = "String"; + ValueErrorType[ValueErrorType["Symbol"] = 55] = "Symbol"; + ValueErrorType[ValueErrorType["TupleLength"] = 56] = "TupleLength"; + ValueErrorType[ValueErrorType["Tuple"] = 57] = "Tuple"; + ValueErrorType[ValueErrorType["Uint8ArrayMaxByteLength"] = 58] = "Uint8ArrayMaxByteLength"; + ValueErrorType[ValueErrorType["Uint8ArrayMinByteLength"] = 59] = "Uint8ArrayMinByteLength"; + ValueErrorType[ValueErrorType["Uint8Array"] = 60] = "Uint8Array"; + ValueErrorType[ValueErrorType["Undefined"] = 61] = "Undefined"; + ValueErrorType[ValueErrorType["Union"] = 62] = "Union"; + ValueErrorType[ValueErrorType["Void"] = 63] = "Void"; +})(ValueErrorType || (ValueErrorType = {})); +// ------------------------------------------------------------------ +// ValueErrors +// ------------------------------------------------------------------ +export class ValueErrorsUnknownTypeError extends TypeBoxError { + constructor(schema) { + super('Unknown type'); + this.schema = schema; + } +} +// ------------------------------------------------------------------ +// EscapeKey +// ------------------------------------------------------------------ +function EscapeKey(key) { + return key.replace(/~/g, '~0').replace(/\//g, '~1'); // RFC6901 Path +} +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +function IsDefined(value) { + return value !== undefined; +} +// ------------------------------------------------------------------ +// ValueErrorIterator +// ------------------------------------------------------------------ +export class ValueErrorIterator { + constructor(iterator) { + this.iterator = iterator; + } + [Symbol.iterator]() { + return this.iterator; + } + /** Returns the first value error or undefined if no errors */ + First() { + const next = this.iterator.next(); + return next.done ? undefined : next.value; + } +} +// -------------------------------------------------------------------------- +// Create +// -------------------------------------------------------------------------- +function Create(errorType, schema, path, value, errors = []) { + return { + type: errorType, + schema, + path, + value, + message: GetErrorFunction()({ errorType, path, schema, value, errors }), + errors, + }; +} +// -------------------------------------------------------------------------- +// Types +// -------------------------------------------------------------------------- +function* FromAny(schema, references, path, value) { } +function* FromArgument(schema, references, path, value) { } +function* FromArray(schema, references, path, value) { + if (!IsArray(value)) { + return yield Create(ValueErrorType.Array, schema, path, value); + } + if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) { + yield Create(ValueErrorType.ArrayMinItems, schema, path, value); + } + if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) { + yield Create(ValueErrorType.ArrayMaxItems, schema, path, value); + } + for (let i = 0; i < value.length; i++) { + yield* Visit(schema.items, references, `${path}/${i}`, value[i]); + } + // prettier-ignore + if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) { + const hashed = Hash(element); + if (set.has(hashed)) { + return false; + } + else { + set.add(hashed); + } + } return true; })())) { + yield Create(ValueErrorType.ArrayUniqueItems, schema, path, value); + } + // contains + if (!(IsDefined(schema.contains) || IsDefined(schema.minContains) || IsDefined(schema.maxContains))) { + return; + } + const containsSchema = IsDefined(schema.contains) ? schema.contains : Never(); + const containsCount = value.reduce((acc, value, index) => (Visit(containsSchema, references, `${path}${index}`, value).next().done === true ? acc + 1 : acc), 0); + if (containsCount === 0) { + yield Create(ValueErrorType.ArrayContains, schema, path, value); + } + if (IsNumber(schema.minContains) && containsCount < schema.minContains) { + yield Create(ValueErrorType.ArrayMinContains, schema, path, value); + } + if (IsNumber(schema.maxContains) && containsCount > schema.maxContains) { + yield Create(ValueErrorType.ArrayMaxContains, schema, path, value); + } +} +function* FromAsyncIterator(schema, references, path, value) { + if (!IsAsyncIterator(value)) + yield Create(ValueErrorType.AsyncIterator, schema, path, value); +} +function* FromBigInt(schema, references, path, value) { + if (!IsBigInt(value)) + return yield Create(ValueErrorType.BigInt, schema, path, value); + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + yield Create(ValueErrorType.BigIntExclusiveMaximum, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + yield Create(ValueErrorType.BigIntExclusiveMinimum, schema, path, value); + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + yield Create(ValueErrorType.BigIntMaximum, schema, path, value); + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + yield Create(ValueErrorType.BigIntMinimum, schema, path, value); + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) { + yield Create(ValueErrorType.BigIntMultipleOf, schema, path, value); + } +} +function* FromBoolean(schema, references, path, value) { + if (!IsBoolean(value)) + yield Create(ValueErrorType.Boolean, schema, path, value); +} +function* FromConstructor(schema, references, path, value) { + yield* Visit(schema.returns, references, path, value.prototype); +} +function* FromDate(schema, references, path, value) { + if (!IsDate(value)) + return yield Create(ValueErrorType.Date, schema, path, value); + if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) { + yield Create(ValueErrorType.DateExclusiveMaximumTimestamp, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) { + yield Create(ValueErrorType.DateExclusiveMinimumTimestamp, schema, path, value); + } + if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) { + yield Create(ValueErrorType.DateMaximumTimestamp, schema, path, value); + } + if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) { + yield Create(ValueErrorType.DateMinimumTimestamp, schema, path, value); + } + if (IsDefined(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) { + yield Create(ValueErrorType.DateMultipleOfTimestamp, schema, path, value); + } +} +function* FromFunction(schema, references, path, value) { + if (!IsFunction(value)) + yield Create(ValueErrorType.Function, schema, path, value); +} +function* FromImport(schema, references, path, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + yield* Visit(target, [...references, ...definitions], path, value); +} +function* FromInteger(schema, references, path, value) { + if (!IsInteger(value)) + return yield Create(ValueErrorType.Integer, schema, path, value); + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + yield Create(ValueErrorType.IntegerExclusiveMaximum, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + yield Create(ValueErrorType.IntegerExclusiveMinimum, schema, path, value); + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + yield Create(ValueErrorType.IntegerMaximum, schema, path, value); + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + yield Create(ValueErrorType.IntegerMinimum, schema, path, value); + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + yield Create(ValueErrorType.IntegerMultipleOf, schema, path, value); + } +} +function* FromIntersect(schema, references, path, value) { + let hasError = false; + for (const inner of schema.allOf) { + for (const error of Visit(inner, references, path, value)) { + hasError = true; + yield error; + } + } + if (hasError) { + return yield Create(ValueErrorType.Intersect, schema, path, value); + } + if (schema.unevaluatedProperties === false) { + const keyCheck = new RegExp(KeyOfPattern(schema)); + for (const valueKey of Object.getOwnPropertyNames(value)) { + if (!keyCheck.test(valueKey)) { + yield Create(ValueErrorType.IntersectUnevaluatedProperties, schema, `${path}/${valueKey}`, value); + } + } + } + if (typeof schema.unevaluatedProperties === 'object') { + const keyCheck = new RegExp(KeyOfPattern(schema)); + for (const valueKey of Object.getOwnPropertyNames(value)) { + if (!keyCheck.test(valueKey)) { + const next = Visit(schema.unevaluatedProperties, references, `${path}/${valueKey}`, value[valueKey]).next(); + if (!next.done) + yield next.value; // yield interior + } + } + } +} +function* FromIterator(schema, references, path, value) { + if (!IsIterator(value)) + yield Create(ValueErrorType.Iterator, schema, path, value); +} +function* FromLiteral(schema, references, path, value) { + if (!(value === schema.const)) + yield Create(ValueErrorType.Literal, schema, path, value); +} +function* FromNever(schema, references, path, value) { + yield Create(ValueErrorType.Never, schema, path, value); +} +function* FromNot(schema, references, path, value) { + if (Visit(schema.not, references, path, value).next().done === true) + yield Create(ValueErrorType.Not, schema, path, value); +} +function* FromNull(schema, references, path, value) { + if (!IsNull(value)) + yield Create(ValueErrorType.Null, schema, path, value); +} +function* FromNumber(schema, references, path, value) { + if (!TypeSystemPolicy.IsNumberLike(value)) + return yield Create(ValueErrorType.Number, schema, path, value); + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + yield Create(ValueErrorType.NumberExclusiveMaximum, schema, path, value); + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + yield Create(ValueErrorType.NumberExclusiveMinimum, schema, path, value); + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + yield Create(ValueErrorType.NumberMaximum, schema, path, value); + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + yield Create(ValueErrorType.NumberMinimum, schema, path, value); + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + yield Create(ValueErrorType.NumberMultipleOf, schema, path, value); + } +} +function* FromObject(schema, references, path, value) { + if (!TypeSystemPolicy.IsObjectLike(value)) + return yield Create(ValueErrorType.Object, schema, path, value); + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + yield Create(ValueErrorType.ObjectMinProperties, schema, path, value); + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + yield Create(ValueErrorType.ObjectMaxProperties, schema, path, value); + } + const requiredKeys = Array.isArray(schema.required) ? schema.required : []; + const knownKeys = Object.getOwnPropertyNames(schema.properties); + const unknownKeys = Object.getOwnPropertyNames(value); + for (const requiredKey of requiredKeys) { + if (unknownKeys.includes(requiredKey)) + continue; + yield Create(ValueErrorType.ObjectRequiredProperty, schema.properties[requiredKey], `${path}/${EscapeKey(requiredKey)}`, undefined); + } + if (schema.additionalProperties === false) { + for (const valueKey of unknownKeys) { + if (!knownKeys.includes(valueKey)) { + yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path}/${EscapeKey(valueKey)}`, value[valueKey]); + } + } + } + if (typeof schema.additionalProperties === 'object') { + for (const valueKey of unknownKeys) { + if (knownKeys.includes(valueKey)) + continue; + yield* Visit(schema.additionalProperties, references, `${path}/${EscapeKey(valueKey)}`, value[valueKey]); + } + } + for (const knownKey of knownKeys) { + const property = schema.properties[knownKey]; + if (schema.required && schema.required.includes(knownKey)) { + yield* Visit(property, references, `${path}/${EscapeKey(knownKey)}`, value[knownKey]); + if (ExtendsUndefinedCheck(schema) && !(knownKey in value)) { + yield Create(ValueErrorType.ObjectRequiredProperty, property, `${path}/${EscapeKey(knownKey)}`, undefined); + } + } + else { + if (TypeSystemPolicy.IsExactOptionalProperty(value, knownKey)) { + yield* Visit(property, references, `${path}/${EscapeKey(knownKey)}`, value[knownKey]); + } + } + } +} +function* FromPromise(schema, references, path, value) { + if (!IsPromise(value)) + yield Create(ValueErrorType.Promise, schema, path, value); +} +function* FromRecord(schema, references, path, value) { + if (!TypeSystemPolicy.IsRecordLike(value)) + return yield Create(ValueErrorType.Object, schema, path, value); + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + yield Create(ValueErrorType.ObjectMinProperties, schema, path, value); + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + yield Create(ValueErrorType.ObjectMaxProperties, schema, path, value); + } + const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0]; + const regex = new RegExp(patternKey); + for (const [propertyKey, propertyValue] of Object.entries(value)) { + if (regex.test(propertyKey)) + yield* Visit(patternSchema, references, `${path}/${EscapeKey(propertyKey)}`, propertyValue); + } + if (typeof schema.additionalProperties === 'object') { + for (const [propertyKey, propertyValue] of Object.entries(value)) { + if (!regex.test(propertyKey)) + yield* Visit(schema.additionalProperties, references, `${path}/${EscapeKey(propertyKey)}`, propertyValue); + } + } + if (schema.additionalProperties === false) { + for (const [propertyKey, propertyValue] of Object.entries(value)) { + if (regex.test(propertyKey)) + continue; + return yield Create(ValueErrorType.ObjectAdditionalProperties, schema, `${path}/${EscapeKey(propertyKey)}`, propertyValue); + } + } +} +function* FromRef(schema, references, path, value) { + yield* Visit(Deref(schema, references), references, path, value); +} +function* FromRegExp(schema, references, path, value) { + if (!IsString(value)) + return yield Create(ValueErrorType.String, schema, path, value); + if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) { + yield Create(ValueErrorType.StringMinLength, schema, path, value); + } + if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) { + yield Create(ValueErrorType.StringMaxLength, schema, path, value); + } + const regex = new RegExp(schema.source, schema.flags); + if (!regex.test(value)) { + return yield Create(ValueErrorType.RegExp, schema, path, value); + } +} +function* FromString(schema, references, path, value) { + if (!IsString(value)) + return yield Create(ValueErrorType.String, schema, path, value); + if (IsDefined(schema.minLength) && !(value.length >= schema.minLength)) { + yield Create(ValueErrorType.StringMinLength, schema, path, value); + } + if (IsDefined(schema.maxLength) && !(value.length <= schema.maxLength)) { + yield Create(ValueErrorType.StringMaxLength, schema, path, value); + } + if (IsString(schema.pattern)) { + const regex = new RegExp(schema.pattern); + if (!regex.test(value)) { + yield Create(ValueErrorType.StringPattern, schema, path, value); + } + } + if (IsString(schema.format)) { + if (!FormatRegistry.Has(schema.format)) { + yield Create(ValueErrorType.StringFormatUnknown, schema, path, value); + } + else { + const format = FormatRegistry.Get(schema.format); + if (!format(value)) { + yield Create(ValueErrorType.StringFormat, schema, path, value); + } + } + } +} +function* FromSymbol(schema, references, path, value) { + if (!IsSymbol(value)) + yield Create(ValueErrorType.Symbol, schema, path, value); +} +function* FromTemplateLiteral(schema, references, path, value) { + if (!IsString(value)) + return yield Create(ValueErrorType.String, schema, path, value); + const regex = new RegExp(schema.pattern); + if (!regex.test(value)) { + yield Create(ValueErrorType.StringPattern, schema, path, value); + } +} +function* FromThis(schema, references, path, value) { + yield* Visit(Deref(schema, references), references, path, value); +} +function* FromTuple(schema, references, path, value) { + if (!IsArray(value)) + return yield Create(ValueErrorType.Tuple, schema, path, value); + if (schema.items === undefined && !(value.length === 0)) { + return yield Create(ValueErrorType.TupleLength, schema, path, value); + } + if (!(value.length === schema.maxItems)) { + return yield Create(ValueErrorType.TupleLength, schema, path, value); + } + if (!schema.items) { + return; + } + for (let i = 0; i < schema.items.length; i++) { + yield* Visit(schema.items[i], references, `${path}/${i}`, value[i]); + } +} +function* FromUndefined(schema, references, path, value) { + if (!IsUndefined(value)) + yield Create(ValueErrorType.Undefined, schema, path, value); +} +function* FromUnion(schema, references, path, value) { + if (Check(schema, references, value)) + return; + const errors = schema.anyOf.map((variant) => new ValueErrorIterator(Visit(variant, references, path, value))); + yield Create(ValueErrorType.Union, schema, path, value, errors); +} +function* FromUint8Array(schema, references, path, value) { + if (!IsUint8Array(value)) + return yield Create(ValueErrorType.Uint8Array, schema, path, value); + if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) { + yield Create(ValueErrorType.Uint8ArrayMaxByteLength, schema, path, value); + } + if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) { + yield Create(ValueErrorType.Uint8ArrayMinByteLength, schema, path, value); + } +} +function* FromUnknown(schema, references, path, value) { } +function* FromVoid(schema, references, path, value) { + if (!TypeSystemPolicy.IsVoidLike(value)) + yield Create(ValueErrorType.Void, schema, path, value); +} +function* FromKind(schema, references, path, value) { + const check = TypeRegistry.Get(schema[Kind]); + if (!check(schema, value)) + yield Create(ValueErrorType.Kind, schema, path, value); +} +function* Visit(schema, references, path, value) { + const references_ = IsDefined(schema.$id) ? [...references, schema] : references; + const schema_ = schema; + switch (schema_[Kind]) { + case 'Any': + return yield* FromAny(schema_, references_, path, value); + case 'Argument': + return yield* FromArgument(schema_, references_, path, value); + case 'Array': + return yield* FromArray(schema_, references_, path, value); + case 'AsyncIterator': + return yield* FromAsyncIterator(schema_, references_, path, value); + case 'BigInt': + return yield* FromBigInt(schema_, references_, path, value); + case 'Boolean': + return yield* FromBoolean(schema_, references_, path, value); + case 'Constructor': + return yield* FromConstructor(schema_, references_, path, value); + case 'Date': + return yield* FromDate(schema_, references_, path, value); + case 'Function': + return yield* FromFunction(schema_, references_, path, value); + case 'Import': + return yield* FromImport(schema_, references_, path, value); + case 'Integer': + return yield* FromInteger(schema_, references_, path, value); + case 'Intersect': + return yield* FromIntersect(schema_, references_, path, value); + case 'Iterator': + return yield* FromIterator(schema_, references_, path, value); + case 'Literal': + return yield* FromLiteral(schema_, references_, path, value); + case 'Never': + return yield* FromNever(schema_, references_, path, value); + case 'Not': + return yield* FromNot(schema_, references_, path, value); + case 'Null': + return yield* FromNull(schema_, references_, path, value); + case 'Number': + return yield* FromNumber(schema_, references_, path, value); + case 'Object': + return yield* FromObject(schema_, references_, path, value); + case 'Promise': + return yield* FromPromise(schema_, references_, path, value); + case 'Record': + return yield* FromRecord(schema_, references_, path, value); + case 'Ref': + return yield* FromRef(schema_, references_, path, value); + case 'RegExp': + return yield* FromRegExp(schema_, references_, path, value); + case 'String': + return yield* FromString(schema_, references_, path, value); + case 'Symbol': + return yield* FromSymbol(schema_, references_, path, value); + case 'TemplateLiteral': + return yield* FromTemplateLiteral(schema_, references_, path, value); + case 'This': + return yield* FromThis(schema_, references_, path, value); + case 'Tuple': + return yield* FromTuple(schema_, references_, path, value); + case 'Undefined': + return yield* FromUndefined(schema_, references_, path, value); + case 'Union': + return yield* FromUnion(schema_, references_, path, value); + case 'Uint8Array': + return yield* FromUint8Array(schema_, references_, path, value); + case 'Unknown': + return yield* FromUnknown(schema_, references_, path, value); + case 'Void': + return yield* FromVoid(schema_, references_, path, value); + default: + if (!TypeRegistry.Has(schema_[Kind])) + throw new ValueErrorsUnknownTypeError(schema); + return yield* FromKind(schema_, references_, path, value); + } +} +/** Returns an iterator for each error in this value. */ +export function Errors(...args) { + const iterator = args.length === 3 ? Visit(args[0], args[1], '', args[2]) : Visit(args[0], [], '', args[1]); + return new ValueErrorIterator(iterator); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/errors/function.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/errors/function.d.mts new file mode 100644 index 0000000..b59f7b9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/errors/function.d.mts @@ -0,0 +1,21 @@ +import { TSchema } from '../type/schema/index.mjs'; +import { ValueErrorIterator, ValueErrorType } from './errors.mjs'; +/** Creates an error message using en-US as the default locale */ +export declare function DefaultErrorFunction(error: ErrorFunctionParameter): string; +export type ErrorFunctionParameter = { + /** The type of validation error */ + errorType: ValueErrorType; + /** The path of the error */ + path: string; + /** The schema associated with the error */ + schema: TSchema; + /** The value associated with the error */ + value: unknown; + /** Interior errors for this error */ + errors: ValueErrorIterator[]; +}; +export type ErrorFunction = (parameter: ErrorFunctionParameter) => string; +/** Sets the error function used to generate error messages. */ +export declare function SetErrorFunction(callback: ErrorFunction): void; +/** Gets the error function used to generate error messages */ +export declare function GetErrorFunction(): ErrorFunction; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/errors/function.mjs b/ui/node_modules/@sinclair/typebox/build/esm/errors/function.mjs new file mode 100644 index 0000000..9bdabaf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/errors/function.mjs @@ -0,0 +1,147 @@ +import { Kind } from '../type/symbols/index.mjs'; +import { ValueErrorType } from './errors.mjs'; +/** Creates an error message using en-US as the default locale */ +export function DefaultErrorFunction(error) { + switch (error.errorType) { + case ValueErrorType.ArrayContains: + return 'Expected array to contain at least one matching value'; + case ValueErrorType.ArrayMaxContains: + return `Expected array to contain no more than ${error.schema.maxContains} matching values`; + case ValueErrorType.ArrayMinContains: + return `Expected array to contain at least ${error.schema.minContains} matching values`; + case ValueErrorType.ArrayMaxItems: + return `Expected array length to be less or equal to ${error.schema.maxItems}`; + case ValueErrorType.ArrayMinItems: + return `Expected array length to be greater or equal to ${error.schema.minItems}`; + case ValueErrorType.ArrayUniqueItems: + return 'Expected array elements to be unique'; + case ValueErrorType.Array: + return 'Expected array'; + case ValueErrorType.AsyncIterator: + return 'Expected AsyncIterator'; + case ValueErrorType.BigIntExclusiveMaximum: + return `Expected bigint to be less than ${error.schema.exclusiveMaximum}`; + case ValueErrorType.BigIntExclusiveMinimum: + return `Expected bigint to be greater than ${error.schema.exclusiveMinimum}`; + case ValueErrorType.BigIntMaximum: + return `Expected bigint to be less or equal to ${error.schema.maximum}`; + case ValueErrorType.BigIntMinimum: + return `Expected bigint to be greater or equal to ${error.schema.minimum}`; + case ValueErrorType.BigIntMultipleOf: + return `Expected bigint to be a multiple of ${error.schema.multipleOf}`; + case ValueErrorType.BigInt: + return 'Expected bigint'; + case ValueErrorType.Boolean: + return 'Expected boolean'; + case ValueErrorType.DateExclusiveMinimumTimestamp: + return `Expected Date timestamp to be greater than ${error.schema.exclusiveMinimumTimestamp}`; + case ValueErrorType.DateExclusiveMaximumTimestamp: + return `Expected Date timestamp to be less than ${error.schema.exclusiveMaximumTimestamp}`; + case ValueErrorType.DateMinimumTimestamp: + return `Expected Date timestamp to be greater or equal to ${error.schema.minimumTimestamp}`; + case ValueErrorType.DateMaximumTimestamp: + return `Expected Date timestamp to be less or equal to ${error.schema.maximumTimestamp}`; + case ValueErrorType.DateMultipleOfTimestamp: + return `Expected Date timestamp to be a multiple of ${error.schema.multipleOfTimestamp}`; + case ValueErrorType.Date: + return 'Expected Date'; + case ValueErrorType.Function: + return 'Expected function'; + case ValueErrorType.IntegerExclusiveMaximum: + return `Expected integer to be less than ${error.schema.exclusiveMaximum}`; + case ValueErrorType.IntegerExclusiveMinimum: + return `Expected integer to be greater than ${error.schema.exclusiveMinimum}`; + case ValueErrorType.IntegerMaximum: + return `Expected integer to be less or equal to ${error.schema.maximum}`; + case ValueErrorType.IntegerMinimum: + return `Expected integer to be greater or equal to ${error.schema.minimum}`; + case ValueErrorType.IntegerMultipleOf: + return `Expected integer to be a multiple of ${error.schema.multipleOf}`; + case ValueErrorType.Integer: + return 'Expected integer'; + case ValueErrorType.IntersectUnevaluatedProperties: + return 'Unexpected property'; + case ValueErrorType.Intersect: + return 'Expected all values to match'; + case ValueErrorType.Iterator: + return 'Expected Iterator'; + case ValueErrorType.Literal: + return `Expected ${typeof error.schema.const === 'string' ? `'${error.schema.const}'` : error.schema.const}`; + case ValueErrorType.Never: + return 'Never'; + case ValueErrorType.Not: + return 'Value should not match'; + case ValueErrorType.Null: + return 'Expected null'; + case ValueErrorType.NumberExclusiveMaximum: + return `Expected number to be less than ${error.schema.exclusiveMaximum}`; + case ValueErrorType.NumberExclusiveMinimum: + return `Expected number to be greater than ${error.schema.exclusiveMinimum}`; + case ValueErrorType.NumberMaximum: + return `Expected number to be less or equal to ${error.schema.maximum}`; + case ValueErrorType.NumberMinimum: + return `Expected number to be greater or equal to ${error.schema.minimum}`; + case ValueErrorType.NumberMultipleOf: + return `Expected number to be a multiple of ${error.schema.multipleOf}`; + case ValueErrorType.Number: + return 'Expected number'; + case ValueErrorType.Object: + return 'Expected object'; + case ValueErrorType.ObjectAdditionalProperties: + return 'Unexpected property'; + case ValueErrorType.ObjectMaxProperties: + return `Expected object to have no more than ${error.schema.maxProperties} properties`; + case ValueErrorType.ObjectMinProperties: + return `Expected object to have at least ${error.schema.minProperties} properties`; + case ValueErrorType.ObjectRequiredProperty: + return 'Expected required property'; + case ValueErrorType.Promise: + return 'Expected Promise'; + case ValueErrorType.RegExp: + return 'Expected string to match regular expression'; + case ValueErrorType.StringFormatUnknown: + return `Unknown format '${error.schema.format}'`; + case ValueErrorType.StringFormat: + return `Expected string to match '${error.schema.format}' format`; + case ValueErrorType.StringMaxLength: + return `Expected string length less or equal to ${error.schema.maxLength}`; + case ValueErrorType.StringMinLength: + return `Expected string length greater or equal to ${error.schema.minLength}`; + case ValueErrorType.StringPattern: + return `Expected string to match '${error.schema.pattern}'`; + case ValueErrorType.String: + return 'Expected string'; + case ValueErrorType.Symbol: + return 'Expected symbol'; + case ValueErrorType.TupleLength: + return `Expected tuple to have ${error.schema.maxItems || 0} elements`; + case ValueErrorType.Tuple: + return 'Expected tuple'; + case ValueErrorType.Uint8ArrayMaxByteLength: + return `Expected byte length less or equal to ${error.schema.maxByteLength}`; + case ValueErrorType.Uint8ArrayMinByteLength: + return `Expected byte length greater or equal to ${error.schema.minByteLength}`; + case ValueErrorType.Uint8Array: + return 'Expected Uint8Array'; + case ValueErrorType.Undefined: + return 'Expected undefined'; + case ValueErrorType.Union: + return 'Expected union value'; + case ValueErrorType.Void: + return 'Expected void'; + case ValueErrorType.Kind: + return `Expected kind '${error.schema[Kind]}'`; + default: + return 'Unknown error type'; + } +} +/** Manages error message providers */ +let errorFunction = DefaultErrorFunction; +/** Sets the error function used to generate error messages. */ +export function SetErrorFunction(callback) { + errorFunction = callback; +} +/** Gets the error function used to generate error messages */ +export function GetErrorFunction() { + return errorFunction; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/errors/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/errors/index.d.mts new file mode 100644 index 0000000..1c886b0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/errors/index.d.mts @@ -0,0 +1,2 @@ +export * from './errors.mjs'; +export * from './function.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/errors/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/errors/index.mjs new file mode 100644 index 0000000..1c886b0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/errors/index.mjs @@ -0,0 +1,2 @@ +export * from './errors.mjs'; +export * from './function.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/index.d.mts new file mode 100644 index 0000000..5dafc75 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/index.d.mts @@ -0,0 +1,71 @@ +export * from './type/clone/index.mjs'; +export * from './type/create/index.mjs'; +export * from './type/error/index.mjs'; +export * from './type/guard/index.mjs'; +export * from './type/helpers/index.mjs'; +export * from './type/patterns/index.mjs'; +export * from './type/registry/index.mjs'; +export * from './type/sets/index.mjs'; +export * from './type/symbols/index.mjs'; +export * from './type/any/index.mjs'; +export * from './type/array/index.mjs'; +export * from './type/argument/index.mjs'; +export * from './type/async-iterator/index.mjs'; +export * from './type/awaited/index.mjs'; +export * from './type/bigint/index.mjs'; +export * from './type/boolean/index.mjs'; +export * from './type/composite/index.mjs'; +export * from './type/const/index.mjs'; +export * from './type/constructor/index.mjs'; +export * from './type/constructor-parameters/index.mjs'; +export * from './type/date/index.mjs'; +export * from './type/enum/index.mjs'; +export * from './type/exclude/index.mjs'; +export * from './type/extends/index.mjs'; +export * from './type/extract/index.mjs'; +export * from './type/function/index.mjs'; +export * from './type/indexed/index.mjs'; +export * from './type/instance-type/index.mjs'; +export * from './type/instantiate/index.mjs'; +export * from './type/integer/index.mjs'; +export * from './type/intersect/index.mjs'; +export * from './type/iterator/index.mjs'; +export * from './type/intrinsic/index.mjs'; +export * from './type/keyof/index.mjs'; +export * from './type/literal/index.mjs'; +export * from './type/module/index.mjs'; +export * from './type/mapped/index.mjs'; +export * from './type/never/index.mjs'; +export * from './type/not/index.mjs'; +export * from './type/null/index.mjs'; +export * from './type/number/index.mjs'; +export * from './type/object/index.mjs'; +export * from './type/omit/index.mjs'; +export * from './type/optional/index.mjs'; +export * from './type/parameters/index.mjs'; +export * from './type/partial/index.mjs'; +export * from './type/pick/index.mjs'; +export * from './type/promise/index.mjs'; +export * from './type/readonly/index.mjs'; +export * from './type/readonly-optional/index.mjs'; +export * from './type/record/index.mjs'; +export * from './type/recursive/index.mjs'; +export * from './type/ref/index.mjs'; +export * from './type/regexp/index.mjs'; +export * from './type/required/index.mjs'; +export * from './type/rest/index.mjs'; +export * from './type/return-type/index.mjs'; +export * from './type/schema/index.mjs'; +export * from './type/static/index.mjs'; +export * from './type/string/index.mjs'; +export * from './type/symbol/index.mjs'; +export * from './type/template-literal/index.mjs'; +export * from './type/transform/index.mjs'; +export * from './type/tuple/index.mjs'; +export * from './type/uint8array/index.mjs'; +export * from './type/undefined/index.mjs'; +export * from './type/union/index.mjs'; +export * from './type/unknown/index.mjs'; +export * from './type/unsafe/index.mjs'; +export * from './type/void/index.mjs'; +export * from './type/type/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/index.mjs new file mode 100644 index 0000000..3e0498a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/index.mjs @@ -0,0 +1,80 @@ +// ------------------------------------------------------------------ +// Infrastructure +// ------------------------------------------------------------------ +export * from './type/clone/index.mjs'; +export * from './type/create/index.mjs'; +export * from './type/error/index.mjs'; +export * from './type/guard/index.mjs'; +export * from './type/helpers/index.mjs'; +export * from './type/patterns/index.mjs'; +export * from './type/registry/index.mjs'; +export * from './type/sets/index.mjs'; +export * from './type/symbols/index.mjs'; +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +export * from './type/any/index.mjs'; +export * from './type/array/index.mjs'; +export * from './type/argument/index.mjs'; +export * from './type/async-iterator/index.mjs'; +export * from './type/awaited/index.mjs'; +export * from './type/bigint/index.mjs'; +export * from './type/boolean/index.mjs'; +export * from './type/composite/index.mjs'; +export * from './type/const/index.mjs'; +export * from './type/constructor/index.mjs'; +export * from './type/constructor-parameters/index.mjs'; +export * from './type/date/index.mjs'; +export * from './type/enum/index.mjs'; +export * from './type/exclude/index.mjs'; +export * from './type/extends/index.mjs'; +export * from './type/extract/index.mjs'; +export * from './type/function/index.mjs'; +export * from './type/indexed/index.mjs'; +export * from './type/instance-type/index.mjs'; +export * from './type/instantiate/index.mjs'; +export * from './type/integer/index.mjs'; +export * from './type/intersect/index.mjs'; +export * from './type/iterator/index.mjs'; +export * from './type/intrinsic/index.mjs'; +export * from './type/keyof/index.mjs'; +export * from './type/literal/index.mjs'; +export * from './type/module/index.mjs'; +export * from './type/mapped/index.mjs'; +export * from './type/never/index.mjs'; +export * from './type/not/index.mjs'; +export * from './type/null/index.mjs'; +export * from './type/number/index.mjs'; +export * from './type/object/index.mjs'; +export * from './type/omit/index.mjs'; +export * from './type/optional/index.mjs'; +export * from './type/parameters/index.mjs'; +export * from './type/partial/index.mjs'; +export * from './type/pick/index.mjs'; +export * from './type/promise/index.mjs'; +export * from './type/readonly/index.mjs'; +export * from './type/readonly-optional/index.mjs'; +export * from './type/record/index.mjs'; +export * from './type/recursive/index.mjs'; +export * from './type/ref/index.mjs'; +export * from './type/regexp/index.mjs'; +export * from './type/required/index.mjs'; +export * from './type/rest/index.mjs'; +export * from './type/return-type/index.mjs'; +export * from './type/schema/index.mjs'; +export * from './type/static/index.mjs'; +export * from './type/string/index.mjs'; +export * from './type/symbol/index.mjs'; +export * from './type/template-literal/index.mjs'; +export * from './type/transform/index.mjs'; +export * from './type/tuple/index.mjs'; +export * from './type/uint8array/index.mjs'; +export * from './type/undefined/index.mjs'; +export * from './type/union/index.mjs'; +export * from './type/unknown/index.mjs'; +export * from './type/unsafe/index.mjs'; +export * from './type/void/index.mjs'; +// ------------------------------------------------------------------ +// Type.* +// ------------------------------------------------------------------ +export * from './type/type/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/index.d.mts new file mode 100644 index 0000000..4321a7b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/index.d.mts @@ -0,0 +1,2 @@ +export * as Runtime from './runtime/index.mjs'; +export * as Static from './static/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/index.mjs new file mode 100644 index 0000000..4321a7b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/index.mjs @@ -0,0 +1,2 @@ +export * as Runtime from './runtime/index.mjs'; +export * as Static from './static/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.d.mts new file mode 100644 index 0000000..1a547cd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.d.mts @@ -0,0 +1,23 @@ +import { IArray, IConst, IContext, IIdent, INumber, IOptional, IRef, IString, ITuple, IUnion } from './types.mjs'; +/** Returns true if the value is a Array Parser */ +export declare function IsArray(value: unknown): value is IArray; +/** Returns true if the value is a Const Parser */ +export declare function IsConst(value: unknown): value is IConst; +/** Returns true if the value is a Context Parser */ +export declare function IsContext(value: unknown): value is IContext; +/** Returns true if the value is a Ident Parser */ +export declare function IsIdent(value: unknown): value is IIdent; +/** Returns true if the value is a Number Parser */ +export declare function IsNumber(value: unknown): value is INumber; +/** Returns true if the value is a Optional Parser */ +export declare function IsOptional(value: unknown): value is IOptional; +/** Returns true if the value is a Ref Parser */ +export declare function IsRef(value: unknown): value is IRef; +/** Returns true if the value is a String Parser */ +export declare function IsString(value: unknown): value is IString; +/** Returns true if the value is a Tuple Parser */ +export declare function IsTuple(value: unknown): value is ITuple; +/** Returns true if the value is a Union Parser */ +export declare function IsUnion(value: unknown): value is IUnion; +/** Returns true if the value is a Parser */ +export declare function IsParser(value: unknown): value is IContext | IUnion | IArray | IConst | IIdent | INumber | IOptional | IRef | IString | ITuple; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.mjs new file mode 100644 index 0000000..73446cc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/guard.mjs @@ -0,0 +1,72 @@ +// ------------------------------------------------------------------ +// Value Guard +// ------------------------------------------------------------------ +// prettier-ignore +function HasPropertyKey(value, key) { + return key in value; +} +// prettier-ignore +function IsObjectValue(value) { + return typeof value === 'object' && value !== null; +} +// prettier-ignore +function IsArrayValue(value) { + return globalThis.Array.isArray(value); +} +// ------------------------------------------------------------------ +// Parser Guard +// ------------------------------------------------------------------ +/** Returns true if the value is a Array Parser */ +export function IsArray(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Array' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser); +} +/** Returns true if the value is a Const Parser */ +export function IsConst(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Const' && HasPropertyKey(value, 'value') && typeof value.value === 'string'; +} +/** Returns true if the value is a Context Parser */ +export function IsContext(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Context' && HasPropertyKey(value, 'left') && IsParser(value.left) && HasPropertyKey(value, 'right') && IsParser(value.right); +} +/** Returns true if the value is a Ident Parser */ +export function IsIdent(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ident'; +} +/** Returns true if the value is a Number Parser */ +export function IsNumber(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Number'; +} +/** Returns true if the value is a Optional Parser */ +export function IsOptional(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Optional' && HasPropertyKey(value, 'parser') && IsObjectValue(value.parser); +} +/** Returns true if the value is a Ref Parser */ +export function IsRef(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Ref' && HasPropertyKey(value, 'ref') && typeof value.ref === 'string'; +} +/** Returns true if the value is a String Parser */ +export function IsString(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'String' && HasPropertyKey(value, 'options') && IsArrayValue(value.options); +} +/** Returns true if the value is a Tuple Parser */ +export function IsTuple(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Tuple' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers); +} +/** Returns true if the value is a Union Parser */ +export function IsUnion(value) { + return IsObjectValue(value) && HasPropertyKey(value, 'type') && value.type === 'Union' && HasPropertyKey(value, 'parsers') && IsArrayValue(value.parsers); +} +/** Returns true if the value is a Parser */ +export function IsParser(value) { + // prettier-ignore + return (IsArray(value) || + IsConst(value) || + IsContext(value) || + IsIdent(value) || + IsNumber(value) || + IsOptional(value) || + IsRef(value) || + IsString(value) || + IsTuple(value) || + IsUnion(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.d.mts new file mode 100644 index 0000000..67ae62f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.d.mts @@ -0,0 +1,5 @@ +export * as Guard from './guard.mjs'; +export * as Token from './token.mjs'; +export * from './types.mjs'; +export * from './module.mjs'; +export * from './parse.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.mjs new file mode 100644 index 0000000..67ae62f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/index.mjs @@ -0,0 +1,5 @@ +export * as Guard from './guard.mjs'; +export * as Token from './token.mjs'; +export * from './types.mjs'; +export * from './module.mjs'; +export * from './parse.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.d.mts new file mode 100644 index 0000000..fb538f6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.d.mts @@ -0,0 +1,9 @@ +import * as Types from './types.mjs'; +export declare class Module { + private readonly properties; + constructor(properties: Properties); + /** Parses using one of the parsers defined on this instance */ + Parse(key: Key, content: string, context: unknown): [] | [Types.StaticParser, string]; + /** Parses using one of the parsers defined on this instance */ + Parse(key: Key, content: string): [] | [Types.StaticParser, string]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.mjs new file mode 100644 index 0000000..7f9d017 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/module.mjs @@ -0,0 +1,17 @@ +import { Parse } from './parse.mjs'; +// ------------------------------------------------------------------ +// Module +// ------------------------------------------------------------------ +export class Module { + constructor(properties) { + this.properties = properties; + } + /** Parses using one of the parsers defined on this instance */ + Parse(...args) { + // prettier-ignore + const [key, content, context] = (args.length === 3 ? [args[0], args[1], args[2]] : + args.length === 2 ? [args[0], args[1], undefined] : + (() => { throw Error('Invalid parse arguments'); })()); + return Parse(this.properties, this.properties[key], content, context); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.d.mts new file mode 100644 index 0000000..054efa3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.d.mts @@ -0,0 +1,9 @@ +import * as Types from './types.mjs'; +/** Parses content using the given Parser */ +export declare function Parse(moduleProperties: Types.IModuleProperties, parser: Parser, code: string, context: unknown): [] | [Types.StaticParser, string]; +/** Parses content using the given Parser */ +export declare function Parse(moduleProperties: Types.IModuleProperties, parser: Parser, code: string): [] | [Types.StaticParser, string]; +/** Parses content using the given Parser */ +export declare function Parse(parser: Parser, content: string, context: unknown): [] | [Types.StaticParser, string]; +/** Parses content using the given Parser */ +export declare function Parse(parser: Parser, content: string): [] | [Types.StaticParser, string]; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.mjs new file mode 100644 index 0000000..62a8a62 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/parse.mjs @@ -0,0 +1,123 @@ +import * as Guard from './guard.mjs'; +import * as Token from './token.mjs'; +// ------------------------------------------------------------------ +// Context +// ------------------------------------------------------------------ +function ParseContext(moduleProperties, left, right, code, context) { + const result = ParseParser(moduleProperties, left, code, context); + return result.length === 2 ? ParseParser(moduleProperties, right, result[1], result[0]) : []; +} +// ------------------------------------------------------------------ +// Array +// ------------------------------------------------------------------ +function ParseArray(moduleProperties, parser, code, context) { + const buffer = []; + let rest = code; + while (rest.length > 0) { + const result = ParseParser(moduleProperties, parser, rest, context); + if (result.length === 0) + return [buffer, rest]; + buffer.push(result[0]); + rest = result[1]; + } + return [buffer, rest]; +} +// ------------------------------------------------------------------ +// Const +// ------------------------------------------------------------------ +function ParseConst(value, code, context) { + return Token.Const(value, code); +} +// ------------------------------------------------------------------ +// Ident +// ------------------------------------------------------------------ +function ParseIdent(code, _context) { + return Token.Ident(code); +} +// ------------------------------------------------------------------ +// Number +// ------------------------------------------------------------------ +// prettier-ignore +function ParseNumber(code, _context) { + return Token.Number(code); +} +// ------------------------------------------------------------------ +// Optional +// ------------------------------------------------------------------ +function ParseOptional(moduleProperties, parser, code, context) { + const result = ParseParser(moduleProperties, parser, code, context); + return (result.length === 2 ? [[result[0]], result[1]] : [[], code]); +} +// ------------------------------------------------------------------ +// Ref +// ------------------------------------------------------------------ +function ParseRef(moduleProperties, ref, code, context) { + const parser = moduleProperties[ref]; + if (!Guard.IsParser(parser)) + throw Error(`Cannot dereference Parser '${ref}'`); + return ParseParser(moduleProperties, parser, code, context); +} +// ------------------------------------------------------------------ +// String +// ------------------------------------------------------------------ +// prettier-ignore +function ParseString(options, code, _context) { + return Token.String(options, code); +} +// ------------------------------------------------------------------ +// Tuple +// ------------------------------------------------------------------ +function ParseTuple(moduleProperties, parsers, code, context) { + const buffer = []; + let rest = code; + for (const parser of parsers) { + const result = ParseParser(moduleProperties, parser, rest, context); + if (result.length === 0) + return []; + buffer.push(result[0]); + rest = result[1]; + } + return [buffer, rest]; +} +// ------------------------------------------------------------------ +// Union +// ------------------------------------------------------------------ +// prettier-ignore +function ParseUnion(moduleProperties, parsers, code, context) { + for (const parser of parsers) { + const result = ParseParser(moduleProperties, parser, code, context); + if (result.length === 0) + continue; + return result; + } + return []; +} +// ------------------------------------------------------------------ +// Parser +// ------------------------------------------------------------------ +// prettier-ignore +function ParseParser(moduleProperties, parser, code, context) { + const result = (Guard.IsContext(parser) ? ParseContext(moduleProperties, parser.left, parser.right, code, context) : + Guard.IsArray(parser) ? ParseArray(moduleProperties, parser.parser, code, context) : + Guard.IsConst(parser) ? ParseConst(parser.value, code, context) : + Guard.IsIdent(parser) ? ParseIdent(code, context) : + Guard.IsNumber(parser) ? ParseNumber(code, context) : + Guard.IsOptional(parser) ? ParseOptional(moduleProperties, parser.parser, code, context) : + Guard.IsRef(parser) ? ParseRef(moduleProperties, parser.ref, code, context) : + Guard.IsString(parser) ? ParseString(parser.options, code, context) : + Guard.IsTuple(parser) ? ParseTuple(moduleProperties, parser.parsers, code, context) : + Guard.IsUnion(parser) ? ParseUnion(moduleProperties, parser.parsers, code, context) : + []); + return (result.length === 2 + ? [parser.mapping(result[0], context), result[1]] + : result); +} +/** Parses content using the given parser */ +// prettier-ignore +export function Parse(...args) { + const withModuleProperties = typeof args[1] === 'string' ? false : true; + const [moduleProperties, parser, content, context] = withModuleProperties + ? [args[0], args[1], args[2], args[3]] + : [{}, args[0], args[1], args[2]]; + return ParseParser(moduleProperties, parser, content, context); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.d.mts new file mode 100644 index 0000000..47a2d4c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.d.mts @@ -0,0 +1,8 @@ +/** Takes the next constant string value skipping any whitespace */ +export declare function Const(value: string, code: string): [] | [string, string]; +/** Scans for the next Ident token */ +export declare function Ident(code: string): [] | [string, string]; +/** Scans for the next number token */ +export declare function Number(code: string): [string, string] | []; +/** Scans the next Literal String value */ +export declare function String(options: string[], code: string): [string, string] | []; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.mjs new file mode 100644 index 0000000..88460cb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/token.mjs @@ -0,0 +1,223 @@ +// ------------------------------------------------------------------ +// Chars +// ------------------------------------------------------------------ +// prettier-ignore +var Chars; +(function (Chars) { + /** Returns true if the char code is a whitespace */ + function IsWhitespace(value) { + return value === 32; + } + Chars.IsWhitespace = IsWhitespace; + /** Returns true if the char code is a newline */ + function IsNewline(value) { + return value === 10; + } + Chars.IsNewline = IsNewline; + /** Returns true if the char code is a alpha */ + function IsAlpha(value) { + return ((value >= 65 && value <= 90) || // A-Z + (value >= 97 && value <= 122) // a-z + ); + } + Chars.IsAlpha = IsAlpha; + /** Returns true if the char code is zero */ + function IsZero(value) { + return value === 48; + } + Chars.IsZero = IsZero; + /** Returns true if the char code is non-zero */ + function IsNonZero(value) { + return value >= 49 && value <= 57; + } + Chars.IsNonZero = IsNonZero; + /** Returns true if the char code is a digit */ + function IsDigit(value) { + return (IsNonZero(value) || + IsZero(value)); + } + Chars.IsDigit = IsDigit; + /** Returns true if the char code is a dot */ + function IsDot(value) { + return value === 46; + } + Chars.IsDot = IsDot; + /** Returns true if this char code is a underscore */ + function IsUnderscore(value) { + return value === 95; + } + Chars.IsUnderscore = IsUnderscore; + /** Returns true if this char code is a dollar sign */ + function IsDollarSign(value) { + return value === 36; + } + Chars.IsDollarSign = IsDollarSign; +})(Chars || (Chars = {})); +// ------------------------------------------------------------------ +// Trim +// ------------------------------------------------------------------ +// prettier-ignore +var Trim; +(function (Trim) { + /** Trims Whitespace and retains Newline, Tabspaces, etc. */ + function TrimWhitespaceOnly(code) { + for (let i = 0; i < code.length; i++) { + if (Chars.IsWhitespace(code.charCodeAt(i))) + continue; + return code.slice(i); + } + return code; + } + Trim.TrimWhitespaceOnly = TrimWhitespaceOnly; + /** Trims Whitespace including Newline, Tabspaces, etc. */ + function TrimAll(code) { + return code.trimStart(); + } + Trim.TrimAll = TrimAll; +})(Trim || (Trim = {})); +// ------------------------------------------------------------------ +// Const +// ------------------------------------------------------------------ +/** Checks the value matches the next string */ +// prettier-ignore +function NextTokenCheck(value, code) { + if (value.length > code.length) + return false; + for (let i = 0; i < value.length; i++) { + if (value.charCodeAt(i) !== code.charCodeAt(i)) + return false; + } + return true; +} +/** Gets the next constant string value or empty if no match */ +// prettier-ignore +function NextConst(value, code) { + return NextTokenCheck(value, code) + ? [code.slice(0, value.length), code.slice(value.length)] + : []; +} +/** Takes the next constant string value skipping any whitespace */ +// prettier-ignore +export function Const(value, code) { + if (value.length === 0) + return ['', code]; + const char_0 = value.charCodeAt(0); + return (Chars.IsNewline(char_0) ? NextConst(value, Trim.TrimWhitespaceOnly(code)) : + Chars.IsWhitespace(char_0) ? NextConst(value, code) : + NextConst(value, Trim.TrimAll(code))); +} +// ------------------------------------------------------------------ +// Ident +// ------------------------------------------------------------------ +// prettier-ignore +function IdentIsFirst(char) { + return (Chars.IsAlpha(char) || + Chars.IsDollarSign(char) || + Chars.IsUnderscore(char)); +} +// prettier-ignore +function IdentIsRest(char) { + return (Chars.IsAlpha(char) || + Chars.IsDigit(char) || + Chars.IsDollarSign(char) || + Chars.IsUnderscore(char)); +} +// prettier-ignore +function NextIdent(code) { + if (!IdentIsFirst(code.charCodeAt(0))) + return []; + for (let i = 1; i < code.length; i++) { + const char = code.charCodeAt(i); + if (IdentIsRest(char)) + continue; + const slice = code.slice(0, i); + const rest = code.slice(i); + return [slice, rest]; + } + return [code, '']; +} +/** Scans for the next Ident token */ +// prettier-ignore +export function Ident(code) { + return NextIdent(Trim.TrimAll(code)); +} +// ------------------------------------------------------------------ +// Number +// ------------------------------------------------------------------ +/** Checks that the next number is not a leading zero */ +// prettier-ignore +function NumberLeadingZeroCheck(code, index) { + const char_0 = code.charCodeAt(index + 0); + const char_1 = code.charCodeAt(index + 1); + return (( + // 1-9 + Chars.IsNonZero(char_0)) || ( + // 0 + Chars.IsZero(char_0) && + !Chars.IsDigit(char_1)) || ( + // 0. + Chars.IsZero(char_0) && + Chars.IsDot(char_1)) || ( + // .0 + Chars.IsDot(char_0) && + Chars.IsDigit(char_1))); +} +/** Gets the next number token */ +// prettier-ignore +function NextNumber(code) { + const negated = code.charAt(0) === '-'; + const index = negated ? 1 : 0; + if (!NumberLeadingZeroCheck(code, index)) { + return []; + } + const dash = negated ? '-' : ''; + let hasDot = false; + for (let i = index; i < code.length; i++) { + const char_i = code.charCodeAt(i); + if (Chars.IsDigit(char_i)) { + continue; + } + if (Chars.IsDot(char_i)) { + if (hasDot) { + const slice = code.slice(index, i); + const rest = code.slice(i); + return [`${dash}${slice}`, rest]; + } + hasDot = true; + continue; + } + const slice = code.slice(index, i); + const rest = code.slice(i); + return [`${dash}${slice}`, rest]; + } + return [code, '']; +} +/** Scans for the next number token */ +// prettier-ignore +export function Number(code) { + return NextNumber(Trim.TrimAll(code)); +} +// ------------------------------------------------------------------ +// String +// ------------------------------------------------------------------ +// prettier-ignore +function NextString(options, code) { + const first = code.charAt(0); + if (!options.includes(first)) + return []; + const quote = first; + for (let i = 1; i < code.length; i++) { + const char = code.charAt(i); + if (char === quote) { + const slice = code.slice(1, i); + const rest = code.slice(i + 1); + return [slice, rest]; + } + } + return []; +} +/** Scans the next Literal String value */ +// prettier-ignore +export function String(options, code) { + return NextString(options, Trim.TrimAll(code)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.d.mts new file mode 100644 index 0000000..4200962 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.d.mts @@ -0,0 +1,98 @@ +export type IModuleProperties = Record; +/** Force output static type evaluation for Arrays */ +export type StaticEnsure = T extends infer R ? R : never; +/** Infers the Output Parameter for a Parser */ +export type StaticParser = Parser extends IParser ? Output : unknown; +export type IMapping = (input: Input, context: any) => Output; +/** Maps input to output. This is the default Mapping */ +export declare const Identity: (value: unknown) => unknown; +/** Maps the output as the given parameter T */ +export declare const As: (mapping: T) => ((value: unknown) => T); +export interface IParser { + type: string; + mapping: IMapping; +} +export type ContextParameter<_Left extends IParser, Right extends IParser> = (StaticParser); +export interface IContext extends IParser { + type: 'Context'; + left: IParser; + right: IParser; +} +/** `[Context]` Creates a Context Parser */ +export declare function Context>>(left: Left, right: Right, mapping: Mapping): IContext>; +/** `[Context]` Creates a Context Parser */ +export declare function Context(left: Left, right: Right): IContext>; +export type ArrayParameter = StaticEnsure[]>; +export interface IArray extends IParser { + type: 'Array'; + parser: IParser; +} +/** `[EBNF]` Creates an Array Parser */ +export declare function Array>>(parser: Parser, mapping: Mapping): IArray>; +/** `[EBNF]` Creates an Array Parser */ +export declare function Array(parser: Parser): IArray>; +export interface IConst extends IParser { + type: 'Const'; + value: string; +} +/** `[TERM]` Creates a Const Parser */ +export declare function Const>(value: Value, mapping: Mapping): IConst>; +/** `[TERM]` Creates a Const Parser */ +export declare function Const(value: Value): IConst; +export interface IRef extends IParser { + type: 'Ref'; + ref: string; +} +/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */ +export declare function Ref>(ref: string, mapping: Mapping): IRef>; +/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */ +export declare function Ref(ref: string): IRef; +export interface IString extends IParser { + type: 'String'; + options: string[]; +} +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +export declare function String>(options: string[], mapping: Mapping): IString>; +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +export declare function String(options: string[]): IString; +export interface IIdent extends IParser { + type: 'Ident'; +} +/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */ +export declare function Ident>(mapping: Mapping): IIdent>; +/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */ +export declare function Ident(): IIdent; +export interface INumber extends IParser { + type: 'Number'; +} +/** `[TERM]` Creates an Number Parser */ +export declare function Number>(mapping: Mapping): INumber>; +/** `[TERM]` Creates an Number Parser */ +export declare function Number(): INumber; +export type OptionalParameter] | []> = (Result); +export interface IOptional extends IParser { + type: 'Optional'; + parser: IParser; +} +/** `[EBNF]` Creates an Optional Parser */ +export declare function Optional>>(parser: Parser, mapping: Mapping): IOptional>; +/** `[EBNF]` Creates an Optional Parser */ +export declare function Optional(parser: Parser): IOptional>; +export type TupleParameter = StaticEnsure>]> : Result>; +export interface ITuple extends IParser { + type: 'Tuple'; + parsers: IParser[]; +} +/** `[BNF]` Creates a Tuple Parser */ +export declare function Tuple>>(parsers: [...Parsers], mapping: Mapping): ITuple>; +/** `[BNF]` Creates a Tuple Parser */ +export declare function Tuple(parsers: [...Parsers]): ITuple>; +export type UnionParameter = StaticEnsure> : Result>; +export interface IUnion extends IParser { + type: 'Union'; + parsers: IParser[]; +} +/** `[BNF]` Creates a Union parser */ +export declare function Union>>(parsers: [...Parsers], mapping: Mapping): IUnion>; +/** `[BNF]` Creates a Union parser */ +export declare function Union(parsers: [...Parsers]): IUnion>; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.mjs new file mode 100644 index 0000000..c503b0b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/runtime/types.mjs @@ -0,0 +1,55 @@ +/** Maps input to output. This is the default Mapping */ +export const Identity = (value) => value; +/** Maps the output as the given parameter T */ +// prettier-ignore +export const As = (mapping) => (_) => mapping; +/** `[Context]` Creates a Context Parser */ +export function Context(...args) { + const [left, right, mapping] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], args[1], Identity]; + return { type: 'Context', left, right, mapping }; +} +/** `[EBNF]` Creates an Array Parser */ +export function Array(...args) { + const [parser, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], Identity]; + return { type: 'Array', parser, mapping }; +} +/** `[TERM]` Creates a Const Parser */ +export function Const(...args) { + const [value, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], Identity]; + return { type: 'Const', value, mapping }; +} +/** `[BNF]` Creates a Ref Parser. This Parser can only be used in the context of a Module */ +export function Ref(...args) { + const [ref, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], Identity]; + return { type: 'Ref', ref, mapping }; +} +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +export function String(...params) { + const [options, mapping] = params.length === 2 ? [params[0], params[1]] : [params[0], Identity]; + return { type: 'String', options, mapping }; +} +/** `[TERM]` Creates an Ident Parser where Ident matches any valid JavaScript identifier */ +export function Ident(...params) { + const mapping = params.length === 1 ? params[0] : Identity; + return { type: 'Ident', mapping }; +} +/** `[TERM]` Creates an Number Parser */ +export function Number(...params) { + const mapping = params.length === 1 ? params[0] : Identity; + return { type: 'Number', mapping }; +} +/** `[EBNF]` Creates an Optional Parser */ +export function Optional(...args) { + const [parser, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], Identity]; + return { type: 'Optional', parser, mapping }; +} +/** `[BNF]` Creates a Tuple Parser */ +export function Tuple(...args) { + const [parsers, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], Identity]; + return { type: 'Tuple', parsers, mapping }; +} +/** `[BNF]` Creates a Union parser */ +export function Union(...args) { + const [parsers, mapping] = args.length === 2 ? [args[0], args[1]] : [args[0], Identity]; + return { type: 'Union', parsers, mapping }; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.d.mts new file mode 100644 index 0000000..4300144 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.d.mts @@ -0,0 +1,3 @@ +export * as Token from './token.mjs'; +export * from './parse.mjs'; +export * from './types.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.mjs new file mode 100644 index 0000000..4300144 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/index.mjs @@ -0,0 +1,3 @@ +export * as Token from './token.mjs'; +export * from './parse.mjs'; +export * from './types.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.d.mts new file mode 100644 index 0000000..30d30d2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.d.mts @@ -0,0 +1,20 @@ +import * as Tokens from './token.mjs'; +import * as Types from './types.mjs'; +type ContextParser = (Parse extends [infer Context extends unknown, infer Rest extends string] ? Parse : []); +type ArrayParser = (Parse extends [infer Value1 extends unknown, infer Rest extends string] ? ArrayParser : [Result, Code]); +type ConstParser = (Tokens.Const extends [infer Match extends Value, infer Rest extends string] ? [Match, Rest] : []); +type IdentParser = (Tokens.Ident extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []); +type NumberParser = (Tokens.Number extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []); +type OptionalParser = (Parse extends [infer Value extends unknown, infer Rest extends string] ? [[Value], Rest] : [[], Code]); +type StringParser = (Tokens.String extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []); +type TupleParser = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse extends [infer Value extends unknown, infer Rest extends string] ? TupleParser : [] : [Result, Code]); +type UnionParser = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse extends [infer Value extends unknown, infer Rest extends string] ? [Value, Rest] : UnionParser : []); +type ParseCode = (Type extends Types.Context ? ContextParser : Type extends Types.Array ? ArrayParser : Type extends Types.Const ? ConstParser : Type extends Types.Ident ? IdentParser : Type extends Types.Number ? NumberParser : Type extends Types.Optional ? OptionalParser : Type extends Types.String ? StringParser : Type extends Types.Tuple ? TupleParser : Type extends Types.Union ? UnionParser : [ +]); +type ParseMapping = ((Parser['mapping'] & { + input: Result; + context: Context; +})['output']); +/** Parses code with the given parser */ +export type Parse = (ParseCode extends [infer L extends unknown, infer R extends string] ? [ParseMapping, R] : []); +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/parse.mjs @@ -0,0 +1 @@ +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.d.mts new file mode 100644 index 0000000..003f854 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.d.mts @@ -0,0 +1,108 @@ +declare namespace Chars { + type Empty = ''; + type Space = ' '; + type Newline = '\n'; + type Dot = '.'; + type Hyphen = '-'; + type Digit = [ + '0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9' + ]; + type Alpha = [ + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z' + ]; +} +declare namespace Trim { + type W4 = `${W3}${W3}`; + type W3 = `${W2}${W2}`; + type W2 = `${W1}${W1}`; + type W1 = `${W0}${W0}`; + type W0 = ` `; + /** Trims whitespace only */ + export type TrimWhitespace = (Code extends `${W4}${infer Rest extends string}` ? TrimWhitespace : Code extends `${W3}${infer Rest extends string}` ? TrimWhitespace : Code extends `${W1}${infer Rest extends string}` ? TrimWhitespace : Code extends `${W0}${infer Rest extends string}` ? TrimWhitespace : Code); + /** Trims Whitespace and Newline */ + export type TrimAll = (Code extends `${W4}${infer Rest extends string}` ? TrimAll : Code extends `${W3}${infer Rest extends string}` ? TrimAll : Code extends `${W1}${infer Rest extends string}` ? TrimAll : Code extends `${W0}${infer Rest extends string}` ? TrimAll : Code extends `${Chars.Newline}${infer Rest extends string}` ? TrimAll : Code); + export {}; +} +/** Scans for the next match union */ +type NextUnion = (Variants extends [infer Variant extends string, ...infer Rest1 extends string[]] ? NextConst extends [infer Match extends string, infer Rest2 extends string] ? [Match, Rest2] : NextUnion : []); +type NextConst = (Code extends `${Value}${infer Rest extends string}` ? [Value, Rest] : []); +/** Scans for the next constant value */ +export type Const = (Value extends '' ? ['', Code] : Value extends `${infer First extends string}${string}` ? (First extends Chars.Newline ? NextConst> : First extends Chars.Space ? NextConst : NextConst>) : never); +type NextNumberNegate = (Code extends `${Chars.Hyphen}${infer Rest extends string}` ? [Chars.Hyphen, Rest] : [Chars.Empty, Code]); +type NextNumberZeroCheck = (Code extends `0${infer Rest}` ? NextUnion extends [string, string] ? false : true : true); +type NextNumberScan = (NextUnion<[...Chars.Digit, Chars.Dot], Code> extends [infer Char extends string, infer Rest extends string] ? Char extends Chars.Dot ? HasDecimal extends false ? NextNumberScan : [Result, `.${Rest}`] : NextNumberScan : [Result, Code]); +export type NextNumber = (NextNumberNegate extends [infer Negate extends string, infer Rest extends string] ? NextNumberZeroCheck extends true ? NextNumberScan extends [infer Number extends string, infer Rest2 extends string] ? Number extends Chars.Empty ? [] : [`${Negate}${Number}`, Rest2] : [] : [] : []); +/** Scans for the next literal number */ +export type Number = NextNumber>; +type NextStringQuote = NextUnion; +type NextStringBody = (Code extends `${infer Char extends string}${infer Rest extends string}` ? Char extends Quote ? [Result, Rest] : NextStringBody : []); +type NextString = (NextStringQuote extends [infer Quote extends string, infer Rest extends string] ? NextStringBody extends [infer String extends string, infer Rest extends string] ? [String, Rest] : [] : []); +/** Scans for the next literal string */ +export type String = NextString>; +type IdentLeft = [...Chars.Alpha, '_', '$']; +type IdentRight = [...Chars.Digit, ...IdentLeft]; +type NextIdentScan = (NextUnion extends [infer Char extends string, infer Rest extends string] ? NextIdentScan : [Result, Code]); +type NextIdent = (NextUnion extends [infer Left extends string, infer Rest1 extends string] ? NextIdentScan extends [infer Right extends string, infer Rest2 extends string] ? [`${Left}${Right}`, Rest2] : [] : []); +/** Scans for the next Ident */ +export type Ident = NextIdent>; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/token.mjs @@ -0,0 +1 @@ +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.d.mts new file mode 100644 index 0000000..ec60c9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.d.mts @@ -0,0 +1,69 @@ +/** + * `[ACTION]` Inference mapping base type. Used to specify semantic actions for + * Parser productions. This type is implemented as a higher-kinded type where + * productions are received on the `input` property with mapping assigned + * the `output` property. The parsing context is available on the `context` + * property. + */ +export interface IMapping { + context: unknown; + input: unknown; + output: unknown; +} +/** `[ACTION]` Default inference mapping. */ +export interface Identity extends IMapping { + output: this['input']; +} +/** `[ACTION]` Maps the given argument `T` as the mapping output */ +export interface As extends IMapping { + output: T; +} +/** Base type Parser implemented by all other parsers */ +export interface IParser { + type: string; + mapping: Mapping; +} +/** `[Context]` Creates a Context Parser */ +export interface Context extends IParser { + type: 'Context'; + left: Left; + right: Right; +} +/** `[EBNF]` Creates an Array Parser */ +export interface Array extends IParser { + type: 'Array'; + parser: Parser; +} +/** `[TERM]` Creates a Const Parser */ +export interface Const extends IParser { + type: 'Const'; + value: Value; +} +/** `[TERM]` Creates an Ident Parser. */ +export interface Ident extends IParser { + type: 'Ident'; +} +/** `[TERM]` Creates a Number Parser. */ +export interface Number extends IParser { + type: 'Number'; +} +/** `[EBNF]` Creates a Optional Parser */ +export interface Optional extends IParser { + type: 'Optional'; + parser: Parser; +} +/** `[TERM]` Creates a String Parser. Options are an array of permissable quote characters */ +export interface String extends IParser { + type: 'String'; + quote: Options; +} +/** `[BNF]` Creates a Tuple Parser */ +export interface Tuple extends IParser { + type: 'Tuple'; + parsers: [...Parsers]; +} +/** `[BNF]` Creates a Union Parser */ +export interface Union extends IParser { + type: 'Union'; + parsers: [...Parsers]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.mjs b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/parser/static/types.mjs @@ -0,0 +1 @@ +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/syntax/index.d.mts new file mode 100644 index 0000000..bd50b1a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/index.d.mts @@ -0,0 +1 @@ +export * from './syntax.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/syntax/index.mjs new file mode 100644 index 0000000..bd50b1a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/index.mjs @@ -0,0 +1 @@ +export * from './syntax.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.d.mts new file mode 100644 index 0000000..8e04ecb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.d.mts @@ -0,0 +1,167 @@ +import * as T from '../type/index.mjs'; +type TDereference = (Key extends keyof Context ? Context[Key] : T.TRef); +type TDelimitedDecode = (Input extends [infer Left, ...infer Right] ? Left extends [infer Item, infer _] ? TDelimitedDecode : TDelimitedDecode : Result); +type TDelimited = Input extends [infer Left extends unknown[], infer Right extends unknown[]] ? TDelimitedDecode<[...Left, ...Right]> : []; +export type TGenericReferenceParameterListMapping = TDelimited; +export declare function GenericReferenceParameterListMapping(input: [unknown, unknown], context: unknown): unknown[]; +export type TGenericReferenceMapping'] ? T.TInstantiate, Args> : never : never> = Result; +export declare function GenericReferenceMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TGenericArgumentsListMapping = TDelimited; +export declare function GenericArgumentsListMapping(input: [unknown, unknown], context: unknown): unknown[]; +type GenericArgumentsContext = (Arguments extends [...infer Left extends string[], infer Right extends string] ? GenericArgumentsContext; +}> : T.Evaluate); +export type TGenericArgumentsMapping = Input extends ['<', infer Arguments extends string[], '>'] ? Context extends infer Context extends T.TProperties ? GenericArgumentsContext : never : never; +declare const GenericArgumentsContext: (_arguments: string[], context: T.TProperties) => T.TProperties; +export declare function GenericArgumentsMapping(input: [unknown, unknown, unknown], context: unknown): T.TProperties; +export type TKeywordStringMapping = T.TString; +export declare function KeywordStringMapping(input: 'string', context: unknown): T.TString; +export type TKeywordNumberMapping = T.TNumber; +export declare function KeywordNumberMapping(input: 'number', context: unknown): T.TNumber; +export type TKeywordBooleanMapping = T.TBoolean; +export declare function KeywordBooleanMapping(input: 'boolean', context: unknown): T.TBoolean; +export type TKeywordUndefinedMapping = T.TUndefined; +export declare function KeywordUndefinedMapping(input: 'undefined', context: unknown): T.TUndefined; +export type TKeywordNullMapping = T.TNull; +export declare function KeywordNullMapping(input: 'null', context: unknown): T.TNull; +export type TKeywordIntegerMapping = T.TInteger; +export declare function KeywordIntegerMapping(input: 'integer', context: unknown): T.TInteger; +export type TKeywordBigIntMapping = T.TBigInt; +export declare function KeywordBigIntMapping(input: 'bigint', context: unknown): T.TBigInt; +export type TKeywordUnknownMapping = T.TUnknown; +export declare function KeywordUnknownMapping(input: 'unknown', context: unknown): T.TUnknown; +export type TKeywordAnyMapping = T.TAny; +export declare function KeywordAnyMapping(input: 'any', context: unknown): T.TAny; +export type TKeywordNeverMapping = T.TNever; +export declare function KeywordNeverMapping(input: 'never', context: unknown): T.TNever; +export type TKeywordSymbolMapping = T.TSymbol; +export declare function KeywordSymbolMapping(input: 'symbol', context: unknown): T.TSymbol; +export type TKeywordVoidMapping = T.TVoid; +export declare function KeywordVoidMapping(input: 'void', context: unknown): T.TVoid; +export type TKeywordMapping = Input; +export declare function KeywordMapping(input: unknown, context: unknown): unknown; +export type TLiteralStringMapping = Input extends T.TLiteralValue ? T.TLiteral : never; +export declare function LiteralStringMapping(input: string, context: unknown): T.TLiteral; +export type TLiteralNumberMapping = Input extends `${infer Value extends number}` ? T.TLiteral : never; +export declare function LiteralNumberMapping(input: string, context: unknown): T.TLiteral; +export type TLiteralBooleanMapping = Input extends 'true' ? T.TLiteral : T.TLiteral; +export declare function LiteralBooleanMapping(input: 'true' | 'false', context: unknown): T.TLiteral; +export type TLiteralMapping = Input; +export declare function LiteralMapping(input: unknown, context: unknown): unknown; +export type TKeyOfMapping = Input extends [unknown] ? true : false; +export declare function KeyOfMapping(input: [unknown] | [], context: unknown): boolean; +type TIndexArrayMappingReduce = (Input extends [infer Left extends unknown, ...infer Right extends unknown[]] ? Left extends ['[', infer Type extends T.TSchema, ']'] ? TIndexArrayMappingReduce : TIndexArrayMappingReduce : Result); +export type TIndexArrayMapping = Input extends unknown[] ? TIndexArrayMappingReduce : []; +export declare function IndexArrayMapping(input: ([unknown, unknown, unknown] | [unknown, unknown])[], context: unknown): unknown[]; +export type TExtendsMapping = Input extends ['extends', infer Type extends T.TSchema, '?', infer True extends T.TSchema, ':', infer False extends T.TSchema] ? [Type, True, False] : []; +export declare function ExtendsMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown] | [], context: unknown): unknown[]; +export type TBaseMapping = (Input extends ['(', infer Type extends T.TSchema, ')'] ? Type : Input extends infer Type extends T.TSchema ? Type : never); +export declare function BaseMapping(input: [unknown, unknown, unknown] | unknown, context: unknown): unknown; +type TFactorIndexArray = (IndexArray extends [...infer Left extends unknown[], infer Right extends T.TSchema[]] ? (Right extends [infer Indexer extends T.TSchema] ? T.TIndex, T.TIndexPropertyKeys> : Right extends [] ? T.TArray> : T.TNever) : Type); +type TFactorExtends = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? T.TExtends : Type); +export type TFactorMapping = Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extends extends unknown[]] ? KeyOf extends true ? TFactorExtends>, Extends> : TFactorExtends, Extends> : never; +export declare function FactorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +type TExprBinaryMapping = (Rest extends [infer Operator extends unknown, infer Right extends T.TSchema, infer Next extends unknown[]] ? (TExprBinaryMapping extends infer Schema extends T.TSchema ? (Operator extends '&' ? (Schema extends T.TIntersect ? T.TIntersect<[Left, ...Types]> : T.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends T.TUnion ? T.TUnion<[Left, ...Types]> : T.TUnion<[Left, Schema]>) : never) : never) : Left); +export type TExprTermTailMapping = Input; +export declare function ExprTermTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown]; +export type TExprTermMapping = (Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping : []); +export declare function ExprTermMapping(input: [unknown, unknown], context: unknown): T.TSchema; +export type TExprTailMapping = Input; +export declare function ExprTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown]; +export type TExprMapping = Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping : []; +export declare function ExprMapping(input: [unknown, unknown], context: unknown): T.TSchema; +export type TTypeMapping = Input; +export declare function TypeMapping(input: unknown, context: unknown): unknown; +export type TPropertyKeyMapping = Input; +export declare function PropertyKeyMapping(input: string, context: unknown): string; +export type TReadonlyMapping = Input extends [unknown] ? true : false; +export declare function ReadonlyMapping(input: [unknown] | [], context: unknown): boolean; +export type TOptionalMapping = Input extends [unknown] ? true : false; +export declare function OptionalMapping(input: [unknown] | [], context: unknown): boolean; +export type TPropertyMapping = Input extends [infer IsReadonly extends boolean, infer Key extends string, infer IsOptional extends boolean, string, infer Type extends T.TSchema] ? { + [_ in Key]: ([ + IsReadonly, + IsOptional + ] extends [true, true] ? T.TReadonlyOptional : [ + IsReadonly, + IsOptional + ] extends [true, false] ? T.TReadonly : [ + IsReadonly, + IsOptional + ] extends [false, true] ? T.TOptional : Type); +} : never; +export declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): { + [x: string]: T.TSchema; +}; +export type TPropertyDelimiterMapping = Input; +export declare function PropertyDelimiterMapping(input: [unknown, unknown] | [unknown], context: unknown): [unknown] | [unknown, unknown]; +export type TPropertyListMapping = TDelimited; +export declare function PropertyListMapping(input: [unknown, unknown], context: unknown): unknown[]; +type TObjectMappingReduce = (PropertiesList extends [infer Left extends T.TProperties, ...infer Right extends T.TProperties[]] ? TObjectMappingReduce : { + [Key in keyof Result]: Result[Key]; +}); +export type TObjectMapping = Input extends ['{', infer PropertyList extends T.TProperties[], '}'] ? T.TObject> : never; +export declare function ObjectMapping(input: [unknown, unknown, unknown], context: unknown): T.TObject; +export type TElementListMapping = TDelimited; +export declare function ElementListMapping(input: [unknown, unknown], context: unknown): unknown[]; +export type TTupleMapping = Input extends ['[', infer Types extends T.TSchema[], ']'] ? T.TTuple : never; +export declare function TupleMapping(input: [unknown, unknown, unknown], context: unknown): T.TTuple; +export type TParameterMapping = Input extends [string, ':', infer Type extends T.TSchema] ? Type : never; +export declare function ParameterMapping(input: [unknown, unknown, unknown], context: unknown): T.TSchema; +export type TParameterListMapping = TDelimited; +export declare function ParameterListMapping(input: [unknown, unknown], context: unknown): unknown[]; +export type TFunctionMapping = Input extends ['(', infer ParameterList extends T.TSchema[], ')', '=>', infer ReturnType extends T.TSchema] ? T.TFunction : never; +export declare function FunctionMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): T.TFunction; +export type TConstructorMapping = Input extends ['new', '(', infer ParameterList extends T.TSchema[], ')', '=>', infer InstanceType extends T.TSchema] ? T.TConstructor : never; +export declare function ConstructorMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TConstructor; +export type TMappedMapping = Input extends ['{', '[', infer _Key extends string, 'in', infer _Right extends T.TSchema, ']', ':', infer _Type extends T.TSchema, '}'] ? T.TLiteral<'Mapped types not supported'> : never; +export declare function MappedMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TLiteral<"Mapped types not supported">; +export type TAsyncIteratorMapping = Input extends ['AsyncIterator', '<', infer Type extends T.TSchema, '>'] ? T.TAsyncIterator : never; +export declare function AsyncIteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TAsyncIterator; +export type TIteratorMapping = Input extends ['Iterator', '<', infer Type extends T.TSchema, '>'] ? T.TIterator : never; +export declare function IteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TIterator; +export type TArgumentMapping = Input extends ['Argument', '<', infer Type extends T.TSchema, '>'] ? Type extends T.TLiteral ? T.TArgument : T.TNever : never; +export declare function ArgumentMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever | T.TArgument; +export type TAwaitedMapping = Input extends ['Awaited', '<', infer Type extends T.TSchema, '>'] ? T.TAwaited : never; +export declare function AwaitedMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TArrayMapping = Input extends ['Array', '<', infer Type extends T.TSchema, '>'] ? T.TArray : never; +export declare function ArrayMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TArray; +export type TRecordMapping = Input extends ['Record', '<', infer Key extends T.TSchema, ',', infer Type extends T.TSchema, '>'] ? T.TRecordOrObject : never; +export declare function RecordMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TPromiseMapping = Input extends ['Promise', '<', infer Type extends T.TSchema, '>'] ? T.TPromise : never; +export declare function PromiseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TPromise; +export type TConstructorParametersMapping = Input extends ['ConstructorParameters', '<', infer Type extends T.TSchema, '>'] ? T.TConstructorParameters : never; +export declare function ConstructorParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TFunctionParametersMapping = Input extends ['Parameters', '<', infer Type extends T.TSchema, '>'] ? T.TParameters : never; +export declare function FunctionParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TInstanceTypeMapping = Input extends ['InstanceType', '<', infer Type extends T.TSchema, '>'] ? T.TInstanceType : never; +export declare function InstanceTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TReturnTypeMapping = Input extends ['ReturnType', '<', infer Type extends T.TSchema, '>'] ? T.TReturnType : never; +export declare function ReturnTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TPartialMapping = Input extends ['Partial', '<', infer Type extends T.TSchema, '>'] ? T.TPartial : never; +export declare function PartialMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TRequiredMapping = Input extends ['Required', '<', infer Type extends T.TSchema, '>'] ? T.TRequired : never; +export declare function RequiredMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TPickMapping = Input extends ['Pick', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TPick : never; +export declare function PickMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TOmitMapping = Input extends ['Omit', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TOmit : never; +export declare function OmitMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>; +export type TExcludeMapping = Input extends ['Exclude', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExclude : never; +export declare function ExcludeMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever; +export type TExtractMapping = Input extends ['Extract', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExtract : never; +export declare function ExtractMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TUppercaseMapping = Input extends ['Uppercase', '<', infer Type extends T.TSchema, '>'] ? T.TUppercase : never; +export declare function UppercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TLowercaseMapping = Input extends ['Lowercase', '<', infer Type extends T.TSchema, '>'] ? T.TLowercase : never; +export declare function LowercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TCapitalizeMapping = Input extends ['Capitalize', '<', infer Type extends T.TSchema, '>'] ? T.TCapitalize : never; +export declare function CapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TUncapitalizeMapping = Input extends ['Uncapitalize', '<', infer Type extends T.TSchema, '>'] ? T.TUncapitalize : never; +export declare function UncapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema; +export type TDateMapping = T.TDate; +export declare function DateMapping(input: 'Date', context: unknown): T.TDate; +export type TUint8ArrayMapping = T.TUint8Array; +export declare function Uint8ArrayMapping(input: 'Uint8Array', context: unknown): T.TUint8Array; +export type TReferenceMapping = Context extends T.TProperties ? Input extends string ? TDereference : never : never; +export declare function ReferenceMapping(input: string, context: unknown): T.TSchema; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.mjs b/ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.mjs new file mode 100644 index 0000000..7b95fda --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/mapping.mjs @@ -0,0 +1,386 @@ +import * as T from '../type/index.mjs'; +// prettier-ignore +const Dereference = (context, key) => { + return key in context ? context[key] : T.Ref(key); +}; +// prettier-ignore +const DelimitedDecode = (input, result = []) => { + return input.reduce((result, left) => { + return T.ValueGuard.IsArray(left) && left.length === 2 + ? [...result, left[0]] + : [...result, left]; + }, []); +}; +// prettier-ignore +const Delimited = (input) => { + const [left, right] = input; + return DelimitedDecode([...left, ...right]); +}; +// prettier-ignore +export function GenericReferenceParameterListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +export function GenericReferenceMapping(input, context) { + const type = Dereference(context, input[0]); + const args = input[2]; + return T.Instantiate(type, args); +} +// prettier-ignore +export function GenericArgumentsListMapping(input, context) { + return Delimited(input); +} +// ... +// prettier-ignore +const GenericArgumentsContext = (_arguments, context) => { + return _arguments.reduce((result, arg, index) => { + return { ...result, [arg]: T.Argument(index) }; + }, context); +}; +// prettier-ignore +export function GenericArgumentsMapping(input, context) { + return input.length === 3 + ? GenericArgumentsContext(input[1], context) + : {}; +} +// prettier-ignore +export function KeywordStringMapping(input, context) { + return T.String(); +} +// prettier-ignore +export function KeywordNumberMapping(input, context) { + return T.Number(); +} +// prettier-ignore +export function KeywordBooleanMapping(input, context) { + return T.Boolean(); +} +// prettier-ignore +export function KeywordUndefinedMapping(input, context) { + return T.Undefined(); +} +// prettier-ignore +export function KeywordNullMapping(input, context) { + return T.Null(); +} +// prettier-ignore +export function KeywordIntegerMapping(input, context) { + return T.Integer(); +} +// prettier-ignore +export function KeywordBigIntMapping(input, context) { + return T.BigInt(); +} +// prettier-ignore +export function KeywordUnknownMapping(input, context) { + return T.Unknown(); +} +// prettier-ignore +export function KeywordAnyMapping(input, context) { + return T.Any(); +} +// prettier-ignore +export function KeywordNeverMapping(input, context) { + return T.Never(); +} +// prettier-ignore +export function KeywordSymbolMapping(input, context) { + return T.Symbol(); +} +// prettier-ignore +export function KeywordVoidMapping(input, context) { + return T.Void(); +} +// prettier-ignore +export function KeywordMapping(input, context) { + return input; +} +// prettier-ignore +export function LiteralStringMapping(input, context) { + return T.Literal(input); +} +// prettier-ignore +export function LiteralNumberMapping(input, context) { + return T.Literal(parseFloat(input)); +} +// prettier-ignore +export function LiteralBooleanMapping(input, context) { + return T.Literal(input === 'true'); +} +// prettier-ignore +export function LiteralMapping(input, context) { + return input; +} +// prettier-ignore +export function KeyOfMapping(input, context) { + return input.length > 0; +} +// prettier-ignore +export function IndexArrayMapping(input, context) { + return input.reduce((result, current) => { + return current.length === 3 + ? [...result, [current[1]]] + : [...result, []]; + }, []); +} +// prettier-ignore +export function ExtendsMapping(input, context) { + return input.length === 6 + ? [input[1], input[3], input[5]] + : []; +} +// prettier-ignore +export function BaseMapping(input, context) { + return T.ValueGuard.IsArray(input) && input.length === 3 ? input[1] : input; +} +// ... +// prettier-ignore +const FactorIndexArray = (Type, indexArray) => { + return indexArray.reduceRight((result, right) => { + const _right = right; + return (_right.length === 1 ? T.Index(result, _right[0]) : + _right.length === 0 ? T.Array(result, _right[0]) : + T.Never()); + }, Type); +}; +// prettier-ignore +const FactorExtends = (Type, Extends) => { + return Extends.length === 3 + ? T.Extends(Type, Extends[0], Extends[1], Extends[2]) + : Type; +}; +// prettier-ignore +export function FactorMapping(input, context) { + const [KeyOf, Type, IndexArray, Extends] = input; + return KeyOf + ? FactorExtends(T.KeyOf(FactorIndexArray(Type, IndexArray)), Extends) + : FactorExtends(FactorIndexArray(Type, IndexArray), Extends); +} +// prettier-ignore +function ExprBinaryMapping(Left, Rest) { + return (Rest.length === 3 ? (() => { + const [Operator, Right, Next] = Rest; + const Schema = ExprBinaryMapping(Right, Next); + if (Operator === '&') { + return T.TypeGuard.IsIntersect(Schema) + ? T.Intersect([Left, ...Schema.allOf]) + : T.Intersect([Left, Schema]); + } + if (Operator === '|') { + return T.TypeGuard.IsUnion(Schema) + ? T.Union([Left, ...Schema.anyOf]) + : T.Union([Left, Schema]); + } + throw 1; + })() : Left); +} +// prettier-ignore +export function ExprTermTailMapping(input, context) { + return input; +} +// prettier-ignore +export function ExprTermMapping(input, context) { + const [left, rest] = input; + return ExprBinaryMapping(left, rest); +} +// prettier-ignore +export function ExprTailMapping(input, context) { + return input; +} +// prettier-ignore +export function ExprMapping(input, context) { + const [left, rest] = input; + return ExprBinaryMapping(left, rest); +} +// prettier-ignore +export function TypeMapping(input, context) { + return input; +} +// prettier-ignore +export function PropertyKeyMapping(input, context) { + return input; +} +// prettier-ignore +export function ReadonlyMapping(input, context) { + return input.length > 0; +} +// prettier-ignore +export function OptionalMapping(input, context) { + return input.length > 0; +} +// prettier-ignore +export function PropertyMapping(input, context) { + const [isReadonly, key, isOptional, _colon, type] = input; + return { + [key]: (isReadonly && isOptional ? T.ReadonlyOptional(type) : + isReadonly && !isOptional ? T.Readonly(type) : + !isReadonly && isOptional ? T.Optional(type) : + type) + }; +} +// prettier-ignore +export function PropertyDelimiterMapping(input, context) { + return input; +} +// prettier-ignore +export function PropertyListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +export function ObjectMapping(input, context) { + const propertyList = input[1]; + return T.Object(propertyList.reduce((result, property) => { + return { ...result, ...property }; + }, {})); +} +// prettier-ignore +export function ElementListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +export function TupleMapping(input, context) { + return T.Tuple(input[1]); +} +// prettier-ignore +export function ParameterMapping(input, context) { + const [_ident, _colon, type] = input; + return type; +} +// prettier-ignore +export function ParameterListMapping(input, context) { + return Delimited(input); +} +// prettier-ignore +export function FunctionMapping(input, context) { + const [_lparan, parameterList, _rparan, _arrow, returnType] = input; + return T.Function(parameterList, returnType); +} +// prettier-ignore +export function ConstructorMapping(input, context) { + const [_new, _lparan, parameterList, _rparan, _arrow, instanceType] = input; + return T.Constructor(parameterList, instanceType); +} +// prettier-ignore +export function MappedMapping(input, context) { + const [_lbrace, _lbracket, _key, _in, _right, _rbracket, _colon, _type] = input; + return T.Literal('Mapped types not supported'); +} +// prettier-ignore +export function AsyncIteratorMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.AsyncIterator(type); +} +// prettier-ignore +export function IteratorMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Iterator(type); +} +// prettier-ignore +export function ArgumentMapping(input, context) { + return T.KindGuard.IsLiteralNumber(input[2]) + ? T.Argument(Math.trunc(input[2].const)) + : T.Never(); +} +// prettier-ignore +export function AwaitedMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Awaited(type); +} +// prettier-ignore +export function ArrayMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Array(type); +} +// prettier-ignore +export function RecordMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Record(key, type); +} +// prettier-ignore +export function PromiseMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Promise(type); +} +// prettier-ignore +export function ConstructorParametersMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.ConstructorParameters(type); +} +// prettier-ignore +export function FunctionParametersMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Parameters(type); +} +// prettier-ignore +export function InstanceTypeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.InstanceType(type); +} +// prettier-ignore +export function ReturnTypeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.ReturnType(type); +} +// prettier-ignore +export function PartialMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Partial(type); +} +// prettier-ignore +export function RequiredMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Required(type); +} +// prettier-ignore +export function PickMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Pick(key, type); +} +// prettier-ignore +export function OmitMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Omit(key, type); +} +// prettier-ignore +export function ExcludeMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Exclude(key, type); +} +// prettier-ignore +export function ExtractMapping(input, context) { + const [_name, _langle, key, _comma, type, _rangle] = input; + return T.Extract(key, type); +} +// prettier-ignore +export function UppercaseMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Uppercase(type); +} +// prettier-ignore +export function LowercaseMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Lowercase(type); +} +// prettier-ignore +export function CapitalizeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Capitalize(type); +} +// prettier-ignore +export function UncapitalizeMapping(input, context) { + const [_name, _langle, type, _rangle] = input; + return T.Uncapitalize(type); +} +// prettier-ignore +export function DateMapping(input, context) { + return T.Date(); +} +// prettier-ignore +export function Uint8ArrayMapping(input, context) { + return T.Uint8Array(); +} +// prettier-ignore +export function ReferenceMapping(input, context) { + const target = Dereference(context, input); + return target; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.d.mts new file mode 100644 index 0000000..7fcd5be --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.d.mts @@ -0,0 +1,162 @@ +import { Static } from '../parser/index.mjs'; +import * as T from '../type/index.mjs'; +import * as S from './mapping.mjs'; +export type TGenericReferenceParameterList_0 = (TType extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TGenericReferenceParameterList_0 : [Result, Input]; +export type TGenericReferenceParameterList = (TGenericReferenceParameterList_0 extends [infer _0, infer Input extends string] ? ((TType extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TGenericReferenceParameterListMapping<_0, Context>, Input] : []; +export type TGenericReference = (Static.Token.Ident extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TGenericReferenceParameterList extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TGenericReferenceMapping<_0, Context>, Input] : []; +export type TGenericArgumentsList_0 = (Static.Token.Ident extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TGenericArgumentsList_0 : [Result, Input]; +export type TGenericArgumentsList = (TGenericArgumentsList_0 extends [infer _0, infer Input extends string] ? ((Static.Token.Ident extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TGenericArgumentsListMapping<_0, Context>, Input] : []; +export type TGenericArguments = (Static.Token.Const<'<', Input> extends [infer _0, infer Input extends string] ? TGenericArgumentsList extends [infer _1, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TGenericArgumentsMapping<_0, Context>, Input] : []; +export type TKeywordString = Static.Token.Const<'string', Input> extends [infer _0 extends 'string', infer Input extends string] ? [S.TKeywordStringMapping<_0, Context>, Input] : []; +export type TKeywordNumber = Static.Token.Const<'number', Input> extends [infer _0 extends 'number', infer Input extends string] ? [S.TKeywordNumberMapping<_0, Context>, Input] : []; +export type TKeywordBoolean = Static.Token.Const<'boolean', Input> extends [infer _0 extends 'boolean', infer Input extends string] ? [S.TKeywordBooleanMapping<_0, Context>, Input] : []; +export type TKeywordUndefined = Static.Token.Const<'undefined', Input> extends [infer _0 extends 'undefined', infer Input extends string] ? [S.TKeywordUndefinedMapping<_0, Context>, Input] : []; +export type TKeywordNull = Static.Token.Const<'null', Input> extends [infer _0 extends 'null', infer Input extends string] ? [S.TKeywordNullMapping<_0, Context>, Input] : []; +export type TKeywordInteger = Static.Token.Const<'integer', Input> extends [infer _0 extends 'integer', infer Input extends string] ? [S.TKeywordIntegerMapping<_0, Context>, Input] : []; +export type TKeywordBigInt = Static.Token.Const<'bigint', Input> extends [infer _0 extends 'bigint', infer Input extends string] ? [S.TKeywordBigIntMapping<_0, Context>, Input] : []; +export type TKeywordUnknown = Static.Token.Const<'unknown', Input> extends [infer _0 extends 'unknown', infer Input extends string] ? [S.TKeywordUnknownMapping<_0, Context>, Input] : []; +export type TKeywordAny = Static.Token.Const<'any', Input> extends [infer _0 extends 'any', infer Input extends string] ? [S.TKeywordAnyMapping<_0, Context>, Input] : []; +export type TKeywordNever = Static.Token.Const<'never', Input> extends [infer _0 extends 'never', infer Input extends string] ? [S.TKeywordNeverMapping<_0, Context>, Input] : []; +export type TKeywordSymbol = Static.Token.Const<'symbol', Input> extends [infer _0 extends 'symbol', infer Input extends string] ? [S.TKeywordSymbolMapping<_0, Context>, Input] : []; +export type TKeywordVoid = Static.Token.Const<'void', Input> extends [infer _0 extends 'void', infer Input extends string] ? [S.TKeywordVoidMapping<_0, Context>, Input] : []; +export type TKeyword = (TKeywordString extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNumber extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordBoolean extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordUndefined extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNull extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordInteger extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordBigInt extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordUnknown extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordAny extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordNever extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordSymbol extends [infer _0, infer Input extends string] ? [_0, Input] : TKeywordVoid extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TKeywordMapping<_0, Context>, Input] : []; +export type TLiteralString = Static.Token.String<["'", '"', '`'], Input> extends [infer _0 extends string, infer Input extends string] ? [S.TLiteralStringMapping<_0, Context>, Input] : []; +export type TLiteralNumber = Static.Token.Number extends [infer _0 extends string, infer Input extends string] ? [S.TLiteralNumberMapping<_0, Context>, Input] : []; +export type TLiteralBoolean = (Static.Token.Const<'true', Input> extends [infer _0, infer Input extends string] ? [_0, Input] : Static.Token.Const<'false', Input> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends 'true' | 'false', infer Input extends string] ? [S.TLiteralBooleanMapping<_0, Context>, Input] : []; +export type TLiteral = (TLiteralBoolean extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteralNumber extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteralString extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TLiteralMapping<_0, Context>, Input] : []; +export type TKeyOf = ((Static.Token.Const<'keyof', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TKeyOfMapping<_0, Context>, Input] : []; +export type TIndexArray_0 = ((Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? TType extends [infer _1, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<']', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [ + infer _0, + infer Input extends string +] ? [_0, Input] : []) extends [infer _0, infer Input extends string] ? TIndexArray_0 : [Result, Input]; +export type TIndexArray = TIndexArray_0 extends [infer _0 extends ([unknown, unknown, unknown] | [unknown, unknown])[], infer Input extends string] ? [S.TIndexArrayMapping<_0, Context>, Input] : []; +export type TExtends = ((Static.Token.Const<'extends', Input> extends [infer _0, infer Input extends string] ? TType extends [infer _1, infer Input extends string] ? Static.Token.Const<'?', Input> extends [infer _2, infer Input extends string] ? TType extends [infer _3, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _4, infer Input extends string] ? TType extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExtendsMapping<_0, Context>, Input] : []; +export type TBase = ((Static.Token.Const<'(', Input> extends [infer _0, infer Input extends string] ? TType extends [infer _1, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : TKeyword extends [infer _0, infer Input extends string] ? [_0, Input] : TObject extends [infer _0, infer Input extends string] ? [_0, Input] : TTuple extends [infer _0, infer Input extends string] ? [_0, Input] : TLiteral extends [infer _0, infer Input extends string] ? [_0, Input] : TConstructor extends [infer _0, infer Input extends string] ? [_0, Input] : TFunction extends [infer _0, infer Input extends string] ? [_0, Input] : TMapped extends [infer _0, infer Input extends string] ? [_0, Input] : TAsyncIterator extends [infer _0, infer Input extends string] ? [_0, Input] : TIterator extends [infer _0, infer Input extends string] ? [_0, Input] : TConstructorParameters extends [infer _0, infer Input extends string] ? [_0, Input] : TFunctionParameters extends [infer _0, infer Input extends string] ? [_0, Input] : TInstanceType extends [infer _0, infer Input extends string] ? [_0, Input] : TReturnType extends [infer _0, infer Input extends string] ? [_0, Input] : TArgument extends [infer _0, infer Input extends string] ? [_0, Input] : TAwaited extends [infer _0, infer Input extends string] ? [_0, Input] : TArray extends [infer _0, infer Input extends string] ? [_0, Input] : TRecord extends [infer _0, infer Input extends string] ? [_0, Input] : TPromise extends [infer _0, infer Input extends string] ? [_0, Input] : TPartial extends [infer _0, infer Input extends string] ? [_0, Input] : TRequired extends [infer _0, infer Input extends string] ? [_0, Input] : TPick extends [infer _0, infer Input extends string] ? [_0, Input] : TOmit extends [infer _0, infer Input extends string] ? [_0, Input] : TExclude extends [infer _0, infer Input extends string] ? [_0, Input] : TExtract extends [infer _0, infer Input extends string] ? [_0, Input] : TUppercase extends [infer _0, infer Input extends string] ? [_0, Input] : TLowercase extends [infer _0, infer Input extends string] ? [_0, Input] : TCapitalize extends [infer _0, infer Input extends string] ? [_0, Input] : TUncapitalize extends [infer _0, infer Input extends string] ? [_0, Input] : TDate extends [infer _0, infer Input extends string] ? [_0, Input] : TUint8Array extends [infer _0, infer Input extends string] ? [_0, Input] : TGenericReference extends [infer _0, infer Input extends string] ? [_0, Input] : TReference extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | unknown, infer Input extends string] ? [S.TBaseMapping<_0, Context>, Input] : []; +export type TFactor = (TKeyOf extends [infer _0, infer Input extends string] ? TBase extends [infer _1, infer Input extends string] ? TIndexArray extends [infer _2, infer Input extends string] ? TExtends extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFactorMapping<_0, Context>, Input] : []; +export type TExprTermTail = ((Static.Token.Const<'&', Input> extends [infer _0, infer Input extends string] ? TFactor extends [infer _1, infer Input extends string] ? TExprTermTail extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExprTermTailMapping<_0, Context>, Input] : []; +export type TExprTerm = (TFactor extends [infer _0, infer Input extends string] ? (TExprTermTail extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TExprTermMapping<_0, Context>, Input] : []; +export type TExprTail = ((Static.Token.Const<'|', Input> extends [infer _0, infer Input extends string] ? TExprTerm extends [infer _1, infer Input extends string] ? TExprTail extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | [], infer Input extends string] ? [S.TExprTailMapping<_0, Context>, Input] : []; +export type TExpr = (TExprTerm extends [infer _0, infer Input extends string] ? (TExprTail extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TExprMapping<_0, Context>, Input] : []; +export type TType = (TGenericArguments extends [infer _0 extends T.TProperties, infer Input extends string] ? TExpr : [] extends [infer _0, infer Input extends string] ? [_0, Input] : TExpr extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TTypeMapping<_0, Context>, Input] : []; +export type TPropertyKey = (Static.Token.Ident extends [infer _0, infer Input extends string] ? [_0, Input] : Static.Token.String<["'", '"'], Input> extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends string, infer Input extends string] ? [S.TPropertyKeyMapping<_0, Context>, Input] : []; +export type TReadonly = ((Static.Token.Const<'readonly', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TReadonlyMapping<_0, Context>, Input] : []; +export type TOptional = ((Static.Token.Const<'?', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown] | [], infer Input extends string] ? [S.TOptionalMapping<_0, Context>, Input] : []; +export type TProperty = (TReadonly extends [infer _0, infer Input extends string] ? TPropertyKey extends [infer _1, infer Input extends string] ? TOptional extends [infer _2, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? [[_0, _1, _2, _3, _4], Input] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPropertyMapping<_0, Context>, Input] : []; +export type TPropertyDelimiter = ((Static.Token.Const<',', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<'\n', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [ + infer _0, + infer Input extends string +] ? [_0, Input] : (Static.Token.Const<';', Input> extends [infer _0, infer Input extends string] ? (Static.Token.Const<'\n', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [ + infer _0, + infer Input extends string +] ? [_0, Input] : (Static.Token.Const<',', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<';', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (Static.Token.Const<'\n', Input> extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown] | [unknown], infer Input extends string] ? [S.TPropertyDelimiterMapping<_0, Context>, Input] : []; +export type TPropertyList_0 = (TProperty extends [infer _0, infer Input extends string] ? (TPropertyDelimiter extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TPropertyList_0 : [Result, Input]; +export type TPropertyList = (TPropertyList_0 extends [infer _0, infer Input extends string] ? ((TProperty extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TPropertyListMapping<_0, Context>, Input] : []; +export type TObject = (Static.Token.Const<'{', Input> extends [infer _0, infer Input extends string] ? TPropertyList extends [infer _1, infer Input extends string] ? Static.Token.Const<'}', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TObjectMapping<_0, Context>, Input] : []; +export type TElementList_0 = (TType extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TElementList_0 : [Result, Input]; +export type TElementList = (TElementList_0 extends [infer _0, infer Input extends string] ? ((TType extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TElementListMapping<_0, Context>, Input] : []; +export type TTuple = (Static.Token.Const<'[', Input> extends [infer _0, infer Input extends string] ? TElementList extends [infer _1, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TTupleMapping<_0, Context>, Input] : []; +export type TParameter = (Static.Token.Ident extends [infer _0, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TParameterMapping<_0, Context>, Input] : []; +export type TParameterList_0 = (TParameter extends [infer _0, infer Input extends string] ? (Static.Token.Const<',', Input> extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : []) : []) extends [infer _0, infer Input extends string] ? TParameterList_0 : [Result, Input]; +export type TParameterList = (TParameterList_0 extends [infer _0, infer Input extends string] ? ((TParameter extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _1, infer Input extends string] ? [[_0, _1], Input] : [] : []) extends [infer _0 extends [unknown, unknown], infer Input extends string] ? [S.TParameterListMapping<_0, Context>, Input] : []; +export type TFunction = (Static.Token.Const<'(', Input> extends [infer _0, infer Input extends string] ? TParameterList extends [infer _1, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _2, infer Input extends string] ? Static.Token.Const<'=>', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? [[_0, _1, _2, _3, _4], Input] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFunctionMapping<_0, Context>, Input] : []; +export type TConstructor = (Static.Token.Const<'new', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'(', Input> extends [infer _1, infer Input extends string] ? TParameterList extends [infer _2, infer Input extends string] ? Static.Token.Const<')', Input> extends [infer _3, infer Input extends string] ? Static.Token.Const<'=>', Input> extends [infer _4, infer Input extends string] ? TType extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TConstructorMapping<_0, Context>, Input] : []; +export type TMapped = (Static.Token.Const<'{', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'[', Input> extends [infer _1, infer Input extends string] ? Static.Token.Ident extends [infer _2, infer Input extends string] ? Static.Token.Const<'in', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<']', Input> extends [infer _5, infer Input extends string] ? Static.Token.Const<':', Input> extends [infer _6, infer Input extends string] ? TType extends [infer _7, infer Input extends string] ? Static.Token.Const<'}', Input> extends [infer _8, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5, _6, _7, _8], Input] : [] : [] : [] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TMappedMapping<_0, Context>, Input] : []; +export type TAsyncIterator = (Static.Token.Const<'AsyncIterator', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TAsyncIteratorMapping<_0, Context>, Input] : []; +export type TIterator = (Static.Token.Const<'Iterator', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TIteratorMapping<_0, Context>, Input] : []; +export type TArgument = (Static.Token.Const<'Argument', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TArgumentMapping<_0, Context>, Input] : []; +export type TAwaited = (Static.Token.Const<'Awaited', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TAwaitedMapping<_0, Context>, Input] : []; +export type TArray = (Static.Token.Const<'Array', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TArrayMapping<_0, Context>, Input] : []; +export type TRecord = (Static.Token.Const<'Record', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TRecordMapping<_0, Context>, Input] : []; +export type TPromise = (Static.Token.Const<'Promise', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPromiseMapping<_0, Context>, Input] : []; +export type TConstructorParameters = (Static.Token.Const<'ConstructorParameters', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TConstructorParametersMapping<_0, Context>, Input] : []; +export type TFunctionParameters = (Static.Token.Const<'Parameters', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TFunctionParametersMapping<_0, Context>, Input] : []; +export type TInstanceType = (Static.Token.Const<'InstanceType', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TInstanceTypeMapping<_0, Context>, Input] : []; +export type TReturnType = (Static.Token.Const<'ReturnType', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TReturnTypeMapping<_0, Context>, Input] : []; +export type TPartial = (Static.Token.Const<'Partial', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPartialMapping<_0, Context>, Input] : []; +export type TRequired = (Static.Token.Const<'Required', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TRequiredMapping<_0, Context>, Input] : []; +export type TPick = (Static.Token.Const<'Pick', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TPickMapping<_0, Context>, Input] : []; +export type TOmit = (Static.Token.Const<'Omit', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TOmitMapping<_0, Context>, Input] : []; +export type TExclude = (Static.Token.Const<'Exclude', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TExcludeMapping<_0, Context>, Input] : []; +export type TExtract = (Static.Token.Const<'Extract', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<',', Input> extends [infer _3, infer Input extends string] ? TType extends [infer _4, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _5, infer Input extends string] ? [[_0, _1, _2, _3, _4, _5], Input] : [] : [] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TExtractMapping<_0, Context>, Input] : []; +export type TUppercase = (Static.Token.Const<'Uppercase', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TUppercaseMapping<_0, Context>, Input] : []; +export type TLowercase = (Static.Token.Const<'Lowercase', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TLowercaseMapping<_0, Context>, Input] : []; +export type TCapitalize = (Static.Token.Const<'Capitalize', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TCapitalizeMapping<_0, Context>, Input] : []; +export type TUncapitalize = (Static.Token.Const<'Uncapitalize', Input> extends [infer _0, infer Input extends string] ? Static.Token.Const<'<', Input> extends [infer _1, infer Input extends string] ? TType extends [infer _2, infer Input extends string] ? Static.Token.Const<'>', Input> extends [infer _3, infer Input extends string] ? [[_0, _1, _2, _3], Input] : [] : [] : [] : []) extends [infer _0 extends [unknown, unknown, unknown, unknown], infer Input extends string] ? [S.TUncapitalizeMapping<_0, Context>, Input] : []; +export type TDate = Static.Token.Const<'Date', Input> extends [infer _0 extends 'Date', infer Input extends string] ? [S.TDateMapping<_0, Context>, Input] : []; +export type TUint8Array = Static.Token.Const<'Uint8Array', Input> extends [infer _0 extends 'Uint8Array', infer Input extends string] ? [S.TUint8ArrayMapping<_0, Context>, Input] : []; +export type TReference = Static.Token.Ident extends [infer _0 extends string, infer Input extends string] ? [S.TReferenceMapping<_0, Context>, Input] : []; +export declare const GenericReferenceParameterList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const GenericReferenceParameterList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const GenericReference: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const GenericArgumentsList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const GenericArgumentsList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const GenericArguments: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordString: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordNumber: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordBoolean: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordUndefined: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordNull: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordInteger: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordBigInt: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordUnknown: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordAny: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordNever: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordSymbol: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeywordVoid: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Keyword: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const LiteralString: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const LiteralNumber: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const LiteralBoolean: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Literal: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const KeyOf: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const IndexArray_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const IndexArray: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Extends: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Base: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Factor: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ExprTermTail: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ExprTerm: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ExprTail: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Expr: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Type: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const PropertyKey: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Readonly: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Optional: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Property: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const PropertyDelimiter: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const PropertyList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const PropertyList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const _Object: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ElementList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const ElementList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Tuple: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Parameter: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ParameterList_0: (input: string, context: T.TProperties, result?: unknown[]) => [unknown[], string]; +export declare const ParameterList: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Function: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Constructor: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Mapped: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const AsyncIterator: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Iterator: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Argument: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Awaited: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Array: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Record: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Promise: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ConstructorParameters: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const FunctionParameters: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const InstanceType: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const ReturnType: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Partial: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Required: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Pick: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Omit: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Exclude: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Extract: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Uppercase: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Lowercase: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Capitalize: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Uncapitalize: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Date: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Uint8Array: (input: string, context?: T.TProperties) => [unknown, string] | []; +export declare const Reference: (input: string, context?: T.TProperties) => [unknown, string] | []; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.mjs b/ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.mjs new file mode 100644 index 0000000..2d84f89 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/parser.mjs @@ -0,0 +1,78 @@ +import { Runtime } from '../parser/index.mjs'; +import * as S from './mapping.mjs'; +const If = (result, left, right = () => []) => (result.length === 2 ? left(result) : right()); +export const GenericReferenceParameterList_0 = (input, context, result = []) => If(If(Type(input, context), ([_0, input]) => If(Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => GenericReferenceParameterList_0(input, context, [...result, _0]), () => [result, input]); +export const GenericReferenceParameterList = (input, context = {}) => If(If(GenericReferenceParameterList_0(input, context), ([_0, input]) => If(If(If(Type(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.GenericReferenceParameterListMapping(_0, context), input]); +export const GenericReference = (input, context = {}) => If(If(Runtime.Token.Ident(input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(GenericReferenceParameterList(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.GenericReferenceMapping(_0, context), input]); +export const GenericArgumentsList_0 = (input, context, result = []) => If(If(Runtime.Token.Ident(input), ([_0, input]) => If(Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => GenericArgumentsList_0(input, context, [...result, _0]), () => [result, input]); +export const GenericArgumentsList = (input, context = {}) => If(If(GenericArgumentsList_0(input, context), ([_0, input]) => If(If(If(Runtime.Token.Ident(input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.GenericArgumentsListMapping(_0, context), input]); +export const GenericArguments = (input, context = {}) => If(If(Runtime.Token.Const('<', input), ([_0, input]) => If(GenericArgumentsList(input, context), ([_1, input]) => If(Runtime.Token.Const('>', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.GenericArgumentsMapping(_0, context), input]); +export const KeywordString = (input, context = {}) => If(Runtime.Token.Const('string', input), ([_0, input]) => [S.KeywordStringMapping(_0, context), input]); +export const KeywordNumber = (input, context = {}) => If(Runtime.Token.Const('number', input), ([_0, input]) => [S.KeywordNumberMapping(_0, context), input]); +export const KeywordBoolean = (input, context = {}) => If(Runtime.Token.Const('boolean', input), ([_0, input]) => [S.KeywordBooleanMapping(_0, context), input]); +export const KeywordUndefined = (input, context = {}) => If(Runtime.Token.Const('undefined', input), ([_0, input]) => [S.KeywordUndefinedMapping(_0, context), input]); +export const KeywordNull = (input, context = {}) => If(Runtime.Token.Const('null', input), ([_0, input]) => [S.KeywordNullMapping(_0, context), input]); +export const KeywordInteger = (input, context = {}) => If(Runtime.Token.Const('integer', input), ([_0, input]) => [S.KeywordIntegerMapping(_0, context), input]); +export const KeywordBigInt = (input, context = {}) => If(Runtime.Token.Const('bigint', input), ([_0, input]) => [S.KeywordBigIntMapping(_0, context), input]); +export const KeywordUnknown = (input, context = {}) => If(Runtime.Token.Const('unknown', input), ([_0, input]) => [S.KeywordUnknownMapping(_0, context), input]); +export const KeywordAny = (input, context = {}) => If(Runtime.Token.Const('any', input), ([_0, input]) => [S.KeywordAnyMapping(_0, context), input]); +export const KeywordNever = (input, context = {}) => If(Runtime.Token.Const('never', input), ([_0, input]) => [S.KeywordNeverMapping(_0, context), input]); +export const KeywordSymbol = (input, context = {}) => If(Runtime.Token.Const('symbol', input), ([_0, input]) => [S.KeywordSymbolMapping(_0, context), input]); +export const KeywordVoid = (input, context = {}) => If(Runtime.Token.Const('void', input), ([_0, input]) => [S.KeywordVoidMapping(_0, context), input]); +export const Keyword = (input, context = {}) => If(If(KeywordString(input, context), ([_0, input]) => [_0, input], () => If(KeywordNumber(input, context), ([_0, input]) => [_0, input], () => If(KeywordBoolean(input, context), ([_0, input]) => [_0, input], () => If(KeywordUndefined(input, context), ([_0, input]) => [_0, input], () => If(KeywordNull(input, context), ([_0, input]) => [_0, input], () => If(KeywordInteger(input, context), ([_0, input]) => [_0, input], () => If(KeywordBigInt(input, context), ([_0, input]) => [_0, input], () => If(KeywordUnknown(input, context), ([_0, input]) => [_0, input], () => If(KeywordAny(input, context), ([_0, input]) => [_0, input], () => If(KeywordNever(input, context), ([_0, input]) => [_0, input], () => If(KeywordSymbol(input, context), ([_0, input]) => [_0, input], () => If(KeywordVoid(input, context), ([_0, input]) => [_0, input], () => [])))))))))))), ([_0, input]) => [S.KeywordMapping(_0, context), input]); +export const LiteralString = (input, context = {}) => If(Runtime.Token.String(["'", '"', '`'], input), ([_0, input]) => [S.LiteralStringMapping(_0, context), input]); +export const LiteralNumber = (input, context = {}) => If(Runtime.Token.Number(input), ([_0, input]) => [S.LiteralNumberMapping(_0, context), input]); +export const LiteralBoolean = (input, context = {}) => If(If(Runtime.Token.Const('true', input), ([_0, input]) => [_0, input], () => If(Runtime.Token.Const('false', input), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.LiteralBooleanMapping(_0, context), input]); +export const Literal = (input, context = {}) => If(If(LiteralBoolean(input, context), ([_0, input]) => [_0, input], () => If(LiteralNumber(input, context), ([_0, input]) => [_0, input], () => If(LiteralString(input, context), ([_0, input]) => [_0, input], () => []))), ([_0, input]) => [S.LiteralMapping(_0, context), input]); +export const KeyOf = (input, context = {}) => If(If(If(Runtime.Token.Const('keyof', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.KeyOfMapping(_0, context), input]); +export const IndexArray_0 = (input, context, result = []) => If(If(If(Runtime.Token.Const('[', input), ([_0, input]) => If(Type(input, context), ([_1, input]) => If(Runtime.Token.Const(']', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If(If(Runtime.Token.Const('[', input), ([_0, input]) => If(Runtime.Token.Const(']', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => IndexArray_0(input, context, [...result, _0]), () => [result, input]); +export const IndexArray = (input, context = {}) => If(IndexArray_0(input, context), ([_0, input]) => [S.IndexArrayMapping(_0, context), input]); +export const Extends = (input, context = {}) => If(If(If(Runtime.Token.Const('extends', input), ([_0, input]) => If(Type(input, context), ([_1, input]) => If(Runtime.Token.Const('?', input), ([_2, input]) => If(Type(input, context), ([_3, input]) => If(Runtime.Token.Const(':', input), ([_4, input]) => If(Type(input, context), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExtendsMapping(_0, context), input]); +export const Base = (input, context = {}) => If(If(If(Runtime.Token.Const('(', input), ([_0, input]) => If(Type(input, context), ([_1, input]) => If(Runtime.Token.Const(')', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If(Keyword(input, context), ([_0, input]) => [_0, input], () => If(_Object(input, context), ([_0, input]) => [_0, input], () => If(Tuple(input, context), ([_0, input]) => [_0, input], () => If(Literal(input, context), ([_0, input]) => [_0, input], () => If(Constructor(input, context), ([_0, input]) => [_0, input], () => If(Function(input, context), ([_0, input]) => [_0, input], () => If(Mapped(input, context), ([_0, input]) => [_0, input], () => If(AsyncIterator(input, context), ([_0, input]) => [_0, input], () => If(Iterator(input, context), ([_0, input]) => [_0, input], () => If(ConstructorParameters(input, context), ([_0, input]) => [_0, input], () => If(FunctionParameters(input, context), ([_0, input]) => [_0, input], () => If(InstanceType(input, context), ([_0, input]) => [_0, input], () => If(ReturnType(input, context), ([_0, input]) => [_0, input], () => If(Argument(input, context), ([_0, input]) => [_0, input], () => If(Awaited(input, context), ([_0, input]) => [_0, input], () => If(Array(input, context), ([_0, input]) => [_0, input], () => If(Record(input, context), ([_0, input]) => [_0, input], () => If(Promise(input, context), ([_0, input]) => [_0, input], () => If(Partial(input, context), ([_0, input]) => [_0, input], () => If(Required(input, context), ([_0, input]) => [_0, input], () => If(Pick(input, context), ([_0, input]) => [_0, input], () => If(Omit(input, context), ([_0, input]) => [_0, input], () => If(Exclude(input, context), ([_0, input]) => [_0, input], () => If(Extract(input, context), ([_0, input]) => [_0, input], () => If(Uppercase(input, context), ([_0, input]) => [_0, input], () => If(Lowercase(input, context), ([_0, input]) => [_0, input], () => If(Capitalize(input, context), ([_0, input]) => [_0, input], () => If(Uncapitalize(input, context), ([_0, input]) => [_0, input], () => If(Date(input, context), ([_0, input]) => [_0, input], () => If(Uint8Array(input, context), ([_0, input]) => [_0, input], () => If(GenericReference(input, context), ([_0, input]) => [_0, input], () => If(Reference(input, context), ([_0, input]) => [_0, input], () => []))))))))))))))))))))))))))))))))), ([_0, input]) => [S.BaseMapping(_0, context), input]); +export const Factor = (input, context = {}) => If(If(KeyOf(input, context), ([_0, input]) => If(Base(input, context), ([_1, input]) => If(IndexArray(input, context), ([_2, input]) => If(Extends(input, context), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.FactorMapping(_0, context), input]); +export const ExprTermTail = (input, context = {}) => If(If(If(Runtime.Token.Const('&', input), ([_0, input]) => If(Factor(input, context), ([_1, input]) => If(ExprTermTail(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExprTermTailMapping(_0, context), input]); +export const ExprTerm = (input, context = {}) => If(If(Factor(input, context), ([_0, input]) => If(ExprTermTail(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ExprTermMapping(_0, context), input]); +export const ExprTail = (input, context = {}) => If(If(If(Runtime.Token.Const('|', input), ([_0, input]) => If(ExprTerm(input, context), ([_1, input]) => If(ExprTail(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ExprTailMapping(_0, context), input]); +export const Expr = (input, context = {}) => If(If(ExprTerm(input, context), ([_0, input]) => If(ExprTail(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ExprMapping(_0, context), input]); +export const Type = (input, context = {}) => If(If(If(GenericArguments(input, context), ([_0, input]) => Expr(input, _0), () => []), ([_0, input]) => [_0, input], () => If(Expr(input, context), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.TypeMapping(_0, context), input]); +export const PropertyKey = (input, context = {}) => If(If(Runtime.Token.Ident(input), ([_0, input]) => [_0, input], () => If(Runtime.Token.String(["'", '"'], input), ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.PropertyKeyMapping(_0, context), input]); +export const Readonly = (input, context = {}) => If(If(If(Runtime.Token.Const('readonly', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.ReadonlyMapping(_0, context), input]); +export const Optional = (input, context = {}) => If(If(If(Runtime.Token.Const('?', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_0, input]) => [S.OptionalMapping(_0, context), input]); +export const Property = (input, context = {}) => If(If(Readonly(input, context), ([_0, input]) => If(PropertyKey(input, context), ([_1, input]) => If(Optional(input, context), ([_2, input]) => If(Runtime.Token.Const(':', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => [[_0, _1, _2, _3, _4], input]))))), ([_0, input]) => [S.PropertyMapping(_0, context), input]); +export const PropertyDelimiter = (input, context = {}) => If(If(If(Runtime.Token.Const(',', input), ([_0, input]) => If(Runtime.Token.Const('\n', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => If(If(Runtime.Token.Const(';', input), ([_0, input]) => If(Runtime.Token.Const('\n', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [_0, input], () => If(If(Runtime.Token.Const(',', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If(If(Runtime.Token.Const(';', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If(If(Runtime.Token.Const('\n', input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => []))))), ([_0, input]) => [S.PropertyDelimiterMapping(_0, context), input]); +export const PropertyList_0 = (input, context, result = []) => If(If(Property(input, context), ([_0, input]) => If(PropertyDelimiter(input, context), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => PropertyList_0(input, context, [...result, _0]), () => [result, input]); +export const PropertyList = (input, context = {}) => If(If(PropertyList_0(input, context), ([_0, input]) => If(If(If(Property(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.PropertyListMapping(_0, context), input]); +export const _Object = (input, context = {}) => If(If(Runtime.Token.Const('{', input), ([_0, input]) => If(PropertyList(input, context), ([_1, input]) => If(Runtime.Token.Const('}', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.ObjectMapping(_0, context), input]); +export const ElementList_0 = (input, context, result = []) => If(If(Type(input, context), ([_0, input]) => If(Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => ElementList_0(input, context, [...result, _0]), () => [result, input]); +export const ElementList = (input, context = {}) => If(If(ElementList_0(input, context), ([_0, input]) => If(If(If(Type(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ElementListMapping(_0, context), input]); +export const Tuple = (input, context = {}) => If(If(Runtime.Token.Const('[', input), ([_0, input]) => If(ElementList(input, context), ([_1, input]) => If(Runtime.Token.Const(']', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.TupleMapping(_0, context), input]); +export const Parameter = (input, context = {}) => If(If(Runtime.Token.Ident(input), ([_0, input]) => If(Runtime.Token.Const(':', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.ParameterMapping(_0, context), input]); +export const ParameterList_0 = (input, context, result = []) => If(If(Parameter(input, context), ([_0, input]) => If(Runtime.Token.Const(',', input), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => ParameterList_0(input, context, [...result, _0]), () => [result, input]); +export const ParameterList = (input, context = {}) => If(If(ParameterList_0(input, context), ([_0, input]) => If(If(If(Parameter(input, context), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => [])), ([_1, input]) => [[_0, _1], input])), ([_0, input]) => [S.ParameterListMapping(_0, context), input]); +export const Function = (input, context = {}) => If(If(Runtime.Token.Const('(', input), ([_0, input]) => If(ParameterList(input, context), ([_1, input]) => If(Runtime.Token.Const(')', input), ([_2, input]) => If(Runtime.Token.Const('=>', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => [[_0, _1, _2, _3, _4], input]))))), ([_0, input]) => [S.FunctionMapping(_0, context), input]); +export const Constructor = (input, context = {}) => If(If(Runtime.Token.Const('new', input), ([_0, input]) => If(Runtime.Token.Const('(', input), ([_1, input]) => If(ParameterList(input, context), ([_2, input]) => If(Runtime.Token.Const(')', input), ([_3, input]) => If(Runtime.Token.Const('=>', input), ([_4, input]) => If(Type(input, context), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ConstructorMapping(_0, context), input]); +export const Mapped = (input, context = {}) => If(If(Runtime.Token.Const('{', input), ([_0, input]) => If(Runtime.Token.Const('[', input), ([_1, input]) => If(Runtime.Token.Ident(input), ([_2, input]) => If(Runtime.Token.Const('in', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => If(Runtime.Token.Const(']', input), ([_5, input]) => If(Runtime.Token.Const(':', input), ([_6, input]) => If(Type(input, context), ([_7, input]) => If(Runtime.Token.Const('}', input), ([_8, input]) => [[_0, _1, _2, _3, _4, _5, _6, _7, _8], input]))))))))), ([_0, input]) => [S.MappedMapping(_0, context), input]); +export const AsyncIterator = (input, context = {}) => If(If(Runtime.Token.Const('AsyncIterator', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.AsyncIteratorMapping(_0, context), input]); +export const Iterator = (input, context = {}) => If(If(Runtime.Token.Const('Iterator', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.IteratorMapping(_0, context), input]); +export const Argument = (input, context = {}) => If(If(Runtime.Token.Const('Argument', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ArgumentMapping(_0, context), input]); +export const Awaited = (input, context = {}) => If(If(Runtime.Token.Const('Awaited', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.AwaitedMapping(_0, context), input]); +export const Array = (input, context = {}) => If(If(Runtime.Token.Const('Array', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ArrayMapping(_0, context), input]); +export const Record = (input, context = {}) => If(If(Runtime.Token.Const('Record', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const(',', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => If(Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.RecordMapping(_0, context), input]); +export const Promise = (input, context = {}) => If(If(Runtime.Token.Const('Promise', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.PromiseMapping(_0, context), input]); +export const ConstructorParameters = (input, context = {}) => If(If(Runtime.Token.Const('ConstructorParameters', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ConstructorParametersMapping(_0, context), input]); +export const FunctionParameters = (input, context = {}) => If(If(Runtime.Token.Const('Parameters', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.FunctionParametersMapping(_0, context), input]); +export const InstanceType = (input, context = {}) => If(If(Runtime.Token.Const('InstanceType', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.InstanceTypeMapping(_0, context), input]); +export const ReturnType = (input, context = {}) => If(If(Runtime.Token.Const('ReturnType', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.ReturnTypeMapping(_0, context), input]); +export const Partial = (input, context = {}) => If(If(Runtime.Token.Const('Partial', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.PartialMapping(_0, context), input]); +export const Required = (input, context = {}) => If(If(Runtime.Token.Const('Required', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.RequiredMapping(_0, context), input]); +export const Pick = (input, context = {}) => If(If(Runtime.Token.Const('Pick', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const(',', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => If(Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.PickMapping(_0, context), input]); +export const Omit = (input, context = {}) => If(If(Runtime.Token.Const('Omit', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const(',', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => If(Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.OmitMapping(_0, context), input]); +export const Exclude = (input, context = {}) => If(If(Runtime.Token.Const('Exclude', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const(',', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => If(Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ExcludeMapping(_0, context), input]); +export const Extract = (input, context = {}) => If(If(Runtime.Token.Const('Extract', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const(',', input), ([_3, input]) => If(Type(input, context), ([_4, input]) => If(Runtime.Token.Const('>', input), ([_5, input]) => [[_0, _1, _2, _3, _4, _5], input])))))), ([_0, input]) => [S.ExtractMapping(_0, context), input]); +export const Uppercase = (input, context = {}) => If(If(Runtime.Token.Const('Uppercase', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.UppercaseMapping(_0, context), input]); +export const Lowercase = (input, context = {}) => If(If(Runtime.Token.Const('Lowercase', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.LowercaseMapping(_0, context), input]); +export const Capitalize = (input, context = {}) => If(If(Runtime.Token.Const('Capitalize', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.CapitalizeMapping(_0, context), input]); +export const Uncapitalize = (input, context = {}) => If(If(Runtime.Token.Const('Uncapitalize', input), ([_0, input]) => If(Runtime.Token.Const('<', input), ([_1, input]) => If(Type(input, context), ([_2, input]) => If(Runtime.Token.Const('>', input), ([_3, input]) => [[_0, _1, _2, _3], input])))), ([_0, input]) => [S.UncapitalizeMapping(_0, context), input]); +export const Date = (input, context = {}) => If(Runtime.Token.Const('Date', input), ([_0, input]) => [S.DateMapping(_0, context), input]); +export const Uint8Array = (input, context = {}) => If(Runtime.Token.Const('Uint8Array', input), ([_0, input]) => [S.Uint8ArrayMapping(_0, context), input]); +export const Reference = (input, context = {}) => If(Runtime.Token.Ident(input), ([_0, input]) => [S.ReferenceMapping(_0, context), input]); diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.d.mts new file mode 100644 index 0000000..096100b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.d.mts @@ -0,0 +1,12 @@ +import * as t from '../type/index.mjs'; +import { TType } from './parser.mjs'; +/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */ +export declare function NoInfer, Input extends string>(context: Context, input: Input, options?: t.SchemaOptions): t.TSchema; +/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */ +export declare function NoInfer(input: Input, options?: t.SchemaOptions): t.TSchema; +/** `[Experimental]` Parses type expressions into TypeBox types */ +export type TSyntax, Code extends string> = (TType extends [infer Type extends t.TSchema, string] ? Type : t.TNever); +/** `[Experimental]` Parses type expressions into TypeBox types */ +export declare function Syntax, Input extends string>(context: Context, input: Input, options?: t.SchemaOptions): TSyntax; +/** `[Experimental]` Parses type expressions into TypeBox types */ +export declare function Syntax(annotation: Input, options?: t.SchemaOptions): TSyntax<{}, Input>; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.mjs b/ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.mjs new file mode 100644 index 0000000..03e7a13 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/syntax/syntax.mjs @@ -0,0 +1,16 @@ +import * as t from '../type/index.mjs'; +import { Type } from './parser.mjs'; +/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */ +// prettier-ignore +export function NoInfer(...args) { + const withContext = typeof args[0] === 'string' ? false : true; + const [context, code, options] = withContext ? [args[0], args[1], args[2] || {}] : [{}, args[0], args[1] || {}]; + const result = Type(code, context)[0]; + return t.KindGuard.IsSchema(result) + ? t.CloneType(result, options) + : t.Never(options); +} +/** `[Experimental]` Parses type expressions into TypeBox types */ +export function Syntax(...args) { + return NoInfer.apply(null, args); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/system/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/system/index.d.mts new file mode 100644 index 0000000..53239c3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/system/index.d.mts @@ -0,0 +1,2 @@ +export * from './policy.mjs'; +export * from './system.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/system/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/system/index.mjs new file mode 100644 index 0000000..53239c3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/system/index.mjs @@ -0,0 +1,2 @@ +export * from './policy.mjs'; +export * from './system.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/system/policy.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/system/policy.d.mts new file mode 100644 index 0000000..bb6307f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/system/policy.d.mts @@ -0,0 +1,29 @@ +export declare namespace TypeSystemPolicy { + /** + * Configures the instantiation behavior of TypeBox types. The `default` option assigns raw JavaScript + * references for embedded types, which may cause side effects if type properties are explicitly updated + * outside the TypeBox type builder. The `clone` option creates copies of any shared types upon creation, + * preventing unintended side effects. The `freeze` option applies `Object.freeze()` to the type, making + * it fully readonly and immutable. Implementations should use `default` whenever possible, as it is the + * fastest way to instantiate types. The default setting is `default`. + */ + let InstanceMode: 'default' | 'clone' | 'freeze'; + /** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */ + let ExactOptionalPropertyTypes: boolean; + /** Sets whether arrays should be treated as a kind of objects. The default is `false` */ + let AllowArrayObject: boolean; + /** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */ + let AllowNaN: boolean; + /** Sets whether `null` should validate for void types. The default is `false` */ + let AllowNullVoid: boolean; + /** Checks this value using the ExactOptionalPropertyTypes policy */ + function IsExactOptionalProperty(value: Record, key: string): boolean; + /** Checks this value using the AllowArrayObjects policy */ + function IsObjectLike(value: unknown): value is Record; + /** Checks this value as a record using the AllowArrayObjects policy */ + function IsRecordLike(value: unknown): value is Record; + /** Checks this value using the AllowNaN policy */ + function IsNumberLike(value: unknown): value is number; + /** Checks this value using the AllowVoidNull policy */ + function IsVoidLike(value: unknown): value is void; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/system/policy.mjs b/ui/node_modules/@sinclair/typebox/build/esm/system/policy.mjs new file mode 100644 index 0000000..87db0a5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/system/policy.mjs @@ -0,0 +1,54 @@ +import { IsObject, IsArray, IsNumber, IsUndefined } from '../value/guard/index.mjs'; +export var TypeSystemPolicy; +(function (TypeSystemPolicy) { + // ------------------------------------------------------------------ + // TypeSystemPolicy: Instancing + // ------------------------------------------------------------------ + /** + * Configures the instantiation behavior of TypeBox types. The `default` option assigns raw JavaScript + * references for embedded types, which may cause side effects if type properties are explicitly updated + * outside the TypeBox type builder. The `clone` option creates copies of any shared types upon creation, + * preventing unintended side effects. The `freeze` option applies `Object.freeze()` to the type, making + * it fully readonly and immutable. Implementations should use `default` whenever possible, as it is the + * fastest way to instantiate types. The default setting is `default`. + */ + TypeSystemPolicy.InstanceMode = 'default'; + // ------------------------------------------------------------------ + // TypeSystemPolicy: Checking + // ------------------------------------------------------------------ + /** Sets whether TypeBox should assert optional properties using the TypeScript `exactOptionalPropertyTypes` assertion policy. The default is `false` */ + TypeSystemPolicy.ExactOptionalPropertyTypes = false; + /** Sets whether arrays should be treated as a kind of objects. The default is `false` */ + TypeSystemPolicy.AllowArrayObject = false; + /** Sets whether `NaN` or `Infinity` should be treated as valid numeric values. The default is `false` */ + TypeSystemPolicy.AllowNaN = false; + /** Sets whether `null` should validate for void types. The default is `false` */ + TypeSystemPolicy.AllowNullVoid = false; + /** Checks this value using the ExactOptionalPropertyTypes policy */ + function IsExactOptionalProperty(value, key) { + return TypeSystemPolicy.ExactOptionalPropertyTypes ? key in value : value[key] !== undefined; + } + TypeSystemPolicy.IsExactOptionalProperty = IsExactOptionalProperty; + /** Checks this value using the AllowArrayObjects policy */ + function IsObjectLike(value) { + const isObject = IsObject(value); + return TypeSystemPolicy.AllowArrayObject ? isObject : isObject && !IsArray(value); + } + TypeSystemPolicy.IsObjectLike = IsObjectLike; + /** Checks this value as a record using the AllowArrayObjects policy */ + function IsRecordLike(value) { + return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array); + } + TypeSystemPolicy.IsRecordLike = IsRecordLike; + /** Checks this value using the AllowNaN policy */ + function IsNumberLike(value) { + return TypeSystemPolicy.AllowNaN ? IsNumber(value) : Number.isFinite(value); + } + TypeSystemPolicy.IsNumberLike = IsNumberLike; + /** Checks this value using the AllowVoidNull policy */ + function IsVoidLike(value) { + const isUndefined = IsUndefined(value); + return TypeSystemPolicy.AllowNullVoid ? isUndefined || value === null : isUndefined; + } + TypeSystemPolicy.IsVoidLike = IsVoidLike; +})(TypeSystemPolicy || (TypeSystemPolicy = {})); diff --git a/ui/node_modules/@sinclair/typebox/build/esm/system/system.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/system/system.d.mts new file mode 100644 index 0000000..719dac1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/system/system.d.mts @@ -0,0 +1,16 @@ +import { type TUnsafe } from '../type/unsafe/index.mjs'; +import { TypeBoxError } from '../type/error/index.mjs'; +export declare class TypeSystemDuplicateTypeKind extends TypeBoxError { + constructor(kind: string); +} +export declare class TypeSystemDuplicateFormat extends TypeBoxError { + constructor(kind: string); +} +export type TypeFactoryFunction> = (options?: Partial) => TUnsafe; +/** Creates user defined types and formats and provides overrides for value checking behaviours */ +export declare namespace TypeSystem { + /** Creates a new type */ + function Type>(kind: string, check: (options: Options, value: unknown) => boolean): TypeFactoryFunction; + /** Creates a new string format */ + function Format(format: F, check: (value: string) => boolean): F; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/system/system.mjs b/ui/node_modules/@sinclair/typebox/build/esm/system/system.mjs new file mode 100644 index 0000000..a435298 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/system/system.mjs @@ -0,0 +1,37 @@ +import { TypeRegistry, FormatRegistry } from '../type/registry/index.mjs'; +import { Unsafe } from '../type/unsafe/index.mjs'; +import { Kind } from '../type/symbols/index.mjs'; +import { TypeBoxError } from '../type/error/index.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class TypeSystemDuplicateTypeKind extends TypeBoxError { + constructor(kind) { + super(`Duplicate type kind '${kind}' detected`); + } +} +export class TypeSystemDuplicateFormat extends TypeBoxError { + constructor(kind) { + super(`Duplicate string format '${kind}' detected`); + } +} +/** Creates user defined types and formats and provides overrides for value checking behaviours */ +export var TypeSystem; +(function (TypeSystem) { + /** Creates a new type */ + function Type(kind, check) { + if (TypeRegistry.Has(kind)) + throw new TypeSystemDuplicateTypeKind(kind); + TypeRegistry.Set(kind, check); + return (options = {}) => Unsafe({ ...options, [Kind]: kind }); + } + TypeSystem.Type = Type; + /** Creates a new string format */ + function Format(format, check) { + if (FormatRegistry.Has(format)) + throw new TypeSystemDuplicateFormat(format); + FormatRegistry.Set(format, check); + return format; + } + TypeSystem.Format = Format; +})(TypeSystem || (TypeSystem = {})); diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/any/any.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/any/any.d.mts new file mode 100644 index 0000000..8555b64 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/any/any.d.mts @@ -0,0 +1,8 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TAny extends TSchema { + [Kind]: 'Any'; + static: any; +} +/** `[Json]` Creates an Any type */ +export declare function Any(options?: SchemaOptions): TAny; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs new file mode 100644 index 0000000..36fdcf3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates an Any type */ +export function Any(options) { + return CreateType({ [Kind]: 'Any' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/any/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/any/index.d.mts new file mode 100644 index 0000000..c91a0a7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/any/index.d.mts @@ -0,0 +1 @@ +export * from './any.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/any/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/any/index.mjs new file mode 100644 index 0000000..c91a0a7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/any/index.mjs @@ -0,0 +1 @@ +export * from './any.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.d.mts new file mode 100644 index 0000000..37fcb9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.d.mts @@ -0,0 +1,9 @@ +import type { TSchema } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TArgument extends TSchema { + [Kind]: 'Argument'; + static: unknown; + index: Index; +} +/** `[JavaScript]` Creates an Argument Type. */ +export declare function Argument(index: Index): TArgument; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs new file mode 100644 index 0000000..1d39611 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates an Argument Type. */ +export function Argument(index) { + return CreateType({ [Kind]: 'Argument', index }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.d.mts new file mode 100644 index 0000000..6b95405 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.d.mts @@ -0,0 +1 @@ +export * from './argument.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.mjs new file mode 100644 index 0000000..6b95405 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/argument/index.mjs @@ -0,0 +1 @@ +export * from './argument.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/array/array.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/array/array.d.mts new file mode 100644 index 0000000..d19a035 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/array/array.d.mts @@ -0,0 +1,28 @@ +import { Ensure } from '../helpers/index.mjs'; +import type { SchemaOptions, TSchema } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface ArrayOptions extends SchemaOptions { + /** The minimum number of items in this array */ + minItems?: number; + /** The maximum number of items in this array */ + maxItems?: number; + /** Should this schema contain unique items */ + uniqueItems?: boolean; + /** A schema for which some elements should match */ + contains?: TSchema; + /** A minimum number of contains schema matches */ + minContains?: number; + /** A maximum number of contains schema matches */ + maxContains?: number; +} +type ArrayStatic = Ensure[]>; +export interface TArray extends TSchema, ArrayOptions { + [Kind]: 'Array'; + static: ArrayStatic; + type: 'array'; + items: T; +} +/** `[Json]` Creates an Array type */ +export declare function Array(items: Type, options?: ArrayOptions): TArray; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs new file mode 100644 index 0000000..8f593d7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates an Array type */ +export function Array(items, options) { + return CreateType({ [Kind]: 'Array', type: 'array', items }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/array/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/array/index.d.mts new file mode 100644 index 0000000..76cd68f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/array/index.d.mts @@ -0,0 +1 @@ +export * from './array.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/array/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/array/index.mjs new file mode 100644 index 0000000..76cd68f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/array/index.mjs @@ -0,0 +1 @@ +export * from './array.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.d.mts new file mode 100644 index 0000000..bbafa8e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.d.mts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TAsyncIterator extends TSchema { + [Kind]: 'AsyncIterator'; + static: AsyncIterableIterator>; + type: 'AsyncIterator'; + items: T; +} +/** `[JavaScript]` Creates a AsyncIterator type */ +export declare function AsyncIterator(items: T, options?: SchemaOptions): TAsyncIterator; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs new file mode 100644 index 0000000..5ff3441 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs @@ -0,0 +1,6 @@ +import { Kind } from '../symbols/index.mjs'; +import { CreateType } from '../create/type.mjs'; +/** `[JavaScript]` Creates a AsyncIterator type */ +export function AsyncIterator(items, options) { + return CreateType({ [Kind]: 'AsyncIterator', type: 'AsyncIterator', items }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.d.mts new file mode 100644 index 0000000..9977afa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.d.mts @@ -0,0 +1 @@ +export * from './async-iterator.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.mjs new file mode 100644 index 0000000..9977afa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/async-iterator/index.mjs @@ -0,0 +1 @@ +export * from './async-iterator.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.d.mts new file mode 100644 index 0000000..f06fca7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.d.mts @@ -0,0 +1,14 @@ +import { Ensure } from '../helpers/index.mjs'; +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TComputed } from '../computed/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TPromise } from '../promise/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +type TFromComputed = Ensure<(TComputed<'Awaited', [TComputed]>)>; +type TFromRef = Ensure]>>; +type TFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest]> : Result); +export type TAwaited = (Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TPromise ? TAwaited : Type); +/** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ +export declare function Awaited(type: T, options?: SchemaOptions): TAwaited; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs new file mode 100644 index 0000000..12af890 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs @@ -0,0 +1,37 @@ +import { CreateType } from '../create/type.mjs'; +import { Computed } from '../computed/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Union } from '../union/index.mjs'; +import { Ref } from '../ref/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsIntersect, IsUnion, IsPromise, IsRef, IsComputed } from '../guard/kind.mjs'; +// prettier-ignore +function FromComputed(target, parameters) { + return Computed('Awaited', [Computed(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return Computed('Awaited', [Ref($ref)]); +} +// prettier-ignore +function FromIntersect(types) { + return Intersect(FromRest(types)); +} +// prettier-ignore +function FromUnion(types) { + return Union(FromRest(types)); +} +// prettier-ignore +function FromPromise(type) { + return Awaited(type); +} +// prettier-ignore +function FromRest(types) { + return types.map(type => Awaited(type)); +} +/** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ +export function Awaited(type, options) { + return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect(type.allOf) : IsUnion(type) ? FromUnion(type.anyOf) : IsPromise(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.d.mts new file mode 100644 index 0000000..325c169 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.d.mts @@ -0,0 +1 @@ +export * from './awaited.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.mjs new file mode 100644 index 0000000..325c169 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/awaited/index.mjs @@ -0,0 +1 @@ +export * from './awaited.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.d.mts new file mode 100644 index 0000000..03f8adf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.d.mts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface BigIntOptions extends SchemaOptions { + exclusiveMaximum?: bigint; + exclusiveMinimum?: bigint; + maximum?: bigint; + minimum?: bigint; + multipleOf?: bigint; +} +export interface TBigInt extends TSchema, BigIntOptions { + [Kind]: 'BigInt'; + static: bigint; + type: 'bigint'; +} +/** `[JavaScript]` Creates a BigInt type */ +export declare function BigInt(options?: BigIntOptions): TBigInt; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs new file mode 100644 index 0000000..52d81e0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs @@ -0,0 +1,6 @@ +import { Kind } from '../symbols/index.mjs'; +import { CreateType } from '../create/index.mjs'; +/** `[JavaScript]` Creates a BigInt type */ +export function BigInt(options) { + return CreateType({ [Kind]: 'BigInt', type: 'bigint' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.d.mts new file mode 100644 index 0000000..27a8011 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.d.mts @@ -0,0 +1 @@ +export * from './bigint.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.mjs new file mode 100644 index 0000000..27a8011 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/bigint/index.mjs @@ -0,0 +1 @@ +export * from './bigint.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.d.mts new file mode 100644 index 0000000..d451cf8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.d.mts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TBoolean extends TSchema { + [Kind]: 'Boolean'; + static: boolean; + type: 'boolean'; +} +/** `[Json]` Creates a Boolean type */ +export declare function Boolean(options?: SchemaOptions): TBoolean; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs new file mode 100644 index 0000000..a269113 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs @@ -0,0 +1,6 @@ +import { Kind } from '../symbols/index.mjs'; +import { CreateType } from '../create/index.mjs'; +/** `[Json]` Creates a Boolean type */ +export function Boolean(options) { + return CreateType({ [Kind]: 'Boolean', type: 'boolean' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.d.mts new file mode 100644 index 0000000..32e45ff --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.d.mts @@ -0,0 +1 @@ +export * from './boolean.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.mjs new file mode 100644 index 0000000..32e45ff --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/boolean/index.mjs @@ -0,0 +1 @@ +export * from './boolean.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.d.mts new file mode 100644 index 0000000..36ea11f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.d.mts @@ -0,0 +1,2 @@ +export * from './type.mjs'; +export * from './value.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.mjs new file mode 100644 index 0000000..36ea11f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/index.mjs @@ -0,0 +1,2 @@ +export * from './type.mjs'; +export * from './value.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.d.mts new file mode 100644 index 0000000..f9593b9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.d.mts @@ -0,0 +1,5 @@ +import { TSchema, SchemaOptions } from '../schema/index.mjs'; +/** Clones a Rest */ +export declare function CloneRest(schemas: T): T; +/** Clones a Type */ +export declare function CloneType(schema: T, options?: SchemaOptions): T; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs new file mode 100644 index 0000000..964c43c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs @@ -0,0 +1,9 @@ +import { Clone } from './value.mjs'; +/** Clones a Rest */ +export function CloneRest(schemas) { + return schemas.map((schema) => CloneType(schema)); +} +/** Clones a Type */ +export function CloneType(schema, options) { + return options === undefined ? Clone(schema) : Clone({ ...options, ...schema }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.d.mts new file mode 100644 index 0000000..30aa085 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.d.mts @@ -0,0 +1,2 @@ +/** Clones a value */ +export declare function Clone(value: T): T; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs new file mode 100644 index 0000000..82f971c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs @@ -0,0 +1,36 @@ +import * as ValueGuard from '../guard/value.mjs'; +function ArrayType(value) { + return value.map((value) => Visit(value)); +} +function DateType(value) { + return new Date(value.getTime()); +} +function Uint8ArrayType(value) { + return new Uint8Array(value); +} +function RegExpType(value) { + return new RegExp(value.source, value.flags); +} +function ObjectType(value) { + const result = {}; + for (const key of Object.getOwnPropertyNames(value)) { + result[key] = Visit(value[key]); + } + for (const key of Object.getOwnPropertySymbols(value)) { + result[key] = Visit(value[key]); + } + return result; +} +// prettier-ignore +function Visit(value) { + return (ValueGuard.IsArray(value) ? ArrayType(value) : + ValueGuard.IsDate(value) ? DateType(value) : + ValueGuard.IsUint8Array(value) ? Uint8ArrayType(value) : + ValueGuard.IsRegExp(value) ? RegExpType(value) : + ValueGuard.IsObject(value) ? ObjectType(value) : + value); +} +/** Clones a value */ +export function Clone(value) { + return Visit(value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.d.mts new file mode 100644 index 0000000..d1e632e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.d.mts @@ -0,0 +1,18 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { Evaluate } from '../helpers/index.mjs'; +import { type TIntersectEvaluated } from '../intersect/index.mjs'; +import { type TIndexFromPropertyKeys } from '../indexed/index.mjs'; +import { type TKeyOfPropertyKeys } from '../keyof/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TObject, type TProperties, type ObjectOptions } from '../object/index.mjs'; +import { TSetDistinct } from '../sets/index.mjs'; +type TCompositeKeys = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeKeys]> : TSetDistinct); +type TFilterNever = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? TFilterNever : TFilterNever : Acc); +type TCompositeProperty = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeProperty]> : TFilterNever); +type TCompositeProperties = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TCompositeProperties>; +}> : Acc); +type TCompositeEvaluate, P extends TProperties = Evaluate>, R extends TSchema = TObject

> = R; +export type TComposite = TCompositeEvaluate; +export declare function Composite(T: [...T], options?: ObjectOptions): TComposite; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs new file mode 100644 index 0000000..bcad1f6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs @@ -0,0 +1,42 @@ +import { IntersectEvaluated } from '../intersect/index.mjs'; +import { IndexFromPropertyKeys } from '../indexed/index.mjs'; +import { KeyOfPropertyKeys } from '../keyof/index.mjs'; +import { Object } from '../object/index.mjs'; +import { SetDistinct } from '../sets/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsNever } from '../guard/kind.mjs'; +// prettier-ignore +function CompositeKeys(T) { + const Acc = []; + for (const L of T) + Acc.push(...KeyOfPropertyKeys(L)); + return SetDistinct(Acc); +} +// prettier-ignore +function FilterNever(T) { + return T.filter(L => !IsNever(L)); +} +// prettier-ignore +function CompositeProperty(T, K) { + const Acc = []; + for (const L of T) + Acc.push(...IndexFromPropertyKeys(L, [K])); + return FilterNever(Acc); +} +// prettier-ignore +function CompositeProperties(T, K) { + const Acc = {}; + for (const L of K) { + Acc[L] = IntersectEvaluated(CompositeProperty(T, L)); + } + return Acc; +} +// prettier-ignore +export function Composite(T, options) { + const K = CompositeKeys(T); + const P = CompositeProperties(T, K); + const R = Object(P, options); + return R; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.d.mts new file mode 100644 index 0000000..cabb7e0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.d.mts @@ -0,0 +1 @@ +export * from './composite.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.mjs new file mode 100644 index 0000000..cabb7e0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/composite/index.mjs @@ -0,0 +1 @@ +export * from './composite.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.d.mts new file mode 100644 index 0000000..7133497 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.d.mts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/symbols.mjs'; +export interface TComputed extends TSchema { + [Kind]: 'Computed'; + target: Target; + parameters: Parameters; +} +/** `[Internal]` Creates a deferred computed type. This type is used exclusively in modules to defer resolution of computable types that contain interior references */ +export declare function Computed(target: Target, parameters: [...Parameters], options?: SchemaOptions): TComputed; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs new file mode 100644 index 0000000..2ac0107 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/index.mjs'; +import { Kind } from '../symbols/symbols.mjs'; +/** `[Internal]` Creates a deferred computed type. This type is used exclusively in modules to defer resolution of computable types that contain interior references */ +export function Computed(target, parameters, options) { + return CreateType({ [Kind]: 'Computed', target, parameters }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.d.mts new file mode 100644 index 0000000..1954cbe --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.d.mts @@ -0,0 +1 @@ +export * from './computed.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.mjs new file mode 100644 index 0000000..1954cbe --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/computed/index.mjs @@ -0,0 +1 @@ +export * from './computed.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/const/const.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/const/const.d.mts new file mode 100644 index 0000000..e424e51 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/const/const.d.mts @@ -0,0 +1,27 @@ +import type { AssertRest, Evaluate } from '../helpers/index.mjs'; +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TAny } from '../any/index.mjs'; +import { type TBigInt } from '../bigint/index.mjs'; +import { type TDate } from '../date/index.mjs'; +import { type TFunction } from '../function/index.mjs'; +import { type TLiteral } from '../literal/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TNull } from '../null/index.mjs'; +import { type TObject } from '../object/index.mjs'; +import { type TSymbol } from '../symbol/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { type TReadonly } from '../readonly/index.mjs'; +import { type TUndefined } from '../undefined/index.mjs'; +import { type TUint8Array } from '../uint8array/index.mjs'; +import { type TUnknown } from '../unknown/index.mjs'; +type TFromArray = T extends readonly [infer L extends unknown, ...infer R extends unknown[]] ? [FromValue, ...TFromArray] : T; +type TFromProperties> = { + -readonly [K in keyof T]: FromValue extends infer R extends TSchema ? TReadonly : TReadonly; +}; +type TConditionalReadonly = Root extends true ? T : TReadonly; +type FromValue = T extends AsyncIterableIterator ? TConditionalReadonly : T extends IterableIterator ? TConditionalReadonly : T extends readonly unknown[] ? TReadonly>>> : T extends Uint8Array ? TUint8Array : T extends Date ? TDate : T extends Record ? TConditionalReadonly>>, Root> : T extends Function ? TConditionalReadonly, Root> : T extends undefined ? TUndefined : T extends null ? TNull : T extends symbol ? TSymbol : T extends number ? TLiteral : T extends boolean ? TLiteral : T extends string ? TLiteral : T extends bigint ? TBigInt : TObject<{}>; +declare function FromValue(value: T, root: Root): FromValue; +export type TConst = FromValue; +/** `[JavaScript]` Creates a readonly const type from the given value. */ +export declare function Const(T: T, options?: SchemaOptions): TConst; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs new file mode 100644 index 0000000..831eb87 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs @@ -0,0 +1,54 @@ +import { Any } from '../any/index.mjs'; +import { BigInt } from '../bigint/index.mjs'; +import { Date } from '../date/index.mjs'; +import { Function as FunctionType } from '../function/index.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Null } from '../null/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Symbol } from '../symbol/index.mjs'; +import { Tuple } from '../tuple/index.mjs'; +import { Readonly } from '../readonly/index.mjs'; +import { Undefined } from '../undefined/index.mjs'; +import { Uint8Array } from '../uint8array/index.mjs'; +import { Unknown } from '../unknown/index.mjs'; +import { CreateType } from '../create/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsArray, IsNumber, IsBigInt, IsUint8Array, IsDate, IsIterator, IsObject, IsAsyncIterator, IsFunction, IsUndefined, IsNull, IsSymbol, IsBoolean, IsString } from '../guard/value.mjs'; +// prettier-ignore +function FromArray(T) { + return T.map(L => FromValue(L, false)); +} +// prettier-ignore +function FromProperties(value) { + const Acc = {}; + for (const K of globalThis.Object.getOwnPropertyNames(value)) + Acc[K] = Readonly(FromValue(value[K], false)); + return Acc; +} +function ConditionalReadonly(T, root) { + return (root === true ? T : Readonly(T)); +} +// prettier-ignore +function FromValue(value, root) { + return (IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : + IsIterator(value) ? ConditionalReadonly(Any(), root) : + IsArray(value) ? Readonly(Tuple(FromArray(value))) : + IsUint8Array(value) ? Uint8Array() : + IsDate(value) ? Date() : + IsObject(value) ? ConditionalReadonly(Object(FromProperties(value)), root) : + IsFunction(value) ? ConditionalReadonly(FunctionType([], Unknown()), root) : + IsUndefined(value) ? Undefined() : + IsNull(value) ? Null() : + IsSymbol(value) ? Symbol() : + IsBigInt(value) ? BigInt() : + IsNumber(value) ? Literal(value) : + IsBoolean(value) ? Literal(value) : + IsString(value) ? Literal(value) : + Object({})); +} +/** `[JavaScript]` Creates a readonly const type from the given value. */ +export function Const(T, options) { + return CreateType(FromValue(T, true), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/const/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/const/index.d.mts new file mode 100644 index 0000000..66ca700 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/const/index.d.mts @@ -0,0 +1 @@ +export * from './const.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/const/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/const/index.mjs new file mode 100644 index 0000000..66ca700 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/const/index.mjs @@ -0,0 +1 @@ +export * from './const.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.d.mts new file mode 100644 index 0000000..fab65da --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.d.mts @@ -0,0 +1,7 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TConstructor } from '../constructor/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { type TNever } from '../never/index.mjs'; +export type TConstructorParameters = (Type extends TConstructor ? TTuple : TNever); +/** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ +export declare function ConstructorParameters(schema: Type, options?: SchemaOptions): TConstructorParameters; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs new file mode 100644 index 0000000..8be5261 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs @@ -0,0 +1,7 @@ +import { Tuple } from '../tuple/index.mjs'; +import { Never } from '../never/index.mjs'; +import * as KindGuard from '../guard/kind.mjs'; +/** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ +export function ConstructorParameters(schema, options) { + return (KindGuard.IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.d.mts new file mode 100644 index 0000000..b415346 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.d.mts @@ -0,0 +1 @@ +export * from './constructor-parameters.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.mjs new file mode 100644 index 0000000..b415346 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/index.mjs @@ -0,0 +1 @@ +export * from './constructor-parameters.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.d.mts new file mode 100644 index 0000000..242bbf0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.d.mts @@ -0,0 +1,23 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import type { Ensure } from '../helpers/index.mjs'; +import type { TReadonlyOptional } from '../readonly-optional/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import type { TOptional } from '../optional/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +type StaticReturnType = Static; +type StaticParameter = T extends TReadonlyOptional ? [Readonly>?] : T extends TReadonly ? [Readonly>] : T extends TOptional ? [Static?] : [ + Static +]; +type StaticParameters = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? StaticParameters]> : Acc); +type StaticConstructor = Ensure) => StaticReturnType>; +export interface TConstructor extends TSchema { + [Kind]: 'Constructor'; + static: StaticConstructor; + type: 'Constructor'; + parameters: T; + returns: U; +} +/** `[JavaScript]` Creates a Constructor type */ +export declare function Constructor(parameters: [...T], returns: U, options?: SchemaOptions): TConstructor; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs new file mode 100644 index 0000000..aa86f73 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a Constructor type */ +export function Constructor(parameters, returns, options) { + return CreateType({ [Kind]: 'Constructor', type: 'Constructor', parameters, returns }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.d.mts new file mode 100644 index 0000000..96f31ed --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.d.mts @@ -0,0 +1 @@ +export * from './constructor.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.mjs new file mode 100644 index 0000000..96f31ed --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/constructor/index.mjs @@ -0,0 +1 @@ +export * from './constructor.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.d.mts new file mode 100644 index 0000000..8b90d40 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.d.mts @@ -0,0 +1,2 @@ +/** Specialized deep immutable value. Applies freeze recursively to the given value */ +export declare function Immutable(value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs new file mode 100644 index 0000000..3c212ee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs @@ -0,0 +1,33 @@ +import * as ValueGuard from '../guard/value.mjs'; +function ImmutableArray(value) { + return globalThis.Object.freeze(value).map((value) => Immutable(value)); +} +function ImmutableDate(value) { + return value; +} +function ImmutableUint8Array(value) { + return value; +} +function ImmutableRegExp(value) { + return value; +} +function ImmutableObject(value) { + const result = {}; + for (const key of Object.getOwnPropertyNames(value)) { + result[key] = Immutable(value[key]); + } + for (const key of Object.getOwnPropertySymbols(value)) { + result[key] = Immutable(value[key]); + } + return globalThis.Object.freeze(result); +} +/** Specialized deep immutable value. Applies freeze recursively to the given value */ +// prettier-ignore +export function Immutable(value) { + return (ValueGuard.IsArray(value) ? ImmutableArray(value) : + ValueGuard.IsDate(value) ? ImmutableDate(value) : + ValueGuard.IsUint8Array(value) ? ImmutableUint8Array(value) : + ValueGuard.IsRegExp(value) ? ImmutableRegExp(value) : + ValueGuard.IsObject(value) ? ImmutableObject(value) : + value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/create/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/create/index.d.mts new file mode 100644 index 0000000..52a0951 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/create/index.d.mts @@ -0,0 +1 @@ +export * from './type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/create/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/create/index.mjs new file mode 100644 index 0000000..52a0951 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/create/index.mjs @@ -0,0 +1 @@ +export * from './type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/create/type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/create/type.d.mts new file mode 100644 index 0000000..792aa9f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/create/type.d.mts @@ -0,0 +1,3 @@ +import { SchemaOptions } from '../schema/schema.mjs'; +/** Creates TypeBox schematics using the configured InstanceMode */ +export declare function CreateType(schema: Record, options?: SchemaOptions): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs new file mode 100644 index 0000000..cff1548 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs @@ -0,0 +1,15 @@ +import { TypeSystemPolicy } from '../../system/policy.mjs'; +import { Immutable } from './immutable.mjs'; +import { Clone } from '../clone/value.mjs'; +/** Creates TypeBox schematics using the configured InstanceMode */ +export function CreateType(schema, options) { + const result = options !== undefined ? { ...options, ...schema } : schema; + switch (TypeSystemPolicy.InstanceMode) { + case 'freeze': + return Immutable(result); + case 'clone': + return Clone(result); + default: + return result; + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/date/date.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/date/date.d.mts new file mode 100644 index 0000000..55495e9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/date/date.d.mts @@ -0,0 +1,21 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface DateOptions extends SchemaOptions { + /** The exclusive maximum timestamp value */ + exclusiveMaximumTimestamp?: number; + /** The exclusive minimum timestamp value */ + exclusiveMinimumTimestamp?: number; + /** The maximum timestamp value */ + maximumTimestamp?: number; + /** The minimum timestamp value */ + minimumTimestamp?: number; + /** The multiple of timestamp value */ + multipleOfTimestamp?: number; +} +export interface TDate extends TSchema, DateOptions { + [Kind]: 'Date'; + static: Date; + type: 'date'; +} +/** `[JavaScript]` Creates a Date type */ +export declare function Date(options?: DateOptions): TDate; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs new file mode 100644 index 0000000..bd764ec --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs @@ -0,0 +1,6 @@ +import { Kind } from '../symbols/index.mjs'; +import { CreateType } from '../create/type.mjs'; +/** `[JavaScript]` Creates a Date type */ +export function Date(options) { + return CreateType({ [Kind]: 'Date', type: 'Date' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/date/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/date/index.d.mts new file mode 100644 index 0000000..e1eb20c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/date/index.d.mts @@ -0,0 +1 @@ +export * from './date.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/date/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/date/index.mjs new file mode 100644 index 0000000..e1eb20c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/date/index.mjs @@ -0,0 +1 @@ +export * from './date.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.d.mts new file mode 100644 index 0000000..77e1c9a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.d.mts @@ -0,0 +1,2 @@ +/** Discards property keys from the given value. This function returns a shallow Clone. */ +export declare function Discard(value: Record, keys: PropertyKey[]): Record; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs new file mode 100644 index 0000000..f2d8a67 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs @@ -0,0 +1,8 @@ +function DiscardKey(value, key) { + const { [key]: _, ...rest } = value; + return rest; +} +/** Discards property keys from the given value. This function returns a shallow Clone. */ +export function Discard(value, keys) { + return keys.reduce((acc, key) => DiscardKey(acc, key), value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.d.mts new file mode 100644 index 0000000..d88a397 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.d.mts @@ -0,0 +1 @@ +export * from './discard.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.mjs new file mode 100644 index 0000000..d88a397 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/discard/index.mjs @@ -0,0 +1 @@ +export * from './discard.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.d.mts new file mode 100644 index 0000000..36de86f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.d.mts @@ -0,0 +1,14 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TLiteral } from '../literal/index.mjs'; +import { Kind, Hint } from '../symbols/index.mjs'; +export type TEnumRecord = Record; +export type TEnumValue = string | number; +export type TEnumKey = string; +export interface TEnum = Record> extends TSchema { + [Kind]: 'Union'; + [Hint]: 'Enum'; + static: T[keyof T]; + anyOf: TLiteral[]; +} +/** `[Json]` Creates a Enum type */ +export declare function Enum>(item: T, options?: SchemaOptions): TEnum; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs new file mode 100644 index 0000000..fce6196 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs @@ -0,0 +1,18 @@ +import { Literal } from '../literal/index.mjs'; +import { Kind, Hint } from '../symbols/index.mjs'; +import { Union } from '../union/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsUndefined } from '../guard/value.mjs'; +/** `[Json]` Creates a Enum type */ +export function Enum(item, options) { + if (IsUndefined(item)) + throw new Error('Enum undefined or empty'); + const values1 = globalThis.Object.getOwnPropertyNames(item) + .filter((key) => isNaN(key)) + .map((key) => item[key]); + const values2 = [...new Set(values1)]; + const anyOf = values2.map((value) => Literal(value)); + return Union(anyOf, { ...options, [Hint]: 'Enum' }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.d.mts new file mode 100644 index 0000000..0801086 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.d.mts @@ -0,0 +1 @@ +export * from './enum.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.mjs new file mode 100644 index 0000000..0801086 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/enum/index.mjs @@ -0,0 +1 @@ +export * from './enum.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/error/error.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/error/error.d.mts new file mode 100644 index 0000000..4560532 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/error/error.d.mts @@ -0,0 +1,4 @@ +/** The base Error type thrown for all TypeBox exceptions */ +export declare class TypeBoxError extends Error { + constructor(message: string); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs new file mode 100644 index 0000000..f035c35 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs @@ -0,0 +1,6 @@ +/** The base Error type thrown for all TypeBox exceptions */ +export class TypeBoxError extends Error { + constructor(message) { + super(message); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/error/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/error/index.d.mts new file mode 100644 index 0000000..428548b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/error/index.d.mts @@ -0,0 +1 @@ +export * from './error.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/error/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/error/index.mjs new file mode 100644 index 0000000..428548b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/error/index.mjs @@ -0,0 +1 @@ +export * from './error.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.d.mts new file mode 100644 index 0000000..a36cd5c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.d.mts @@ -0,0 +1,11 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TExclude } from './exclude.mjs'; +type TFromProperties = ({ + [K2 in keyof K]: TExclude; +}); +type TFromMappedResult = (TFromProperties); +export type TExcludeFromMappedResult> = (TMappedResult

); +export declare function ExcludeFromMappedResult>(R: R, T: T): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs new file mode 100644 index 0000000..df63757 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs @@ -0,0 +1,18 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Exclude } from './exclude.mjs'; +// prettier-ignore +function FromProperties(P, U) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = Exclude(P[K2], U); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, T) { + return FromProperties(R.properties, T); +} +// prettier-ignore +export function ExcludeFromMappedResult(R, T) { + const P = FromMappedResult(R, T); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.d.mts new file mode 100644 index 0000000..2e9f3a4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.d.mts @@ -0,0 +1,5 @@ +import type { TSchema } from '../schema/index.mjs'; +import { TExclude } from './exclude.mjs'; +import { type TTemplateLiteral, type TTemplateLiteralToUnion } from '../template-literal/index.mjs'; +export type TExcludeFromTemplateLiteral = (TExclude, R>); +export declare function ExcludeFromTemplateLiteral(L: L, R: R): TExcludeFromTemplateLiteral; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs new file mode 100644 index 0000000..f23ce32 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs @@ -0,0 +1,5 @@ +import { Exclude } from './exclude.mjs'; +import { TemplateLiteralToUnion } from '../template-literal/index.mjs'; +export function ExcludeFromTemplateLiteral(L, R) { + return Exclude(TemplateLiteralToUnion(L), R); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.d.mts new file mode 100644 index 0000000..a8a289a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.d.mts @@ -0,0 +1,21 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { UnionToTuple, AssertRest, AssertType } from '../helpers/index.mjs'; +import type { TMappedResult } from '../mapped/index.mjs'; +import { type TTemplateLiteral } from '../template-literal/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type Static } from '../static/index.mjs'; +import { type TUnionEvaluated } from '../union/index.mjs'; +import { type TExcludeFromMappedResult } from './exclude-from-mapped-result.mjs'; +import { type TExcludeFromTemplateLiteral } from './exclude-from-template-literal.mjs'; +type TExcludeRest = AssertRest> extends Static ? never : L[K]; +}[number]>> extends infer R extends TSchema[] ? TUnionEvaluated : never; +export type TExclude = (L extends TUnion ? TExcludeRest : L extends R ? TNever : L); +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +export declare function Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult; +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +export declare function Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromTemplateLiteral; +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +export declare function Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs new file mode 100644 index 0000000..34ca779 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs @@ -0,0 +1,25 @@ +import { CreateType } from '../create/type.mjs'; +import { Union } from '../union/index.mjs'; +import { Never } from '../never/index.mjs'; +import { ExtendsCheck, ExtendsResult } from '../extends/index.mjs'; +import { ExcludeFromMappedResult } from './exclude-from-mapped-result.mjs'; +import { ExcludeFromTemplateLiteral } from './exclude-from-template-literal.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsMappedResult, IsTemplateLiteral, IsUnion } from '../guard/kind.mjs'; +function ExcludeRest(L, R) { + const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False); + return excluded.length === 1 ? excluded[0] : Union(excluded); +} +/** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ +export function Exclude(L, R, options = {}) { + // overloads + if (IsTemplateLiteral(L)) + return CreateType(ExcludeFromTemplateLiteral(L, R), options); + if (IsMappedResult(L)) + return CreateType(ExcludeFromMappedResult(L, R), options); + // prettier-ignore + return CreateType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : + ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.d.mts new file mode 100644 index 0000000..2cef888 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.d.mts @@ -0,0 +1,3 @@ +export * from './exclude-from-mapped-result.mjs'; +export * from './exclude-from-template-literal.mjs'; +export * from './exclude.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.mjs new file mode 100644 index 0000000..2cef888 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/exclude/index.mjs @@ -0,0 +1,3 @@ +export * from './exclude-from-mapped-result.mjs'; +export * from './exclude-from-template-literal.mjs'; +export * from './exclude.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.d.mts new file mode 100644 index 0000000..f23524c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.d.mts @@ -0,0 +1,10 @@ +import { type TSchema } from '../schema/index.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +export declare class ExtendsResolverError extends TypeBoxError { +} +export declare enum ExtendsResult { + Union = 0, + True = 1, + False = 2 +} +export declare function ExtendsCheck(left: TSchema, right: TSchema): ExtendsResult; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs new file mode 100644 index 0000000..8d40622 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs @@ -0,0 +1,635 @@ +import { Any } from '../any/index.mjs'; +import { Function as FunctionType } from '../function/index.mjs'; +import { Number } from '../number/index.mjs'; +import { String } from '../string/index.mjs'; +import { Unknown } from '../unknown/index.mjs'; +import { TemplateLiteralToUnion } from '../template-literal/index.mjs'; +import { PatternNumberExact, PatternStringExact } from '../patterns/index.mjs'; +import { Kind, Hint } from '../symbols/index.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +import { TypeGuard, ValueGuard } from '../guard/index.mjs'; +export class ExtendsResolverError extends TypeBoxError { +} +export var ExtendsResult; +(function (ExtendsResult) { + ExtendsResult[ExtendsResult["Union"] = 0] = "Union"; + ExtendsResult[ExtendsResult["True"] = 1] = "True"; + ExtendsResult[ExtendsResult["False"] = 2] = "False"; +})(ExtendsResult || (ExtendsResult = {})); +// ------------------------------------------------------------------ +// IntoBooleanResult +// ------------------------------------------------------------------ +// prettier-ignore +function IntoBooleanResult(result) { + return result === ExtendsResult.False ? result : ExtendsResult.True; +} +// ------------------------------------------------------------------ +// Throw +// ------------------------------------------------------------------ +// prettier-ignore +function Throw(message) { + throw new ExtendsResolverError(message); +} +// ------------------------------------------------------------------ +// StructuralRight +// ------------------------------------------------------------------ +// prettier-ignore +function IsStructuralRight(right) { + return (TypeGuard.IsNever(right) || + TypeGuard.IsIntersect(right) || + TypeGuard.IsUnion(right) || + TypeGuard.IsUnknown(right) || + TypeGuard.IsAny(right)); +} +// prettier-ignore +function StructuralRight(left, right) { + return (TypeGuard.IsNever(right) ? FromNeverRight(left, right) : + TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + TypeGuard.IsUnion(right) ? FromUnionRight(left, right) : + TypeGuard.IsUnknown(right) ? FromUnknownRight(left, right) : + TypeGuard.IsAny(right) ? FromAnyRight(left, right) : + Throw('StructuralRight')); +} +// ------------------------------------------------------------------ +// Any +// ------------------------------------------------------------------ +// prettier-ignore +function FromAnyRight(left, right) { + return ExtendsResult.True; +} +// prettier-ignore +function FromAny(left, right) { + return (TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + (TypeGuard.IsUnion(right) && right.anyOf.some((schema) => TypeGuard.IsAny(schema) || TypeGuard.IsUnknown(schema))) ? ExtendsResult.True : + TypeGuard.IsUnion(right) ? ExtendsResult.Union : + TypeGuard.IsUnknown(right) ? ExtendsResult.True : + TypeGuard.IsAny(right) ? ExtendsResult.True : + ExtendsResult.Union); +} +// ------------------------------------------------------------------ +// Array +// ------------------------------------------------------------------ +// prettier-ignore +function FromArrayRight(left, right) { + return (TypeGuard.IsUnknown(left) ? ExtendsResult.False : + TypeGuard.IsAny(left) ? ExtendsResult.Union : + TypeGuard.IsNever(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromArray(left, right) { + return (TypeGuard.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : + IsStructuralRight(right) ? StructuralRight(left, right) : + !TypeGuard.IsArray(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.items, right.items))); +} +// ------------------------------------------------------------------ +// AsyncIterator +// ------------------------------------------------------------------ +// prettier-ignore +function FromAsyncIterator(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + !TypeGuard.IsAsyncIterator(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.items, right.items))); +} +// ------------------------------------------------------------------ +// BigInt +// ------------------------------------------------------------------ +// prettier-ignore +function FromBigInt(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsBigInt(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Boolean +// ------------------------------------------------------------------ +// prettier-ignore +function FromBooleanRight(left, right) { + return (TypeGuard.IsLiteralBoolean(left) ? ExtendsResult.True : + TypeGuard.IsBoolean(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromBoolean(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsBoolean(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Constructor +// ------------------------------------------------------------------ +// prettier-ignore +function FromConstructor(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + !TypeGuard.IsConstructor(right) ? ExtendsResult.False : + left.parameters.length > right.parameters.length ? ExtendsResult.False : + (!left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === ExtendsResult.True)) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.returns, right.returns))); +} +// ------------------------------------------------------------------ +// Date +// ------------------------------------------------------------------ +// prettier-ignore +function FromDate(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsDate(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Function +// ------------------------------------------------------------------ +// prettier-ignore +function FromFunction(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + !TypeGuard.IsFunction(right) ? ExtendsResult.False : + left.parameters.length > right.parameters.length ? ExtendsResult.False : + (!left.parameters.every((schema, index) => IntoBooleanResult(Visit(right.parameters[index], schema)) === ExtendsResult.True)) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.returns, right.returns))); +} +// ------------------------------------------------------------------ +// Integer +// ------------------------------------------------------------------ +// prettier-ignore +function FromIntegerRight(left, right) { + return (TypeGuard.IsLiteral(left) && ValueGuard.IsNumber(left.const) ? ExtendsResult.True : + TypeGuard.IsNumber(left) || TypeGuard.IsInteger(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromInteger(left, right) { + return (TypeGuard.IsInteger(right) || TypeGuard.IsNumber(right) ? ExtendsResult.True : + IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Intersect +// ------------------------------------------------------------------ +// prettier-ignore +function FromIntersectRight(left, right) { + return right.allOf.every((schema) => Visit(left, schema) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// prettier-ignore +function FromIntersect(left, right) { + return left.allOf.some((schema) => Visit(schema, right) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// ------------------------------------------------------------------ +// Iterator +// ------------------------------------------------------------------ +// prettier-ignore +function FromIterator(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + !TypeGuard.IsIterator(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.items, right.items))); +} +// ------------------------------------------------------------------ +// Literal +// ------------------------------------------------------------------ +// prettier-ignore +function FromLiteral(left, right) { + return (TypeGuard.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : + IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsString(right) ? FromStringRight(left, right) : + TypeGuard.IsNumber(right) ? FromNumberRight(left, right) : + TypeGuard.IsInteger(right) ? FromIntegerRight(left, right) : + TypeGuard.IsBoolean(right) ? FromBooleanRight(left, right) : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Never +// ------------------------------------------------------------------ +// prettier-ignore +function FromNeverRight(left, right) { + return ExtendsResult.False; +} +// prettier-ignore +function FromNever(left, right) { + return ExtendsResult.True; +} +// ------------------------------------------------------------------ +// Not +// ------------------------------------------------------------------ +// prettier-ignore +function UnwrapTNot(schema) { + let [current, depth] = [schema, 0]; + while (true) { + if (!TypeGuard.IsNot(current)) + break; + current = current.not; + depth += 1; + } + return depth % 2 === 0 ? current : Unknown(); +} +// prettier-ignore +function FromNot(left, right) { + // TypeScript has no concept of negated types, and attempts to correctly check the negated + // type at runtime would put TypeBox at odds with TypeScripts ability to statically infer + // the type. Instead we unwrap to either unknown or T and continue evaluating. + // prettier-ignore + return (TypeGuard.IsNot(left) ? Visit(UnwrapTNot(left), right) : + TypeGuard.IsNot(right) ? Visit(left, UnwrapTNot(right)) : + Throw('Invalid fallthrough for Not')); +} +// ------------------------------------------------------------------ +// Null +// ------------------------------------------------------------------ +// prettier-ignore +function FromNull(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsNull(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Number +// ------------------------------------------------------------------ +// prettier-ignore +function FromNumberRight(left, right) { + return (TypeGuard.IsLiteralNumber(left) ? ExtendsResult.True : + TypeGuard.IsNumber(left) || TypeGuard.IsInteger(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromNumber(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsInteger(right) || TypeGuard.IsNumber(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Object +// ------------------------------------------------------------------ +// prettier-ignore +function IsObjectPropertyCount(schema, count) { + return Object.getOwnPropertyNames(schema.properties).length === count; +} +// prettier-ignore +function IsObjectStringLike(schema) { + return IsObjectArrayLike(schema); +} +// prettier-ignore +function IsObjectSymbolLike(schema) { + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'description' in schema.properties && TypeGuard.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && ((TypeGuard.IsString(schema.properties.description.anyOf[0]) && + TypeGuard.IsUndefined(schema.properties.description.anyOf[1])) || (TypeGuard.IsString(schema.properties.description.anyOf[1]) && + TypeGuard.IsUndefined(schema.properties.description.anyOf[0])))); +} +// prettier-ignore +function IsObjectNumberLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectBooleanLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectBigIntLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectDateLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectUint8ArrayLike(schema) { + return IsObjectArrayLike(schema); +} +// prettier-ignore +function IsObjectFunctionLike(schema) { + const length = Number(); + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'length' in schema.properties && IntoBooleanResult(Visit(schema.properties['length'], length)) === ExtendsResult.True); +} +// prettier-ignore +function IsObjectConstructorLike(schema) { + return IsObjectPropertyCount(schema, 0); +} +// prettier-ignore +function IsObjectArrayLike(schema) { + const length = Number(); + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'length' in schema.properties && IntoBooleanResult(Visit(schema.properties['length'], length)) === ExtendsResult.True); +} +// prettier-ignore +function IsObjectPromiseLike(schema) { + const then = FunctionType([Any()], Any()); + return IsObjectPropertyCount(schema, 0) || (IsObjectPropertyCount(schema, 1) && 'then' in schema.properties && IntoBooleanResult(Visit(schema.properties['then'], then)) === ExtendsResult.True); +} +// ------------------------------------------------------------------ +// Property +// ------------------------------------------------------------------ +// prettier-ignore +function Property(left, right) { + return (Visit(left, right) === ExtendsResult.False ? ExtendsResult.False : + TypeGuard.IsOptional(left) && !TypeGuard.IsOptional(right) ? ExtendsResult.False : + ExtendsResult.True); +} +// prettier-ignore +function FromObjectRight(left, right) { + return (TypeGuard.IsUnknown(left) ? ExtendsResult.False : + TypeGuard.IsAny(left) ? ExtendsResult.Union : (TypeGuard.IsNever(left) || + (TypeGuard.IsLiteralString(left) && IsObjectStringLike(right)) || + (TypeGuard.IsLiteralNumber(left) && IsObjectNumberLike(right)) || + (TypeGuard.IsLiteralBoolean(left) && IsObjectBooleanLike(right)) || + (TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right)) || + (TypeGuard.IsBigInt(left) && IsObjectBigIntLike(right)) || + (TypeGuard.IsString(left) && IsObjectStringLike(right)) || + (TypeGuard.IsSymbol(left) && IsObjectSymbolLike(right)) || + (TypeGuard.IsNumber(left) && IsObjectNumberLike(right)) || + (TypeGuard.IsInteger(left) && IsObjectNumberLike(right)) || + (TypeGuard.IsBoolean(left) && IsObjectBooleanLike(right)) || + (TypeGuard.IsUint8Array(left) && IsObjectUint8ArrayLike(right)) || + (TypeGuard.IsDate(left) && IsObjectDateLike(right)) || + (TypeGuard.IsConstructor(left) && IsObjectConstructorLike(right)) || + (TypeGuard.IsFunction(left) && IsObjectFunctionLike(right))) ? ExtendsResult.True : + (TypeGuard.IsRecord(left) && TypeGuard.IsString(RecordKey(left))) ? (() => { + // When expressing a Record with literal key values, the Record is converted into a Object with + // the Hint assigned as `Record`. This is used to invert the extends logic. + return right[Hint] === 'Record' ? ExtendsResult.True : ExtendsResult.False; + })() : + (TypeGuard.IsRecord(left) && TypeGuard.IsNumber(RecordKey(left))) ? (() => { + return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False; + })() : + ExtendsResult.False); +} +// prettier-ignore +function FromObject(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + !TypeGuard.IsObject(right) ? ExtendsResult.False : + (() => { + for (const key of Object.getOwnPropertyNames(right.properties)) { + if (!(key in left.properties) && !TypeGuard.IsOptional(right.properties[key])) { + return ExtendsResult.False; + } + if (TypeGuard.IsOptional(right.properties[key])) { + return ExtendsResult.True; + } + if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) { + return ExtendsResult.False; + } + } + return ExtendsResult.True; + })()); +} +// ------------------------------------------------------------------ +// Promise +// ------------------------------------------------------------------ +// prettier-ignore +function FromPromise(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : + !TypeGuard.IsPromise(right) ? ExtendsResult.False : + IntoBooleanResult(Visit(left.item, right.item))); +} +// ------------------------------------------------------------------ +// Record +// ------------------------------------------------------------------ +// prettier-ignore +function RecordKey(schema) { + return (PatternNumberExact in schema.patternProperties ? Number() : + PatternStringExact in schema.patternProperties ? String() : + Throw('Unknown record key pattern')); +} +// prettier-ignore +function RecordValue(schema) { + return (PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : + PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : + Throw('Unable to get record value schema')); +} +// prettier-ignore +function FromRecordRight(left, right) { + const [Key, Value] = [RecordKey(right), RecordValue(right)]; + return ((TypeGuard.IsLiteralString(left) && TypeGuard.IsNumber(Key) && IntoBooleanResult(Visit(left, Value)) === ExtendsResult.True) ? ExtendsResult.True : + TypeGuard.IsUint8Array(left) && TypeGuard.IsNumber(Key) ? Visit(left, Value) : + TypeGuard.IsString(left) && TypeGuard.IsNumber(Key) ? Visit(left, Value) : + TypeGuard.IsArray(left) && TypeGuard.IsNumber(Key) ? Visit(left, Value) : + TypeGuard.IsObject(left) ? (() => { + for (const key of Object.getOwnPropertyNames(left.properties)) { + if (Property(Value, left.properties[key]) === ExtendsResult.False) { + return ExtendsResult.False; + } + } + return ExtendsResult.True; + })() : + ExtendsResult.False); +} +// prettier-ignore +function FromRecord(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + !TypeGuard.IsRecord(right) ? ExtendsResult.False : + Visit(RecordValue(left), RecordValue(right))); +} +// ------------------------------------------------------------------ +// RegExp +// ------------------------------------------------------------------ +// prettier-ignore +function FromRegExp(left, right) { + // Note: RegExp types evaluate as strings, not RegExp objects. + // Here we remap either into string and continue evaluating. + const L = TypeGuard.IsRegExp(left) ? String() : left; + const R = TypeGuard.IsRegExp(right) ? String() : right; + return Visit(L, R); +} +// ------------------------------------------------------------------ +// String +// ------------------------------------------------------------------ +// prettier-ignore +function FromStringRight(left, right) { + return (TypeGuard.IsLiteral(left) && ValueGuard.IsString(left.const) ? ExtendsResult.True : + TypeGuard.IsString(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromString(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsString(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Symbol +// ------------------------------------------------------------------ +// prettier-ignore +function FromSymbol(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsSymbol(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// TemplateLiteral +// ------------------------------------------------------------------ +// prettier-ignore +function FromTemplateLiteral(left, right) { + // TemplateLiteral types are resolved to either unions for finite expressions or string + // for infinite expressions. Here we call to TemplateLiteralResolver to resolve for + // either type and continue evaluating. + return (TypeGuard.IsTemplateLiteral(left) ? Visit(TemplateLiteralToUnion(left), right) : + TypeGuard.IsTemplateLiteral(right) ? Visit(left, TemplateLiteralToUnion(right)) : + Throw('Invalid fallthrough for TemplateLiteral')); +} +// ------------------------------------------------------------------ +// Tuple +// ------------------------------------------------------------------ +// prettier-ignore +function IsArrayOfTuple(left, right) { + return (TypeGuard.IsArray(right) && + left.items !== undefined && + left.items.every((schema) => Visit(schema, right.items) === ExtendsResult.True)); +} +// prettier-ignore +function FromTupleRight(left, right) { + return (TypeGuard.IsNever(left) ? ExtendsResult.True : + TypeGuard.IsUnknown(left) ? ExtendsResult.False : + TypeGuard.IsAny(left) ? ExtendsResult.Union : + ExtendsResult.False); +} +// prettier-ignore +function FromTuple(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : + TypeGuard.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : + !TypeGuard.IsTuple(right) ? ExtendsResult.False : + (ValueGuard.IsUndefined(left.items) && !ValueGuard.IsUndefined(right.items)) || (!ValueGuard.IsUndefined(left.items) && ValueGuard.IsUndefined(right.items)) ? ExtendsResult.False : + (ValueGuard.IsUndefined(left.items) && !ValueGuard.IsUndefined(right.items)) ? ExtendsResult.True : + left.items.every((schema, index) => Visit(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Uint8Array +// ------------------------------------------------------------------ +// prettier-ignore +function FromUint8Array(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsUint8Array(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Undefined +// ------------------------------------------------------------------ +// prettier-ignore +function FromUndefined(left, right) { + return (IsStructuralRight(right) ? StructuralRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsRecord(right) ? FromRecordRight(left, right) : + TypeGuard.IsVoid(right) ? FromVoidRight(left, right) : + TypeGuard.IsUndefined(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Union +// ------------------------------------------------------------------ +// prettier-ignore +function FromUnionRight(left, right) { + return right.anyOf.some((schema) => Visit(left, schema) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// prettier-ignore +function FromUnion(left, right) { + return left.anyOf.every((schema) => Visit(schema, right) === ExtendsResult.True) + ? ExtendsResult.True + : ExtendsResult.False; +} +// ------------------------------------------------------------------ +// Unknown +// ------------------------------------------------------------------ +// prettier-ignore +function FromUnknownRight(left, right) { + return ExtendsResult.True; +} +// prettier-ignore +function FromUnknown(left, right) { + return (TypeGuard.IsNever(right) ? FromNeverRight(left, right) : + TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + TypeGuard.IsUnion(right) ? FromUnionRight(left, right) : + TypeGuard.IsAny(right) ? FromAnyRight(left, right) : + TypeGuard.IsString(right) ? FromStringRight(left, right) : + TypeGuard.IsNumber(right) ? FromNumberRight(left, right) : + TypeGuard.IsInteger(right) ? FromIntegerRight(left, right) : + TypeGuard.IsBoolean(right) ? FromBooleanRight(left, right) : + TypeGuard.IsArray(right) ? FromArrayRight(left, right) : + TypeGuard.IsTuple(right) ? FromTupleRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsUnknown(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// ------------------------------------------------------------------ +// Void +// ------------------------------------------------------------------ +// prettier-ignore +function FromVoidRight(left, right) { + return (TypeGuard.IsUndefined(left) ? ExtendsResult.True : + TypeGuard.IsUndefined(left) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function FromVoid(left, right) { + return (TypeGuard.IsIntersect(right) ? FromIntersectRight(left, right) : + TypeGuard.IsUnion(right) ? FromUnionRight(left, right) : + TypeGuard.IsUnknown(right) ? FromUnknownRight(left, right) : + TypeGuard.IsAny(right) ? FromAnyRight(left, right) : + TypeGuard.IsObject(right) ? FromObjectRight(left, right) : + TypeGuard.IsVoid(right) ? ExtendsResult.True : + ExtendsResult.False); +} +// prettier-ignore +function Visit(left, right) { + return ( + // resolvable + (TypeGuard.IsTemplateLiteral(left) || TypeGuard.IsTemplateLiteral(right)) ? FromTemplateLiteral(left, right) : + (TypeGuard.IsRegExp(left) || TypeGuard.IsRegExp(right)) ? FromRegExp(left, right) : + (TypeGuard.IsNot(left) || TypeGuard.IsNot(right)) ? FromNot(left, right) : + // standard + TypeGuard.IsAny(left) ? FromAny(left, right) : + TypeGuard.IsArray(left) ? FromArray(left, right) : + TypeGuard.IsBigInt(left) ? FromBigInt(left, right) : + TypeGuard.IsBoolean(left) ? FromBoolean(left, right) : + TypeGuard.IsAsyncIterator(left) ? FromAsyncIterator(left, right) : + TypeGuard.IsConstructor(left) ? FromConstructor(left, right) : + TypeGuard.IsDate(left) ? FromDate(left, right) : + TypeGuard.IsFunction(left) ? FromFunction(left, right) : + TypeGuard.IsInteger(left) ? FromInteger(left, right) : + TypeGuard.IsIntersect(left) ? FromIntersect(left, right) : + TypeGuard.IsIterator(left) ? FromIterator(left, right) : + TypeGuard.IsLiteral(left) ? FromLiteral(left, right) : + TypeGuard.IsNever(left) ? FromNever(left, right) : + TypeGuard.IsNull(left) ? FromNull(left, right) : + TypeGuard.IsNumber(left) ? FromNumber(left, right) : + TypeGuard.IsObject(left) ? FromObject(left, right) : + TypeGuard.IsRecord(left) ? FromRecord(left, right) : + TypeGuard.IsString(left) ? FromString(left, right) : + TypeGuard.IsSymbol(left) ? FromSymbol(left, right) : + TypeGuard.IsTuple(left) ? FromTuple(left, right) : + TypeGuard.IsPromise(left) ? FromPromise(left, right) : + TypeGuard.IsUint8Array(left) ? FromUint8Array(left, right) : + TypeGuard.IsUndefined(left) ? FromUndefined(left, right) : + TypeGuard.IsUnion(left) ? FromUnion(left, right) : + TypeGuard.IsUnknown(left) ? FromUnknown(left, right) : + TypeGuard.IsVoid(left) ? FromVoid(left, right) : + Throw(`Unknown left type operand '${left[Kind]}'`)); +} +export function ExtendsCheck(left, right) { + return Visit(left, right); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.d.mts new file mode 100644 index 0000000..b8994bf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.d.mts @@ -0,0 +1,14 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import type { Assert } from '../helpers/index.mjs'; +import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs'; +import { type TLiteral, type TLiteralValue } from '../literal/index.mjs'; +import { type TExtends } from './extends.mjs'; +type TFromPropertyKey = { + [_ in K]: TExtends>, U, L, R>; +}; +type TFromPropertyKeys = (K extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? TFromPropertyKeys> : Acc); +type TFromMappedKey = (TFromPropertyKeys); +export type TExtendsFromMappedKey> = (TMappedResult

); +export declare function ExtendsFromMappedKey>(T: T, U: U, L: L, R: R, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs new file mode 100644 index 0000000..ace359f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs @@ -0,0 +1,25 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Extends } from './extends.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromPropertyKey(K, U, L, R, options) { + return { + [K]: Extends(Literal(K), U, L, R, Clone(options)) + }; +} +// prettier-ignore +function FromPropertyKeys(K, U, L, R, options) { + return K.reduce((Acc, LK) => { + return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) }; + }, {}); +} +// prettier-ignore +function FromMappedKey(K, U, L, R, options) { + return FromPropertyKeys(K.keys, U, L, R, options); +} +// prettier-ignore +export function ExtendsFromMappedKey(T, U, L, R, options) { + const P = FromMappedKey(T, U, L, R, options); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.d.mts new file mode 100644 index 0000000..44a49a5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.d.mts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TExtends } from './extends.mjs'; +type TFromProperties

= ({ + [K2 in keyof P]: TExtends; +}); +type TFromMappedResult = (TFromProperties); +export type TExtendsFromMappedResult> = (TMappedResult

); +export declare function ExtendsFromMappedResult>(Left: Left, Right: Right, True: True, False: False, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs new file mode 100644 index 0000000..9a11a4f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs @@ -0,0 +1,19 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Extends } from './extends.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromProperties(P, Right, True, False, options) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = Extends(P[K2], Right, True, False, Clone(options)); + return Acc; +} +// prettier-ignore +function FromMappedResult(Left, Right, True, False, options) { + return FromProperties(Left.properties, Right, True, False, options); +} +// prettier-ignore +export function ExtendsFromMappedResult(Left, Right, True, False, options) { + const P = FromMappedResult(Left, Right, True, False, options); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.d.mts new file mode 100644 index 0000000..df9a7a4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.d.mts @@ -0,0 +1,3 @@ +import type { TSchema } from '../schema/index.mjs'; +/** Fast undefined check used for properties of type undefined */ +export declare function ExtendsUndefinedCheck(schema: TSchema): boolean; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.mjs new file mode 100644 index 0000000..4882eb3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.mjs @@ -0,0 +1,20 @@ +import { Kind } from '../symbols/index.mjs'; +/** Fast undefined check used for properties of type undefined */ +function Intersect(schema) { + return schema.allOf.every((schema) => ExtendsUndefinedCheck(schema)); +} +function Union(schema) { + return schema.anyOf.some((schema) => ExtendsUndefinedCheck(schema)); +} +function Not(schema) { + return !ExtendsUndefinedCheck(schema.not); +} +/** Fast undefined check used for properties of type undefined */ +// prettier-ignore +export function ExtendsUndefinedCheck(schema) { + return (schema[Kind] === 'Intersect' ? Intersect(schema) : + schema[Kind] === 'Union' ? Union(schema) : + schema[Kind] === 'Not' ? Not(schema) : + schema[Kind] === 'Undefined' ? true : + false); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.d.mts new file mode 100644 index 0000000..8ce8e55 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.d.mts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { TMappedKey, TMappedResult } from '../mapped/index.mjs'; +import { UnionToTuple } from '../helpers/index.mjs'; +import { type TExtendsFromMappedKey } from './extends-from-mapped-key.mjs'; +import { type TExtendsFromMappedResult } from './extends-from-mapped-result.mjs'; +type TExtendsResolve = ((Static extends Static ? T : U) extends infer O extends TSchema ? UnionToTuple extends [infer X extends TSchema, infer Y extends TSchema] ? TUnion<[X, Y]> : O : never); +export type TExtends = TExtendsResolve; +/** `[Json]` Creates a Conditional type */ +export declare function Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult; +/** `[Json]` Creates a Conditional type */ +export declare function Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey; +/** `[Json]` Creates a Conditional type */ +export declare function Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs new file mode 100644 index 0000000..5540d53 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs @@ -0,0 +1,23 @@ +import { CreateType } from '../create/type.mjs'; +import { Union } from '../union/index.mjs'; +import { ExtendsCheck, ExtendsResult } from './extends-check.mjs'; +import { ExtendsFromMappedKey } from './extends-from-mapped-key.mjs'; +import { ExtendsFromMappedResult } from './extends-from-mapped-result.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsMappedKey, IsMappedResult } from '../guard/kind.mjs'; +// prettier-ignore +function ExtendsResolve(left, right, trueType, falseType) { + const R = ExtendsCheck(left, right); + return (R === ExtendsResult.Union ? Union([trueType, falseType]) : + R === ExtendsResult.True ? trueType : + falseType); +} +/** `[Json]` Creates a Conditional type */ +export function Extends(L, R, T, F, options) { + // prettier-ignore + return (IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : + IsMappedKey(L) ? CreateType(ExtendsFromMappedKey(L, R, T, F, options)) : + CreateType(ExtendsResolve(L, R, T, F), options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.d.mts new file mode 100644 index 0000000..2dec0f2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.d.mts @@ -0,0 +1,5 @@ +export * from './extends-check.mjs'; +export * from './extends-from-mapped-key.mjs'; +export * from './extends-from-mapped-result.mjs'; +export * from './extends-undefined.mjs'; +export * from './extends.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.mjs new file mode 100644 index 0000000..2dec0f2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extends/index.mjs @@ -0,0 +1,5 @@ +export * from './extends-check.mjs'; +export * from './extends-from-mapped-key.mjs'; +export * from './extends-from-mapped-result.mjs'; +export * from './extends-undefined.mjs'; +export * from './extends.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.d.mts new file mode 100644 index 0000000..cd190eb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.d.mts @@ -0,0 +1,11 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TExtract } from './extract.mjs'; +type TFromProperties

= ({ + [K2 in keyof P]: TExtract; +}); +type TFromMappedResult = (TFromProperties); +export type TExtractFromMappedResult> = (TMappedResult

); +export declare function ExtractFromMappedResult>(R: R, T: T): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs new file mode 100644 index 0000000..d89ef9a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs @@ -0,0 +1,18 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Extract } from './extract.mjs'; +// prettier-ignore +function FromProperties(P, T) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = Extract(P[K2], T); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, T) { + return FromProperties(R.properties, T); +} +// prettier-ignore +export function ExtractFromMappedResult(R, T) { + const P = FromMappedResult(R, T); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.d.mts new file mode 100644 index 0000000..c01b138 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.d.mts @@ -0,0 +1,5 @@ +import type { TSchema } from '../schema/index.mjs'; +import { type TExtract } from './extract.mjs'; +import { type TTemplateLiteral, type TTemplateLiteralToUnion } from '../template-literal/index.mjs'; +export type TExtractFromTemplateLiteral = (TExtract, R>); +export declare function ExtractFromTemplateLiteral(L: L, R: R): TExtractFromTemplateLiteral; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs new file mode 100644 index 0000000..cd7e038 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs @@ -0,0 +1,5 @@ +import { Extract } from './extract.mjs'; +import { TemplateLiteralToUnion } from '../template-literal/index.mjs'; +export function ExtractFromTemplateLiteral(L, R) { + return Extract(TemplateLiteralToUnion(L), R); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.d.mts new file mode 100644 index 0000000..644be01 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.d.mts @@ -0,0 +1,21 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { AssertRest, AssertType, UnionToTuple } from '../helpers/index.mjs'; +import type { TMappedResult } from '../mapped/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type Static } from '../static/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TUnionEvaluated } from '../union/index.mjs'; +import { type TTemplateLiteral } from '../template-literal/index.mjs'; +import { type TExtractFromMappedResult } from './extract-from-mapped-result.mjs'; +import { type TExtractFromTemplateLiteral } from './extract-from-template-literal.mjs'; +type TExtractRest = AssertRest> extends Static ? L[K] : never; +}[number]>> extends infer R extends TSchema[] ? TUnionEvaluated : never; +export type TExtract = (L extends TUnion ? TExtractRest : L extends U ? L : TNever); +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +export declare function Extract(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult; +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +export declare function Extract(type: L, union: R, options?: SchemaOptions): TExtractFromTemplateLiteral; +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +export declare function Extract(type: L, union: R, options?: SchemaOptions): TExtract; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs new file mode 100644 index 0000000..224bc44 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs @@ -0,0 +1,25 @@ +import { CreateType } from '../create/type.mjs'; +import { Union } from '../union/index.mjs'; +import { Never } from '../never/index.mjs'; +import { ExtendsCheck, ExtendsResult } from '../extends/index.mjs'; +import { ExtractFromMappedResult } from './extract-from-mapped-result.mjs'; +import { ExtractFromTemplateLiteral } from './extract-from-template-literal.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsMappedResult, IsTemplateLiteral, IsUnion } from '../guard/kind.mjs'; +function ExtractRest(L, R) { + const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False); + return extracted.length === 1 ? extracted[0] : Union(extracted); +} +/** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ +export function Extract(L, R, options) { + // overloads + if (IsTemplateLiteral(L)) + return CreateType(ExtractFromTemplateLiteral(L, R), options); + if (IsMappedResult(L)) + return CreateType(ExtractFromMappedResult(L, R), options); + // prettier-ignore + return CreateType(IsUnion(L) ? ExtractRest(L.anyOf, R) : + ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.d.mts new file mode 100644 index 0000000..ef57e33 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.d.mts @@ -0,0 +1,3 @@ +export * from './extract-from-mapped-result.mjs'; +export * from './extract-from-template-literal.mjs'; +export * from './extract.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.mjs new file mode 100644 index 0000000..ef57e33 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/extract/index.mjs @@ -0,0 +1,3 @@ +export * from './extract-from-mapped-result.mjs'; +export * from './extract-from-template-literal.mjs'; +export * from './extract.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/function/function.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/function/function.d.mts new file mode 100644 index 0000000..11aa16b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/function/function.d.mts @@ -0,0 +1,23 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import type { Ensure } from '../helpers/index.mjs'; +import type { TReadonlyOptional } from '../readonly-optional/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import type { TOptional } from '../optional/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +type StaticReturnType = Static; +type StaticParameter = T extends TReadonlyOptional ? [Readonly>?] : T extends TReadonly ? [Readonly>] : T extends TOptional ? [Static?] : [ + Static +]; +type StaticParameters = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? StaticParameters]> : Acc); +type StaticFunction = Ensure<(...param: StaticParameters) => StaticReturnType>; +export interface TFunction extends TSchema { + [Kind]: 'Function'; + static: StaticFunction; + type: 'Function'; + parameters: T; + returns: U; +} +/** `[JavaScript]` Creates a Function type */ +export declare function Function(parameters: [...T], returns: U, options?: SchemaOptions): TFunction; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs new file mode 100644 index 0000000..739e71d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a Function type */ +export function Function(parameters, returns, options) { + return CreateType({ [Kind]: 'Function', type: 'Function', parameters, returns }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/function/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/function/index.d.mts new file mode 100644 index 0000000..e2c3c85 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/function/index.d.mts @@ -0,0 +1 @@ +export * from './function.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/function/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/function/index.mjs new file mode 100644 index 0000000..e2c3c85 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/function/index.mjs @@ -0,0 +1 @@ +export * from './function.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.d.mts new file mode 100644 index 0000000..cbfca84 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.d.mts @@ -0,0 +1,3 @@ +export * as KindGuard from './kind.mjs'; +export * as TypeGuard from './type.mjs'; +export * as ValueGuard from './value.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.mjs new file mode 100644 index 0000000..cbfca84 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/index.mjs @@ -0,0 +1,3 @@ +export * as KindGuard from './kind.mjs'; +export * as TypeGuard from './type.mjs'; +export * as ValueGuard from './value.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.d.mts new file mode 100644 index 0000000..cc9f97c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.d.mts @@ -0,0 +1,147 @@ +import { Kind, Hint, TransformKind } from '../symbols/index.mjs'; +import { TransformOptions } from '../transform/index.mjs'; +import type { TAny } from '../any/index.mjs'; +import type { TArgument } from '../argument/index.mjs'; +import type { TArray } from '../array/index.mjs'; +import type { TAsyncIterator } from '../async-iterator/index.mjs'; +import type { TBoolean } from '../boolean/index.mjs'; +import type { TComputed } from '../computed/index.mjs'; +import type { TBigInt } from '../bigint/index.mjs'; +import type { TConstructor } from '../constructor/index.mjs'; +import type { TFunction } from '../function/index.mjs'; +import type { TImport } from '../module/index.mjs'; +import type { TInteger } from '../integer/index.mjs'; +import type { TIntersect } from '../intersect/index.mjs'; +import type { TIterator } from '../iterator/index.mjs'; +import type { TLiteral, TLiteralValue } from '../literal/index.mjs'; +import type { TMappedKey, TMappedResult } from '../mapped/index.mjs'; +import type { TNever } from '../never/index.mjs'; +import type { TNot } from '../not/index.mjs'; +import type { TNull } from '../null/index.mjs'; +import type { TNumber } from '../number/index.mjs'; +import type { TObject, TProperties } from '../object/index.mjs'; +import type { TOptional } from '../optional/index.mjs'; +import type { TPromise } from '../promise/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import type { TRecord } from '../record/index.mjs'; +import type { TRef } from '../ref/index.mjs'; +import type { TRegExp } from '../regexp/index.mjs'; +import type { TSchema } from '../schema/index.mjs'; +import type { TString } from '../string/index.mjs'; +import type { TSymbol } from '../symbol/index.mjs'; +import type { TTemplateLiteral } from '../template-literal/index.mjs'; +import type { TTuple } from '../tuple/index.mjs'; +import type { TUint8Array } from '../uint8array/index.mjs'; +import type { TUndefined } from '../undefined/index.mjs'; +import type { TUnknown } from '../unknown/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TUnsafe } from '../unsafe/index.mjs'; +import type { TVoid } from '../void/index.mjs'; +import type { TDate } from '../date/index.mjs'; +import type { TThis } from '../recursive/index.mjs'; +/** `[Kind-Only]` Returns true if this value has a Readonly symbol */ +export declare function IsReadonly(value: T): value is TReadonly; +/** `[Kind-Only]` Returns true if this value has a Optional symbol */ +export declare function IsOptional(value: T): value is TOptional; +/** `[Kind-Only]` Returns true if the given value is TAny */ +export declare function IsAny(value: unknown): value is TAny; +/** `[Kind-Only]` Returns true if the given value is TArgument */ +export declare function IsArgument(value: unknown): value is TArgument; +/** `[Kind-Only]` Returns true if the given value is TArray */ +export declare function IsArray(value: unknown): value is TArray; +/** `[Kind-Only]` Returns true if the given value is TAsyncIterator */ +export declare function IsAsyncIterator(value: unknown): value is TAsyncIterator; +/** `[Kind-Only]` Returns true if the given value is TBigInt */ +export declare function IsBigInt(value: unknown): value is TBigInt; +/** `[Kind-Only]` Returns true if the given value is TBoolean */ +export declare function IsBoolean(value: unknown): value is TBoolean; +/** `[Kind-Only]` Returns true if the given value is TComputed */ +export declare function IsComputed(value: unknown): value is TComputed; +/** `[Kind-Only]` Returns true if the given value is TConstructor */ +export declare function IsConstructor(value: unknown): value is TConstructor; +/** `[Kind-Only]` Returns true if the given value is TDate */ +export declare function IsDate(value: unknown): value is TDate; +/** `[Kind-Only]` Returns true if the given value is TFunction */ +export declare function IsFunction(value: unknown): value is TFunction; +/** `[Kind-Only]` Returns true if the given value is TInteger */ +export declare function IsImport(value: unknown): value is TImport; +/** `[Kind-Only]` Returns true if the given value is TInteger */ +export declare function IsInteger(value: unknown): value is TInteger; +/** `[Kind-Only]` Returns true if the given schema is TProperties */ +export declare function IsProperties(value: unknown): value is TProperties; +/** `[Kind-Only]` Returns true if the given value is TIntersect */ +export declare function IsIntersect(value: unknown): value is TIntersect; +/** `[Kind-Only]` Returns true if the given value is TIterator */ +export declare function IsIterator(value: unknown): value is TIterator; +/** `[Kind-Only]` Returns true if the given value is a TKind with the given name. */ +export declare function IsKindOf(value: unknown, kind: T): value is Record & { + [Kind]: T; +}; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteralString(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteralNumber(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteralBoolean(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is TLiteralValue */ +export declare function IsLiteralValue(value: unknown): value is TLiteralValue; +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export declare function IsLiteral(value: unknown): value is TLiteral; +/** `[Kind-Only]` Returns true if the given value is a TMappedKey */ +export declare function IsMappedKey(value: unknown): value is TMappedKey; +/** `[Kind-Only]` Returns true if the given value is TMappedResult */ +export declare function IsMappedResult(value: unknown): value is TMappedResult; +/** `[Kind-Only]` Returns true if the given value is TNever */ +export declare function IsNever(value: unknown): value is TNever; +/** `[Kind-Only]` Returns true if the given value is TNot */ +export declare function IsNot(value: unknown): value is TNot; +/** `[Kind-Only]` Returns true if the given value is TNull */ +export declare function IsNull(value: unknown): value is TNull; +/** `[Kind-Only]` Returns true if the given value is TNumber */ +export declare function IsNumber(value: unknown): value is TNumber; +/** `[Kind-Only]` Returns true if the given value is TObject */ +export declare function IsObject(value: unknown): value is TObject; +/** `[Kind-Only]` Returns true if the given value is TPromise */ +export declare function IsPromise(value: unknown): value is TPromise; +/** `[Kind-Only]` Returns true if the given value is TRecord */ +export declare function IsRecord(value: unknown): value is TRecord; +/** `[Kind-Only]` Returns true if this value is TRecursive */ +export declare function IsRecursive(value: unknown): value is { + [Hint]: 'Recursive'; +}; +/** `[Kind-Only]` Returns true if the given value is TRef */ +export declare function IsRef(value: unknown): value is TRef; +/** `[Kind-Only]` Returns true if the given value is TRegExp */ +export declare function IsRegExp(value: unknown): value is TRegExp; +/** `[Kind-Only]` Returns true if the given value is TString */ +export declare function IsString(value: unknown): value is TString; +/** `[Kind-Only]` Returns true if the given value is TSymbol */ +export declare function IsSymbol(value: unknown): value is TSymbol; +/** `[Kind-Only]` Returns true if the given value is TTemplateLiteral */ +export declare function IsTemplateLiteral(value: unknown): value is TTemplateLiteral; +/** `[Kind-Only]` Returns true if the given value is TThis */ +export declare function IsThis(value: unknown): value is TThis; +/** `[Kind-Only]` Returns true of this value is TTransform */ +export declare function IsTransform(value: unknown): value is { + [TransformKind]: TransformOptions; +}; +/** `[Kind-Only]` Returns true if the given value is TTuple */ +export declare function IsTuple(value: unknown): value is TTuple; +/** `[Kind-Only]` Returns true if the given value is TUndefined */ +export declare function IsUndefined(value: unknown): value is TUndefined; +/** `[Kind-Only]` Returns true if the given value is TUnion */ +export declare function IsUnion(value: unknown): value is TUnion; +/** `[Kind-Only]` Returns true if the given value is TUint8Array */ +export declare function IsUint8Array(value: unknown): value is TUint8Array; +/** `[Kind-Only]` Returns true if the given value is TUnknown */ +export declare function IsUnknown(value: unknown): value is TUnknown; +/** `[Kind-Only]` Returns true if the given value is a raw TUnsafe */ +export declare function IsUnsafe(value: unknown): value is TUnsafe; +/** `[Kind-Only]` Returns true if the given value is TVoid */ +export declare function IsVoid(value: unknown): value is TVoid; +/** `[Kind-Only]` Returns true if the given value is TKind */ +export declare function IsKind(value: unknown): value is Record & { + [Kind]: string; +}; +/** `[Kind-Only]` Returns true if the given value is TSchema */ +export declare function IsSchema(value: unknown): value is TSchema; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs new file mode 100644 index 0000000..3ad56b2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs @@ -0,0 +1,235 @@ +import * as ValueGuard from './value.mjs'; +import { Kind, Hint, TransformKind, ReadonlyKind, OptionalKind } from '../symbols/index.mjs'; +/** `[Kind-Only]` Returns true if this value has a Readonly symbol */ +export function IsReadonly(value) { + return ValueGuard.IsObject(value) && value[ReadonlyKind] === 'Readonly'; +} +/** `[Kind-Only]` Returns true if this value has a Optional symbol */ +export function IsOptional(value) { + return ValueGuard.IsObject(value) && value[OptionalKind] === 'Optional'; +} +/** `[Kind-Only]` Returns true if the given value is TAny */ +export function IsAny(value) { + return IsKindOf(value, 'Any'); +} +/** `[Kind-Only]` Returns true if the given value is TArgument */ +export function IsArgument(value) { + return IsKindOf(value, 'Argument'); +} +/** `[Kind-Only]` Returns true if the given value is TArray */ +export function IsArray(value) { + return IsKindOf(value, 'Array'); +} +/** `[Kind-Only]` Returns true if the given value is TAsyncIterator */ +export function IsAsyncIterator(value) { + return IsKindOf(value, 'AsyncIterator'); +} +/** `[Kind-Only]` Returns true if the given value is TBigInt */ +export function IsBigInt(value) { + return IsKindOf(value, 'BigInt'); +} +/** `[Kind-Only]` Returns true if the given value is TBoolean */ +export function IsBoolean(value) { + return IsKindOf(value, 'Boolean'); +} +/** `[Kind-Only]` Returns true if the given value is TComputed */ +export function IsComputed(value) { + return IsKindOf(value, 'Computed'); +} +/** `[Kind-Only]` Returns true if the given value is TConstructor */ +export function IsConstructor(value) { + return IsKindOf(value, 'Constructor'); +} +/** `[Kind-Only]` Returns true if the given value is TDate */ +export function IsDate(value) { + return IsKindOf(value, 'Date'); +} +/** `[Kind-Only]` Returns true if the given value is TFunction */ +export function IsFunction(value) { + return IsKindOf(value, 'Function'); +} +/** `[Kind-Only]` Returns true if the given value is TInteger */ +export function IsImport(value) { + return IsKindOf(value, 'Import'); +} +/** `[Kind-Only]` Returns true if the given value is TInteger */ +export function IsInteger(value) { + return IsKindOf(value, 'Integer'); +} +/** `[Kind-Only]` Returns true if the given schema is TProperties */ +export function IsProperties(value) { + return ValueGuard.IsObject(value); +} +/** `[Kind-Only]` Returns true if the given value is TIntersect */ +export function IsIntersect(value) { + return IsKindOf(value, 'Intersect'); +} +/** `[Kind-Only]` Returns true if the given value is TIterator */ +export function IsIterator(value) { + return IsKindOf(value, 'Iterator'); +} +/** `[Kind-Only]` Returns true if the given value is a TKind with the given name. */ +export function IsKindOf(value, kind) { + return ValueGuard.IsObject(value) && Kind in value && value[Kind] === kind; +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export function IsLiteralString(value) { + return IsLiteral(value) && ValueGuard.IsString(value.const); +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export function IsLiteralNumber(value) { + return IsLiteral(value) && ValueGuard.IsNumber(value.const); +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export function IsLiteralBoolean(value) { + return IsLiteral(value) && ValueGuard.IsBoolean(value.const); +} +/** `[Kind-Only]` Returns true if the given value is TLiteralValue */ +export function IsLiteralValue(value) { + return ValueGuard.IsBoolean(value) || ValueGuard.IsNumber(value) || ValueGuard.IsString(value); +} +/** `[Kind-Only]` Returns true if the given value is TLiteral */ +export function IsLiteral(value) { + return IsKindOf(value, 'Literal'); +} +/** `[Kind-Only]` Returns true if the given value is a TMappedKey */ +export function IsMappedKey(value) { + return IsKindOf(value, 'MappedKey'); +} +/** `[Kind-Only]` Returns true if the given value is TMappedResult */ +export function IsMappedResult(value) { + return IsKindOf(value, 'MappedResult'); +} +/** `[Kind-Only]` Returns true if the given value is TNever */ +export function IsNever(value) { + return IsKindOf(value, 'Never'); +} +/** `[Kind-Only]` Returns true if the given value is TNot */ +export function IsNot(value) { + return IsKindOf(value, 'Not'); +} +/** `[Kind-Only]` Returns true if the given value is TNull */ +export function IsNull(value) { + return IsKindOf(value, 'Null'); +} +/** `[Kind-Only]` Returns true if the given value is TNumber */ +export function IsNumber(value) { + return IsKindOf(value, 'Number'); +} +/** `[Kind-Only]` Returns true if the given value is TObject */ +export function IsObject(value) { + return IsKindOf(value, 'Object'); +} +/** `[Kind-Only]` Returns true if the given value is TPromise */ +export function IsPromise(value) { + return IsKindOf(value, 'Promise'); +} +/** `[Kind-Only]` Returns true if the given value is TRecord */ +export function IsRecord(value) { + return IsKindOf(value, 'Record'); +} +/** `[Kind-Only]` Returns true if this value is TRecursive */ +export function IsRecursive(value) { + return ValueGuard.IsObject(value) && Hint in value && value[Hint] === 'Recursive'; +} +/** `[Kind-Only]` Returns true if the given value is TRef */ +export function IsRef(value) { + return IsKindOf(value, 'Ref'); +} +/** `[Kind-Only]` Returns true if the given value is TRegExp */ +export function IsRegExp(value) { + return IsKindOf(value, 'RegExp'); +} +/** `[Kind-Only]` Returns true if the given value is TString */ +export function IsString(value) { + return IsKindOf(value, 'String'); +} +/** `[Kind-Only]` Returns true if the given value is TSymbol */ +export function IsSymbol(value) { + return IsKindOf(value, 'Symbol'); +} +/** `[Kind-Only]` Returns true if the given value is TTemplateLiteral */ +export function IsTemplateLiteral(value) { + return IsKindOf(value, 'TemplateLiteral'); +} +/** `[Kind-Only]` Returns true if the given value is TThis */ +export function IsThis(value) { + return IsKindOf(value, 'This'); +} +/** `[Kind-Only]` Returns true of this value is TTransform */ +export function IsTransform(value) { + return ValueGuard.IsObject(value) && TransformKind in value; +} +/** `[Kind-Only]` Returns true if the given value is TTuple */ +export function IsTuple(value) { + return IsKindOf(value, 'Tuple'); +} +/** `[Kind-Only]` Returns true if the given value is TUndefined */ +export function IsUndefined(value) { + return IsKindOf(value, 'Undefined'); +} +/** `[Kind-Only]` Returns true if the given value is TUnion */ +export function IsUnion(value) { + return IsKindOf(value, 'Union'); +} +/** `[Kind-Only]` Returns true if the given value is TUint8Array */ +export function IsUint8Array(value) { + return IsKindOf(value, 'Uint8Array'); +} +/** `[Kind-Only]` Returns true if the given value is TUnknown */ +export function IsUnknown(value) { + return IsKindOf(value, 'Unknown'); +} +/** `[Kind-Only]` Returns true if the given value is a raw TUnsafe */ +export function IsUnsafe(value) { + return IsKindOf(value, 'Unsafe'); +} +/** `[Kind-Only]` Returns true if the given value is TVoid */ +export function IsVoid(value) { + return IsKindOf(value, 'Void'); +} +/** `[Kind-Only]` Returns true if the given value is TKind */ +export function IsKind(value) { + return ValueGuard.IsObject(value) && Kind in value && ValueGuard.IsString(value[Kind]); +} +/** `[Kind-Only]` Returns true if the given value is TSchema */ +export function IsSchema(value) { + // prettier-ignore + return (IsAny(value) || + IsArgument(value) || + IsArray(value) || + IsBoolean(value) || + IsBigInt(value) || + IsAsyncIterator(value) || + IsComputed(value) || + IsConstructor(value) || + IsDate(value) || + IsFunction(value) || + IsInteger(value) || + IsIntersect(value) || + IsIterator(value) || + IsLiteral(value) || + IsMappedKey(value) || + IsMappedResult(value) || + IsNever(value) || + IsNot(value) || + IsNull(value) || + IsNumber(value) || + IsObject(value) || + IsPromise(value) || + IsRecord(value) || + IsRef(value) || + IsRegExp(value) || + IsString(value) || + IsSymbol(value) || + IsTemplateLiteral(value) || + IsThis(value) || + IsTuple(value) || + IsUndefined(value) || + IsUnion(value) || + IsUint8Array(value) || + IsUnknown(value) || + IsUnsafe(value) || + IsVoid(value) || + IsKind(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.d.mts new file mode 100644 index 0000000..c8896c7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.d.mts @@ -0,0 +1,152 @@ +import { Kind, Hint, TransformKind } from '../symbols/index.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +import { TransformOptions } from '../transform/index.mjs'; +import type { TAny } from '../any/index.mjs'; +import type { TArgument } from '../argument/index.mjs'; +import type { TArray } from '../array/index.mjs'; +import type { TAsyncIterator } from '../async-iterator/index.mjs'; +import type { TBoolean } from '../boolean/index.mjs'; +import type { TComputed } from '../computed/index.mjs'; +import type { TBigInt } from '../bigint/index.mjs'; +import type { TConstructor } from '../constructor/index.mjs'; +import type { TFunction } from '../function/index.mjs'; +import type { TImport } from '../module/index.mjs'; +import type { TInteger } from '../integer/index.mjs'; +import type { TIntersect } from '../intersect/index.mjs'; +import type { TIterator } from '../iterator/index.mjs'; +import type { TLiteral, TLiteralValue } from '../literal/index.mjs'; +import type { TMappedKey, TMappedResult } from '../mapped/index.mjs'; +import type { TNever } from '../never/index.mjs'; +import type { TNot } from '../not/index.mjs'; +import type { TNull } from '../null/index.mjs'; +import type { TNumber } from '../number/index.mjs'; +import type { TObject, TProperties } from '../object/index.mjs'; +import type { TOptional } from '../optional/index.mjs'; +import type { TPromise } from '../promise/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import type { TRecord } from '../record/index.mjs'; +import type { TRef } from '../ref/index.mjs'; +import type { TRegExp } from '../regexp/index.mjs'; +import type { TSchema } from '../schema/index.mjs'; +import type { TString } from '../string/index.mjs'; +import type { TSymbol } from '../symbol/index.mjs'; +import type { TTemplateLiteral } from '../template-literal/index.mjs'; +import type { TTuple } from '../tuple/index.mjs'; +import type { TUint8Array } from '../uint8array/index.mjs'; +import type { TUndefined } from '../undefined/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TUnknown } from '../unknown/index.mjs'; +import type { TUnsafe } from '../unsafe/index.mjs'; +import type { TVoid } from '../void/index.mjs'; +import type { TDate } from '../date/index.mjs'; +import type { TThis } from '../recursive/index.mjs'; +export declare class TypeGuardUnknownTypeError extends TypeBoxError { +} +/** Returns true if this value has a Readonly symbol */ +export declare function IsReadonly(value: T): value is TReadonly; +/** Returns true if this value has a Optional symbol */ +export declare function IsOptional(value: T): value is TOptional; +/** Returns true if the given value is TAny */ +export declare function IsAny(value: unknown): value is TAny; +/** Returns true if the given value is TArgument */ +export declare function IsArgument(value: unknown): value is TArgument; +/** Returns true if the given value is TArray */ +export declare function IsArray(value: unknown): value is TArray; +/** Returns true if the given value is TAsyncIterator */ +export declare function IsAsyncIterator(value: unknown): value is TAsyncIterator; +/** Returns true if the given value is TBigInt */ +export declare function IsBigInt(value: unknown): value is TBigInt; +/** Returns true if the given value is TBoolean */ +export declare function IsBoolean(value: unknown): value is TBoolean; +/** Returns true if the given value is TComputed */ +export declare function IsComputed(value: unknown): value is TComputed; +/** Returns true if the given value is TConstructor */ +export declare function IsConstructor(value: unknown): value is TConstructor; +/** Returns true if the given value is TDate */ +export declare function IsDate(value: unknown): value is TDate; +/** Returns true if the given value is TFunction */ +export declare function IsFunction(value: unknown): value is TFunction; +/** Returns true if the given value is TImport */ +export declare function IsImport(value: unknown): value is TImport; +/** Returns true if the given value is TInteger */ +export declare function IsInteger(value: unknown): value is TInteger; +/** Returns true if the given schema is TProperties */ +export declare function IsProperties(value: unknown): value is TProperties; +/** Returns true if the given value is TIntersect */ +export declare function IsIntersect(value: unknown): value is TIntersect; +/** Returns true if the given value is TIterator */ +export declare function IsIterator(value: unknown): value is TIterator; +/** Returns true if the given value is a TKind with the given name. */ +export declare function IsKindOf(value: unknown, kind: T): value is Record & { + [Kind]: T; +}; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteralString(value: unknown): value is TLiteral; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteralNumber(value: unknown): value is TLiteral; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteralBoolean(value: unknown): value is TLiteral; +/** Returns true if the given value is TLiteral */ +export declare function IsLiteral(value: unknown): value is TLiteral; +/** Returns true if the given value is a TLiteralValue */ +export declare function IsLiteralValue(value: unknown): value is TLiteralValue; +/** Returns true if the given value is a TMappedKey */ +export declare function IsMappedKey(value: unknown): value is TMappedKey; +/** Returns true if the given value is TMappedResult */ +export declare function IsMappedResult(value: unknown): value is TMappedResult; +/** Returns true if the given value is TNever */ +export declare function IsNever(value: unknown): value is TNever; +/** Returns true if the given value is TNot */ +export declare function IsNot(value: unknown): value is TNot; +/** Returns true if the given value is TNull */ +export declare function IsNull(value: unknown): value is TNull; +/** Returns true if the given value is TNumber */ +export declare function IsNumber(value: unknown): value is TNumber; +/** Returns true if the given value is TObject */ +export declare function IsObject(value: unknown): value is TObject; +/** Returns true if the given value is TPromise */ +export declare function IsPromise(value: unknown): value is TPromise; +/** Returns true if the given value is TRecord */ +export declare function IsRecord(value: unknown): value is TRecord; +/** Returns true if this value is TRecursive */ +export declare function IsRecursive(value: unknown): value is { + [Hint]: 'Recursive'; +}; +/** Returns true if the given value is TRef */ +export declare function IsRef(value: unknown): value is TRef; +/** Returns true if the given value is TRegExp */ +export declare function IsRegExp(value: unknown): value is TRegExp; +/** Returns true if the given value is TString */ +export declare function IsString(value: unknown): value is TString; +/** Returns true if the given value is TSymbol */ +export declare function IsSymbol(value: unknown): value is TSymbol; +/** Returns true if the given value is TTemplateLiteral */ +export declare function IsTemplateLiteral(value: unknown): value is TTemplateLiteral; +/** Returns true if the given value is TThis */ +export declare function IsThis(value: unknown): value is TThis; +/** Returns true of this value is TTransform */ +export declare function IsTransform(value: unknown): value is { + [TransformKind]: TransformOptions; +}; +/** Returns true if the given value is TTuple */ +export declare function IsTuple(value: unknown): value is TTuple; +/** Returns true if the given value is TUndefined */ +export declare function IsUndefined(value: unknown): value is TUndefined; +/** Returns true if the given value is TUnion[]> */ +export declare function IsUnionLiteral(value: unknown): value is TUnion; +/** Returns true if the given value is TUnion */ +export declare function IsUnion(value: unknown): value is TUnion; +/** Returns true if the given value is TUint8Array */ +export declare function IsUint8Array(value: unknown): value is TUint8Array; +/** Returns true if the given value is TUnknown */ +export declare function IsUnknown(value: unknown): value is TUnknown; +/** Returns true if the given value is a raw TUnsafe */ +export declare function IsUnsafe(value: unknown): value is TUnsafe; +/** Returns true if the given value is TVoid */ +export declare function IsVoid(value: unknown): value is TVoid; +/** Returns true if the given value is TKind */ +export declare function IsKind(value: unknown): value is Record & { + [Kind]: string; +}; +/** Returns true if the given value is TSchema */ +export declare function IsSchema(value: unknown): value is TSchema; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs new file mode 100644 index 0000000..5ba3bc2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs @@ -0,0 +1,509 @@ +import * as ValueGuard from './value.mjs'; +import { Kind, Hint, TransformKind, ReadonlyKind, OptionalKind } from '../symbols/index.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +export class TypeGuardUnknownTypeError extends TypeBoxError { +} +const KnownTypes = [ + 'Argument', + 'Any', + 'Array', + 'AsyncIterator', + 'BigInt', + 'Boolean', + 'Computed', + 'Constructor', + 'Date', + 'Enum', + 'Function', + 'Integer', + 'Intersect', + 'Iterator', + 'Literal', + 'MappedKey', + 'MappedResult', + 'Not', + 'Null', + 'Number', + 'Object', + 'Promise', + 'Record', + 'Ref', + 'RegExp', + 'String', + 'Symbol', + 'TemplateLiteral', + 'This', + 'Tuple', + 'Undefined', + 'Union', + 'Uint8Array', + 'Unknown', + 'Void', +]; +function IsPattern(value) { + try { + new RegExp(value); + return true; + } + catch { + return false; + } +} +function IsControlCharacterFree(value) { + if (!ValueGuard.IsString(value)) + return false; + for (let i = 0; i < value.length; i++) { + const code = value.charCodeAt(i); + if ((code >= 7 && code <= 13) || code === 27 || code === 127) { + return false; + } + } + return true; +} +function IsAdditionalProperties(value) { + return IsOptionalBoolean(value) || IsSchema(value); +} +function IsOptionalBigInt(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsBigInt(value); +} +function IsOptionalNumber(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsNumber(value); +} +function IsOptionalBoolean(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsBoolean(value); +} +function IsOptionalString(value) { + return ValueGuard.IsUndefined(value) || ValueGuard.IsString(value); +} +function IsOptionalPattern(value) { + return ValueGuard.IsUndefined(value) || (ValueGuard.IsString(value) && IsControlCharacterFree(value) && IsPattern(value)); +} +function IsOptionalFormat(value) { + return ValueGuard.IsUndefined(value) || (ValueGuard.IsString(value) && IsControlCharacterFree(value)); +} +function IsOptionalSchema(value) { + return ValueGuard.IsUndefined(value) || IsSchema(value); +} +// ------------------------------------------------------------------ +// Modifiers +// ------------------------------------------------------------------ +/** Returns true if this value has a Readonly symbol */ +export function IsReadonly(value) { + return ValueGuard.IsObject(value) && value[ReadonlyKind] === 'Readonly'; +} +/** Returns true if this value has a Optional symbol */ +export function IsOptional(value) { + return ValueGuard.IsObject(value) && value[OptionalKind] === 'Optional'; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +/** Returns true if the given value is TAny */ +export function IsAny(value) { + // prettier-ignore + return (IsKindOf(value, 'Any') && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TArgument */ +export function IsArgument(value) { + // prettier-ignore + return (IsKindOf(value, 'Argument') && + ValueGuard.IsNumber(value.index)); +} +/** Returns true if the given value is TArray */ +export function IsArray(value) { + return (IsKindOf(value, 'Array') && + value.type === 'array' && + IsOptionalString(value.$id) && + IsSchema(value.items) && + IsOptionalNumber(value.minItems) && + IsOptionalNumber(value.maxItems) && + IsOptionalBoolean(value.uniqueItems) && + IsOptionalSchema(value.contains) && + IsOptionalNumber(value.minContains) && + IsOptionalNumber(value.maxContains)); +} +/** Returns true if the given value is TAsyncIterator */ +export function IsAsyncIterator(value) { + // prettier-ignore + return (IsKindOf(value, 'AsyncIterator') && + value.type === 'AsyncIterator' && + IsOptionalString(value.$id) && + IsSchema(value.items)); +} +/** Returns true if the given value is TBigInt */ +export function IsBigInt(value) { + // prettier-ignore + return (IsKindOf(value, 'BigInt') && + value.type === 'bigint' && + IsOptionalString(value.$id) && + IsOptionalBigInt(value.exclusiveMaximum) && + IsOptionalBigInt(value.exclusiveMinimum) && + IsOptionalBigInt(value.maximum) && + IsOptionalBigInt(value.minimum) && + IsOptionalBigInt(value.multipleOf)); +} +/** Returns true if the given value is TBoolean */ +export function IsBoolean(value) { + // prettier-ignore + return (IsKindOf(value, 'Boolean') && + value.type === 'boolean' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TComputed */ +export function IsComputed(value) { + // prettier-ignore + return (IsKindOf(value, 'Computed') && + ValueGuard.IsString(value.target) && + ValueGuard.IsArray(value.parameters) && + value.parameters.every((schema) => IsSchema(schema))); +} +/** Returns true if the given value is TConstructor */ +export function IsConstructor(value) { + // prettier-ignore + return (IsKindOf(value, 'Constructor') && + value.type === 'Constructor' && + IsOptionalString(value.$id) && + ValueGuard.IsArray(value.parameters) && + value.parameters.every(schema => IsSchema(schema)) && + IsSchema(value.returns)); +} +/** Returns true if the given value is TDate */ +export function IsDate(value) { + return (IsKindOf(value, 'Date') && + value.type === 'Date' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.exclusiveMaximumTimestamp) && + IsOptionalNumber(value.exclusiveMinimumTimestamp) && + IsOptionalNumber(value.maximumTimestamp) && + IsOptionalNumber(value.minimumTimestamp) && + IsOptionalNumber(value.multipleOfTimestamp)); +} +/** Returns true if the given value is TFunction */ +export function IsFunction(value) { + // prettier-ignore + return (IsKindOf(value, 'Function') && + value.type === 'Function' && + IsOptionalString(value.$id) && + ValueGuard.IsArray(value.parameters) && + value.parameters.every(schema => IsSchema(schema)) && + IsSchema(value.returns)); +} +/** Returns true if the given value is TImport */ +export function IsImport(value) { + // prettier-ignore + return (IsKindOf(value, 'Import') && + ValueGuard.HasPropertyKey(value, '$defs') && + ValueGuard.IsObject(value.$defs) && + IsProperties(value.$defs) && + ValueGuard.HasPropertyKey(value, '$ref') && + ValueGuard.IsString(value.$ref) && + value.$ref in value.$defs // required + ); +} +/** Returns true if the given value is TInteger */ +export function IsInteger(value) { + return (IsKindOf(value, 'Integer') && + value.type === 'integer' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.exclusiveMaximum) && + IsOptionalNumber(value.exclusiveMinimum) && + IsOptionalNumber(value.maximum) && + IsOptionalNumber(value.minimum) && + IsOptionalNumber(value.multipleOf)); +} +/** Returns true if the given schema is TProperties */ +export function IsProperties(value) { + // prettier-ignore + return (ValueGuard.IsObject(value) && + Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema(schema))); +} +/** Returns true if the given value is TIntersect */ +export function IsIntersect(value) { + // prettier-ignore + return (IsKindOf(value, 'Intersect') && + (ValueGuard.IsString(value.type) && value.type !== 'object' ? false : true) && + ValueGuard.IsArray(value.allOf) && + value.allOf.every(schema => IsSchema(schema) && !IsTransform(schema)) && + IsOptionalString(value.type) && + (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TIterator */ +export function IsIterator(value) { + // prettier-ignore + return (IsKindOf(value, 'Iterator') && + value.type === 'Iterator' && + IsOptionalString(value.$id) && + IsSchema(value.items)); +} +/** Returns true if the given value is a TKind with the given name. */ +export function IsKindOf(value, kind) { + return ValueGuard.IsObject(value) && Kind in value && value[Kind] === kind; +} +/** Returns true if the given value is TLiteral */ +export function IsLiteralString(value) { + return IsLiteral(value) && ValueGuard.IsString(value.const); +} +/** Returns true if the given value is TLiteral */ +export function IsLiteralNumber(value) { + return IsLiteral(value) && ValueGuard.IsNumber(value.const); +} +/** Returns true if the given value is TLiteral */ +export function IsLiteralBoolean(value) { + return IsLiteral(value) && ValueGuard.IsBoolean(value.const); +} +/** Returns true if the given value is TLiteral */ +export function IsLiteral(value) { + // prettier-ignore + return (IsKindOf(value, 'Literal') && + IsOptionalString(value.$id) && IsLiteralValue(value.const)); +} +/** Returns true if the given value is a TLiteralValue */ +export function IsLiteralValue(value) { + return ValueGuard.IsBoolean(value) || ValueGuard.IsNumber(value) || ValueGuard.IsString(value); +} +/** Returns true if the given value is a TMappedKey */ +export function IsMappedKey(value) { + // prettier-ignore + return (IsKindOf(value, 'MappedKey') && + ValueGuard.IsArray(value.keys) && + value.keys.every(key => ValueGuard.IsNumber(key) || ValueGuard.IsString(key))); +} +/** Returns true if the given value is TMappedResult */ +export function IsMappedResult(value) { + // prettier-ignore + return (IsKindOf(value, 'MappedResult') && + IsProperties(value.properties)); +} +/** Returns true if the given value is TNever */ +export function IsNever(value) { + // prettier-ignore + return (IsKindOf(value, 'Never') && + ValueGuard.IsObject(value.not) && + Object.getOwnPropertyNames(value.not).length === 0); +} +/** Returns true if the given value is TNot */ +export function IsNot(value) { + // prettier-ignore + return (IsKindOf(value, 'Not') && + IsSchema(value.not)); +} +/** Returns true if the given value is TNull */ +export function IsNull(value) { + // prettier-ignore + return (IsKindOf(value, 'Null') && + value.type === 'null' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TNumber */ +export function IsNumber(value) { + return (IsKindOf(value, 'Number') && + value.type === 'number' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.exclusiveMaximum) && + IsOptionalNumber(value.exclusiveMinimum) && + IsOptionalNumber(value.maximum) && + IsOptionalNumber(value.minimum) && + IsOptionalNumber(value.multipleOf)); +} +/** Returns true if the given value is TObject */ +export function IsObject(value) { + // prettier-ignore + return (IsKindOf(value, 'Object') && + value.type === 'object' && + IsOptionalString(value.$id) && + IsProperties(value.properties) && + IsAdditionalProperties(value.additionalProperties) && + IsOptionalNumber(value.minProperties) && + IsOptionalNumber(value.maxProperties)); +} +/** Returns true if the given value is TPromise */ +export function IsPromise(value) { + // prettier-ignore + return (IsKindOf(value, 'Promise') && + value.type === 'Promise' && + IsOptionalString(value.$id) && + IsSchema(value.item)); +} +/** Returns true if the given value is TRecord */ +export function IsRecord(value) { + // prettier-ignore + return (IsKindOf(value, 'Record') && + value.type === 'object' && + IsOptionalString(value.$id) && + IsAdditionalProperties(value.additionalProperties) && + ValueGuard.IsObject(value.patternProperties) && + ((schema) => { + const keys = Object.getOwnPropertyNames(schema.patternProperties); + return (keys.length === 1 && + IsPattern(keys[0]) && + ValueGuard.IsObject(schema.patternProperties) && + IsSchema(schema.patternProperties[keys[0]])); + })(value)); +} +/** Returns true if this value is TRecursive */ +export function IsRecursive(value) { + return ValueGuard.IsObject(value) && Hint in value && value[Hint] === 'Recursive'; +} +/** Returns true if the given value is TRef */ +export function IsRef(value) { + // prettier-ignore + return (IsKindOf(value, 'Ref') && + IsOptionalString(value.$id) && + ValueGuard.IsString(value.$ref)); +} +/** Returns true if the given value is TRegExp */ +export function IsRegExp(value) { + // prettier-ignore + return (IsKindOf(value, 'RegExp') && + IsOptionalString(value.$id) && + ValueGuard.IsString(value.source) && + ValueGuard.IsString(value.flags) && + IsOptionalNumber(value.maxLength) && + IsOptionalNumber(value.minLength)); +} +/** Returns true if the given value is TString */ +export function IsString(value) { + // prettier-ignore + return (IsKindOf(value, 'String') && + value.type === 'string' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.minLength) && + IsOptionalNumber(value.maxLength) && + IsOptionalPattern(value.pattern) && + IsOptionalFormat(value.format)); +} +/** Returns true if the given value is TSymbol */ +export function IsSymbol(value) { + // prettier-ignore + return (IsKindOf(value, 'Symbol') && + value.type === 'symbol' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TTemplateLiteral */ +export function IsTemplateLiteral(value) { + // prettier-ignore + return (IsKindOf(value, 'TemplateLiteral') && + value.type === 'string' && + ValueGuard.IsString(value.pattern) && + value.pattern[0] === '^' && + value.pattern[value.pattern.length - 1] === '$'); +} +/** Returns true if the given value is TThis */ +export function IsThis(value) { + // prettier-ignore + return (IsKindOf(value, 'This') && + IsOptionalString(value.$id) && + ValueGuard.IsString(value.$ref)); +} +/** Returns true of this value is TTransform */ +export function IsTransform(value) { + return ValueGuard.IsObject(value) && TransformKind in value; +} +/** Returns true if the given value is TTuple */ +export function IsTuple(value) { + // prettier-ignore + return (IsKindOf(value, 'Tuple') && + value.type === 'array' && + IsOptionalString(value.$id) && + ValueGuard.IsNumber(value.minItems) && + ValueGuard.IsNumber(value.maxItems) && + value.minItems === value.maxItems && + (( // empty + ValueGuard.IsUndefined(value.items) && + ValueGuard.IsUndefined(value.additionalItems) && + value.minItems === 0) || (ValueGuard.IsArray(value.items) && + value.items.every(schema => IsSchema(schema))))); +} +/** Returns true if the given value is TUndefined */ +export function IsUndefined(value) { + // prettier-ignore + return (IsKindOf(value, 'Undefined') && + value.type === 'undefined' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TUnion[]> */ +export function IsUnionLiteral(value) { + return IsUnion(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema)); +} +/** Returns true if the given value is TUnion */ +export function IsUnion(value) { + // prettier-ignore + return (IsKindOf(value, 'Union') && + IsOptionalString(value.$id) && + ValueGuard.IsObject(value) && + ValueGuard.IsArray(value.anyOf) && + value.anyOf.every(schema => IsSchema(schema))); +} +/** Returns true if the given value is TUint8Array */ +export function IsUint8Array(value) { + // prettier-ignore + return (IsKindOf(value, 'Uint8Array') && + value.type === 'Uint8Array' && + IsOptionalString(value.$id) && + IsOptionalNumber(value.minByteLength) && + IsOptionalNumber(value.maxByteLength)); +} +/** Returns true if the given value is TUnknown */ +export function IsUnknown(value) { + // prettier-ignore + return (IsKindOf(value, 'Unknown') && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is a raw TUnsafe */ +export function IsUnsafe(value) { + return IsKindOf(value, 'Unsafe'); +} +/** Returns true if the given value is TVoid */ +export function IsVoid(value) { + // prettier-ignore + return (IsKindOf(value, 'Void') && + value.type === 'void' && + IsOptionalString(value.$id)); +} +/** Returns true if the given value is TKind */ +export function IsKind(value) { + return ValueGuard.IsObject(value) && Kind in value && ValueGuard.IsString(value[Kind]) && !KnownTypes.includes(value[Kind]); +} +/** Returns true if the given value is TSchema */ +export function IsSchema(value) { + // prettier-ignore + return (ValueGuard.IsObject(value)) && (IsAny(value) || + IsArgument(value) || + IsArray(value) || + IsBoolean(value) || + IsBigInt(value) || + IsAsyncIterator(value) || + IsComputed(value) || + IsConstructor(value) || + IsDate(value) || + IsFunction(value) || + IsInteger(value) || + IsIntersect(value) || + IsIterator(value) || + IsLiteral(value) || + IsMappedKey(value) || + IsMappedResult(value) || + IsNever(value) || + IsNot(value) || + IsNull(value) || + IsNumber(value) || + IsObject(value) || + IsPromise(value) || + IsRecord(value) || + IsRef(value) || + IsRegExp(value) || + IsString(value) || + IsSymbol(value) || + IsTemplateLiteral(value) || + IsThis(value) || + IsTuple(value) || + IsUndefined(value) || + IsUnion(value) || + IsUint8Array(value) || + IsUnknown(value) || + IsUnsafe(value) || + IsVoid(value) || + IsKind(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.d.mts new file mode 100644 index 0000000..f3d18d1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.d.mts @@ -0,0 +1,34 @@ +/** Returns true if this value has this property key */ +export declare function HasPropertyKey(value: Record, key: K): value is Record & { + [_ in K]: unknown; +}; +/** Returns true if this value is an async iterator */ +export declare function IsAsyncIterator(value: unknown): value is AsyncIterableIterator; +/** Returns true if this value is an array */ +export declare function IsArray(value: unknown): value is unknown[]; +/** Returns true if this value is bigint */ +export declare function IsBigInt(value: unknown): value is bigint; +/** Returns true if this value is a boolean */ +export declare function IsBoolean(value: unknown): value is boolean; +/** Returns true if this value is a Date object */ +export declare function IsDate(value: unknown): value is Date; +/** Returns true if this value is a function */ +export declare function IsFunction(value: unknown): value is Function; +/** Returns true if this value is an iterator */ +export declare function IsIterator(value: unknown): value is IterableIterator; +/** Returns true if this value is null */ +export declare function IsNull(value: unknown): value is null; +/** Returns true if this value is number */ +export declare function IsNumber(value: unknown): value is number; +/** Returns true if this value is an object */ +export declare function IsObject(value: unknown): value is Record; +/** Returns true if this value is RegExp */ +export declare function IsRegExp(value: unknown): value is RegExp; +/** Returns true if this value is string */ +export declare function IsString(value: unknown): value is string; +/** Returns true if this value is symbol */ +export declare function IsSymbol(value: unknown): value is symbol; +/** Returns true if this value is a Uint8Array */ +export declare function IsUint8Array(value: unknown): value is Uint8Array; +/** Returns true if this value is undefined */ +export declare function IsUndefined(value: unknown): value is undefined; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs new file mode 100644 index 0000000..dad437e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs @@ -0,0 +1,70 @@ +// -------------------------------------------------------------------------- +// PropertyKey +// -------------------------------------------------------------------------- +/** Returns true if this value has this property key */ +export function HasPropertyKey(value, key) { + return key in value; +} +// -------------------------------------------------------------------------- +// Object Instances +// -------------------------------------------------------------------------- +/** Returns true if this value is an async iterator */ +export function IsAsyncIterator(value) { + return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value; +} +/** Returns true if this value is an array */ +export function IsArray(value) { + return Array.isArray(value); +} +/** Returns true if this value is bigint */ +export function IsBigInt(value) { + return typeof value === 'bigint'; +} +/** Returns true if this value is a boolean */ +export function IsBoolean(value) { + return typeof value === 'boolean'; +} +/** Returns true if this value is a Date object */ +export function IsDate(value) { + return value instanceof globalThis.Date; +} +/** Returns true if this value is a function */ +export function IsFunction(value) { + return typeof value === 'function'; +} +/** Returns true if this value is an iterator */ +export function IsIterator(value) { + return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value; +} +/** Returns true if this value is null */ +export function IsNull(value) { + return value === null; +} +/** Returns true if this value is number */ +export function IsNumber(value) { + return typeof value === 'number'; +} +/** Returns true if this value is an object */ +export function IsObject(value) { + return typeof value === 'object' && value !== null; +} +/** Returns true if this value is RegExp */ +export function IsRegExp(value) { + return value instanceof globalThis.RegExp; +} +/** Returns true if this value is string */ +export function IsString(value) { + return typeof value === 'string'; +} +/** Returns true if this value is symbol */ +export function IsSymbol(value) { + return typeof value === 'symbol'; +} +/** Returns true if this value is a Uint8Array */ +export function IsUint8Array(value) { + return value instanceof globalThis.Uint8Array; +} +/** Returns true if this value is undefined */ +export function IsUndefined(value) { + return value === undefined; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.d.mts new file mode 100644 index 0000000..7c9e3f7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.d.mts @@ -0,0 +1,42 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import type { TNever } from '../never/index.mjs'; +export type TupleToIntersect = T extends [infer I] ? I : T extends [infer I, ...infer R] ? I & TupleToIntersect : never; +export type TupleToUnion = { + [K in keyof T]: T[K]; +}[number]; +export type UnionToIntersect = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never; +export type UnionLast = UnionToIntersect 0 : never> extends (x: infer L) => 0 ? L : never; +export type UnionToTuple> = [U] extends [never] ? Acc : UnionToTuple, [Extract, ...Acc]>; +export type Trim = T extends `${' '}${infer U}` ? Trim : T extends `${infer U}${' '}` ? Trim : T; +export type Assert = T extends E ? T : never; +export type Evaluate = T extends infer O ? { + [K in keyof O]: O[K]; +} : never; +export type Ensure = T extends infer U ? U : never; +export type EmptyString = ''; +export type ZeroString = '0'; +type IncrementBase = { + m: '9'; + t: '01'; + '0': '1'; + '1': '2'; + '2': '3'; + '3': '4'; + '4': '5'; + '5': '6'; + '6': '7'; + '7': '8'; + '8': '9'; + '9': '0'; +}; +type IncrementTake = IncrementBase[T]; +type IncrementStep = T extends IncrementBase['m'] ? IncrementBase['t'] : T extends `${infer L extends keyof IncrementBase}${infer R}` ? L extends IncrementBase['m'] ? `${IncrementTake}${IncrementStep}` : `${IncrementTake}${R}` : never; +type IncrementReverse = T extends `${infer L}${infer R}` ? `${IncrementReverse}${L}` : T; +export type TIncrement = IncrementReverse>>; +/** Increments the given string value + 1 */ +export declare function Increment(T: T): TIncrement; +export type AssertProperties = T extends TProperties ? T : TProperties; +export type AssertRest = T extends E ? T : []; +export type AssertType = T extends E ? T : TNever; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.mjs new file mode 100644 index 0000000..90ebc48 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/helpers.mjs @@ -0,0 +1,4 @@ +/** Increments the given string value + 1 */ +export function Increment(T) { + return (parseInt(T) + 1).toString(); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.d.mts new file mode 100644 index 0000000..c5cfad8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.d.mts @@ -0,0 +1 @@ +export * from './helpers.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.mjs new file mode 100644 index 0000000..c5cfad8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/helpers/index.mjs @@ -0,0 +1 @@ +export * from './helpers.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/index.d.mts new file mode 100644 index 0000000..485eace --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/index.d.mts @@ -0,0 +1,71 @@ +export * from './any/index.mjs'; +export * from './argument/index.mjs'; +export * from './array/index.mjs'; +export * from './async-iterator/index.mjs'; +export * from './awaited/index.mjs'; +export * from './bigint/index.mjs'; +export * from './boolean/index.mjs'; +export * from './clone/index.mjs'; +export * from './composite/index.mjs'; +export * from './const/index.mjs'; +export * from './constructor/index.mjs'; +export * from './constructor-parameters/index.mjs'; +export * from './date/index.mjs'; +export * from './discard/index.mjs'; +export * from './enum/index.mjs'; +export * from './error/index.mjs'; +export * from './exclude/index.mjs'; +export * from './extends/index.mjs'; +export * from './extract/index.mjs'; +export * from './function/index.mjs'; +export * from './guard/index.mjs'; +export * from './helpers/index.mjs'; +export * from './indexed/index.mjs'; +export * from './instance-type/index.mjs'; +export * from './instantiate/index.mjs'; +export * from './integer/index.mjs'; +export * from './intersect/index.mjs'; +export * from './intrinsic/index.mjs'; +export * from './iterator/index.mjs'; +export * from './keyof/index.mjs'; +export * from './literal/index.mjs'; +export * from './mapped/index.mjs'; +export * from './module/index.mjs'; +export * from './never/index.mjs'; +export * from './not/index.mjs'; +export * from './null/index.mjs'; +export * from './number/index.mjs'; +export * from './object/index.mjs'; +export * from './omit/index.mjs'; +export * from './optional/index.mjs'; +export * from './parameters/index.mjs'; +export * from './partial/index.mjs'; +export * from './patterns/index.mjs'; +export * from './pick/index.mjs'; +export * from './promise/index.mjs'; +export * from './readonly/index.mjs'; +export * from './readonly-optional/index.mjs'; +export * from './record/index.mjs'; +export * from './recursive/index.mjs'; +export * from './ref/index.mjs'; +export * from './regexp/index.mjs'; +export * from './registry/index.mjs'; +export * from './required/index.mjs'; +export * from './rest/index.mjs'; +export * from './return-type/index.mjs'; +export * from './schema/index.mjs'; +export * from './sets/index.mjs'; +export * from './static/index.mjs'; +export * from './string/index.mjs'; +export * from './symbol/index.mjs'; +export * from './symbols/index.mjs'; +export * from './template-literal/index.mjs'; +export * from './transform/index.mjs'; +export * from './tuple/index.mjs'; +export * from './type/index.mjs'; +export * from './uint8array/index.mjs'; +export * from './undefined/index.mjs'; +export * from './union/index.mjs'; +export * from './unknown/index.mjs'; +export * from './unsafe/index.mjs'; +export * from './void/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/index.mjs new file mode 100644 index 0000000..485eace --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/index.mjs @@ -0,0 +1,71 @@ +export * from './any/index.mjs'; +export * from './argument/index.mjs'; +export * from './array/index.mjs'; +export * from './async-iterator/index.mjs'; +export * from './awaited/index.mjs'; +export * from './bigint/index.mjs'; +export * from './boolean/index.mjs'; +export * from './clone/index.mjs'; +export * from './composite/index.mjs'; +export * from './const/index.mjs'; +export * from './constructor/index.mjs'; +export * from './constructor-parameters/index.mjs'; +export * from './date/index.mjs'; +export * from './discard/index.mjs'; +export * from './enum/index.mjs'; +export * from './error/index.mjs'; +export * from './exclude/index.mjs'; +export * from './extends/index.mjs'; +export * from './extract/index.mjs'; +export * from './function/index.mjs'; +export * from './guard/index.mjs'; +export * from './helpers/index.mjs'; +export * from './indexed/index.mjs'; +export * from './instance-type/index.mjs'; +export * from './instantiate/index.mjs'; +export * from './integer/index.mjs'; +export * from './intersect/index.mjs'; +export * from './intrinsic/index.mjs'; +export * from './iterator/index.mjs'; +export * from './keyof/index.mjs'; +export * from './literal/index.mjs'; +export * from './mapped/index.mjs'; +export * from './module/index.mjs'; +export * from './never/index.mjs'; +export * from './not/index.mjs'; +export * from './null/index.mjs'; +export * from './number/index.mjs'; +export * from './object/index.mjs'; +export * from './omit/index.mjs'; +export * from './optional/index.mjs'; +export * from './parameters/index.mjs'; +export * from './partial/index.mjs'; +export * from './patterns/index.mjs'; +export * from './pick/index.mjs'; +export * from './promise/index.mjs'; +export * from './readonly/index.mjs'; +export * from './readonly-optional/index.mjs'; +export * from './record/index.mjs'; +export * from './recursive/index.mjs'; +export * from './ref/index.mjs'; +export * from './regexp/index.mjs'; +export * from './registry/index.mjs'; +export * from './required/index.mjs'; +export * from './rest/index.mjs'; +export * from './return-type/index.mjs'; +export * from './schema/index.mjs'; +export * from './sets/index.mjs'; +export * from './static/index.mjs'; +export * from './string/index.mjs'; +export * from './symbol/index.mjs'; +export * from './symbols/index.mjs'; +export * from './template-literal/index.mjs'; +export * from './transform/index.mjs'; +export * from './tuple/index.mjs'; +export * from './type/index.mjs'; +export * from './uint8array/index.mjs'; +export * from './undefined/index.mjs'; +export * from './union/index.mjs'; +export * from './unknown/index.mjs'; +export * from './unsafe/index.mjs'; +export * from './void/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.d.mts new file mode 100644 index 0000000..9be97fa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.d.mts @@ -0,0 +1,4 @@ +export * from './indexed-from-mapped-key.mjs'; +export * from './indexed-from-mapped-result.mjs'; +export * from './indexed-property-keys.mjs'; +export * from './indexed.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.mjs new file mode 100644 index 0000000..9be97fa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/index.mjs @@ -0,0 +1,4 @@ +export * from './indexed-from-mapped-key.mjs'; +export * from './indexed-from-mapped-result.mjs'; +export * from './indexed-property-keys.mjs'; +export * from './indexed.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.d.mts new file mode 100644 index 0000000..8431b12 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.d.mts @@ -0,0 +1,13 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Ensure, Evaluate } from '../helpers/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TIndex } from './indexed.mjs'; +import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs'; +type TMappedIndexPropertyKey = { + [_ in Key]: TIndex; +}; +type TMappedIndexPropertyKeys = (PropertyKeys extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? TMappedIndexPropertyKeys> : Result); +type TMappedIndexProperties = Evaluate>; +export type TIndexFromMappedKey> = (Ensure>); +export declare function IndexFromMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs new file mode 100644 index 0000000..e28850f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs @@ -0,0 +1,22 @@ +import { Index } from './indexed.mjs'; +import { MappedResult } from '../mapped/index.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function MappedIndexPropertyKey(type, key, options) { + return { [key]: Index(type, [key], Clone(options)) }; +} +// prettier-ignore +function MappedIndexPropertyKeys(type, propertyKeys, options) { + return propertyKeys.reduce((result, left) => { + return { ...result, ...MappedIndexPropertyKey(type, left, options) }; + }, {}); +} +// prettier-ignore +function MappedIndexProperties(type, mappedKey, options) { + return MappedIndexPropertyKeys(type, mappedKey.keys, options); +} +// prettier-ignore +export function IndexFromMappedKey(type, mappedKey, options) { + const properties = MappedIndexProperties(type, mappedKey, options); + return MappedResult(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.d.mts new file mode 100644 index 0000000..b8f5777 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.d.mts @@ -0,0 +1,12 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TIndexPropertyKeys } from './indexed-property-keys.mjs'; +import { type TIndex } from './index.mjs'; +type TFromProperties = ({ + [K2 in keyof Properties]: TIndex>; +}); +type TFromMappedResult = (TFromProperties); +export type TIndexFromMappedResult> = (TMappedResult); +export declare function IndexFromMappedResult>(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs new file mode 100644 index 0000000..0045a09 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs @@ -0,0 +1,20 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { IndexPropertyKeys } from './indexed-property-keys.mjs'; +import { Index } from './index.mjs'; +// prettier-ignore +function FromProperties(type, properties, options) { + const result = {}; + for (const K2 of Object.getOwnPropertyNames(properties)) { + result[K2] = Index(type, IndexPropertyKeys(properties[K2]), options); + } + return result; +} +// prettier-ignore +function FromMappedResult(type, mappedResult, options) { + return FromProperties(type, mappedResult.properties, options); +} +// prettier-ignore +export function IndexFromMappedResult(type, mappedResult, options) { + const properties = FromMappedResult(type, mappedResult, options); + return MappedResult(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.d.mts new file mode 100644 index 0000000..cf5240d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.d.mts @@ -0,0 +1,14 @@ +import { type TTemplateLiteralGenerate, type TTemplateLiteral } from '../template-literal/index.mjs'; +import type { TLiteral, TLiteralValue } from '../literal/index.mjs'; +import type { TInteger } from '../integer/index.mjs'; +import type { TNumber } from '../number/index.mjs'; +import type { TSchema } from '../schema/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +type TFromTemplateLiteral> = (Keys); +type TFromUnion = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromUnion]> : Result); +type TFromLiteral = (LiteralValue extends PropertyKey ? [`${LiteralValue}`] : []); +export type TIndexPropertyKeys = (Type extends TTemplateLiteral ? TFromTemplateLiteral : Type extends TUnion ? TFromUnion : Type extends TLiteral ? TFromLiteral : Type extends TNumber ? ['[number]'] : Type extends TInteger ? ['[number]'] : [ +]); +/** Returns a tuple of PropertyKeys derived from the given TSchema */ +export declare function IndexPropertyKeys(type: Type): TIndexPropertyKeys; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs new file mode 100644 index 0000000..9df4285 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs @@ -0,0 +1,32 @@ +import { TemplateLiteralGenerate } from '../template-literal/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsTemplateLiteral, IsUnion, IsLiteral, IsNumber, IsInteger } from '../guard/kind.mjs'; +// prettier-ignore +function FromTemplateLiteral(templateLiteral) { + const keys = TemplateLiteralGenerate(templateLiteral); + return keys.map(key => key.toString()); +} +// prettier-ignore +function FromUnion(types) { + const result = []; + for (const type of types) + result.push(...IndexPropertyKeys(type)); + return result; +} +// prettier-ignore +function FromLiteral(literalValue) { + return ([literalValue.toString()] // TS 5.4 observes TLiteralValue as not having a toString() + ); +} +/** Returns a tuple of PropertyKeys derived from the given TSchema */ +// prettier-ignore +export function IndexPropertyKeys(type) { + return [...new Set((IsTemplateLiteral(type) ? FromTemplateLiteral(type) : + IsUnion(type) ? FromUnion(type.anyOf) : + IsLiteral(type) ? FromLiteral(type.const) : + IsNumber(type) ? ['[number]'] : + IsInteger(type) ? ['[number]'] : + []))]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.d.mts new file mode 100644 index 0000000..65e8279 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.d.mts @@ -0,0 +1,52 @@ +import { type TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type Assert } from '../helpers/index.mjs'; +import { type TComputed } from '../computed/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TArray } from '../array/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs'; +import { type TObject, type TProperties } from '../object/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TRecursive } from '../recursive/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { type TIntersectEvaluated } from '../intersect/index.mjs'; +import { type TUnionEvaluated } from '../union/index.mjs'; +import { type TIndexPropertyKeys } from './indexed-property-keys.mjs'; +import { type TIndexFromMappedKey } from './indexed-from-mapped-key.mjs'; +import { type TIndexFromMappedResult } from './indexed-from-mapped-result.mjs'; +type TFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromRest, TSchema>]> : Result); +type TFromIntersectRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? TFromIntersectRest : TFromIntersectRest : Result); +type TFromIntersect = (TIntersectEvaluated>>); +type TFromUnionRest = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TNever ? [] : TFromUnionRest : Result; +type TFromUnion = (TUnionEvaluated>>); +type TFromTuple = (Key extends keyof Types ? Types[Key] : Key extends '[number]' ? TUnionEvaluated : TNever); +type TFromArray = (Key extends '[number]' ? Type : TNever); +type AssertPropertyKey = Assert; +type TFromProperty = (Key extends keyof Properties ? Properties[Key] : `${AssertPropertyKey}` extends `${AssertPropertyKey}` ? Properties[AssertPropertyKey] : TNever); +export type TIndexFromPropertyKey = (Type extends TRecursive ? TIndexFromPropertyKey : Type extends TIntersect ? TFromIntersect : Type extends TUnion ? TFromUnion : Type extends TTuple ? TFromTuple : Type extends TArray ? TFromArray : Type extends TObject ? TFromProperty : TNever); +export declare function IndexFromPropertyKey(type: Type, propertyKey: Key): TIndexFromPropertyKey; +export type TIndexFromPropertyKeys = (PropertyKeys extends [infer Left extends PropertyKey, ...infer Right extends PropertyKey[]] ? TIndexFromPropertyKeys, TSchema>]> : Result); +export declare function IndexFromPropertyKeys(type: Type, propertyKeys: [...PropertyKeys]): TIndexFromPropertyKeys; +type FromSchema = (TUnionEvaluated>); +declare function FromSchema(type: Type, propertyKeys: [...PropertyKeys]): FromSchema; +export type TIndexFromComputed = (TComputed<'Index', [Type, Key]>); +export declare function IndexFromComputed(type: Type, key: Key): TIndexFromComputed; +export type TIndex = (FromSchema); +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TIndexFromMappedKey; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index>(T: Type, K: Key, options?: SchemaOptions): TIndex; +/** `[Json]` Returns an Indexed property type for the given keys */ +export declare function Index(type: Type, propertyKeys: readonly [...PropertyKeys], options?: SchemaOptions): TIndex; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs new file mode 100644 index 0000000..caf86d9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs @@ -0,0 +1,91 @@ +import { CreateType } from '../create/type.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +import { Computed } from '../computed/index.mjs'; +import { Never } from '../never/index.mjs'; +import { IntersectEvaluated } from '../intersect/index.mjs'; +import { UnionEvaluated } from '../union/index.mjs'; +import { IndexPropertyKeys } from './indexed-property-keys.mjs'; +import { IndexFromMappedKey } from './indexed-from-mapped-key.mjs'; +import { IndexFromMappedResult } from './indexed-from-mapped-result.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsArray, IsIntersect, IsObject, IsMappedKey, IsMappedResult, IsNever, IsSchema, IsTuple, IsUnion, IsRef } from '../guard/kind.mjs'; +// prettier-ignore +function FromRest(types, key) { + return types.map(type => IndexFromPropertyKey(type, key)); +} +// prettier-ignore +function FromIntersectRest(types) { + return types.filter(type => !IsNever(type)); +} +// prettier-ignore +function FromIntersect(types, key) { + return (IntersectEvaluated(FromIntersectRest(FromRest(types, key)))); +} +// prettier-ignore +function FromUnionRest(types) { + return (types.some(L => IsNever(L)) + ? [] + : types); +} +// prettier-ignore +function FromUnion(types, key) { + return (UnionEvaluated(FromUnionRest(FromRest(types, key)))); +} +// prettier-ignore +function FromTuple(types, key) { + return (key in types ? types[key] : + key === '[number]' ? UnionEvaluated(types) : + Never()); +} +// prettier-ignore +function FromArray(type, key) { + return (key === '[number]' + ? type + : Never()); +} +// prettier-ignore +function FromProperty(properties, propertyKey) { + return (propertyKey in properties ? properties[propertyKey] : Never()); +} +// prettier-ignore +export function IndexFromPropertyKey(type, propertyKey) { + return (IsIntersect(type) ? FromIntersect(type.allOf, propertyKey) : + IsUnion(type) ? FromUnion(type.anyOf, propertyKey) : + IsTuple(type) ? FromTuple(type.items ?? [], propertyKey) : + IsArray(type) ? FromArray(type.items, propertyKey) : + IsObject(type) ? FromProperty(type.properties, propertyKey) : + Never()); +} +// prettier-ignore +export function IndexFromPropertyKeys(type, propertyKeys) { + return propertyKeys.map(propertyKey => IndexFromPropertyKey(type, propertyKey)); +} +// prettier-ignore +function FromSchema(type, propertyKeys) { + return (UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys))); +} +// prettier-ignore +export function IndexFromComputed(type, key) { + return Computed('Index', [type, key]); +} +/** `[Json]` Returns an Indexed property type for the given keys */ +export function Index(type, key, options) { + // computed-type + if (IsRef(type) || IsRef(key)) { + const error = `Index types using Ref parameters require both Type and Key to be of TSchema`; + if (!IsSchema(type) || !IsSchema(key)) + throw new TypeBoxError(error); + return Computed('Index', [type, key]); + } + // mapped-types + if (IsMappedResult(key)) + return IndexFromMappedResult(type, key, options); + if (IsMappedKey(key)) + return IndexFromMappedKey(type, key, options); + // prettier-ignore + return CreateType(IsSchema(key) + ? FromSchema(type, IndexPropertyKeys(key)) + : FromSchema(type, key), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.d.mts new file mode 100644 index 0000000..90bd2b9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.d.mts @@ -0,0 +1 @@ +export * from './instance-type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.mjs new file mode 100644 index 0000000..90bd2b9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/index.mjs @@ -0,0 +1 @@ +export * from './instance-type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.d.mts new file mode 100644 index 0000000..f2d87c9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.d.mts @@ -0,0 +1,6 @@ +import { type TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TConstructor } from '../constructor/index.mjs'; +import { type TNever } from '../never/index.mjs'; +export type TInstanceType ? InstanceType : TNever> = Result; +/** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ +export declare function InstanceType(schema: Type, options?: SchemaOptions): TInstanceType; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs new file mode 100644 index 0000000..a89c3d1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs @@ -0,0 +1,7 @@ +import { CreateType } from '../create/type.mjs'; +import { Never } from '../never/index.mjs'; +import * as KindGuard from '../guard/kind.mjs'; +/** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ +export function InstanceType(schema, options) { + return (KindGuard.IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.d.mts new file mode 100644 index 0000000..51d5331 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.d.mts @@ -0,0 +1 @@ +export * from './instantiate.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.mjs new file mode 100644 index 0000000..51d5331 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/index.mjs @@ -0,0 +1 @@ +export * from './instantiate.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.d.mts new file mode 100644 index 0000000..4a223a4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.d.mts @@ -0,0 +1,50 @@ +import { type TSchema } from '../schema/index.mjs'; +import { type TArgument } from '../argument/index.mjs'; +import { type TUnknown } from '../unknown/index.mjs'; +import { type TReadonlyOptional } from '../readonly-optional/index.mjs'; +import { type TReadonly } from '../readonly/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +import { type TConstructor } from '../constructor/index.mjs'; +import { type TFunction } from '../function/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { type TArray } from '../array/index.mjs'; +import { type TAsyncIterator } from '../async-iterator/index.mjs'; +import { type TIterator } from '../iterator/index.mjs'; +import { type TPromise } from '../promise/index.mjs'; +import { type TObject, type TProperties } from '../object/index.mjs'; +import { type TRecordOrObject, type TRecord } from '../record/index.mjs'; +type TFromConstructor, TFromType>> = Result; +type TFromFunction, TFromType>> = Result; +type TFromIntersect>> = Result; +type TFromUnion>> = Result; +type TFromTuple>> = Result; +type TFromArray>> = Result; +type TFromAsyncIterator>> = Result; +type TFromIterator>> = Result; +type TFromPromise>> = Result; +type TFromObject, Result extends TSchema = TObject> = Result; +type TFromRecord, MappedValue extends TSchema = TFromType, Result extends TSchema = TRecordOrObject> = Result; +type TFromArgument = Result; +type TFromProperty ? true : false, IsOptional extends boolean = Type extends TOptional ? true : false, Mapped extends TSchema = TFromType, Result extends TSchema = ([ + IsReadonly, + IsOptional +] extends [true, true] ? TReadonlyOptional : [ + IsReadonly, + IsOptional +] extends [true, false] ? TReadonly : [ + IsReadonly, + IsOptional +] extends [false, true] ? TOptional : Mapped)> = Result; +type TFromProperties; +}> = Result; +export type TFromTypes = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromTypes]> : Result); +export declare function FromTypes(args: [...Args], types: [...Types]): TFromTypes; +export type TFromType = (Type extends TConstructor ? TFromConstructor : Type extends TFunction ? TFromFunction : Type extends TIntersect ? TFromIntersect : Type extends TUnion ? TFromUnion : Type extends TTuple ? TFromTuple : Type extends TArray ? TFromArray : Type extends TAsyncIterator ? TFromAsyncIterator : Type extends TIterator ? TFromIterator : Type extends TPromise ? TFromPromise : Type extends TObject ? TFromObject : Type extends TRecord ? TFromRecord : Type extends TArgument ? TFromArgument : Type); +/** `[JavaScript]` Instantiates a type with the given parameters */ +export type TInstantiate> = Result; +/** `[JavaScript]` Instantiates a type with the given parameters */ +export declare function Instantiate(type: Type, args: [...Args]): TInstantiate; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs new file mode 100644 index 0000000..c6a7d49 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs @@ -0,0 +1,115 @@ +import { CloneType } from '../clone/type.mjs'; +import { Unknown } from '../unknown/index.mjs'; +import { ReadonlyOptional } from '../readonly-optional/index.mjs'; +import { Readonly } from '../readonly/index.mjs'; +import { Optional } from '../optional/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Record, RecordKey, RecordValue } from '../record/index.mjs'; +import * as ValueGuard from '../guard/value.mjs'; +import * as KindGuard from '../guard/kind.mjs'; +// prettier-ignore +function FromConstructor(args, type) { + type.parameters = FromTypes(args, type.parameters); + type.returns = FromType(args, type.returns); + return type; +} +// prettier-ignore +function FromFunction(args, type) { + type.parameters = FromTypes(args, type.parameters); + type.returns = FromType(args, type.returns); + return type; +} +// prettier-ignore +function FromIntersect(args, type) { + type.allOf = FromTypes(args, type.allOf); + return type; +} +// prettier-ignore +function FromUnion(args, type) { + type.anyOf = FromTypes(args, type.anyOf); + return type; +} +// prettier-ignore +function FromTuple(args, type) { + if (ValueGuard.IsUndefined(type.items)) + return type; + type.items = FromTypes(args, type.items); + return type; +} +// prettier-ignore +function FromArray(args, type) { + type.items = FromType(args, type.items); + return type; +} +// prettier-ignore +function FromAsyncIterator(args, type) { + type.items = FromType(args, type.items); + return type; +} +// prettier-ignore +function FromIterator(args, type) { + type.items = FromType(args, type.items); + return type; +} +// prettier-ignore +function FromPromise(args, type) { + type.item = FromType(args, type.item); + return type; +} +// prettier-ignore +function FromObject(args, type) { + const mappedProperties = FromProperties(args, type.properties); + return { ...type, ...Object(mappedProperties) }; // retain options +} +// prettier-ignore +function FromRecord(args, type) { + const mappedKey = FromType(args, RecordKey(type)); + const mappedValue = FromType(args, RecordValue(type)); + const result = Record(mappedKey, mappedValue); + return { ...type, ...result }; // retain options +} +// prettier-ignore +function FromArgument(args, argument) { + return argument.index in args ? args[argument.index] : Unknown(); +} +// prettier-ignore +function FromProperty(args, type) { + const isReadonly = KindGuard.IsReadonly(type); + const isOptional = KindGuard.IsOptional(type); + const mapped = FromType(args, type); + return (isReadonly && isOptional ? ReadonlyOptional(mapped) : + isReadonly && !isOptional ? Readonly(mapped) : + !isReadonly && isOptional ? Optional(mapped) : + mapped); +} +// prettier-ignore +function FromProperties(args, properties) { + return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => { + return { ...result, [key]: FromProperty(args, properties[key]) }; + }, {}); +} +// prettier-ignore +export function FromTypes(args, types) { + return types.map(type => FromType(args, type)); +} +// prettier-ignore +function FromType(args, type) { + return (KindGuard.IsConstructor(type) ? FromConstructor(args, type) : + KindGuard.IsFunction(type) ? FromFunction(args, type) : + KindGuard.IsIntersect(type) ? FromIntersect(args, type) : + KindGuard.IsUnion(type) ? FromUnion(args, type) : + KindGuard.IsTuple(type) ? FromTuple(args, type) : + KindGuard.IsArray(type) ? FromArray(args, type) : + KindGuard.IsAsyncIterator(type) ? FromAsyncIterator(args, type) : + KindGuard.IsIterator(type) ? FromIterator(args, type) : + KindGuard.IsPromise(type) ? FromPromise(args, type) : + KindGuard.IsObject(type) ? FromObject(args, type) : + KindGuard.IsRecord(type) ? FromRecord(args, type) : + KindGuard.IsArgument(type) ? FromArgument(args, type) : + type); +} +/** `[JavaScript]` Instantiates a type with the given parameters */ +// prettier-ignore +export function Instantiate(type, args) { + return FromType(args, CloneType(type)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.d.mts new file mode 100644 index 0000000..6c678d7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.d.mts @@ -0,0 +1 @@ +export * from './integer.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.mjs new file mode 100644 index 0000000..6c678d7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/index.mjs @@ -0,0 +1 @@ +export * from './integer.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.d.mts new file mode 100644 index 0000000..52067c8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.d.mts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface IntegerOptions extends SchemaOptions { + exclusiveMaximum?: number; + exclusiveMinimum?: number; + maximum?: number; + minimum?: number; + multipleOf?: number; +} +export interface TInteger extends TSchema, IntegerOptions { + [Kind]: 'Integer'; + static: number; + type: 'integer'; +} +/** `[Json]` Creates an Integer type */ +export declare function Integer(options?: IntegerOptions): TInteger; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs new file mode 100644 index 0000000..45f0961 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates an Integer type */ +export function Integer(options) { + return CreateType({ [Kind]: 'Integer', type: 'integer' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.d.mts new file mode 100644 index 0000000..fdd2c19 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.d.mts @@ -0,0 +1,3 @@ +export * from './intersect-evaluated.mjs'; +export * from './intersect-type.mjs'; +export * from './intersect.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.mjs new file mode 100644 index 0000000..fdd2c19 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/index.mjs @@ -0,0 +1,3 @@ +export * from './intersect-evaluated.mjs'; +export * from './intersect-type.mjs'; +export * from './intersect.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.d.mts new file mode 100644 index 0000000..7e10564 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.d.mts @@ -0,0 +1,3 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { TIntersect, IntersectOptions } from './intersect-type.mjs'; +export declare function IntersectCreate(T: [...T], options?: IntersectOptions): TIntersect; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs new file mode 100644 index 0000000..e39615d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs @@ -0,0 +1,19 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsObject, IsSchema } from '../guard/kind.mjs'; +// ------------------------------------------------------------------ +// IntersectCreate +// ------------------------------------------------------------------ +// prettier-ignore +export function IntersectCreate(T, options = {}) { + const allObjects = T.every((schema) => IsObject(schema)); + const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) + ? { unevaluatedProperties: options.unevaluatedProperties } + : {}; + return CreateType((options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects + ? { ...clonedUnevaluatedProperties, [Kind]: 'Intersect', type: 'object', allOf: T } + : { ...clonedUnevaluatedProperties, [Kind]: 'Intersect', allOf: T }), options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.d.mts new file mode 100644 index 0000000..60129c0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.d.mts @@ -0,0 +1,13 @@ +import type { TSchema } from '../schema/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import { TIntersect, IntersectOptions } from './intersect-type.mjs'; +type TIsIntersectOptional = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? TIsIntersectOptional : false : true); +type TRemoveOptionalFromType = (Type extends TReadonly ? TReadonly> : Type extends TOptional ? TRemoveOptionalFromType : Type); +type TRemoveOptionalFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? TRemoveOptionalFromRest]> : TRemoveOptionalFromRest : Result); +type TResolveIntersect = (TIsIntersectOptional extends true ? TOptional>> : TIntersect>); +export type TIntersectEvaluated = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TResolveIntersect); +/** `[Json]` Creates an evaluated Intersect type */ +export declare function IntersectEvaluated>(types: [...Types], options?: IntersectOptions): Result; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs new file mode 100644 index 0000000..56403c6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs @@ -0,0 +1,38 @@ +import { OptionalKind } from '../symbols/index.mjs'; +import { CreateType } from '../create/type.mjs'; +import { Discard } from '../discard/index.mjs'; +import { Never } from '../never/index.mjs'; +import { Optional } from '../optional/index.mjs'; +import { IntersectCreate } from './intersect-create.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsOptional, IsTransform } from '../guard/kind.mjs'; +// prettier-ignore +function IsIntersectOptional(types) { + return types.every(left => IsOptional(left)); +} +// prettier-ignore +function RemoveOptionalFromType(type) { + return (Discard(type, [OptionalKind])); +} +// prettier-ignore +function RemoveOptionalFromRest(types) { + return types.map(left => IsOptional(left) ? RemoveOptionalFromType(left) : left); +} +// prettier-ignore +function ResolveIntersect(types, options) { + return (IsIntersectOptional(types) + ? Optional(IntersectCreate(RemoveOptionalFromRest(types), options)) + : IntersectCreate(RemoveOptionalFromRest(types), options)); +} +/** `[Json]` Creates an evaluated Intersect type */ +export function IntersectEvaluated(types, options = {}) { + if (types.length === 1) + return CreateType(types[0], options); + if (types.length === 0) + return Never(options); + if (types.some((schema) => IsTransform(schema))) + throw new Error('Cannot intersect transform types'); + return ResolveIntersect(types, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.d.mts new file mode 100644 index 0000000..f7713bf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.d.mts @@ -0,0 +1,15 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +type TIntersectStatic = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TIntersectStatic> : Acc; +export type TUnevaluatedProperties = undefined | TSchema | boolean; +export interface IntersectOptions extends SchemaOptions { + unevaluatedProperties?: TUnevaluatedProperties; +} +export interface TIntersect extends TSchema, IntersectOptions { + [Kind]: 'Intersect'; + static: TIntersectStatic; + type?: 'object'; + allOf: [...T]; +} +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.mjs new file mode 100644 index 0000000..6d09727 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-type.mjs @@ -0,0 +1 @@ +import { Kind } from '../symbols/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.d.mts new file mode 100644 index 0000000..4e76628 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.d.mts @@ -0,0 +1,6 @@ +import type { TSchema } from '../schema/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { TIntersect, IntersectOptions } from './intersect-type.mjs'; +export type Intersect = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TIntersect); +/** `[Json]` Creates an evaluated Intersect type */ +export declare function Intersect(types: [...Types], options?: IntersectOptions): Intersect; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs new file mode 100644 index 0000000..16ee666 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs @@ -0,0 +1,17 @@ +import { CreateType } from '../create/type.mjs'; +import { Never } from '../never/index.mjs'; +import { IntersectCreate } from './intersect-create.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsTransform } from '../guard/kind.mjs'; +/** `[Json]` Creates an evaluated Intersect type */ +export function Intersect(types, options) { + if (types.length === 1) + return CreateType(types[0], options); + if (types.length === 0) + return Never(options); + if (types.some((schema) => IsTransform(schema))) + throw new Error('Cannot intersect transform types'); + return IntersectCreate(types, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.d.mts new file mode 100644 index 0000000..fd1ea06 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.d.mts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TIntrinsic } from './intrinsic.mjs'; +export type TCapitalize = TIntrinsic; +/** `[Json]` Intrinsic function to Capitalize LiteralString types */ +export declare function Capitalize(T: T, options?: SchemaOptions): TCapitalize; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs new file mode 100644 index 0000000..78ec9c1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs @@ -0,0 +1,5 @@ +import { Intrinsic } from './intrinsic.mjs'; +/** `[Json]` Intrinsic function to Capitalize LiteralString types */ +export function Capitalize(T, options = {}) { + return Intrinsic(T, 'Capitalize', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.d.mts new file mode 100644 index 0000000..b65c8e5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.d.mts @@ -0,0 +1,6 @@ +export * from './capitalize.mjs'; +export * from './intrinsic-from-mapped-key.mjs'; +export * from './intrinsic.mjs'; +export * from './lowercase.mjs'; +export * from './uncapitalize.mjs'; +export * from './uppercase.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.mjs new file mode 100644 index 0000000..b65c8e5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/index.mjs @@ -0,0 +1,6 @@ +export * from './capitalize.mjs'; +export * from './intrinsic-from-mapped-key.mjs'; +export * from './intrinsic.mjs'; +export * from './lowercase.mjs'; +export * from './uncapitalize.mjs'; +export * from './uppercase.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.d.mts new file mode 100644 index 0000000..33e97c6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.d.mts @@ -0,0 +1,14 @@ +import type { SchemaOptions } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { Assert } from '../helpers/index.mjs'; +import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs'; +import { type TIntrinsic, type IntrinsicMode } from './intrinsic.mjs'; +import { type TLiteral, type TLiteralValue } from '../literal/index.mjs'; +type TMappedIntrinsicPropertyKey = { + [_ in K]: TIntrinsic>, M>; +}; +type TMappedIntrinsicPropertyKeys = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedIntrinsicPropertyKeys> : Acc); +type TMappedIntrinsicProperties = (TMappedIntrinsicPropertyKeys); +export type TIntrinsicFromMappedKey> = (TMappedResult

); +export declare function IntrinsicFromMappedKey>(T: K, M: M, options: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs new file mode 100644 index 0000000..94ae788 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs @@ -0,0 +1,26 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Intrinsic } from './intrinsic.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function MappedIntrinsicPropertyKey(K, M, options) { + return { + [K]: Intrinsic(Literal(K), M, Clone(options)) + }; +} +// prettier-ignore +function MappedIntrinsicPropertyKeys(K, M, options) { + const result = K.reduce((Acc, L) => { + return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) }; + }, {}); + return result; +} +// prettier-ignore +function MappedIntrinsicProperties(T, M, options) { + return MappedIntrinsicPropertyKeys(T['keys'], M, options); +} +// prettier-ignore +export function IntrinsicFromMappedKey(T, M, options) { + const P = MappedIntrinsicProperties(T, M, options); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.d.mts new file mode 100644 index 0000000..d24980f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.d.mts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TTemplateLiteral, type TTemplateLiteralKind } from '../template-literal/index.mjs'; +import { type TIntrinsicFromMappedKey } from './intrinsic-from-mapped-key.mjs'; +import { type TLiteral } from '../literal/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TMappedKey } from '../mapped/index.mjs'; +export type IntrinsicMode = 'Uppercase' | 'Lowercase' | 'Capitalize' | 'Uncapitalize'; +type TFromTemplateLiteral = M extends IntrinsicMode ? T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? [TIntrinsic, ...TFromTemplateLiteral] : T : T; +type TFromLiteralValue = (T extends string ? M extends 'Uncapitalize' ? Uncapitalize : M extends 'Capitalize' ? Capitalize : M extends 'Uppercase' ? Uppercase : M extends 'Lowercase' ? Lowercase : string : T); +type TFromRest = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Acc; +export type TIntrinsic = T extends TMappedKey ? TIntrinsicFromMappedKey : T extends TTemplateLiteral ? TTemplateLiteral> : T extends TUnion ? TUnion> : T extends TLiteral ? TLiteral> : T; +/** Applies an intrinsic string manipulation to the given type. */ +export declare function Intrinsic(schema: T, mode: M, options?: SchemaOptions): TIntrinsicFromMappedKey; +/** Applies an intrinsic string manipulation to the given type. */ +export declare function Intrinsic(schema: T, mode: M, options?: SchemaOptions): TIntrinsic; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs new file mode 100644 index 0000000..96c3a7b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs @@ -0,0 +1,64 @@ +import { CreateType } from '../create/type.mjs'; +import { TemplateLiteral, TemplateLiteralParseExact, IsTemplateLiteralExpressionFinite, TemplateLiteralExpressionGenerate } from '../template-literal/index.mjs'; +import { IntrinsicFromMappedKey } from './intrinsic-from-mapped-key.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Union } from '../union/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsMappedKey, IsTemplateLiteral, IsUnion, IsLiteral } from '../guard/kind.mjs'; +// ------------------------------------------------------------------ +// Apply +// ------------------------------------------------------------------ +function ApplyUncapitalize(value) { + const [first, rest] = [value.slice(0, 1), value.slice(1)]; + return [first.toLowerCase(), rest].join(''); +} +function ApplyCapitalize(value) { + const [first, rest] = [value.slice(0, 1), value.slice(1)]; + return [first.toUpperCase(), rest].join(''); +} +function ApplyUppercase(value) { + return value.toUpperCase(); +} +function ApplyLowercase(value) { + return value.toLowerCase(); +} +function FromTemplateLiteral(schema, mode, options) { + // note: template literals require special runtime handling as they are encoded in string patterns. + // This diverges from the mapped type which would otherwise map on the template literal kind. + const expression = TemplateLiteralParseExact(schema.pattern); + const finite = IsTemplateLiteralExpressionFinite(expression); + if (!finite) + return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) }; + const strings = [...TemplateLiteralExpressionGenerate(expression)]; + const literals = strings.map((value) => Literal(value)); + const mapped = FromRest(literals, mode); + const union = Union(mapped); + return TemplateLiteral([union], options); +} +// prettier-ignore +function FromLiteralValue(value, mode) { + return (typeof value === 'string' ? (mode === 'Uncapitalize' ? ApplyUncapitalize(value) : + mode === 'Capitalize' ? ApplyCapitalize(value) : + mode === 'Uppercase' ? ApplyUppercase(value) : + mode === 'Lowercase' ? ApplyLowercase(value) : + value) : value.toString()); +} +// prettier-ignore +function FromRest(T, M) { + return T.map(L => Intrinsic(L, M)); +} +/** Applies an intrinsic string manipulation to the given type. */ +export function Intrinsic(schema, mode, options = {}) { + // prettier-ignore + return ( + // Intrinsic-Mapped-Inference + IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : + // Standard-Inference + IsTemplateLiteral(schema) ? FromTemplateLiteral(schema, mode, options) : + IsUnion(schema) ? Union(FromRest(schema.anyOf, mode), options) : + IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : + // Default Type + CreateType(schema, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.d.mts new file mode 100644 index 0000000..7c6f1fa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.d.mts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TIntrinsic } from './intrinsic.mjs'; +export type TLowercase = TIntrinsic; +/** `[Json]` Intrinsic function to Lowercase LiteralString types */ +export declare function Lowercase(T: T, options?: SchemaOptions): TLowercase; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs new file mode 100644 index 0000000..a6250e0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs @@ -0,0 +1,5 @@ +import { Intrinsic } from './intrinsic.mjs'; +/** `[Json]` Intrinsic function to Lowercase LiteralString types */ +export function Lowercase(T, options = {}) { + return Intrinsic(T, 'Lowercase', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.d.mts new file mode 100644 index 0000000..ecaa8b3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.d.mts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TIntrinsic } from './intrinsic.mjs'; +export type TUncapitalize = TIntrinsic; +/** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ +export declare function Uncapitalize(T: T, options?: SchemaOptions): TUncapitalize; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs new file mode 100644 index 0000000..15024c7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs @@ -0,0 +1,5 @@ +import { Intrinsic } from './intrinsic.mjs'; +/** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ +export function Uncapitalize(T, options = {}) { + return Intrinsic(T, 'Uncapitalize', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.d.mts new file mode 100644 index 0000000..f916777 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.d.mts @@ -0,0 +1,5 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TIntrinsic } from './intrinsic.mjs'; +export type TUppercase = TIntrinsic; +/** `[Json]` Intrinsic function to Uppercase LiteralString types */ +export declare function Uppercase(T: T, options?: SchemaOptions): TUppercase; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs new file mode 100644 index 0000000..41752f9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs @@ -0,0 +1,5 @@ +import { Intrinsic } from './intrinsic.mjs'; +/** `[Json]` Intrinsic function to Uppercase LiteralString types */ +export function Uppercase(T, options = {}) { + return Intrinsic(T, 'Uppercase', options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.d.mts new file mode 100644 index 0000000..99c6a9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.d.mts @@ -0,0 +1 @@ +export * from './iterator.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.mjs new file mode 100644 index 0000000..99c6a9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/index.mjs @@ -0,0 +1 @@ +export * from './iterator.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.d.mts new file mode 100644 index 0000000..9635d6e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.d.mts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TIterator extends TSchema { + [Kind]: 'Iterator'; + static: IterableIterator>; + type: 'Iterator'; + items: T; +} +/** `[JavaScript]` Creates an Iterator type */ +export declare function Iterator(items: T, options?: SchemaOptions): TIterator; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs new file mode 100644 index 0000000..1fc8ed8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates an Iterator type */ +export function Iterator(items, options) { + return CreateType({ [Kind]: 'Iterator', type: 'Iterator', items }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.d.mts new file mode 100644 index 0000000..84a5f97 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.d.mts @@ -0,0 +1,4 @@ +export * from './keyof-from-mapped-result.mjs'; +export * from './keyof-property-entries.mjs'; +export * from './keyof-property-keys.mjs'; +export * from './keyof.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.mjs new file mode 100644 index 0000000..84a5f97 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/index.mjs @@ -0,0 +1,4 @@ +export * from './keyof-from-mapped-result.mjs'; +export * from './keyof-property-entries.mjs'; +export * from './keyof-property-keys.mjs'; +export * from './keyof.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.d.mts new file mode 100644 index 0000000..0dcda77 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.d.mts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index.mjs'; +import type { Ensure, Evaluate } from '../helpers/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TKeyOfFromType } from './keyof.mjs'; +type TFromProperties = ({ + [K2 in keyof Properties]: TKeyOfFromType; +}); +type TFromMappedResult = (Evaluate>); +export type TKeyOfFromMappedResult> = (Ensure>); +export declare function KeyOfFromMappedResult>(mappedResult: MappedResult, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs new file mode 100644 index 0000000..86bed64 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs @@ -0,0 +1,19 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { KeyOf } from './keyof.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromProperties(properties, options) { + const result = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(properties)) + result[K2] = KeyOf(properties[K2], Clone(options)); + return result; +} +// prettier-ignore +function FromMappedResult(mappedResult, options) { + return FromProperties(mappedResult.properties, options); +} +// prettier-ignore +export function KeyOfFromMappedResult(mappedResult, options) { + const properties = FromMappedResult(mappedResult, options); + return MappedResult(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.d.mts new file mode 100644 index 0000000..ae3314a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.d.mts @@ -0,0 +1,7 @@ +import { TSchema } from '../schema/index.mjs'; +/** + * `[Utility]` Resolves an array of keys and schemas from the given schema. This method is faster + * than obtaining the keys and resolving each individually via indexing. This method was written + * accellerate Intersect and Union encoding. + */ +export declare function KeyOfPropertyEntries(schema: TSchema): [key: string, schema: TSchema][]; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.mjs new file mode 100644 index 0000000..4533f76 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-entries.mjs @@ -0,0 +1,12 @@ +import { IndexFromPropertyKeys } from '../indexed/indexed.mjs'; +import { KeyOfPropertyKeys } from './keyof-property-keys.mjs'; +/** + * `[Utility]` Resolves an array of keys and schemas from the given schema. This method is faster + * than obtaining the keys and resolving each individually via indexing. This method was written + * accellerate Intersect and Union encoding. + */ +export function KeyOfPropertyEntries(schema) { + const keys = KeyOfPropertyKeys(schema); + const schemas = IndexFromPropertyKeys(schema, keys); + return keys.map((_, index) => [keys[index], schemas[index]]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.d.mts new file mode 100644 index 0000000..66c0cac --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.d.mts @@ -0,0 +1,24 @@ +import type { TSchema } from '../schema/index.mjs'; +import { type ZeroString, type UnionToTuple, type TIncrement } from '../helpers/index.mjs'; +import type { TRecursive } from '../recursive/index.mjs'; +import type { TIntersect } from '../intersect/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TTuple } from '../tuple/index.mjs'; +import type { TArray } from '../array/index.mjs'; +import type { TObject, TProperties } from '../object/index.mjs'; +import { type TSetUnionMany, type TSetIntersectMany } from '../sets/index.mjs'; +type TFromRest = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Result); +type TFromIntersect, PropertyKeys extends PropertyKey[] = TSetUnionMany> = PropertyKeys; +type TFromUnion, PropertyKeys extends PropertyKey[] = TSetIntersectMany> = PropertyKeys; +type TFromTuple = Types extends [infer _ extends TSchema, ...infer R extends TSchema[]] ? TFromTuple, [...Acc, Indexer]> : Acc; +type TFromArray<_ extends TSchema> = ([ + '[number]' +]); +type TFromProperties = (UnionToTuple); +export type TKeyOfPropertyKeys = (Type extends TRecursive ? TKeyOfPropertyKeys : Type extends TIntersect ? TFromIntersect : Type extends TUnion ? TFromUnion : Type extends TTuple ? TFromTuple : Type extends TArray ? TFromArray : Type extends TObject ? TFromProperties : [ +]); +/** Returns a tuple of PropertyKeys derived from the given TSchema. */ +export declare function KeyOfPropertyKeys(type: Type): TKeyOfPropertyKeys; +/** Returns a regular expression pattern derived from the given TSchema */ +export declare function KeyOfPattern(schema: TSchema): string; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs new file mode 100644 index 0000000..76ec6fa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs @@ -0,0 +1,73 @@ +import { SetUnionMany, SetIntersectMany } from '../sets/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsIntersect, IsUnion, IsTuple, IsArray, IsObject, IsRecord } from '../guard/kind.mjs'; +// prettier-ignore +function FromRest(types) { + const result = []; + for (const L of types) + result.push(KeyOfPropertyKeys(L)); + return result; +} +// prettier-ignore +function FromIntersect(types) { + const propertyKeysArray = FromRest(types); + const propertyKeys = SetUnionMany(propertyKeysArray); + return propertyKeys; +} +// prettier-ignore +function FromUnion(types) { + const propertyKeysArray = FromRest(types); + const propertyKeys = SetIntersectMany(propertyKeysArray); + return propertyKeys; +} +// prettier-ignore +function FromTuple(types) { + return types.map((_, indexer) => indexer.toString()); +} +// prettier-ignore +function FromArray(_) { + return (['[number]']); +} +// prettier-ignore +function FromProperties(T) { + return (globalThis.Object.getOwnPropertyNames(T)); +} +// ------------------------------------------------------------------ +// FromPatternProperties +// ------------------------------------------------------------------ +// prettier-ignore +function FromPatternProperties(patternProperties) { + if (!includePatternProperties) + return []; + const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties); + return patternPropertyKeys.map(key => { + return (key[0] === '^' && key[key.length - 1] === '$') + ? key.slice(1, key.length - 1) + : key; + }); +} +/** Returns a tuple of PropertyKeys derived from the given TSchema. */ +// prettier-ignore +export function KeyOfPropertyKeys(type) { + return (IsIntersect(type) ? FromIntersect(type.allOf) : + IsUnion(type) ? FromUnion(type.anyOf) : + IsTuple(type) ? FromTuple(type.items ?? []) : + IsArray(type) ? FromArray(type.items) : + IsObject(type) ? FromProperties(type.properties) : + IsRecord(type) ? FromPatternProperties(type.patternProperties) : + []); +} +// ---------------------------------------------------------------- +// KeyOfPattern +// ---------------------------------------------------------------- +let includePatternProperties = false; +/** Returns a regular expression pattern derived from the given TSchema */ +export function KeyOfPattern(schema) { + includePatternProperties = true; + const keys = KeyOfPropertyKeys(schema); + includePatternProperties = false; + const pattern = keys.map((key) => `(${key})`); + return `^(${pattern.join('|')})$`; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.d.mts new file mode 100644 index 0000000..c4f3479 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.d.mts @@ -0,0 +1,21 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { Assert, Ensure } from '../helpers/index.mjs'; +import type { TMappedResult } from '../mapped/index.mjs'; +import type { SchemaOptions } from '../schema/index.mjs'; +import { type TLiteral, type TLiteralValue } from '../literal/index.mjs'; +import { type TNumber } from '../number/index.mjs'; +import { TComputed } from '../computed/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +import { type TKeyOfPropertyKeys } from './keyof-property-keys.mjs'; +import { type TUnionEvaluated } from '../union/index.mjs'; +import { type TKeyOfFromMappedResult } from './keyof-from-mapped-result.mjs'; +type TFromComputed = Ensure]>>; +type TFromRef = Ensure]>>; +/** `[Internal]` Used by KeyOfFromMappedResult */ +export type TKeyOfFromType, PropertyKeyTypes extends TSchema[] = TKeyOfPropertyKeysToRest, Result = TUnionEvaluated> = Ensure; +export type TKeyOfPropertyKeysToRest = (PropertyKeys extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? L extends '[number]' ? TKeyOfPropertyKeysToRest : TKeyOfPropertyKeysToRest>]> : Result); +export declare function KeyOfPropertyKeysToRest(propertyKeys: [...PropertyKeys]): TKeyOfPropertyKeysToRest; +export type TKeyOf = (Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TMappedResult ? TKeyOfFromMappedResult : TKeyOfFromType); +/** `[Json]` Creates a KeyOf type */ +export declare function KeyOf(type: Type, options?: SchemaOptions): TKeyOf; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs new file mode 100644 index 0000000..0908e32 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs @@ -0,0 +1,35 @@ +import { CreateType } from '../create/type.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Number } from '../number/index.mjs'; +import { Computed } from '../computed/index.mjs'; +import { Ref } from '../ref/index.mjs'; +import { KeyOfPropertyKeys } from './keyof-property-keys.mjs'; +import { UnionEvaluated } from '../union/index.mjs'; +import { KeyOfFromMappedResult } from './keyof-from-mapped-result.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsMappedResult, IsRef, IsComputed } from '../guard/kind.mjs'; +// prettier-ignore +function FromComputed(target, parameters) { + return Computed('KeyOf', [Computed(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return Computed('KeyOf', [Ref($ref)]); +} +// prettier-ignore +function KeyOfFromType(type, options) { + const propertyKeys = KeyOfPropertyKeys(type); + const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys); + const result = UnionEvaluated(propertyKeyTypes); + return CreateType(result, options); +} +// prettier-ignore +export function KeyOfPropertyKeysToRest(propertyKeys) { + return propertyKeys.map(L => L === '[number]' ? Number() : Literal(L)); +} +/** `[Json]` Creates a KeyOf type */ +export function KeyOf(type, options) { + return (IsComputed(type) ? FromComputed(type.target, type.parameters) : IsRef(type) ? FromRef(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.d.mts new file mode 100644 index 0000000..8344238 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.d.mts @@ -0,0 +1 @@ +export * from './literal.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.mjs new file mode 100644 index 0000000..8344238 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/index.mjs @@ -0,0 +1 @@ +export * from './literal.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.d.mts new file mode 100644 index 0000000..5dd73d3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.d.mts @@ -0,0 +1,10 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export type TLiteralValue = boolean | number | string; +export interface TLiteral extends TSchema { + [Kind]: 'Literal'; + static: T; + const: T; +} +/** `[Json]` Creates a Literal type */ +export declare function Literal(value: T, options?: SchemaOptions): TLiteral; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs new file mode 100644 index 0000000..1347135 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs @@ -0,0 +1,10 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Literal type */ +export function Literal(value, options) { + return CreateType({ + [Kind]: 'Literal', + const: value, + type: typeof value, + }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.d.mts new file mode 100644 index 0000000..b7c46de --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.d.mts @@ -0,0 +1,3 @@ +export * from './mapped-key.mjs'; +export * from './mapped-result.mjs'; +export * from './mapped.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.mjs new file mode 100644 index 0000000..b7c46de --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/index.mjs @@ -0,0 +1,3 @@ +export * from './mapped-key.mjs'; +export * from './mapped-result.mjs'; +export * from './mapped.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.d.mts new file mode 100644 index 0000000..884b597 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.d.mts @@ -0,0 +1,8 @@ +import type { TSchema } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TMappedKey extends TSchema { + [Kind]: 'MappedKey'; + static: T[number]; + keys: T; +} +export declare function MappedKey(T: [...T]): TMappedKey; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.mjs new file mode 100644 index 0000000..a59df64 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-key.mjs @@ -0,0 +1,9 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +// prettier-ignore +export function MappedKey(T) { + return CreateType({ + [Kind]: 'MappedKey', + keys: T + }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.d.mts new file mode 100644 index 0000000..ee75d74 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.d.mts @@ -0,0 +1,9 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TMappedResult extends TSchema { + [Kind]: 'MappedResult'; + properties: T; + static: unknown; +} +export declare function MappedResult(properties: T): TMappedResult; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs new file mode 100644 index 0000000..7dfa725 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs @@ -0,0 +1,9 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +// prettier-ignore +export function MappedResult(properties) { + return CreateType({ + [Kind]: 'MappedResult', + properties + }); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.d.mts new file mode 100644 index 0000000..ede5ee2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.d.mts @@ -0,0 +1,47 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { Ensure, Evaluate, Assert } from '../helpers/index.mjs'; +import { type TArray } from '../array/index.mjs'; +import { type TAsyncIterator } from '../async-iterator/index.mjs'; +import { type TConstructor } from '../constructor/index.mjs'; +import { type TEnum, type TEnumRecord } from '../enum/index.mjs'; +import { type TFunction } from '../function/index.mjs'; +import { type TIndexPropertyKeys } from '../indexed/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TIterator } from '../iterator/index.mjs'; +import { type TLiteral, type TLiteralValue } from '../literal/index.mjs'; +import { type TObject, type TProperties, type ObjectOptions } from '../object/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +import { type TPromise } from '../promise/index.mjs'; +import { type TReadonly } from '../readonly/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TSetIncludes } from '../sets/index.mjs'; +import { type TMappedResult } from './mapped-result.mjs'; +import type { TMappedKey } from './mapped-key.mjs'; +type TFromMappedResult = (K extends keyof P ? FromSchemaType : TMappedResult

); +type TMappedKeyToKnownMappedResultProperties = { + [_ in K]: TLiteral>; +}; +type TMappedKeyToUnknownMappedResultProperties

= (P extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedKeyToUnknownMappedResultProperties>; +}> : Acc); +type TMappedKeyToMappedResultProperties = (TSetIncludes extends true ? TMappedKeyToKnownMappedResultProperties : TMappedKeyToUnknownMappedResultProperties

); +type TFromMappedKey> = (TFromMappedResult); +type TFromRest = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Acc); +type FromProperties; +}>> = R; +declare function FromProperties(K: K, T: T): FromProperties; +type FromSchemaType = (T extends TReadonly ? TReadonly> : T extends TOptional ? TOptional> : T extends TMappedResult ? TFromMappedResult : T extends TMappedKey ? TFromMappedKey : T extends TConstructor ? TConstructor, FromSchemaType> : T extends TFunction ? TFunction, FromSchemaType> : T extends TAsyncIterator ? TAsyncIterator> : T extends TIterator ? TIterator> : T extends TIntersect ? TIntersect> : T extends TEnum ? TEnum : T extends TUnion ? TUnion> : T extends TTuple ? TTuple> : T extends TObject ? TObject> : T extends TArray ? TArray> : T extends TPromise ? TPromise> : T); +declare function FromSchemaType(K: K, T: T): FromSchemaType; +export type TMappedFunctionReturnType = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TMappedFunctionReturnType; +}> : Acc); +export declare function MappedFunctionReturnType(K: [...K], T: T): TMappedFunctionReturnType; +export type TMappedFunction> = (T: I) => TSchema; +export type TMapped, R extends TProperties = Evaluate>>> = Ensure>; +/** `[Json]` Creates a Mapped object type */ +export declare function Mapped, F extends TMappedFunction = TMappedFunction, R extends TMapped = TMapped>(key: K, map: F, options?: ObjectOptions): R; +/** `[Json]` Creates a Mapped object type */ +export declare function Mapped = TMappedFunction, R extends TMapped = TMapped>(key: [...K], map: F, options?: ObjectOptions): R; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs new file mode 100644 index 0000000..c48d438 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs @@ -0,0 +1,102 @@ +import { Kind, OptionalKind, ReadonlyKind } from '../symbols/index.mjs'; +import { Discard } from '../discard/index.mjs'; +// evaluation types +import { Array } from '../array/index.mjs'; +import { AsyncIterator } from '../async-iterator/index.mjs'; +import { Constructor } from '../constructor/index.mjs'; +import { Function as FunctionType } from '../function/index.mjs'; +import { IndexPropertyKeys } from '../indexed/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Iterator } from '../iterator/index.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Optional } from '../optional/index.mjs'; +import { Promise } from '../promise/index.mjs'; +import { Readonly } from '../readonly/index.mjs'; +import { Tuple } from '../tuple/index.mjs'; +import { Union } from '../union/index.mjs'; +// operator +import { SetIncludes } from '../sets/index.mjs'; +// mapping types +import { MappedResult } from './mapped-result.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsArray, IsAsyncIterator, IsConstructor, IsFunction, IsIntersect, IsIterator, IsReadonly, IsMappedResult, IsMappedKey, IsObject, IsOptional, IsPromise, IsSchema, IsTuple, IsUnion } from '../guard/kind.mjs'; +// prettier-ignore +function FromMappedResult(K, P) { + return (K in P + ? FromSchemaType(K, P[K]) + : MappedResult(P)); +} +// prettier-ignore +function MappedKeyToKnownMappedResultProperties(K) { + return { [K]: Literal(K) }; +} +// prettier-ignore +function MappedKeyToUnknownMappedResultProperties(P) { + const Acc = {}; + for (const L of P) + Acc[L] = Literal(L); + return Acc; +} +// prettier-ignore +function MappedKeyToMappedResultProperties(K, P) { + return (SetIncludes(P, K) + ? MappedKeyToKnownMappedResultProperties(K) + : MappedKeyToUnknownMappedResultProperties(P)); +} +// prettier-ignore +function FromMappedKey(K, P) { + const R = MappedKeyToMappedResultProperties(K, P); + return FromMappedResult(K, R); +} +// prettier-ignore +function FromRest(K, T) { + return T.map(L => FromSchemaType(K, L)); +} +// prettier-ignore +function FromProperties(K, T) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(T)) + Acc[K2] = FromSchemaType(K, T[K2]); + return Acc; +} +// prettier-ignore +function FromSchemaType(K, T) { + // required to retain user defined options for mapped type + const options = { ...T }; + return ( + // unevaluated modifier types + IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : + IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : + // unevaluated mapped types + IsMappedResult(T) ? FromMappedResult(K, T.properties) : + IsMappedKey(T) ? FromMappedKey(K, T.keys) : + // unevaluated types + IsConstructor(T) ? Constructor(FromRest(K, T.parameters), FromSchemaType(K, T.returns), options) : + IsFunction(T) ? FunctionType(FromRest(K, T.parameters), FromSchemaType(K, T.returns), options) : + IsAsyncIterator(T) ? AsyncIterator(FromSchemaType(K, T.items), options) : + IsIterator(T) ? Iterator(FromSchemaType(K, T.items), options) : + IsIntersect(T) ? Intersect(FromRest(K, T.allOf), options) : + IsUnion(T) ? Union(FromRest(K, T.anyOf), options) : + IsTuple(T) ? Tuple(FromRest(K, T.items ?? []), options) : + IsObject(T) ? Object(FromProperties(K, T.properties), options) : + IsArray(T) ? Array(FromSchemaType(K, T.items), options) : + IsPromise(T) ? Promise(FromSchemaType(K, T.item), options) : + T); +} +// prettier-ignore +export function MappedFunctionReturnType(K, T) { + const Acc = {}; + for (const L of K) + Acc[L] = FromSchemaType(L, T); + return Acc; +} +/** `[Json]` Creates a Mapped object type */ +export function Mapped(key, map, options) { + const K = IsSchema(key) ? IndexPropertyKeys(key) : key; + const RT = map({ [Kind]: 'MappedKey', keys: K }); + const R = MappedFunctionReturnType(K, RT); + return Object(R, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.d.mts new file mode 100644 index 0000000..4f49330 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.d.mts @@ -0,0 +1,59 @@ +import { Ensure, Evaluate } from '../helpers/index.mjs'; +import { type TSchema } from '../schema/index.mjs'; +import { type TArray } from '../array/index.mjs'; +import { type TAwaited } from '../awaited/index.mjs'; +import { type TAsyncIterator } from '../async-iterator/index.mjs'; +import { TComputed } from '../computed/index.mjs'; +import { type TConstructor } from '../constructor/index.mjs'; +import { type TIndex, type TIndexPropertyKeys } from '../indexed/index.mjs'; +import { TEnum, type TEnumRecord } from '../enum/index.mjs'; +import { type TFunction } from '../function/index.mjs'; +import { type TIntersect, type TIntersectEvaluated } from '../intersect/index.mjs'; +import { type TIterator } from '../iterator/index.mjs'; +import { type TKeyOf } from '../keyof/index.mjs'; +import { type TObject, type TProperties } from '../object/index.mjs'; +import { type TOmit } from '../omit/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +import { type TPick } from '../pick/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { TPartial } from '../partial/index.mjs'; +import { type TReadonly } from '../readonly/index.mjs'; +import { type TRecordOrObject, type TRecord } from '../record/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +import { type TRequired } from '../required/index.mjs'; +import { type TTransform } from '../transform/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { type TUnion, type TUnionEvaluated } from '../union/index.mjs'; +type TDereferenceParameters = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TRef ? TDereferenceParameters]> : TDereferenceParameters]> : Result); +type TDereference ? TDereference : TFromType : TNever)> = Result; +type TFromAwaited = (Parameters extends [infer T0 extends TSchema] ? TAwaited : never); +type TFromIndex = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TIndex> extends infer Result extends TSchema ? Result : never : never); +type TFromKeyOf = (Parameters extends [infer T0 extends TSchema] ? TKeyOf : never); +type TFromPartial = (Parameters extends [infer T0 extends TSchema] ? TPartial : never); +type TFromOmit = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TOmit : never); +type TFromPick = (Parameters extends [infer T0 extends TSchema, infer T1 extends TSchema] ? TPick : never); +type TFromRequired = (Parameters extends [infer T0 extends TSchema] ? TRequired : never); +type TFromComputed> = (Target extends 'Awaited' ? TFromAwaited : Target extends 'Index' ? TFromIndex : Target extends 'KeyOf' ? TFromKeyOf : Target extends 'Partial' ? TFromPartial : Target extends 'Omit' ? TFromOmit : Target extends 'Pick' ? TFromPick : Target extends 'Required' ? TFromRequired : TNever); +type TFromArray = (Ensure>>); +type TFromAsyncIterator = (TAsyncIterator>); +type TFromConstructor = (TConstructor, TFromType>); +type TFromFunction = Ensure, TFromType>>>; +type TFromIntersect = (Ensure>>); +type TFromIterator = (TIterator>); +type TFromObject = Ensure; +}>>>; +type TFromRecord>> = Result; +type TFromTransform ? TTransform, Output> : TTransform> = Result; +type TFromTuple = (Ensure>>); +type TFromUnion = (Ensure>>); +type TFromTypes = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromTypes]> : Result); +export type TFromType = (Type extends TOptional ? TOptional> : Type extends TReadonly ? TReadonly> : Type extends TTransform ? TFromTransform : Type extends TArray ? TFromArray : Type extends TAsyncIterator ? TFromAsyncIterator : Type extends TComputed ? TFromComputed : Type extends TConstructor ? TFromConstructor : Type extends TFunction ? TFromFunction : Type extends TIntersect ? TFromIntersect : Type extends TIterator ? TFromIterator : Type extends TObject ? TFromObject : Type extends TRecord ? TFromRecord : Type extends TTuple ? TFromTuple : Type extends TEnum ? Type : Type extends TUnion ? TFromUnion : Type); +export declare function FromType(moduleProperties: ModuleProperties, type: Type): TFromType; +export type TComputeType = (Key extends keyof ModuleProperties ? TFromType : TNever); +export declare function ComputeType(moduleProperties: ModuleProperties, key: Key): TComputeType; +export type TComputeModuleProperties = Evaluate<{ + [Key in keyof ModuleProperties]: TComputeType; +}>; +export declare function ComputeModuleProperties(moduleProperties: ModuleProperties): TComputeModuleProperties; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs new file mode 100644 index 0000000..a89d677 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs @@ -0,0 +1,166 @@ +import { CreateType } from '../create/index.mjs'; +import { CloneType } from '../clone/index.mjs'; +import { Discard } from '../discard/index.mjs'; +import { Array } from '../array/index.mjs'; +import { Awaited } from '../awaited/index.mjs'; +import { AsyncIterator } from '../async-iterator/index.mjs'; +import { Constructor } from '../constructor/index.mjs'; +import { Index } from '../indexed/index.mjs'; +import { Function as FunctionType } from '../function/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Iterator } from '../iterator/index.mjs'; +import { KeyOf } from '../keyof/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Omit } from '../omit/index.mjs'; +import { Pick } from '../pick/index.mjs'; +import { Never } from '../never/index.mjs'; +import { Partial } from '../partial/index.mjs'; +import { RecordValue, RecordPattern } from '../record/index.mjs'; +import { Required } from '../required/index.mjs'; +import { Tuple } from '../tuple/index.mjs'; +import { Union } from '../union/index.mjs'; +// ------------------------------------------------------------------ +// Symbols +// ------------------------------------------------------------------ +import { TransformKind, OptionalKind, ReadonlyKind } from '../symbols/index.mjs'; +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +import * as KindGuard from '../guard/kind.mjs'; +// prettier-ignore +function DereferenceParameters(moduleProperties, types) { + return types.map((type) => { + return KindGuard.IsRef(type) + ? Dereference(moduleProperties, type.$ref) + : FromType(moduleProperties, type); + }); +} +// prettier-ignore +function Dereference(moduleProperties, ref) { + return (ref in moduleProperties + ? KindGuard.IsRef(moduleProperties[ref]) + ? Dereference(moduleProperties, moduleProperties[ref].$ref) + : FromType(moduleProperties, moduleProperties[ref]) + : Never()); +} +// prettier-ignore +function FromAwaited(parameters) { + return Awaited(parameters[0]); +} +// prettier-ignore +function FromIndex(parameters) { + return Index(parameters[0], parameters[1]); +} +// prettier-ignore +function FromKeyOf(parameters) { + return KeyOf(parameters[0]); +} +// prettier-ignore +function FromPartial(parameters) { + return Partial(parameters[0]); +} +// prettier-ignore +function FromOmit(parameters) { + return Omit(parameters[0], parameters[1]); +} +// prettier-ignore +function FromPick(parameters) { + return Pick(parameters[0], parameters[1]); +} +// prettier-ignore +function FromRequired(parameters) { + return Required(parameters[0]); +} +// prettier-ignore +function FromComputed(moduleProperties, target, parameters) { + const dereferenced = DereferenceParameters(moduleProperties, parameters); + return (target === 'Awaited' ? FromAwaited(dereferenced) : + target === 'Index' ? FromIndex(dereferenced) : + target === 'KeyOf' ? FromKeyOf(dereferenced) : + target === 'Partial' ? FromPartial(dereferenced) : + target === 'Omit' ? FromOmit(dereferenced) : + target === 'Pick' ? FromPick(dereferenced) : + target === 'Required' ? FromRequired(dereferenced) : + Never()); +} +function FromArray(moduleProperties, type) { + return Array(FromType(moduleProperties, type)); +} +function FromAsyncIterator(moduleProperties, type) { + return AsyncIterator(FromType(moduleProperties, type)); +} +// prettier-ignore +function FromConstructor(moduleProperties, parameters, instanceType) { + return Constructor(FromTypes(moduleProperties, parameters), FromType(moduleProperties, instanceType)); +} +// prettier-ignore +function FromFunction(moduleProperties, parameters, returnType) { + return FunctionType(FromTypes(moduleProperties, parameters), FromType(moduleProperties, returnType)); +} +function FromIntersect(moduleProperties, types) { + return Intersect(FromTypes(moduleProperties, types)); +} +function FromIterator(moduleProperties, type) { + return Iterator(FromType(moduleProperties, type)); +} +function FromObject(moduleProperties, properties) { + return Object(globalThis.Object.keys(properties).reduce((result, key) => { + return { ...result, [key]: FromType(moduleProperties, properties[key]) }; + }, {})); +} +// prettier-ignore +function FromRecord(moduleProperties, type) { + const [value, pattern] = [FromType(moduleProperties, RecordValue(type)), RecordPattern(type)]; + const result = CloneType(type); + result.patternProperties[pattern] = value; + return result; +} +// prettier-ignore +function FromTransform(moduleProperties, transform) { + return (KindGuard.IsRef(transform)) + ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } + : transform; +} +function FromTuple(moduleProperties, types) { + return Tuple(FromTypes(moduleProperties, types)); +} +function FromUnion(moduleProperties, types) { + return Union(FromTypes(moduleProperties, types)); +} +function FromTypes(moduleProperties, types) { + return types.map((type) => FromType(moduleProperties, type)); +} +// prettier-ignore +export function FromType(moduleProperties, type) { + return ( + // Modifiers + KindGuard.IsOptional(type) ? CreateType(FromType(moduleProperties, Discard(type, [OptionalKind])), type) : + KindGuard.IsReadonly(type) ? CreateType(FromType(moduleProperties, Discard(type, [ReadonlyKind])), type) : + // Transform + KindGuard.IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : + // Types + KindGuard.IsArray(type) ? CreateType(FromArray(moduleProperties, type.items), type) : + KindGuard.IsAsyncIterator(type) ? CreateType(FromAsyncIterator(moduleProperties, type.items), type) : + KindGuard.IsComputed(type) ? CreateType(FromComputed(moduleProperties, type.target, type.parameters)) : + KindGuard.IsConstructor(type) ? CreateType(FromConstructor(moduleProperties, type.parameters, type.returns), type) : + KindGuard.IsFunction(type) ? CreateType(FromFunction(moduleProperties, type.parameters, type.returns), type) : + KindGuard.IsIntersect(type) ? CreateType(FromIntersect(moduleProperties, type.allOf), type) : + KindGuard.IsIterator(type) ? CreateType(FromIterator(moduleProperties, type.items), type) : + KindGuard.IsObject(type) ? CreateType(FromObject(moduleProperties, type.properties), type) : + KindGuard.IsRecord(type) ? CreateType(FromRecord(moduleProperties, type)) : + KindGuard.IsTuple(type) ? CreateType(FromTuple(moduleProperties, type.items || []), type) : + KindGuard.IsUnion(type) ? CreateType(FromUnion(moduleProperties, type.anyOf), type) : + type); +} +// prettier-ignore +export function ComputeType(moduleProperties, key) { + return (key in moduleProperties + ? FromType(moduleProperties, moduleProperties[key]) + : Never()); +} +// prettier-ignore +export function ComputeModuleProperties(moduleProperties) { + return globalThis.Object.getOwnPropertyNames(moduleProperties).reduce((result, key) => { + return { ...result, [key]: ComputeType(moduleProperties, key) }; + }, {}); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/module/index.d.mts new file mode 100644 index 0000000..a8c597e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/index.d.mts @@ -0,0 +1 @@ +export * from './module.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/module/index.mjs new file mode 100644 index 0000000..a8c597e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/index.mjs @@ -0,0 +1 @@ +export * from './module.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.d.mts new file mode 100644 index 0000000..691c829 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.d.mts @@ -0,0 +1,49 @@ +import { Ensure, Evaluate } from '../helpers/index.mjs'; +import { TSchema } from '../schema/index.mjs'; +import { TArray } from '../array/index.mjs'; +import { TAsyncIterator } from '../async-iterator/index.mjs'; +import { TConstructor } from '../constructor/index.mjs'; +import { TEnum, TEnumRecord } from '../enum/index.mjs'; +import { TFunction } from '../function/index.mjs'; +import { TIntersect } from '../intersect/index.mjs'; +import { TIterator } from '../iterator/index.mjs'; +import { TObject, TProperties } from '../object/index.mjs'; +import { TOptional } from '../optional/index.mjs'; +import { TRecord } from '../record/index.mjs'; +import { TReadonly } from '../readonly/index.mjs'; +import { TRef } from '../ref/index.mjs'; +import { TTuple } from '../tuple/index.mjs'; +import { TUnion } from '../union/index.mjs'; +import { Static } from '../static/index.mjs'; +import { TRecursive } from '../recursive/index.mjs'; +type TInferArray = (Ensure>>); +type TInferAsyncIterator = (Ensure>>); +type TInferConstructor = Ensure) => TInfer>; +type TInferFunction = Ensure<(...args: TInferTuple) => TInfer>; +type TInferIterator = (Ensure>>); +type TInferIntersect = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TInferIntersect> : Result); +type ReadonlyOptionalPropertyKeys = { + [Key in keyof Properties]: Properties[Key] extends TReadonly ? (Properties[Key] extends TOptional ? Key : never) : never; +}[keyof Properties]; +type ReadonlyPropertyKeys = { + [Key in keyof Source]: Source[Key] extends TReadonly ? (Source[Key] extends TOptional ? never : Key) : never; +}[keyof Source]; +type OptionalPropertyKeys = { + [Key in keyof Source]: Source[Key] extends TOptional ? (Source[Key] extends TReadonly ? never : Key) : never; +}[keyof Source]; +type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys>; +type InferPropertiesWithModifiers> = Evaluate<(Readonly>>> & Readonly>> & Partial>> & Required>>)>; +type InferProperties = InferPropertiesWithModifiers; +}>; +type TInferObject = (InferProperties); +type TInferTuple = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TInferTuple]> : Result); +type TInferRecord extends infer Key extends PropertyKey ? Key : never, InferedType extends unknown = TInfer> = Ensure<{ + [_ in InferredKey]: InferedType; +}>; +type TInferRef = (Ref extends keyof ModuleProperties ? TInfer : unknown); +type TInferUnion = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TInferUnion> : Result); +type TInfer = (Type extends TArray ? TInferArray : Type extends TAsyncIterator ? TInferAsyncIterator : Type extends TConstructor ? TInferConstructor : Type extends TFunction ? TInferFunction : Type extends TIntersect ? TInferIntersect : Type extends TIterator ? TInferIterator : Type extends TObject ? TInferObject : Type extends TRecord ? TInferRecord : Type extends TRef ? TInferRef : Type extends TTuple ? TInferTuple : Type extends TEnum ? Static : Type extends TUnion ? TInferUnion : Type extends TRecursive ? TInfer : Static); +/** Inference Path for Imports. This type is used to compute TImport `static` */ +export type TInferFromModuleKey = (Key extends keyof ModuleProperties ? TInfer : never); +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/infer.mjs @@ -0,0 +1 @@ +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/module.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/module/module.d.mts new file mode 100644 index 0000000..5240892 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/module.d.mts @@ -0,0 +1,27 @@ +import { Kind } from '../symbols/index.mjs'; +import { SchemaOptions, TSchema } from '../schema/index.mjs'; +import { TProperties } from '../object/index.mjs'; +import { Static } from '../static/index.mjs'; +import { TComputeModuleProperties } from './compute.mjs'; +import { TInferFromModuleKey } from './infer.mjs'; +export interface TDefinitions extends TSchema { + static: { + [K in keyof ModuleProperties]: Static; + }; + $defs: ModuleProperties; +} +export interface TImport extends TSchema { + [Kind]: 'Import'; + static: TInferFromModuleKey; + $defs: ModuleProperties; + $ref: Key; +} +export declare class TModule> { + private readonly $defs; + constructor($defs: ModuleProperties); + /** `[Json]` Imports a Type by Key. */ + Import(key: Key, options?: SchemaOptions): TImport; + private WithIdentifiers; +} +/** `[Json]` Creates a Type Definition Module. */ +export declare function Module(properties: Properties): TModule; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs new file mode 100644 index 0000000..99f7d6c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs @@ -0,0 +1,32 @@ +import { CreateType } from '../create/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +// ------------------------------------------------------------------ +// Module Infrastructure Types +// ------------------------------------------------------------------ +import { ComputeModuleProperties } from './compute.mjs'; +// ------------------------------------------------------------------ +// Module +// ------------------------------------------------------------------ +// prettier-ignore +export class TModule { + constructor($defs) { + const computed = ComputeModuleProperties($defs); + const identified = this.WithIdentifiers(computed); + this.$defs = identified; + } + /** `[Json]` Imports a Type by Key. */ + Import(key, options) { + const $defs = { ...this.$defs, [key]: CreateType(this.$defs[key], options) }; + return CreateType({ [Kind]: 'Import', $defs, $ref: key }); + } + // prettier-ignore + WithIdentifiers($defs) { + return globalThis.Object.getOwnPropertyNames($defs).reduce((result, key) => { + return { ...result, [key]: { ...$defs[key], $id: key } }; + }, {}); + } +} +/** `[Json]` Creates a Type Definition Module. */ +export function Module(properties) { + return new TModule(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/never/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/never/index.d.mts new file mode 100644 index 0000000..381a79e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/never/index.d.mts @@ -0,0 +1 @@ +export * from './never.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/never/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/never/index.mjs new file mode 100644 index 0000000..381a79e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/never/index.mjs @@ -0,0 +1 @@ +export * from './never.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/never/never.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/never/never.d.mts new file mode 100644 index 0000000..c7c83e4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/never/never.d.mts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TNever extends TSchema { + [Kind]: 'Never'; + static: never; + not: {}; +} +/** `[Json]` Creates a Never type */ +export declare function Never(options?: SchemaOptions): TNever; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs new file mode 100644 index 0000000..a1d4938 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Never type */ +export function Never(options) { + return CreateType({ [Kind]: 'Never', not: {} }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/not/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/not/index.d.mts new file mode 100644 index 0000000..7bce22b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/not/index.d.mts @@ -0,0 +1 @@ +export * from './not.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/not/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/not/index.mjs new file mode 100644 index 0000000..7bce22b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/not/index.mjs @@ -0,0 +1 @@ +export * from './not.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/not/not.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/not/not.d.mts new file mode 100644 index 0000000..1e7f2be --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/not/not.d.mts @@ -0,0 +1,10 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TNot extends TSchema { + [Kind]: 'Not'; + static: T extends TNot ? Static : unknown; + not: T; +} +/** `[Json]` Creates a Not type */ +export declare function Not(type: Type, options?: SchemaOptions): TNot; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs new file mode 100644 index 0000000..2d1ea6c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Not type */ +export function Not(type, options) { + return CreateType({ [Kind]: 'Not', not: type }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/null/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/null/index.d.mts new file mode 100644 index 0000000..5b0152c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/null/index.d.mts @@ -0,0 +1 @@ +export * from './null.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/null/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/null/index.mjs new file mode 100644 index 0000000..5b0152c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/null/index.mjs @@ -0,0 +1 @@ +export * from './null.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/null/null.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/null/null.d.mts new file mode 100644 index 0000000..668b03c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/null/null.d.mts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TNull extends TSchema { + [Kind]: 'Null'; + static: null; + type: 'null'; +} +/** `[Json]` Creates a Null type */ +export declare function Null(options?: SchemaOptions): TNull; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs new file mode 100644 index 0000000..876e35a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Null type */ +export function Null(options) { + return CreateType({ [Kind]: 'Null', type: 'null' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/number/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/number/index.d.mts new file mode 100644 index 0000000..8cdb1e1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/number/index.d.mts @@ -0,0 +1 @@ +export * from './number.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/number/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/number/index.mjs new file mode 100644 index 0000000..8cdb1e1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/number/index.mjs @@ -0,0 +1 @@ +export * from './number.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/number/number.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/number/number.d.mts new file mode 100644 index 0000000..d0e966a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/number/number.d.mts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface NumberOptions extends SchemaOptions { + exclusiveMaximum?: number; + exclusiveMinimum?: number; + maximum?: number; + minimum?: number; + multipleOf?: number; +} +export interface TNumber extends TSchema, NumberOptions { + [Kind]: 'Number'; + static: number; + type: 'number'; +} +/** `[Json]` Creates a Number type */ +export declare function Number(options?: NumberOptions): TNumber; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs new file mode 100644 index 0000000..8fecb55 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Number type */ +export function Number(options) { + return CreateType({ [Kind]: 'Number', type: 'number' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/object/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/object/index.d.mts new file mode 100644 index 0000000..e866a0f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/object/index.d.mts @@ -0,0 +1 @@ +export * from './object.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/object/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/object/index.mjs new file mode 100644 index 0000000..e866a0f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/object/index.mjs @@ -0,0 +1 @@ +export * from './object.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/object/object.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/object/object.d.mts new file mode 100644 index 0000000..ad84b31 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/object/object.d.mts @@ -0,0 +1,51 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import type { Evaluate, UnionToTuple } from '../helpers/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import type { TOptional } from '../optional/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +type ReadonlyOptionalPropertyKeys = { + [K in keyof T]: T[K] extends TReadonly ? (T[K] extends TOptional ? K : never) : never; +}[keyof T]; +type ReadonlyPropertyKeys = { + [K in keyof T]: T[K] extends TReadonly ? (T[K] extends TOptional ? never : K) : never; +}[keyof T]; +type OptionalPropertyKeys = { + [K in keyof T]: T[K] extends TOptional ? (T[K] extends TReadonly ? never : K) : never; +}[keyof T]; +type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys>; +type ObjectStaticProperties> = Evaluate<(Readonly>>> & Readonly>> & Partial>> & Required>>)>; +type ObjectStatic = ObjectStaticProperties; +}>; +export type TPropertyKey = string | number; +export type TProperties = Record; +type TIsLiteralString = ([ + Type +] extends [string] ? [string] extends [Type] ? false : true : false); +type IsRequiredArrayLiteralConstant = (RequiredTuple extends [infer Left extends string, ...infer _ extends string[]] ? TIsLiteralString : false); +type TRequiredArray ? never : Key]: Properties[Key]; +}, RequiredUnion extends string = Extract, RequiredTuple extends string[] = UnionToTuple, Result extends string[] | undefined = (IsRequiredArrayLiteralConstant extends true ? RequiredTuple : string[] | undefined)> = Result; +export type TAdditionalProperties = undefined | TSchema | boolean; +export interface ObjectOptions extends SchemaOptions { + /** Additional property constraints for this object */ + additionalProperties?: TAdditionalProperties; + /** The minimum number of properties allowed on this object */ + minProperties?: number; + /** The maximum number of properties allowed on this object */ + maxProperties?: number; +} +export interface TObject extends TSchema, ObjectOptions { + [Kind]: 'Object'; + static: ObjectStatic; + additionalProperties?: TAdditionalProperties; + type: 'object'; + properties: T; + required: TRequiredArray; +} +/** `[Json]` Creates an Object type */ +declare function _Object(properties: T, options?: ObjectOptions): TObject; +/** `[Json]` Creates an Object type */ +export declare var Object: typeof _Object; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs new file mode 100644 index 0000000..1730d52 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs @@ -0,0 +1,18 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsOptional } from '../guard/kind.mjs'; +/** Creates a RequiredArray derived from the given TProperties value. */ +function RequiredArray(properties) { + return globalThis.Object.keys(properties).filter((key) => !IsOptional(properties[key])); +} +/** `[Json]` Creates an Object type */ +function _Object(properties, options) { + const required = RequiredArray(properties); + const schema = required.length > 0 ? { [Kind]: 'Object', type: 'object', required, properties } : { [Kind]: 'Object', type: 'object', properties }; + return CreateType(schema, options); +} +/** `[Json]` Creates an Object type */ +export var Object = _Object; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.d.mts new file mode 100644 index 0000000..0886987 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.d.mts @@ -0,0 +1,3 @@ +export * from './omit-from-mapped-key.mjs'; +export * from './omit-from-mapped-result.mjs'; +export * from './omit.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.mjs new file mode 100644 index 0000000..0886987 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/index.mjs @@ -0,0 +1,3 @@ +export * from './omit-from-mapped-key.mjs'; +export * from './omit-from-mapped-result.mjs'; +export * from './omit.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.d.mts new file mode 100644 index 0000000..10877e3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.d.mts @@ -0,0 +1,12 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs'; +import { type TOmit } from './omit.mjs'; +type TFromPropertyKey = { + [_ in Key]: TOmit; +}; +type TFromPropertyKeys = (PropertyKeys extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? TFromPropertyKeys> : Result); +type TFromMappedKey = (TFromPropertyKeys); +export type TOmitFromMappedKey> = (TMappedResult); +export declare function OmitFromMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs new file mode 100644 index 0000000..dc3b0b6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs @@ -0,0 +1,22 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Omit } from './omit.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromPropertyKey(type, key, options) { + return { [key]: Omit(type, [key], Clone(options)) }; +} +// prettier-ignore +function FromPropertyKeys(type, propertyKeys, options) { + return propertyKeys.reduce((Acc, LK) => { + return { ...Acc, ...FromPropertyKey(type, LK, options) }; + }, {}); +} +// prettier-ignore +function FromMappedKey(type, mappedKey, options) { + return FromPropertyKeys(type, mappedKey.keys, options); +} +// prettier-ignore +export function OmitFromMappedKey(type, mappedKey, options) { + const properties = FromMappedKey(type, mappedKey, options); + return MappedResult(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.d.mts new file mode 100644 index 0000000..ffd94ef --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.d.mts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index.mjs'; +import type { Ensure, Evaluate } from '../helpers/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TOmit } from './omit.mjs'; +type TFromProperties = ({ + [K2 in keyof Properties]: TOmit; +}); +type TFromMappedResult = (Evaluate>); +export type TOmitFromMappedResult> = (Ensure>); +export declare function OmitFromMappedResult>(mappedResult: MappedResult, propertyKeys: [...PropertyKeys], options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs new file mode 100644 index 0000000..4e5859a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs @@ -0,0 +1,19 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Omit } from './omit.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromProperties(properties, propertyKeys, options) { + const result = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(properties)) + result[K2] = Omit(properties[K2], propertyKeys, Clone(options)); + return result; +} +// prettier-ignore +function FromMappedResult(mappedResult, propertyKeys, options) { + return FromProperties(mappedResult.properties, propertyKeys, options); +} +// prettier-ignore +export function OmitFromMappedResult(mappedResult, propertyKeys, options) { + const properties = FromMappedResult(mappedResult, propertyKeys, options); + return MappedResult(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.d.mts new file mode 100644 index 0000000..3a00a9b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.d.mts @@ -0,0 +1,36 @@ +import type { SchemaOptions, TSchema } from '../schema/index.mjs'; +import type { TupleToUnion, Evaluate } from '../helpers/index.mjs'; +import { type TRecursive } from '../recursive/index.mjs'; +import type { TMappedKey, TMappedResult } from '../mapped/index.mjs'; +import { TComputed } from '../computed/index.mjs'; +import { TLiteral, TLiteralValue } from '../literal/index.mjs'; +import { type TIndexPropertyKeys } from '../indexed/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TObject, type TProperties } from '../object/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +import { type TOmitFromMappedKey } from './omit-from-mapped-key.mjs'; +import { type TOmitFromMappedResult } from './omit-from-mapped-result.mjs'; +type TFromIntersect = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect]> : Result); +type TFromUnion = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion]> : Result); +type TFromProperties> = (Evaluate>); +type TFromObject<_Type extends TObject, PropertyKeys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TUnionFromPropertyKeys = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys]> : TUnionFromPropertyKeys : TUnion); +export type TOmitResolve = (Properties extends TRecursive ? TRecursive> : Properties extends TIntersect ? TIntersect> : Properties extends TUnion ? TUnion> : Properties extends TObject ? TFromObject : TObject<{}>); +type TResolvePropertyKeys = Key extends TSchema ? TIndexPropertyKeys : Key; +type TResolveTypeKey = Key extends PropertyKey[] ? TUnionFromPropertyKeys : Key; +export type TOmit = (Type extends TMappedResult ? TOmitFromMappedResult> : Key extends TMappedKey ? TOmitFromMappedKey : [ + IsTypeRef, + IsKeyRef +] extends [true, true] ? TComputed<'Omit', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [false, true] ? TComputed<'Omit', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [true, false] ? TComputed<'Omit', [Type, TResolveTypeKey]> : TOmitResolve>); +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Omit(type: Type, key: readonly [...Key], options?: SchemaOptions): TOmit; +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Omit(type: Type, key: Key, options?: SchemaOptions): TOmit; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs new file mode 100644 index 0000000..4f3a642 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs @@ -0,0 +1,71 @@ +import { CreateType } from '../create/type.mjs'; +import { Discard } from '../discard/discard.mjs'; +import { TransformKind } from '../symbols/symbols.mjs'; +import { Computed } from '../computed/index.mjs'; +import { Literal } from '../literal/index.mjs'; +import { IndexPropertyKeys } from '../indexed/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Union } from '../union/index.mjs'; +import { Object } from '../object/index.mjs'; +// ------------------------------------------------------------------ +// Mapped +// ------------------------------------------------------------------ +import { OmitFromMappedKey } from './omit-from-mapped-key.mjs'; +import { OmitFromMappedResult } from './omit-from-mapped-result.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsMappedKey, IsIntersect, IsUnion, IsObject, IsSchema, IsMappedResult, IsLiteralValue, IsRef } from '../guard/kind.mjs'; +import { IsArray as IsArrayValue } from '../guard/value.mjs'; +// prettier-ignore +function FromIntersect(types, propertyKeys) { + return types.map((type) => OmitResolve(type, propertyKeys)); +} +// prettier-ignore +function FromUnion(types, propertyKeys) { + return types.map((type) => OmitResolve(type, propertyKeys)); +} +// ------------------------------------------------------------------ +// FromProperty +// ------------------------------------------------------------------ +// prettier-ignore +function FromProperty(properties, key) { + const { [key]: _, ...R } = properties; + return R; +} +// prettier-ignore +function FromProperties(properties, propertyKeys) { + return propertyKeys.reduce((T, K2) => FromProperty(T, K2), properties); +} +// prettier-ignore +function FromObject(type, propertyKeys, properties) { + const options = Discard(type, [TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties, propertyKeys); + return Object(mappedProperties, options); +} +// prettier-ignore +function UnionFromPropertyKeys(propertyKeys) { + const result = propertyKeys.reduce((result, key) => IsLiteralValue(key) ? [...result, Literal(key)] : result, []); + return Union(result); +} +// prettier-ignore +function OmitResolve(type, propertyKeys) { + return (IsIntersect(type) ? Intersect(FromIntersect(type.allOf, propertyKeys)) : + IsUnion(type) ? Union(FromUnion(type.anyOf, propertyKeys)) : + IsObject(type) ? FromObject(type, propertyKeys, type.properties) : + Object({})); +} +/** `[Json]` Constructs a type whose keys are picked from the given type */ +// prettier-ignore +export function Omit(type, key, options) { + const typeKey = IsArrayValue(key) ? UnionFromPropertyKeys(key) : key; + const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key; + const isTypeRef = IsRef(type); + const isKeyRef = IsRef(key); + return (IsMappedResult(type) ? OmitFromMappedResult(type, propertyKeys, options) : + IsMappedKey(key) ? OmitFromMappedKey(type, key, options) : + (isTypeRef && isKeyRef) ? Computed('Omit', [type, typeKey], options) : + (!isTypeRef && isKeyRef) ? Computed('Omit', [type, typeKey], options) : + (isTypeRef && !isKeyRef) ? Computed('Omit', [type, typeKey], options) : + CreateType({ ...OmitResolve(type, propertyKeys), ...options })); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.d.mts new file mode 100644 index 0000000..5b89537 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.d.mts @@ -0,0 +1,2 @@ +export * from './optional-from-mapped-result.mjs'; +export * from './optional.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.mjs new file mode 100644 index 0000000..5b89537 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/index.mjs @@ -0,0 +1,2 @@ +export * from './optional-from-mapped-result.mjs'; +export * from './optional.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.d.mts new file mode 100644 index 0000000..d8f5fd3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.d.mts @@ -0,0 +1,10 @@ +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TOptionalWithFlag } from './optional.mjs'; +type TFromProperties

= ({ + [K2 in keyof P]: TOptionalWithFlag; +}); +type TFromMappedResult = (TFromProperties); +export type TOptionalFromMappedResult> = (TMappedResult

); +export declare function OptionalFromMappedResult>(R: R, F: F): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs new file mode 100644 index 0000000..4b47335 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs @@ -0,0 +1,18 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Optional } from './optional.mjs'; +// prettier-ignore +function FromProperties(P, F) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = Optional(P[K2], F); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, F) { + return FromProperties(R.properties, F); +} +// prettier-ignore +export function OptionalFromMappedResult(R, F) { + const P = FromMappedResult(R, F); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.d.mts new file mode 100644 index 0000000..7e17a6c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.d.mts @@ -0,0 +1,20 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { Ensure } from '../helpers/index.mjs'; +import { OptionalKind } from '../symbols/index.mjs'; +import type { TMappedResult } from '../mapped/index.mjs'; +import { type TOptionalFromMappedResult } from './optional-from-mapped-result.mjs'; +type TRemoveOptional = T extends TOptional ? S : T; +type TAddOptional = T extends TOptional ? TOptional : Ensure>; +export type TOptionalWithFlag = F extends false ? TRemoveOptional : TAddOptional; +export type TOptional = T & { + [OptionalKind]: 'Optional'; +}; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T, enable: F): TOptionalFromMappedResult; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T, enable: F): TOptionalWithFlag; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T): TOptionalFromMappedResult; +/** `[Json]` Creates a Optional property */ +export declare function Optional(schema: T): TOptionalWithFlag; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs new file mode 100644 index 0000000..90469a9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs @@ -0,0 +1,22 @@ +import { CreateType } from '../create/type.mjs'; +import { OptionalKind } from '../symbols/index.mjs'; +import { Discard } from '../discard/index.mjs'; +import { OptionalFromMappedResult } from './optional-from-mapped-result.mjs'; +import { IsMappedResult } from '../guard/kind.mjs'; +function RemoveOptional(schema) { + return CreateType(Discard(schema, [OptionalKind])); +} +function AddOptional(schema) { + return CreateType({ ...schema, [OptionalKind]: 'Optional' }); +} +// prettier-ignore +function OptionalWithFlag(schema, F) { + return (F === false + ? RemoveOptional(schema) + : AddOptional(schema)); +} +/** `[Json]` Creates a Optional property */ +export function Optional(schema, enable) { + const F = enable ?? true; + return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.d.mts new file mode 100644 index 0000000..2684356 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.d.mts @@ -0,0 +1 @@ +export * from './parameters.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.mjs new file mode 100644 index 0000000..2684356 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/index.mjs @@ -0,0 +1 @@ +export * from './parameters.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.d.mts new file mode 100644 index 0000000..2a1318a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.d.mts @@ -0,0 +1,7 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TFunction } from '../function/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { type TNever } from '../never/index.mjs'; +export type TParameters = (Type extends TFunction ? TTuple : TNever); +/** `[JavaScript]` Extracts the Parameters from the given Function type */ +export declare function Parameters(schema: Type, options?: SchemaOptions): TParameters; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs new file mode 100644 index 0000000..c680fbe --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs @@ -0,0 +1,7 @@ +import { Tuple } from '../tuple/index.mjs'; +import { Never } from '../never/index.mjs'; +import * as KindGuard from '../guard/kind.mjs'; +/** `[JavaScript]` Extracts the Parameters from the given Function type */ +export function Parameters(schema, options) { + return (KindGuard.IsFunction(schema) ? Tuple(schema.parameters, options) : Never()); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.d.mts new file mode 100644 index 0000000..8ba941c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.d.mts @@ -0,0 +1,2 @@ +export * from './partial-from-mapped-result.mjs'; +export * from './partial.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.mjs new file mode 100644 index 0000000..8ba941c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/index.mjs @@ -0,0 +1,2 @@ +export * from './partial-from-mapped-result.mjs'; +export * from './partial.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.d.mts new file mode 100644 index 0000000..1e0f8e0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.d.mts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index.mjs'; +import type { Ensure, Evaluate } from '../helpers/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TPartial } from './partial.mjs'; +type TFromProperties

= ({ + [K2 in keyof P]: TPartial; +}); +type TFromMappedResult = (Evaluate>); +export type TPartialFromMappedResult> = (Ensure>); +export declare function PartialFromMappedResult>(R: R, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs new file mode 100644 index 0000000..191790d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs @@ -0,0 +1,19 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Partial } from './partial.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromProperties(K, options) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(K)) + Acc[K2] = Partial(K[K2], Clone(options)); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, options) { + return FromProperties(R.properties, options); +} +// prettier-ignore +export function PartialFromMappedResult(R, options) { + const P = FromMappedResult(R, options); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.d.mts new file mode 100644 index 0000000..b165bd1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.d.mts @@ -0,0 +1,35 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Evaluate, Ensure } from '../helpers/index.mjs'; +import type { TMappedResult } from '../mapped/index.mjs'; +import { type TReadonlyOptional } from '../readonly-optional/index.mjs'; +import { type TComputed } from '../computed/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +import { type TReadonly } from '../readonly/index.mjs'; +import { type TRecursive } from '../recursive/index.mjs'; +import { type TObject, type TProperties } from '../object/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +import { type TBigInt } from '../bigint/index.mjs'; +import { type TBoolean } from '../boolean/index.mjs'; +import { type TInteger } from '../integer/index.mjs'; +import { type TLiteral } from '../literal/index.mjs'; +import { type TNull } from '../null/index.mjs'; +import { type TNumber } from '../number/index.mjs'; +import { type TString } from '../string/index.mjs'; +import { type TSymbol } from '../symbol/index.mjs'; +import { type TUndefined } from '../undefined/index.mjs'; +import { type TPartialFromMappedResult } from './partial-from-mapped-result.mjs'; +type TFromComputed = Ensure]>>; +type TFromRef = Ensure]>>; +type TFromProperties = Evaluate<{ + [K in keyof Properties]: Properties[K] extends (TReadonlyOptional) ? TReadonlyOptional : Properties[K] extends (TReadonly) ? TReadonlyOptional : Properties[K] extends (TOptional) ? TOptional : TOptional; +}>; +type TFromObject<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TFromRest = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Result); +export type TPartial = (Type extends TRecursive ? TRecursive> : Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TObject ? TFromObject : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>); +/** `[Json]` Constructs a type where all properties are optional */ +export declare function Partial(type: MappedResult, options?: SchemaOptions): TPartialFromMappedResult; +/** `[Json]` Constructs a type where all properties are optional */ +export declare function Partial(type: Type, options?: SchemaOptions): TPartial; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs new file mode 100644 index 0000000..0ba7ce9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs @@ -0,0 +1,74 @@ +import { CreateType } from '../create/type.mjs'; +import { Computed } from '../computed/index.mjs'; +import { Optional } from '../optional/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Union } from '../union/index.mjs'; +import { Ref } from '../ref/index.mjs'; +import { Discard } from '../discard/index.mjs'; +import { TransformKind } from '../symbols/index.mjs'; +import { PartialFromMappedResult } from './partial-from-mapped-result.mjs'; +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +import * as KindGuard from '../guard/kind.mjs'; +// prettier-ignore +function FromComputed(target, parameters) { + return Computed('Partial', [Computed(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return Computed('Partial', [Ref($ref)]); +} +// prettier-ignore +function FromProperties(properties) { + const partialProperties = {}; + for (const K of globalThis.Object.getOwnPropertyNames(properties)) + partialProperties[K] = Optional(properties[K]); + return partialProperties; +} +// prettier-ignore +function FromObject(type, properties) { + const options = Discard(type, [TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties); + return Object(mappedProperties, options); +} +// prettier-ignore +function FromRest(types) { + return types.map(type => PartialResolve(type)); +} +// ------------------------------------------------------------------ +// PartialResolve +// ------------------------------------------------------------------ +// prettier-ignore +function PartialResolve(type) { + return ( + // Mappable + KindGuard.IsComputed(type) ? FromComputed(type.target, type.parameters) : + KindGuard.IsRef(type) ? FromRef(type.$ref) : + KindGuard.IsIntersect(type) ? Intersect(FromRest(type.allOf)) : + KindGuard.IsUnion(type) ? Union(FromRest(type.anyOf)) : + KindGuard.IsObject(type) ? FromObject(type, type.properties) : + // Intrinsic + KindGuard.IsBigInt(type) ? type : + KindGuard.IsBoolean(type) ? type : + KindGuard.IsInteger(type) ? type : + KindGuard.IsLiteral(type) ? type : + KindGuard.IsNull(type) ? type : + KindGuard.IsNumber(type) ? type : + KindGuard.IsString(type) ? type : + KindGuard.IsSymbol(type) ? type : + KindGuard.IsUndefined(type) ? type : + // Passthrough + Object({})); +} +/** `[Json]` Constructs a type where all properties are optional */ +export function Partial(type, options) { + if (KindGuard.IsMappedResult(type)) { + return PartialFromMappedResult(type, options); + } + else { + // special: mapping types require overridable options + return CreateType({ ...PartialResolve(type), ...options }); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.d.mts new file mode 100644 index 0000000..7a645c4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.d.mts @@ -0,0 +1 @@ +export * from './patterns.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.mjs new file mode 100644 index 0000000..7a645c4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/index.mjs @@ -0,0 +1 @@ +export * from './patterns.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.d.mts new file mode 100644 index 0000000..37e3ae2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.d.mts @@ -0,0 +1,8 @@ +export declare const PatternBoolean = "(true|false)"; +export declare const PatternNumber = "(0|[1-9][0-9]*)"; +export declare const PatternString = "(.*)"; +export declare const PatternNever = "(?!.*)"; +export declare const PatternBooleanExact = "^(true|false)$"; +export declare const PatternNumberExact = "^(0|[1-9][0-9]*)$"; +export declare const PatternStringExact = "^(.*)$"; +export declare const PatternNeverExact = "^(?!.*)$"; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs new file mode 100644 index 0000000..52fa2c5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs @@ -0,0 +1,8 @@ +export const PatternBoolean = '(true|false)'; +export const PatternNumber = '(0|[1-9][0-9]*)'; +export const PatternString = '(.*)'; +export const PatternNever = '(?!.*)'; +export const PatternBooleanExact = `^${PatternBoolean}$`; +export const PatternNumberExact = `^${PatternNumber}$`; +export const PatternStringExact = `^${PatternString}$`; +export const PatternNeverExact = `^${PatternNever}$`; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.d.mts new file mode 100644 index 0000000..274be36 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.d.mts @@ -0,0 +1,3 @@ +export * from './pick-from-mapped-key.mjs'; +export * from './pick-from-mapped-result.mjs'; +export * from './pick.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.mjs new file mode 100644 index 0000000..274be36 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/index.mjs @@ -0,0 +1,3 @@ +export * from './pick-from-mapped-key.mjs'; +export * from './pick-from-mapped-result.mjs'; +export * from './pick.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.d.mts new file mode 100644 index 0000000..2fb955e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.d.mts @@ -0,0 +1,12 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult, type TMappedKey } from '../mapped/index.mjs'; +import { type TPick } from './pick.mjs'; +type TFromPropertyKey = { + [_ in Key]: TPick; +}; +type TFromPropertyKeys = (PropertyKeys extends [infer LeftKey extends PropertyKey, ...infer RightKeys extends PropertyKey[]] ? TFromPropertyKeys> : Result); +type TFromMappedKey = (TFromPropertyKeys); +export type TPickFromMappedKey> = (TMappedResult); +export declare function PickFromMappedKey>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs new file mode 100644 index 0000000..2c59ee1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs @@ -0,0 +1,24 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Pick } from './pick.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromPropertyKey(type, key, options) { + return { + [key]: Pick(type, [key], Clone(options)) + }; +} +// prettier-ignore +function FromPropertyKeys(type, propertyKeys, options) { + return propertyKeys.reduce((result, leftKey) => { + return { ...result, ...FromPropertyKey(type, leftKey, options) }; + }, {}); +} +// prettier-ignore +function FromMappedKey(type, mappedKey, options) { + return FromPropertyKeys(type, mappedKey.keys, options); +} +// prettier-ignore +export function PickFromMappedKey(type, mappedKey, options) { + const properties = FromMappedKey(type, mappedKey, options); + return MappedResult(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.d.mts new file mode 100644 index 0000000..1ae0164 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.d.mts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index.mjs'; +import type { Ensure, Evaluate } from '../helpers/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TPick } from './pick.mjs'; +type TFromProperties = ({ + [K2 in keyof Properties]: TPick; +}); +type TFromMappedResult = (Evaluate>); +export type TPickFromMappedResult> = (Ensure>); +export declare function PickFromMappedResult>(mappedResult: MappedResult, propertyKeys: [...PropertyKeys], options?: SchemaOptions): TMappedResult; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs new file mode 100644 index 0000000..0e4c688 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs @@ -0,0 +1,19 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Pick } from './pick.mjs'; +import { Clone } from '../clone/value.mjs'; +// prettier-ignore +function FromProperties(properties, propertyKeys, options) { + const result = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(properties)) + result[K2] = Pick(properties[K2], propertyKeys, Clone(options)); + return result; +} +// prettier-ignore +function FromMappedResult(mappedResult, propertyKeys, options) { + return FromProperties(mappedResult.properties, propertyKeys, options); +} +// prettier-ignore +export function PickFromMappedResult(mappedResult, propertyKeys, options) { + const properties = FromMappedResult(mappedResult, propertyKeys, options); + return MappedResult(properties); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.d.mts new file mode 100644 index 0000000..8c272a8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.d.mts @@ -0,0 +1,36 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { TupleToUnion, Evaluate } from '../helpers/index.mjs'; +import { type TRecursive } from '../recursive/index.mjs'; +import { type TComputed } from '../computed/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TLiteral, type TLiteralValue } from '../literal/index.mjs'; +import { type TObject, type TProperties } from '../object/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TMappedKey, type TMappedResult } from '../mapped/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +import { type TIndexPropertyKeys } from '../indexed/index.mjs'; +import { type TPickFromMappedKey } from './pick-from-mapped-key.mjs'; +import { type TPickFromMappedResult } from './pick-from-mapped-result.mjs'; +type TFromIntersect = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromIntersect]> : Result; +type TFromUnion = Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromUnion]> : Result; +type TFromProperties> = (Evaluate>); +type TFromObject<_Type extends TObject, Keys extends PropertyKey[], Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TUnionFromPropertyKeys = (PropertyKeys extends [infer Key extends PropertyKey, ...infer Rest extends PropertyKey[]] ? Key extends TLiteralValue ? TUnionFromPropertyKeys]> : TUnionFromPropertyKeys : TUnion); +export type TPickResolve = (Type extends TRecursive ? TRecursive> : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TObject ? TFromObject : TObject<{}>); +type TResolvePropertyKeys = Key extends TSchema ? TIndexPropertyKeys : Key; +type TResolveTypeKey = Key extends PropertyKey[] ? TUnionFromPropertyKeys : Key; +export type TPick = (Type extends TMappedResult ? TPickFromMappedResult> : Key extends TMappedKey ? TPickFromMappedKey : [ + IsTypeRef, + IsKeyRef +] extends [true, true] ? TComputed<'Pick', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [false, true] ? TComputed<'Pick', [Type, TResolveTypeKey]> : [ + IsTypeRef, + IsKeyRef +] extends [true, false] ? TComputed<'Pick', [Type, TResolveTypeKey]> : TPickResolve>); +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Pick(type: Type, key: readonly [...Key], options?: SchemaOptions): TPick; +/** `[Json]` Constructs a type whose keys are picked from the given type */ +export declare function Pick(type: Type, key: Key, options?: SchemaOptions): TPick; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs new file mode 100644 index 0000000..2b459bd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs @@ -0,0 +1,66 @@ +import { CreateType } from '../create/type.mjs'; +import { Discard } from '../discard/discard.mjs'; +import { Computed } from '../computed/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Union } from '../union/index.mjs'; +import { IndexPropertyKeys } from '../indexed/index.mjs'; +import { TransformKind } from '../symbols/symbols.mjs'; +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +import { IsMappedKey, IsMappedResult, IsIntersect, IsUnion, IsObject, IsSchema, IsLiteralValue, IsRef } from '../guard/kind.mjs'; +import { IsArray as IsArrayValue } from '../guard/value.mjs'; +// ------------------------------------------------------------------ +// Infrastructure +// ------------------------------------------------------------------ +import { PickFromMappedKey } from './pick-from-mapped-key.mjs'; +import { PickFromMappedResult } from './pick-from-mapped-result.mjs'; +function FromIntersect(types, propertyKeys) { + return types.map((type) => PickResolve(type, propertyKeys)); +} +// prettier-ignore +function FromUnion(types, propertyKeys) { + return types.map((type) => PickResolve(type, propertyKeys)); +} +// prettier-ignore +function FromProperties(properties, propertyKeys) { + const result = {}; + for (const K2 of propertyKeys) + if (K2 in properties) + result[K2] = properties[K2]; + return result; +} +// prettier-ignore +function FromObject(Type, keys, properties) { + const options = Discard(Type, [TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties, keys); + return Object(mappedProperties, options); +} +// prettier-ignore +function UnionFromPropertyKeys(propertyKeys) { + const result = propertyKeys.reduce((result, key) => IsLiteralValue(key) ? [...result, Literal(key)] : result, []); + return Union(result); +} +// prettier-ignore +function PickResolve(type, propertyKeys) { + return (IsIntersect(type) ? Intersect(FromIntersect(type.allOf, propertyKeys)) : + IsUnion(type) ? Union(FromUnion(type.anyOf, propertyKeys)) : + IsObject(type) ? FromObject(type, propertyKeys, type.properties) : + Object({})); +} +/** `[Json]` Constructs a type whose keys are picked from the given type */ +// prettier-ignore +export function Pick(type, key, options) { + const typeKey = IsArrayValue(key) ? UnionFromPropertyKeys(key) : key; + const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key; + const isTypeRef = IsRef(type); + const isKeyRef = IsRef(key); + return (IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) : + IsMappedKey(key) ? PickFromMappedKey(type, key, options) : + (isTypeRef && isKeyRef) ? Computed('Pick', [type, typeKey], options) : + (!isTypeRef && isKeyRef) ? Computed('Pick', [type, typeKey], options) : + (isTypeRef && !isKeyRef) ? Computed('Pick', [type, typeKey], options) : + CreateType({ ...PickResolve(type, propertyKeys), ...options })); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.d.mts new file mode 100644 index 0000000..02a51fc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.d.mts @@ -0,0 +1 @@ +export * from './promise.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.mjs new file mode 100644 index 0000000..02a51fc --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/index.mjs @@ -0,0 +1 @@ +export * from './promise.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.d.mts new file mode 100644 index 0000000..fb57d27 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.d.mts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TPromise extends TSchema { + [Kind]: 'Promise'; + static: Promise>; + type: 'Promise'; + item: TSchema; +} +/** `[JavaScript]` Creates a Promise type */ +export declare function Promise(item: T, options?: SchemaOptions): TPromise; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs new file mode 100644 index 0000000..c128ed5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a Promise type */ +export function Promise(item, options) { + return CreateType({ [Kind]: 'Promise', type: 'Promise', item }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.d.mts new file mode 100644 index 0000000..a42744c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.d.mts @@ -0,0 +1 @@ +export * from './readonly-optional.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.mjs new file mode 100644 index 0000000..a42744c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/index.mjs @@ -0,0 +1 @@ +export * from './readonly-optional.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.d.mts new file mode 100644 index 0000000..b125361 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.d.mts @@ -0,0 +1,6 @@ +import type { TSchema } from '../schema/index.mjs'; +import { type TReadonly } from '../readonly/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +export type TReadonlyOptional = TOptional & TReadonly; +/** `[Json]` Creates a Readonly and Optional property */ +export declare function ReadonlyOptional(schema: T): TReadonly>; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs new file mode 100644 index 0000000..51dd577 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs @@ -0,0 +1,6 @@ +import { Readonly } from '../readonly/index.mjs'; +import { Optional } from '../optional/index.mjs'; +/** `[Json]` Creates a Readonly and Optional property */ +export function ReadonlyOptional(schema) { + return Readonly(Optional(schema)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.d.mts new file mode 100644 index 0000000..d5964b8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.d.mts @@ -0,0 +1,2 @@ +export * from './readonly-from-mapped-result.mjs'; +export * from './readonly.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.mjs new file mode 100644 index 0000000..d5964b8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/index.mjs @@ -0,0 +1,2 @@ +export * from './readonly-from-mapped-result.mjs'; +export * from './readonly.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.d.mts new file mode 100644 index 0000000..4a5b3e6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.d.mts @@ -0,0 +1,10 @@ +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TReadonlyWithFlag } from './readonly.mjs'; +type TFromProperties

= ({ + [K2 in keyof P]: TReadonlyWithFlag; +}); +type TFromMappedResult = (TFromProperties); +export type TReadonlyFromMappedResult> = (TMappedResult

); +export declare function ReadonlyFromMappedResult>(R: R, F: F): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs new file mode 100644 index 0000000..4c9c050 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs @@ -0,0 +1,18 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Readonly } from './readonly.mjs'; +// prettier-ignore +function FromProperties(K, F) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(K)) + Acc[K2] = Readonly(K[K2], F); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, F) { + return FromProperties(R.properties, F); +} +// prettier-ignore +export function ReadonlyFromMappedResult(R, F) { + const P = FromMappedResult(R, F); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.d.mts new file mode 100644 index 0000000..a2366c0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.d.mts @@ -0,0 +1,20 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { Ensure } from '../helpers/index.mjs'; +import { ReadonlyKind } from '../symbols/index.mjs'; +import type { TMappedResult } from '../mapped/index.mjs'; +import { type TReadonlyFromMappedResult } from './readonly-from-mapped-result.mjs'; +type TRemoveReadonly = T extends TReadonly ? S : T; +type TAddReadonly = T extends TReadonly ? TReadonly : Ensure>; +export type TReadonlyWithFlag = F extends false ? TRemoveReadonly : TAddReadonly; +export type TReadonly = T & { + [ReadonlyKind]: 'Readonly'; +}; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T, enable: F): TReadonlyFromMappedResult; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T, enable: F): TReadonlyWithFlag; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T): TReadonlyFromMappedResult; +/** `[Json]` Creates a Readonly property */ +export declare function Readonly(schema: T): TReadonlyWithFlag; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs new file mode 100644 index 0000000..97a9c6f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs @@ -0,0 +1,22 @@ +import { CreateType } from '../create/type.mjs'; +import { ReadonlyKind } from '../symbols/index.mjs'; +import { Discard } from '../discard/index.mjs'; +import { ReadonlyFromMappedResult } from './readonly-from-mapped-result.mjs'; +import { IsMappedResult } from '../guard/kind.mjs'; +function RemoveReadonly(schema) { + return CreateType(Discard(schema, [ReadonlyKind])); +} +function AddReadonly(schema) { + return CreateType({ ...schema, [ReadonlyKind]: 'Readonly' }); +} +// prettier-ignore +function ReadonlyWithFlag(schema, F) { + return (F === false + ? RemoveReadonly(schema) + : AddReadonly(schema)); +} +/** `[Json]` Creates a Readonly property */ +export function Readonly(schema, enable) { + const F = enable ?? true; + return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/record/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/record/index.d.mts new file mode 100644 index 0000000..6eff9ea --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/record/index.d.mts @@ -0,0 +1 @@ +export * from './record.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/record/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/record/index.mjs new file mode 100644 index 0000000..6eff9ea --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/record/index.mjs @@ -0,0 +1 @@ +export * from './record.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/record/record.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/record/record.d.mts new file mode 100644 index 0000000..720c44d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/record/record.d.mts @@ -0,0 +1,71 @@ +import { Kind } from '../symbols/index.mjs'; +import type { TSchema } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import type { Evaluate, Ensure, Assert } from '../helpers/index.mjs'; +import { type TAny } from '../any/index.mjs'; +import { type TBoolean } from '../boolean/index.mjs'; +import { type TEnumRecord, type TEnum } from '../enum/index.mjs'; +import { type TInteger } from '../integer/index.mjs'; +import { type TLiteral, type TLiteralValue } from '../literal/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TNumber } from '../number/index.mjs'; +import { type TObject, type TProperties, type TAdditionalProperties, type ObjectOptions } from '../object/index.mjs'; +import { type TRegExp } from '../regexp/index.mjs'; +import { type TString } from '../string/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { TIsTemplateLiteralFinite, type TTemplateLiteral } from '../template-literal/index.mjs'; +type TFromTemplateLiteralKeyInfinite = Ensure>; +type TFromTemplateLiteralKeyFinite> = (Ensure>>); +type TFromTemplateLiteralKey = TIsTemplateLiteralFinite extends false ? TFromTemplateLiteralKeyInfinite : TFromTemplateLiteralKeyFinite; +type TFromEnumKey, Type extends TSchema> = Ensure>; +type TFromUnionKeyLiteralString, Type extends TSchema> = { + [_ in Key['const']]: Type; +}; +type TFromUnionKeyLiteralNumber, Type extends TSchema> = { + [_ in Key['const']]: Type; +}; +type TFromUnionKeyVariants = Keys extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? (Left extends TUnion ? TFromUnionKeyVariants> : Left extends TLiteral ? TFromUnionKeyVariants> : Left extends TLiteral ? TFromUnionKeyVariants> : {}) : Result; +type TFromUnionKey> = (Ensure>>); +type TFromLiteralKey = (Ensure]: Type; +}>>); +type TFromRegExpKey<_Key extends TRegExp, Type extends TSchema> = (Ensure>); +type TFromStringKey<_Key extends TString, Type extends TSchema> = (Ensure>); +type TFromAnyKey<_Key extends TAny, Type extends TSchema> = (Ensure>); +type TFromNeverKey<_Key extends TNever, Type extends TSchema> = (Ensure>); +type TFromBooleanKey<_Key extends TBoolean, Type extends TSchema> = (Ensure>); +type TFromIntegerKey<_Key extends TSchema, Type extends TSchema> = (Ensure>); +type TFromNumberKey<_Key extends TSchema, Type extends TSchema> = (Ensure>); +type RecordStatic = (Evaluate<{ + [_ in Assert, PropertyKey>]: Static; +}>); +export interface TRecord extends TSchema { + [Kind]: 'Record'; + static: RecordStatic; + type: 'object'; + patternProperties: { + [pattern: string]: Type; + }; + additionalProperties: TAdditionalProperties; +} +export type TRecordOrObject = (Key extends TTemplateLiteral ? TFromTemplateLiteralKey : Key extends TEnum ? TFromEnumKey : Key extends TUnion ? TFromUnionKey : Key extends TLiteral ? TFromLiteralKey : Key extends TBoolean ? TFromBooleanKey : Key extends TInteger ? TFromIntegerKey : Key extends TNumber ? TFromNumberKey : Key extends TRegExp ? TFromRegExpKey : Key extends TString ? TFromStringKey : Key extends TAny ? TFromAnyKey : Key extends TNever ? TFromNeverKey : TNever); +/** `[Json]` Creates a Record type */ +export declare function Record(key: Key, type: Type, options?: ObjectOptions): TRecordOrObject; +/** Gets the Records Pattern */ +export declare function RecordPattern(record: TRecord): string; +/** Gets the Records Key Type */ +export type TRecordKey ? (Key extends TNumber ? TNumber : Key extends TString ? TString : TString) : TString> = Result; +/** Gets the Records Key Type */ +export declare function RecordKey(type: Type): TRecordKey; +/** Gets a Record Value Type */ +export type TRecordValue ? Value : TNever)> = Result; +/** Gets a Record Value Type */ +export declare function RecordValue(type: Type): TRecordValue; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs new file mode 100644 index 0000000..80dc871 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs @@ -0,0 +1,116 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind, Hint } from '../symbols/index.mjs'; +import { Never } from '../never/index.mjs'; +import { Number } from '../number/index.mjs'; +import { Object } from '../object/index.mjs'; +import { String } from '../string/index.mjs'; +import { Union } from '../union/index.mjs'; +import { IsTemplateLiteralFinite } from '../template-literal/index.mjs'; +import { PatternStringExact, PatternNumberExact, PatternNeverExact } from '../patterns/index.mjs'; +import { IndexPropertyKeys } from '../indexed/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsUndefined } from '../guard/value.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsInteger, IsLiteral, IsAny, IsBoolean, IsNever, IsNumber, IsString, IsRegExp, IsTemplateLiteral, IsUnion } from '../guard/kind.mjs'; +// ------------------------------------------------------------------ +// RecordCreateFromPattern +// ------------------------------------------------------------------ +// prettier-ignore +function RecordCreateFromPattern(pattern, T, options) { + return CreateType({ [Kind]: 'Record', type: 'object', patternProperties: { [pattern]: T } }, options); +} +// ------------------------------------------------------------------ +// RecordCreateFromKeys +// ------------------------------------------------------------------ +// prettier-ignore +function RecordCreateFromKeys(K, T, options) { + const result = {}; + for (const K2 of K) + result[K2] = T; + return Object(result, { ...options, [Hint]: 'Record' }); +} +// prettier-ignore +function FromTemplateLiteralKey(K, T, options) { + return (IsTemplateLiteralFinite(K) + ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) + : RecordCreateFromPattern(K.pattern, T, options)); +} +// prettier-ignore +function FromUnionKey(key, type, options) { + return RecordCreateFromKeys(IndexPropertyKeys(Union(key)), type, options); +} +// prettier-ignore +function FromLiteralKey(key, type, options) { + return RecordCreateFromKeys([key.toString()], type, options); +} +// prettier-ignore +function FromRegExpKey(key, type, options) { + return RecordCreateFromPattern(key.source, type, options); +} +// prettier-ignore +function FromStringKey(key, type, options) { + const pattern = IsUndefined(key.pattern) ? PatternStringExact : key.pattern; + return RecordCreateFromPattern(pattern, type, options); +} +// prettier-ignore +function FromAnyKey(_, type, options) { + return RecordCreateFromPattern(PatternStringExact, type, options); +} +// prettier-ignore +function FromNeverKey(_key, type, options) { + return RecordCreateFromPattern(PatternNeverExact, type, options); +} +// prettier-ignore +function FromBooleanKey(_key, type, options) { + return Object({ true: type, false: type }, options); +} +// prettier-ignore +function FromIntegerKey(_key, type, options) { + return RecordCreateFromPattern(PatternNumberExact, type, options); +} +// prettier-ignore +function FromNumberKey(_, type, options) { + return RecordCreateFromPattern(PatternNumberExact, type, options); +} +// ------------------------------------------------------------------ +// TRecordOrObject +// ------------------------------------------------------------------ +/** `[Json]` Creates a Record type */ +export function Record(key, type, options = {}) { + // prettier-ignore + return (IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : + IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : + IsLiteral(key) ? FromLiteralKey(key.const, type, options) : + IsBoolean(key) ? FromBooleanKey(key, type, options) : + IsInteger(key) ? FromIntegerKey(key, type, options) : + IsNumber(key) ? FromNumberKey(key, type, options) : + IsRegExp(key) ? FromRegExpKey(key, type, options) : + IsString(key) ? FromStringKey(key, type, options) : + IsAny(key) ? FromAnyKey(key, type, options) : + IsNever(key) ? FromNeverKey(key, type, options) : + Never(options)); +} +// ------------------------------------------------------------------ +// Record Utilities +// ------------------------------------------------------------------ +/** Gets the Records Pattern */ +export function RecordPattern(record) { + return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0]; +} +/** Gets the Records Key Type */ +// prettier-ignore +export function RecordKey(type) { + const pattern = RecordPattern(type); + return (pattern === PatternStringExact ? String() : + pattern === PatternNumberExact ? Number() : + String({ pattern })); +} +/** Gets a Record Value Type */ +// prettier-ignore +export function RecordValue(type) { + return type.patternProperties[RecordPattern(type)]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.d.mts new file mode 100644 index 0000000..e492ca1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.d.mts @@ -0,0 +1 @@ +export * from './recursive.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.mjs new file mode 100644 index 0000000..e492ca1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/index.mjs @@ -0,0 +1 @@ +export * from './recursive.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.d.mts new file mode 100644 index 0000000..c5f0dd9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.d.mts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind, Hint } from '../symbols/index.mjs'; +import { Static } from '../static/index.mjs'; +export interface TThis extends TSchema { + [Kind]: 'This'; + static: this['params'][0]; + $ref: string; +} +type RecursiveStatic = Static]>; +export interface TRecursive extends TSchema { + [Hint]: 'Recursive'; + static: RecursiveStatic; +} +/** `[Json]` Creates a Recursive type */ +export declare function Recursive(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs new file mode 100644 index 0000000..566e408 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs @@ -0,0 +1,15 @@ +import { CloneType } from '../clone/type.mjs'; +import { CreateType } from '../create/type.mjs'; +import { IsUndefined } from '../guard/value.mjs'; +import { Kind, Hint } from '../symbols/index.mjs'; +// Auto Tracked For Recursive Types without ID's +let Ordinal = 0; +/** `[Json]` Creates a Recursive type */ +export function Recursive(callback, options = {}) { + if (IsUndefined(options.$id)) + options.$id = `T${Ordinal++}`; + const thisType = CloneType(callback({ [Kind]: 'This', $ref: `${options.$id}` })); + thisType.$id = options.$id; + // prettier-ignore + return CreateType({ [Hint]: 'Recursive', ...thisType }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.d.mts new file mode 100644 index 0000000..b2ea0f9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.d.mts @@ -0,0 +1 @@ +export * from './ref.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.mjs new file mode 100644 index 0000000..b2ea0f9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/index.mjs @@ -0,0 +1 @@ +export * from './ref.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.d.mts new file mode 100644 index 0000000..8ceb787 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.d.mts @@ -0,0 +1,41 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +import { TUnsafe } from '../unsafe/index.mjs'; +import { Static } from '../static/index.mjs'; +export interface TRef extends TSchema { + [Kind]: 'Ref'; + static: unknown; + $ref: Ref; +} +export type TRefUnsafe = TUnsafe>; +/** `[Json]` Creates a Ref type.*/ +export declare function Ref($ref: Ref, options?: SchemaOptions): TRef; +/** + * @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass + * a `string` value for the reference (and not a schema). + * + * To adhere to the 0.34.0 signature, Ref implementations should be updated to the following. + * + * ```typescript + * // pre-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Ref(T) + * ``` + * should be changed to the following + * + * ```typescript + * // post-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Unsafe>(Type.Ref('T')) + * ``` + * You can also create a generic function to replicate the pre-0.34.0 signature if required + * + * ```typescript + * const LegacyRef = (schema: T) => Type.Unsafe>(Type.Ref(schema.$id!)) + * ``` + */ +export declare function Ref(type: Type, options?: SchemaOptions): TRefUnsafe; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs new file mode 100644 index 0000000..83a4694 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs @@ -0,0 +1,10 @@ +import { TypeBoxError } from '../error/index.mjs'; +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Ref type. The referenced type must contain a $id */ +export function Ref(...args) { + const [$ref, options] = typeof args[0] === 'string' ? [args[0], args[1]] : [args[0].$id, args[1]]; + if (typeof $ref !== 'string') + throw new TypeBoxError('Ref: $ref must be a string'); + return CreateType({ [Kind]: 'Ref', $ref }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.d.mts new file mode 100644 index 0000000..22cb422 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.d.mts @@ -0,0 +1 @@ +export * from './regexp.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.mjs new file mode 100644 index 0000000..22cb422 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/index.mjs @@ -0,0 +1 @@ +export * from './regexp.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.d.mts new file mode 100644 index 0000000..ba1ee3e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.d.mts @@ -0,0 +1,20 @@ +import type { SchemaOptions } from '../schema/index.mjs'; +import type { TSchema } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface RegExpOptions extends SchemaOptions { + /** The maximum length of the string */ + maxLength?: number; + /** The minimum length of the string */ + minLength?: number; +} +export interface TRegExp extends TSchema { + [Kind]: 'RegExp'; + static: `${string}`; + type: 'RegExp'; + source: string; + flags: string; +} +/** `[JavaScript]` Creates a RegExp type */ +export declare function RegExp(pattern: string, options?: RegExpOptions): TRegExp; +/** `[JavaScript]` Creates a RegExp type */ +export declare function RegExp(regex: RegExp, options?: RegExpOptions): TRegExp; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs new file mode 100644 index 0000000..49d7ee3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs @@ -0,0 +1,8 @@ +import { CreateType } from '../create/type.mjs'; +import { IsString } from '../guard/value.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a RegExp type */ +export function RegExp(unresolved, options) { + const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved; + return CreateType({ [Kind]: 'RegExp', type: 'RegExp', source: expr.source, flags: expr.flags }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.d.mts new file mode 100644 index 0000000..6e7e222 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.d.mts @@ -0,0 +1,13 @@ +export type FormatRegistryValidationFunction = (value: string) => boolean; +/** Returns the entries in this registry */ +export declare function Entries(): Map; +/** Clears all user defined string formats */ +export declare function Clear(): void; +/** Deletes a registered format */ +export declare function Delete(format: string): boolean; +/** Returns true if the user defined string format exists */ +export declare function Has(format: string): boolean; +/** Sets a validation function for a user defined string format */ +export declare function Set(format: string, func: FormatRegistryValidationFunction): void; +/** Gets a validation function for a user defined string format */ +export declare function Get(format: string): FormatRegistryValidationFunction | undefined; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs new file mode 100644 index 0000000..efd11aa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs @@ -0,0 +1,26 @@ +/** A registry for user defined string formats */ +const map = new Map(); +/** Returns the entries in this registry */ +export function Entries() { + return new Map(map); +} +/** Clears all user defined string formats */ +export function Clear() { + return map.clear(); +} +/** Deletes a registered format */ +export function Delete(format) { + return map.delete(format); +} +/** Returns true if the user defined string format exists */ +export function Has(format) { + return map.has(format); +} +/** Sets a validation function for a user defined string format */ +export function Set(format, func) { + map.set(format, func); +} +/** Gets a validation function for a user defined string format */ +export function Get(format) { + return map.get(format); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.d.mts new file mode 100644 index 0000000..a45cbe5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.d.mts @@ -0,0 +1,2 @@ +export * as FormatRegistry from './format.mjs'; +export * as TypeRegistry from './type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.mjs new file mode 100644 index 0000000..a45cbe5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/index.mjs @@ -0,0 +1,2 @@ +export * as FormatRegistry from './format.mjs'; +export * as TypeRegistry from './type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.d.mts new file mode 100644 index 0000000..504cec7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.d.mts @@ -0,0 +1,13 @@ +export type TypeRegistryValidationFunction = (schema: TSchema, value: unknown) => boolean; +/** Returns the entries in this registry */ +export declare function Entries(): Map>; +/** Clears all user defined types */ +export declare function Clear(): void; +/** Deletes a registered type */ +export declare function Delete(kind: string): boolean; +/** Returns true if this registry contains this kind */ +export declare function Has(kind: string): boolean; +/** Sets a validation function for a user defined type */ +export declare function Set(kind: string, func: TypeRegistryValidationFunction): void; +/** Gets a custom validation function for a user defined type */ +export declare function Get(kind: string): TypeRegistryValidationFunction | undefined; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs new file mode 100644 index 0000000..c6e5055 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs @@ -0,0 +1,26 @@ +/** A registry for user defined types */ +const map = new Map(); +/** Returns the entries in this registry */ +export function Entries() { + return new Map(map); +} +/** Clears all user defined types */ +export function Clear() { + return map.clear(); +} +/** Deletes a registered type */ +export function Delete(kind) { + return map.delete(kind); +} +/** Returns true if this registry contains this kind */ +export function Has(kind) { + return map.has(kind); +} +/** Sets a validation function for a user defined type */ +export function Set(kind, func) { + map.set(kind, func); +} +/** Gets a custom validation function for a user defined type */ +export function Get(kind) { + return map.get(kind); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/required/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/required/index.d.mts new file mode 100644 index 0000000..3732eab --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/required/index.d.mts @@ -0,0 +1,2 @@ +export * from './required-from-mapped-result.mjs'; +export * from './required.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/required/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/required/index.mjs new file mode 100644 index 0000000..3732eab --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/required/index.mjs @@ -0,0 +1,2 @@ +export * from './required-from-mapped-result.mjs'; +export * from './required.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.d.mts new file mode 100644 index 0000000..9e5db2d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.d.mts @@ -0,0 +1,12 @@ +import type { SchemaOptions } from '../schema/index.mjs'; +import type { Ensure, Evaluate } from '../helpers/index.mjs'; +import type { TProperties } from '../object/index.mjs'; +import { type TMappedResult } from '../mapped/index.mjs'; +import { type TRequired } from './required.mjs'; +type TFromProperties

= ({ + [K2 in keyof P]: TRequired; +}); +type TFromMappedResult = (Evaluate>); +export type TRequiredFromMappedResult> = (Ensure>); +export declare function RequiredFromMappedResult>(R: R, options?: SchemaOptions): TMappedResult

; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs new file mode 100644 index 0000000..b0e0e8d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs @@ -0,0 +1,18 @@ +import { MappedResult } from '../mapped/index.mjs'; +import { Required } from './required.mjs'; +// prettier-ignore +function FromProperties(P, options) { + const Acc = {}; + for (const K2 of globalThis.Object.getOwnPropertyNames(P)) + Acc[K2] = Required(P[K2], options); + return Acc; +} +// prettier-ignore +function FromMappedResult(R, options) { + return FromProperties(R.properties, options); +} +// prettier-ignore +export function RequiredFromMappedResult(R, options) { + const P = FromMappedResult(R, options); + return MappedResult(P); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/required/required.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required.d.mts new file mode 100644 index 0000000..bc80b77 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required.d.mts @@ -0,0 +1,35 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Evaluate, Ensure } from '../helpers/index.mjs'; +import type { TMappedResult } from '../mapped/index.mjs'; +import { type TReadonlyOptional } from '../readonly-optional/index.mjs'; +import { type TComputed } from '../computed/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +import { type TReadonly } from '../readonly/index.mjs'; +import { type TRecursive } from '../recursive/index.mjs'; +import { type TObject, type TProperties } from '../object/index.mjs'; +import { type TIntersect } from '../intersect/index.mjs'; +import { type TUnion } from '../union/index.mjs'; +import { type TRef } from '../ref/index.mjs'; +import { type TBigInt } from '../bigint/index.mjs'; +import { type TBoolean } from '../boolean/index.mjs'; +import { type TInteger } from '../integer/index.mjs'; +import { type TLiteral } from '../literal/index.mjs'; +import { type TNull } from '../null/index.mjs'; +import { type TNumber } from '../number/index.mjs'; +import { type TString } from '../string/index.mjs'; +import { type TSymbol } from '../symbol/index.mjs'; +import { type TUndefined } from '../undefined/index.mjs'; +import { type TRequiredFromMappedResult } from './required-from-mapped-result.mjs'; +type TFromComputed = Ensure]>>; +type TFromRef = Ensure]>>; +type TFromProperties = Evaluate<{ + [K in keyof Properties]: Properties[K] extends (TReadonlyOptional) ? TReadonly : Properties[K] extends (TReadonly) ? TReadonly : Properties[K] extends (TOptional) ? S : Properties[K]; +}>; +type TFromObject<_Type extends TObject, Properties extends TProperties, MappedProperties extends TProperties = TFromProperties, Result extends TSchema = TObject> = Result; +type TFromRest = (Types extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TFromRest]> : Result); +export type TRequired = (Type extends TRecursive ? TRecursive> : Type extends TComputed ? TFromComputed : Type extends TRef ? TFromRef : Type extends TIntersect ? TIntersect> : Type extends TUnion ? TUnion> : Type extends TObject ? TFromObject : Type extends TBigInt ? Type : Type extends TBoolean ? Type : Type extends TInteger ? Type : Type extends TLiteral ? Type : Type extends TNull ? Type : Type extends TNumber ? Type : Type extends TString ? Type : Type extends TSymbol ? Type : Type extends TUndefined ? Type : TObject<{}>); +/** `[Json]` Constructs a type where all properties are required */ +export declare function Required(type: MappedResult, options?: SchemaOptions): TRequiredFromMappedResult; +/** `[Json]` Constructs a type where all properties are required */ +export declare function Required(type: Type, options?: SchemaOptions): TRequired; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs new file mode 100644 index 0000000..5e69e39 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs @@ -0,0 +1,73 @@ +import { CreateType } from '../create/type.mjs'; +import { Computed } from '../computed/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Union } from '../union/index.mjs'; +import { Ref } from '../ref/index.mjs'; +import { OptionalKind, TransformKind } from '../symbols/index.mjs'; +import { Discard } from '../discard/index.mjs'; +import { RequiredFromMappedResult } from './required-from-mapped-result.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import * as KindGuard from '../guard/kind.mjs'; +// prettier-ignore +function FromComputed(target, parameters) { + return Computed('Required', [Computed(target, parameters)]); +} +// prettier-ignore +function FromRef($ref) { + return Computed('Required', [Ref($ref)]); +} +// prettier-ignore +function FromProperties(properties) { + const requiredProperties = {}; + for (const K of globalThis.Object.getOwnPropertyNames(properties)) + requiredProperties[K] = Discard(properties[K], [OptionalKind]); + return requiredProperties; +} +// prettier-ignore +function FromObject(type, properties) { + const options = Discard(type, [TransformKind, '$id', 'required', 'properties']); + const mappedProperties = FromProperties(properties); + return Object(mappedProperties, options); +} +// prettier-ignore +function FromRest(types) { + return types.map(type => RequiredResolve(type)); +} +// ------------------------------------------------------------------ +// RequiredResolve +// ------------------------------------------------------------------ +// prettier-ignore +function RequiredResolve(type) { + return ( + // Mappable + KindGuard.IsComputed(type) ? FromComputed(type.target, type.parameters) : + KindGuard.IsRef(type) ? FromRef(type.$ref) : + KindGuard.IsIntersect(type) ? Intersect(FromRest(type.allOf)) : + KindGuard.IsUnion(type) ? Union(FromRest(type.anyOf)) : + KindGuard.IsObject(type) ? FromObject(type, type.properties) : + // Intrinsic + KindGuard.IsBigInt(type) ? type : + KindGuard.IsBoolean(type) ? type : + KindGuard.IsInteger(type) ? type : + KindGuard.IsLiteral(type) ? type : + KindGuard.IsNull(type) ? type : + KindGuard.IsNumber(type) ? type : + KindGuard.IsString(type) ? type : + KindGuard.IsSymbol(type) ? type : + KindGuard.IsUndefined(type) ? type : + // Passthrough + Object({})); +} +/** `[Json]` Constructs a type where all properties are required */ +export function Required(type, options) { + if (KindGuard.IsMappedResult(type)) { + return RequiredFromMappedResult(type, options); + } + else { + // special: mapping types require overridable options + return CreateType({ ...RequiredResolve(type), ...options }); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.d.mts new file mode 100644 index 0000000..46c9702 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.d.mts @@ -0,0 +1 @@ +export * from './rest.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.mjs new file mode 100644 index 0000000..46c9702 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/index.mjs @@ -0,0 +1 @@ +export * from './rest.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.d.mts new file mode 100644 index 0000000..48b567d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.d.mts @@ -0,0 +1,10 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { TIntersect } from '../intersect/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TTuple } from '../tuple/index.mjs'; +type TRestResolve = T extends TIntersect ? S : T extends TUnion ? S : T extends TTuple ? S : [ +]; +export type TRest = TRestResolve; +/** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ +export declare function Rest(T: T): TRest; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs new file mode 100644 index 0000000..787e6ba --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs @@ -0,0 +1,15 @@ +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsIntersect, IsUnion, IsTuple } from '../guard/kind.mjs'; +// prettier-ignore +function RestResolve(T) { + return (IsIntersect(T) ? T.allOf : + IsUnion(T) ? T.anyOf : + IsTuple(T) ? T.items ?? [] : + []); +} +/** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ +export function Rest(T) { + return RestResolve(T); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.d.mts new file mode 100644 index 0000000..56d6ed8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.d.mts @@ -0,0 +1 @@ +export * from './return-type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.mjs new file mode 100644 index 0000000..56d6ed8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/index.mjs @@ -0,0 +1 @@ +export * from './return-type.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.d.mts new file mode 100644 index 0000000..e35f38a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.d.mts @@ -0,0 +1,6 @@ +import { type TSchema, type SchemaOptions } from '../schema/index.mjs'; +import { type TFunction } from '../function/index.mjs'; +import { type TNever } from '../never/index.mjs'; +export type TReturnType ? ReturnType : TNever> = Result; +/** `[JavaScript]` Extracts the ReturnType from the given Function type */ +export declare function ReturnType(schema: Type, options?: SchemaOptions): TReturnType; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs new file mode 100644 index 0000000..b580c01 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs @@ -0,0 +1,7 @@ +import { CreateType } from '../create/type.mjs'; +import { Never } from '../never/index.mjs'; +import * as KindGuard from '../guard/kind.mjs'; +/** `[JavaScript]` Extracts the ReturnType from the given Function type */ +export function ReturnType(schema, options) { + return (KindGuard.IsFunction(schema) ? CreateType(schema.returns, options) : Never(options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.d.mts new file mode 100644 index 0000000..06418ad --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.d.mts @@ -0,0 +1,33 @@ +import type { TAny } from '../any/index.mjs'; +import type { TArray } from '../array/index.mjs'; +import type { TAsyncIterator } from '../async-iterator/index.mjs'; +import type { TBigInt } from '../bigint/index.mjs'; +import type { TBoolean } from '../boolean/index.mjs'; +import type { TConstructor } from '../constructor/index.mjs'; +import type { TDate } from '../date/index.mjs'; +import type { TEnum } from '../enum/index.mjs'; +import type { TFunction } from '../function/index.mjs'; +import type { TInteger } from '../integer/index.mjs'; +import type { TIntersect } from '../intersect/index.mjs'; +import type { TIterator } from '../iterator/index.mjs'; +import type { TLiteral } from '../literal/index.mjs'; +import type { TNot } from '../not/index.mjs'; +import type { TNull } from '../null/index.mjs'; +import type { TNumber } from '../number/index.mjs'; +import type { TObject } from '../object/index.mjs'; +import type { TPromise } from '../promise/index.mjs'; +import type { TRecord } from '../record/index.mjs'; +import type { TThis } from '../recursive/index.mjs'; +import type { TRef } from '../ref/index.mjs'; +import type { TRegExp } from '../regexp/index.mjs'; +import type { TString } from '../string/index.mjs'; +import type { TSymbol } from '../symbol/index.mjs'; +import type { TTemplateLiteral } from '../template-literal/index.mjs'; +import type { TTuple } from '../tuple/index.mjs'; +import type { TUint8Array } from '../uint8array/index.mjs'; +import type { TUndefined } from '../undefined/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TUnknown } from '../unknown/index.mjs'; +import type { TVoid } from '../void/index.mjs'; +import type { TSchema } from './schema.mjs'; +export type TAnySchema = TSchema | TAny | TArray | TAsyncIterator | TBigInt | TBoolean | TConstructor | TDate | TEnum | TFunction | TInteger | TIntersect | TIterator | TLiteral | TNot | TNull | TNumber | TObject | TPromise | TRecord | TRef | TRegExp | TString | TSymbol | TTemplateLiteral | TThis | TTuple | TUndefined | TUnion | TUint8Array | TUnknown | TVoid; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/anyschema.mjs @@ -0,0 +1 @@ +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.d.mts new file mode 100644 index 0000000..14aebad --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.d.mts @@ -0,0 +1,2 @@ +export * from './anyschema.mjs'; +export * from './schema.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.mjs new file mode 100644 index 0000000..14aebad --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/index.mjs @@ -0,0 +1,2 @@ +export * from './anyschema.mjs'; +export * from './schema.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.d.mts new file mode 100644 index 0000000..dc29ef3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.d.mts @@ -0,0 +1,29 @@ +import { Kind, Hint, ReadonlyKind, OptionalKind } from '../symbols/index.mjs'; +export interface SchemaOptions { + $schema?: string; + /** Id for this schema */ + $id?: string; + /** Title of this schema */ + title?: string; + /** Description of this schema */ + description?: string; + /** Default value for this schema */ + default?: any; + /** Example values matching this schema */ + examples?: any; + /** Optional annotation for readOnly */ + readOnly?: boolean; + /** Optional annotation for writeOnly */ + writeOnly?: boolean; + [prop: string]: any; +} +export interface TKind { + [Kind]: string; +} +export interface TSchema extends TKind, SchemaOptions { + [ReadonlyKind]?: string; + [OptionalKind]?: string; + [Hint]?: string; + params: unknown[]; + static: unknown; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.mjs new file mode 100644 index 0000000..25db1a1 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/schema/schema.mjs @@ -0,0 +1 @@ +import { Kind, Hint, ReadonlyKind, OptionalKind } from '../symbols/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.d.mts new file mode 100644 index 0000000..8167858 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.d.mts @@ -0,0 +1 @@ +export * from './set.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.mjs new file mode 100644 index 0000000..8167858 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/index.mjs @@ -0,0 +1 @@ +export * from './set.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.d.mts new file mode 100644 index 0000000..11d704c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.d.mts @@ -0,0 +1,28 @@ +export type TSetIncludes = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? S extends L ? true : TSetIncludes : false); +/** Returns true if element right is in the set of left */ +export declare function SetIncludes(T: [...T], S: S): TSetIncludes; +export type TSetIsSubset = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends true ? TSetIsSubset : false : true); +/** Returns true if left is a subset of right */ +export declare function SetIsSubset(T: [...T], S: [...S]): TSetIsSubset; +export type TSetDistinct = T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends false ? TSetDistinct : TSetDistinct : Acc; +/** Returns a distinct set of elements */ +export declare function SetDistinct(T: [...T]): TSetDistinct; +export type TSetIntersect = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends true ? TSetIntersect : TSetIntersect : Acc); +/** Returns the Intersect of the given sets */ +export declare function SetIntersect(T: [...T], S: [...S]): TSetIntersect; +export type TSetUnion = ([ + ...T, + ...S +]); +/** Returns the Union of the given sets */ +export declare function SetUnion(T: [...T], S: [...S]): TSetUnion; +export type TSetComplement = (T extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TSetIncludes extends true ? TSetComplement : TSetComplement : Acc); +/** Returns the Complement by omitting elements in T that are in S */ +export declare function SetComplement(T: [...T], S: [...S]): TSetComplement; +type TSetIntersectManyResolve = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve> : Acc); +export type TSetIntersectMany = (T extends [infer L extends PropertyKey[]] ? L : T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetIntersectManyResolve : []); +export declare function SetIntersectMany(T: [...T]): TSetIntersectMany; +export type TSetUnionMany = (T extends [infer L extends PropertyKey[], ...infer R extends PropertyKey[][]] ? TSetUnionMany> : Acc); +/** Returns the Union of multiple sets */ +export declare function SetUnionMany(T: [...T]): TSetUnionMany; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs new file mode 100644 index 0000000..7783869 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs @@ -0,0 +1,48 @@ +/** Returns true if element right is in the set of left */ +// prettier-ignore +export function SetIncludes(T, S) { + return T.includes(S); +} +/** Returns true if left is a subset of right */ +export function SetIsSubset(T, S) { + return T.every((L) => SetIncludes(S, L)); +} +/** Returns a distinct set of elements */ +export function SetDistinct(T) { + return [...new Set(T)]; +} +/** Returns the Intersect of the given sets */ +export function SetIntersect(T, S) { + return T.filter((L) => S.includes(L)); +} +/** Returns the Union of the given sets */ +export function SetUnion(T, S) { + return [...T, ...S]; +} +/** Returns the Complement by omitting elements in T that are in S */ +// prettier-ignore +export function SetComplement(T, S) { + return T.filter(L => !S.includes(L)); +} +// prettier-ignore +function SetIntersectManyResolve(T, Init) { + return T.reduce((Acc, L) => { + return SetIntersect(Acc, L); + }, Init); +} +// prettier-ignore +export function SetIntersectMany(T) { + return (T.length === 1 + ? T[0] + // Use left to initialize the accumulator for resolve + : T.length > 1 + ? SetIntersectManyResolve(T.slice(1), T[0]) + : []); +} +/** Returns the Union of multiple sets */ +export function SetUnionMany(T) { + const Acc = []; + for (const L of T) + Acc.push(...L); + return Acc; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/static/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/static/index.d.mts new file mode 100644 index 0000000..8b47ca6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/static/index.d.mts @@ -0,0 +1 @@ +export * from './static.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/static/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/static/index.mjs new file mode 100644 index 0000000..8b47ca6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/static/index.mjs @@ -0,0 +1 @@ +export * from './static.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/static/static.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/static/static.d.mts new file mode 100644 index 0000000..9a26d96 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/static/static.d.mts @@ -0,0 +1,39 @@ +import type { Evaluate } from '../helpers/index.mjs'; +import type { TOptional } from '../optional/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import type { TArray } from '../array/index.mjs'; +import type { TAsyncIterator } from '../async-iterator/index.mjs'; +import type { TConstructor } from '../constructor/index.mjs'; +import type { TEnum } from '../enum/index.mjs'; +import type { TFunction } from '../function/index.mjs'; +import type { TIntersect } from '../intersect/index.mjs'; +import type { TImport } from '../module/index.mjs'; +import type { TIterator } from '../iterator/index.mjs'; +import type { TNot } from '../not/index.mjs'; +import type { TObject, TProperties } from '../object/index.mjs'; +import type { TPromise } from '../promise/index.mjs'; +import type { TRecursive } from '../recursive/index.mjs'; +import type { TRecord } from '../record/index.mjs'; +import type { TRef } from '../ref/index.mjs'; +import type { TTuple } from '../tuple/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TUnsafe } from '../unsafe/index.mjs'; +import type { TSchema } from '../schema/index.mjs'; +import type { TTransform } from '../transform/index.mjs'; +import type { TNever } from '../never/index.mjs'; +type TDecodeImport = (Key extends keyof ModuleProperties ? TDecodeType extends infer Type extends TSchema ? Type extends TRef ? TDecodeImport : Type : TNever : TNever); +type TDecodeProperties = { + [Key in keyof Properties]: TDecodeType; +}; +type TDecodeTypes = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TDecodeTypes]> : Result); +export type TDecodeType = (Type extends TOptional ? TOptional> : Type extends TReadonly ? TReadonly> : Type extends TTransform ? TUnsafe : Type extends TArray ? TArray> : Type extends TAsyncIterator ? TAsyncIterator> : Type extends TConstructor ? TConstructor, TDecodeType> : Type extends TEnum ? TEnum : Type extends TFunction ? TFunction, TDecodeType> : Type extends TIntersect ? TIntersect> : Type extends TImport ? TDecodeImport : Type extends TIterator ? TIterator> : Type extends TNot ? TNot> : Type extends TObject ? TObject>> : Type extends TPromise ? TPromise> : Type extends TRecord ? TRecord> : Type extends TRecursive ? TRecursive> : Type extends TRef ? TRef : Type extends TTuple ? TTuple> : Type extends TUnion ? TUnion> : Type); +export type StaticDecodeIsAny = boolean extends (Type extends TSchema ? true : false) ? true : false; +/** Creates an decoded static type from a TypeBox type */ +export type StaticDecode extends true ? unknown : Static, Params>> = Result; +/** Creates an encoded static type from a TypeBox type */ +export type StaticEncode> = Result; +/** Creates a static type from a TypeBox type */ +export type Static = Result; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/static/static.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/static/static.mjs new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/static/static.mjs @@ -0,0 +1 @@ +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/string/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/string/index.d.mts new file mode 100644 index 0000000..dff2286 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/string/index.d.mts @@ -0,0 +1 @@ +export * from './string.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/string/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/string/index.mjs new file mode 100644 index 0000000..dff2286 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/string/index.mjs @@ -0,0 +1 @@ +export * from './string.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/string/string.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/string/string.d.mts new file mode 100644 index 0000000..6c2f977 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/string/string.d.mts @@ -0,0 +1,25 @@ +import { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | ({} & string); +export type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string); +export interface StringOptions extends SchemaOptions { + /** The maximum string length */ + maxLength?: number; + /** The minimum string length */ + minLength?: number; + /** A regular expression pattern this string should match */ + pattern?: string; + /** A format this string should match */ + format?: StringFormatOption; + /** The content encoding for this string */ + contentEncoding?: StringContentEncodingOption; + /** The content media type for this string */ + contentMediaType?: string; +} +export interface TString extends TSchema, StringOptions { + [Kind]: 'String'; + static: string; + type: 'string'; +} +/** `[Json]` Creates a String type */ +export declare function String(options?: StringOptions): TString; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs new file mode 100644 index 0000000..8e7fa35 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a String type */ +export function String(options) { + return CreateType({ [Kind]: 'String', type: 'string' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.d.mts new file mode 100644 index 0000000..4325a00 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.d.mts @@ -0,0 +1 @@ +export * from './symbol.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.mjs new file mode 100644 index 0000000..4325a00 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/index.mjs @@ -0,0 +1 @@ +export * from './symbol.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.d.mts new file mode 100644 index 0000000..a730bc4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.d.mts @@ -0,0 +1,10 @@ +import { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export type TSymbolValue = string | number | undefined; +export interface TSymbol extends TSchema, SchemaOptions { + [Kind]: 'Symbol'; + static: symbol; + type: 'symbol'; +} +/** `[JavaScript]` Creates a Symbol type */ +export declare function Symbol(options?: SchemaOptions): TSymbol; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs new file mode 100644 index 0000000..119da26 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a Symbol type */ +export function Symbol(options) { + return CreateType({ [Kind]: 'Symbol', type: 'symbol' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.d.mts new file mode 100644 index 0000000..74b73db --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.d.mts @@ -0,0 +1 @@ +export * from './symbols.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.mjs new file mode 100644 index 0000000..74b73db --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/index.mjs @@ -0,0 +1 @@ +export * from './symbols.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.d.mts new file mode 100644 index 0000000..2c0dad5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.d.mts @@ -0,0 +1,10 @@ +/** Symbol key applied to transform types */ +export declare const TransformKind: unique symbol; +/** Symbol key applied to readonly types */ +export declare const ReadonlyKind: unique symbol; +/** Symbol key applied to optional types */ +export declare const OptionalKind: unique symbol; +/** Symbol key applied to types */ +export declare const Hint: unique symbol; +/** Symbol key applied to types */ +export declare const Kind: unique symbol; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs new file mode 100644 index 0000000..e0b28b0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs @@ -0,0 +1,10 @@ +/** Symbol key applied to transform types */ +export const TransformKind = Symbol.for('TypeBox.Transform'); +/** Symbol key applied to readonly types */ +export const ReadonlyKind = Symbol.for('TypeBox.Readonly'); +/** Symbol key applied to optional types */ +export const OptionalKind = Symbol.for('TypeBox.Optional'); +/** Symbol key applied to types */ +export const Hint = Symbol.for('TypeBox.Hint'); +/** Symbol key applied to types */ +export const Kind = Symbol.for('TypeBox.Kind'); diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.d.mts new file mode 100644 index 0000000..8d03666 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.d.mts @@ -0,0 +1,19 @@ +import { TypeBoxError } from '../error/index.mjs'; +import type { TTemplateLiteral, TTemplateLiteralKind } from './index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TString } from '../string/index.mjs'; +import type { TBoolean } from '../boolean/index.mjs'; +import type { TNumber } from '../number/index.mjs'; +import type { TInteger } from '../integer/index.mjs'; +import type { TBigInt } from '../bigint/index.mjs'; +import type { TLiteral } from '../literal/index.mjs'; +import type { Expression } from './parse.mjs'; +export declare class TemplateLiteralFiniteError extends TypeBoxError { +} +type TFromTemplateLiteralKind = T extends TTemplateLiteral ? TFromTemplateLiteralKinds : T extends TUnion ? TFromTemplateLiteralKinds : T extends TString ? false : T extends TNumber ? false : T extends TInteger ? false : T extends TBigInt ? false : T extends TBoolean ? true : T extends TLiteral ? true : false; +type TFromTemplateLiteralKinds = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? TFromTemplateLiteralKind extends false ? false : TFromTemplateLiteralKinds : true; +export declare function IsTemplateLiteralExpressionFinite(expression: Expression): boolean; +export type TIsTemplateLiteralFinite = T extends TTemplateLiteral ? TFromTemplateLiteralKinds : false; +/** Returns true if this TemplateLiteral resolves to a finite set of values */ +export declare function IsTemplateLiteralFinite(schema: T): boolean; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs new file mode 100644 index 0000000..b2a4e8a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs @@ -0,0 +1,49 @@ +import { TemplateLiteralParseExact } from './parse.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +// ------------------------------------------------------------------ +// TemplateLiteralFiniteError +// ------------------------------------------------------------------ +export class TemplateLiteralFiniteError extends TypeBoxError { +} +// ------------------------------------------------------------------ +// IsTemplateLiteralFiniteCheck +// ------------------------------------------------------------------ +// prettier-ignore +function IsNumberExpression(expression) { + return (expression.type === 'or' && + expression.expr.length === 2 && + expression.expr[0].type === 'const' && + expression.expr[0].const === '0' && + expression.expr[1].type === 'const' && + expression.expr[1].const === '[1-9][0-9]*'); +} +// prettier-ignore +function IsBooleanExpression(expression) { + return (expression.type === 'or' && + expression.expr.length === 2 && + expression.expr[0].type === 'const' && + expression.expr[0].const === 'true' && + expression.expr[1].type === 'const' && + expression.expr[1].const === 'false'); +} +// prettier-ignore +function IsStringExpression(expression) { + return expression.type === 'const' && expression.const === '.*'; +} +// ------------------------------------------------------------------ +// IsTemplateLiteralExpressionFinite +// ------------------------------------------------------------------ +// prettier-ignore +export function IsTemplateLiteralExpressionFinite(expression) { + return (IsNumberExpression(expression) || IsStringExpression(expression) ? false : + IsBooleanExpression(expression) ? true : + (expression.type === 'and') ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : + (expression.type === 'or') ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : + (expression.type === 'const') ? true : + (() => { throw new TemplateLiteralFiniteError(`Unknown expression type`); })()); +} +/** Returns true if this TemplateLiteral resolves to a finite set of values */ +export function IsTemplateLiteralFinite(schema) { + const expression = TemplateLiteralParseExact(schema.pattern); + return IsTemplateLiteralExpressionFinite(expression); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.d.mts new file mode 100644 index 0000000..aac45ae --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.d.mts @@ -0,0 +1,21 @@ +import { TIsTemplateLiteralFinite } from './finite.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +import type { Assert } from '../helpers/index.mjs'; +import type { TBoolean } from '../boolean/index.mjs'; +import type { TTemplateLiteral, TTemplateLiteralKind } from './index.mjs'; +import type { TLiteral, TLiteralValue } from '../literal/index.mjs'; +import type { Expression } from './parse.mjs'; +import type { TUnion } from '../union/index.mjs'; +export declare class TemplateLiteralGenerateError extends TypeBoxError { +} +type TStringReduceUnary = R extends [infer A extends string, ...infer B extends string[]] ? TStringReduceUnary : Acc; +type TStringReduceBinary = L extends [infer A extends string, ...infer B extends string[]] ? TStringReduceBinary]> : Acc; +type TStringReduceMany = T extends [infer L extends string[], infer R extends string[], ...infer Rest extends string[][]] ? TStringReduceMany<[TStringReduceBinary, ...Rest]> : T; +type TStringReduce> = 0 extends keyof O ? Assert : []; +type TFromTemplateLiteralUnionKinds = T extends [infer L extends TLiteral, ...infer R extends TLiteral[]] ? [`${L['const']}`, ...TFromTemplateLiteralUnionKinds] : []; +type TFromTemplateLiteralKinds = T extends [infer L extends TTemplateLiteralKind, ...infer R extends TTemplateLiteralKind[]] ? (L extends TTemplateLiteral ? TFromTemplateLiteralKinds<[...S, ...R], Acc> : L extends TLiteral ? TFromTemplateLiteralKinds : L extends TUnion ? TFromTemplateLiteralKinds]> : L extends TBoolean ? TFromTemplateLiteralKinds : Acc) : Acc; +export declare function TemplateLiteralExpressionGenerate(expression: Expression): IterableIterator; +export type TTemplateLiteralGenerate> = F extends true ? (T extends TTemplateLiteral ? TFromTemplateLiteralKinds extends infer R extends string[][] ? TStringReduce : [] : []) : []; +/** Generates a tuple of strings from the given TemplateLiteral. Returns an empty tuple if infinite. */ +export declare function TemplateLiteralGenerate(schema: T): TTemplateLiteralGenerate; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs new file mode 100644 index 0000000..5163273 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs @@ -0,0 +1,53 @@ +import { IsTemplateLiteralExpressionFinite } from './finite.mjs'; +import { TemplateLiteralParseExact } from './parse.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +// ------------------------------------------------------------------ +// TemplateLiteralGenerateError +// ------------------------------------------------------------------ +export class TemplateLiteralGenerateError extends TypeBoxError { +} +// ------------------------------------------------------------------ +// TemplateLiteralExpressionGenerate +// ------------------------------------------------------------------ +// prettier-ignore +function* GenerateReduce(buffer) { + if (buffer.length === 1) + return yield* buffer[0]; + for (const left of buffer[0]) { + for (const right of GenerateReduce(buffer.slice(1))) { + yield `${left}${right}`; + } + } +} +// prettier-ignore +function* GenerateAnd(expression) { + return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)])); +} +// prettier-ignore +function* GenerateOr(expression) { + for (const expr of expression.expr) + yield* TemplateLiteralExpressionGenerate(expr); +} +// prettier-ignore +function* GenerateConst(expression) { + return yield expression.const; +} +export function* TemplateLiteralExpressionGenerate(expression) { + return expression.type === 'and' + ? yield* GenerateAnd(expression) + : expression.type === 'or' + ? yield* GenerateOr(expression) + : expression.type === 'const' + ? yield* GenerateConst(expression) + : (() => { + throw new TemplateLiteralGenerateError('Unknown expression'); + })(); +} +/** Generates a tuple of strings from the given TemplateLiteral. Returns an empty tuple if infinite. */ +export function TemplateLiteralGenerate(schema) { + const expression = TemplateLiteralParseExact(schema.pattern); + // prettier-ignore + return (IsTemplateLiteralExpressionFinite(expression) + ? [...TemplateLiteralExpressionGenerate(expression)] + : []); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.d.mts new file mode 100644 index 0000000..421f636 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.d.mts @@ -0,0 +1,7 @@ +export * from './finite.mjs'; +export * from './generate.mjs'; +export * from './syntax.mjs'; +export * from './parse.mjs'; +export * from './pattern.mjs'; +export * from './union.mjs'; +export * from './template-literal.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.mjs new file mode 100644 index 0000000..421f636 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/index.mjs @@ -0,0 +1,7 @@ +export * from './finite.mjs'; +export * from './generate.mjs'; +export * from './syntax.mjs'; +export * from './parse.mjs'; +export * from './pattern.mjs'; +export * from './union.mjs'; +export * from './template-literal.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.d.mts new file mode 100644 index 0000000..bfc66b8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.d.mts @@ -0,0 +1,20 @@ +import { TypeBoxError } from '../error/index.mjs'; +export declare class TemplateLiteralParserError extends TypeBoxError { +} +export type Expression = ExpressionAnd | ExpressionOr | ExpressionConst; +export type ExpressionConst = { + type: 'const'; + const: string; +}; +export type ExpressionAnd = { + type: 'and'; + expr: Expression[]; +}; +export type ExpressionOr = { + type: 'or'; + expr: Expression[]; +}; +/** Parses a pattern and returns an expression tree */ +export declare function TemplateLiteralParse(pattern: string): Expression; +/** Parses a pattern and strips forward and trailing ^ and $ */ +export declare function TemplateLiteralParseExact(pattern: string): Expression; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs new file mode 100644 index 0000000..15ee1fa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs @@ -0,0 +1,167 @@ +import { TypeBoxError } from '../error/index.mjs'; +// ------------------------------------------------------------------ +// TemplateLiteralParserError +// ------------------------------------------------------------------ +export class TemplateLiteralParserError extends TypeBoxError { +} +// ------------------------------------------------------------------- +// Unescape +// +// Unescape for these control characters specifically. Note that this +// function is only called on non union group content, and where we +// still want to allow the user to embed control characters in that +// content. For review. +// ------------------------------------------------------------------- +// prettier-ignore +function Unescape(pattern) { + return pattern + .replace(/\\\$/g, '$') + .replace(/\\\*/g, '*') + .replace(/\\\^/g, '^') + .replace(/\\\|/g, '|') + .replace(/\\\(/g, '(') + .replace(/\\\)/g, ')'); +} +// ------------------------------------------------------------------- +// Control Characters +// ------------------------------------------------------------------- +function IsNonEscaped(pattern, index, char) { + return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92; +} +function IsOpenParen(pattern, index) { + return IsNonEscaped(pattern, index, '('); +} +function IsCloseParen(pattern, index) { + return IsNonEscaped(pattern, index, ')'); +} +function IsSeparator(pattern, index) { + return IsNonEscaped(pattern, index, '|'); +} +// ------------------------------------------------------------------- +// Control Groups +// ------------------------------------------------------------------- +function IsGroup(pattern) { + if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1))) + return false; + let count = 0; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + count += 1; + if (IsCloseParen(pattern, index)) + count -= 1; + if (count === 0 && index !== pattern.length - 1) + return false; + } + return true; +} +// prettier-ignore +function InGroup(pattern) { + return pattern.slice(1, pattern.length - 1); +} +// prettier-ignore +function IsPrecedenceOr(pattern) { + let count = 0; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + count += 1; + if (IsCloseParen(pattern, index)) + count -= 1; + if (IsSeparator(pattern, index) && count === 0) + return true; + } + return false; +} +// prettier-ignore +function IsPrecedenceAnd(pattern) { + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + return true; + } + return false; +} +// prettier-ignore +function Or(pattern) { + let [count, start] = [0, 0]; + const expressions = []; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) + count += 1; + if (IsCloseParen(pattern, index)) + count -= 1; + if (IsSeparator(pattern, index) && count === 0) { + const range = pattern.slice(start, index); + if (range.length > 0) + expressions.push(TemplateLiteralParse(range)); + start = index + 1; + } + } + const range = pattern.slice(start); + if (range.length > 0) + expressions.push(TemplateLiteralParse(range)); + if (expressions.length === 0) + return { type: 'const', const: '' }; + if (expressions.length === 1) + return expressions[0]; + return { type: 'or', expr: expressions }; +} +// prettier-ignore +function And(pattern) { + function Group(value, index) { + if (!IsOpenParen(value, index)) + throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`); + let count = 0; + for (let scan = index; scan < value.length; scan++) { + if (IsOpenParen(value, scan)) + count += 1; + if (IsCloseParen(value, scan)) + count -= 1; + if (count === 0) + return [index, scan]; + } + throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`); + } + function Range(pattern, index) { + for (let scan = index; scan < pattern.length; scan++) { + if (IsOpenParen(pattern, scan)) + return [index, scan]; + } + return [index, pattern.length]; + } + const expressions = []; + for (let index = 0; index < pattern.length; index++) { + if (IsOpenParen(pattern, index)) { + const [start, end] = Group(pattern, index); + const range = pattern.slice(start, end + 1); + expressions.push(TemplateLiteralParse(range)); + index = end; + } + else { + const [start, end] = Range(pattern, index); + const range = pattern.slice(start, end); + if (range.length > 0) + expressions.push(TemplateLiteralParse(range)); + index = end - 1; + } + } + return ((expressions.length === 0) ? { type: 'const', const: '' } : + (expressions.length === 1) ? expressions[0] : + { type: 'and', expr: expressions }); +} +// ------------------------------------------------------------------ +// TemplateLiteralParse +// ------------------------------------------------------------------ +/** Parses a pattern and returns an expression tree */ +export function TemplateLiteralParse(pattern) { + // prettier-ignore + return (IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : + IsPrecedenceOr(pattern) ? Or(pattern) : + IsPrecedenceAnd(pattern) ? And(pattern) : + { type: 'const', const: Unescape(pattern) }); +} +// ------------------------------------------------------------------ +// TemplateLiteralParseExact +// ------------------------------------------------------------------ +/** Parses a pattern and strips forward and trailing ^ and $ */ +export function TemplateLiteralParseExact(pattern) { + return TemplateLiteralParse(pattern.slice(1, pattern.length - 1)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.d.mts new file mode 100644 index 0000000..3181fad --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.d.mts @@ -0,0 +1,5 @@ +import type { TTemplateLiteralKind } from './index.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +export declare class TemplateLiteralPatternError extends TypeBoxError { +} +export declare function TemplateLiteralPattern(kinds: TTemplateLiteralKind[]): string; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs new file mode 100644 index 0000000..483ad02 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs @@ -0,0 +1,33 @@ +import { PatternNumber, PatternString, PatternBoolean } from '../patterns/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +import { TypeBoxError } from '../error/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsTemplateLiteral, IsUnion, IsNumber, IsInteger, IsBigInt, IsString, IsLiteral, IsBoolean } from '../guard/kind.mjs'; +// ------------------------------------------------------------------ +// TemplateLiteralPatternError +// ------------------------------------------------------------------ +export class TemplateLiteralPatternError extends TypeBoxError { +} +// ------------------------------------------------------------------ +// TemplateLiteralPattern +// ------------------------------------------------------------------ +function Escape(value) { + return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} +// prettier-ignore +function Visit(schema, acc) { + return (IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : + IsUnion(schema) ? `(${schema.anyOf.map((schema) => Visit(schema, acc)).join('|')})` : + IsNumber(schema) ? `${acc}${PatternNumber}` : + IsInteger(schema) ? `${acc}${PatternNumber}` : + IsBigInt(schema) ? `${acc}${PatternNumber}` : + IsString(schema) ? `${acc}${PatternString}` : + IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : + IsBoolean(schema) ? `${acc}${PatternBoolean}` : + (() => { throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`); })()); +} +export function TemplateLiteralPattern(kinds) { + return `^${kinds.map((schema) => Visit(schema, '')).join('')}\$`; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.d.mts new file mode 100644 index 0000000..82d6979 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.d.mts @@ -0,0 +1,20 @@ +import type { Assert, Trim } from '../helpers/index.mjs'; +import type { TTemplateLiteral, TTemplateLiteralKind } from './index.mjs'; +import { type TLiteral } from '../literal/index.mjs'; +import { type TBoolean } from '../boolean/index.mjs'; +import { type TBigInt } from '../bigint/index.mjs'; +import { type TNumber } from '../number/index.mjs'; +import { type TString } from '../string/index.mjs'; +import { type TUnionEvaluated } from '../union/index.mjs'; +declare function FromUnion(syntax: string): IterableIterator; +declare function FromTerminal(syntax: string): IterableIterator; +type FromUnionLiteral = T extends `${infer L}|${infer R}` ? [TLiteral>, ...FromUnionLiteral] : T extends `${infer L}` ? [TLiteral>] : [ +]; +type FromUnion = TUnionEvaluated>; +type FromTerminal = T extends 'boolean' ? TBoolean : T extends 'bigint' ? TBigInt : T extends 'number' ? TNumber : T extends 'string' ? TString : FromUnion; +type FromString = T extends `{${infer L}}${infer R}` ? [FromTerminal, ...FromString] : T extends `${infer L}$\{${infer R1}\}${infer R2}` ? [TLiteral, ...FromString<`{${R1}}`>, ...FromString] : T extends `${infer L}$\{${infer R1}\}` ? [TLiteral, ...FromString<`{${R1}}`>] : T extends `${infer L}` ? [TLiteral] : [ +]; +export type TTemplateLiteralSyntax = (TTemplateLiteral, TTemplateLiteralKind[]>>); +/** Parses TemplateLiteralSyntax and returns a tuple of TemplateLiteralKinds */ +export declare function TemplateLiteralSyntax(syntax: string): TTemplateLiteralKind[]; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs new file mode 100644 index 0000000..583655a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs @@ -0,0 +1,55 @@ +import { Literal } from '../literal/index.mjs'; +import { Boolean } from '../boolean/index.mjs'; +import { BigInt } from '../bigint/index.mjs'; +import { Number } from '../number/index.mjs'; +import { String } from '../string/index.mjs'; +import { UnionEvaluated } from '../union/index.mjs'; +import { Never } from '../never/index.mjs'; +// ------------------------------------------------------------------ +// SyntaxParsers +// ------------------------------------------------------------------ +// prettier-ignore +function* FromUnion(syntax) { + const trim = syntax.trim().replace(/"|'/g, ''); + return (trim === 'boolean' ? yield Boolean() : + trim === 'number' ? yield Number() : + trim === 'bigint' ? yield BigInt() : + trim === 'string' ? yield String() : + yield (() => { + const literals = trim.split('|').map((literal) => Literal(literal.trim())); + return (literals.length === 0 ? Never() : + literals.length === 1 ? literals[0] : + UnionEvaluated(literals)); + })()); +} +// prettier-ignore +function* FromTerminal(syntax) { + if (syntax[1] !== '{') { + const L = Literal('$'); + const R = FromSyntax(syntax.slice(1)); + return yield* [L, ...R]; + } + for (let i = 2; i < syntax.length; i++) { + if (syntax[i] === '}') { + const L = FromUnion(syntax.slice(2, i)); + const R = FromSyntax(syntax.slice(i + 1)); + return yield* [...L, ...R]; + } + } + yield Literal(syntax); +} +// prettier-ignore +function* FromSyntax(syntax) { + for (let i = 0; i < syntax.length; i++) { + if (syntax[i] === '$') { + const L = Literal(syntax.slice(0, i)); + const R = FromTerminal(syntax.slice(i)); + return yield* [L, ...R]; + } + } + yield Literal(syntax); +} +/** Parses TemplateLiteralSyntax and returns a tuple of TemplateLiteralKinds */ +export function TemplateLiteralSyntax(syntax) { + return [...FromSyntax(syntax)]; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.d.mts new file mode 100644 index 0000000..b235c76 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.d.mts @@ -0,0 +1,30 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Assert } from '../helpers/index.mjs'; +import type { TUnion } from '../union/index.mjs'; +import type { TLiteral } from '../literal/index.mjs'; +import type { TInteger } from '../integer/index.mjs'; +import type { TNumber } from '../number/index.mjs'; +import type { TBigInt } from '../bigint/index.mjs'; +import type { TString } from '../string/index.mjs'; +import type { TBoolean } from '../boolean/index.mjs'; +import type { TNever } from '../never/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { type TTemplateLiteralSyntax } from './syntax.mjs'; +import { EmptyString } from '../helpers/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +type TemplateLiteralStaticKind = T extends TUnion ? { + [K in keyof U]: TemplateLiteralStatic, Acc>; +}[number] : T extends TTemplateLiteral ? `${Static}` : T extends TLiteral ? `${U}` : T extends TString ? `${string}` : T extends TNumber ? `${number}` : T extends TBigInt ? `${bigint}` : T extends TBoolean ? `${boolean}` : never; +type TemplateLiteralStatic = T extends [infer L, ...infer R] ? `${TemplateLiteralStaticKind}${TemplateLiteralStatic, Acc>}` : Acc; +export type TTemplateLiteralKind = TTemplateLiteral | TUnion | TLiteral | TInteger | TNumber | TBigInt | TString | TBoolean | TNever; +export interface TTemplateLiteral extends TSchema { + [Kind]: 'TemplateLiteral'; + static: TemplateLiteralStatic; + type: 'string'; + pattern: string; +} +/** `[Json]` Creates a TemplateLiteral type from template dsl string */ +export declare function TemplateLiteral(syntax: T, options?: SchemaOptions): TTemplateLiteralSyntax; +/** `[Json]` Creates a TemplateLiteral type */ +export declare function TemplateLiteral(kinds: [...T], options?: SchemaOptions): TTemplateLiteral; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs new file mode 100644 index 0000000..b2ce48c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs @@ -0,0 +1,13 @@ +import { CreateType } from '../create/type.mjs'; +import { TemplateLiteralSyntax } from './syntax.mjs'; +import { TemplateLiteralPattern } from './pattern.mjs'; +import { IsString } from '../guard/value.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a TemplateLiteral type */ +// prettier-ignore +export function TemplateLiteral(unresolved, options) { + const pattern = IsString(unresolved) + ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) + : TemplateLiteralPattern(unresolved); + return CreateType({ [Kind]: 'TemplateLiteral', type: 'string', pattern }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.d.mts new file mode 100644 index 0000000..1d2f5c9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.d.mts @@ -0,0 +1,9 @@ +import type { Static } from '../static/index.mjs'; +import type { TTemplateLiteral } from './template-literal.mjs'; +import type { UnionToTuple } from '../helpers/index.mjs'; +import { type TUnionEvaluated } from '../union/index.mjs'; +import { type TLiteral } from '../literal/index.mjs'; +export type TTemplateLiteralToUnionLiteralArray = (T extends [infer L extends string, ...infer R extends string[]] ? TTemplateLiteralToUnionLiteralArray]> : Acc); +export type TTemplateLiteralToUnion>> = TUnionEvaluated>; +/** Returns a Union from the given TemplateLiteral */ +export declare function TemplateLiteralToUnion(schema: TTemplateLiteral): TTemplateLiteralToUnion; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs new file mode 100644 index 0000000..d90c157 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs @@ -0,0 +1,9 @@ +import { UnionEvaluated } from '../union/index.mjs'; +import { Literal } from '../literal/index.mjs'; +import { TemplateLiteralGenerate } from './generate.mjs'; +/** Returns a Union from the given TemplateLiteral */ +export function TemplateLiteralToUnion(schema) { + const R = TemplateLiteralGenerate(schema); + const L = R.map((S) => Literal(S)); + return UnionEvaluated(L); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.d.mts new file mode 100644 index 0000000..8aa31eb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.d.mts @@ -0,0 +1 @@ +export * from './transform.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.mjs new file mode 100644 index 0000000..8aa31eb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/index.mjs @@ -0,0 +1 @@ +export * from './transform.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.d.mts new file mode 100644 index 0000000..d341cba --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.d.mts @@ -0,0 +1,30 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { Static, StaticDecode } from '../static/index.mjs'; +import { TransformKind } from '../symbols/index.mjs'; +export declare class TransformDecodeBuilder { + private readonly schema; + constructor(schema: T); + Decode, U>>(decode: D): TransformEncodeBuilder; +} +export declare class TransformEncodeBuilder { + private readonly schema; + private readonly decode; + constructor(schema: T, decode: D); + private EncodeTransform; + private EncodeSchema; + Encode, StaticDecode>>(encode: E): TTransform>; +} +type TransformStatic = T extends TTransform ? S : Static; +export type TransformFunction = (value: T) => U; +export interface TransformOptions { + Decode: TransformFunction, O>; + Encode: TransformFunction>; +} +export interface TTransform extends TSchema { + static: TransformStatic; + [TransformKind]: TransformOptions; + [key: string]: any; +} +/** `[Json]` Creates a Transform type */ +export declare function Transform(schema: I): TransformDecodeBuilder; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs new file mode 100644 index 0000000..48e7caf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs @@ -0,0 +1,40 @@ +import { TransformKind } from '../symbols/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsTransform } from '../guard/kind.mjs'; +// ------------------------------------------------------------------ +// TransformBuilders +// ------------------------------------------------------------------ +export class TransformDecodeBuilder { + constructor(schema) { + this.schema = schema; + } + Decode(decode) { + return new TransformEncodeBuilder(this.schema, decode); + } +} +// prettier-ignore +export class TransformEncodeBuilder { + constructor(schema, decode) { + this.schema = schema; + this.decode = decode; + } + EncodeTransform(encode, schema) { + const Encode = (value) => schema[TransformKind].Encode(encode(value)); + const Decode = (value) => this.decode(schema[TransformKind].Decode(value)); + const Codec = { Encode: Encode, Decode: Decode }; + return { ...schema, [TransformKind]: Codec }; + } + EncodeSchema(encode, schema) { + const Codec = { Decode: this.decode, Encode: encode }; + return { ...schema, [TransformKind]: Codec }; + } + Encode(encode) { + return (IsTransform(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema)); + } +} +/** `[Json]` Creates a Transform type */ +export function Transform(schema) { + return new TransformDecodeBuilder(schema); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.d.mts new file mode 100644 index 0000000..f886af6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.d.mts @@ -0,0 +1 @@ +export * from './tuple.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.mjs new file mode 100644 index 0000000..f886af6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/index.mjs @@ -0,0 +1 @@ +export * from './tuple.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.d.mts new file mode 100644 index 0000000..5282aa7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.d.mts @@ -0,0 +1,16 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +type TupleStatic = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TupleStatic]> : Acc; +export interface TTuple extends TSchema { + [Kind]: 'Tuple'; + static: TupleStatic; + type: 'array'; + items: T; + additionalItems?: false; + minItems: T['length']; + maxItems: T['length']; +} +/** `[Json]` Creates a Tuple type */ +export declare function Tuple(types: [...Types], options?: SchemaOptions): TTuple; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs new file mode 100644 index 0000000..17e425a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs @@ -0,0 +1,9 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Tuple type */ +export function Tuple(types, options) { + // prettier-ignore + return CreateType(types.length > 0 ? + { [Kind]: 'Tuple', type: 'array', items: types, additionalItems: false, minItems: types.length, maxItems: types.length } : + { [Kind]: 'Tuple', type: 'array', minItems: types.length, maxItems: types.length }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/type/index.d.mts new file mode 100644 index 0000000..7a8672d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/index.d.mts @@ -0,0 +1,6 @@ +export { JsonTypeBuilder } from './json.mjs'; +import { JavaScriptTypeBuilder } from './javascript.mjs'; +/** JavaScript Type Builder with Static Resolution for TypeScript */ +declare const Type: InstanceType; +export { JavaScriptTypeBuilder }; +export { Type }; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs new file mode 100644 index 0000000..dd6cd01 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs @@ -0,0 +1,13 @@ +// ------------------------------------------------------------------ +// JsonTypeBuilder +// ------------------------------------------------------------------ +export { JsonTypeBuilder } from './json.mjs'; +// ------------------------------------------------------------------ +// JavaScriptTypeBuilder +// ------------------------------------------------------------------ +import * as TypeBuilder from './type.mjs'; +import { JavaScriptTypeBuilder } from './javascript.mjs'; +/** JavaScript Type Builder with Static Resolution for TypeScript */ +const Type = TypeBuilder; +export { JavaScriptTypeBuilder }; +export { Type }; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.d.mts new file mode 100644 index 0000000..a17cc34 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.d.mts @@ -0,0 +1,64 @@ +import { JsonTypeBuilder } from './json.mjs'; +import { type TArgument } from '../argument/index.mjs'; +import { type TAsyncIterator } from '../async-iterator/index.mjs'; +import { type TAwaited } from '../awaited/index.mjs'; +import { type TBigInt, type BigIntOptions } from '../bigint/index.mjs'; +import { type TConstructor } from '../constructor/index.mjs'; +import { type TConstructorParameters } from '../constructor-parameters/index.mjs'; +import { type TDate, type DateOptions } from '../date/index.mjs'; +import { type TFunction } from '../function/index.mjs'; +import { type TInstanceType } from '../instance-type/index.mjs'; +import { type TInstantiate } from '../instantiate/index.mjs'; +import { type TIterator } from '../iterator/index.mjs'; +import { type TParameters } from '../parameters/index.mjs'; +import { type TPromise } from '../promise/index.mjs'; +import { type TRegExp, RegExpOptions } from '../regexp/index.mjs'; +import { type TReturnType } from '../return-type/index.mjs'; +import { type TSchema, type SchemaOptions } from '../schema/index.mjs'; +import { type TSymbol } from '../symbol/index.mjs'; +import { type TUint8Array, type Uint8ArrayOptions } from '../uint8array/index.mjs'; +import { type TUndefined } from '../undefined/index.mjs'; +import { type TVoid } from '../void/index.mjs'; +/** JavaScript Type Builder with Static Resolution for TypeScript */ +export declare class JavaScriptTypeBuilder extends JsonTypeBuilder { + /** `[JavaScript]` Creates a Generic Argument Type */ + Argument(index: Index): TArgument; + /** `[JavaScript]` Creates a AsyncIterator type */ + AsyncIterator(items: Type, options?: SchemaOptions): TAsyncIterator; + /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ + Awaited(schema: Type, options?: SchemaOptions): TAwaited; + /** `[JavaScript]` Creates a BigInt type */ + BigInt(options?: BigIntOptions): TBigInt; + /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ + ConstructorParameters(schema: Type, options?: SchemaOptions): TConstructorParameters; + /** `[JavaScript]` Creates a Constructor type */ + Constructor(parameters: [...Parameters], instanceType: InstanceType, options?: SchemaOptions): TConstructor; + /** `[JavaScript]` Creates a Date type */ + Date(options?: DateOptions): TDate; + /** `[JavaScript]` Creates a Function type */ + Function(parameters: [...Parameters], returnType: ReturnType, options?: SchemaOptions): TFunction; + /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ + InstanceType(schema: Type, options?: SchemaOptions): TInstanceType; + /** `[JavaScript]` Instantiates a type with the given parameters */ + Instantiate(schema: Type, parameters: [...Parameters]): TInstantiate; + /** `[JavaScript]` Creates an Iterator type */ + Iterator(items: Type, options?: SchemaOptions): TIterator; + /** `[JavaScript]` Extracts the Parameters from the given Function type */ + Parameters(schema: Type, options?: SchemaOptions): TParameters; + /** `[JavaScript]` Creates a Promise type */ + Promise(item: Type, options?: SchemaOptions): TPromise; + /** `[JavaScript]` Creates a RegExp type */ + RegExp(pattern: string, options?: RegExpOptions): TRegExp; + /** `[JavaScript]` Creates a RegExp type */ + RegExp(regex: RegExp, options?: RegExpOptions): TRegExp; + /** `[JavaScript]` Extracts the ReturnType from the given Function type */ + ReturnType(type: Type, options?: SchemaOptions): TReturnType; + /** `[JavaScript]` Creates a Symbol type */ + Symbol(options?: SchemaOptions): TSymbol; + /** `[JavaScript]` Creates a Undefined type */ + Undefined(options?: SchemaOptions): TUndefined; + /** `[JavaScript]` Creates a Uint8Array type */ + Uint8Array(options?: Uint8ArrayOptions): TUint8Array; + /** `[JavaScript]` Creates a Void type */ + Void(options?: SchemaOptions): TVoid; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.mjs new file mode 100644 index 0000000..05c2557 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/javascript.mjs @@ -0,0 +1,99 @@ +import { JsonTypeBuilder } from './json.mjs'; +import { Argument } from '../argument/index.mjs'; +import { AsyncIterator } from '../async-iterator/index.mjs'; +import { Awaited } from '../awaited/index.mjs'; +import { BigInt } from '../bigint/index.mjs'; +import { Constructor } from '../constructor/index.mjs'; +import { ConstructorParameters } from '../constructor-parameters/index.mjs'; +import { Date } from '../date/index.mjs'; +import { Function as FunctionType } from '../function/index.mjs'; +import { InstanceType } from '../instance-type/index.mjs'; +import { Instantiate } from '../instantiate/index.mjs'; +import { Iterator } from '../iterator/index.mjs'; +import { Parameters } from '../parameters/index.mjs'; +import { Promise } from '../promise/index.mjs'; +import { RegExp } from '../regexp/index.mjs'; +import { ReturnType } from '../return-type/index.mjs'; +import { Symbol } from '../symbol/index.mjs'; +import { Uint8Array } from '../uint8array/index.mjs'; +import { Undefined } from '../undefined/index.mjs'; +import { Void } from '../void/index.mjs'; +/** JavaScript Type Builder with Static Resolution for TypeScript */ +export class JavaScriptTypeBuilder extends JsonTypeBuilder { + /** `[JavaScript]` Creates a Generic Argument Type */ + Argument(index) { + return Argument(index); + } + /** `[JavaScript]` Creates a AsyncIterator type */ + AsyncIterator(items, options) { + return AsyncIterator(items, options); + } + /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ + Awaited(schema, options) { + return Awaited(schema, options); + } + /** `[JavaScript]` Creates a BigInt type */ + BigInt(options) { + return BigInt(options); + } + /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ + ConstructorParameters(schema, options) { + return ConstructorParameters(schema, options); + } + /** `[JavaScript]` Creates a Constructor type */ + Constructor(parameters, instanceType, options) { + return Constructor(parameters, instanceType, options); + } + /** `[JavaScript]` Creates a Date type */ + Date(options = {}) { + return Date(options); + } + /** `[JavaScript]` Creates a Function type */ + Function(parameters, returnType, options) { + return FunctionType(parameters, returnType, options); + } + /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ + InstanceType(schema, options) { + return InstanceType(schema, options); + } + /** `[JavaScript]` Instantiates a type with the given parameters */ + Instantiate(schema, parameters) { + return Instantiate(schema, parameters); + } + /** `[JavaScript]` Creates an Iterator type */ + Iterator(items, options) { + return Iterator(items, options); + } + /** `[JavaScript]` Extracts the Parameters from the given Function type */ + Parameters(schema, options) { + return Parameters(schema, options); + } + /** `[JavaScript]` Creates a Promise type */ + Promise(item, options) { + return Promise(item, options); + } + /** `[JavaScript]` Creates a RegExp type */ + RegExp(unresolved, options) { + return RegExp(unresolved, options); + } + /** `[JavaScript]` Extracts the ReturnType from the given Function type */ + ReturnType(type, options) { + return ReturnType(type, options); + } + /** `[JavaScript]` Creates a Symbol type */ + Symbol(options) { + return Symbol(options); + } + /** `[JavaScript]` Creates a Undefined type */ + Undefined(options) { + return Undefined(options); + } + /** `[JavaScript]` Creates a Uint8Array type */ + Uint8Array(options) { + return Uint8Array(options); + } + /** `[JavaScript]` Creates a Void type */ + Void(options) { + return Void(options); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/json.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/type/json.d.mts new file mode 100644 index 0000000..032fc6e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/json.d.mts @@ -0,0 +1,208 @@ +import { type TAny } from '../any/index.mjs'; +import { type TArray, type ArrayOptions } from '../array/index.mjs'; +import { type TBoolean } from '../boolean/index.mjs'; +import { type TComposite } from '../composite/index.mjs'; +import { type TConst } from '../const/index.mjs'; +import { type TEnum, type TEnumKey, type TEnumValue } from '../enum/index.mjs'; +import { type TExclude, type TExcludeFromMappedResult, type TExcludeFromTemplateLiteral } from '../exclude/index.mjs'; +import { type TExtends, type TExtendsFromMappedKey, type TExtendsFromMappedResult } from '../extends/index.mjs'; +import { type TExtract, type TExtractFromMappedResult, type TExtractFromTemplateLiteral } from '../extract/index.mjs'; +import { TIndex, type TIndexPropertyKeys, type TIndexFromMappedKey, type TIndexFromMappedResult, type TIndexFromComputed } from '../indexed/index.mjs'; +import { type IntegerOptions, type TInteger } from '../integer/index.mjs'; +import { Intersect, type IntersectOptions } from '../intersect/index.mjs'; +import { type TCapitalize, type TUncapitalize, type TLowercase, type TUppercase } from '../intrinsic/index.mjs'; +import { type TKeyOf } from '../keyof/index.mjs'; +import { type TLiteral, type TLiteralValue } from '../literal/index.mjs'; +import { type TMappedFunction, type TMapped, type TMappedResult } from '../mapped/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TNot } from '../not/index.mjs'; +import { type TNull } from '../null/index.mjs'; +import { type TMappedKey } from '../mapped/index.mjs'; +import { TModule } from '../module/index.mjs'; +import { type TNumber, type NumberOptions } from '../number/index.mjs'; +import { type TObject, type TProperties, type ObjectOptions } from '../object/index.mjs'; +import { type TOmit } from '../omit/index.mjs'; +import { type TOptionalWithFlag, type TOptionalFromMappedResult } from '../optional/index.mjs'; +import { type TPartial, type TPartialFromMappedResult } from '../partial/index.mjs'; +import { type TPick } from '../pick/index.mjs'; +import { type TReadonlyWithFlag, type TReadonlyFromMappedResult } from '../readonly/index.mjs'; +import { type TReadonlyOptional } from '../readonly-optional/index.mjs'; +import { type TRecordOrObject } from '../record/index.mjs'; +import { type TRecursive, type TThis } from '../recursive/index.mjs'; +import { type TRef, type TRefUnsafe } from '../ref/index.mjs'; +import { type TRequired, type TRequiredFromMappedResult } from '../required/index.mjs'; +import { type TRest } from '../rest/index.mjs'; +import { type TSchema, type SchemaOptions } from '../schema/index.mjs'; +import { type TString, type StringOptions } from '../string/index.mjs'; +import { type TTemplateLiteral, type TTemplateLiteralKind, type TTemplateLiteralSyntax } from '../template-literal/index.mjs'; +import { TransformDecodeBuilder } from '../transform/index.mjs'; +import { type TTuple } from '../tuple/index.mjs'; +import { Union } from '../union/index.mjs'; +import { type TUnknown } from '../unknown/index.mjs'; +import { type TUnsafe, type UnsafeOptions } from '../unsafe/index.mjs'; +/** Json Type Builder with Static Resolution for TypeScript */ +export declare class JsonTypeBuilder { + /** `[Json]` Creates a Readonly and Optional property */ + ReadonlyOptional(type: Type): TReadonlyOptional; + /** `[Json]` Creates a Readonly property */ + Readonly(type: Type, enable: Flag): TReadonlyFromMappedResult; + /** `[Json]` Creates a Readonly property */ + Readonly(type: Type, enable: Flag): TReadonlyWithFlag; + /** `[Json]` Creates a Optional property */ + Readonly(type: Type): TReadonlyFromMappedResult; + /** `[Json]` Creates a Readonly property */ + Readonly(type: Type): TReadonlyWithFlag; + /** `[Json]` Creates a Optional property */ + Optional(type: Type, enable: Flag): TOptionalFromMappedResult; + /** `[Json]` Creates a Optional property */ + Optional(type: Type, enable: Flag): TOptionalWithFlag; + /** `[Json]` Creates a Optional property */ + Optional(type: Type): TOptionalFromMappedResult; + /** `[Json]` Creates a Optional property */ + Optional(type: Type): TOptionalWithFlag; + /** `[Json]` Creates an Any type */ + Any(options?: SchemaOptions): TAny; + /** `[Json]` Creates an Array type */ + Array(items: Type, options?: ArrayOptions): TArray; + /** `[Json]` Creates a Boolean type */ + Boolean(options?: SchemaOptions): TBoolean; + /** `[Json]` Intrinsic function to Capitalize LiteralString types */ + Capitalize(schema: T, options?: SchemaOptions): TCapitalize; + /** `[Json]` Creates a Composite object type */ + Composite(schemas: [...T], options?: ObjectOptions): TComposite; + /** `[JavaScript]` Creates a readonly const type from the given value. */ + Const(value: T, options?: SchemaOptions): TConst; + /** `[Json]` Creates a Enum type */ + Enum>(item: T, options?: SchemaOptions): TEnum; + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromMappedResult; + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExcludeFromTemplateLiteral; + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude; + /** `[Json]` Creates a Conditional type */ + Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult; + /** `[Json]` Creates a Conditional type */ + Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey; + /** `[Json]` Creates a Conditional type */ + Extends(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends; + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type: L, union: R, options?: SchemaOptions): TExtractFromMappedResult; + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type: L, union: R, options?: SchemaOptions): TExtractFromTemplateLiteral; + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type: L, union: R, options?: SchemaOptions): TExtract; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, key: Key, options?: SchemaOptions): TIndexFromComputed; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TIndexFromMappedResult; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TIndexFromMappedKey; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index>(T: Type, K: Key, options?: SchemaOptions): TIndex; + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type: Type, propertyKeys: readonly [...PropertyKeys], options?: SchemaOptions): TIndex; + /** `[Json]` Creates an Integer type */ + Integer(options?: IntegerOptions): TInteger; + /** `[Json]` Creates an Intersect type */ + Intersect(types: [...Types], options?: IntersectOptions): Intersect; + /** `[Json]` Creates a KeyOf type */ + KeyOf(type: Type, options?: SchemaOptions): TKeyOf; + /** `[Json]` Creates a Literal type */ + Literal(literalValue: LiteralValue, options?: SchemaOptions): TLiteral; + /** `[Json]` Intrinsic function to Lowercase LiteralString types */ + Lowercase(type: Type, options?: SchemaOptions): TLowercase; + /** `[Json]` Creates a Mapped object type */ + Mapped, F extends TMappedFunction = TMappedFunction, R extends TMapped = TMapped>(key: K, map: F, options?: ObjectOptions): R; + /** `[Json]` Creates a Mapped object type */ + Mapped = TMappedFunction, R extends TMapped = TMapped>(key: [...K], map: F, options?: ObjectOptions): R; + /** `[Json]` Creates a Type Definition Module. */ + Module(properties: Properties): TModule; + /** `[Json]` Creates a Never type */ + Never(options?: SchemaOptions): TNever; + /** `[Json]` Creates a Not type */ + Not(type: T, options?: SchemaOptions): TNot; + /** `[Json]` Creates a Null type */ + Null(options?: SchemaOptions): TNull; + /** `[Json]` Creates a Number type */ + Number(options?: NumberOptions): TNumber; + /** `[Json]` Creates an Object type */ + Object(properties: T, options?: ObjectOptions): TObject; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Omit(type: Type, key: readonly [...Key], options?: SchemaOptions): TOmit; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Omit(type: Type, key: Key, options?: SchemaOptions): TOmit; + /** `[Json]` Constructs a type where all properties are optional */ + Partial(type: MappedResult, options?: SchemaOptions): TPartialFromMappedResult; + /** `[Json]` Constructs a type where all properties are optional */ + Partial(type: Type, options?: SchemaOptions): TPartial; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Pick(type: Type, key: readonly [...Key], options?: SchemaOptions): TPick; + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Pick(type: Type, key: Key, options?: SchemaOptions): TPick; + /** `[Json]` Creates a Record type */ + Record(key: Key, value: Value, options?: ObjectOptions): TRecordOrObject; + /** `[Json]` Creates a Recursive type */ + Recursive(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive; + /** `[Json]` Creates a Ref type.*/ + Ref($ref: Ref, options?: SchemaOptions): TRef; + /** + * @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass + * a `string` value for the reference (and not a schema). + * + * To adhere to the 0.34.0 signature, Ref implementations should be updated to the following. + * + * ```typescript + * // pre-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Ref(T) + * ``` + * should be changed to the following + * + * ```typescript + * // post-0.34.0 + * + * const T = Type.String({ $id: 'T' }) + * + * const R = Type.Unsafe>(Type.Ref('T')) + * ``` + * You can also create a generic function to replicate the pre-0.34.0 signature if required + * + * ```typescript + * const LegacyRef = (schema: T) => Type.Unsafe>(Type.Ref(schema.$id!)) + * ``` + */ + Ref(type: Type, options?: SchemaOptions): TRefUnsafe; + /** `[Json]` Constructs a type where all properties are required */ + Required(type: MappedResult, options?: SchemaOptions): TRequiredFromMappedResult; + /** `[Json]` Constructs a type where all properties are required */ + Required(type: Type, options?: SchemaOptions): TRequired; + /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ + Rest(type: Type): TRest; + /** `[Json]` Creates a String type */ + String(options?: StringOptions): TString; + /** `[Json]` Creates a TemplateLiteral type from template dsl string */ + TemplateLiteral(syntax: Syntax, options?: SchemaOptions): TTemplateLiteralSyntax; + /** `[Json]` Creates a TemplateLiteral type */ + TemplateLiteral(kinds: [...Kinds], options?: SchemaOptions): TTemplateLiteral; + /** `[Json]` Creates a Transform type */ + Transform(type: Type): TransformDecodeBuilder; + /** `[Json]` Creates a Tuple type */ + Tuple(types: [...Types], options?: SchemaOptions): TTuple; + /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ + Uncapitalize(type: Type, options?: SchemaOptions): TUncapitalize; + /** `[Json]` Creates a Union type */ + Union(types: [...Types], options?: SchemaOptions): Union; + /** `[Json]` Creates an Unknown type */ + Unknown(options?: SchemaOptions): TUnknown; + /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ + Unsafe(options?: UnsafeOptions): TUnsafe; + /** `[Json]` Intrinsic function to Uppercase LiteralString types */ + Uppercase(schema: T, options?: SchemaOptions): TUppercase; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/json.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/type/json.mjs new file mode 100644 index 0000000..b5f341a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/json.mjs @@ -0,0 +1,221 @@ +import { Any } from '../any/index.mjs'; +import { Array } from '../array/index.mjs'; +import { Boolean } from '../boolean/index.mjs'; +import { Composite } from '../composite/index.mjs'; +import { Const } from '../const/index.mjs'; +import { Enum } from '../enum/index.mjs'; +import { Exclude } from '../exclude/index.mjs'; +import { Extends } from '../extends/index.mjs'; +import { Extract } from '../extract/index.mjs'; +import { Index } from '../indexed/index.mjs'; +import { Integer } from '../integer/index.mjs'; +import { Intersect } from '../intersect/index.mjs'; +import { Capitalize, Uncapitalize, Lowercase, Uppercase } from '../intrinsic/index.mjs'; +import { KeyOf } from '../keyof/index.mjs'; +import { Literal } from '../literal/index.mjs'; +import { Mapped } from '../mapped/index.mjs'; +import { Never } from '../never/index.mjs'; +import { Not } from '../not/index.mjs'; +import { Null } from '../null/index.mjs'; +import { Module } from '../module/index.mjs'; +import { Number } from '../number/index.mjs'; +import { Object } from '../object/index.mjs'; +import { Omit } from '../omit/index.mjs'; +import { Optional } from '../optional/index.mjs'; +import { Partial } from '../partial/index.mjs'; +import { Pick } from '../pick/index.mjs'; +import { Readonly } from '../readonly/index.mjs'; +import { ReadonlyOptional } from '../readonly-optional/index.mjs'; +import { Record } from '../record/index.mjs'; +import { Recursive } from '../recursive/index.mjs'; +import { Ref } from '../ref/index.mjs'; +import { Required } from '../required/index.mjs'; +import { Rest } from '../rest/index.mjs'; +import { String } from '../string/index.mjs'; +import { TemplateLiteral } from '../template-literal/index.mjs'; +import { Transform } from '../transform/index.mjs'; +import { Tuple } from '../tuple/index.mjs'; +import { Union } from '../union/index.mjs'; +import { Unknown } from '../unknown/index.mjs'; +import { Unsafe } from '../unsafe/index.mjs'; +/** Json Type Builder with Static Resolution for TypeScript */ +export class JsonTypeBuilder { + // ------------------------------------------------------------------------ + // Modifiers + // ------------------------------------------------------------------------ + /** `[Json]` Creates a Readonly and Optional property */ + ReadonlyOptional(type) { + return ReadonlyOptional(type); + } + /** `[Json]` Creates a Readonly property */ + Readonly(type, enable) { + return Readonly(type, enable ?? true); + } + /** `[Json]` Creates a Optional property */ + Optional(type, enable) { + return Optional(type, enable ?? true); + } + // ------------------------------------------------------------------------ + // Types + // ------------------------------------------------------------------------ + /** `[Json]` Creates an Any type */ + Any(options) { + return Any(options); + } + /** `[Json]` Creates an Array type */ + Array(items, options) { + return Array(items, options); + } + /** `[Json]` Creates a Boolean type */ + Boolean(options) { + return Boolean(options); + } + /** `[Json]` Intrinsic function to Capitalize LiteralString types */ + Capitalize(schema, options) { + return Capitalize(schema, options); + } + /** `[Json]` Creates a Composite object type */ + Composite(schemas, options) { + return Composite(schemas, options); // (error) TS 5.4.0-dev - review TComposite implementation + } + /** `[JavaScript]` Creates a readonly const type from the given value. */ + Const(value, options) { + return Const(value, options); + } + /** `[Json]` Creates a Enum type */ + Enum(item, options) { + return Enum(item, options); + } + /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ + Exclude(unionType, excludedMembers, options) { + return Exclude(unionType, excludedMembers, options); + } + /** `[Json]` Creates a Conditional type */ + Extends(L, R, T, F, options) { + return Extends(L, R, T, F, options); + } + /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ + Extract(type, union, options) { + return Extract(type, union, options); + } + /** `[Json]` Returns an Indexed property type for the given keys */ + Index(type, key, options) { + return Index(type, key, options); + } + /** `[Json]` Creates an Integer type */ + Integer(options) { + return Integer(options); + } + /** `[Json]` Creates an Intersect type */ + Intersect(types, options) { + return Intersect(types, options); + } + /** `[Json]` Creates a KeyOf type */ + KeyOf(type, options) { + return KeyOf(type, options); + } + /** `[Json]` Creates a Literal type */ + Literal(literalValue, options) { + return Literal(literalValue, options); + } + /** `[Json]` Intrinsic function to Lowercase LiteralString types */ + Lowercase(type, options) { + return Lowercase(type, options); + } + /** `[Json]` Creates a Mapped object type */ + Mapped(key, map, options) { + return Mapped(key, map, options); + } + /** `[Json]` Creates a Type Definition Module. */ + Module(properties) { + return Module(properties); + } + /** `[Json]` Creates a Never type */ + Never(options) { + return Never(options); + } + /** `[Json]` Creates a Not type */ + Not(type, options) { + return Not(type, options); + } + /** `[Json]` Creates a Null type */ + Null(options) { + return Null(options); + } + /** `[Json]` Creates a Number type */ + Number(options) { + return Number(options); + } + /** `[Json]` Creates an Object type */ + Object(properties, options) { + return Object(properties, options); + } + /** `[Json]` Constructs a type whose keys are omitted from the given type */ + Omit(schema, selector, options) { + return Omit(schema, selector, options); + } + /** `[Json]` Constructs a type where all properties are optional */ + Partial(type, options) { + return Partial(type, options); + } + /** `[Json]` Constructs a type whose keys are picked from the given type */ + Pick(type, key, options) { + return Pick(type, key, options); + } + /** `[Json]` Creates a Record type */ + Record(key, value, options) { + return Record(key, value, options); + } + /** `[Json]` Creates a Recursive type */ + Recursive(callback, options) { + return Recursive(callback, options); + } + /** `[Json]` Creates a Ref type. The referenced type must contain a $id */ + Ref(...args) { + return Ref(args[0], args[1]); + } + /** `[Json]` Constructs a type where all properties are required */ + Required(type, options) { + return Required(type, options); + } + /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ + Rest(type) { + return Rest(type); + } + /** `[Json]` Creates a String type */ + String(options) { + return String(options); + } + /** `[Json]` Creates a TemplateLiteral type */ + TemplateLiteral(unresolved, options) { + return TemplateLiteral(unresolved, options); + } + /** `[Json]` Creates a Transform type */ + Transform(type) { + return Transform(type); + } + /** `[Json]` Creates a Tuple type */ + Tuple(types, options) { + return Tuple(types, options); + } + /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ + Uncapitalize(type, options) { + return Uncapitalize(type, options); + } + /** `[Json]` Creates a Union type */ + Union(types, options) { + return Union(types, options); + } + /** `[Json]` Creates an Unknown type */ + Unknown(options) { + return Unknown(options); + } + /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ + Unsafe(options) { + return Unsafe(options); + } + /** `[Json]` Intrinsic function to Uppercase LiteralString types */ + Uppercase(schema, options) { + return Uppercase(schema, options); + } +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/type/type.d.mts new file mode 100644 index 0000000..2a4e9e6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/type.d.mts @@ -0,0 +1,59 @@ +export { Any } from '../any/index.mjs'; +export { Argument } from '../argument/index.mjs'; +export { Array } from '../array/index.mjs'; +export { AsyncIterator } from '../async-iterator/index.mjs'; +export { Awaited } from '../awaited/index.mjs'; +export { BigInt } from '../bigint/index.mjs'; +export { Boolean } from '../boolean/index.mjs'; +export { Composite } from '../composite/index.mjs'; +export { Const } from '../const/index.mjs'; +export { Constructor } from '../constructor/index.mjs'; +export { ConstructorParameters } from '../constructor-parameters/index.mjs'; +export { Date } from '../date/index.mjs'; +export { Enum } from '../enum/index.mjs'; +export { Exclude } from '../exclude/index.mjs'; +export { Extends } from '../extends/index.mjs'; +export { Extract } from '../extract/index.mjs'; +export { Function } from '../function/index.mjs'; +export { Index } from '../indexed/index.mjs'; +export { InstanceType } from '../instance-type/index.mjs'; +export { Instantiate } from '../instantiate/index.mjs'; +export { Integer } from '../integer/index.mjs'; +export { Intersect } from '../intersect/index.mjs'; +export { Capitalize, Uncapitalize, Lowercase, Uppercase } from '../intrinsic/index.mjs'; +export { Iterator } from '../iterator/index.mjs'; +export { KeyOf } from '../keyof/index.mjs'; +export { Literal } from '../literal/index.mjs'; +export { Mapped } from '../mapped/index.mjs'; +export { Module } from '../module/index.mjs'; +export { Never } from '../never/index.mjs'; +export { Not } from '../not/index.mjs'; +export { Null } from '../null/index.mjs'; +export { Number } from '../number/index.mjs'; +export { Object } from '../object/index.mjs'; +export { Omit } from '../omit/index.mjs'; +export { Optional } from '../optional/index.mjs'; +export { Parameters } from '../parameters/index.mjs'; +export { Partial } from '../partial/index.mjs'; +export { Pick } from '../pick/index.mjs'; +export { Promise } from '../promise/index.mjs'; +export { Readonly } from '../readonly/index.mjs'; +export { ReadonlyOptional } from '../readonly-optional/index.mjs'; +export { Record } from '../record/index.mjs'; +export { Recursive } from '../recursive/index.mjs'; +export { Ref } from '../ref/index.mjs'; +export { RegExp } from '../regexp/index.mjs'; +export { Required } from '../required/index.mjs'; +export { Rest } from '../rest/index.mjs'; +export { ReturnType } from '../return-type/index.mjs'; +export { String } from '../string/index.mjs'; +export { Symbol } from '../symbol/index.mjs'; +export { TemplateLiteral } from '../template-literal/index.mjs'; +export { Transform } from '../transform/index.mjs'; +export { Tuple } from '../tuple/index.mjs'; +export { Uint8Array } from '../uint8array/index.mjs'; +export { Undefined } from '../undefined/index.mjs'; +export { Union } from '../union/index.mjs'; +export { Unknown } from '../unknown/index.mjs'; +export { Unsafe } from '../unsafe/index.mjs'; +export { Void } from '../void/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs new file mode 100644 index 0000000..116be26 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs @@ -0,0 +1,62 @@ +// ------------------------------------------------------------------ +// Type: Module +// ------------------------------------------------------------------ +export { Any } from '../any/index.mjs'; +export { Argument } from '../argument/index.mjs'; +export { Array } from '../array/index.mjs'; +export { AsyncIterator } from '../async-iterator/index.mjs'; +export { Awaited } from '../awaited/index.mjs'; +export { BigInt } from '../bigint/index.mjs'; +export { Boolean } from '../boolean/index.mjs'; +export { Composite } from '../composite/index.mjs'; +export { Const } from '../const/index.mjs'; +export { Constructor } from '../constructor/index.mjs'; +export { ConstructorParameters } from '../constructor-parameters/index.mjs'; +export { Date } from '../date/index.mjs'; +export { Enum } from '../enum/index.mjs'; +export { Exclude } from '../exclude/index.mjs'; +export { Extends } from '../extends/index.mjs'; +export { Extract } from '../extract/index.mjs'; +export { Function } from '../function/index.mjs'; +export { Index } from '../indexed/index.mjs'; +export { InstanceType } from '../instance-type/index.mjs'; +export { Instantiate } from '../instantiate/index.mjs'; +export { Integer } from '../integer/index.mjs'; +export { Intersect } from '../intersect/index.mjs'; +export { Capitalize, Uncapitalize, Lowercase, Uppercase } from '../intrinsic/index.mjs'; +export { Iterator } from '../iterator/index.mjs'; +export { KeyOf } from '../keyof/index.mjs'; +export { Literal } from '../literal/index.mjs'; +export { Mapped } from '../mapped/index.mjs'; +export { Module } from '../module/index.mjs'; +export { Never } from '../never/index.mjs'; +export { Not } from '../not/index.mjs'; +export { Null } from '../null/index.mjs'; +export { Number } from '../number/index.mjs'; +export { Object } from '../object/index.mjs'; +export { Omit } from '../omit/index.mjs'; +export { Optional } from '../optional/index.mjs'; +export { Parameters } from '../parameters/index.mjs'; +export { Partial } from '../partial/index.mjs'; +export { Pick } from '../pick/index.mjs'; +export { Promise } from '../promise/index.mjs'; +export { Readonly } from '../readonly/index.mjs'; +export { ReadonlyOptional } from '../readonly-optional/index.mjs'; +export { Record } from '../record/index.mjs'; +export { Recursive } from '../recursive/index.mjs'; +export { Ref } from '../ref/index.mjs'; +export { RegExp } from '../regexp/index.mjs'; +export { Required } from '../required/index.mjs'; +export { Rest } from '../rest/index.mjs'; +export { ReturnType } from '../return-type/index.mjs'; +export { String } from '../string/index.mjs'; +export { Symbol } from '../symbol/index.mjs'; +export { TemplateLiteral } from '../template-literal/index.mjs'; +export { Transform } from '../transform/index.mjs'; +export { Tuple } from '../tuple/index.mjs'; +export { Uint8Array } from '../uint8array/index.mjs'; +export { Undefined } from '../undefined/index.mjs'; +export { Union } from '../union/index.mjs'; +export { Unknown } from '../unknown/index.mjs'; +export { Unsafe } from '../unsafe/index.mjs'; +export { Void } from '../void/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.d.mts new file mode 100644 index 0000000..3b4837e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.d.mts @@ -0,0 +1 @@ +export * from './uint8array.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.mjs new file mode 100644 index 0000000..3b4837e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/index.mjs @@ -0,0 +1 @@ +export * from './uint8array.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.d.mts new file mode 100644 index 0000000..0c8f437 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.d.mts @@ -0,0 +1,13 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface Uint8ArrayOptions extends SchemaOptions { + maxByteLength?: number; + minByteLength?: number; +} +export interface TUint8Array extends TSchema, Uint8ArrayOptions { + [Kind]: 'Uint8Array'; + static: Uint8Array; + type: 'uint8array'; +} +/** `[JavaScript]` Creates a Uint8Array type */ +export declare function Uint8Array(options?: Uint8ArrayOptions): TUint8Array; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs new file mode 100644 index 0000000..d51201f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a Uint8Array type */ +export function Uint8Array(options) { + return CreateType({ [Kind]: 'Uint8Array', type: 'Uint8Array' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.d.mts new file mode 100644 index 0000000..beb6f6d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.d.mts @@ -0,0 +1 @@ +export * from './undefined.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.mjs new file mode 100644 index 0000000..beb6f6d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/index.mjs @@ -0,0 +1 @@ +export * from './undefined.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.d.mts new file mode 100644 index 0000000..c24efbd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.d.mts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TUndefined extends TSchema { + [Kind]: 'Undefined'; + static: undefined; + type: 'undefined'; +} +/** `[JavaScript]` Creates a Undefined type */ +export declare function Undefined(options?: SchemaOptions): TUndefined; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs new file mode 100644 index 0000000..8ef98f0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a Undefined type */ +export function Undefined(options) { + return CreateType({ [Kind]: 'Undefined', type: 'undefined' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/union/index.d.mts new file mode 100644 index 0000000..22aca52 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/index.d.mts @@ -0,0 +1,3 @@ +export * from './union-evaluated.mjs'; +export * from './union-type.mjs'; +export * from './union.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/union/index.mjs new file mode 100644 index 0000000..22aca52 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/index.mjs @@ -0,0 +1,3 @@ +export * from './union-evaluated.mjs'; +export * from './union-type.mjs'; +export * from './union.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.d.mts new file mode 100644 index 0000000..b6e1ccb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.d.mts @@ -0,0 +1,3 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { TUnion } from './union-type.mjs'; +export declare function UnionCreate(T: [...T], options?: SchemaOptions): TUnion; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs new file mode 100644 index 0000000..83567ae --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs @@ -0,0 +1,5 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +export function UnionCreate(T, options) { + return CreateType({ [Kind]: 'Union', anyOf: T }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.d.mts new file mode 100644 index 0000000..05e677c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.d.mts @@ -0,0 +1,13 @@ +import type { SchemaOptions, TSchema } from '../schema/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import { type TOptional } from '../optional/index.mjs'; +import type { TReadonly } from '../readonly/index.mjs'; +import type { TUnion } from './union-type.mjs'; +type TIsUnionOptional = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? true : TIsUnionOptional : false); +type TRemoveOptionalFromRest = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? Left extends TOptional ? TRemoveOptionalFromRest]> : TRemoveOptionalFromRest : Result); +type TRemoveOptionalFromType = (Type extends TReadonly ? TReadonly> : Type extends TOptional ? TRemoveOptionalFromType : Type); +type TResolveUnion, IsOptional extends boolean = TIsUnionOptional> = (IsOptional extends true ? TOptional> : TUnion); +export type TUnionEvaluated = (Types extends [TSchema] ? Types[0] : Types extends [] ? TNever : TResolveUnion); +/** `[Json]` Creates an evaluated Union type */ +export declare function UnionEvaluated>(T: [...Types], options?: SchemaOptions): Result; +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs new file mode 100644 index 0000000..df8483b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs @@ -0,0 +1,36 @@ +import { CreateType } from '../create/type.mjs'; +import { OptionalKind } from '../symbols/index.mjs'; +import { Discard } from '../discard/index.mjs'; +import { Never } from '../never/index.mjs'; +import { Optional } from '../optional/index.mjs'; +import { UnionCreate } from './union-create.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsOptional } from '../guard/kind.mjs'; +// prettier-ignore +function IsUnionOptional(types) { + return types.some(type => IsOptional(type)); +} +// prettier-ignore +function RemoveOptionalFromRest(types) { + return types.map(left => IsOptional(left) ? RemoveOptionalFromType(left) : left); +} +// prettier-ignore +function RemoveOptionalFromType(T) { + return (Discard(T, [OptionalKind])); +} +// prettier-ignore +function ResolveUnion(types, options) { + const isOptional = IsUnionOptional(types); + return (isOptional + ? Optional(UnionCreate(RemoveOptionalFromRest(types), options)) + : UnionCreate(RemoveOptionalFromRest(types), options)); +} +/** `[Json]` Creates an evaluated Union type */ +export function UnionEvaluated(T, options) { + // prettier-ignore + return (T.length === 1 ? CreateType(T[0], options) : + T.length === 0 ? Never(options) : + ResolveUnion(T, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.d.mts new file mode 100644 index 0000000..aab00a4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.d.mts @@ -0,0 +1,12 @@ +import type { TSchema } from '../schema/index.mjs'; +import type { Static } from '../static/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +type UnionStatic = { + [K in keyof T]: T[K] extends TSchema ? Static : never; +}[number]; +export interface TUnion extends TSchema { + [Kind]: 'Union'; + static: UnionStatic; + anyOf: T; +} +export {}; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.mjs new file mode 100644 index 0000000..6d09727 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union-type.mjs @@ -0,0 +1 @@ +import { Kind } from '../symbols/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union.d.mts new file mode 100644 index 0000000..ed1c44c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union.d.mts @@ -0,0 +1,6 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { type TNever } from '../never/index.mjs'; +import type { TUnion } from './union-type.mjs'; +export type Union = (T extends [] ? TNever : T extends [TSchema] ? T[0] : TUnion); +/** `[Json]` Creates a Union type */ +export declare function Union(types: [...Types], options?: SchemaOptions): Union; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs new file mode 100644 index 0000000..6911884 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs @@ -0,0 +1,10 @@ +import { Never } from '../never/index.mjs'; +import { CreateType } from '../create/type.mjs'; +import { UnionCreate } from './union-create.mjs'; +/** `[Json]` Creates a Union type */ +export function Union(types, options) { + // prettier-ignore + return (types.length === 0 ? Never(options) : + types.length === 1 ? CreateType(types[0], options) : + UnionCreate(types, options)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.d.mts new file mode 100644 index 0000000..10f321d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.d.mts @@ -0,0 +1 @@ +export * from './unknown.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.mjs new file mode 100644 index 0000000..10f321d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/index.mjs @@ -0,0 +1 @@ +export * from './unknown.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.d.mts new file mode 100644 index 0000000..12c328c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.d.mts @@ -0,0 +1,8 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TUnknown extends TSchema { + [Kind]: 'Unknown'; + static: unknown; +} +/** `[Json]` Creates an Unknown type */ +export declare function Unknown(options?: SchemaOptions): TUnknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs new file mode 100644 index 0000000..4d1f104 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates an Unknown type */ +export function Unknown(options) { + return CreateType({ [Kind]: 'Unknown' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.d.mts new file mode 100644 index 0000000..9643f61 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.d.mts @@ -0,0 +1 @@ +export * from './unsafe.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.mjs new file mode 100644 index 0000000..9643f61 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/index.mjs @@ -0,0 +1 @@ +export * from './unsafe.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.d.mts new file mode 100644 index 0000000..bb5e20d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.d.mts @@ -0,0 +1,11 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface UnsafeOptions extends SchemaOptions { + [Kind]?: string; +} +export interface TUnsafe extends TSchema { + [Kind]: string; + static: T; +} +/** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ +export declare function Unsafe(options?: UnsafeOptions): TUnsafe; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs new file mode 100644 index 0000000..15abb1b --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ +export function Unsafe(options = {}) { + return CreateType({ [Kind]: options[Kind] ?? 'Unsafe' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/void/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/void/index.d.mts new file mode 100644 index 0000000..f9933e3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/void/index.d.mts @@ -0,0 +1 @@ +export * from './void.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/void/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/void/index.mjs new file mode 100644 index 0000000..f9933e3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/void/index.mjs @@ -0,0 +1 @@ +export * from './void.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/void/void.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/type/void/void.d.mts new file mode 100644 index 0000000..a48dad5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/void/void.d.mts @@ -0,0 +1,9 @@ +import type { TSchema, SchemaOptions } from '../schema/index.mjs'; +import { Kind } from '../symbols/index.mjs'; +export interface TVoid extends TSchema { + [Kind]: 'Void'; + static: void; + type: 'void'; +} +/** `[JavaScript]` Creates a Void type */ +export declare function Void(options?: SchemaOptions): TVoid; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs b/ui/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs new file mode 100644 index 0000000..f5bf7d9 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs @@ -0,0 +1,6 @@ +import { CreateType } from '../create/type.mjs'; +import { Kind } from '../symbols/index.mjs'; +/** `[JavaScript]` Creates a Void type */ +export function Void(options) { + return CreateType({ [Kind]: 'Void', type: 'void' }, options); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.d.mts new file mode 100644 index 0000000..57e13ca --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.d.mts @@ -0,0 +1,15 @@ +import { ValueErrorIterator, ValueError } from '../../errors/index.mjs'; +import { TypeBoxError } from '../../type/error/error.mjs'; +import { TSchema } from '../../type/schema/index.mjs'; +import { Static } from '../../type/static/index.mjs'; +export declare class AssertError extends TypeBoxError { + #private; + error: ValueError | undefined; + constructor(iterator: ValueErrorIterator); + /** Returns an iterator for each error in this value. */ + Errors(): ValueErrorIterator; +} +/** Asserts a value matches the given type or throws an `AssertError` if invalid */ +export declare function Assert(schema: T, references: TSchema[], value: unknown): asserts value is Static; +/** Asserts a value matches the given type or throws an `AssertError` if invalid */ +export declare function Assert(schema: T, value: unknown): asserts value is Static; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.mjs new file mode 100644 index 0000000..93034f0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/assert.mjs @@ -0,0 +1,49 @@ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _AssertError_instances, _AssertError_iterator, _AssertError_Iterator; +import { Errors, ValueErrorIterator } from '../../errors/index.mjs'; +import { TypeBoxError } from '../../type/error/error.mjs'; +import { Check } from '../check/check.mjs'; +// ------------------------------------------------------------------ +// AssertError +// ------------------------------------------------------------------ +export class AssertError extends TypeBoxError { + constructor(iterator) { + const error = iterator.First(); + super(error === undefined ? 'Invalid Value' : error.message); + _AssertError_instances.add(this); + _AssertError_iterator.set(this, void 0); + __classPrivateFieldSet(this, _AssertError_iterator, iterator, "f"); + this.error = error; + } + /** Returns an iterator for each error in this value. */ + Errors() { + return new ValueErrorIterator(__classPrivateFieldGet(this, _AssertError_instances, "m", _AssertError_Iterator).call(this)); + } +} +_AssertError_iterator = new WeakMap(), _AssertError_instances = new WeakSet(), _AssertError_Iterator = function* _AssertError_Iterator() { + if (this.error) + yield this.error; + yield* __classPrivateFieldGet(this, _AssertError_iterator, "f"); +}; +// ------------------------------------------------------------------ +// AssertValue +// ------------------------------------------------------------------ +function AssertValue(schema, references, value) { + if (Check(schema, references, value)) + return; + throw new AssertError(Errors(schema, references, value)); +} +/** Asserts a value matches the given type or throws an `AssertError` if invalid */ +export function Assert(...args) { + return args.length === 3 ? AssertValue(args[0], args[1], args[2]) : AssertValue(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.d.mts new file mode 100644 index 0000000..d981f4c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.d.mts @@ -0,0 +1 @@ +export * from './assert.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.mjs new file mode 100644 index 0000000..d981f4c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/assert/index.mjs @@ -0,0 +1 @@ +export * from './assert.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.d.mts new file mode 100644 index 0000000..ce46fa2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.d.mts @@ -0,0 +1,11 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import type { TSchema } from '../../type/schema/index.mjs'; +import type { Static } from '../../type/static/index.mjs'; +export declare class ValueCastError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema, message: string); +} +/** Casts a value into a given type and references. The return value will retain as much information of the original value as possible. */ +export declare function Cast(schema: T, references: TSchema[], value: unknown): Static; +/** Casts a value into a given type. The return value will retain as much information of the original value as possible. */ +export declare function Cast(schema: T, value: unknown): Static; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.mjs new file mode 100644 index 0000000..cbe3c43 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/cast.mjs @@ -0,0 +1,235 @@ +import { IsObject, IsArray, IsString, IsNumber, IsNull } from '../guard/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +import { Create } from '../create/index.mjs'; +import { Check } from '../check/index.mjs'; +import { Clone } from '../clone/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class ValueCastError extends TypeBoxError { + constructor(schema, message) { + super(message); + this.schema = schema; + } +} +// ------------------------------------------------------------------ +// The following logic assigns a score to a schema based on how well +// it matches a given value. For object types, the score is calculated +// by evaluating each property of the value against the schema's +// properties. To avoid bias towards objects with many properties, +// each property contributes equally to the total score. Properties +// that exactly match literal values receive the highest possible +// score, as literals are often used as discriminators in union types. +// ------------------------------------------------------------------ +function ScoreUnion(schema, references, value) { + if (schema[Kind] === 'Object' && typeof value === 'object' && !IsNull(value)) { + const object = schema; + const keys = Object.getOwnPropertyNames(value); + const entries = Object.entries(object.properties); + return entries.reduce((acc, [key, schema]) => { + const literal = schema[Kind] === 'Literal' && schema.const === value[key] ? 100 : 0; + const checks = Check(schema, references, value[key]) ? 10 : 0; + const exists = keys.includes(key) ? 1 : 0; + return acc + (literal + checks + exists); + }, 0); + } + else if (schema[Kind] === 'Union') { + const schemas = schema.anyOf.map((schema) => Deref(schema, references)); + const scores = schemas.map((schema) => ScoreUnion(schema, references, value)); + return Math.max(...scores); + } + else { + return Check(schema, references, value) ? 1 : 0; + } +} +function SelectUnion(union, references, value) { + const schemas = union.anyOf.map((schema) => Deref(schema, references)); + let [select, best] = [schemas[0], 0]; + for (const schema of schemas) { + const score = ScoreUnion(schema, references, value); + if (score > best) { + select = schema; + best = score; + } + } + return select; +} +function CastUnion(union, references, value) { + if ('default' in union) { + return typeof value === 'function' ? union.default : Clone(union.default); + } + else { + const schema = SelectUnion(union, references, value); + return Cast(schema, references, value); + } +} +// ------------------------------------------------------------------ +// Default +// ------------------------------------------------------------------ +function DefaultClone(schema, references, value) { + return Check(schema, references, value) ? Clone(value) : Create(schema, references); +} +function Default(schema, references, value) { + return Check(schema, references, value) ? value : Create(schema, references); +} +// ------------------------------------------------------------------ +// Cast +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + if (Check(schema, references, value)) + return Clone(value); + const created = IsArray(value) ? Clone(value) : Create(schema, references); + const minimum = IsNumber(schema.minItems) && created.length < schema.minItems ? [...created, ...Array.from({ length: schema.minItems - created.length }, () => null)] : created; + const maximum = IsNumber(schema.maxItems) && minimum.length > schema.maxItems ? minimum.slice(0, schema.maxItems) : minimum; + const casted = maximum.map((value) => Visit(schema.items, references, value)); + if (schema.uniqueItems !== true) + return casted; + const unique = [...new Set(casted)]; + if (!Check(schema, references, unique)) + throw new ValueCastError(schema, 'Array cast produced invalid data due to uniqueItems constraint'); + return unique; +} +function FromConstructor(schema, references, value) { + if (Check(schema, references, value)) + return Create(schema, references); + const required = new Set(schema.returns.required || []); + const result = function () { }; + for (const [key, property] of Object.entries(schema.returns.properties)) { + if (!required.has(key) && value.prototype[key] === undefined) + continue; + result.prototype[key] = Visit(property, references, value.prototype[key]); + } + return result; +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +// ------------------------------------------------------------------ +// Intersect +// ------------------------------------------------------------------ +function IntersectAssign(correct, value) { + // trust correct on mismatch | value on non-object + if ((IsObject(correct) && !IsObject(value)) || (!IsObject(correct) && IsObject(value))) + return correct; + if (!IsObject(correct) || !IsObject(value)) + return value; + return globalThis.Object.getOwnPropertyNames(correct).reduce((result, key) => { + const property = key in value ? IntersectAssign(correct[key], value[key]) : correct[key]; + return { ...result, [key]: property }; + }, {}); +} +function FromIntersect(schema, references, value) { + if (Check(schema, references, value)) + return value; + const correct = Create(schema, references); + const assigned = IntersectAssign(correct, value); + return Check(schema, references, assigned) ? assigned : correct; +} +function FromNever(schema, references, value) { + throw new ValueCastError(schema, 'Never types cannot be cast'); +} +function FromObject(schema, references, value) { + if (Check(schema, references, value)) + return value; + if (value === null || typeof value !== 'object') + return Create(schema, references); + const required = new Set(schema.required || []); + const result = {}; + for (const [key, property] of Object.entries(schema.properties)) { + if (!required.has(key) && value[key] === undefined) + continue; + result[key] = Visit(property, references, value[key]); + } + // additional schema properties + if (typeof schema.additionalProperties === 'object') { + const propertyNames = Object.getOwnPropertyNames(schema.properties); + for (const propertyName of Object.getOwnPropertyNames(value)) { + if (propertyNames.includes(propertyName)) + continue; + result[propertyName] = Visit(schema.additionalProperties, references, value[propertyName]); + } + } + return result; +} +function FromRecord(schema, references, value) { + if (Check(schema, references, value)) + return Clone(value); + if (value === null || typeof value !== 'object' || Array.isArray(value) || value instanceof Date) + return Create(schema, references); + const subschemaPropertyName = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const subschema = schema.patternProperties[subschemaPropertyName]; + const result = {}; + for (const [propKey, propValue] of Object.entries(value)) { + result[propKey] = Visit(subschema, references, propValue); + } + return result; +} +function FromRef(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromThis(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromTuple(schema, references, value) { + if (Check(schema, references, value)) + return Clone(value); + if (!IsArray(value)) + return Create(schema, references); + if (schema.items === undefined) + return []; + return schema.items.map((schema, index) => Visit(schema, references, value[index])); +} +function FromUnion(schema, references, value) { + return Check(schema, references, value) ? Clone(value) : CastUnion(schema, references, value); +} +function Visit(schema, references, value) { + const references_ = IsString(schema.$id) ? Pushref(schema, references) : references; + const schema_ = schema; + switch (schema[Kind]) { + // -------------------------------------------------------------- + // Structural + // -------------------------------------------------------------- + case 'Array': + return FromArray(schema_, references_, value); + case 'Constructor': + return FromConstructor(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Never': + return FromNever(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + // -------------------------------------------------------------- + // DefaultClone + // -------------------------------------------------------------- + case 'Date': + case 'Symbol': + case 'Uint8Array': + return DefaultClone(schema, references, value); + // -------------------------------------------------------------- + // Default + // -------------------------------------------------------------- + default: + return Default(schema_, references_, value); + } +} +/** Casts a value into a given type. The return value will retain as much information of the original value as possible. */ +export function Cast(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.d.mts new file mode 100644 index 0000000..f23796a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.d.mts @@ -0,0 +1 @@ +export * from './cast.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.mjs new file mode 100644 index 0000000..f23796a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/cast/index.mjs @@ -0,0 +1 @@ +export * from './cast.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/check/check.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/check/check.d.mts new file mode 100644 index 0000000..a9fe8ab --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/check/check.d.mts @@ -0,0 +1,11 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import type { TSchema } from '../../type/schema/index.mjs'; +import type { Static } from '../../type/static/index.mjs'; +export declare class ValueCheckUnknownTypeError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema); +} +/** Returns true if the value matches the given type. */ +export declare function Check(schema: T, references: TSchema[], value: unknown): value is Static; +/** Returns true if the value matches the given type. */ +export declare function Check(schema: T, value: unknown): value is Static; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/check/check.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/check/check.mjs new file mode 100644 index 0000000..fb6fa67 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/check/check.mjs @@ -0,0 +1,470 @@ +import { TypeSystemPolicy } from '../../system/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +import { Hash } from '../hash/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +import { KeyOfPattern } from '../../type/keyof/index.mjs'; +import { ExtendsUndefinedCheck } from '../../type/extends/index.mjs'; +import { TypeRegistry, FormatRegistry } from '../../type/registry/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +import { Never } from '../../type/never/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsArray, IsUint8Array, IsDate, IsPromise, IsFunction, IsAsyncIterator, IsIterator, IsBoolean, IsNumber, IsBigInt, IsString, IsSymbol, IsInteger, IsNull, IsUndefined } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +import { IsSchema } from '../../type/guard/kind.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class ValueCheckUnknownTypeError extends TypeBoxError { + constructor(schema) { + super(`Unknown type`); + this.schema = schema; + } +} +// ------------------------------------------------------------------ +// TypeGuards +// ------------------------------------------------------------------ +function IsAnyOrUnknown(schema) { + return schema[Kind] === 'Any' || schema[Kind] === 'Unknown'; +} +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +function IsDefined(value) { + return value !== undefined; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +function FromAny(schema, references, value) { + return true; +} +function FromArgument(schema, references, value) { + return true; +} +function FromArray(schema, references, value) { + if (!IsArray(value)) + return false; + if (IsDefined(schema.minItems) && !(value.length >= schema.minItems)) { + return false; + } + if (IsDefined(schema.maxItems) && !(value.length <= schema.maxItems)) { + return false; + } + for (const element of value) { + if (!Visit(schema.items, references, element)) + return false; + } + // prettier-ignore + if (schema.uniqueItems === true && !((function () { const set = new Set(); for (const element of value) { + const hashed = Hash(element); + if (set.has(hashed)) { + return false; + } + else { + set.add(hashed); + } + } return true; })())) { + return false; + } + // contains + if (!(IsDefined(schema.contains) || IsNumber(schema.minContains) || IsNumber(schema.maxContains))) { + return true; // exit + } + const containsSchema = IsDefined(schema.contains) ? schema.contains : Never(); + const containsCount = value.reduce((acc, value) => (Visit(containsSchema, references, value) ? acc + 1 : acc), 0); + if (containsCount === 0) { + return false; + } + if (IsNumber(schema.minContains) && containsCount < schema.minContains) { + return false; + } + if (IsNumber(schema.maxContains) && containsCount > schema.maxContains) { + return false; + } + return true; +} +function FromAsyncIterator(schema, references, value) { + return IsAsyncIterator(value); +} +function FromBigInt(schema, references, value) { + if (!IsBigInt(value)) + return false; + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + return false; + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + return false; + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + return false; + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + return false; + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === BigInt(0))) { + return false; + } + return true; +} +function FromBoolean(schema, references, value) { + return IsBoolean(value); +} +function FromConstructor(schema, references, value) { + return Visit(schema.returns, references, value.prototype); +} +function FromDate(schema, references, value) { + if (!IsDate(value)) + return false; + if (IsDefined(schema.exclusiveMaximumTimestamp) && !(value.getTime() < schema.exclusiveMaximumTimestamp)) { + return false; + } + if (IsDefined(schema.exclusiveMinimumTimestamp) && !(value.getTime() > schema.exclusiveMinimumTimestamp)) { + return false; + } + if (IsDefined(schema.maximumTimestamp) && !(value.getTime() <= schema.maximumTimestamp)) { + return false; + } + if (IsDefined(schema.minimumTimestamp) && !(value.getTime() >= schema.minimumTimestamp)) { + return false; + } + if (IsDefined(schema.multipleOfTimestamp) && !(value.getTime() % schema.multipleOfTimestamp === 0)) { + return false; + } + return true; +} +function FromFunction(schema, references, value) { + return IsFunction(value); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromInteger(schema, references, value) { + if (!IsInteger(value)) { + return false; + } + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + return false; + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + return false; + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + return false; + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + return false; + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + return false; + } + return true; +} +function FromIntersect(schema, references, value) { + const check1 = schema.allOf.every((schema) => Visit(schema, references, value)); + if (schema.unevaluatedProperties === false) { + const keyPattern = new RegExp(KeyOfPattern(schema)); + const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key)); + return check1 && check2; + } + else if (IsSchema(schema.unevaluatedProperties)) { + const keyCheck = new RegExp(KeyOfPattern(schema)); + const check2 = Object.getOwnPropertyNames(value).every((key) => keyCheck.test(key) || Visit(schema.unevaluatedProperties, references, value[key])); + return check1 && check2; + } + else { + return check1; + } +} +function FromIterator(schema, references, value) { + return IsIterator(value); +} +function FromLiteral(schema, references, value) { + return value === schema.const; +} +function FromNever(schema, references, value) { + return false; +} +function FromNot(schema, references, value) { + return !Visit(schema.not, references, value); +} +function FromNull(schema, references, value) { + return IsNull(value); +} +function FromNumber(schema, references, value) { + if (!TypeSystemPolicy.IsNumberLike(value)) + return false; + if (IsDefined(schema.exclusiveMaximum) && !(value < schema.exclusiveMaximum)) { + return false; + } + if (IsDefined(schema.exclusiveMinimum) && !(value > schema.exclusiveMinimum)) { + return false; + } + if (IsDefined(schema.minimum) && !(value >= schema.minimum)) { + return false; + } + if (IsDefined(schema.maximum) && !(value <= schema.maximum)) { + return false; + } + if (IsDefined(schema.multipleOf) && !(value % schema.multipleOf === 0)) { + return false; + } + return true; +} +function FromObject(schema, references, value) { + if (!TypeSystemPolicy.IsObjectLike(value)) + return false; + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + return false; + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + return false; + } + const knownKeys = Object.getOwnPropertyNames(schema.properties); + for (const knownKey of knownKeys) { + const property = schema.properties[knownKey]; + if (schema.required && schema.required.includes(knownKey)) { + if (!Visit(property, references, value[knownKey])) { + return false; + } + if ((ExtendsUndefinedCheck(property) || IsAnyOrUnknown(property)) && !(knownKey in value)) { + return false; + } + } + else { + if (TypeSystemPolicy.IsExactOptionalProperty(value, knownKey) && !Visit(property, references, value[knownKey])) { + return false; + } + } + } + if (schema.additionalProperties === false) { + const valueKeys = Object.getOwnPropertyNames(value); + // optimization: value is valid if schemaKey length matches the valueKey length + if (schema.required && schema.required.length === knownKeys.length && valueKeys.length === knownKeys.length) { + return true; + } + else { + return valueKeys.every((valueKey) => knownKeys.includes(valueKey)); + } + } + else if (typeof schema.additionalProperties === 'object') { + const valueKeys = Object.getOwnPropertyNames(value); + return valueKeys.every((key) => knownKeys.includes(key) || Visit(schema.additionalProperties, references, value[key])); + } + else { + return true; + } +} +function FromPromise(schema, references, value) { + return IsPromise(value); +} +function FromRecord(schema, references, value) { + if (!TypeSystemPolicy.IsRecordLike(value)) { + return false; + } + if (IsDefined(schema.minProperties) && !(Object.getOwnPropertyNames(value).length >= schema.minProperties)) { + return false; + } + if (IsDefined(schema.maxProperties) && !(Object.getOwnPropertyNames(value).length <= schema.maxProperties)) { + return false; + } + const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0]; + const regex = new RegExp(patternKey); + // prettier-ignore + const check1 = Object.entries(value).every(([key, value]) => { + return (regex.test(key)) ? Visit(patternSchema, references, value) : true; + }); + // prettier-ignore + const check2 = typeof schema.additionalProperties === 'object' ? Object.entries(value).every(([key, value]) => { + return (!regex.test(key)) ? Visit(schema.additionalProperties, references, value) : true; + }) : true; + const check3 = schema.additionalProperties === false + ? Object.getOwnPropertyNames(value).every((key) => { + return regex.test(key); + }) + : true; + return check1 && check2 && check3; +} +function FromRef(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromRegExp(schema, references, value) { + const regex = new RegExp(schema.source, schema.flags); + if (IsDefined(schema.minLength)) { + if (!(value.length >= schema.minLength)) + return false; + } + if (IsDefined(schema.maxLength)) { + if (!(value.length <= schema.maxLength)) + return false; + } + return regex.test(value); +} +function FromString(schema, references, value) { + if (!IsString(value)) { + return false; + } + if (IsDefined(schema.minLength)) { + if (!(value.length >= schema.minLength)) + return false; + } + if (IsDefined(schema.maxLength)) { + if (!(value.length <= schema.maxLength)) + return false; + } + if (IsDefined(schema.pattern)) { + const regex = new RegExp(schema.pattern); + if (!regex.test(value)) + return false; + } + if (IsDefined(schema.format)) { + if (!FormatRegistry.Has(schema.format)) + return false; + const func = FormatRegistry.Get(schema.format); + return func(value); + } + return true; +} +function FromSymbol(schema, references, value) { + return IsSymbol(value); +} +function FromTemplateLiteral(schema, references, value) { + return IsString(value) && new RegExp(schema.pattern).test(value); +} +function FromThis(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromTuple(schema, references, value) { + if (!IsArray(value)) { + return false; + } + if (schema.items === undefined && !(value.length === 0)) { + return false; + } + if (!(value.length === schema.maxItems)) { + return false; + } + if (!schema.items) { + return true; + } + for (let i = 0; i < schema.items.length; i++) { + if (!Visit(schema.items[i], references, value[i])) + return false; + } + return true; +} +function FromUndefined(schema, references, value) { + return IsUndefined(value); +} +function FromUnion(schema, references, value) { + return schema.anyOf.some((inner) => Visit(inner, references, value)); +} +function FromUint8Array(schema, references, value) { + if (!IsUint8Array(value)) { + return false; + } + if (IsDefined(schema.maxByteLength) && !(value.length <= schema.maxByteLength)) { + return false; + } + if (IsDefined(schema.minByteLength) && !(value.length >= schema.minByteLength)) { + return false; + } + return true; +} +function FromUnknown(schema, references, value) { + return true; +} +function FromVoid(schema, references, value) { + return TypeSystemPolicy.IsVoidLike(value); +} +function FromKind(schema, references, value) { + if (!TypeRegistry.Has(schema[Kind])) + return false; + const func = TypeRegistry.Get(schema[Kind]); + return func(schema, value); +} +function Visit(schema, references, value) { + const references_ = IsDefined(schema.$id) ? Pushref(schema, references) : references; + const schema_ = schema; + switch (schema_[Kind]) { + case 'Any': + return FromAny(schema_, references_, value); + case 'Argument': + return FromArgument(schema_, references_, value); + case 'Array': + return FromArray(schema_, references_, value); + case 'AsyncIterator': + return FromAsyncIterator(schema_, references_, value); + case 'BigInt': + return FromBigInt(schema_, references_, value); + case 'Boolean': + return FromBoolean(schema_, references_, value); + case 'Constructor': + return FromConstructor(schema_, references_, value); + case 'Date': + return FromDate(schema_, references_, value); + case 'Function': + return FromFunction(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Integer': + return FromInteger(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Iterator': + return FromIterator(schema_, references_, value); + case 'Literal': + return FromLiteral(schema_, references_, value); + case 'Never': + return FromNever(schema_, references_, value); + case 'Not': + return FromNot(schema_, references_, value); + case 'Null': + return FromNull(schema_, references_, value); + case 'Number': + return FromNumber(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Promise': + return FromPromise(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'RegExp': + return FromRegExp(schema_, references_, value); + case 'String': + return FromString(schema_, references_, value); + case 'Symbol': + return FromSymbol(schema_, references_, value); + case 'TemplateLiteral': + return FromTemplateLiteral(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Undefined': + return FromUndefined(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + case 'Uint8Array': + return FromUint8Array(schema_, references_, value); + case 'Unknown': + return FromUnknown(schema_, references_, value); + case 'Void': + return FromVoid(schema_, references_, value); + default: + if (!TypeRegistry.Has(schema_[Kind])) + throw new ValueCheckUnknownTypeError(schema_); + return FromKind(schema_, references_, value); + } +} +/** Returns true if the value matches the given type. */ +export function Check(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/check/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/check/index.d.mts new file mode 100644 index 0000000..108d77f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/check/index.d.mts @@ -0,0 +1 @@ +export * from './check.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/check/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/check/index.mjs new file mode 100644 index 0000000..108d77f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/check/index.mjs @@ -0,0 +1 @@ +export * from './check.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.d.mts new file mode 100644 index 0000000..102382c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.d.mts @@ -0,0 +1,5 @@ +import type { TSchema } from '../../type/schema/index.mjs'; +/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Clean(schema: TSchema, references: TSchema[], value: unknown): unknown; +/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Clean(schema: TSchema, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs new file mode 100644 index 0000000..77fc813 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs @@ -0,0 +1,145 @@ +import { KeyOfPropertyKeys } from '../../type/keyof/index.mjs'; +import { Check } from '../check/index.mjs'; +import { Clone } from '../clone/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +// prettier-ignore +import { HasPropertyKey, IsString, IsObject, IsArray, IsUndefined } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +// prettier-ignore +import { IsKind } from '../../type/guard/kind.mjs'; +// ------------------------------------------------------------------ +// IsCheckable +// ------------------------------------------------------------------ +function IsCheckable(schema) { + return IsKind(schema) && schema[Kind] !== 'Unsafe'; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + if (!IsArray(value)) + return value; + return value.map((value) => Visit(schema.items, references, value)); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromIntersect(schema, references, value) { + const unevaluatedProperties = schema.unevaluatedProperties; + const intersections = schema.allOf.map((schema) => Visit(schema, references, Clone(value))); + const composite = intersections.reduce((acc, value) => (IsObject(value) ? { ...acc, ...value } : value), {}); + if (!IsObject(value) || !IsObject(composite) || !IsKind(unevaluatedProperties)) + return composite; + const knownkeys = KeyOfPropertyKeys(schema); + for (const key of Object.getOwnPropertyNames(value)) { + if (knownkeys.includes(key)) + continue; + if (Check(unevaluatedProperties, references, value[key])) { + composite[key] = Visit(unevaluatedProperties, references, value[key]); + } + } + return composite; +} +function FromObject(schema, references, value) { + if (!IsObject(value) || IsArray(value)) + return value; // Check IsArray for AllowArrayObject configuration + const additionalProperties = schema.additionalProperties; + for (const key of Object.getOwnPropertyNames(value)) { + if (HasPropertyKey(schema.properties, key)) { + value[key] = Visit(schema.properties[key], references, value[key]); + continue; + } + if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) { + value[key] = Visit(additionalProperties, references, value[key]); + continue; + } + delete value[key]; + } + return value; +} +function FromRecord(schema, references, value) { + if (!IsObject(value)) + return value; + const additionalProperties = schema.additionalProperties; + const propertyKeys = Object.getOwnPropertyNames(value); + const [propertyKey, propertySchema] = Object.entries(schema.patternProperties)[0]; + const propertyKeyTest = new RegExp(propertyKey); + for (const key of propertyKeys) { + if (propertyKeyTest.test(key)) { + value[key] = Visit(propertySchema, references, value[key]); + continue; + } + if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) { + value[key] = Visit(additionalProperties, references, value[key]); + continue; + } + delete value[key]; + } + return value; +} +function FromRef(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromThis(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromTuple(schema, references, value) { + if (!IsArray(value)) + return value; + if (IsUndefined(schema.items)) + return []; + const length = Math.min(value.length, schema.items.length); + for (let i = 0; i < length; i++) { + value[i] = Visit(schema.items[i], references, value[i]); + } + // prettier-ignore + return value.length > length + ? value.slice(0, length) + : value; +} +function FromUnion(schema, references, value) { + for (const inner of schema.anyOf) { + if (IsCheckable(inner) && Check(inner, references, value)) { + return Visit(inner, references, value); + } + } + return value; +} +function Visit(schema, references, value) { + const references_ = IsString(schema.$id) ? Pushref(schema, references) : references; + const schema_ = schema; + switch (schema_[Kind]) { + case 'Array': + return FromArray(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + default: + return value; + } +} +/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */ +export function Clean(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.d.mts new file mode 100644 index 0000000..e4dfd7c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.d.mts @@ -0,0 +1 @@ +export * from './clean.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.mjs new file mode 100644 index 0000000..e4dfd7c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clean/index.mjs @@ -0,0 +1 @@ +export * from './clean.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.d.mts new file mode 100644 index 0000000..06a609e --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.d.mts @@ -0,0 +1,2 @@ +/** Returns a clone of the given value */ +export declare function Clone(value: T): T; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.mjs new file mode 100644 index 0000000..b746c59 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/clone.mjs @@ -0,0 +1,56 @@ +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsArray, IsDate, IsMap, IsSet, IsObject, IsTypedArray, IsValueType } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// Clonable +// ------------------------------------------------------------------ +function FromObject(value) { + const Acc = {}; + for (const key of Object.getOwnPropertyNames(value)) { + Acc[key] = Clone(value[key]); + } + for (const key of Object.getOwnPropertySymbols(value)) { + Acc[key] = Clone(value[key]); + } + return Acc; +} +function FromArray(value) { + return value.map((element) => Clone(element)); +} +function FromTypedArray(value) { + return value.slice(); +} +function FromMap(value) { + return new Map(Clone([...value.entries()])); +} +function FromSet(value) { + return new Set(Clone([...value.entries()])); +} +function FromDate(value) { + return new Date(value.toISOString()); +} +function FromValue(value) { + return value; +} +// ------------------------------------------------------------------ +// Clone +// ------------------------------------------------------------------ +/** Returns a clone of the given value */ +export function Clone(value) { + if (IsArray(value)) + return FromArray(value); + if (IsDate(value)) + return FromDate(value); + if (IsTypedArray(value)) + return FromTypedArray(value); + if (IsMap(value)) + return FromMap(value); + if (IsSet(value)) + return FromSet(value); + if (IsObject(value)) + return FromObject(value); + if (IsValueType(value)) + return FromValue(value); + throw new Error('ValueClone: Unable to clone value'); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.d.mts new file mode 100644 index 0000000..dc46ad5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.d.mts @@ -0,0 +1 @@ +export * from './clone.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.mjs new file mode 100644 index 0000000..dc46ad5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/clone/index.mjs @@ -0,0 +1 @@ +export * from './clone.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.d.mts new file mode 100644 index 0000000..5cdb07a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.d.mts @@ -0,0 +1,5 @@ +import type { TSchema } from '../../type/schema/index.mjs'; +/** `[Mutable]` Converts any type mismatched values to their target type if a reasonable conversion is possible. */ +export declare function Convert(schema: TSchema, references: TSchema[], value: unknown): unknown; +/** `[Mutable]` Converts any type mismatched values to their target type if a reasonable conversion is possible. */ +export declare function Convert(schema: TSchema, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.mjs new file mode 100644 index 0000000..d23cce5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/convert.mjs @@ -0,0 +1,260 @@ +import { Clone } from '../clone/index.mjs'; +import { Check } from '../check/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsArray, IsObject, IsDate, IsUndefined, IsString, IsNumber, IsBoolean, IsBigInt, IsSymbol, HasPropertyKey } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// Conversions +// ------------------------------------------------------------------ +function IsStringNumeric(value) { + return IsString(value) && !isNaN(value) && !isNaN(parseFloat(value)); +} +function IsValueToString(value) { + return IsBigInt(value) || IsBoolean(value) || IsNumber(value); +} +function IsValueTrue(value) { + return value === true || (IsNumber(value) && value === 1) || (IsBigInt(value) && value === BigInt('1')) || (IsString(value) && (value.toLowerCase() === 'true' || value === '1')); +} +function IsValueFalse(value) { + return value === false || (IsNumber(value) && (value === 0 || Object.is(value, -0))) || (IsBigInt(value) && value === BigInt('0')) || (IsString(value) && (value.toLowerCase() === 'false' || value === '0' || value === '-0')); +} +function IsTimeStringWithTimeZone(value) { + return IsString(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value); +} +function IsTimeStringWithoutTimeZone(value) { + return IsString(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value); +} +function IsDateTimeStringWithTimeZone(value) { + return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value); +} +function IsDateTimeStringWithoutTimeZone(value) { + return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value); +} +function IsDateString(value) { + return IsString(value) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value); +} +// ------------------------------------------------------------------ +// Convert +// ------------------------------------------------------------------ +function TryConvertLiteralString(value, target) { + const conversion = TryConvertString(value); + return conversion === target ? conversion : value; +} +function TryConvertLiteralNumber(value, target) { + const conversion = TryConvertNumber(value); + return conversion === target ? conversion : value; +} +function TryConvertLiteralBoolean(value, target) { + const conversion = TryConvertBoolean(value); + return conversion === target ? conversion : value; +} +// prettier-ignore +function TryConvertLiteral(schema, value) { + return (IsString(schema.const) ? TryConvertLiteralString(value, schema.const) : + IsNumber(schema.const) ? TryConvertLiteralNumber(value, schema.const) : + IsBoolean(schema.const) ? TryConvertLiteralBoolean(value, schema.const) : + value); +} +function TryConvertBoolean(value) { + return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value; +} +function TryConvertBigInt(value) { + const truncateInteger = (value) => value.split('.')[0]; + return IsStringNumeric(value) ? BigInt(truncateInteger(value)) : IsNumber(value) ? BigInt(Math.trunc(value)) : IsValueFalse(value) ? BigInt(0) : IsValueTrue(value) ? BigInt(1) : value; +} +function TryConvertString(value) { + return IsSymbol(value) && value.description !== undefined ? value.description.toString() : IsValueToString(value) ? value.toString() : value; +} +function TryConvertNumber(value) { + return IsStringNumeric(value) ? parseFloat(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value; +} +function TryConvertInteger(value) { + return IsStringNumeric(value) ? parseInt(value) : IsNumber(value) ? Math.trunc(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value; +} +function TryConvertNull(value) { + return IsString(value) && value.toLowerCase() === 'null' ? null : value; +} +function TryConvertUndefined(value) { + return IsString(value) && value === 'undefined' ? undefined : value; +} +// ------------------------------------------------------------------ +// note: this function may return an invalid dates for the regex +// tests above. Invalid dates will however be checked during the +// casting function and will return a epoch date if invalid. +// Consider better string parsing for the iso dates in future +// revisions. +// ------------------------------------------------------------------ +// prettier-ignore +function TryConvertDate(value) { + return (IsDate(value) ? value : + IsNumber(value) ? new Date(value) : + IsValueTrue(value) ? new Date(1) : + IsValueFalse(value) ? new Date(0) : + IsStringNumeric(value) ? new Date(parseInt(value)) : + IsTimeStringWithoutTimeZone(value) ? new Date(`1970-01-01T${value}.000Z`) : + IsTimeStringWithTimeZone(value) ? new Date(`1970-01-01T${value}`) : + IsDateTimeStringWithoutTimeZone(value) ? new Date(`${value}.000Z`) : + IsDateTimeStringWithTimeZone(value) ? new Date(value) : + IsDateString(value) ? new Date(`${value}T00:00:00.000Z`) : + value); +} +// ------------------------------------------------------------------ +// Default +// ------------------------------------------------------------------ +function Default(value) { + return value; +} +// ------------------------------------------------------------------ +// Convert +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + const elements = IsArray(value) ? value : [value]; + return elements.map((element) => Visit(schema.items, references, element)); +} +function FromBigInt(schema, references, value) { + return TryConvertBigInt(value); +} +function FromBoolean(schema, references, value) { + return TryConvertBoolean(value); +} +function FromDate(schema, references, value) { + return TryConvertDate(value); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromInteger(schema, references, value) { + return TryConvertInteger(value); +} +function FromIntersect(schema, references, value) { + return schema.allOf.reduce((value, schema) => Visit(schema, references, value), value); +} +function FromLiteral(schema, references, value) { + return TryConvertLiteral(schema, value); +} +function FromNull(schema, references, value) { + return TryConvertNull(value); +} +function FromNumber(schema, references, value) { + return TryConvertNumber(value); +} +// prettier-ignore +function FromObject(schema, references, value) { + if (!IsObject(value) || IsArray(value)) + return value; + for (const propertyKey of Object.getOwnPropertyNames(schema.properties)) { + if (!HasPropertyKey(value, propertyKey)) + continue; + value[propertyKey] = Visit(schema.properties[propertyKey], references, value[propertyKey]); + } + return value; +} +function FromRecord(schema, references, value) { + const isConvertable = IsObject(value) && !IsArray(value); + if (!isConvertable) + return value; + const propertyKey = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const property = schema.patternProperties[propertyKey]; + for (const [propKey, propValue] of Object.entries(value)) { + value[propKey] = Visit(property, references, propValue); + } + return value; +} +function FromRef(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromString(schema, references, value) { + return TryConvertString(value); +} +function FromSymbol(schema, references, value) { + return IsString(value) || IsNumber(value) ? Symbol(value) : value; +} +function FromThis(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +// prettier-ignore +function FromTuple(schema, references, value) { + const isConvertable = IsArray(value) && !IsUndefined(schema.items); + if (!isConvertable) + return value; + return value.map((value, index) => { + return (index < schema.items.length) + ? Visit(schema.items[index], references, value) + : value; + }); +} +function FromUndefined(schema, references, value) { + return TryConvertUndefined(value); +} +function FromUnion(schema, references, value) { + // Check if original value already matches one of the union variants + for (const subschema of schema.anyOf) { + if (Check(subschema, references, value)) { + return value; + } + } + // Attempt conversion for each variant + for (const subschema of schema.anyOf) { + const converted = Visit(subschema, references, Clone(value)); + if (!Check(subschema, references, converted)) + continue; + return converted; + } + return value; +} +function Visit(schema, references, value) { + const references_ = Pushref(schema, references); + const schema_ = schema; + switch (schema[Kind]) { + case 'Array': + return FromArray(schema_, references_, value); + case 'BigInt': + return FromBigInt(schema_, references_, value); + case 'Boolean': + return FromBoolean(schema_, references_, value); + case 'Date': + return FromDate(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Integer': + return FromInteger(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Literal': + return FromLiteral(schema_, references_, value); + case 'Null': + return FromNull(schema_, references_, value); + case 'Number': + return FromNumber(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'String': + return FromString(schema_, references_, value); + case 'Symbol': + return FromSymbol(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Undefined': + return FromUndefined(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + default: + return Default(value); + } +} +/** `[Mutable]` Converts any type mismatched values to their target type if a reasonable conversion is possible. */ +// prettier-ignore +export function Convert(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.d.mts new file mode 100644 index 0000000..1af2acf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.d.mts @@ -0,0 +1 @@ +export * from './convert.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.mjs new file mode 100644 index 0000000..1af2acf --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/convert/index.mjs @@ -0,0 +1 @@ +export * from './convert.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/create/create.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/create/create.d.mts new file mode 100644 index 0000000..4824a1f --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/create/create.d.mts @@ -0,0 +1,11 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import type { TSchema } from '../../type/schema/index.mjs'; +import type { Static } from '../../type/static/index.mjs'; +export declare class ValueCreateError extends TypeBoxError { + readonly schema: TSchema; + constructor(schema: TSchema, message: string); +} +/** Creates a value from the given schema and references */ +export declare function Create(schema: T, references: TSchema[]): Static; +/** Creates a value from the given schema */ +export declare function Create(schema: T): Static; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/create/create.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/create/create.mjs new file mode 100644 index 0000000..96f5cf4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/create/create.mjs @@ -0,0 +1,468 @@ +import { HasPropertyKey } from '../guard/index.mjs'; +import { Check } from '../check/index.mjs'; +import { Clone } from '../clone/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +import { TemplateLiteralGenerate, IsTemplateLiteralFinite } from '../../type/template-literal/index.mjs'; +import { TypeRegistry } from '../../type/registry/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +import { IsFunction } from '../guard/guard.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class ValueCreateError extends TypeBoxError { + constructor(schema, message) { + super(message); + this.schema = schema; + } +} +// ------------------------------------------------------------------ +// Default +// ------------------------------------------------------------------ +function FromDefault(value) { + return IsFunction(value) ? value() : Clone(value); +} +// ------------------------------------------------------------------ +// Create +// ------------------------------------------------------------------ +function FromAny(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return {}; + } +} +function FromArgument(schema, references) { + return {}; +} +function FromArray(schema, references) { + if (schema.uniqueItems === true && !HasPropertyKey(schema, 'default')) { + throw new ValueCreateError(schema, 'Array with the uniqueItems constraint requires a default value'); + } + else if ('contains' in schema && !HasPropertyKey(schema, 'default')) { + throw new ValueCreateError(schema, 'Array with the contains constraint requires a default value'); + } + else if ('default' in schema) { + return FromDefault(schema.default); + } + else if (schema.minItems !== undefined) { + return Array.from({ length: schema.minItems }).map((item) => { + return Visit(schema.items, references); + }); + } + else { + return []; + } +} +function FromAsyncIterator(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return (async function* () { })(); + } +} +function FromBigInt(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return BigInt(0); + } +} +function FromBoolean(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return false; + } +} +function FromConstructor(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + const value = Visit(schema.returns, references); + if (typeof value === 'object' && !Array.isArray(value)) { + return class { + constructor() { + for (const [key, val] of Object.entries(value)) { + const self = this; + self[key] = val; + } + } + }; + } + else { + return class { + }; + } + } +} +function FromDate(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minimumTimestamp !== undefined) { + return new Date(schema.minimumTimestamp); + } + else { + return new Date(); + } +} +function FromFunction(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return () => Visit(schema.returns, references); + } +} +function FromImport(schema, references) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions]); +} +function FromInteger(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minimum !== undefined) { + return schema.minimum; + } + else { + return 0; + } +} +function FromIntersect(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + // -------------------------------------------------------------- + // Note: The best we can do here is attempt to instance each + // sub type and apply through object assign. For non-object + // sub types, we just escape the assignment and just return + // the value. In the latter case, this is typically going to + // be a consequence of an illogical intersection. + // -------------------------------------------------------------- + const value = schema.allOf.reduce((acc, schema) => { + const next = Visit(schema, references); + return typeof next === 'object' ? { ...acc, ...next } : next; + }, {}); + if (!Check(schema, references, value)) + throw new ValueCreateError(schema, 'Intersect produced invalid value. Consider using a default value.'); + return value; + } +} +function FromIterator(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return (function* () { })(); + } +} +function FromLiteral(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return schema.const; + } +} +function FromNever(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new ValueCreateError(schema, 'Never types cannot be created. Consider using a default value.'); + } +} +function FromNot(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new ValueCreateError(schema, 'Not types must have a default value'); + } +} +function FromNull(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return null; + } +} +function FromNumber(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minimum !== undefined) { + return schema.minimum; + } + else { + return 0; + } +} +function FromObject(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + const required = new Set(schema.required); + const Acc = {}; + for (const [key, subschema] of Object.entries(schema.properties)) { + if (!required.has(key)) + continue; + Acc[key] = Visit(subschema, references); + } + return Acc; + } +} +function FromPromise(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return Promise.resolve(Visit(schema.item, references)); + } +} +function FromRecord(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return {}; + } +} +function FromRef(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return Visit(Deref(schema, references), references); + } +} +function FromRegExp(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new ValueCreateError(schema, 'RegExp types cannot be created. Consider using a default value.'); + } +} +function FromString(schema, references) { + if (schema.pattern !== undefined) { + if (!HasPropertyKey(schema, 'default')) { + throw new ValueCreateError(schema, 'String types with patterns must specify a default value'); + } + else { + return FromDefault(schema.default); + } + } + else if (schema.format !== undefined) { + if (!HasPropertyKey(schema, 'default')) { + throw new ValueCreateError(schema, 'String types with formats must specify a default value'); + } + else { + return FromDefault(schema.default); + } + } + else { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minLength !== undefined) { + // prettier-ignore + return Array.from({ length: schema.minLength }).map(() => ' ').join(''); + } + else { + return ''; + } + } +} +function FromSymbol(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else if ('value' in schema) { + return Symbol.for(schema.value); + } + else { + return Symbol(); + } +} +function FromTemplateLiteral(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + if (!IsTemplateLiteralFinite(schema)) + throw new ValueCreateError(schema, 'Can only create template literals that produce a finite variants. Consider using a default value.'); + const generated = TemplateLiteralGenerate(schema); + return generated[0]; +} +function FromThis(schema, references) { + if (recursiveDepth++ > recursiveMaxDepth) + throw new ValueCreateError(schema, 'Cannot create recursive type as it appears possibly infinite. Consider using a default.'); + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return Visit(Deref(schema, references), references); + } +} +function FromTuple(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + if (schema.items === undefined) { + return []; + } + else { + return Array.from({ length: schema.minItems }).map((_, index) => Visit(schema.items[index], references)); + } +} +function FromUndefined(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return undefined; + } +} +function FromUnion(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.anyOf.length === 0) { + throw new Error('ValueCreate.Union: Cannot create Union with zero variants'); + } + else { + return Visit(schema.anyOf[0], references); + } +} +function FromUint8Array(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else if (schema.minByteLength !== undefined) { + return new Uint8Array(schema.minByteLength); + } + else { + return new Uint8Array(0); + } +} +function FromUnknown(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return {}; + } +} +function FromVoid(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + return void 0; + } +} +function FromKind(schema, references) { + if (HasPropertyKey(schema, 'default')) { + return FromDefault(schema.default); + } + else { + throw new Error('User defined types must specify a default value'); + } +} +function Visit(schema, references) { + const references_ = Pushref(schema, references); + const schema_ = schema; + switch (schema_[Kind]) { + case 'Any': + return FromAny(schema_, references_); + case 'Argument': + return FromArgument(schema_, references_); + case 'Array': + return FromArray(schema_, references_); + case 'AsyncIterator': + return FromAsyncIterator(schema_, references_); + case 'BigInt': + return FromBigInt(schema_, references_); + case 'Boolean': + return FromBoolean(schema_, references_); + case 'Constructor': + return FromConstructor(schema_, references_); + case 'Date': + return FromDate(schema_, references_); + case 'Function': + return FromFunction(schema_, references_); + case 'Import': + return FromImport(schema_, references_); + case 'Integer': + return FromInteger(schema_, references_); + case 'Intersect': + return FromIntersect(schema_, references_); + case 'Iterator': + return FromIterator(schema_, references_); + case 'Literal': + return FromLiteral(schema_, references_); + case 'Never': + return FromNever(schema_, references_); + case 'Not': + return FromNot(schema_, references_); + case 'Null': + return FromNull(schema_, references_); + case 'Number': + return FromNumber(schema_, references_); + case 'Object': + return FromObject(schema_, references_); + case 'Promise': + return FromPromise(schema_, references_); + case 'Record': + return FromRecord(schema_, references_); + case 'Ref': + return FromRef(schema_, references_); + case 'RegExp': + return FromRegExp(schema_, references_); + case 'String': + return FromString(schema_, references_); + case 'Symbol': + return FromSymbol(schema_, references_); + case 'TemplateLiteral': + return FromTemplateLiteral(schema_, references_); + case 'This': + return FromThis(schema_, references_); + case 'Tuple': + return FromTuple(schema_, references_); + case 'Undefined': + return FromUndefined(schema_, references_); + case 'Union': + return FromUnion(schema_, references_); + case 'Uint8Array': + return FromUint8Array(schema_, references_); + case 'Unknown': + return FromUnknown(schema_, references_); + case 'Void': + return FromVoid(schema_, references_); + default: + if (!TypeRegistry.Has(schema_[Kind])) + throw new ValueCreateError(schema_, 'Unknown type'); + return FromKind(schema_, references_); + } +} +// ------------------------------------------------------------------ +// State +// ------------------------------------------------------------------ +const recursiveMaxDepth = 512; +let recursiveDepth = 0; +/** Creates a value from the given schema */ +export function Create(...args) { + recursiveDepth = 0; + return args.length === 2 ? Visit(args[0], args[1]) : Visit(args[0], []); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/create/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/create/index.d.mts new file mode 100644 index 0000000..99805a0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/create/index.d.mts @@ -0,0 +1 @@ +export * from './create.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/create/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/create/index.mjs new file mode 100644 index 0000000..99805a0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/create/index.mjs @@ -0,0 +1 @@ +export * from './create.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.d.mts new file mode 100644 index 0000000..a7bd6a5 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.d.mts @@ -0,0 +1,6 @@ +import type { TSchema } from '../../type/schema/index.mjs'; +import type { StaticDecode } from '../../type/static/index.mjs'; +/** Decodes a value or throws if error */ +export declare function Decode, Result extends Static = Static>(schema: T, references: TSchema[], value: unknown): Result; +/** Decodes a value or throws if error */ +export declare function Decode, Result extends Static = Static>(schema: T, value: unknown): Result; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.mjs new file mode 100644 index 0000000..ee55a98 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/decode.mjs @@ -0,0 +1,10 @@ +import { HasTransform, TransformDecode, TransformDecodeCheckError } from '../transform/index.mjs'; +import { Check } from '../check/index.mjs'; +import { Errors } from '../../errors/index.mjs'; +/** Decodes a value or throws if error */ +export function Decode(...args) { + const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]]; + if (!Check(schema, references, value)) + throw new TransformDecodeCheckError(schema, value, Errors(schema, references, value).First()); + return HasTransform(schema, references) ? TransformDecode(schema, references, value) : value; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.d.mts new file mode 100644 index 0000000..3d9cf5d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.d.mts @@ -0,0 +1 @@ +export * from './decode.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.mjs new file mode 100644 index 0000000..3d9cf5d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/decode/index.mjs @@ -0,0 +1 @@ +export * from './decode.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/default/default.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/default/default.d.mts new file mode 100644 index 0000000..b33f8ec --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/default/default.d.mts @@ -0,0 +1,5 @@ +import type { TSchema } from '../../type/schema/index.mjs'; +/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Default(schema: TSchema, references: TSchema[], value: unknown): unknown; +/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ +export declare function Default(schema: TSchema, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/default/default.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/default/default.mjs new file mode 100644 index 0000000..52638d8 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/default/default.mjs @@ -0,0 +1,172 @@ +import { Check } from '../check/index.mjs'; +import { Clone } from '../clone/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsArray, IsDate, IsFunction, IsObject, IsUndefined, HasPropertyKey } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// TypeGuard +// ------------------------------------------------------------------ +import { IsKind } from '../../type/guard/kind.mjs'; +// ------------------------------------------------------------------ +// ValueOrDefault +// ------------------------------------------------------------------ +function ValueOrDefault(schema, value) { + const defaultValue = HasPropertyKey(schema, 'default') ? schema.default : undefined; + const clone = IsFunction(defaultValue) ? defaultValue() : Clone(defaultValue); + return IsUndefined(value) ? clone : IsObject(value) && IsObject(clone) ? Object.assign(clone, value) : value; +} +// ------------------------------------------------------------------ +// HasDefaultProperty +// ------------------------------------------------------------------ +function HasDefaultProperty(schema) { + return IsKind(schema) && 'default' in schema; +} +// ------------------------------------------------------------------ +// Types +// ------------------------------------------------------------------ +function FromArray(schema, references, value) { + // if the value is an array, we attempt to initialize it's elements + if (IsArray(value)) { + for (let i = 0; i < value.length; i++) { + value[i] = Visit(schema.items, references, value[i]); + } + return value; + } + // ... otherwise use default initialization + const defaulted = ValueOrDefault(schema, value); + if (!IsArray(defaulted)) + return defaulted; + for (let i = 0; i < defaulted.length; i++) { + defaulted[i] = Visit(schema.items, references, defaulted[i]); + } + return defaulted; +} +function FromDate(schema, references, value) { + // special case intercept for dates + return IsDate(value) ? value : ValueOrDefault(schema, value); +} +function FromImport(schema, references, value) { + const definitions = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + return Visit(target, [...references, ...definitions], value); +} +function FromIntersect(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + return schema.allOf.reduce((acc, schema) => { + const next = Visit(schema, references, defaulted); + return IsObject(next) ? { ...acc, ...next } : next; + }, {}); +} +function FromObject(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + // return defaulted + if (!IsObject(defaulted)) + return defaulted; + const knownPropertyKeys = Object.getOwnPropertyNames(schema.properties); + // properties + for (const key of knownPropertyKeys) { + // note: we need to traverse into the object and test if the return value + // yielded a non undefined result. Here we interpret an undefined result as + // a non assignable property and continue. + const propertyValue = Visit(schema.properties[key], references, defaulted[key]); + if (IsUndefined(propertyValue)) + continue; + defaulted[key] = Visit(schema.properties[key], references, defaulted[key]); + } + // return if not additional properties + if (!HasDefaultProperty(schema.additionalProperties)) + return defaulted; + // additional properties + for (const key of Object.getOwnPropertyNames(defaulted)) { + if (knownPropertyKeys.includes(key)) + continue; + defaulted[key] = Visit(schema.additionalProperties, references, defaulted[key]); + } + return defaulted; +} +function FromRecord(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + if (!IsObject(defaulted)) + return defaulted; + const additionalPropertiesSchema = schema.additionalProperties; + const [propertyKeyPattern, propertySchema] = Object.entries(schema.patternProperties)[0]; + const knownPropertyKey = new RegExp(propertyKeyPattern); + // properties + for (const key of Object.getOwnPropertyNames(defaulted)) { + if (!(knownPropertyKey.test(key) && HasDefaultProperty(propertySchema))) + continue; + defaulted[key] = Visit(propertySchema, references, defaulted[key]); + } + // return if not additional properties + if (!HasDefaultProperty(additionalPropertiesSchema)) + return defaulted; + // additional properties + for (const key of Object.getOwnPropertyNames(defaulted)) { + if (knownPropertyKey.test(key)) + continue; + defaulted[key] = Visit(additionalPropertiesSchema, references, defaulted[key]); + } + return defaulted; +} +function FromRef(schema, references, value) { + return Visit(Deref(schema, references), references, ValueOrDefault(schema, value)); +} +function FromThis(schema, references, value) { + return Visit(Deref(schema, references), references, value); +} +function FromTuple(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + if (!IsArray(defaulted) || IsUndefined(schema.items)) + return defaulted; + const [items, max] = [schema.items, Math.max(schema.items.length, defaulted.length)]; + for (let i = 0; i < max; i++) { + if (i < items.length) + defaulted[i] = Visit(items[i], references, defaulted[i]); + } + return defaulted; +} +function FromUnion(schema, references, value) { + const defaulted = ValueOrDefault(schema, value); + for (const inner of schema.anyOf) { + const result = Visit(inner, references, Clone(defaulted)); + if (Check(inner, references, result)) { + return result; + } + } + return defaulted; +} +function Visit(schema, references, value) { + const references_ = Pushref(schema, references); + const schema_ = schema; + switch (schema_[Kind]) { + case 'Array': + return FromArray(schema_, references_, value); + case 'Date': + return FromDate(schema_, references_, value); + case 'Import': + return FromImport(schema_, references_, value); + case 'Intersect': + return FromIntersect(schema_, references_, value); + case 'Object': + return FromObject(schema_, references_, value); + case 'Record': + return FromRecord(schema_, references_, value); + case 'Ref': + return FromRef(schema_, references_, value); + case 'This': + return FromThis(schema_, references_, value); + case 'Tuple': + return FromTuple(schema_, references_, value); + case 'Union': + return FromUnion(schema_, references_, value); + default: + return ValueOrDefault(schema_, value); + } +} +/** `[Mutable]` Generates missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. */ +export function Default(...args) { + return args.length === 3 ? Visit(args[0], args[1], args[2]) : Visit(args[0], [], args[1]); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/default/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/default/index.d.mts new file mode 100644 index 0000000..ffe4f1c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/default/index.d.mts @@ -0,0 +1 @@ +export * from './default.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/default/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/default/index.mjs new file mode 100644 index 0000000..ffe4f1c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/default/index.mjs @@ -0,0 +1 @@ +export * from './default.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.d.mts new file mode 100644 index 0000000..caed1d3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.d.mts @@ -0,0 +1,32 @@ +import type { Static } from '../../type/static/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +import { type TLiteral } from '../../type/literal/index.mjs'; +import { type TObject } from '../../type/object/index.mjs'; +import { type TString } from '../../type/string/index.mjs'; +import { type TUnknown } from '../../type/unknown/index.mjs'; +import { type TUnion } from '../../type/union/index.mjs'; +export type Insert = Static; +export declare const Insert: TObject<{ + type: TLiteral<'insert'>; + path: TString; + value: TUnknown; +}>; +export type Update = Static; +export declare const Update: TObject<{ + type: TLiteral<'update'>; + path: TString; + value: TUnknown; +}>; +export type Delete = Static; +export declare const Delete: TObject<{ + type: TLiteral<'delete'>; + path: TString; +}>; +export type Edit = Static; +export declare const Edit: TUnion<[typeof Insert, typeof Update, typeof Delete]>; +export declare class ValueDiffError extends TypeBoxError { + readonly value: unknown; + constructor(value: unknown, message: string); +} +export declare function Diff(current: unknown, next: unknown): Edit[]; +export declare function Patch(current: unknown, edits: Edit[]): T; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs new file mode 100644 index 0000000..024b6e3 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs @@ -0,0 +1,171 @@ +import { HasPropertyKey, IsStandardObject, IsArray, IsTypedArray, IsValueType } from '../guard/index.mjs'; +import { ValuePointer } from '../pointer/index.mjs'; +import { Clone } from '../clone/index.mjs'; +import { Equal } from '../equal/equal.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +import { Literal } from '../../type/literal/index.mjs'; +import { Object } from '../../type/object/index.mjs'; +import { String } from '../../type/string/index.mjs'; +import { Unknown } from '../../type/unknown/index.mjs'; +import { Union } from '../../type/union/index.mjs'; +export const Insert = Object({ + type: Literal('insert'), + path: String(), + value: Unknown(), +}); +export const Update = Object({ + type: Literal('update'), + path: String(), + value: Unknown(), +}); +export const Delete = Object({ + type: Literal('delete'), + path: String(), +}); +export const Edit = Union([Insert, Update, Delete]); +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class ValueDiffError extends TypeBoxError { + constructor(value, message) { + super(message); + this.value = value; + } +} +// ------------------------------------------------------------------ +// Command Factory +// ------------------------------------------------------------------ +function CreateUpdate(path, value) { + return { type: 'update', path, value }; +} +function CreateInsert(path, value) { + return { type: 'insert', path, value }; +} +function CreateDelete(path) { + return { type: 'delete', path }; +} +// ------------------------------------------------------------------ +// AssertDiffable +// ------------------------------------------------------------------ +function AssertDiffable(value) { + if (globalThis.Object.getOwnPropertySymbols(value).length > 0) + throw new ValueDiffError(value, 'Cannot diff objects with symbols'); +} +// ------------------------------------------------------------------ +// Diffing Generators +// ------------------------------------------------------------------ +function* ObjectType(path, current, next) { + AssertDiffable(current); + AssertDiffable(next); + if (!IsStandardObject(next)) + return yield CreateUpdate(path, next); + const currentKeys = globalThis.Object.getOwnPropertyNames(current); + const nextKeys = globalThis.Object.getOwnPropertyNames(next); + // ---------------------------------------------------------------- + // inserts + // ---------------------------------------------------------------- + for (const key of nextKeys) { + if (HasPropertyKey(current, key)) + continue; + yield CreateInsert(`${path}/${key}`, next[key]); + } + // ---------------------------------------------------------------- + // updates + // ---------------------------------------------------------------- + for (const key of currentKeys) { + if (!HasPropertyKey(next, key)) + continue; + if (Equal(current, next)) + continue; + yield* Visit(`${path}/${key}`, current[key], next[key]); + } + // ---------------------------------------------------------------- + // deletes + // ---------------------------------------------------------------- + for (const key of currentKeys) { + if (HasPropertyKey(next, key)) + continue; + yield CreateDelete(`${path}/${key}`); + } +} +function* ArrayType(path, current, next) { + if (!IsArray(next)) + return yield CreateUpdate(path, next); + for (let i = 0; i < Math.min(current.length, next.length); i++) { + yield* Visit(`${path}/${i}`, current[i], next[i]); + } + for (let i = 0; i < next.length; i++) { + if (i < current.length) + continue; + yield CreateInsert(`${path}/${i}`, next[i]); + } + for (let i = current.length - 1; i >= 0; i--) { + if (i < next.length) + continue; + yield CreateDelete(`${path}/${i}`); + } +} +function* TypedArrayType(path, current, next) { + if (!IsTypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name) + return yield CreateUpdate(path, next); + for (let i = 0; i < Math.min(current.length, next.length); i++) { + yield* Visit(`${path}/${i}`, current[i], next[i]); + } +} +function* ValueType(path, current, next) { + if (current === next) + return; + yield CreateUpdate(path, next); +} +function* Visit(path, current, next) { + if (IsStandardObject(current)) + return yield* ObjectType(path, current, next); + if (IsArray(current)) + return yield* ArrayType(path, current, next); + if (IsTypedArray(current)) + return yield* TypedArrayType(path, current, next); + if (IsValueType(current)) + return yield* ValueType(path, current, next); + throw new ValueDiffError(current, 'Unable to diff value'); +} +// ------------------------------------------------------------------ +// Diff +// ------------------------------------------------------------------ +export function Diff(current, next) { + return [...Visit('', current, next)]; +} +// ------------------------------------------------------------------ +// Patch +// ------------------------------------------------------------------ +function IsRootUpdate(edits) { + return edits.length > 0 && edits[0].path === '' && edits[0].type === 'update'; +} +function IsIdentity(edits) { + return edits.length === 0; +} +export function Patch(current, edits) { + if (IsRootUpdate(edits)) { + return Clone(edits[0].value); + } + if (IsIdentity(edits)) { + return Clone(current); + } + const clone = Clone(current); + for (const edit of edits) { + switch (edit.type) { + case 'insert': { + ValuePointer.Set(clone, edit.path, edit.value); + break; + } + case 'update': { + ValuePointer.Set(clone, edit.path, edit.value); + break; + } + case 'delete': { + ValuePointer.Delete(clone, edit.path); + break; + } + } + } + return clone; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.d.mts new file mode 100644 index 0000000..bad11ed --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.d.mts @@ -0,0 +1 @@ +export * from './delta.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.mjs new file mode 100644 index 0000000..bad11ed --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/delta/index.mjs @@ -0,0 +1 @@ +export * from './delta.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.d.mts new file mode 100644 index 0000000..7b54e05 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.d.mts @@ -0,0 +1,12 @@ +import type { TSchema } from '../../type/schema/index.mjs'; +import type { TRef } from '../../type/ref/index.mjs'; +import type { TThis } from '../../type/recursive/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +export declare class TypeDereferenceError extends TypeBoxError { + readonly schema: TRef | TThis; + constructor(schema: TRef | TThis); +} +/** `[Internal]` Pushes a schema onto references if the schema has an $id and does not exist on references */ +export declare function Pushref(schema: TSchema, references: TSchema[]): TSchema[]; +/** `[Internal]` Dereferences a schema from the references array or throws if not found */ +export declare function Deref(schema: TSchema, references: TSchema[]): TSchema; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.mjs new file mode 100644 index 0000000..5de7851 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/deref.mjs @@ -0,0 +1,29 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +import { IsString } from '../guard/guard.mjs'; +export class TypeDereferenceError extends TypeBoxError { + constructor(schema) { + super(`Unable to dereference schema with $id '${schema.$ref}'`); + this.schema = schema; + } +} +function Resolve(schema, references) { + const target = references.find((target) => target.$id === schema.$ref); + if (target === undefined) + throw new TypeDereferenceError(schema); + return Deref(target, references); +} +/** `[Internal]` Pushes a schema onto references if the schema has an $id and does not exist on references */ +export function Pushref(schema, references) { + if (!IsString(schema.$id) || references.some((target) => target.$id === schema.$id)) + return references; + references.push(schema); + return references; +} +/** `[Internal]` Dereferences a schema from the references array or throws if not found */ +export function Deref(schema, references) { + // prettier-ignore + return (schema[Kind] === 'This' || schema[Kind] === 'Ref') + ? Resolve(schema, references) + : schema; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.d.mts new file mode 100644 index 0000000..91ea9f6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.d.mts @@ -0,0 +1 @@ +export * from './deref.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.mjs new file mode 100644 index 0000000..91ea9f6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/deref/index.mjs @@ -0,0 +1 @@ +export * from './deref.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.d.mts new file mode 100644 index 0000000..8a87923 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.d.mts @@ -0,0 +1,6 @@ +import type { TSchema } from '../../type/schema/index.mjs'; +import type { StaticEncode } from '../../type/static/index.mjs'; +/** Encodes a value or throws if error */ +export declare function Encode, Result extends Static = Static>(schema: T, references: TSchema[], value: unknown): Result; +/** Encodes a value or throws if error */ +export declare function Encode, Result extends Static = Static>(schema: T, value: unknown): Result; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.mjs new file mode 100644 index 0000000..a16198a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/encode.mjs @@ -0,0 +1,11 @@ +import { HasTransform, TransformEncode, TransformEncodeCheckError } from '../transform/index.mjs'; +import { Check } from '../check/index.mjs'; +import { Errors } from '../../errors/index.mjs'; +/** Encodes a value or throws if error */ +export function Encode(...args) { + const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]]; + const encoded = HasTransform(schema, references) ? TransformEncode(schema, references, value) : value; + if (!Check(schema, references, encoded)) + throw new TransformEncodeCheckError(schema, encoded, Errors(schema, references, encoded).First()); + return encoded; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.d.mts new file mode 100644 index 0000000..6a2975a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.d.mts @@ -0,0 +1 @@ +export * from './encode.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.mjs new file mode 100644 index 0000000..6a2975a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/encode/index.mjs @@ -0,0 +1 @@ +export * from './encode.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.d.mts new file mode 100644 index 0000000..d1095c4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.d.mts @@ -0,0 +1,2 @@ +/** Returns true if the left value deep-equals the right */ +export declare function Equal(left: T, right: unknown): right is T; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.mjs new file mode 100644 index 0000000..cfcb8ab --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/equal.mjs @@ -0,0 +1,46 @@ +import { IsObject, IsDate, IsArray, IsTypedArray, IsValueType } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// Equality Checks +// ------------------------------------------------------------------ +function ObjectType(left, right) { + if (!IsObject(right)) + return false; + const leftKeys = [...Object.keys(left), ...Object.getOwnPropertySymbols(left)]; + const rightKeys = [...Object.keys(right), ...Object.getOwnPropertySymbols(right)]; + if (leftKeys.length !== rightKeys.length) + return false; + return leftKeys.every((key) => Equal(left[key], right[key])); +} +function DateType(left, right) { + return IsDate(right) && left.getTime() === right.getTime(); +} +function ArrayType(left, right) { + if (!IsArray(right) || left.length !== right.length) + return false; + return left.every((value, index) => Equal(value, right[index])); +} +function TypedArrayType(left, right) { + if (!IsTypedArray(right) || left.length !== right.length || Object.getPrototypeOf(left).constructor.name !== Object.getPrototypeOf(right).constructor.name) + return false; + return left.every((value, index) => Equal(value, right[index])); +} +function ValueType(left, right) { + return left === right; +} +// ------------------------------------------------------------------ +// Equal +// ------------------------------------------------------------------ +/** Returns true if the left value deep-equals the right */ +export function Equal(left, right) { + if (IsDate(left)) + return DateType(left, right); + if (IsTypedArray(left)) + return TypedArrayType(left, right); + if (IsArray(left)) + return ArrayType(left, right); + if (IsObject(left)) + return ObjectType(left, right); + if (IsValueType(left)) + return ValueType(left, right); + throw new Error('ValueEquals: Unable to compare value'); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.d.mts new file mode 100644 index 0000000..a3cb0ee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.d.mts @@ -0,0 +1 @@ +export * from './equal.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.mjs new file mode 100644 index 0000000..a3cb0ee --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/equal/index.mjs @@ -0,0 +1 @@ +export * from './equal.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.d.mts new file mode 100644 index 0000000..0a5f115 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.d.mts @@ -0,0 +1,74 @@ +export type ObjectType = Record; +export type ArrayType = unknown[]; +export type ValueType = null | undefined | symbol | bigint | number | boolean | string; +export type TypedArrayType = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; +/** Returns true if this value is an async iterator */ +export declare function IsAsyncIterator(value: unknown): value is AsyncIterableIterator; +/** Returns true if this value is an iterator */ +export declare function IsIterator(value: unknown): value is IterableIterator; +/** Returns true if this value is not an instance of a class */ +export declare function IsStandardObject(value: unknown): value is ObjectType; +/** Returns true if this value is an instance of a class */ +export declare function IsInstanceObject(value: unknown): value is ObjectType; +/** Returns true if this value is a Promise */ +export declare function IsPromise(value: unknown): value is Promise; +/** Returns true if this value is a Date */ +export declare function IsDate(value: unknown): value is Date; +/** Returns true if this value is an instance of Map */ +export declare function IsMap(value: unknown): value is Map; +/** Returns true if this value is an instance of Set */ +export declare function IsSet(value: unknown): value is Set; +/** Returns true if this value is RegExp */ +export declare function IsRegExp(value: unknown): value is RegExp; +/** Returns true if this value is a typed array */ +export declare function IsTypedArray(value: unknown): value is TypedArrayType; +/** Returns true if the value is a Int8Array */ +export declare function IsInt8Array(value: unknown): value is Int8Array; +/** Returns true if the value is a Uint8Array */ +export declare function IsUint8Array(value: unknown): value is Uint8Array; +/** Returns true if the value is a Uint8ClampedArray */ +export declare function IsUint8ClampedArray(value: unknown): value is Uint8ClampedArray; +/** Returns true if the value is a Int16Array */ +export declare function IsInt16Array(value: unknown): value is Int16Array; +/** Returns true if the value is a Uint16Array */ +export declare function IsUint16Array(value: unknown): value is Uint16Array; +/** Returns true if the value is a Int32Array */ +export declare function IsInt32Array(value: unknown): value is Int32Array; +/** Returns true if the value is a Uint32Array */ +export declare function IsUint32Array(value: unknown): value is Uint32Array; +/** Returns true if the value is a Float32Array */ +export declare function IsFloat32Array(value: unknown): value is Float32Array; +/** Returns true if the value is a Float64Array */ +export declare function IsFloat64Array(value: unknown): value is Float64Array; +/** Returns true if the value is a BigInt64Array */ +export declare function IsBigInt64Array(value: unknown): value is BigInt64Array; +/** Returns true if the value is a BigUint64Array */ +export declare function IsBigUint64Array(value: unknown): value is BigUint64Array; +/** Returns true if this value has this property key */ +export declare function HasPropertyKey(value: Record, key: K): value is Record & { + [_ in K]: unknown; +}; +/** Returns true of this value is an object type */ +export declare function IsObject(value: unknown): value is ObjectType; +/** Returns true if this value is an array, but not a typed array */ +export declare function IsArray(value: unknown): value is ArrayType; +/** Returns true if this value is an undefined */ +export declare function IsUndefined(value: unknown): value is undefined; +/** Returns true if this value is an null */ +export declare function IsNull(value: unknown): value is null; +/** Returns true if this value is an boolean */ +export declare function IsBoolean(value: unknown): value is boolean; +/** Returns true if this value is an number */ +export declare function IsNumber(value: unknown): value is number; +/** Returns true if this value is an integer */ +export declare function IsInteger(value: unknown): value is number; +/** Returns true if this value is bigint */ +export declare function IsBigInt(value: unknown): value is bigint; +/** Returns true if this value is string */ +export declare function IsString(value: unknown): value is string; +/** Returns true if this value is a function */ +export declare function IsFunction(value: unknown): value is Function; +/** Returns true if this value is a symbol */ +export declare function IsSymbol(value: unknown): value is symbol; +/** Returns true if this value is a value type such as number, string, boolean */ +export declare function IsValueType(value: unknown): value is ValueType; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs new file mode 100644 index 0000000..7364cf7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs @@ -0,0 +1,158 @@ +// -------------------------------------------------------------------------- +// Iterators +// -------------------------------------------------------------------------- +/** Returns true if this value is an async iterator */ +export function IsAsyncIterator(value) { + return IsObject(value) && globalThis.Symbol.asyncIterator in value; +} +/** Returns true if this value is an iterator */ +export function IsIterator(value) { + return IsObject(value) && globalThis.Symbol.iterator in value; +} +// -------------------------------------------------------------------------- +// Object Instances +// -------------------------------------------------------------------------- +/** Returns true if this value is not an instance of a class */ +export function IsStandardObject(value) { + return IsObject(value) && (globalThis.Object.getPrototypeOf(value) === Object.prototype || globalThis.Object.getPrototypeOf(value) === null); +} +/** Returns true if this value is an instance of a class */ +export function IsInstanceObject(value) { + return IsObject(value) && !IsArray(value) && IsFunction(value.constructor) && value.constructor.name !== 'Object'; +} +// -------------------------------------------------------------------------- +// JavaScript +// -------------------------------------------------------------------------- +/** Returns true if this value is a Promise */ +export function IsPromise(value) { + return value instanceof globalThis.Promise; +} +/** Returns true if this value is a Date */ +export function IsDate(value) { + return value instanceof Date && globalThis.Number.isFinite(value.getTime()); +} +/** Returns true if this value is an instance of Map */ +export function IsMap(value) { + return value instanceof globalThis.Map; +} +/** Returns true if this value is an instance of Set */ +export function IsSet(value) { + return value instanceof globalThis.Set; +} +/** Returns true if this value is RegExp */ +export function IsRegExp(value) { + return value instanceof globalThis.RegExp; +} +/** Returns true if this value is a typed array */ +export function IsTypedArray(value) { + return globalThis.ArrayBuffer.isView(value); +} +/** Returns true if the value is a Int8Array */ +export function IsInt8Array(value) { + return value instanceof globalThis.Int8Array; +} +/** Returns true if the value is a Uint8Array */ +export function IsUint8Array(value) { + return value instanceof globalThis.Uint8Array; +} +/** Returns true if the value is a Uint8ClampedArray */ +export function IsUint8ClampedArray(value) { + return value instanceof globalThis.Uint8ClampedArray; +} +/** Returns true if the value is a Int16Array */ +export function IsInt16Array(value) { + return value instanceof globalThis.Int16Array; +} +/** Returns true if the value is a Uint16Array */ +export function IsUint16Array(value) { + return value instanceof globalThis.Uint16Array; +} +/** Returns true if the value is a Int32Array */ +export function IsInt32Array(value) { + return value instanceof globalThis.Int32Array; +} +/** Returns true if the value is a Uint32Array */ +export function IsUint32Array(value) { + return value instanceof globalThis.Uint32Array; +} +/** Returns true if the value is a Float32Array */ +export function IsFloat32Array(value) { + return value instanceof globalThis.Float32Array; +} +/** Returns true if the value is a Float64Array */ +export function IsFloat64Array(value) { + return value instanceof globalThis.Float64Array; +} +/** Returns true if the value is a BigInt64Array */ +export function IsBigInt64Array(value) { + return value instanceof globalThis.BigInt64Array; +} +/** Returns true if the value is a BigUint64Array */ +export function IsBigUint64Array(value) { + return value instanceof globalThis.BigUint64Array; +} +// -------------------------------------------------------------------------- +// PropertyKey +// -------------------------------------------------------------------------- +/** Returns true if this value has this property key */ +export function HasPropertyKey(value, key) { + return key in value; +} +// -------------------------------------------------------------------------- +// Standard +// -------------------------------------------------------------------------- +/** Returns true of this value is an object type */ +export function IsObject(value) { + return value !== null && typeof value === 'object'; +} +/** Returns true if this value is an array, but not a typed array */ +export function IsArray(value) { + return globalThis.Array.isArray(value) && !globalThis.ArrayBuffer.isView(value); +} +/** Returns true if this value is an undefined */ +export function IsUndefined(value) { + return value === undefined; +} +/** Returns true if this value is an null */ +export function IsNull(value) { + return value === null; +} +/** Returns true if this value is an boolean */ +export function IsBoolean(value) { + return typeof value === 'boolean'; +} +/** Returns true if this value is an number */ +export function IsNumber(value) { + return typeof value === 'number'; +} +/** Returns true if this value is an integer */ +export function IsInteger(value) { + return globalThis.Number.isInteger(value); +} +/** Returns true if this value is bigint */ +export function IsBigInt(value) { + return typeof value === 'bigint'; +} +/** Returns true if this value is string */ +export function IsString(value) { + return typeof value === 'string'; +} +/** Returns true if this value is a function */ +export function IsFunction(value) { + return typeof value === 'function'; +} +/** Returns true if this value is a symbol */ +export function IsSymbol(value) { + return typeof value === 'symbol'; +} +/** Returns true if this value is a value type such as number, string, boolean */ +export function IsValueType(value) { + // prettier-ignore + return (IsBigInt(value) || + IsBoolean(value) || + IsNull(value) || + IsNumber(value) || + IsString(value) || + IsSymbol(value) || + IsUndefined(value)); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.d.mts new file mode 100644 index 0000000..c17e7ce --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.d.mts @@ -0,0 +1 @@ +export * from './guard.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.mjs new file mode 100644 index 0000000..c17e7ce --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/guard/index.mjs @@ -0,0 +1 @@ +export * from './guard.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.d.mts new file mode 100644 index 0000000..9609e22 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.d.mts @@ -0,0 +1,7 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +export declare class ValueHashError extends TypeBoxError { + readonly value: unknown; + constructor(value: unknown); +} +/** Creates a FNV1A-64 non cryptographic hash of the given value */ +export declare function Hash(value: unknown): bigint; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs new file mode 100644 index 0000000..7cc9c49 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs @@ -0,0 +1,146 @@ +import { IsArray, IsBoolean, IsBigInt, IsDate, IsNull, IsNumber, IsObject, IsString, IsSymbol, IsUint8Array, IsUndefined } from '../guard/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class ValueHashError extends TypeBoxError { + constructor(value) { + super(`Unable to hash value`); + this.value = value; + } +} +// ------------------------------------------------------------------ +// ByteMarker +// ------------------------------------------------------------------ +var ByteMarker; +(function (ByteMarker) { + ByteMarker[ByteMarker["Undefined"] = 0] = "Undefined"; + ByteMarker[ByteMarker["Null"] = 1] = "Null"; + ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean"; + ByteMarker[ByteMarker["Number"] = 3] = "Number"; + ByteMarker[ByteMarker["String"] = 4] = "String"; + ByteMarker[ByteMarker["Object"] = 5] = "Object"; + ByteMarker[ByteMarker["Array"] = 6] = "Array"; + ByteMarker[ByteMarker["Date"] = 7] = "Date"; + ByteMarker[ByteMarker["Uint8Array"] = 8] = "Uint8Array"; + ByteMarker[ByteMarker["Symbol"] = 9] = "Symbol"; + ByteMarker[ByteMarker["BigInt"] = 10] = "BigInt"; +})(ByteMarker || (ByteMarker = {})); +// ------------------------------------------------------------------ +// State +// ------------------------------------------------------------------ +let Accumulator = BigInt('14695981039346656037'); +const [Prime, Size] = [BigInt('1099511628211'), BigInt('18446744073709551616' /* 2 ^ 64 */)]; +const Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i)); +const F64 = new Float64Array(1); +const F64In = new DataView(F64.buffer); +const F64Out = new Uint8Array(F64.buffer); +// ------------------------------------------------------------------ +// NumberToBytes +// ------------------------------------------------------------------ +function* NumberToBytes(value) { + const byteCount = value === 0 ? 1 : Math.ceil(Math.floor(Math.log2(value) + 1) / 8); + for (let i = 0; i < byteCount; i++) { + yield (value >> (8 * (byteCount - 1 - i))) & 0xff; + } +} +// ------------------------------------------------------------------ +// Hashing Functions +// ------------------------------------------------------------------ +function ArrayType(value) { + FNV1A64(ByteMarker.Array); + for (const item of value) { + Visit(item); + } +} +function BooleanType(value) { + FNV1A64(ByteMarker.Boolean); + FNV1A64(value ? 1 : 0); +} +function BigIntType(value) { + FNV1A64(ByteMarker.BigInt); + F64In.setBigInt64(0, value); + for (const byte of F64Out) { + FNV1A64(byte); + } +} +function DateType(value) { + FNV1A64(ByteMarker.Date); + Visit(value.getTime()); +} +function NullType(value) { + FNV1A64(ByteMarker.Null); +} +function NumberType(value) { + FNV1A64(ByteMarker.Number); + F64In.setFloat64(0, value); + for (const byte of F64Out) { + FNV1A64(byte); + } +} +function ObjectType(value) { + FNV1A64(ByteMarker.Object); + for (const key of globalThis.Object.getOwnPropertyNames(value).sort()) { + Visit(key); + Visit(value[key]); + } +} +function StringType(value) { + FNV1A64(ByteMarker.String); + for (let i = 0; i < value.length; i++) { + for (const byte of NumberToBytes(value.charCodeAt(i))) { + FNV1A64(byte); + } + } +} +function SymbolType(value) { + FNV1A64(ByteMarker.Symbol); + Visit(value.description); +} +function Uint8ArrayType(value) { + FNV1A64(ByteMarker.Uint8Array); + for (let i = 0; i < value.length; i++) { + FNV1A64(value[i]); + } +} +function UndefinedType(value) { + return FNV1A64(ByteMarker.Undefined); +} +function Visit(value) { + if (IsArray(value)) + return ArrayType(value); + if (IsBoolean(value)) + return BooleanType(value); + if (IsBigInt(value)) + return BigIntType(value); + if (IsDate(value)) + return DateType(value); + if (IsNull(value)) + return NullType(value); + if (IsNumber(value)) + return NumberType(value); + if (IsObject(value)) + return ObjectType(value); + if (IsString(value)) + return StringType(value); + if (IsSymbol(value)) + return SymbolType(value); + if (IsUint8Array(value)) + return Uint8ArrayType(value); + if (IsUndefined(value)) + return UndefinedType(value); + throw new ValueHashError(value); +} +function FNV1A64(byte) { + Accumulator = Accumulator ^ Bytes[byte]; + Accumulator = (Accumulator * Prime) % Size; +} +// ------------------------------------------------------------------ +// Hash +// ------------------------------------------------------------------ +/** Creates a FNV1A-64 non cryptographic hash of the given value */ +export function Hash(value) { + Accumulator = BigInt('14695981039346656037'); + Visit(value); + return Accumulator; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.d.mts new file mode 100644 index 0000000..cb66652 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.d.mts @@ -0,0 +1 @@ +export * from './hash.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.mjs new file mode 100644 index 0000000..cb66652 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/hash/index.mjs @@ -0,0 +1 @@ +export * from './hash.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/index.d.mts new file mode 100644 index 0000000..6b7d7fb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/index.d.mts @@ -0,0 +1,20 @@ +export { ValueError, ValueErrorType, ValueErrorIterator } from '../errors/index.mjs'; +export * from './guard/index.mjs'; +export * from './assert/index.mjs'; +export * from './cast/index.mjs'; +export * from './check/index.mjs'; +export * from './clean/index.mjs'; +export * from './clone/index.mjs'; +export * from './convert/index.mjs'; +export * from './create/index.mjs'; +export * from './decode/index.mjs'; +export * from './default/index.mjs'; +export * from './delta/index.mjs'; +export * from './encode/index.mjs'; +export * from './equal/index.mjs'; +export * from './hash/index.mjs'; +export * from './mutate/index.mjs'; +export * from './parse/index.mjs'; +export * from './pointer/index.mjs'; +export * from './transform/index.mjs'; +export { Value } from './value/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/index.mjs new file mode 100644 index 0000000..c3aaa73 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/index.mjs @@ -0,0 +1,32 @@ +// ------------------------------------------------------------------ +// Errors (re-export) +// ------------------------------------------------------------------ +export { ValueErrorType, ValueErrorIterator } from '../errors/index.mjs'; +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +export * from './guard/index.mjs'; +// ------------------------------------------------------------------ +// Operators +// ------------------------------------------------------------------ +export * from './assert/index.mjs'; +export * from './cast/index.mjs'; +export * from './check/index.mjs'; +export * from './clean/index.mjs'; +export * from './clone/index.mjs'; +export * from './convert/index.mjs'; +export * from './create/index.mjs'; +export * from './decode/index.mjs'; +export * from './default/index.mjs'; +export * from './delta/index.mjs'; +export * from './encode/index.mjs'; +export * from './equal/index.mjs'; +export * from './hash/index.mjs'; +export * from './mutate/index.mjs'; +export * from './parse/index.mjs'; +export * from './pointer/index.mjs'; +export * from './transform/index.mjs'; +// ------------------------------------------------------------------ +// Namespace +// ------------------------------------------------------------------ +export { Value } from './value/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.d.mts new file mode 100644 index 0000000..7e5a7dd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.d.mts @@ -0,0 +1 @@ +export * from './mutate.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.mjs new file mode 100644 index 0000000..7e5a7dd --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/index.mjs @@ -0,0 +1 @@ +export * from './mutate.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.d.mts new file mode 100644 index 0000000..30a322d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.d.mts @@ -0,0 +1,9 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +export declare class ValueMutateError extends TypeBoxError { + constructor(message: string); +} +export type Mutable = { + [key: string]: unknown; +} | unknown[]; +/** `[Mutable]` Performs a deep mutable value assignment while retaining internal references */ +export declare function Mutate(current: Mutable, next: Mutable): void; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.mjs new file mode 100644 index 0000000..60eeb2c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.mjs @@ -0,0 +1,98 @@ +import { IsObject, IsArray, IsTypedArray, IsValueType } from '../guard/index.mjs'; +import { ValuePointer } from '../pointer/index.mjs'; +import { Clone } from '../clone/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +// ------------------------------------------------------------------ +// IsStandardObject +// ------------------------------------------------------------------ +function IsStandardObject(value) { + return IsObject(value) && !IsArray(value); +} +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class ValueMutateError extends TypeBoxError { + constructor(message) { + super(message); + } +} +function ObjectType(root, path, current, next) { + if (!IsStandardObject(current)) { + ValuePointer.Set(root, path, Clone(next)); + } + else { + const currentKeys = Object.getOwnPropertyNames(current); + const nextKeys = Object.getOwnPropertyNames(next); + for (const currentKey of currentKeys) { + if (!nextKeys.includes(currentKey)) { + delete current[currentKey]; + } + } + for (const nextKey of nextKeys) { + if (!currentKeys.includes(nextKey)) { + current[nextKey] = null; + } + } + for (const nextKey of nextKeys) { + Visit(root, `${path}/${nextKey}`, current[nextKey], next[nextKey]); + } + } +} +function ArrayType(root, path, current, next) { + if (!IsArray(current)) { + ValuePointer.Set(root, path, Clone(next)); + } + else { + for (let index = 0; index < next.length; index++) { + Visit(root, `${path}/${index}`, current[index], next[index]); + } + current.splice(next.length); + } +} +function TypedArrayType(root, path, current, next) { + if (IsTypedArray(current) && current.length === next.length) { + for (let i = 0; i < current.length; i++) { + current[i] = next[i]; + } + } + else { + ValuePointer.Set(root, path, Clone(next)); + } +} +function ValueType(root, path, current, next) { + if (current === next) + return; + ValuePointer.Set(root, path, next); +} +function Visit(root, path, current, next) { + if (IsArray(next)) + return ArrayType(root, path, current, next); + if (IsTypedArray(next)) + return TypedArrayType(root, path, current, next); + if (IsStandardObject(next)) + return ObjectType(root, path, current, next); + if (IsValueType(next)) + return ValueType(root, path, current, next); +} +// ------------------------------------------------------------------ +// IsNonMutableValue +// ------------------------------------------------------------------ +function IsNonMutableValue(value) { + return IsTypedArray(value) || IsValueType(value); +} +function IsMismatchedValue(current, next) { + // prettier-ignore + return ((IsStandardObject(current) && IsArray(next)) || + (IsArray(current) && IsStandardObject(next))); +} +// ------------------------------------------------------------------ +// Mutate +// ------------------------------------------------------------------ +/** `[Mutable]` Performs a deep mutable value assignment while retaining internal references */ +export function Mutate(current, next) { + if (IsNonMutableValue(current) || IsNonMutableValue(next)) + throw new ValueMutateError('Only object and array types can be mutated at the root level'); + if (IsMismatchedValue(current, next)) + throw new ValueMutateError('Cannot assign due type mismatch of assignable values'); + Visit(current, '', current, next); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.d.mts new file mode 100644 index 0000000..1fa0e7c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.d.mts @@ -0,0 +1 @@ +export * from './parse.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.mjs new file mode 100644 index 0000000..1fa0e7c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/index.mjs @@ -0,0 +1 @@ +export * from './parse.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.d.mts new file mode 100644 index 0000000..2c4d927 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.d.mts @@ -0,0 +1,22 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import { TSchema } from '../../type/schema/index.mjs'; +import { StaticDecode } from '../../type/static/index.mjs'; +export declare class ParseError extends TypeBoxError { + constructor(message: string); +} +export type TParseOperation = 'Assert' | 'Cast' | 'Clean' | 'Clone' | 'Convert' | 'Decode' | 'Default' | 'Encode' | ({} & string); +export type TParseFunction = (type: TSchema, references: TSchema[], value: unknown) => unknown; +export declare namespace ParseRegistry { + function Delete(key: string): void; + function Set(key: string, callback: TParseFunction): void; + function Get(key: string): TParseFunction | undefined; +} +export declare const ParseDefault: readonly ["Clone", "Clean", "Default", "Convert", "Assert", "Decode"]; +/** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */ +export declare function Parse, Result extends Output = Output>(schema: Type, references: TSchema[], value: unknown): Result; +/** Parses a value using the default parse pipeline. Will throws an `AssertError` if invalid. */ +export declare function Parse, Result extends Output = Output>(schema: Type, value: unknown): Result; +/** Parses a value using the specified operations. */ +export declare function Parse(operations: TParseOperation[], schema: Type, references: TSchema[], value: unknown): unknown; +/** Parses a value using the specified operations. */ +export declare function Parse(operations: TParseOperation[], schema: Type, value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.mjs new file mode 100644 index 0000000..05c7df2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/parse/parse.mjs @@ -0,0 +1,81 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import { TransformDecode, TransformEncode, HasTransform } from '../transform/index.mjs'; +import { Assert } from '../assert/index.mjs'; +import { Cast } from '../cast/index.mjs'; +import { Clean } from '../clean/index.mjs'; +import { Clone } from '../clone/index.mjs'; +import { Convert } from '../convert/index.mjs'; +import { Default } from '../default/index.mjs'; +// ------------------------------------------------------------------ +// Guards +// ------------------------------------------------------------------ +import { IsArray, IsUndefined } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// Error +// ------------------------------------------------------------------ +export class ParseError extends TypeBoxError { + constructor(message) { + super(message); + } +} +// prettier-ignore +export var ParseRegistry; +(function (ParseRegistry) { + const registry = new Map([ + ['Assert', (type, references, value) => { Assert(type, references, value); return value; }], + ['Cast', (type, references, value) => Cast(type, references, value)], + ['Clean', (type, references, value) => Clean(type, references, value)], + ['Clone', (_type, _references, value) => Clone(value)], + ['Convert', (type, references, value) => Convert(type, references, value)], + ['Decode', (type, references, value) => (HasTransform(type, references) ? TransformDecode(type, references, value) : value)], + ['Default', (type, references, value) => Default(type, references, value)], + ['Encode', (type, references, value) => (HasTransform(type, references) ? TransformEncode(type, references, value) : value)], + ]); + // Deletes an entry from the registry + function Delete(key) { + registry.delete(key); + } + ParseRegistry.Delete = Delete; + // Sets an entry in the registry + function Set(key, callback) { + registry.set(key, callback); + } + ParseRegistry.Set = Set; + // Gets an entry in the registry + function Get(key) { + return registry.get(key); + } + ParseRegistry.Get = Get; +})(ParseRegistry || (ParseRegistry = {})); +// ------------------------------------------------------------------ +// Default Parse Pipeline +// ------------------------------------------------------------------ +// prettier-ignore +export const ParseDefault = [ + 'Clone', + 'Clean', + 'Default', + 'Convert', + 'Assert', + 'Decode' +]; +// ------------------------------------------------------------------ +// ParseValue +// ------------------------------------------------------------------ +function ParseValue(operations, type, references, value) { + return operations.reduce((value, operationKey) => { + const operation = ParseRegistry.Get(operationKey); + if (IsUndefined(operation)) + throw new ParseError(`Unable to find Parse operation '${operationKey}'`); + return operation(type, references, value); + }, value); +} +/** Parses a value */ +export function Parse(...args) { + // prettier-ignore + const [operations, schema, references, value] = (args.length === 4 ? [args[0], args[1], args[2], args[3]] : + args.length === 3 ? IsArray(args[0]) ? [args[0], args[1], [], args[2]] : [ParseDefault, args[0], args[1], args[2]] : + args.length === 2 ? [ParseDefault, args[0], [], args[1]] : + (() => { throw new ParseError('Invalid Arguments'); })()); + return ParseValue(operations, schema, references, value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.d.mts new file mode 100644 index 0000000..0d359eb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.d.mts @@ -0,0 +1 @@ +export * as ValuePointer from './pointer.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.mjs new file mode 100644 index 0000000..0d359eb --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/index.mjs @@ -0,0 +1 @@ +export * as ValuePointer from './pointer.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.d.mts new file mode 100644 index 0000000..90031f7 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.d.mts @@ -0,0 +1,22 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +export declare class ValuePointerRootSetError extends TypeBoxError { + readonly value: unknown; + readonly path: string; + readonly update: unknown; + constructor(value: unknown, path: string, update: unknown); +} +export declare class ValuePointerRootDeleteError extends TypeBoxError { + readonly value: unknown; + readonly path: string; + constructor(value: unknown, path: string); +} +/** Formats the given pointer into navigable key components */ +export declare function Format(pointer: string): IterableIterator; +/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */ +export declare function Set(value: any, pointer: string, update: unknown): void; +/** Deletes a value at the given pointer */ +export declare function Delete(value: any, pointer: string): void; +/** Returns true if a value exists at the given pointer */ +export declare function Has(value: any, pointer: string): boolean; +/** Gets the value at the given pointer */ +export declare function Get(value: any, pointer: string): any; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs new file mode 100644 index 0000000..67784d2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs @@ -0,0 +1,115 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +export class ValuePointerRootSetError extends TypeBoxError { + constructor(value, path, update) { + super('Cannot set root value'); + this.value = value; + this.path = path; + this.update = update; + } +} +export class ValuePointerRootDeleteError extends TypeBoxError { + constructor(value, path) { + super('Cannot delete root value'); + this.value = value; + this.path = path; + } +} +// ------------------------------------------------------------------ +// ValuePointer +// ------------------------------------------------------------------ +/** Provides functionality to update values through RFC6901 string pointers */ +// prettier-ignore +function Escape(component) { + return component.indexOf('~') === -1 ? component : component.replace(/~1/g, '/').replace(/~0/g, '~'); +} +/** Formats the given pointer into navigable key components */ +// prettier-ignore +export function* Format(pointer) { + if (pointer === '') + return; + let [start, end] = [0, 0]; + for (let i = 0; i < pointer.length; i++) { + const char = pointer.charAt(i); + if (char === '/') { + if (i === 0) { + start = i + 1; + } + else { + end = i; + yield Escape(pointer.slice(start, end)); + start = i + 1; + } + } + else { + end = i; + } + } + yield Escape(pointer.slice(start)); +} +/** Sets the value at the given pointer. If the value at the pointer does not exist it is created */ +// prettier-ignore +export function Set(value, pointer, update) { + if (pointer === '') + throw new ValuePointerRootSetError(value, pointer, update); + let [owner, next, key] = [null, value, '']; + for (const component of Format(pointer)) { + if (next[component] === undefined) + next[component] = {}; + owner = next; + next = next[component]; + key = component; + } + owner[key] = update; +} +/** Deletes a value at the given pointer */ +// prettier-ignore +export function Delete(value, pointer) { + if (pointer === '') + throw new ValuePointerRootDeleteError(value, pointer); + let [owner, next, key] = [null, value, '']; + for (const component of Format(pointer)) { + if (next[component] === undefined || next[component] === null) + return; + owner = next; + next = next[component]; + key = component; + } + if (Array.isArray(owner)) { + const index = parseInt(key); + owner.splice(index, 1); + } + else { + delete owner[key]; + } +} +/** Returns true if a value exists at the given pointer */ +// prettier-ignore +export function Has(value, pointer) { + if (pointer === '') + return true; + let [owner, next, key] = [null, value, '']; + for (const component of Format(pointer)) { + if (next[component] === undefined) + return false; + owner = next; + next = next[component]; + key = component; + } + return Object.getOwnPropertyNames(owner).includes(key); +} +/** Gets the value at the given pointer */ +// prettier-ignore +export function Get(value, pointer) { + if (pointer === '') + return value; + let current = value; + for (const component of Format(pointer)) { + if (current[component] === undefined) + return undefined; + current = current[component]; + } + return current; +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.d.mts new file mode 100644 index 0000000..0b003ce --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.d.mts @@ -0,0 +1,22 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import { ValueError } from '../../errors/index.mjs'; +import type { TSchema } from '../../type/schema/index.mjs'; +export declare class TransformDecodeCheckError extends TypeBoxError { + readonly schema: TSchema; + readonly value: unknown; + readonly error: ValueError; + constructor(schema: TSchema, value: unknown, error: ValueError); +} +export declare class TransformDecodeError extends TypeBoxError { + readonly schema: TSchema; + readonly path: string; + readonly value: unknown; + readonly error: Error; + constructor(schema: TSchema, path: string, value: unknown, error: Error); +} +/** + * `[Internal]` Decodes the value and returns the result. This function requires that + * the caller `Check` the value before use. Passing unchecked values may result in + * undefined behavior. Refer to the `Value.Decode()` for implementation details. + */ +export declare function TransformDecode(schema: TSchema, references: TSchema[], value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs new file mode 100644 index 0000000..83aedf2 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs @@ -0,0 +1,207 @@ +import { TypeSystemPolicy } from '../../system/policy.mjs'; +import { Kind, TransformKind } from '../../type/symbols/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +import { KeyOfPropertyKeys, KeyOfPropertyEntries } from '../../type/keyof/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +import { Check } from '../check/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { HasPropertyKey, IsObject, IsArray, IsValueType, IsUndefined as IsUndefinedValue } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +import { IsTransform, IsSchema, IsUndefined } from '../../type/guard/kind.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +// thrown externally +// prettier-ignore +export class TransformDecodeCheckError extends TypeBoxError { + constructor(schema, value, error) { + super(`Unable to decode value as it does not match the expected schema`); + this.schema = schema; + this.value = value; + this.error = error; + } +} +// prettier-ignore +export class TransformDecodeError extends TypeBoxError { + constructor(schema, path, value, error) { + super(error instanceof Error ? error.message : 'Unknown error'); + this.schema = schema; + this.path = path; + this.value = value; + this.error = error; + } +} +// ------------------------------------------------------------------ +// Decode +// ------------------------------------------------------------------ +// prettier-ignore +function Default(schema, path, value) { + try { + return IsTransform(schema) ? schema[TransformKind].Decode(value) : value; + } + catch (error) { + throw new TransformDecodeError(schema, path, value, error); + } +} +// prettier-ignore +function FromArray(schema, references, path, value) { + return (IsArray(value)) + ? Default(schema, path, value.map((value, index) => Visit(schema.items, references, `${path}/${index}`, value))) + : Default(schema, path, value); +} +// prettier-ignore +function FromIntersect(schema, references, path, value) { + if (!IsObject(value) || IsValueType(value)) + return Default(schema, path, value); + const knownEntries = KeyOfPropertyEntries(schema); + const knownKeys = knownEntries.map(entry => entry[0]); + const knownProperties = { ...value }; + for (const [knownKey, knownSchema] of knownEntries) + if (knownKey in knownProperties) { + knownProperties[knownKey] = Visit(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]); + } + if (!IsTransform(schema.unevaluatedProperties)) { + return Default(schema, path, knownProperties); + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const unevaluatedProperties = schema.unevaluatedProperties; + const unknownProperties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + unknownProperties[key] = Default(unevaluatedProperties, `${path}/${key}`, unknownProperties[key]); + } + return Default(schema, path, unknownProperties); +} +// prettier-ignore +function FromImport(schema, references, path, value) { + const additional = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + const result = Visit(target, [...references, ...additional], path, value); + return Default(schema, path, result); +} +function FromNot(schema, references, path, value) { + return Default(schema, path, Visit(schema.not, references, path, value)); +} +// prettier-ignore +function FromObject(schema, references, path, value) { + if (!IsObject(value)) + return Default(schema, path, value); + const knownKeys = KeyOfPropertyKeys(schema); + const knownProperties = { ...value }; + for (const key of knownKeys) { + if (!HasPropertyKey(knownProperties, key)) + continue; + // if the property value is undefined, but the target is not, nor does it satisfy exact optional + // property policy, then we need to continue. This is a special case for optional property handling + // where a transforms wrapped in a optional modifiers should not run. + if (IsUndefinedValue(knownProperties[key]) && (!IsUndefined(schema.properties[key]) || + TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key))) + continue; + // decode property + knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]); + } + if (!IsSchema(schema.additionalProperties)) { + return Default(schema, path, knownProperties); + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const unknownProperties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]); + } + return Default(schema, path, unknownProperties); +} +// prettier-ignore +function FromRecord(schema, references, path, value) { + if (!IsObject(value)) + return Default(schema, path, value); + const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const knownKeys = new RegExp(pattern); + const knownProperties = { ...value }; + for (const key of Object.getOwnPropertyNames(value)) + if (knownKeys.test(key)) { + knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]); + } + if (!IsSchema(schema.additionalProperties)) { + return Default(schema, path, knownProperties); + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const unknownProperties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.test(key)) { + unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]); + } + return Default(schema, path, unknownProperties); +} +// prettier-ignore +function FromRef(schema, references, path, value) { + const target = Deref(schema, references); + return Default(schema, path, Visit(target, references, path, value)); +} +// prettier-ignore +function FromThis(schema, references, path, value) { + const target = Deref(schema, references); + return Default(schema, path, Visit(target, references, path, value)); +} +// prettier-ignore +function FromTuple(schema, references, path, value) { + return (IsArray(value) && IsArray(schema.items)) + ? Default(schema, path, schema.items.map((schema, index) => Visit(schema, references, `${path}/${index}`, value[index]))) + : Default(schema, path, value); +} +// prettier-ignore +function FromUnion(schema, references, path, value) { + for (const subschema of schema.anyOf) { + if (!Check(subschema, references, value)) + continue; + // note: ensure interior is decoded first + const decoded = Visit(subschema, references, path, value); + return Default(schema, path, decoded); + } + return Default(schema, path, value); +} +// prettier-ignore +function Visit(schema, references, path, value) { + const references_ = Pushref(schema, references); + const schema_ = schema; + switch (schema[Kind]) { + case 'Array': + return FromArray(schema_, references_, path, value); + case 'Import': + return FromImport(schema_, references_, path, value); + case 'Intersect': + return FromIntersect(schema_, references_, path, value); + case 'Not': + return FromNot(schema_, references_, path, value); + case 'Object': + return FromObject(schema_, references_, path, value); + case 'Record': + return FromRecord(schema_, references_, path, value); + case 'Ref': + return FromRef(schema_, references_, path, value); + case 'Symbol': + return Default(schema_, path, value); + case 'This': + return FromThis(schema_, references_, path, value); + case 'Tuple': + return FromTuple(schema_, references_, path, value); + case 'Union': + return FromUnion(schema_, references_, path, value); + default: + return Default(schema_, path, value); + } +} +/** + * `[Internal]` Decodes the value and returns the result. This function requires that + * the caller `Check` the value before use. Passing unchecked values may result in + * undefined behavior. Refer to the `Value.Decode()` for implementation details. + */ +export function TransformDecode(schema, references, value) { + return Visit(schema, references, '', value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.d.mts new file mode 100644 index 0000000..ea95229 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.d.mts @@ -0,0 +1,23 @@ +import { TypeBoxError } from '../../type/error/index.mjs'; +import { ValueError } from '../../errors/index.mjs'; +import type { TSchema } from '../../type/schema/index.mjs'; +export declare class TransformEncodeCheckError extends TypeBoxError { + readonly schema: TSchema; + readonly value: unknown; + readonly error: ValueError; + constructor(schema: TSchema, value: unknown, error: ValueError); +} +export declare class TransformEncodeError extends TypeBoxError { + readonly schema: TSchema; + readonly path: string; + readonly value: unknown; + readonly error: Error; + constructor(schema: TSchema, path: string, value: unknown, error: Error); +} +/** + * `[Internal]` Encodes the value and returns the result. This function expects the + * caller to pass a statically checked value. This function does not check the encoded + * result, meaning the result should be passed to `Check` before use. Refer to the + * `Value.Encode()` function for implementation details. + */ +export declare function TransformEncode(schema: TSchema, references: TSchema[], value: unknown): unknown; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs new file mode 100644 index 0000000..7ec3c47 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs @@ -0,0 +1,218 @@ +import { TypeSystemPolicy } from '../../system/policy.mjs'; +import { Kind, TransformKind } from '../../type/symbols/index.mjs'; +import { TypeBoxError } from '../../type/error/index.mjs'; +import { KeyOfPropertyKeys, KeyOfPropertyEntries } from '../../type/keyof/index.mjs'; +import { Deref, Pushref } from '../deref/index.mjs'; +import { Check } from '../check/index.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { HasPropertyKey, IsObject, IsArray, IsValueType, IsUndefined as IsUndefinedValue } from '../guard/index.mjs'; +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +import { IsTransform, IsSchema, IsUndefined } from '../../type/guard/kind.mjs'; +// ------------------------------------------------------------------ +// Errors +// ------------------------------------------------------------------ +// prettier-ignore +export class TransformEncodeCheckError extends TypeBoxError { + constructor(schema, value, error) { + super(`The encoded value does not match the expected schema`); + this.schema = schema; + this.value = value; + this.error = error; + } +} +// prettier-ignore +export class TransformEncodeError extends TypeBoxError { + constructor(schema, path, value, error) { + super(`${error instanceof Error ? error.message : 'Unknown error'}`); + this.schema = schema; + this.path = path; + this.value = value; + this.error = error; + } +} +// ------------------------------------------------------------------ +// Encode +// ------------------------------------------------------------------ +// prettier-ignore +function Default(schema, path, value) { + try { + return IsTransform(schema) ? schema[TransformKind].Encode(value) : value; + } + catch (error) { + throw new TransformEncodeError(schema, path, value, error); + } +} +// prettier-ignore +function FromArray(schema, references, path, value) { + const defaulted = Default(schema, path, value); + return IsArray(defaulted) + ? defaulted.map((value, index) => Visit(schema.items, references, `${path}/${index}`, value)) + : defaulted; +} +// prettier-ignore +function FromImport(schema, references, path, value) { + const additional = globalThis.Object.values(schema.$defs); + const target = schema.$defs[schema.$ref]; + const result = Default(schema, path, value); + return Visit(target, [...references, ...additional], path, result); +} +// prettier-ignore +function FromIntersect(schema, references, path, value) { + const defaulted = Default(schema, path, value); + if (!IsObject(value) || IsValueType(value)) + return defaulted; + const knownEntries = KeyOfPropertyEntries(schema); + const knownKeys = knownEntries.map(entry => entry[0]); + const knownProperties = { ...defaulted }; + for (const [knownKey, knownSchema] of knownEntries) + if (knownKey in knownProperties) { + knownProperties[knownKey] = Visit(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]); + } + if (!IsTransform(schema.unevaluatedProperties)) { + return knownProperties; + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const unevaluatedProperties = schema.unevaluatedProperties; + const properties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + properties[key] = Default(unevaluatedProperties, `${path}/${key}`, properties[key]); + } + return properties; +} +// prettier-ignore +function FromNot(schema, references, path, value) { + return Default(schema.not, path, Default(schema, path, value)); +} +// prettier-ignore +function FromObject(schema, references, path, value) { + const defaulted = Default(schema, path, value); + if (!IsObject(defaulted)) + return defaulted; + const knownKeys = KeyOfPropertyKeys(schema); + const knownProperties = { ...defaulted }; + for (const key of knownKeys) { + if (!HasPropertyKey(knownProperties, key)) + continue; + // if the property value is undefined, but the target is not, nor does it satisfy exact optional + // property policy, then we need to continue. This is a special case for optional property handling + // where a transforms wrapped in a optional modifiers should not run. + if (IsUndefinedValue(knownProperties[key]) && (!IsUndefined(schema.properties[key]) || + TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key))) + continue; + // encode property + knownProperties[key] = Visit(schema.properties[key], references, `${path}/${key}`, knownProperties[key]); + } + if (!IsSchema(schema.additionalProperties)) { + return knownProperties; + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const properties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.includes(key)) { + properties[key] = Default(additionalProperties, `${path}/${key}`, properties[key]); + } + return properties; +} +// prettier-ignore +function FromRecord(schema, references, path, value) { + const defaulted = Default(schema, path, value); + if (!IsObject(value)) + return defaulted; + const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const knownKeys = new RegExp(pattern); + const knownProperties = { ...defaulted }; + for (const key of Object.getOwnPropertyNames(value)) + if (knownKeys.test(key)) { + knownProperties[key] = Visit(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]); + } + if (!IsSchema(schema.additionalProperties)) { + return knownProperties; + } + const unknownKeys = Object.getOwnPropertyNames(knownProperties); + const additionalProperties = schema.additionalProperties; + const properties = { ...knownProperties }; + for (const key of unknownKeys) + if (!knownKeys.test(key)) { + properties[key] = Default(additionalProperties, `${path}/${key}`, properties[key]); + } + return properties; +} +// prettier-ignore +function FromRef(schema, references, path, value) { + const target = Deref(schema, references); + const resolved = Visit(target, references, path, value); + return Default(schema, path, resolved); +} +// prettier-ignore +function FromThis(schema, references, path, value) { + const target = Deref(schema, references); + const resolved = Visit(target, references, path, value); + return Default(schema, path, resolved); +} +// prettier-ignore +function FromTuple(schema, references, path, value) { + const value1 = Default(schema, path, value); + return IsArray(schema.items) ? schema.items.map((schema, index) => Visit(schema, references, `${path}/${index}`, value1[index])) : []; +} +// prettier-ignore +function FromUnion(schema, references, path, value) { + // test value against union variants + for (const subschema of schema.anyOf) { + if (!Check(subschema, references, value)) + continue; + const value1 = Visit(subschema, references, path, value); + return Default(schema, path, value1); + } + // test transformed value against union variants + for (const subschema of schema.anyOf) { + const value1 = Visit(subschema, references, path, value); + if (!Check(schema, references, value1)) + continue; + return Default(schema, path, value1); + } + return Default(schema, path, value); +} +// prettier-ignore +function Visit(schema, references, path, value) { + const references_ = Pushref(schema, references); + const schema_ = schema; + switch (schema[Kind]) { + case 'Array': + return FromArray(schema_, references_, path, value); + case 'Import': + return FromImport(schema_, references_, path, value); + case 'Intersect': + return FromIntersect(schema_, references_, path, value); + case 'Not': + return FromNot(schema_, references_, path, value); + case 'Object': + return FromObject(schema_, references_, path, value); + case 'Record': + return FromRecord(schema_, references_, path, value); + case 'Ref': + return FromRef(schema_, references_, path, value); + case 'This': + return FromThis(schema_, references_, path, value); + case 'Tuple': + return FromTuple(schema_, references_, path, value); + case 'Union': + return FromUnion(schema_, references_, path, value); + default: + return Default(schema_, path, value); + } +} +/** + * `[Internal]` Encodes the value and returns the result. This function expects the + * caller to pass a statically checked value. This function does not check the encoded + * result, meaning the result should be passed to `Check` before use. Refer to the + * `Value.Encode()` function for implementation details. + */ +export function TransformEncode(schema, references, value) { + return Visit(schema, references, '', value); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.d.mts new file mode 100644 index 0000000..4abf58a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.d.mts @@ -0,0 +1,3 @@ +import type { TSchema } from '../../type/schema/index.mjs'; +/** Returns true if this schema contains a transform codec */ +export declare function HasTransform(schema: TSchema, references: TSchema[]): boolean; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs new file mode 100644 index 0000000..7c3f48a --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs @@ -0,0 +1,129 @@ +import { Deref, Pushref } from '../deref/index.mjs'; +import { Kind } from '../../type/symbols/index.mjs'; +// ------------------------------------------------------------------ +// KindGuard +// ------------------------------------------------------------------ +import { IsTransform, IsSchema } from '../../type/guard/kind.mjs'; +// ------------------------------------------------------------------ +// ValueGuard +// ------------------------------------------------------------------ +import { IsUndefined } from '../guard/index.mjs'; +// prettier-ignore +function FromArray(schema, references) { + return IsTransform(schema) || Visit(schema.items, references); +} +// prettier-ignore +function FromAsyncIterator(schema, references) { + return IsTransform(schema) || Visit(schema.items, references); +} +// prettier-ignore +function FromConstructor(schema, references) { + return IsTransform(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function FromFunction(schema, references) { + return IsTransform(schema) || Visit(schema.returns, references) || schema.parameters.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function FromIntersect(schema, references) { + return IsTransform(schema) || IsTransform(schema.unevaluatedProperties) || schema.allOf.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function FromImport(schema, references) { + const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []); + const target = schema.$defs[schema.$ref]; + return IsTransform(schema) || Visit(target, [...additional, ...references]); +} +// prettier-ignore +function FromIterator(schema, references) { + return IsTransform(schema) || Visit(schema.items, references); +} +// prettier-ignore +function FromNot(schema, references) { + return IsTransform(schema) || Visit(schema.not, references); +} +// prettier-ignore +function FromObject(schema, references) { + return (IsTransform(schema) || + Object.values(schema.properties).some((schema) => Visit(schema, references)) || + (IsSchema(schema.additionalProperties) && Visit(schema.additionalProperties, references))); +} +// prettier-ignore +function FromPromise(schema, references) { + return IsTransform(schema) || Visit(schema.item, references); +} +// prettier-ignore +function FromRecord(schema, references) { + const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0]; + const property = schema.patternProperties[pattern]; + return IsTransform(schema) || Visit(property, references) || (IsSchema(schema.additionalProperties) && IsTransform(schema.additionalProperties)); +} +// prettier-ignore +function FromRef(schema, references) { + if (IsTransform(schema)) + return true; + return Visit(Deref(schema, references), references); +} +// prettier-ignore +function FromThis(schema, references) { + if (IsTransform(schema)) + return true; + return Visit(Deref(schema, references), references); +} +// prettier-ignore +function FromTuple(schema, references) { + return IsTransform(schema) || (!IsUndefined(schema.items) && schema.items.some((schema) => Visit(schema, references))); +} +// prettier-ignore +function FromUnion(schema, references) { + return IsTransform(schema) || schema.anyOf.some((schema) => Visit(schema, references)); +} +// prettier-ignore +function Visit(schema, references) { + const references_ = Pushref(schema, references); + const schema_ = schema; + if (schema.$id && visited.has(schema.$id)) + return false; + if (schema.$id) + visited.add(schema.$id); + switch (schema[Kind]) { + case 'Array': + return FromArray(schema_, references_); + case 'AsyncIterator': + return FromAsyncIterator(schema_, references_); + case 'Constructor': + return FromConstructor(schema_, references_); + case 'Function': + return FromFunction(schema_, references_); + case 'Import': + return FromImport(schema_, references_); + case 'Intersect': + return FromIntersect(schema_, references_); + case 'Iterator': + return FromIterator(schema_, references_); + case 'Not': + return FromNot(schema_, references_); + case 'Object': + return FromObject(schema_, references_); + case 'Promise': + return FromPromise(schema_, references_); + case 'Record': + return FromRecord(schema_, references_); + case 'Ref': + return FromRef(schema_, references_); + case 'This': + return FromThis(schema_, references_); + case 'Tuple': + return FromTuple(schema_, references_); + case 'Union': + return FromUnion(schema_, references_); + default: + return IsTransform(schema); + } +} +const visited = new Set(); +/** Returns true if this schema contains a transform codec */ +export function HasTransform(schema, references) { + visited.clear(); + return Visit(schema, references); +} diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.d.mts new file mode 100644 index 0000000..ad9e40d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.d.mts @@ -0,0 +1,3 @@ +export * from './decode.mjs'; +export * from './encode.mjs'; +export * from './has.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.mjs new file mode 100644 index 0000000..ad9e40d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/transform/index.mjs @@ -0,0 +1,3 @@ +export * from './decode.mjs'; +export * from './encode.mjs'; +export * from './has.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/value/index.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/value/index.d.mts new file mode 100644 index 0000000..72674f4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/value/index.d.mts @@ -0,0 +1 @@ +export * as Value from './value.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/value/index.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/value/index.mjs new file mode 100644 index 0000000..72674f4 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/value/index.mjs @@ -0,0 +1 @@ +export * as Value from './value.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/value/value.d.mts b/ui/node_modules/@sinclair/typebox/build/esm/value/value/value.d.mts new file mode 100644 index 0000000..b604c61 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/value/value.d.mts @@ -0,0 +1,16 @@ +export { Errors, ValueErrorIterator } from '../../errors/index.mjs'; +export { Assert } from '../assert/index.mjs'; +export { Cast } from '../cast/index.mjs'; +export { Check } from '../check/index.mjs'; +export { Clean } from '../clean/index.mjs'; +export { Clone } from '../clone/index.mjs'; +export { Convert } from '../convert/index.mjs'; +export { Create } from '../create/index.mjs'; +export { Decode } from '../decode/index.mjs'; +export { Default } from '../default/index.mjs'; +export { Diff, Patch, Edit } from '../delta/index.mjs'; +export { Encode } from '../encode/index.mjs'; +export { Equal } from '../equal/index.mjs'; +export { Hash } from '../hash/index.mjs'; +export { Mutate, type Mutable } from '../mutate/index.mjs'; +export { Parse } from '../parse/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/build/esm/value/value/value.mjs b/ui/node_modules/@sinclair/typebox/build/esm/value/value/value.mjs new file mode 100644 index 0000000..0af3d52 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/build/esm/value/value/value.mjs @@ -0,0 +1,16 @@ +export { Errors, ValueErrorIterator } from '../../errors/index.mjs'; +export { Assert } from '../assert/index.mjs'; +export { Cast } from '../cast/index.mjs'; +export { Check } from '../check/index.mjs'; +export { Clean } from '../clean/index.mjs'; +export { Clone } from '../clone/index.mjs'; +export { Convert } from '../convert/index.mjs'; +export { Create } from '../create/index.mjs'; +export { Decode } from '../decode/index.mjs'; +export { Default } from '../default/index.mjs'; +export { Diff, Patch, Edit } from '../delta/index.mjs'; +export { Encode } from '../encode/index.mjs'; +export { Equal } from '../equal/index.mjs'; +export { Hash } from '../hash/index.mjs'; +export { Mutate } from '../mutate/index.mjs'; +export { Parse } from '../parse/index.mjs'; diff --git a/ui/node_modules/@sinclair/typebox/compiler/package.json b/ui/node_modules/@sinclair/typebox/compiler/package.json new file mode 100644 index 0000000..75254db --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/compiler/package.json @@ -0,0 +1,4 @@ +{ + "main": "../build/cjs/compiler/index.js", + "types": "../build/cjs/compiler/index.d.ts" +} \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/errors/package.json b/ui/node_modules/@sinclair/typebox/errors/package.json new file mode 100644 index 0000000..39ae3d0 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/errors/package.json @@ -0,0 +1,4 @@ +{ + "main": "../build/cjs/errors/index.js", + "types": "../build/cjs/errors/index.d.ts" +} \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/license b/ui/node_modules/@sinclair/typebox/license new file mode 100644 index 0000000..2a1b348 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/license @@ -0,0 +1,25 @@ +TypeBox + +Json Schema Type Builder with Static Type Resolution for TypeScript + +The MIT License (MIT) + +Copyright (c) 2017-2026 Haydn Paterson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/package.json b/ui/node_modules/@sinclair/typebox/package.json new file mode 100644 index 0000000..6dd451d --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/package.json @@ -0,0 +1,116 @@ +{ + "name": "@sinclair/typebox", + "version": "0.34.48", + "description": "Json Schema Type Builder with Static Type Resolution for TypeScript", + "keywords": [ + "typescript", + "json-schema", + "validate", + "typecheck" + ], + "author": "sinclairzx81", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sinclairzx81/typebox-legacy" + }, + "scripts": { + "test": "echo test" + }, + "types": "./build/cjs/index.d.ts", + "main": "./build/cjs/index.js", + "module": "./build/esm/index.mjs", + "esm.sh": { + "bundle": false + }, + "sideEffects": [ + "./build/esm/type/registry/format.mjs", + "./build/esm/type/registry/type.mjs", + "./build/esm/type/system/policy.mjs", + "./build/cjs/type/registry/format.js", + "./build/cjs/type/registry/type.js", + "./build/cjs/type/system/policy.js" + ], + "exports": { + ".": { + "require": { + "types": "./build/cjs/index.d.ts", + "default": "./build/cjs/index.js" + }, + "import": { + "types": "./build/esm/index.d.mts", + "default": "./build/esm/index.mjs" + } + }, + "./compiler": { + "require": { + "types": "./build/cjs/compiler/index.d.ts", + "default": "./build/cjs/compiler/index.js" + }, + "import": { + "types": "./build/esm/compiler/index.d.mts", + "default": "./build/esm/compiler/index.mjs" + } + }, + "./errors": { + "require": { + "types": "./build/cjs/errors/index.d.ts", + "default": "./build/cjs/errors/index.js" + }, + "import": { + "types": "./build/esm/errors/index.d.mts", + "default": "./build/esm/errors/index.mjs" + } + }, + "./parser": { + "require": { + "types": "./build/cjs/parser/index.d.ts", + "default": "./build/cjs/parser/index.js" + }, + "import": { + "types": "./build/esm/parser/index.d.mts", + "default": "./build/esm/parser/index.mjs" + } + }, + "./syntax": { + "require": { + "types": "./build/cjs/syntax/index.d.ts", + "default": "./build/cjs/syntax/index.js" + }, + "import": { + "types": "./build/esm/syntax/index.d.mts", + "default": "./build/esm/syntax/index.mjs" + } + }, + "./system": { + "require": { + "types": "./build/cjs/system/index.d.ts", + "default": "./build/cjs/system/index.js" + }, + "import": { + "types": "./build/esm/system/index.d.mts", + "default": "./build/esm/system/index.mjs" + } + }, + "./type": { + "require": { + "types": "./build/cjs/type/index.d.ts", + "default": "./build/cjs/type/index.js" + }, + "import": { + "types": "./build/esm/type/index.d.mts", + "default": "./build/esm/type/index.mjs" + } + }, + "./value": { + "require": { + "types": "./build/cjs/value/index.d.ts", + "default": "./build/cjs/value/index.js" + }, + "import": { + "types": "./build/esm/value/index.d.mts", + "default": "./build/esm/value/index.mjs" + } + } + } +} \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/parser/package.json b/ui/node_modules/@sinclair/typebox/parser/package.json new file mode 100644 index 0000000..6f4c981 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/parser/package.json @@ -0,0 +1,4 @@ +{ + "main": "../build/cjs/parser/index.js", + "types": "../build/cjs/parser/index.d.ts" +} \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/readme.md b/ui/node_modules/@sinclair/typebox/readme.md new file mode 100644 index 0000000..3f1253c --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/readme.md @@ -0,0 +1,1865 @@ +

+ +

TypeBox 0.34.x

+ +

Json Schema Type Builder with Static Type Resolution for TypeScript

+ + + +
+
+ +[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox) +[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox) +[![Build](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox/actions/workflows/build.yml) +[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +
+ + + +## Install + +```bash +$ npm install @sinclair/typebox # TypeBox-Legacy | 0.34.x + +$ npm install typebox # TypeBox | 1.0.x +``` + +## Example + +```typescript +import { Type, type Static } from '@sinclair/typebox' + +const T = Type.Object({ // const T = { + x: Type.Number(), // type: 'object', + y: Type.Number(), // required: ['x', 'y', 'z'], + z: Type.Number() // properties: { +}) // x: { type: 'number' }, + // y: { type: 'number' }, + // z: { type: 'number' } + // } + // } + +type T = Static // type T = { + // x: number, + // y: number, + // z: number + // } +``` + + + + +## Overview + +> ⚠️ TypeBox versions (pre-1.0) will continue active maintenance through 2026 and beyond. This repository services as the OIDC publishing environment for the `@sinclair/typebox` package scope on NPM. For TypeBox versions 1.0 and above, refer to https://github.com/sinclairzx81/typebox + +TypeBox is a runtime type builder that creates in-memory Json Schema objects that infer as TypeScript types. The schematics produced by this library are designed to match the static type checking rules of the TypeScript compiler. TypeBox offers a unified type that can be statically checked by TypeScript and runtime asserted using standard Json Schema validation. + +This library is designed to allow Json Schema to compose similar to how types compose within TypeScript's type system. It can be used as a simple tool to build up complex schematics or integrated into REST and RPC services to help validate data received over the wire. + +License MIT + +## Contents +- [Install](#install) +- [Overview](#overview) +- [Usage](#usage) +- [Types](#types) + - [Json](#types-json) + - [JavaScript](#types-javascript) + - [Options](#types-options) + - [Properties](#types-properties) + - [Generics](#types-generics) + - [Recursive](#types-recursive) + - [Modules](#types-modules) + - [Template Literal](#types-template-literal) + - [Indexed](#types-indexed) + - [Mapped](#types-mapped) + - [Conditional](#types-conditional) + - [Transform](#types-transform) + - [Guard](#types-guard) + - [Unsafe](#types-unsafe) +- [Values](#values) + - [Assert](#values-assert) + - [Create](#values-create) + - [Clone](#values-clone) + - [Check](#values-check) + - [Convert](#values-convert) + - [Default](#values-default) + - [Clean](#values-clean) + - [Cast](#values-cast) + - [Decode](#values-decode) + - [Encode](#values-decode) + - [Parse](#values-parse) + - [Equal](#values-equal) + - [Hash](#values-hash) + - [Diff](#values-diff) + - [Patch](#values-patch) + - [Errors](#values-errors) + - [Mutate](#values-mutate) + - [Pointer](#values-pointer) +- [Syntax](#syntax) + - [Create](#syntax-create) + - [Parameters](#syntax-parameters) + - [Generics](#syntax-generics) + - [Options](#syntax-options) + - [NoInfer](#syntax-no-infer) +- [TypeRegistry](#typeregistry) + - [Type](#typeregistry-type) + - [Format](#typeregistry-format) +- [TypeCheck](#typecheck) + - [Ajv](#typecheck-ajv) + - [TypeCompiler](#typecheck-typecompiler) +- [TypeMap](#typemap) + - [Usage](#typemap-usage) +- [TypeSystem](#typesystem) + - [Policies](#typesystem-policies) +- [Error Function](#error-function) +- [Workbench](#workbench) +- [Codegen](#codegen) +- [Ecosystem](#ecosystem) +- [Benchmark](#benchmark) + - [Compile](#benchmark-compile) + - [Validate](#benchmark-validate) + - [Compression](#benchmark-compression) +- [Contribute](#contribute) + + + +## Usage + +The following shows general usage. + +```typescript +import { Type, type Static } from '@sinclair/typebox' + +//-------------------------------------------------------------------------------------------- +// +// Let's say you have the following type ... +// +//-------------------------------------------------------------------------------------------- + +type T = { + id: string, + name: string, + timestamp: number +} + +//-------------------------------------------------------------------------------------------- +// +// ... you can express this type in the following way. +// +//-------------------------------------------------------------------------------------------- + +const T = Type.Object({ // const T = { + id: Type.String(), // type: 'object', + name: Type.String(), // properties: { + timestamp: Type.Integer() // id: { +}) // type: 'string' + // }, + // name: { + // type: 'string' + // }, + // timestamp: { + // type: 'integer' + // } + // }, + // required: [ + // 'id', + // 'name', + // 'timestamp' + // ] + // } + +//-------------------------------------------------------------------------------------------- +// +// ... then infer back to the original static type this way. +// +//-------------------------------------------------------------------------------------------- + +type T = Static // type T = { + // id: string, + // name: string, + // timestamp: number + // } + +//-------------------------------------------------------------------------------------------- +// +// ... or use the type to parse JavaScript values. +// +//-------------------------------------------------------------------------------------------- + +import { Value } from '@sinclair/typebox/value' + +const R = Value.Parse(T, value) // const R: { + // id: string, + // name: string, + // timestamp: number + // } +``` + + + +## Types + +TypeBox types are Json Schema fragments that compose into more complex types. Each fragment is structured such that any Json Schema compliant validator can runtime assert a value the same way TypeScript will statically assert a type. TypeBox offers a set of Json Types which are used to create Json Schema compliant schematics as well as a JavaScript type set used to create schematics for constructs native to JavaScript. + + + +### Json Types + +The following table lists the supported Json types. These types are fully compatible with the Json Schema Draft 7 specification. + +```typescript +┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ +│ TypeBox │ TypeScript │ Json Schema │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Any() │ type T = any │ const T = { } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Unknown() │ type T = unknown │ const T = { } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.String() │ type T = string │ const T = { │ +│ │ │ type: 'string' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Number() │ type T = number │ const T = { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Integer() │ type T = number │ const T = { │ +│ │ │ type: 'integer' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Boolean() │ type T = boolean │ const T = { │ +│ │ │ type: 'boolean' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Null() │ type T = null │ const T = { │ +│ │ │ type: 'null' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Literal(42) │ type T = 42 │ const T = { │ +│ │ │ const: 42, │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Array( │ type T = number[] │ const T = { │ +│ Type.Number() │ │ type: 'array', │ +│ ) │ │ items: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ x: Type.Number(), │ x: number, │ type: 'object', │ +│ y: Type.Number() │ y: number │ required: ['x', 'y'], │ +│ }) │ } │ properties: { │ +│ │ │ x: { │ +│ │ │ type: 'number' │ +│ │ │ }, │ +│ │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Tuple([ │ type T = [number, number] │ const T = { │ +│ Type.Number(), │ │ type: 'array', │ +│ Type.Number() │ │ items: [{ │ +│ ]) │ │ type: 'number' │ +│ │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ }], │ +│ │ │ additionalItems: false, │ +│ │ │ minItems: 2, │ +│ │ │ maxItems: 2 │ +│ │ │ } │ +│ │ │ │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ enum Foo { │ enum Foo { │ const T = { │ +│ A, │ A, │ anyOf: [{ │ +│ B │ B │ type: 'number', │ +│ } │ } │ const: 0 │ +│ │ │ }, { │ +│ const T = Type.Enum(Foo) │ type T = Foo │ type: 'number', │ +│ │ │ const: 1 │ +│ │ │ }] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Const({ │ type T = { │ const T = { │ +│ x: 1, │ readonly x: 1, │ type: 'object', │ +│ y: 2, │ readonly y: 2 │ required: ['x', 'y'], │ +│ } as const) │ } │ properties: { │ +│ │ │ x: { │ +│ │ │ type: 'number', │ +│ │ │ const: 1 │ +│ │ │ }, │ +│ │ │ y: { │ +│ │ │ type: 'number', │ +│ │ │ const: 2 │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.KeyOf( │ type T = keyof { │ const T = { │ +│ Type.Object({ │ x: number, │ anyOf: [{ │ +│ x: Type.Number(), │ y: number │ type: 'string', │ +│ y: Type.Number() │ } │ const: 'x' │ +│ }) │ │ }, { │ +│ ) │ │ type: 'string', │ +│ │ │ const: 'y' │ +│ │ │ }] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Union([ │ type T = string | number │ const T = { │ +│ Type.String(), │ │ anyOf: [{ │ +│ Type.Number() │ │ type: 'string' │ +│ ]) │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ }] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Intersect([ │ type T = { │ const T = { │ +│ Type.Object({ │ x: number │ allOf: [{ │ +│ x: Type.Number() │ } & { │ type: 'object', │ +│ }), │ y: number │ required: ['x'], │ +│ Type.Object({ │ } │ properties: { │ +│ y: Type.Number() │ │ x: { │ +│ }) │ │ type: 'number' │ +│ ]) │ │ } │ +│ │ │ } │ +│ │ │ }, { │ +│ │ │ type: 'object', | +│ │ │ required: ['y'], │ +│ │ │ properties: { │ +│ │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ }] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Composite([ │ type T = { │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'object', │ +│ x: Type.Number() │ y: number │ required: ['x', 'y'], │ +│ }), │ } │ properties: { │ +│ Type.Object({ │ │ x: { │ +│ y: Type.Number() │ │ type: 'number' │ +│ }) │ │ }, │ +│ ]) │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Never() │ type T = never │ const T = { │ +│ │ │ not: {} │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Not( | type T = unknown │ const T = { │ +│ Type.String() │ │ not: { │ +│ ) │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Extends( │ type T = │ const T = { │ +│ Type.String(), │ string extends number │ const: false, │ +│ Type.Number(), │ ? true │ type: 'boolean' │ +│ Type.Literal(true), │ : false │ } │ +│ Type.Literal(false) │ │ │ +│ ) │ │ │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Extract( │ type T = Extract< │ const T = { │ +│ Type.Union([ │ string | number, │ type: 'string' │ +│ Type.String(), │ string │ } │ +│ Type.Number(), │ > │ │ +│ ]), │ │ │ +│ Type.String() │ │ │ +│ ) │ │ │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Exclude( │ type T = Exclude< │ const T = { │ +│ Type.Union([ │ string | number, │ type: 'number' │ +│ Type.String(), │ string │ } │ +│ Type.Number(), │ > │ │ +│ ]), │ │ │ +│ Type.String() │ │ │ +│ ) │ │ │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Mapped( │ type T = { │ const T = { │ +│ Type.Union([ │ [_ in 'x' | 'y'] : number │ type: 'object', │ +│ Type.Literal('x'), │ } │ required: ['x', 'y'], │ +│ Type.Literal('y') │ │ properties: { │ +│ ]), │ │ x: { │ +│ () => Type.Number() │ │ type: 'number' │ +│ ) │ │ }, │ +│ │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const U = Type.Union([ │ type U = 'open' | 'close' │ const T = { │ +│ Type.Literal('open'), │ │ type: 'string', │ +│ Type.Literal('close') │ type T = `on${U}` │ pattern: '^on(open|close)$' │ +│ ]) │ │ } │ +│ │ │ │ +│ const T = Type │ │ │ +│ .TemplateLiteral([ │ │ │ +│ Type.Literal('on'), │ │ │ +│ U │ │ │ +│ ]) │ │ │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Record( │ type T = Record< │ const T = { │ +│ Type.String(), │ string, │ type: 'object', │ +│ Type.Number() │ number │ patternProperties: { │ +│ ) │ > │ '^.*$': { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Partial( │ type T = Partial<{ │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'object', │ +│ x: Type.Number(), │ y: number │ properties: { │ +│ y: Type.Number() | }> │ x: { │ +│ }) │ │ type: 'number' │ +│ ) │ │ }, │ +│ │ │ y: { │ +│ │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Required( │ type T = Required<{ │ const T = { │ +│ Type.Object({ │ x?: number, │ type: 'object', │ +│ x: Type.Optional( │ y?: number │ required: ['x', 'y'], │ +│ Type.Number() | }> │ properties: { │ +│ ), │ │ x: { │ +│ y: Type.Optional( │ │ type: 'number' │ +│ Type.Number() │ │ }, │ +│ ) │ │ y: { │ +│ }) │ │ type: 'number' │ +│ ) │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Pick( │ type T = Pick<{ │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'object', │ +│ x: Type.Number(), │ y: number │ required: ['x'], │ +│ y: Type.Number() │ }, 'x'> │ properties: { │ +│ }), ['x'] | │ x: { │ +│ ) │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Omit( │ type T = Omit<{ │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'object', │ +│ x: Type.Number(), │ y: number │ required: ['y'], │ +│ y: Type.Number() │ }, 'x'> │ properties: { │ +│ }), ['x'] | │ y: { │ +│ ) │ │ type: 'number' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Index( │ type T = { │ const T = { │ +│ Type.Object({ │ x: number, │ type: 'number' │ +│ x: Type.Number(), │ y: string │ } │ +│ y: Type.String() │ }['x'] │ │ +│ }), ['x'] │ │ │ +│ ) │ │ │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const A = Type.Tuple([ │ type A = [0, 1] │ const T = { │ +│ Type.Literal(0), │ type B = [2, 3] │ type: 'array', │ +│ Type.Literal(1) │ type T = [ │ items: [ │ +│ ]) │ ...A, │ { const: 0 }, │ +│ const B = Type.Tuple([ │ ...B │ { const: 1 }, │ +| Type.Literal(2), │ ] │ { const: 2 }, │ +| Type.Literal(3) │ │ { const: 3 } │ +│ ]) │ │ ], │ +│ const T = Type.Tuple([ │ │ additionalItems: false, │ +| ...Type.Rest(A), │ │ minItems: 4, │ +| ...Type.Rest(B) │ │ maxItems: 4 │ +│ ]) │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Uncapitalize( │ type T = Uncapitalize< │ const T = { │ +│ Type.Literal('Hello') │ 'Hello' │ type: 'string', │ +│ ) │ > │ const: 'hello' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Capitalize( │ type T = Capitalize< │ const T = { │ +│ Type.Literal('hello') │ 'hello' │ type: 'string', │ +│ ) │ > │ const: 'Hello' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Uppercase( │ type T = Uppercase< │ const T = { │ +│ Type.Literal('hello') │ 'hello' │ type: 'string', │ +│ ) │ > │ const: 'HELLO' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Lowercase( │ type T = Lowercase< │ const T = { │ +│ Type.Literal('HELLO') │ 'HELLO' │ type: 'string', │ +│ ) │ > │ const: 'hello' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const R = Type.Ref('T') │ type R = unknown │ const R = { $ref: 'T' } │ +│ │ │ │ +└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ +``` + + + +### JavaScript Types + +TypeBox provides an extended type set that can be used to create schematics for common JavaScript constructs. These types can not be used with any standard Json Schema validator; but can be used to frame schematics for interfaces that may receive Json validated data. JavaScript types are prefixed with the `[JavaScript]` JSDoc comment for convenience. The following table lists the supported types. + +```typescript +┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ +│ TypeBox │ TypeScript │ Extended Schema │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Constructor([ │ type T = new ( │ const T = { │ +│ Type.String(), │ arg0: string, │ type: 'Constructor', │ +│ Type.Number() │ arg0: number │ parameters: [{ │ +│ ], Type.Boolean()) │ ) => boolean │ type: 'string' │ +│ │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ }], │ +│ │ │ returns: { │ +│ │ │ type: 'boolean' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Function([ │ type T = ( │ const T = { │ +| Type.String(), │ arg0: string, │ type: 'Function', │ +│ Type.Number() │ arg1: number │ parameters: [{ │ +│ ], Type.Boolean()) │ ) => boolean │ type: 'string' │ +│ │ │ }, { │ +│ │ │ type: 'number' │ +│ │ │ }], │ +│ │ │ returns: { │ +│ │ │ type: 'boolean' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Promise( │ type T = Promise │ const T = { │ +│ Type.String() │ │ type: 'Promise', │ +│ ) │ │ item: { │ +│ │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = │ type T = │ const T = { │ +│ Type.AsyncIterator( │ AsyncIterableIterator< │ type: 'AsyncIterator', │ +│ Type.String() │ string │ items: { │ +│ ) │ > │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Iterator( │ type T = │ const T = { │ +│ Type.String() │ IterableIterator │ type: 'Iterator', │ +│ ) │ │ items: { │ +│ │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.RegExp(/abc/i) │ type T = string │ const T = { │ +│ │ │ type: 'RegExp' │ +│ │ │ source: 'abc' │ +│ │ │ flags: 'i' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Uint8Array() │ type T = Uint8Array │ const T = { │ +│ │ │ type: 'Uint8Array' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Date() │ type T = Date │ const T = { │ +│ │ │ type: 'Date' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Undefined() │ type T = undefined │ const T = { │ +│ │ │ type: 'undefined' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Symbol() │ type T = symbol │ const T = { │ +│ │ │ type: 'symbol' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.BigInt() │ type T = bigint │ const T = { │ +│ │ │ type: 'bigint' │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Void() │ type T = void │ const T = { │ +│ │ │ type: 'void' │ +│ │ │ } │ +│ │ │ │ +└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ +``` + + + +### Options + +You can pass Json Schema options on the last argument of any given type. Option hints specific to each type are provided for convenience. + +```typescript +// String must be an email +const T = Type.String({ // const T = { + format: 'email' // type: 'string', +}) // format: 'email' + // } + +// Number must be a multiple of 2 +const T = Type.Number({ // const T = { + multipleOf: 2 // type: 'number', +}) // multipleOf: 2 + // } + +// Array must have at least 5 integer values +const T = Type.Array(Type.Integer(), { // const T = { + minItems: 5 // type: 'array', +}) // minItems: 5, + // items: { + // type: 'integer' + // } + // } +``` + + + +### Properties + +Object properties can be modified with Readonly and Optional. The following table shows how these modifiers map between TypeScript and Json Schema. + +```typescript +┌────────────────────────────────┬─────────────────────────────┬────────────────────────────────┐ +│ TypeBox │ TypeScript │ Json Schema │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ name: Type.ReadonlyOptional( │ readonly name?: string │ type: 'object', │ +│ Type.String() │ } │ properties: { │ +│ ) │ │ name: { │ +│ }) │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ name: Type.Readonly( │ readonly name: string │ type: 'object', │ +│ Type.String() │ } │ properties: { │ +│ ) │ │ name: { │ +│ }) │ │ type: 'string' │ +│ │ │ } │ +│ │ │ }, │ +│ │ │ required: ['name'] │ +│ │ │ } │ +│ │ │ │ +├────────────────────────────────┼─────────────────────────────┼────────────────────────────────┤ +│ const T = Type.Object({ │ type T = { │ const T = { │ +│ name: Type.Optional( │ name?: string │ type: 'object', │ +│ Type.String() │ } │ properties: { │ +│ ) │ │ name: { │ +│ }) │ │ type: 'string' │ +│ │ │ } │ +│ │ │ } │ +│ │ │ } │ +│ │ │ │ +└────────────────────────────────┴─────────────────────────────┴────────────────────────────────┘ +``` + + + +### Generic Types + +Generic types can be created with generic functions. + +```typescript +const Nullable = (T: T) => { // type Nullable = T | null + return Type.Union([T, Type.Null()]) +} + +const T = Nullable(Type.String()) // type T = Nullable +``` + + + +### Recursive Types + +Use the Recursive function to create recursive types. + +```typescript +const Node = Type.Recursive(This => Type.Object({ // const Node = { + id: Type.String(), // $id: 'Node', + nodes: Type.Array(This) // type: 'object', +}), { $id: 'Node' }) // properties: { + // id: { + // type: 'string' + // }, + // nodes: { + // type: 'array', + // items: { + // $ref: 'Node' + // } + // } + // }, + // required: [ + // 'id', + // 'nodes' + // ] + // } + +type Node = Static // type Node = { + // id: string + // nodes: Node[] + // } + +function test(node: Node) { + const id = node.nodes[0].nodes[0].id // id is string +} +``` + + + +### Module Types + +Module types are containers for a set of referential types. Modules act as namespaces, enabling types to reference one another via string identifiers. Modules support both singular and mutually recursive references, as well as deferred dereferencing for computed types such as Partial. Types imported from a module are expressed using the Json Schema `$defs` keyword. + +```typescript +const Module = Type.Module({ + PartialUser: Type.Partial(Type.Ref('User')), // TComputed<'Partial', [TRef<'User'>]> + + User: Type.Object({ // TObject<{ + id: Type.String(), // user: TString, + name: Type.String(), // name: TString, + email: Type.String() // email: TString + }), // }> +}) +const User = Module.Import('User') // const User: TImport<{...}, 'User'> + +type User = Static // type User = { + // id: string, + // name: string, + // email: string + // } + +const PartialUser = Module.Import('PartialUser') // const PartialUser: TImport<{...}, 'PartialUser'> + +type PartialUser = Static // type PartialUser = { + // id?: string, + // name?: string, + // email?: string + // } +``` + + + +### Template Literal Types + +TypeBox supports template literal types with the TemplateLiteral function. This type can be created using a syntax similar to the TypeScript template literal syntax or composed from exterior types. TypeBox encodes template literals as regular expressions which enables the template to be checked by Json Schema validators. This type also supports regular expression parsing that enables template patterns to be used for generative types. The following shows both TypeScript and TypeBox usage. + +```typescript +// TypeScript + +type K = `prop${'A'|'B'|'C'}` // type T = 'propA' | 'propB' | 'propC' + +type R = Record // type R = { + // propA: string + // propB: string + // propC: string + // } + +// TypeBox + +const K = Type.TemplateLiteral('prop${A|B|C}') // const K: TTemplateLiteral<[ + // TLiteral<'prop'>, + // TUnion<[ + // TLiteral<'A'>, + // TLiteral<'B'>, + // TLiteral<'C'>, + // ]> + // ]> + +const R = Type.Record(K, Type.String()) // const R: TObject<{ + // propA: TString, + // propB: TString, + // propC: TString, + // }> +``` + + + +### Indexed Access Types + +TypeBox supports indexed access types with the Index function. This function enables uniform access to interior property and element types without having to extract them from the underlying schema representation. Index types are supported for Object, Array, Tuple, Union and Intersect types. + +```typescript +const T = Type.Object({ // type T = { + x: Type.Number(), // x: number, + y: Type.String(), // y: string, + z: Type.Boolean() // z: boolean +}) // } + +const A = Type.Index(T, ['x']) // type A = T['x'] + // + // ... evaluated as + // + // const A: TNumber + +const B = Type.Index(T, ['x', 'y']) // type B = T['x' | 'y'] + // + // ... evaluated as + // + // const B: TUnion<[ + // TNumber, + // TString, + // ]> + +const C = Type.Index(T, Type.KeyOf(T)) // type C = T[keyof T] + // + // ... evaluated as + // + // const C: TUnion<[ + // TNumber, + // TString, + // TBoolean + // ]> +``` + + + +### Mapped Types + +TypeBox supports mapped types with the Mapped function. This function accepts two arguments, the first is a union type typically derived from KeyOf, the second is a mapping function that receives a mapping key `K` that can be used to index properties of a type. The following implements a mapped type that remaps each property to be `T | null`. + +```typescript +const T = Type.Object({ // type T = { + x: Type.Number(), // x: number, + y: Type.String(), // y: string, + z: Type.Boolean() // z: boolean +}) // } + +const M = Type.Mapped(Type.KeyOf(T), K => { // type M = { [K in keyof T]: T[K] | null } + return Type.Union([Type.Index(T, K), Type.Null()]) // +}) // ... evaluated as + // + // const M: TObject<{ + // x: TUnion<[TNumber, TNull]>, + // y: TUnion<[TString, TNull]>, + // z: TUnion<[TBoolean, TNull]> + // }> +``` + + + +### Conditional Types + +TypeBox supports runtime conditional types with the Extends function. This function performs a structural assignability check against the first (`left`) and second (`right`) arguments and will return either the third (`true`) or fourth (`false`) argument based on the result. The conditional types Exclude and Extract are also supported. The following shows both TypeScript and TypeBox examples of conditional types. + +```typescript +// Extends +const A = Type.Extends( // type A = string extends number ? 1 : 2 + Type.String(), // + Type.Number(), // ... evaluated as + Type.Literal(1), // + Type.Literal(2) // const A: TLiteral<2> +) + +// Extract +const B = Type.Extract( // type B = Extract<1 | 2 | 3, 1> + Type.Union([ // + Type.Literal(1), // ... evaluated as + Type.Literal(2), // + Type.Literal(3) // const B: TLiteral<1> + ]), + Type.Literal(1) +) + +// Exclude +const C = Type.Exclude( // type C = Exclude<1 | 2 | 3, 1> + Type.Union([ // + Type.Literal(1), // ... evaluated as + Type.Literal(2), // + Type.Literal(3) // const C: TUnion<[ + ]), // TLiteral<2>, + Type.Literal(1) // TLiteral<3>, +) // ]> +``` + + + +### Transform Types + +TypeBox supports value decoding and encoding with Transform types. These types work in tandem with the Encode and Decode functions available on the Value and TypeCompiler submodules. Transform types can be used to convert Json encoded values into constructs more natural to JavaScript. The following creates a Transform type to decode numbers into Dates using the Value submodule. + +```typescript +import { Value } from '@sinclair/typebox/value' + +const T = Type.Transform(Type.Number()) + .Decode(value => new Date(value)) // decode: number to Date + .Encode(value => value.getTime()) // encode: Date to number + +const D = Value.Decode(T, 0) // const D = Date(1970-01-01T00:00:00.000Z) +const E = Value.Encode(T, D) // const E = 0 +``` +Use the StaticEncode or StaticDecode types to infer a Transform type. +```typescript +import { Static, StaticDecode, StaticEncode } from '@sinclair/typebox' + +const T = Type.Transform(Type.Array(Type.Number(), { uniqueItems: true })) + .Decode(value => new Set(value)) + .Encode(value => [...value]) + +type D = StaticDecode // type D = Set +type E = StaticEncode // type E = Array +type T = Static // type T = Array +``` + + + +### Unsafe Types + +TypeBox supports user defined types with Unsafe. This type allows you to specify both schema representation and inference type. The following creates an Unsafe type with a number schema that infers as string. + +```typescript +const T = Type.Unsafe({ type: 'number' }) // const T = { type: 'number' } + +type T = Static // type T = string - ? +``` +The Unsafe type is often used to create schematics for extended specifications like OpenAPI. +```typescript + +const Nullable = (schema: T) => Type.Unsafe | null>({ + ...schema, nullable: true +}) + +const T = Nullable(Type.String()) // const T = { + // type: 'string', + // nullable: true + // } + +type T = Static // type T = string | null + +const StringEnum = (values: [...T]) => Type.Unsafe({ + type: 'string', enum: values +}) +const S = StringEnum(['A', 'B', 'C']) // const S = { + // enum: ['A', 'B', 'C'] + // } + +type S = Static // type S = 'A' | 'B' | 'C' +``` + + +### TypeGuard + +TypeBox can check its own types with the TypeGuard module. This module is written for type introspection and provides structural tests for every built-in TypeBox type. Functions of this module return `is` guards which can be used with control flow assertions to obtain schema inference for unknown values. The following guards that the value `T` is TString. + +```typescript +import { TypeGuard, Kind } from '@sinclair/typebox' + +const T = { [Kind]: 'String', type: 'string' } + +if(TypeGuard.IsString(T)) { + + // T is TString +} +``` + + + +## Values + +TypeBox provides an optional Value submodule that can be used to perform structural operations on JavaScript values. This submodule includes functionality to create, check and cast values from types as well as check equality, clone, diff and patch JavaScript values. This submodule is provided via optional import. + +```typescript +import { Value } from '@sinclair/typebox/value' +``` + + + +### Assert + +Use the Assert function to assert a value is valid. + +```typescript +let value: unknown = 1 + +Value.Assert(Type.Number(), value) // throws AssertError if invalid +``` + + + +### Create + +Use the Create function to create a value from a type. TypeBox will use default values if specified. + +```typescript +const T = Type.Object({ x: Type.Number(), y: Type.Number({ default: 42 }) }) + +const A = Value.Create(T) // const A = { x: 0, y: 42 } +``` + + + +### Clone + +Use the Clone function to deeply clone a value. + +```typescript +const A = Value.Clone({ x: 1, y: 2, z: 3 }) // const A = { x: 1, y: 2, z: 3 } +``` + + + +### Check + +Use the Check function to type check a value. + +```typescript +const T = Type.Object({ x: Type.Number() }) + +const R = Value.Check(T, { x: 1 }) // const R = true +``` + + + +### Convert + +Use the Convert function to convert a value into its target type if a reasonable conversion is possible. This function may return an invalid value and should be checked before use. Its return type is `unknown`. + +```typescript +const T = Type.Object({ x: Type.Number() }) + +const R1 = Value.Convert(T, { x: '3.14' }) // const R1 = { x: 3.14 } + +const R2 = Value.Convert(T, { x: 'not a number' }) // const R2 = { x: 'not a number' } +``` + + + +### Clean + +Use Clean to remove excess properties from a value. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. + +```typescript +const T = Type.Object({ + x: Type.Number(), + y: Type.Number() +}) + +const X = Value.Clean(T, null) // const 'X = null + +const Y = Value.Clean(T, { x: 1 }) // const 'Y = { x: 1 } + +const Z = Value.Clean(T, { x: 1, y: 2, z: 3 }) // const 'Z = { x: 1, y: 2 } +``` + + + +### Default + +Use Default to generate missing properties on a value using default schema annotations if available. This function does not check the value and returns an unknown type. You should Check the result before use. Default is a mutable operation. To avoid mutation, Clone the value first. + +```typescript +const T = Type.Object({ + x: Type.Number({ default: 0 }), + y: Type.Number({ default: 0 }) +}) + +const X = Value.Default(T, null) // const 'X = null - non-enumerable + +const Y = Value.Default(T, { }) // const 'Y = { x: 0, y: 0 } + +const Z = Value.Default(T, { x: 1 }) // const 'Z = { x: 1, y: 0 } +``` + + + +### Cast + +Use the Cast function to upcast a value into a target type. This function will retain as much information as possible from the original value. The Cast function is intended to be used in data migration scenarios where existing values need to be upgraded to match a modified type. + +```typescript +const T = Type.Object({ x: Type.Number(), y: Type.Number() }, { additionalProperties: false }) + +const X = Value.Cast(T, null) // const X = { x: 0, y: 0 } + +const Y = Value.Cast(T, { x: 1 }) // const Y = { x: 1, y: 0 } + +const Z = Value.Cast(T, { x: 1, y: 2, z: 3 }) // const Z = { x: 1, y: 2 } +``` + + + +### Decode + +Use the Decode function to decode a value from a type or throw if the value is invalid. The return value will infer as the decoded type. This function will run Transform codecs if available. + +```typescript +const A = Value.Decode(Type.String(), 'hello') // const A = 'hello' + +const B = Value.Decode(Type.String(), 42) // throw +``` + + +### Encode + +Use the Encode function to encode a value to a type or throw if the value is invalid. The return value will infer as the encoded type. This function will run Transform codecs if available. + +```typescript +const A = Value.Encode(Type.String(), 'hello') // const A = 'hello' + +const B = Value.Encode(Type.String(), 42) // throw +``` + + + +### Parse + +Use the Parse function to parse a value. This function calls the `Clone` `Clean`, `Default`, `Convert`, `Assert` and `Decode` Value functions in this exact order to process a value. + +```typescript +const R = Value.Parse(Type.String(), 'hello') // const R: string = "hello" + +const E = Value.Parse(Type.String(), undefined) // throws AssertError +``` + +You can override the order in which functions are run, or omit functions entirely using the following. + +```typescript +// Runs no functions. + +const R = Value.Parse([], Type.String(), 12345) + +// Runs the Assert() function. + +const E = Value.Parse(['Assert'], Type.String(), 12345) + +// Runs the Convert() function followed by the Assert() function. + +const S = Value.Parse(['Convert', 'Assert'], Type.String(), 12345) +``` + + + +### Equal + +Use the Equal function to deeply check for value equality. + +```typescript +const R = Value.Equal( // const R = true + { x: 1, y: 2, z: 3 }, + { x: 1, y: 2, z: 3 } +) +``` + + + +### Hash + +Use the Hash function to create a [FNV1A-64](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) non-cryptographic hash of a value. + +```typescript +const A = Value.Hash({ x: 1, y: 2, z: 3 }) // const A = 2910466848807138541n + +const B = Value.Hash({ x: 1, y: 4, z: 3 }) // const B = 1418369778807423581n +``` + + + +### Diff + +Use the Diff function to generate a sequence of edits that will transform one value into another. + +```typescript +const E = Value.Diff( // const E = [ + { x: 1, y: 2, z: 3 }, // { type: 'update', path: '/y', value: 4 }, + { y: 4, z: 5, w: 6 } // { type: 'update', path: '/z', value: 5 }, +) // { type: 'insert', path: '/w', value: 6 }, + // { type: 'delete', path: '/x' } + // ] +``` + + + +### Patch + +Use the Patch function to apply a sequence of edits. + +```typescript +const A = { x: 1, y: 2 } + +const B = { x: 3 } + +const E = Value.Diff(A, B) // const E = [ + // { type: 'update', path: '/x', value: 3 }, + // { type: 'delete', path: '/y' } + // ] + +const C = Value.Patch(A, E) // const C = { x: 3 } +``` + + + +### Errors + +Use the Errors function to enumerate validation errors. + +```typescript +const T = Type.Object({ x: Type.Number(), y: Type.Number() }) + +const R = [...Value.Errors(T, { x: '42' })] // const R = [{ + // schema: { type: 'number' }, + // path: '/x', + // value: '42', + // message: 'Expected number' + // }, { + // schema: { type: 'number' }, + // path: '/y', + // value: undefined, + // message: 'Expected number' + // }] +``` + + + +### Mutate + +Use the Mutate function to perform a deep mutable value assignment while retaining internal references. + +```typescript +const Y = { z: 1 } // const Y = { z: 1 } +const X = { y: Y } // const X = { y: { z: 1 } } +const A = { x: X } // const A = { x: { y: { z: 1 } } } + +Value.Mutate(A, { x: { y: { z: 2 } } }) // A' = { x: { y: { z: 2 } } } + +const R0 = A.x.y.z === 2 // const R0 = true +const R1 = A.x.y === Y // const R1 = true +const R2 = A.x === X // const R2 = true +``` + + + +### Pointer + +Use ValuePointer to perform mutable updates on existing values using [RFC6901](https://www.rfc-editor.org/rfc/rfc6901) Json Pointers. + +```typescript +import { ValuePointer } from '@sinclair/typebox/value' + +const A = { x: 0, y: 0, z: 0 } + +ValuePointer.Set(A, '/x', 1) // A' = { x: 1, y: 0, z: 0 } +ValuePointer.Set(A, '/y', 1) // A' = { x: 1, y: 1, z: 0 } +ValuePointer.Set(A, '/z', 1) // A' = { x: 1, y: 1, z: 1 } +``` + + + + + +## Syntax Types + +TypeBox provides experimental support for parsing TypeScript annotation syntax into TypeBox types. + +This feature is provided via optional import. + +```typescript +import { Syntax } from '@sinclair/typebox/syntax' +``` + + + +### Create + +Use the Syntax function to create TypeBox types from TypeScript syntax ([Example](https://www.typescriptlang.org/play/?moduleResolution=99&module=199&ts=5.8.0-beta#code/JYWwDg9gTgLgBAbzgZQJ4DsYEMAecC+cAZlBCHAOQACAzsOgMYA2WwUA9DKmAKYBGEHOxoZsOCgChQkWIhTYYwBgWKly1OoxZtO3foMkSGEdDXgAVOAF4Uo3AAoABkhwAuOOgCuIPjygAaOFR3Lx8-AkcASjgY2Jj2djhjUwt3cwB5PgArHgYYAB4ECTiS0rLyisrYhNi3OHMAOW9fAOKq9o7OuBqY4PqmsKg2rpHR+MT8AD4JCS5eeut5LEUGfLmeCCJ6ybHKmvWFmyLdk86euDrQlv9h07uy876rv1v7t-GCIA)) + +```typescript +const T = Syntax(`{ x: number, y: number }`) // const T: TObject<{ + // x: TNumber, + // y: TNumber + // }> + +type T = Static // type T = { + // x: number, + // y: number + // } +``` + + + +### Parameters + +Syntax types can be parameterized to receive exterior types ([Example](https://www.typescriptlang.org/play/?moduleResolution=99&module=199&ts=5.8.0-beta#code/JYWwDg9gTgLgBAbzgZQJ4DsYEMAecC+cAZlBCHAOQACAzsOgMYA2WwUA9DKmAKYBGEHOxoZsOCgCgJDCOhrwAKnAC8KUbgAUAAyQ4AXHHQBXEHx5QANHFQHjp8wS0BKOK7ev27ODLmKDCgHk+ACseBhgAHgQJd1i4+ITEpLdPN304BQA5EzNLGOSCwqK4VNcbDOz7KHzi2rqPL3wAPikfeRQVNUxNJCV8Ky0ABSxYYCwmCIUm52LUtvhkfyDQ8Kia+o2C0rh0wLAYYFlxycrcpot1zav47fK9g6OJrJzzFuv3m8amoA)) + +```typescript +const T = Syntax(`{ x: number, y: number }`) // const T: TObject<{ + // x: TNumber, + // y: TNumber + // }> + +const S = Syntax({ T }, `Partial`) // const S: TObject<{ + // x: TOptional, + // y: TOptional + // }> +``` + + + + + +### Generics + +Syntax types support generic parameters in the following way ([Example](https://www.typescriptlang.org/play/?moduleResolution=99&module=199&ts=5.8.0-beta#code/JYWwDg9gTgLgBAbzgZQJ4DsYEMAecC+cAZlBCHAOQACAzsOgMYA2WwUA9DKmAKYBGEHOxoZsOCgChQkWIhTYYwBgWKly1OoxZtO3foMkSGEdDXgA1HgxjQ4AXhSjcACgAGAHgAaAGjgBNXwAtAD45CTg4HAAuOB84cLhUGID4iIAvGMD4-FcASgkjEzM4ACEsOhpLa2gae0dMFyQqmygCX1cEBOi4Zuh3AEZfAAZh4O8EpJ6rFvcRuEG4IbGEjKnqqFnh337lnPyJLl5S8uBK6Zq65AUld0OeCCJjit6oGlCIiPZ2ODun05fag5Oh8QaCweCIZCoV8Pt0kN0FpM5qshm0ElCMZisSCYRFJvCYnNJgsUWjseSKeDcXBVgTFr4kb5Vv0COjKezsTD8EA)) + +```typescript +const Vector = Syntax(` { + x: X, + y: Y, + z: Z +}`) + +const BasisVectors = Syntax({ Vector }, `{ + x: Vector<1, 0, 0>, + y: Vector<0, 1, 0>, + z: Vector<0, 0, 1>, +}`) + +type BasisVectors = Static // type BasisVectors = { + // x: { x: 1, y: 0, z: 0 }, + // y: { x: 0, y: 1, z: 0 }, + // z: { x: 0, y: 0, z: 1 } + // } +``` + + + +### Options + +Options can be passed via the last parameter. + +```typescript +const T = Syntax(`number`, { minimum: 42 }) // const T = { + // type: 'number', + // minimum: 42 + // } +``` + + + +### NoInfer + +Syntax parsing is an expensive type level operation and can impact on language service performance. Use the NoInfer function parse syntax at runtime only. + +```typescript +import { NoInfer } from '@sinclair/typebox/syntax' + +const T = NoInfer(`number | string`) // const T: TSchema = { + // anyOf: [ + // { type: 'number' }, + // { type: 'string' } + // ] + // } +``` + + + +## TypeRegistry + +The TypeBox type system can be extended with additional types and formats using the TypeRegistry and FormatRegistry modules. These modules integrate deeply with TypeBox's internal type checking infrastructure and can be used to create application specific types, or register schematics for alternative specifications. + + + +### TypeRegistry + +Use the TypeRegistry to register a type. The Kind must match the registered type name. + +```typescript +import { TSchema, Kind, TypeRegistry } from '@sinclair/typebox' + +TypeRegistry.Set('Foo', (schema, value) => value === 'foo') + +const Foo = { [Kind]: 'Foo' } as TSchema + +const A = Value.Check(Foo, 'foo') // const A = true + +const B = Value.Check(Foo, 'bar') // const B = false +``` + + + +### FormatRegistry + +Use the FormatRegistry to register a string format. + +```typescript +import { FormatRegistry } from '@sinclair/typebox' + +FormatRegistry.Set('foo', (value) => value === 'foo') + +const T = Type.String({ format: 'foo' }) + +const A = Value.Check(T, 'foo') // const A = true + +const B = Value.Check(T, 'bar') // const B = false +``` + + + +## TypeCheck + +TypeBox types target Json Schema Draft 7 and are compatible with any validator that supports this specification. TypeBox also provides a built-in type checking compiler designed specifically for TypeBox types that offers high performance compilation and value checking. + +The following sections detail using Ajv and the TypeBox compiler infrastructure. + + + +## Ajv + +The following shows the recommended setup for Ajv. + +```bash +$ npm install ajv ajv-formats --save +``` + +```typescript +import { Type } from '@sinclair/typebox' +import addFormats from 'ajv-formats' +import Ajv from 'ajv' + +const ajv = addFormats(new Ajv({}), [ + 'date-time', + 'time', + 'date', + 'email', + 'hostname', + 'ipv4', + 'ipv6', + 'uri', + 'uri-reference', + 'uuid', + 'uri-template', + 'json-pointer', + 'relative-json-pointer', + 'regex' +]) + +const validate = ajv.compile(Type.Object({ + x: Type.Number(), + y: Type.Number(), + z: Type.Number() +})) + +const R = validate({ x: 1, y: 2, z: 3 }) // const R = true +``` + + + +### TypeCompiler + +The TypeBox TypeCompiler is a high performance JIT validation compiler that transforms TypeBox types into optimized JavaScript validation routines. The compiler is tuned for fast compilation as well as fast value assertion. It is built to serve as a validation backend that can be integrated into larger applications. It can also be used for code generation. + +The TypeCompiler is provided as an optional import. + +```typescript +import { TypeCompiler } from '@sinclair/typebox/compiler' +``` + +Use the Compile function to JIT compile a type. Note that compilation is generally an expensive operation and should only be performed once per type during application start up. TypeBox does not cache previously compiled types, and applications are expected to hold references to each compiled type for the lifetime of the application. + +```typescript +const C = TypeCompiler.Compile(Type.Object({ // const C: TypeCheck> + +const R = C.Check({ x: 1, y: 2, z: 3 }) // const R = true +``` + +Use the Errors function to generate diagnostic errors for a value. The Errors function will return an iterator that when enumerated; will perform an exhaustive check across the entire value yielding any error found. For performance, this function should only be called after a failed Check. Applications may also choose to yield only the first value to avoid exhaustive error generation. + +```typescript +const C = TypeCompiler.Compile(Type.Object({ // const C: TypeCheck> + +const value = { } + +const first = C.Errors(value).First() // const first = { + // schema: { type: 'number' }, + // path: '/x', + // value: undefined, + // message: 'Expected number' + // } + +const all = [...C.Errors(value)] // const all = [{ + // schema: { type: 'number' }, + // path: '/x', + // value: undefined, + // message: 'Expected number' + // }, { + // schema: { type: 'number' }, + // path: '/y', + // value: undefined, + // message: 'Expected number' + // }, { + // schema: { type: 'number' }, + // path: '/z', + // value: undefined, + // message: 'Expected number' + // }] +``` + +Use the Code function to generate assertion functions as strings. This function can be used to generate code that can be written to disk as importable modules. This technique is sometimes referred to as Ahead of Time (AOT) compilation. The following generates code to check a string. + +```typescript +const C = TypeCompiler.Code(Type.String()) // const C = `return function check(value) { + // return ( + // (typeof value === 'string') + // ) + // }` +``` + + + +## TypeMap + +TypeBox offers an external package for bidirectional mapping between TypeBox, Valibot, and Zod type libraries. It also includes syntax parsing support for Valibot and Zod and supports the Standard Schema specification. For more details on TypeMap, refer to the project repository. + +[TypeMap Repository](https://github.com/sinclairzx81/typemap) + + + +### Usage + +TypeMap needs to be installed separately + +```bash +$ npm install @sinclair/typemap +``` + +Once installed it offers advanced structural remapping between various runtime type libraries ([Example](https://www.typescriptlang.org/play/?moduleResolution=99&module=199&ts=5.8.0-beta#code/JYWwDg9gTgLgBAbzgFQJ5gKYCEIA8A0cAyqgHYwCGBcAWhACZwC+cAZlBCHAOQACAzsFIBjADYVgUAPQx0GEBTDcAUMuERS-eMjgBeFHJy4AFAAMkuAFxxSAVxAAjDFEKprdx88IAvd-adQzKYAlHBwUlJw6pra1sgA8g4AVhjCMAA8CMphObl5+QWFRcW5ETlWKABy-s4A3NkljU3NBWVhblU1UPUtvX3FbXC+nZ7dDf0TE2VMAHyq0VrEesRklCbIoS1lC-BE1twWfqOuRwE+p87MKmoaiwBKy3T0xkTBAHRgFFD8GMZ2oqJNnltrd4HdrFlJltImEKh4Aj0oU1Bh14XVxkiBjChhcxpjGtMwkA)) + +```typescript +import { TypeBox, Syntax, Zod } from '@sinclair/typemap' + +const T = TypeBox(`{ x: number, y: number, z: number }`) // const T: TObject<{ + // x: TNumber; + // y: TNumber; + // z: TNumber; + // }> + +const S = Syntax(T) // const S: '{ x: number, y: number, z: number }' + +const R = Zod(S).parse(null) // const R: { + // x: number; + // y: number; + // z: number; + // } +``` + + + +## TypeSystem + +The TypeBox TypeSystem module provides configurations to use either Json Schema or TypeScript type checking semantics. Configurations made to the TypeSystem module are observed by the TypeCompiler, Value and Error modules. + + + +### Policies + +TypeBox validates using standard Json Schema assertion policies by default. The TypeSystemPolicy module can override some of these to have TypeBox assert values inline with TypeScript static checks. It also provides overrides for certain checking rules related to non-serializable values (such as void) which can be helpful in Json based protocols such as Json Rpc 2.0. + +The following overrides are available. + +```typescript +import { TypeSystemPolicy } from '@sinclair/typebox/system' + +// Disallow undefined values for optional properties (default is false) +// +// const A: { x?: number } = { x: undefined } - disallowed when enabled + +TypeSystemPolicy.ExactOptionalPropertyTypes = true + +// Allow arrays to validate as object types (default is false) +// +// const A: {} = [] - allowed in TS + +TypeSystemPolicy.AllowArrayObject = true + +// Allow numeric values to be NaN or + or - Infinity (default is false) +// +// const A: number = NaN - allowed in TS + +TypeSystemPolicy.AllowNaN = true + +// Allow void types to check with undefined and null (default is false) +// +// Used to signal void return on Json-Rpc 2.0 protocol + +TypeSystemPolicy.AllowNullVoid = true +``` + + + +## Error Function + +Error messages in TypeBox can be customized by defining an ErrorFunction. This function allows for the localization of error messages as well as enabling custom error messages for custom types. By default, TypeBox will generate messages using the `en-US` locale. To support additional locales, you can replicate the function found in `src/errors/function.ts` and create a locale specific translation. The function can then be set via SetErrorFunction. + +The following example shows an inline error function that intercepts errors for String, Number and Boolean only. The DefaultErrorFunction is used to return a default error message. + + +```typescript +import { SetErrorFunction, DefaultErrorFunction, ValueErrorType } from '@sinclair/typebox/errors' + +SetErrorFunction((error) => { // i18n override + switch(error.errorType) { + /* en-US */ case ValueErrorType.String: return 'Expected string' + /* fr-FR */ case ValueErrorType.Number: return 'Nombre attendu' + /* ko-KR */ case ValueErrorType.Boolean: return '예상 부울' + /* en-US */ default: return DefaultErrorFunction(error) + } +}) +const T = Type.Object({ // const T: TObject<{ + x: Type.String(), // TString, + y: Type.Number(), // TNumber, + z: Type.Boolean() // TBoolean +}) // }> + +const E = [...Value.Errors(T, { // const E = [{ + x: null, // type: 48, + y: null, // schema: { ... }, + z: null // path: '/x', +})] // value: null, + // message: 'Expected string' + // }, { + // type: 34, + // schema: { ... }, + // path: '/y', + // value: null, + // message: 'Nombre attendu' + // }, { + // type: 14, + // schema: { ... }, + // path: '/z', + // value: null, + // message: '예상 부울' + // }] +``` + + + +## TypeBox Workbench + +TypeBox offers a web based code generation tool that can convert TypeScript types into TypeBox types as well as several other ecosystem libraries. + +[TypeBox Workbench Link Here](https://sinclairzx81.github.io/typebox-workbench/) + + + +## TypeBox Codegen + +TypeBox provides a code generation library that can be integrated into toolchains to automate type translation between TypeScript and TypeBox. This library also includes functionality to transform TypeScript types to other ecosystem libraries. + +[TypeBox Codegen Link Here](https://github.com/sinclairzx81/typebox-codegen) + + + +## Ecosystem + +The following is a list of community packages that offer general tooling, extended functionality and framework integration support for TypeBox. + +| Package | Description | +| ------------- | ------------- | +| [drizzle-typebox](https://www.npmjs.com/package/drizzle-typebox) | Generates TypeBox types from Drizzle ORM schemas | +| [elysia](https://github.com/elysiajs/elysia) | Fast and friendly Bun web framework | +| [fastify-type-provider-typebox](https://github.com/fastify/fastify-type-provider-typebox) | Fastify TypeBox integration with the Fastify Type Provider | +| [feathersjs](https://github.com/feathersjs/feathers) | The API and real-time application framework | +| [fetch-typebox](https://github.com/erfanium/fetch-typebox) | Drop-in replacement for fetch that brings easy integration with TypeBox | +| [@lonli-lokli/fetcher-typebox](https://github.com/Lonli-Lokli/fetcher-ts/tree/master/packages/fetcher-typebox) | A strongly-typed fetch wrapper for TypeScript applications with optional runtime validation using TypeBox | +| [h3-typebox](https://github.com/kevinmarrec/h3-typebox) | Schema validation utilities for h3 using TypeBox & Ajv | +| [http-wizard](https://github.com/flodlc/http-wizard) | Type safe http client library for Fastify | +| [json2typebox](https://github.com/hacxy/json2typebox) | Creating TypeBox code from Json Data | +| [nominal-typebox](https://github.com/Coder-Spirit/nominal/tree/main/%40coderspirit/nominal-typebox) | Allows devs to integrate nominal types into TypeBox schemas | +| [openapi-box](https://github.com/geut/openapi-box) | Generate TypeBox types from OpenApi IDL + Http client library | +| [prismabox](https://github.com/m1212e/prismabox) | Converts a prisma.schema to TypeBox schema matching the database models | +| [schema2typebox](https://github.com/xddq/schema2typebox) | Creating TypeBox code from Json Schemas | +| [sveltekit-superforms](https://github.com/ciscoheat/sveltekit-superforms) | A comprehensive SvelteKit form library for server and client validation | +| [ts2typebox](https://github.com/xddq/ts2typebox) | Creating TypeBox code from Typescript types | +| [typebox-cli](https://github.com/gsuess/typebox-cli) | Generate Schema with TypeBox from the CLI | +| [typebox-form-parser](https://github.com/jtlapp/typebox-form-parser) | Parses form and query data based on TypeBox schemas | +| [typebox-schema-faker](https://github.com/iam-medvedev/typebox-schema-faker) | Generate fake data from TypeBox schemas for testing, prototyping and development | + + + + +## Benchmark + +This project maintains a set of benchmarks that measure Ajv, Value and TypeCompiler compilation and validation performance. These benchmarks can be run locally by cloning this repository and running `npm run benchmark`. The results below show for Ajv version 8.12.0 running on Node 20.10.0. + +For additional comparative benchmarks, please refer to [typescript-runtime-type-benchmarks](https://moltar.github.io/typescript-runtime-type-benchmarks/). + + + +### Compile + +This benchmark measures compilation performance for varying types. + +```typescript +┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┐ +│ (index) │ Iterations │ Ajv │ TypeCompiler │ Performance │ +├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┤ +│ Literal_String │ 1000 │ ' 211 ms' │ ' 8 ms' │ ' 26.38 x' │ +│ Literal_Number │ 1000 │ ' 185 ms' │ ' 5 ms' │ ' 37.00 x' │ +│ Literal_Boolean │ 1000 │ ' 195 ms' │ ' 4 ms' │ ' 48.75 x' │ +│ Primitive_Number │ 1000 │ ' 149 ms' │ ' 7 ms' │ ' 21.29 x' │ +│ Primitive_String │ 1000 │ ' 135 ms' │ ' 5 ms' │ ' 27.00 x' │ +│ Primitive_String_Pattern │ 1000 │ ' 193 ms' │ ' 10 ms' │ ' 19.30 x' │ +│ Primitive_Boolean │ 1000 │ ' 152 ms' │ ' 4 ms' │ ' 38.00 x' │ +│ Primitive_Null │ 1000 │ ' 147 ms' │ ' 4 ms' │ ' 36.75 x' │ +│ Object_Unconstrained │ 1000 │ ' 1065 ms' │ ' 26 ms' │ ' 40.96 x' │ +│ Object_Constrained │ 1000 │ ' 1183 ms' │ ' 26 ms' │ ' 45.50 x' │ +│ Object_Vector3 │ 1000 │ ' 407 ms' │ ' 9 ms' │ ' 45.22 x' │ +│ Object_Box3D │ 1000 │ ' 1777 ms' │ ' 24 ms' │ ' 74.04 x' │ +│ Tuple_Primitive │ 1000 │ ' 485 ms' │ ' 11 ms' │ ' 44.09 x' │ +│ Tuple_Object │ 1000 │ ' 1344 ms' │ ' 17 ms' │ ' 79.06 x' │ +│ Composite_Intersect │ 1000 │ ' 606 ms' │ ' 14 ms' │ ' 43.29 x' │ +│ Composite_Union │ 1000 │ ' 522 ms' │ ' 17 ms' │ ' 30.71 x' │ +│ Math_Vector4 │ 1000 │ ' 851 ms' │ ' 9 ms' │ ' 94.56 x' │ +│ Math_Matrix4 │ 1000 │ ' 406 ms' │ ' 10 ms' │ ' 40.60 x' │ +│ Array_Primitive_Number │ 1000 │ ' 367 ms' │ ' 6 ms' │ ' 61.17 x' │ +│ Array_Primitive_String │ 1000 │ ' 339 ms' │ ' 7 ms' │ ' 48.43 x' │ +│ Array_Primitive_Boolean │ 1000 │ ' 325 ms' │ ' 5 ms' │ ' 65.00 x' │ +│ Array_Object_Unconstrained │ 1000 │ ' 1863 ms' │ ' 21 ms' │ ' 88.71 x' │ +│ Array_Object_Constrained │ 1000 │ ' 1535 ms' │ ' 18 ms' │ ' 85.28 x' │ +│ Array_Tuple_Primitive │ 1000 │ ' 829 ms' │ ' 14 ms' │ ' 59.21 x' │ +│ Array_Tuple_Object │ 1000 │ ' 1674 ms' │ ' 14 ms' │ ' 119.57 x' │ +│ Array_Composite_Intersect │ 1000 │ ' 789 ms' │ ' 13 ms' │ ' 60.69 x' │ +│ Array_Composite_Union │ 1000 │ ' 822 ms' │ ' 15 ms' │ ' 54.80 x' │ +│ Array_Math_Vector4 │ 1000 │ ' 1129 ms' │ ' 14 ms' │ ' 80.64 x' │ +│ Array_Math_Matrix4 │ 1000 │ ' 673 ms' │ ' 9 ms' │ ' 74.78 x' │ +└────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┘ +``` + + + +### Validate + +This benchmark measures validation performance for varying types. + +```typescript +┌────────────────────────────┬────────────┬──────────────┬──────────────┬──────────────┬──────────────┐ +│ (index) │ Iterations │ ValueCheck │ Ajv │ TypeCompiler │ Performance │ +├────────────────────────────┼────────────┼──────────────┼──────────────┼──────────────┼──────────────┤ +│ Literal_String │ 1000000 │ ' 17 ms' │ ' 5 ms' │ ' 5 ms' │ ' 1.00 x' │ +│ Literal_Number │ 1000000 │ ' 14 ms' │ ' 18 ms' │ ' 9 ms' │ ' 2.00 x' │ +│ Literal_Boolean │ 1000000 │ ' 14 ms' │ ' 20 ms' │ ' 9 ms' │ ' 2.22 x' │ +│ Primitive_Number │ 1000000 │ ' 17 ms' │ ' 19 ms' │ ' 9 ms' │ ' 2.11 x' │ +│ Primitive_String │ 1000000 │ ' 17 ms' │ ' 18 ms' │ ' 10 ms' │ ' 1.80 x' │ +│ Primitive_String_Pattern │ 1000000 │ ' 172 ms' │ ' 46 ms' │ ' 41 ms' │ ' 1.12 x' │ +│ Primitive_Boolean │ 1000000 │ ' 14 ms' │ ' 19 ms' │ ' 10 ms' │ ' 1.90 x' │ +│ Primitive_Null │ 1000000 │ ' 16 ms' │ ' 19 ms' │ ' 9 ms' │ ' 2.11 x' │ +│ Object_Unconstrained │ 1000000 │ ' 437 ms' │ ' 28 ms' │ ' 14 ms' │ ' 2.00 x' │ +│ Object_Constrained │ 1000000 │ ' 653 ms' │ ' 46 ms' │ ' 37 ms' │ ' 1.24 x' │ +│ Object_Vector3 │ 1000000 │ ' 201 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │ +│ Object_Box3D │ 1000000 │ ' 961 ms' │ ' 37 ms' │ ' 19 ms' │ ' 1.95 x' │ +│ Object_Recursive │ 1000000 │ ' 3715 ms' │ ' 363 ms' │ ' 174 ms' │ ' 2.09 x' │ +│ Tuple_Primitive │ 1000000 │ ' 107 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │ +│ Tuple_Object │ 1000000 │ ' 375 ms' │ ' 28 ms' │ ' 15 ms' │ ' 1.87 x' │ +│ Composite_Intersect │ 1000000 │ ' 377 ms' │ ' 22 ms' │ ' 12 ms' │ ' 1.83 x' │ +│ Composite_Union │ 1000000 │ ' 337 ms' │ ' 30 ms' │ ' 17 ms' │ ' 1.76 x' │ +│ Math_Vector4 │ 1000000 │ ' 137 ms' │ ' 23 ms' │ ' 11 ms' │ ' 2.09 x' │ +│ Math_Matrix4 │ 1000000 │ ' 576 ms' │ ' 37 ms' │ ' 28 ms' │ ' 1.32 x' │ +│ Array_Primitive_Number │ 1000000 │ ' 145 ms' │ ' 23 ms' │ ' 12 ms' │ ' 1.92 x' │ +│ Array_Primitive_String │ 1000000 │ ' 152 ms' │ ' 22 ms' │ ' 13 ms' │ ' 1.69 x' │ +│ Array_Primitive_Boolean │ 1000000 │ ' 131 ms' │ ' 20 ms' │ ' 13 ms' │ ' 1.54 x' │ +│ Array_Object_Unconstrained │ 1000000 │ ' 2821 ms' │ ' 62 ms' │ ' 45 ms' │ ' 1.38 x' │ +│ Array_Object_Constrained │ 1000000 │ ' 2958 ms' │ ' 119 ms' │ ' 134 ms' │ ' 0.89 x' │ +│ Array_Object_Recursive │ 1000000 │ ' 14695 ms' │ ' 1621 ms' │ ' 635 ms' │ ' 2.55 x' │ +│ Array_Tuple_Primitive │ 1000000 │ ' 478 ms' │ ' 35 ms' │ ' 28 ms' │ ' 1.25 x' │ +│ Array_Tuple_Object │ 1000000 │ ' 1623 ms' │ ' 63 ms' │ ' 48 ms' │ ' 1.31 x' │ +│ Array_Composite_Intersect │ 1000000 │ ' 1582 ms' │ ' 43 ms' │ ' 30 ms' │ ' 1.43 x' │ +│ Array_Composite_Union │ 1000000 │ ' 1331 ms' │ ' 76 ms' │ ' 40 ms' │ ' 1.90 x' │ +│ Array_Math_Vector4 │ 1000000 │ ' 564 ms' │ ' 38 ms' │ ' 24 ms' │ ' 1.58 x' │ +│ Array_Math_Matrix4 │ 1000000 │ ' 2382 ms' │ ' 111 ms' │ ' 83 ms' │ ' 1.34 x' │ +└────────────────────────────┴────────────┴──────────────┴──────────────┴──────────────┴──────────────┘ +``` + + + +### Compression + +The following table lists esbuild compiled and minified sizes for each TypeBox module. + +```typescript +┌──────────────────────┬────────────┬────────────┬─────────────┐ +│ (index) │ Compiled │ Minified │ Compression │ +├──────────────────────┼────────────┼────────────┼─────────────┤ +│ typebox/compiler │ '122.4 kb' │ ' 53.4 kb' │ '2.29 x' │ +│ typebox/errors │ ' 67.6 kb' │ ' 29.6 kb' │ '2.28 x' │ +│ typebox/syntax │ '132.9 kb' │ ' 54.2 kb' │ '2.45 x' │ +│ typebox/system │ ' 7.4 kb' │ ' 3.2 kb' │ '2.33 x' │ +│ typebox/value │ '150.1 kb' │ ' 62.2 kb' │ '2.41 x' │ +│ typebox │ '106.8 kb' │ ' 43.2 kb' │ '2.47 x' │ +└──────────────────────┴────────────┴────────────┴─────────────┘ +``` + + + +## Contribute + +TypeBox is open to community contribution. Please ensure you submit an open issue before submitting your pull request. The TypeBox project prefers open community discussion before accepting new features. diff --git a/ui/node_modules/@sinclair/typebox/syntax/package.json b/ui/node_modules/@sinclair/typebox/syntax/package.json new file mode 100644 index 0000000..f380231 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/syntax/package.json @@ -0,0 +1,4 @@ +{ + "main": "../build/cjs/syntax/index.js", + "types": "../build/cjs/syntax/index.d.ts" +} \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/system/package.json b/ui/node_modules/@sinclair/typebox/system/package.json new file mode 100644 index 0000000..93fb9fa --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/system/package.json @@ -0,0 +1,4 @@ +{ + "main": "../build/cjs/system/index.js", + "types": "../build/cjs/system/index.d.ts" +} \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/type/package.json b/ui/node_modules/@sinclair/typebox/type/package.json new file mode 100644 index 0000000..71b4403 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/type/package.json @@ -0,0 +1,4 @@ +{ + "main": "../build/cjs/type/index.js", + "types": "../build/cjs/type/index.d.ts" +} \ No newline at end of file diff --git a/ui/node_modules/@sinclair/typebox/value/package.json b/ui/node_modules/@sinclair/typebox/value/package.json new file mode 100644 index 0000000..7a7aef6 --- /dev/null +++ b/ui/node_modules/@sinclair/typebox/value/package.json @@ -0,0 +1,4 @@ +{ + "main": "../build/cjs/value/index.js", + "types": "../build/cjs/value/index.d.ts" +} \ No newline at end of file diff --git a/ui/node_modules/@tokenizer/inflate/LICENSE b/ui/node_modules/@tokenizer/inflate/LICENSE new file mode 100644 index 0000000..1149e9e --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/LICENSE @@ -0,0 +1,15 @@ +Copyright (c) 2024, Borewit +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/ui/node_modules/@tokenizer/inflate/README.md b/ui/node_modules/@tokenizer/inflate/README.md new file mode 100644 index 0000000..2f33e2d --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/README.md @@ -0,0 +1,114 @@ +[![Node.js CI](https://github.com/Borewit/tokenizer-inflate/actions/workflows/nodejs-ci.yml/badge.svg)](https://github.com/Borewit/tokenizer-inflate/actions/workflows/nodejs-ci.yml) +[![NPM version](https://badge.fury.io/js/%40tokenizer%2Finflate.svg)](https://npmjs.org/package/@tokenizer/inflate) +[![npm downloads](https://img.shields.io/npm/dm/@tokenizer%2Finflate.svg)](https://npmcharts.com/compare/%40tokenizer%2Finflate?start=1200&interval=30) + +# @tokenizer/inflate + +`@tokenizer/inflate` is a package designed for handling and extracting data from ZIP files efficiently using a tokenizer-based approach. +The library provides a customizable way to parse ZIP archives and extract compressed data while minimizing memory usage. + +## Features +- Efficient Decompression: Handles streams compressed with DEFLATE and related formats (e.g., gzip). +- Tokenizer Compatibility: Seamlessly integrates with [strtok3](https://github.com/Borewit/strtok3). For example, use [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3) for efficient partial extraction of a Zip stored on AWS S3 cloud file storage. +- Streamlined Interface: Provides an intuitive API for working with compressed data in streaming and random-access scenarios. +- Chunked Data Access: Leverages the underlying media's capabilities to offer chunked or random access to data, unlike traditional streams. +- Plug-and-Play: Easily integrate with existing tokenizer-based workflows for parsing file metadata or binary structures. +- Interrupt the extraction process conditionally. + +## Installation +```bash +npm install @tokenizer/inflate +``` + +## Usage + +### Example: Extracting Specific Files + +The following example demonstrates how to use the library to extract .txt files and stop processing when encountering a .stop file. + +```js +import { ZipHandler } from '@tokenizer/inflate'; +import { fromFile } from 'strtok3'; + +const fileFilter = (file) => { + console.log(`Processing file: ${file.filename}`); + + if (file.filename?.endsWith(".stop")) { + console.log(`Stopping processing due to file: ${file.filename}`); + return { handler: false, stop: true }; // Stop the unzip process + } + + if (file.filename?.endsWith(".txt")) { + return { + handler: async (data) => { + console.log(`Extracted text file: ${file.filename}`); + console.log(new TextDecoder().decode(data)); + }, + }; + } + + return { handler: false }; // Ignore other files +}; + +async function extractFiles(zipFilePath) { + const tokenizer = await fromFile(zipFilePath); + const zipHandler = new ZipHandler(tokenizer); + await zipHandler.unzip(fileFilter); +} + +extractFiles('example.zip').catch(console.error); +``` + +## API + +### `ZipHandler` +A class for handling ZIP file parsing and extraction. +#### Constructor +```ts +new ZipHandler(tokenizer: ITokenizer) +``` +- **tokenizer**: An instance of ITokenizer to read the ZIP archive. +#### Methods + +- `isZip(): Promise` + + Determines whether the input file is a ZIP archive. + +- `unzip(fileCb: InflateFileFilter): Promise` + + Extracts files from the ZIP archive, applying the provided `InflateFileFilter` callback to each file. + +```InflatedDataHandler``` + +## Types + +### `InflateFileFilter` +```ts +type InflateFileFilter = (file: IFullZipHeader) => InflateFileFilterResult; +``` +Callback function to determine whether a file should be handled or ignored. + +### `InflateFileFilterResult` +```ts +type InflateFileFilterResult = { + handler: InflatedDataHandler | false; // Handle file data or ignore + stop?: boolean; // Stop processing further files +}; + +``` +Returned from `InflateFileFilter` to control file handling and extraction flow. + +### `InflatedDataHandler` +```ts +type InflatedDataHandler = (fileData: Uint8Array) => Promise; +``` +Handler for processing uncompressed file data. + +## Compatibility + +This module is a [pure ECMAScript Module (ESM)](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). +The distributed JavaScript codebase is compliant with the [ECMAScript 2020 (11th Edition)](https://en.wikipedia.org/wiki/ECMAScript_version_history#11th_Edition_%E2%80%93_ECMAScript_2020) standard. +If used with Node.js, it requires version ≥ 18. + +## License +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. \ No newline at end of file diff --git a/ui/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts b/ui/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts new file mode 100644 index 0000000..98fd5dc --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts @@ -0,0 +1,6 @@ +import type { ITokenizer } from 'strtok3'; +export declare class GzipHandler { + private tokenizer; + constructor(tokenizer: ITokenizer); + inflate(): ReadableStream; +} diff --git a/ui/node_modules/@tokenizer/inflate/lib/GzipHandler.js b/ui/node_modules/@tokenizer/inflate/lib/GzipHandler.js new file mode 100644 index 0000000..50d8a0e --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/GzipHandler.js @@ -0,0 +1,19 @@ +export class GzipHandler { + constructor(tokenizer) { + this.tokenizer = tokenizer; + } + inflate() { + const tokenizer = this.tokenizer; + return new ReadableStream({ + async pull(controller) { + const buffer = new Uint8Array(1024); + const size = await tokenizer.readBuffer(buffer, { mayBeLess: true }); + if (size === 0) { + controller.close(); + return; + } + controller.enqueue(buffer.subarray(0, size)); + } + }).pipeThrough(new DecompressionStream("gzip")); + } +} diff --git a/ui/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts b/ui/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts new file mode 100644 index 0000000..1bbc15c --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts @@ -0,0 +1,26 @@ +import type { ITokenizer } from 'strtok3'; +import { type IFileHeader, type ILocalFileHeader } from "./ZipToken.js"; +export type InflateFileFilterResult = { + handler: InflatedDataHandler | false; + stop?: boolean; +}; +export type { ILocalFileHeader } from './ZipToken.js'; +/** + * Return false when to ignore the file, return `InflatedDataHandler` to handle extracted data + */ +export type InflateFileFilter = (file: ILocalFileHeader) => InflateFileFilterResult; +export type InflatedDataHandler = (fileData: Uint8Array) => Promise; +export declare class ZipHandler { + private tokenizer; + private syncBuffer; + constructor(tokenizer: ITokenizer); + isZip(): Promise; + private peekSignature; + findEndOfCentralDirectoryLocator(): Promise; + readCentralDirectory(): Promise; + unzip(fileCb: InflateFileFilter): Promise; + private iterateOverCentralDirectory; + private inflate; + private static decompressDeflateRaw; + private readLocalFileHeader; +} diff --git a/ui/node_modules/@tokenizer/inflate/lib/ZipHandler.js b/ui/node_modules/@tokenizer/inflate/lib/ZipHandler.js new file mode 100644 index 0000000..d960367 --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/ZipHandler.js @@ -0,0 +1,233 @@ +import { StringType, UINT32_LE } from 'token-types'; +import initDebug from 'debug'; +import { DataDescriptor, EndOfCentralDirectoryRecordToken, FileHeader, LocalFileHeaderToken, Signature } from "./ZipToken.js"; +function signatureToArray(signature) { + const signatureBytes = new Uint8Array(UINT32_LE.len); + UINT32_LE.put(signatureBytes, 0, signature); + return signatureBytes; +} +const debug = initDebug('tokenizer:inflate'); +const syncBufferSize = 256 * 1024; +const ddSignatureArray = signatureToArray(Signature.DataDescriptor); +const eocdSignatureBytes = signatureToArray(Signature.EndOfCentralDirectory); +export class ZipHandler { + constructor(tokenizer) { + this.tokenizer = tokenizer; + this.syncBuffer = new Uint8Array(syncBufferSize); + } + async isZip() { + return await this.peekSignature() === Signature.LocalFileHeader; + } + peekSignature() { + return this.tokenizer.peekToken(UINT32_LE); + } + async findEndOfCentralDirectoryLocator() { + const randomReadTokenizer = this.tokenizer; + const chunkLength = Math.min(16 * 1024, randomReadTokenizer.fileInfo.size); + const buffer = this.syncBuffer.subarray(0, chunkLength); + await this.tokenizer.readBuffer(buffer, { position: randomReadTokenizer.fileInfo.size - chunkLength }); + // Search the buffer from end to beginning for EOCD signature + // const signature = 0x06054b50; + for (let i = buffer.length - 4; i >= 0; i--) { + // Compare 4 bytes directly without calling readUInt32LE + if (buffer[i] === eocdSignatureBytes[0] && + buffer[i + 1] === eocdSignatureBytes[1] && + buffer[i + 2] === eocdSignatureBytes[2] && + buffer[i + 3] === eocdSignatureBytes[3]) { + return randomReadTokenizer.fileInfo.size - chunkLength + i; + } + } + return -1; + } + async readCentralDirectory() { + if (!this.tokenizer.supportsRandomAccess()) { + debug('Cannot reading central-directory without random-read support'); + return; + } + debug('Reading central-directory...'); + const pos = this.tokenizer.position; + const offset = await this.findEndOfCentralDirectoryLocator(); + if (offset > 0) { + debug('Central-directory 32-bit signature found'); + const eocdHeader = await this.tokenizer.readToken(EndOfCentralDirectoryRecordToken, offset); + const files = []; + this.tokenizer.setPosition(eocdHeader.offsetOfStartOfCd); + for (let n = 0; n < eocdHeader.nrOfEntriesOfSize; ++n) { + const entry = await this.tokenizer.readToken(FileHeader); + if (entry.signature !== Signature.CentralFileHeader) { + throw new Error('Expected Central-File-Header signature'); + } + entry.filename = await this.tokenizer.readToken(new StringType(entry.filenameLength, 'utf-8')); + await this.tokenizer.ignore(entry.extraFieldLength); + await this.tokenizer.ignore(entry.fileCommentLength); + files.push(entry); + debug(`Add central-directory file-entry: n=${n + 1}/${files.length}: filename=${files[n].filename}`); + } + this.tokenizer.setPosition(pos); + return files; + } + this.tokenizer.setPosition(pos); + } + async unzip(fileCb) { + const entries = await this.readCentralDirectory(); + if (entries) { + // Use Central Directory to iterate over files + return this.iterateOverCentralDirectory(entries, fileCb); + } + // Scan Zip files for local-file-header + let stop = false; + do { + const zipHeader = await this.readLocalFileHeader(); + if (!zipHeader) + break; + const next = fileCb(zipHeader); + stop = !!next.stop; + let fileData; + await this.tokenizer.ignore(zipHeader.extraFieldLength); + if (zipHeader.dataDescriptor && zipHeader.compressedSize === 0) { + const chunks = []; + let len = syncBufferSize; + debug('Compressed-file-size unknown, scanning for next data-descriptor-signature....'); + let nextHeaderIndex = -1; + while (nextHeaderIndex < 0 && len === syncBufferSize) { + len = await this.tokenizer.peekBuffer(this.syncBuffer, { mayBeLess: true }); + nextHeaderIndex = indexOf(this.syncBuffer.subarray(0, len), ddSignatureArray); + const size = nextHeaderIndex >= 0 ? nextHeaderIndex : len; + if (next.handler) { + const data = new Uint8Array(size); + await this.tokenizer.readBuffer(data); + chunks.push(data); + } + else { + // Move position to the next header if found, skip the whole buffer otherwise + await this.tokenizer.ignore(size); + } + } + debug(`Found data-descriptor-signature at pos=${this.tokenizer.position}`); + if (next.handler) { + await this.inflate(zipHeader, mergeArrays(chunks), next.handler); + } + } + else { + if (next.handler) { + debug(`Reading compressed-file-data: ${zipHeader.compressedSize} bytes`); + fileData = new Uint8Array(zipHeader.compressedSize); + await this.tokenizer.readBuffer(fileData); + await this.inflate(zipHeader, fileData, next.handler); + } + else { + debug(`Ignoring compressed-file-data: ${zipHeader.compressedSize} bytes`); + await this.tokenizer.ignore(zipHeader.compressedSize); + } + } + debug(`Reading data-descriptor at pos=${this.tokenizer.position}`); + if (zipHeader.dataDescriptor) { + // await this.tokenizer.ignore(DataDescriptor.len); + const dataDescriptor = await this.tokenizer.readToken(DataDescriptor); + if (dataDescriptor.signature !== 0x08074b50) { + throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - DataDescriptor.len}`); + } + } + } while (!stop); + } + async iterateOverCentralDirectory(entries, fileCb) { + for (const fileHeader of entries) { + const next = fileCb(fileHeader); + if (next.handler) { + this.tokenizer.setPosition(fileHeader.relativeOffsetOfLocalHeader); + const zipHeader = await this.readLocalFileHeader(); + if (zipHeader) { + await this.tokenizer.ignore(zipHeader.extraFieldLength); + const fileData = new Uint8Array(fileHeader.compressedSize); + await this.tokenizer.readBuffer(fileData); + await this.inflate(zipHeader, fileData, next.handler); + } + } + if (next.stop) + break; + } + } + async inflate(zipHeader, fileData, cb) { + if (zipHeader.compressedMethod === 0) { + // Stored (uncompressed) + return cb(fileData); + } + if (zipHeader.compressedMethod !== 8) { + throw new Error(`Unsupported ZIP compression method: ${zipHeader.compressedMethod}`); + } + debug(`Decompress filename=${zipHeader.filename}, compressed-size=${fileData.length}`); + const uncompressedData = await ZipHandler.decompressDeflateRaw(fileData); + return cb(uncompressedData); + } + static async decompressDeflateRaw(data) { + // Wrap Uint8Array in a ReadableStream without copying + const input = new ReadableStream({ + start(controller) { + controller.enqueue(data); + controller.close(); + } + }); + const ds = new DecompressionStream("deflate-raw"); + const output = input.pipeThrough(ds); + try { + // Collect decompressed bytes from the output stream + const response = new Response(output); + const buffer = await response.arrayBuffer(); + return new Uint8Array(buffer); + } + catch (err) { + // Provide ZIP-specific error context + const message = err instanceof Error + ? `Failed to deflate ZIP entry: ${err.message}` + : "Unknown decompression error in ZIP entry"; + throw new TypeError(message); + } + } + async readLocalFileHeader() { + const signature = await this.tokenizer.peekToken(UINT32_LE); + if (signature === Signature.LocalFileHeader) { + const header = await this.tokenizer.readToken(LocalFileHeaderToken); + header.filename = await this.tokenizer.readToken(new StringType(header.filenameLength, 'utf-8')); + return header; + } + if (signature === Signature.CentralFileHeader) { + return false; + } + if (signature === 0xE011CFD0) { + throw new Error('Encrypted ZIP'); + } + throw new Error('Unexpected signature'); + } +} +function indexOf(buffer, portion) { + const bufferLength = buffer.length; + const portionLength = portion.length; + // Return -1 if the portion is longer than the buffer + if (portionLength > bufferLength) + return -1; + // Search for the portion in the buffer + for (let i = 0; i <= bufferLength - portionLength; i++) { + let found = true; + for (let j = 0; j < portionLength; j++) { + if (buffer[i + j] !== portion[j]) { + found = false; + break; + } + } + if (found) { + return i; // Return the starting offset + } + } + return -1; // Not found +} +function mergeArrays(chunks) { + // Concatenate chunks into a single Uint8Array + const totalLength = chunks.reduce((acc, curr) => acc + curr.length, 0); + const mergedArray = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks) { + mergedArray.set(chunk, offset); + offset += chunk.length; + } + return mergedArray; +} diff --git a/ui/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts b/ui/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts new file mode 100644 index 0000000..3798026 --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts @@ -0,0 +1,94 @@ +/** + * Ref https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT + */ +import type { IGetToken } from "strtok3"; +export declare const Signature: { + LocalFileHeader: number; + DataDescriptor: number; + CentralFileHeader: number; + EndOfCentralDirectory: number; +}; +interface IDataDescriptor { + signature: number; + compressedSize: number; + uncompressedSize: number; +} +export interface ILocalFileHeader extends IDataDescriptor { + minVersion: number; + dataDescriptor: boolean; + compressedMethod: number; + compressedSize: number; + uncompressedSize: number; + filenameLength: number; + extraFieldLength: number; + filename: string; +} +export declare const DataDescriptor: IGetToken; +/** + * First part of the ZIP Local File Header + * Offset | Bytes| Description + * -------|------+------------------------------------------------------------------- + * 0 | 4 | Signature (0x04034b50) + * 4 | 2 | Minimum version needed to extract + * 6 | 2 | Bit flag + * 8 | 2 | Compression method + * 10 | 2 | File last modification time (MS-DOS format) + * 12 | 2 | File last modification date (MS-DOS format) + * 14 | 4 | CRC-32 of uncompressed data + * 18 | 4 | Compressed size + * 22 | 4 | Uncompressed size + * 26 | 2 | File name length (n) + * 28 | 2 | Extra field length (m) + * 30 | n | File name + * 30 + n | m | Extra field + */ +export declare const LocalFileHeaderToken: IGetToken; +interface IEndOfCentralDirectoryRecord { + signature: number; + nrOfThisDisk: number; + nrOfThisDiskWithTheStart: number; + nrOfEntriesOnThisDisk: number; + nrOfEntriesOfSize: number; + sizeOfCd: number; + offsetOfStartOfCd: number; + zipFileCommentLength: number; +} +/** + * 4.3.16 End of central directory record: + * end of central dir signature (0x06064b50) 4 bytes + * number of this disk 2 bytes + * number of the disk with the start of the central directory 2 bytes + * total number of entries in the central directory on this disk 2 bytes + * total number of entries in the size of the central directory 2 bytes + * sizeOfTheCentralDirectory 4 bytes + * offset of start of central directory with respect to the starting disk number 4 bytes + * .ZIP file comment length 2 bytes + * .ZIP file comment (variable size) + */ +export declare const EndOfCentralDirectoryRecordToken: IGetToken; +export interface IFileHeader extends ILocalFileHeader { + fileCommentLength: number; + relativeOffsetOfLocalHeader: number; +} +/** + * File header: + * central file header signature 4 bytes 0 (0x02014b50) + * version made by 2 bytes 4 + * version needed to extract 2 bytes 6 + * general purpose bit flag 2 bytes 8 + * compression method 2 bytes 10 + * last mod file time 2 bytes 12 + * last mod file date 2 bytes 14 + * crc-32 4 bytes 16 + * compressed size 4 bytes 20 + * uncompressed size 4 bytes 24 + * file name length 2 bytes 28 + * extra field length 2 bytes 30 + * file comment length 2 bytes 32 + * disk number start 2 bytes 34 + * internal file attributes 2 bytes 36 + * external file attributes 4 bytes 38 + * relative offset of local header 4 bytes 42 + */ +export declare const FileHeader: IGetToken; +export {}; diff --git a/ui/node_modules/@tokenizer/inflate/lib/ZipToken.js b/ui/node_modules/@tokenizer/inflate/lib/ZipToken.js new file mode 100644 index 0000000..c6f3894 --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/ZipToken.js @@ -0,0 +1,117 @@ +/** + * Ref https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT + */ +import { UINT16_LE, UINT32_LE } from "token-types"; +export const Signature = { + LocalFileHeader: 0x04034b50, + DataDescriptor: 0x08074b50, + CentralFileHeader: 0x02014b50, + EndOfCentralDirectory: 0x06054b50 +}; +export const DataDescriptor = { + get(array) { + return { + signature: UINT32_LE.get(array, 0), + compressedSize: UINT32_LE.get(array, 8), + uncompressedSize: UINT32_LE.get(array, 12), + }; + }, len: 16 +}; +/** + * First part of the ZIP Local File Header + * Offset | Bytes| Description + * -------|------+------------------------------------------------------------------- + * 0 | 4 | Signature (0x04034b50) + * 4 | 2 | Minimum version needed to extract + * 6 | 2 | Bit flag + * 8 | 2 | Compression method + * 10 | 2 | File last modification time (MS-DOS format) + * 12 | 2 | File last modification date (MS-DOS format) + * 14 | 4 | CRC-32 of uncompressed data + * 18 | 4 | Compressed size + * 22 | 4 | Uncompressed size + * 26 | 2 | File name length (n) + * 28 | 2 | Extra field length (m) + * 30 | n | File name + * 30 + n | m | Extra field + */ +export const LocalFileHeaderToken = { + get(array) { + const flags = UINT16_LE.get(array, 6); + return { + signature: UINT32_LE.get(array, 0), + minVersion: UINT16_LE.get(array, 4), + dataDescriptor: !!(flags & 0x0008), + compressedMethod: UINT16_LE.get(array, 8), + compressedSize: UINT32_LE.get(array, 18), + uncompressedSize: UINT32_LE.get(array, 22), + filenameLength: UINT16_LE.get(array, 26), + extraFieldLength: UINT16_LE.get(array, 28), + filename: null + }; + }, len: 30 +}; +/** + * 4.3.16 End of central directory record: + * end of central dir signature (0x06064b50) 4 bytes + * number of this disk 2 bytes + * number of the disk with the start of the central directory 2 bytes + * total number of entries in the central directory on this disk 2 bytes + * total number of entries in the size of the central directory 2 bytes + * sizeOfTheCentralDirectory 4 bytes + * offset of start of central directory with respect to the starting disk number 4 bytes + * .ZIP file comment length 2 bytes + * .ZIP file comment (variable size) + */ +export const EndOfCentralDirectoryRecordToken = { + get(array) { + return { + signature: UINT32_LE.get(array, 0), + nrOfThisDisk: UINT16_LE.get(array, 4), + nrOfThisDiskWithTheStart: UINT16_LE.get(array, 6), + nrOfEntriesOnThisDisk: UINT16_LE.get(array, 8), + nrOfEntriesOfSize: UINT16_LE.get(array, 10), + sizeOfCd: UINT32_LE.get(array, 12), + offsetOfStartOfCd: UINT32_LE.get(array, 16), + zipFileCommentLength: UINT16_LE.get(array, 20), + }; + }, len: 22 +}; +/** + * File header: + * central file header signature 4 bytes 0 (0x02014b50) + * version made by 2 bytes 4 + * version needed to extract 2 bytes 6 + * general purpose bit flag 2 bytes 8 + * compression method 2 bytes 10 + * last mod file time 2 bytes 12 + * last mod file date 2 bytes 14 + * crc-32 4 bytes 16 + * compressed size 4 bytes 20 + * uncompressed size 4 bytes 24 + * file name length 2 bytes 28 + * extra field length 2 bytes 30 + * file comment length 2 bytes 32 + * disk number start 2 bytes 34 + * internal file attributes 2 bytes 36 + * external file attributes 4 bytes 38 + * relative offset of local header 4 bytes 42 + */ +export const FileHeader = { + get(array) { + const flags = UINT16_LE.get(array, 8); + return { + signature: UINT32_LE.get(array, 0), + minVersion: UINT16_LE.get(array, 6), + dataDescriptor: !!(flags & 0x0008), + compressedMethod: UINT16_LE.get(array, 10), + compressedSize: UINT32_LE.get(array, 20), + uncompressedSize: UINT32_LE.get(array, 24), + filenameLength: UINT16_LE.get(array, 28), + extraFieldLength: UINT16_LE.get(array, 30), + fileCommentLength: UINT16_LE.get(array, 32), + relativeOffsetOfLocalHeader: UINT32_LE.get(array, 42), + filename: null + }; + }, len: 46 +}; diff --git a/ui/node_modules/@tokenizer/inflate/lib/index.d.ts b/ui/node_modules/@tokenizer/inflate/lib/index.d.ts new file mode 100644 index 0000000..73e6618 --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/index.d.ts @@ -0,0 +1,3 @@ +export { ZipHandler } from './ZipHandler.js'; +export { GzipHandler } from './GzipHandler.js'; +export type { ILocalFileHeader } from './ZipToken.js'; diff --git a/ui/node_modules/@tokenizer/inflate/lib/index.js b/ui/node_modules/@tokenizer/inflate/lib/index.js new file mode 100644 index 0000000..4b675bc --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/lib/index.js @@ -0,0 +1,2 @@ +export { ZipHandler } from './ZipHandler.js'; +export { GzipHandler } from './GzipHandler.js'; diff --git a/ui/node_modules/@tokenizer/inflate/package.json b/ui/node_modules/@tokenizer/inflate/package.json new file mode 100644 index 0000000..521040f --- /dev/null +++ b/ui/node_modules/@tokenizer/inflate/package.json @@ -0,0 +1,76 @@ +{ + "name": "@tokenizer/inflate", + "version": "0.4.1", + "description": "Tokenized zip support", + "type": "module", + "exports": "./lib/index.js", + "files": [ + "lib/**/*.js", + "lib/**/*.d.ts" + ], + "scripts": { + "clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'test/**/*.js' 'test/**/*.js.map'", + "compile-src": "tsc -p lib", + "compile-test": "tsc -p test", + "compile": "yarn run compile-src && yarn run compile-test", + "build": "yarn run clean && yarn run compile", + "prepublishOnly": "yarn run build", + "eslint": "eslint lib test", + "lint:md": "remark -u preset-lint-recommended .", + "lint:ts": "biome check", + "fix": "yarn run biome lint --write", + "test": "mocha", + "start": "yarn run compile && yarn run lint && yarn run cover-test", + "update-biome": "yarn add -D --exact @biomejs/biome && npx @biomejs/biome migrate --write" + }, + "engines": { + "node": ">=18" + }, + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "license": "MIT", + "packageManager": "yarn@4.9.1", + "devDependencies": { + "@aws-sdk/client-s3": "^3.934.0", + "@biomejs/biome": "2.3.6", + "@tokenizer/s3": "^1.0.1", + "@types/chai": "^5.2.3", + "@types/debug": "^4", + "@types/mocha": "^10.0.10", + "@types/node": "^24.10.1", + "chai": "^6.2.1", + "del-cli": "^7.0.0", + "file-type": "^21.1.0", + "mocha": "^11.7.5", + "strtok3": "^10.3.4", + "ts-node": "^10.9.2", + "typescript": "^5.9.3" + }, + "dependencies": { + "debug": "^4.4.3", + "token-types": "^6.1.1" + }, + "repository": { + "type": "git", + "url": "https://github.com/Borewit/tokenizer-inflate.git" + }, + "bugs": { + "url": "hhttps://github.com/Borewit/tokenizer-inflate/issues" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "keywords": [ + "zip", + "unzip", + "decompress", + "inflate", + "strtok3", + "tokenizer", + "stream", + "S3" + ] +} diff --git a/ui/node_modules/@tokenizer/token/README.md b/ui/node_modules/@tokenizer/token/README.md new file mode 100644 index 0000000..4116049 --- /dev/null +++ b/ui/node_modules/@tokenizer/token/README.md @@ -0,0 +1,19 @@ +[![npm version](https://badge.fury.io/js/%40tokenizer%2Ftoken.svg)](https://www.npmjs.com/package/@tokenizer/token) +[![npm downloads](http://img.shields.io/npm/dm/@tokenizer/token.svg)](https://npmcharts.com/compare/@tokenizer/token?interval=30) + +# @tokenizer/token + +TypeScript definition of an [strtok3](https://github.com/Borewit/strtok3) token. + +## Licence + +(The MIT License) + +Copyright (c) 2020 Borewit + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/ui/node_modules/@tokenizer/token/index.d.ts b/ui/node_modules/@tokenizer/token/index.d.ts new file mode 100644 index 0000000..3703b77 --- /dev/null +++ b/ui/node_modules/@tokenizer/token/index.d.ts @@ -0,0 +1,30 @@ +/** + * Read-only token + * See https://github.com/Borewit/strtok3 for more information + */ +export interface IGetToken { + + /** + * Length of encoded token in bytes + */ + len: number; + + /** + * Decode value from buffer at offset + * @param array - Uint8Array to read the decoded value from + * @param offset - Decode offset + * @return decoded value + */ + get(array: Array, offset: number): Value; +} + +export interface IToken extends IGetToken { + /** + * Encode value to buffer + * @param array - Uint8Array to write the encoded value to + * @param offset - Buffer write offset + * @param value - Value to decode of type T + * @return offset plus number of bytes written + */ + put(array: Array, offset: number, value: Value): number +} diff --git a/ui/node_modules/@tokenizer/token/package.json b/ui/node_modules/@tokenizer/token/package.json new file mode 100644 index 0000000..4bb38fd --- /dev/null +++ b/ui/node_modules/@tokenizer/token/package.json @@ -0,0 +1,33 @@ +{ + "name": "@tokenizer/token", + "version": "0.3.0", + "description": "TypeScript definition for strtok3 token", + "main": "", + "types": "index.d.ts", + "files": [ + "index.d.ts" + ], + "keywords": [ + "token", + "interface", + "tokenizer", + "TypeScript" + ], + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Borewit/tokenizer-token.git" + }, + "bugs": { + "url": "https://github.com/Borewit/tokenizer-token/issues" + }, + "typeScriptVersion": "3.0", + "dependencies": {}, + "devDependencies": { + "@types/node": "^13.1.0" + } +} diff --git a/ui/node_modules/cookie/LICENSE b/ui/node_modules/cookie/LICENSE new file mode 100644 index 0000000..058b6b4 --- /dev/null +++ b/ui/node_modules/cookie/LICENSE @@ -0,0 +1,24 @@ +(The MIT License) + +Copyright (c) 2012-2014 Roman Shtylman +Copyright (c) 2015 Douglas Christopher Wilson + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/ui/node_modules/cookie/README.md b/ui/node_modules/cookie/README.md new file mode 100644 index 0000000..24ec013 --- /dev/null +++ b/ui/node_modules/cookie/README.md @@ -0,0 +1,295 @@ +# cookie + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coverage-image]][coverage-url] + +Basic HTTP cookie parser and serializer for HTTP servers. + +## Installation + +```sh +$ npm install cookie +``` + +## API + +```js +const cookie = require("cookie"); +// import * as cookie from 'cookie'; +``` + +### cookie.parseCookie(str, options) + +Parse an HTTP `Cookie` header string and return an [object](#cookie-object) of all cookie name-value pairs. +The `str` argument is the string representing a `Cookie` header value and `options` is an +optional object containing additional parsing options. + +```js +const cookieObject = cookie.parseCookie("foo=bar; equation=E%3Dmc%5E2"); +// { foo: 'bar', equation: 'E=mc^2' } +``` + +#### Options + +- `decode` Specifies the function to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`decodeURIComponent`](#encode-and-decode). + +### cookie.stringifyCookie(cookieObj, options) + +Stringifies a [cookie object](#cookie-object) into an HTTP `Cookie` header. + +```js +const cookieHeader = cookie.stringify({ a: "foo", b: "bar" }); +// a=foo; b=bar +``` + +#### Options + +- `encode` Specifies the function to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`encodeURIComponent`](#encode-and-decode). + +### cookie.parseSetCookie(str, options) + +Parse an HTTP `Set-Cookie` header string and return an [object](#set-cookie-object) of the options. + +```js +const setCookieObject = cookie.parseSetCookie("foo=bar; httpOnly"); +// { name: "foo", value: "bar", httpOnly: true } +``` + +**Note:** Cookie follows the specification and ignores invalid attributes, but does not attempt to normalize or modify any attributes as a browser might. For example: + +```js +cookie.parseSetCookie( + "session=abc; max-age=1.5; expires=invalid; custom=value; domain=example.com", +); +// { name: "session", value: "abc", domain: "example.com" } +``` + +#### Options + +- `decode` Specifies the function to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`decodeURIComponent`](#encode-and-decode). + +### cookie.stringifySetCookie(setCookieObj, options) + +Stringifies a [`Set-Cookie` object](#set-cookie-object) into a `Set-Cookie` header string. + +```js +const setCookieHeader = cookie.stringifySetCookie({ + name: "foo", + value: "bar", +}); +// foo=bar +``` + +#### Options + +- `encode` Specifies the function to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). Defaults to [`encodeURIComponent`](#encode-and-decode). + +## Cookie object + +The cookie object represents all cookie name-value pairs in a `Cookie` header, where `{ name: "value" }` is used for `name=value`. + +## `Set-Cookie` object + +The `Set-Cookie` object represents all the options in a `Set-Cookie` header. + +### name + +The name of the cookie. + +### value + +The value of a cookie after it has been [decoded](#encode-and-decode). + +### maxAge + +Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2). + +The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +### expires + +Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1). +When no expiration is set, clients consider this a "non-persistent cookie" and delete it when the current session is over. + +The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and +`maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, +so if both are set, they should point to the same date and time. + +### domain + +Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3). +When no domain is set, clients consider the cookie to apply to the current domain only. + +### path + +Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4). +When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4). + +### httpOnly + +Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6). +When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`. + +### secure + +Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5). +When enabled, clients will only send the cookie back if the browser has an HTTPS connection. + +### partitioned + +Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/). +When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches. + +This is an attribute that has not yet been fully standardized, and may change in the future. +This also means clients may ignore this attribute until they understand it. More information +about can be found in [the proposal](https://github.com/privacycg/CHIPS). + +### priority + +Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + +- `'low'` will set the `Priority` attribute to `Low`. +- `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. +- `'high'` will set the `Priority` attribute to `High`. + +More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + +### sameSite + +Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + +- `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. +- `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. +- `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. +- `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + +More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + +## Encode and decode + +Cookie accepts `encode` or `decode` options for processing a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). +Since the value of a cookie has a limited character set (and must be a simple string), these functions are used to transform values into strings suitable for a cookies value. + +The default `encode` function is the global `encodeURIComponent`. + +The default `decode` function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error +is thrown it will return the cookie's original value. If you provide your own encode/decode +scheme you must ensure errors are appropriately handled. + +## Example + +The following example uses this module in conjunction with the Node.js core HTTP server +to prompt a user for their name and display it back on future visits. + +```js +var cookie = require("cookie"); +var escapeHtml = require("escape-html"); +var http = require("http"); +var url = require("url"); + +function onRequest(req, res) { + // Parse the query string + var query = url.parse(req.url, true, true).query; + + if (query && query.name) { + // Set a new cookie with the name + res.setHeader( + "Set-Cookie", + cookie.stringifySetCookie({ + name: "name", + value: String(query.name), + httpOnly: true, + maxAge: 60 * 60 * 24 * 7, // 1 week + }), + ); + + // Redirect back after setting cookie + res.statusCode = 302; + res.setHeader("Location", req.headers.referer || "/"); + res.end(); + return; + } + + // Parse the cookies on the request + var cookies = cookie.parseCookie(req.headers.cookie || ""); + + // Get the visitor name set in the cookie + var name = cookies.name; + + res.setHeader("Content-Type", "text/html; charset=UTF-8"); + + if (name) { + res.write("

Welcome back, " + escapeHtml(name) + "!

"); + } else { + res.write("

Hello, new visitor!

"); + } + + res.write('
'); + res.write( + ' ', + ); + res.end("
"); +} + +http.createServer(onRequest).listen(3000); +``` + +## Testing + +```sh +npm test +``` + +## Benchmark + +```sh +npm run bench +``` + +``` + name hz min max mean p75 p99 p995 p999 rme samples + · simple 8,566,313.09 0.0000 0.3694 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.64% 4283157 fastest + · decode 3,834,348.85 0.0001 0.2465 0.0003 0.0003 0.0003 0.0004 0.0006 ±0.38% 1917175 + · unquote 8,315,355.96 0.0000 0.3824 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.72% 4157880 + · duplicates 1,944,765.97 0.0004 0.2959 0.0005 0.0005 0.0006 0.0006 0.0008 ±0.24% 972384 + · 10 cookies 675,345.67 0.0012 0.4328 0.0015 0.0015 0.0019 0.0020 0.0058 ±0.75% 337673 + · 100 cookies 61,040.71 0.0152 0.4092 0.0164 0.0160 0.0196 0.0228 0.2260 ±0.71% 30521 slowest + ✓ parse top-sites (15) 22945ms + name hz min max mean p75 p99 p995 p999 rme samples + · parse accounts.google.com 7,164,349.17 0.0000 0.0929 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.09% 3582184 + · parse apple.com 7,817,686.84 0.0000 0.6048 0.0001 0.0001 0.0002 0.0002 0.0003 ±1.05% 3908844 + · parse cloudflare.com 7,189,841.70 0.0000 0.0390 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3594921 + · parse docs.google.com 7,051,765.61 0.0000 0.0296 0.0001 0.0002 0.0002 0.0002 0.0003 ±0.06% 3525883 + · parse drive.google.com 7,349,104.77 0.0000 0.0368 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.05% 3674553 + · parse en.wikipedia.org 1,929,909.49 0.0004 0.3598 0.0005 0.0005 0.0007 0.0007 0.0012 ±0.16% 964955 + · parse linkedin.com 2,225,658.01 0.0003 0.0595 0.0004 0.0005 0.0005 0.0005 0.0006 ±0.06% 1112830 + · parse maps.google.com 4,423,511.68 0.0001 0.0942 0.0002 0.0003 0.0003 0.0003 0.0005 ±0.08% 2211756 + · parse microsoft.com 3,387,601.88 0.0002 0.0725 0.0003 0.0003 0.0004 0.0004 0.0005 ±0.09% 1693801 + · parse play.google.com 7,375,980.86 0.0000 0.1994 0.0001 0.0001 0.0002 0.0002 0.0003 ±0.12% 3687991 + · parse support.google.com 4,912,267.94 0.0001 2.8958 0.0002 0.0002 0.0003 0.0003 0.0005 ±1.28% 2456134 + · parse www.google.com 3,443,035.87 0.0002 0.2783 0.0003 0.0003 0.0004 0.0004 0.0007 ±0.51% 1721518 + · parse youtu.be 1,910,492.87 0.0004 0.3490 0.0005 0.0005 0.0007 0.0007 0.0011 ±0.46% 955247 + · parse youtube.com 1,895,082.62 0.0004 0.7454 0.0005 0.0005 0.0006 0.0007 0.0013 ±0.64% 947542 slowest + · parse example.com 21,582,835.27 0.0000 0.1095 0.0000 0.0000 0.0001 0.0001 0.0001 ±0.13% 10791418 +``` + +## References + +- [RFC 6265: HTTP State Management Mechanism](https://tools.ietf.org/html/rfc6265) +- [Same-site Cookies](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7) + +## License + +[MIT](LICENSE) + +[ci-image]: https://img.shields.io/github/actions/workflow/status/jshttp/cookie/ci.yml +[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml?query=branch%3Amaster +[coverage-image]: https://img.shields.io/codecov/c/github/jshttp/cookie/master +[coverage-url]: https://app.codecov.io/gh/jshttp/cookie +[npm-downloads-image]: https://img.shields.io/npm/dm/cookie +[npm-url]: https://npmjs.org/package/cookie +[npm-version-image]: https://img.shields.io/npm/v/cookie diff --git a/ui/node_modules/cookie/dist/index.d.ts b/ui/node_modules/cookie/dist/index.d.ts new file mode 100644 index 0000000..1ae405a --- /dev/null +++ b/ui/node_modules/cookie/dist/index.d.ts @@ -0,0 +1,148 @@ +/** + * Parse options. + */ +export interface ParseOptions { + /** + * Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). + * Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode + * a previously-encoded cookie value into a JavaScript string. + * + * The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error + * is thrown it will return the cookie's original value. If you provide your own encode/decode + * scheme you must ensure errors are appropriately handled. + * + * @default decode + */ + decode?: (str: string) => string | undefined; +} +/** + * Cookies object. + */ +export type Cookies = Record; +/** + * Parse a `Cookie` header. + * + * Parse the given cookie header string into an object + * The object has the various cookies as keys(names) => values + */ +export declare function parseCookie(str: string, options?: ParseOptions): Cookies; +export interface StringifyOptions { + /** + * Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1). + * Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode + * a value into a string suited for a cookie's value, and should mirror `decode` when parsing. + * + * @default encodeURIComponent + */ + encode?: (str: string) => string; +} +/** + * Stringifies an object into an HTTP `Cookie` header. + */ +export declare function stringifyCookie(cookie: Cookies, options?: StringifyOptions): string; +/** + * Set-Cookie object. + */ +export interface SetCookie { + /** + * Specifies the name of the cookie. + */ + name: string; + /** + * Specifies the string to be the value for the cookie. + */ + value: string | undefined; + /** + * Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2). + * + * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and + * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, + * so if both are set, they should point to the same date and time. + */ + maxAge?: number; + /** + * Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1). + * When no expiration is set, clients consider this a "non-persistent cookie" and delete it when the current session is over. + * + * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and + * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, + * so if both are set, they should point to the same date and time. + */ + expires?: Date; + /** + * Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3). + * When no domain is set, clients consider the cookie to apply to the current domain only. + */ + domain?: string; + /** + * Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4). + * When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4). + */ + path?: string; + /** + * Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6). + * When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`. + */ + httpOnly?: boolean; + /** + * Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5). + * When enabled, clients will only send the cookie back if the browser has an HTTPS connection. + */ + secure?: boolean; + /** + * Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/). + * When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches. + * + * This is an attribute that has not yet been fully standardized, and may change in the future. + * This also means clients may ignore this attribute until they understand it. More information + * about can be found in [the proposal](https://github.com/privacycg/CHIPS). + */ + partitioned?: boolean; + /** + * Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + * + * - `'low'` will set the `Priority` attribute to `Low`. + * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set. + * - `'high'` will set the `Priority` attribute to `High`. + * + * More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1). + */ + priority?: "low" | "medium" | "high"; + /** + * Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + * + * - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + * - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. + * - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie. + * - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. + * + * More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7). + */ + sameSite?: boolean | "lax" | "strict" | "none"; +} +/** + * Backward compatibility serialize options. + */ +export type SerializeOptions = StringifyOptions & Omit; +/** + * Serialize data into a cookie header. + * + * Serialize a name value pair into a cookie string suitable for + * http headers. An optional options object specifies cookie parameters. + * + * serialize('foo', 'bar', { httpOnly: true }) + * => "foo=bar; httpOnly" + */ +export declare function stringifySetCookie(cookie: SetCookie, options?: StringifyOptions): string; +export declare function stringifySetCookie(name: string, val: string, options?: SerializeOptions): string; +/** + * Deserialize a `Set-Cookie` header into an object. + * + * deserialize('foo=bar; httpOnly') + * => { name: 'foo', value: 'bar', httpOnly: true } + */ +export declare function parseSetCookie(str: string, options?: ParseOptions): SetCookie; +/** + * Backward compatibility exports. + */ +export { stringifySetCookie as serialize, parseCookie as parse }; diff --git a/ui/node_modules/cookie/dist/index.js b/ui/node_modules/cookie/dist/index.js new file mode 100644 index 0000000..d83d190 --- /dev/null +++ b/ui/node_modules/cookie/dist/index.js @@ -0,0 +1,350 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseCookie = parseCookie; +exports.parse = parseCookie; +exports.stringifyCookie = stringifyCookie; +exports.stringifySetCookie = stringifySetCookie; +exports.serialize = stringifySetCookie; +exports.parseSetCookie = parseSetCookie; +exports.stringifySetCookie = stringifySetCookie; +exports.serialize = stringifySetCookie; +/** + * RegExp to match cookie-name in RFC 6265 sec 4.1.1 + * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2 + * which has been replaced by the token definition in RFC 7230 appendix B. + * + * cookie-name = token + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / + * "*" / "+" / "-" / "." / "^" / "_" / + * "`" / "|" / "~" / DIGIT / ALPHA + * + * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191 + * Allow same range as cookie value, except `=`, which delimits end of name. + */ +const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/; +/** + * RegExp to match cookie-value in RFC 6265 sec 4.1.1 + * + * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) + * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E + * ; US-ASCII characters excluding CTLs, + * ; whitespace DQUOTE, comma, semicolon, + * ; and backslash + * + * Allowing more characters: https://github.com/jshttp/cookie/issues/191 + * Comma, backslash, and DQUOTE are not part of the parsing algorithm. + */ +const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/; +/** + * RegExp to match domain-value in RFC 6265 sec 4.1.1 + * + * domain-value = + * ; defined in [RFC1034], Section 3.5, as + * ; enhanced by [RFC1123], Section 2.1 + * =