@forinda/kickjs 3.2.0 → 4.1.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.
Files changed (193) hide show
  1. package/README.md +13 -212
  2. package/dist/adapter-6Pp4kFdM.d.mts +296 -0
  3. package/dist/adapter-6Pp4kFdM.d.mts.map +1 -0
  4. package/dist/{app-module-ERR9jhow.d.mts → app-module-Blgz4Rti.d.mts} +4 -4
  5. package/dist/app-module-Blgz4Rti.d.mts.map +1 -0
  6. package/dist/application-Bepa-pFw.d.mts +302 -0
  7. package/dist/application-Bepa-pFw.d.mts.map +1 -0
  8. package/dist/{application-x8CXLOlv.mjs → application-DvmPMUgF.mjs} +28 -9
  9. package/dist/application-DvmPMUgF.mjs.map +1 -0
  10. package/dist/bootstrap-B4T3X2B6.d.mts +28 -0
  11. package/dist/bootstrap-B4T3X2B6.d.mts.map +1 -0
  12. package/dist/{bootstrap-CYnxozL_.mjs → bootstrap-THfr8phJ.mjs} +6 -6
  13. package/dist/{bootstrap-CYnxozL_.mjs.map → bootstrap-THfr8phJ.mjs.map} +1 -1
  14. package/dist/{cache-V91BNTIM.d.mts → cache-XrNWj1KQ.d.mts} +3 -3
  15. package/dist/{cache-V91BNTIM.d.mts.map → cache-XrNWj1KQ.d.mts.map} +1 -1
  16. package/dist/config/index.d.mts +1 -1
  17. package/dist/config/index.mjs +3 -3
  18. package/dist/{config-aWxKLk4A.mjs → config-BEjgF1fI.mjs} +4 -4
  19. package/dist/{config-aWxKLk4A.mjs.map → config-BEjgF1fI.mjs.map} +1 -1
  20. package/dist/{container-Dnk43k54.mjs → container-BYuMSnqW.mjs} +314 -9
  21. package/dist/container-BYuMSnqW.mjs.map +1 -0
  22. package/dist/{container-fIS1uLx-.d.mts → container-CnWDsxi-.d.mts} +9 -7
  23. package/dist/container-CnWDsxi-.d.mts.map +1 -0
  24. package/dist/{context-OktlOQBQ.mjs → context-CyQbqSz-.mjs} +33 -41
  25. package/dist/context-CyQbqSz-.mjs.map +1 -0
  26. package/dist/context-Ymvv-85x.d.mts +260 -0
  27. package/dist/context-Ymvv-85x.d.mts.map +1 -0
  28. package/dist/{context-decorator-GA8-hDLe.d.mts → context-decorator-DrPvQ9Ag.d.mts} +62 -12
  29. package/dist/context-decorator-DrPvQ9Ag.d.mts.map +1 -0
  30. package/dist/core/adapter.d.mts +1 -1
  31. package/dist/core/adapter.mjs +1 -1
  32. package/dist/core/app-module.d.mts +1 -1
  33. package/dist/core/app-module.mjs +1 -1
  34. package/dist/core/cache.d.mts +1 -1
  35. package/dist/core/cache.mjs +3 -3
  36. package/dist/core/cache.mjs.map +1 -1
  37. package/dist/core/container.d.mts +1 -1
  38. package/dist/core/container.mjs +2 -2
  39. package/dist/core/cron.d.mts +1 -1
  40. package/dist/core/cron.mjs +3 -3
  41. package/dist/core/cron.mjs.map +1 -1
  42. package/dist/core/decorators.d.mts +2 -2
  43. package/dist/core/decorators.mjs +48 -16
  44. package/dist/core/decorators.mjs.map +1 -1
  45. package/dist/core/errors.d.mts +1 -1
  46. package/dist/core/errors.mjs +1 -1
  47. package/dist/core/interfaces.d.mts +1 -1
  48. package/dist/core/interfaces.mjs +35 -18
  49. package/dist/core/interfaces.mjs.map +1 -1
  50. package/dist/core/logger.d.mts +2 -2
  51. package/dist/core/logger.mjs +2 -4
  52. package/dist/core/logger.mjs.map +1 -1
  53. package/dist/core/path.d.mts +1 -1
  54. package/dist/core/path.mjs +1 -1
  55. package/dist/core/plugin.d.mts +1 -1
  56. package/dist/core/plugin.mjs +1 -1
  57. package/dist/core/reactivity.d.mts +1 -1
  58. package/dist/core/reactivity.mjs +1 -1
  59. package/dist/{core-DANnH5-e.mjs → core-Dj3iVQ3t.mjs} +305 -8
  60. package/dist/core-Dj3iVQ3t.mjs.map +1 -0
  61. package/dist/cors-BfgqfLPd.d.mts +48 -0
  62. package/dist/cors-BfgqfLPd.d.mts.map +1 -0
  63. package/dist/{cron-CfsPdi7R.d.mts → cron-GNoYydfg.d.mts} +2 -2
  64. package/dist/cron-GNoYydfg.d.mts.map +1 -0
  65. package/dist/csrf-DiK9zept.d.mts +52 -0
  66. package/dist/csrf-DiK9zept.d.mts.map +1 -0
  67. package/dist/{decorators-H42oPg0m.d.mts → decorators-BMvaLliz.d.mts} +147 -12
  68. package/dist/decorators-BMvaLliz.d.mts.map +1 -0
  69. package/dist/{env-Cs8Wt8A_.mjs → env-DMqv56Bb.mjs} +3 -4
  70. package/dist/{env-Cs8Wt8A_.mjs.map → env-DMqv56Bb.mjs.map} +1 -1
  71. package/dist/error-handler-Xud_3Lah.d.mts +20 -0
  72. package/dist/error-handler-Xud_3Lah.d.mts.map +1 -0
  73. package/dist/{errors-D_CWI7Bl.d.mts → errors-uaHCeXRz.d.mts} +1 -1
  74. package/dist/{errors-D_CWI7Bl.d.mts.map → errors-uaHCeXRz.d.mts.map} +1 -1
  75. package/dist/{execution-context-Dl2CKqSo.d.mts → execution-context-DKnt61pY.d.mts} +1 -1
  76. package/dist/{execution-context-Dl2CKqSo.d.mts.map → execution-context-DKnt61pY.d.mts.map} +1 -1
  77. package/dist/helmet-CaMbjzBG.d.mts +41 -0
  78. package/dist/helmet-CaMbjzBG.d.mts.map +1 -0
  79. package/dist/http/application.d.mts +2 -293
  80. package/dist/http/application.mjs +2 -2
  81. package/dist/http/bootstrap.d.mts +2 -27
  82. package/dist/http/bootstrap.mjs +2 -2
  83. package/dist/http/context.d.mts +3 -251
  84. package/dist/http/context.mjs +2 -2
  85. package/dist/http/middleware/cors.d.mts +2 -47
  86. package/dist/http/middleware/cors.mjs +1 -1
  87. package/dist/http/middleware/csrf.d.mts +2 -51
  88. package/dist/http/middleware/csrf.mjs +2 -2
  89. package/dist/http/middleware/csrf.mjs.map +1 -1
  90. package/dist/http/middleware/error-handler.d.mts +2 -19
  91. package/dist/http/middleware/error-handler.mjs +2 -2
  92. package/dist/http/middleware/helmet.d.mts +2 -40
  93. package/dist/http/middleware/helmet.mjs +1 -1
  94. package/dist/http/middleware/rate-limit.d.mts +2 -55
  95. package/dist/http/middleware/rate-limit.mjs +2 -2
  96. package/dist/http/middleware/rate-limit.mjs.map +1 -1
  97. package/dist/http/middleware/request-id.d.mts +2 -9
  98. package/dist/http/middleware/request-id.mjs +12 -3
  99. package/dist/http/middleware/request-id.mjs.map +1 -1
  100. package/dist/http/middleware/request-logger.d.mts +2 -31
  101. package/dist/http/middleware/request-logger.mjs +2 -2
  102. package/dist/http/middleware/session.d.mts +2 -69
  103. package/dist/http/middleware/session.mjs +1 -1
  104. package/dist/http/middleware/spa.d.mts +2 -100
  105. package/dist/http/middleware/spa.mjs +5 -5
  106. package/dist/http/middleware/spa.mjs.map +1 -1
  107. package/dist/http/middleware/upload.d.mts +2 -78
  108. package/dist/http/middleware/upload.mjs +1 -1
  109. package/dist/http/middleware/validate.d.mts +2 -22
  110. package/dist/http/middleware/validate.mjs +2 -2
  111. package/dist/http/middleware/views.d.mts +2 -61
  112. package/dist/http/middleware/views.mjs +16 -15
  113. package/dist/http/middleware/views.mjs.map +1 -1
  114. package/dist/http/query/index.d.mts +1 -1
  115. package/dist/http/query/index.mjs +2 -2
  116. package/dist/http/router-builder.d.mts +2 -32
  117. package/dist/http/router-builder.mjs +10 -14
  118. package/dist/http/router-builder.mjs.map +1 -1
  119. package/dist/{index-RNK41JPE.d.mts → index-B9cyOQAe.d.mts} +1 -1
  120. package/dist/{index-RNK41JPE.d.mts.map → index-B9cyOQAe.d.mts.map} +1 -1
  121. package/dist/{index-Cf-MGrqT.d.mts → index-D-qhXg9M.d.mts} +3 -3
  122. package/dist/{index-Cf-MGrqT.d.mts.map → index-D-qhXg9M.d.mts.map} +1 -1
  123. package/dist/{index-BQM9pJrV.d.mts → index-Yhs9sTMW.d.mts} +241 -5
  124. package/dist/index-Yhs9sTMW.d.mts.map +1 -0
  125. package/dist/index.d.mts +34 -152
  126. package/dist/index.mjs +50 -14
  127. package/dist/index.mjs.map +1 -1
  128. package/dist/interfaces-B50n7dwl.d.mts +71 -0
  129. package/dist/{interfaces-CwcdqfNq.d.mts.map → interfaces-B50n7dwl.d.mts.map} +1 -1
  130. package/dist/{logger-GK8yT0BD.d.mts → logger-CLVRZf2N.d.mts} +2 -4
  131. package/dist/{logger-GK8yT0BD.d.mts.map → logger-CLVRZf2N.d.mts.map} +1 -1
  132. package/dist/{metadata-BFuoSEX6.mjs → metadata-BF1WDBOh.mjs} +2 -2
  133. package/dist/{metadata-BFuoSEX6.mjs.map → metadata-BF1WDBOh.mjs.map} +1 -1
  134. package/dist/{path-Bj3vZMUY.d.mts → path-Diviu6hv.d.mts} +1 -1
  135. package/dist/path-Diviu6hv.d.mts.map +1 -0
  136. package/dist/{plugin-3rKA0Loy.d.mts → plugin-DDjoN4XI.d.mts} +46 -8
  137. package/dist/plugin-DDjoN4XI.d.mts.map +1 -0
  138. package/dist/{query-BcYEjYyX.mjs → query-BrYRQMa5.mjs} +2 -2
  139. package/dist/{query-BcYEjYyX.mjs.map → query-BrYRQMa5.mjs.map} +1 -1
  140. package/dist/rate-limit-DUwoICtI.d.mts +56 -0
  141. package/dist/rate-limit-DUwoICtI.d.mts.map +1 -0
  142. package/dist/{reactivity-CczHu3R-.d.mts → reactivity-CfJceo4H.d.mts} +1 -1
  143. package/dist/{reactivity-CczHu3R-.d.mts.map → reactivity-CfJceo4H.d.mts.map} +1 -1
  144. package/dist/request-id-BgglvZHN.d.mts +19 -0
  145. package/dist/request-id-BgglvZHN.d.mts.map +1 -0
  146. package/dist/request-logger-CWHbAzTE.d.mts +32 -0
  147. package/dist/request-logger-CWHbAzTE.d.mts.map +1 -0
  148. package/dist/router-builder-zsX4Oq7c.d.mts +31 -0
  149. package/dist/router-builder-zsX4Oq7c.d.mts.map +1 -0
  150. package/dist/session-N0hActOO.d.mts +70 -0
  151. package/dist/session-N0hActOO.d.mts.map +1 -0
  152. package/dist/spa-CwIbdvPc.d.mts +101 -0
  153. package/dist/spa-CwIbdvPc.d.mts.map +1 -0
  154. package/dist/upload-BueOnnLw.d.mts +79 -0
  155. package/dist/upload-BueOnnLw.d.mts.map +1 -0
  156. package/dist/validate-HwAyWTwH.d.mts +23 -0
  157. package/dist/validate-HwAyWTwH.d.mts.map +1 -0
  158. package/dist/views-v05_dP1I.d.mts +181 -0
  159. package/dist/views-v05_dP1I.d.mts.map +1 -0
  160. package/package.json +6 -9
  161. package/dist/adapter-DLEHb0K6.d.mts +0 -151
  162. package/dist/adapter-DLEHb0K6.d.mts.map +0 -1
  163. package/dist/app-module-ERR9jhow.d.mts.map +0 -1
  164. package/dist/application-x8CXLOlv.mjs.map +0 -1
  165. package/dist/chunk-Bt-rz0Tp.mjs +0 -15
  166. package/dist/container-Dnk43k54.mjs.map +0 -1
  167. package/dist/container-fIS1uLx-.d.mts.map +0 -1
  168. package/dist/context-OktlOQBQ.mjs.map +0 -1
  169. package/dist/context-decorator-GA8-hDLe.d.mts.map +0 -1
  170. package/dist/core-DANnH5-e.mjs.map +0 -1
  171. package/dist/cron-CfsPdi7R.d.mts.map +0 -1
  172. package/dist/decorators-H42oPg0m.d.mts.map +0 -1
  173. package/dist/http/application.d.mts.map +0 -1
  174. package/dist/http/bootstrap.d.mts.map +0 -1
  175. package/dist/http/context.d.mts.map +0 -1
  176. package/dist/http/middleware/cors.d.mts.map +0 -1
  177. package/dist/http/middleware/csrf.d.mts.map +0 -1
  178. package/dist/http/middleware/error-handler.d.mts.map +0 -1
  179. package/dist/http/middleware/helmet.d.mts.map +0 -1
  180. package/dist/http/middleware/rate-limit.d.mts.map +0 -1
  181. package/dist/http/middleware/request-id.d.mts.map +0 -1
  182. package/dist/http/middleware/request-logger.d.mts.map +0 -1
  183. package/dist/http/middleware/session.d.mts.map +0 -1
  184. package/dist/http/middleware/spa.d.mts.map +0 -1
  185. package/dist/http/middleware/upload.d.mts.map +0 -1
  186. package/dist/http/middleware/validate.d.mts.map +0 -1
  187. package/dist/http/middleware/views.d.mts.map +0 -1
  188. package/dist/http/router-builder.d.mts.map +0 -1
  189. package/dist/index-BQM9pJrV.d.mts.map +0 -1
  190. package/dist/index.d.mts.map +0 -1
  191. package/dist/interfaces-CwcdqfNq.d.mts +0 -54
  192. package/dist/path-Bj3vZMUY.d.mts.map +0 -1
  193. package/dist/plugin-3rKA0Loy.d.mts.map +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- import { c as Scope, i as Constructor, r as ClassKind, s as PostConstructStatus } from "./interfaces-CwcdqfNq.mjs";
