@forinda/kickjs 5.4.0 → 5.6.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 (101) hide show
  1. package/dist/{adapter-C1w_xt08.d.mts → adapter-0r2uRCD3.d.mts} +2 -2
  2. package/dist/{adapter-C1w_xt08.d.mts.map → adapter-0r2uRCD3.d.mts.map} +1 -1
  3. package/dist/app-module-CzlIIjO3.d.mts +92 -0
  4. package/dist/app-module-CzlIIjO3.d.mts.map +1 -0
  5. package/dist/{application-BTRI4aBd.d.mts → application-CaEYca9E.d.mts} +34 -7
  6. package/dist/application-CaEYca9E.d.mts.map +1 -0
  7. package/dist/application-YJZ2frWX.mjs +12 -0
  8. package/dist/application-YJZ2frWX.mjs.map +1 -0
  9. package/dist/{bootstrap-B4YrBipl.d.mts → bootstrap-Db8k2-21.d.mts} +2 -2
  10. package/dist/{bootstrap-B4YrBipl.d.mts.map → bootstrap-Db8k2-21.d.mts.map} +1 -1
  11. package/dist/{bootstrap-B7j_-dOg.mjs → bootstrap-UCZoqbbW.mjs} +3 -3
  12. package/dist/{bootstrap-B7j_-dOg.mjs.map → bootstrap-UCZoqbbW.mjs.map} +1 -1
  13. package/dist/config/index.mjs +2 -2
  14. package/dist/{config-Dk5RVTnD.mjs → config-D6VaNpwo.mjs} +3 -3
  15. package/dist/{config-Dk5RVTnD.mjs.map → config-D6VaNpwo.mjs.map} +1 -1
  16. package/dist/container-D0v17gF8.mjs +12 -0
  17. package/dist/{container-DArhTDQQ.mjs.map → container-D0v17gF8.mjs.map} +1 -1
  18. package/dist/context-CbX_T0XC.mjs +12 -0
  19. package/dist/context-CbX_T0XC.mjs.map +1 -0
  20. package/dist/{context-BAdAV-zO.d.mts → context-aocg9gO-.d.mts} +36 -1
  21. package/dist/context-aocg9gO-.d.mts.map +1 -0
  22. package/dist/{context-decorator-Bca_BoRK.d.mts → context-decorator-BgdDd-6X.d.mts} +19 -4
  23. package/dist/{context-decorator-Bca_BoRK.d.mts.map → context-decorator-BgdDd-6X.d.mts.map} +1 -1
  24. package/dist/core/adapter.d.mts +1 -1
  25. package/dist/core/adapter.mjs +1 -1
  26. package/dist/core/app-module.d.mts +2 -2
  27. package/dist/core/app-module.mjs +1 -1
  28. package/dist/core/cache.mjs +1 -1
  29. package/dist/core/container.mjs +2 -2
  30. package/dist/core/cron.mjs +2 -2
  31. package/dist/core/decorators.mjs +2 -2
  32. package/dist/core/decorators.mjs.map +1 -1
  33. package/dist/core/errors.mjs +1 -1
  34. package/dist/core/interfaces.mjs +1 -1
  35. package/dist/core/logger.mjs +1 -1
  36. package/dist/core/path.mjs +1 -1
  37. package/dist/core/path.mjs.map +1 -1
  38. package/dist/core/plugin.d.mts +1 -1
  39. package/dist/core/plugin.mjs +1 -1
  40. package/dist/core/reactivity.mjs +1 -1
  41. package/dist/core-DvTHNOay.mjs +13 -0
  42. package/dist/core-DvTHNOay.mjs.map +1 -0
  43. package/dist/{env-BL0xOTyi.mjs → env-yTMEMpV6.mjs} +3 -3
  44. package/dist/{env-BL0xOTyi.mjs.map → env-yTMEMpV6.mjs.map} +1 -1
  45. package/dist/http/application.d.mts +1 -1
  46. package/dist/http/application.mjs +2 -2
  47. package/dist/http/bootstrap.d.mts +1 -1
  48. package/dist/http/bootstrap.mjs +2 -2
  49. package/dist/http/context.d.mts +1 -1
  50. package/dist/http/context.mjs +2 -2
  51. package/dist/http/middleware/cors.mjs +1 -1
  52. package/dist/http/middleware/csrf.mjs +1 -1
  53. package/dist/http/middleware/error-handler.mjs +2 -2
  54. package/dist/http/middleware/helmet.mjs +1 -1
  55. package/dist/http/middleware/rate-limit.mjs +1 -1
  56. package/dist/http/middleware/request-id.mjs +1 -1
  57. package/dist/http/middleware/request-logger.mjs +2 -2
  58. package/dist/http/middleware/session.mjs +1 -1
  59. package/dist/http/middleware/session.mjs.map +1 -1
  60. package/dist/http/middleware/spa.d.mts +1 -1
  61. package/dist/http/middleware/spa.mjs +2 -2
  62. package/dist/http/middleware/upload.mjs +1 -1
  63. package/dist/http/middleware/upload.mjs.map +1 -1
  64. package/dist/http/middleware/validate.mjs +2 -2
  65. package/dist/http/middleware/views.d.mts +1 -1
  66. package/dist/http/middleware/views.mjs +2 -2
  67. package/dist/http/query/index.mjs +2 -2
  68. package/dist/http/router-builder.d.mts +1 -1
  69. package/dist/http/router-builder.mjs +2 -2
  70. package/dist/http/router-builder.mjs.map +1 -1
  71. package/dist/{index-DvZfBNIf.d.mts → index-D-Wb23e6.d.mts} +264 -86
  72. package/dist/index-D-Wb23e6.d.mts.map +1 -0
  73. package/dist/index.d.mts +12 -12
  74. package/dist/index.mjs +2 -2
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/{metadata-Dn6kNT82.mjs → metadata-IHiynOCv.mjs} +2 -2
  77. package/dist/{metadata-Dn6kNT82.mjs.map → metadata-IHiynOCv.mjs.map} +1 -1
  78. package/dist/{plugin-DF8Xfv9Z.d.mts → plugin-JMkG7soG.d.mts} +102 -8
  79. package/dist/plugin-JMkG7soG.d.mts.map +1 -0
  80. package/dist/{query-B7n5isk_.mjs → query-CQU-Hyiv.mjs} +2 -2
  81. package/dist/{query-B7n5isk_.mjs.map → query-CQU-Hyiv.mjs.map} +1 -1
  82. package/dist/{router-builder-C7sXk_FG.d.mts → router-builder-CaQ629tw.d.mts} +2 -2
  83. package/dist/{router-builder-C7sXk_FG.d.mts.map → router-builder-CaQ629tw.d.mts.map} +1 -1
  84. package/dist/{spa-e4FIS2RB.d.mts → spa-CreyQc4N.d.mts} +2 -2
  85. package/dist/{spa-e4FIS2RB.d.mts.map → spa-CreyQc4N.d.mts.map} +1 -1
  86. package/dist/{views-oKRSw0Op.d.mts → views-BMhrZsH9.d.mts} +4 -4
  87. package/dist/{views-oKRSw0Op.d.mts.map → views-BMhrZsH9.d.mts.map} +1 -1
  88. package/package.json +2 -2
  89. package/dist/app-module-D6zL_V5S.d.mts +0 -50
  90. package/dist/app-module-D6zL_V5S.d.mts.map +0 -1
  91. package/dist/application-BTRI4aBd.d.mts.map +0 -1
  92. package/dist/application-mir5CSWO.mjs +0 -12
  93. package/dist/application-mir5CSWO.mjs.map +0 -1
  94. package/dist/container-DArhTDQQ.mjs +0 -12
  95. package/dist/context-BAdAV-zO.d.mts.map +0 -1
  96. package/dist/context-CIoXqpAX.mjs +0 -12
  97. package/dist/context-CIoXqpAX.mjs.map +0 -1
  98. package/dist/core-BQZyB8Wv.mjs +0 -12
  99. package/dist/core-BQZyB8Wv.mjs.map +0 -1
  100. package/dist/index-DvZfBNIf.d.mts.map +0 -1
  101. package/dist/plugin-DF8Xfv9Z.d.mts.map +0 -1
@@ -1,9 +1,265 @@
1
1
 
2
2
  import { s as InjectionToken, t as Container } from "./container-BZKeHc5X.mjs";
3
3
  import { n as ExecutionContext } from "./execution-context-DKnt61pY.mjs";
