@forinda/kickjs 6.2.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/{adapter-DCfEFZMY.d.mts → adapter-stSpsUHs.d.mts} +33 -10
- package/dist/{adapter-DCfEFZMY.d.mts.map → adapter-stSpsUHs.d.mts.map} +1 -1
- package/dist/{application-DS7t40r-.mjs → application-CHYTI1Q_.mjs} +3 -3
- package/dist/{application-DS7t40r-.mjs.map → application-CHYTI1Q_.mjs.map} +1 -1
- package/dist/{application-p8RRz7p6.d.mts → application-C_KlrNoH.d.mts} +2 -2
- package/dist/{application-p8RRz7p6.d.mts.map → application-C_KlrNoH.d.mts.map} +1 -1
- package/dist/{bootstrap-JXdD0wVC.d.mts → bootstrap-BgffgFNX.d.mts} +2 -2
- package/dist/{bootstrap-JXdD0wVC.d.mts.map → bootstrap-BgffgFNX.d.mts.map} +1 -1
- package/dist/{bootstrap-DESuFm-t.mjs → bootstrap-sB0dlLu7.mjs} +3 -3
- package/dist/{bootstrap-DESuFm-t.mjs.map → bootstrap-sB0dlLu7.mjs.map} +1 -1
- package/dist/config/index.d.mts +1 -1
- package/dist/config/index.mjs +2 -2
- package/dist/{config-CqN6u5CP.mjs → config-DqO6gB-n.mjs} +3 -3
- package/dist/{config-CqN6u5CP.mjs.map → config-DqO6gB-n.mjs.map} +1 -1
- package/dist/{container-CkcVS_gA.mjs → container-C522k8AX.mjs} +3 -3
- package/dist/{container-CkcVS_gA.mjs.map → container-C522k8AX.mjs.map} +1 -1
- package/dist/{context-Cd-p7DfC.mjs → context-Cmnmn68a.mjs} +3 -3
- package/dist/{context-Cd-p7DfC.mjs.map → context-Cmnmn68a.mjs.map} +1 -1
- package/dist/{contributor-runner-BP9rOU_2.mjs → contributor-runner-C4qFEVIz.mjs} +2 -2
- package/dist/{contributor-runner-BP9rOU_2.mjs.map → contributor-runner-C4qFEVIz.mjs.map} +1 -1
- package/dist/core/adapter.d.mts +1 -1
- package/dist/core/adapter.mjs +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.d.mts +1 -1
- package/dist/core/decorators.mjs +2 -2
- package/dist/core/decorators.mjs.map +1 -1
- 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-BBnRIW_2.mjs → core-3S12kJ7Q.mjs} +3 -3
- package/dist/{core-BBnRIW_2.mjs.map → core-3S12kJ7Q.mjs.map} +1 -1
- package/dist/{csrf-CrChcN0K.mjs → csrf-CbB5oAPn.mjs} +2 -2
- package/dist/{csrf-CrChcN0K.mjs.map → csrf-CbB5oAPn.mjs.map} +1 -1
- package/dist/{decorators-DKjpujFp.d.mts → decorators-wEJBqXHg.d.mts} +9 -2
- package/dist/{decorators-DKjpujFp.d.mts.map → decorators-wEJBqXHg.d.mts.map} +1 -1
- package/dist/{disposables-msQG0AHt.mjs → disposables-BBTIbZkX.mjs} +2 -2
- package/dist/{disposables-msQG0AHt.mjs.map → disposables-BBTIbZkX.mjs.map} +1 -1
- package/dist/{env-CrvPEW3K.mjs → env-Cj5QLqnZ.mjs} +3 -3
- package/dist/{env-CrvPEW3K.mjs.map → env-Cj5QLqnZ.mjs.map} +1 -1
- package/dist/{handler-BMUwLMu_.mjs → handler-db1-nMd6.mjs} +3 -3
- package/dist/{handler-BMUwLMu_.mjs.map → handler-db1-nMd6.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.mjs +2 -2
- package/dist/http/middleware/error-handler.mjs +2 -2
- package/dist/http/middleware/helmet.mjs +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-ChK5rOgq.d.mts → index-D98NLfS5.d.mts} +2 -2
- package/dist/{index-ChK5rOgq.d.mts.map → index-D98NLfS5.d.mts.map} +1 -1
- package/dist/index.d.mts +11 -11
- package/dist/index.mjs +2 -2
- package/dist/{metadata-WlPWz6fi.mjs → metadata-W54KhZoU.mjs} +2 -2
- package/dist/{metadata-WlPWz6fi.mjs.map → metadata-W54KhZoU.mjs.map} +1 -1
- package/dist/{module-registry-DmTQjSdD.mjs → module-registry-BbYVBwD9.mjs} +2 -2
- package/dist/{module-registry-DmTQjSdD.mjs.map → module-registry-BbYVBwD9.mjs.map} +1 -1
- package/dist/{query-B2w_8bwe.mjs → query-B0ucxuU0.mjs} +2 -2
- package/dist/{query-B2w_8bwe.mjs.map → query-B0ucxuU0.mjs.map} +1 -1
- package/dist/{reply-Elm9mc8Z.d.mts → reply-2CvBP_Sl.d.mts} +2 -2
- package/dist/{reply-Elm9mc8Z.d.mts.map → reply-2CvBP_Sl.d.mts.map} +1 -1
- package/dist/{reply-Dh15A_0R.mjs → reply-DI4EqF0R.mjs} +3 -3
- package/dist/{reply-Dh15A_0R.mjs.map → reply-DI4EqF0R.mjs.map} +1 -1
- package/dist/{rolldown-runtime-C4pdyXoH.mjs → rolldown-runtime-Dv-xQPN8.mjs} +1 -1
- package/dist/{router-builder-BHTp3zL3.d.mts → router-builder-BK7yPm89.d.mts} +2 -2
- package/dist/{router-builder-BHTp3zL3.d.mts.map → router-builder-BK7yPm89.d.mts.map} +1 -1
- package/dist/{spa-D8I4YnpL.d.mts → spa-BwO1qOuA.d.mts} +2 -2
- package/dist/{spa-D8I4YnpL.d.mts.map → spa-BwO1qOuA.d.mts.map} +1 -1
- package/dist/{upload-CUyZ0zNt.d.mts → upload-CIZc803m.d.mts} +2 -2
- package/dist/{upload-CUyZ0zNt.d.mts.map → upload-CIZc803m.d.mts.map} +1 -1
- package/dist/{upload-config-B6vGWI0_.mjs → upload-config-D8gsl_ox.mjs} +2 -2
- package/dist/{upload-config-B6vGWI0_.mjs.map → upload-config-D8gsl_ox.mjs.map} +1 -1
- package/dist/{views-PFf-CBvN.d.mts → views-w0EPrhui.d.mts} +3 -3
- package/dist/{views-PFf-CBvN.d.mts.map → views-w0EPrhui.d.mts.map} +1 -1
- package/dist/web.d.mts +3 -3
- package/dist/web.d.mts.map +1 -1
- package/dist/web.mjs +2 -2
- package/dist/web.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,6 +132,20 @@ export const app = await bootstrap({ modules, runtime: fastifyRuntime() })
|
|
|
132
132
|
|
|
133
133
|
`kick new --runtime express|fastify|h3` scaffolds the right peers. File uploads (`@FileUpload` → `ctx.file` / `ctx.files`) and the rest of the surface work the same on all three. See [HTTP Runtimes](https://kickjs.app/guide/http-runtimes.html).
|
|
134
134
|
|
|
135
|
+
Two web-standard entries sit alongside them (h3 v2 engine — additive, the v1 runtime is untouched):
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { h3WebRuntime } from '@forinda/kickjs/h3-web' // bootstrap() on node, WHATWG pipeline
|
|
139
|
+
import { createWebApp } from '@forinda/kickjs/web' // fetch(Request) → Response — Workers / Bun / Deno
|
|
140
|
+
import * as h3 from 'h3' // v2 — passed in: edge bundlers have no createRequire
|
|
141
|
+
import { modules } from './modules'
|
|
142
|
+
|
|
143
|
+
const app = createWebApp({ h3, modules })
|
|
144
|
+
export default { fetch: (req: Request) => app.fetch(req) }
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
See [Edge Deployment](https://kickjs.app/guide/edge-deployment.html).
|
|
148
|
+
|
|
135
149
|
## Project Layout
|
|
136
150
|
|
|
137
151
|
`kick new` produces this convention; everything except the bootstrap entry is configurable via `kick.config.ts`:
|
|
@@ -157,6 +171,7 @@ vite.config.ts # Vite + KickJS HMR
|
|
|
157
171
|
## Core Concepts
|
|
158
172
|
|
|
159
173
|
- **Pluggable HTTP runtimes** — one `HttpRuntime` seam over Express (default), Fastify, or h3. Swap the engine in one line; everything above stays the same. See [HTTP Runtimes](https://kickjs.app/guide/http-runtimes.html).
|
|
174
|
+
- **Return-value handlers + typed client** — `return` the payload (`reply(201, body)` for other statuses) and the response type flows through `kick typegen` into `KickRoutes.Api`, consumed by [`@forinda/kickjs-client`](https://kickjs.app/guide/typed-client.html) on the frontend. Declare `{ response: schema }` on a route and the same contract feeds the OpenAPI success response. See [Controllers](https://kickjs.app/guide/controllers.html#return-value-handlers), [Typed Client](https://kickjs.app/guide/typed-client.html).
|
|
160
175
|
- **First-class database** — `kick/db`: code-first schema, fully typed queries, and migrations for PostgreSQL / SQLite / MySQL. `kick add db` (or `pg` / `sqlite` / `mysql`). See [Database](https://kickjs.app/guide/database/).
|
|
161
176
|
- **Custom DI container** — three scopes (singleton / transient / request), slash-delimited tokens (`createToken<T>('app/users/repository')`), constructor + property injection. No external DI dep. See [Dependency Injection](https://kickjs.app/guide/dependency-injection.html).
|
|
162
177
|
- **Factory-first** — `defineAdapter()`, `definePlugin()`, `defineModule()`, `defineHttpContextDecorator()`. No class hierarchies to inherit from. See [Adapters](https://kickjs.app/guide/adapters.html), [Plugins](https://kickjs.app/guide/plugins.html).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as Constructor, o as MaybePromise } from "./interfaces-CayXPOAf.mjs";
|
|
3
3
|
import { s as InjectionToken, t as Container } from "./container-iED1swkd.mjs";
|
|
4
|
-
import { g as FileUploadConfig, k as RouteDefinition, x as MiddlewareHandler } from "./decorators-
|
|
4
|
+
import { g as FileUploadConfig, k as RouteDefinition, x as MiddlewareHandler } from "./decorators-wEJBqXHg.mjs";
|
|
5
5
|
import { _ as ExecutionContext, a as AnyContributorRegistration, d as ContributorRegistrations, r as AppModuleEntry, t as AppModule, v as MetaValue } from "./app-module-BwYtACD6.mjs";
|
|
6
6
|
import { i as ProblemDetails } from "./errors-n0H96eEz.mjs";
|
|
7
7
|
import { S as QueryFieldConfig, T as TypedParsedQuery, t as ParseQueryOptions } from "./index-BtWJ9SLP.mjs";
|
|
@@ -1624,26 +1624,49 @@ declare class RequestContext<TBody = any, TParams = any, TQuery = any> implement
|
|
|
1624
1624
|
* Start an SSE (Server-Sent Events) stream.
|
|
1625
1625
|
* Sets the correct headers and returns helpers to send events.
|
|
1626
1626
|
*
|
|
1627
|
+
* Pass a payload type to get typed sends — and `return sse` from the
|
|
1628
|
+
* handler so `kick typegen` carries the event type into
|
|
1629
|
+
* `KickRoutes.Api`, where `@forinda/kickjs-client`'s `api.stream()`
|
|
1630
|
+
* picks it up (the returned handler is ignored at runtime — the
|
|
1631
|
+
* response is already streaming).
|
|
1632
|
+
*
|
|
1627
1633
|
* @example
|
|
1628
1634
|
* ```ts
|
|
1635
|
+
* interface Tick { time: string }
|
|
1636
|
+
*
|
|
1629
1637
|
* @Get('/events')
|
|
1630
1638
|
* async stream(ctx: RequestContext) {
|
|
1631
|
-
* const sse = ctx.sse()
|
|
1639
|
+
* const sse = ctx.sse<Tick>()
|
|
1632
1640
|
*
|
|
1633
1641
|
* const interval = setInterval(() => {
|
|
1634
1642
|
* sse.send({ time: new Date().toISOString() }, 'tick')
|
|
1635
1643
|
* }, 1000)
|
|
1636
1644
|
*
|
|
1637
1645
|
* sse.onClose(() => clearInterval(interval))
|
|
1646
|
+
* return sse // typed as SseHandler<Tick> → response inference
|
|
1638
1647
|
* }
|
|
1639
1648
|
* ```
|
|
1640
1649
|
*/
|
|
1641
|
-
sse():
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1650
|
+
sse<T = unknown>(): SseHandler<T>;
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* The handle {@link RequestContext.sse} returns. The optional phantom
|
|
1654
|
+
* `__sse` property carries the event payload type STRUCTURALLY — never set
|
|
1655
|
+
* at runtime — so `kick typegen`'s response inference (handler `return sse`)
|
|
1656
|
+
* flows it into `KickRoutes.Api`, and `@forinda/kickjs-client` detects SSE
|
|
1657
|
+
* routes without importing any server types.
|
|
1658
|
+
*/
|
|
1659
|
+
interface SseHandler<T = unknown> {
|
|
1660
|
+
/** Phantom event-payload type marker — never assigned at runtime. */
|
|
1661
|
+
readonly __sse?: T;
|
|
1662
|
+
/** Send an SSE event with optional event name and id. */
|
|
1663
|
+
send(data: T, event?: string, id?: string): void;
|
|
1664
|
+
/** Send a comment line (keeps the connection alive through proxies). */
|
|
1665
|
+
comment(text: string): void;
|
|
1666
|
+
/** Register a callback for client disconnect. */
|
|
1667
|
+
onClose(fn: () => void): void;
|
|
1668
|
+
/** End the SSE stream. */
|
|
1669
|
+
close(): void;
|
|
1647
1670
|
}
|
|
1648
1671
|
/**
|
|
1649
1672
|
* Short alias for `RequestContext` parameterised by a route shape.
|
|
@@ -2140,5 +2163,5 @@ interface AppAdapter {
|
|
|
2140
2163
|
/** Constructor type for AppAdapter classes */
|
|
2141
2164
|
type AppAdapterClass = new () => AppAdapter;
|
|
2142
2165
|
//#endregion
|
|
2143
|
-
export {
|
|
2144
|
-
//# sourceMappingURL=adapter-
|
|
2166
|
+
export { MissingContributorError as $, GroupAssetKeysOptions as A, BuildContext as At, MountCycleError as B, KickJsPluginRegistry as Bt, Ctx as C, disposeAll as Ct, SseHandler as D, DefineModuleOptions as Dt, RouteShape as E, defineModules as Et, AdapterFactory as F, KickPlugin as Ft, runContributors as G, MountSortItem as H, IntrospectFn as Ht, DefineAdapterOptions as I, ModuleRegistry as It, ContributorSource as J, BuildPipelineOptions as K, defineAdapter as L, MutableModuleRegistry as Lt, groupAssetKeys as M, PluginAsyncOptions as Mt, stripExt as N, PluginFactory as Nt, AssetKeyPair as O, ModuleFactory as Ot, AdapterAsyncOptions as P, definePlugin as Pt, DuplicateContributorError as Q, DuplicateMountNameError as R, AugmentationMeta as Rt, UseConnectOptions as S, Disposable as St, RequestContext as T, ModuleList as Tt, mountSort as U, IntrospectionKind as Ut, MountKind as V, defineAugmentation as Vt, RunContributorsOptions as W, IntrospectionSnapshot as Wt, buildPipeline as X, SourcedRegistration as Y, ContributorCycleError as Z, RouteTable as _, setMethodMeta as _t, MiddlewarePath as a, getClassMeta as at, RuntimeResponse as b, KickErrorInit as bt, AdapterHttp as c, getMetaRecord as ct, ExpressRuntimeTypes as d, hasClassMeta as dt, CircuitBreaker as et, HttpRuntime as f, pushClassMeta as ft, RouteMethod as g, setInMetaRecord as gt, RouteMeta as h, setInMetaMap as ht, AppAdapterClass as i, CircuitOpenError as it, GroupAssetKeysResult as j, DefinePluginOptions as jt, AssetKeyStrategy as k, defineModule as kt, ConnectMiddleware as l, getMethodMeta as lt, RouteEntry as m, setClassMeta as mt, AdapterMiddleware as n, CircuitBreakerState as nt, MiddlewarePhase as o, getClassMetaOrUndefined as ot, KickRuntimeRegister as p, pushMethodMeta as pt, ContributorPipeline as q, AppAdapter as r, CircuitBreakerStats as rt, ActiveRuntime as s, getMetaMap as st, AdapterContext as t, CircuitBreakerOptions as tt, CtxHandler as u, getMethodMetaOrUndefined as ut, RuntimeAppOptions as v, FormatKickErrorOptions as vt, DeepReadonly as w, registerDisposable as wt, RuntimeTypeMap as x, formatKickError as xt, RuntimeCapabilities as y, KickError as yt, MissingMountDepError as z, KickJsPluginName as zt };
|
|
2167
|
+
//# sourceMappingURL=adapter-stSpsUHs.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-DCfEFZMY.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/disposables.ts","../src/core/kick-error.ts","../src/core/metadata.ts","../src/core/circuit-breaker.ts","../src/core/context-errors.ts","../src/core/contributor-pipeline.ts","../src/core/contributor-runner.ts","../src/core/mount-sort.ts","../src/core/define-adapter.ts","../src/core/asset-keys.ts","../src/http/context.ts","../src/http/runtime.ts","../src/core/adapter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;UAAiB,qBAAA;EA4BC;;;;;;;;;EAlBhB,eAAA;EAawC;EAXxC,IAAA;EAgBU;EAdV,IAAA,EAAM,iBAAA;EAgBK;EAdX,OAAA;EAuBU;;;;EAlBV,KAAA,GAAQ,MAAA;EAyBE;EAvBV,MAAA;IAAW,QAAA;IAA6B,QAAA;EAAA;EAuBe;;;;EAlBvD,OAAA,GAAU,MAAA;EAkBqD;EAhB/D,WAAA;AAAA;;;;AC3BF;;;KDoCY,iBAAA;ACpCyB;AAUrC;;;;AAVqC,KD2CzB,YAAA,SAAqB,qBAAA,GAAwB,OAAA,CAAQ,qBAAA;;;;;;;;;;;;;;;AA9CjE;;;;;;;;UCGiB,oBAAA;;;;;;;;;KAUL,gBAAA,SAAyB,oBAAA,gCAE3B,oBAAoB;;;;ADejB;AASb;;;;AAA6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BAAA;EhB2CkB;;;;EgBrCvC,UAAA,KAAe,iBAAA;;;;Af7JjB;;;;;;EewKE,YAAA,KAAiB,wBAAA;EfvJ+B;;;;Ee6JhD,WAAA,EAAa,GAAA,EAAK,cAAA,UAAwB,OAAA;Ef5K1C;;;;EekLA,YAAA,EAAc,eAAA,EAAiB,WAAA,EAAa,SAAA;EftKjC;;;;;;;;;;AAG+C;AAS5D;EewKE,WAAA,EAAa,GAAA,EAAK,cAAA,UAAwB,OAAA;;;AftKpC;AAYR;;;;;;;;;;;Ee0KE,UAAA,EAAY,GAAA,EAAK,cAAA,UAAwB,OAAA;EfxKzC;;;;Ee8KA,aAAA,KAAkB,OAAA;IAAU,IAAA;IAAc,MAAA;EAAA;EftKd;EeyK5B,QAAA,KAAa,YAAA;EfxKK;;;;;;;;;;;;EesLlB,UAAA,KAAe,qBAAA,GAAwB,OAAA,CAAQ,qBAAA;EflLlB;;;;;;;;;;Ee8L7B,YAAA;AAAA;;KAIU,eAAA,aAA4B,UAAU"}
|
|
1
|
+
{"version":3,"file":"adapter-stSpsUHs.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/disposables.ts","../src/core/kick-error.ts","../src/core/metadata.ts","../src/core/circuit-breaker.ts","../src/core/context-errors.ts","../src/core/contributor-pipeline.ts","../src/core/contributor-runner.ts","../src/core/mount-sort.ts","../src/core/define-adapter.ts","../src/core/asset-keys.ts","../src/http/context.ts","../src/http/runtime.ts","../src/core/adapter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;UAAiB,qBAAA;EA4BC;;;;;;;;;EAlBhB,eAAA;EAawC;EAXxC,IAAA;EAgBU;EAdV,IAAA,EAAM,iBAAA;EAgBK;EAdX,OAAA;EAuBU;;;;EAlBV,KAAA,GAAQ,MAAA;EAyBE;EAvBV,MAAA;IAAW,QAA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felix Orinda
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import{METADATA}from"./core/interfaces.mjs";import{n as tokenName,o as moduleRouteMissingControllerError,t as Container}from"./container-CkcVS_gA.mjs";import{Logger,createLogger}from"./core/logger.mjs";import{t as getClassMeta}from"./metadata-WlPWz6fi.mjs";import{g as mountSort}from"./core-BBnRIW_2.mjs";import{t as MutableModuleRegistry}from"./module-registry-DmTQjSdD.mjs";import{i as runDisposables,n as drainDisposables,r as registerDisposable,t as disposeAll}from"./disposables-msQG0AHt.mjs";import{normalizePath}from"./core/path.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-Cd-p7DfC.mjs";import{o as isRequestScopeMiddleware,s as requestScopeMiddleware,t as applyHandlerResult}from"./reply-Dh15A_0R.mjs";import{_setExternalContributorSources,buildRouteTable}from"./http/router-builder.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";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=[];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)this.runtime.mountRoutes(this.app,[{mountPath,routes:buildRouteTable(route.controller)}]);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{materializeRouter as i,buildRoutes as n,expressRuntime as r,Application as t};
|
|
12
|
-
//# sourceMappingURL=application-
|
|
11
|
+
import{METADATA}from"./core/interfaces.mjs";import{n as tokenName,o as moduleRouteMissingControllerError,t as Container}from"./container-C522k8AX.mjs";import{Logger,createLogger}from"./core/logger.mjs";import{t as getClassMeta}from"./metadata-W54KhZoU.mjs";import{g as mountSort}from"./core-3S12kJ7Q.mjs";import{t as MutableModuleRegistry}from"./module-registry-BbYVBwD9.mjs";import{i as runDisposables,n as drainDisposables,r as registerDisposable,t as disposeAll}from"./disposables-BBTIbZkX.mjs";import{normalizePath}from"./core/path.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-Cmnmn68a.mjs";import{o as isRequestScopeMiddleware,s as requestScopeMiddleware,t as applyHandlerResult}from"./reply-DI4EqF0R.mjs";import{_setExternalContributorSources,buildRouteTable}from"./http/router-builder.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";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=[];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)this.runtime.mountRoutes(this.app,[{mountPath,routes:buildRouteTable(route.controller)}]);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{materializeRouter as i,buildRoutes as n,expressRuntime as r,Application as t};
|
|
12
|
+
//# sourceMappingURL=application-CHYTI1Q_.mjs.map
|