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/trace.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TraceEvent } from "./constants.js";
|
|
2
2
|
import { Context } from "./context.js";
|
|
3
|
+
import { Prettify, RouteSchema, SingletonBase } from "./types.js";
|
|
3
4
|
|
|
4
5
|
//#region src/trace.d.ts
|
|
5
|
-
type TraceEvent = 'request' | 'parse' | 'transform' | 'beforeHandle' | 'handle' | 'afterHandle' | 'mapResponse' | 'afterResponse' | 'error';
|
|
6
6
|
declare function unionTracePhases(handlers: readonly Function[] | undefined): Set<TraceEvent> | null;
|
|
7
7
|
interface TraceStream {
|
|
8
8
|
id: number;
|
|
@@ -87,9 +87,8 @@ type TraceHandler<in out Route extends RouteSchema = {}, in out Singleton extend
|
|
|
87
87
|
}> = {
|
|
88
88
|
(lifecycle: Prettify<{
|
|
89
89
|
/**
|
|
90
|
-
* Per-request id. Sourced from `
|
|
91
|
-
*
|
|
92
|
-
* `crypto.randomUUID()`. Useful for log correlation.
|
|
90
|
+
* Per-request id. Sourced from `Bun.randomUUIDv7()` on Bun,
|
|
91
|
+
* otherwise `crypto.randomUUID()`. Useful for log correlation.
|
|
93
92
|
*/
|
|
94
93
|
id: string;
|
|
95
94
|
context: Context<Route, Singleton>;
|
|
@@ -111,7 +110,6 @@ declare class TraceRecorder {
|
|
|
111
110
|
callbacksBegin?: Function[];
|
|
112
111
|
callbacksEnd?: Function[];
|
|
113
112
|
callbacksChild?: Function[];
|
|
114
|
-
pendingPromise?: Promise<TraceProcess<'begin'>>;
|
|
115
113
|
pendingResolve?: (result: TraceProcess<'begin'>) => void;
|
|
116
114
|
endPromise?: Promise<number>;
|
|
117
115
|
endResolve?: (end: number) => void;
|
|
@@ -122,7 +120,6 @@ declare class TraceRecorder {
|
|
|
122
120
|
childBegin?: (process: TraceStream) => (error?: Error | null) => void;
|
|
123
121
|
listen(): (callback?: Function) => Promise<TraceProcess<"begin">>;
|
|
124
122
|
begin(process: TraceStream): this;
|
|
125
|
-
get resolveChild(): this;
|
|
126
123
|
shift(): ((process: TraceStream) => (error?: Error | null) => void) | undefined;
|
|
127
124
|
resolve(error?: Error | null, at?: number): void;
|
|
128
125
|
}
|
|
@@ -147,4 +144,4 @@ interface TraceCapability {
|
|
|
147
144
|
readonly unionTracePhases: typeof unionTracePhases;
|
|
148
145
|
}
|
|
149
146
|
//#endregion
|
|
150
|
-
export { TraceCapability, TraceEndDetail, TraceEvent, TraceHandler, TraceListener, TraceProcess, TraceStream, createTracer, unionTracePhases };
|
|
147
|
+
export { TraceCapability, TraceEndDetail, type TraceEvent, TraceHandler, TraceListener, TraceProcess, TraceStream, createTracer, unionTracePhases };
|
package/dist/trace.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_constants = require('./constants.js');
|
|
3
|
-
const require_compile_lexer = require('./compile/lexer.js');
|
|
4
3
|
const require_sucrose = require('./sucrose.js');
|
|
5
4
|
|
|
6
5
|
//#region src/trace.ts
|
|
@@ -15,126 +14,19 @@ const phaseGetter = {
|
|
|
15
14
|
onAfterResponse: "afterResponse",
|
|
16
15
|
onError: "error"
|
|
17
16
|
};
|
|
18
|
-
|
|
19
|
-
let parameters;
|
|
20
|
-
try {
|
|
21
|
-
({parameters} = require_sucrose.retrieveRootparameters(group));
|
|
22
|
-
} catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
const out = /* @__PURE__ */ new Set();
|
|
26
|
-
for (const key in parameters) {
|
|
27
|
-
if (key.charCodeAt(0) === 91 || key.startsWith("...")) return null;
|
|
28
|
-
const phase = phaseGetter[key];
|
|
29
|
-
if (phase) out.add(phase);
|
|
30
|
-
}
|
|
31
|
-
return out;
|
|
32
|
-
}
|
|
33
|
-
function phasesFromMemberAccess(p, body) {
|
|
34
|
-
const out = /* @__PURE__ */ new Set();
|
|
35
|
-
const len = p.length;
|
|
36
|
-
let i = 0;
|
|
37
|
-
while (i < body.length) {
|
|
38
|
-
const idx = body.indexOf(p, i);
|
|
39
|
-
if (idx === -1) break;
|
|
40
|
-
if (require_compile_lexer.isIdentCharCode(idx > 0 ? body.charCodeAt(idx - 1) : 0) || require_compile_lexer.isIdentCharCode(body.charCodeAt(idx + len))) {
|
|
41
|
-
i = idx + len;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
let j = idx + len;
|
|
45
|
-
let optional = false;
|
|
46
|
-
if (body.charCodeAt(j) === 63) {
|
|
47
|
-
optional = true;
|
|
48
|
-
j++;
|
|
49
|
-
}
|
|
50
|
-
const next = body.charCodeAt(j);
|
|
51
|
-
if (next === 46) {
|
|
52
|
-
j++;
|
|
53
|
-
const s = j;
|
|
54
|
-
while (require_compile_lexer.isIdentCharCode(body.charCodeAt(j))) j++;
|
|
55
|
-
const phase = phaseGetter[body.slice(s, j)];
|
|
56
|
-
if (phase) out.add(phase);
|
|
57
|
-
i = j;
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (next === 91) {
|
|
61
|
-
j++;
|
|
62
|
-
const q = body.charCodeAt(j);
|
|
63
|
-
if (q !== 34 && q !== 39) return null;
|
|
64
|
-
j++;
|
|
65
|
-
const s = j;
|
|
66
|
-
while (j < body.length && body.charCodeAt(j) !== q) {
|
|
67
|
-
if (body.charCodeAt(j) === 92) return null;
|
|
68
|
-
j++;
|
|
69
|
-
}
|
|
70
|
-
const name = body.slice(s, j);
|
|
71
|
-
j++;
|
|
72
|
-
if (body.charCodeAt(j) !== 93) return null;
|
|
73
|
-
j++;
|
|
74
|
-
const phase = phaseGetter[name];
|
|
75
|
-
if (phase) out.add(phase);
|
|
76
|
-
i = j;
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (optional) return null;
|
|
80
|
-
let k = idx - 1;
|
|
81
|
-
while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
|
|
82
|
-
if (body.charCodeAt(k) === 61) {
|
|
83
|
-
k--;
|
|
84
|
-
while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
|
|
85
|
-
if (body.charCodeAt(k) === 125) {
|
|
86
|
-
i = idx + len;
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return out;
|
|
93
|
-
}
|
|
17
|
+
const phaseOf = (member) => Object.hasOwn(phaseGetter, member) ? phaseGetter[member] : void 0;
|
|
94
18
|
const tracePhaseCache = /* @__PURE__ */ new WeakMap();
|
|
95
19
|
function scanTracePhases(fn) {
|
|
96
20
|
const cached = tracePhaseCache.get(fn);
|
|
97
21
|
if (cached !== void 0) return cached;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
function computeTracePhases(fn) {
|
|
103
|
-
let src;
|
|
104
|
-
try {
|
|
105
|
-
src = Function.prototype.toString.call(fn);
|
|
106
|
-
} catch {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
if (src.includes("[native code]")) return null;
|
|
110
|
-
let param;
|
|
111
|
-
let body;
|
|
112
|
-
try {
|
|
113
|
-
[param, body] = require_sucrose.separateFunction(src);
|
|
22
|
+
let result = null;
|
|
23
|
+
if (fn.length) try {
|
|
24
|
+
result = require_sucrose.inferFunction(Function.prototype.toString.call(fn), phaseOf, true);
|
|
114
25
|
} catch {
|
|
115
|
-
|
|
26
|
+
result = null;
|
|
116
27
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
try {
|
|
120
|
-
roots = require_sucrose.retrieveRootparameters(param);
|
|
121
|
-
} catch {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
if (roots.hasParenthesis) return phasesFromDestructure(param);
|
|
125
|
-
const first = Object.keys(roots.parameters)[0];
|
|
126
|
-
if (!first) return null;
|
|
127
|
-
const inner = body.charCodeAt(0) === 123 ? body.slice(1, -1) : body;
|
|
128
|
-
const phases = phasesFromMemberAccess(first, inner);
|
|
129
|
-
if (phases === null) return null;
|
|
130
|
-
const aliases = require_sucrose.findAlias(first, inner);
|
|
131
|
-
for (const alias of aliases) {
|
|
132
|
-
if (alias.charCodeAt(0) !== 123) return null;
|
|
133
|
-
const aliasPhases = phasesFromDestructure(alias);
|
|
134
|
-
if (aliasPhases === null) return null;
|
|
135
|
-
for (const p of aliasPhases) phases.add(p);
|
|
136
|
-
}
|
|
137
|
-
return phases;
|
|
28
|
+
tracePhaseCache.set(fn, result);
|
|
29
|
+
return result;
|
|
138
30
|
}
|
|
139
31
|
function unionTracePhases(handlers) {
|
|
140
32
|
if (!handlers?.length) return /* @__PURE__ */ new Set();
|
|
@@ -146,6 +38,10 @@ function unionTracePhases(handlers) {
|
|
|
146
38
|
}
|
|
147
39
|
return union;
|
|
148
40
|
}
|
|
41
|
+
/** Prevent rejected trace callbacks from becoming unhandled rejections. */
|
|
42
|
+
function fire(result) {
|
|
43
|
+
if (typeof result?.then === "function") result.then(void 0, (error) => console.error(error));
|
|
44
|
+
}
|
|
149
45
|
var TraceRecorder = class {
|
|
150
46
|
constructor() {
|
|
151
47
|
this.remaining = 0;
|
|
@@ -159,11 +55,10 @@ var TraceRecorder = class {
|
|
|
159
55
|
if (this.listenFn) return this.listenFn;
|
|
160
56
|
if (this.begun) return this.listenFn = (_callback) => Promise.resolve(this.#result());
|
|
161
57
|
const { promise, resolve } = Promise.withResolvers();
|
|
162
|
-
this.pendingPromise = promise;
|
|
163
58
|
this.pendingResolve = resolve;
|
|
164
59
|
return this.listenFn = (callback) => {
|
|
165
60
|
if (callback) (this.callbacksBegin ??= []).push(callback);
|
|
166
|
-
return
|
|
61
|
+
return promise;
|
|
167
62
|
};
|
|
168
63
|
}
|
|
169
64
|
#result() {
|
|
@@ -175,7 +70,12 @@ var TraceRecorder = class {
|
|
|
175
70
|
return slot.#end();
|
|
176
71
|
},
|
|
177
72
|
get error() {
|
|
178
|
-
return slot
|
|
73
|
+
if (slot.errorPromise) return slot.errorPromise;
|
|
74
|
+
if (slot.ended) return slot.errorPromise = Promise.resolve(slot.endError);
|
|
75
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
76
|
+
slot.errorPromise = promise;
|
|
77
|
+
slot.errorResolve = resolve;
|
|
78
|
+
return promise;
|
|
179
79
|
},
|
|
180
80
|
onEvent(callback) {
|
|
181
81
|
if (callback) (slot.callbacksChild ??= []).push(callback);
|
|
@@ -194,14 +94,6 @@ var TraceRecorder = class {
|
|
|
194
94
|
this.endResolve = resolve;
|
|
195
95
|
return promise;
|
|
196
96
|
}
|
|
197
|
-
#error() {
|
|
198
|
-
if (this.errorPromise) return this.errorPromise;
|
|
199
|
-
if (this.ended) return this.errorPromise = Promise.resolve(this.endError);
|
|
200
|
-
const { promise, resolve } = Promise.withResolvers();
|
|
201
|
-
this.errorPromise = promise;
|
|
202
|
-
this.errorResolve = resolve;
|
|
203
|
-
return promise;
|
|
204
|
-
}
|
|
205
97
|
begin(process) {
|
|
206
98
|
this.begun = process;
|
|
207
99
|
this.remaining = process.total ?? 0;
|
|
@@ -211,13 +103,10 @@ var TraceRecorder = class {
|
|
|
211
103
|
const result = this.#result();
|
|
212
104
|
resolve(result);
|
|
213
105
|
const callbacks = this.callbacksBegin;
|
|
214
|
-
if (callbacks) for (let i = 0; i < callbacks.length; i++) callbacks[i](result);
|
|
106
|
+
if (callbacks) for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](result));
|
|
215
107
|
}
|
|
216
108
|
return this;
|
|
217
109
|
}
|
|
218
|
-
get resolveChild() {
|
|
219
|
-
return this;
|
|
220
|
-
}
|
|
221
110
|
shift() {
|
|
222
111
|
if (this.remaining <= 0) return;
|
|
223
112
|
this.remaining--;
|
|
@@ -241,7 +130,7 @@ var TraceRecorder = class {
|
|
|
241
130
|
return end;
|
|
242
131
|
}
|
|
243
132
|
};
|
|
244
|
-
for (let i = 0; i < children.length; i++) children[i](result);
|
|
133
|
+
for (let i = 0; i < children.length; i++) fire(children[i](result));
|
|
245
134
|
let resolved = false;
|
|
246
135
|
return (err = null) => {
|
|
247
136
|
if (resolved) return;
|
|
@@ -255,7 +144,7 @@ var TraceRecorder = class {
|
|
|
255
144
|
return endAt - process.begin;
|
|
256
145
|
}
|
|
257
146
|
};
|
|
258
|
-
for (let i = 0; i < callbacksEnd.length; i++) callbacksEnd[i](detail);
|
|
147
|
+
for (let i = 0; i < callbacksEnd.length; i++) fire(callbacksEnd[i](detail));
|
|
259
148
|
resolveEnd(endAt);
|
|
260
149
|
resolveError(err);
|
|
261
150
|
};
|
|
@@ -278,7 +167,7 @@ var TraceRecorder = class {
|
|
|
278
167
|
return end - begun.begin;
|
|
279
168
|
}
|
|
280
169
|
};
|
|
281
|
-
for (let i = 0; i < callbacks.length; i++) callbacks[i](detail);
|
|
170
|
+
for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](detail));
|
|
282
171
|
}
|
|
283
172
|
this.endResolve?.(end);
|
|
284
173
|
this.errorResolve?.(error);
|
|
@@ -380,7 +269,7 @@ var TracerLifecycle = class {
|
|
|
380
269
|
const createTracer = (traceListener) => (context) => {
|
|
381
270
|
const handle = new TracerHandle();
|
|
382
271
|
handle.rid = context.rid ?? "";
|
|
383
|
-
traceListener(new TracerLifecycle(handle, context));
|
|
272
|
+
fire(traceListener(new TracerLifecycle(handle, context)));
|
|
384
273
|
return handle;
|
|
385
274
|
};
|
|
386
275
|
|
package/dist/trace.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { traceEvents } from "./constants.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { findAlias, retrieveRootparameters, separateFunction } from "./sucrose.mjs";
|
|
2
|
+
import { inferFunction } from "./sucrose.mjs";
|
|
4
3
|
|
|
5
4
|
//#region src/trace.ts
|
|
6
5
|
const phaseGetter = {
|
|
@@ -14,126 +13,19 @@ const phaseGetter = {
|
|
|
14
13
|
onAfterResponse: "afterResponse",
|
|
15
14
|
onError: "error"
|
|
16
15
|
};
|
|
17
|
-
|
|
18
|
-
let parameters;
|
|
19
|
-
try {
|
|
20
|
-
({parameters} = retrieveRootparameters(group));
|
|
21
|
-
} catch {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
const out = /* @__PURE__ */ new Set();
|
|
25
|
-
for (const key in parameters) {
|
|
26
|
-
if (key.charCodeAt(0) === 91 || key.startsWith("...")) return null;
|
|
27
|
-
const phase = phaseGetter[key];
|
|
28
|
-
if (phase) out.add(phase);
|
|
29
|
-
}
|
|
30
|
-
return out;
|
|
31
|
-
}
|
|
32
|
-
function phasesFromMemberAccess(p, body) {
|
|
33
|
-
const out = /* @__PURE__ */ new Set();
|
|
34
|
-
const len = p.length;
|
|
35
|
-
let i = 0;
|
|
36
|
-
while (i < body.length) {
|
|
37
|
-
const idx = body.indexOf(p, i);
|
|
38
|
-
if (idx === -1) break;
|
|
39
|
-
if (isIdentCharCode(idx > 0 ? body.charCodeAt(idx - 1) : 0) || isIdentCharCode(body.charCodeAt(idx + len))) {
|
|
40
|
-
i = idx + len;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
let j = idx + len;
|
|
44
|
-
let optional = false;
|
|
45
|
-
if (body.charCodeAt(j) === 63) {
|
|
46
|
-
optional = true;
|
|
47
|
-
j++;
|
|
48
|
-
}
|
|
49
|
-
const next = body.charCodeAt(j);
|
|
50
|
-
if (next === 46) {
|
|
51
|
-
j++;
|
|
52
|
-
const s = j;
|
|
53
|
-
while (isIdentCharCode(body.charCodeAt(j))) j++;
|
|
54
|
-
const phase = phaseGetter[body.slice(s, j)];
|
|
55
|
-
if (phase) out.add(phase);
|
|
56
|
-
i = j;
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (next === 91) {
|
|
60
|
-
j++;
|
|
61
|
-
const q = body.charCodeAt(j);
|
|
62
|
-
if (q !== 34 && q !== 39) return null;
|
|
63
|
-
j++;
|
|
64
|
-
const s = j;
|
|
65
|
-
while (j < body.length && body.charCodeAt(j) !== q) {
|
|
66
|
-
if (body.charCodeAt(j) === 92) return null;
|
|
67
|
-
j++;
|
|
68
|
-
}
|
|
69
|
-
const name = body.slice(s, j);
|
|
70
|
-
j++;
|
|
71
|
-
if (body.charCodeAt(j) !== 93) return null;
|
|
72
|
-
j++;
|
|
73
|
-
const phase = phaseGetter[name];
|
|
74
|
-
if (phase) out.add(phase);
|
|
75
|
-
i = j;
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (optional) return null;
|
|
79
|
-
let k = idx - 1;
|
|
80
|
-
while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
|
|
81
|
-
if (body.charCodeAt(k) === 61) {
|
|
82
|
-
k--;
|
|
83
|
-
while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
|
|
84
|
-
if (body.charCodeAt(k) === 125) {
|
|
85
|
-
i = idx + len;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return out;
|
|
92
|
-
}
|
|
16
|
+
const phaseOf = (member) => Object.hasOwn(phaseGetter, member) ? phaseGetter[member] : void 0;
|
|
93
17
|
const tracePhaseCache = /* @__PURE__ */ new WeakMap();
|
|
94
18
|
function scanTracePhases(fn) {
|
|
95
19
|
const cached = tracePhaseCache.get(fn);
|
|
96
20
|
if (cached !== void 0) return cached;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
function computeTracePhases(fn) {
|
|
102
|
-
let src;
|
|
103
|
-
try {
|
|
104
|
-
src = Function.prototype.toString.call(fn);
|
|
105
|
-
} catch {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
if (src.includes("[native code]")) return null;
|
|
109
|
-
let param;
|
|
110
|
-
let body;
|
|
111
|
-
try {
|
|
112
|
-
[param, body] = separateFunction(src);
|
|
21
|
+
let result = null;
|
|
22
|
+
if (fn.length) try {
|
|
23
|
+
result = inferFunction(Function.prototype.toString.call(fn), phaseOf, true);
|
|
113
24
|
} catch {
|
|
114
|
-
|
|
25
|
+
result = null;
|
|
115
26
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
try {
|
|
119
|
-
roots = retrieveRootparameters(param);
|
|
120
|
-
} catch {
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
if (roots.hasParenthesis) return phasesFromDestructure(param);
|
|
124
|
-
const first = Object.keys(roots.parameters)[0];
|
|
125
|
-
if (!first) return null;
|
|
126
|
-
const inner = body.charCodeAt(0) === 123 ? body.slice(1, -1) : body;
|
|
127
|
-
const phases = phasesFromMemberAccess(first, inner);
|
|
128
|
-
if (phases === null) return null;
|
|
129
|
-
const aliases = findAlias(first, inner);
|
|
130
|
-
for (const alias of aliases) {
|
|
131
|
-
if (alias.charCodeAt(0) !== 123) return null;
|
|
132
|
-
const aliasPhases = phasesFromDestructure(alias);
|
|
133
|
-
if (aliasPhases === null) return null;
|
|
134
|
-
for (const p of aliasPhases) phases.add(p);
|
|
135
|
-
}
|
|
136
|
-
return phases;
|
|
27
|
+
tracePhaseCache.set(fn, result);
|
|
28
|
+
return result;
|
|
137
29
|
}
|
|
138
30
|
function unionTracePhases(handlers) {
|
|
139
31
|
if (!handlers?.length) return /* @__PURE__ */ new Set();
|
|
@@ -145,6 +37,10 @@ function unionTracePhases(handlers) {
|
|
|
145
37
|
}
|
|
146
38
|
return union;
|
|
147
39
|
}
|
|
40
|
+
/** Prevent rejected trace callbacks from becoming unhandled rejections. */
|
|
41
|
+
function fire(result) {
|
|
42
|
+
if (typeof result?.then === "function") result.then(void 0, (error) => console.error(error));
|
|
43
|
+
}
|
|
148
44
|
var TraceRecorder = class {
|
|
149
45
|
constructor() {
|
|
150
46
|
this.remaining = 0;
|
|
@@ -158,11 +54,10 @@ var TraceRecorder = class {
|
|
|
158
54
|
if (this.listenFn) return this.listenFn;
|
|
159
55
|
if (this.begun) return this.listenFn = (_callback) => Promise.resolve(this.#result());
|
|
160
56
|
const { promise, resolve } = Promise.withResolvers();
|
|
161
|
-
this.pendingPromise = promise;
|
|
162
57
|
this.pendingResolve = resolve;
|
|
163
58
|
return this.listenFn = (callback) => {
|
|
164
59
|
if (callback) (this.callbacksBegin ??= []).push(callback);
|
|
165
|
-
return
|
|
60
|
+
return promise;
|
|
166
61
|
};
|
|
167
62
|
}
|
|
168
63
|
#result() {
|
|
@@ -174,7 +69,12 @@ var TraceRecorder = class {
|
|
|
174
69
|
return slot.#end();
|
|
175
70
|
},
|
|
176
71
|
get error() {
|
|
177
|
-
return slot
|
|
72
|
+
if (slot.errorPromise) return slot.errorPromise;
|
|
73
|
+
if (slot.ended) return slot.errorPromise = Promise.resolve(slot.endError);
|
|
74
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
75
|
+
slot.errorPromise = promise;
|
|
76
|
+
slot.errorResolve = resolve;
|
|
77
|
+
return promise;
|
|
178
78
|
},
|
|
179
79
|
onEvent(callback) {
|
|
180
80
|
if (callback) (slot.callbacksChild ??= []).push(callback);
|
|
@@ -193,14 +93,6 @@ var TraceRecorder = class {
|
|
|
193
93
|
this.endResolve = resolve;
|
|
194
94
|
return promise;
|
|
195
95
|
}
|
|
196
|
-
#error() {
|
|
197
|
-
if (this.errorPromise) return this.errorPromise;
|
|
198
|
-
if (this.ended) return this.errorPromise = Promise.resolve(this.endError);
|
|
199
|
-
const { promise, resolve } = Promise.withResolvers();
|
|
200
|
-
this.errorPromise = promise;
|
|
201
|
-
this.errorResolve = resolve;
|
|
202
|
-
return promise;
|
|
203
|
-
}
|
|
204
96
|
begin(process) {
|
|
205
97
|
this.begun = process;
|
|
206
98
|
this.remaining = process.total ?? 0;
|
|
@@ -210,13 +102,10 @@ var TraceRecorder = class {
|
|
|
210
102
|
const result = this.#result();
|
|
211
103
|
resolve(result);
|
|
212
104
|
const callbacks = this.callbacksBegin;
|
|
213
|
-
if (callbacks) for (let i = 0; i < callbacks.length; i++) callbacks[i](result);
|
|
105
|
+
if (callbacks) for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](result));
|
|
214
106
|
}
|
|
215
107
|
return this;
|
|
216
108
|
}
|
|
217
|
-
get resolveChild() {
|
|
218
|
-
return this;
|
|
219
|
-
}
|
|
220
109
|
shift() {
|
|
221
110
|
if (this.remaining <= 0) return;
|
|
222
111
|
this.remaining--;
|
|
@@ -240,7 +129,7 @@ var TraceRecorder = class {
|
|
|
240
129
|
return end;
|
|
241
130
|
}
|
|
242
131
|
};
|
|
243
|
-
for (let i = 0; i < children.length; i++) children[i](result);
|
|
132
|
+
for (let i = 0; i < children.length; i++) fire(children[i](result));
|
|
244
133
|
let resolved = false;
|
|
245
134
|
return (err = null) => {
|
|
246
135
|
if (resolved) return;
|
|
@@ -254,7 +143,7 @@ var TraceRecorder = class {
|
|
|
254
143
|
return endAt - process.begin;
|
|
255
144
|
}
|
|
256
145
|
};
|
|
257
|
-
for (let i = 0; i < callbacksEnd.length; i++) callbacksEnd[i](detail);
|
|
146
|
+
for (let i = 0; i < callbacksEnd.length; i++) fire(callbacksEnd[i](detail));
|
|
258
147
|
resolveEnd(endAt);
|
|
259
148
|
resolveError(err);
|
|
260
149
|
};
|
|
@@ -277,7 +166,7 @@ var TraceRecorder = class {
|
|
|
277
166
|
return end - begun.begin;
|
|
278
167
|
}
|
|
279
168
|
};
|
|
280
|
-
for (let i = 0; i < callbacks.length; i++) callbacks[i](detail);
|
|
169
|
+
for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](detail));
|
|
281
170
|
}
|
|
282
171
|
this.endResolve?.(end);
|
|
283
172
|
this.errorResolve?.(error);
|
|
@@ -379,7 +268,7 @@ var TracerLifecycle = class {
|
|
|
379
268
|
const createTracer = (traceListener) => (context) => {
|
|
380
269
|
const handle = new TracerHandle();
|
|
381
270
|
handle.rid = context.rid ?? "";
|
|
382
|
-
traceListener(new TracerLifecycle(handle, context));
|
|
271
|
+
fire(traceListener(new TracerLifecycle(handle, context)));
|
|
383
272
|
return handle;
|
|
384
273
|
};
|
|
385
274
|
|
|
@@ -5,11 +5,13 @@ import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-ca
|
|
|
5
5
|
import { TypeBoxValidator } from "./validator/index.js";
|
|
6
6
|
import { applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure } from "./coerce.js";
|
|
7
7
|
import { Ref } from "typebox/type";
|
|
8
|
+
import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
|
|
8
9
|
import { Compile } from "typebox/compile";
|
|
9
|
-
import { Check, Clone, Create, Decode, Default, HasCodec } from "typebox/value";
|
|
10
10
|
|
|
11
11
|
//#region src/type/bridge-live.d.ts
|
|
12
12
|
declare function useTypebox(_mod?: Parameters<typeof useTypebox$1>[0]): void;
|
|
13
|
+
declare function warmTypebox(): void;
|
|
14
|
+
declare function preloadTypebox(): Promise<void> | undefined;
|
|
13
15
|
declare const isBridgeLive: () => boolean;
|
|
14
16
|
//#endregion
|
|
15
|
-
export { Check, Clone, Compile, Create, Decode,
|
|
17
|
+
export { Check, Clone, Compile, Create, Decode, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, preloadTypebox, useTypebox, warmTypebox };
|
package/dist/type/bridge-live.js
CHANGED
|
@@ -6,13 +6,15 @@ const require_type_validator_validator_cache = require('./validator/validator-ca
|
|
|
6
6
|
const require_type_validator_index = require('./validator/index.js');
|
|
7
7
|
const require_type_elysia_intersect = require('./elysia/intersect.js');
|
|
8
8
|
let typebox_type = require("typebox/type");
|
|
9
|
-
let typebox_compile = require("typebox/compile");
|
|
10
9
|
let typebox_value = require("typebox/value");
|
|
10
|
+
let typebox_compile = require("typebox/compile");
|
|
11
11
|
let typebox_system = require("typebox/system");
|
|
12
12
|
|
|
13
13
|
//#region src/type/bridge-live.ts
|
|
14
14
|
typebox_system.Settings.Set({ unionPrioritySort: false });
|
|
15
15
|
function useTypebox(_mod) {}
|
|
16
|
+
function warmTypebox() {}
|
|
17
|
+
function preloadTypebox() {}
|
|
16
18
|
const isBridgeLive = () => true;
|
|
17
19
|
|
|
18
20
|
//#endregion
|
|
@@ -21,7 +23,6 @@ exports.Clone = typebox_value.Clone;
|
|
|
21
23
|
exports.Compile = typebox_compile.Compile;
|
|
22
24
|
exports.Create = typebox_value.Create;
|
|
23
25
|
exports.Decode = typebox_value.Decode;
|
|
24
|
-
exports.Default = typebox_value.Default;
|
|
25
26
|
exports.HasCodec = typebox_value.HasCodec;
|
|
26
27
|
exports.Intersect = require_type_elysia_intersect.Intersect;
|
|
27
28
|
exports.Ref = typebox_type.Ref;
|
|
@@ -36,4 +37,6 @@ exports.coerceStringToStructure = require_type_coerce.coerceStringToStructure;
|
|
|
36
37
|
exports.hasTypes = require_type_utils.hasTypes;
|
|
37
38
|
exports.isBridgeLive = isBridgeLive;
|
|
38
39
|
exports.mayHaveFileType = require_type_validator_validator_cache.mayHaveFileType;
|
|
39
|
-
exports.
|
|
40
|
+
exports.preloadTypebox = preloadTypebox;
|
|
41
|
+
exports.useTypebox = useTypebox;
|
|
42
|
+
exports.warmTypebox = warmTypebox;
|
|
@@ -4,14 +4,16 @@ import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-ca
|
|
|
4
4
|
import { TypeBoxValidator } from "./validator/index.mjs";
|
|
5
5
|
import { Intersect } from "./elysia/intersect.mjs";
|
|
6
6
|
import { Ref } from "typebox/type";
|
|
7
|
+
import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
|
|
7
8
|
import { Compile } from "typebox/compile";
|
|
8
|
-
import { Check, Clone, Create, Decode, Default, HasCodec } from "typebox/value";
|
|
9
9
|
import { Settings } from "typebox/system";
|
|
10
10
|
|
|
11
11
|
//#region src/type/bridge-live.ts
|
|
12
12
|
Settings.Set({ unionPrioritySort: false });
|
|
13
13
|
function useTypebox(_mod) {}
|
|
14
|
+
function warmTypebox() {}
|
|
15
|
+
function preloadTypebox() {}
|
|
14
16
|
const isBridgeLive = () => true;
|
|
15
17
|
|
|
16
18
|
//#endregion
|
|
17
|
-
export { Check, Clone, Compile, Create, Decode,
|
|
19
|
+
export { Check, Clone, Compile, Create, Decode, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, preloadTypebox, useTypebox, warmTypebox };
|
package/dist/type/bridge.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { TypeBoxValidatorCache as TypeBoxValidatorCache$1, mayHaveFileType as ma
|
|
|
4
4
|
import { TypeBoxValidator as TypeBoxValidator$1 } from "./validator/index.js";
|
|
5
5
|
import { applyCoercions as applyCoercions$1, coerceBody as coerceBody$1, coerceFormData as coerceFormData$1, coerceQuery as coerceQuery$1, coerceRoot as coerceRoot$1, coerceStringToStructure as coerceStringToStructure$1 } from "./coerce.js";
|
|
6
6
|
import { Ref as Ref$1, TAny, TSchema } from "typebox/type";
|
|
7
|
+
import { Check as Check$1, Clone as Clone$1, Create as Create$1, Decode as Decode$2, HasCodec as HasCodec$1 } from "typebox/value";
|
|
7
8
|
import { Compile as Compile$1 } from "typebox/compile";
|
|
8
|
-
import { Check as Check$1, Clone as Clone$1, Create as Create$1, Decode as Decode$2, Default as Default$1, HasCodec as HasCodec$1 } from "typebox/value";
|
|
9
9
|
|
|
10
10
|
//#region src/type/bridge.d.ts
|
|
11
11
|
interface TypeboxModule {
|
|
@@ -24,10 +24,11 @@ interface TypeboxModule {
|
|
|
24
24
|
mayHaveFileType: typeof mayHaveFileType$1;
|
|
25
25
|
HasCodec: typeof HasCodec$1;
|
|
26
26
|
Intersect: typeof Intersect$2;
|
|
27
|
-
Default: typeof Default$1;
|
|
28
27
|
Ref: typeof Ref$1;
|
|
29
28
|
Clone: typeof Clone$1;
|
|
30
29
|
Check: typeof Check$1;
|
|
30
|
+
warmTypebox: () => void;
|
|
31
|
+
preloadTypebox: () => Promise<void> | undefined;
|
|
31
32
|
}
|
|
32
33
|
declare let Compile: typeof Compile$1;
|
|
33
34
|
declare let Create: typeof Create$1;
|
|
@@ -46,11 +47,12 @@ declare let hasTypes: typeof hasTypes$1;
|
|
|
46
47
|
declare let mayHaveFileType: typeof mayHaveFileType$1;
|
|
47
48
|
declare let HasCodec: typeof HasCodec$1;
|
|
48
49
|
declare let Intersect: typeof Intersect$2;
|
|
49
|
-
declare let Default: typeof Default$1;
|
|
50
50
|
declare let Ref: typeof Ref$1;
|
|
51
51
|
declare let Clone: typeof Clone$1;
|
|
52
52
|
declare let Check: typeof Check$1;
|
|
53
|
+
declare let warmTypebox: () => void;
|
|
54
|
+
declare let preloadTypebox: () => Promise<void> | undefined;
|
|
53
55
|
declare const isBridgeLive: () => boolean;
|
|
54
56
|
declare function useTypebox(mod: TypeboxModule): void;
|
|
55
57
|
//#endregion
|
|
56
|
-
export { Check, Clone, Compile, Create, Decode,
|
|
58
|
+
export { Check, Clone, Compile, Create, Decode, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, preloadTypebox, useTypebox, warmTypebox };
|
package/dist/type/bridge.js
CHANGED
|
@@ -33,10 +33,11 @@ let hasTypes = stub("hasTypes");
|
|
|
33
33
|
let mayHaveFileType = stub("mayHaveFileType");
|
|
34
34
|
let HasCodec = stub("HasCodec");
|
|
35
35
|
let Intersect = stub("Intersect");
|
|
36
|
-
let Default = stub("Default");
|
|
37
36
|
let Ref = stub("Ref");
|
|
38
37
|
let Clone = stub("Clone");
|
|
39
38
|
let Check = stub("Check");
|
|
39
|
+
let warmTypebox = stub("warmTypebox");
|
|
40
|
+
let preloadTypebox = () => void 0;
|
|
40
41
|
const isBridgeLive = () => live !== void 0;
|
|
41
42
|
function useTypebox(mod) {
|
|
42
43
|
live = mod;
|
|
@@ -55,10 +56,11 @@ function useTypebox(mod) {
|
|
|
55
56
|
mayHaveFileType = mod.mayHaveFileType;
|
|
56
57
|
HasCodec = mod.HasCodec;
|
|
57
58
|
Intersect = mod.Intersect;
|
|
58
|
-
Default = mod.Default;
|
|
59
59
|
Ref = mod.Ref;
|
|
60
60
|
Clone = mod.Clone;
|
|
61
61
|
Check = mod.Check;
|
|
62
|
+
warmTypebox = mod.warmTypebox;
|
|
63
|
+
preloadTypebox = mod.preloadTypebox;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
//#endregion
|
|
@@ -92,12 +94,6 @@ Object.defineProperty(exports, 'Decode', {
|
|
|
92
94
|
return Decode;
|
|
93
95
|
}
|
|
94
96
|
});
|
|
95
|
-
Object.defineProperty(exports, 'Default', {
|
|
96
|
-
enumerable: true,
|
|
97
|
-
get: function () {
|
|
98
|
-
return Default;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
97
|
Object.defineProperty(exports, 'HasCodec', {
|
|
102
98
|
enumerable: true,
|
|
103
99
|
get: function () {
|
|
@@ -177,4 +173,16 @@ Object.defineProperty(exports, 'mayHaveFileType', {
|
|
|
177
173
|
return mayHaveFileType;
|
|
178
174
|
}
|
|
179
175
|
});
|
|
180
|
-
exports
|
|
176
|
+
Object.defineProperty(exports, 'preloadTypebox', {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function () {
|
|
179
|
+
return preloadTypebox;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
exports.useTypebox = useTypebox;
|
|
183
|
+
Object.defineProperty(exports, 'warmTypebox', {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
get: function () {
|
|
186
|
+
return warmTypebox;
|
|
187
|
+
}
|
|
188
|
+
});
|