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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { syncRequire } from "./sync-require.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/type/typebox-type.ts
|
|
4
|
+
let namespaces;
|
|
5
|
+
/**
|
|
6
|
+
* Loads `typebox/type` + `typebox/system` on first use
|
|
7
|
+
*
|
|
8
|
+
* separate from `typebox-value` (type ⊂ value)
|
|
9
|
+
* sharing one would make a single `t.Date()` drag the whole value graph in
|
|
10
|
+
*/
|
|
11
|
+
function load() {
|
|
12
|
+
if (namespaces) return namespaces;
|
|
13
|
+
injectTypeboxType(resolveNamespaces());
|
|
14
|
+
return namespaces;
|
|
15
|
+
}
|
|
16
|
+
function resolveNamespaces() {
|
|
17
|
+
if (typeof require === "function") try {
|
|
18
|
+
return {
|
|
19
|
+
type: require("typebox/type"),
|
|
20
|
+
system: require("./typebox-system-lite.mjs")
|
|
21
|
+
};
|
|
22
|
+
} catch {}
|
|
23
|
+
const req = syncRequire(import.meta, import.meta.url);
|
|
24
|
+
if (!req) throw new Error("TypeBox couldn't be loaded: this runtime has no synchronous module loader. Build with the AOT plugin ('elysia/plugin/aot') so TypeBox is wired statically, or register it manually with setupTypebox({ typebox: { type, system } }).");
|
|
25
|
+
return {
|
|
26
|
+
type: req("typebox/type"),
|
|
27
|
+
system: req("typebox/system")
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const loadTypeNamespace = () => namespaces ?? load();
|
|
31
|
+
let typeUsed = false;
|
|
32
|
+
const markTypeUsed = () => {
|
|
33
|
+
typeUsed = true;
|
|
34
|
+
};
|
|
35
|
+
const isTypeUsed = () => typeUsed || namespaces !== void 0;
|
|
36
|
+
const isTypeNamespaceLoaded = () => namespaces !== void 0;
|
|
37
|
+
function stub(get) {
|
|
38
|
+
return function(...args) {
|
|
39
|
+
load();
|
|
40
|
+
return get()(...args);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
let Codec = stub(() => Codec);
|
|
44
|
+
let Composite = stub(() => Composite);
|
|
45
|
+
let Decode = stub(() => Decode);
|
|
46
|
+
let Evaluate = stub(() => Evaluate);
|
|
47
|
+
let Interface = stub(() => Interface);
|
|
48
|
+
let Intersect = stub(() => Intersect);
|
|
49
|
+
let Mapped = stub(() => Mapped);
|
|
50
|
+
let Module = stub(() => Module);
|
|
51
|
+
let Null = stub(() => Null);
|
|
52
|
+
let Omit = stub(() => Omit);
|
|
53
|
+
let Partial = stub(() => Partial);
|
|
54
|
+
let Pick = stub(() => Pick);
|
|
55
|
+
let ReadonlyObject = stub(() => ReadonlyObject);
|
|
56
|
+
let Ref = stub(() => Ref);
|
|
57
|
+
let Refine = stub(() => Refine);
|
|
58
|
+
let Required = stub(() => Required);
|
|
59
|
+
let Undefined = stub(() => Undefined);
|
|
60
|
+
let Unsafe = stub(() => Unsafe);
|
|
61
|
+
function injectTypeboxType(typebox) {
|
|
62
|
+
const first = namespaces === void 0;
|
|
63
|
+
namespaces = typebox;
|
|
64
|
+
Codec = typebox.type.Codec;
|
|
65
|
+
Composite = typebox.type.Composite;
|
|
66
|
+
Decode = typebox.type.Decode;
|
|
67
|
+
Evaluate = typebox.type.Evaluate;
|
|
68
|
+
Interface = typebox.type.Interface;
|
|
69
|
+
Intersect = typebox.type.Intersect;
|
|
70
|
+
Mapped = typebox.type.Mapped;
|
|
71
|
+
Module = typebox.type.Module;
|
|
72
|
+
Null = typebox.type.Null;
|
|
73
|
+
Omit = typebox.type.Omit;
|
|
74
|
+
Partial = typebox.type.Partial;
|
|
75
|
+
Pick = typebox.type.Pick;
|
|
76
|
+
ReadonlyObject = typebox.type.ReadonlyObject;
|
|
77
|
+
Ref = typebox.type.Ref;
|
|
78
|
+
Refine = typebox.type.Refine;
|
|
79
|
+
Required = typebox.type.Required;
|
|
80
|
+
Undefined = typebox.type.Undefined;
|
|
81
|
+
Unsafe = typebox.type.Unsafe;
|
|
82
|
+
if (first) typebox.system.Settings.Set({ unionPrioritySort: false });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { Codec, Composite, Decode, Evaluate, Interface, Intersect, Mapped, Module, Null, Omit, Partial, Pick, ReadonlyObject, Ref, Refine, Required, Undefined, Unsafe, injectTypeboxType, isTypeNamespaceLoaded, isTypeUsed, loadTypeNamespace, markTypeUsed };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TypeboxNamespaces } from "./typebox-value.js";
|
|
2
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
3
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
4
|
+
import { Compile } from "typebox/compile";
|
|
5
|
+
|
|
6
|
+
//#region src/type/typebox-value-live.d.ts
|
|
7
|
+
declare function injectTypebox(_typebox?: TypeboxNamespaces): void;
|
|
8
|
+
declare function warmTypebox(): void;
|
|
9
|
+
declare function preloadTypebox(): Promise<void> | undefined;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, type TypeboxNamespaces, injectTypebox, preloadTypebox, warmTypebox };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
3
|
+
let typebox_schema = require("typebox/schema");
|
|
4
|
+
let typebox_value = require("typebox/value");
|
|
5
|
+
let typebox_compile = require("typebox/compile");
|
|
6
|
+
let typebox_system = require("typebox/system");
|
|
7
|
+
|
|
8
|
+
//#region src/type/typebox-value-live.ts
|
|
9
|
+
typebox_system.Settings.Set({ unionPrioritySort: false });
|
|
10
|
+
function injectTypebox(_typebox) {}
|
|
11
|
+
function warmTypebox() {}
|
|
12
|
+
function preloadTypebox() {}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.Build = typebox_schema.Build;
|
|
16
|
+
exports.Check = typebox_value.Check;
|
|
17
|
+
exports.Clean = typebox_value.Clean;
|
|
18
|
+
exports.Clone = typebox_value.Clone;
|
|
19
|
+
exports.Compile = typebox_compile.Compile;
|
|
20
|
+
exports.Create = typebox_value.Create;
|
|
21
|
+
exports.Decode = typebox_value.Decode;
|
|
22
|
+
exports.DecodeUnsafe = typebox_value.DecodeUnsafe;
|
|
23
|
+
exports.Default = typebox_value.Default;
|
|
24
|
+
exports.Encode = typebox_value.Encode;
|
|
25
|
+
exports.EncodeUnsafe = typebox_value.EncodeUnsafe;
|
|
26
|
+
exports.Errors = typebox_value.Errors;
|
|
27
|
+
exports.HasCodec = typebox_value.HasCodec;
|
|
28
|
+
exports.SchemaCompile = typebox_schema.Compile;
|
|
29
|
+
exports.injectTypebox = injectTypebox;
|
|
30
|
+
exports.preloadTypebox = preloadTypebox;
|
|
31
|
+
exports.warmTypebox = warmTypebox;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
2
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
3
|
+
import { Compile } from "typebox/compile";
|
|
4
|
+
import { Settings } from "typebox/system";
|
|
5
|
+
|
|
6
|
+
//#region src/type/typebox-value-live.ts
|
|
7
|
+
Settings.Set({ unionPrioritySort: false });
|
|
8
|
+
function injectTypebox(_typebox) {}
|
|
9
|
+
function warmTypebox() {}
|
|
10
|
+
function preloadTypebox() {}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, injectTypebox, preloadTypebox, warmTypebox };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
2
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
3
|
+
import { Compile } from "typebox/compile";
|
|
4
|
+
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
3
|
+
let typebox_schema = require("typebox/schema");
|
|
4
|
+
let typebox_value = require("typebox/value");
|
|
5
|
+
let typebox_compile = require("typebox/compile");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'Build', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return typebox_schema.Build;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, 'Check', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return typebox_value.Check;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, 'Clean', {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return typebox_value.Clean;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, 'Clone', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return typebox_value.Clone;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, 'Compile', {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return typebox_compile.Compile;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, 'Create', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return typebox_value.Create;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, 'Decode', {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return typebox_value.Decode;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, 'DecodeUnsafe', {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return typebox_value.DecodeUnsafe;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, 'Default', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return typebox_value.Default;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, 'Encode', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return typebox_value.Encode;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, 'EncodeUnsafe', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return typebox_value.EncodeUnsafe;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, 'Errors', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return typebox_value.Errors;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, 'HasCodec', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return typebox_value.HasCodec;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, 'SchemaCompile', {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return typebox_schema.Compile;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
2
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
3
|
+
import { Compile } from "typebox/compile";
|
|
4
|
+
|
|
5
|
+
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TypeboxTypeNamespaces } from "./typebox-type.js";
|
|
2
|
+
import { TypeboxNamespaces } from "./typebox-value.js";
|
|
3
|
+
|
|
4
|
+
//#region src/type/typebox-value-require.d.ts
|
|
5
|
+
declare const requireTypebox: () => TypeboxNamespaces | undefined;
|
|
6
|
+
declare const importTypebox: () => Promise<[TypeboxTypeNamespaces, TypeboxNamespaces]> | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { importTypebox, requireTypebox };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/type/typebox-value-require.ts
|
|
4
|
+
const fromOps = (ops) => ({
|
|
5
|
+
value: ops,
|
|
6
|
+
schema: {
|
|
7
|
+
Compile: ops.SchemaCompile,
|
|
8
|
+
Build: ops.Build
|
|
9
|
+
},
|
|
10
|
+
compile: { Compile: ops.Compile }
|
|
11
|
+
});
|
|
12
|
+
const requireTypebox = () => {
|
|
13
|
+
if (typeof require === "function") try {
|
|
14
|
+
return fromOps(require("./typebox-value-ops.mjs"));
|
|
15
|
+
} catch {}
|
|
16
|
+
};
|
|
17
|
+
const importTypebox = () => Promise.all([
|
|
18
|
+
import("typebox/type"),
|
|
19
|
+
import("./typebox-system-lite.mjs"),
|
|
20
|
+
import("./typebox-value-ops.mjs")
|
|
21
|
+
]).then(([type, system, ops]) => [{
|
|
22
|
+
type,
|
|
23
|
+
system
|
|
24
|
+
}, fromOps(ops)]);
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.importTypebox = importTypebox;
|
|
28
|
+
exports.requireTypebox = requireTypebox;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/type/typebox-value-require.ts
|
|
2
|
+
const fromOps = (ops) => ({
|
|
3
|
+
value: ops,
|
|
4
|
+
schema: {
|
|
5
|
+
Compile: ops.SchemaCompile,
|
|
6
|
+
Build: ops.Build
|
|
7
|
+
},
|
|
8
|
+
compile: { Compile: ops.Compile }
|
|
9
|
+
});
|
|
10
|
+
const requireTypebox = () => {
|
|
11
|
+
if (typeof require === "function") try {
|
|
12
|
+
return fromOps(require("./typebox-value-ops.mjs"));
|
|
13
|
+
} catch {}
|
|
14
|
+
};
|
|
15
|
+
const importTypebox = () => Promise.all([
|
|
16
|
+
import("typebox/type"),
|
|
17
|
+
import("./typebox-system-lite.mjs"),
|
|
18
|
+
import("./typebox-value-ops.mjs")
|
|
19
|
+
]).then(([type, system, ops]) => [{
|
|
20
|
+
type,
|
|
21
|
+
system
|
|
22
|
+
}, fromOps(ops)]);
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { importTypebox, requireTypebox };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as _$typebox_schema0 from "typebox/schema";
|
|
2
|
+
import { Build as Build$1, Compile as Compile$1 } from "typebox/schema";
|
|
3
|
+
import * as _$typebox_value0 from "typebox/value";
|
|
4
|
+
import { Check as Check$1, Clean as Clean$1, Clone as Clone$1, Create as Create$1, Decode as Decode$1, DecodeUnsafe as DecodeUnsafe$1, Default as Default$1, Encode as Encode$1, EncodeUnsafe as EncodeUnsafe$1, Errors as Errors$1, HasCodec as HasCodec$1 } from "typebox/value";
|
|
5
|
+
import * as _$typebox_compile0 from "typebox/compile";
|
|
6
|
+
import { Compile as Compile$2 } from "typebox/compile";
|
|
7
|
+
|
|
8
|
+
//#region src/type/typebox-value.d.ts
|
|
9
|
+
interface TypeboxNamespaces {
|
|
10
|
+
value: Pick<typeof _$typebox_value0, 'Check' | 'Clean' | 'Clone' | 'Create' | 'Decode' | 'DecodeUnsafe' | 'Default' | 'Encode' | 'EncodeUnsafe' | 'Errors' | 'HasCodec'>;
|
|
11
|
+
schema: Pick<typeof _$typebox_schema0, 'Compile' | 'Build'>;
|
|
12
|
+
compile: Pick<typeof _$typebox_compile0, 'Compile'>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
|
|
16
|
+
*/
|
|
17
|
+
declare function load(): void;
|
|
18
|
+
declare function preloadTypebox(): Promise<void> | undefined;
|
|
19
|
+
declare let Check: typeof Check$1;
|
|
20
|
+
declare let Clean: typeof Clean$1;
|
|
21
|
+
declare let Clone: typeof Clone$1;
|
|
22
|
+
declare let Create: typeof Create$1;
|
|
23
|
+
declare let Decode: typeof Decode$1;
|
|
24
|
+
declare let DecodeUnsafe: typeof DecodeUnsafe$1;
|
|
25
|
+
declare let Default: typeof Default$1;
|
|
26
|
+
declare let Encode: typeof Encode$1;
|
|
27
|
+
declare let EncodeUnsafe: typeof EncodeUnsafe$1;
|
|
28
|
+
declare let Errors: typeof Errors$1;
|
|
29
|
+
declare let HasCodec: typeof HasCodec$1;
|
|
30
|
+
declare let SchemaCompile: typeof Compile$1;
|
|
31
|
+
declare let Build: typeof Build$1;
|
|
32
|
+
declare let Compile: typeof Compile$2;
|
|
33
|
+
declare function injectTypebox(typebox: TypeboxNamespaces): void;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, TypeboxNamespaces, injectTypebox, preloadTypebox, load as warmTypebox };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_type_sync_require = require('./sync-require.js');
|
|
3
|
+
const require_type_typebox_type = require('./typebox-type.js');
|
|
4
|
+
const require_type_typebox_value_require = require('./typebox-value-require.js');
|
|
5
|
+
|
|
6
|
+
//#region src/type/typebox-value.ts
|
|
7
|
+
let loaded = false;
|
|
8
|
+
/**
|
|
9
|
+
* Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
|
|
10
|
+
*/
|
|
11
|
+
function load() {
|
|
12
|
+
if (loaded) return;
|
|
13
|
+
require_type_typebox_type.loadTypeNamespace();
|
|
14
|
+
injectTypebox(resolveNamespaces());
|
|
15
|
+
}
|
|
16
|
+
function preloadTypebox() {
|
|
17
|
+
if (loaded || !require_type_typebox_type.isTypeUsed()) return;
|
|
18
|
+
return require_type_typebox_value_require.importTypebox()?.then(([typeSide, valueSide]) => {
|
|
19
|
+
if (loaded) return;
|
|
20
|
+
if (!require_type_typebox_type.isTypeNamespaceLoaded()) require_type_typebox_type.injectTypeboxType(typeSide);
|
|
21
|
+
injectTypebox(valueSide);
|
|
22
|
+
}, () => {});
|
|
23
|
+
}
|
|
24
|
+
function resolveNamespaces() {
|
|
25
|
+
const bundled = require_type_typebox_value_require.requireTypebox();
|
|
26
|
+
if (bundled) return bundled;
|
|
27
|
+
const req = require_type_sync_require.syncRequire({}, require("url").pathToFileURL(__filename).href);
|
|
28
|
+
if (!req) throw new Error("TypeBox couldn't be loaded: runtime has no synchronous module loader. Try building with the AOT plugin or register it with setupTypebox()");
|
|
29
|
+
return {
|
|
30
|
+
value: req("typebox/value"),
|
|
31
|
+
schema: req("typebox/schema"),
|
|
32
|
+
compile: req("typebox/compile")
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function stub(get) {
|
|
36
|
+
return function(...args) {
|
|
37
|
+
load();
|
|
38
|
+
return get()(...args);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
let Check = stub(() => Check);
|
|
42
|
+
let Clean = stub(() => Clean);
|
|
43
|
+
let Clone = stub(() => Clone);
|
|
44
|
+
let Create = stub(() => Create);
|
|
45
|
+
let Decode = stub(() => Decode);
|
|
46
|
+
let DecodeUnsafe = stub(() => DecodeUnsafe);
|
|
47
|
+
let Default = stub(() => Default);
|
|
48
|
+
let Encode = stub(() => Encode);
|
|
49
|
+
let EncodeUnsafe = stub(() => EncodeUnsafe);
|
|
50
|
+
let Errors = stub(() => Errors);
|
|
51
|
+
let HasCodec = stub(() => HasCodec);
|
|
52
|
+
let SchemaCompile = stub(() => SchemaCompile);
|
|
53
|
+
let Build = stub(() => Build);
|
|
54
|
+
let Compile = stub(() => Compile);
|
|
55
|
+
function injectTypebox(typebox) {
|
|
56
|
+
loaded = true;
|
|
57
|
+
require_type_typebox_type.loadTypeNamespace();
|
|
58
|
+
Check = typebox.value.Check;
|
|
59
|
+
Clean = typebox.value.Clean;
|
|
60
|
+
Clone = typebox.value.Clone;
|
|
61
|
+
Create = typebox.value.Create;
|
|
62
|
+
Decode = typebox.value.Decode;
|
|
63
|
+
DecodeUnsafe = typebox.value.DecodeUnsafe;
|
|
64
|
+
Default = typebox.value.Default;
|
|
65
|
+
Encode = typebox.value.Encode;
|
|
66
|
+
EncodeUnsafe = typebox.value.EncodeUnsafe;
|
|
67
|
+
Errors = typebox.value.Errors;
|
|
68
|
+
HasCodec = typebox.value.HasCodec;
|
|
69
|
+
SchemaCompile = typebox.schema.Compile;
|
|
70
|
+
Build = typebox.schema.Build;
|
|
71
|
+
Compile = typebox.compile.Compile;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
Object.defineProperty(exports, 'Build', {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return Build;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, 'Check', {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () {
|
|
84
|
+
return Check;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, 'Clean', {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return Clean;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports, 'Clone', {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function () {
|
|
96
|
+
return Clone;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
Object.defineProperty(exports, 'Compile', {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () {
|
|
102
|
+
return Compile;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(exports, 'Create', {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function () {
|
|
108
|
+
return Create;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(exports, 'Decode', {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () {
|
|
114
|
+
return Decode;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(exports, 'DecodeUnsafe', {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function () {
|
|
120
|
+
return DecodeUnsafe;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(exports, 'Default', {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () {
|
|
126
|
+
return Default;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(exports, 'Encode', {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function () {
|
|
132
|
+
return Encode;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(exports, 'EncodeUnsafe', {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () {
|
|
138
|
+
return EncodeUnsafe;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(exports, 'Errors', {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function () {
|
|
144
|
+
return Errors;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
Object.defineProperty(exports, 'HasCodec', {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () {
|
|
150
|
+
return HasCodec;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(exports, 'SchemaCompile', {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () {
|
|
156
|
+
return SchemaCompile;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
exports.injectTypebox = injectTypebox;
|
|
160
|
+
exports.preloadTypebox = preloadTypebox;
|
|
161
|
+
exports.warmTypebox = load;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { syncRequire } from "./sync-require.mjs";
|
|
2
|
+
import { injectTypeboxType, isTypeNamespaceLoaded, isTypeUsed, loadTypeNamespace } from "./typebox-type.mjs";
|
|
3
|
+
import { importTypebox, requireTypebox } from "./typebox-value-require.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/type/typebox-value.ts
|
|
6
|
+
let loaded = false;
|
|
7
|
+
/**
|
|
8
|
+
* Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
|
|
9
|
+
*/
|
|
10
|
+
function load() {
|
|
11
|
+
if (loaded) return;
|
|
12
|
+
loadTypeNamespace();
|
|
13
|
+
injectTypebox(resolveNamespaces());
|
|
14
|
+
}
|
|
15
|
+
function preloadTypebox() {
|
|
16
|
+
if (loaded || !isTypeUsed()) return;
|
|
17
|
+
return importTypebox()?.then(([typeSide, valueSide]) => {
|
|
18
|
+
if (loaded) return;
|
|
19
|
+
if (!isTypeNamespaceLoaded()) injectTypeboxType(typeSide);
|
|
20
|
+
injectTypebox(valueSide);
|
|
21
|
+
}, () => {});
|
|
22
|
+
}
|
|
23
|
+
function resolveNamespaces() {
|
|
24
|
+
const bundled = requireTypebox();
|
|
25
|
+
if (bundled) return bundled;
|
|
26
|
+
const req = syncRequire(import.meta, import.meta.url);
|
|
27
|
+
if (!req) throw new Error("TypeBox couldn't be loaded: runtime has no synchronous module loader. Try building with the AOT plugin or register it with setupTypebox()");
|
|
28
|
+
return {
|
|
29
|
+
value: req("typebox/value"),
|
|
30
|
+
schema: req("typebox/schema"),
|
|
31
|
+
compile: req("typebox/compile")
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function stub(get) {
|
|
35
|
+
return function(...args) {
|
|
36
|
+
load();
|
|
37
|
+
return get()(...args);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
let Check = stub(() => Check);
|
|
41
|
+
let Clean = stub(() => Clean);
|
|
42
|
+
let Clone = stub(() => Clone);
|
|
43
|
+
let Create = stub(() => Create);
|
|
44
|
+
let Decode = stub(() => Decode);
|
|
45
|
+
let DecodeUnsafe = stub(() => DecodeUnsafe);
|
|
46
|
+
let Default = stub(() => Default);
|
|
47
|
+
let Encode = stub(() => Encode);
|
|
48
|
+
let EncodeUnsafe = stub(() => EncodeUnsafe);
|
|
49
|
+
let Errors = stub(() => Errors);
|
|
50
|
+
let HasCodec = stub(() => HasCodec);
|
|
51
|
+
let SchemaCompile = stub(() => SchemaCompile);
|
|
52
|
+
let Build = stub(() => Build);
|
|
53
|
+
let Compile = stub(() => Compile);
|
|
54
|
+
function injectTypebox(typebox) {
|
|
55
|
+
loaded = true;
|
|
56
|
+
loadTypeNamespace();
|
|
57
|
+
Check = typebox.value.Check;
|
|
58
|
+
Clean = typebox.value.Clean;
|
|
59
|
+
Clone = typebox.value.Clone;
|
|
60
|
+
Create = typebox.value.Create;
|
|
61
|
+
Decode = typebox.value.Decode;
|
|
62
|
+
DecodeUnsafe = typebox.value.DecodeUnsafe;
|
|
63
|
+
Default = typebox.value.Default;
|
|
64
|
+
Encode = typebox.value.Encode;
|
|
65
|
+
EncodeUnsafe = typebox.value.EncodeUnsafe;
|
|
66
|
+
Errors = typebox.value.Errors;
|
|
67
|
+
HasCodec = typebox.value.HasCodec;
|
|
68
|
+
SchemaCompile = typebox.schema.Compile;
|
|
69
|
+
Build = typebox.schema.Build;
|
|
70
|
+
Compile = typebox.compile.Compile;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, injectTypebox, preloadTypebox, load as warmTypebox };
|
package/dist/type/utils.js
CHANGED
|
@@ -5,18 +5,9 @@ const require_type_validator_clean_safe = require('./validator/clean-safe.js');
|
|
|
5
5
|
//#region src/type/utils.ts
|
|
6
6
|
const prunePrimitive = (node) => "~elyTyp" in node && require_type_constants.primitiveElysiaTypes.has(node["~elyTyp"]);
|
|
7
7
|
const refTarget = (node) => node.$ref && node.$defs ? node.$defs[node.$ref] : void 0;
|
|
8
|
-
const typeSets = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
function typeSetOf(types) {
|
|
10
|
-
let set = typeSets.get(types);
|
|
11
|
-
if (set === void 0) {
|
|
12
|
-
set = new Set(types);
|
|
13
|
-
typeSets.set(types, set);
|
|
14
|
-
}
|
|
15
|
-
return set;
|
|
16
|
-
}
|
|
17
8
|
function hasTypes(types, schema) {
|
|
18
9
|
if ("~standard" in schema) return false;
|
|
19
|
-
const set =
|
|
10
|
+
const set = new Set(types);
|
|
20
11
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
21
12
|
const wantsFiles = set.has(require_type_constants.ELYSIA_TYPES.Files);
|
|
22
13
|
const test = (node) => {
|
package/dist/type/utils.mjs
CHANGED
|
@@ -4,18 +4,9 @@ import { schemaSome } from "./validator/clean-safe.mjs";
|
|
|
4
4
|
//#region src/type/utils.ts
|
|
5
5
|
const prunePrimitive = (node) => "~elyTyp" in node && primitiveElysiaTypes.has(node["~elyTyp"]);
|
|
6
6
|
const refTarget = (node) => node.$ref && node.$defs ? node.$defs[node.$ref] : void 0;
|
|
7
|
-
const typeSets = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
function typeSetOf(types) {
|
|
9
|
-
let set = typeSets.get(types);
|
|
10
|
-
if (set === void 0) {
|
|
11
|
-
set = new Set(types);
|
|
12
|
-
typeSets.set(types, set);
|
|
13
|
-
}
|
|
14
|
-
return set;
|
|
15
|
-
}
|
|
16
7
|
function hasTypes(types, schema) {
|
|
17
8
|
if ("~standard" in schema) return false;
|
|
18
|
-
const set =
|
|
9
|
+
const set = new Set(types);
|
|
19
10
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
20
11
|
const wantsFiles = set.has(ELYSIA_TYPES.Files);
|
|
21
12
|
const test = (node) => {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
//#region src/type/validator/clean-safe.d.ts
|
|
2
|
-
declare function schemaSome(schema: any, test: (node: any) => boolean, seen?: WeakSet<object>, prune?: (node: any) => boolean): boolean;
|
|
2
|
+
declare function schemaSome(schema: any, test: (node: any) => boolean, seen?: WeakSet<object>, prune?: (node: any) => boolean, conditional?: boolean): boolean;
|
|
3
3
|
declare const schemaHasDangerousProperties: (schema: any) => boolean;
|
|
4
|
-
declare const schemaContainsRef: (node: any, seen?: WeakSet<WeakKey>) => boolean;
|
|
5
|
-
declare function isCleanSafeNode(node: any, visiting: WeakSet<object>, clean: WeakSet<object>): boolean;
|
|
6
4
|
declare function isFullyClosedObject(schema: any): boolean;
|
|
7
5
|
//#endregion
|
|
8
|
-
export {
|
|
6
|
+
export { isFullyClosedObject, schemaHasDangerousProperties, schemaSome };
|