@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,60 @@
1
1
 
2
- import { l as ServiceOptions } from "./interfaces-CwcdqfNq.mjs";
2
+ import { l as ServiceOptions } from "./interfaces-B50n7dwl.mjs";
3
+ import { i as KickJsRegistry, s as InjectionToken } from "./container-CnWDsxi-.mjs";
4
+ //#region src/core/assets.d.ts
5
+ declare const ASSET_MANIFEST_VERSION: 1;
6
+ /**
7
+ * Augmentable interface — `kick typegen` (assets-plan.md PR 4) emits
8
+ * a `declare global` augmentation listing every namespace + key for
9
+ * the project's `assetMap`. Adopters who haven't run typegen yet
10
+ * still get a runtime-correct Proxy; only typed autocomplete waits
11
+ * on the augmentation.
12
+ */
13
+ interface KickAssets {}
14
+ /**
15
+ * DI token for the `assets` Proxy. Adopter code that wants to
16
+ * receive assets via constructor injection registers via
17
+ * `container.registerInstance(ASSETS, useAssets())` in `bootstrap()`
18
+ * and injects with `@Inject(ASSETS)`.
19
+ */
20
+ declare const ASSETS: InjectionToken<KickAssets>;
21
+ declare class UnknownAssetError extends Error {
22
+ readonly namespace: string;
23
+ readonly key: string;
24
+ constructor(namespace: string, key: string);
25
+ }
26
+ declare function resolveAsset(namespace: string, key: string): string;
27
+ /** Reset the manifest cache. Tests use this; production code shouldn't need it. */
28
+ declare function clearAssetCache(): void;
29
+ /**
30
+ * Variant A — the ambient Proxy. Default accessor for static call
31
+ * sites where the namespace + key are literals known at compile time.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * import { assets } from '@forinda/kickjs'
36
+ * const path = assets.mails.welcome()
37
+ * ```
38
+ */
39
+ declare const assets: KickAssets;
40
+ /**
41
+ * Variant B — the hook accessor. Returns the same Proxy as `assets`;
42
+ * factory shape exists for testability + DI. Mock via
43
+ * `vi.mock('@forinda/kickjs', () => ({ useAssets: () => fakeAssets }))`.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * import { useAssets } from '@forinda/kickjs'
48
+ * class MailService {
49
+ * private assets = useAssets()
50
+ * send(name: string) {
51
+ * return ejs.renderFile(this.assets.mails[name](), {})
52
+ * }
53
+ * }
54
+ * ```
55
+ */
56
+ declare function useAssets(): KickAssets;
57
+ //#endregion
3
58
  //#region src/core/decorators.d.ts
4
59
  /** Mark a class as injectable with lifecycle scope */
5
60
  declare function Injectable(options?: ServiceOptions): ClassDecorator;
@@ -12,12 +67,13 @@ declare function Repository(options?: ServiceOptions): ClassDecorator;
12
67
  /**
13
68
  * Mark a class as an HTTP controller and register it in the DI container.
14
69
  *
15
- * @param path - **Deprecated.** The path parameter is no longer used for routing.
16
- * Route prefixes are defined by the module's `routes().path` — the single source
17
- * of truth for where routes are mounted. This parameter will be removed in a
18
- * future major version.
70
+ * Route prefixes are defined by the module's `routes().path` — the single
71
+ * source of truth for where routes mount. The legacy
72
+ * `@Controller('/path')` parameter was removed in v4; if your code
73
+ * still passes a string, see `docs/guide/migration-v3-to-v4.md` for
74
+ * the rename map.
19
75
  */
20
- declare function Controller(path?: string): ClassDecorator;
76
+ declare function Controller(): ClassDecorator;
21
77
  /** Mark a method as a lifecycle hook called after instantiation */
22
78
  declare function PostConstruct(): MethodDecorator;
23
79
  /** Property injection — resolved lazily from the container */
@@ -27,8 +83,32 @@ declare function Autowired(token?: any): PropertyDecorator;
27
83
  *
28
84
  * **Constructor parameters only** — does not work as a property decorator.
29
85
  * For property injection with a token, use `@Autowired(token)` instead.