2
+ import { c as Scope, i as Constructor, r as ClassKind, s as PostConstructStatus } from "./interfaces-B50n7dwl.mjs";
3
3
  //#region src/core/token.d.ts
4
4
  /**
5
5
  * Collision-safe injection tokens with phantom type parameters.
@@ -133,14 +133,16 @@ declare class Container {
133
133
  /** Callback invoked on reset so decorators can update their container reference */
134
134
  static _onReset: ((container: Container) => void) | null;
135
135
  /**
136
- * Environment resolver for @Value decorator. Set by @forinda/kickjs-config
137
- * to return Zod-validated, type-coerced env values instead of raw process.env strings.
136
+ * Environment resolver for @Value decorator. Set by the unified
137
+ * `@forinda/kickjs` config layer to return Zod-validated, type-coerced
138
+ * env values instead of raw process.env strings.
138
139
  */
139
140
  static _envResolver: ((key: string) => any) | null;
140
141
  /**
141
- * Request store provider for REQUEST-scoped DI. Set by @forinda/kickjs-http
142
- * to return the current request's AsyncLocalStorage store.
143
- * Returns { instances: Map, values: Map } or null if outside a request.
142
+ * Request store provider for REQUEST-scoped DI. Set by the HTTP layer
143
+ * inside `@forinda/kickjs` to return the current request's
144
+ * AsyncLocalStorage store. Returns { instances: Map, values: Map } or
145
+ * null if outside a request.
144
146
  */
