@forinda/kickjs 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-C1w_xt08.d.mts → adapter-0r2uRCD3.d.mts} +2 -2
- package/dist/{adapter-C1w_xt08.d.mts.map → adapter-0r2uRCD3.d.mts.map} +1 -1
- package/dist/app-module-CzlIIjO3.d.mts +92 -0
- package/dist/app-module-CzlIIjO3.d.mts.map +1 -0
- package/dist/{application-BTRI4aBd.d.mts → application-CaEYca9E.d.mts} +34 -7
- package/dist/application-CaEYca9E.d.mts.map +1 -0
- package/dist/application-Zt956jNS.mjs +12 -0
- package/dist/application-Zt956jNS.mjs.map +1 -0
- package/dist/bootstrap-CmFQq1ar.mjs +12 -0
- package/dist/{bootstrap-kPcmbbWe.mjs.map → bootstrap-CmFQq1ar.mjs.map} +1 -1
- package/dist/{bootstrap-B4YrBipl.d.mts → bootstrap-Db8k2-21.d.mts} +2 -2
- package/dist/{bootstrap-B4YrBipl.d.mts.map → bootstrap-Db8k2-21.d.mts.map} +1 -1
- package/dist/config/index.mjs +2 -4
- package/dist/config-DDz5LuWw.mjs +12 -0
- package/dist/{config-DxEREQmR.mjs.map → config-DDz5LuWw.mjs.map} +1 -1
- package/dist/container-DrioVLNv.mjs +12 -0
- package/dist/{container-SMnB5yeT.mjs.map → container-DrioVLNv.mjs.map} +1 -1
- package/dist/context-B4BeGq1B.mjs +12 -0
- package/dist/context-B4BeGq1B.mjs.map +1 -0
- package/dist/{context-Ymvv-85x.d.mts → context-BAdAV-zO.d.mts} +48 -11
- package/dist/context-BAdAV-zO.d.mts.map +1 -0
- package/dist/{context-decorator-Bca_BoRK.d.mts → context-decorator-BgdDd-6X.d.mts} +19 -4
- package/dist/{context-decorator-Bca_BoRK.d.mts.map → context-decorator-BgdDd-6X.d.mts.map} +1 -1
- package/dist/core/adapter.d.mts +1 -1
- package/dist/core/adapter.mjs +2 -2
- package/dist/core/app-module.d.mts +2 -2
- package/dist/core/app-module.mjs +2 -2
- package/dist/core/cache.mjs +2 -103
- package/dist/core/cache.mjs.map +1 -1
- package/dist/core/container.mjs +2 -3
- package/dist/core/cron.mjs +2 -32
- package/dist/core/cron.mjs.map +1 -1
- package/dist/core/decorators.mjs +2 -285
- package/dist/core/decorators.mjs.map +1 -1
- package/dist/core/errors.mjs +2 -110
- package/dist/core/errors.mjs.map +1 -1
- package/dist/core/interfaces.mjs +2 -53
- package/dist/core/interfaces.mjs.map +1 -1
- package/dist/core/logger.mjs +2 -207
- package/dist/core/logger.mjs.map +1 -1
- package/dist/core/path.mjs +2 -35
- package/dist/core/path.mjs.map +1 -1
- package/dist/core/plugin.d.mts +1 -1
- package/dist/core/plugin.mjs +2 -2
- package/dist/core/reactivity.mjs +2 -179
- package/dist/core/reactivity.mjs.map +1 -1
- package/dist/core-MvABl8Cl.mjs +13 -0
- package/dist/core-MvABl8Cl.mjs.map +1 -0
- package/dist/env-CObTuGZ3.mjs +12 -0
- package/dist/{env-C4Yr6nN8.mjs.map → env-CObTuGZ3.mjs.map} +1 -1
- package/dist/http/application.d.mts +1 -1
- package/dist/http/application.mjs +2 -3
- package/dist/http/bootstrap.d.mts +1 -1
- package/dist/http/bootstrap.mjs +2 -3
- package/dist/http/context.d.mts +2 -2
- package/dist/http/context.mjs +2 -3
- package/dist/http/middleware/cors.mjs +2 -73
- package/dist/http/middleware/cors.mjs.map +1 -1
- package/dist/http/middleware/csrf.mjs +2 -62
- package/dist/http/middleware/csrf.mjs.map +1 -1
- package/dist/http/middleware/error-handler.mjs +2 -54
- package/dist/http/middleware/error-handler.mjs.map +1 -1
- package/dist/http/middleware/helmet.mjs +2 -41
- package/dist/http/middleware/helmet.mjs.map +1 -1
- package/dist/http/middleware/rate-limit.mjs +2 -91
- package/dist/http/middleware/rate-limit.mjs.map +1 -1
- package/dist/http/middleware/request-id.mjs +2 -25
- package/dist/http/middleware/request-id.mjs.map +1 -1
- package/dist/http/middleware/request-logger.mjs +2 -39
- package/dist/http/middleware/request-logger.mjs.map +1 -1
- package/dist/http/middleware/session.mjs +2 -167
- package/dist/http/middleware/session.mjs.map +1 -1
- package/dist/http/middleware/spa.d.mts +1 -1
- package/dist/http/middleware/spa.mjs +2 -98
- package/dist/http/middleware/spa.mjs.map +1 -1
- package/dist/http/middleware/upload.mjs +2 -181
- package/dist/http/middleware/upload.mjs.map +1 -1
- package/dist/http/middleware/validate.mjs +2 -68
- package/dist/http/middleware/validate.mjs.map +1 -1
- package/dist/http/middleware/views.d.mts +1 -1
- package/dist/http/middleware/views.mjs +2 -56
- package/dist/http/middleware/views.mjs.map +1 -1
- package/dist/http/query/index.mjs +2 -3
- package/dist/http/router-builder.d.mts +1 -1
- package/dist/http/router-builder.mjs +2 -105
- package/dist/http/router-builder.mjs.map +1 -1
- package/dist/{index-DvZfBNIf.d.mts → index-D-Wb23e6.d.mts} +264 -86
- package/dist/index-D-Wb23e6.d.mts.map +1 -0
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +2 -171
- package/dist/index.mjs.map +1 -1
- package/dist/metadata-WTmSU6Sf.mjs +12 -0
- package/dist/{metadata-CdYaU-XM.mjs.map → metadata-WTmSU6Sf.mjs.map} +1 -1
- package/dist/{plugin-DF8Xfv9Z.d.mts → plugin-JMkG7soG.d.mts} +102 -8
- package/dist/plugin-JMkG7soG.d.mts.map +1 -0
- package/dist/query-BmO0aBf6.mjs +12 -0
- package/dist/{query-nAYUgagU.mjs.map → query-BmO0aBf6.mjs.map} +1 -1
- package/dist/{router-builder-C7sXk_FG.d.mts → router-builder-CaQ629tw.d.mts} +2 -2
- package/dist/{router-builder-C7sXk_FG.d.mts.map → router-builder-CaQ629tw.d.mts.map} +1 -1
- package/dist/{spa-e4FIS2RB.d.mts → spa-CreyQc4N.d.mts} +2 -2
- package/dist/{spa-e4FIS2RB.d.mts.map → spa-CreyQc4N.d.mts.map} +1 -1
- package/dist/{views-DkNp9JJs.d.mts → views-1e3jQr5C.d.mts} +4 -4
- package/dist/{views-DkNp9JJs.d.mts.map → views-1e3jQr5C.d.mts.map} +1 -1
- package/package.json +2 -2
- package/dist/app-module-D6zL_V5S.d.mts +0 -50
- package/dist/app-module-D6zL_V5S.d.mts.map +0 -1
- package/dist/application-BTRI4aBd.d.mts.map +0 -1
- package/dist/application-Cna_2gex.mjs +0 -574
- package/dist/application-Cna_2gex.mjs.map +0 -1
- package/dist/bootstrap-kPcmbbWe.mjs +0 -195
- package/dist/config-DxEREQmR.mjs +0 -135
- package/dist/container-SMnB5yeT.mjs +0 -897
- package/dist/context-B0B3WQft.mjs +0 -348
- package/dist/context-B0B3WQft.mjs.map +0 -1
- package/dist/context-Ymvv-85x.d.mts.map +0 -1
- package/dist/core--a4XflX7.mjs +0 -820
- package/dist/core--a4XflX7.mjs.map +0 -1
- package/dist/env-C4Yr6nN8.mjs +0 -137
- package/dist/index-DvZfBNIf.d.mts.map +0 -1
- package/dist/metadata-CdYaU-XM.mjs +0 -76
- package/dist/plugin-DF8Xfv9Z.d.mts.map +0 -1
- package/dist/query-nAYUgagU.mjs +0 -164
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @forinda/kickjs v5.3.0
|
|
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 { i as parseQuery } from "./query-nAYUgagU.mjs";
|
|
12
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
13
|
-
//#region src/http/request-store.ts
|
|
14
|
-
/** AsyncLocalStorage instance shared across the framework */
|
|
15
|
-
const requestStore = new AsyncLocalStorage();
|
|
16
|
-
/**
|
|
17
|
-
* Get the current request store. Throws if called outside a request context.
|
|
18
|
-
* Used by the Container to resolve REQUEST-scoped dependencies.
|
|
19
|
-
*/
|
|
20
|
-
function getRequestStore() {
|
|
21
|
-
const store = requestStore.getStore();
|
|
22
|
-
if (!store) throw new Error("No active request context. REQUEST-scoped services can only be resolved during an HTTP request.");
|
|
23
|
-
return store;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Read a per-request `ContextMeta`-keyed value from outside a controller
|
|
27
|
-
* (services, repositories, anywhere with no `ctx` reference). Returns
|
|
28
|
-
* the augmented type for the key — `MetaValue<K>` — so consumers get the
|
|
29
|
-
* same static safety as `ctx.get(key)` without holding the context.
|
|
30
|
-
*
|
|
31
|
-
* Returns `undefined` outside an active request frame (background jobs,
|
|
32
|
-
* startup code, tests without `requestScopeMiddleware()`) — the helper
|
|
33
|
-
* is intentionally null-tolerant so calling it from a service that
|
|
34
|
-
* runs in both request and non-request paths doesn't throw.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* declare module '@forinda/kickjs' {
|
|
39
|
-
* interface ContextMeta { tenant: { id: string; name: string } }
|
|
40
|
-
* }
|
|
41
|
-
*
|
|
42
|
-
* @Service()
|
|
43
|
-
* class AuditService {
|
|
44
|
-
* log(action: string) {
|
|
45
|
-
* const tenant = getRequestValue('tenant') // typed: { id; name } | undefined
|
|
46
|
-
* db.audit.insert({ action, tenantId: tenant?.id })
|
|
47
|
-
* }
|
|
48
|
-
* }
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
function getRequestValue(key) {
|
|
52
|
-
return requestStore.getStore()?.values.get(key);
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/http/context.ts
|
|
56
|
-
/**
|
|
57
|
-
* Unified request/response abstraction passed to every controller method.
|
|
58
|
-
* Shields handlers from raw Express objects and provides convenience methods.
|
|
59
|
-
*
|
|
60
|
-
* Implements {@link ExecutionContext} so the transport-agnostic Context
|
|
61
|
-
* Contributor pipeline (#107) can run against this concrete HTTP context
|
|
62
|
-
* the same way it will run against future WS / queue / cron contexts.
|
|
63
|
-
*/
|
|
64
|
-
var RequestContext = class {
|
|
65
|
-
constructor(req, res, next) {
|
|
66
|
-
this.req = req;
|
|
67
|
-
this.res = res;
|
|
68
|
-
this.next = next;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Read-side accessor for the per-request metadata map.
|
|
72
|
-
*
|
|
73
|
-
* Returns the AsyncLocalStorage map (`requestStore.getStore().values`)
|
|
74
|
-
* shared with the Context Contributor pipeline when an ALS frame is
|
|
75
|
-
* active. Returns `null` outside any frame — read-side callers
|
|
76
|
-
* (`ctx.get`, `ctx.user`, `ctx.tenantId`, `ctx.roles`) treat that as
|
|
77
|
-
* "no metadata" and fall through to their `req.*` defaults. Reads
|
|
78
|
-
* never throw because outside an ALS frame nobody could have written
|
|
79
|
-
* via `ctx.set` anyway, so an empty answer is the truthful one.
|
|
80
|
-
*/
|
|
81
|
-
metadataReadOnly() {
|
|
82
|
-
return requestStore.getStore()?.values ?? null;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Write-side accessor for the per-request metadata map.
|
|
86
|
-
*
|
|
87
|
-
* Returns the same map as {@link metadataReadOnly} when an ALS frame
|
|
88
|
-
* is active. Throws otherwise — writing to a fallback map outside
|
|
89
|
-
* the ALS frame would silently lose data because other call sites
|
|
90
|
-
* (downstream contributors, request-logger, etc.) read from the
|
|
91
|
-
* canonical store and would never see it. Mount
|
|
92
|
-
* `requestScopeMiddleware()` (Application does this for you in
|
|
93
|
-
* `'auto'` mode) or wrap your test setup in
|
|
94
|
-
* `requestStore.run({...}, () => …)` to fix.
|
|
95
|
-
*/
|
|
96
|
-
metadataForWrite() {
|
|
97
|
-
const store = requestStore.getStore();
|
|
98
|
-
if (store) return store.values;
|
|
99
|
-
throw new Error("RequestContext.set called outside an AsyncLocalStorage frame. Mount requestScopeMiddleware() before constructing RequestContext, or wrap test setup in requestStore.run({ requestId, instances: new Map(), values: new Map() }, () => ...).");
|
|
100
|
-
}
|
|
101
|
-
get body() {
|
|
102
|
-
return this.req.body;
|
|
103
|
-
}
|
|
104
|
-
get params() {
|
|
105
|
-
return this.req.params;
|
|
106
|
-
}
|
|
107
|
-
get query() {
|
|
108
|
-
return this.req.query;
|
|
109
|
-
}
|
|
110
|
-
get headers() {
|
|
111
|
-
return this.req.headers;
|
|
112
|
-
}
|
|
113
|
-
get requestId() {
|
|
114
|
-
return this.req.requestId ?? this.req.headers["x-request-id"];
|
|
115
|
-
}
|
|
116
|
-
/** Session data (requires session middleware) */
|
|
117
|
-
get session() {
|
|
118
|
-
return this.req.session;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* The authenticated user set by AuthAdapter.
|
|
122
|
-
* Reads from the per-request metadata store first (`ctx.set('user', ...)`),
|
|
123
|
-
* then falls back to `req.user` (set directly by AuthAdapter middleware).
|
|
124
|
-
*
|
|
125
|
-
* Extend the `AuthUser` interface via module augmentation in `@forinda/kickjs-auth`
|
|
126
|
-
* to get full typing.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```ts
|
|
130
|
-
* @Get('/me')
|
|
131
|
-
* @Authenticated()
|
|
132
|
-
* getProfile(ctx: RequestContext) {
|
|
133
|
-
* const user = ctx.user
|
|
134
|
-
* if (!user) return ctx.notFound()
|
|
135
|
-
* return ctx.json({ user })
|
|
136
|
-
* }
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
get user() {
|
|
140
|
-
return this.metadataReadOnly()?.get("user") ?? this.req.user;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Tenant identifier for multi-tenant apps. Reads `user.tenantId` —
|
|
144
|
-
* populated either by `AuthAdapter.testMode({ tenantId })`, a tenant
|
|
145
|
-
* resolver middleware, or manually on the strategy's `mapPayload`.
|
|
146
|
-
*
|
|
147
|
-
* Augment `AuthUser` (or `ContextMeta['user']`) to widen the return
|
|
148
|
-
* type if your user shape guarantees a non-`string | undefined` id.
|
|
149
|
-
*/
|
|
150
|
-
get tenantId() {
|
|
151
|
-
return this.user?.tenantId;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Effective role list for the current user. Prefers `user.tenantRoles`
|
|
155
|
-
* (populated by `AuthAdapterOptions.roleResolver` under a tenant) and
|
|
156
|
-
* falls back to `user.roles`. Returns an empty array when the user is
|
|
157
|
-
* absent or the shape has neither field.
|
|
158
|
-
*/
|
|
159
|
-
get roles() {
|
|
160
|
-
const u = this.user;
|
|
161
|
-
return u?.tenantRoles ?? u?.roles ?? [];
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Parse the request query string into structured filters, sort, pagination, and search.
|
|
165
|
-
* Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).
|
|
166
|
-
*
|
|
167
|
-
* Generic over the field config: when passed an inline literal (or
|
|
168
|
-
* `as const`), `filters[].field` and `sort[].field` are narrowed to
|
|
169
|
-
* the exact whitelisted field names. Pass nothing or a non-literal
|
|
170
|
-
* config and you get the loose `string` fallback.
|
|
171
|
-
*
|
|
172
|
-
* @param fieldConfig - Optional whitelist for filterable, sortable, and searchable fields
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* ```ts
|
|
176
|
-
* @Get('/')
|
|
177
|
-
* async list(ctx: RequestContext) {
|
|
178
|
-
* const parsed = ctx.qs({
|
|
179
|
-
* filterable: ['status', 'priority'],
|
|
180
|
-
* sortable: ['createdAt', 'title'],
|
|
181
|
-
* } as const)
|
|
182
|
-
* parsed.filters[0].field // typed as 'status' | 'priority'
|
|
183
|
-
* parsed.sort[0].field // typed as 'createdAt' | 'title'
|
|
184
|
-
* }
|
|
185
|
-
* ```
|
|
186
|
-
*/
|
|
187
|
-
qs(fieldConfig) {
|
|
188
|
-
return parseQuery(this.req.query, fieldConfig);
|
|
189
|
-
}
|
|
190
|
-
/** Single uploaded file (requires @FileUpload({ mode: 'single' })) */
|
|
191
|
-
get file() {
|
|
192
|
-
return this.req.file;
|
|
193
|
-
}
|
|
194
|
-
/** Array of uploaded files (requires @FileUpload({ mode: 'array' })) */
|
|
195
|
-
get files() {
|
|
196
|
-
return this.req.files;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Read a value from the per-request metadata store.
|
|
200
|
-
*
|
|
201
|
-
* When `ContextMeta` has been augmented with a matching key, the return
|
|
202
|
-
* type is inferred automatically. For ad-hoc keys, pass a generic:
|
|
203
|
-
* `ctx.get<MyType>('custom')`.
|
|
204
|
-
*/
|
|
205
|
-
get(key) {
|
|
206
|
-
return this.metadataReadOnly()?.get(key);
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Write a value to the per-request metadata store. Throws when no
|
|
210
|
-
* AsyncLocalStorage frame is active — see {@link metadataForWrite}
|
|
211
|
-
* for why a silent fallback is the wrong default.
|
|
212
|
-
*/
|
|
213
|
-
set(key, value) {
|
|
214
|
-
this.metadataForWrite().set(key, value);
|
|
215
|
-
}
|
|
216
|
-
json(data, status = 200) {
|
|
217
|
-
return this.res.status(status).json(data);
|
|
218
|
-
}
|
|
219
|
-
created(data) {
|
|
220
|
-
return this.res.status(201).json(data);
|
|
221
|
-
}
|
|
222
|
-
noContent() {
|
|
223
|
-
return this.res.status(204).end();
|
|
224
|
-
}
|
|
225
|
-
notFound(message = "Not Found") {
|
|
226
|
-
return this.res.status(404).json({ message });
|
|
227
|
-
}
|
|
228
|
-
badRequest(message) {
|
|
229
|
-
return this.res.status(400).json({ message });
|
|
230
|
-
}
|
|
231
|
-
html(content, status = 200) {
|
|
232
|
-
return this.res.status(status).type("html").send(content);
|
|
233
|
-
}
|
|
234
|
-
download(buffer, filename, contentType = "application/octet-stream") {
|
|
235
|
-
this.res.setHeader("Content-Disposition", `attachment; filename="${filename}"`);
|
|
236
|
-
this.res.setHeader("Content-Type", contentType);
|
|
237
|
-
return this.res.send(buffer);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Render a template using the registered view engine (EJS, Pug, Handlebars, etc.).
|
|
241
|
-
* Requires a ViewAdapter to be configured in bootstrap().
|
|
242
|
-
*
|
|
243
|
-
* @param template - Template name (without extension, relative to viewsDir)
|
|
244
|
-
* @param data - Data to pass to the template
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* ```ts
|
|
248
|
-
* ctx.render('dashboard', { user, title: 'Dashboard' })
|
|
249
|
-
* ctx.render('emails/welcome', { name: 'Alice' })
|
|
250
|
-
* ```
|
|
251
|
-
*/
|
|
252
|
-
render(template, data = {}) {
|
|
253
|
-
return this.res.render(template, data);
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Parse query params and return a standardized paginated response.
|
|
257
|
-
* Calls `ctx.qs()` internally, then wraps your data with pagination meta.
|
|
258
|
-
*
|
|
259
|
-
* @param fetcher - Async function that receives ParsedQuery and returns `{ data, total }`
|
|
260
|
-
* @param fieldConfig - Optional whitelist for filterable, sortable, searchable fields
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* ```ts
|
|
264
|
-
* @Get('/')
|
|
265
|
-
* async list(ctx: RequestContext) {
|
|
266
|
-
* return ctx.paginate(
|
|
267
|
-
* async (parsed) => {
|
|
268
|
-
* const data = await db.select().from(users)
|
|
269
|
-
* .where(query.where).limit(parsed.pagination.limit)
|
|
270
|
-
* .offset(parsed.pagination.offset).all()
|
|
271
|
-
* const total = await db.select({ count: count() }).from(users).get()
|
|
272
|
-
* return { data, total: total?.count ?? 0 }
|
|
273
|
-
* },
|
|
274
|
-
* { filterable: ['name', 'role'], sortable: ['createdAt'] },
|
|
275
|
-
* )
|
|
276
|
-
* }
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
279
|
-
async paginate(fetcher, fieldConfig) {
|
|
280
|
-
const parsed = this.qs(fieldConfig);
|
|
281
|
-
const { data, total } = await fetcher(parsed);
|
|
282
|
-
const { page, limit } = parsed.pagination;
|
|
283
|
-
const totalPages = Math.ceil(total / limit) || 1;
|
|
284
|
-
const response = {
|
|
285
|
-
data,
|
|
286
|
-
meta: {
|
|
287
|
-
page,
|
|
288
|
-
limit,
|
|
289
|
-
total,
|
|
290
|
-
totalPages,
|
|
291
|
-
hasNext: page < totalPages,
|
|
292
|
-
hasPrev: page > 1
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
return this.json(response);
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Start an SSE (Server-Sent Events) stream.
|
|
299
|
-
* Sets the correct headers and returns helpers to send events.
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* ```ts
|
|
303
|
-
* @Get('/events')
|
|
304
|
-
* async stream(ctx: RequestContext) {
|
|
305
|
-
* const sse = ctx.sse()
|
|
306
|
-
*
|
|
307
|
-
* const interval = setInterval(() => {
|
|
308
|
-
* sse.send({ time: new Date().toISOString() }, 'tick')
|
|
309
|
-
* }, 1000)
|
|
310
|
-
*
|
|
311
|
-
* sse.onClose(() => clearInterval(interval))
|
|
312
|
-
* }
|
|
313
|
-
* ```
|
|
314
|
-
*/
|
|
315
|
-
sse() {
|
|
316
|
-
this.res.writeHead(200, {
|
|
317
|
-
"Content-Type": "text/event-stream",
|
|
318
|
-
"Cache-Control": "no-cache",
|
|
319
|
-
Connection: "keep-alive",
|
|
320
|
-
"X-Accel-Buffering": "no"
|
|
321
|
-
});
|
|
322
|
-
this.res.flushHeaders();
|
|
323
|
-
const closeCallbacks = [];
|
|
324
|
-
this.req.on("close", () => {
|
|
325
|
-
for (const cb of closeCallbacks) cb();
|
|
326
|
-
});
|
|
327
|
-
return {
|
|
328
|
-
send: (data, event, id) => {
|
|
329
|
-
if (id) this.res.write(`id: ${id}\n`);
|
|
330
|
-
if (event) this.res.write(`event: ${event}\n`);
|
|
331
|
-
this.res.write(`data: ${JSON.stringify(data)}\n\n`);
|
|
332
|
-
},
|
|
333
|
-
comment: (text) => {
|
|
334
|
-
this.res.write(`: ${text}\n\n`);
|
|
335
|
-
},
|
|
336
|
-
onClose: (fn) => {
|
|
337
|
-
closeCallbacks.push(fn);
|
|
338
|
-
},
|
|
339
|
-
close: () => {
|
|
340
|
-
this.res.end();
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
//#endregion
|
|
346
|
-
export { requestStore as i, getRequestStore as n, getRequestValue as r, RequestContext as t };
|
|
347
|
-
|
|
348
|
-
//# sourceMappingURL=context-B0B3WQft.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-B0B3WQft.mjs","names":[],"sources":["../src/http/request-store.ts","../src/http/context.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport type { MetaValue } from '../core/execution-context'\n\n/** Per-request storage for REQUEST-scoped DI and request context propagation */\nexport interface RequestStore {\n /** Unique request identifier */\n requestId: string\n /**\n * Per-request singleton cache for REQUEST-scoped services. Keys are\n * heterogeneous (class constructors, `InjectionToken` objects, raw\n * strings), so the map type stays `Map<any, any>`.\n */\n instances: Map<any, any>\n /**\n * Per-request key/value bag. Canonical backing store for\n * `RequestContext.set/get` and the Context Contributor pipeline (#107)\n * since Phase 3. Anything written here is visible to every concrete\n * execution context constructed for the same request, regardless of\n * which middleware/contributor wrote it.\n *\n * Keys are constrained to `string` per the locked decision in\n * `architecture.md` §20.12 (#4); the value type is `unknown` because\n * the concrete shape at each key is determined by the consumer's\n * `ContextMeta` augmentation, not by the store itself.\n *\n * Prefer the {@link getRequestValue} helper over reaching into this\n * map directly — it threads the augmented `ContextMeta` shape through\n * `MetaValue<K>` so consumers get typed reads without an `as` cast.\n * Writes should flow through `ctx.set(key, value)` or a Context\n * Contributor's return value — see the `setRequestValue` note below\n * for why this package intentionally does NOT ship a service-level\n * write helper.\n */\n values: Map<string, unknown>\n}\n\n/** AsyncLocalStorage instance shared across the framework */\nexport const requestStore = new AsyncLocalStorage<RequestStore>()\n\n/**\n * Get the current request store. Throws if called outside a request context.\n * Used by the Container to resolve REQUEST-scoped dependencies.\n */\nexport function getRequestStore(): RequestStore {\n const store = requestStore.getStore()\n if (!store) {\n throw new Error(\n 'No active request context. REQUEST-scoped services can only be resolved during an HTTP request.',\n )\n }\n return store\n}\n\n/**\n * Read a per-request `ContextMeta`-keyed value from outside a controller\n * (services, repositories, anywhere with no `ctx` reference). Returns\n * the augmented type for the key — `MetaValue<K>` — so consumers get the\n * same static safety as `ctx.get(key)` without holding the context.\n *\n * Returns `undefined` outside an active request frame (background jobs,\n * startup code, tests without `requestScopeMiddleware()`) — the helper\n * is intentionally null-tolerant so calling it from a service that\n * runs in both request and non-request paths doesn't throw.\n *\n * @example\n * ```ts\n * declare module '@forinda/kickjs' {\n * interface ContextMeta { tenant: { id: string; name: string } }\n * }\n *\n * @Service()\n * class AuditService {\n * log(action: string) {\n * const tenant = getRequestValue('tenant') // typed: { id; name } | undefined\n * db.audit.insert({ action, tenantId: tenant?.id })\n * }\n * }\n * ```\n */\nexport function getRequestValue<K extends string>(key: K): MetaValue<K> | undefined {\n return requestStore.getStore()?.values.get(key) as MetaValue<K> | undefined\n}\n\n// Intentionally NO `setRequestValue` export.\n//\n// Writes are deliberately context-scoped — only the controlled write\n// surfaces should mutate the per-request Map:\n//\n// 1. A Context Contributor's `resolve()` / `onError()` return value\n// (the runner does `ctx.set(reg.key, value)` on the contributor's\n// behalf). This is the canonical way to populate a key.\n// 2. A controller / middleware / contributor that holds a\n// `RequestContext` instance can call `ctx.set(key, value)`\n// directly. The write is auditable inline at the call site.\n//\n// Letting arbitrary services reach in and mutate the store from\n// anywhere produces \"spooky action at a distance\" — keys appear in\n// the request bag without an obvious source, and tracing which\n// service polluted what becomes a grep exercise. Services that need\n// to publish per-request state should return the value to the caller\n// (controller or contributor) and let *that* layer write it via\n// `ctx.set`. If a future need genuinely requires a service-level\n// write surface, expose a narrow function (`recordTrace`,\n// `markStartTime`) on a service that captures the side effect, not a\n// generic `setRequestValue`.\n","import type { Request, Response, NextFunction } from 'express'\nimport { type ContextMeta, type ExecutionContext, type MetaValue } from '../core/execution-context'\nimport { requestStore } from './request-store'\nimport {\n parseQuery,\n type QueryFieldConfig,\n type PaginatedResponse,\n type TypedParsedQuery,\n} from './query'\n\n/**\n * Re-export the augmentable {@link ContextMeta} registry from core/.\n * Declared in `core/execution-context.ts` so non-HTTP transports\n * (WS/queue/cron, V2) share one declaration site. Apps still augment\n * via the canonical `declare module '@forinda/kickjs'` form.\n */\nexport type { ContextMeta } from '../core/execution-context'\n\n/**\n * The shape of a single route entry in `KickRoutes`. Generated by\n * `kick typegen` and consumed via the `Ctx<T>` helper. Each field is\n * `unknown` by default and is filled in as the typegen learns more\n * about the route (URL params from the path, body/query from validation\n * schemas, etc.).\n */\nexport interface RouteShape {\n params?: unknown\n body?: unknown\n query?: unknown\n response?: unknown\n}\n\n/**\n * Unified request/response abstraction passed to every controller method.\n * Shields handlers from raw Express objects and provides convenience methods.\n *\n * Implements {@link ExecutionContext} so the transport-agnostic Context\n * Contributor pipeline (#107) can run against this concrete HTTP context\n * the same way it will run against future WS / queue / cron contexts.\n */\nexport class RequestContext<TBody = any, TParams = any, TQuery = any> implements ExecutionContext {\n constructor(\n public readonly req: Request,\n public readonly res: Response,\n public readonly next: NextFunction,\n ) {}\n\n /**\n * Read-side accessor for the per-request metadata map.\n *\n * Returns the AsyncLocalStorage map (`requestStore.getStore().values`)\n * shared with the Context Contributor pipeline when an ALS frame is\n * active. Returns `null` outside any frame — read-side callers\n * (`ctx.get`, `ctx.user`, `ctx.tenantId`, `ctx.roles`) treat that as\n * \"no metadata\" and fall through to their `req.*` defaults. Reads\n * never throw because outside an ALS frame nobody could have written\n * via `ctx.set` anyway, so an empty answer is the truthful one.\n */\n private metadataReadOnly(): Map<string, any> | null {\n return (requestStore.getStore()?.values as Map<string, any> | undefined) ?? null\n }\n\n /**\n * Write-side accessor for the per-request metadata map.\n *\n * Returns the same map as {@link metadataReadOnly} when an ALS frame\n * is active. Throws otherwise — writing to a fallback map outside\n * the ALS frame would silently lose data because other call sites\n * (downstream contributors, request-logger, etc.) read from the\n * canonical store and would never see it. Mount\n * `requestScopeMiddleware()` (Application does this for you in\n * `'auto'` mode) or wrap your test setup in\n * `requestStore.run({...}, () => …)` to fix.\n */\n private metadataForWrite(): Map<string, any> {\n const store = requestStore.getStore()\n if (store) return store.values as Map<string, any>\n throw new Error(\n 'RequestContext.set called outside an AsyncLocalStorage frame. ' +\n 'Mount requestScopeMiddleware() before constructing RequestContext, ' +\n 'or wrap test setup in requestStore.run({ requestId, instances: new Map(), values: new Map() }, () => ...).',\n )\n }\n\n // ── Request Data ────────────────────────────────────────────────────\n\n get body(): TBody {\n return this.req.body as TBody\n }\n\n get params(): TParams {\n return this.req.params as TParams\n }\n\n get query(): TQuery {\n return this.req.query as TQuery\n }\n\n get headers() {\n return this.req.headers\n }\n\n get requestId(): string | undefined {\n return (this.req as any).requestId ?? (this.req.headers['x-request-id'] as string | undefined)\n }\n\n /** Session data (requires session middleware) */\n get session(): any {\n return (this.req as any).session\n }\n\n /**\n * The authenticated user set by AuthAdapter.\n * Reads from the per-request metadata store first (`ctx.set('user', ...)`),\n * then falls back to `req.user` (set directly by AuthAdapter middleware).\n *\n * Extend the `AuthUser` interface via module augmentation in `@forinda/kickjs-auth`\n * to get full typing.\n *\n * @example\n * ```ts\n * @Get('/me')\n * @Authenticated()\n * getProfile(ctx: RequestContext) {\n * const user = ctx.user\n * if (!user) return ctx.notFound()\n * return ctx.json({ user })\n * }\n * ```\n */\n get user(): MetaValue<'user', Record<string, any>> | undefined {\n return this.metadataReadOnly()?.get('user') ?? (this.req as any).user\n }\n\n /**\n * Tenant identifier for multi-tenant apps. Reads `user.tenantId` —\n * populated either by `AuthAdapter.testMode({ tenantId })`, a tenant\n * resolver middleware, or manually on the strategy's `mapPayload`.\n *\n * Augment `AuthUser` (or `ContextMeta['user']`) to widen the return\n * type if your user shape guarantees a non-`string | undefined` id.\n */\n get tenantId(): string | undefined {\n const u = this.user as Record<string, any> | undefined\n return u?.tenantId\n }\n\n /**\n * Effective role list for the current user. Prefers `user.tenantRoles`\n * (populated by `AuthAdapterOptions.roleResolver` under a tenant) and\n * falls back to `user.roles`. Returns an empty array when the user is\n * absent or the shape has neither field.\n */\n get roles(): string[] {\n const u = this.user as Record<string, any> | undefined\n return u?.tenantRoles ?? u?.roles ?? []\n }\n\n // ── Query String Parsing ───────────────────────────────────────────\n\n /**\n * Parse the request query string into structured filters, sort, pagination, and search.\n * Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).\n *\n * Generic over the field config: when passed an inline literal (or\n * `as const`), `filters[].field` and `sort[].field` are narrowed to\n * the exact whitelisted field names. Pass nothing or a non-literal\n * config and you get the loose `string` fallback.\n *\n * @param fieldConfig - Optional whitelist for filterable, sortable, and searchable fields\n *\n * @example\n * ```ts\n * @Get('/')\n * async list(ctx: RequestContext) {\n * const parsed = ctx.qs({\n * filterable: ['status', 'priority'],\n * sortable: ['createdAt', 'title'],\n * } as const)\n * parsed.filters[0].field // typed as 'status' | 'priority'\n * parsed.sort[0].field // typed as 'createdAt' | 'title'\n * }\n * ```\n */\n qs<TConfig extends QueryFieldConfig | undefined = undefined>(\n fieldConfig?: TConfig,\n ): TypedParsedQuery<TConfig> {\n return parseQuery<TConfig>(this.req.query as Record<string, any>, fieldConfig)\n }\n\n // ── File Uploads ────────────────────────────────────────────────────\n\n /** Single uploaded file (requires @FileUpload({ mode: 'single' })) */\n get file(): any {\n return (this.req as any).file\n }\n\n /** Array of uploaded files (requires @FileUpload({ mode: 'array' })) */\n get files(): any[] | undefined {\n return (this.req as any).files\n }\n\n // ── Metadata Store ──────────────────────────────────────────────────\n\n /**\n * Read a value from the per-request metadata store.\n *\n * When `ContextMeta` has been augmented with a matching key, the return\n * type is inferred automatically. For ad-hoc keys, pass a generic:\n * `ctx.get<MyType>('custom')`.\n */\n get<K extends string>(key: K): MetaValue<K> | undefined {\n return this.metadataReadOnly()?.get(key) as MetaValue<K> | undefined\n }\n\n /**\n * Write a value to the per-request metadata store. Throws when no\n * AsyncLocalStorage frame is active — see {@link metadataForWrite}\n * for why a silent fallback is the wrong default.\n */\n set<K extends string>(key: K, value: MetaValue<K>): void {\n this.metadataForWrite().set(key, value)\n }\n\n // ── Response Helpers ────────────────────────────────────────────────\n\n json(data: any, status = 200) {\n return this.res.status(status).json(data)\n }\n\n created(data: any) {\n return this.res.status(201).json(data)\n }\n\n noContent() {\n return this.res.status(204).end()\n }\n\n notFound(message = 'Not Found') {\n return this.res.status(404).json({ message })\n }\n\n badRequest(message: string) {\n return this.res.status(400).json({ message })\n }\n\n html(content: string, status = 200) {\n return this.res.status(status).type('html').send(content)\n }\n\n download(buffer: Buffer, filename: string, contentType = 'application/octet-stream') {\n this.res.setHeader('Content-Disposition', `attachment; filename=\"${filename}\"`)\n this.res.setHeader('Content-Type', contentType)\n return this.res.send(buffer)\n }\n\n /**\n * Render a template using the registered view engine (EJS, Pug, Handlebars, etc.).\n * Requires a ViewAdapter to be configured in bootstrap().\n *\n * @param template - Template name (without extension, relative to viewsDir)\n * @param data - Data to pass to the template\n *\n * @example\n * ```ts\n * ctx.render('dashboard', { user, title: 'Dashboard' })\n * ctx.render('emails/welcome', { name: 'Alice' })\n * ```\n */\n render(template: string, data: Record<string, any> = {}) {\n return this.res.render(template, data)\n }\n\n /**\n * Parse query params and return a standardized paginated response.\n * Calls `ctx.qs()` internally, then wraps your data with pagination meta.\n *\n * @param fetcher - Async function that receives ParsedQuery and returns `{ data, total }`\n * @param fieldConfig - Optional whitelist for filterable, sortable, searchable fields\n *\n * @example\n * ```ts\n * @Get('/')\n * async list(ctx: RequestContext) {\n * return ctx.paginate(\n * async (parsed) => {\n * const data = await db.select().from(users)\n * .where(query.where).limit(parsed.pagination.limit)\n * .offset(parsed.pagination.offset).all()\n * const total = await db.select({ count: count() }).from(users).get()\n * return { data, total: total?.count ?? 0 }\n * },\n * { filterable: ['name', 'role'], sortable: ['createdAt'] },\n * )\n * }\n * ```\n */\n async paginate<T, TConfig extends QueryFieldConfig | undefined = undefined>(\n fetcher: (parsed: TypedParsedQuery<TConfig>) => Promise<{ data: T[]; total: number }>,\n fieldConfig?: TConfig,\n ) {\n const parsed = this.qs<TConfig>(fieldConfig)\n const { data, total } = await fetcher(parsed)\n const { page, limit } = parsed.pagination\n const totalPages = Math.ceil(total / limit) || 1\n\n const response: PaginatedResponse<T> = {\n data,\n meta: {\n page,\n limit,\n total,\n totalPages,\n hasNext: page < totalPages,\n hasPrev: page > 1,\n },\n }\n\n return this.json(response)\n }\n\n // ── Server-Sent Events ──────────────────────────────────────────────\n\n /**\n * Start an SSE (Server-Sent Events) stream.\n * Sets the correct headers and returns helpers to send events.\n *\n * @example\n * ```ts\n * @Get('/events')\n * async stream(ctx: RequestContext) {\n * const sse = ctx.sse()\n *\n * const interval = setInterval(() => {\n * sse.send({ time: new Date().toISOString() }, 'tick')\n * }, 1000)\n *\n * sse.onClose(() => clearInterval(interval))\n * }\n * ```\n */\n sse() {\n this.res.writeHead(200, {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n 'X-Accel-Buffering': 'no',\n })\n this.res.flushHeaders()\n\n const closeCallbacks: Array<() => void> = []\n\n this.req.on('close', () => {\n for (const cb of closeCallbacks) cb()\n })\n\n return {\n /** Send an SSE event with optional event name and id */\n send: (data: any, event?: string, id?: string) => {\n if (id) this.res.write(`id: ${id}\\n`)\n if (event) this.res.write(`event: ${event}\\n`)\n this.res.write(`data: ${JSON.stringify(data)}\\n\\n`)\n },\n /** Send a comment (keeps connection alive) */\n comment: (text: string) => {\n this.res.write(`: ${text}\\n\\n`)\n },\n /** Register a callback when the client disconnects */\n onClose: (fn: () => void) => {\n closeCallbacks.push(fn)\n },\n /** End the SSE stream */\n close: () => {\n this.res.end()\n },\n }\n }\n}\n\n/**\n * Short alias for `RequestContext` parameterised by a route shape.\n *\n * Use with `kick typegen`'s generated `KickRoutes` namespace for\n * fully-typed `ctx.params`, `ctx.body`, and `ctx.query`. Metadata\n * typing (`ctx.get()`, `ctx.set()`, `ctx.user`) comes from\n * `ContextMeta` augmentation and works on all `RequestContext` instances.\n *\n * @example\n * ```ts\n * @Get('/:id')\n * getUser(ctx: Ctx<KickRoutes.UserController['getUser']>) {\n * ctx.params.id // typed from RouteShape\n * ctx.body // typed from RouteShape\n * ctx.user // typed from ContextMeta\n * ctx.get('tenant') // typed from ContextMeta\n * }\n * ```\n */\nexport type Ctx<TRoute extends RouteShape = RouteShape> = RequestContext<\n TRoute extends { body: infer B } ? B : any,\n TRoute extends { params: infer P } ? P : any,\n TRoute extends { query: infer Q } ? Q : any\n>\n\n/**\n * Global ambient registry of typed routes, populated by `kick typegen`.\n *\n * Each interface inside `KickRoutes` corresponds to a controller class;\n * each property is one route method on that controller. The values\n * conform to `RouteShape`.\n *\n * Empty by default — declarations come from `.kickjs/types/routes.d.ts`\n * generated alongside the rest of the typegen output.\n */\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace KickRoutes {}\n}\n"],"mappings":";;;;;;;;;;;;;;AAqCA,MAAa,eAAe,IAAI,mBAAiC;;;;;AAMjE,SAAgB,kBAAgC;CAC9C,MAAM,QAAQ,aAAa,UAAU;AACrC,KAAI,CAAC,MACH,OAAM,IAAI,MACR,kGACD;AAEH,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BT,SAAgB,gBAAkC,KAAkC;AAClF,QAAO,aAAa,UAAU,EAAE,OAAO,IAAI,IAAI;;;;;;;;;;;;ACxCjD,IAAa,iBAAb,MAAkG;CAChG,YACE,KACA,KACA,MACA;AAHgB,OAAA,MAAA;AACA,OAAA,MAAA;AACA,OAAA,OAAA;;;;;;;;;;;;;CAclB,mBAAoD;AAClD,SAAQ,aAAa,UAAU,EAAE,UAA2C;;;;;;;;;;;;;;CAe9E,mBAA6C;EAC3C,MAAM,QAAQ,aAAa,UAAU;AACrC,MAAI,MAAO,QAAO,MAAM;AACxB,QAAM,IAAI,MACR,8OAGD;;CAKH,IAAI,OAAc;AAChB,SAAO,KAAK,IAAI;;CAG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