elysia 2.0.0-exp.51 → 2.0.0-exp.52
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.js +6 -4
- package/dist/adapter/bun/index.mjs +6 -4
- package/dist/adapter/origin.d.ts +6 -2
- package/dist/adapter/origin.js +6 -2
- package/dist/adapter/origin.mjs +6 -2
- package/dist/compile/handler/jit.js +2 -1
- package/dist/compile/handler/jit.mjs +3 -2
- package/dist/compile/handler/params.js +1 -0
- package/dist/compile/handler/params.mjs +2 -1
- package/dist/compile/handler/utils.d.ts +9 -1
- package/dist/compile/handler/utils.js +15 -0
- package/dist/compile/handler/utils.mjs +15 -1
- package/dist/compile/lexer.d.ts +1 -1
- package/dist/context.d.ts +2 -2
- package/dist/handler/fetch.js +0 -1
- package/dist/handler/fetch.mjs +0 -1
- package/dist/package.js +1 -1
- package/dist/package.mjs +1 -1
- package/dist/type/bridge.d.ts +6 -6
- package/dist/type/constants.d.ts +1 -1
- package/dist/type/validator/index.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4,9 +4,9 @@ const require_constants = require('../../constants.js');
|
|
|
4
4
|
const require_utils = require('../../utils.js');
|
|
5
5
|
const require_adapter_web_standard_index = require('../web-standard/index.js');
|
|
6
6
|
const require_generation = require('../../generation.js');
|
|
7
|
+
const require_adapter_origin = require('../origin.js');
|
|
7
8
|
const require_compile_handler_index = require('../../compile/handler/index.js');
|
|
8
9
|
const require_route_table = require('../../route-table.js');
|
|
9
|
-
const require_adapter_origin = require('../origin.js');
|
|
10
10
|
|
|
11
11
|
//#region src/adapter/bun/index.ts
|
|
12
12
|
/**
|
|
@@ -15,9 +15,11 @@ const require_adapter_origin = require('../origin.js');
|
|
|
15
15
|
* always run before the next request comes in
|
|
16
16
|
* @see ../origin.ts
|
|
17
17
|
*
|
|
18
|
-
* Publish the request `Bun.serve` handed us so
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Publish the request `Bun.serve` handed us so the pipeline can prove, before
|
|
19
|
+
* its first suspension, that it holds the untouched original and may defer
|
|
20
|
+
* materializing `request.signal`. The proof happens in `createFetchHandler`'s
|
|
21
|
+
* prologue when there is a request hook, and at the compiled route's entry
|
|
22
|
+
* probe otherwise — both inside the same synchronous frame.
|
|
21
23
|
*
|
|
22
24
|
* `finally` runs on the synchronous return of `fetch` (the returned promise is
|
|
23
25
|
* not awaited), so the slot is live only for the handler's synchronous prologue.
|
|
@@ -3,9 +3,9 @@ import { isDynamicRegex, needEncodeRegex } from "../../constants.mjs";
|
|
|
3
3
|
import { flattenChain, getLoosePath, nullObject } from "../../utils.mjs";
|
|
4
4
|
import { WebStandardAdapter } from "../web-standard/index.mjs";
|
|
5
5
|
import { frozenRootOf, resolvedWsOf } from "../../generation.mjs";
|
|
6
|
+
import { origin } from "../origin.mjs";
|
|
6
7
|
import { buildNativeStaticResponse } from "../../compile/handler/index.mjs";
|
|
7
8
|
import { routeRow } from "../../route-table.mjs";
|
|
8
|
-
import { origin } from "../origin.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/adapter/bun/index.ts
|
|
11
11
|
/**
|
|
@@ -14,9 +14,11 @@ import { origin } from "../origin.mjs";
|
|
|
14
14
|
* always run before the next request comes in
|
|
15
15
|
* @see ../origin.ts
|
|
16
16
|
*
|
|
17
|
-
* Publish the request `Bun.serve` handed us so
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Publish the request `Bun.serve` handed us so the pipeline can prove, before
|
|
18
|
+
* its first suspension, that it holds the untouched original and may defer
|
|
19
|
+
* materializing `request.signal`. The proof happens in `createFetchHandler`'s
|
|
20
|
+
* prologue when there is a request hook, and at the compiled route's entry
|
|
21
|
+
* probe otherwise — both inside the same synchronous frame.
|
|
20
22
|
*
|
|
21
23
|
* `finally` runs on the synchronous return of `fetch` (the returned promise is
|
|
22
24
|
* not awaited), so the slot is live only for the handler's synchronous prologue.
|
package/dist/adapter/origin.d.ts
CHANGED
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
* and therefore must be observed synchronously.
|
|
12
12
|
*
|
|
13
13
|
* The Bun adapter publishes the untouched original here for the *synchronous*
|
|
14
|
-
* prologue of `app.fetch` and
|
|
14
|
+
* prologue of `app.fetch` and, on the lane where `fetch` has no request hook
|
|
15
|
+
* to run, for the compiled route's own entry probe, which is still inside that
|
|
16
|
+
* same synchronous frame, then clears it in `finally`, so the window closes
|
|
15
17
|
* before the first suspension and cannot leak across concurrent requests.
|
|
16
18
|
* A `.wrap()` HOC that replaces the request or defers calling `next()` past a
|
|
17
19
|
* microtask simply misses the window, fetch handler falls back to eager check
|
|
@@ -23,7 +25,9 @@
|
|
|
23
25
|
* JavaScript only ever does ONE thing at a time. When a request comes in, the
|
|
24
26
|
* adapter writes its name on the whiteboard (`origin.request = request`),
|
|
25
27
|
* walks it down the hall (`fetch(request)` the synchronous part, where the
|
|
26
|
-
* one and only identity check happens
|
|
28
|
+
* one and only identity check happens, in `fetch`'s prologue, or at the
|
|
29
|
+
* compiled route's entry when `fetch` had no hook to run first), and erases
|
|
30
|
+
* the whiteboard `finally`
|
|
27
31
|
* all in one uninterruptible turn. The next request's turn CANNOT start
|
|
28
32
|
* until this turn is completely finished, because that is how the event loop
|
|
29
33
|
* works: run-to-completion, no preemption. So request B can never see request
|
package/dist/adapter/origin.js
CHANGED
|
@@ -13,7 +13,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
13
13
|
* and therefore must be observed synchronously.
|
|
14
14
|
*
|
|
15
15
|
* The Bun adapter publishes the untouched original here for the *synchronous*
|
|
16
|
-
* prologue of `app.fetch` and
|
|
16
|
+
* prologue of `app.fetch` and, on the lane where `fetch` has no request hook
|
|
17
|
+
* to run, for the compiled route's own entry probe, which is still inside that
|
|
18
|
+
* same synchronous frame, then clears it in `finally`, so the window closes
|
|
17
19
|
* before the first suspension and cannot leak across concurrent requests.
|
|
18
20
|
* A `.wrap()` HOC that replaces the request or defers calling `next()` past a
|
|
19
21
|
* microtask simply misses the window, fetch handler falls back to eager check
|
|
@@ -25,7 +27,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
25
27
|
* JavaScript only ever does ONE thing at a time. When a request comes in, the
|
|
26
28
|
* adapter writes its name on the whiteboard (`origin.request = request`),
|
|
27
29
|
* walks it down the hall (`fetch(request)` the synchronous part, where the
|
|
28
|
-
* one and only identity check happens
|
|
30
|
+
* one and only identity check happens, in `fetch`'s prologue, or at the
|
|
31
|
+
* compiled route's entry when `fetch` had no hook to run first), and erases
|
|
32
|
+
* the whiteboard `finally`
|
|
29
33
|
* all in one uninterruptible turn. The next request's turn CANNOT start
|
|
30
34
|
* until this turn is completely finished, because that is how the event loop
|
|
31
35
|
* works: run-to-completion, no preemption. So request B can never see request
|
package/dist/adapter/origin.mjs
CHANGED
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
* and therefore must be observed synchronously.
|
|
12
12
|
*
|
|
13
13
|
* The Bun adapter publishes the untouched original here for the *synchronous*
|
|
14
|
-
* prologue of `app.fetch` and
|
|
14
|
+
* prologue of `app.fetch` and, on the lane where `fetch` has no request hook
|
|
15
|
+
* to run, for the compiled route's own entry probe, which is still inside that
|
|
16
|
+
* same synchronous frame, then clears it in `finally`, so the window closes
|
|
15
17
|
* before the first suspension and cannot leak across concurrent requests.
|
|
16
18
|
* A `.wrap()` HOC that replaces the request or defers calling `next()` past a
|
|
17
19
|
* microtask simply misses the window, fetch handler falls back to eager check
|
|
@@ -23,7 +25,9 @@
|
|
|
23
25
|
* JavaScript only ever does ONE thing at a time. When a request comes in, the
|
|
24
26
|
* adapter writes its name on the whiteboard (`origin.request = request`),
|
|
25
27
|
* walks it down the hall (`fetch(request)` the synchronous part, where the
|
|
26
|
-
* one and only identity check happens
|
|
28
|
+
* one and only identity check happens, in `fetch`'s prologue, or at the
|
|
29
|
+
* compiled route's entry when `fetch` had no hook to run first), and erases
|
|
30
|
+
* the whiteboard `finally`
|
|
27
31
|
* all in one uninterruptible turn. The next request's turn CANNOT start
|
|
28
32
|
* until this turn is completely finished, because that is how the event loop
|
|
29
33
|
* works: run-to-completion, no preemption. So request B can never see request
|
|
@@ -221,7 +221,8 @@ function compileHandlerJit({ method, path, handler, root, errorRoot, hook, adapt
|
|
|
221
221
|
let code = `${isAsync ? "async " : ""}function route(c){\n`;
|
|
222
222
|
if (abortOn) {
|
|
223
223
|
link(require_handler_utils.emptyResponse, "emp");
|
|
224
|
-
|
|
224
|
+
link(require_compile_handler_utils.armEntryAbort, "ea");
|
|
225
|
+
code += `if(ea(c))return emp.clone()\n`;
|
|
225
226
|
}
|
|
226
227
|
if ((hasAfterResponse || hasTrace) && !syncAfterResponse) code += "let _stl\n";
|
|
227
228
|
if (asyncCookieSign) code += "let _sg\n";
|
|
@@ -11,7 +11,7 @@ import { resolvedTraceOf, traceCapabilityRequired } from "../../generation.mjs";
|
|
|
11
11
|
import { buildCookieJar, parseCookieRaw, parseCookieRawDeferred, parseCookieRawLazy, parseCookieRawSigned, parseCookieRawSync, signCookieValues } from "../../cookie/utils.mjs";
|
|
12
12
|
import { isAsyncFunction } from "../utils.mjs";
|
|
13
13
|
import { emptyResponse, finalizeRouteError, forwardError } from "../../handler/utils.mjs";
|
|
14
|
-
import { cloneResponse, getQueryParseChannels, hasRequestBody, mapAfterHandle, mapAfterResponse, mapBeforeHandle, mapError, mapMapResponse, mapTransform, runBeforeHandlePrefix, runBeforeHandlePrefixAsync } from "./utils.mjs";
|
|
14
|
+
import { armEntryAbort, cloneResponse, getQueryParseChannels, hasRequestBody, mapAfterHandle, mapAfterResponse, mapBeforeHandle, mapError, mapMapResponse, mapTransform, runBeforeHandlePrefix, runBeforeHandlePrefixAsync } from "./utils.mjs";
|
|
15
15
|
import { JITProbe } from "../jit-probe.mjs";
|
|
16
16
|
|
|
17
17
|
//#region src/compile/handler/jit.ts
|
|
@@ -220,7 +220,8 @@ function compileHandlerJit({ method, path, handler, root, errorRoot, hook, adapt
|
|
|
220
220
|
let code = `${isAsync ? "async " : ""}function route(c){\n`;
|
|
221
221
|
if (abortOn) {
|
|
222
222
|
link(emptyResponse, "emp");
|
|
223
|
-
|
|
223
|
+
link(armEntryAbort, "ea");
|
|
224
|
+
code += `if(ea(c))return emp.clone()\n`;
|
|
224
225
|
}
|
|
225
226
|
if ((hasAfterResponse || hasTrace) && !syncAfterResponse) code += "let _stl\n";
|
|
226
227
|
if (asyncCookieSign) code += "let _sg\n";
|
|
@@ -30,6 +30,7 @@ const HANDLER_PARAMS = {
|
|
|
30
30
|
rdc: () => require_compile_handler_utils.replaceDeriveContext,
|
|
31
31
|
ise: () => require_error.internalServerErrorResponse,
|
|
32
32
|
emp: () => require_handler_utils.emptyResponse,
|
|
33
|
+
ea: () => require_compile_handler_utils.armEntryAbort,
|
|
33
34
|
isprod: () => require_universal_is_production.isProduction,
|
|
34
35
|
verr: () => require_error.ValidationError,
|
|
35
36
|
tee: () => require_adapter_utils.tee,
|
|
@@ -5,7 +5,7 @@ import { materializeSetHeaders, normalizeContentType, tee } from "../../adapter/
|
|
|
5
5
|
import { parseQueryFromURL } from "../../parse-query.mjs";
|
|
6
6
|
import { buildCookieJar, parseCookieRaw, parseCookieRawDeferred, parseCookieRawLazy, parseCookieRawSigned, parseCookieRawSync, signCookieValues } from "../../cookie/utils.mjs";
|
|
7
7
|
import { emptyResponse, finalizeRouteError, forwardError } from "../../handler/utils.mjs";
|
|
8
|
-
import { cloneResponse, getQueryParseChannels, hasRequestBody, replaceDeriveContext, runBeforeHandlePrefix } from "./utils.mjs";
|
|
8
|
+
import { armEntryAbort, cloneResponse, getQueryParseChannels, hasRequestBody, replaceDeriveContext, runBeforeHandlePrefix } from "./utils.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/compile/handler/params.ts
|
|
11
11
|
/** @internal exported for test/aot/param-descriptor.test.ts */
|
|
@@ -29,6 +29,7 @@ const HANDLER_PARAMS = {
|
|
|
29
29
|
rdc: () => replaceDeriveContext,
|
|
30
30
|
ise: () => internalServerErrorResponse,
|
|
31
31
|
emp: () => emptyResponse,
|
|
32
|
+
ea: () => armEntryAbort,
|
|
32
33
|
isprod: () => isProduction,
|
|
33
34
|
verr: () => ValidationError,
|
|
34
35
|
tee: () => tee,
|
|
@@ -13,6 +13,14 @@ interface TraceReporter {
|
|
|
13
13
|
}
|
|
14
14
|
declare function cloneResponse(r: unknown): unknown;
|
|
15
15
|
declare function hasRequestBody(request: Request): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Route-entry abort probe. Mirrors `createFetchHandler`'s `armEager`, but is
|
|
18
|
+
* paid only by routes that can actually observe an abort, so a hook-less
|
|
19
|
+
* route never materializes `request.signal` on any lane.
|
|
20
|
+
*
|
|
21
|
+
* @see `../../adapter/origin` for the provenance channel
|
|
22
|
+
*/
|
|
23
|
+
declare function armEntryAbort(context: any): any;
|
|
16
24
|
declare const mapTransform: (event: MaybeArray<TransformHandler<any, any, undefined, "local">>, rest?: [isAsync: boolean, report?: TraceReporter | undefined] | undefined, abortGuard?: string) => string;
|
|
17
25
|
declare function extractDeriveKeys(fn: Function): string[] | null;
|
|
18
26
|
declare function replaceDeriveContext(context: any, derivative: any): any;
|
|
@@ -34,4 +42,4 @@ interface QueryWalkState {
|
|
|
34
42
|
}
|
|
35
43
|
declare function getQueryParseChannels(querySchema: any): QueryWalkState | undefined;
|
|
36
44
|
//#endregion
|
|
37
|
-
export { Link, TraceReporter, cloneResponse, deriveModes, emptyResponse, extractDeriveKeys, getQueryParseChannels, hasRequestBody, mapAfterHandle, mapAfterResponse, mapBeforeHandle, mapError, mapMapResponse, mapTransform, replaceDeriveContext, runBeforeHandlePrefix, runBeforeHandlePrefixAsync };
|
|
45
|
+
export { Link, TraceReporter, armEntryAbort, cloneResponse, deriveModes, emptyResponse, extractDeriveKeys, getQueryParseChannels, hasRequestBody, mapAfterHandle, mapAfterResponse, mapBeforeHandle, mapError, mapMapResponse, mapTransform, replaceDeriveContext, runBeforeHandlePrefix, runBeforeHandlePrefixAsync };
|
|
@@ -5,6 +5,7 @@ const require_adapter_skip_clone = require('../../adapter/skip-clone.js');
|
|
|
5
5
|
const require_error = require('../../error.js');
|
|
6
6
|
const require_compile_utils = require('../utils.js');
|
|
7
7
|
const require_handler_utils = require('../../handler/utils.js');
|
|
8
|
+
const require_adapter_origin = require('../../adapter/origin.js');
|
|
8
9
|
const require_compile_lexer = require('../lexer.js');
|
|
9
10
|
|
|
10
11
|
//#region src/compile/handler/utils.ts
|
|
@@ -27,6 +28,19 @@ function hasRequestBody(request) {
|
|
|
27
28
|
if (request.headers.get("transfer-encoding") !== null) return true;
|
|
28
29
|
return request.body != null;
|
|
29
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Route-entry abort probe. Mirrors `createFetchHandler`'s `armEager`, but is
|
|
33
|
+
* paid only by routes that can actually observe an abort, so a hook-less
|
|
34
|
+
* route never materializes `request.signal` on any lane.
|
|
35
|
+
*
|
|
36
|
+
* @see `../../adapter/origin` for the provenance channel
|
|
37
|
+
*/
|
|
38
|
+
function armEntryAbort(context) {
|
|
39
|
+
const sig = context["~sig"];
|
|
40
|
+
if (sig !== void 0) return sig.aborted === true;
|
|
41
|
+
if (context.request === require_adapter_origin.origin.request) return false;
|
|
42
|
+
return (context["~sig"] = context.request.signal).aborted;
|
|
43
|
+
}
|
|
30
44
|
const trace = (report, fn) => report?.resolveChild(childName(fn)) ?? noTrace;
|
|
31
45
|
const toArray = (v) => Array.isArray(v) ? v : [v];
|
|
32
46
|
const mapTransform = /* @__PURE__ */ map((i, fn, [isAsync, report]) => {
|
|
@@ -481,6 +495,7 @@ const Await = (fn) => require_compile_utils.isAsyncFunction(fn) ? "await " : "";
|
|
|
481
495
|
const awaitGuard = (fn, isAsync, target) => isAsync && !require_compile_utils.isAsyncFunction(fn) ? `if(${target} instanceof Promise)${target}=await ${target}\n` : "";
|
|
482
496
|
|
|
483
497
|
//#endregion
|
|
498
|
+
exports.armEntryAbort = armEntryAbort;
|
|
484
499
|
exports.cloneResponse = cloneResponse;
|
|
485
500
|
exports.deriveModes = deriveModes;
|
|
486
501
|
exports.emptyResponse = require_handler_utils.emptyResponse;
|
|
@@ -4,6 +4,7 @@ import { skipClone } from "../../adapter/skip-clone.mjs";
|
|
|
4
4
|
import { ElysiaStatus } from "../../error.mjs";
|
|
5
5
|
import { isAsyncFunction } from "../utils.mjs";
|
|
6
6
|
import { emptyResponse } from "../../handler/utils.mjs";
|
|
7
|
+
import { origin } from "../../adapter/origin.mjs";
|
|
7
8
|
import { isIdentChar, isSpace, skipString } from "../lexer.mjs";
|
|
8
9
|
|
|
9
10
|
//#region src/compile/handler/utils.ts
|
|
@@ -26,6 +27,19 @@ function hasRequestBody(request) {
|
|
|
26
27
|
if (request.headers.get("transfer-encoding") !== null) return true;
|
|
27
28
|
return request.body != null;
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Route-entry abort probe. Mirrors `createFetchHandler`'s `armEager`, but is
|
|
32
|
+
* paid only by routes that can actually observe an abort, so a hook-less
|
|
33
|
+
* route never materializes `request.signal` on any lane.
|
|
34
|
+
*
|
|
35
|
+
* @see `../../adapter/origin` for the provenance channel
|
|
36
|
+
*/
|
|
37
|
+
function armEntryAbort(context) {
|
|
38
|
+
const sig = context["~sig"];
|
|
39
|
+
if (sig !== void 0) return sig.aborted === true;
|
|
40
|
+
if (context.request === origin.request) return false;
|
|
41
|
+
return (context["~sig"] = context.request.signal).aborted;
|
|
42
|
+
}
|
|
29
43
|
const trace = (report, fn) => report?.resolveChild(childName(fn)) ?? noTrace;
|
|
30
44
|
const toArray = (v) => Array.isArray(v) ? v : [v];
|
|
31
45
|
const mapTransform = /* @__PURE__ */ map((i, fn, [isAsync, report]) => {
|
|
@@ -480,4 +494,4 @@ const Await = (fn) => isAsyncFunction(fn) ? "await " : "";
|
|
|
480
494
|
const awaitGuard = (fn, isAsync, target) => isAsync && !isAsyncFunction(fn) ? `if(${target} instanceof Promise)${target}=await ${target}\n` : "";
|
|
481
495
|
|
|
482
496
|
//#endregion
|
|
483
|
-
export { cloneResponse, deriveModes, emptyResponse, extractDeriveKeys, getQueryParseChannels, hasRequestBody, mapAfterHandle, mapAfterResponse, mapBeforeHandle, mapError, mapMapResponse, mapTransform, replaceDeriveContext, runBeforeHandlePrefix, runBeforeHandlePrefixAsync };
|
|
497
|
+
export { armEntryAbort, cloneResponse, deriveModes, emptyResponse, extractDeriveKeys, getQueryParseChannels, hasRequestBody, mapAfterHandle, mapAfterResponse, mapBeforeHandle, mapError, mapMapResponse, mapTransform, replaceDeriveContext, runBeforeHandlePrefix, runBeforeHandlePrefixAsync };
|
package/dist/compile/lexer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/compile/lexer.d.ts
|
|
2
|
-
declare const isSpace: (ch: string) => ch is "
|
|
2
|
+
declare const isSpace: (ch: string) => ch is "\n" | " " | "\t" | "\r";
|
|
3
3
|
declare const isIdentChar: (ch: string) => boolean;
|
|
4
4
|
declare const isIdentCharCode: (code: number) => boolean;
|
|
5
5
|
declare function skipString(src: string, start: number): number;
|
package/dist/context.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { AnyElysia } from "./base.js";
|
|
|
11
11
|
declare function createBaseContext(app: AnyElysia): any;
|
|
12
12
|
declare function clearContextCache(): void;
|
|
13
13
|
declare function createContext(app: AnyElysia): new (request: Request) => Context;
|
|
14
|
-
|
|
14
|
+
interface ContextBase<in out Route extends RouteSchema, in out Singleton extends SingletonBase> {
|
|
15
15
|
server: Server | null;
|
|
16
16
|
redirect: redirect;
|
|
17
17
|
set: {
|
|
@@ -48,7 +48,7 @@ type ContextBase<in out Route extends RouteSchema, in out Singleton extends Sing
|
|
|
48
48
|
rid?: string;
|
|
49
49
|
request: Request;
|
|
50
50
|
store: Singleton['store'];
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
52
|
type ErrorContext<in out Route extends RouteSchema = {}, in out Singleton extends SingletonBase = DefaultSingleton, Path extends string | undefined = undefined> = Prettify<{
|
|
53
53
|
body: Route['body'];
|
|
54
54
|
query: undefined extends Route['query'] ? Record<string, string | undefined> : Route['query'];
|
package/dist/handler/fetch.js
CHANGED
|
@@ -304,7 +304,6 @@ function createFetchHandler(app) {
|
|
|
304
304
|
}
|
|
305
305
|
return (request, server) => {
|
|
306
306
|
const context = new Context(request);
|
|
307
|
-
if (abortSignal && request !== require_adapter_origin.origin.request) context["~sig"] = request.signal;
|
|
308
307
|
const path = extractPath(request.url, context, pathStart);
|
|
309
308
|
context.server = server ?? null;
|
|
310
309
|
const method = request.method;
|
package/dist/handler/fetch.mjs
CHANGED
|
@@ -302,7 +302,6 @@ function createFetchHandler(app) {
|
|
|
302
302
|
}
|
|
303
303
|
return (request, server) => {
|
|
304
304
|
const context = new Context(request);
|
|
305
|
-
if (abortSignal && request !== origin.request) context["~sig"] = request.signal;
|
|
306
305
|
const path = extractPath(request.url, context, pathStart);
|
|
307
306
|
context.server = server ?? null;
|
|
308
307
|
const method = request.method;
|
package/dist/package.js
CHANGED
package/dist/package.mjs
CHANGED
package/dist/type/bridge.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Intersect as Intersect$
|
|
1
|
+
import { Intersect as Intersect$2 } from "./elysia/intersect.js";
|
|
2
2
|
import { hasTypes as hasTypes$1 } from "./utils.js";
|
|
3
3
|
import { TypeBoxValidatorCache as TypeBoxValidatorCache$1, mayHaveFileType as mayHaveFileType$1 } from "./validator/validator-cache.js";
|
|
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
7
|
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$
|
|
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 {
|
|
12
12
|
Compile: typeof Compile$1;
|
|
13
13
|
Create: typeof Create$1;
|
|
14
|
-
Decode: typeof Decode$
|
|
14
|
+
Decode: typeof Decode$2;
|
|
15
15
|
applyCoercions: typeof applyCoercions$1;
|
|
16
16
|
TypeBoxValidator: TypeBoxValidator$1;
|
|
17
17
|
TypeBoxValidatorCache: TypeBoxValidatorCache$1;
|
|
@@ -23,7 +23,7 @@ interface TypeboxModule {
|
|
|
23
23
|
hasTypes: typeof hasTypes$1;
|
|
24
24
|
mayHaveFileType: typeof mayHaveFileType$1;
|
|
25
25
|
HasCodec: typeof HasCodec$1;
|
|
26
|
-
Intersect: typeof Intersect$
|
|
26
|
+
Intersect: typeof Intersect$2;
|
|
27
27
|
Default: typeof Default$1;
|
|
28
28
|
Ref: typeof Ref$1;
|
|
29
29
|
Clone: typeof Clone$1;
|
|
@@ -31,7 +31,7 @@ interface TypeboxModule {
|
|
|
31
31
|
}
|
|
32
32
|
declare let Compile: typeof Compile$1;
|
|
33
33
|
declare let Create: typeof Create$1;
|
|
34
|
-
declare let Decode: typeof Decode$
|
|
34
|
+
declare let Decode: typeof Decode$2;
|
|
35
35
|
declare let applyCoercions: typeof applyCoercions$1;
|
|
36
36
|
declare let TypeBoxValidator: TypeBoxValidator$1;
|
|
37
37
|
type TypeBoxValidator<T extends TSchema = TAny> = TypeBoxValidator$1<T>;
|
|
@@ -45,7 +45,7 @@ declare let coerceBody: typeof coerceBody$1;
|
|
|
45
45
|
declare let hasTypes: typeof hasTypes$1;
|
|
46
46
|
declare let mayHaveFileType: typeof mayHaveFileType$1;
|
|
47
47
|
declare let HasCodec: typeof HasCodec$1;
|
|
48
|
-
declare let Intersect: typeof Intersect$
|
|
48
|
+
declare let Intersect: typeof Intersect$2;
|
|
49
49
|
declare let Default: typeof Default$1;
|
|
50
50
|
declare let Ref: typeof Ref$1;
|
|
51
51
|
declare let Clone: typeof Clone$1;
|
package/dist/type/constants.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const ELYSIA_TYPES: {
|
|
|
17
17
|
readonly NoValidate: 15;
|
|
18
18
|
};
|
|
19
19
|
type ELYSIA_TYPES = typeof ELYSIA_TYPES;
|
|
20
|
-
declare const primitiveElysiaTypes: Set<
|
|
20
|
+
declare const primitiveElysiaTypes: Set<1 | 2 | 6 | 3 | 10 | 11 | 13 | 14>;
|
|
21
21
|
declare const noEnumerable: {
|
|
22
22
|
readonly enumerable: false;
|
|
23
23
|
};
|
|
@@ -2,8 +2,8 @@ import { MaybePromise } from "../../types.js";
|
|
|
2
2
|
import { Validator as Validator$1, ValidatorOptions } from "../../validator/index.js";
|
|
3
3
|
import { TypeBoxValidatorCache, mayHaveFileType } from "./validator-cache.js";
|
|
4
4
|
import { Static, StaticDecode, StaticEncode, TAny, TSchema } from "typebox/type";
|
|
5
|
-
import { TLocalizedValidationError } from "typebox/error";
|
|
6
5
|
import { Validator } from "typebox/schema";
|
|
6
|
+
import { TLocalizedValidationError } from "typebox/error";
|
|
7
7
|
|
|
8
8
|
//#region src/type/validator/index.d.ts
|
|
9
9
|
declare function shallowMergeObjects(members: any[]): TSchema | null;
|
package/dist/types.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ import { Context, ErrorContext, LifecycleContext, PreContext } from "./context.j
|
|
|
9
9
|
import { AnySchema, StandardSchemaV1Like, TypeBoxSchema } from "./type/types.js";
|
|
10
10
|
import { AnyElysia, Elysia } from "./base.js";
|
|
11
11
|
import { ElysiaAdapter } from "./adapter/index.js";
|
|
12
|
-
import { Static, StaticDecode, StaticEncode, TIntersect, TObject, TSchema } from "typebox";
|
|
13
12
|
import { Instruction } from "exact-mirror";
|
|
13
|
+
import { Static, StaticDecode, StaticEncode, TIntersect, TObject, TSchema } from "typebox";
|
|
14
14
|
import { OpenAPIV3 } from "openapi-types";
|
|
15
15
|
|
|
16
16
|
//#region src/types.d.ts
|