86
+ *
87
+ * ## Typed string-literal overload (architecture.md §22.4 #3)
88
+ *
89
+ * When called with a string literal that matches a key of the
90
+ * augmented `KickJsRegistry`, TypeScript narrows the parameter type
91
+ * to the registered type. Typo'd literals become compile errors
92
+ * (the string isn't `keyof KickJsRegistry`). Class identities and
93
+ * `InjectionToken<T>` keep working unchanged via the second overload.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * import { Service, Inject } from '@forinda/kickjs'
98
+ * import type { PrismaClient } from '@prisma/client'
99
+ *
100
+ * `@Service()`
101
+ * class UserRepo {
102
+ * constructor(@Inject('kick/prisma/Client') private db: PrismaClient) {}
103
+ * }
104
+ * ```
105
+ *
106
+ * After `kick typegen` populates `.kickjs/types/registry.d.ts` the
107
+ * literal autocompletes from the registry, and a typo
108
+ * (`@Inject('kick/prisma/Cleint')`) becomes a TS2345 error.
30
109
  */
31
- declare function Inject(token: any): ParameterDecorator;
110
+ declare function Inject<K extends keyof KickJsRegistry & string>(token: K): ParameterDecorator;
111
+ declare function Inject(token: unknown): ParameterDecorator;
32
112
  /**
33
113
  * Global ambient registry of typed environment variables, populated by
34
114
  * `kick typegen` from the project's env schema (typically
@@ -89,6 +169,61 @@ type ValueKey<K extends string> = [EnvKey] extends [never] ? K : K & EnvKey;
89
169
  * schema's inferred type for that key.
90
170
  */
91
171
  declare function Value<K extends string>(envKey: ValueKey<K>, defaultValue?: K extends EnvKey ? KickEnv[K] : unknown): PropertyDecorator;
172
+ /**
173
+ * Flatten the nested `KickAssets` augmentation (typegen-emitted in
174
+ * PR 4) into a string-literal union of dot/slash-joined paths.
175
+ *
176
+ * `interface KickAssets { mails: { welcome: () => string; orders: {
177
+ * confirmation: () => string } } }` becomes
178
+ * `'mails/welcome' | 'mails/orders/confirmation'`.
179
+ *
180
+ * Returns `never` when `KickAssets` is empty (no typegen has run yet)
181
+ * so `AssetKeyArg` falls through to accept any string.
182
+ */
183
+ type FlattenAssets<T, Prefix extends string = ''> = { [K in keyof T & string]: T[K] extends (() => string) ? `${Prefix}${K}` : T[K] extends Record<string, unknown> ? FlattenAssets<T[K], `${Prefix}${K}/`> : never }[keyof T & string];
184
+ /** Flat union of every known `<namespace>/<key>` path. */
185
+ type AssetKey = FlattenAssets<KickAssets>;
186
+ /**
187
+ * Constraint mirroring `ValueKey<K>` — accepts any string when
188
+ * `AssetKey` is `never` (back-compat for adopters who haven't run
189
+ * `kick typegen` yet) but locks the argument to known literals once
190
+ * the typegen-augmented `KickAssets` interface is populated.
191
+ */
192
+ type AssetKeyArg<K extends string> = [AssetKey] extends [never] ? K : K & AssetKey;
193
+ /**
194
+ * Inject the resolved file-system path for a typed asset. Mirrors
195
+ * `@Value`'s lazy-getter pattern — the asset is resolved on every
196
+ * property access, NOT at class instantiation, so:
197
+ *
198
+ * - Tests can swap fixtures + clear the cache without re-instantiating
199
+ * the consuming class.
200
+ * - The first access cost is paid once per process (the manifest cache
201
+ * in `core/assets.ts` makes subsequent calls cheap).
202
+ *
203
+ * Type-safety:
204
+ *
205
+ * - Without typegen, any string key is accepted (back-compat — same
206
+ * trick as `@Value`).
207
+ * - After typegen, `KickAssets` is populated and `AssetKey` is a
208
+ * union of every flattened `<namespace>/<key>` path. Unknown keys
209
+ * become a TS error.
210
+ *
211
+ * @example
212
+ * ```ts
213
+ * import { Service, Asset } from '@forinda/kickjs'
214
+ *
215
+ * `@Service()`
216
+ * class MailService {
217
+ * `@Asset('mails/welcome')`
218
+ * private welcomeTemplate!: string
219
+ *
220
+ * send(user: User) {
221
+ * return ejs.renderFile(this.welcomeTemplate, { user })
222
+ * }
223
+ * }
224
+ * ```
225
+ */
226
+ declare function Asset<K extends string>(assetKey: AssetKeyArg<K>): PropertyDecorator;
92
227
  interface RouteDefinition {
93
228
  method: string;
94
229
  path: string;
@@ -152,11 +287,11 @@ declare function ApiQueryParams(config: ApiQueryParamsConfig | ColumnApiQueryPar
152
287
  /**
153
288
  * Middleware handler function.
154
289
  * Generic `TCtx` defaults to `any` — import `RequestContext` from
155
- * `@forinda/kickjs-http` for full type safety:
290
+ * `@forinda/kickjs` for full type safety:
156
291
  *
157
292
  * ```ts
158
- * import type { MiddlewareHandler } from '@forinda/kickjs-core'
159
- * import type { RequestContext } from '@forinda/kickjs-http'
293
+ * import type { MiddlewareHandler } from '@forinda/kickjs'
294
+ * import type { RequestContext } from '@forinda/kickjs'
160
295
  *
161
296
  * const auth: MiddlewareHandler<RequestContext> = (ctx, next) => {
162
297
  * ctx.body // fully typed
@@ -200,5 +335,5 @@ declare function FileUpload(config: FileUploadConfig): MethodDecorator;
200
335
  /** Add a static builder() method for fluent construction */
201
336
  declare function Builder(target: any): void;
202
337
  //#endregion
203
- export { Put as C, Value as D, Service as E, normalizeApiQueryParamsConfig as O, PostConstruct as S, RouteDefinition as T, Injectable as _, Builder as a, Patch as b, Controller as c, EnvKey as d, FileTypeFilter as f, Inject as g, Get as h, BaseUploadOptions as i, Delete as l, FileUploadConfig as m, ApiQueryParamsConfig as n, ColumnApiQueryParamsConfig as o, FileUpload as p, Autowired as r, Component as s, ApiQueryParams as t, Env as u, Middleware as v, Repository as w, Post as x, MiddlewareHandler as y };
204
- //# sourceMappingURL=decorators-H42oPg0m.d.mts.map
338
+ export { normalizeApiQueryParamsConfig as A, Post as C, RouteDefinition as D, Repository as E, assets as F, clearAssetCache as I, resolveAsset as L, ASSET_MANIFEST_VERSION as M, KickAssets as N, Service as O, UnknownAssetError as P, useAssets as R, Patch as S, Put as T, Get as _, Autowired as a, Middleware as b, ColumnApiQueryParamsConfig as c, Delete as d, Env as f, FileUploadConfig as g, FileUpload as h, AssetKey as i, ASSETS as j, Value as k, Component as l, FileTypeFilter as m, ApiQueryParamsConfig as n, BaseUploadOptions as o, EnvKey as p, Asset as r, Builder as s, ApiQueryParams as t, Controller as u, Inject as v, PostConstruct as w, MiddlewareHandler as x, Injectable as y };
339
+ //# sourceMappingURL=decorators-BMvaLliz.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators-BMvaLliz.d.mts","names":[],"sources":["../src/core/assets.ts","../src/core/decorators.ts"],"mappings":"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"}
@@ -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 { t as __require } from "./chunk-Bt-rz0Tp.mjs";
12
- import { t as Container } from "./container-Dnk43k54.mjs";
11
+ import { p as __require, t as Container } from "./container-BYuMSnqW.mjs";
13
12
  import { z } from "zod";
14
13
  //#region src/config/env.ts
15
14
  /**
@@ -129,4 +128,4 @@ function resetEnvCache() {
129
128
  //#endregion
130
129
  export { reloadEnv as a, loadEnv as i, defineEnv as n, resetEnvCache as o, getEnv as r, baseEnvSchema as t };
131
130
 
132
- //# sourceMappingURL=env-Cs8Wt8A_.mjs.map
131
+ //# sourceMappingURL=env-DMqv56Bb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-Cs8Wt8A_.mjs","names":[],"sources":["../src/config/env.ts"],"sourcesContent":["import { z } from 'zod'\nimport { Container } from '../core/container'\nimport type { EnvKey } from '../core/decorators'\n\n/**\n * Lazily load `.env` via dotenv if it is installed in the consumer app.\n * `dotenv` is an **optional peer dependency** of `@forinda/kickjs` —\n * apps that want `.env` file support install it themselves (the CLI\n * generators add it to every scaffolded `package.json`). Apps that\n * inject env via the shell, Docker, or a secret manager can skip it\n * entirely and `process.env` is read as-is.\n *\n * We call `dotenv.config()` directly rather than `require('dotenv/config')`\n * so that a re-evaluation of this module (e.g. Vite SSR full-reload after\n * editing `.env`) can re-read the file. `dotenv/config` is a side-effect\n * shim that CJS caches aggressively, so the second `require` is a no-op\n * and new keys never reach `process.env` — the root cause of the\n * \"DATABASE_URL undefined until restart\" bug on Windows dev.\n */\nfunction tryLoadDotenv(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const dotenv = require('dotenv')\n dotenv.config({ override: false })\n } catch {\n // dotenv not installed — fall through, env vars must come from\n // the environment directly. This is a valid deployment style.\n }\n}\ntryLoadDotenv()\n\n/**\n * Base environment schema with common server variables.\n * Users extend this with their own application-specific vars.\n */\nexport const baseEnvSchema = z.object({\n // Server\n PORT: z.coerce.number().default(3000),\n NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),\n LOG_LEVEL: z.string().default('info'),\n})\n\n/** Cached env config to avoid re-parsing — keyed by schema reference */\nlet cachedEnv: any = null\nlet cachedSchema: any = null\n\n/**\n * Define a custom env schema. The base schema (`PORT`, `NODE_ENV`,\n * `LOG_LEVEL`) is always merged in, so users never need to remember to\n * extend it themselves — both styles below produce the same result and\n * both surface the base keys in `KickEnv`.\n *\n * Returns a Zod schema that validates `process.env`.\n *\n * @example\n * ```ts\n * // Style A — return a fresh object; base fields are merged automatically\n * export default defineEnv(() =>\n * z.object({\n * DATABASE_URL: z.string().url(),\n * JWT_SECRET: z.string().min(32),\n * })\n * )\n *\n * // Style B — explicitly extend `base` (still works, identical result)\n * export default defineEnv((base) =>\n * base.extend({\n * DATABASE_URL: z.string().url(),\n * })\n * )\n * ```\n *\n * User-defined keys override base keys when they collide, so a project\n * can re-type `PORT` or tighten `NODE_ENV` without losing the rest of\n * the base shape.\n */\nexport function defineEnv<T extends z.ZodRawShape>(\n extend: (base: typeof baseEnvSchema) => z.ZodObject<T>,\n): z.ZodObject<typeof baseEnvSchema.shape & T> {\n const userSchema = extend(baseEnvSchema)\n // Always merge the base in. `extend` lets the user's shape override\n // any colliding base keys, which preserves the escape hatch for\n // projects that want to re-type `PORT` etc.\n return baseEnvSchema.extend(userSchema.shape) as z.ZodObject<typeof baseEnvSchema.shape & T>\n}\n\n/**\n * Parse and validate `process.env` against a Zod schema. Caches result per schema.\n *\n * **No-arg behaviour is sticky.** The first time `loadEnv(schema)` is called\n * with an extended schema, the cache holds that schema. Subsequent\n * `loadEnv()` calls (no arg) will reuse the cached extended schema rather\n * than falling back to `baseEnvSchema`.\n *\n * Stickiness matters because `ConfigService` and the `@Value()` decorator\n * both read through the no-arg form internally. Without it, resolving\n * either of them after a `loadEnv(extendedSchema)` call would silently\n * downgrade the env to the base shape and drop every user-defined key.\n *\n * To force a re-parse with a different schema, pass the new schema explicitly.\n * To start fresh, call `resetEnvCache()` (full reset) or `reloadEnv()`\n * (re-parse against the same schema after a `.env` file change).\n *\n * **Typing:**\n * - With an explicit schema → returns `z.infer<typeof schema>`.\n * - With no schema and `KickEnv` populated by typegen → returns\n * `KickEnv` (the project-wide typed env shape).\n * - With no schema and `KickEnv` empty → returns the base `Env`.\n */\nexport function loadEnv<T extends z.ZodObject<any>>(schema: T): z.infer<T>\nexport function loadEnv(): [EnvKey] extends [never] ? Env : KickEnv\nexport function loadEnv<T extends z.ZodObject<any>>(schema?: T): any {\n // Sticky: when called with no arg, prefer the most recently cached\n // schema over re-parsing with the base schema.\n const s = schema ?? cachedSchema ?? baseEnvSchema\n // Re-parse if schema changed or no cache yet\n if (cachedEnv && cachedSchema === s) return cachedEnv\n cachedSchema = s\n cachedEnv = s.parse(process.env)\n\n // Register env resolver so @Value() reads validated values\n Container._envResolver = (key: string) => cachedEnv?.[key]\n\n return cachedEnv\n}\n\n/**\n * Get a single typed environment variable value.\n *\n * Three forms:\n * - **No-arg, KickEnv populated** (`kick typegen` has run) → key is\n * constrained to known `KickEnv` keys; return type inferred from\n * the schema.\n * - **With explicit schema** → key constrained to that schema's keys;\n * return type is `z.infer<typeof schema>[K]`.\n * - **No-arg, KickEnv empty** → loose `string` key, `any` return.\n *\n * @example\n * ```ts\n * // After `kick typegen` (KickEnv populated):\n * const port = getEnv('PORT') // typed as number\n * const url = getEnv('DATABASE_URL') // typed as string\n *\n * // With an inline schema (legacy / one-off):\n * const dbUrl = getEnv('DATABASE_URL', envSchema)\n * ```\n */\nexport function getEnv<K extends EnvKey>(key: K): KickEnv[K]\nexport function getEnv<T extends z.ZodObject<any>, K extends string & keyof z.infer<T>>(\n key: K,\n schema: T,\n): z.infer<T>[K]\nexport function getEnv(key: string, schema?: z.ZodObject<any>): any {\n const env = schema ? loadEnv(schema) : (loadEnv() as Record<string, any>)\n return env[key]\n}\n\n/**\n * Reload env from `process.env`. Re-reads `.env` via dotenv (if\n * installed), then re-parses the result against the **same** schema\n * the project registered at startup. Called during HMR rebuild and by\n * `envWatchPlugin` to pick up `.env` file changes mid-session.\n *\n * Crucially, this preserves the registered schema. Wiping it would\n * silently downgrade `ConfigService` and `@Value()` back to the base\n * schema on the next read, so every user-defined key would start\n * resolving as `undefined` after the first `.env` save — which was the\n * original \"config disappears in dev\" bug.\n *\n * If you need to fully forget the schema (e.g. tests that swap schemas\n * between cases), call {@link resetEnvCache} instead.\n */\nexport function reloadEnv(): void {\n // Re-read .env file into process.env if dotenv is installed.\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n require('dotenv').config({ override: true })\n } catch {\n // dotenv not installed — nothing to reload, env comes from the\n // environment directly.\n }\n\n // Drop the parsed snapshot but keep the schema. Re-parse eagerly so\n // existing consumers (including ConfigService getters and @Value\n // resolvers that may already hold references to the env state) see\n // the new values on their very next read instead of having to\n // re-trigger any cache-population step.\n cachedEnv = null\n if (cachedSchema) {\n loadEnv(cachedSchema)\n }\n}\n\n/**\n * Fully reset the env cache, including the registered schema. Use this\n * in tests that need to swap schemas between cases — `reloadEnv()`\n * deliberately preserves the schema to avoid the \"user keys vanish on\n * `.env` reload\" footgun.\n */\nexport function resetEnvCache(): void {\n cachedEnv = null\n cachedSchema = null\n}\n\nexport type Env = z.infer<typeof baseEnvSchema>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAS,gBAAsB;AAC7B,KAAI;AAGF,YADuB,SAAS,CACzB,OAAO,EAAE,UAAU,OAAO,CAAC;SAC5B;;AAKV,eAAe;;;;;AAMf,MAAa,gBAAgB,EAAE,OAAO;CAEpC,MAAM,EAAE,OAAO,QAAQ,CAAC,QAAQ,IAAK;CACrC,UAAU,EAAE,KAAK;EAAC;EAAe;EAAc;EAAO,CAAC,CAAC,QAAQ,cAAc;CAC9E,WAAW,EAAE,QAAQ,CAAC,QAAQ,OAAO;CACtC,CAAC;;AAGF,IAAI,YAAiB;AACrB,IAAI,eAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCxB,SAAgB,UACd,QAC6C;CAC7C,MAAM,aAAa,OAAO,cAAc;AAIxC,QAAO,cAAc,OAAO,WAAW,MAAM;;AA4B/C,SAAgB,QAAoC,QAAiB;CAGnE,MAAM,IAAI,UAAU,gBAAgB;AAEpC,KAAI,aAAa,iBAAiB,EAAG,QAAO;AAC5C,gBAAe;AACf,aAAY,EAAE,MAAM,QAAQ,IAAI;AAGhC,WAAU,gBAAgB,QAAgB,YAAY;AAEtD,QAAO;;AA6BT,SAAgB,OAAO,KAAa,QAAgC;AAElE,SADY,SAAS,QAAQ,OAAO,GAAI,SAAS,EACtC;;;;;;;;;;;;;;;;;AAkBb,SAAgB,YAAkB;AAEhC,KAAI;AAEF,YAAQ,SAAS,CAAC,OAAO,EAAE,UAAU,MAAM,CAAC;SACtC;AAUR,aAAY;AACZ,KAAI,aACF,SAAQ,aAAa;;;;;;;;AAUzB,SAAgB,gBAAsB;AACpC,aAAY;AACZ,gBAAe"}
1
+ {"version":3,"file":"env-DMqv56Bb.mjs","names":[],"sources":["../src/config/env.ts"],"sourcesContent":["import { z } from 'zod'\nimport { Container } from '../core/container'\nimport type { EnvKey } from '../core/decorators'\n\n/**\n * Lazily load `.env` via dotenv if it is installed in the consumer app.\n * `dotenv` is an **optional peer dependency** of `@forinda/kickjs` —\n * apps that want `.env` file support install it themselves (the CLI\n * generators add it to every scaffolded `package.json`). Apps that\n * inject env via the shell, Docker, or a secret manager can skip it\n * entirely and `process.env` is read as-is.\n *\n * We call `dotenv.config()` directly rather than `require('dotenv/config')`\n * so that a re-evaluation of this module (e.g. Vite SSR full-reload after\n * editing `.env`) can re-read the file. `dotenv/config` is a side-effect\n * shim that CJS caches aggressively, so the second `require` is a no-op\n * and new keys never reach `process.env` — the root cause of the\n * \"DATABASE_URL undefined until restart\" bug on Windows dev.\n */\nfunction tryLoadDotenv(): void {\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const dotenv = require('dotenv')\n dotenv.config({ override: false })\n } catch {\n // dotenv not installed — fall through, env vars must come from\n // the environment directly. This is a valid deployment style.\n }\n}\ntryLoadDotenv()\n\n/**\n * Base environment schema with common server variables.\n * Users extend this with their own application-specific vars.\n */\nexport const baseEnvSchema = z.object({\n // Server\n PORT: z.coerce.number().default(3000),\n NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),\n LOG_LEVEL: z.string().default('info'),\n})\n\n/** Cached env config to avoid re-parsing — keyed by schema reference */\nlet cachedEnv: any = null\nlet cachedSchema: any = null\n\n/**\n * Define a custom env schema. The base schema (`PORT`, `NODE_ENV`,\n * `LOG_LEVEL`) is always merged in, so users never need to remember to\n * extend it themselves — both styles below produce the same result and\n * both surface the base keys in `KickEnv`.\n *\n * Returns a Zod schema that validates `process.env`.\n *\n * @example\n * ```ts\n * // Style A — return a fresh object; base fields are merged automatically\n * export default defineEnv(() =>\n * z.object({\n * DATABASE_URL: z.string().url(),\n * JWT_SECRET: z.string().min(32),\n * })\n * )\n *\n * // Style B — explicitly extend `base` (still works, identical result)\n * export default defineEnv((base) =>\n * base.extend({\n * DATABASE_URL: z.string().url(),\n * })\n * )\n * ```\n *\n * User-defined keys override base keys when they collide, so a project\n * can re-type `PORT` or tighten `NODE_ENV` without losing the rest of\n * the base shape.\n */\nexport function defineEnv<T extends z.ZodRawShape>(\n extend: (base: typeof baseEnvSchema) => z.ZodObject<T>,\n): z.ZodObject<typeof baseEnvSchema.shape & T> {\n const userSchema = extend(baseEnvSchema)\n // Always merge the base in. `extend` lets the user's shape override\n // any colliding base keys, which preserves the escape hatch for\n // projects that want to re-type `PORT` etc.\n return baseEnvSchema.extend(userSchema.shape) as z.ZodObject<typeof baseEnvSchema.shape & T>\n}\n\n/**\n * Parse and validate `process.env` against a Zod schema. Caches result per schema.\n *\n * **No-arg behaviour is sticky.** The first time `loadEnv(schema)` is called\n * with an extended schema, the cache holds that schema. Subsequent\n * `loadEnv()` calls (no arg) will reuse the cached extended schema rather\n * than falling back to `baseEnvSchema`.\n *\n * Stickiness matters because `ConfigService` and the `@Value()` decorator\n * both read through the no-arg form internally. Without it, resolving\n * either of them after a `loadEnv(extendedSchema)` call would silently\n * downgrade the env to the base shape and drop every user-defined key.\n *\n * To force a re-parse with a different schema, pass the new schema explicitly.\n * To start fresh, call `resetEnvCache()` (full reset) or `reloadEnv()`\n * (re-parse against the same schema after a `.env` file change).\n *\n * **Typing:**\n * - With an explicit schema → returns `z.infer<typeof schema>`.\n * - With no schema and `KickEnv` populated by typegen → returns\n * `KickEnv` (the project-wide typed env shape).\n * - With no schema and `KickEnv` empty → returns the base `Env`.\n */\nexport function loadEnv<T extends z.ZodObject<any>>(schema: T): z.infer<T>\nexport function loadEnv(): [EnvKey] extends [never] ? Env : KickEnv\nexport function loadEnv<T extends z.ZodObject<any>>(schema?: T): any {\n // Sticky: when called with no arg, prefer the most recently cached\n // schema over re-parsing with the base schema.\n const s = schema ?? cachedSchema ?? baseEnvSchema\n // Re-parse if schema changed or no cache yet\n if (cachedEnv && cachedSchema === s) return cachedEnv\n cachedSchema = s\n cachedEnv = s.parse(process.env)\n\n // Register env resolver so @Value() reads validated values\n Container._envResolver = (key: string) => cachedEnv?.[key]\n\n return cachedEnv\n}\n\n/**\n * Get a single typed environment variable value.\n *\n * Three forms:\n * - **No-arg, KickEnv populated** (`kick typegen` has run) → key is\n * constrained to known `KickEnv` keys; return type inferred from\n * the schema.\n * - **With explicit schema** → key constrained to that schema's keys;\n * return type is `z.infer<typeof schema>[K]`.\n * - **No-arg, KickEnv empty** → loose `string` key, `any` return.\n *\n * @example\n * ```ts\n * // After `kick typegen` (KickEnv populated):\n * const port = getEnv('PORT') // typed as number\n * const url = getEnv('DATABASE_URL') // typed as string\n *\n * // With an inline schema (legacy / one-off):\n * const dbUrl = getEnv('DATABASE_URL', envSchema)\n * ```\n */\nexport function getEnv<K extends EnvKey>(key: K): KickEnv[K]\nexport function getEnv<T extends z.ZodObject<any>, K extends string & keyof z.infer<T>>(\n key: K,\n schema: T,\n): z.infer<T>[K]\nexport function getEnv(key: string, schema?: z.ZodObject<any>): any {\n const env = schema ? loadEnv(schema) : (loadEnv() as Record<string, any>)\n return env[key]\n}\n\n/**\n * Reload env from `process.env`. Re-reads `.env` via dotenv (if\n * installed), then re-parses the result against the **same** schema\n * the project registered at startup. Called during HMR rebuild and by\n * `envWatchPlugin` to pick up `.env` file changes mid-session.\n *\n * Crucially, this preserves the registered schema. Wiping it would\n * silently downgrade `ConfigService` and `@Value()` back to the base\n * schema on the next read, so every user-defined key would start\n * resolving as `undefined` after the first `.env` save — which was the\n * original \"config disappears in dev\" bug.\n *\n * If you need to fully forget the schema (e.g. tests that swap schemas\n * between cases), call {@link resetEnvCache} instead.\n */\nexport function reloadEnv(): void {\n // Re-read .env file into process.env if dotenv is installed.\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n require('dotenv').config({ override: true })\n } catch {\n // dotenv not installed — nothing to reload, env comes from the\n // environment directly.\n }\n\n // Drop the parsed snapshot but keep the schema. Re-parse eagerly so\n // existing consumers (including ConfigService getters and @Value\n // resolvers that may already hold references to the env state) see\n // the new values on their very next read instead of having to\n // re-trigger any cache-population step.\n cachedEnv = null\n if (cachedSchema) {\n loadEnv(cachedSchema)\n }\n}\n\n/**\n * Fully reset the env cache, including the registered schema. Use this\n * in tests that need to swap schemas between cases — `reloadEnv()`\n * deliberately preserves the schema to avoid the \"user keys vanish on\n * `.env` reload\" footgun.\n */\nexport function resetEnvCache(): void {\n cachedEnv = null\n cachedSchema = null\n}\n\nexport type Env = z.infer<typeof baseEnvSchema>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAS,gBAAsB;AAC7B,KAAI;AAGF,YADuB,SAAS,CACzB,OAAO,EAAE,UAAU,OAAO,CAAC;SAC5B;;AAKV,eAAe;;;;;AAMf,MAAa,gBAAgB,EAAE,OAAO;CAEpC,MAAM,EAAE,OAAO,QAAQ,CAAC,QAAQ,IAAK;CACrC,UAAU,EAAE,KAAK;EAAC;EAAe;EAAc;EAAO,CAAC,CAAC,QAAQ,cAAc;CAC9E,WAAW,EAAE,QAAQ,CAAC,QAAQ,OAAO;CACtC,CAAC;;AAGF,IAAI,YAAiB;AACrB,IAAI,eAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCxB,SAAgB,UACd,QAC6C;CAC7C,MAAM,aAAa,OAAO,cAAc;AAIxC,QAAO,cAAc,OAAO,WAAW,MAAM;;AA4B/C,SAAgB,QAAoC,QAAiB;CAGnE,MAAM,IAAI,UAAU,gBAAgB;AAEpC,KAAI,aAAa,iBAAiB,EAAG,QAAO;AAC5C,gBAAe;AACf,aAAY,EAAE,MAAM,QAAQ,IAAI;AAGhC,WAAU,gBAAgB,QAAgB,YAAY;AAEtD,QAAO;;AA6BT,SAAgB,OAAO,KAAa,QAAgC;AAElE,SADY,SAAS,QAAQ,OAAO,GAAI,SAAS,EACtC;;;;;;;;;;;;;;;;;AAkBb,SAAgB,YAAkB;AAEhC,KAAI;AAEF,YAAQ,SAAS,CAAC,OAAO,EAAE,UAAU,MAAM,CAAC;SACtC;AAUR,aAAY;AACZ,KAAI,aACF,SAAQ,aAAa;;;;;;;;AAUzB,SAAgB,gBAAsB;AACpC,aAAY;AACZ,gBAAe"}
@@ -0,0 +1,20 @@
1
+
2
+ import { NextFunction, Request, Response } from "express";
3
+
4
+ //#region src/http/middleware/error-handler.d.ts
5
+ /** Catch-all for unmatched routes */
6
+ declare function notFoundHandler(): (_req: Request, res: Response, _next: NextFunction) => void;
7
+ /**
8
+ * Global error handler.
9
+ *
10
+ * Default behavior strips error `details` from the response in production
11
+ * (NODE_ENV === 'production') so internal context (DB errors, validation
12
+ * issues, custom payloads) does not leak to clients. Apps that want to
13
+ * expose details in production — for client-facing field-level validation,
14
+ * for example — should pass their own `onError` to `bootstrap()` and decide
15
+ * the policy explicitly.
16
+ */
17
+ declare function errorHandler(): (err: any, req: Request, res: Response, _next: NextFunction) => Response<any, Record<string, any>> | undefined;
18
+ //#endregion
19
+ export { notFoundHandler as n, errorHandler as t };
20
+ //# sourceMappingURL=error-handler-Xud_3Lah.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler-Xud_3Lah.d.mts","names":[],"sources":["../src/http/middleware/error-handler.ts"],"mappings":";;;;;iBAMgB,eAAA,CAAA,IACN,IAAA,EAAM,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,KAAA,EAAO,YAAA;AAD/C;;;;;;;;;;AAAA,iBAgBgB,YAAA,CAAA,IAEN,GAAA,OAAU,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,KAAA,EAAO,YAAA,KAAY,QAAA,MAAA,MAAA"}
@@ -78,4 +78,4 @@ declare class HttpException extends Error {
78
78
  }
79
79
  //#endregion
80
80
  export { ValidationError as i, HttpStatus as n, HttpStatusCode as r, HttpException as t };
81
- //# sourceMappingURL=errors-D_CWI7Bl.d.mts.map
81
+ //# sourceMappingURL=errors-uaHCeXRz.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors-D_CWI7Bl.d.mts","names":[],"sources":["../src/core/errors.ts"],"mappings":";;;AAUA;;;;;;;;;cAAa,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCD,cAAA,WAAyB,UAAA,eAAyB,UAAA;;UAG7C,eAAA;EACf,KAAA;EACA,OAAA;EACA,IAAA;AAAA;;;AAeF;;;;;;;;;;cAAa,aAAA,SAAsB,KAAA;EAAA,SAEf,MAAA;EAAA,SAEA,OAAA;EAAA,SACA,OAAA,GAAU,MAAA;cAHV,MAAA,UAChB,OAAA,UACgB,OAAA,wBACA,OAAA,GAAU,MAAA;EAsDsD;EA/ClF,WAAA,CAAY,OAAA,EAAS,MAAA,mBAAyB,aAAA;EA0DuC;EAAA,OAlD9E,YAAA,CAAa,KAAA,OAAY,OAAA,YAAmB,aAAA;EAAA,OAc5C,UAAA,CAAW,OAAA,YAAuB,aAAA;EAAA,OAGlC,YAAA,CAAa,OAAA,WAA0B,eAAA,YAAwB,aAAA;EAAA,OAQ/D,SAAA,CAAU,OAAA,YAAqB,aAAA;EAAA,OAG/B,QAAA,CAAS,OAAA,YAAqB,aAAA;EAAA,OAG9B,gBAAA,CAAiB,cAAA,YAA0B,OAAA,YAA8B,aAAA;EAAA,OAKzE,QAAA,CAAS,OAAA,YAAoB,aAAA;EAAA,OAG7B,aAAA,CAAc,OAAA,WAAkC,OAAA,GAAU,eAAA,KAAiB,aAAA;EAAA,OAG3E,eAAA,CAAgB,OAAA,WAA+B,iBAAA,YAA0B,aAAA;EAAA,OAQzE,kBAAA,CAAmB,OAAA,WAAiC,iBAAA,YAA0B,aAAA;EAAA,OAQ9E,QAAA,CAAS,OAAA,YAAiC,aAAA;AAAA"}
1
+ {"version":3,"file":"errors-uaHCeXRz.d.mts","names":[],"sources":["../src/core/errors.ts"],"mappings":";;;AAUA;;;;;;;;;cAAa,UAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCD,cAAA,WAAyB,UAAA,eAAyB,UAAA;;UAG7C,eAAA;EACf,KAAA;EACA,OAAA;EACA,IAAA;AAAA;;;AAeF;;;;;;;;;;cAAa,aAAA,SAAsB,KAAA;EAAA,SAEf,MAAA;EAAA,SAEA,OAAA;EAAA,SACA,OAAA,GAAU,MAAA;cAHV,MAAA,UAChB,OAAA,UACgB,OAAA,wBACA,OAAA,GAAU,MAAA;EAsDsD;EA/ClF,WAAA,CAAY,OAAA,EAAS,MAAA,mBAAyB,aAAA;EA0DuC;EAAA,OAlD9E,YAAA,CAAa,KAAA,OAAY,OAAA,YAAmB,aAAA;EAAA,OAc5C,UAAA,CAAW,OAAA,YAAuB,aAAA;EAAA,OAGlC,YAAA,CAAa,OAAA,WAA0B,eAAA,YAAwB,aAAA;EAAA,OAQ/D,SAAA,CAAU,OAAA,YAAqB,aAAA;EAAA,OAG/B,QAAA,CAAS,OAAA,YAAqB,aAAA;EAAA,OAG9B,gBAAA,CAAiB,cAAA,YAA0B,OAAA,YAA8B,aAAA;EAAA,OAKzE,QAAA,CAAS,OAAA,YAAoB,aAAA;EAAA,OAG7B,aAAA,CAAc,OAAA,WAAkC,OAAA,GAAU,eAAA,KAAiB,aAAA;EAAA,OAG3E,eAAA,CAAgB,OAAA,WAA+B,iBAAA,YAA0B,aAAA;EAAA,OAQzE,kBAAA,CAAmB,OAAA,WAAiC,iBAAA,YAA0B,aAAA;EAAA,OAQ9E,QAAA,CAAS,OAAA,YAAiC,aAAA;AAAA"}
@@ -54,4 +54,4 @@ interface ExecutionContext {
54
54
  }
55
55
  //#endregion
56
56
  export { ExecutionContext as n, MetaValue as r, ContextMeta as t };
57
- //# sourceMappingURL=execution-context-Dl2CKqSo.d.mts.map
57
+ //# sourceMappingURL=execution-context-DKnt61pY.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution-context-Dl2CKqSo.d.mts","names":[],"sources":["../src/core/execution-context.ts"],"mappings":";;;AAmCA;;;;;AAGA;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;UAfiB,WAAA;;KAGL,SAAA,yCAAkD,CAAA,eAAgB,WAAA,GAC1E,WAAA,CAAY,CAAA,IACZ,QAAA;;;;;;;;;UAUa,gBAAA;EAIsB;EAFrC,GAAA,mBAAsB,GAAA,EAAK,CAAA,GAAI,SAAA,CAAU,CAAA;EAEX;EAA9B,GAAA,mBAAsB,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,SAAA,CAAU,CAAA;EAE7B;EAAA,SAAT,SAAA;AAAA"}
1
+ {"version":3,"file":"execution-context-DKnt61pY.d.mts","names":[],"sources":["../src/core/execution-context.ts"],"mappings":";;;AAmCA;;;;;AAGA;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;UAfiB,WAAA;;KAGL,SAAA,yCAAkD,CAAA,eAAgB,WAAA,GAC1E,WAAA,CAAY,CAAA,IACZ,QAAA;;;;;;;;;UAUa,gBAAA;EAIsB;EAFrC,GAAA,mBAAsB,GAAA,EAAK,CAAA,GAAI,SAAA,CAAU,CAAA;EAEX;EAA9B,GAAA,mBAAsB,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,SAAA,CAAU,CAAA;EAE7B;EAAA,SAAT,SAAA;AAAA"}
@@ -0,0 +1,41 @@
1
+
2
+ import { NextFunction, Request, Response } from "express";
3
+
4
+ //#region src/http/middleware/helmet.d.ts
5
+ interface HelmetOptions {
6
+ /** Set Content-Security-Policy header (default: self-only policy) */
7
+ contentSecurityPolicy?: boolean | Record<string, string[]>;
8
+ /** Set X-Content-Type-Options: nosniff (default: true) */
9
+ noSniff?: boolean;
10
+ /** Set X-Frame-Options (default: 'DENY') */
11
+ frameguard?: false | 'DENY' | 'SAMEORIGIN';
12
+ /** Set Strict-Transport-Security (default: max-age=31536000; includeSubDomains) */
13
+ hsts?: false | {
14
+ maxAge?: number;
15
+ includeSubDomains?: boolean;
16
+ preload?: boolean;
17
+ };
18
+ /** Set X-DNS-Prefetch-Control (default: off) */
19
+ dnsPrefetch?: boolean;
20
+ /** Remove X-Powered-By header (default: true) */
21
+ hidePoweredBy?: boolean;
22
+ /** Set Referrer-Policy (default: 'no-referrer') */
23
+ referrerPolicy?: false | string;
24
+ /** Set X-XSS-Protection: 0 (default: true — disables legacy XSS auditor) */
25
+ xssFilter?: boolean;
26
+ }
27
+ /**
28
+ * Security headers middleware. Lightweight alternative to the `helmet` npm package
29
+ * with sensible defaults for API servers.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * bootstrap({
34
+ * middleware: [helmet(), requestId(), express.json()],
35
+ * })
36
+ * ```
37
+ */
38
+ declare function helmet(options?: HelmetOptions): (req: Request, res: Response, next: NextFunction) => void;
39
+ //#endregion
40
+ export { helmet as n, HelmetOptions as t };
41
+ //# sourceMappingURL=helmet-CaMbjzBG.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helmet-CaMbjzBG.d.mts","names":[],"sources":["../src/http/middleware/helmet.ts"],"mappings":";;;;UAEiB,aAAA;;EAEf,qBAAA,aAAkC,MAAA;EAFN;EAI5B,OAAA;EAFwC;EAIxC,UAAA;EAJkC;EAMlC,IAAA;IAAiB,MAAA;IAAiB,iBAAA;IAA6B,OAAA;EAAA;EAAA;EAE/D,WAAA;EAEA;EAAA,aAAA;EAIA;EAFA,cAAA;EAES;EAAT,SAAA;AAAA;;;;;;;;;;;;iBAcc,MAAA,CAAO,OAAA,GAAS,aAAA,IAYtB,GAAA,EAAK,OAAA,EAAS,GAAA,EAAK,QAAA,EAAU,IAAA,EAAM,YAAA"}