@forinda/kickjs 6.5.0 → 6.5.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-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-Cl0JlmNY.mjs +12 -0
- package/dist/application-Cl0JlmNY.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-DzyWLYpU.mjs} +3 -3
- package/dist/{bootstrap-C1VGQQVF.mjs.map → bootstrap-DzyWLYpU.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-CwFPFwsN.mjs} +3 -3
- package/dist/{config-BeIZJBXA.mjs.map → config-CwFPFwsN.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-C7kmdVwh.mjs} +3 -3
- package/dist/{container-CBaL5lus.mjs.map → container-C7kmdVwh.mjs.map} +1 -1
- package/dist/{context-BS5o1IuU.mjs → context-DQaUwwQM.mjs} +3 -3
- package/dist/{context-BS5o1IuU.mjs.map → context-DQaUwwQM.mjs.map} +1 -1
- package/dist/{context-errors-CwD27Vbj.mjs → context-errors-97x9siRx.mjs} +2 -2
- package/dist/{context-errors-CwD27Vbj.mjs.map → context-errors-97x9siRx.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-CLmwVWlw.mjs +12 -0
- package/dist/core-CLmwVWlw.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-BsrsObK-.mjs} +2 -2
- package/dist/{csrf-DNh_7aOk.mjs.map → csrf-BsrsObK-.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-D46xX96x.mjs} +2 -2
- package/dist/{disposables-mnjJuaVx.mjs.map → disposables-D46xX96x.mjs.map} +1 -1
- package/dist/env-Biq_60jq.mjs +13 -0
- package/dist/{env-Dgtjncd5.mjs.map → env-Biq_60jq.mjs.map} +1 -1
- 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-Ci1NMv-9.mjs} +3 -3
- package/dist/{handler-UvmjQGYc.mjs.map → handler-Ci1NMv-9.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-O8HUSwpv.mjs → kv-stores-BLJdf3Fn.mjs} +2 -2
- package/dist/{kv-stores-O8HUSwpv.mjs.map → kv-stores-BLJdf3Fn.mjs.map} +1 -1
- 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/logger-DA43DvNY.d.mts.map +1 -1
- package/dist/{metadata-CUDfhy4e.mjs → metadata-DUBbuHqY.mjs} +2 -2
- package/dist/{metadata-CUDfhy4e.mjs.map → metadata-DUBbuHqY.mjs.map} +1 -1
- package/dist/{module-registry-Mv5FqVlq.mjs → module-registry-aIt66if2.mjs} +2 -2
- package/dist/{module-registry-Mv5FqVlq.mjs.map → module-registry-aIt66if2.mjs.map} +1 -1
- package/dist/path-BVA9MfN1.d.mts.map +1 -1
- package/dist/query-CXN52dzy.mjs +12 -0
- package/dist/{query-gMAVXzx2.mjs.map → query-CXN52dzy.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-C1ljl6xS.mjs} +3 -3
- package/dist/{reply-BMBvs-FB.mjs.map → reply-C1ljl6xS.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-BbgVXuy3.mjs +12 -0
- package/dist/router-builder-BbgVXuy3.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-Dd_QvlpC.mjs} +2 -2
- package/dist/{upload-config-CFfHvoHF.mjs.map → upload-config-Dd_QvlpC.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-Dj6XFaca.mjs +12 -0
- package/dist/views-Dj6XFaca.mjs.map +1 -0
- package/dist/views-DsfBT1fR.d.mts +659 -0
- package/dist/views-DsfBT1fR.d.mts.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/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,13 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as Constructor, o as MaybePromise } from "./interfaces-
|
|
3
|
-
import { s as InjectionToken, t as Container } from "./container-
|
|
4
|
-
import { g as FileUploadConfig, k as RouteDefinition, x as MiddlewareHandler } from "./decorators-
|
|
5
|
-
import { _ as ExecutionContext, a as AnyContributorRegistration, d as ContributorRegistrations, r as AppModuleEntry, t as AppModule, v as MetaValue } from "./app-module-
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
2
|
+
import { i as Constructor, o as MaybePromise } from "./interfaces-BTTBdkvG.mjs";
|
|
3
|
+
import { s as InjectionToken, t as Container } from "./container-BW_MlgLj.mjs";
|
|
4
|
+
import { g as FileUploadConfig, k as RouteDefinition, x as MiddlewareHandler } from "./decorators-Bks7cgBJ.mjs";
|
|
5
|
+
import { _ as ExecutionContext, a as AnyContributorRegistration, d as ContributorRegistrations, r as AppModuleEntry, t as AppModule, v as MetaValue } from "./app-module-DtoySG6l.mjs";
|
|
6
|
+
import "./cache-C0qL0NSD.mjs";
|
|
7
|
+
import { i as ProblemDetails } from "./errors-By6UueCm.mjs";
|
|
8
|
+
import { S as QueryFieldConfig, T as TypedParsedQuery, t as ParseQueryOptions } from "./index-BfT5KZ-M.mjs";
|
|
9
|
+
import "reflect-metadata";
|
|
8
10
|
import http, { IncomingMessage, ServerResponse } from "node:http";
|
|
9
11
|
import { ErrorRequestHandler, Express as Express$1, NextFunction, Request, RequestHandler, Response } from "express";
|
|
10
|
-
|
|
11
12
|
//#region src/core/introspect.d.ts
|
|
12
13
|
/**
|
|
13
14
|
* Per-primitive introspection snapshot — the JSON shape an adapter or
|
|
@@ -688,81 +689,6 @@ declare class ModuleList extends Array<AppModuleEntry> {
|
|
|
688
689
|
*/
|
|
689
690
|
declare function defineModules(...initial: AppModuleEntry[]): ModuleList;
|
|
690
691
|
//#endregion
|
|
691
|
-
//#region src/core/disposables.d.ts
|
|
692
|
-
/**
|
|
693
|
-
* Registry for framework-owned resources that hold timers or other handles
|
|
694
|
-
* outside the adapter/plugin lifecycle — e.g. the in-memory session and
|
|
695
|
-
* rate-limit stores' cleanup intervals. `Application.shutdown()` drains it so
|
|
696
|
-
* startup and shutdown stay symmetric even for resources created lazily by
|
|
697
|
-
* middleware factories.
|
|
698
|
-
*
|
|
699
|
-
* Intervals are `.unref()`'d so they never wedge process exit — this registry
|
|
700
|
-
* exists for IN-PROCESS teardown (test suites, HMR, multi-app hosts) where
|
|
701
|
-
* each un-disposed store would otherwise leak a live interval + backing Map
|
|
702
|
-
* per app instance.
|
|
703
|
-
*/
|
|
704
|
-
type Disposable = () => void | Promise<void>;
|
|
705
|
-
/** Register a cleanup callback. Returns an unregister function. */
|
|
706
|
-
declare function registerDisposable(fn: Disposable): () => void;
|
|
707
|
-
/** Run and clear all registered disposables. Errors are swallowed per-entry. */
|
|
708
|
-
declare function disposeAll(): Promise<void>;
|
|
709
|
-
//#endregion
|
|
710
|
-
//#region src/core/kick-error.d.ts
|
|
711
|
-
/**
|
|
712
|
-
* Structured framework error with code, cause, and actionable fix hint.
|
|
713
|
-
*
|
|
714
|
-
* The goal is "the developer who hits this knows what to do next." A
|
|
715
|
-
* cryptic `Error('No binding found for: UserService')` becomes a
|
|
716
|
-
* multi-line explanation pointing at the likely cause, the exact code
|
|
717
|
-
* change to apply, and a docs link.
|
|
718
|
-
*
|
|
719
|
-
* `.message` carries the full multi-line plain-text body so Node's
|
|
720
|
-
* default `Error.toString()` and unhandled-exception printing still
|
|
721
|
-
* surface the helpful version. Call {@link formatKickError} to render a
|
|
722
|
-
* colorized version for terminals.
|
|
723
|
-
*
|
|
724
|
-
* Per-error factories live in `kick-errors.ts` — those are the public
|
|
725
|
-
* entry points framework code uses. `KickError` is exported so adopters
|
|
726
|
-
* can build their own structured errors using the same shape.
|
|
727
|
-
*/
|
|
728
|
-
interface KickErrorInit {
|
|
729
|
-
/** Short stable identifier (e.g. `KICK001`, `NO_PROVIDER`). */
|
|
730
|
-
code: string;
|
|
731
|
-
/** One-line headline. */
|
|
732
|
-
summary: string;
|
|
733
|
-
/** Multi-line explanation of why this happened. */
|
|
734
|
-
cause?: string;
|
|
735
|
-
/** Multi-line actionable fix — show exact code if possible. */
|
|
736
|
-
fix?: string;
|
|
737
|
-
/** Absolute URL to the docs page that covers this error. */
|
|
738
|
-
docsUrl?: string;
|
|
739
|
-
/** Arbitrary structured fields for log consumers / debug tooling. */
|
|
740
|
-
context?: Record<string, unknown>;
|
|
741
|
-
}
|
|
742
|
-
declare class KickError extends Error {
|
|
743
|
-
readonly code: string;
|
|
744
|
-
readonly summary: string;
|
|
745
|
-
readonly cause?: string;
|
|
746
|
-
readonly fix?: string;
|
|
747
|
-
readonly docsUrl?: string;
|
|
748
|
-
readonly context?: Record<string, unknown>;
|
|
749
|
-
constructor(init: KickErrorInit);
|
|
750
|
-
}
|
|
751
|
-
interface FormatKickErrorOptions {
|
|
752
|
-
/**
|
|
753
|
-
* Render ANSI colour codes. Defaults to TTY detection (`NO_COLOR` /
|
|
754
|
-
* `FORCE_COLOR` env vars honoured). Pass `false` for log files,
|
|
755
|
-
* structured loggers, or HTTP response bodies.
|
|
756
|
-
*/
|
|
757
|
-
color?: boolean;
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* Render a {@link KickErrorInit} (or {@link KickError} instance) into a
|
|
761
|
-
* multi-line human-readable string. Identical layout regardless of
|
|
762
|
-
* colour — the colour flag only toggles ANSI codes.
|
|
763
|
-
*/
|
|
764
|
-
declare function formatKickError(err: KickErrorInit | KickError, options?: FormatKickErrorOptions): string;
|
|
765
|
-
//#endregion
|
|
766
692
|
//#region src/core/metadata.d.ts
|
|
767
693
|
/**
|
|
768
694
|
* Typed utilities for reflect-metadata operations.
|
|
@@ -803,181 +729,6 @@ declare function setInMetaRecord<V>(key: MetaKey, target: object, recKey: string
|
|
|
803
729
|
/** Get a Record from class metadata (returns empty object if absent) */
|
|
804
730
|
declare function getMetaRecord<V>(key: MetaKey, target: object): Record<string | number, V>;
|
|
805
731
|
//#endregion
|
|
806
|
-
//#region src/core/circuit-breaker.d.ts
|
|
807
|
-
/**
|
|
808
|
-
* Circuit Breaker pattern for external service calls.
|
|
809
|
-
*
|
|
810
|
-
* Protects your application from cascading failures when downstream
|
|
811
|
-
* services are unhealthy by short-circuiting requests after a
|
|
812
|
-
* configurable failure threshold.
|
|
813
|
-
*
|
|
814
|
-
* @example
|
|
815
|
-
* ```ts
|
|
816
|
-
* const breaker = new CircuitBreaker('payment-api', {
|
|
817
|
-
* failureThreshold: 5,
|
|
818
|
-
* resetTimeout: 30_000,
|
|
819
|
-
* })
|
|
820
|
-
*
|
|
821
|
-
* const result = await breaker.execute(() => fetch('https://payment.example.com/charge'))
|
|
822
|
-
* ```
|
|
823
|
-
*/
|
|
824
|
-
type CircuitBreakerState = 'closed' | 'open' | 'half_open';
|
|
825
|
-
interface CircuitBreakerOptions {
|
|
826
|
-
/** Number of consecutive failures before the circuit opens. */
|
|
827
|
-
failureThreshold: number;
|
|
828
|
-
/** Milliseconds to wait before transitioning from OPEN to HALF_OPEN. */
|
|
829
|
-
resetTimeout: number;
|
|
830
|
-
/** Max requests allowed in HALF_OPEN state before deciding (default 1). */
|
|
831
|
-
halfOpenMax?: number;
|
|
832
|
-
}
|
|
833
|
-
interface CircuitBreakerStats {
|
|
834
|
-
failures: number;
|
|
835
|
-
successes: number;
|
|
836
|
-
state: CircuitBreakerState;
|
|
837
|
-
lastFailure?: Date;
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
|
-
* Error thrown when the circuit is open and calls are being rejected.
|
|
841
|
-
*/
|
|
842
|
-
declare class CircuitOpenError extends Error {
|
|
843
|
-
readonly breakerName: string;
|
|
844
|
-
constructor(breakerName: string);
|
|
845
|
-
}
|
|
846
|
-
declare class CircuitBreaker {
|
|
847
|
-
readonly name: string;
|
|
848
|
-
private state;
|
|
849
|
-
private failures;
|
|
850
|
-
private successes;
|
|
851
|
-
private halfOpenAttempts;
|
|
852
|
-
private lastFailure?;
|
|
853
|
-
private openedAt?;
|
|
854
|
-
private readonly failureThreshold;
|
|
855
|
-
private readonly resetTimeout;
|
|
856
|
-
private readonly halfOpenMax;
|
|
857
|
-
constructor(name: string, options: CircuitBreakerOptions);
|
|
858
|
-
/**
|
|
859
|
-
* Execute an async function through the circuit breaker.
|
|
860
|
-
* Throws `CircuitOpenError` if the circuit is open.
|
|
861
|
-
*/
|
|
862
|
-
execute<T>(fn: () => Promise<T>): Promise<T>;
|
|
863
|
-
/** Returns the current circuit state. */
|
|
864
|
-
getState(): CircuitBreakerState;
|
|
865
|
-
/** Returns current statistics. */
|
|
866
|
-
getStats(): CircuitBreakerStats;
|
|
867
|
-
/** Manually reset the circuit breaker to CLOSED state. */
|
|
868
|
-
reset(): void;
|
|
869
|
-
private onSuccess;
|
|
870
|
-
private onFailure;
|
|
871
|
-
private maybeTransitionToHalfOpen;
|
|
872
|
-
}
|
|
873
|
-
//#endregion
|
|
874
|
-
//#region src/core/context-errors.d.ts
|
|
875
|
-
/**
|
|
876
|
-
* Errors thrown by the Context Contributor pipeline.
|
|
877
|
-
*
|
|
878
|
-
* `MissingContributorError`, `ContributorCycleError`, and
|
|
879
|
-
* `DuplicateContributorError` are startup-time errors raised during
|
|
880
|
-
* pipeline build (topo-sort + validation), not per-request — a
|
|
881
|
-
* misconfigured app fails to boot rather than fails a request. Per the
|
|
882
|
-
* locked design in `architecture.md` §20.4, the pipeline is validated
|
|
883
|
-
* once when each route is mounted and the resolved order is cached on
|
|
884
|
-
* the route.
|
|
885
|
-
*
|
|
886
|
-
* `MissingContextValueError` is the one request-time error here: it is
|
|
887
|
-
* raised by `ctx.require(key)` when a value a handler declared it needs
|
|
888
|
-
* is absent. See its doc comment for why that case can't be caught at
|
|
889
|
-
* startup today.
|
|
890
|
-
*/
|
|
891
|
-
/**
|
|
892
|
-
* A contributor declared `dependsOn: ['<key>']` but no other contributor
|
|
893
|
-
* (at any precedence level) produces that key for the same route.
|
|
894
|
-
*
|
|
895
|
-
* @example
|
|
896
|
-
* ```text
|
|
897
|
-
* MissingContributorError: Missing context contributor 'tenant' required by 'project' on route GET /projects/:id
|
|
898
|
-
* declared at src/contributors/load-project.ts:42:18
|
|
899
|
-
* ```
|
|
900
|
-
*/
|
|
901
|
-
declare class MissingContributorError extends Error {
|
|
902
|
-
readonly key: string;
|
|
903
|
-
readonly dependent: string;
|
|
904
|
-
readonly route?: string;
|
|
905
|
-
readonly dependentDefinedAt?: string;
|
|
906
|
-
constructor(key: string, dependent: string, route?: string, dependentDefinedAt?: string);
|
|
907
|
-
}
|
|
908
|
-
/**
|
|
909
|
-
* `ctx.require(key)` found no value under `key` in the per-request
|
|
910
|
-
* metadata store.
|
|
911
|
-
*
|
|
912
|
-
* Thrown at request time, by design. `ctx.get(key)` returns
|
|
913
|
-
* `T | undefined` for every key, so the usual workaround is a
|
|
914
|
-
* non-null assertion — `ctx.get('tenant')!` — which compiles whether or
|
|
915
|
-
* not the route actually carries the contributor that produces it. On
|
|
916
|
-
* an authorization value that is the worst possible thing to leave
|
|
917
|
-
* untypeable: dropping the decorator produces no diagnostic anywhere,
|
|
918
|
-
* and the handler reads `undefined` as though it were a real value.
|
|
919
|
-
*
|
|
920
|
-
* `ctx.require()` converts that silent hole into a loud, named failure
|
|
921
|
-
* that points at the missing contributor.
|
|
922
|
-
*
|
|
923
|
-
* A handler typed with a generated route type (`Ctx<KickRoutes…>`) also
|
|
924
|
-
* gets compile-time narrowing, so a dropped decorator fails `tsc` rather
|
|
925
|
-
* than reaching this error at all. This error remains the backstop for
|
|
926
|
-
* routes typegen couldn't prove (module/adapter/bootstrap registrations),
|
|
927
|
-
* handlers typed as plain `RequestContext`, and contributors that ran but
|
|
928
|
-
* resolved to `undefined`. See `architecture.md` §20.14.
|
|
929
|
-
*
|
|
930
|
-
* @example
|
|
931
|
-
* ```text
|
|
932
|
-
* MissingContextValueError: No context value for 'tenantPerm' on GET /projects/:id
|
|
933
|
-
* Nothing wrote this key before the handler ran. Either the contributor
|
|
934
|
-
* that produces it isn't applied to this route, or it ran and resolved
|
|
935
|
-
* to undefined (check `optional: true` contributors).
|
|
936
|
-
* ```
|
|
937
|
-
*/
|
|
938
|
-
declare class MissingContextValueError extends Error {
|
|
939
|
-
readonly key: string;
|
|
940
|
-
readonly route?: string;
|
|
941
|
-
constructor(key: string, route?: string);
|
|
942
|
-
}
|
|
943
|
-
/**
|
|
944
|
-
* Topo-sort detected a cycle in `dependsOn` declarations. The `cycle` field
|
|
945
|
-
* lists the keys in the order they form the loop, with the first key
|
|
946
|
-
* repeated at the end so the path reads naturally.
|
|
947
|
-
*
|
|
948
|
-
* @example
|
|
949
|
-
* ```text
|
|
950
|
-
* ContributorCycleError: Cycle in context contributors on route GET /projects/:id: tenant → project → tenant
|
|
951
|
-
* ```
|
|
952
|
-
*/
|
|
953
|
-
declare class ContributorCycleError extends Error {
|
|
954
|
-
readonly cycle: readonly string[];
|
|
955
|
-
readonly route?: string;
|
|
956
|
-
constructor(cycle: readonly string[], route?: string);
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Two contributors at the same precedence level both produce the same key
|
|
960
|
-
* for the same route. Precedence resolution (method > class > module >
|
|
961
|
-
* adapter > global, per architecture.md §20.4) silently drops
|
|
962
|
-
* lower-precedence duplicates; this error fires only when ties occur
|
|
963
|
-
* within a single level — e.g., two method-level decorators declaring
|
|
964
|
-
* `key: 'tenant'`.
|
|
965
|
-
*
|
|
966
|
-
* `sources` is best-effort identifying labels for each conflicting
|
|
967
|
-
* registration (typically the decorator's call site or registering
|
|
968
|
-
* module/adapter name).
|
|
969
|
-
*
|
|
970
|
-
* @example
|
|
971
|
-
* ```text
|
|
972
|
-
* DuplicateContributorError: Duplicate context contributor for key 'tenant' at the same precedence level. Sources: LoadTenantFromHeader, LoadTenantFromSubdomain
|
|
973
|
-
* ```
|
|
974
|
-
*/
|
|
975
|
-
declare class DuplicateContributorError extends Error {
|
|
976
|
-
readonly key: string;
|
|
977
|
-
readonly sources: readonly string[];
|
|
978
|
-
constructor(key: string, sources: readonly string[]);
|
|
979
|
-
}
|
|
980
|
-
//#endregion
|
|
981
732
|
//#region src/core/contributor-pipeline.d.ts
|
|
982
733
|
/**
|
|
983
734
|
* Where a contributor was registered, ordered by precedence
|
|
@@ -1084,83 +835,6 @@ interface RunContributorsOptions {
|
|
|
1084
835
|
*/
|
|
1085
836
|
declare function runContributors(options: RunContributorsOptions): Promise<void>;
|
|
1086
837
|
//#endregion
|
|
1087
|
-
//#region src/core/mount-sort.d.ts
|
|
1088
|
-
/**
|
|
1089
|
-
* Topological sort for plugins and adapters with `dependsOn` declarations.
|
|
1090
|
-
*
|
|
1091
|
-
* Mirrors the algorithm used by the Context Contributor pipeline
|
|
1092
|
-
* (`contributor-pipeline.ts:topoSort`) but operates on a name-keyed
|
|
1093
|
-
* `MountSortItem` shape rather than a `ContributorRegistration`. Kept
|
|
1094
|
-
* standalone instead of factored generic so that:
|
|
1095
|
-
*
|
|
1096
|
-
* 1. The contributor pipeline doesn't need refactoring (risk reduction).
|
|
1097
|
-
* 2. The error classes can carry plugin/adapter-specific diagnostic
|
|
1098
|
-
* fields (`kind`, `dependent`) without bending the contributor types.
|
|
1099
|
-
*/
|
|
1100
|
-
/**
|
|
1101
|
-
* A plugin or adapter that participates in dependency-ordered mounting.
|
|
1102
|
-
* Both `KickPlugin` and `AppAdapter` satisfy this shape via their `name`
|
|
1103
|
-
* and `dependsOn` fields.
|
|
1104
|
-
*/
|
|
1105
|
-
interface MountSortItem {
|
|
1106
|
-
/** Unique mount name within the plugin/adapter set being sorted. */
|
|
1107
|
-
name: string;
|
|
1108
|
-
/**
|
|
1109
|
-
* Other plugin/adapter names that must mount before this one. Cycles
|
|
1110
|
-
* and missing names fail at boot — same fail-fast contract as the
|
|
1111
|
-
* Context Contributor pipeline (architecture.md §20.4).
|
|
1112
|
-
*/
|
|
1113
|
-
dependsOn?: readonly string[];
|
|
1114
|
-
}
|
|
1115
|
-
/** What kind of mount set the sort is operating on — surfaces in error messages. */
|
|
1116
|
-
type MountKind = 'plugin' | 'adapter';
|
|
1117
|
-
/**
|
|
1118
|
-
* Two items in the same mount set declared the same `name`. Plugin/adapter
|
|
1119
|
-
* names must be unique so `dependsOn` references resolve unambiguously.
|
|
1120
|
-
*/
|
|
1121
|
-
declare class DuplicateMountNameError extends Error {
|
|
1122
|
-
readonly kind: MountKind;
|
|
1123
|
-
readonly mountName: string;
|
|
1124
|
-
constructor(kind: MountKind, mountName: string);
|
|
1125
|
-
}
|
|
1126
|
-
/**
|
|
1127
|
-
* A `dependsOn` entry references a plugin/adapter that isn't in the
|
|
1128
|
-
* current set. The dependency might not be installed, might be misspelled,
|
|
1129
|
-
* or might live in a different mount set (plugin referencing an adapter,
|
|
1130
|
-
* or vice versa — they sort independently).
|
|
1131
|
-
*/
|
|
1132
|
-
declare class MissingMountDepError extends Error {
|
|
1133
|
-
readonly kind: MountKind;
|
|
1134
|
-
readonly missing: string;
|
|
1135
|
-
readonly dependent: string;
|
|
1136
|
-
constructor(kind: MountKind, missing: string, dependent: string);
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* The `dependsOn` declarations form a cycle. Boot fails so the cycle
|
|
1140
|
-
* can't poison live traffic. The `cycle` field reports one path through
|
|
1141
|
-
* the offending nodes for diagnostics — formatted `A → B → C → A`.
|
|
1142
|
-
*/
|
|
1143
|
-
declare class MountCycleError extends Error {
|
|
1144
|
-
readonly kind: MountKind;
|
|
1145
|
-
readonly cycle: readonly string[];
|
|
1146
|
-
constructor(kind: MountKind, cycle: readonly string[]);
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* Topologically sort `items` so every item with `dependsOn: ['X']` mounts
|
|
1150
|
-
* after `X`. Items without `dependsOn` keep their input order via Kahn's
|
|
1151
|
-
* algorithm with a FIFO queue seeded in input order — preserves the
|
|
1152
|
-
* historical "plugins/adapters mount in declaration order" behaviour for
|
|
1153
|
-
* any set that doesn't use `dependsOn`.
|
|
1154
|
-
*
|
|
1155
|
-
* @param items - mountable items, e.g. plugins or adapters
|
|
1156
|
-
* @param kind - 'plugin' | 'adapter', used in error messages
|
|
1157
|
-
* @returns a new array in valid mount order
|
|
1158
|
-
* @throws {DuplicateMountNameError} two items share a name
|
|
1159
|
-
* @throws {MissingMountDepError} a `dependsOn` references an unknown name
|
|
1160
|
-
* @throws {MountCycleError} the dep graph contains a cycle
|
|
1161
|
-
*/
|
|
1162
|
-
declare function mountSort<T extends MountSortItem>(items: readonly T[], kind: MountKind): T[];
|
|
1163
|
-
//#endregion
|
|
1164
838
|
//#region src/core/define-adapter.d.ts
|
|
1165
839
|
/**
|
|
1166
840
|
* Options passed to {@link defineAdapter}. Mirrors {@link DefinePluginOptions}
|
|
@@ -1238,49 +912,6 @@ interface AdapterFactory<TConfig, TExtra = unknown> {
|
|
|
1238
912
|
*/
|
|
1239
913
|
declare function defineAdapter<TConfig = Record<string, unknown>, TExtra = unknown>(options: DefineAdapterOptions<TConfig, TExtra>): AdapterFactory<TConfig, TExtra>;
|
|
1240
914
|
//#endregion
|
|
1241
|
-
//#region src/core/asset-keys.d.ts
|
|
1242
|
-
type AssetKeyStrategy = 'auto' | 'strip' | 'with-extension';
|
|
1243
|
-
interface AssetKeyPair {
|
|
1244
|
-
/** Source-relative path the file was discovered at. */
|
|
1245
|
-
rel: string;
|
|
1246
|
-
/** Final logical key for the manifest, including the namespace prefix. */
|
|
1247
|
-
key: string;
|
|
1248
|
-
}
|
|
1249
|
-
interface GroupAssetKeysOptions {
|
|
1250
|
-
/**
|
|
1251
|
-
* Strategy applied to this namespace. Default `'auto'`.
|
|
1252
|
-
*
|
|
1253
|
-
* Adopters override per-namespace via `assetMap.<ns>.keys` in
|
|
1254
|
-
* kick.config.ts when they want uniform behaviour (e.g. always
|
|
1255
|
-
* include the extension regardless of collisions).
|
|
1256
|
-
*/
|
|
1257
|
-
strategy?: AssetKeyStrategy;
|
|
1258
|
-
}
|
|
1259
|
-
interface GroupAssetKeysResult {
|
|
1260
|
-
pairs: AssetKeyPair[];
|
|
1261
|
-
/**
|
|
1262
|
-
* Number of collision groups resolved by keeping extensions.
|
|
1263
|
-
* Surfaces as an informational log ("auto-resolved N collisions")
|
|
1264
|
-
* so adopters know whether they're relying on auto-mode or not.
|
|
1265
|
-
* Always 0 for `'strip'` (overwrites) and `'with-extension'`
|
|
1266
|
-
* (extensions always preserved, no collision possible).
|
|
1267
|
-
*/
|
|
1268
|
-
collisionGroupsResolved: number;
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* Compute final manifest keys for a namespace's discovered paths,
|
|
1272
|
-
* given the chosen strategy. Pure function — no fs / config / globals
|
|
1273
|
-
* involved.
|
|
1274
|
-
*
|
|
1275
|
-
* @param namespace assetMap key — e.g. `'mails'`, `'pages'`.
|
|
1276
|
-
* @param paths source-relative file paths (POSIX separators) discovered
|
|
1277
|
-
* under the namespace's `src` directory.
|
|
1278
|
-
* @param opts grouping options.
|
|
1279
|
-
*/
|
|
1280
|
-
declare function groupAssetKeys(namespace: string, paths: readonly string[], opts?: GroupAssetKeysOptions): GroupAssetKeysResult;
|
|
1281
|
-
/** Strip the final extension from a path. `'mails/welcome.ejs'` → `'mails/welcome'`. */
|
|
1282
|
-
declare function stripExt(path: string): string;
|
|
1283
|
-
//#endregion
|
|
1284
915
|
//#region src/http/context.d.ts
|
|
1285
916
|
/**
|
|
1286
917
|
* Input shape for the typed problem-detail convenience methods on
|
|
@@ -1355,7 +986,7 @@ interface ProblemSender {
|
|
|
1355
986
|
* Type-only. No runtime cost. `DeepReadonly<any>` is `any` (TS
|
|
1356
987
|
* distributes conditional types over `any`).
|
|
1357
988
|
*/
|
|
1358
|
-
type DeepReadonly<T> = T extends ((...args: never[]) => unknown) ? T : T extends Date | RegExp ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer V> ? ReadonlySet<DeepReadonly<V>> : T extends readonly (infer U)[] ? number extends T['length'] ? ReadonlyArray<DeepReadonly<U>> : { readonly [K in keyof T]: DeepReadonly<T[K]
|
|
989
|
+
type DeepReadonly<T> = T extends ((...args: never[]) => unknown) ? T : T extends Date | RegExp ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer V> ? ReadonlySet<DeepReadonly<V>> : T extends readonly (infer U)[] ? number extends T['length'] ? ReadonlyArray<DeepReadonly<U>> : { readonly [K in keyof T]: DeepReadonly<T[K]>; } : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]>; } : T;
|
|
1359
990
|
/**
|
|
1360
991
|
* The shape of a single route entry in `KickRoutes`. Generated by
|
|
1361
992
|
* `kick typegen` and consumed via the `Ctx<T>` helper. Each field is
|
|
@@ -1690,6 +1321,19 @@ TKeys extends string = string> implements ExecutionContext<TKeys> {
|
|
|
1690
1321
|
*/
|
|
1691
1322
|
get problem(): ProblemSender;
|
|
1692
1323
|
private sendProblem;
|
|
1324
|
+
/**
|
|
1325
|
+
* Send an HTML response.
|
|
1326
|
+
*
|
|
1327
|
+
* Passes the full MIME type rather than the `'html'` shorthand. The
|
|
1328
|
+
* shorthand is an Express affordance — `res.type()` runs it through a MIME
|
|
1329
|
+
* lookup — but the Fastify and h3 drivers forward the string to their own
|
|
1330
|
+
* `type()` / `setHeader()` verbatim, so `'html'` reached the wire as a
|
|
1331
|
+
* malformed `Content-Type: html` on those engines. Fastify 5.10 started
|
|
1332
|
+
* normalising that invalid value to `text/plain`, which is what surfaced it.
|
|
1333
|
+
*
|
|
1334
|
+
* Express produces `text/html; charset=utf-8` for `.type('html')`, so
|
|
1335
|
+
* spelling it out here is byte-identical there and correct everywhere else.
|
|
1336
|
+
*/
|
|
1693
1337
|
html(content: string, status?: number): RuntimeResponse;
|
|
1694
1338
|
download(buffer: Buffer, filename: string, contentType?: string): RuntimeResponse;
|
|
1695
1339
|
/**
|
|
@@ -1824,7 +1468,7 @@ type Ctx<TRoute extends RouteShape = RouteShape> = RequestContext<TRoute extends
|
|
|
1824
1468
|
*/
|
|
1825
1469
|
declare global {
|
|
1826
1470
|
namespace KickRoutes {}
|
|
1827
|
-
}
|
|
1471
|
+
}
|
|
1828
1472
|
//#endregion
|
|
1829
1473
|
//#region src/http/runtime.d.ts
|
|
1830
1474
|
/** HTTP verbs the router emits. Mirrors the decorator surface (@Get/@Post/...). */
|
|
@@ -2279,5 +1923,5 @@ interface AppAdapter {
|
|
|
2279
1923
|
/** Constructor type for AppAdapter classes */
|
|
2280
1924
|
type AppAdapterClass = new () => AppAdapter;
|
|
2281
1925
|
//#endregion
|
|
2282
|
-
export {
|
|
2283
|
-
//# sourceMappingURL=adapter-
|
|
1926
|
+
export { defineModules as $, DefineAdapterOptions as A, getClassMetaOrUndefined as B, Ctx as C, SseHandler as D, RouteShape as E, ContributorPipeline as F, hasClassMeta as G, getMetaRecord as H, ContributorSource as I, setClassMeta as J, pushClassMeta as K, SourcedRegistration as L, RunContributorsOptions as M, runContributors as N, AdapterAsyncOptions as O, BuildPipelineOptions as P, ModuleList as Q, buildPipeline as R, UseConnectOptions as S, RequestContext as T, getMethodMeta as U, getMetaMap as V, getMethodMetaOrUndefined as W, setInMetaRecord as X, setInMetaMap as Y, setMethodMeta as Z, RouteTable as _, IntrospectionSnapshot as _t, MiddlewarePath as a, PluginAsyncOptions as at, RuntimeResponse as b, AdapterHttp as c, KickPlugin as ct, ExpressRuntimeTypes as d, AugmentationMeta as dt, DefineModuleOptions as et, HttpRuntime as f, KickJsPluginName as ft, RouteMethod as g, IntrospectionKind as gt, RouteMeta as h, IntrospectFn as ht, AppAdapterClass as i, DefinePluginOptions as it, defineAdapter as j, AdapterFactory as k, ConnectMiddleware as l, ModuleRegistry as lt, RouteEntry as m, defineAugmentation as mt, AdapterMiddleware as n, defineModule as nt, MiddlewarePhase as o, PluginFactory as ot, KickRuntimeRegister as p, KickJsPluginRegistry as pt, pushMethodMeta as q, AppAdapter as r, BuildContext as rt, ActiveRuntime as s, definePlugin as st, AdapterContext as t, ModuleFactory as tt, CtxHandler as u, MutableModuleRegistry as ut, RuntimeAppOptions as v, DeepReadonly as w, RuntimeTypeMap as x, RuntimeCapabilities as y, getClassMeta as z };
|
|
1927
|
+
//# sourceMappingURL=adapter-CbMq-NBf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-CbMq-NBf.d.mts","names":[],"sources":["../src/core/introspect.ts","../src/core/augmentation.ts","../src/core/module-registry.ts","../src/core/plugin.ts","../src/core/define-plugin.ts","../src/core/define-module.ts","../src/core/define-modules.ts","../src/core/metadata.ts","../src/core/contributor-pipeline.ts","../src/core/contributor-runner.ts","../src/core/define-adapter.ts","../src/http/context.ts","../src/http/runtime.ts","../src/core/adapter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAkBiB;;;;;;;;;;EAUf;;EAEA;;EAE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Aa;;;;;;;;;;;;;EAc5C,aAAa,KAAK,wBAAwB;;;;;;;;;;;;;;;EAgB1C,YAAY,KAAK,wBAAwB;;;;;EAMzC,kBAAkB;IAAU;IAAc;;;EAG1C,aAAa;;;;;;;;;;;;;EAcb,eAAe,wBAAwB,QAAQ;;;;;;;;;;;EAY/C;;;KAIU,4BAA4B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as Constructor, o as MaybePromise } from "./interfaces-
|
|
3
|
-
import { s as InjectionToken, t as Container } from "./container-
|
|
2
|
+
import { i as Constructor, o as MaybePromise } from "./interfaces-BTTBdkvG.mjs";
|
|
3
|
+
import { s as InjectionToken, t as Container } from "./container-BW_MlgLj.mjs";
|
|
4
|
+
import "reflect-metadata";
|
|
4
5
|
//#region src/core/execution-context.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* Transport-agnostic execution context primitives.
|
|
@@ -157,11 +158,11 @@ type DepValue = InjectionToken<unknown> | Constructor<unknown>;
|
|
|
157
158
|
* `{ db: Db, cache: CacheService }` — the runner resolves each value
|
|
158
159
|
* against the DI container and hands the result to `resolve()`.
|
|
159
160
|
*/
|
|
160
|
-
type ResolvedDeps<D extends Record<string, DepValue>> = { [K in keyof D]: D[K] extends InjectionToken<infer T> ? T : D[K] extends Constructor<infer T> ? T : never };
|
|
161
|
+
type ResolvedDeps<D extends Record<string, DepValue>> = { [K in keyof D]: D[K] extends InjectionToken<infer T> ? T : D[K] extends Constructor<infer T> ? T : never; };
|
|
161
162
|
/**
|
|
162
163
|
* Keys of `T` that are declared required (i.e. not `?`-optional).
|
|
163
164
|
*/
|
|
164
|
-
type RequiredParamKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T];
|
|
165
|
+
type RequiredParamKeys<T> = { [K in keyof T]-?: {} extends Pick<T, K> ? never : K; }[keyof T];
|
|
165
166
|
/**
|
|
166
167
|
* Params a call site MUST supply: the required keys of `P` that
|
|
167
168
|
* `paramDefaults` (type `PD`) doesn't already provide.
|
|
@@ -643,4 +644,4 @@ type AppModuleClass = new () => AppModule;
|
|
|
643
644
|
type AppModuleEntry = AppModuleClass | AppModule;
|
|
644
645
|
//#endregion
|
|
645
646
|
export { ExecutionContext as _, AnyContributorRegistration as a, ContextDecoratorTarget as c, ContributorRegistrations as d, DepValue as f, ContextMeta as g, ContextKeys as h, ModuleRoutes as i, ContextMetaKey as l, defineContextDecorator as m, AppModuleClass as n, ContextDecorator as o, ResolvedDeps as p, AppModuleEntry as r, ContextDecoratorSpec as s, AppModule as t, ContributorRegistration as u, MetaValue as v };
|
|
646
|
-
//# sourceMappingURL=app-module-
|
|
647
|
+
//# sourceMappingURL=app-module-DtoySG6l.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-module-DtoySG6l.d.mts","names":[],"sources":["../src/core/execution-context.ts","../src/core/context-decorator.ts","../src/core/app-module.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8CiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgCA;;KAGL,UAAU,kBAAkB,sBAAsB,gBAAgB,cAC1E,YAAY,KACZ;;;;;;;;;UAUa,iBAAiB;;;;;;;;;EAShC,IAAI,kBAAkB,KAAK,IAAI,UAAU;;;;;;;;;;;;;;EAczC,QAAQ,UAAU,OAAO,KAAK,IAAI,QAAQ,UAAU;;EAEpD,IAAI,kBAAkB,KAAK,GAAG,OAAO,UAAU;;WAEtC;;;;;;;;;;;;;;;;;;;;;;;;;KC7FN,wBAAwB,oBAAoB;KACrC,kBAAkB,4CAA4C;;;;;;;;;KAU9D,WAAW,0BAA0B;;;;;;;;KASrC,aAAa,UAAU,eAAe,gBAC/C,WAAW,IAAI,EAAE,WAAW,qBAAqB,KAC9C,IACA,EAAE,WAAW,kBAAkB,KAC7B;;;;KAOH,kBAAkB,QAEpB,WAAW,iBAAiB,KAAK,GAAG,aAAa,WAC5C;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AgB3B,iBAAiB,iBAAiB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @forinda/kickjs v6.5.1
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Felix Orinda
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import{METADATA}from"./core/interfaces.mjs";import{n as tokenName,s as moduleRouteMissingControllerError,t as Container}from"./container-C7kmdVwh.mjs";import{Logger,createLogger}from"./core/logger.mjs";import{t as getClassMeta}from"./metadata-DUBbuHqY.mjs";import{t as MutableModuleRegistry}from"./module-registry-aIt66if2.mjs";import{i as runDisposables,n as drainDisposables,r as registerDisposable,t as disposeAll}from"./disposables-D46xX96x.mjs";import{joinPaths,normalizePath}from"./core/path.mjs";import"./core-CLmwVWlw.mjs";import{n as assertRouteUnique,r as buildRouteTable,t as _setExternalContributorSources}from"./router-builder-BbgVXuy3.mjs";import{requestId}from"./http/middleware/request-id.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{i as requestStore,t as RequestContext}from"./context-DQaUwwQM.mjs";import{o as isRequestScopeMiddleware,s as requestScopeMiddleware,t as applyHandlerResult}from"./reply-C1ljl6xS.mjs";import{validate}from"./http/middleware/validate.mjs";import{buildUploadMiddleware}from"./http/middleware/upload.mjs";import http from"node:http";import express,{Router}from"express";var DuplicateMountNameError=class extends Error{kind;mountName;constructor(kind,mountName){super(`Duplicate ${kind} name '${mountName}' — every ${kind} must declare a unique name`),this.name=`DuplicateMountNameError`,this.kind=kind,this.mountName=mountName}},MissingMountDepError=class extends Error{kind;missing;dependent;constructor(kind,missing,dependent){super(`Missing ${kind} dependency '${missing}' required by '${dependent}' — is the ${kind} installed and named correctly?`),this.name=`MissingMountDepError`,this.kind=kind,this.missing=missing,this.dependent=dependent}},MountCycleError=class extends Error{kind;cycle;constructor(kind,cycle){super(`Cycle in ${kind} dependsOn declarations: ${cycle.join(` → `)}`),this.name=`MountCycleError`,this.kind=kind,this.cycle=Object.freeze([...cycle])}};function mountSort(items,kind){let byName=new Map;for(let item of items){if(byName.has(item.name))throw new DuplicateMountNameError(kind,item.name);byName.set(item.name,item)}let indegree=new Map,dependents=new Map;for(let item of items)indegree.set(item.name,item.dependsOn?.length??0);for(let item of items)for(let dep of item.dependsOn??[]){if(!byName.has(dep))throw new MissingMountDepError(kind,dep,item.name);let list=dependents.get(dep)??[];list.push(item),dependents.set(dep,list)}let queue=[];for(let item of items)indegree.get(item.name)===0&&queue.push(item);let sorted=[];for(;queue.length>0;){let node=queue.shift();sorted.push(node);for(let dependent of dependents.get(node.name)??[]){let next=(indegree.get(dependent.name)??0)-1;indegree.set(dependent.name,next),next===0&&queue.push(dependent)}}if(sorted.length!==items.length)throw new MountCycleError(kind,reconstructCycle(items.filter(it=>(indegree.get(it.name)??0)>0),byName));return sorted}function reconstructCycle(residual,byName){let residualNames=new Set(residual.map(r=>r.name)),start=residual[0].name,path=[start],seen=new Set([start]),cursor=start;for(;;){let nextDep=byName.get(cursor).dependsOn?.find(d=>residualNames.has(d));if(nextDep===void 0)break;if(seen.has(nextDep)){let cycleStart=path.indexOf(nextDep);return[...path.slice(cycleStart),nextDep]}path.push(nextDep),seen.add(nextDep),cursor=nextDep}return path}function materializeRouter(entries){let router=Router();for(let entry of entries){let method=entry.method.toLowerCase(),handlers=[];entry.meta.validation&&handlers.push(validate(entry.meta.validation)),entry.meta.upload&&handlers.push(buildUploadMiddleware(entry.meta.upload));for(let mw of entry.middlewares)handlers.push((req,res,next)=>{let ctx=new RequestContext(req,res,next);Promise.resolve(mw(ctx,next)).catch(next)});if(entry.contributorRunner){let run=entry.contributorRunner;handlers.push(async(req,res,next)=>{let ctx=new RequestContext(req,res,next);try{await run(ctx),next()}catch(err){next(err)}})}handlers.push(async(req,res,next)=>{let ctx=new RequestContext(req,res,next);try{let result=await entry.handler(ctx);res.headersSent||applyHandlerResult(ctx,result)}catch(err){next(err)}}),router[method](entry.path,...handlers)}return router}function buildRoutes(controllerClass,options={}){return materializeRouter(buildRouteTable(controllerClass,options))}function expressRuntime(){return{name:`express`,createApp(options={}){let app=express();return app.disable(`x-powered-by`),app.set(`trust proxy`,options.trustProxy??!1),app},nodeHandler(app){return(req,res,next)=>{next?app(req,res,next):app(req,res)}},mountRoutes(app,table){for(let{mountPath,routes}of table)app.use(mountPath,materializeRouter(routes))},useConnect(app,mw,opts={}){opts.path===void 0?app.use(mw):app.use(opts.path,mw)},serveStatic(app,prefix,dir){app.use(prefix,express.static(dir))},setNotFound(app,mw){app.use(mw)},setErrorHandler(app,mw){app.use(mw)},capabilities:{render:!0,uploads:!0,connectMiddleware:!0,nativeBodyParsing:!1}}}const log=createLogger(`Application`);var Application=class{options;app;runtime;container;httpServer=null;adapters;plugins;_moduleContributors=[];_inFlightRequests=0;_draining=!1;_shutdownInitiated=!1;_drainResolvers=[];constructor(options){this.options=options,this.runtime=options.runtime??expressRuntime(),this.app=this.runtime.createApp({trustProxy:options.trustProxy}),this.container=Container.getInstance(),this.plugins=mountSort(options.plugins??[],`plugin`);let allAdapters=[...this.plugins.flatMap(p=>p.adapters?.()??[]),...options.adapters??[]],anonAdapterCount=0,namedAdapters=allAdapters.map(adapter=>{if(!adapter.name){let ctorName=adapter.constructor?.name,fallback=ctorName&&ctorName!==`Object`?ctorName:`AnonymousAdapter#${anonAdapterCount++}`;return Object.assign(adapter,{name:fallback})}return adapter});this.adapters=mountSort(namedAdapters,`adapter`),Container._requestStoreProvider=()=>requestStore.getStore()??null}get isDraining(){return this._draining}get inFlightRequests(){return this._inFlightRequests}getContainer(){return this.container}handle(req,res,next){let handler=this.runtime.nodeHandler(this.app);next?handler(req,res,next):handler(req,res)}adapterCtx(server){let env=process.env.NODE_ENV??`development`;return{http:this.adapterHttp(),app:this.app,container:this.container,server,env,isProduction:env===`production`}}adapterHttp(){return{route:(method,path,handler)=>{let entry={method,path,middlewares:[],contributorRunner:null,handler,meta:{}};this.runtime.mountRoutes(this.app,[{mountPath:`/`,routes:[entry]}])},mount:(prefix,routes)=>{this.runtime.mountRoutes(this.app,[{mountPath:prefix,routes}])},serveStatic:(prefix,dir)=>{this.runtime.serveStatic(this.app,prefix,dir)},use:(mw,opts)=>{this.runtime.useConnect(this.app,mw,opts)}}}async callHook(hook,ctx){if(hook)try{let result=hook(ctx);result&&typeof result.then==`function`&&await result}catch(err){log.error(err,`Adapter hook failed`)}}async setup(){log.debug(`Bootstrapping application...`),this._moduleContributors=[];let adapterMw=this.collectAdapterMiddleware();this.app.__kickApp=this;let ctx=this.adapterCtx();for(let adapter of this.adapters)await this.callHook(adapter.beforeMount?.bind(adapter),ctx);this.runtime.useConnect(this.app,this.requestTrackingMiddleware()),this.mountHealthEndpoints(),this.shouldAutoMountRequestScope()&&this.runtime.useConnect(this.app,requestScopeMiddleware()),this.mountMiddlewareList(adapterMw.beforeGlobal);for(let plugin of this.plugins)plugin.register?.(this.container);for(let plugin of this.plugins)try{let mw=plugin.middleware?.()??[];for(let handler of mw)this.runtime.useConnect(this.app,handler)}catch(err){log.error(err,`Plugin middleware failed: ${plugin.name??`unknown`}`)}if(this.options.security?.helmet!==!1)try{let{helmet:helmetFn}=await import(`./http/middleware/helmet.mjs`);this.runtime.useConnect(this.app,helmetFn())}catch{}let userMiddlewares=this.options.middlewares??this.options.middleware;if(userMiddlewares)for(let entry of userMiddlewares)this.mountMiddlewareEntry(entry);else this.runtime.useConnect(this.app,requestId()),this.runtime.capabilities.nativeBodyParsing||this.runtime.useConnect(this.app,express.json({limit:this.options.jsonLimit??`1mb`}));this.mountMiddlewareList(adapterMw.afterGlobal);let moduleRegistry=new MutableModuleRegistry;for(let plugin of this.plugins){for(let m of plugin.modules?.()??[])moduleRegistry.mount(m);plugin.setup?.(moduleRegistry)}for(let m of this.options.modules)moduleRegistry.mount(m);this.options.setup?.(moduleRegistry);let modules=moduleRegistry.entries.map(entry=>{let mod=typeof entry==`function`?new entry:entry;return mod.register?.(this.container),mod});this.container.bootstrap(),this.container.has(Logger)||this.container.registerInstance(Logger,new Logger),this.mountMiddlewareList(adapterMw.beforeRoutes);let apiPrefix=this.options.apiPrefix??`/api`,defaultVersion=this.options.defaultVersion??1,shouldLogRoutes=this.options.logRouteTable??this.options.logRoutesTable??!1,mountedRoutes=[],adapterSources=[];for(let adapter of this.adapters){let adapterContribs=adapter.contributors?.()??[],adapterLabel=adapter.name??adapter.constructor.name??`adapter`;for(let registration of adapterContribs)adapterSources.push({source:`adapter`,registration,label:adapterLabel})}for(let plugin of this.plugins){let pluginContribs=plugin.contributors?.()??[],pluginLabel=plugin.name??plugin.constructor?.name??`plugin`;for(let registration of pluginContribs)adapterSources.push({source:`adapter`,registration,label:pluginLabel})}let globalSources=(this.options.contributors??[]).map(registration=>({source:`global`,registration,label:`bootstrap`}));this._moduleContributors=[];let seenRoutes=new Map;for(let mod of modules){let declaredName=mod.name,ctorName=mod.constructor?.name,moduleLabel=typeof declaredName==`string`&&declaredName.length>0?declaredName:ctorName&&ctorName!==`Object`?ctorName:`module`,moduleSources=(mod.contributors?.()??[]).map(registration=>({source:`module`,registration,label:moduleLabel}));for(let src of moduleSources)this._moduleContributors.push({registration:src.registration,label:moduleLabel});_setExternalContributorSources([...moduleSources,...adapterSources,...globalSources]);try{let result=mod.routes();if(!result)continue;let routeSets=Array.isArray(result)?result:[result];for(let route of routeSets){let mountPath=`${apiPrefix}/v${route.version??defaultVersion}${normalizePath(route.path)}`;if(route.router)this.runtime.useConnect(this.app,route.router,{path:mountPath});else if(route.controller){let routeTable=buildRouteTable(route.controller),ctrl=route.controller.name??`controller`;for(let entry of routeTable){let owner=`${ctrl}.${String(entry.meta.handlerName??`?`)}`;assertRouteUnique(seenRoutes,entry.method,joinPaths(mountPath,entry.path),owner)}this.runtime.mountRoutes(this.app,[{mountPath,routes:routeTable}])}else throw moduleRouteMissingControllerError(mountPath);if(route.controller){for(let adapter of this.adapters)try{adapter.onRouteMount?.(route.controller,mountPath)}catch(err){log.error(err,`adapter.onRouteMount() failed for ${mountPath}`)}shouldLogRoutes&&mountedRoutes.push({controller:route.controller,mountPath})}}}finally{_setExternalContributorSources([])}}if(shouldLogRoutes&&mountedRoutes.length>0){let methodOrder=[`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`HEAD`,`OPTIONS`],methodRank=m=>{let i=methodOrder.indexOf(m);return i===-1?99:i},totalRoutes=0;log.info(`Routes:`);for(let{controller,mountPath}of mountedRoutes){let defs=getClassMeta(METADATA.ROUTES,controller,[]);if(defs.length===0)continue;let counts={};for(let def of defs){let m=def.method.toUpperCase();counts[m]=(counts[m]||0)+1}totalRoutes+=defs.length;let methods=Object.entries(counts).toSorted(([a],[b])=>methodRank(a)-methodRank(b)).map(([m,n])=>`${n} ${m}`).join(`, `),name=controller.name||`Controller`;log.info(` ${name.padEnd(30)} ${mountPath.padEnd(25)} ${defs.length} routes (${methods})`)}log.info(` Total: ${totalRoutes} routes`)}this.mountMiddlewareList(adapterMw.afterRoutes);for(let adapter of this.adapters)await this.callHook(adapter.beforeStart?.bind(adapter),ctx);this.runtime.setNotFound(this.app,this.options.onNotFound??notFoundHandler()),this.runtime.setErrorHandler(this.app,this.options.onError??errorHandler())}async registerOnly(){await this.setup()}async start(){await this.setup();let g=globalThis;if(g.__kickjs_httpServer){this.httpServer=g.__kickjs_httpServer,log.debug(`Attached to Vite dev server`),g.__kickjs_app_shutdown=()=>this.shutdown();for(let adapter of this.adapters){let ctx=this.adapterCtx(this.httpServer);await this.callHook(adapter.afterStart?.bind(adapter),ctx)}for(let plugin of this.plugins)await plugin.onReady?.(this.container);return}let port=this.options.port??parseInt(process.env.PORT||`3000`,10);this.httpServer=http.createServer(this.runtime.nodeHandler(this.app)),this.httpServer.on(`error`,err=>{throw err.code===`EADDRINUSE`&&(log.error(`Port ${port} is already in use. Kill the existing process or use a different port:\n PORT=${port+1} kick dev\n lsof -i :${port} # find what's using it\n kill <PID> # stop it`),process.exit(1)),err}),await new Promise((resolve,reject)=>{this.httpServer.listen(port,async()=>{try{log.info(`Server running on http://localhost:${port}`);for(let adapter of this.adapters){let afterCtx=this.adapterCtx(this.httpServer);await this.callHook(adapter.afterStart?.bind(adapter),afterCtx)}for(let plugin of this.plugins)await plugin.onReady?.(this.container);resolve()}catch(err){reject(err)}})})}async rebuild(){let prevApp=this.app,prevContainer=this.container,staleDisposables=drainDisposables();try{Container.reset(),this.container=Container.getInstance(),this.app=this.runtime.createApp({trustProxy:this.options.trustProxy}),await this.setup()}catch(err){log.error(err,`HMR rebuild failed, keeping previous app`),await runDisposables(drainDisposables());for(let d of staleDisposables)registerDisposable(d);this.app=prevApp,this.container=prevContainer;return}await runDisposables(staleDisposables),this.httpServer&&(this.httpServer.removeAllListeners(`request`),this.httpServer.on(`request`,this.runtime.nodeHandler(this.app)),log.debug(`HMR: app rebuilt and swapped`))}async shutdown(){if(this._shutdownInitiated){log.debug(`Shutdown already in progress, skipping duplicate call`);return}this._shutdownInitiated=!0,this._draining=!0,log.debug(`Shutting down — draining in-flight requests...`);let timeoutMs=this.options.shutdownTimeout??3e4,timer,forceExitPromise=timeoutMs>0?new Promise(resolve=>{timer=setTimeout(()=>resolve(`timeout`),timeoutMs),timer.unref()}):new Promise(()=>{});try{if(this.httpServer&&this.httpServer.close(()=>{}),this._inFlightRequests>0){log.debug(`Waiting for ${this._inFlightRequests} in-flight request(s) to complete...`);let drainPromise=new Promise(resolve=>{this._drainResolvers.push(()=>resolve(`drained`))});await Promise.race([drainPromise,forceExitPromise])===`timeout`?log.warn(`Shutdown timeout (${timeoutMs}ms) reached with ${this._inFlightRequests} request(s) still in-flight, forcing shutdown`):log.debug(`All in-flight requests completed`)}let results=await Promise.allSettled([...this.plugins.map(plugin=>Promise.resolve(plugin.shutdown?.())),...this.adapters.map(adapter=>Promise.resolve(adapter.shutdown?.()))]);for(let result of results)result.status===`rejected`&&log.error({err:result.reason},`Adapter shutdown failed`);await disposeAll(),this.container.flushChanges()}finally{timer&&clearTimeout(timer)}}getRuntimeApp(){return this.app}getActiveRuntime(){return{name:this.runtime.name,capabilities:this.runtime.capabilities}}getExpressApp(){return this.app}getAdapters(){return this.adapters}getPlugins(){return this.plugins}getContributors(){let out=[],ingest=(list,source,label)=>{if(list)for(let reg of list){let r=reg;if(r.key===void 0||r.key===null)continue;let key=typeof r.key==`string`?r.key:tokenName(r.key);out.push({key,source,label,dependsOn:Array.isArray(r.dependsOn)?r.dependsOn:[]})}};for(let adapter of this.adapters)ingest(adapter.contributors?.(),`adapter`,adapter.name??`adapter`);for(let plugin of this.plugins)ingest(plugin.contributors?.(),`plugin`,plugin.name??`plugin`);for(let{registration,label}of this._moduleContributors)ingest([registration],`module`,label);return ingest(this.options.contributors,`global`,`bootstrap`),out}getHttpServer(){return this.httpServer}shouldAutoMountRequestScope(){if(this.options.contextStore===`manual`)return!1;let userEntries=this.options.middlewares??this.options.middleware??[];for(let entry of userEntries)if(isRequestScopeMiddleware(typeof entry==`function`?entry:entry.handler))return!1;return!0}collectAdapterMiddleware(){let result={beforeGlobal:[],afterGlobal:[],beforeRoutes:[],afterRoutes:[]};for(let adapter of this.adapters){let entries=adapter.middleware?.()??[];for(let entry of entries)result[entry.phase??`afterGlobal`].push(entry)}return result}mountMiddlewareList(entries){for(let entry of entries){if(entry.path===void 0){this.runtime.useConnect(this.app,entry.handler);continue}this.runtime.useConnect(this.app,entry.handler,{path:entry.path})}}mountMiddlewareEntry(entry){typeof entry==`function`?this.runtime.useConnect(this.app,entry):this.runtime.useConnect(this.app,entry.handler,{path:entry.path})}requestTrackingMiddleware(){return(_req,res,next)=>{this._inFlightRequests++;let onFinish=()=>{if(res.removeListener(`finish`,onFinish),res.removeListener(`close`,onFinish),this._inFlightRequests--,this._draining&&this._inFlightRequests===0){for(let resolve of this._drainResolvers)resolve();this._drainResolvers=[]}};res.on(`finish`,onFinish),res.on(`close`,onFinish),next()}}mountHealthEndpoints(){let http=this.adapterHttp();http.route(`GET`,`/health/live`,ctx=>{this._draining?ctx.res.status(503).json({status:`draining`,uptime:process.uptime()}):ctx.json({status:`ok`,uptime:process.uptime()})}),http.route(`GET`,`/health/ready`,async ctx=>{if(this._draining){ctx.res.status(503).json({status:`draining`,checks:[]});return}let adaptersWithHealth=this.adapters.filter(a=>a.onHealthCheck),results=(await Promise.allSettled(adaptersWithHealth.map(a=>a.onHealthCheck()))).map((c,i)=>c.status===`fulfilled`?c.value:{name:adaptersWithHealth[i].name??`unknown`,status:`down`}),healthy=results.every(r=>r.status===`up`);ctx.res.status(healthy?200:503).json({status:healthy?`ready`:`degraded`,checks:results})})}};export{DuplicateMountNameError as a,mountSort as c,materializeRouter as i,buildRoutes as n,MissingMountDepError as o,expressRuntime as r,MountCycleError as s,Application as t};
|
|
12
|
+
//# sourceMappingURL=application-Cl0JlmNY.mjs.map
|