145
147
  static _requestStoreProvider: (() => {
146
148
  instances: Map<any, any>;
@@ -250,4 +252,4 @@ declare class Container {
250
252
  }
251
253
  //#endregion
252
254
  export { tokenName as a, createToken as c, KickJsRegistry as i, isInjectionToken as l, ContainerChangeEvent as n, INJECTION_TOKEN as o, ContainerChangeListener as r, InjectionToken as s, Container as t };
253
- //# sourceMappingURL=container-fIS1uLx-.d.mts.map
255
+ //# sourceMappingURL=container-CnWDsxi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S,KAAA,OAAY,MAAA,EAAQ,WAAA,EAAa,KAAA,GAAO,KAAA;EAuInB;EAzH9B,eAAA,CAAgB,KAAA,OAAY,OAAA,aAAoB,KAAA,GAAO,KAAA;EAsPb;EA/M1C,gBAAA,CAAiB,KAAA,OAAY,QAAA;EA9Jd;EA2Lf,GAAA,CAAI,KAAA;EAzLI;EA8LR,gBAAA,CAAA,GAAoB,KAAA;IAClB,KAAA;IACA,KAAA;IACA,IAAA,EAAM,SAAA;IACN,YAAA;IACA,YAAA;IACA,cAAA;IACA,eAAA;IACA,iBAAA;IACA,mBAAA,EAAqB,mBAAA;IACrB,YAAA;EAAA;EAhLK;;;;;;;;;;;;;EAmNP,OAAA,GAAA,CAAW,KAAA,EAAO,cAAA,CAAe,CAAA,IAAK,CAAA;EACtC,OAAA,GAAA,CAAW,KAAA,EAAO,WAAA,CAAY,CAAA,IAAK,CAAA;EACnC,OAAA,iBAAwB,cAAA,UAAA,CAAyB,KAAA,EAAO,CAAA,GAAI,cAAA,CAAe,CAAA;EAC3E,OAAA,SAAA,CAAiB,KAAA,QAAa,CAAA;EAzHd;EAuNhB,SAAA,CAAA;EAvNuD;;;;;;;;;;;;;;;;;;;;;;;;EAsPvD,QAAA,CAAS,QAAA,EAAU,uBAAA;EAhIR;;;;;;;;EA6IX,UAAA,CAAW,KAAA;EA3IH;EAAA,QAoKA,IAAA;EApKgD;EAsLxD,YAAA,CAAA;EAAA,QAgBQ,cAAA;EAtMmE;EAAA,QAoQnE,mBAAA;EAAA,QASA,gBAAA;AAAA"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.2.0
2
+ * @forinda/kickjs v4.1.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,8 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { Logger } from "./core/logger.mjs";
12
- import { i as parseQuery } from "./query-BcYEjYyX.mjs";
11
+ import { i as parseQuery } from "./query-BrYRQMa5.mjs";
13
12
  import { AsyncLocalStorage } from "node:async_hooks";
14
13
  //#region src/http/request-store.ts
15
14
  /** AsyncLocalStorage instance shared across the framework */
@@ -25,20 +24,6 @@ function getRequestStore() {
25
24
  }
26
25
  //#endregion
27
26
  //#region src/http/context.ts
28
- const log = Logger.for("RequestContext");
29
- /**
30
- * One-time non-production warning when {@link RequestContext} falls back to
31
- * `req.__ctxMeta` because no AsyncLocalStorage frame is active. This is the
32
- * back-compat path for ad-hoc context construction (mostly tests). The
33
- * fallback is deprecated and will be removed in the next major.
34
- */
35
- let warnedAboutCtxMetaFallback = false;
36
- function warnCtxMetaFallbackOnce() {
37
- if (warnedAboutCtxMetaFallback) return;
38
- warnedAboutCtxMetaFallback = true;
39
- if (process.env.NODE_ENV === "production") return;
40
- log.warn("RequestContext.metadata fell back to req.__ctxMeta because no AsyncLocalStorage frame was active. Mount requestScopeMiddleware() before constructing RequestContext to use the unified ALS-backed store. The req.__ctxMeta path is deprecated and will be removed in the next major.");
41
- }
42
27
  /**
43
28
  * Unified request/response abstraction passed to every controller method.
44
29
  * Shields handlers from raw Express objects and provides convenience methods.
@@ -54,27 +39,35 @@ var RequestContext = class {
54
39
  this.next = next;
55
40
  }
56
41
  /**
57
- * Per-request metadata map shared across all RequestContext instances
58
- * for the same request.
42
+ * Read-side accessor for the per-request metadata map.
59
43
  *
60
- * Backed by `requestStore.getStore()?.values` (the AsyncLocalStorage
61
- * map shared with the Context Contributor pipeline) when an ALS frame
62
- * is active — the canonical, supported path.
44
+ * Returns the AsyncLocalStorage map (`requestStore.getStore().values`)
45
+ * shared with the Context Contributor pipeline when an ALS frame is
46
+ * active. Returns `null` outside any frame — read-side callers
47
+ * (`ctx.get`, `ctx.user`, `ctx.tenantId`, `ctx.roles`) treat that as
48
+ * "no metadata" and fall through to their `req.*` defaults. Reads
49
+ * never throw because outside an ALS frame nobody could have written
50
+ * via `ctx.set` anyway, so an empty answer is the truthful one.
51
+ */
52
+ metadataReadOnly() {
53
+ return requestStore.getStore()?.values ?? null;
54
+ }
55
+ /**
56
+ * Write-side accessor for the per-request metadata map.
63
57
  *
64
- * Falls back to a lazily-attached `req.__ctxMeta` Map for ad-hoc
65
- * construction outside any frame — typically test code that builds a
66
- * RequestContext directly without mounting `requestScopeMiddleware()`.
67
- * That fallback path is **deprecated** and will be removed in the next
68
- * major; a one-time non-production warning fires the first time it is
69
- * hit so adopters can migrate to ALS-backed contexts.
58
+ * Returns the same map as {@link metadataReadOnly} when an ALS frame
59
+ * is active. Throws otherwise — writing to a fallback map outside
60
+ * the ALS frame would silently lose data because other call sites
61
+ * (downstream contributors, request-logger, etc.) read from the
62
+ * canonical store and would never see it. Mount
63
+ * `requestScopeMiddleware()` (Application does this for you in
64
+ * `'auto'` mode) or wrap your test setup in
65
+ * `requestStore.run({...}, () => …)` to fix.
70
66
  */
71
- get metadata() {
67
+ metadataForWrite() {
72
68
  const store = requestStore.getStore();
73
69
  if (store) return store.values;
74
- warnCtxMetaFallbackOnce();
75
- const r = this.req;
76
- if (!r.__ctxMeta) r.__ctxMeta = /* @__PURE__ */ new Map();
77
- return r.__ctxMeta;
70
+ 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() }, () => ...).");
78
71
  }
79
72
  get body() {
80
73
  return this.req.body;
@@ -115,7 +108,7 @@ var RequestContext = class {
115
108
  * ```
116
109
  */
117
110
  get user() {
118
- return this.metadata.get("user") ?? this.req.user;
111
+ return this.metadataReadOnly()?.get("user") ?? this.req.user;
119
112
  }
120
113
  /**
121
114
  * Tenant identifier for multi-tenant apps. Reads `user.tenantId` —
@@ -181,16 +174,15 @@ var RequestContext = class {
181
174
  * `ctx.get<MyType>('custom')`.
182
175
  */
183
176
  get(key) {
184
- return this.metadata.get(key);
177
+ return this.metadataReadOnly()?.get(key);
185
178
  }
186
179
  /**
187
- * Write a value to the per-request metadata store.
188
- *
189
- * When `ContextMeta` has been augmented with a matching key, the value
190
- * type is checked at compile time.
180
+ * Write a value to the per-request metadata store. Throws when no
181
+ * AsyncLocalStorage frame is active — see {@link metadataForWrite}
182
+ * for why a silent fallback is the wrong default.
191
183
  */
192
184
  set(key, value) {
193
- this.metadata.set(key, value);
185
+ this.metadataForWrite().set(key, value);
194
186
  }
195
187
  json(data, status = 200) {
196
188
  return this.res.status(status).json(data);
@@ -324,4 +316,4 @@ var RequestContext = class {
324
316
  //#endregion
325
317
  export { getRequestStore as n, requestStore as r, RequestContext as t };
326
318
 
327
- //# sourceMappingURL=context-OktlOQBQ.mjs.map
319
+ //# sourceMappingURL=context-CyQbqSz-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-CyQbqSz-.mjs","names":[],"sources":["../src/http/request-store.ts","../src/http/context.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\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 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","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":";;;;;;;;;;;;;;AA4BA,MAAa,eAAe,IAAI,mBAAiC;;;;;AAMjE,SAAgB,kBAAgC;CAC9C,MAAM,QAAQ,aAAa,UAAU;AACrC,KAAI,CAAC,MACH,OAAM,IAAI,MACR,kGACD;AAEH,QAAO;;;;;;;;;;;;ACDT,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;;CAGlB,IAAI,SA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,MAAM;;GAGrD,UAAU,SAAiB;AACzB,SAAK,IAAI,MAAM,KAAK,KAAK,MAAM;;GAGjC,UAAU,OAAmB;AAC3B,mBAAe,KAAK,GAAG;;GAGzB,aAAa;AACX,SAAK,IAAI,KAAK;;GAEjB"}
@@ -0,0 +1,260 @@
1
+
2
+ import { n as ExecutionContext, r as MetaValue } from "./execution-context-DKnt61pY.mjs";
3
+ import { g as QueryFieldConfig, y as TypedParsedQuery } from "./index-B9cyOQAe.mjs";
4
+ import * as _$node_http0 from "node:http";
5
+ import { NextFunction, Request, Response } from "express";
6
+
7
+ //#region src/http/context.d.ts
8
+ /**
9
+ * The shape of a single route entry in `KickRoutes`. Generated by
10
+ * `kick typegen` and consumed via the `Ctx<T>` helper. Each field is
11
+ * `unknown` by default and is filled in as the typegen learns more
12
+ * about the route (URL params from the path, body/query from validation
13
+ * schemas, etc.).
14
+ */
15
+ interface RouteShape {
16
+ params?: unknown;
17
+ body?: unknown;
18
+ query?: unknown;
19
+ response?: unknown;
20
+ }
21
+ /**
22
+ * Unified request/response abstraction passed to every controller method.
23
+ * Shields handlers from raw Express objects and provides convenience methods.
24
+ *
25
+ * Implements {@link ExecutionContext} so the transport-agnostic Context
26
+ * Contributor pipeline (#107) can run against this concrete HTTP context
27
+ * the same way it will run against future WS / queue / cron contexts.
28
+ */
29
+ declare class RequestContext<TBody = any, TParams = any, TQuery = any> implements ExecutionContext {
30
+ readonly req: Request;
31
+ readonly res: Response;
32
+ readonly next: NextFunction;
33
+ constructor(req: Request, res: Response, next: NextFunction);
34
+ /**
35
+ * Read-side accessor for the per-request metadata map.
36
+ *
37
+ * Returns the AsyncLocalStorage map (`requestStore.getStore().values`)
38
+ * shared with the Context Contributor pipeline when an ALS frame is
39
+ * active. Returns `null` outside any frame — read-side callers
40
+ * (`ctx.get`, `ctx.user`, `ctx.tenantId`, `ctx.roles`) treat that as
41
+ * "no metadata" and fall through to their `req.*` defaults. Reads
42
+ * never throw because outside an ALS frame nobody could have written
43
+ * via `ctx.set` anyway, so an empty answer is the truthful one.
44
+ */
45
+ private metadataReadOnly;
46
+ /**
47
+ * Write-side accessor for the per-request metadata map.
48
+ *
49
+ * Returns the same map as {@link metadataReadOnly} when an ALS frame
50
+ * is active. Throws otherwise — writing to a fallback map outside
51
+ * the ALS frame would silently lose data because other call sites
52
+ * (downstream contributors, request-logger, etc.) read from the
53
+ * canonical store and would never see it. Mount
54
+ * `requestScopeMiddleware()` (Application does this for you in
55
+ * `'auto'` mode) or wrap your test setup in
56
+ * `requestStore.run({...}, () => …)` to fix.
57
+ */
58
+ private metadataForWrite;
59
+ get body(): TBody;
60
+ get params(): TParams;
61
+ get query(): TQuery;
62
+ get headers(): _$node_http0.IncomingHttpHeaders;
63
+ get requestId(): string | undefined;
64
+ /** Session data (requires session middleware) */
65
+ get session(): any;
66
+ /**
67
+ * The authenticated user set by AuthAdapter.
68
+ * Reads from the per-request metadata store first (`ctx.set('user', ...)`),
69
+ * then falls back to `req.user` (set directly by AuthAdapter middleware).
70
+ *
71
+ * Extend the `AuthUser` interface via module augmentation in `@forinda/kickjs-auth`
72
+ * to get full typing.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * @Get('/me')
77
+ * @Authenticated()
78
+ * getProfile(ctx: RequestContext) {
79
+ * const user = ctx.user
80
+ * if (!user) return ctx.notFound()
81
+ * return ctx.json({ user })
82
+ * }
83
+ * ```
84
+ */
85
+ get user(): MetaValue<'user', Record<string, any>> | undefined;
86
+ /**
87
+ * Tenant identifier for multi-tenant apps. Reads `user.tenantId` —
88
+ * populated either by `AuthAdapter.testMode({ tenantId })`, a tenant
89
+ * resolver middleware, or manually on the strategy's `mapPayload`.
90
+ *
91
+ * Augment `AuthUser` (or `ContextMeta['user']`) to widen the return
92
+ * type if your user shape guarantees a non-`string | undefined` id.
93
+ */
94
+ get tenantId(): string | undefined;
95
+ /**
96
+ * Effective role list for the current user. Prefers `user.tenantRoles`
97
+ * (populated by `AuthAdapterOptions.roleResolver` under a tenant) and
98
+ * falls back to `user.roles`. Returns an empty array when the user is
99
+ * absent or the shape has neither field.
100
+ */
101
+ get roles(): string[];
102
+ /**
103
+ * Parse the request query string into structured filters, sort, pagination, and search.
104
+ * Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).
105
+ *
106
+ * Generic over the field config: when passed an inline literal (or
107
+ * `as const`), `filters[].field` and `sort[].field` are narrowed to
108
+ * the exact whitelisted field names. Pass nothing or a non-literal
109
+ * config and you get the loose `string` fallback.
110
+ *
111
+ * @param fieldConfig - Optional whitelist for filterable, sortable, and searchable fields
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * @Get('/')
116
+ * async list(ctx: RequestContext) {
117
+ * const parsed = ctx.qs({
118
+ * filterable: ['status', 'priority'],
119
+ * sortable: ['createdAt', 'title'],
120
+ * } as const)
121
+ * parsed.filters[0].field // typed as 'status' | 'priority'
122
+ * parsed.sort[0].field // typed as 'createdAt' | 'title'
123
+ * }
124
+ * ```
125
+ */
126
+ qs<TConfig extends QueryFieldConfig | undefined = undefined>(fieldConfig?: TConfig): TypedParsedQuery<TConfig>;
127
+ /** Single uploaded file (requires @FileUpload({ mode: 'single' })) */
128
+ get file(): any;
129
+ /** Array of uploaded files (requires @FileUpload({ mode: 'array' })) */
130
+ get files(): any[] | undefined;
131
+ /**
132
+ * Read a value from the per-request metadata store.
133
+ *
134
+ * When `ContextMeta` has been augmented with a matching key, the return
135
+ * type is inferred automatically. For ad-hoc keys, pass a generic:
136
+ * `ctx.get<MyType>('custom')`.
137
+ */
138
+ get<K extends string>(key: K): MetaValue<K> | undefined;
139
+ /**
140
+ * Write a value to the per-request metadata store. Throws when no
141
+ * AsyncLocalStorage frame is active — see {@link metadataForWrite}
142
+ * for why a silent fallback is the wrong default.
143
+ */
144
+ set<K extends string>(key: K, value: MetaValue<K>): void;
145
+ json(data: any, status?: number): Response<any, Record<string, any>>;
146
+ created(data: any): Response<any, Record<string, any>>;
147
+ noContent(): Response<any, Record<string, any>>;
148
+ notFound(message?: string): Response<any, Record<string, any>>;
149
+ badRequest(message: string): Response<any, Record<string, any>>;
150
+ html(content: string, status?: number): Response<any, Record<string, any>>;
151
+ download(buffer: Buffer, filename: string, contentType?: string): Response<any, Record<string, any>>;
152
+ /**
153
+ * Render a template using the registered view engine (EJS, Pug, Handlebars, etc.).
154
+ * Requires a ViewAdapter to be configured in bootstrap().
155
+ *
156
+ * @param template - Template name (without extension, relative to viewsDir)
157
+ * @param data - Data to pass to the template
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * ctx.render('dashboard', { user, title: 'Dashboard' })
162
+ * ctx.render('emails/welcome', { name: 'Alice' })
163
+ * ```
164
+ */
165
+ render(template: string, data?: Record<string, any>): void;
166
+ /**
167
+ * Parse query params and return a standardized paginated response.
168
+ * Calls `ctx.qs()` internally, then wraps your data with pagination meta.
169
+ *
170
+ * @param fetcher - Async function that receives ParsedQuery and returns `{ data, total }`
171
+ * @param fieldConfig - Optional whitelist for filterable, sortable, searchable fields
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * @Get('/')
176
+ * async list(ctx: RequestContext) {
177
+ * return ctx.paginate(
178
+ * async (parsed) => {
179
+ * const data = await db.select().from(users)
180
+ * .where(query.where).limit(parsed.pagination.limit)
181
+ * .offset(parsed.pagination.offset).all()
182
+ * const total = await db.select({ count: count() }).from(users).get()
183
+ * return { data, total: total?.count ?? 0 }
184
+ * },
185
+ * { filterable: ['name', 'role'], sortable: ['createdAt'] },
186
+ * )
187
+ * }
188
+ * ```
189
+ */
190
+ paginate<T, TConfig extends QueryFieldConfig | undefined = undefined>(fetcher: (parsed: TypedParsedQuery<TConfig>) => Promise<{
191
+ data: T[];
192
+ total: number;
193
+ }>, fieldConfig?: TConfig): Promise<Response<any, Record<string, any>>>;
194
+ /**
195
+ * Start an SSE (Server-Sent Events) stream.
196
+ * Sets the correct headers and returns helpers to send events.
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * @Get('/events')
201
+ * async stream(ctx: RequestContext) {
202
+ * const sse = ctx.sse()
203
+ *
204
+ * const interval = setInterval(() => {
205
+ * sse.send({ time: new Date().toISOString() }, 'tick')
206
+ * }, 1000)
207
+ *
208
+ * sse.onClose(() => clearInterval(interval))
209
+ * }
210
+ * ```
211
+ */
212
+ sse(): {
213
+ /** Send an SSE event with optional event name and id */send: (data: any, event?: string, id?: string) => void; /** Send a comment (keeps connection alive) */
214
+ comment: (text: string) => void; /** Register a callback when the client disconnects */
215
+ onClose: (fn: () => void) => void; /** End the SSE stream */
216
+ close: () => void;
217
+ };
218
+ }
219
+ /**
220
+ * Short alias for `RequestContext` parameterised by a route shape.
221
+ *
222
+ * Use with `kick typegen`'s generated `KickRoutes` namespace for
223
+ * fully-typed `ctx.params`, `ctx.body`, and `ctx.query`. Metadata
224
+ * typing (`ctx.get()`, `ctx.set()`, `ctx.user`) comes from
225
+ * `ContextMeta` augmentation and works on all `RequestContext` instances.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * @Get('/:id')
230
+ * getUser(ctx: Ctx<KickRoutes.UserController['getUser']>) {
231
+ * ctx.params.id // typed from RouteShape
232
+ * ctx.body // typed from RouteShape
233
+ * ctx.user // typed from ContextMeta
234
+ * ctx.get('tenant') // typed from ContextMeta
235
+ * }
236
+ * ```
237
+ */
238
+ type Ctx<TRoute extends RouteShape = RouteShape> = RequestContext<TRoute extends {
239
+ body: infer B;
240
+ } ? B : any, TRoute extends {
241
+ params: infer P;
242
+ } ? P : any, TRoute extends {
243
+ query: infer Q;
244
+ } ? Q : any>;
245
+ /**
246
+ * Global ambient registry of typed routes, populated by `kick typegen`.
247
+ *
248
+ * Each interface inside `KickRoutes` corresponds to a controller class;
249
+ * each property is one route method on that controller. The values
250
+ * conform to `RouteShape`.
251
+ *
252
+ * Empty by default — declarations come from `.kickjs/types/routes.d.ts`
253
+ * generated alongside the rest of the typegen output.
254
+ */
255
+ declare global {
256
+ namespace KickRoutes {}
257
+ } //# sourceMappingURL=context.d.ts.map
258
+ //#endregion
259
+ export { RequestContext as n, RouteShape as r, Ctx as t };
260
+ //# sourceMappingURL=context-Ymvv-85x.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-Ymvv-85x.d.mts","names":[],"sources":["../src/http/context.ts"],"mappings":";;;;;;;;;;;;;AAwCA;UAfiB,UAAA;EACf,MAAA;EACA,IAAA;EACA,KAAA;EACA,QAAA;AAAA;;;;;;;;;cAWW,cAAA,sDAAoE,gBAAA;EAAA,SAE7D,GAAA,EAAK,OAAA;EAAA,SACL,GAAA,EAAK,QAAA;EAAA,SACL,IAAA,EAAM,YAAA;cAFN,GAAA,EAAK,OAAA,EACL,GAAA,EAAK,QAAA,EACL,IAAA,EAAM,YAAA;EAuKiB;;;;;;;;;;;EAAA,QAzJjC,gBAAA;EAoLsB;;;;;;;;;;;;EAAA,QApKtB,gBAAA;EAAA,IAYJ,IAAA,CAAA,GAAQ,KAAA;EAAA,IAIR,MAAA,CAAA,GAAU,OAAA;EAAA,IAIV,KAAA,CAAA,GAAS,MAAA;EAAA,IAIT,OAAA,CAAA,GAJe,YAAA,CAIR,mBAAA;EAAA,IAIP,SAAA,CAAA;EA9D2E;EAAA,IAmE3E,OAAA,CAAA;EAnE2F;;;;;;;;;;;;;;;;;;;EAAA,IA0F3F,IAAA,CAAA,GAAQ,SAAA,SAAkB,MAAA;EA5C1B;;;;;;;;EAAA,IAwDA,QAAA,CAAA;EAnCA;;;;;;EAAA,IA8CA,KAAA,CAAA;EA+BD;;;;;;;;;;;;;;;;;;;;;;;;EAAH,EAAA,iBAAmB,gBAAA,yBAAA,CACjB,WAAA,GAAc,OAAA,GACb,gBAAA,CAAiB,OAAA;EAwCQ;EAAA,IAjCxB,IAAA,CAAA;EAqCI;EAAA,IAhCJ,KAAA,CAAA;EAgCa;;;;;;;EAnBjB,GAAA,kBAAA,CAAsB,GAAA,EAAK,CAAA,GAAI,SAAA,CAAU,CAAA;EA+BzC;;;;;EAtBA,GAAA,kBAAA,CAAsB,GAAA,EAAK,CAAA,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fIS1uLx-.mjs";
4
- import { n as ExecutionContext, r as MetaValue } from "./execution-context-Dl2CKqSo.mjs";
2
+ import { i as Constructor, o as MaybePromise } from "./interfaces-B50n7dwl.mjs";
3
+ import { s as InjectionToken } from "./container-CnWDsxi-.mjs";
4
+ import { n as ExecutionContext, r as MetaValue, t as ContextMeta } from "./execution-context-DKnt61pY.mjs";
5
5
  //#region src/core/context-decorator.d.ts
6
+ /**
7
+ * String-literal union of every key declared on the augmentable
8
+ * {@link ContextMeta} interface. Resolves to `string` when the
9
+ * project hasn't augmented `ContextMeta` yet (so a first-day project
10
+ * keeps compiling), and narrows to the concrete keys once the
11
+ * `declare module '@forinda/kickjs' { interface ContextMeta { ... } }`
12
+ * blocks land.
13
+ *
14
+ * Used as the element type of `dependsOn`, so a typo like
15
+ * `dependsOn: ['tenent']` becomes a TS error instead of a boot-time
16
+ * `MissingContributorError`.
17
+ */
18
+ type ContextMetaKey = keyof ContextMeta extends never ? string : keyof ContextMeta & string;
19
+ /**
20
+ * What a single `deps` entry is allowed to be — the runtime calls
21
+ * `container.resolve(value)`, which accepts an injection token brand
22
+ * or a constructor (decorated class). Anything else (a string literal,
23
+ * an array, a plain object) silently fails at boot when the runner
24
+ * tries to resolve it; constraining at the type level surfaces the
25
+ * mistake in the editor instead.
26
+ */
27
+ type DepValue = InjectionToken<unknown> | Constructor<unknown>;
6
28
  /**
7
29
  * Maps a `deps` declaration object to its resolved-instance shape.
8
30
  *
@@ -10,7 +32,7 @@ import { n as ExecutionContext, r as MetaValue } from "./execution-context-Dl2CK
10
32
  * `{ db: Db, cache: CacheService }` — the runner resolves each value
11
33
  * against the DI container and hands the result to `resolve()`.
12
34
  */
13
- type ResolvedDeps<D extends Record<string, unknown>> = { [K in keyof D]: D[K] extends InjectionToken<infer T> ? T : D[K] extends Constructor<infer T> ? T : unknown };
35
+ 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 };
14
36
  /**
15
37
  * Spec passed to {@link defineContextDecorator}. Describes one entry in
16
38
  * the per-request contributor pipeline.
@@ -21,7 +43,7 @@ type ResolvedDeps<D extends Record<string, unknown>> = { [K in keyof D]: D[K] ex
21
43
  * {@link ExecutionContext}; HTTP contributors typically
22
44
  * default to `RequestContext` at the call site.
23
45
  */
24
- interface ContextDecoratorSpec<K extends string = string, D extends Record<string, unknown> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext> {
46
+ interface ContextDecoratorSpec<K extends string = string, D extends Record<string, DepValue> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext> {
25
47
  /** ContextMeta key the resolved value is written to. */
26
48
  key: K;
27
49
  /**
@@ -33,8 +55,15 @@ interface ContextDecoratorSpec<K extends string = string, D extends Record<strin
33
55
  /**
34
56
  * Other contributor keys that must populate before this one runs.
35
57
  * Enforced via topo-sort at startup; missing deps and cycles fail boot.
58
+ *
59
+ * Typed against `keyof ContextMeta` once the project augments it — so
60
+ * `dependsOn: ['tenent']` (typo) is a TS error, not a boot-time
61
+ * `MissingContributorError`. Falls back to plain `string[]` when the
62
+ * registry is empty (no augmentation yet) so first-day projects keep
63
+ * compiling. Cast-as-any escape hatch:
64
+ * `dependsOn: ['custom-key' as keyof ContextMeta]`.
36
65
  */
37
- dependsOn?: readonly string[];
66
+ dependsOn?: readonly ContextMetaKey[];
38
67
  /**
39
68
  * If `true`, a thrown `resolve` skips the contributor instead of
40
69
  * forwarding to the request error handler. The key is left unset
@@ -61,21 +90,42 @@ interface ContextDecoratorSpec<K extends string = string, D extends Record<strin
61
90
  * module, adapter, global). The pipeline builder dedupes by `key` using
62
91
  * the precedence rule defined in §20.4 of `architecture.md`.
63
92
  */
64
- interface ContributorRegistration<K extends string = string, D extends Record<string, unknown> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext> {
93
+ interface ContributorRegistration<K extends string = string, D extends Record<string, DepValue> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext> {
65
94
  readonly key: K;
66
95
  readonly deps: D;
67
- readonly dependsOn: readonly string[];
96
+ readonly dependsOn: readonly ContextMetaKey[];
68
97
  readonly optional: boolean;
69
98
  readonly onError?: ContextDecoratorSpec<K, D, Ctx>['onError'];
70
99
  readonly resolve: ContextDecoratorSpec<K, D, Ctx>['resolve'];
71
100
  }
101
+ /**
102
+ * Type-erased registration shape used in the public collection slots
103
+ * (`AppModule.contributors?()`, `AppAdapter.contributors?()`,
104
+ * `KickPlugin.contributors?()`, `bootstrap({ contributors })`).
105
+ *
106
+ * The narrow `ContributorRegistration` carries a `Ctx` parameter so
107
+ * `resolve(ctx, deps)` is typed at the *definition* site, but `Ctx`
108
+ * sits in a contravariant position on `resolve` — meaning a
109
+ * `ContributorRegistration<…, RequestContext>` is *not* assignable to
110
+ * `ContributorRegistration<…, ExecutionContext>` even though every
111
+ * `RequestContext` is-a `ExecutionContext`. That's TS-sound but
112
+ * useless: the runner only ever calls a contributor with the same
113
+ * concrete ctx the route mounts under, so an HTTP-typed contributor
114
+ * never sees a non-HTTP ctx. Erasing `Ctx` to `any` in the collection
115
+ * type lets adopters store contributors typed against `RequestContext`
116
+ * (or any future transport-specific ctx) in the same array without
117
+ * casting.
118
+ */
119
+ type AnyContributorRegistration = ContributorRegistration<string, any, any>;
120
+ /** Convenience alias for `AnyContributorRegistration[]` collections. */
121
+ type ContributorRegistrations = AnyContributorRegistration[] | readonly AnyContributorRegistration[];
72
122
  /**
73
123
  * The value returned by {@link defineContextDecorator}. Callable as either
74
124
  * a method or class decorator, and exposes the underlying frozen
75
125
  * {@link ContributorRegistration} via `.registration` for non-decorator
76
126
  * registration sites (module hooks, adapter hooks, bootstrap option).
77
127
  */
78
- interface ContextDecorator<K extends string = string, D extends Record<string, unknown> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext> {
128
+ interface ContextDecorator<K extends string = string, D extends Record<string, DepValue> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext> {
79
129
  (target: object, propertyKey?: string | symbol, descriptor?: PropertyDescriptor): void;
80
130
  readonly registration: ContributorRegistration<K, D, Ctx>;
81
131
  }
@@ -105,7 +155,7 @@ interface ContextDecorator<K extends string = string, D extends Record<string, u
105
155
  * metadata; the topo-sort, runner, and HTTP integration land in later
106
156
  * phases. See `architecture.md` §20 for the full pipeline plan.
107
157
  */
108
- declare function defineContextDecorator<K extends string, D extends Record<string, unknown> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext>(spec: ContextDecoratorSpec<K, D, Ctx>): ContextDecorator<K, D, Ctx>;
158
+ declare function defineContextDecorator<K extends string, D extends Record<string, DepValue> = Record<string, never>, Ctx extends ExecutionContext = ExecutionContext>(spec: ContextDecoratorSpec<K, D, Ctx>): ContextDecorator<K, D, Ctx>;
109
159
  //#endregion
110
- export { defineContextDecorator as a, ResolvedDeps as i, ContextDecoratorSpec as n, ContributorRegistration as r, ContextDecorator as t };
111
- //# sourceMappingURL=context-decorator-GA8-hDLe.d.mts.map
160
+ export { ContributorRegistration as a, ResolvedDeps as c, ContextMetaKey as i, defineContextDecorator as l, ContextDecorator as n, ContributorRegistrations as o, ContextDecoratorSpec as r, DepValue as s, AnyContributorRegistration as t };
161
+ //# sourceMappingURL=context-decorator-DrPvQ9Ag.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-decorator-DrPvQ9Ag.d.mts","names":[],"sources":["../src/core/context-decorator.ts"],"mappings":";;;;;;;AAkBA;;;;;AAUA;;;;;KAVY,cAAA,SAAuB,WAAA,gCAA2C,WAAA;;;;;;;;;KAUlE,QAAA,GAAW,cAAA,YAA0B,WAAA;;;;;;;;KASrC,YAAA,WAAuB,MAAA,SAAe,QAAA,mBACpC,CAAA,GAAI,CAAA,CAAE,CAAA,UAAW,cAAA,YACzB,CAAA,GACA,CAAA,CAAE,CAAA,UAAW,WAAA,YACX,CAAA;;;;;;;;;;;UAcS,oBAAA,sCAEL,MAAA,SAAe,QAAA,IAAY,MAAA,6BACzB,gBAAA,GAAmB,gBAAA;EAH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CAAiB,CAAA,EAAG,CAAA,EAAG,GAAA"}
@@ -1,3 +1,3 @@
1
1
 
2
- import { a as MiddlewarePhase, i as AppAdapterClass, n as AdapterMiddleware, r as AppAdapter, t as AdapterContext } from "../adapter-DLEHb0K6.mjs";
2
+ import { a as MiddlewarePhase, i as AppAdapterClass, n as AdapterMiddleware, r as AppAdapter, t as AdapterContext } from "../adapter-6Pp4kFdM.mjs";
3
3
  export { AdapterContext, AdapterMiddleware, AppAdapter, AppAdapterClass, MiddlewarePhase };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.2.0
2
+ * @forinda/kickjs v4.1.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,3 +1,3 @@
1
1
 
2
- import { n as AppModuleClass, r as ModuleRoutes, t as AppModule } from "../app-module-ERR9jhow.mjs";
2
+ import { n as AppModuleClass, r as ModuleRoutes, t as AppModule } from "../app-module-Blgz4Rti.mjs";
3
3
  export { AppModule, AppModuleClass, ModuleRoutes };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.2.0
2
+ * @forinda/kickjs v4.1.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,3 +1,3 @@
1
1
 
2
- import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider, t as CACHEABLE_META } from "../cache-V91BNTIM.mjs";
2
+ import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider, t as CACHEABLE_META } from "../cache-XrNWj1KQ.mjs";
3
3
  export { CACHEABLE_META, CacheEvict, CacheOptions, CacheProvider, Cacheable, MemoryCacheProvider, getCacheProvider, setCacheProvider };