4
- import { t as AnyContributorRegistration } from "./context-decorator-Bca_BoRK.mjs";
5
- import { r as AppAdapter } from "./adapter-C1w_xt08.mjs";
6
- import { t as KickPlugin } from "./plugin-DF8Xfv9Z.mjs";
4
+ import { t as AnyContributorRegistration } from "./context-decorator-BgdDd-6X.mjs";
5
+ import { r as AppAdapter } from "./adapter-0r2uRCD3.mjs";
6
+ import { r as AppModuleEntry, t as AppModule } from "./app-module-CzlIIjO3.mjs";
7
+ import { t as KickPlugin } from "./plugin-JMkG7soG.mjs";
8
+ //#region src/core/define-plugin.d.ts
9
+ /**
10
+ * Options passed to {@link definePlugin}. Mirrors the spec in
11
+ * `architecture.md` §21.3.1 + §21.2.2 (Phase A "lite").
12
+ */
13
+ interface DefinePluginOptions<TConfig> {
14
+ /** Stable identity used for logging, `dependsOn` lookups, and `.scoped()` namespacing. */
15
+ name: string;
16
+ /** Optional plugin version — surfaced to DevTools and `kick add` compatibility checks (Phase B). */
17
+ version?: string;
18
+ /**
19
+ * Peer-version ranges this plugin needs from the framework or other
20
+ * plugins. Recorded as metadata; runtime enforcement lands in §21.4.4.
21
+ */
22
+ requires?: {
23
+ kickjs?: string;
24
+ };
25
+ /** Default config merged under any caller overrides. */
26
+ defaults?: Partial<TConfig>;
27
+ /** Builds the underlying {@link KickPlugin} from the resolved config. */
28
+ build(config: TConfig, ctx: BuildContext): Omit<KickPlugin, 'name'>;
29
+ }
30
+ /**
31
+ * Hook context handed to a plugin/adapter `build` function. `name` is the
32
+ * resolved instance name (the bare definition name for the bare call,
33
+ * or `${defName}:${scope}` for `.scoped()`). `scoped` is the discriminator
34
+ * authors use to namespace DI tokens or resource keys.
35
+ */
36
+ interface BuildContext {
37
+ name: string;
38
+ scoped: boolean;
39
+ }
40
+ /**
41
+ * Async-config form of a plugin or adapter — `inject` lists DI tokens to
42
+ * resolve from the container, then `useFactory` produces the config.
43
+ *
44
+ * Plugins resolve this lazily inside `onReady`, so any module/adapter/
45
+ * middleware/contributor a plugin contributes via `build` is **not
46
+ * available** when `.async()` is used. Use the bare/`.scoped()` form for
47
+ * plugins that need to register modules or middleware.
48
+ */
49
+ interface PluginAsyncOptions<TConfig> {
50
+ inject?: ReadonlyArray<unknown>;
51
+ useFactory(...deps: any[]): TConfig | Promise<TConfig>;
52
+ }
53
+ /**
54
+ * Factory returned by {@link definePlugin}. Callable form is the singleton
55
+ * (`AuthPlugin(config)`); `.scoped()` and `.async()` are the multi-instance
56
+ * and deferred-config forms.
57
+ */
58
+ interface PluginFactory<TConfig> {
59
+ (config?: Partial<TConfig>): KickPlugin;
60
+ scoped(scopeName: string, config?: Partial<TConfig>): KickPlugin;
61
+ async(opts: PluginAsyncOptions<TConfig>): KickPlugin;
62
+ /** Read-only access to the original definition — useful for DevTools introspection. */
63
+ readonly definition: Readonly<DefinePluginOptions<TConfig>>;
64
+ }
65
+ /**
66
+ * Build a {@link KickPlugin} factory from a typed definition. See
67
+ * `architecture.md` §21.2.2 for the design rationale.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const FlagsPlugin = definePlugin<FlagsConfig>({
72
+ * name: 'FlagsPlugin',
73
+ * defaults: { defaultTtl: 60_000 },
74
+ * build(config) {
75
+ * return {
76
+ * register(container) {
77
+ * container.registerInstance(FLAGS, makeProvider(config))
78
+ * },
79
+ * }
80
+ * },
81
+ * })
82
+ *
83
+ * bootstrap({ plugins: [FlagsPlugin({ provider: launchDarkly })] })
84
+ * ```
85
+ */
86
+ declare function definePlugin<TConfig = Record<string, unknown>>(options: DefinePluginOptions<TConfig>): PluginFactory<TConfig>;
87
+ //#endregion
88
+ //#region src/core/define-module.d.ts
89
+ /**
90
+ * Options passed to {@link defineModule}. Mirrors {@link DefineAdapterOptions}
91
+ * and {@link DefinePluginOptions} so adopters learn one mental model
92
+ * across all three primitives.
93
+ *
94
+ * The optional `TExtra` generic lets a module ship public methods
95
+ * beyond the standard {@link AppModule} contract — they're preserved
96
+ * on the returned module instance so external callers (tests, sibling
97
+ * modules) can invoke them directly.
98
+ */
99
+ interface DefineModuleOptions<TConfig, TExtra = unknown> {
100
+ /**
101
+ * Stable identity surfaced in diagnostics, route logs, and
102
+ * `.scoped()` namespacing. Required because boot-time error
103
+ * messages reference modules by name — anonymous modules make
104
+ * cycles + missing-dep errors hard to localize.
105
+ */
106
+ name: string;
107
+ /** Optional version string surfaced in diagnostics. */
108
+ version?: string;
109
+ /**
110
+ * Optional kickjs version constraint. Enforced by the framework
111
+ * when implemented; today it lives on the definition for
112
+ * documentation and forward compatibility.
113
+ */
114
+ requires?: {
115
+ kickjs?: string;
116
+ };
117
+ /**
118
+ * Default config merged with overrides at instantiation time
119
+ * (`MyModule({ field: x })`). Call-site overrides win.
120
+ */
121
+ defaults?: Partial<TConfig>;
122
+ /**
123
+ * Build the AppModule shape from the resolved config and context.
124
+ * `ctx.name` is the resolved instance name (the bare definition
125
+ * name for the default call, or `${name}:${scope}` for
126
+ * `.scoped()`); `ctx.scoped` discriminates so the build function
127
+ * can branch on namespacing if needed.
128
+ *
129
+ * Return any extension methods alongside the standard
130
+ * {@link AppModule} surface — they're typed via `TExtra` and stay
131
+ * accessible on the resulting instance.
132
+ */
133
+ build(config: TConfig, ctx: BuildContext): AppModule & TExtra;
134
+ }
135
+ /**
136
+ * Factory returned by {@link defineModule}. Mirrors {@link AdapterFactory}
137
+ * — call (`MyModule({...})`), scope (`MyModule.scoped('public', {...})`),
138
+ * inspect (`MyModule.definition`).
139
+ *
140
+ * `.async()` is intentionally **not** part of the module factory
141
+ * surface. Module config has no async-resolution window: `register()`
142
+ * and `routes()` both run synchronously during bootstrap, before any
143
+ * adapter `beforeStart` hook fires. Adopters that need async-resolved
144
+ * config push it into an adapter (which has `beforeStart`), then
145
+ * inject the resolved value into the module via DI tokens.
146
+ */
147
+ interface ModuleFactory<TConfig, TExtra = unknown> {
148
+ (config?: Partial<TConfig>): AppModule & TExtra;
149
+ scoped(scopeName: string, config?: Partial<TConfig>): AppModule & TExtra;
150
+ readonly definition: Readonly<DefineModuleOptions<TConfig, TExtra>>;
151
+ }
152
+ /**
153
+ * Build an {@link AppModule} factory from a typed definition. Pairs
154
+ * with {@link defineAdapter}, {@link definePlugin}, and
155
+ * {@link defineContextDecorator} as the fourth `define*` primitive
156
+ * — adopters write modules the same way they write adapters and
157
+ * plugins.
158
+ *
159
+ * The returned factory produces real {@link AppModule} instances
160
+ * that drop into `bootstrap({ modules })` directly. The legacy
161
+ * class form (`class TasksModule implements AppModule { ... }`) keeps
162
+ * working — `bootstrap` accepts either shape.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * interface TasksConfig {
167
+ * scope: 'public' | 'admin'
168
+ * }
169
+ *
170
+ * const TasksModule = defineModule<TasksConfig>({
171
+ * name: 'TasksModule',
172
+ * defaults: { scope: 'public' },
173
+ * build: (config, { name }) => ({
174
+ * register(container) {
175
+ * container.registerInstance(`tasks:scope:${name}`, config.scope)
176
+ * },
177
+ * routes() {
178
+ * return { path: `/${config.scope}/tasks`, router: buildTasksRouter() }
179
+ * },
180
+ * contributors() {
181
+ * return [LoadTenant.registration]
182
+ * },
183
+ * }),
184
+ * })
185
+ *
186
+ * bootstrap({
187
+ * modules: [
188
+ * TasksModule(), // public scope (defaults)
189
+ * TasksModule.scoped('admin', { scope: 'admin' }),
190
+ * ],
191
+ * })
192
+ * ```
193
+ */
194
+ declare function defineModule<TConfig = Record<string, unknown>, TExtra = unknown>(options: DefineModuleOptions<TConfig, TExtra>): ModuleFactory<TConfig, TExtra>;
195
+ //#endregion
196
+ //#region src/core/define-modules.d.ts
197
+ /**
198
+ * Chainable registry returned by {@link defineModules}. Extends
199
+ * `Array<AppModuleEntry>` so it drops into `bootstrap({ modules })`
200
+ * unchanged — the framework loader already iterates the array, so a
201
+ * `ModuleList` IS a valid `modules` value with no special handling.
202
+ *
203
+ * The added affordance is `.mount(module)` returning `this` so
204
+ * adopters can build the list fluently:
205
+ *
206
+ * ```ts
207
+ * const modules = defineModules()
208
+ * .mount(HelloModule())
209
+ * .mount(AdminModule())
210
+ *
211
+ * bootstrap({ modules })
212
+ * ```
213
+ *
214
+ * **Why not just use a plain array?** Two reasons. First, the
215
+ * fluent shape reads more naturally for module-list construction —
216
+ * adopters used to `definePlugin().scoped(...)` / `defineAdapter(...)`
217
+ * see the same call-then-call pattern. Second, the registry is the
218
+ * stable extension point: a future `.use(module)` for non-HTTP
219
+ * modules (queues, cron, workers) lands as a method on `ModuleList`
220
+ * without breaking the `Array<AppModuleEntry>` superclass contract.
221
+ */
222
+ declare class ModuleList extends Array<AppModuleEntry> {
223
+ /**
224
+ * Append a module to the list. Returns `this` for chaining.
225
+ *
226
+ * Accepts both class form (`SomeModule extends AppModule`) and
227
+ * `defineModule` factory output — same as the underlying
228
+ * `bootstrap({ modules })` array. The framework loader
229
+ * discriminates `typeof entry === 'function'` at boot.
230
+ */
231
+ mount(module: AppModuleEntry): this;
232
+ }
233
+ /**
234
+ * Build a {@link ModuleList} for the application. Optional vararg
235
+ * lets adopters seed the list inline; subsequent `.mount()` calls
236
+ * append.
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * import { bootstrap, defineModules } from '@forinda/kickjs'
241
+ * import { HelloModule } from './modules/hello/hello.module'
242
+ * import { AdminModule } from './modules/admin/admin.module'
243
+ *
244
+ * // Fluent — most common
245
+ * const modules = defineModules()
246
+ * .mount(HelloModule())
247
+ * .mount(AdminModule())
248
+ *
249
+ * // Or seeded inline + chained
250
+ * const modules2 = defineModules(HelloModule()).mount(AdminModule())
251
+ *
252
+ * await bootstrap({ modules })
253
+ * ```
254
+ *
255
+ * The returned value is an `AppModuleEntry[]` subclass — `bootstrap`
256
+ * accepts it directly without any special-casing. For conditional /
257
+ * dynamic registration at bootstrap time (env flags, runtime config,
258
+ * tenant lists), use the `setup(registry)` callback on `bootstrap`
259
+ * instead — both surfaces compose.
260
+ */
261
+ declare function defineModules(...initial: AppModuleEntry[]): ModuleList;
262
+ //#endregion
7
263
  //#region src/core/metadata.d.ts
8
264
  /**
9
265
  * Typed utilities for reflect-metadata operations.
@@ -129,13 +385,15 @@ declare class CircuitBreaker {
129
385
  * @example
130
386
  * ```text
131
387
  * MissingContributorError: Missing context contributor 'tenant' required by 'project' on route GET /projects/:id
388
+ * declared at src/contributors/load-project.ts:42:18
132
389
  * ```
133
390
  */
134
391
  declare class MissingContributorError extends Error {
135
392
  readonly key: string;
136
393
  readonly dependent: string;
137
394
  readonly route?: string;
138
- constructor(key: string, dependent: string, route?: string);
395
+ readonly dependentDefinedAt?: string;
396
+ constructor(key: string, dependent: string, route?: string, dependentDefinedAt?: string);
139
397
  }
140
398
  /**
141
399
  * Topo-sort detected a cycle in `dependsOn` declarations. The `cycle` field
@@ -358,86 +616,6 @@ declare class MountCycleError extends Error {
358
616
  */
359
617
  declare function mountSort<T extends MountSortItem>(items: readonly T[], kind: MountKind): T[];
360
618
  //#endregion
361
- //#region src/core/define-plugin.d.ts
362
- /**
363
- * Options passed to {@link definePlugin}. Mirrors the spec in
364
- * `architecture.md` §21.3.1 + §21.2.2 (Phase A "lite").
365
- */
366
- interface DefinePluginOptions<TConfig> {
367
- /** Stable identity used for logging, `dependsOn` lookups, and `.scoped()` namespacing. */
368
- name: string;
369
- /** Optional plugin version — surfaced to DevTools and `kick add` compatibility checks (Phase B). */
370
- version?: string;
371
- /**
372
- * Peer-version ranges this plugin needs from the framework or other
373
- * plugins. Recorded as metadata; runtime enforcement lands in §21.4.4.
374
- */
375
- requires?: {
376
- kickjs?: string;
377
- };
378
- /** Default config merged under any caller overrides. */
379
- defaults?: Partial<TConfig>;
380
- /** Builds the underlying {@link KickPlugin} from the resolved config. */
381
- build(config: TConfig, ctx: BuildContext): Omit<KickPlugin, 'name'>;
382
- }
383
- /**
384
- * Hook context handed to a plugin/adapter `build` function. `name` is the
385
- * resolved instance name (the bare definition name for the bare call,
386
- * or `${defName}:${scope}` for `.scoped()`). `scoped` is the discriminator
387
- * authors use to namespace DI tokens or resource keys.
388
- */
389
- interface BuildContext {
390
- name: string;
391
- scoped: boolean;
392
- }
393
- /**
394
- * Async-config form of a plugin or adapter — `inject` lists DI tokens to
395
- * resolve from the container, then `useFactory` produces the config.
396
- *
397
- * Plugins resolve this lazily inside `onReady`, so any module/adapter/
398
- * middleware/contributor a plugin contributes via `build` is **not
399
- * available** when `.async()` is used. Use the bare/`.scoped()` form for
400
- * plugins that need to register modules or middleware.
401
- */
402
- interface PluginAsyncOptions<TConfig> {
403
- inject?: ReadonlyArray<unknown>;
404
- useFactory(...deps: any[]): TConfig | Promise<TConfig>;
405
- }
406
- /**
407
- * Factory returned by {@link definePlugin}. Callable form is the singleton
408
- * (`AuthPlugin(config)`); `.scoped()` and `.async()` are the multi-instance
409
- * and deferred-config forms.
410
- */
411
- interface PluginFactory<TConfig> {
412
- (config?: Partial<TConfig>): KickPlugin;
413
- scoped(scopeName: string, config?: Partial<TConfig>): KickPlugin;
414
- async(opts: PluginAsyncOptions<TConfig>): KickPlugin;
415
- /** Read-only access to the original definition — useful for DevTools introspection. */
416
- readonly definition: Readonly<DefinePluginOptions<TConfig>>;
417
- }
418
- /**
419
- * Build a {@link KickPlugin} factory from a typed definition. See
420
- * `architecture.md` §21.2.2 for the design rationale.
421
- *
422
- * @example
423
- * ```ts
424
- * const FlagsPlugin = definePlugin<FlagsConfig>({
425
- * name: 'FlagsPlugin',
426
- * defaults: { defaultTtl: 60_000 },
427
- * build(config) {
428
- * return {
429
- * register(container) {
430
- * container.registerInstance(FLAGS, makeProvider(config))
431
- * },
432
- * }
433
- * },
434
- * })
435
- *
436
- * bootstrap({ plugins: [FlagsPlugin({ provider: launchDarkly })] })
437
- * ```
438
- */
439
- declare function definePlugin<TConfig = Record<string, unknown>>(options: DefinePluginOptions<TConfig>): PluginFactory<TConfig>;
440
- //#endregion
441
619
  //#region src/core/define-adapter.d.ts
