elysia 2.0.0-beta.2 → 2.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/bun/index.d.ts +18 -2
- package/dist/adapter/bun/index.js +467 -110
- package/dist/adapter/bun/index.mjs +467 -112
- package/dist/adapter/types.d.ts +2 -21
- package/dist/adapter/utils.d.ts +14 -3
- package/dist/adapter/utils.js +146 -87
- package/dist/adapter/utils.mjs +148 -90
- package/dist/adapter/web-standard/handler.d.ts +1 -1
- package/dist/adapter/web-standard/handler.js +47 -36
- package/dist/adapter/web-standard/handler.mjs +48 -37
- package/dist/adapter/web-standard/index.js +2 -30
- package/dist/adapter/web-standard/index.mjs +2 -30
- package/dist/adapter/web-standard/utils.js +5 -18
- package/dist/adapter/web-standard/utils.mjs +5 -18
- package/dist/base.d.ts +99 -67
- package/dist/base.js +678 -510
- package/dist/base.mjs +682 -514
- package/dist/compile/aot-capture.d.ts +2 -13
- package/dist/compile/aot-capture.js +26 -69
- package/dist/compile/aot-capture.mjs +28 -67
- package/dist/compile/aot-emit.d.ts +9 -7
- package/dist/compile/aot-emit.js +42 -19
- package/dist/compile/aot-emit.mjs +42 -20
- package/dist/compile/aot.d.ts +17 -19
- package/dist/compile/aot.js +41 -51
- package/dist/compile/aot.mjs +39 -49
- package/dist/compile/handler/descriptor.d.ts +9 -12
- package/dist/compile/handler/descriptor.js +19 -44
- package/dist/compile/handler/descriptor.mjs +20 -42
- package/dist/compile/handler/frozen-validator.d.ts +5 -10
- package/dist/compile/handler/frozen-validator.js +55 -105
- package/dist/compile/handler/frozen-validator.mjs +53 -105
- package/dist/compile/handler/index.d.ts +7 -5
- package/dist/compile/handler/index.js +270 -111
- package/dist/compile/handler/index.mjs +270 -113
- package/dist/compile/handler/jit.d.ts +19 -17
- package/dist/compile/handler/jit.js +222 -149
- package/dist/compile/handler/jit.mjs +224 -152
- package/dist/compile/handler/params.d.ts +1 -4
- package/dist/compile/handler/params.js +10 -5
- package/dist/compile/handler/params.mjs +14 -8
- package/dist/compile/handler/reconstruct.d.ts +2 -2
- package/dist/compile/handler/reconstruct.js +6 -4
- package/dist/compile/handler/reconstruct.mjs +6 -4
- package/dist/compile/handler/static-clone-resolver.d.ts +6 -0
- package/dist/compile/handler/static-clone-resolver.js +8 -0
- package/dist/compile/handler/static-clone-resolver.mjs +7 -0
- package/dist/compile/handler/utils.d.ts +22 -11
- package/dist/compile/handler/utils.js +159 -253
- package/dist/compile/handler/utils.mjs +155 -252
- package/dist/compile/jit-probe.d.ts +2 -2
- package/dist/compile/jit-probe.js +2 -3
- package/dist/compile/jit-probe.mjs +2 -3
- package/dist/compile/lexer.d.ts +7 -4
- package/dist/compile/lexer.js +268 -6
- package/dist/compile/lexer.mjs +268 -4
- package/dist/compile/utils.js +7 -4
- package/dist/compile/utils.mjs +7 -4
- package/dist/compiled.d.ts +0 -1
- package/dist/compiled.js +0 -1
- package/dist/compiled.mjs +0 -1
- package/dist/context.d.ts +14 -4
- package/dist/context.js +17 -32
- package/dist/context.mjs +19 -34
- package/dist/cookie/config.d.ts +7 -2
- package/dist/cookie/config.js +76 -16
- package/dist/cookie/config.mjs +77 -18
- package/dist/cookie/cookie.d.ts +1 -1
- package/dist/cookie/cookie.js +8 -10
- package/dist/cookie/cookie.mjs +8 -10
- package/dist/cookie/crypto.d.ts +8 -7
- package/dist/cookie/crypto.js +51 -40
- package/dist/cookie/crypto.mjs +51 -41
- package/dist/cookie/error.d.ts +1 -2
- package/dist/cookie/error.js +6 -4
- package/dist/cookie/error.mjs +6 -4
- package/dist/cookie/lib.js +7 -2
- package/dist/cookie/lib.mjs +7 -2
- package/dist/cookie/serialize.js +1 -1
- package/dist/cookie/serialize.mjs +1 -1
- package/dist/cookie/types.d.ts +10 -0
- package/dist/cookie/utils.d.ts +4 -8
- package/dist/cookie/utils.js +86 -52
- package/dist/cookie/utils.mjs +89 -54
- package/dist/error.d.ts +113 -103
- package/dist/error.js +181 -117
- package/dist/error.mjs +179 -118
- package/dist/generation.d.ts +2 -2
- package/dist/handler/error.d.ts +26 -15
- package/dist/handler/error.js +77 -96
- package/dist/handler/error.mjs +74 -97
- package/dist/handler/fetch.js +87 -108
- package/dist/handler/fetch.mjs +89 -110
- package/dist/handler/utils.d.ts +12 -6
- package/dist/handler/utils.js +84 -28
- package/dist/handler/utils.mjs +80 -28
- package/dist/index.d.ts +12 -12
- package/dist/index.js +2 -9
- package/dist/index.mjs +1 -1
- package/dist/memory.js +1 -1
- package/dist/memory.mjs +1 -1
- package/dist/package.js +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugin/aot/bun.d.ts +8 -1
- package/dist/plugin/aot/bun.js +16 -9
- package/dist/plugin/aot/bun.mjs +17 -10
- package/dist/plugin/aot/core.d.ts +52 -60
- package/dist/plugin/aot/core.js +208 -109
- package/dist/plugin/aot/core.mjs +205 -111
- package/dist/plugin/aot/esbuild.js +8 -5
- package/dist/plugin/aot/esbuild.mjs +9 -6
- package/dist/plugin/aot/hooks.d.ts +6 -17
- package/dist/plugin/aot/hooks.js +36 -14
- package/dist/plugin/aot/hooks.mjs +37 -16
- package/dist/plugin/aot/rspack-loader.d.ts +1 -5
- package/dist/plugin/aot/rspack-loader.js +1 -10
- package/dist/plugin/aot/rspack-loader.mjs +1 -10
- package/dist/plugin/aot/rspack.js +2 -5
- package/dist/plugin/aot/rspack.mjs +3 -6
- package/dist/plugin/aot/source.d.ts +6 -42
- package/dist/plugin/aot/source.js +71 -71
- package/dist/plugin/aot/source.mjs +72 -72
- package/dist/plugin/aot/treeshake.js +2 -6
- package/dist/plugin/aot/treeshake.mjs +2 -6
- package/dist/plugin/aot/unplugin.d.ts +1 -4
- package/dist/plugin/aot/unplugin.js +4 -13
- package/dist/plugin/aot/unplugin.mjs +4 -13
- package/dist/plugin/aot/vite.d.ts +2 -6
- package/dist/plugin/aot/worker.js +2 -2
- package/dist/plugin/aot/worker.mjs +2 -2
- package/dist/plugin/auto-head.js +1 -10
- package/dist/plugin/auto-head.mjs +1 -10
- package/dist/plugin/trace.d.ts +2 -1
- package/dist/route-table.d.ts +3 -0
- package/dist/route-table.js +16 -11
- package/dist/route-table.mjs +16 -11
- package/dist/schema-snapshot.d.ts +0 -4
- package/dist/schema-snapshot.js +32 -49
- package/dist/schema-snapshot.mjs +32 -49
- package/dist/sucrose.d.ts +6 -55
- package/dist/sucrose.js +103 -731
- package/dist/sucrose.mjs +102 -724
- package/dist/trace.d.ts +5 -8
- package/dist/trace.js +23 -134
- package/dist/trace.mjs +24 -135
- package/dist/type/bridge-live.d.ts +4 -2
- package/dist/type/bridge-live.js +6 -3
- package/dist/type/bridge-live.mjs +4 -2
- package/dist/type/bridge.d.ts +6 -4
- package/dist/type/bridge.js +17 -9
- package/dist/type/bridge.mjs +5 -3
- package/dist/type/coerce-plan.d.ts +5 -5
- package/dist/type/coerce-plan.js +41 -39
- package/dist/type/coerce-plan.mjs +43 -39
- package/dist/type/coerce.d.ts +3 -7
- package/dist/type/coerce.js +18 -75
- package/dist/type/coerce.mjs +19 -76
- package/dist/type/compat.d.ts +3 -0
- package/dist/type/compat.js +23 -14
- package/dist/type/compat.mjs +20 -10
- package/dist/type/elysia/array-buffer.d.ts +4 -1
- package/dist/type/elysia/array-buffer.js +17 -17
- package/dist/type/elysia/array-buffer.mjs +17 -17
- package/dist/type/elysia/array-string.js +2 -40
- package/dist/type/elysia/array-string.mjs +2 -39
- package/dist/type/elysia/array.js +5 -9
- package/dist/type/elysia/array.mjs +5 -9
- package/dist/type/elysia/boolean-string.js +2 -3
- package/dist/type/elysia/boolean-string.mjs +1 -1
- package/dist/type/elysia/boolean.js +3 -12
- package/dist/type/elysia/boolean.mjs +3 -11
- package/dist/type/elysia/cookie.d.ts +3 -4
- package/dist/type/elysia/cookie.js +5 -15
- package/dist/type/elysia/cookie.mjs +5 -15
- package/dist/type/elysia/date.js +13 -20
- package/dist/type/elysia/date.mjs +10 -16
- package/dist/type/elysia/file-type.d.ts +11 -4
- package/dist/type/elysia/file-type.js +17 -2
- package/dist/type/elysia/file-type.mjs +17 -3
- package/dist/type/elysia/file.d.ts +1 -3
- package/dist/type/elysia/file.js +11 -27
- package/dist/type/elysia/file.mjs +11 -12
- package/dist/type/elysia/files.js +7 -11
- package/dist/type/elysia/files.mjs +7 -10
- package/dist/type/elysia/form.js +2 -3
- package/dist/type/elysia/form.mjs +3 -3
- package/dist/type/elysia/integer-string.d.ts +1 -1
- package/dist/type/elysia/integer-string.js +4 -30
- package/dist/type/elysia/integer-string.mjs +5 -30
- package/dist/type/elysia/integer.js +3 -12
- package/dist/type/elysia/integer.mjs +3 -11
- package/dist/type/elysia/intersect.js +0 -5
- package/dist/type/elysia/intersect.mjs +0 -5
- package/dist/type/elysia/json-string.d.ts +7 -0
- package/dist/type/elysia/json-string.js +47 -0
- package/dist/type/elysia/json-string.mjs +46 -0
- package/dist/type/elysia/keep-config.d.ts +14 -0
- package/dist/type/elysia/keep-config.js +62 -0
- package/dist/type/elysia/keep-config.mjs +53 -0
- package/dist/type/elysia/maybe-empty.js +3 -4
- package/dist/type/elysia/maybe-empty.mjs +1 -1
- package/dist/type/elysia/nullable.js +2 -3
- package/dist/type/elysia/nullable.mjs +1 -1
- package/dist/type/elysia/number.d.ts +2 -1
- package/dist/type/elysia/number.js +19 -11
- package/dist/type/elysia/number.mjs +18 -10
- package/dist/type/elysia/numeric-enum.d.ts +1 -1
- package/dist/type/elysia/numeric-enum.js +4 -5
- package/dist/type/elysia/numeric-enum.mjs +3 -3
- package/dist/type/elysia/numeric.d.ts +4 -2
- package/dist/type/elysia/numeric.js +20 -17
- package/dist/type/elysia/numeric.mjs +19 -16
- package/dist/type/elysia/object-string.js +2 -37
- package/dist/type/elysia/object-string.mjs +2 -36
- package/dist/type/elysia/object.js +5 -9
- package/dist/type/elysia/object.mjs +5 -9
- package/dist/type/elysia/optional.js +8 -8
- package/dist/type/elysia/optional.mjs +7 -7
- package/dist/type/elysia/problem.d.ts +20 -0
- package/dist/type/elysia/problem.js +25 -0
- package/dist/type/elysia/problem.mjs +24 -0
- package/dist/type/elysia/string.js +4 -3
- package/dist/type/elysia/string.mjs +4 -2
- package/dist/type/elysia/uint8-array.d.ts +1 -1
- package/dist/type/elysia/uint8-array.js +5 -20
- package/dist/type/elysia/uint8-array.mjs +5 -19
- package/dist/type/elysia/union-enum.js +7 -8
- package/dist/type/elysia/union-enum.mjs +6 -6
- package/dist/type/elysia/union.js +0 -5
- package/dist/type/elysia/union.mjs +0 -5
- package/dist/type/elysia/utils.d.ts +2 -4
- package/dist/type/elysia/utils.js +10 -21
- package/dist/type/elysia/utils.mjs +7 -15
- package/dist/type/exports.d.ts +4 -2
- package/dist/type/exports.js +23 -2
- package/dist/type/exports.mjs +11 -2
- package/dist/type/index.d.ts +10 -2
- package/dist/type/index.js +62 -15
- package/dist/type/index.mjs +65 -11
- package/dist/type/shared.d.ts +3 -9
- package/dist/type/shared.js +44 -97
- package/dist/type/shared.mjs +43 -97
- package/dist/type/sync-require.d.ts +11 -0
- package/dist/type/sync-require.js +14 -0
- package/dist/type/sync-require.mjs +12 -0
- package/dist/type/typebox-system-lite.d.ts +2 -0
- package/dist/type/typebox-system-lite.js +34 -0
- package/dist/type/typebox-system-lite.mjs +3 -0
- package/dist/type/typebox-system-require.d.ts +7 -0
- package/dist/type/typebox-system-require.js +24 -0
- package/dist/type/typebox-system-require.mjs +23 -0
- package/dist/type/typebox-type-live.d.ts +11 -0
- package/dist/type/typebox-type-live.js +45 -0
- package/dist/type/typebox-type-live.mjs +20 -0
- package/dist/type/typebox-type.d.ts +34 -0
- package/dist/type/typebox-type.js +199 -0
- package/dist/type/typebox-type.mjs +86 -0
- package/dist/type/typebox-value-live.d.ts +11 -0
- package/dist/type/typebox-value-live.js +31 -0
- package/dist/type/typebox-value-live.mjs +13 -0
- package/dist/type/typebox-value-ops.d.ts +4 -0
- package/dist/type/typebox-value-ops.js +90 -0
- package/dist/type/typebox-value-ops.mjs +5 -0
- package/dist/type/typebox-value-require.d.ts +8 -0
- package/dist/type/typebox-value-require.js +28 -0
- package/dist/type/typebox-value-require.mjs +25 -0
- package/dist/type/typebox-value.d.ts +35 -0
- package/dist/type/typebox-value.js +161 -0
- package/dist/type/typebox-value.mjs +74 -0
- package/dist/type/utils.js +1 -10
- package/dist/type/utils.mjs +1 -10
- package/dist/type/validator/clean-safe.d.ts +2 -4
- package/dist/type/validator/clean-safe.js +15 -11
- package/dist/type/validator/clean-safe.mjs +16 -10
- package/dist/type/validator/custom-error.js +12 -16
- package/dist/type/validator/custom-error.mjs +11 -14
- package/dist/type/validator/default-precompute.d.ts +9 -1
- package/dist/type/validator/default-precompute.js +40 -77
- package/dist/type/validator/default-precompute.mjs +37 -74
- package/dist/type/validator/exact-mirror-live.d.ts +8 -0
- package/dist/type/validator/exact-mirror-live.js +22 -0
- package/dist/type/validator/exact-mirror-live.mjs +17 -0
- package/dist/type/validator/exact-mirror-require.d.ts +4 -0
- package/dist/type/validator/exact-mirror-require.js +11 -0
- package/dist/type/validator/exact-mirror-require.mjs +9 -0
- package/dist/type/validator/exact-mirror.js +8 -8
- package/dist/type/validator/exact-mirror.mjs +9 -8
- package/dist/type/validator/frozen-check.js +5 -6
- package/dist/type/validator/frozen-check.mjs +6 -7
- package/dist/type/validator/index.d.ts +1 -0
- package/dist/type/validator/index.js +169 -166
- package/dist/type/validator/index.mjs +162 -158
- package/dist/type/validator/string-codec-aot.d.ts +2 -1
- package/dist/type/validator/string-codec-aot.js +8 -2
- package/dist/type/validator/string-codec-aot.mjs +7 -2
- package/dist/type/validator/validator-cache.d.ts +5 -4
- package/dist/type/validator/validator-cache.js +41 -24
- package/dist/type/validator/validator-cache.mjs +40 -22
- package/dist/types.d.ts +263 -95
- package/dist/universal/constants.d.ts +2 -1
- package/dist/universal/constants.js +3 -1
- package/dist/universal/constants.mjs +2 -1
- package/dist/universal/env.js +2 -3
- package/dist/universal/env.mjs +2 -3
- package/dist/universal/file.d.ts +6 -4
- package/dist/universal/file.js +11 -16
- package/dist/universal/file.mjs +12 -16
- package/dist/universal/index.d.ts +2 -2
- package/dist/universal/is-production.d.ts +1 -2
- package/dist/universal/is-production.js +1 -3
- package/dist/universal/is-production.mjs +2 -3
- package/dist/universal/server.d.ts +0 -272
- package/dist/utils.d.ts +43 -7
- package/dist/utils.js +181 -126
- package/dist/utils.mjs +168 -126
- package/dist/validator/index.d.ts +1 -1
- package/dist/validator/index.js +17 -30
- package/dist/validator/index.mjs +18 -31
- package/dist/validator/route.js +2 -1
- package/dist/validator/route.mjs +2 -1
- package/dist/ws/context.d.ts +8 -1
- package/dist/ws/context.js +68 -44
- package/dist/ws/context.mjs +67 -44
- package/dist/ws/parser.js +10 -20
- package/dist/ws/parser.mjs +10 -20
- package/dist/ws/route.d.ts +2 -2
- package/dist/ws/route.js +249 -141
- package/dist/ws/route.mjs +254 -146
- package/dist/ws/types.d.ts +2 -2
- package/package.json +23 -49
- package/dist/compile/analysis-cache.d.ts +0 -6
- package/dist/compile/analysis-cache.js +0 -12
- package/dist/compile/analysis-cache.mjs +0 -11
- package/dist/cookie/index.d.ts +0 -7
- package/dist/cookie/index.js +0 -13
- package/dist/cookie/index.mjs +0 -7
- package/dist/handler/index.d.ts +0 -2
- package/dist/handler/index.js +0 -5
- package/dist/handler/index.mjs +0 -3
package/dist/type/exports.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
3
|
+
const require_type_typebox_type = require('./typebox-type.js');
|
|
2
4
|
const require_type_elysia_array = require('./elysia/array.js');
|
|
3
5
|
const require_type_elysia_string = require('./elysia/string.js');
|
|
4
6
|
const require_type_elysia_union = require('./elysia/union.js');
|
|
@@ -11,24 +13,34 @@ const require_type_elysia_boolean = require('./elysia/boolean.js');
|
|
|
11
13
|
const require_type_elysia_boolean_string = require('./elysia/boolean-string.js');
|
|
12
14
|
const require_type_elysia_integer = require('./elysia/integer.js');
|
|
13
15
|
const require_type_elysia_integer_string = require('./elysia/integer-string.js');
|
|
14
|
-
const require_type_elysia_file = require('./elysia/file.js');
|
|
15
16
|
const require_type_elysia_intersect = require('./elysia/intersect.js');
|
|
16
17
|
const require_type_compat = require('./compat.js');
|
|
17
18
|
const require_type_elysia_accelerate = require('./elysia/accelerate.js');
|
|
18
19
|
const require_type_elysia_array_buffer = require('./elysia/array-buffer.js');
|
|
19
20
|
const require_type_elysia_cookie = require('./elysia/cookie.js');
|
|
20
21
|
const require_type_elysia_date = require('./elysia/date.js');
|
|
22
|
+
const require_type_elysia_file = require('./elysia/file.js');
|
|
21
23
|
const require_type_elysia_files = require('./elysia/files.js');
|
|
22
24
|
const require_type_elysia_form = require('./elysia/form.js');
|
|
25
|
+
const require_type_elysia_keep_config = require('./elysia/keep-config.js');
|
|
23
26
|
const require_type_elysia_maybe_empty = require('./elysia/maybe-empty.js');
|
|
24
27
|
const require_type_elysia_no_validate = require('./elysia/no-validate.js');
|
|
25
28
|
const require_type_elysia_nullable = require('./elysia/nullable.js');
|
|
26
29
|
const require_type_elysia_numeric_enum = require('./elysia/numeric-enum.js');
|
|
27
30
|
const require_type_elysia_optional = require('./elysia/optional.js');
|
|
31
|
+
const require_type_elysia_problem = require('./elysia/problem.js');
|
|
28
32
|
const require_type_elysia_uint8_array = require('./elysia/uint8-array.js');
|
|
29
33
|
const require_type_elysia_union_enum = require('./elysia/union-enum.js');
|
|
34
|
+
let typebox_type = require("typebox/type");
|
|
35
|
+
typebox_type = require_runtime.__toESM(typebox_type);
|
|
36
|
+
let typebox_system = require("typebox/system");
|
|
37
|
+
typebox_system = require_runtime.__toESM(typebox_system);
|
|
30
38
|
|
|
31
39
|
//#region src/type/exports.ts
|
|
40
|
+
require_type_typebox_type.injectTypeboxType({
|
|
41
|
+
type: typebox_type,
|
|
42
|
+
system: typebox_system
|
|
43
|
+
});
|
|
32
44
|
require_type_compat.setupTypebox();
|
|
33
45
|
|
|
34
46
|
//#endregion
|
|
@@ -38,14 +50,18 @@ exports.ArrayBuffer = require_type_elysia_array_buffer.ArrayBufferType;
|
|
|
38
50
|
exports.ArrayString = require_type_elysia_array_string.ArrayString;
|
|
39
51
|
exports.Boolean = require_type_elysia_boolean.BooleanType;
|
|
40
52
|
exports.BooleanString = require_type_elysia_boolean_string.BooleanString;
|
|
53
|
+
exports.Composite = require_type_elysia_keep_config.CompositeType;
|
|
41
54
|
exports.Cookie = require_type_elysia_cookie.Cookie;
|
|
42
55
|
exports.Date = require_type_elysia_date.DateType;
|
|
56
|
+
exports.Evaluate = require_type_elysia_keep_config.EvaluateType;
|
|
43
57
|
exports.File = require_type_elysia_file.File;
|
|
44
58
|
exports.Files = require_type_elysia_files.Files;
|
|
45
59
|
exports.Form = require_type_elysia_form.Form;
|
|
46
60
|
exports.Integer = require_type_elysia_integer.Integer;
|
|
47
61
|
exports.IntegerString = require_type_elysia_integer_string.IntegerString;
|
|
62
|
+
exports.Interface = require_type_elysia_keep_config.InterfaceType;
|
|
48
63
|
exports.Intersect = require_type_elysia_intersect.Intersect;
|
|
64
|
+
exports.Mapped = require_type_elysia_keep_config.MappedType;
|
|
49
65
|
exports.MaybeEmpty = require_type_elysia_maybe_empty.MaybeEmpty;
|
|
50
66
|
exports.NoValidate = require_type_elysia_no_validate.NoValidate;
|
|
51
67
|
exports.Nullable = require_type_elysia_nullable.Nullable;
|
|
@@ -54,12 +70,17 @@ exports.Numeric = require_type_elysia_numeric.Numeric;
|
|
|
54
70
|
exports.NumericEnum = require_type_elysia_numeric_enum.NumericEnum;
|
|
55
71
|
exports.Object = require_type_elysia_object.ObjectType;
|
|
56
72
|
exports.ObjectString = require_type_elysia_object_string.ObjectString;
|
|
73
|
+
exports.Omit = require_type_elysia_keep_config.OmitType;
|
|
57
74
|
exports.Optional = require_type_elysia_optional.Optional;
|
|
75
|
+
exports.Partial = require_type_elysia_keep_config.PartialType;
|
|
76
|
+
exports.Pick = require_type_elysia_keep_config.PickType;
|
|
77
|
+
exports.Problem = require_type_elysia_problem.Problem;
|
|
78
|
+
exports.ReadonlyObject = require_type_elysia_keep_config.ReadonlyObjectType;
|
|
79
|
+
exports.Required = require_type_elysia_keep_config.RequiredType;
|
|
58
80
|
exports.String = require_type_elysia_string.StringType;
|
|
59
81
|
exports.Uint8Array = require_type_elysia_uint8_array.Uint8ArrayType;
|
|
60
82
|
exports.Union = require_type_elysia_union.Union;
|
|
61
83
|
exports.UnionEnum = require_type_elysia_union_enum.UnionEnum;
|
|
62
|
-
var typebox_type = require("typebox/type");
|
|
63
84
|
Object.keys(typebox_type).forEach(function (k) {
|
|
64
85
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
65
86
|
enumerable: true,
|
package/dist/type/exports.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { injectTypeboxType } from "./typebox-type.mjs";
|
|
1
2
|
import { ArrayType } from "./elysia/array.mjs";
|
|
2
3
|
import { StringType } from "./elysia/string.mjs";
|
|
3
4
|
import { Union } from "./elysia/union.mjs";
|
|
@@ -10,27 +11,35 @@ import { BooleanType } from "./elysia/boolean.mjs";
|
|
|
10
11
|
import { BooleanString } from "./elysia/boolean-string.mjs";
|
|
11
12
|
import { Integer } from "./elysia/integer.mjs";
|
|
12
13
|
import { IntegerString } from "./elysia/integer-string.mjs";
|
|
13
|
-
import { File } from "./elysia/file.mjs";
|
|
14
14
|
import { Intersect } from "./elysia/intersect.mjs";
|
|
15
15
|
import { setupTypebox } from "./compat.mjs";
|
|
16
16
|
import { Accelerate } from "./elysia/accelerate.mjs";
|
|
17
17
|
import { ArrayBufferType } from "./elysia/array-buffer.mjs";
|
|
18
18
|
import { Cookie } from "./elysia/cookie.mjs";
|
|
19
19
|
import { DateType } from "./elysia/date.mjs";
|
|
20
|
+
import { File } from "./elysia/file.mjs";
|
|
20
21
|
import { Files } from "./elysia/files.mjs";
|
|
21
22
|
import { Form } from "./elysia/form.mjs";
|
|
23
|
+
import { CompositeType, EvaluateType, InterfaceType, MappedType, OmitType, PartialType, PickType, ReadonlyObjectType, RequiredType } from "./elysia/keep-config.mjs";
|
|
22
24
|
import { MaybeEmpty } from "./elysia/maybe-empty.mjs";
|
|
23
25
|
import { NoValidate } from "./elysia/no-validate.mjs";
|
|
24
26
|
import { Nullable } from "./elysia/nullable.mjs";
|
|
25
27
|
import { NumericEnum } from "./elysia/numeric-enum.mjs";
|
|
26
28
|
import { Optional } from "./elysia/optional.mjs";
|
|
29
|
+
import { Problem } from "./elysia/problem.mjs";
|
|
27
30
|
import { Uint8ArrayType } from "./elysia/uint8-array.mjs";
|
|
28
31
|
import { UnionEnum } from "./elysia/union-enum.mjs";
|
|
32
|
+
import * as type from "typebox/type";
|
|
33
|
+
import * as system from "typebox/system";
|
|
29
34
|
|
|
30
35
|
export * from "typebox/type"
|
|
31
36
|
|
|
32
37
|
//#region src/type/exports.ts
|
|
38
|
+
injectTypeboxType({
|
|
39
|
+
type,
|
|
40
|
+
system
|
|
41
|
+
});
|
|
33
42
|
setupTypebox();
|
|
34
43
|
|
|
35
44
|
//#endregion
|
|
36
|
-
export { Accelerate, ArrayType as Array, ArrayBufferType as ArrayBuffer, ArrayString, BooleanType as Boolean, BooleanString, Cookie, DateType as Date, File, Files, Form, Integer, IntegerString, Intersect, MaybeEmpty, NoValidate, Nullable, NumberType as Number, Numeric, NumericEnum, ObjectType as Object, ObjectString, Optional, StringType as String, Uint8ArrayType as Uint8Array, Union, UnionEnum };
|
|
45
|
+
export { Accelerate, ArrayType as Array, ArrayBufferType as ArrayBuffer, ArrayString, BooleanType as Boolean, BooleanString, CompositeType as Composite, Cookie, DateType as Date, EvaluateType as Evaluate, File, Files, Form, Integer, IntegerString, InterfaceType as Interface, Intersect, MappedType as Mapped, MaybeEmpty, NoValidate, Nullable, NumberType as Number, Numeric, NumericEnum, ObjectType as Object, ObjectString, OmitType as Omit, Optional, PartialType as Partial, PickType as Pick, Problem, ReadonlyObjectType as ReadonlyObject, RequiredType as Required, StringType as String, Uint8ArrayType as Uint8Array, Union, UnionEnum };
|
package/dist/type/index.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { AnySchema, BaseSchema, StandardJSONSchemaV1Like, StandardSchemaV1Like, TypeBoxSchema } from "./types.js";
|
|
2
|
-
import { FileTypeDetector, fileType, setFileTypeDetector } from "./elysia/file-type.js";
|
|
3
2
|
import { exports_d_exports } from "./exports.js";
|
|
4
3
|
import { setupTypebox } from "./compat.js";
|
|
4
|
+
import { FileTypeDetector, fileType, setFileTypeDetector } from "./elysia/file-type.js";
|
|
5
5
|
import { TypeBoxValidator } from "./validator/index.js";
|
|
6
6
|
import * as TypeBoxType from "typebox/type";
|
|
7
|
-
import { System
|
|
7
|
+
import { System } from "typebox/system";
|
|
8
8
|
|
|
9
9
|
//#region src/type/index.d.ts
|
|
10
10
|
type TypeBuilder = Omit<typeof TypeBoxType, keyof typeof exports_d_exports> & typeof exports_d_exports;
|
|
11
11
|
declare const t: TypeBuilder;
|
|
12
|
+
/**
|
|
13
|
+
* `typebox/system` is a subgraph of `typebox/type`, so a static re-export here
|
|
14
|
+
* would pin ~231 KB of the deferral back into the eager graph. The proxy also
|
|
15
|
+
* guarantees Elysia's own `Settings` default lands BEFORE the namespace is
|
|
16
|
+
* handed out, keeping a user's explicit `TypeSystem.Settings.Set(...)` last —
|
|
17
|
+
* the ordering the eager `setupTypebox()` used to provide
|
|
18
|
+
*/
|
|
19
|
+
declare const TypeSystem: typeof System;
|
|
12
20
|
//#endregion
|
|
13
21
|
export { type AnySchema, type BaseSchema, type FileTypeDetector, type StandardJSONSchemaV1Like, type StandardSchemaV1Like, type TypeBoxSchema, TypeBoxValidator, TypeSystem, fileType, setFileTypeDetector, setupTypebox, t };
|
package/dist/type/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const require_type_elysia_file_type = require('./elysia/file-type.js');
|
|
2
|
+
const require_type_typebox_type = require('./typebox-type.js');
|
|
4
3
|
const require_type_elysia_array = require('./elysia/array.js');
|
|
5
4
|
const require_type_elysia_string = require('./elysia/string.js');
|
|
6
5
|
const require_type_elysia_union = require('./elysia/union.js');
|
|
@@ -13,45 +12,84 @@ const require_type_elysia_boolean = require('./elysia/boolean.js');
|
|
|
13
12
|
const require_type_elysia_boolean_string = require('./elysia/boolean-string.js');
|
|
14
13
|
const require_type_elysia_integer = require('./elysia/integer.js');
|
|
15
14
|
const require_type_elysia_integer_string = require('./elysia/integer-string.js');
|
|
16
|
-
const
|
|
15
|
+
const require_type_elysia_file_type = require('./elysia/file-type.js');
|
|
17
16
|
const require_type_validator_index = require('./validator/index.js');
|
|
18
17
|
const require_type_elysia_intersect = require('./elysia/intersect.js');
|
|
19
18
|
const require_type_compat = require('./compat.js');
|
|
19
|
+
const require_type_typebox_system_require = require('./typebox-system-require.js');
|
|
20
20
|
const require_type_elysia_accelerate = require('./elysia/accelerate.js');
|
|
21
21
|
const require_type_elysia_array_buffer = require('./elysia/array-buffer.js');
|
|
22
22
|
const require_type_elysia_cookie = require('./elysia/cookie.js');
|
|
23
23
|
const require_type_elysia_date = require('./elysia/date.js');
|
|
24
|
+
const require_type_elysia_file = require('./elysia/file.js');
|
|
24
25
|
const require_type_elysia_files = require('./elysia/files.js');
|
|
25
26
|
const require_type_elysia_form = require('./elysia/form.js');
|
|
27
|
+
const require_type_elysia_keep_config = require('./elysia/keep-config.js');
|
|
26
28
|
const require_type_elysia_maybe_empty = require('./elysia/maybe-empty.js');
|
|
27
29
|
const require_type_elysia_no_validate = require('./elysia/no-validate.js');
|
|
28
30
|
const require_type_elysia_nullable = require('./elysia/nullable.js');
|
|
29
31
|
const require_type_elysia_numeric_enum = require('./elysia/numeric-enum.js');
|
|
30
32
|
const require_type_elysia_optional = require('./elysia/optional.js');
|
|
33
|
+
const require_type_elysia_problem = require('./elysia/problem.js');
|
|
31
34
|
const require_type_elysia_uint8_array = require('./elysia/uint8-array.js');
|
|
32
35
|
const require_type_elysia_union_enum = require('./elysia/union-enum.js');
|
|
33
|
-
let typebox_type = require("typebox/type");
|
|
34
|
-
typebox_type = require_runtime.__toESM(typebox_type);
|
|
35
|
-
let typebox_system = require("typebox/system");
|
|
36
36
|
|
|
37
37
|
//#region src/type/index.ts
|
|
38
38
|
require_type_compat.setupTypebox();
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* A namespace object that materializes `typebox/type` only when a key it does
|
|
41
|
+
* not own is actually read
|
|
42
|
+
*/
|
|
43
|
+
const lazyNamespace = (resolve, overrides, onRead) => new Proxy(overrides, {
|
|
44
|
+
get: (target, key, receiver) => {
|
|
45
|
+
onRead?.();
|
|
46
|
+
return key in target ? Reflect.get(target, key, receiver) : resolve()[key];
|
|
47
|
+
},
|
|
48
|
+
has: (target, key) => key in target || key in resolve(),
|
|
49
|
+
ownKeys(target) {
|
|
50
|
+
const keys = Object.keys(resolve());
|
|
51
|
+
for (const key of Object.getOwnPropertyNames(target)) if (!keys.includes(key)) keys.push(key);
|
|
52
|
+
return keys;
|
|
53
|
+
},
|
|
54
|
+
getOwnPropertyDescriptor(target, key) {
|
|
55
|
+
if (Object.hasOwn(target, key)) return Reflect.getOwnPropertyDescriptor(target, key);
|
|
56
|
+
const ns = resolve();
|
|
57
|
+
if (!Object.hasOwn(ns, key)) return;
|
|
58
|
+
const get = Reflect.getOwnPropertyDescriptor(ns, key).get;
|
|
59
|
+
if (get) return {
|
|
60
|
+
get,
|
|
61
|
+
enumerable: true,
|
|
62
|
+
configurable: true
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
value: ns[key],
|
|
66
|
+
enumerable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
configurable: true
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
preventExtensions: () => false,
|
|
72
|
+
set: (target, key, value) => Reflect.set(target, key, value)
|
|
73
|
+
});
|
|
74
|
+
const t = lazyNamespace(() => require_type_typebox_type.loadTypeNamespace().type, {
|
|
41
75
|
Accelerate: require_type_elysia_accelerate.Accelerate,
|
|
42
76
|
Array: require_type_elysia_array.ArrayType,
|
|
43
77
|
ArrayBuffer: require_type_elysia_array_buffer.ArrayBufferType,
|
|
44
78
|
ArrayString: require_type_elysia_array_string.ArrayString,
|
|
45
79
|
Boolean: require_type_elysia_boolean.BooleanType,
|
|
46
80
|
BooleanString: require_type_elysia_boolean_string.BooleanString,
|
|
81
|
+
Composite: require_type_elysia_keep_config.CompositeType,
|
|
47
82
|
Cookie: require_type_elysia_cookie.Cookie,
|
|
48
83
|
Date: require_type_elysia_date.DateType,
|
|
84
|
+
Evaluate: require_type_elysia_keep_config.EvaluateType,
|
|
49
85
|
File: require_type_elysia_file.File,
|
|
50
86
|
Files: require_type_elysia_files.Files,
|
|
51
87
|
Form: require_type_elysia_form.Form,
|
|
52
88
|
Integer: require_type_elysia_integer.Integer,
|
|
89
|
+
Interface: require_type_elysia_keep_config.InterfaceType,
|
|
53
90
|
Intersect: require_type_elysia_intersect.Intersect,
|
|
54
91
|
IntegerString: require_type_elysia_integer_string.IntegerString,
|
|
92
|
+
Mapped: require_type_elysia_keep_config.MappedType,
|
|
55
93
|
MaybeEmpty: require_type_elysia_maybe_empty.MaybeEmpty,
|
|
56
94
|
NoValidate: require_type_elysia_no_validate.NoValidate,
|
|
57
95
|
Nullable: require_type_elysia_nullable.Nullable,
|
|
@@ -60,21 +98,30 @@ const t = {
|
|
|
60
98
|
NumericEnum: require_type_elysia_numeric_enum.NumericEnum,
|
|
61
99
|
Object: require_type_elysia_object.ObjectType,
|
|
62
100
|
ObjectString: require_type_elysia_object_string.ObjectString,
|
|
101
|
+
Omit: require_type_elysia_keep_config.OmitType,
|
|
63
102
|
Optional: require_type_elysia_optional.Optional,
|
|
103
|
+
Partial: require_type_elysia_keep_config.PartialType,
|
|
104
|
+
Pick: require_type_elysia_keep_config.PickType,
|
|
105
|
+
Problem: require_type_elysia_problem.Problem,
|
|
106
|
+
ReadonlyObject: require_type_elysia_keep_config.ReadonlyObjectType,
|
|
107
|
+
Required: require_type_elysia_keep_config.RequiredType,
|
|
64
108
|
String: require_type_elysia_string.StringType,
|
|
65
109
|
Uint8Array: require_type_elysia_uint8_array.Uint8ArrayType,
|
|
66
110
|
Union: require_type_elysia_union.Union,
|
|
67
111
|
UnionEnum: require_type_elysia_union_enum.UnionEnum
|
|
68
|
-
};
|
|
112
|
+
}, require_type_typebox_type.markTypeUsed);
|
|
113
|
+
/**
|
|
114
|
+
* `typebox/system` is a subgraph of `typebox/type`, so a static re-export here
|
|
115
|
+
* would pin ~231 KB of the deferral back into the eager graph. The proxy also
|
|
116
|
+
* guarantees Elysia's own `Settings` default lands BEFORE the namespace is
|
|
117
|
+
* handed out, keeping a user's explicit `TypeSystem.Settings.Set(...)` last —
|
|
118
|
+
* the ordering the eager `setupTypebox()` used to provide
|
|
119
|
+
*/
|
|
120
|
+
const TypeSystem = lazyNamespace(() => require_type_typebox_system_require.typeSystem(require_type_typebox_type.loadTypeNamespace().system), Object.create(null));
|
|
69
121
|
|
|
70
122
|
//#endregion
|
|
71
123
|
exports.TypeBoxValidator = require_type_validator_index.TypeBoxValidator;
|
|
72
|
-
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return typebox_system.System;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
124
|
+
exports.TypeSystem = TypeSystem;
|
|
78
125
|
exports.fileType = require_type_elysia_file_type.fileType;
|
|
79
126
|
exports.setFileTypeDetector = require_type_elysia_file_type.setFileTypeDetector;
|
|
80
127
|
exports.setupTypebox = require_type_compat.setupTypebox;
|
package/dist/type/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { loadTypeNamespace, markTypeUsed } from "./typebox-type.mjs";
|
|
2
2
|
import { ArrayType } from "./elysia/array.mjs";
|
|
3
3
|
import { StringType } from "./elysia/string.mjs";
|
|
4
4
|
import { Union } from "./elysia/union.mjs";
|
|
@@ -9,46 +9,86 @@ import { NumberType } from "./elysia/number.mjs";
|
|
|
9
9
|
import { Numeric } from "./elysia/numeric.mjs";
|
|
10
10
|
import { BooleanType } from "./elysia/boolean.mjs";
|
|
11
11
|
import { BooleanString } from "./elysia/boolean-string.mjs";
|
|
12
|
-
import { Integer
|
|
12
|
+
import { Integer } from "./elysia/integer.mjs";
|
|
13
13
|
import { IntegerString } from "./elysia/integer-string.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { fileType, setFileTypeDetector } from "./elysia/file-type.mjs";
|
|
15
15
|
import { TypeBoxValidator } from "./validator/index.mjs";
|
|
16
|
-
import { Intersect
|
|
16
|
+
import { Intersect } from "./elysia/intersect.mjs";
|
|
17
17
|
import { setupTypebox } from "./compat.mjs";
|
|
18
|
+
import { typeSystem } from "./typebox-system-require.mjs";
|
|
18
19
|
import { Accelerate } from "./elysia/accelerate.mjs";
|
|
19
20
|
import { ArrayBufferType } from "./elysia/array-buffer.mjs";
|
|
20
21
|
import { Cookie } from "./elysia/cookie.mjs";
|
|
21
22
|
import { DateType } from "./elysia/date.mjs";
|
|
23
|
+
import { File } from "./elysia/file.mjs";
|
|
22
24
|
import { Files } from "./elysia/files.mjs";
|
|
23
25
|
import { Form } from "./elysia/form.mjs";
|
|
26
|
+
import { CompositeType, EvaluateType, InterfaceType, MappedType, OmitType, PartialType, PickType, ReadonlyObjectType, RequiredType } from "./elysia/keep-config.mjs";
|
|
24
27
|
import { MaybeEmpty } from "./elysia/maybe-empty.mjs";
|
|
25
28
|
import { NoValidate } from "./elysia/no-validate.mjs";
|
|
26
29
|
import { Nullable } from "./elysia/nullable.mjs";
|
|
27
30
|
import { NumericEnum } from "./elysia/numeric-enum.mjs";
|
|
28
31
|
import { Optional } from "./elysia/optional.mjs";
|
|
32
|
+
import { Problem } from "./elysia/problem.mjs";
|
|
29
33
|
import { Uint8ArrayType } from "./elysia/uint8-array.mjs";
|
|
30
34
|
import { UnionEnum } from "./elysia/union-enum.mjs";
|
|
31
|
-
import * as TypeBox from "typebox/type";
|
|
32
|
-
import { System as TypeSystem } from "typebox/system";
|
|
33
35
|
|
|
34
36
|
//#region src/type/index.ts
|
|
35
37
|
setupTypebox();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* A namespace object that materializes `typebox/type` only when a key it does
|
|
40
|
+
* not own is actually read
|
|
41
|
+
*/
|
|
42
|
+
const lazyNamespace = (resolve, overrides, onRead) => new Proxy(overrides, {
|
|
43
|
+
get: (target, key, receiver) => {
|
|
44
|
+
onRead?.();
|
|
45
|
+
return key in target ? Reflect.get(target, key, receiver) : resolve()[key];
|
|
46
|
+
},
|
|
47
|
+
has: (target, key) => key in target || key in resolve(),
|
|
48
|
+
ownKeys(target) {
|
|
49
|
+
const keys = Object.keys(resolve());
|
|
50
|
+
for (const key of Object.getOwnPropertyNames(target)) if (!keys.includes(key)) keys.push(key);
|
|
51
|
+
return keys;
|
|
52
|
+
},
|
|
53
|
+
getOwnPropertyDescriptor(target, key) {
|
|
54
|
+
if (Object.hasOwn(target, key)) return Reflect.getOwnPropertyDescriptor(target, key);
|
|
55
|
+
const ns = resolve();
|
|
56
|
+
if (!Object.hasOwn(ns, key)) return;
|
|
57
|
+
const get = Reflect.getOwnPropertyDescriptor(ns, key).get;
|
|
58
|
+
if (get) return {
|
|
59
|
+
get,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
value: ns[key],
|
|
65
|
+
enumerable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
configurable: true
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
preventExtensions: () => false,
|
|
71
|
+
set: (target, key, value) => Reflect.set(target, key, value)
|
|
72
|
+
});
|
|
73
|
+
const t = lazyNamespace(() => loadTypeNamespace().type, {
|
|
38
74
|
Accelerate,
|
|
39
75
|
Array: ArrayType,
|
|
40
76
|
ArrayBuffer: ArrayBufferType,
|
|
41
77
|
ArrayString,
|
|
42
78
|
Boolean: BooleanType,
|
|
43
79
|
BooleanString,
|
|
80
|
+
Composite: CompositeType,
|
|
44
81
|
Cookie,
|
|
45
82
|
Date: DateType,
|
|
83
|
+
Evaluate: EvaluateType,
|
|
46
84
|
File,
|
|
47
85
|
Files,
|
|
48
86
|
Form,
|
|
49
|
-
Integer
|
|
50
|
-
|
|
87
|
+
Integer,
|
|
88
|
+
Interface: InterfaceType,
|
|
89
|
+
Intersect,
|
|
51
90
|
IntegerString,
|
|
91
|
+
Mapped: MappedType,
|
|
52
92
|
MaybeEmpty,
|
|
53
93
|
NoValidate,
|
|
54
94
|
Nullable,
|
|
@@ -57,12 +97,26 @@ const t = {
|
|
|
57
97
|
NumericEnum,
|
|
58
98
|
Object: ObjectType,
|
|
59
99
|
ObjectString,
|
|
100
|
+
Omit: OmitType,
|
|
60
101
|
Optional,
|
|
102
|
+
Partial: PartialType,
|
|
103
|
+
Pick: PickType,
|
|
104
|
+
Problem,
|
|
105
|
+
ReadonlyObject: ReadonlyObjectType,
|
|
106
|
+
Required: RequiredType,
|
|
61
107
|
String: StringType,
|
|
62
108
|
Uint8Array: Uint8ArrayType,
|
|
63
109
|
Union,
|
|
64
110
|
UnionEnum
|
|
65
|
-
};
|
|
111
|
+
}, markTypeUsed);
|
|
112
|
+
/**
|
|
113
|
+
* `typebox/system` is a subgraph of `typebox/type`, so a static re-export here
|
|
114
|
+
* would pin ~231 KB of the deferral back into the eager graph. The proxy also
|
|
115
|
+
* guarantees Elysia's own `Settings` default lands BEFORE the namespace is
|
|
116
|
+
* handed out, keeping a user's explicit `TypeSystem.Settings.Set(...)` last —
|
|
117
|
+
* the ordering the eager `setupTypebox()` used to provide
|
|
118
|
+
*/
|
|
119
|
+
const TypeSystem = lazyNamespace(() => typeSystem(loadTypeNamespace().system), Object.create(null));
|
|
66
120
|
|
|
67
121
|
//#endregion
|
|
68
122
|
export { TypeBoxValidator, TypeSystem, fileType, setFileTypeDetector, setupTypebox, t };
|
package/dist/type/shared.d.ts
CHANGED
|
@@ -6,22 +6,16 @@ declare const SHARED_REFERENCE_CACHE_LIMIT = 1024;
|
|
|
6
6
|
declare function referenceCache(cache: Map<number, any> | Map<string, any>): void;
|
|
7
7
|
/** @internal */
|
|
8
8
|
declare function clearSharedReferenceCaches(): void;
|
|
9
|
-
/**
|
|
10
|
-
* @internal Tag every `~refine` entry of a framework-built node as pure.
|
|
11
|
-
* Only ever call this on nodes whose predicates are self-contained: a predicate
|
|
12
|
-
* that can transitively reach a USER refinement (e.g. ObjectString, which runs
|
|
13
|
-
* `Check` over the inner schema) is NOT pure and must keep the pool.
|
|
14
|
-
*/
|
|
15
9
|
declare function pureRefine<T>(node: T): T;
|
|
16
10
|
/** @internal */
|
|
17
11
|
declare const isPureRefinement: (refinement: object) => boolean;
|
|
18
12
|
/** @internal */
|
|
19
13
|
declare const coerceLeafCache: Map<string, any>;
|
|
20
14
|
/** @internal test isolation */
|
|
21
|
-
declare const coerceLeafCacheSize: () => number;
|
|
22
|
-
/** @internal test isolation */
|
|
23
15
|
declare function clearCoerceLeafCache(): void;
|
|
16
|
+
declare function copyNonEnumerable(src: object, target: object, skipKey?: string): void;
|
|
24
17
|
declare function cloneNode(node: BaseSchema, out: any): any;
|
|
18
|
+
declare function dropCompiledSource(tb: any): void;
|
|
25
19
|
declare function nonAdditionalProperties(node: BaseSchema, seen?: WeakSet<object>): BaseSchema;
|
|
26
20
|
//#endregion
|
|
27
|
-
export { SHARED_REFERENCE_CACHE_LIMIT, clearCoerceLeafCache, clearSharedReferenceCaches, cloneNode, coerceLeafCache,
|
|
21
|
+
export { SHARED_REFERENCE_CACHE_LIMIT, clearCoerceLeafCache, clearSharedReferenceCaches, cloneNode, coerceLeafCache, copyNonEnumerable, dropCompiledSource, isPureRefinement, nonAdditionalProperties, pureRefine, referenceCache };
|
package/dist/type/shared.js
CHANGED
|
@@ -14,12 +14,6 @@ function clearSharedReferenceCaches() {
|
|
|
14
14
|
for (const cache of sharedReferenceCaches) cache.clear();
|
|
15
15
|
}
|
|
16
16
|
const pureRefinements = /* @__PURE__ */ new WeakSet();
|
|
17
|
-
/**
|
|
18
|
-
* @internal Tag every `~refine` entry of a framework-built node as pure.
|
|
19
|
-
* Only ever call this on nodes whose predicates are self-contained: a predicate
|
|
20
|
-
* that can transitively reach a USER refinement (e.g. ObjectString, which runs
|
|
21
|
-
* `Check` over the inner schema) is NOT pure and must keep the pool.
|
|
22
|
-
*/
|
|
23
17
|
function pureRefine(node) {
|
|
24
18
|
const refinements = node?.["~refine"];
|
|
25
19
|
if (Array.isArray(refinements)) {
|
|
@@ -32,20 +26,13 @@ const isPureRefinement = (refinement) => pureRefinements.has(refinement);
|
|
|
32
26
|
/** @internal */
|
|
33
27
|
const coerceLeafCache = /* @__PURE__ */ new Map();
|
|
34
28
|
/** @internal test isolation */
|
|
35
|
-
const coerceLeafCacheSize = () => coerceLeafCache.size;
|
|
36
|
-
/** @internal test isolation */
|
|
37
29
|
function clearCoerceLeafCache() {
|
|
38
30
|
coerceLeafCache.clear();
|
|
39
31
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"~kind": node["~kind"]
|
|
45
|
-
};
|
|
46
|
-
for (const key of Object.getOwnPropertyNames(node)) {
|
|
47
|
-
const desc = Object.getOwnPropertyDescriptor(node, key);
|
|
48
|
-
if (!desc || desc.enumerable || key === "~kind") continue;
|
|
32
|
+
function copyNonEnumerable(src, target, skipKey) {
|
|
33
|
+
for (const key of Object.getOwnPropertyNames(src)) {
|
|
34
|
+
const desc = Object.getOwnPropertyDescriptor(src, key);
|
|
35
|
+
if (!desc || desc.enumerable || key === skipKey) continue;
|
|
49
36
|
Object.defineProperty(target, key, {
|
|
50
37
|
value: desc.value,
|
|
51
38
|
enumerable: false,
|
|
@@ -53,104 +40,63 @@ function cloneNode(node, out) {
|
|
|
53
40
|
configurable: true
|
|
54
41
|
});
|
|
55
42
|
}
|
|
43
|
+
}
|
|
44
|
+
function cloneNode(node, out) {
|
|
45
|
+
if (out !== node) return out;
|
|
46
|
+
const target = {
|
|
47
|
+
...node,
|
|
48
|
+
"~kind": node["~kind"]
|
|
49
|
+
};
|
|
50
|
+
copyNonEnumerable(node, target, "~kind");
|
|
56
51
|
return Object.defineProperty(target, "~kind", require_type_constants.noEnumerable);
|
|
57
52
|
}
|
|
53
|
+
function dropCompiledSource(tb) {
|
|
54
|
+
if (tb.evaluateResult) tb.evaluateResult.code = void 0;
|
|
55
|
+
if (tb.buildResult) tb.buildResult.functions = void 0;
|
|
56
|
+
}
|
|
58
57
|
function nonAdditionalProperties(node, seen = /* @__PURE__ */ new WeakSet()) {
|
|
59
58
|
if (!node || typeof node !== "object" || seen.has(node)) return node;
|
|
60
59
|
seen.add(node);
|
|
61
60
|
let out = node;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
const set = (key, value) => {
|
|
62
|
+
out = cloneNode(node, out);
|
|
63
|
+
out[key] = value;
|
|
64
|
+
};
|
|
65
|
+
const single = (key) => {
|
|
66
|
+
const v = node[key];
|
|
67
|
+
const r = nonAdditionalProperties(v, seen);
|
|
68
|
+
if (r !== v) set(key, r);
|
|
69
|
+
};
|
|
70
|
+
const record = (key) => {
|
|
71
|
+
const children = node[key];
|
|
72
|
+
let copy;
|
|
73
|
+
for (const k in children) {
|
|
74
|
+
const v = children[k];
|
|
66
75
|
const r = nonAdditionalProperties(v, seen);
|
|
67
|
-
if (r !== v) {
|
|
68
|
-
newProps ??= { ...node.properties };
|
|
69
|
-
newProps[k] = r;
|
|
70
|
-
}
|
|
76
|
+
if (r !== v) (copy ??= { ...children })[k] = r;
|
|
71
77
|
}
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
if (node.items) if (Array.isArray(node.items)) {
|
|
78
|
-
let newItems;
|
|
79
|
-
for (let i = 0; i < node.items.length; i++) {
|
|
80
|
-
const r = nonAdditionalProperties(node.items[i], seen);
|
|
81
|
-
if (r !== node.items[i]) {
|
|
82
|
-
newItems ??= [...node.items];
|
|
83
|
-
newItems[i] = r;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (newItems) {
|
|
87
|
-
out = cloneNode(node, out);
|
|
88
|
-
out.items = newItems;
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
const r = nonAdditionalProperties(node.items, seen);
|
|
92
|
-
if (r !== node.items) {
|
|
93
|
-
out = cloneNode(node, out);
|
|
94
|
-
out.items = r;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
78
|
+
if (copy) set(key, copy);
|
|
79
|
+
};
|
|
80
|
+
if (node.properties) record("properties");
|
|
81
|
+
if (node.items && !Array.isArray(node.items)) single("items");
|
|
97
82
|
for (const key of [
|
|
83
|
+
"items",
|
|
98
84
|
"anyOf",
|
|
99
85
|
"allOf",
|
|
100
86
|
"oneOf"
|
|
101
87
|
]) {
|
|
102
88
|
const arr = node[key];
|
|
103
89
|
if (!Array.isArray(arr)) continue;
|
|
104
|
-
let
|
|
90
|
+
let copy;
|
|
105
91
|
for (let i = 0; i < arr.length; i++) {
|
|
106
92
|
const r = nonAdditionalProperties(arr[i], seen);
|
|
107
|
-
if (r !== arr[i])
|
|
108
|
-
newArr ??= [...arr];
|
|
109
|
-
newArr[i] = r;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (newArr) {
|
|
113
|
-
out = cloneNode(node, out);
|
|
114
|
-
out[key] = newArr;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (node.additionalProperties && typeof node.additionalProperties === "object") {
|
|
118
|
-
const r = nonAdditionalProperties(node.additionalProperties, seen);
|
|
119
|
-
if (r !== node.additionalProperties) {
|
|
120
|
-
out = cloneNode(node, out);
|
|
121
|
-
out.additionalProperties = r;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (node.patternProperties) {
|
|
125
|
-
let newPP;
|
|
126
|
-
for (const k in node.patternProperties) {
|
|
127
|
-
const v = node.patternProperties[k];
|
|
128
|
-
const r = nonAdditionalProperties(v, seen);
|
|
129
|
-
if (r !== v) {
|
|
130
|
-
newPP ??= { ...node.patternProperties };
|
|
131
|
-
newPP[k] = r;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (newPP) {
|
|
135
|
-
out = cloneNode(node, out);
|
|
136
|
-
out.patternProperties = newPP;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (node.$defs) {
|
|
140
|
-
let newDefs;
|
|
141
|
-
for (const k in node.$defs) {
|
|
142
|
-
const v = node.$defs[k];
|
|
143
|
-
const r = nonAdditionalProperties(v, seen);
|
|
144
|
-
if (r !== v) {
|
|
145
|
-
newDefs ??= { ...node.$defs };
|
|
146
|
-
newDefs[k] = r;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (newDefs) {
|
|
150
|
-
out = cloneNode(node, out);
|
|
151
|
-
out.$defs = newDefs;
|
|
93
|
+
if (r !== arr[i]) (copy ??= [...arr])[i] = r;
|
|
152
94
|
}
|
|
95
|
+
if (copy) set(key, copy);
|
|
153
96
|
}
|
|
97
|
+
if (node.additionalProperties && typeof node.additionalProperties === "object") single("additionalProperties");
|
|
98
|
+
if (node.patternProperties) record("patternProperties");
|
|
99
|
+
if (node.$defs) record("$defs");
|
|
154
100
|
if ((node.type === "object" || node["~kind"] === "Object") && !("additionalProperties" in node)) {
|
|
155
101
|
out = cloneNode(node, out);
|
|
156
102
|
out.additionalProperties = false;
|
|
@@ -164,7 +110,8 @@ exports.clearCoerceLeafCache = clearCoerceLeafCache;
|
|
|
164
110
|
exports.clearSharedReferenceCaches = clearSharedReferenceCaches;
|
|
165
111
|
exports.cloneNode = cloneNode;
|
|
166
112
|
exports.coerceLeafCache = coerceLeafCache;
|
|
167
|
-
exports.
|
|
113
|
+
exports.copyNonEnumerable = copyNonEnumerable;
|
|
114
|
+
exports.dropCompiledSource = dropCompiledSource;
|
|
168
115
|
exports.isPureRefinement = isPureRefinement;
|
|
169
116
|
exports.nonAdditionalProperties = nonAdditionalProperties;
|
|
170
117
|
exports.pureRefine = pureRefine;
|