@forinda/kickjs 8.2.1 → 8.3.1
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-CvHtIu8A.d.mts → adapter-Duqrig18.d.mts} +9 -5
- package/dist/adapter-Duqrig18.d.mts.map +1 -0
- package/dist/{app-module-DyqiS9rQ.d.mts → app-module--bC2V1yw.d.mts} +18 -2
- package/dist/{app-module-DyqiS9rQ.d.mts.map → app-module--bC2V1yw.d.mts.map} +1 -1
- package/dist/{spa-DXTOhkVK.d.mts → application-BeVzWyTq.d.mts} +598 -69
- package/dist/application-BeVzWyTq.d.mts.map +1 -0
- package/dist/application-DT1nNdC7.mjs +12 -0
- package/dist/application-DT1nNdC7.mjs.map +1 -0
- package/dist/{bootstrap-DjJFTF0G.mjs → bootstrap-C6-CrVgx.mjs} +3 -3
- package/dist/{bootstrap-DjJFTF0G.mjs.map → bootstrap-C6-CrVgx.mjs.map} +1 -1
- package/dist/{client-ip-Dq-vEUNq.mjs → client-ip-r74dYQsg.mjs} +2 -2
- package/dist/{client-ip-Dq-vEUNq.mjs.map → client-ip-r74dYQsg.mjs.map} +1 -1
- package/dist/config/index.mjs +2 -2
- package/dist/{config-C3V72KSV.mjs → config-Bbqd77CD.mjs} +3 -3
- package/dist/{config-C3V72KSV.mjs.map → config-Bbqd77CD.mjs.map} +1 -1
- package/dist/{container-CZPSM8p-.mjs → container-CzBE79TS.mjs} +3 -3
- package/dist/{container-CZPSM8p-.mjs.map → container-CzBE79TS.mjs.map} +1 -1
- package/dist/{context-Dlkv3CNe.mjs → context-CCo_tD5m.mjs} +3 -3
- package/dist/{context-Dlkv3CNe.mjs.map → context-CCo_tD5m.mjs.map} +1 -1
- package/dist/{context-errors-CkXOg4qD.mjs → context-errors-CH2YMGwk.mjs} +2 -2
- package/dist/{context-errors-CkXOg4qD.mjs.map → context-errors-CH2YMGwk.mjs.map} +1 -1
- package/dist/{contributor-runner-r-_idhMs.mjs → contributor-runner-Cf6M_ILY.mjs} +3 -3
- package/dist/{contributor-runner-r-_idhMs.mjs.map → contributor-runner-Cf6M_ILY.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.mjs +1 -1
- package/dist/core/container.mjs +2 -2
- package/dist/core/cron.mjs +2 -2
- package/dist/core/decorators.mjs +2 -2
- package/dist/core/errors.mjs +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.mjs +1 -1
- package/dist/{core-yW2dJ6lZ.mjs → core-vktCOX0c.mjs} +3 -3
- package/dist/{core-yW2dJ6lZ.mjs.map → core-vktCOX0c.mjs.map} +1 -1
- package/dist/{csrf-HVVOHlf8.d.mts → csrf-DDwUOF45.d.mts} +2 -2
- package/dist/{csrf-HVVOHlf8.d.mts.map → csrf-DDwUOF45.d.mts.map} +1 -1
- package/dist/{csrf-CFqmihA5.mjs → csrf-DiOCjUPJ.mjs} +3 -3
- package/dist/{csrf-CFqmihA5.mjs.map → csrf-DiOCjUPJ.mjs.map} +1 -1
- package/dist/{decorate-BzpBGF3k.mjs → decorate-Bn8r2PEB.mjs} +1 -1
- package/dist/{define-adapter-DexwynMQ.mjs → define-adapter-BBA4UbXZ.mjs} +2 -2
- package/dist/{define-adapter-DexwynMQ.mjs.map → define-adapter-BBA4UbXZ.mjs.map} +1 -1
- package/dist/{disposables-aOd-n5K3.mjs → disposables-DsrxA4Xv.mjs} +2 -2
- package/dist/{disposables-aOd-n5K3.mjs.map → disposables-DsrxA4Xv.mjs.map} +1 -1
- package/dist/{env-CXMlXrJd.mjs → env-DmEVaWGi.mjs} +3 -3
- package/dist/{env-CXMlXrJd.mjs.map → env-DmEVaWGi.mjs.map} +1 -1
- package/dist/{error-handler-DVAcTt8p.d.mts → error-handler-BOT8vAPx.d.mts} +2 -2
- package/dist/{error-handler-DVAcTt8p.d.mts.map → error-handler-BOT8vAPx.d.mts.map} +1 -1
- package/dist/{handler-Bhn7_J7d.mjs → handler-HmFLwQ8M.mjs} +3 -3
- package/dist/{handler-Bhn7_J7d.mjs.map → handler-HmFLwQ8M.mjs.map} +1 -1
- 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.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.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.mjs +1 -1
- package/dist/http/middleware/request-logger.mjs +2 -2
- 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/upload.d.mts +1 -1
- package/dist/http/middleware/upload.mjs +2 -2
- package/dist/http/middleware/validate.mjs +1 -1
- package/dist/http/middleware/views.d.mts +1 -1
- package/dist/http/middleware/views.mjs +2 -2
- package/dist/http/query/index.mjs +2 -2
- package/dist/http/router-builder.d.mts +1 -1
- package/dist/http/router-builder.mjs +2 -2
- package/dist/http/runtimes/fastify.d.mts +1 -1
- package/dist/http/runtimes/fastify.mjs +2 -2
- package/dist/http/runtimes/h3-web.d.mts +1 -1
- package/dist/http/runtimes/h3-web.mjs +2 -2
- package/dist/http/runtimes/h3.d.mts +1 -1
- package/dist/http/runtimes/h3.mjs +2 -2
- package/dist/index.d.mts +14 -16
- package/dist/index.mjs +2 -2
- package/dist/{kv-stores-D_anc94e.d.mts → kv-stores-BICLX1Yy.d.mts} +4 -4
- package/dist/{kv-stores-D_anc94e.d.mts.map → kv-stores-BICLX1Yy.d.mts.map} +1 -1
- package/dist/{kv-stores-Cy9GuUcp.mjs → kv-stores-BQ5jox2K.mjs} +3 -3
- package/dist/{kv-stores-Cy9GuUcp.mjs.map → kv-stores-BQ5jox2K.mjs.map} +1 -1
- package/dist/{metadata-C-9GVv_0.mjs → metadata-CugcKCXW.mjs} +2 -2
- package/dist/{metadata-C-9GVv_0.mjs.map → metadata-CugcKCXW.mjs.map} +1 -1
- package/dist/{module-registry-Wk9JPlyW.mjs → module-registry-D6lAL81K.mjs} +2 -2
- package/dist/{module-registry-Wk9JPlyW.mjs.map → module-registry-D6lAL81K.mjs.map} +1 -1
- package/dist/{query-CN3EnbSs.mjs → query-Dc58mMd1.mjs} +2 -2
- package/dist/{query-CN3EnbSs.mjs.map → query-Dc58mMd1.mjs.map} +1 -1
- package/dist/{rate-limit-BJc724GS.d.mts → rate-limit-D5FHbYKG.d.mts} +2 -2
- package/dist/{rate-limit-BJc724GS.d.mts.map → rate-limit-D5FHbYKG.d.mts.map} +1 -1
- package/dist/{respond-Dh4eK1qn.mjs → respond-DM0pbGtn.mjs} +2 -2
- package/dist/{respond-Dh4eK1qn.mjs.map → respond-DM0pbGtn.mjs.map} +1 -1
- package/dist/route-flag-BKYcu3L0.mjs +12 -0
- package/dist/route-flag-BKYcu3L0.mjs.map +1 -0
- package/dist/{route-flag-C6VJQ2el.d.mts → route-flag-BMlwj3Nk.d.mts} +22 -6
- package/dist/route-flag-BMlwj3Nk.d.mts.map +1 -0
- package/dist/{route-policy-dA3BgX2k.mjs → route-policy-YrOBnVpp.mjs} +2 -2
- package/dist/{route-policy-dA3BgX2k.mjs.map → route-policy-YrOBnVpp.mjs.map} +1 -1
- package/dist/router-builder-B5Vbzba3.mjs +12 -0
- package/dist/router-builder-B5Vbzba3.mjs.map +1 -0
- package/dist/{router-builder-CxRFEM9j.d.mts → router-builder-CGOQIi4T.d.mts} +9 -2
- package/dist/router-builder-CGOQIi4T.d.mts.map +1 -0
- package/dist/{runtime-DhoVD9YL.mjs → runtime-DhY6i4TY.mjs} +3 -3
- package/dist/{runtime-DhoVD9YL.mjs.map → runtime-DhY6i4TY.mjs.map} +1 -1
- package/dist/{upload-ysRl6aKu.d.mts → upload-B63Ayql7.d.mts} +2 -2
- package/dist/{upload-ysRl6aKu.d.mts.map → upload-B63Ayql7.d.mts.map} +1 -1
- package/dist/{upload-config-DIXi-mCL.mjs → upload-config-BYINSxAp.mjs} +2 -2
- package/dist/{upload-config-DIXi-mCL.mjs.map → upload-config-BYINSxAp.mjs.map} +1 -1
- package/dist/web.d.mts +3 -3
- package/dist/web.mjs +2 -2
- package/dist/web.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/adapter-CvHtIu8A.d.mts.map +0 -1
- package/dist/application-8Pw_oQno.mjs +0 -12
- package/dist/application-8Pw_oQno.mjs.map +0 -1
- package/dist/application-DIxWiYOw.d.mts +0 -496
- package/dist/application-DIxWiYOw.d.mts.map +0 -1
- package/dist/bootstrap-DCUWJRmN.d.mts +0 -27
- package/dist/bootstrap-DCUWJRmN.d.mts.map +0 -1
- package/dist/route-flag-C6VJQ2el.d.mts.map +0 -1
- package/dist/route-flag-DTfTiScc.mjs +0 -12
- package/dist/route-flag-DTfTiScc.mjs.map +0 -1
- package/dist/router-builder-CxRFEM9j.d.mts.map +0 -1
- package/dist/router-builder-DP6CbI7S.mjs +0 -12
- package/dist/router-builder-DP6CbI7S.mjs.map +0 -1
- package/dist/spa-DXTOhkVK.d.mts.map +0 -1
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
import { s as InjectionToken, t as Container } from "./container-Dpvd66Yt.mjs";
|
|
3
3
|
import "./index-Btz1W0X5.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { C as MetaValue, c as ContextDecorator, h as DepValue, u as ContextDecoratorSpec, x as ContextMetaKey } from "./app-module
|
|
6
|
-
import { A as AdapterFactory, E as RequestContext, f as HttpRuntime, h as RouteEntry, nt as ModuleFactory } from "./adapter-
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
9
|
-
import "./cors-CsibNTQ6.mjs";
|
|
10
|
-
import "./csrf-HVVOHlf8.mjs";
|
|
11
|
-
import "./error-handler-DVAcTt8p.mjs";
|
|
12
|
-
import "./helmet-C2QEU6S-.mjs";
|
|
13
|
-
import "./rate-limit-BJc724GS.mjs";
|
|
4
|
+
import { p as RouteFlags, s as RouteFlagDeclarations } from "./route-flag-BMlwj3Nk.mjs";
|
|
5
|
+
import { C as MetaValue, c as ContextDecorator, h as DepValue, m as ContributorRegistrations, r as AppModuleEntry, u as ContextDecoratorSpec, x as ContextMetaKey } from "./app-module--bC2V1yw.mjs";
|
|
6
|
+
import { A as AdapterFactory, E as RequestContext, b as RuntimeCapabilities, f as HttpRuntime, h as RouteEntry, lt as KickPlugin, nt as ModuleFactory, r as AppAdapter, s as ActiveRuntime, ut as ModuleRegistry, x as RuntimeResponse } from "./adapter-Duqrig18.mjs";
|
|
7
|
+
import { l as Reply } from "./kv-stores-BICLX1Yy.mjs";
|
|
8
|
+
import { t as BuildRoutesOptions } from "./router-builder-CGOQIi4T.mjs";
|
|
14
9
|
import "./request-id-CVzJ1uHD.mjs";
|
|
15
|
-
import "./session-BHgRyfqZ.mjs";
|
|
16
|
-
import { l as Reply } from "./kv-stores-D_anc94e.mjs";
|
|
17
|
-
import { t as BuildRoutesOptions } from "./router-builder-CxRFEM9j.mjs";
|
|
18
10
|
import "./validate-DMYpUnrf.mjs";
|
|
19
|
-
import "./
|
|
20
|
-
import
|
|
11
|
+
import "./error-handler-BOT8vAPx.mjs";
|
|
12
|
+
import "./csrf-DDwUOF45.mjs";
|
|
13
|
+
import "./helmet-C2QEU6S-.mjs";
|
|
14
|
+
import "./cors-CsibNTQ6.mjs";
|
|
15
|
+
import "./rate-limit-D5FHbYKG.mjs";
|
|
16
|
+
import "./session-BHgRyfqZ.mjs";
|
|
17
|
+
import "./upload-B63Ayql7.mjs";
|
|
18
|
+
import http from "node:http";
|
|
19
|
+
import { Express, NextFunction, Request, RequestHandler, Response, Router } from "express";
|
|
21
20
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
22
21
|
//#region src/core/disposables.d.ts
|
|
23
22
|
/**
|
|
@@ -414,62 +413,28 @@ declare function bindRoutePolicy<T extends object>(handler: T, receive: (table:
|
|
|
414
413
|
/** Hand the table to a middleware if it declared the slot. */
|
|
415
414
|
declare function offerRoutePolicy(handler: unknown, table: RoutePolicyTable): void;
|
|
416
415
|
//#endregion
|
|
417
|
-
//#region src/http/
|
|
418
|
-
/** One adapter's answer to `onHealthCheck()`. */
|
|
419
|
-
interface HealthCheckResult {
|
|
420
|
-
name: string;
|
|
421
|
-
status: 'up' | 'down';
|
|
422
|
-
}
|
|
416
|
+
//#region src/http/bootstrap.d.ts
|
|
423
417
|
/**
|
|
424
|
-
*
|
|
418
|
+
* Bootstrap a KickJS application.
|
|
425
419
|
*
|
|
426
|
-
*
|
|
427
|
-
* the
|
|
428
|
-
*
|
|
429
|
-
|
|
430
|
-
interface HealthProbe {
|
|
431
|
-
/** True once shutdown has begun and traffic should drain away. */
|
|
432
|
-
isDraining(): boolean;
|
|
433
|
-
/** Aggregated `onHealthCheck()` results from every adapter that has one. */
|
|
434
|
-
checks(): Promise<HealthCheckResult[]>;
|
|
435
|
-
}
|
|
436
|
-
declare const HEALTH_PROBE: InjectionToken<HealthProbe>;
|
|
437
|
-
declare class HealthController {
|
|
438
|
-
private readonly probe;
|
|
439
|
-
constructor(probe: HealthProbe);
|
|
440
|
-
/** Liveness: is the process up and not shutting down. */
|
|
441
|
-
live(): Reply<200, {
|
|
442
|
-
status: string;
|
|
443
|
-
uptime: number;
|
|
444
|
-
}> | Reply<503, {
|
|
445
|
-
status: string;
|
|
446
|
-
uptime: number;
|
|
447
|
-
}>;
|
|
448
|
-
/** Readiness: is every adapter's dependency answering. */
|
|
449
|
-
ready(): Promise<Reply<200 | 503, {
|
|
450
|
-
status: string;
|
|
451
|
-
checks: HealthCheckResult[];
|
|
452
|
-
}>>;
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* `GET /health/live` and `GET /health/ready`, mounted at the root.
|
|
420
|
+
* Creates the Express app, registers modules and adapters, and starts
|
|
421
|
+
* the HTTP server. In dev mode (`kick dev`), the Vite plugin manages
|
|
422
|
+
* the server and HMR — source changes are picked up instantly without
|
|
423
|
+
* losing database connections or WebSocket state.
|
|
456
424
|
*
|
|
457
|
-
*
|
|
458
|
-
* should be declared the way it asks adopters to declare theirs, not through a
|
|
459
|
-
* shape only the framework can produce.
|
|
425
|
+
* @returns The {@link Application} instance.
|
|
460
426
|
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}>;
|
|
427
|
+
* @example
|
|
428
|
+
* ```ts
|
|
429
|
+
* // src/index.ts
|
|
430
|
+
* import 'reflect-metadata'
|
|
431
|
+
* import { bootstrap } from '@forinda/kickjs'
|
|
432
|
+
* import { modules } from './modules'
|
|
433
|
+
*
|
|
434
|
+
* export const app = await bootstrap({ modules })
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
declare function bootstrap(options: ApplicationOptions): Promise<Application>;
|
|
473
438
|
//#endregion
|
|
474
439
|
//#region src/http/cluster.d.ts
|
|
475
440
|
interface ClusterOptions {
|
|
@@ -864,5 +829,569 @@ declare function resolveClientDir(clientDir: string, cwd?: string, entry?: strin
|
|
|
864
829
|
*/
|
|
865
830
|
declare const SpaAdapter: AdapterFactory<SpaAdapterOptions, unknown>;
|
|
866
831
|
//#endregion
|
|
867
|
-
|
|
868
|
-
|
|
832
|
+
//#region src/http/health-module.d.ts
|
|
833
|
+
/** One adapter's answer to `onHealthCheck()`. */
|
|
834
|
+
interface HealthCheckResult {
|
|
835
|
+
name: string;
|
|
836
|
+
status: 'up' | 'down';
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* What the health routes need from the running Application.
|
|
840
|
+
*
|
|
841
|
+
* A controller cannot reach `Application` internals, and should not: this is
|
|
842
|
+
* the whole surface the endpoints depend on, so a replacement module can
|
|
843
|
+
* satisfy it without knowing anything else.
|
|
844
|
+
*/
|
|
845
|
+
interface HealthProbe {
|
|
846
|
+
/** True once shutdown has begun and traffic should drain away. */
|
|
847
|
+
isDraining(): boolean;
|
|
848
|
+
/** Aggregated `onHealthCheck()` results from every adapter that has one. */
|
|
849
|
+
checks(): Promise<HealthCheckResult[]>;
|
|
850
|
+
}
|
|
851
|
+
declare const HEALTH_PROBE: InjectionToken<HealthProbe>;
|
|
852
|
+
/** Config for {@link healthModule}. */
|
|
853
|
+
interface HealthModuleConfig {
|
|
854
|
+
/**
|
|
855
|
+
* Route flags to put on `GET /health/live` and `GET /health/ready`.
|
|
856
|
+
*
|
|
857
|
+
* The framework names no flags, so it cannot decide these probes are
|
|
858
|
+
* "public" on your behalf — the name is yours, and every consumer that
|
|
859
|
+
* already reads it (an auth contributor's `skipWhen`, a guard's
|
|
860
|
+
* `exemptWhen`, `SwaggerAdapter({ publicFlag })`) then covers health with no
|
|
861
|
+
* further wiring:
|
|
862
|
+
*
|
|
863
|
+
* ```ts
|
|
864
|
+
* bootstrap({ health: { flags: ['auth.public'] } })
|
|
865
|
+
* ```
|
|
866
|
+
*
|
|
867
|
+
* This replaces exempting `/health/live` and `/health/ready` by pathname,
|
|
868
|
+
* which silently stops matching if the probe paths ever move.
|
|
869
|
+
*/
|
|
870
|
+
flags?: RouteFlagDeclarations;
|
|
871
|
+
}
|
|
872
|
+
declare class HealthController {
|
|
873
|
+
private readonly probe;
|
|
874
|
+
constructor(probe: HealthProbe);
|
|
875
|
+
/** Liveness: is the process up and not shutting down. */
|
|
876
|
+
live(): Reply<200, {
|
|
877
|
+
status: string;
|
|
878
|
+
uptime: number;
|
|
879
|
+
}> | Reply<503, {
|
|
880
|
+
status: string;
|
|
881
|
+
uptime: number;
|
|
882
|
+
}>;
|
|
883
|
+
/** Readiness: is every adapter's dependency answering. */
|
|
884
|
+
ready(): Promise<Reply<200 | 503, {
|
|
885
|
+
status: string;
|
|
886
|
+
checks: HealthCheckResult[];
|
|
887
|
+
}>>;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* `GET /health/live` and `GET /health/ready`, mounted at the root.
|
|
891
|
+
*
|
|
892
|
+
* A `defineModule` factory like any other module — the framework's own routes
|
|
893
|
+
* should be declared the way it asks adopters to declare theirs, not through a
|
|
894
|
+
* shape only the framework can produce.
|
|
895
|
+
*
|
|
896
|
+
* Registered automatically unless the app passes `health: false` or supplies a
|
|
897
|
+
* module of its own. Pass `health: { flags: [...] }` to `bootstrap()` to flag
|
|
898
|
+
* both probes — see {@link HealthModuleConfig}.
|
|
899
|
+
*/
|
|
900
|
+
declare const healthModule: ModuleFactory<HealthModuleConfig, unknown>;
|
|
901
|
+
//#endregion
|
|
902
|
+
//#region src/http/application.d.ts
|
|
903
|
+
/**
|
|
904
|
+
* A middleware entry in the declarative pipeline.
|
|
905
|
+
* Can be a bare handler or an object with path scoping.
|
|
906
|
+
*/
|
|
907
|
+
type MiddlewareEntry = RequestHandler | {
|
|
908
|
+
path: string;
|
|
909
|
+
handler: RequestHandler;
|
|
910
|
+
};
|
|
911
|
+
/** Options for {@link Application.shutdown}. */
|
|
912
|
+
interface ShutdownOptions {
|
|
913
|
+
/**
|
|
914
|
+
* Close the HTTP server and drain in-flight requests. Default `true`.
|
|
915
|
+
*
|
|
916
|
+
* Set `false` for a dev HMR rebuild, where the server is shared across
|
|
917
|
+
* reloads — adapters, plugins, and disposables are still torn down, which is
|
|
918
|
+
* the part a reload needs.
|
|
919
|
+
*/
|
|
920
|
+
closeServer?: boolean;
|
|
921
|
+
}
|
|
922
|
+
interface ApplicationOptions {
|
|
923
|
+
/**
|
|
924
|
+
* Feature modules to load. Accepts both class form
|
|
925
|
+
* (`SomeModule extends AppModule`, instantiated via `new`) and
|
|
926
|
+
* instance form (output of {@link defineModule}'s factory call,
|
|
927
|
+
* e.g. `TasksModule({ scope: 'admin' })`) — the loader discriminates
|
|
928
|
+
* and either `new`-s the class or uses the instance directly.
|
|
929
|
+
*
|
|
930
|
+
* Static path — for conditional / dynamic registration, use the
|
|
931
|
+
* {@link ApplicationOptions.setup} callback instead.
|
|
932
|
+
*/
|
|
933
|
+
modules: AppModuleEntry[];
|
|
934
|
+
/**
|
|
935
|
+
* Imperative module registration callback. Receives a
|
|
936
|
+
* {@link ModuleRegistry} you call `.mount(module)` on to register
|
|
937
|
+
* modules conditionally — based on env flags, runtime config, a
|
|
938
|
+
* tenant list, etc. Runs after every plugin's `setup()` hook and
|
|
939
|
+
* after the static `modules: [...]` array is collected.
|
|
940
|
+
*
|
|
941
|
+
* @example
|
|
942
|
+
* ```ts
|
|
943
|
+
* bootstrap({
|
|
944
|
+
* modules: [HelloModule()],
|
|
945
|
+
* setup(registry) {
|
|
946
|
+
* if (env.ENABLE_ADMIN) registry.mount(AdminModule())
|
|
947
|
+
* },
|
|
948
|
+
* })
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
setup?(registry: ModuleRegistry): void;
|
|
952
|
+
/** Adapters that hook into the lifecycle (DB, Redis, Swagger, etc.) */
|
|
953
|
+
adapters?: AppAdapter[];
|
|
954
|
+
/** Server port (falls back to PORT env var, then 3000) */
|
|
955
|
+
port?: number;
|
|
956
|
+
/** Global API prefix (default: '/api'). Pass `''` to mount at the root. */
|
|
957
|
+
apiPrefix?: string;
|
|
958
|
+
/**
|
|
959
|
+
* Default API version (default: 1) — routes become /{prefix}/v{version}/{path}.
|
|
960
|
+
*
|
|
961
|
+
* `false` opts out of URL versioning: routes mount at /{prefix}/{path}.
|
|
962
|
+
* A module can still version itself by setting `version` on its
|
|
963
|
+
* `ModuleRoutes` — the per-mount value always wins over this default, in
|
|
964
|
+
* either direction.
|
|
965
|
+
*/
|
|
966
|
+
defaultVersion?: number | false;
|
|
967
|
+
/**
|
|
968
|
+
* Global middleware pipeline. Declared in order.
|
|
969
|
+
* Replaces the hardcoded middleware stack — you control exactly what runs.
|
|
970
|
+
*
|
|
971
|
+
* @example
|
|
972
|
+
* ```ts
|
|
973
|
+
* bootstrap({
|
|
974
|
+
* modules,
|
|
975
|
+
* middlewares: [
|
|
976
|
+
* helmet(),
|
|
977
|
+
* cors(),
|
|
978
|
+
* compression(),
|
|
979
|
+
* morgan('dev'),
|
|
980
|
+
* express.json({ limit: '1mb' }),
|
|
981
|
+
* ],
|
|
982
|
+
* })
|
|
983
|
+
* ```
|
|
984
|
+
*
|
|
985
|
+
* If omitted, a sensible default is applied:
|
|
986
|
+
* requestId(), express.json({ limit: '100kb' })
|
|
987
|
+
*/
|
|
988
|
+
middlewares?: MiddlewareEntry[];
|
|
989
|
+
/** Plugins that bundle modules, adapters, middleware, and DI bindings */
|
|
990
|
+
plugins?: KickPlugin[];
|
|
991
|
+
/**
|
|
992
|
+
* Global Context Contributors (#107) that apply to every route in the
|
|
993
|
+
* application. Merge into the per-route pipeline at the `'global'`
|
|
994
|
+
* precedence level — they lose to module, adapter, class, and method
|
|
995
|
+
* contributors with the same key, providing app-wide defaults that any
|
|
996
|
+
* narrower scope can override.
|
|
997
|
+
*
|
|
998
|
+
* @example
|
|
999
|
+
* ```ts
|
|
1000
|
+
* const StartedAt = defineContextDecorator({
|
|
1001
|
+
* key: 'requestStartedAt',
|
|
1002
|
+
* resolve: () => Date.now(),
|
|
1003
|
+
* })
|
|
1004
|
+
*
|
|
1005
|
+
* bootstrap({
|
|
1006
|
+
* modules,
|
|
1007
|
+
* contributors: [StartedAt.registration],
|
|
1008
|
+
* })
|
|
1009
|
+
* ```
|
|
1010
|
+
*/
|
|
1011
|
+
contributors?: ContributorRegistrations;
|
|
1012
|
+
/**
|
|
1013
|
+
* Backing store strategy for {@link RequestContext} `set/get` and the
|
|
1014
|
+
* Context Contributor pipeline (#107).
|
|
1015
|
+
*
|
|
1016
|
+
* - `'auto'` (default) — Application mounts {@link requestScopeMiddleware}
|
|
1017
|
+
* automatically before any user middleware. If the user-supplied
|
|
1018
|
+
* `middleware` list already includes `requestScopeMiddleware()`,
|
|
1019
|
+
* detection skips the auto-mount so adopters can control its position.
|
|
1020
|
+
* - `'manual'` — Application never mounts the wrapper. The Context
|
|
1021
|
+
* Contributor pipeline still runs on every route — the runner is
|
|
1022
|
+
* inserted by `router-builder` regardless of ALS state. What
|
|
1023
|
+
* degrades without an ALS frame is the *backing store*:
|
|
1024
|
+
* REQUEST-scoped DI throws (no `requestStore.getStore()` to read
|
|
1025
|
+
* from) and `RequestContext.set/get` throws. Use `'manual'` only when you
|
|
1026
|
+
* genuinely intend to wrap requests in your own ALS frame (rare —
|
|
1027
|
+
* multi-tenant adapters used to do this; post-Phase 3 they share
|
|
1028
|
+
* the framework's frame instead).
|
|
1029
|
+
*/
|
|
1030
|
+
contextStore?: 'auto' | 'manual';
|
|
1031
|
+
/**
|
|
1032
|
+
* Controls whether KickJS registers process-level handlers at bootstrap.
|
|
1033
|
+
*
|
|
1034
|
+
* - `'auto'` (default) — register `uncaughtException` /
|
|
1035
|
+
* `unhandledRejection` loggers AND `SIGINT` / `SIGTERM` →
|
|
1036
|
+
* `app.shutdown()` → `process.exit(0)`.
|
|
1037
|
+
* - `'errors-only'` — register the error loggers; skip the signal
|
|
1038
|
+
* handlers. Use this when you have your own shutdown choreographer
|
|
1039
|
+
* (OpenTelemetry SDK, Sentry, custom orchestrator) that calls
|
|
1040
|
+
* `app.shutdown()` itself and you don't want two listeners racing
|
|
1041
|
+
* to call `process.exit`.
|
|
1042
|
+
* - `'manual'` — skip everything. Adopter is responsible for both
|
|
1043
|
+
* error logging and signal-driven shutdown.
|
|
1044
|
+
*
|
|
1045
|
+
* Background: many observability SDKs install their own SIGTERM
|
|
1046
|
+
* handler to flush spans/metrics before the process exits. Two
|
|
1047
|
+
* separate handlers calling `process.exit(0)` race each other and
|
|
1048
|
+
* can truncate the in-flight flush. Setting this to `'errors-only'`
|
|
1049
|
+
* or `'manual'` lets the SDK own the lifecycle while still letting
|
|
1050
|
+
* KickJS surface uncaught exceptions / rejections via the logger.
|
|
1051
|
+
*
|
|
1052
|
+
* The dev mode auto-detect (`__kickjs_httpServer` set by the Vite
|
|
1053
|
+
* plugin) suppresses signal registration regardless of this option,
|
|
1054
|
+
* since Vite owns the lifecycle in development.
|
|
1055
|
+
*/
|
|
1056
|
+
processHooks?: 'auto' | 'errors-only' | 'manual';
|
|
1057
|
+
/**
|
|
1058
|
+
* The HTTP engine driver. Defaults to {@link expressRuntime} — Express stays
|
|
1059
|
+
* the zero-config default, so existing apps are unaffected.
|
|
1060
|
+
*
|
|
1061
|
+
* Any `HttpRuntime` is accepted — pass `fastifyRuntime()` (from
|
|
1062
|
+
* `@forinda/kickjs/fastify`) or a custom engine driver. Defaults to
|
|
1063
|
+
* {@link expressRuntime}. The engine-native escape hatches
|
|
1064
|
+
* (`getRuntimeApp()`, `AdapterContext.app`) follow the active runtime via the
|
|
1065
|
+
* registry (`ActiveRuntime`, spec §4.3b) — Express by default, or the augmented
|
|
1066
|
+
* engine once the `kick/runtime` typegen output is present.
|
|
1067
|
+
*/
|
|
1068
|
+
/**
|
|
1069
|
+
* Mount the built-in `GET /health/live` and `GET /health/ready`.
|
|
1070
|
+
*
|
|
1071
|
+
* On by default. Set `false` to take them over completely — supply your own
|
|
1072
|
+
* module at `/health` and nothing collides. The built-in is registered last,
|
|
1073
|
+
* so an app module claiming the same path already wins without this.
|
|
1074
|
+
*
|
|
1075
|
+
* They mount as an ordinary module, which means they sit inside the
|
|
1076
|
+
* middleware chain: whatever guards the rest of the app guards these too.
|
|
1077
|
+
* Pass `{ flags: [...] }` to put your own route flags on both probes — the
|
|
1078
|
+
* way to make them reachable unauthenticated without exempting a pathname
|
|
1079
|
+
* that can move:
|
|
1080
|
+
*
|
|
1081
|
+
* ```ts
|
|
1082
|
+
* bootstrap({ health: { flags: ['auth.public'] } })
|
|
1083
|
+
* ```
|
|
1084
|
+
*/
|
|
1085
|
+
health?: boolean | HealthModuleConfig;
|
|
1086
|
+
runtime?: HttpRuntime;
|
|
1087
|
+
/** Express `trust proxy` setting */
|
|
1088
|
+
trustProxy?: boolean | number | string | ((ip: string, hopIndex: number) => boolean);
|
|
1089
|
+
/** Maximum JSON body size (only used when middleware is not provided) */
|
|
1090
|
+
jsonLimit?: string | number;
|
|
1091
|
+
/**
|
|
1092
|
+
* Print the route table on startup. Default: `false`. Set to `true`
|
|
1093
|
+
* to log a per-controller summary (method counts + mount paths) once
|
|
1094
|
+
* the app has mounted. Emitted at `info` level, so it is still subject
|
|
1095
|
+
* to `LOG_LEVEL` filtering (visible at the default `info`; hidden at
|
|
1096
|
+
* `warn`/`error`/`silent`).
|
|
1097
|
+
*/
|
|
1098
|
+
logRouteTable?: boolean;
|
|
1099
|
+
/**
|
|
1100
|
+
* @deprecated Use {@link ApplicationOptions.logRouteTable}. Kept as an
|
|
1101
|
+
* alias for back-compat; `logRouteTable` wins when both are set.
|
|
1102
|
+
*/
|
|
1103
|
+
logRoutesTable?: boolean;
|
|
1104
|
+
/**
|
|
1105
|
+
* Maximum time (ms) to wait for graceful shutdown before forcing exit.
|
|
1106
|
+
* Default: 30000 (30 seconds). Set to 0 to disable forced exit.
|
|
1107
|
+
*/
|
|
1108
|
+
shutdownTimeout?: number;
|
|
1109
|
+
/**
|
|
1110
|
+
* Enable cluster mode for multi-core utilization.
|
|
1111
|
+
*
|
|
1112
|
+
* When enabled, the primary process forks worker processes that share the
|
|
1113
|
+
* same port via Node's built-in `cluster` module (OS load balancing).
|
|
1114
|
+
*
|
|
1115
|
+
* - `true` — use all available CPU cores
|
|
1116
|
+
* - `{ workers: N }` — use exactly N workers
|
|
1117
|
+
*
|
|
1118
|
+
* Workers are auto-restarted on crash. SIGTERM/SIGINT on the primary is
|
|
1119
|
+
* forwarded to all workers.
|
|
1120
|
+
*
|
|
1121
|
+
* @example
|
|
1122
|
+
* ```ts
|
|
1123
|
+
* bootstrap({ modules, cluster: true })
|
|
1124
|
+
* bootstrap({ modules, cluster: { workers: 4 } })
|
|
1125
|
+
* ```
|
|
1126
|
+
*/
|
|
1127
|
+
cluster?: boolean | {
|
|
1128
|
+
workers?: number;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* Custom 404 handler for unmatched routes. When omitted, the built-in
|
|
1132
|
+
* handler returns `{ message: 'Not Found' }` with status 404.
|
|
1133
|
+
*
|
|
1134
|
+
* Connect-**shaped**, not Express-**semantic** — see {@link onError} for the
|
|
1135
|
+
* per-runtime table. The same two caveats apply: `next()` is inert on
|
|
1136
|
+
* Fastify and h3, and Express-only request members (`req.originalUrl`,
|
|
1137
|
+
* `req.path`, `req.ip`) are `undefined` there, so read `req.url`.
|
|
1138
|
+
*
|
|
1139
|
+
* @example
|
|
1140
|
+
* ```ts
|
|
1141
|
+
* bootstrap({
|
|
1142
|
+
* modules,
|
|
1143
|
+
* onNotFound: (req, res) => {
|
|
1144
|
+
* // `req.originalUrl` is Express-only — use `req.url` for portability.
|
|
1145
|
+
* res.status(404).json({ error: 'Route not found', path: req.url })
|
|
1146
|
+
* },
|
|
1147
|
+
* })
|
|
1148
|
+
* ```
|
|
1149
|
+
*/
|
|
1150
|
+
onNotFound?: (req: any, res: RuntimeResponse, next: (err?: unknown) => void) => void;
|
|
1151
|
+
/**
|
|
1152
|
+
* Custom global error handler, receiving `(err, req, res, next)`. When
|
|
1153
|
+
* omitted, the built-in handler formats ZodError, HttpException, and
|
|
1154
|
+
* unexpected errors.
|
|
1155
|
+
*
|
|
1156
|
+
* The shape is connect-style, but it is NOT "the standard Express error
|
|
1157
|
+
* handler" on every engine — what you actually receive differs, and the
|
|
1158
|
+
* differences bite:
|
|
1159
|
+
*
|
|
1160
|
+
* | | `req` | `res` | `next` |
|
|
1161
|
+
* | --- | --- | --- | --- |
|
|
1162
|
+
* | Express | native `Request` | native `Response` | real `next` |
|
|
1163
|
+
* | Fastify | `request.raw` | reply driver | **no-op** |
|
|
1164
|
+
* | h3 | `event.node.req` | response driver | no-op (or dev fall-through) |
|
|
1165
|
+
*
|
|
1166
|
+
* Two consequences worth knowing before you write one:
|
|
1167
|
+
*
|
|
1168
|
+
* - **`next(err)` does nothing on Fastify and h3.** It is a no-op function
|
|
1169
|
+
* there, so delegating to the default handler silently drops the error.
|
|
1170
|
+
* Send a response yourself rather than passing it on.
|
|
1171
|
+
* - **Express-only request members are `undefined` elsewhere.**
|
|
1172
|
+
* `req.originalUrl`, `req.path`, and `req.ip` do not exist on the raw node
|
|
1173
|
+
* request — use `req.url` and the `x-forwarded-*` headers, or reach for
|
|
1174
|
+
* `ctx.ip` in a contributor / guard where a `RequestContext` is available.
|
|
1175
|
+
*
|
|
1176
|
+
* `res` is typed {@link RuntimeResponse} because that is what every engine
|
|
1177
|
+
* genuinely provides: `status`, `json`, `send`, `setHeader`, `render`,
|
|
1178
|
+
* `writeHead`, `end`. Express's own `Response` satisfies it.
|
|
1179
|
+
*
|
|
1180
|
+
* @example
|
|
1181
|
+
* ```ts
|
|
1182
|
+
* bootstrap({
|
|
1183
|
+
* modules,
|
|
1184
|
+
* onError: (err, req, res) => {
|
|
1185
|
+
* logger.error(err, `${req.method} ${req.url}`) // not `originalUrl`
|
|
1186
|
+
* res.status(err.status ?? 500).json({ error: err.message })
|
|
1187
|
+
* },
|
|
1188
|
+
* })
|
|
1189
|
+
* ```
|
|
1190
|
+
*/
|
|
1191
|
+
onError?: (err: any, req: any, res: RuntimeResponse, next: (err?: unknown) => void) => void;
|
|
1192
|
+
/**
|
|
1193
|
+
* Security defaults applied automatically unless opted out.
|
|
1194
|
+
*
|
|
1195
|
+
* When not specified, secure defaults are applied:
|
|
1196
|
+
* - Helmet security headers are auto-injected
|
|
1197
|
+
* - JSON body limit defaults to 1MB
|
|
1198
|
+
*
|
|
1199
|
+
* @example
|
|
1200
|
+
* ```ts
|
|
1201
|
+
* bootstrap({
|
|
1202
|
+
* modules,
|
|
1203
|
+
* security: {
|
|
1204
|
+
* helmet: false, // disable auto-helmet
|
|
1205
|
+
* },
|
|
1206
|
+
* })
|
|
1207
|
+
* ```
|
|
1208
|
+
*/
|
|
1209
|
+
security?: {
|
|
1210
|
+
/** Auto-inject helmet security headers. Default: true */
|
|
1211
|
+
helmet?: boolean;
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
declare class Application {
|
|
1215
|
+
private readonly options;
|
|
1216
|
+
private app;
|
|
1217
|
+
/** The HTTP engine driver. Defaults to {@link expressRuntime}. */
|
|
1218
|
+
private readonly runtime;
|
|
1219
|
+
private container;
|
|
1220
|
+
private httpServer;
|
|
1221
|
+
private readonly adapters;
|
|
1222
|
+
/**
|
|
1223
|
+
* Flags of every mounted route, for middleware that runs before routing and
|
|
1224
|
+
* therefore cannot read `ctx.route` (the connect-style rate limiter). Handed
|
|
1225
|
+
* to middleware that declares the slot — see `core/route-policy.ts`.
|
|
1226
|
+
*/
|
|
1227
|
+
private readonly routePolicy;
|
|
1228
|
+
private readonly plugins;
|
|
1229
|
+
/**
|
|
1230
|
+
* Snapshot of every module-level Context Contributor registration
|
|
1231
|
+
* captured during `setup()`. The registrations themselves are
|
|
1232
|
+
* frozen by `defineContextDecorator`, so storing references is
|
|
1233
|
+
* safe — they outlive the module instances they came from.
|
|
1234
|
+
*
|
|
1235
|
+
* Used by {@link getContributors} so DevTools and adopter tooling
|
|
1236
|
+
* can render the module-level contributors alongside the adapter /
|
|
1237
|
+
* plugin / global ones. Populated once per `setup()` call; cleared
|
|
1238
|
+
* at the start of each invocation so a re-setup (test harnesses,
|
|
1239
|
+
* dev-server restarts) doesn't accumulate stale entries.
|
|
1240
|
+
*/
|
|
1241
|
+
private _moduleContributors;
|
|
1242
|
+
/** Number of HTTP requests currently being processed */
|
|
1243
|
+
private _inFlightRequests;
|
|
1244
|
+
/** Whether the application is draining (shutting down gracefully) */
|
|
1245
|
+
private _draining;
|
|
1246
|
+
/** Whether shutdown has already been initiated (prevents double-shutdown) */
|
|
1247
|
+
private _shutdownInitiated;
|
|
1248
|
+
/** Resolvers waiting for in-flight requests to reach zero */
|
|
1249
|
+
private _drainResolvers;
|
|
1250
|
+
constructor(options: ApplicationOptions);
|
|
1251
|
+
/** Whether the application is currently draining in-flight requests */
|
|
1252
|
+
get isDraining(): boolean;
|
|
1253
|
+
/** Number of HTTP requests currently being processed */
|
|
1254
|
+
get inFlightRequests(): number;
|
|
1255
|
+
/** Get the DI container instance */
|
|
1256
|
+
getContainer(): Container;
|
|
1257
|
+
/**
|
|
1258
|
+
* Express request handler — delegates to the internal Express app.
|
|
1259
|
+
*
|
|
1260
|
+
* Used by the Vite dev-server plugin to route requests through KickJS:
|
|
1261
|
+
* ```ts
|
|
1262
|
+
* const mod = await ssrLoadModule('virtual:kickjs/app')
|
|
1263
|
+
* mod.app.handle(req, res, next)
|
|
1264
|
+
* ```
|
|
1265
|
+
*
|
|
1266
|
+
* Also works as a standard Node.js request handler for production:
|
|
1267
|
+
* ```ts
|
|
1268
|
+
* http.createServer(app.handle.bind(app))
|
|
1269
|
+
* ```
|
|
1270
|
+
*/
|
|
1271
|
+
handle(req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void): void;
|
|
1272
|
+
/**
|
|
1273
|
+
* Full setup pipeline:
|
|
1274
|
+
* 1. Adapter beforeMount hooks (early routes — e.g. docs UI)
|
|
1275
|
+
* 2. Adapter middleware (phase: beforeGlobal)
|
|
1276
|
+
* 3. Global middleware (user-declared or defaults)
|
|
1277
|
+
* 4. Adapter middleware (phase: afterGlobal)
|
|
1278
|
+
* 5. Module registration + DI bootstrap (the built-in health module mounts
|
|
1279
|
+
* here with everything else — it is NOT an early route)
|
|
1280
|
+
* 6. Adapter middleware (phase: beforeRoutes)
|
|
1281
|
+
* 7. Module route mounting
|
|
1282
|
+
* 8. Adapter middleware (phase: afterRoutes)
|
|
1283
|
+
* 9. Adapter beforeStart hooks
|
|
1284
|
+
* 10. Error handlers (notFound + global)
|
|
1285
|
+
*/
|
|
1286
|
+
/** Build the adapter context object (shared across all hooks) */
|
|
1287
|
+
private adapterCtx;
|
|
1288
|
+
/**
|
|
1289
|
+
* The engine-agnostic HTTP surface handed to adapters as `ctx.http`. Each
|
|
1290
|
+
* call routes through the active runtime over the current `this.app`, so an
|
|
1291
|
+
* adapter written against this works under any runtime.
|
|
1292
|
+
*/
|
|
1293
|
+
private adapterHttp;
|
|
1294
|
+
/** Call an adapter hook, awaiting async hooks and catching errors */
|
|
1295
|
+
private callHook;
|
|
1296
|
+
setup(): Promise<void>;
|
|
1297
|
+
/** Register modules and DI without starting the HTTP server (used by kick tinker) */
|
|
1298
|
+
registerOnly(): Promise<void>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Start the HTTP server.
|
|
1301
|
+
*
|
|
1302
|
+
* In **dev mode** (Vite plugin active): reuses `globalThis.__kickjs_httpServer`
|
|
1303
|
+
* created by Vite. Adapters (WsAdapter, Socket.IO, etc.) receive the real
|
|
1304
|
+
* `http.Server` through `afterStart({ server })` — zero adapter changes needed.
|
|
1305
|
+
*
|
|
1306
|
+
* In **production**: creates its own `http.Server` and binds to the port.
|
|
1307
|
+
*/
|
|
1308
|
+
start(): Promise<void>;
|
|
1309
|
+
/** HMR rebuild: swap Express handler without restarting the server */
|
|
1310
|
+
rebuild(): Promise<void>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Graceful shutdown with request draining.
|
|
1313
|
+
*
|
|
1314
|
+
* 1. Stops accepting new connections (server.close())
|
|
1315
|
+
* 2. Waits for in-flight requests to complete (up to shutdownTimeout)
|
|
1316
|
+
* 3. Calls adapter.shutdown() for all registered adapters
|
|
1317
|
+
* 4. Force-closes after timeout
|
|
1318
|
+
*
|
|
1319
|
+
* Safe to call multiple times — subsequent calls return the same promise.
|
|
1320
|
+
*/
|
|
1321
|
+
shutdown(options?: ShutdownOptions): Promise<void>;
|
|
1322
|
+
/**
|
|
1323
|
+
* The engine-native app instance, typed from the active runtime
|
|
1324
|
+
* ({@link ActiveRuntime} — Express by default). Prefer this over
|
|
1325
|
+
* {@link getExpressApp}; under a non-Express runtime the type follows the
|
|
1326
|
+
* augmented registry.
|
|
1327
|
+
*/
|
|
1328
|
+
getRuntimeApp(): ActiveRuntime['app'];
|
|
1329
|
+
/**
|
|
1330
|
+
* The active HTTP runtime's identity + capabilities — `name` is `'express'`
|
|
1331
|
+
* (default), `'fastify'`, or `'h3'`; `capabilities` reports what the engine
|
|
1332
|
+
* supports (render / uploads / connectMiddleware / nativeBodyParsing).
|
|
1333
|
+
* Surfaced by DevTools and the VS Code extension so tooling can show which
|
|
1334
|
+
* engine the app is running on. Cheap, side-effect free.
|
|
1335
|
+
*/
|
|
1336
|
+
getActiveRuntime(): {
|
|
1337
|
+
name: string;
|
|
1338
|
+
capabilities: RuntimeCapabilities;
|
|
1339
|
+
};
|
|
1340
|
+
/** @deprecated Use {@link getRuntimeApp}. Returns the engine-native app. */
|
|
1341
|
+
getExpressApp(): Express;
|
|
1342
|
+
/** Get registered adapters — used by DevToolsAdapter for peer discovery */
|
|
1343
|
+
getAdapters(): AppAdapter[];
|
|
1344
|
+
/**
|
|
1345
|
+
* Get registered plugins — used by DevToolsAdapter for topology
|
|
1346
|
+
* introspection (architecture.md §23). Read-only; returns the
|
|
1347
|
+
* already-sorted plugin list (post-`dependsOn` topo-sort).
|
|
1348
|
+
*/
|
|
1349
|
+
getPlugins(): readonly KickPlugin[];
|
|
1350
|
+
/**
|
|
1351
|
+
* Snapshot of every Context Contributor reachable from this app —
|
|
1352
|
+
* walks **four** registration sites: adapters, plugins, modules,
|
|
1353
|
+
* and the bootstrap `contributors` option. The devtools Topology
|
|
1354
|
+
* tab consumes this for the Contributors panel; tests + adopters
|
|
1355
|
+
* can call it for diagnostics.
|
|
1356
|
+
*
|
|
1357
|
+
* Per-route (method/class-decorator) registrations are NOT included
|
|
1358
|
+
* here — they live on the route registry rather than on any of
|
|
1359
|
+
* the four collection sites this method walks. A future RPC will
|
|
1360
|
+
* surface them separately.
|
|
1361
|
+
*
|
|
1362
|
+
* Result shape stays minimal — `{ key, source, label, dependsOn }`
|
|
1363
|
+
* — so we don't leak `resolve` closures or other internal fields.
|
|
1364
|
+
* `source` matches the five-level precedence union from
|
|
1365
|
+
* `ContributorSource` (minus `'method'` / `'class'` which require
|
|
1366
|
+
* the per-route walk noted above).
|
|
1367
|
+
*/
|
|
1368
|
+
getContributors(): ReadonlyArray<{
|
|
1369
|
+
key: string;
|
|
1370
|
+
source: 'module' | 'adapter' | 'plugin' | 'global';
|
|
1371
|
+
label: string;
|
|
1372
|
+
dependsOn: readonly string[];
|
|
1373
|
+
}>;
|
|
1374
|
+
getHttpServer(): http.Server | null;
|
|
1375
|
+
/**
|
|
1376
|
+
* Decide whether {@link Application} should auto-mount the
|
|
1377
|
+
* {@link requestScopeMiddleware} ALS wrapper.
|
|
1378
|
+
*
|
|
1379
|
+
* Returns `false` when:
|
|
1380
|
+
* - `contextStore: 'manual'` was set (caller manages ALS frames), or
|
|
1381
|
+
* - the user-supplied `middleware` list already includes a
|
|
1382
|
+
* `requestScopeMiddleware()` (detected via the symbol marker stamped
|
|
1383
|
+
* in `middleware/request-scope.ts`).
|
|
1384
|
+
*
|
|
1385
|
+
* Otherwise `true` — preserves the historical default of "always wrap
|
|
1386
|
+
* requests in an ALS frame" so existing apps see no behavior change.
|
|
1387
|
+
*/
|
|
1388
|
+
private shouldAutoMountRequestScope;
|
|
1389
|
+
private collectAdapterMiddleware;
|
|
1390
|
+
private mountMiddlewareList;
|
|
1391
|
+
private mountMiddlewareEntry;
|
|
1392
|
+
/** Middleware that tracks in-flight requests for graceful draining */
|
|
1393
|
+
private requestTrackingMiddleware;
|
|
1394
|
+
}
|
|
1395
|
+
//#endregion
|
|
1396
|
+
export { CircuitBreakerOptions as $, ClusterOptions as A, groupAssetKeys as B, getRequestStore as C, expressRuntime as D, buildRoutes as E, offerRoutePolicy as F, MountKind as G, DuplicateMountNameError as H, AssetKeyPair as I, ContributorCycleError as J, MountSortItem as K, AssetKeyStrategy as L, bootstrap as M, RoutePolicyTable as N, materializeRouter as O, bindRoutePolicy as P, CircuitBreaker as Q, GroupAssetKeysOptions as R, RequestStore as S, requestStore as T, MissingMountDepError as U, stripExt as V, MountCycleError as W, MissingContextValueError as X, DuplicateContributorError as Y, MissingContributorError as Z, TraceContext as _, HEALTH_PROBE as a, KickErrorInit as at, traceContext as b, HealthModuleConfig as c, disposeAll as ct, SpaAdapter as d, CircuitBreakerState as et, SpaAdapterOptions as f, TRACEPARENT_HEADER as g, ViewAdapterOptions as h, ShutdownOptions as i, KickError as it, isClusterPrimary as j, defineHttpContextDecorator as k, HealthProbe as l, registerDisposable as lt, ViewAdapter as m, ApplicationOptions as n, CircuitOpenError as nt, HealthCheckResult as o, formatKickError as ot, resolveClientDir as p, mountSort as q, MiddlewareEntry as r, FormatKickErrorOptions as rt, HealthController as s, Disposable as st, Application as t, CircuitBreakerStats as tt, healthModule as u, TraceContextOptions as v, getRequestValue as w, requestScopeMiddleware as x, parseTraceparent as y, GroupAssetKeysResult as z };
|
|
1397
|
+
//# sourceMappingURL=application-BeVzWyTq.d.mts.map
|