442
620
  /**
443
621
  * Options passed to {@link defineAdapter}. Mirrors {@link DefinePluginOptions}
@@ -558,5 +736,5 @@ declare function groupAssetKeys(namespace: string, paths: readonly string[], opt
558
736
  /** Strip the final extension from a path. `'mails/welcome.ejs'` → `'mails/welcome'`. */
559
737
  declare function stripExt(path: string): string;
560
738
  //#endregion
561
- export { DuplicateContributorError as A, getMetaRecord as B, runContributors as C, SourcedRegistration as D, ContributorSource as E, CircuitBreakerStats as F, pushMethodMeta as G, getMethodMetaOrUndefined as H, CircuitOpenError as I, setInMetaRecord as J, setClassMeta as K, getClassMeta as L, CircuitBreaker as M, CircuitBreakerOptions as N, buildPipeline as O, CircuitBreakerState as P, getClassMetaOrUndefined as R, RunContributorsOptions as S, ContributorPipeline as T, hasClassMeta as U, getMethodMeta as V, pushClassMeta as W, setMethodMeta as Y, MissingMountDepError as _, groupAssetKeys as a, MountSortItem as b, AdapterFactory as c, BuildContext as d, DefinePluginOptions as f, DuplicateMountNameError as g, definePlugin as h, GroupAssetKeysResult as i, MissingContributorError as j, ContributorCycleError as k, DefineAdapterOptions as l, PluginFactory as m, AssetKeyStrategy as n, stripExt as o, PluginAsyncOptions as p, setInMetaMap as q, GroupAssetKeysOptions as r, AdapterAsyncOptions as s, AssetKeyPair as t, defineAdapter as u, MountCycleError as v, BuildPipelineOptions as w, mountSort as x, MountKind as y, getMetaMap as z };
562
- //# sourceMappingURL=index-DvZfBNIf.d.mts.map
739
+ export { PluginFactory as $, CircuitBreakerStats as A, pushMethodMeta as B, buildPipeline as C, CircuitBreaker as D, MissingContributorError as E, getMetaRecord as F, ModuleList as G, setInMetaMap as H, getMethodMeta as I, ModuleFactory as J, defineModules as K, getMethodMetaOrUndefined as L, getClassMeta as M, getClassMetaOrUndefined as N, CircuitBreakerOptions as O, getMetaMap as P, PluginAsyncOptions as Q, hasClassMeta as R, SourcedRegistration as S, DuplicateContributorError as T, setInMetaRecord as U, setClassMeta as V, setMethodMeta as W, BuildContext as X, defineModule as Y, DefinePluginOptions as Z, RunContributorsOptions as _, groupAssetKeys as a, ContributorPipeline as b, AdapterFactory as c, DuplicateMountNameError as d, definePlugin as et, MissingMountDepError as f, mountSort as g, MountSortItem as h, GroupAssetKeysResult as i, CircuitOpenError as j, CircuitBreakerState as k, DefineAdapterOptions as l, MountKind as m, AssetKeyStrategy as n, stripExt as o, MountCycleError as p, DefineModuleOptions as q, GroupAssetKeysOptions as r, AdapterAsyncOptions as s, AssetKeyPair as t, defineAdapter as u, runContributors as v, ContributorCycleError as w, ContributorSource as x, BuildPipelineOptions as y, pushClassMeta as z };
740
+ //# sourceMappingURL=index-D-Wb23e6.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-D-Wb23e6.d.mts","names":[],"sources":["../src/core/define-plugin.ts","../src/core/define-module.ts","../src/core/define-modules.ts","../src/core/metadata.ts","../src/core/circuit-breaker.ts","../src/core/context-errors.ts","../src/core/contributor-pipeline.ts","../src/core/contributor-runner.ts","../src/core/mount-sort.ts","../src/core/define-adapter.ts","../src/core/asset-keys.ts"],"mappings":";;;;;;;;;;;;UAOiB,mBAAA;;EAEf,IAAA;;EAGA,OAAA;;;;AALF;EAWE,QAAA;IAAa,MAAA;EAAA;EAGF;EAAX,QAAA,GAAW,OAAA,CAAQ,OAAA;EAGS;EAA5B,KAAA,CAAM,MAAA,EAAQ,OAAA,EAAS,GAAA,EAAK,YAAA,GAAe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YAAA;EVpBqB;;;;;;;EU4B5B,uBAAA;AAAA;;;;;;;;;;;iBAac,cAAA,CACd,SAAA,UACA,KAAA,qBACA,IAAA,GAAM,qBAAA,GACL,oBAAA;;iBA2Da,QAAA,CAAS,IAAA"}
package/dist/index.d.mts CHANGED
@@ -4,21 +4,21 @@ import { a as tokenName, c as createToken, i as KickJsRegistry, l as isInjection
4
4
  import { A as normalizeApiQueryParamsConfig, C as Post, D as RouteDefinition, E as Repository, F as UnknownAssetError, I as assets, L as clearAssetCache, M as ASSETS, N as ASSET_MANIFEST_VERSION, O as Service, P as KickAssets, R as resolveAsset, S as Patch, T as Put, _ as Get, a as Autowired, b as Middleware, c as ColumnApiQueryParamsConfig, d as Delete, f as Env, g as FileUploadConfig, h as FileUpload, i as AssetKey, j as withBuilder, k as Value, l as Component, m as FileTypeFilter, n as ApiQueryParamsConfig, o as BaseUploadOptions, p as EnvKey, r as Asset, s as Builder, t as ApiQueryParams, u as Controller, v as Inject, w as PostConstruct, x as MiddlewareHandler, y as Injectable, z as useAssets } from "./decorators-J5mC7D-6.mjs";
5
5
  import { a as baseEnvSchema, c as loadEnv, l as reloadEnv, n as TypedConfigService, o as defineEnv, r as createConfigService, s as getEnv, t as ConfigService, u as resetEnvCache } from "./index-BbtF8kIr.mjs";
6
6
  import { n as ExecutionContext, r as MetaValue, t as ContextMeta } from "./execution-context-DKnt61pY.mjs";
7
- import { a as ContributorRegistration, c as ResolvedDeps, i as ContextMetaKey, l as defineContextDecorator, n as ContextDecorator, o as ContributorRegistrations, r as ContextDecoratorSpec, s as DepValue, t as AnyContributorRegistration } from "./context-decorator-Bca_BoRK.mjs";
8
- import { a as MiddlewarePhase, c as KickJsPluginRegistry, i as AppAdapterClass, l as defineAugmentation, n as AdapterMiddleware, o as AugmentationMeta, r as AppAdapter, s as KickJsPluginName, t as AdapterContext } from "./adapter-C1w_xt08.mjs";
9
- import { n as AppModuleClass, r as ModuleRoutes, t as AppModule } from "./app-module-D6zL_V5S.mjs";
7
+ import { a as ContributorRegistration, c as ResolvedDeps, i as ContextMetaKey, l as defineContextDecorator, n as ContextDecorator, o as ContributorRegistrations, r as ContextDecoratorSpec, s as DepValue, t as AnyContributorRegistration } from "./context-decorator-BgdDd-6X.mjs";
8
+ import { a as MiddlewarePhase, c as KickJsPluginRegistry, i as AppAdapterClass, l as defineAugmentation, n as AdapterMiddleware, o as AugmentationMeta, r as AppAdapter, s as KickJsPluginName, t as AdapterContext } from "./adapter-0r2uRCD3.mjs";
9
+ import { i as ModuleRoutes, n as AppModuleClass, r as AppModuleEntry, t as AppModule } from "./app-module-CzlIIjO3.mjs";
10
10
  import { a as Cacheable, c as setCacheProvider, i as CacheProvider, n as CacheEvict, o as MemoryCacheProvider, r as CacheOptions, s as getCacheProvider } from "./cache-XrNWj1KQ.mjs";
11
11
  import { i as getCronJobs, n as Cron, r as CronJobMeta, t as CRON_META } from "./cron-GNoYydfg.mjs";
12
12
  import { i as ValidationError, n as HttpStatus, r as HttpStatusCode, t as HttpException } from "./errors-uaHCeXRz.mjs";
13
13
  import { a as rootLogger, i as createLogger, n as Logger, r as LoggerProvider, t as ConsoleLoggerProvider } from "./logger-CLVRZf2N.mjs";
14
14
  import { n as normalizePath, t as joinPaths } from "./path-Diviu6hv.mjs";
15
- import { t as KickPlugin } from "./plugin-DF8Xfv9Z.mjs";
15
+ import { n as ModuleRegistry, r as MutableModuleRegistry, t as KickPlugin } from "./plugin-JMkG7soG.mjs";
16
16
  import { a as isRef, c as toRefs, i as computed, l as unref, n as Ref, o as reactive, r as WatchOptions, s as ref, t as ComputedRef, u as watch } from "./reactivity-CfJceo4H.mjs";
17
- import { A as DuplicateContributorError, B as getMetaRecord, C as runContributors, D as SourcedRegistration, E as ContributorSource, F as CircuitBreakerStats, G as pushMethodMeta, H as getMethodMetaOrUndefined, I as CircuitOpenError, J as setInMetaRecord, K as setClassMeta, L as getClassMeta, M as CircuitBreaker, N as CircuitBreakerOptions, O as buildPipeline, P as CircuitBreakerState, R as getClassMetaOrUndefined, S as RunContributorsOptions, T as ContributorPipeline, U as hasClassMeta, V as getMethodMeta, W as pushClassMeta, Y as setMethodMeta, _ as MissingMountDepError, a as groupAssetKeys, b as MountSortItem, c as AdapterFactory, d as BuildContext, f as DefinePluginOptions, g as DuplicateMountNameError, h as definePlugin, i as GroupAssetKeysResult, j as MissingContributorError, k as ContributorCycleError, l as DefineAdapterOptions, m as PluginFactory, n as AssetKeyStrategy, o as stripExt, p as PluginAsyncOptions, q as setInMetaMap, r as GroupAssetKeysOptions, s as AdapterAsyncOptions, t as AssetKeyPair, u as defineAdapter, v as MountCycleError, w as BuildPipelineOptions, x as mountSort, y as MountKind, z as getMetaMap } from "./index-DvZfBNIf.mjs";
18
- import { n as ApplicationOptions, r as MiddlewareEntry, t as Application } from "./application-BTRI4aBd.mjs";
19
- import { t as bootstrap } from "./bootstrap-B4YrBipl.mjs";
17
+ import { $ as PluginFactory, A as CircuitBreakerStats, B as pushMethodMeta, C as buildPipeline, D as CircuitBreaker, E as MissingContributorError, F as getMetaRecord, G as ModuleList, H as setInMetaMap, I as getMethodMeta, J as ModuleFactory, K as defineModules, L as getMethodMetaOrUndefined, M as getClassMeta, N as getClassMetaOrUndefined, O as CircuitBreakerOptions, P as getMetaMap, Q as PluginAsyncOptions, R as hasClassMeta, S as SourcedRegistration, T as DuplicateContributorError, U as setInMetaRecord, V as setClassMeta, W as setMethodMeta, X as BuildContext, Y as defineModule, Z as DefinePluginOptions, _ as RunContributorsOptions, a as groupAssetKeys, b as ContributorPipeline, c as AdapterFactory, d as DuplicateMountNameError, et as definePlugin, f as MissingMountDepError, g as mountSort, h as MountSortItem, i as GroupAssetKeysResult, j as CircuitOpenError, k as CircuitBreakerState, l as DefineAdapterOptions, m as MountKind, n as AssetKeyStrategy, o as stripExt, p as MountCycleError, q as DefineModuleOptions, r as GroupAssetKeysOptions, s as AdapterAsyncOptions, t as AssetKeyPair, u as defineAdapter, v as runContributors, w as ContributorCycleError, x as ContributorSource, y as BuildPipelineOptions, z as pushClassMeta } from "./index-D-Wb23e6.mjs";
18
+ import { n as ApplicationOptions, r as MiddlewareEntry, t as Application } from "./application-CaEYca9E.mjs";
19
+ import { t as bootstrap } from "./bootstrap-Db8k2-21.mjs";
20
20
  import { _ as SortItem, a as parseSearchQuery, c as FILTER_OPERATORS, d as FilterOperator, f as PaginatedResponse, g as QueryFieldConfig, h as QueryBuilderAdapter, i as parseQuery, l as FieldsOf, m as ParsedQuery, n as parseFilters, o as parseSort, p as PaginationParams, r as parsePagination, t as buildQueryParams, u as FilterItem, y as TypedParsedQuery } from "./index-B9cyOQAe.mjs";
21
- import { i as RouteShape, n as DeepReadonly, r as RequestContext, t as Ctx } from "./context-BAdAV-zO.mjs";
21
+ import { i as RouteShape, n as DeepReadonly, r as RequestContext, t as Ctx } from "./context-aocg9gO-.mjs";
22
22
  import { n as cors, t as CorsOptions } from "./cors-BfgqfLPd.mjs";
23
23
  import { n as csrf, t as CsrfOptions } from "./csrf-DiK9zept.mjs";
24
24
  import { n as notFoundHandler, t as errorHandler } from "./error-handler-Xud_3Lah.mjs";
@@ -27,9 +27,9 @@ import { n as RateLimitStore, r as rateLimit, t as RateLimitOptions } from "./ra
27
27
  import { n as requestId, t as REQUEST_ID_HEADER } from "./request-id-BgglvZHN.mjs";
28
28
  import { n as requestLogger, t as RequestLoggerOptions } from "./request-logger-CWHbAzTE.mjs";
29
29
  import { a as session, i as SessionStore, n as SessionData, r as SessionOptions, t as Session } from "./session-N0hActOO.mjs";
30
- import { n as SpaAdapterOptions, t as SpaAdapter } from "./spa-e4FIS2RB.mjs";
30
+ import { n as SpaAdapterOptions, t as SpaAdapter } from "./spa-CreyQc4N.mjs";
31
31
  import { a as upload, i as resolveMimeTypes, n as buildUploadMiddleware, r as cleanupFiles, t as UploadOptions } from "./upload-tGMrlhEB.mjs";
32
32
  import { n as validate } from "./validate-HwAyWTwH.mjs";
33
- import { a as TraceContextOptions, c as requestScopeMiddleware, d as getRequestValue, f as requestStore, h as isClusterPrimary, i as TraceContext, l as RequestStore, m as ClusterOptions, n as ViewAdapterOptions, o as parseTraceparent, p as defineHttpContextDecorator, r as TRACEPARENT_HEADER, s as traceContext, t as ViewAdapter, u as getRequestStore } from "./views-oKRSw0Op.mjs";
34
- import { r as buildRoutes } from "./router-builder-C7sXk_FG.mjs";
35
- export { ASSETS, ASSET_MANIFEST_VERSION, AdapterAsyncOptions, AdapterContext, AdapterFactory, AdapterMiddleware, AnyContributorRegistration, ApiQueryParams, ApiQueryParamsConfig, ApiQueryParamsConfig as QueryParamsConfig, AppAdapter, AppAdapterClass, AppModule, AppModuleClass, Application, ApplicationOptions, Asset, AssetKey, AssetKeyPair, AssetKeyStrategy, AugmentationMeta, Autowired, BaseUploadOptions, BuildContext, BuildPipelineOptions, Buildable, Builder, BuilderOf, CRON_META, CacheEvict, CacheOptions, CacheProvider, Cacheable, CircuitBreaker, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStats, CircuitOpenError, ClassKind, ClusterOptions, ColumnApiQueryParamsConfig, Component, ComputedRef, ConfigService, ConsoleLoggerProvider, Constructor, Container, ContainerChangeEvent, ContainerChangeListener, ContextDecorator, ContextDecoratorSpec, ContextMeta, ContextMetaKey, ContributorCycleError, ContributorPipeline, ContributorRegistration, ContributorRegistrations, ContributorSource, Controller, CorsOptions, Cron, CronJobMeta, CsrfOptions, Ctx, DeepReadonly, DefineAdapterOptions, DefinePluginOptions, Delete, DepValue, DuplicateContributorError, DuplicateMountNameError, Env, EnvKey, ExecutionContext, FILTER_OPERATORS, FieldsOf, FileTypeFilter, FileUpload, FileUploadConfig, FilterItem, FilterOperator, Get, GroupAssetKeysOptions, GroupAssetKeysResult, HelmetOptions, HttpException, HttpStatus, HttpStatusCode, INJECTION_TOKEN, Inject, Injectable, InjectionToken, KickAssets, KickJsPluginName, KickJsPluginRegistry, KickJsRegistry, KickPlugin, Logger, LoggerProvider, METADATA, MaybePromise, MemoryCacheProvider, MetaValue, Middleware, MiddlewareEntry, MiddlewareHandler, MiddlewarePhase, MissingContributorError, MissingMountDepError, ModuleRoutes, MountCycleError, MountKind, MountSortItem, PaginatedResponse, PaginationParams, ParsedQuery, Patch, PluginAsyncOptions, PluginFactory, Post, PostConstruct, PostConstructStatus, Put, QueryBuilderAdapter, QueryFieldConfig, REQUEST_ID_HEADER, RateLimitOptions, RateLimitStore, Ref, Repository, RequestContext, RequestLoggerOptions, RequestStore, ResolvedDeps, RouteDefinition, RouteShape, RunContributorsOptions, Scope, Service, ServiceOptions, Session, SessionData, SessionOptions, SessionStore, SortItem, SourcedRegistration, SpaAdapter, SpaAdapterOptions, TRACEPARENT_HEADER, TraceContext, TraceContextOptions, TypedConfigService, TypedParsedQuery, UnknownAssetError, UploadOptions, ValidationError, Value, ViewAdapter, ViewAdapterOptions, WatchOptions, assets, baseEnvSchema, bootstrap, buildPipeline, buildQueryParams, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createLogger, createToken, csrf, defineAdapter, defineAugmentation, defineContextDecorator, defineEnv, defineHttpContextDecorator, definePlugin, errorHandler, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getRequestStore, getRequestValue, groupAssetKeys, hasClassMeta, helmet, isClusterPrimary, isInjectionToken, isRef, joinPaths, loadEnv, mountSort, normalizeApiQueryParamsConfig, normalizePath, notFoundHandler, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, reactive, ref, reloadEnv, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resolveAsset, resolveMimeTypes, rootLogger, runContributors, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, stripExt, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, watch, withBuilder };
33
+ import { a as TraceContextOptions, c as requestScopeMiddleware, d as getRequestValue, f as requestStore, h as isClusterPrimary, i as TraceContext, l as RequestStore, m as ClusterOptions, n as ViewAdapterOptions, o as parseTraceparent, p as defineHttpContextDecorator, r as TRACEPARENT_HEADER, s as traceContext, t as ViewAdapter, u as getRequestStore } from "./views-BMhrZsH9.mjs";
34
+ import { r as buildRoutes } from "./router-builder-CaQ629tw.mjs";
35
+ export { ASSETS, ASSET_MANIFEST_VERSION, AdapterAsyncOptions, AdapterContext, AdapterFactory, AdapterMiddleware, AnyContributorRegistration, ApiQueryParams, ApiQueryParamsConfig, ApiQueryParamsConfig as QueryParamsConfig, AppAdapter, AppAdapterClass, AppModule, AppModuleClass, AppModuleEntry, Application, ApplicationOptions, Asset, AssetKey, AssetKeyPair, AssetKeyStrategy, AugmentationMeta, Autowired, BaseUploadOptions, BuildContext, BuildPipelineOptions, Buildable, Builder, BuilderOf, CRON_META, CacheEvict, CacheOptions, CacheProvider, Cacheable, CircuitBreaker, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStats, CircuitOpenError, ClassKind, ClusterOptions, ColumnApiQueryParamsConfig, Component, ComputedRef, ConfigService, ConsoleLoggerProvider, Constructor, Container, ContainerChangeEvent, ContainerChangeListener, ContextDecorator, ContextDecoratorSpec, ContextMeta, ContextMetaKey, ContributorCycleError, ContributorPipeline, ContributorRegistration, ContributorRegistrations, ContributorSource, Controller, CorsOptions, Cron, CronJobMeta, CsrfOptions, Ctx, DeepReadonly, DefineAdapterOptions, DefineModuleOptions, DefinePluginOptions, Delete, DepValue, DuplicateContributorError, DuplicateMountNameError, Env, EnvKey, ExecutionContext, FILTER_OPERATORS, FieldsOf, FileTypeFilter, FileUpload, FileUploadConfig, FilterItem, FilterOperator, Get, GroupAssetKeysOptions, GroupAssetKeysResult, HelmetOptions, HttpException, HttpStatus, HttpStatusCode, INJECTION_TOKEN, Inject, Injectable, InjectionToken, KickAssets, KickJsPluginName, KickJsPluginRegistry, KickJsRegistry, KickPlugin, Logger, LoggerProvider, METADATA, MaybePromise, MemoryCacheProvider, MetaValue, Middleware, MiddlewareEntry, MiddlewareHandler, MiddlewarePhase, MissingContributorError, MissingMountDepError, ModuleFactory, ModuleList, ModuleRegistry, ModuleRoutes, MountCycleError, MountKind, MountSortItem, MutableModuleRegistry, PaginatedResponse, PaginationParams, ParsedQuery, Patch, PluginAsyncOptions, PluginFactory, Post, PostConstruct, PostConstructStatus, Put, QueryBuilderAdapter, QueryFieldConfig, REQUEST_ID_HEADER, RateLimitOptions, RateLimitStore, Ref, Repository, RequestContext, RequestLoggerOptions, RequestStore, ResolvedDeps, RouteDefinition, RouteShape, RunContributorsOptions, Scope, Service, ServiceOptions, Session, SessionData, SessionOptions, SessionStore, SortItem, SourcedRegistration, SpaAdapter, SpaAdapterOptions, TRACEPARENT_HEADER, TraceContext, TraceContextOptions, TypedConfigService, TypedParsedQuery, UnknownAssetError, UploadOptions, ValidationError, Value, ViewAdapter, ViewAdapterOptions, WatchOptions, assets, baseEnvSchema, bootstrap, buildPipeline, buildQueryParams, buildRoutes, buildUploadMiddleware, cleanupFiles, clearAssetCache, computed, cors, createConfigService, createLogger, createToken, csrf, defineAdapter, defineAugmentation, defineContextDecorator, defineEnv, defineHttpContextDecorator, defineModule, defineModules, definePlugin, errorHandler, getCacheProvider, getClassMeta, getClassMetaOrUndefined, getCronJobs, getEnv, getMetaMap, getMetaRecord, getMethodMeta, getMethodMetaOrUndefined, getRequestStore, getRequestValue, groupAssetKeys, hasClassMeta, helmet, isClusterPrimary, isInjectionToken, isRef, joinPaths, loadEnv, mountSort, normalizeApiQueryParamsConfig, normalizePath, notFoundHandler, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort, parseTraceparent, pushClassMeta, pushMethodMeta, rateLimit, reactive, ref, reloadEnv, requestId, requestLogger, requestScopeMiddleware, requestStore, resetEnvCache, resolveAsset, resolveMimeTypes, rootLogger, runContributors, session, setCacheProvider, setClassMeta, setInMetaMap, setInMetaRecord, setMethodMeta, stripExt, toRefs, tokenName, traceContext, unref, upload, useAssets, validate, watch, withBuilder };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v5.4.0
2
+ * @forinda/kickjs v5.6.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import{a as UnknownAssetError,c as resolveAsset,d as stripExt,f as INJECTION_TOKEN,i as ASSET_MANIFEST_VERSION,l as useAssets,m as isInjectionToken,n as tokenName,o as assets,p as createToken,r as ASSETS,s as clearAssetCache,t as Container,u as groupAssetKeys}from"./container-DArhTDQQ.mjs";import{METADATA,Scope}from"./core/interfaces.mjs";import{ConsoleLoggerProvider,Logger,createLogger,rootLogger}from"./core/logger.mjs";import{a as getMethodMeta,c as pushClassMeta,d as setInMetaMap,f as setInMetaRecord,i as getMetaRecord,l as pushMethodMeta,n as getClassMetaOrUndefined,o as getMethodMetaOrUndefined,p as setMethodMeta,r as getMetaMap,s as hasClassMeta,t as getClassMeta,u as setClassMeta}from"./metadata-Dn6kNT82.mjs";import{ApiQueryParams,Asset,Autowired,Builder,Component,Controller,Delete,FileUpload,Get,Inject,Injectable,Middleware,Patch,Post,PostConstruct,Put,Repository,Service,Value,normalizeApiQueryParamsConfig,withBuilder}from"./core/decorators.mjs";import{CRON_META,Cron,getCronJobs}from"./core/cron.mjs";import{CacheEvict,Cacheable,MemoryCacheProvider,getCacheProvider,setCacheProvider}from"./core/cache.mjs";import{HttpException,HttpStatus}from"./core/errors.mjs";import{joinPaths,normalizePath}from"./core/path.mjs";import{a as MissingMountDepError,c as runContributors,d as DuplicateContributorError,f as MissingContributorError,h as CircuitOpenError,i as DuplicateMountNameError,l as buildPipeline,m as CircuitBreaker,n as defineAdapter,o as MountCycleError,p as defineContextDecorator,r as definePlugin,s as mountSort,t as defineAugmentation,u as ContributorCycleError}from"./core-BQZyB8Wv.mjs";import{computed,isRef,reactive,ref,toRefs,unref,watch}from"./core/reactivity.mjs";import{REQUEST_ID_HEADER,requestId}from"./http/middleware/request-id.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{i as requestStore,n as getRequestStore,r as getRequestValue,t as RequestContext}from"./context-CIoXqpAX.mjs";import{n as requestScopeMiddleware,t as Application}from"./application-mir5CSWO.mjs";import{a as parseSearchQuery,i as parseQuery,n as parseFilters,o as parseSort,r as parsePagination,s as FILTER_OPERATORS,t as buildQueryParams}from"./query-B7n5isk_.mjs";import{validate}from"./http/middleware/validate.mjs";import{buildUploadMiddleware,cleanupFiles,resolveMimeTypes,upload}from"./http/middleware/upload.mjs";import{buildRoutes}from"./http/router-builder.mjs";import{a as reloadEnv,i as loadEnv,n as defineEnv,o as resetEnvCache,r as getEnv,t as baseEnvSchema}from"./env-BL0xOTyi.mjs";import{n as isClusterPrimary,t as bootstrap}from"./bootstrap-B7j_-dOg.mjs";import{csrf}from"./http/middleware/csrf.mjs";import{requestLogger}from"./http/middleware/request-logger.mjs";import{helmet}from"./http/middleware/helmet.mjs";import{cors}from"./http/middleware/cors.mjs";import{rateLimit}from"./http/middleware/rate-limit.mjs";import{session}from"./http/middleware/session.mjs";import{ViewAdapter}from"./http/middleware/views.mjs";import{SpaAdapter}from"./http/middleware/spa.mjs";import{n as createConfigService,t as ConfigService}from"./config-Dk5RVTnD.mjs";import crypto from"node:crypto";function defineHttpContextDecorator(spec){return defineContextDecorator(spec)}const TRACEPARENT_HEADER=`traceparent`,TRACEPARENT_RE=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function generateTraceId(){return crypto.randomBytes(16).toString(`hex`)}function generateSpanId(){return crypto.randomBytes(8).toString(`hex`)}function parseTraceparent(header){let match=TRACEPARENT_RE.exec(header.trim().toLowerCase());if(!match)return null;let version=match[1],traceId=match[2],parentSpanId=match[3],flags=match[4];return version===`ff`||traceId===`00000000000000000000000000000000`||parentSpanId===`0000000000000000`?null:{version,traceId,parentSpanId,flags}}function traceContext(options={}){return(req,res,next)=>{let store=requestStore.getStore(),traceparentHeader=req.headers[TRACEPARENT_HEADER],raw=Array.isArray(traceparentHeader)?traceparentHeader[0]:traceparentHeader,parsed=raw?parseTraceparent(raw):null,traceId=parsed?.traceId??generateTraceId(),spanId=generateSpanId();store&&(store.values.set(`traceId`,traceId),store.values.set(`spanId`,spanId),parsed&&(store.values.set(`parentSpanId`,parsed.parentSpanId),store.values.set(`traceFlags`,parsed.flags),store.values.set(`traceVersion`,parsed.version))),req.traceId=traceId,req.spanId=spanId,options.propagateResponse&&res.setHeader(`traceresponse`,traceId),next()}}export{ASSETS,ASSET_MANIFEST_VERSION,ApiQueryParams,Application,Asset,Autowired,Builder,CRON_META,CacheEvict,Cacheable,CircuitBreaker,CircuitOpenError,Component,ConfigService,ConsoleLoggerProvider,Container,ContributorCycleError,Controller,Cron,Delete,DuplicateContributorError,DuplicateMountNameError,FILTER_OPERATORS,FileUpload,Get,HttpException,HttpStatus,INJECTION_TOKEN,Inject,Injectable,Logger,METADATA,MemoryCacheProvider,Middleware,MissingContributorError,MissingMountDepError,MountCycleError,Patch,Post,PostConstruct,Put,REQUEST_ID_HEADER,Repository,RequestContext,Scope,Service,SpaAdapter,TRACEPARENT_HEADER,UnknownAssetError,Value,ViewAdapter,assets,baseEnvSchema,bootstrap,buildPipeline,buildQueryParams,buildRoutes,buildUploadMiddleware,cleanupFiles,clearAssetCache,computed,cors,createConfigService,createLogger,createToken,csrf,defineAdapter,defineAugmentation,defineContextDecorator,defineEnv,defineHttpContextDecorator,definePlugin,errorHandler,getCacheProvider,getClassMeta,getClassMetaOrUndefined,getCronJobs,getEnv,getMetaMap,getMetaRecord,getMethodMeta,getMethodMetaOrUndefined,getRequestStore,getRequestValue,groupAssetKeys,hasClassMeta,helmet,isClusterPrimary,isInjectionToken,isRef,joinPaths,loadEnv,mountSort,normalizeApiQueryParamsConfig,normalizePath,notFoundHandler,parseFilters,parsePagination,parseQuery,parseSearchQuery,parseSort,parseTraceparent,pushClassMeta,pushMethodMeta,rateLimit,reactive,ref,reloadEnv,requestId,requestLogger,requestScopeMiddleware,requestStore,resetEnvCache,resolveAsset,resolveMimeTypes,rootLogger,runContributors,session,setCacheProvider,setClassMeta,setInMetaMap,setInMetaRecord,setMethodMeta,stripExt,toRefs,tokenName,traceContext,unref,upload,useAssets,validate,watch,withBuilder};
11
+ import{a as UnknownAssetError,c as resolveAsset,d as stripExt,f as INJECTION_TOKEN,i as ASSET_MANIFEST_VERSION,l as useAssets,m as isInjectionToken,n as tokenName,o as assets,p as createToken,r as ASSETS,s as clearAssetCache,t as Container,u as groupAssetKeys}from"./container-D0v17gF8.mjs";import{METADATA,Scope}from"./core/interfaces.mjs";import{ConsoleLoggerProvider,Logger,createLogger,rootLogger}from"./core/logger.mjs";import{a as getMethodMeta,c as pushClassMeta,d as setInMetaMap,f as setInMetaRecord,i as getMetaRecord,l as pushMethodMeta,n as getClassMetaOrUndefined,o as getMethodMetaOrUndefined,p as setMethodMeta,r as getMetaMap,s as hasClassMeta,t as getClassMeta,u as setClassMeta}from"./metadata-IHiynOCv.mjs";import{ApiQueryParams,Asset,Autowired,Builder,Component,Controller,Delete,FileUpload,Get,Inject,Injectable,Middleware,Patch,Post,PostConstruct,Put,Repository,Service,Value,normalizeApiQueryParamsConfig,withBuilder}from"./core/decorators.mjs";import{_ as ModuleList,a as MissingMountDepError,c as runContributors,d as DuplicateContributorError,f as MissingContributorError,g as MutableModuleRegistry,h as CircuitOpenError,i as DuplicateMountNameError,l as buildPipeline,m as CircuitBreaker,n as defineAdapter,o as MountCycleError,p as defineContextDecorator,r as definePlugin,s as mountSort,t as defineAugmentation,u as ContributorCycleError,v as defineModules,y as defineModule}from"./core-DvTHNOay.mjs";import{CRON_META,Cron,getCronJobs}from"./core/cron.mjs";import{CacheEvict,Cacheable,MemoryCacheProvider,getCacheProvider,setCacheProvider}from"./core/cache.mjs";import{HttpException,HttpStatus}from"./core/errors.mjs";import{joinPaths,normalizePath}from"./core/path.mjs";import{computed,isRef,reactive,ref,toRefs,unref,watch}from"./core/reactivity.mjs";import{REQUEST_ID_HEADER,requestId}from"./http/middleware/request-id.mjs";import{errorHandler,notFoundHandler}from"./http/middleware/error-handler.mjs";import{i as requestStore,n as getRequestStore,r as getRequestValue,t as RequestContext}from"./context-CbX_T0XC.mjs";import{n as requestScopeMiddleware,t as Application}from"./application-YJZ2frWX.mjs";import{a as parseSearchQuery,i as parseQuery,n as parseFilters,o as parseSort,r as parsePagination,s as FILTER_OPERATORS,t as buildQueryParams}from"./query-CQU-Hyiv.mjs";import{validate}from"./http/middleware/validate.mjs";import{buildUploadMiddleware,cleanupFiles,resolveMimeTypes,upload}from"./http/middleware/upload.mjs";import{buildRoutes}from"./http/router-builder.mjs";import{a as reloadEnv,i as loadEnv,n as defineEnv,o as resetEnvCache,r as getEnv,t as baseEnvSchema}from"./env-yTMEMpV6.mjs";import{n as isClusterPrimary,t as bootstrap}from"./bootstrap-UCZoqbbW.mjs";import{csrf}from"./http/middleware/csrf.mjs";import{requestLogger}from"./http/middleware/request-logger.mjs";import{helmet}from"./http/middleware/helmet.mjs";import{cors}from"./http/middleware/cors.mjs";import{rateLimit}from"./http/middleware/rate-limit.mjs";import{session}from"./http/middleware/session.mjs";import{ViewAdapter}from"./http/middleware/views.mjs";import{SpaAdapter}from"./http/middleware/spa.mjs";import{n as createConfigService,t as ConfigService}from"./config-D6VaNpwo.mjs";import crypto from"node:crypto";function defineHttpContextDecorator(spec){return defineContextDecorator(spec)}const TRACEPARENT_HEADER=`traceparent`,TRACEPARENT_RE=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function generateTraceId(){return crypto.randomBytes(16).toString(`hex`)}function generateSpanId(){return crypto.randomBytes(8).toString(`hex`)}function parseTraceparent(header){let match=TRACEPARENT_RE.exec(header.trim().toLowerCase());if(!match)return null;let version=match[1],traceId=match[2],parentSpanId=match[3],flags=match[4];return version===`ff`||traceId===`00000000000000000000000000000000`||parentSpanId===`0000000000000000`?null:{version,traceId,parentSpanId,flags}}function traceContext(options={}){return(req,res,next)=>{let store=requestStore.getStore(),traceparentHeader=req.headers[TRACEPARENT_HEADER],raw=Array.isArray(traceparentHeader)?traceparentHeader[0]:traceparentHeader,parsed=raw?parseTraceparent(raw):null,traceId=parsed?.traceId??generateTraceId(),spanId=generateSpanId();store&&(store.values.set(`traceId`,traceId),store.values.set(`spanId`,spanId),parsed&&(store.values.set(`parentSpanId`,parsed.parentSpanId),store.values.set(`traceFlags`,parsed.flags),store.values.set(`traceVersion`,parsed.version))),req.traceId=traceId,req.spanId=spanId,options.propagateResponse&&res.setHeader(`traceresponse`,traceId),next()}}export{ASSETS,ASSET_MANIFEST_VERSION,ApiQueryParams,Application,Asset,Autowired,Builder,CRON_META,CacheEvict,Cacheable,CircuitBreaker,CircuitOpenError,Component,ConfigService,ConsoleLoggerProvider,Container,ContributorCycleError,Controller,Cron,Delete,DuplicateContributorError,DuplicateMountNameError,FILTER_OPERATORS,FileUpload,Get,HttpException,HttpStatus,INJECTION_TOKEN,Inject,Injectable,Logger,METADATA,MemoryCacheProvider,Middleware,MissingContributorError,MissingMountDepError,ModuleList,MountCycleError,MutableModuleRegistry,Patch,Post,PostConstruct,Put,REQUEST_ID_HEADER,Repository,RequestContext,Scope,Service,SpaAdapter,TRACEPARENT_HEADER,UnknownAssetError,Value,ViewAdapter,assets,baseEnvSchema,bootstrap,buildPipeline,buildQueryParams,buildRoutes,buildUploadMiddleware,cleanupFiles,clearAssetCache,computed,cors,createConfigService,createLogger,createToken,csrf,defineAdapter,defineAugmentation,defineContextDecorator,defineEnv,defineHttpContextDecorator,defineModule,defineModules,definePlugin,errorHandler,getCacheProvider,getClassMeta,getClassMetaOrUndefined,getCronJobs,getEnv,getMetaMap,getMetaRecord,getMethodMeta,getMethodMetaOrUndefined,getRequestStore,getRequestValue,groupAssetKeys,hasClassMeta,helmet,isClusterPrimary,isInjectionToken,isRef,joinPaths,loadEnv,mountSort,normalizeApiQueryParamsConfig,normalizePath,notFoundHandler,parseFilters,parsePagination,parseQuery,parseSearchQuery,parseSort,parseTraceparent,pushClassMeta,pushMethodMeta,rateLimit,reactive,ref,reloadEnv,requestId,requestLogger,requestScopeMiddleware,requestStore,resetEnvCache,resolveAsset,resolveMimeTypes,rootLogger,runContributors,session,setCacheProvider,setClassMeta,setInMetaMap,setInMetaRecord,setMethodMeta,stripExt,toRefs,tokenName,traceContext,unref,upload,useAssets,validate,watch,withBuilder};
12
12
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/http/define-http-context-decorator.ts","../src/http/middleware/trace-context.ts"],"sourcesContent":["/**\n * HTTP-flavoured wrapper around {@link defineContextDecorator}.\n *\n * The core factory leaves `Ctx` defaulted to {@link ExecutionContext} so the\n * Context Contributor pipeline stays transport-agnostic — future WebSocket,\n * queue, and cron contexts share the same primitive. The cost is that the\n * vast majority of contributors (which are HTTP) have to spell the fourth\n * generic by hand to get `ctx.req` / `ctx.headers` typing:\n *\n * ```ts\n * // Verbose: spell every generic, including the params shape `P`.\n * defineContextDecorator<'tenant', Record<string, never>, Record<string, never>, RequestContext>({\n * key: 'tenant',\n * resolve: (ctx) => ({ id: ctx.req.headers['x-tenant-id'] as string }),\n * })\n * ```\n *\n * `defineHttpContextDecorator` removes that ceremony — the spec is typed\n * against `RequestContext` from the start, so resolvers can read `ctx.req`,\n * `ctx.headers`, `ctx.params`, etc. without a cast or generic dance:\n *\n * ```ts\n * import { defineHttpContextDecorator } from '@forinda/kickjs'\n *\n * const LoadTenant = defineHttpContextDecorator({\n * key: 'tenant',\n * resolve: (ctx) => ({ id: ctx.req.headers['x-tenant-id'] as string }),\n * })\n *\n * // Parameterised: the third generic carries the per-call params shape.\n * const LoadTenantParameterised = defineHttpContextDecorator<\n * 'tenant',\n * Record<string, never>,\n * { source: 'header' | 'subdomain' }\n * >({\n * key: 'tenant',\n * paramDefaults: { source: 'header' },\n * resolve: (ctx, _deps, params) => {\n * // params.source narrows inside `if` branches.\n * },\n * })\n * ```\n *\n * Use {@link defineContextDecorator} directly when authoring contributors\n * for non-HTTP transports or when you want to share one contributor across\n * HTTP + WS + queue (the resolver then has to stick to the\n * `ExecutionContext` surface — `ctx.get` / `ctx.set` / `ctx.requestId`).\n */\n\nimport {\n defineContextDecorator,\n type ContextDecorator,\n type ContextDecoratorSpec,\n type DepValue,\n} from '../core/context-decorator'\nimport type { RequestContext } from './context'\n\nexport function defineHttpContextDecorator<\n K extends string,\n D extends Record<string, DepValue> = Record<string, never>,\n P extends Record<string, unknown> = Record<string, never>,\n>(spec: ContextDecoratorSpec<K, D, P, RequestContext>): ContextDecorator<K, D, P, RequestContext> {\n return defineContextDecorator<K, D, P, RequestContext>(spec)\n}\n","import crypto from 'node:crypto'\nimport type { Request, Response, NextFunction } from 'express'\nimport { requestStore } from '../request-store'\n\n/**\n * W3C Trace Context header name.\n * @see https://www.w3.org/TR/trace-context/#traceparent-header\n */\nexport const TRACEPARENT_HEADER = 'traceparent'\n\n/** Regex for a valid W3C traceparent: {version}-{trace-id}-{parent-id}-{flags} */\nconst TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/\n\nexport interface TraceContextOptions {\n /**\n * When true, respond with a `traceresponse` header containing the trace ID.\n * Useful for debugging. Default: false.\n */\n propagateResponse?: boolean\n}\n\n/**\n * Parsed W3C trace context fields.\n */\nexport interface TraceContext {\n /** W3C traceparent version (usually '00') */\n version: string\n /** 32-hex-char distributed trace ID */\n traceId: string\n /** 16-hex-char parent span ID */\n parentSpanId: string\n /** 2-hex-char trace flags */\n flags: string\n}\n\n/**\n * Generate a random 32-hex-character trace ID.\n */\nfunction generateTraceId(): string {\n return crypto.randomBytes(16).toString('hex')\n}\n\n/**\n * Generate a random 16-hex-character span ID.\n */\nfunction generateSpanId(): string {\n return crypto.randomBytes(8).toString('hex')\n}\n\n/**\n * Parse a W3C traceparent header value.\n * Returns null if the format is invalid.\n */\nexport function parseTraceparent(header: string): TraceContext | null {\n const match = TRACEPARENT_RE.exec(header.trim().toLowerCase())\n if (!match) return null\n\n const version = match[1]\n const traceId = match[2]\n const parentSpanId = match[3]\n const flags = match[4]\n\n // W3C spec: version ff is invalid, all-zero trace-id and parent-id are invalid\n if (\n version === 'ff' ||\n traceId === '00000000000000000000000000000000' ||\n parentSpanId === '0000000000000000'\n ) {\n return null\n }\n\n return { version, traceId, parentSpanId, flags }\n}\n\n/**\n * Middleware that extracts W3C `traceparent` header and stores trace context\n * in the request's AsyncLocalStorage store.\n *\n * If no valid `traceparent` header is present, a new traceId is generated\n * so that every request always has a trace ID available for correlation.\n *\n * Must be mounted **after** `requestScopeMiddleware()` (which creates the store).\n *\n * @example\n * ```ts\n * bootstrap({\n * middleware: [\n * requestScopeMiddleware(),\n * traceContext(), // extracts or generates traceId\n * requestLogger(),\n * express.json(),\n * ],\n * })\n * ```\n */\nexport function traceContext(options: TraceContextOptions = {}) {\n return (req: Request, res: Response, next: NextFunction) => {\n const store = requestStore.getStore()\n\n const traceparentHeader = req.headers[TRACEPARENT_HEADER]\n const raw = Array.isArray(traceparentHeader) ? traceparentHeader[0] : traceparentHeader\n const parsed = raw ? parseTraceparent(raw) : null\n\n const traceId = parsed?.traceId ?? generateTraceId()\n const spanId = generateSpanId()\n\n // Attach to the request store so logger + downstream code can access it\n if (store) {\n store.values.set('traceId', traceId)\n store.values.set('spanId', spanId)\n if (parsed) {\n store.values.set('parentSpanId', parsed.parentSpanId)\n store.values.set('traceFlags', parsed.flags)\n store.values.set('traceVersion', parsed.version)\n }\n }\n\n // Also expose on req for convenience\n ;(req as any).traceId = traceId\n ;(req as any).spanId = spanId\n\n if (options.propagateResponse) {\n res.setHeader('traceresponse', traceId)\n }\n\n next()\n }\n}\n"],"mappings":";;;;;;;;;;klGAyDA,SAAgB,2BAId,KAAgG,CAChG,OAAO,uBAAgD,KAAK,CCtD9D,MAAa,mBAAqB,cAG5B,eAAiB,8DA2BvB,SAAS,iBAA0B,CACjC,OAAO,OAAO,YAAY,GAAG,CAAC,SAAS,MAAM,CAM/C,SAAS,gBAAyB,CAChC,OAAO,OAAO,YAAY,EAAE,CAAC,SAAS,MAAM,CAO9C,SAAgB,iBAAiB,OAAqC,CACpE,IAAM,MAAQ,eAAe,KAAK,OAAO,MAAM,CAAC,aAAa,CAAC,CAC9D,GAAI,CAAC,MAAO,OAAO,KAEnB,IAAM,QAAU,MAAM,GAChB,QAAU,MAAM,GAChB,aAAe,MAAM,GACrB,MAAQ,MAAM,GAWpB,OAPE,UAAY,MACZ,UAAY,oCACZ,eAAiB,mBAEV,KAGF,CAAE,QAAS,QAAS,aAAc,MAAO,CAwBlD,SAAgB,aAAa,QAA+B,EAAE,CAAE,CAC9D,OAAQ,IAAc,IAAe,OAAuB,CAC1D,IAAM,MAAQ,aAAa,UAAU,CAE/B,kBAAoB,IAAI,QAAQ,oBAChC,IAAM,MAAM,QAAQ,kBAAkB,CAAG,kBAAkB,GAAK,kBAChE,OAAS,IAAM,iBAAiB,IAAI,CAAG,KAEvC,QAAU,QAAQ,SAAW,iBAAiB,CAC9C,OAAS,gBAAgB,CAG3B,QACF,MAAM,OAAO,IAAI,UAAW,QAAQ,CACpC,MAAM,OAAO,IAAI,SAAU,OAAO,CAC9B,SACF,MAAM,OAAO,IAAI,eAAgB,OAAO,aAAa,CACrD,MAAM,OAAO,IAAI,aAAc,OAAO,MAAM,CAC5C,MAAM,OAAO,IAAI,eAAgB,OAAO,QAAQ,GAKlD,IAAY,QAAU,QACtB,IAAY,OAAS,OAEnB,QAAQ,mBACV,IAAI,UAAU,gBAAiB,QAAQ,CAGzC,MAAM"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/http/define-http-context-decorator.ts","../src/http/middleware/trace-context.ts"],"sourcesContent":["/**\n * HTTP-flavoured wrapper around {@link defineContextDecorator}.\n *\n * The core factory leaves `Ctx` defaulted to {@link ExecutionContext} so the\n * Context Contributor pipeline stays transport-agnostic — future WebSocket,\n * queue, and cron contexts share the same primitive. The cost is that the\n * vast majority of contributors (which are HTTP) have to spell the fourth\n * generic by hand to get `ctx.req` / `ctx.headers` typing:\n *\n * ```ts\n * // Verbose: spell every generic, including the params shape `P`.\n * defineContextDecorator<'tenant', Record<string, never>, Record<string, never>, RequestContext>({\n * key: 'tenant',\n * resolve: (ctx) => ({ id: ctx.req.headers['x-tenant-id'] as string }),\n * })\n * ```\n *\n * `defineHttpContextDecorator` removes that ceremony — the spec is typed\n * against `RequestContext` from the start, so resolvers can read `ctx.req`,\n * `ctx.headers`, `ctx.params`, etc. without a cast or generic dance:\n *\n * ```ts\n * import { defineHttpContextDecorator } from '@forinda/kickjs'\n *\n * const LoadTenant = defineHttpContextDecorator({\n * key: 'tenant',\n * resolve: (ctx) => ({ id: ctx.req.headers['x-tenant-id'] as string }),\n * })\n *\n * // Parameterised: the third generic carries the per-call params shape.\n * const LoadTenantParameterised = defineHttpContextDecorator<\n * 'tenant',\n * Record<string, never>,\n * { source: 'header' | 'subdomain' }\n * >({\n * key: 'tenant',\n * paramDefaults: { source: 'header' },\n * resolve: (ctx, _deps, params) => {\n * // params.source narrows inside `if` branches.\n * },\n * })\n * ```\n *\n * Use {@link defineContextDecorator} directly when authoring contributors\n * for non-HTTP transports or when you want to share one contributor across\n * HTTP + WS + queue (the resolver then has to stick to the\n * `ExecutionContext` surface — `ctx.get` / `ctx.set` / `ctx.requestId`).\n */\n\nimport {\n defineContextDecorator,\n type ContextDecorator,\n type ContextDecoratorSpec,\n type DepValue,\n} from '../core/context-decorator'\nimport type { RequestContext } from './context'\n\nexport function defineHttpContextDecorator<\n K extends string,\n D extends Record<string, DepValue> = Record<string, never>,\n P extends Record<string, unknown> = Record<string, never>,\n>(spec: ContextDecoratorSpec<K, D, P, RequestContext>): ContextDecorator<K, D, P, RequestContext> {\n return defineContextDecorator<K, D, P, RequestContext>(spec)\n}\n","import crypto from 'node:crypto'\nimport type { Request, Response, NextFunction } from 'express'\nimport { requestStore } from '../request-store'\n\n/**\n * W3C Trace Context header name.\n * @see https://www.w3.org/TR/trace-context/#traceparent-header\n */\nexport const TRACEPARENT_HEADER = 'traceparent'\n\n/** Regex for a valid W3C traceparent: {version}-{trace-id}-{parent-id}-{flags} */\nconst TRACEPARENT_RE = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/\n\nexport interface TraceContextOptions {\n /**\n * When true, respond with a `traceresponse` header containing the trace ID.\n * Useful for debugging. Default: false.\n */\n propagateResponse?: boolean\n}\n\n/**\n * Parsed W3C trace context fields.\n */\nexport interface TraceContext {\n /** W3C traceparent version (usually '00') */\n version: string\n /** 32-hex-char distributed trace ID */\n traceId: string\n /** 16-hex-char parent span ID */\n parentSpanId: string\n /** 2-hex-char trace flags */\n flags: string\n}\n\n/**\n * Generate a random 32-hex-character trace ID.\n */\nfunction generateTraceId(): string {\n return crypto.randomBytes(16).toString('hex')\n}\n\n/**\n * Generate a random 16-hex-character span ID.\n */\nfunction generateSpanId(): string {\n return crypto.randomBytes(8).toString('hex')\n}\n\n/**\n * Parse a W3C traceparent header value.\n * Returns null if the format is invalid.\n */\nexport function parseTraceparent(header: string): TraceContext | null {\n const match = TRACEPARENT_RE.exec(header.trim().toLowerCase())\n if (!match) return null\n\n const version = match[1]\n const traceId = match[2]\n const parentSpanId = match[3]\n const flags = match[4]\n\n // W3C spec: version ff is invalid, all-zero trace-id and parent-id are invalid\n if (\n version === 'ff' ||\n traceId === '00000000000000000000000000000000' ||\n parentSpanId === '0000000000000000'\n ) {\n return null\n }\n\n return { version, traceId, parentSpanId, flags }\n}\n\n/**\n * Middleware that extracts W3C `traceparent` header and stores trace context\n * in the request's AsyncLocalStorage store.\n *\n * If no valid `traceparent` header is present, a new traceId is generated\n * so that every request always has a trace ID available for correlation.\n *\n * Must be mounted **after** `requestScopeMiddleware()` (which creates the store).\n *\n * @example\n * ```ts\n * bootstrap({\n * middleware: [\n * requestScopeMiddleware(),\n * traceContext(), // extracts or generates traceId\n * requestLogger(),\n * express.json(),\n * ],\n * })\n * ```\n */\nexport function traceContext(options: TraceContextOptions = {}) {\n return (req: Request, res: Response, next: NextFunction) => {\n const store = requestStore.getStore()\n\n const traceparentHeader = req.headers[TRACEPARENT_HEADER]\n const raw = Array.isArray(traceparentHeader) ? traceparentHeader[0] : traceparentHeader\n const parsed = raw ? parseTraceparent(raw) : null\n\n const traceId = parsed?.traceId ?? generateTraceId()\n const spanId = generateSpanId()\n\n // Attach to the request store so logger + downstream code can access it\n if (store) {\n store.values.set('traceId', traceId)\n store.values.set('spanId', spanId)\n if (parsed) {\n store.values.set('parentSpanId', parsed.parentSpanId)\n store.values.set('traceFlags', parsed.flags)\n store.values.set('traceVersion', parsed.version)\n }\n }\n\n // Also expose on req for convenience\n ;(req as any).traceId = traceId\n ;(req as any).spanId = spanId\n\n if (options.propagateResponse) {\n res.setHeader('traceresponse', traceId)\n }\n\n next()\n }\n}\n"],"mappings":";;;;;;;;;;kqGAyDA,SAAgB,2BAId,KAAgG,CAChG,OAAO,uBAAgD,KAAK,CCtD9D,MAAa,mBAAqB,cAG5B,eAAiB,8DA2BvB,SAAS,iBAA0B,CACjC,OAAO,OAAO,YAAY,GAAG,CAAC,SAAS,MAAM,CAM/C,SAAS,gBAAyB,CAChC,OAAO,OAAO,YAAY,EAAE,CAAC,SAAS,MAAM,CAO9C,SAAgB,iBAAiB,OAAqC,CACpE,IAAM,MAAQ,eAAe,KAAK,OAAO,MAAM,CAAC,aAAa,CAAC,CAC9D,GAAI,CAAC,MAAO,OAAO,KAEnB,IAAM,QAAU,MAAM,GAChB,QAAU,MAAM,GAChB,aAAe,MAAM,GACrB,MAAQ,MAAM,GAWpB,OAPE,UAAY,MACZ,UAAY,oCACZ,eAAiB,mBAEV,KAGF,CAAE,QAAS,QAAS,aAAc,MAAO,CAwBlD,SAAgB,aAAa,QAA+B,EAAE,CAAE,CAC9D,OAAQ,IAAc,IAAe,OAAuB,CAC1D,IAAM,MAAQ,aAAa,UAAU,CAE/B,kBAAoB,IAAI,QAAQ,oBAChC,IAAM,MAAM,QAAQ,kBAAkB,CAAG,kBAAkB,GAAK,kBAChE,OAAS,IAAM,iBAAiB,IAAI,CAAG,KAEvC,QAAU,QAAQ,SAAW,iBAAiB,CAC9C,OAAS,gBAAgB,CAG3B,QACF,MAAM,OAAO,IAAI,UAAW,QAAQ,CACpC,MAAM,OAAO,IAAI,SAAU,OAAO,CAC9B,SACF,MAAM,OAAO,IAAI,eAAgB,OAAO,aAAa,CACrD,MAAM,OAAO,IAAI,aAAc,OAAO,MAAM,CAC5C,MAAM,OAAO,IAAI,eAAgB,OAAO,QAAQ,GAKlD,IAAY,QAAU,QACtB,IAAY,OAAS,OAEnB,QAAQ,mBACV,IAAI,UAAU,gBAAiB,QAAQ,CAGzC,MAAM"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v5.4.0
2
+ * @forinda/kickjs v5.6.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,4 +9,4 @@
9
9
  * @license MIT
10
10
  */
11
11
  import"reflect-metadata";function setClassMeta(key,value,target){Reflect.defineMetadata(key,value,target)}function setMethodMeta(key,value,target,method){Reflect.defineMetadata(key,value,target,method)}function getClassMeta(key,target,fallback){return Reflect.getMetadata(key,target)??fallback}function getMethodMeta(key,target,method,fallback){return Reflect.getMetadata(key,target,method)??fallback}function hasClassMeta(key,target){return Reflect.hasMetadata(key,target)}function getClassMetaOrUndefined(key,target){return Reflect.getMetadata(key,target)}function getMethodMetaOrUndefined(key,target,method){return Reflect.getMetadata(key,target,method)}function pushClassMeta(key,target,...items){let existing=Reflect.getOwnMetadata(key,target)??[];Reflect.defineMetadata(key,[...existing,...items],target)}function pushMethodMeta(key,target,method,...items){let existing=Reflect.getOwnMetadata(key,target,method)??[];Reflect.defineMetadata(key,[...existing,...items],target,method)}function setInMetaMap(key,target,mapKey,mapValue){let inherited=Reflect.getOwnMetadata(key,target),map=inherited?new Map(inherited):new Map;map.set(mapKey,mapValue),Reflect.defineMetadata(key,map,target)}function getMetaMap(key,target){return Reflect.getMetadata(key,target)??new Map}function setInMetaRecord(key,target,recKey,recValue){let inherited=Reflect.getOwnMetadata(key,target),rec=inherited?{...inherited}:{};rec[recKey]=recValue,Reflect.defineMetadata(key,rec,target)}function getMetaRecord(key,target){return Reflect.getMetadata(key,target)??{}}export{getMethodMeta as a,pushClassMeta as c,setInMetaMap as d,setInMetaRecord as f,getMetaRecord as i,pushMethodMeta as l,getClassMetaOrUndefined as n,getMethodMetaOrUndefined as o,setMethodMeta as p,getMetaMap as r,hasClassMeta as s,getClassMeta as t,setClassMeta as u};
12
- //# sourceMappingURL=metadata-Dn6kNT82.mjs.map
12
+ //# sourceMappingURL=metadata-IHiynOCv.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata-Dn6kNT82.mjs","names":[],"sources":["../src/core/metadata.ts"],"sourcesContent":["import 'reflect-metadata'\nimport type { InjectionToken } from './token'\n\n/**\n * Typed utilities for reflect-metadata operations.\n *\n * Replaces scattered Reflect.defineMetadata/getMetadata calls with a single\n * source of truth. If we later move to Stage 3 decorators or a WeakMap-based\n * store, only this file changes — all 24+ consumer files stay untouched.\n *\n * Keys may be symbols, strings, or `InjectionToken<T>` objects produced by\n * `createToken()`. Using `createToken` is the preferred pattern because the\n * token's phantom type flows through the helpers, enabling type-safe reads.\n */\n\ntype MetaKey = symbol | string | InjectionToken<unknown>\n\n// ── Setters ─────────────────────────────────────────────────────\n\n/** Set metadata on a class (or prototype for property decorators) */\nexport function setClassMeta<T>(key: MetaKey, value: T, target: object): void {\n Reflect.defineMetadata(key, value, target)\n}\n\n/** Set metadata on a specific method */\nexport function setMethodMeta<T>(key: MetaKey, value: T, target: object, method: string): void {\n Reflect.defineMetadata(key, value, target, method)\n}\n\n// ── Getters ─────────────────────────────────────────────────────\n\n/** Get metadata from a class, returning `fallback` if not set */\nexport function getClassMeta<T>(key: MetaKey, target: object, fallback: T): T {\n return (Reflect.getMetadata(key, target) as T) ?? fallback\n}\n\n/** Get metadata from a specific method, returning `fallback` if not set */\nexport function getMethodMeta<T>(key: MetaKey, target: object, method: string, fallback: T): T {\n return (Reflect.getMetadata(key, target, method) as T) ?? fallback\n}\n\n/** Check if metadata exists on a class */\nexport function hasClassMeta(key: MetaKey, target: object): boolean {\n return Reflect.hasMetadata(key, target)\n}\n\n/** Get metadata from a class with no default (returns undefined if absent) */\nexport function getClassMetaOrUndefined<T>(key: MetaKey, target: object): T | undefined {\n return Reflect.getMetadata(key, target) as T | undefined\n}\n\n/** Get metadata from a method with no default (returns undefined if absent) */\nexport function getMethodMetaOrUndefined<T>(\n key: MetaKey,\n target: object,\n method: string,\n): T | undefined {\n return Reflect.getMetadata(key, target, method) as T | undefined\n}\n\n// ── Accumulate: Arrays ──────────────────────────────────────────\n\n/** Append items to an array stored in class metadata */\nexport function pushClassMeta<T>(key: MetaKey, target: object, ...items: T[]): void {\n const existing: T[] = Reflect.getOwnMetadata(key, target) ?? []\n Reflect.defineMetadata(key, [...existing, ...items], target)\n}\n\n/** Append items to an array stored in method metadata */\nexport function pushMethodMeta<T>(\n key: MetaKey,\n target: object,\n method: string,\n ...items: T[]\n): void {\n const existing: T[] = Reflect.getOwnMetadata(key, target, method) ?? []\n Reflect.defineMetadata(key, [...existing, ...items], target, method)\n}\n\n// ── Accumulate: Maps ────────────────────────────────────────────\n\n/** Set a key/value in a Map stored in class metadata */\nexport function setInMetaMap<K, V>(key: MetaKey, target: object, mapKey: K, mapValue: V): void {\n const inherited: Map<K, V> | undefined = Reflect.getOwnMetadata(key, target)\n const map = inherited ? new Map(inherited) : new Map<K, V>()\n map.set(mapKey, mapValue)\n Reflect.defineMetadata(key, map, target)\n}\n\n/** Get a Map from class metadata (returns empty Map if absent) */\nexport function getMetaMap<K, V>(key: MetaKey, target: object): Map<K, V> {\n return Reflect.getMetadata(key, target) ?? new Map()\n}\n\n// ── Accumulate: Records ─────────────────────────────────────────\n\n/** Set a key/value in a Record stored in class metadata */\nexport function setInMetaRecord<V>(\n key: MetaKey,\n target: object,\n recKey: string | number,\n recValue: V,\n): void {\n const inherited: Record<string | number, V> | undefined = Reflect.getOwnMetadata(key, target)\n const rec = inherited ? { ...inherited } : {}\n rec[recKey] = recValue\n Reflect.defineMetadata(key, rec, target)\n}\n\n/** Get a Record from class metadata (returns empty object if absent) */\nexport function getMetaRecord<V>(key: MetaKey, target: object): Record<string | number, V> {\n return Reflect.getMetadata(key, target) ?? {}\n}\n"],"mappings":";;;;;;;;;;yBAoBA,SAAgB,aAAgB,IAAc,MAAU,OAAsB,CAC5E,QAAQ,eAAe,IAAK,MAAO,OAAO,CAI5C,SAAgB,cAAiB,IAAc,MAAU,OAAgB,OAAsB,CAC7F,QAAQ,eAAe,IAAK,MAAO,OAAQ,OAAO,CAMpD,SAAgB,aAAgB,IAAc,OAAgB,SAAgB,CAC5E,OAAQ,QAAQ,YAAY,IAAK,OAAO,EAAU,SAIpD,SAAgB,cAAiB,IAAc,OAAgB,OAAgB,SAAgB,CAC7F,OAAQ,QAAQ,YAAY,IAAK,OAAQ,OAAO,EAAU,SAI5D,SAAgB,aAAa,IAAc,OAAyB,CAClE,OAAO,QAAQ,YAAY,IAAK,OAAO,CAIzC,SAAgB,wBAA2B,IAAc,OAA+B,CACtF,OAAO,QAAQ,YAAY,IAAK,OAAO,CAIzC,SAAgB,yBACd,IACA,OACA,OACe,CACf,OAAO,QAAQ,YAAY,IAAK,OAAQ,OAAO,CAMjD,SAAgB,cAAiB,IAAc,OAAgB,GAAG,MAAkB,CAClF,IAAM,SAAgB,QAAQ,eAAe,IAAK,OAAO,EAAI,EAAE,CAC/D,QAAQ,eAAe,IAAK,CAAC,GAAG,SAAU,GAAG,MAAM,CAAE,OAAO,CAI9D,SAAgB,eACd,IACA,OACA,OACA,GAAG,MACG,CACN,IAAM,SAAgB,QAAQ,eAAe,IAAK,OAAQ,OAAO,EAAI,EAAE,CACvE,QAAQ,eAAe,IAAK,CAAC,GAAG,SAAU,GAAG,MAAM,CAAE,OAAQ,OAAO,CAMtE,SAAgB,aAAmB,IAAc,OAAgB,OAAW,SAAmB,CAC7F,IAAM,UAAmC,QAAQ,eAAe,IAAK,OAAO,CACtE,IAAM,UAAY,IAAI,IAAI,UAAU,CAAG,IAAI,IACjD,IAAI,IAAI,OAAQ,SAAS,CACzB,QAAQ,eAAe,IAAK,IAAK,OAAO,CAI1C,SAAgB,WAAiB,IAAc,OAA2B,CACxE,OAAO,QAAQ,YAAY,IAAK,OAAO,EAAI,IAAI,IAMjD,SAAgB,gBACd,IACA,OACA,OACA,SACM,CACN,IAAM,UAAoD,QAAQ,eAAe,IAAK,OAAO,CACvF,IAAM,UAAY,CAAE,GAAG,UAAW,CAAG,EAAE,CAC7C,IAAI,QAAU,SACd,QAAQ,eAAe,IAAK,IAAK,OAAO,CAI1C,SAAgB,cAAiB,IAAc,OAA4C,CACzF,OAAO,QAAQ,YAAY,IAAK,OAAO,EAAI,EAAE"}
1
+ {"version":3,"file":"metadata-IHiynOCv.mjs","names":[],"sources":["../src/core/metadata.ts"],"sourcesContent":["import 'reflect-metadata'\nimport type { InjectionToken } from './token'\n\n/**\n * Typed utilities for reflect-metadata operations.\n *\n * Replaces scattered Reflect.defineMetadata/getMetadata calls with a single\n * source of truth. If we later move to Stage 3 decorators or a WeakMap-based\n * store, only this file changes — all 24+ consumer files stay untouched.\n *\n * Keys may be symbols, strings, or `InjectionToken<T>` objects produced by\n * `createToken()`. Using `createToken` is the preferred pattern because the\n * token's phantom type flows through the helpers, enabling type-safe reads.\n */\n\ntype MetaKey = symbol | string | InjectionToken<unknown>\n\n// ── Setters ─────────────────────────────────────────────────────\n\n/** Set metadata on a class (or prototype for property decorators) */\nexport function setClassMeta<T>(key: MetaKey, value: T, target: object): void {\n Reflect.defineMetadata(key, value, target)\n}\n\n/** Set metadata on a specific method */\nexport function setMethodMeta<T>(key: MetaKey, value: T, target: object, method: string): void {\n Reflect.defineMetadata(key, value, target, method)\n}\n\n// ── Getters ─────────────────────────────────────────────────────\n\n/** Get metadata from a class, returning `fallback` if not set */\nexport function getClassMeta<T>(key: MetaKey, target: object, fallback: T): T {\n return (Reflect.getMetadata(key, target) as T) ?? fallback\n}\n\n/** Get metadata from a specific method, returning `fallback` if not set */\nexport function getMethodMeta<T>(key: MetaKey, target: object, method: string, fallback: T): T {\n return (Reflect.getMetadata(key, target, method) as T) ?? fallback\n}\n\n/** Check if metadata exists on a class */\nexport function hasClassMeta(key: MetaKey, target: object): boolean {\n return Reflect.hasMetadata(key, target)\n}\n\n/** Get metadata from a class with no default (returns undefined if absent) */\nexport function getClassMetaOrUndefined<T>(key: MetaKey, target: object): T | undefined {\n return Reflect.getMetadata(key, target) as T | undefined\n}\n\n/** Get metadata from a method with no default (returns undefined if absent) */\nexport function getMethodMetaOrUndefined<T>(\n key: MetaKey,\n target: object,\n method: string,\n): T | undefined {\n return Reflect.getMetadata(key, target, method) as T | undefined\n}\n\n// ── Accumulate: Arrays ──────────────────────────────────────────\n\n/** Append items to an array stored in class metadata */\nexport function pushClassMeta<T>(key: MetaKey, target: object, ...items: T[]): void {\n const existing: T[] = Reflect.getOwnMetadata(key, target) ?? []\n Reflect.defineMetadata(key, [...existing, ...items], target)\n}\n\n/** Append items to an array stored in method metadata */\nexport function pushMethodMeta<T>(\n key: MetaKey,\n target: object,\n method: string,\n ...items: T[]\n): void {\n const existing: T[] = Reflect.getOwnMetadata(key, target, method) ?? []\n Reflect.defineMetadata(key, [...existing, ...items], target, method)\n}\n\n// ── Accumulate: Maps ────────────────────────────────────────────\n\n/** Set a key/value in a Map stored in class metadata */\nexport function setInMetaMap<K, V>(key: MetaKey, target: object, mapKey: K, mapValue: V): void {\n const inherited: Map<K, V> | undefined = Reflect.getOwnMetadata(key, target)\n const map = inherited ? new Map(inherited) : new Map<K, V>()\n map.set(mapKey, mapValue)\n Reflect.defineMetadata(key, map, target)\n}\n\n/** Get a Map from class metadata (returns empty Map if absent) */\nexport function getMetaMap<K, V>(key: MetaKey, target: object): Map<K, V> {\n return Reflect.getMetadata(key, target) ?? new Map()\n}\n\n// ── Accumulate: Records ─────────────────────────────────────────\n\n/** Set a key/value in a Record stored in class metadata */\nexport function setInMetaRecord<V>(\n key: MetaKey,\n target: object,\n recKey: string | number,\n recValue: V,\n): void {\n const inherited: Record<string | number, V> | undefined = Reflect.getOwnMetadata(key, target)\n const rec = inherited ? { ...inherited } : {}\n rec[recKey] = recValue\n Reflect.defineMetadata(key, rec, target)\n}\n\n/** Get a Record from class metadata (returns empty object if absent) */\nexport function getMetaRecord<V>(key: MetaKey, target: object): Record<string | number, V> {\n return Reflect.getMetadata(key, target) ?? {}\n}\n"],"mappings":";;;;;;;;;;yBAoBA,SAAgB,aAAgB,IAAc,MAAU,OAAsB,CAC5E,QAAQ,eAAe,IAAK,MAAO,OAAO,CAI5C,SAAgB,cAAiB,IAAc,MAAU,OAAgB,OAAsB,CAC7F,QAAQ,eAAe,IAAK,MAAO,OAAQ,OAAO,CAMpD,SAAgB,aAAgB,IAAc,OAAgB,SAAgB,CAC5E,OAAQ,QAAQ,YAAY,IAAK,OAAO,EAAU,SAIpD,SAAgB,cAAiB,IAAc,OAAgB,OAAgB,SAAgB,CAC7F,OAAQ,QAAQ,YAAY,IAAK,OAAQ,OAAO,EAAU,SAI5D,SAAgB,aAAa,IAAc,OAAyB,CAClE,OAAO,QAAQ,YAAY,IAAK,OAAO,CAIzC,SAAgB,wBAA2B,IAAc,OAA+B,CACtF,OAAO,QAAQ,YAAY,IAAK,OAAO,CAIzC,SAAgB,yBACd,IACA,OACA,OACe,CACf,OAAO,QAAQ,YAAY,IAAK,OAAQ,OAAO,CAMjD,SAAgB,cAAiB,IAAc,OAAgB,GAAG,MAAkB,CAClF,IAAM,SAAgB,QAAQ,eAAe,IAAK,OAAO,EAAI,EAAE,CAC/D,QAAQ,eAAe,IAAK,CAAC,GAAG,SAAU,GAAG,MAAM,CAAE,OAAO,CAI9D,SAAgB,eACd,IACA,OACA,OACA,GAAG,MACG,CACN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