@forinda/kickjs 3.1.2 → 3.2.0
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-DjL8ql5d.d.mts → adapter-DLEHb0K6.d.mts} +14 -3
- package/dist/adapter-DLEHb0K6.d.mts.map +1 -0
- package/dist/{app-module-Cotu9TIC.d.mts → app-module-ERR9jhow.d.mts} +12 -2
- package/dist/app-module-ERR9jhow.d.mts.map +1 -0
- package/dist/{application-M8SEljFB.mjs → application-x8CXLOlv.mjs} +92 -22
- package/dist/application-x8CXLOlv.mjs.map +1 -0
- package/dist/{bootstrap-DdAhHgVG.mjs → bootstrap-CYnxozL_.mjs} +6 -6
- package/dist/{bootstrap-DdAhHgVG.mjs.map → bootstrap-CYnxozL_.mjs.map} +1 -1
- package/dist/{cache-CcTzzNdr.d.mts → cache-V91BNTIM.d.mts} +1 -1
- package/dist/{cache-CcTzzNdr.d.mts.map → cache-V91BNTIM.d.mts.map} +1 -1
- package/dist/{chunk-BfOl01nR.mjs → chunk-Bt-rz0Tp.mjs} +1 -1
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +3 -3
- package/dist/{config-rspGiIN-.mjs → config-aWxKLk4A.mjs} +3 -3
- package/dist/{config-rspGiIN-.mjs.map → config-aWxKLk4A.mjs.map} +1 -1
- package/dist/{container-BQ-X3dXH.mjs → container-Dnk43k54.mjs} +3 -3
- package/dist/{container-BQ-X3dXH.mjs.map → container-Dnk43k54.mjs.map} +1 -1
- package/dist/{container-BJb34faa.d.mts → container-fIS1uLx-.d.mts} +2 -2
- package/dist/{container-BJb34faa.d.mts.map → container-fIS1uLx-.d.mts.map} +1 -1
- package/dist/context-OktlOQBQ.mjs +327 -0
- package/dist/context-OktlOQBQ.mjs.map +1 -0
- package/dist/context-decorator-GA8-hDLe.d.mts +111 -0
- package/dist/context-decorator-GA8-hDLe.d.mts.map +1 -0
- package/dist/core/adapter.d.mts +1 -1
- package/dist/core/adapter.mjs +1 -1
- package/dist/core/app-module.d.mts +1 -1
- package/dist/core/app-module.mjs +1 -1
- package/dist/core/cache.d.mts +1 -1
- package/dist/core/cache.mjs +1 -1
- package/dist/core/container.d.mts +1 -1
- package/dist/core/container.mjs +2 -2
- package/dist/core/cron.d.mts +1 -1
- package/dist/core/cron.mjs +2 -2
- package/dist/core/decorators.d.mts +1 -1
- package/dist/core/decorators.mjs +3 -3
- package/dist/core/errors.d.mts +1 -1
- package/dist/core/errors.mjs +1 -1
- package/dist/core/interfaces.d.mts +1 -1
- package/dist/core/interfaces.mjs +3 -1
- package/dist/core/interfaces.mjs.map +1 -1
- package/dist/core/logger.d.mts +1 -1
- package/dist/core/logger.mjs +1 -1
- package/dist/core/path.d.mts +1 -1
- package/dist/core/path.mjs +1 -1
- package/dist/core/plugin.d.mts +1 -1
- package/dist/core/plugin.mjs +1 -1
- package/dist/core/reactivity.d.mts +1 -1
- package/dist/core/reactivity.mjs +1 -1
- package/dist/core-DANnH5-e.mjs +435 -0
- package/dist/core-DANnH5-e.mjs.map +1 -0
- package/dist/{cron-H-IyLcOr.d.mts → cron-CfsPdi7R.d.mts} +1 -1
- package/dist/{cron-H-IyLcOr.d.mts.map → cron-CfsPdi7R.d.mts.map} +1 -1
- package/dist/{decorators-C9_SN7ge.d.mts → decorators-H42oPg0m.d.mts} +2 -2
- package/dist/{decorators-C9_SN7ge.d.mts.map → decorators-H42oPg0m.d.mts.map} +1 -1
- package/dist/{env-C_0nE69f.mjs → env-Cs8Wt8A_.mjs} +4 -4
- package/dist/{env-C_0nE69f.mjs.map → env-Cs8Wt8A_.mjs.map} +1 -1
- package/dist/{errors-BOUCRl-p.d.mts → errors-D_CWI7Bl.d.mts} +1 -1
- package/dist/{errors-BOUCRl-p.d.mts.map → errors-D_CWI7Bl.d.mts.map} +1 -1
- package/dist/execution-context-Dl2CKqSo.d.mts +57 -0
- package/dist/execution-context-Dl2CKqSo.d.mts.map +1 -0
- package/dist/http/application.d.mts +60 -6
- package/dist/http/application.d.mts.map +1 -1
- package/dist/http/application.mjs +2 -2
- package/dist/http/bootstrap.mjs +2 -2
- package/dist/http/context.d.mts +21 -32
- package/dist/http/context.d.mts.map +1 -1
- package/dist/http/context.mjs +2 -271
- package/dist/http/middleware/cors.mjs +1 -1
- package/dist/http/middleware/csrf.mjs +1 -1
- package/dist/http/middleware/error-handler.mjs +2 -2
- package/dist/http/middleware/helmet.mjs +1 -1
- package/dist/http/middleware/rate-limit.mjs +1 -1
- package/dist/http/middleware/request-id.mjs +1 -1
- package/dist/http/middleware/request-logger.mjs +2 -2
- package/dist/http/middleware/session.mjs +1 -1
- package/dist/http/middleware/spa.d.mts +1 -1
- package/dist/http/middleware/spa.mjs +3 -3
- package/dist/http/middleware/upload.d.mts +1 -1
- package/dist/http/middleware/upload.mjs +1 -1
- package/dist/http/middleware/validate.d.mts.map +1 -1
- package/dist/http/middleware/validate.mjs +22 -4
- package/dist/http/middleware/validate.mjs.map +1 -1
- package/dist/http/middleware/views.d.mts +1 -1
- package/dist/http/middleware/views.mjs +2 -2
- package/dist/http/query/index.d.mts +1 -1
- package/dist/http/query/index.mjs +2 -2
- package/dist/http/router-builder.d.mts +14 -2
- package/dist/http/router-builder.d.mts.map +1 -1
- package/dist/http/router-builder.mjs +59 -7
- package/dist/http/router-builder.mjs.map +1 -1
- package/dist/index-BQM9pJrV.d.mts +275 -0
- package/dist/index-BQM9pJrV.d.mts.map +1 -0
- package/dist/{index-DNVfGjF9.d.mts → index-Cf-MGrqT.d.mts} +2 -2
- package/dist/{index-DNVfGjF9.d.mts.map → index-Cf-MGrqT.d.mts.map} +1 -1
- package/dist/{index-Co7a3Zat.d.mts → index-RNK41JPE.d.mts} +1 -1
- package/dist/{index-Co7a3Zat.d.mts.map → index-RNK41JPE.d.mts.map} +1 -1
- package/dist/index.d.mts +38 -19
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/{interfaces-DXjE8Re1.d.mts → interfaces-CwcdqfNq.d.mts} +3 -1
- package/dist/{interfaces-DXjE8Re1.d.mts.map → interfaces-CwcdqfNq.d.mts.map} +1 -1
- package/dist/{logger-CW6FHtvU.d.mts → logger-GK8yT0BD.d.mts} +1 -1
- package/dist/{logger-CW6FHtvU.d.mts.map → logger-GK8yT0BD.d.mts.map} +1 -1
- package/dist/{metadata-Dp3Ozdr5.mjs → metadata-BFuoSEX6.mjs} +2 -2
- package/dist/{metadata-Dp3Ozdr5.mjs.map → metadata-BFuoSEX6.mjs.map} +1 -1
- package/dist/{path-B4JcbwKX.d.mts → path-Bj3vZMUY.d.mts} +1 -1
- package/dist/path-Bj3vZMUY.d.mts.map +1 -0
- package/dist/{plugin-Cvacmm7N.d.mts → plugin-3rKA0Loy.d.mts} +36 -4
- package/dist/plugin-3rKA0Loy.d.mts.map +1 -0
- package/dist/{query-o6_fDG4v.mjs → query-BcYEjYyX.mjs} +2 -2
- package/dist/{query-o6_fDG4v.mjs.map → query-BcYEjYyX.mjs.map} +1 -1
- package/dist/{reactivity-I8nDlg4c.d.mts → reactivity-CczHu3R-.d.mts} +1 -1
- package/dist/{reactivity-I8nDlg4c.d.mts.map → reactivity-CczHu3R-.d.mts.map} +1 -1
- package/package.json +1 -1
- package/dist/adapter-DjL8ql5d.d.mts.map +0 -1
- package/dist/app-module-Cotu9TIC.d.mts.map +0 -1
- package/dist/application-M8SEljFB.mjs.map +0 -1
- package/dist/core-NDLlQziD.mjs +0 -121
- package/dist/core-NDLlQziD.mjs.map +0 -1
- package/dist/http/context.mjs.map +0 -1
- package/dist/index-CwqjAF6I.d.mts +0 -112
- package/dist/index-CwqjAF6I.d.mts.map +0 -1
- package/dist/path-B4JcbwKX.d.mts.map +0 -1
- package/dist/plugin-Cvacmm7N.d.mts.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/core/execution-context.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Transport-agnostic execution context primitives.
|
|
5
|
+
*
|
|
6
|
+
* `ExecutionContext` is the minimal contract every transport-specific
|
|
7
|
+
* context object satisfies — `RequestContext` (HTTP) implements it today;
|
|
8
|
+
* `WsContext`, `QueueContext`, and `CronContext` will adopt it in V2.
|
|
9
|
+
*
|
|
10
|
+
* `ContextMeta` is the augmentable per-request key/type registry. Apps and
|
|
11
|
+
* plugins extend it via module augmentation to get type-safe `ctx.get/set`
|
|
12
|
+
* across the codebase. It lives in core/ (not http/) so non-HTTP transports
|
|
13
|
+
* share a single declaration site.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* declare module '@forinda/kickjs' {
|
|
18
|
+
* interface ContextMeta {
|
|
19
|
+
* user: { id: string; email: string }
|
|
20
|
+
* tenant: { id: string; name: string }
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* function loadProject(ctx: ExecutionContext) {
|
|
25
|
+
* const user = ctx.get('user') // typed: { id: string; email: string } | undefined
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Augmentable per-request metadata registry.
|
|
31
|
+
*
|
|
32
|
+
* Extend via module augmentation to give `ctx.get()` / `ctx.set()` static
|
|
33
|
+
* type information for a given key. Unknown keys still resolve via an
|
|
34
|
+
* explicit generic: `ctx.get<MyType>('custom')`.
|
|
35
|
+
*/
|
|
36
|
+
interface ContextMeta {}
|
|
37
|
+
/** Resolve a {@link ContextMeta} value type, falling back to `Fallback` for unknown keys. */
|
|
38
|
+
type MetaValue<K extends string, Fallback = unknown> = K extends keyof ContextMeta ? ContextMeta[K] : Fallback;
|
|
39
|
+
/**
|
|
40
|
+
* Minimal transport-agnostic execution context.
|
|
41
|
+
*
|
|
42
|
+
* `RequestContext` (HTTP) implements this directly; future `WsContext`,
|
|
43
|
+
* `QueueContext`, and `CronContext` (V2) will too. The Context Contributor
|
|
44
|
+
* pipeline only depends on this interface — contributors authored against
|
|
45
|
+
* `ExecutionContext` work across every transport that adopts it.
|
|
46
|
+
*/
|
|
47
|
+
interface ExecutionContext {
|
|
48
|
+
/** Read a typed value from per-request metadata. */
|
|
49
|
+
get<K extends string>(key: K): MetaValue<K> | undefined;
|
|
50
|
+
/** Write a typed value into per-request metadata. */
|
|
51
|
+
set<K extends string>(key: K, value: MetaValue<K>): void;
|
|
52
|
+
/** Unique per-request identifier (HTTP: x-request-id; WS/queue/cron: transport-defined). */
|
|
53
|
+
readonly requestId: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { ExecutionContext as n, MetaValue as r, ContextMeta as t };
|
|
57
|
+
//# sourceMappingURL=execution-context-Dl2CKqSo.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-context-Dl2CKqSo.d.mts","names":[],"sources":["../src/core/execution-context.ts"],"mappings":";;;AAmCA;;;;;AAGA;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;UAfiB,WAAA;;KAGL,SAAA,yCAAkD,CAAA,eAAgB,WAAA,GAC1E,WAAA,CAAY,CAAA,IACZ,QAAA;;;;;;;;;UAUa,gBAAA;EAIsB;EAFrC,GAAA,mBAAsB,GAAA,EAAK,CAAA,GAAI,SAAA,CAAU,CAAA;EAEX;EAA9B,GAAA,mBAAsB,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,SAAA,CAAU,CAAA;EAE7B;EAAA,SAAT,SAAA;AAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as Container } from "../container-
|
|
3
|
-
import { r as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { t as Container } from "../container-fIS1uLx-.mjs";
|
|
3
|
+
import { r as ContributorRegistration } from "../context-decorator-GA8-hDLe.mjs";
|
|
4
|
+
import { r as AppAdapter } from "../adapter-DLEHb0K6.mjs";
|
|
5
|
+
import { n as AppModuleClass } from "../app-module-ERR9jhow.mjs";
|
|
6
|
+
import { t as KickPlugin } from "../plugin-3rKA0Loy.mjs";
|
|
6
7
|
import http from "node:http";
|
|
7
8
|
import { Express, RequestHandler } from "express";
|
|
8
9
|
|
|
@@ -50,6 +51,45 @@ interface ApplicationOptions {
|
|
|
50
51
|
middleware?: MiddlewareEntry[];
|
|
51
52
|
/** Plugins that bundle modules, adapters, middleware, and DI bindings */
|
|
52
53
|
plugins?: KickPlugin[];
|
|
54
|
+
/**
|
|
55
|
+
* Global Context Contributors (#107) that apply to every route in the
|
|
56
|
+
* application. Merge into the per-route pipeline at the `'global'`
|
|
57
|
+
* precedence level — they lose to module, adapter, class, and method
|
|
58
|
+
* contributors with the same key, providing app-wide defaults that any
|
|
59
|
+
* narrower scope can override.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const StartedAt = defineContextDecorator({
|
|
64
|
+
* key: 'requestStartedAt',
|
|
65
|
+
* resolve: () => Date.now(),
|
|
66
|
+
* })
|
|
67
|
+
*
|
|
68
|
+
* bootstrap({
|
|
69
|
+
* modules,
|
|
70
|
+
* contributors: [StartedAt.registration],
|
|
71
|
+
* })
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
contributors?: ContributorRegistration[] | readonly ContributorRegistration[];
|
|
75
|
+
/**
|
|
76
|
+
* Backing store strategy for {@link RequestContext} `set/get` and the
|
|
77
|
+
* Context Contributor pipeline (#107).
|
|
78
|
+
*
|
|
79
|
+
* - `'auto'` (default) — Application mounts {@link requestScopeMiddleware}
|
|
80
|
+
* automatically before any user middleware. If the user-supplied
|
|
81
|
+
* `middleware` list already includes `requestScopeMiddleware()`,
|
|
82
|
+
* detection skips the auto-mount so adopters can control its position.
|
|
83
|
+
* - `'manual'` — Application never mounts the wrapper. The caller is
|
|
84
|
+
* responsible for ensuring an `AsyncLocalStorage` frame surrounds
|
|
85
|
+
* each request, otherwise contributors won't run and `ctx.set/get`
|
|
86
|
+
* falls back to the deprecated `req.__ctxMeta` path.
|
|
87
|
+
*
|
|
88
|
+
* Use `'manual'` only when wrapping requests in your own ALS frame
|
|
89
|
+
* (rare — multi-tenant adapters used to do this; post-Phase 3 they
|
|
90
|
+
* share the framework's frame instead).
|
|
91
|
+
*/
|
|
92
|
+
contextStore?: 'auto' | 'manual';
|
|
53
93
|
/** Express `trust proxy` setting */
|
|
54
94
|
trustProxy?: boolean | number | string | ((ip: string, hopIndex: number) => boolean);
|
|
55
95
|
/** Maximum JSON body size (only used when middleware is not provided) */
|
|
@@ -148,8 +188,8 @@ declare class Application {
|
|
|
148
188
|
private app;
|
|
149
189
|
private container;
|
|
150
190
|
private httpServer;
|
|
151
|
-
private adapters;
|
|
152
|
-
private plugins;
|
|
191
|
+
private readonly adapters;
|
|
192
|
+
private readonly plugins;
|
|
153
193
|
/** Number of HTTP requests currently being processed */
|
|
154
194
|
private _inFlightRequests;
|
|
155
195
|
/** Whether the application is draining (shutting down gracefully) */
|
|
@@ -227,6 +267,20 @@ declare class Application {
|
|
|
227
267
|
/** Get registered adapters — used by DevToolsAdapter for peer discovery */
|
|
228
268
|
getAdapters(): AppAdapter[];
|
|
229
269
|
getHttpServer(): http.Server | null;
|
|
270
|
+
/**
|
|
271
|
+
* Decide whether {@link Application} should auto-mount the
|
|
272
|
+
* {@link requestScopeMiddleware} ALS wrapper.
|
|
273
|
+
*
|
|
274
|
+
* Returns `false` when:
|
|
275
|
+
* - `contextStore: 'manual'` was set (caller manages ALS frames), or
|
|
276
|
+
* - the user-supplied `middleware` list already includes a
|
|
277
|
+
* `requestScopeMiddleware()` (detected via the symbol marker stamped
|
|
278
|
+
* in `middleware/request-scope.ts`).
|
|
279
|
+
*
|
|
280
|
+
* Otherwise `true` — preserves the historical default of "always wrap
|
|
281
|
+
* requests in an ALS frame" so existing apps see no behavior change.
|
|
282
|
+
*/
|
|
283
|
+
private shouldAutoMountRequestScope;
|
|
230
284
|
private collectAdapterMiddleware;
|
|
231
285
|
private mountMiddlewareList;
|
|
232
286
|
private mountMiddlewareEntry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.mts","names":[],"sources":["../../src/http/application.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"application.d.mts","names":[],"sources":["../../src/http/application.ts"],"mappings":";;;;;;;;;;;;;;KA+BY,eAAA,GAAkB,cAAA;EAAmB,IAAA;EAAc,OAAA,EAAS,cAAA;AAAA;AAAA,UAEvD,kBAAA;;EAEf,OAAA,EAAS,cAAA;EAJmB;EAM5B,QAAA,GAAW,UAAA;EANkD;EAQ7D,IAAA;EARoF;EAUpF,SAAA;EARe;EAUf,cAAA;;;;;;;;;;;;;;;;;;;;;;EAuBA,UAAA,GAAa,eAAA;EAyBuC;EAtBpD,OAAA,GAAU,UAAA;EA4CV;;;;;;;;;;;;;;;;;;;;EAtBA,YAAA,GAAe,uBAAA,cAAqC,uBAAA;EAsHzC;;;;;;;;;;;;;;;;;EAnGX,YAAA;EAoGQ;EAjGR,UAAA,iCAA2C,EAAA,UAAY,QAAA;EAmG/C;EAjGR,SAAA;EAoGiB;;;;EA/FjB,cAAA;;;;;EAKA,eAAA;EAwIA;;;;;;;;;;;;;;;;;;EApHA,OAAA;IAAsB,OAAA;EAAA;EAihBhB;;;;;;;;;;;;;;;EAhgBN,UAAA,IAAc,GAAA,OAAU,GAAA,OAAU,IAAA;EAmqBN;;;;;;;;;;;;;;;;EAjpB5B,OAAA,IAAW,GAAA,OAAU,GAAA,OAAU,GAAA,OAAU,IAAA;;;;;;;;;;;;;;;;;;EAmBzC,QAAA;6DAEE,MAAA;EAAA;AAAA;;;;;cAQS,WAAA;EAAA,iBAiBkB,OAAA;EAAA,QAhBrB,GAAA;EAAA,QACA,SAAA;EAAA,QACA,UAAA;EAAA,iBACS,QAAA;EAAA,iBAEA,OAAA;;UAGT,iBAAA;;UAEA,SAAA;;UAEA,kBAAA;;UAEA,eAAA;cAEqB,OAAA,EAAS,kBAAA;;MAyBlC,UAAA,CAAA;;MAKA,gBAAA,CAAA;;EAKJ,YAAA,CAAA,GAAgB,SAAA;;;;;;;;;;;;;;;EAkBhB,MAAA,CAAO,GAAA,EAAK,IAAA,CAAK,eAAA,EAAiB,GAAA,EAAK,IAAA,CAAK,cAAA,EAAgB,IAAA,IAAQ,GAAA;;;;;;;;;;;;;;;UAsB5D,UAAA;;UAYM,QAAA;EAeR,KAAA,CAAA,GAAS,OAAA;;EAuOT,YAAA,CAAA,GAAgB,OAAA;;;;;;;;;;EAahB,KAAA,CAAA,GAAS,OAAA;;EAkET,OAAA,CAAA,GAAW,OAAA;;;;;;;;;;;EAoCX,QAAA,CAAA,GAAY,OAAA;EAgElB,aAAA,CAAA,GAAiB,OAAA;;EAKjB,WAAA,CAAA,GAAe,UAAA;EAIf,aAAA,CAAA,GAAiB,IAAA,CAAK,MAAA;;;;;;;;;;;;;;UAmBd,2BAAA;EAAA,QAWA,wBAAA;EAAA,QAmBA,mBAAA;EAAA,QAUA,oBAAA;;UASA,yBAAA;;UAsBA,oBAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v3.
|
|
2
|
+
* @forinda/kickjs v3.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { t as Application } from "../application-
|
|
11
|
+
import { t as Application } from "../application-x8CXLOlv.mjs";
|
|
12
12
|
export { Application };
|
package/dist/http/bootstrap.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v3.
|
|
2
|
+
* @forinda/kickjs v3.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { t as bootstrap } from "../bootstrap-
|
|
11
|
+
import { t as bootstrap } from "../bootstrap-CYnxozL_.mjs";
|
|
12
12
|
export { bootstrap };
|
package/dist/http/context.d.mts
CHANGED
|
@@ -1,35 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { n as ExecutionContext, r as MetaValue, t as ContextMeta } from "../execution-context-Dl2CKqSo.mjs";
|
|
3
|
+
import { g as QueryFieldConfig, y as TypedParsedQuery } from "../index-RNK41JPE.mjs";
|
|
3
4
|
import * as _$node_http0 from "node:http";
|
|
4
5
|
import { NextFunction, Request, Response } from "express";
|
|
5
6
|
|
|
6
7
|
//#region src/http/context.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Augmentable per-request metadata registry.
|
|
9
|
-
*
|
|
10
|
-
* Extend this interface via module augmentation to get type-safe
|
|
11
|
-
* `ctx.get()` / `ctx.set()` across your app. Unknown keys still
|
|
12
|
-
* work with an explicit generic: `ctx.get<MyType>('custom')`.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* // src/types.ts
|
|
17
|
-
* declare module '@forinda/kickjs' {
|
|
18
|
-
* interface ContextMeta {
|
|
19
|
-
* user: { id: string; email: string; roles: string[] }
|
|
20
|
-
* tenant: { id: string; name: string }
|
|
21
|
-
* requestStartedAt: number
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* // controller — fully typed, no generics needed
|
|
26
|
-
* ctx.get('user') // { id: string; email: string; roles: string[] } | undefined
|
|
27
|
-
* ctx.set('tenant', info) // type-checked value
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
interface ContextMeta {}
|
|
31
|
-
/** Resolve a ContextMeta value type, falling back to `Fallback` for unknown keys. */
|
|
32
|
-
type MetaValue<K extends string, Fallback = unknown> = K extends keyof ContextMeta ? ContextMeta[K] : Fallback;
|
|
33
8
|
/**
|
|
34
9
|
* The shape of a single route entry in `KickRoutes`. Generated by
|
|
35
10
|
* `kick typegen` and consumed via the `Ctx<T>` helper. Each field is
|
|
@@ -46,16 +21,30 @@ interface RouteShape {
|
|
|
46
21
|
/**
|
|
47
22
|
* Unified request/response abstraction passed to every controller method.
|
|
48
23
|
* Shields handlers from raw Express objects and provides convenience methods.
|
|
24
|
+
*
|
|
25
|
+
* Implements {@link ExecutionContext} so the transport-agnostic Context
|
|
26
|
+
* Contributor pipeline (#107) can run against this concrete HTTP context
|
|
27
|
+
* the same way it will run against future WS / queue / cron contexts.
|
|
49
28
|
*/
|
|
50
|
-
declare class RequestContext<TBody = any, TParams = any, TQuery = any> {
|
|
29
|
+
declare class RequestContext<TBody = any, TParams = any, TQuery = any> implements ExecutionContext {
|
|
51
30
|
readonly req: Request;
|
|
52
31
|
readonly res: Response;
|
|
53
32
|
readonly next: NextFunction;
|
|
54
33
|
constructor(req: Request, res: Response, next: NextFunction);
|
|
55
34
|
/**
|
|
56
35
|
* Per-request metadata map shared across all RequestContext instances
|
|
57
|
-
* for the same request.
|
|
58
|
-
*
|
|
36
|
+
* for the same request.
|
|
37
|
+
*
|
|
38
|
+
* Backed by `requestStore.getStore()?.values` (the AsyncLocalStorage
|
|
39
|
+
* map shared with the Context Contributor pipeline) when an ALS frame
|
|
40
|
+
* is active — the canonical, supported path.
|
|
41
|
+
*
|
|
42
|
+
* Falls back to a lazily-attached `req.__ctxMeta` Map for ad-hoc
|
|
43
|
+
* construction outside any frame — typically test code that builds a
|
|
44
|
+
* RequestContext directly without mounting `requestScopeMiddleware()`.
|
|
45
|
+
* That fallback path is **deprecated** and will be removed in the next
|
|
46
|
+
* major; a one-time non-production warning fires the first time it is
|
|
47
|
+
* hit so adopters can migrate to ALS-backed contexts.
|
|
59
48
|
*/
|
|
60
49
|
private get metadata();
|
|
61
50
|
get body(): TBody;
|
|
@@ -257,7 +246,7 @@ type Ctx<TRoute extends RouteShape = RouteShape> = RequestContext<TRoute extends
|
|
|
257
246
|
*/
|
|
258
247
|
declare global {
|
|
259
248
|
namespace KickRoutes {}
|
|
260
|
-
}
|
|
249
|
+
} //# sourceMappingURL=context.d.ts.map
|
|
261
250
|
//#endregion
|
|
262
|
-
export { ContextMeta, Ctx, RequestContext, RouteShape };
|
|
251
|
+
export { type ContextMeta, Ctx, RequestContext, RouteShape };
|
|
263
252
|
//# sourceMappingURL=context.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.mts","names":[],"sources":["../../src/http/context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.mts","names":[],"sources":["../../src/http/context.ts"],"mappings":";;;;;;;;;;;;;AA8DA;UAfiB,UAAA;EACf,MAAA;EACA,IAAA;EACA,KAAA;EACA,QAAA;AAAA;;;;;;;;;cAWW,cAAA,sDAAoE,gBAAA;EAAA,SAE7D,GAAA,EAAK,OAAA;EAAA,SACL,GAAA,EAAK,QAAA;EAAA,SACL,IAAA,EAAM,YAAA;cAFN,GAAA,EAAK,OAAA,EACL,GAAA,EAAK,QAAA,EACL,IAAA,EAAM,YAAA;EA2JiB;;;;;;;;;;;;;;;EAAA,YAzI7B,QAAA,CAAA;EAAA,IAYR,IAAA,CAAA,GAAQ,KAAA;EAAA,IAIR,MAAA,CAAA,GAAU,OAAA;EAAA,IAIV,KAAA,CAAA,GAAS,MAAA;EAAA,IAIT,OAAA,CAAA,GAJe,YAAA,CAIR,mBAAA;EAAA,IAIP,SAAA,CAAA;EAoM8B;EAAA,IA/L9B,OAAA,CAAA;EAgMgB;;;;;;;;;;;;;;;;;;;EAAA,IAzKhB,IAAA,CAAA,GAAQ,SAAA,SAAkB,MAAA;;;;;;;;;MAY1B,QAAA,CAAA;EAxDQ;;;;;;EAAA,IAmER,KAAA,CAAA;EAnDA;;;;;;;;;;;;;;;;;;;;;;;;EAkFJ,EAAA,iBAAmB,gBAAA,yBAAA,CACjB,WAAA,GAAc,OAAA,GACb,gBAAA,CAAiB,OAAA;EAmCE;EAAA,IA5BlB,IAAA,CAAA;EA4B2C;EAAA,IAvB3C,KAAA,CAAA;EA6BJ;;;;;;;EAhBA,GAAA,kBAAA,CAAsB,GAAA,EAAK,CAAA,GAAI,SAAA,CAAU,CAAA;EAoBxB;;;;;;EAVjB,GAAA,kBAAA,CAAsB,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,SAAA,CAAU,CAAA;EAM/C,IAAA,CAAK,IAAA,OAAW,MAAA,YAAY,QAAA,MAAA,MAAA;EAI5B,OAAA,CAAQ,IAAA,QAAS,QAAA,MAAA,MAAA;EAIjB,SAAA,CAAA,GAAS,QAAA,MAAA,MAAA;EAIT,QAAA,CAAS,OAAA,YAAqB,QAAA,MAAA,MAAA;EAI9B,UAAA,CAAW,OAAA,WAAe,QAAA,MAAA,MAAA;EAI1B,IAAA,CAAK,OAAA,UAAiB,MAAA,YAAY,QAAA,MAAA,MAAA;EAIlC,QAAA,CAAS,MAAA,EAAQ,MAAA,EAAQ,QAAA,UAAkB,WAAA,YAAwC,QAAA,MAAA,MAAA;EAJ7D;;;;;;;;;;;;;EAuBtB,MAAA,CAAO,QAAA,UAAkB,IAAA,GAAM,MAAA;EA4BzB;;;;;;;;;;;;;;;;;;;;;;;;EAAA,QAAA,oBAA4B,gBAAA,yBAAA,CAChC,OAAA,GAAU,MAAA,EAAQ,gBAAA,CAAiB,OAAA,MAAa,OAAA;IAAU,IAAA,EAAM,CAAA;IAAK,KAAA;EAAA,IACrE,WAAA,GAAc,OAAA,GAAO,OAAA,CAAA,QAAA,MAAA,MAAA;;AAmGzB;;;;;;;;;;;;;;;;;EAzDE,GAAA,CAAA;IA0DmC,0EAzCf,KAAA,WAAgB,EAAA,oBA0CnB;qCAAoB;uCACpB;;;;;AAClB;;;;;;;;;;;;;;;;;;KAJW,GAAA,gBAAmB,UAAA,GAAa,UAAA,IAAc,cAAA,CACxD,MAAA;EAAiB,IAAA;AAAA,IAAkB,CAAA,QACnC,MAAA;EAAiB,MAAA;AAAA,IAAoB,CAAA,QACrC,MAAA;EAAiB,KAAA;AAAA,IAAmB,CAAA;;;;;;;;;;;QAa9B,MAAA;EAAA,UAEI,UAAA;AAAA"}
|
package/dist/http/context.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v3.
|
|
2
|
+
* @forinda/kickjs v3.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,274 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
//#region src/http/context.ts
|
|
13
|
-
/**
|
|
14
|
-
* Unified request/response abstraction passed to every controller method.
|
|
15
|
-
* Shields handlers from raw Express objects and provides convenience methods.
|
|
16
|
-
*/
|
|
17
|
-
var RequestContext = class {
|
|
18
|
-
constructor(req, res, next) {
|
|
19
|
-
this.req = req;
|
|
20
|
-
this.res = res;
|
|
21
|
-
this.next = next;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Per-request metadata map shared across all RequestContext instances
|
|
25
|
-
* for the same request. Stored on `req` so middleware can pass data
|
|
26
|
-
* to handlers via `ctx.set()` / `ctx.get()`.
|
|
27
|
-
*/
|
|
28
|
-
get metadata() {
|
|
29
|
-
const r = this.req;
|
|
30
|
-
if (!r.__ctxMeta) r.__ctxMeta = /* @__PURE__ */ new Map();
|
|
31
|
-
return r.__ctxMeta;
|
|
32
|
-
}
|
|
33
|
-
get body() {
|
|
34
|
-
return this.req.body;
|
|
35
|
-
}
|
|
36
|
-
get params() {
|
|
37
|
-
return this.req.params;
|
|
38
|
-
}
|
|
39
|
-
get query() {
|
|
40
|
-
return this.req.query;
|
|
41
|
-
}
|
|
42
|
-
get headers() {
|
|
43
|
-
return this.req.headers;
|
|
44
|
-
}
|
|
45
|
-
get requestId() {
|
|
46
|
-
return this.req.requestId ?? this.req.headers["x-request-id"];
|
|
47
|
-
}
|
|
48
|
-
/** Session data (requires session middleware) */
|
|
49
|
-
get session() {
|
|
50
|
-
return this.req.session;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* The authenticated user set by AuthAdapter.
|
|
54
|
-
* Reads from the per-request metadata store first (`ctx.set('user', ...)`),
|
|
55
|
-
* then falls back to `req.user` (set directly by AuthAdapter middleware).
|
|
56
|
-
*
|
|
57
|
-
* Extend the `AuthUser` interface via module augmentation in `@forinda/kickjs-auth`
|
|
58
|
-
* to get full typing.
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```ts
|
|
62
|
-
* @Get('/me')
|
|
63
|
-
* @Authenticated()
|
|
64
|
-
* getProfile(ctx: RequestContext) {
|
|
65
|
-
* const user = ctx.user
|
|
66
|
-
* if (!user) return ctx.notFound()
|
|
67
|
-
* return ctx.json({ user })
|
|
68
|
-
* }
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
get user() {
|
|
72
|
-
return this.metadata.get("user") ?? this.req.user;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Tenant identifier for multi-tenant apps. Reads `user.tenantId` —
|
|
76
|
-
* populated either by `AuthAdapter.testMode({ tenantId })`, a tenant
|
|
77
|
-
* resolver middleware, or manually on the strategy's `mapPayload`.
|
|
78
|
-
*
|
|
79
|
-
* Augment `AuthUser` (or `ContextMeta['user']`) to widen the return
|
|
80
|
-
* type if your user shape guarantees a non-`string | undefined` id.
|
|
81
|
-
*/
|
|
82
|
-
get tenantId() {
|
|
83
|
-
return this.user?.tenantId;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Effective role list for the current user. Prefers `user.tenantRoles`
|
|
87
|
-
* (populated by `AuthAdapterOptions.roleResolver` under a tenant) and
|
|
88
|
-
* falls back to `user.roles`. Returns an empty array when the user is
|
|
89
|
-
* absent or the shape has neither field.
|
|
90
|
-
*/
|
|
91
|
-
get roles() {
|
|
92
|
-
const u = this.user;
|
|
93
|
-
return u?.tenantRoles ?? u?.roles ?? [];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Parse the request query string into structured filters, sort, pagination, and search.
|
|
97
|
-
* Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).
|
|
98
|
-
*
|
|
99
|
-
* Generic over the field config: when passed an inline literal (or
|
|
100
|
-
* `as const`), `filters[].field` and `sort[].field` are narrowed to
|
|
101
|
-
* the exact whitelisted field names. Pass nothing or a non-literal
|
|
102
|
-
* config and you get the loose `string` fallback.
|
|
103
|
-
*
|
|
104
|
-
* @param fieldConfig - Optional whitelist for filterable, sortable, and searchable fields
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```ts
|
|
108
|
-
* @Get('/')
|
|
109
|
-
* async list(ctx: RequestContext) {
|
|
110
|
-
* const parsed = ctx.qs({
|
|
111
|
-
* filterable: ['status', 'priority'],
|
|
112
|
-
* sortable: ['createdAt', 'title'],
|
|
113
|
-
* } as const)
|
|
114
|
-
* parsed.filters[0].field // typed as 'status' | 'priority'
|
|
115
|
-
* parsed.sort[0].field // typed as 'createdAt' | 'title'
|
|
116
|
-
* }
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
qs(fieldConfig) {
|
|
120
|
-
return parseQuery(this.req.query, fieldConfig);
|
|
121
|
-
}
|
|
122
|
-
/** Single uploaded file (requires @FileUpload({ mode: 'single' })) */
|
|
123
|
-
get file() {
|
|
124
|
-
return this.req.file;
|
|
125
|
-
}
|
|
126
|
-
/** Array of uploaded files (requires @FileUpload({ mode: 'array' })) */
|
|
127
|
-
get files() {
|
|
128
|
-
return this.req.files;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Read a value from the per-request metadata store.
|
|
132
|
-
*
|
|
133
|
-
* When `ContextMeta` has been augmented with a matching key, the return
|
|
134
|
-
* type is inferred automatically. For ad-hoc keys, pass a generic:
|
|
135
|
-
* `ctx.get<MyType>('custom')`.
|
|
136
|
-
*/
|
|
137
|
-
get(key) {
|
|
138
|
-
return this.metadata.get(key);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Write a value to the per-request metadata store.
|
|
142
|
-
*
|
|
143
|
-
* When `ContextMeta` has been augmented with a matching key, the value
|
|
144
|
-
* type is checked at compile time.
|
|
145
|
-
*/
|
|
146
|
-
set(key, value) {
|
|
147
|
-
this.metadata.set(key, value);
|
|
148
|
-
}
|
|
149
|
-
json(data, status = 200) {
|
|
150
|
-
return this.res.status(status).json(data);
|
|
151
|
-
}
|
|
152
|
-
created(data) {
|
|
153
|
-
return this.res.status(201).json(data);
|
|
154
|
-
}
|
|
155
|
-
noContent() {
|
|
156
|
-
return this.res.status(204).end();
|
|
157
|
-
}
|
|
158
|
-
notFound(message = "Not Found") {
|
|
159
|
-
return this.res.status(404).json({ message });
|
|
160
|
-
}
|
|
161
|
-
badRequest(message) {
|
|
162
|
-
return this.res.status(400).json({ message });
|
|
163
|
-
}
|
|
164
|
-
html(content, status = 200) {
|
|
165
|
-
return this.res.status(status).type("html").send(content);
|
|
166
|
-
}
|
|
167
|
-
download(buffer, filename, contentType = "application/octet-stream") {
|
|
168
|
-
this.res.setHeader("Content-Disposition", `attachment; filename="${filename}"`);
|
|
169
|
-
this.res.setHeader("Content-Type", contentType);
|
|
170
|
-
return this.res.send(buffer);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Render a template using the registered view engine (EJS, Pug, Handlebars, etc.).
|
|
174
|
-
* Requires a ViewAdapter to be configured in bootstrap().
|
|
175
|
-
*
|
|
176
|
-
* @param template - Template name (without extension, relative to viewsDir)
|
|
177
|
-
* @param data - Data to pass to the template
|
|
178
|
-
*
|
|
179
|
-
* @example
|
|
180
|
-
* ```ts
|
|
181
|
-
* ctx.render('dashboard', { user, title: 'Dashboard' })
|
|
182
|
-
* ctx.render('emails/welcome', { name: 'Alice' })
|
|
183
|
-
* ```
|
|
184
|
-
*/
|
|
185
|
-
render(template, data = {}) {
|
|
186
|
-
return this.res.render(template, data);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Parse query params and return a standardized paginated response.
|
|
190
|
-
* Calls `ctx.qs()` internally, then wraps your data with pagination meta.
|
|
191
|
-
*
|
|
192
|
-
* @param fetcher - Async function that receives ParsedQuery and returns `{ data, total }`
|
|
193
|
-
* @param fieldConfig - Optional whitelist for filterable, sortable, searchable fields
|
|
194
|
-
*
|
|
195
|
-
* @example
|
|
196
|
-
* ```ts
|
|
197
|
-
* @Get('/')
|
|
198
|
-
* async list(ctx: RequestContext) {
|
|
199
|
-
* return ctx.paginate(
|
|
200
|
-
* async (parsed) => {
|
|
201
|
-
* const data = await db.select().from(users)
|
|
202
|
-
* .where(query.where).limit(parsed.pagination.limit)
|
|
203
|
-
* .offset(parsed.pagination.offset).all()
|
|
204
|
-
* const total = await db.select({ count: count() }).from(users).get()
|
|
205
|
-
* return { data, total: total?.count ?? 0 }
|
|
206
|
-
* },
|
|
207
|
-
* { filterable: ['name', 'role'], sortable: ['createdAt'] },
|
|
208
|
-
* )
|
|
209
|
-
* }
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
async paginate(fetcher, fieldConfig) {
|
|
213
|
-
const parsed = this.qs(fieldConfig);
|
|
214
|
-
const { data, total } = await fetcher(parsed);
|
|
215
|
-
const { page, limit } = parsed.pagination;
|
|
216
|
-
const totalPages = Math.ceil(total / limit) || 1;
|
|
217
|
-
const response = {
|
|
218
|
-
data,
|
|
219
|
-
meta: {
|
|
220
|
-
page,
|
|
221
|
-
limit,
|
|
222
|
-
total,
|
|
223
|
-
totalPages,
|
|
224
|
-
hasNext: page < totalPages,
|
|
225
|
-
hasPrev: page > 1
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
return this.json(response);
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Start an SSE (Server-Sent Events) stream.
|
|
232
|
-
* Sets the correct headers and returns helpers to send events.
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* ```ts
|
|
236
|
-
* @Get('/events')
|
|
237
|
-
* async stream(ctx: RequestContext) {
|
|
238
|
-
* const sse = ctx.sse()
|
|
239
|
-
*
|
|
240
|
-
* const interval = setInterval(() => {
|
|
241
|
-
* sse.send({ time: new Date().toISOString() }, 'tick')
|
|
242
|
-
* }, 1000)
|
|
243
|
-
*
|
|
244
|
-
* sse.onClose(() => clearInterval(interval))
|
|
245
|
-
* }
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
sse() {
|
|
249
|
-
this.res.writeHead(200, {
|
|
250
|
-
"Content-Type": "text/event-stream",
|
|
251
|
-
"Cache-Control": "no-cache",
|
|
252
|
-
Connection: "keep-alive",
|
|
253
|
-
"X-Accel-Buffering": "no"
|
|
254
|
-
});
|
|
255
|
-
this.res.flushHeaders();
|
|
256
|
-
const closeCallbacks = [];
|
|
257
|
-
this.req.on("close", () => {
|
|
258
|
-
for (const cb of closeCallbacks) cb();
|
|
259
|
-
});
|
|
260
|
-
return {
|
|
261
|
-
send: (data, event, id) => {
|
|
262
|
-
if (id) this.res.write(`id: ${id}\n`);
|
|
263
|
-
if (event) this.res.write(`event: ${event}\n`);
|
|
264
|
-
this.res.write(`data: ${JSON.stringify(data)}\n\n`);
|
|
265
|
-
},
|
|
266
|
-
comment: (text) => {
|
|
267
|
-
this.res.write(`: ${text}\n\n`);
|
|
268
|
-
},
|
|
269
|
-
onClose: (fn) => {
|
|
270
|
-
closeCallbacks.push(fn);
|
|
271
|
-
},
|
|
272
|
-
close: () => {
|
|
273
|
-
this.res.end();
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
//#endregion
|
|
11
|
+
import { t as RequestContext } from "../context-OktlOQBQ.mjs";
|
|
279
12
|
export { RequestContext };
|
|
280
|
-
|
|
281
|
-
//# sourceMappingURL=context.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v3.
|
|
2
|
+
* @forinda/kickjs v3.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { createLogger } from "../../core/logger.mjs";
|
|
12
12
|
import { HttpException } from "../../core/errors.mjs";
|
|
13
|
-
import "../../core-
|
|
13
|
+
import "../../core-DANnH5-e.mjs";
|
|
14
14
|
//#region src/http/middleware/error-handler.ts
|
|
15
15
|
const log = createLogger("ErrorHandler");
|
|
16
16
|
/** Catch-all for unmatched routes */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v3.
|
|
2
|
+
* @forinda/kickjs v3.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
import { createLogger } from "../../core/logger.mjs";
|
|
12
|
-
import "../../core-
|
|
12
|
+
import "../../core-DANnH5-e.mjs";
|
|
13
13
|
//#region src/http/middleware/request-logger.ts
|
|
14
14
|
/**
|
|
15
15
|
* Middleware that logs every request with method, URL, status, duration, and request ID.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @forinda/kickjs v3.
|
|
2
|
+
* @forinda/kickjs v3.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Felix Orinda
|
|
5
5
|
*
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { t as __require } from "../../chunk-
|
|
11
|
+
import { t as __require } from "../../chunk-Bt-rz0Tp.mjs";
|
|
12
12
|
import { Logger } from "../../core/logger.mjs";
|
|
13
|
-
import "../../core-
|
|
13
|
+
import "../../core-DANnH5-e.mjs";
|
|
14
14
|
import { join, resolve } from "node:path";
|
|
15
15
|
import { existsSync, readFileSync } from "node:fs";
|
|
16
16
|
//#region src/http/middleware/spa.ts
|