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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isNotEmpty } from "../../utils.mjs";
|
|
2
|
+
import { hasSyncHmac } from "../../cookie/crypto.mjs";
|
|
2
3
|
import { Capture } from "../aot.mjs";
|
|
3
4
|
import { frozenRootOf, resolvedTraceOf, traceCapabilityRequired } from "../../generation.mjs";
|
|
4
|
-
import { hasSyncHmac } from "../../cookie/crypto.mjs";
|
|
5
|
-
import { compileCookieConfig } from "../../cookie/config.mjs";
|
|
6
5
|
import { isAsyncFunction, isAsyncLifecycle, mayReturnPromise } from "../utils.mjs";
|
|
7
6
|
import { JITProbe } from "../jit-probe.mjs";
|
|
8
7
|
import { mergeInference, sucrose } from "../../sucrose.mjs";
|
|
8
|
+
import { Reconstrct } from "./reconstruct.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/compile/handler/descriptor.ts
|
|
11
11
|
/**
|
|
@@ -14,16 +14,7 @@ import { mergeInference, sucrose } from "../../sucrose.mjs";
|
|
|
14
14
|
*/
|
|
15
15
|
const routeDescriptors = /* @__PURE__ */ new WeakMap();
|
|
16
16
|
const noTracePhases = /* @__PURE__ */ new Set();
|
|
17
|
-
const
|
|
18
|
-
const mayReturnIdentifierCache = /* @__PURE__ */ new WeakMap();
|
|
19
|
-
function mayReturnIdentifier(fn) {
|
|
20
|
-
let result = mayReturnIdentifierCache.get(fn);
|
|
21
|
-
if (result !== void 0) return result;
|
|
22
|
-
result = matchReturnIdentifier.test(fn.toString());
|
|
23
|
-
mayReturnIdentifierCache.set(fn, result);
|
|
24
|
-
return result;
|
|
25
|
-
}
|
|
26
|
-
const lifecycleMayReturnPromise = (handlers, observed) => handlers ? Array.isArray(handlers) ? handlers.some((fn) => !isAsyncFunction(fn) && (mayReturnPromise(fn) || observed && mayReturnIdentifier(fn))) : !isAsyncFunction(handlers) && (mayReturnPromise(handlers) || observed && mayReturnIdentifier(handlers)) : false;
|
|
17
|
+
const lifecycleMayReturnPromise = (handlers) => handlers ? Array.isArray(handlers) ? handlers.some(mayReturnPromise) : mayReturnPromise(handlers) : false;
|
|
27
18
|
const compactPrefixInference = /* @__PURE__ */ new WeakMap();
|
|
28
19
|
const compactPrefixAsync = /* @__PURE__ */ new WeakMap();
|
|
29
20
|
const inferCompactPrefix = (prefix) => {
|
|
@@ -65,27 +56,13 @@ function compactPrefixForcesAsync(prefix) {
|
|
|
65
56
|
const item = pending[i];
|
|
66
57
|
for (let j = 0; !value && j < item.added.length; j++) {
|
|
67
58
|
const fn = item.added[j];
|
|
68
|
-
value =
|
|
59
|
+
value = mayReturnPromise(fn);
|
|
69
60
|
}
|
|
70
61
|
compactPrefixAsync.set(item, value);
|
|
71
62
|
}
|
|
72
63
|
return value;
|
|
73
64
|
}
|
|
74
|
-
const isAsyncValidator = (vali) => vali?.isAsync ?? true;
|
|
75
|
-
const mayReturnPromiseValidator = (vali) => vali?.mayReturnPromise === true;
|
|
76
|
-
/**
|
|
77
|
-
* Extracted from `buildNativeStaticResponse`'s for-in check so the native
|
|
78
|
-
* static promotion predicate
|
|
79
|
-
*/
|
|
80
|
-
function isEmptyPipelineHook(hook) {
|
|
81
|
-
if (!hook) return true;
|
|
82
|
-
for (const key in hook) {
|
|
83
|
-
if (key === "detail" || key === "tags") continue;
|
|
84
|
-
const value = hook[key];
|
|
85
|
-
if (value !== void 0 && value !== false && (!Array.isArray(value) || value.length)) return false;
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
65
|
+
const isAsyncValidator = (vali) => (vali?.isAsync ?? true) || vali?.mayReturnPromise === true;
|
|
89
66
|
function describeRoute(input) {
|
|
90
67
|
const { method, handler, root, adapter, hook, buildValidator, isHandleFunction, isStaticResponse, isPromiseHandler } = input;
|
|
91
68
|
const vali = buildValidator();
|
|
@@ -99,14 +76,13 @@ function describeRoute(input) {
|
|
|
99
76
|
const hasMergeBody = !!hook?.schemas?.some((s) => s?.body);
|
|
100
77
|
const bodylessMethod = method === "GET" || method === "HEAD";
|
|
101
78
|
const hasBody = !!hook?.body || hasMergeBody || !bodylessMethod && (parseLength > 0 || inference.body) && parseFirst !== "none";
|
|
102
|
-
const bodyValiIsAsync = hasBody &&
|
|
103
|
-
const headersValiIsAsync = vali?.headers &&
|
|
104
|
-
const paramsValiIsAsync = vali?.params &&
|
|
105
|
-
const queryValiIsAsync = vali?.query &&
|
|
106
|
-
const cookieValidIsAsync = vali?.cookie &&
|
|
107
|
-
const appCookieConfig = frozenRootOf(root)["~config"]?.cookie;
|
|
79
|
+
const bodyValiIsAsync = hasBody && isAsyncValidator(vali?.body);
|
|
80
|
+
const headersValiIsAsync = vali?.headers && isAsyncValidator(vali.headers);
|
|
81
|
+
const paramsValiIsAsync = vali?.params && isAsyncValidator(vali.params);
|
|
82
|
+
const queryValiIsAsync = vali?.query && isAsyncValidator(vali.query);
|
|
83
|
+
const cookieValidIsAsync = vali?.cookie && isAsyncValidator(vali.cookie);
|
|
108
84
|
const needsCookie = !!vali?.cookie || !!inference.cookie;
|
|
109
|
-
const cookieConfig = needsCookie ?
|
|
85
|
+
const cookieConfig = needsCookie ? Reconstrct.cookie(hook, root) : void 0;
|
|
110
86
|
const hasCookieSign = !!cookieConfig?.hasSign;
|
|
111
87
|
const syncCookieSign = hasCookieSign && hasSyncHmac && !Capture.isCapturing();
|
|
112
88
|
const asyncCookieSign = hasCookieSign && !syncCookieSign;
|
|
@@ -130,19 +106,20 @@ function describeRoute(input) {
|
|
|
130
106
|
const traceHandleOn = phaseOn("handle");
|
|
131
107
|
let responseValiAsync = false;
|
|
132
108
|
if (vali?.response) {
|
|
133
|
-
for (const code in vali.response) if (isAsyncValidator(vali.response[code])
|
|
109
|
+
for (const code in vali.response) if (isAsyncValidator(vali.response[code])) {
|
|
134
110
|
responseValiAsync = true;
|
|
135
111
|
break;
|
|
136
112
|
}
|
|
137
113
|
}
|
|
138
114
|
const handlerIsAsync = isHandleFunction && isAsyncFunction(handler);
|
|
139
|
-
const errorHookForcesAsync = hasErrorHook && (hasAfterHandle || hasMapResponse || hasResponseValidator || isAsyncLifecycle(hook?.error) || lifecycleMayReturnPromise(hook?.error
|
|
115
|
+
const errorHookForcesAsync = hasErrorHook && (hasAfterHandle || hasMapResponse || hasResponseValidator || isAsyncLifecycle(hook?.error) || lifecycleMayReturnPromise(hook?.error));
|
|
140
116
|
const afterResponseForcesAsync = hasStaticAfterResponse && isAsyncLifecycle(hook?.afterResponse) || hasAfterResponse && (hasAfterHandle || hasMapResponse || hasResponseValidator || hasErrorHook);
|
|
141
|
-
const traceForcesAsync = (traceHandleOn || phaseOn("error") || phaseOn("afterResponse")) && isHandleFunction && !handlerIsAsync &&
|
|
142
|
-
const handlerResultObserved = isHandleFunction && !handlerIsAsync && (hasResponseValidator || hasAfterHandle || hasMapResponse) &&
|
|
143
|
-
const lifecycleForcesAsync = !!hook && ((beforeHandlePrefix ? compactPrefixForcesAsync(beforeHandlePrefix) : false) || lifecycleMayReturnPromise(hook.beforeHandle
|
|
144
|
-
const isAsync = hasBody || handlerIsAsync || errorHookForcesAsync || traceForcesAsync || afterResponseForcesAsync || handlerResultObserved || lifecycleForcesAsync || asyncCookieSign || responseValiAsync ||
|
|
117
|
+
const traceForcesAsync = (traceHandleOn || phaseOn("error") || phaseOn("afterResponse")) && isHandleFunction && !handlerIsAsync && mayReturnPromise(handler);
|
|
118
|
+
const handlerResultObserved = isHandleFunction && !handlerIsAsync && (hasResponseValidator || hasAfterHandle || hasMapResponse) && mayReturnPromise(handler);
|
|
119
|
+
const lifecycleForcesAsync = !!hook && ((beforeHandlePrefix ? compactPrefixForcesAsync(beforeHandlePrefix) : false) || lifecycleMayReturnPromise(hook.beforeHandle) || lifecycleMayReturnPromise(hook.transform) || lifecycleMayReturnPromise(hook.afterHandle) || lifecycleMayReturnPromise(hook.mapResponse));
|
|
120
|
+
const isAsync = hasBody || handlerIsAsync || errorHookForcesAsync || traceForcesAsync || afterResponseForcesAsync || handlerResultObserved || lifecycleForcesAsync || asyncCookieSign || responseValiAsync || headersValiIsAsync || paramsValiIsAsync || queryValiIsAsync || cookieValidIsAsync;
|
|
145
121
|
const callHandlerSyncOnAsync = isAsync && isHandleFunction && !handlerIsAsync;
|
|
122
|
+
const tail = isAsync && !(hasErrorHook && hasMapResponse) && !hasBody && !handlerIsAsync && !asyncCookieSign && !responseValiAsync && !hasTrace && !beforeHandlePrefix?.length && !bodyValiIsAsync && !headersValiIsAsync && !paramsValiIsAsync && !queryValiIsAsync && !cookieValidIsAsync && !(hook && (isAsyncLifecycle(hook.afterHandle) || isAsyncLifecycle(hook.beforeHandle) || isAsyncLifecycle(hook.transform) || isAsyncLifecycle(hook.mapResponse) || isAsyncLifecycle(hook.error)));
|
|
146
123
|
const syncErrorHook = hasErrorHook && !isAsync && !hasTrace;
|
|
147
124
|
const syncAfterResponse = hasAfterResponse && !isAsync && !hasTrace && !hasErrorHook;
|
|
148
125
|
const handlerKind = isHandleFunction ? "function" : isStaticResponse ? "response" : isPromiseHandler ? "promise" : "static-value";
|
|
@@ -153,6 +130,7 @@ function describeRoute(input) {
|
|
|
153
130
|
descriptor: {
|
|
154
131
|
handlerKind,
|
|
155
132
|
async: !!isAsync,
|
|
133
|
+
tail,
|
|
156
134
|
responseMode,
|
|
157
135
|
hasBeforeHandle,
|
|
158
136
|
hasAfterHandle,
|
|
@@ -191,4 +169,4 @@ function describeRoute(input) {
|
|
|
191
169
|
}
|
|
192
170
|
|
|
193
171
|
//#endregion
|
|
194
|
-
export { describeRoute,
|
|
172
|
+
export { describeRoute, routeDescriptors };
|
|
@@ -4,21 +4,13 @@ import { AnyElysia } from "../../base.js";
|
|
|
4
4
|
|
|
5
5
|
//#region src/compile/handler/frozen-validator.d.ts
|
|
6
6
|
declare const isBridgeNotInitialized: (error: unknown) => boolean;
|
|
7
|
-
|
|
8
|
-
interface SlotCheckClean {
|
|
9
|
-
check: (value: unknown) => boolean;
|
|
10
|
-
clean?: (value: unknown) => unknown;
|
|
11
|
-
decode?: (value: unknown) => unknown;
|
|
12
|
-
}
|
|
13
|
-
declare function isCompactDiagnosable(schema: any): boolean;
|
|
14
|
-
declare function isCompactWalkable(schema: any): boolean;
|
|
7
|
+
declare function isCompactWalkable(schema: any, lookThrough?: boolean): boolean;
|
|
15
8
|
declare class FrozenSlotValidator {
|
|
16
9
|
#private;
|
|
17
10
|
isAsync: boolean;
|
|
18
11
|
hasCodec: boolean;
|
|
19
12
|
schema: unknown;
|
|
20
13
|
constructor(frozen: FrozenValidator, schema: unknown, raw: unknown, normalize: boolean | 'exactMirror' | 'typebox' | undefined);
|
|
21
|
-
protected buildCheckClean(frozen: FrozenValidator, schema: unknown, raw: unknown, normalize: boolean | 'exactMirror' | 'typebox' | undefined): SlotCheckClean;
|
|
22
14
|
Check(value: unknown): boolean;
|
|
23
15
|
Errors(value: unknown): unknown[];
|
|
24
16
|
From(value: unknown, type?: string): unknown;
|
|
@@ -32,9 +24,12 @@ interface FrozenRouteValidatorShape {
|
|
|
32
24
|
cookie?: FrozenSlotValidator;
|
|
33
25
|
response?: Record<number, FrozenSlotValidator>;
|
|
34
26
|
}
|
|
27
|
+
declare const REQUEST_SLOTS: readonly ["body", "headers", "query", "params", "cookie"];
|
|
35
28
|
declare const isStandardSchema: (schema: unknown) => schema is object & Record<"~standard", unknown>;
|
|
36
29
|
declare function mergeSchemasAllStandard(schemas: Array<Record<string, unknown>> | undefined): boolean;
|
|
30
|
+
declare function resolveModelRef(schema: unknown, root: AnyElysia): unknown;
|
|
37
31
|
declare function buildFrozenRouteValidator(hook: AnyLocalHook, root: AnyElysia, method: HTTPMethod, path: string): FrozenRouteValidatorShape | undefined;
|
|
32
|
+
declare const isResponseMap: (schema: unknown) => schema is Record<string, unknown>;
|
|
38
33
|
declare function isCapturedBridgeFree(c: CapturedValidator, schema: unknown, coerced?: unknown): boolean;
|
|
39
34
|
//#endregion
|
|
40
|
-
export { buildFrozenRouteValidator, isBridgeNotInitialized, isCapturedBridgeFree,
|
|
35
|
+
export { REQUEST_SLOTS, buildFrozenRouteValidator, isBridgeNotInitialized, isCapturedBridgeFree, isCompactWalkable, isResponseMap, isStandardSchema, mergeSchemasAllStandard, resolveModelRef };
|
|
@@ -9,10 +9,6 @@ const require_validator_index = require('../../validator/index.js');
|
|
|
9
9
|
|
|
10
10
|
//#region src/compile/handler/frozen-validator.ts
|
|
11
11
|
const isBridgeNotInitialized = (error) => error instanceof Error && error.message.startsWith("Typebox module isn't initialized");
|
|
12
|
-
function codecCoercionBridgeFree(f, coerced, raw) {
|
|
13
|
-
return f.k === 1 && !!f.dm && !f.em && !f.ce && f.a !== 1 && !(f.d === 1 && f.ps !== 1) && innerCodecsAligned(f.ic?.length, coerced) && mirrorUnionsAligned(f.u, raw) && mirrorUnionsAligned(f.dm.u, coerced);
|
|
14
|
-
}
|
|
15
|
-
const innerCodecsAligned = (icLength, coerced) => require_compile_aot.reconstruct().collectStringCodecNodes(coerced).length === (icLength ?? 0);
|
|
16
12
|
function mirrorUnionsAligned(u, schema) {
|
|
17
13
|
if (!u) return true;
|
|
18
14
|
const branches = require_compile_aot.reconstruct().collectMirrorUnions(schema);
|
|
@@ -22,25 +18,12 @@ function mirrorUnionsAligned(u, schema) {
|
|
|
22
18
|
}
|
|
23
19
|
function isBridgeFreeComplete(f, schema, raw) {
|
|
24
20
|
if (!f.cm) return false;
|
|
25
|
-
if (
|
|
21
|
+
if (f.k === 1 && !!f.dm && !f.em && !f.ce && f.a !== 1 && !(f.d === 1 && f.ps !== 1) && (f.ic?.length ?? 0) === require_compile_aot.reconstruct().collectStringCodecNodes(schema).length && mirrorUnionsAligned(f.u, raw) && mirrorUnionsAligned(f.dm.u, schema)) return true;
|
|
26
22
|
if (f.e === 1 || f.u || f.dm || f.em || f.k === 1 || f.ce || f.ic || f.a === 1) return false;
|
|
27
23
|
if (f.d === 1 && f.ps !== 1) return false;
|
|
28
24
|
if (require_type_validator_clean_safe.isFullyClosedObject(schema)) return false;
|
|
29
25
|
return true;
|
|
30
26
|
}
|
|
31
|
-
const EMPTY_EXTERNALS = Object.freeze([]);
|
|
32
|
-
function jsTypeMatches(value, type) {
|
|
33
|
-
switch (type) {
|
|
34
|
-
case "string": return typeof value === "string";
|
|
35
|
-
case "number": return typeof value === "number";
|
|
36
|
-
case "integer": return typeof value === "number" && Number.isInteger(value);
|
|
37
|
-
case "boolean": return typeof value === "boolean";
|
|
38
|
-
case "null": return value === null;
|
|
39
|
-
case "array": return Array.isArray(value);
|
|
40
|
-
case "object": return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41
|
-
default: return true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
27
|
const typeError = (schema, instancePath, schemaPath) => ({
|
|
45
28
|
keyword: "type",
|
|
46
29
|
schemaPath,
|
|
@@ -98,63 +81,28 @@ function walkCompactError(schema, value, instancePath, schemaPath) {
|
|
|
98
81
|
}
|
|
99
82
|
return;
|
|
100
83
|
}
|
|
101
|
-
if (typeof type === "
|
|
102
|
-
}
|
|
103
|
-
function bestEffortCodecError(schema, value) {
|
|
104
|
-
if (schema?.type === "object" && typeof value === "object" && value !== null && !Array.isArray(value) && schema.properties) for (const key in schema.properties) {
|
|
105
|
-
if (!(key in value)) continue;
|
|
106
|
-
if (isCompactDiagnosable(schema.properties[key])) continue;
|
|
107
|
-
return {
|
|
108
|
-
keyword: "type",
|
|
109
|
-
schemaPath: `#/properties/${key}`,
|
|
110
|
-
instancePath: `/${key}`,
|
|
111
|
-
params: {},
|
|
112
|
-
message: `must match ${schema.properties[key]?.["~kind"] ?? "schema"}`
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
keyword: "type",
|
|
117
|
-
schemaPath: "#",
|
|
118
|
-
instancePath: "",
|
|
119
|
-
params: {},
|
|
120
|
-
message: `must match ${schema?.["~kind"] ?? "schema"}`
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function isCompactDiagnosable(schema) {
|
|
124
|
-
if (!schema || typeof schema !== "object") return false;
|
|
125
|
-
if (schema.anyOf || schema.oneOf || schema.allOf) return false;
|
|
126
|
-
const type = schema.type;
|
|
127
|
-
if (type === "object") {
|
|
128
|
-
const properties = schema.properties;
|
|
129
|
-
if (properties) {
|
|
130
|
-
for (const key in properties) if (!isCompactDiagnosable(properties[key])) return false;
|
|
131
|
-
}
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
if (type === "array") return isCompactDiagnosable(schema.items);
|
|
135
|
-
return type === "string" || type === "number" || type === "integer" || type === "boolean" || type === "null";
|
|
84
|
+
if (!(type === "string" || type === "number" || type === "boolean" ? typeof value === type : type === "integer" ? Number.isInteger(value) : type !== "null" || value === null)) return typeError(schema, instancePath, schemaPath);
|
|
136
85
|
}
|
|
137
|
-
function isCompactWalkable(schema) {
|
|
86
|
+
function isCompactWalkable(schema, lookThrough = true) {
|
|
138
87
|
if (!schema || typeof schema !== "object") return false;
|
|
139
88
|
const elyTyp = schema["~elyTyp"];
|
|
140
|
-
if (schema.anyOf && (elyTyp === require_type_constants.ELYSIA_TYPES.ObjectString || elyTyp === require_type_constants.ELYSIA_TYPES.ArrayString)) return isCompactWalkable(schema.anyOf[0]);
|
|
89
|
+
if (lookThrough && schema.anyOf && (elyTyp === require_type_constants.ELYSIA_TYPES.ObjectString || elyTyp === require_type_constants.ELYSIA_TYPES.ArrayString)) return isCompactWalkable(schema.anyOf[0]);
|
|
141
90
|
if (schema.anyOf || schema.oneOf || schema.allOf) return false;
|
|
142
91
|
const type = schema.type;
|
|
143
92
|
if (type === "object") {
|
|
144
93
|
const properties = schema.properties;
|
|
145
94
|
if (properties) {
|
|
146
|
-
for (const key in properties) if (!isCompactWalkable(properties[key])) return false;
|
|
95
|
+
for (const key in properties) if (!isCompactWalkable(properties[key], lookThrough)) return false;
|
|
147
96
|
}
|
|
148
97
|
return true;
|
|
149
98
|
}
|
|
150
|
-
if (type === "array") return isCompactWalkable(schema.items);
|
|
99
|
+
if (type === "array") return isCompactWalkable(schema.items, lookThrough);
|
|
151
100
|
return type === "string" || type === "number" || type === "integer" || type === "boolean" || type === "null";
|
|
152
101
|
}
|
|
153
102
|
var FrozenSlotValidator = class {
|
|
154
103
|
#check;
|
|
155
104
|
#clean;
|
|
156
105
|
#decode;
|
|
157
|
-
#hasDefault;
|
|
158
106
|
#defaultFastPath;
|
|
159
107
|
#hasOptional;
|
|
160
108
|
#noValidate;
|
|
@@ -163,13 +111,21 @@ var FrozenSlotValidator = class {
|
|
|
163
111
|
this.hasCodec = false;
|
|
164
112
|
this.schema = schema;
|
|
165
113
|
this.hasCodec = frozen.k === 1;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
114
|
+
if (frozen.ic) require_compile_aot.reconstruct().reconstructInnerCodecs(frozen.ic, schema);
|
|
115
|
+
if (frozen.k === 1 && frozen.dm) {
|
|
116
|
+
const both = require_compile_aot.reconstruct().instantiateFrozenBoth(frozen, schema, raw);
|
|
117
|
+
this.#check = both.check;
|
|
118
|
+
if (normalize !== false) {
|
|
119
|
+
this.#clean = both.clean;
|
|
120
|
+
this.#decode = require_compile_aot.reconstruct().instantiateFrozenDecodeMirror(frozen.dm, schema);
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
const both = frozen.cm(require_compile_aot.EMPTY_EXTERNALS, void 0);
|
|
124
|
+
this.#check = both.check;
|
|
125
|
+
if (normalize !== false) this.#clean = both.clean;
|
|
126
|
+
}
|
|
170
127
|
this.#hasOptional = !!schema?.["~optional"];
|
|
171
128
|
this.#noValidate = schema?.["~elyTyp"] === require_type_constants.ELYSIA_TYPES.NoValidate;
|
|
172
|
-
this.#hasDefault = frozen.d === 1;
|
|
173
129
|
if (frozen.ps === 1) this.#defaultFastPath = {
|
|
174
130
|
value: frozen.pd,
|
|
175
131
|
appliesToNull: frozen.pn === 1,
|
|
@@ -177,20 +133,34 @@ var FrozenSlotValidator = class {
|
|
|
177
133
|
merge: frozen.pm
|
|
178
134
|
};
|
|
179
135
|
}
|
|
180
|
-
buildCheckClean(frozen, schema, raw, normalize) {
|
|
181
|
-
const both = frozen.cm(EMPTY_EXTERNALS, void 0);
|
|
182
|
-
return {
|
|
183
|
-
check: both.check,
|
|
184
|
-
clean: normalize === false ? void 0 : both.clean
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
136
|
Check(value) {
|
|
188
137
|
return this.#check(value);
|
|
189
138
|
}
|
|
190
139
|
Errors(value) {
|
|
191
140
|
const hit = walkCompactError(this.schema, value, "", "#");
|
|
192
141
|
if (hit) return [hit];
|
|
193
|
-
|
|
142
|
+
const schema = this.schema;
|
|
143
|
+
let error;
|
|
144
|
+
if (schema?.type === "object" && typeof value === "object" && value !== null && !Array.isArray(value) && schema.properties) for (const key in schema.properties) {
|
|
145
|
+
if (!(key in value)) continue;
|
|
146
|
+
if (isCompactWalkable(schema.properties[key], false)) continue;
|
|
147
|
+
error = {
|
|
148
|
+
keyword: "type",
|
|
149
|
+
schemaPath: `#/properties/${key}`,
|
|
150
|
+
instancePath: `/${key}`,
|
|
151
|
+
params: {},
|
|
152
|
+
message: `must match ${schema.properties[key]?.["~kind"] ?? "schema"}`
|
|
153
|
+
};
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (!error) error = {
|
|
157
|
+
keyword: "type",
|
|
158
|
+
schemaPath: "#",
|
|
159
|
+
instancePath: "",
|
|
160
|
+
params: {},
|
|
161
|
+
message: `must match ${schema?.["~kind"] ?? "schema"}`
|
|
162
|
+
};
|
|
163
|
+
return [error];
|
|
194
164
|
}
|
|
195
165
|
#error(value, type) {
|
|
196
166
|
return new require_error.ValidationError(type, value, () => this.Errors(value), this.schema);
|
|
@@ -201,16 +171,11 @@ var FrozenSlotValidator = class {
|
|
|
201
171
|
if (value === null || typeof value !== "object") return value;
|
|
202
172
|
return defaults.clone ? defaults.clone() : structuredClone(value);
|
|
203
173
|
}
|
|
204
|
-
#applyDefault(value) {
|
|
205
|
-
return this.#defaultFastPath.merge(value);
|
|
206
|
-
}
|
|
207
174
|
From(value, type) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (defaults)
|
|
211
|
-
|
|
212
|
-
else if (value !== null && typeof value === "object" && defaults.merge !== void 0) value = this.#applyDefault(value);
|
|
213
|
-
}
|
|
175
|
+
const defaults = this.#defaultFastPath;
|
|
176
|
+
if (defaults) {
|
|
177
|
+
if (value === void 0 || value === null && defaults.appliesToNull) value = this.#cloneSharedDefault();
|
|
178
|
+
else if (value !== null && typeof value === "object" && defaults.merge !== void 0) value = defaults.merge(value);
|
|
214
179
|
}
|
|
215
180
|
if (this.#hasOptional) {
|
|
216
181
|
const schema = this.schema;
|
|
@@ -226,25 +191,6 @@ var FrozenSlotValidator = class {
|
|
|
226
191
|
return this.#clean ? this.#clean(value) : value;
|
|
227
192
|
}
|
|
228
193
|
};
|
|
229
|
-
/**
|
|
230
|
-
* The JIT/frozen slot validator: the reconstruct-free `FrozenSlotValidator`
|
|
231
|
-
* base plus the codec/inner-codec branch re-added via the `buildCheckClean`
|
|
232
|
-
* override
|
|
233
|
-
*/
|
|
234
|
-
var CodecFrozenSlotValidator = class extends FrozenSlotValidator {
|
|
235
|
-
buildCheckClean(frozen, schema, raw, normalize) {
|
|
236
|
-
if (frozen.ic) require_compile_aot.reconstruct().reconstructInnerCodecs(frozen.ic, schema);
|
|
237
|
-
if (frozen.k === 1 && frozen.dm) {
|
|
238
|
-
const both = require_compile_aot.reconstruct().instantiateFrozenBoth(frozen, schema, raw);
|
|
239
|
-
return {
|
|
240
|
-
check: both.check,
|
|
241
|
-
clean: normalize === false ? void 0 : both.clean,
|
|
242
|
-
decode: normalize === false ? void 0 : require_compile_aot.reconstruct().instantiateFrozenDecodeMirror(frozen.dm, schema)
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
return super.buildCheckClean(frozen, schema, raw, normalize);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
194
|
const REQUEST_SLOTS = [
|
|
249
195
|
"body",
|
|
250
196
|
"headers",
|
|
@@ -290,11 +236,13 @@ function buildFrozenRouteValidator(hook, root, method, path) {
|
|
|
290
236
|
coerced = rebuild(schema, frozen.cp);
|
|
291
237
|
}
|
|
292
238
|
if (!isBridgeFreeComplete(frozen, coerced, schema)) return void 0;
|
|
293
|
-
out[slot] = new
|
|
239
|
+
out[slot] = new FrozenSlotValidator(frozen, coerced, schema, normalize);
|
|
294
240
|
}
|
|
295
241
|
const response = hook?.response;
|
|
296
242
|
if (response) {
|
|
297
|
-
const
|
|
243
|
+
const resolved = resolveModelRef(response, root);
|
|
244
|
+
if (!resolved) return void 0;
|
|
245
|
+
const statuses = isResponseMap(resolved) ? resolved : { 200: resolved };
|
|
298
246
|
const responseOut = {};
|
|
299
247
|
for (const status in statuses) {
|
|
300
248
|
const raw = statuses[status];
|
|
@@ -307,13 +255,13 @@ function buildFrozenRouteValidator(hook, root, method, path) {
|
|
|
307
255
|
}
|
|
308
256
|
const frozen = require_compile_aot.Compiled.getValidator(method, path, `response:${status}`, root["~programId"]);
|
|
309
257
|
if (!frozen || !isBridgeFreeComplete(frozen, schema, schema)) return void 0;
|
|
310
|
-
responseOut[status] = new
|
|
258
|
+
responseOut[status] = new FrozenSlotValidator(frozen, schema, schema, normalize);
|
|
311
259
|
}
|
|
312
260
|
out.response = responseOut;
|
|
313
261
|
}
|
|
314
262
|
return out;
|
|
315
263
|
}
|
|
316
|
-
const isResponseMap = (schema) => !("~kind" in schema || "~elyAcl" in schema || "~standard" in schema);
|
|
264
|
+
const isResponseMap = (schema) => schema !== null && typeof schema === "object" && !("~kind" in schema || "~elyAcl" in schema || "~standard" in schema);
|
|
317
265
|
const capturedBothMarker = (() => ({}));
|
|
318
266
|
function isCapturedBridgeFree(c, schema, coerced = schema) {
|
|
319
267
|
if (typeof schema === "string") return false;
|
|
@@ -340,10 +288,12 @@ function isCapturedBridgeFree(c, schema, coerced = schema) {
|
|
|
340
288
|
}
|
|
341
289
|
|
|
342
290
|
//#endregion
|
|
291
|
+
exports.REQUEST_SLOTS = REQUEST_SLOTS;
|
|
343
292
|
exports.buildFrozenRouteValidator = buildFrozenRouteValidator;
|
|
344
293
|
exports.isBridgeNotInitialized = isBridgeNotInitialized;
|
|
345
294
|
exports.isCapturedBridgeFree = isCapturedBridgeFree;
|
|
346
|
-
exports.isCompactDiagnosable = isCompactDiagnosable;
|
|
347
295
|
exports.isCompactWalkable = isCompactWalkable;
|
|
296
|
+
exports.isResponseMap = isResponseMap;
|
|
348
297
|
exports.isStandardSchema = isStandardSchema;
|
|
349
|
-
exports.mergeSchemasAllStandard = mergeSchemasAllStandard;
|
|
298
|
+
exports.mergeSchemasAllStandard = mergeSchemasAllStandard;
|
|
299
|
+
exports.resolveModelRef = resolveModelRef;
|