@forinda/kickjs 6.5.0 → 6.6.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-CEt1MEdF.d.mts → adapter-CbMq-NBf.d.mts} +25 -381
- package/dist/adapter-CbMq-NBf.d.mts.map +1 -0
- package/dist/{app-module-BSpHKlhE.d.mts → app-module-DtoySG6l.d.mts} +6 -5
- package/dist/app-module-DtoySG6l.d.mts.map +1 -0
- package/dist/application-B5Q-YJoM.mjs +12 -0
- package/dist/application-B5Q-YJoM.mjs.map +1 -0
- package/dist/{application-Bzdzl5wP.d.mts → application-zlzYGgKD.d.mts} +6 -6
- package/dist/application-zlzYGgKD.d.mts.map +1 -0
- package/dist/{bootstrap-C1VGQQVF.mjs → bootstrap-CBCqfg33.mjs} +3 -3
- package/dist/{bootstrap-C1VGQQVF.mjs.map → bootstrap-CBCqfg33.mjs.map} +1 -1
- package/dist/{bootstrap-DYexY169.d.mts → bootstrap-Nzgi7K2d.d.mts} +2 -3
- package/dist/bootstrap-Nzgi7K2d.d.mts.map +1 -0
- package/dist/{cache-CwZzIH0D.d.mts → cache-C0qL0NSD.d.mts} +2 -1
- package/dist/cache-C0qL0NSD.d.mts.map +1 -0
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +2 -2
- package/dist/{config-BeIZJBXA.mjs → config-BJlQYS41.mjs} +3 -3
- package/dist/{config-BeIZJBXA.mjs.map → config-BJlQYS41.mjs.map} +1 -1
- package/dist/{container-iED1swkd.d.mts → container-BW_MlgLj.d.mts} +3 -2
- package/dist/container-BW_MlgLj.d.mts.map +1 -0
- package/dist/{container-CBaL5lus.mjs → container-CWIOBh3o.mjs} +3 -3
- package/dist/{container-CBaL5lus.mjs.map → container-CWIOBh3o.mjs.map} +1 -1
- package/dist/{context-BS5o1IuU.mjs → context-C_WVtUdJ.mjs} +3 -3
- package/dist/{context-BS5o1IuU.mjs.map → context-C_WVtUdJ.mjs.map} +1 -1
- package/dist/{context-errors-CwD27Vbj.mjs → context-errors-CRYV9zx9.mjs} +2 -2
- package/dist/{context-errors-CwD27Vbj.mjs.map → context-errors-CRYV9zx9.mjs.map} +1 -1
- 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.mjs +2 -2
- package/dist/core/decorators.d.mts +1 -1
- package/dist/core/decorators.mjs +2 -2
- 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 +1 -1
- package/dist/core/logger.mjs +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-BZfJVhFV.mjs +12 -0
- package/dist/core-BZfJVhFV.mjs.map +1 -0
- package/dist/{cors-C4aSCD3J.d.mts → cors-BuDU9CpA.d.mts} +1 -2
- package/dist/cors-BuDU9CpA.d.mts.map +1 -0
- package/dist/cron-DOOtTY4q.d.mts.map +1 -1
- package/dist/{csrf-DNh_7aOk.mjs → csrf-Rg_ieGVH.mjs} +2 -2
- package/dist/{csrf-DNh_7aOk.mjs.map → csrf-Rg_ieGVH.mjs.map} +1 -1
- package/dist/{csrf-7nUXGTuz.d.mts → csrf-vR23CJas.d.mts} +1 -2
- package/dist/csrf-vR23CJas.d.mts.map +1 -0
- package/dist/{decorators-wEJBqXHg.d.mts → decorators-Bks7cgBJ.d.mts} +12 -7
- package/dist/decorators-Bks7cgBJ.d.mts.map +1 -0
- package/dist/{disposables-mnjJuaVx.mjs → disposables-kA0T2HiN.mjs} +2 -2
- package/dist/{disposables-mnjJuaVx.mjs.map → disposables-kA0T2HiN.mjs.map} +1 -1
- package/dist/env-JbEw5dip.mjs +13 -0
- package/dist/env-JbEw5dip.mjs.map +1 -0
- package/dist/{error-handler-DR01K_rI.d.mts → error-handler-Cr6Yt9as.d.mts} +1 -2
- package/dist/error-handler-Cr6Yt9as.d.mts.map +1 -0
- package/dist/{errors-n0H96eEz.d.mts → errors-By6UueCm.d.mts} +18 -9
- package/dist/errors-By6UueCm.d.mts.map +1 -0
- package/dist/{handler-UvmjQGYc.mjs → handler-Bu0kLKd0.mjs} +3 -3
- package/dist/{handler-UvmjQGYc.mjs.map → handler-Bu0kLKd0.mjs.map} +1 -1
- package/dist/{helmet-CKzZzeNl.d.mts → helmet-CFQUTVig.d.mts} +1 -2
- package/dist/helmet-CFQUTVig.d.mts.map +1 -0
- package/dist/http/application.d.mts +1 -1
- package/dist/http/application.mjs +2 -2
- package/dist/http/bootstrap.d.mts +1 -1
- package/dist/http/bootstrap.mjs +2 -2
- package/dist/http/context.d.mts +2 -2
- package/dist/http/context.mjs +2 -2
- package/dist/http/middleware/cors.d.mts +1 -1
- package/dist/http/middleware/cors.mjs +1 -1
- package/dist/http/middleware/csrf.d.mts +1 -1
- package/dist/http/middleware/csrf.mjs +2 -2
- package/dist/http/middleware/error-handler.d.mts +1 -1
- package/dist/http/middleware/error-handler.mjs +2 -2
- package/dist/http/middleware/helmet.d.mts +1 -1
- package/dist/http/middleware/helmet.mjs +1 -1
- package/dist/http/middleware/rate-limit.d.mts +1 -1
- package/dist/http/middleware/rate-limit.mjs +2 -2
- package/dist/http/middleware/request-id.d.mts +1 -1
- package/dist/http/middleware/request-id.mjs +1 -1
- package/dist/http/middleware/request-logger.d.mts +1 -1
- package/dist/http/middleware/request-logger.mjs +2 -2
- package/dist/http/middleware/session.d.mts +1 -1
- package/dist/http/middleware/session.mjs +2 -2
- package/dist/http/middleware/spa.d.mts +1 -1
- package/dist/http/middleware/spa.mjs +2 -2
- package/dist/http/middleware/spa.mjs.map +1 -1
- package/dist/http/middleware/upload.d.mts +1 -1
- package/dist/http/middleware/upload.mjs +2 -2
- package/dist/http/middleware/upload.mjs.map +1 -1
- package/dist/http/middleware/validate.d.mts +1 -1
- package/dist/http/middleware/validate.mjs +1 -1
- package/dist/http/middleware/views.d.mts +1 -1
- package/dist/http/middleware/views.mjs +2 -3
- package/dist/http/query/index.d.mts +1 -1
- package/dist/http/query/index.mjs +2 -2
- package/dist/http/router-builder.d.mts +1 -1
- package/dist/http/router-builder.mjs +2 -3
- package/dist/http/runtimes/fastify.d.mts +1 -2
- package/dist/http/runtimes/fastify.d.mts.map +1 -1
- package/dist/http/runtimes/fastify.mjs +3 -3
- package/dist/http/runtimes/fastify.mjs.map +1 -1
- package/dist/http/runtimes/h3-web.d.mts +1 -2
- package/dist/http/runtimes/h3-web.d.mts.map +1 -1
- package/dist/http/runtimes/h3-web.mjs +2 -2
- package/dist/http/runtimes/h3.d.mts +1 -2
- package/dist/http/runtimes/h3.d.mts.map +1 -1
- package/dist/http/runtimes/h3.mjs +2 -2
- package/dist/{index-BtWJ9SLP.d.mts → index-BfT5KZ-M.d.mts} +2 -2
- package/dist/index-BfT5KZ-M.d.mts.map +1 -0
- package/dist/{index-D98NLfS5.d.mts → index-M6TF75MS.d.mts} +2 -3
- package/dist/index-M6TF75MS.d.mts.map +1 -0
- package/dist/index.d.mts +26 -26
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{interfaces-CayXPOAf.d.mts → interfaces-BTTBdkvG.d.mts} +3 -2
- package/dist/interfaces-BTTBdkvG.d.mts.map +1 -0
- package/dist/{kv-stores-duYHIEr1.d.mts → kv-stores-CHowq8VP.d.mts} +5 -6
- package/dist/kv-stores-CHowq8VP.d.mts.map +1 -0
- package/dist/{kv-stores-O8HUSwpv.mjs → kv-stores-DK7ODvk4.mjs} +2 -2
- package/dist/{kv-stores-O8HUSwpv.mjs.map → kv-stores-DK7ODvk4.mjs.map} +1 -1
- package/dist/logger-DA43DvNY.d.mts.map +1 -1
- package/dist/{metadata-CUDfhy4e.mjs → metadata-DIPNlGWc.mjs} +2 -2
- package/dist/{metadata-CUDfhy4e.mjs.map → metadata-DIPNlGWc.mjs.map} +1 -1
- package/dist/{module-registry-Mv5FqVlq.mjs → module-registry-D-n2vLyp.mjs} +2 -2
- package/dist/{module-registry-Mv5FqVlq.mjs.map → module-registry-D-n2vLyp.mjs.map} +1 -1
- package/dist/path-BVA9MfN1.d.mts.map +1 -1
- package/dist/query-MyZvZviD.mjs +12 -0
- package/dist/{query-gMAVXzx2.mjs.map → query-MyZvZviD.mjs.map} +1 -1
- package/dist/{rate-limit-oLL5EPUf.d.mts → rate-limit-Dme747JJ.d.mts} +1 -2
- package/dist/rate-limit-Dme747JJ.d.mts.map +1 -0
- package/dist/{reactivity-XL0fFDvG.d.mts → reactivity-BkMNA0kp.d.mts} +2 -2
- package/dist/reactivity-BkMNA0kp.d.mts.map +1 -0
- package/dist/{reply-BMBvs-FB.mjs → reply-DjZbNhK8.mjs} +3 -3
- package/dist/{reply-BMBvs-FB.mjs.map → reply-DjZbNhK8.mjs.map} +1 -1
- package/dist/{request-id-IDobbxU-.d.mts → request-id-CVzJ1uHD.d.mts} +1 -2
- package/dist/request-id-CVzJ1uHD.d.mts.map +1 -0
- package/dist/{request-logger-DZVW6VNI.d.mts → request-logger-BU4ulKLp.d.mts} +1 -2
- package/dist/request-logger-BU4ulKLp.d.mts.map +1 -0
- package/dist/router-builder--ux2cFGK.mjs +12 -0
- package/dist/router-builder--ux2cFGK.mjs.map +1 -0
- package/dist/{router-builder-GWgxoOdC.d.mts → router-builder-CMGhEBU2.d.mts} +2 -3
- package/dist/router-builder-CMGhEBU2.d.mts.map +1 -0
- package/dist/{session-DSRA-PUX.d.mts → session-z9iewOXA.d.mts} +1 -2
- package/dist/session-z9iewOXA.d.mts.map +1 -0
- package/dist/{spa-DWzSWAzx.d.mts → spa-DsRUrm69.d.mts} +4 -9
- package/dist/spa-DsRUrm69.d.mts.map +1 -0
- package/dist/{upload-CIZc803m.d.mts → upload-XVTyQcNN.d.mts} +3 -3
- package/dist/upload-XVTyQcNN.d.mts.map +1 -0
- package/dist/{upload-config-CFfHvoHF.mjs → upload-config-CtPxFRHF.mjs} +2 -2
- package/dist/{upload-config-CFfHvoHF.mjs.map → upload-config-CtPxFRHF.mjs.map} +1 -1
- package/dist/{validate-DoZDOhCi.d.mts → validate-DMYpUnrf.d.mts} +1 -2
- package/dist/validate-DMYpUnrf.d.mts.map +1 -0
- package/dist/views-DsfBT1fR.d.mts +659 -0
- package/dist/views-DsfBT1fR.d.mts.map +1 -0
- package/dist/views-P_-HHEd7.mjs +12 -0
- package/dist/views-P_-HHEd7.mjs.map +1 -0
- package/dist/web.d.mts +4 -5
- package/dist/web.d.mts.map +1 -1
- package/dist/web.mjs +2 -2
- package/dist/web.mjs.map +1 -1
- package/package.json +10 -10
- package/dist/adapter-CEt1MEdF.d.mts.map +0 -1
- package/dist/app-module-BSpHKlhE.d.mts.map +0 -1
- package/dist/application-Bzdzl5wP.d.mts.map +0 -1
- package/dist/application-C-r79XqD.mjs +0 -12
- package/dist/application-C-r79XqD.mjs.map +0 -1
- package/dist/bootstrap-DYexY169.d.mts.map +0 -1
- package/dist/cache-CwZzIH0D.d.mts.map +0 -1
- package/dist/container-iED1swkd.d.mts.map +0 -1
- package/dist/contributor-runner-Cu13cDQp.mjs +0 -12
- package/dist/contributor-runner-Cu13cDQp.mjs.map +0 -1
- package/dist/core-TDR0XGzO.mjs +0 -12
- package/dist/core-TDR0XGzO.mjs.map +0 -1
- package/dist/cors-C4aSCD3J.d.mts.map +0 -1
- package/dist/csrf-7nUXGTuz.d.mts.map +0 -1
- package/dist/decorators-wEJBqXHg.d.mts.map +0 -1
- package/dist/env-Dgtjncd5.mjs +0 -13
- package/dist/env-Dgtjncd5.mjs.map +0 -1
- package/dist/error-handler-DR01K_rI.d.mts.map +0 -1
- package/dist/errors-n0H96eEz.d.mts.map +0 -1
- package/dist/helmet-CKzZzeNl.d.mts.map +0 -1
- package/dist/http/middleware/views.mjs.map +0 -1
- package/dist/http/router-builder.mjs.map +0 -1
- package/dist/index-BtWJ9SLP.d.mts.map +0 -1
- package/dist/index-D98NLfS5.d.mts.map +0 -1
- package/dist/interfaces-CayXPOAf.d.mts.map +0 -1
- package/dist/kv-stores-duYHIEr1.d.mts.map +0 -1
- package/dist/query-gMAVXzx2.mjs +0 -12
- package/dist/rate-limit-oLL5EPUf.d.mts.map +0 -1
- package/dist/reactivity-XL0fFDvG.d.mts.map +0 -1
- package/dist/request-id-IDobbxU-.d.mts.map +0 -1
- package/dist/request-logger-DZVW6VNI.d.mts.map +0 -1
- package/dist/rolldown-runtime-CuwksmWW.mjs +0 -11
- package/dist/router-builder-GWgxoOdC.d.mts.map +0 -1
- package/dist/session-DSRA-PUX.d.mts.map +0 -1
- package/dist/spa-DWzSWAzx.d.mts.map +0 -1
- package/dist/upload-CIZc803m.d.mts.map +0 -1
- package/dist/validate-DoZDOhCi.d.mts.map +0 -1
- package/dist/views-Kp8Z3AO1.d.mts +0 -275
- package/dist/views-Kp8Z3AO1.d.mts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-DoZDOhCi.d.mts","names":[],"sources":["../src/http/middleware/validate.ts"],"mappings":";;;;UAMiB,gBAAA;EACf,IAAA;EACA,KAAA;EACA,MAAA;AAAA;;;;;;AAAM;AAgDR;;;;;;;iBAAgB,QAAA,CAAS,MAAA,EAAQ,gBAAA,IAAgB,GAAA,EAClC,OAAA,EAAO,IAAA,EAAQ,QAAA,EAAQ,IAAA,EAAQ,YAAA"}
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { f as DepValue, o as ContextDecorator, s as ContextDecoratorSpec, v as MetaValue } from "./app-module-BSpHKlhE.mjs";
|
|
3
|
-
import { F as AdapterFactory, T as RequestContext, f as HttpRuntime, m as RouteEntry } from "./adapter-CEt1MEdF.mjs";
|
|
4
|
-
import { t as BuildRoutesOptions } from "./router-builder-GWgxoOdC.mjs";
|
|
5
|
-
import { Express, NextFunction, Request, Response, Router } from "express";
|
|
6
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
|
-
|
|
8
|
-
//#region src/http/cluster.d.ts
|
|
9
|
-
interface ClusterOptions {
|
|
10
|
-
/** Number of worker processes (default: os.cpus().length) */
|
|
11
|
-
workers?: number;
|
|
12
|
-
/** Delay before forcefully killing a worker during shutdown (ms), default: 5000 */
|
|
13
|
-
gracefulShutdownTimeout?: number;
|
|
14
|
-
/** Delay between worker restarts (ms), default: 1000 */
|
|
15
|
-
restartDelay?: number;
|
|
16
|
-
/** Max failures in restartWindow before refusing to restart, default: 5 */
|
|
17
|
-
maxFailures?: number;
|
|
18
|
-
/** Time window for counting failures (ms), default: 30000 */
|
|
19
|
-
restartWindow?: number;
|
|
20
|
-
}
|
|
21
|
-
/** Returns true if the current process is the cluster primary */
|
|
22
|
-
declare function isClusterPrimary(): boolean;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/http/define-http-context-decorator.d.ts
|
|
25
|
-
/**
|
|
26
|
-
* Curried form returned by {@link DefineHttpContextDecoratorFn.withParams}.
|
|
27
|
-
* Spell only the per-call params shape `P`; `K` and `D` are inferred
|
|
28
|
-
* from the spec, and `Ctx` is locked to `RequestContext`.
|
|
29
|
-
*/
|
|
30
|
-
interface DefineHttpContextDecoratorWithParams<P extends Record<string, unknown>> {
|
|
31
|
-
<K extends string, D extends Record<string, DepValue> = Record<string, never>>(spec: ContextDecoratorSpec<K, D, P, RequestContext>): ContextDecorator<K, D, P, RequestContext>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Public shape of {@link defineHttpContextDecorator} — the positional
|
|
35
|
-
* call signature plus the curried `.withParams<P>()` helper that fixes
|
|
36
|
-
* partial-inference for the parameterised case.
|
|
37
|
-
*/
|
|
38
|
-
interface DefineHttpContextDecoratorFn {
|
|
39
|
-
<K extends string, D extends Record<string, DepValue> = Record<string, never>, P extends Record<string, unknown> = Record<string, never>>(spec: ContextDecoratorSpec<K, D, P, RequestContext>): ContextDecorator<K, D, P, RequestContext>;
|
|
40
|
-
/**
|
|
41
|
-
* Curried entry point. Spell only `P`; `K` and `D` infer from the
|
|
42
|
-
* spec. `Ctx` is locked to `RequestContext`.
|
|
43
|
-
*
|
|
44
|
-
* ```ts
|
|
45
|
-
* const LoadTenant = defineHttpContextDecorator.withParams<{
|
|
46
|
-
* source: 'header' | 'subdomain'
|
|
47
|
-
* }>()({
|
|
48
|
-
* key: 'tenant',
|
|
49
|
-
* deps: { repo: TENANT_REPO }, // D inferred
|
|
50
|
-
* paramDefaults: { source: 'header' },
|
|
51
|
-
* resolve: (ctx, { repo }, params) => repo.findFor(ctx, params),
|
|
52
|
-
* })
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
withParams<P extends Record<string, unknown>>(): DefineHttpContextDecoratorWithParams<P>;
|
|
56
|
-
}
|
|
57
|
-
declare const defineHttpContextDecorator: DefineHttpContextDecoratorFn;
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/http/runtimes/express.d.ts
|
|
60
|
-
/**
|
|
61
|
-
* Materialize a controller's {@link RouteEntry}[] onto a fresh `express.Router`.
|
|
62
|
-
* Reproduces the legacy handler ordering precisely: validation → upload →
|
|
63
|
-
* `(ctx, next)` middleware → contributor runner → terminal handler. Each step
|
|
64
|
-
* constructs its own `RequestContext` over the same `req`/`res` — request-scoped
|
|
65
|
-
* state lives in the AsyncLocalStorage store, not on the ctx instance, so the
|
|
66
|
-
* per-step instances share state exactly as before.
|
|
67
|
-
*/
|
|
68
|
-
declare function materializeRouter(entries: RouteEntry[]): Router;
|
|
69
|
-
/**
|
|
70
|
-
* Build an Express Router from a controller class decorated with @Get, @Post,
|
|
71
|
-
* etc. The public, back-compatible entry point: a thin shim over
|
|
72
|
-
* {@link buildRouteTable} + {@link materializeRouter}. Returns an
|
|
73
|
-
* `express.Router` exactly as before — modules pass it to `app.use(path, router)`.
|
|
74
|
-
*
|
|
75
|
-
* @see buildRouteTable for the engine-neutral route-table form.
|
|
76
|
-
*/
|
|
77
|
-
declare function buildRoutes(controllerClass: any, options?: BuildRoutesOptions): Router;
|
|
78
|
-
/**
|
|
79
|
-
* The default HTTP runtime. Express stays a peer dependency of `@forinda/kickjs`;
|
|
80
|
-
* apps that pass no `runtime` get this and behave exactly as before.
|
|
81
|
-
*/
|
|
82
|
-
declare function expressRuntime(): HttpRuntime<Express>;
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/http/request-store.d.ts
|
|
85
|
-
/** Per-request storage for REQUEST-scoped DI and request context propagation */
|
|
86
|
-
interface RequestStore {
|
|
87
|
-
/** Unique request identifier */
|
|
88
|
-
requestId: string;
|
|
89
|
-
/**
|
|
90
|
-
* Per-request singleton cache for REQUEST-scoped services. Keys are
|
|
91
|
-
* heterogeneous (class constructors, `InjectionToken` objects, raw
|
|
92
|
-
* strings), so the map type stays `Map<any, any>`.
|
|
93
|
-
*/
|
|
94
|
-
instances: Map<any, any>;
|
|
95
|
-
/**
|
|
96
|
-
* Per-request key/value bag. Canonical backing store for
|
|
97
|
-
* `RequestContext.set/get` and the Context Contributor pipeline (#107)
|
|
98
|
-
* since Phase 3. Anything written here is visible to every concrete
|
|
99
|
-
* execution context constructed for the same request, regardless of
|
|
100
|
-
* which middleware/contributor wrote it.
|
|
101
|
-
*
|
|
102
|
-
* Keys are constrained to `string` per the locked decision in
|
|
103
|
-
* `architecture.md` §20.12 (#4); the value type is `unknown` because
|
|
104
|
-
* the concrete shape at each key is determined by the consumer's
|
|
105
|
-
* `ContextMeta` augmentation, not by the store itself.
|
|
106
|
-
*
|
|
107
|
-
* Prefer the {@link getRequestValue} helper over reaching into this
|
|
108
|
-
* map directly — it threads the augmented `ContextMeta` shape through
|
|
109
|
-
* `MetaValue<K>` so consumers get typed reads without an `as` cast.
|
|
110
|
-
* Writes should flow through `ctx.set(key, value)` or a Context
|
|
111
|
-
* Contributor's return value — see the `setRequestValue` note below
|
|
112
|
-
* for why this package intentionally does NOT ship a service-level
|
|
113
|
-
* write helper.
|
|
114
|
-
*/
|
|
115
|
-
values: Map<string, unknown>;
|
|
116
|
-
/** Set once {@link disposeRequestStore} has run — guards double-dispose. */
|
|
117
|
-
disposed?: boolean;
|
|
118
|
-
}
|
|
119
|
-
/** AsyncLocalStorage instance shared across the framework */
|
|
120
|
-
declare const requestStore: AsyncLocalStorage<RequestStore>;
|
|
121
|
-
/**
|
|
122
|
-
* Get the current request store. Throws if called outside a request context.
|
|
123
|
-
* Used by the Container to resolve REQUEST-scoped dependencies.
|
|
124
|
-
*/
|
|
125
|
-
declare function getRequestStore(): RequestStore;
|
|
126
|
-
/**
|
|
127
|
-
* Read a per-request `ContextMeta`-keyed value from outside a controller
|
|
128
|
-
* (services, repositories, anywhere with no `ctx` reference). Returns
|
|
129
|
-
* the augmented type for the key — `MetaValue<K>` — so consumers get the
|
|
130
|
-
* same static safety as `ctx.get(key)` without holding the context.
|
|
131
|
-
*
|
|
132
|
-
* Returns `undefined` outside an active request frame (background jobs,
|
|
133
|
-
* startup code, tests without `requestScopeMiddleware()`) — the helper
|
|
134
|
-
* is intentionally null-tolerant so calling it from a service that
|
|
135
|
-
* runs in both request and non-request paths doesn't throw.
|
|
136
|
-
*
|
|
137
|
-
* @example
|
|
138
|
-
* ```ts
|
|
139
|
-
* declare module '@forinda/kickjs' {
|
|
140
|
-
* interface ContextMeta { tenant: { id: string; name: string } }
|
|
141
|
-
* }
|
|
142
|
-
*
|
|
143
|
-
* @Service()
|
|
144
|
-
* class AuditService {
|
|
145
|
-
* log(action: string) {
|
|
146
|
-
* const tenant = getRequestValue('tenant') // typed: { id; name } | undefined
|
|
147
|
-
* db.audit.insert({ action, tenantId: tenant?.id })
|
|
148
|
-
* }
|
|
149
|
-
* }
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
declare function getRequestValue<K extends string>(key: K): MetaValue<K> | undefined;
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/http/middleware/request-scope.d.ts
|
|
155
|
-
/**
|
|
156
|
-
* Wraps each request in an AsyncLocalStorage context.
|
|
157
|
-
* Enables REQUEST-scoped DI and automatic requestId propagation to logs.
|
|
158
|
-
*
|
|
159
|
-
* Should be mounted early in the middleware pipeline (before route handlers).
|
|
160
|
-
* `Application` mounts this automatically unless `contextStore: 'manual'` is set
|
|
161
|
-
* or the user already includes one in their middleware list.
|
|
162
|
-
*/
|
|
163
|
-
declare function requestScopeMiddleware(): (req: Request, res: Response, next: NextFunction) => void;
|
|
164
|
-
//#endregion
|
|
165
|
-
//#region src/http/middleware/trace-context.d.ts
|
|
166
|
-
/**
|
|
167
|
-
* W3C Trace Context header name.
|
|
168
|
-
* @see https://www.w3.org/TR/trace-context/#traceparent-header
|
|
169
|
-
*/
|
|
170
|
-
declare const TRACEPARENT_HEADER = "traceparent";
|
|
171
|
-
interface TraceContextOptions {
|
|
172
|
-
/**
|
|
173
|
-
* When true, respond with a `traceresponse` header containing the trace ID.
|
|
174
|
-
* Useful for debugging. Default: false.
|
|
175
|
-
*/
|
|
176
|
-
propagateResponse?: boolean;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Parsed W3C trace context fields.
|
|
180
|
-
*/
|
|
181
|
-
interface TraceContext {
|
|
182
|
-
/** W3C traceparent version (usually '00') */
|
|
183
|
-
version: string;
|
|
184
|
-
/** 32-hex-char distributed trace ID */
|
|
185
|
-
traceId: string;
|
|
186
|
-
/** 16-hex-char parent span ID */
|
|
187
|
-
parentSpanId: string;
|
|
188
|
-
/** 2-hex-char trace flags */
|
|
189
|
-
flags: string;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Parse a W3C traceparent header value.
|
|
193
|
-
* Returns null if the format is invalid.
|
|
194
|
-
*/
|
|
195
|
-
declare function parseTraceparent(header: string): TraceContext | null;
|
|
196
|
-
/**
|
|
197
|
-
* Middleware that extracts W3C `traceparent` header and stores trace context
|
|
198
|
-
* in the request's AsyncLocalStorage store.
|
|
199
|
-
*
|
|
200
|
-
* If no valid `traceparent` header is present, a new traceId is generated
|
|
201
|
-
* so that every request always has a trace ID available for correlation.
|
|
202
|
-
*
|
|
203
|
-
* Must be mounted **after** `requestScopeMiddleware()` (which creates the store).
|
|
204
|
-
*
|
|
205
|
-
* @example
|
|
206
|
-
* ```ts
|
|
207
|
-
* bootstrap({
|
|
208
|
-
* middleware: [
|
|
209
|
-
* requestScopeMiddleware(),
|
|
210
|
-
* traceContext(), // extracts or generates traceId
|
|
211
|
-
* requestLogger(),
|
|
212
|
-
* express.json(),
|
|
213
|
-
* ],
|
|
214
|
-
* })
|
|
215
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
declare function traceContext(options?: TraceContextOptions): (req: Request, res: Response, next: NextFunction) => void;
|
|
218
|
-
//#endregion
|
|
219
|
-
//#region src/http/middleware/views.d.ts
|
|
220
|
-
interface ViewAdapterOptions {
|
|
221
|
-
/**
|
|
222
|
-
* Template engine — pass the engine module or a render function.
|
|
223
|
-
* Supported engines: ejs, pug, handlebars, nunjucks, or any
|
|
224
|
-
* Express-compatible engine with a __express property.
|
|
225
|
-
*
|
|
226
|
-
* @example
|
|
227
|
-
* ```ts
|
|
228
|
-
* import ejs from 'ejs'
|
|
229
|
-
* ViewAdapter({ engine: ejs, ext: 'ejs' })
|
|
230
|
-
*
|
|
231
|
-
* import pug from 'pug'
|
|
232
|
-
* ViewAdapter({ engine: pug, ext: 'pug' })
|
|
233
|
-
* ```
|
|
234
|
-
*/
|
|
235
|
-
engine: any;
|
|
236
|
-
/** File extension for templates (e.g., 'ejs', 'pug', 'hbs') */
|
|
237
|
-
ext: string;
|
|
238
|
-
/** Directory containing template files (default: 'src/views') */
|
|
239
|
-
viewsDir?: string;
|
|
240
|
-
/** Default layout template (optional — depends on engine) */
|
|
241
|
-
layout?: string;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* View/template adapter — pluggable template engine support for KickJS.
|
|
245
|
-
*
|
|
246
|
-
* Registers an Express view engine and sets the views directory.
|
|
247
|
-
* Use `ctx.render()` in controllers to render templates.
|
|
248
|
-
*
|
|
249
|
-
* Migrated to the `defineAdapter()` factory in v4 — call without `new`.
|
|
250
|
-
* The pre-v4 `new ViewAdapter({...})` form is gone; see
|
|
251
|
-
* `docs/guide/migration-v3-to-v4.md` for the rename.
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
* ```ts
|
|
255
|
-
* import ejs from 'ejs'
|
|
256
|
-
* import { ViewAdapter } from '@forinda/kickjs'
|
|
257
|
-
*
|
|
258
|
-
* bootstrap({
|
|
259
|
-
* modules,
|
|
260
|
-
* adapters: [
|
|
261
|
-
* ViewAdapter({ engine: ejs, ext: 'ejs', viewsDir: 'src/views' }),
|
|
262
|
-
* ],
|
|
263
|
-
* })
|
|
264
|
-
*
|
|
265
|
-
* // In a controller:
|
|
266
|
-
* @Get('/dashboard')
|
|
267
|
-
* async dashboard(ctx: RequestContext) {
|
|
268
|
-
* ctx.render('dashboard', { user: currentUser, title: 'Dashboard' })
|
|
269
|
-
* }
|
|
270
|
-
* ```
|
|
271
|
-
*/
|
|
272
|
-
declare const ViewAdapter: AdapterFactory<ViewAdapterOptions, unknown>;
|
|
273
|
-
//#endregion
|
|
274
|
-
export { ClusterOptions as _, TraceContextOptions as a, requestScopeMiddleware as c, getRequestValue as d, requestStore as f, defineHttpContextDecorator as g, materializeRouter as h, TraceContext as i, RequestStore as l, expressRuntime as m, ViewAdapterOptions as n, parseTraceparent as o, buildRoutes as p, TRACEPARENT_HEADER as r, traceContext as s, ViewAdapter as t, getRequestStore as u, isClusterPrimary as v };
|
|
275
|
-
//# sourceMappingURL=views-Kp8Z3AO1.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"views-Kp8Z3AO1.d.mts","names":[],"sources":["../src/http/cluster.ts","../src/http/define-http-context-decorator.ts","../src/http/runtimes/express.ts","../src/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