@forinda/kickjs 3.1.0 → 3.1.2

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 (52) hide show
  1. package/dist/{application-DndmY_Qw.mjs → application-M8SEljFB.mjs} +5 -5
  2. package/dist/{application-DndmY_Qw.mjs.map → application-M8SEljFB.mjs.map} +1 -1
  3. package/dist/{bootstrap-CXcE2wea.mjs → bootstrap-DdAhHgVG.mjs} +6 -6
  4. package/dist/{bootstrap-CXcE2wea.mjs.map → bootstrap-DdAhHgVG.mjs.map} +1 -1
  5. package/dist/{chunk-C9ew9lwC.mjs → chunk-BfOl01nR.mjs} +1 -1
  6. package/dist/config/index.mjs +3 -3
  7. package/dist/{config-CD6z78Es.mjs → config-rspGiIN-.mjs} +3 -3
  8. package/dist/{config-CD6z78Es.mjs.map → config-rspGiIN-.mjs.map} +1 -1
  9. package/dist/{container-DILIivpO.mjs → container-BQ-X3dXH.mjs} +3 -3
  10. package/dist/{container-DILIivpO.mjs.map → container-BQ-X3dXH.mjs.map} +1 -1
  11. package/dist/core/adapter.mjs +1 -1
  12. package/dist/core/app-module.mjs +1 -1
  13. package/dist/core/cache.mjs +1 -1
  14. package/dist/core/container.mjs +2 -2
  15. package/dist/core/cron.mjs +2 -2
  16. package/dist/core/decorators.mjs +3 -3
  17. package/dist/core/errors.mjs +1 -1
  18. package/dist/core/interfaces.mjs +1 -1
  19. package/dist/core/logger.mjs +1 -1
  20. package/dist/core/path.mjs +1 -1
  21. package/dist/core/plugin.mjs +1 -1
  22. package/dist/core/reactivity.mjs +1 -1
  23. package/dist/{core-Bi6XNE_C.mjs → core-NDLlQziD.mjs} +4 -4
  24. package/dist/{core-Bi6XNE_C.mjs.map → core-NDLlQziD.mjs.map} +1 -1
  25. package/dist/{env-hnrBl1G9.mjs → env-C_0nE69f.mjs} +4 -4
  26. package/dist/{env-hnrBl1G9.mjs.map → env-C_0nE69f.mjs.map} +1 -1
  27. package/dist/http/application.mjs +2 -2
  28. package/dist/http/bootstrap.mjs +2 -2
  29. package/dist/http/context.d.mts +16 -0
  30. package/dist/http/context.d.mts.map +1 -1
  31. package/dist/http/context.mjs +23 -2
  32. package/dist/http/context.mjs.map +1 -1
  33. package/dist/http/middleware/cors.mjs +1 -1
  34. package/dist/http/middleware/csrf.mjs +1 -1
  35. package/dist/http/middleware/error-handler.mjs +2 -2
  36. package/dist/http/middleware/helmet.mjs +1 -1
  37. package/dist/http/middleware/rate-limit.mjs +1 -1
  38. package/dist/http/middleware/request-id.mjs +1 -1
  39. package/dist/http/middleware/request-logger.mjs +2 -2
  40. package/dist/http/middleware/session.mjs +1 -1
  41. package/dist/http/middleware/spa.mjs +3 -3
  42. package/dist/http/middleware/upload.mjs +1 -1
  43. package/dist/http/middleware/validate.mjs +2 -2
  44. package/dist/http/middleware/views.mjs +2 -2
  45. package/dist/http/query/index.mjs +2 -2
  46. package/dist/http/router-builder.mjs +4 -4
  47. package/dist/index.mjs +9 -9
  48. package/dist/{metadata-BcaUHcSD.mjs → metadata-Dp3Ozdr5.mjs} +2 -2
  49. package/dist/{metadata-BcaUHcSD.mjs.map → metadata-Dp3Ozdr5.mjs.map} +1 -1
  50. package/dist/{query-BTaH2fIN.mjs → query-o6_fDG4v.mjs} +2 -2
  51. package/dist/{query-BTaH2fIN.mjs.map → query-o6_fDG4v.mjs.map} +1 -1
  52. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { n as tokenName, t as Container } from "../container-DILIivpO.mjs";
11
+ import { n as tokenName, t as Container } from "../container-BQ-X3dXH.mjs";
12
12
  export { Container, tokenName };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { c as pushClassMeta, t as getClassMeta } from "../metadata-BcaUHcSD.mjs";
11
+ import { c as pushClassMeta, t as getClassMeta } from "../metadata-Dp3Ozdr5.mjs";
12
12
  //#region src/core/cron.ts
13
13
  const CRON_META = Symbol("kick:cron");
14
14
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,8 +9,8 @@
9
9
  * @license MIT
10
10
  */
11
11
  import { METADATA, Scope } from "./interfaces.mjs";
12
- import { c as pushClassMeta, d as setInMetaMap, f as setInMetaRecord, l as pushMethodMeta, p as setMethodMeta, u as setClassMeta } from "../metadata-BcaUHcSD.mjs";
13
- import { t as Container } from "../container-DILIivpO.mjs";
12
+ import { c as pushClassMeta, d as setInMetaMap, f as setInMetaRecord, l as pushMethodMeta, p as setMethodMeta, u as setClassMeta } from "../metadata-Dp3Ozdr5.mjs";
13
+ import { t as Container } from "../container-BQ-X3dXH.mjs";
14
14
  import "reflect-metadata";
15
15
  //#region src/core/decorators.ts
16
16
  const pendingRegistrations = [];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -10,8 +10,8 @@
10
10
  */
11
11
  import "./core/interfaces.mjs";
12
12
  import "./core/logger.mjs";
13
- import "./metadata-BcaUHcSD.mjs";
14
- import "./container-DILIivpO.mjs";
13
+ import "./metadata-Dp3Ozdr5.mjs";
14
+ import "./container-BQ-X3dXH.mjs";
15
15
  import "./core/decorators.mjs";
16
16
  import "./core/cron.mjs";
17
17
  import "./core/cache.mjs";
@@ -118,4 +118,4 @@ var CircuitBreaker = class {
118
118
  //#endregion
119
119
  export { CircuitOpenError as n, CircuitBreaker as t };
120
120
 
121
- //# sourceMappingURL=core-Bi6XNE_C.mjs.map
121
+ //# sourceMappingURL=core-NDLlQziD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-Bi6XNE_C.mjs","names":[],"sources":["../src/core/circuit-breaker.ts"],"sourcesContent":["/**\n * Circuit Breaker pattern for external service calls.\n *\n * Protects your application from cascading failures when downstream\n * services are unhealthy by short-circuiting requests after a\n * configurable failure threshold.\n *\n * @example\n * ```ts\n * const breaker = new CircuitBreaker('payment-api', {\n * failureThreshold: 5,\n * resetTimeout: 30_000,\n * })\n *\n * const result = await breaker.execute(() => fetch('https://payment.example.com/charge'))\n * ```\n */\n\nexport type CircuitBreakerState = 'closed' | 'open' | 'half_open'\n\nexport interface CircuitBreakerOptions {\n /** Number of consecutive failures before the circuit opens. */\n failureThreshold: number\n /** Milliseconds to wait before transitioning from OPEN to HALF_OPEN. */\n resetTimeout: number\n /** Max requests allowed in HALF_OPEN state before deciding (default 1). */\n halfOpenMax?: number\n}\n\nexport interface CircuitBreakerStats {\n failures: number\n successes: number\n state: CircuitBreakerState\n lastFailure?: Date\n}\n\n/**\n * Error thrown when the circuit is open and calls are being rejected.\n */\nexport class CircuitOpenError extends Error {\n constructor(public readonly breakerName: string) {\n super(`Circuit breaker \"${breakerName}\" is open — request rejected`)\n this.name = 'CircuitOpenError'\n }\n}\n\nexport class CircuitBreaker {\n private state: CircuitBreakerState = 'closed'\n private failures = 0\n private successes = 0\n private halfOpenAttempts = 0\n private lastFailure?: Date\n private openedAt?: number\n\n private readonly failureThreshold: number\n private readonly resetTimeout: number\n private readonly halfOpenMax: number\n\n constructor(\n public readonly name: string,\n options: CircuitBreakerOptions,\n ) {\n this.failureThreshold = options.failureThreshold\n this.resetTimeout = options.resetTimeout\n this.halfOpenMax = options.halfOpenMax ?? 1\n }\n\n /**\n * Execute an async function through the circuit breaker.\n * Throws `CircuitOpenError` if the circuit is open.\n */\n async execute<T>(fn: () => Promise<T>): Promise<T> {\n this.maybeTransitionToHalfOpen()\n\n if (this.state === 'open') {\n throw new CircuitOpenError(this.name)\n }\n\n if (this.state === 'half_open' && this.halfOpenAttempts >= this.halfOpenMax) {\n throw new CircuitOpenError(this.name)\n }\n\n if (this.state === 'half_open') {\n this.halfOpenAttempts++\n }\n\n try {\n const result = await fn()\n this.onSuccess()\n return result\n } catch (error) {\n this.onFailure()\n throw error\n }\n }\n\n /** Returns the current circuit state. */\n getState(): CircuitBreakerState {\n this.maybeTransitionToHalfOpen()\n return this.state\n }\n\n /** Returns current statistics. */\n getStats(): CircuitBreakerStats {\n this.maybeTransitionToHalfOpen()\n return {\n failures: this.failures,\n successes: this.successes,\n state: this.state,\n ...(this.lastFailure ? { lastFailure: this.lastFailure } : {}),\n }\n }\n\n /** Manually reset the circuit breaker to CLOSED state. */\n reset(): void {\n this.state = 'closed'\n this.failures = 0\n this.successes = 0\n this.halfOpenAttempts = 0\n this.lastFailure = undefined\n this.openedAt = undefined\n }\n\n private onSuccess(): void {\n if (this.state === 'half_open') {\n // Recovery confirmed — close the circuit\n this.state = 'closed'\n this.failures = 0\n this.halfOpenAttempts = 0\n this.openedAt = undefined\n }\n this.successes++\n }\n\n private onFailure(): void {\n this.failures++\n this.lastFailure = new Date()\n\n if (this.state === 'half_open') {\n // Recovery failed — re-open\n this.state = 'open'\n this.openedAt = Date.now()\n this.halfOpenAttempts = 0\n } else if (this.state === 'closed' && this.failures >= this.failureThreshold) {\n this.state = 'open'\n this.openedAt = Date.now()\n }\n }\n\n private maybeTransitionToHalfOpen(): void {\n if (this.state === 'open' && this.openedAt != null) {\n if (Date.now() - this.openedAt >= this.resetTimeout) {\n this.state = 'half_open'\n this.halfOpenAttempts = 0\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,mBAAb,cAAsC,MAAM;CAC1C,YAAY,aAAqC;AAC/C,QAAM,oBAAoB,YAAY,8BAA8B;AAD1C,OAAA,cAAA;AAE1B,OAAK,OAAO;;;AAIhB,IAAa,iBAAb,MAA4B;CAC1B,QAAqC;CACrC,WAAmB;CACnB,YAAoB;CACpB,mBAA2B;CAC3B;CACA;CAEA;CACA;CACA;CAEA,YACE,MACA,SACA;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BAA0C;AACxC,MAAI,KAAK,UAAU,UAAU,KAAK,YAAY;OACxC,KAAK,KAAK,GAAG,KAAK,YAAY,KAAK,cAAc;AACnD,SAAK,QAAQ;AACb,SAAK,mBAAmB"}
1
+ {"version":3,"file":"core-NDLlQziD.mjs","names":[],"sources":["../src/core/circuit-breaker.ts"],"sourcesContent":["/**\n * Circuit Breaker pattern for external service calls.\n *\n * Protects your application from cascading failures when downstream\n * services are unhealthy by short-circuiting requests after a\n * configurable failure threshold.\n *\n * @example\n * ```ts\n * const breaker = new CircuitBreaker('payment-api', {\n * failureThreshold: 5,\n * resetTimeout: 30_000,\n * })\n *\n * const result = await breaker.execute(() => fetch('https://payment.example.com/charge'))\n * ```\n */\n\nexport type CircuitBreakerState = 'closed' | 'open' | 'half_open'\n\nexport interface CircuitBreakerOptions {\n /** Number of consecutive failures before the circuit opens. */\n failureThreshold: number\n /** Milliseconds to wait before transitioning from OPEN to HALF_OPEN. */\n resetTimeout: number\n /** Max requests allowed in HALF_OPEN state before deciding (default 1). */\n halfOpenMax?: number\n}\n\nexport interface CircuitBreakerStats {\n failures: number\n successes: number\n state: CircuitBreakerState\n lastFailure?: Date\n}\n\n/**\n * Error thrown when the circuit is open and calls are being rejected.\n */\nexport class CircuitOpenError extends Error {\n constructor(public readonly breakerName: string) {\n super(`Circuit breaker \"${breakerName}\" is open — request rejected`)\n this.name = 'CircuitOpenError'\n }\n}\n\nexport class CircuitBreaker {\n private state: CircuitBreakerState = 'closed'\n private failures = 0\n private successes = 0\n private halfOpenAttempts = 0\n private lastFailure?: Date\n private openedAt?: number\n\n private readonly failureThreshold: number\n private readonly resetTimeout: number\n private readonly halfOpenMax: number\n\n constructor(\n public readonly name: string,\n options: CircuitBreakerOptions,\n ) {\n this.failureThreshold = options.failureThreshold\n this.resetTimeout = options.resetTimeout\n this.halfOpenMax = options.halfOpenMax ?? 1\n }\n\n /**\n * Execute an async function through the circuit breaker.\n * Throws `CircuitOpenError` if the circuit is open.\n */\n async execute<T>(fn: () => Promise<T>): Promise<T> {\n this.maybeTransitionToHalfOpen()\n\n if (this.state === 'open') {\n throw new CircuitOpenError(this.name)\n }\n\n if (this.state === 'half_open' && this.halfOpenAttempts >= this.halfOpenMax) {\n throw new CircuitOpenError(this.name)\n }\n\n if (this.state === 'half_open') {\n this.halfOpenAttempts++\n }\n\n try {\n const result = await fn()\n this.onSuccess()\n return result\n } catch (error) {\n this.onFailure()\n throw error\n }\n }\n\n /** Returns the current circuit state. */\n getState(): CircuitBreakerState {\n this.maybeTransitionToHalfOpen()\n return this.state\n }\n\n /** Returns current statistics. */\n getStats(): CircuitBreakerStats {\n this.maybeTransitionToHalfOpen()\n return {\n failures: this.failures,\n successes: this.successes,\n state: this.state,\n ...(this.lastFailure ? { lastFailure: this.lastFailure } : {}),\n }\n }\n\n /** Manually reset the circuit breaker to CLOSED state. */\n reset(): void {\n this.state = 'closed'\n this.failures = 0\n this.successes = 0\n this.halfOpenAttempts = 0\n this.lastFailure = undefined\n this.openedAt = undefined\n }\n\n private onSuccess(): void {\n if (this.state === 'half_open') {\n // Recovery confirmed — close the circuit\n this.state = 'closed'\n this.failures = 0\n this.halfOpenAttempts = 0\n this.openedAt = undefined\n }\n this.successes++\n }\n\n private onFailure(): void {\n this.failures++\n this.lastFailure = new Date()\n\n if (this.state === 'half_open') {\n // Recovery failed — re-open\n this.state = 'open'\n this.openedAt = Date.now()\n this.halfOpenAttempts = 0\n } else if (this.state === 'closed' && this.failures >= this.failureThreshold) {\n this.state = 'open'\n this.openedAt = Date.now()\n }\n }\n\n private maybeTransitionToHalfOpen(): void {\n if (this.state === 'open' && this.openedAt != null) {\n if (Date.now() - this.openedAt >= this.resetTimeout) {\n this.state = 'half_open'\n this.halfOpenAttempts = 0\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,mBAAb,cAAsC,MAAM;CAC1C,YAAY,aAAqC;AAC/C,QAAM,oBAAoB,YAAY,8BAA8B;AAD1C,OAA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;AACb,QAAK,WAAW,KAAK,KAAK;AAC1B,QAAK,mBAAmB;aACf,KAAK,UAAU,YAAY,KAAK,YAAY,KAAK,kBAAkB;AAC5E,QAAK,QAAQ;AACb,QAAK,WAAW,KAAK,KAAK;;;CAI9B,4BAA0C;AACxC,MAAI,KAAK,UAAU,UAAU,KAAK,YAAY;OACxC,KAAK,KAAK,GAAG,KAAK,YAAY,KAAK,cAAc;AACnD,SAAK,QAAQ;AACb,SAAK,mBAAmB"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,8 +8,8 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as __require } from "./chunk-C9ew9lwC.mjs";
12
- import { t as Container } from "./container-DILIivpO.mjs";
11
+ import { t as __require } from "./chunk-BfOl01nR.mjs";
12
+ import { t as Container } from "./container-BQ-X3dXH.mjs";
13
13
  import { z } from "zod";
14
14
  //#region src/config/env.ts
15
15
  /**
@@ -129,4 +129,4 @@ function resetEnvCache() {
129
129
  //#endregion
130
130
  export { reloadEnv as a, loadEnv as i, defineEnv as n, resetEnvCache as o, getEnv as r, baseEnvSchema as t };
131
131
 
132
- //# sourceMappingURL=env-hnrBl1G9.mjs.map
132
+ //# sourceMappingURL=env-C_0nE69f.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"env-hnrBl1G9.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-C_0nE69f.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,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as Application } from "../application-DndmY_Qw.mjs";
11
+ import { t as Application } from "../application-M8SEljFB.mjs";
12
12
  export { Application };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,5 +8,5 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as bootstrap } from "../bootstrap-CXcE2wea.mjs";
11
+ import { t as bootstrap } from "../bootstrap-DdAhHgVG.mjs";
12
12
  export { bootstrap };
@@ -85,6 +85,22 @@ declare class RequestContext<TBody = any, TParams = any, TQuery = any> {
85
85
  * ```
86
86
  */
87
87
  get user(): MetaValue<'user', Record<string, any>> | undefined;
88
+ /**
89
+ * Tenant identifier for multi-tenant apps. Reads `user.tenantId` —
90
+ * populated either by `AuthAdapter.testMode({ tenantId })`, a tenant
91
+ * resolver middleware, or manually on the strategy's `mapPayload`.
92
+ *
93
+ * Augment `AuthUser` (or `ContextMeta['user']`) to widen the return
94
+ * type if your user shape guarantees a non-`string | undefined` id.
95
+ */
96
+ get tenantId(): string | undefined;
97
+ /**
98
+ * Effective role list for the current user. Prefers `user.tenantRoles`
99
+ * (populated by `AuthAdapterOptions.roleResolver` under a tenant) and
100
+ * falls back to `user.roles`. Returns an empty array when the user is
101
+ * absent or the shape has neither field.
102
+ */
103
+ get roles(): string[];
88
104
  /**
89
105
  * Parse the request query string into structured filters, sort, pagination, and search.
90
106
  * Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.mts","names":[],"sources":["../../src/http/context.ts"],"mappings":";;;;;;;;;AAgCA;;;;;AAA+B;;;;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lC,QAAA,CAAS,MAAA,EAAQ,MAAA,EAAQ,QAAA,UAAkB,WAAA,YAAwC,QAAA,MAAA,MAAA;EApB3E;;;;;;;;;;;;;EAuCR,MAAA,CAAO,QAAA,UAAkB,IAAA,GAAM,MAAA;EAvB/B;;;;;;;;;;;;;;;;;;;;;;;;EAmDM,QAAA,oBAA4B,gBAAA,yBAAA,CAChC,OAAA,GAAU,MAAA,EAAQ,gBAAA,CAAiB,OAAA,MAAa,OAAA;IAAU,IAAA,EAAM,CAAA;IAAK,KAAA;EAAA,IACrE,WAAA,GAAc,OAAA,GAAO,OAAA,CAAA,QAAA,MAAA,MAAA;EAAP;;;;;;;;;;;;;;;;;AAmGlB;EAzDE,GAAA,CAAA;IAyDa,0EAxCO,KAAA,WAAgB,EAAA,oBAwCM;qCAE1C;uCAFwD;;;;;;;;;;;;;;;;;;;;;AAIzD;;KAJW,GAAA,gBAAmB,UAAA,GAAa,UAAA,IAAc,cAAA,CACxD,MAAA;EAAiB,IAAA;AAAA,IAAkB,CAAA,QACnC,MAAA;EAAiB,MAAA;AAAA,IAAoB,CAAA,QACrC,MAAA;EAAiB,KAAA;AAAA,IAAmB,CAAA;;;;;;;;;;;QAa9B,MAAA;EAAA,UAEI,UAAA;AAAA"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { i as parseQuery } from "../query-BTaH2fIN.mjs";
11
+ import { i as parseQuery } from "../query-o6_fDG4v.mjs";
12
12
  //#region src/http/context.ts
13
13
  /**
14
14
  * Unified request/response abstraction passed to every controller method.
@@ -72,6 +72,27 @@ var RequestContext = class {
72
72
  return this.metadata.get("user") ?? this.req.user;
73
73
  }
74
74
  /**
75
+ * Tenant identifier for multi-tenant apps. Reads `user.tenantId` —
76
+ * populated either by `AuthAdapter.testMode({ tenantId })`, a tenant
77
+ * resolver middleware, or manually on the strategy's `mapPayload`.
78
+ *
79
+ * Augment `AuthUser` (or `ContextMeta['user']`) to widen the return
80
+ * type if your user shape guarantees a non-`string | undefined` id.
81
+ */
82
+ get tenantId() {
83
+ return this.user?.tenantId;
84
+ }
85
+ /**
86
+ * Effective role list for the current user. Prefers `user.tenantRoles`
87
+ * (populated by `AuthAdapterOptions.roleResolver` under a tenant) and
88
+ * falls back to `user.roles`. Returns an empty array when the user is
89
+ * absent or the shape has neither field.
90
+ */
91
+ get roles() {
92
+ const u = this.user;
93
+ return u?.tenantRoles ?? u?.roles ?? [];
94
+ }
95
+ /**
75
96
  * Parse the request query string into structured filters, sort, pagination, and search.
76
97
  * Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).
77
98
  *
@@ -1 +1 @@
1
- {"version":3,"file":"context.mjs","names":[],"sources":["../../src/http/context.ts"],"sourcesContent":["import type { Request, Response, NextFunction } from 'express'\nimport {\n parseQuery,\n type QueryFieldConfig,\n type PaginatedResponse,\n type TypedParsedQuery,\n} from './query'\n\n/**\n * Augmentable per-request metadata registry.\n *\n * Extend this interface via module augmentation to get type-safe\n * `ctx.get()` / `ctx.set()` across your app. Unknown keys still\n * work with an explicit generic: `ctx.get<MyType>('custom')`.\n *\n * @example\n * ```ts\n * // src/types.ts\n * declare module '@forinda/kickjs' {\n * interface ContextMeta {\n * user: { id: string; email: string; roles: string[] }\n * tenant: { id: string; name: string }\n * requestStartedAt: number\n * }\n * }\n *\n * // controller — fully typed, no generics needed\n * ctx.get('user') // { id: string; email: string; roles: string[] } | undefined\n * ctx.set('tenant', info) // type-checked value\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ContextMeta {}\n\n/** Resolve a ContextMeta value type, falling back to `Fallback` for unknown keys. */\ntype MetaValue<K extends string, Fallback = unknown> = K extends keyof ContextMeta\n ? ContextMeta[K]\n : Fallback\n\n/**\n * The shape of a single route entry in `KickRoutes`. Generated by\n * `kick typegen` and consumed via the `Ctx<T>` helper. Each field is\n * `unknown` by default and is filled in as the typegen learns more\n * about the route (URL params from the path, body/query from validation\n * schemas, etc.).\n */\nexport interface RouteShape {\n params?: unknown\n body?: unknown\n query?: unknown\n response?: unknown\n}\n\n/**\n * Unified request/response abstraction passed to every controller method.\n * Shields handlers from raw Express objects and provides convenience methods.\n */\nexport class RequestContext<TBody = any, TParams = any, TQuery = any> {\n constructor(\n public readonly req: Request,\n public readonly res: Response,\n public readonly next: NextFunction,\n ) {}\n\n /**\n * Per-request metadata map shared across all RequestContext instances\n * for the same request. Stored on `req` so middleware can pass data\n * to handlers via `ctx.set()` / `ctx.get()`.\n */\n private get metadata(): Map<string, any> {\n const r = this.req as any\n if (!r.__ctxMeta) r.__ctxMeta = new Map<string, any>()\n return r.__ctxMeta\n }\n\n // ── Request Data ────────────────────────────────────────────────────\n\n get body(): TBody {\n return this.req.body as TBody\n }\n\n get params(): TParams {\n return this.req.params as TParams\n }\n\n get query(): TQuery {\n return this.req.query as TQuery\n }\n\n get headers() {\n return this.req.headers\n }\n\n get requestId(): string | undefined {\n return (this.req as any).requestId ?? (this.req.headers['x-request-id'] as string | undefined)\n }\n\n /** Session data (requires session middleware) */\n get session(): any {\n return (this.req as any).session\n }\n\n /**\n * The authenticated user set by AuthAdapter.\n * Reads from the per-request metadata store first (`ctx.set('user', ...)`),\n * then falls back to `req.user` (set directly by AuthAdapter middleware).\n *\n * Extend the `AuthUser` interface via module augmentation in `@forinda/kickjs-auth`\n * to get full typing.\n *\n * @example\n * ```ts\n * @Get('/me')\n * @Authenticated()\n * getProfile(ctx: RequestContext) {\n * const user = ctx.user\n * if (!user) return ctx.notFound()\n * return ctx.json({ user })\n * }\n * ```\n */\n get user(): MetaValue<'user', Record<string, any>> | undefined {\n return this.metadata.get('user') ?? (this.req as any).user\n }\n\n // ── Query String Parsing ───────────────────────────────────────────\n\n /**\n * Parse the request query string into structured filters, sort, pagination, and search.\n * Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).\n *\n * Generic over the field config: when passed an inline literal (or\n * `as const`), `filters[].field` and `sort[].field` are narrowed to\n * the exact whitelisted field names. Pass nothing or a non-literal\n * config and you get the loose `string` fallback.\n *\n * @param fieldConfig - Optional whitelist for filterable, sortable, and searchable fields\n *\n * @example\n * ```ts\n * @Get('/')\n * async list(ctx: RequestContext) {\n * const parsed = ctx.qs({\n * filterable: ['status', 'priority'],\n * sortable: ['createdAt', 'title'],\n * } as const)\n * parsed.filters[0].field // typed as 'status' | 'priority'\n * parsed.sort[0].field // typed as 'createdAt' | 'title'\n * }\n * ```\n */\n qs<TConfig extends QueryFieldConfig | undefined = undefined>(\n fieldConfig?: TConfig,\n ): TypedParsedQuery<TConfig> {\n return parseQuery<TConfig>(this.req.query as Record<string, any>, fieldConfig)\n }\n\n // ── File Uploads ────────────────────────────────────────────────────\n\n /** Single uploaded file (requires @FileUpload({ mode: 'single' })) */\n get file(): any {\n return (this.req as any).file\n }\n\n /** Array of uploaded files (requires @FileUpload({ mode: 'array' })) */\n get files(): any[] | undefined {\n return (this.req as any).files\n }\n\n // ── Metadata Store ──────────────────────────────────────────────────\n\n /**\n * Read a value from the per-request metadata store.\n *\n * When `ContextMeta` has been augmented with a matching key, the return\n * type is inferred automatically. For ad-hoc keys, pass a generic:\n * `ctx.get<MyType>('custom')`.\n */\n get<K extends string>(key: K): MetaValue<K> | undefined {\n return this.metadata.get(key)\n }\n\n /**\n * Write a value to the per-request metadata store.\n *\n * When `ContextMeta` has been augmented with a matching key, the value\n * type is checked at compile time.\n */\n set<K extends string>(key: K, value: MetaValue<K>): void {\n this.metadata.set(key, value)\n }\n\n // ── Response Helpers ────────────────────────────────────────────────\n\n json(data: any, status = 200) {\n return this.res.status(status).json(data)\n }\n\n created(data: any) {\n return this.res.status(201).json(data)\n }\n\n noContent() {\n return this.res.status(204).end()\n }\n\n notFound(message = 'Not Found') {\n return this.res.status(404).json({ message })\n }\n\n badRequest(message: string) {\n return this.res.status(400).json({ message })\n }\n\n html(content: string, status = 200) {\n return this.res.status(status).type('html').send(content)\n }\n\n download(buffer: Buffer, filename: string, contentType = 'application/octet-stream') {\n this.res.setHeader('Content-Disposition', `attachment; filename=\"${filename}\"`)\n this.res.setHeader('Content-Type', contentType)\n return this.res.send(buffer)\n }\n\n /**\n * Render a template using the registered view engine (EJS, Pug, Handlebars, etc.).\n * Requires a ViewAdapter to be configured in bootstrap().\n *\n * @param template - Template name (without extension, relative to viewsDir)\n * @param data - Data to pass to the template\n *\n * @example\n * ```ts\n * ctx.render('dashboard', { user, title: 'Dashboard' })\n * ctx.render('emails/welcome', { name: 'Alice' })\n * ```\n */\n render(template: string, data: Record<string, any> = {}) {\n return this.res.render(template, data)\n }\n\n /**\n * Parse query params and return a standardized paginated response.\n * Calls `ctx.qs()` internally, then wraps your data with pagination meta.\n *\n * @param fetcher - Async function that receives ParsedQuery and returns `{ data, total }`\n * @param fieldConfig - Optional whitelist for filterable, sortable, searchable fields\n *\n * @example\n * ```ts\n * @Get('/')\n * async list(ctx: RequestContext) {\n * return ctx.paginate(\n * async (parsed) => {\n * const data = await db.select().from(users)\n * .where(query.where).limit(parsed.pagination.limit)\n * .offset(parsed.pagination.offset).all()\n * const total = await db.select({ count: count() }).from(users).get()\n * return { data, total: total?.count ?? 0 }\n * },\n * { filterable: ['name', 'role'], sortable: ['createdAt'] },\n * )\n * }\n * ```\n */\n async paginate<T, TConfig extends QueryFieldConfig | undefined = undefined>(\n fetcher: (parsed: TypedParsedQuery<TConfig>) => Promise<{ data: T[]; total: number }>,\n fieldConfig?: TConfig,\n ) {\n const parsed = this.qs<TConfig>(fieldConfig)\n const { data, total } = await fetcher(parsed)\n const { page, limit } = parsed.pagination\n const totalPages = Math.ceil(total / limit) || 1\n\n const response: PaginatedResponse<T> = {\n data,\n meta: {\n page,\n limit,\n total,\n totalPages,\n hasNext: page < totalPages,\n hasPrev: page > 1,\n },\n }\n\n return this.json(response)\n }\n\n // ── Server-Sent Events ──────────────────────────────────────────────\n\n /**\n * Start an SSE (Server-Sent Events) stream.\n * Sets the correct headers and returns helpers to send events.\n *\n * @example\n * ```ts\n * @Get('/events')\n * async stream(ctx: RequestContext) {\n * const sse = ctx.sse()\n *\n * const interval = setInterval(() => {\n * sse.send({ time: new Date().toISOString() }, 'tick')\n * }, 1000)\n *\n * sse.onClose(() => clearInterval(interval))\n * }\n * ```\n */\n sse() {\n this.res.writeHead(200, {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n 'X-Accel-Buffering': 'no',\n })\n this.res.flushHeaders()\n\n const closeCallbacks: Array<() => void> = []\n\n this.req.on('close', () => {\n for (const cb of closeCallbacks) cb()\n })\n\n return {\n /** Send an SSE event with optional event name and id */\n send: (data: any, event?: string, id?: string) => {\n if (id) this.res.write(`id: ${id}\\n`)\n if (event) this.res.write(`event: ${event}\\n`)\n this.res.write(`data: ${JSON.stringify(data)}\\n\\n`)\n },\n /** Send a comment (keeps connection alive) */\n comment: (text: string) => {\n this.res.write(`: ${text}\\n\\n`)\n },\n /** Register a callback when the client disconnects */\n onClose: (fn: () => void) => {\n closeCallbacks.push(fn)\n },\n /** End the SSE stream */\n close: () => {\n this.res.end()\n },\n }\n }\n}\n\n/**\n * Short alias for `RequestContext` parameterised by a route shape.\n *\n * Use with `kick typegen`'s generated `KickRoutes` namespace for\n * fully-typed `ctx.params`, `ctx.body`, and `ctx.query`. Metadata\n * typing (`ctx.get()`, `ctx.set()`, `ctx.user`) comes from\n * `ContextMeta` augmentation and works on all `RequestContext` instances.\n *\n * @example\n * ```ts\n * @Get('/:id')\n * getUser(ctx: Ctx<KickRoutes.UserController['getUser']>) {\n * ctx.params.id // typed from RouteShape\n * ctx.body // typed from RouteShape\n * ctx.user // typed from ContextMeta\n * ctx.get('tenant') // typed from ContextMeta\n * }\n * ```\n */\nexport type Ctx<TRoute extends RouteShape = RouteShape> = RequestContext<\n TRoute extends { body: infer B } ? B : any,\n TRoute extends { params: infer P } ? P : any,\n TRoute extends { query: infer Q } ? Q : any\n>\n\n/**\n * Global ambient registry of typed routes, populated by `kick typegen`.\n *\n * Each interface inside `KickRoutes` corresponds to a controller class;\n * each property is one route method on that controller. The values\n * conform to `RouteShape`.\n *\n * Empty by default — declarations come from `.kickjs/types/routes.d.ts`\n * generated alongside the rest of the typegen output.\n */\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace KickRoutes {}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyDA,IAAa,iBAAb,MAAsE;CACpE,YACE,KACA,KACA,MACA;AAHgB,OAAA,MAAA;AACA,OAAA,MAAA;AACA,OAAA,OAAA;;;;;;;CAQlB,IAAY,WAA6B;EACvC,MAAM,IAAI,KAAK;AACf,MAAI,CAAC,EAAE,UAAW,GAAE,4BAAY,IAAI,KAAkB;AACtD,SAAO,EAAE;;CAKX,IAAI,OAAc;AAChB,SAAO,KAAK,IAAI;;CAGlB,IAAI,SAAkB;AACpB,SAAO,KAAK,IAAI;;CAGlB,IAAI,QAAgB;AAClB,SAAO,KAAK,IAAI;;CAGlB,IAAI,UAAU;AACZ,SAAO,KAAK,IAAI;;CAGlB,IAAI,YAAgC;AAClC,SAAQ,KAAK,IAAY,aAAc,KAAK,IAAI,QAAQ;;;CAI1D,IAAI,UAAe;AACjB,SAAQ,KAAK,IAAY;;;;;;;;;;;;;;;;;;;;;CAsB3B,IAAI,OAA2D;AAC7D,SAAO,KAAK,SAAS,IAAI,OAAO,IAAK,KAAK,IAAY;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BxD,GACE,aAC2B;AAC3B,SAAO,WAAoB,KAAK,IAAI,OAA8B,YAAY;;;CAMhF,IAAI,OAAY;AACd,SAAQ,KAAK,IAAY;;;CAI3B,IAAI,QAA2B;AAC7B,SAAQ,KAAK,IAAY;;;;;;;;;CAY3B,IAAsB,KAAkC;AACtD,SAAO,KAAK,SAAS,IAAI,IAAI;;;;;;;;CAS/B,I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;CAuB5B,MAAM;AACJ,OAAK,IAAI,UAAU,KAAK;GACtB,gBAAgB;GAChB,iBAAiB;GACjB,YAAY;GACZ,qBAAqB;GACtB,CAAC;AACF,OAAK,IAAI,cAAc;EAEvB,MAAM,iBAAoC,EAAE;AAE5C,OAAK,IAAI,GAAG,eAAe;AACzB,QAAK,MAAM,MAAM,eAAgB,KAAI;IACrC;AAEF,SAAO;GAEL,OAAO,MAAW,OAAgB,OAAgB;AAChD,QAAI,GAAI,MAAK,IAAI,MAAM,OAAO,GAAG,IAAI;AACrC,QAAI,MAAO,MAAK,IAAI,MAAM,UAAU,MAAM,IAAI;AAC9C,SAAK,IAAI,MAAM,SAAS,KAAK,UAAU,KAAK,CAAC,MAAM;;GAGrD,UAAU,SAAiB;AACzB,SAAK,IAAI,MAAM,KAAK,KAAK,MAAM;;GAGjC,UAAU,OAAmB;AAC3B,mBAAe,KAAK,GAAG;;GAGzB,aAAa;AACX,SAAK,IAAI,KAAK;;GAEjB"}
1
+ {"version":3,"file":"context.mjs","names":[],"sources":["../../src/http/context.ts"],"sourcesContent":["import type { Request, Response, NextFunction } from 'express'\nimport {\n parseQuery,\n type QueryFieldConfig,\n type PaginatedResponse,\n type TypedParsedQuery,\n} from './query'\n\n/**\n * Augmentable per-request metadata registry.\n *\n * Extend this interface via module augmentation to get type-safe\n * `ctx.get()` / `ctx.set()` across your app. Unknown keys still\n * work with an explicit generic: `ctx.get<MyType>('custom')`.\n *\n * @example\n * ```ts\n * // src/types.ts\n * declare module '@forinda/kickjs' {\n * interface ContextMeta {\n * user: { id: string; email: string; roles: string[] }\n * tenant: { id: string; name: string }\n * requestStartedAt: number\n * }\n * }\n *\n * // controller — fully typed, no generics needed\n * ctx.get('user') // { id: string; email: string; roles: string[] } | undefined\n * ctx.set('tenant', info) // type-checked value\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ContextMeta {}\n\n/** Resolve a ContextMeta value type, falling back to `Fallback` for unknown keys. */\ntype MetaValue<K extends string, Fallback = unknown> = K extends keyof ContextMeta\n ? ContextMeta[K]\n : Fallback\n\n/**\n * The shape of a single route entry in `KickRoutes`. Generated by\n * `kick typegen` and consumed via the `Ctx<T>` helper. Each field is\n * `unknown` by default and is filled in as the typegen learns more\n * about the route (URL params from the path, body/query from validation\n * schemas, etc.).\n */\nexport interface RouteShape {\n params?: unknown\n body?: unknown\n query?: unknown\n response?: unknown\n}\n\n/**\n * Unified request/response abstraction passed to every controller method.\n * Shields handlers from raw Express objects and provides convenience methods.\n */\nexport class RequestContext<TBody = any, TParams = any, TQuery = any> {\n constructor(\n public readonly req: Request,\n public readonly res: Response,\n public readonly next: NextFunction,\n ) {}\n\n /**\n * Per-request metadata map shared across all RequestContext instances\n * for the same request. Stored on `req` so middleware can pass data\n * to handlers via `ctx.set()` / `ctx.get()`.\n */\n private get metadata(): Map<string, any> {\n const r = this.req as any\n if (!r.__ctxMeta) r.__ctxMeta = new Map<string, any>()\n return r.__ctxMeta\n }\n\n // ── Request Data ────────────────────────────────────────────────────\n\n get body(): TBody {\n return this.req.body as TBody\n }\n\n get params(): TParams {\n return this.req.params as TParams\n }\n\n get query(): TQuery {\n return this.req.query as TQuery\n }\n\n get headers() {\n return this.req.headers\n }\n\n get requestId(): string | undefined {\n return (this.req as any).requestId ?? (this.req.headers['x-request-id'] as string | undefined)\n }\n\n /** Session data (requires session middleware) */\n get session(): any {\n return (this.req as any).session\n }\n\n /**\n * The authenticated user set by AuthAdapter.\n * Reads from the per-request metadata store first (`ctx.set('user', ...)`),\n * then falls back to `req.user` (set directly by AuthAdapter middleware).\n *\n * Extend the `AuthUser` interface via module augmentation in `@forinda/kickjs-auth`\n * to get full typing.\n *\n * @example\n * ```ts\n * @Get('/me')\n * @Authenticated()\n * getProfile(ctx: RequestContext) {\n * const user = ctx.user\n * if (!user) return ctx.notFound()\n * return ctx.json({ user })\n * }\n * ```\n */\n get user(): MetaValue<'user', Record<string, any>> | undefined {\n return this.metadata.get('user') ?? (this.req as any).user\n }\n\n /**\n * Tenant identifier for multi-tenant apps. Reads `user.tenantId` —\n * populated either by `AuthAdapter.testMode({ tenantId })`, a tenant\n * resolver middleware, or manually on the strategy's `mapPayload`.\n *\n * Augment `AuthUser` (or `ContextMeta['user']`) to widen the return\n * type if your user shape guarantees a non-`string | undefined` id.\n */\n get tenantId(): string | undefined {\n const u = this.user as Record<string, any> | undefined\n return u?.tenantId\n }\n\n /**\n * Effective role list for the current user. Prefers `user.tenantRoles`\n * (populated by `AuthAdapterOptions.roleResolver` under a tenant) and\n * falls back to `user.roles`. Returns an empty array when the user is\n * absent or the shape has neither field.\n */\n get roles(): string[] {\n const u = this.user as Record<string, any> | undefined\n return u?.tenantRoles ?? u?.roles ?? []\n }\n\n // ── Query String Parsing ───────────────────────────────────────────\n\n /**\n * Parse the request query string into structured filters, sort, pagination, and search.\n * Pass the result to an ORM query builder adapter (Drizzle, Prisma, Sequelize, etc.).\n *\n * Generic over the field config: when passed an inline literal (or\n * `as const`), `filters[].field` and `sort[].field` are narrowed to\n * the exact whitelisted field names. Pass nothing or a non-literal\n * config and you get the loose `string` fallback.\n *\n * @param fieldConfig - Optional whitelist for filterable, sortable, and searchable fields\n *\n * @example\n * ```ts\n * @Get('/')\n * async list(ctx: RequestContext) {\n * const parsed = ctx.qs({\n * filterable: ['status', 'priority'],\n * sortable: ['createdAt', 'title'],\n * } as const)\n * parsed.filters[0].field // typed as 'status' | 'priority'\n * parsed.sort[0].field // typed as 'createdAt' | 'title'\n * }\n * ```\n */\n qs<TConfig extends QueryFieldConfig | undefined = undefined>(\n fieldConfig?: TConfig,\n ): TypedParsedQuery<TConfig> {\n return parseQuery<TConfig>(this.req.query as Record<string, any>, fieldConfig)\n }\n\n // ── File Uploads ────────────────────────────────────────────────────\n\n /** Single uploaded file (requires @FileUpload({ mode: 'single' })) */\n get file(): any {\n return (this.req as any).file\n }\n\n /** Array of uploaded files (requires @FileUpload({ mode: 'array' })) */\n get files(): any[] | undefined {\n return (this.req as any).files\n }\n\n // ── Metadata Store ──────────────────────────────────────────────────\n\n /**\n * Read a value from the per-request metadata store.\n *\n * When `ContextMeta` has been augmented with a matching key, the return\n * type is inferred automatically. For ad-hoc keys, pass a generic:\n * `ctx.get<MyType>('custom')`.\n */\n get<K extends string>(key: K): MetaValue<K> | undefined {\n return this.metadata.get(key)\n }\n\n /**\n * Write a value to the per-request metadata store.\n *\n * When `ContextMeta` has been augmented with a matching key, the value\n * type is checked at compile time.\n */\n set<K extends string>(key: K, value: MetaValue<K>): void {\n this.metadata.set(key, value)\n }\n\n // ── Response Helpers ────────────────────────────────────────────────\n\n json(data: any, status = 200) {\n return this.res.status(status).json(data)\n }\n\n created(data: any) {\n return this.res.status(201).json(data)\n }\n\n noContent() {\n return this.res.status(204).end()\n }\n\n notFound(message = 'Not Found') {\n return this.res.status(404).json({ message })\n }\n\n badRequest(message: string) {\n return this.res.status(400).json({ message })\n }\n\n html(content: string, status = 200) {\n return this.res.status(status).type('html').send(content)\n }\n\n download(buffer: Buffer, filename: string, contentType = 'application/octet-stream') {\n this.res.setHeader('Content-Disposition', `attachment; filename=\"${filename}\"`)\n this.res.setHeader('Content-Type', contentType)\n return this.res.send(buffer)\n }\n\n /**\n * Render a template using the registered view engine (EJS, Pug, Handlebars, etc.).\n * Requires a ViewAdapter to be configured in bootstrap().\n *\n * @param template - Template name (without extension, relative to viewsDir)\n * @param data - Data to pass to the template\n *\n * @example\n * ```ts\n * ctx.render('dashboard', { user, title: 'Dashboard' })\n * ctx.render('emails/welcome', { name: 'Alice' })\n * ```\n */\n render(template: string, data: Record<string, any> = {}) {\n return this.res.render(template, data)\n }\n\n /**\n * Parse query params and return a standardized paginated response.\n * Calls `ctx.qs()` internally, then wraps your data with pagination meta.\n *\n * @param fetcher - Async function that receives ParsedQuery and returns `{ data, total }`\n * @param fieldConfig - Optional whitelist for filterable, sortable, searchable fields\n *\n * @example\n * ```ts\n * @Get('/')\n * async list(ctx: RequestContext) {\n * return ctx.paginate(\n * async (parsed) => {\n * const data = await db.select().from(users)\n * .where(query.where).limit(parsed.pagination.limit)\n * .offset(parsed.pagination.offset).all()\n * const total = await db.select({ count: count() }).from(users).get()\n * return { data, total: total?.count ?? 0 }\n * },\n * { filterable: ['name', 'role'], sortable: ['createdAt'] },\n * )\n * }\n * ```\n */\n async paginate<T, TConfig extends QueryFieldConfig | undefined = undefined>(\n fetcher: (parsed: TypedParsedQuery<TConfig>) => Promise<{ data: T[]; total: number }>,\n fieldConfig?: TConfig,\n ) {\n const parsed = this.qs<TConfig>(fieldConfig)\n const { data, total } = await fetcher(parsed)\n const { page, limit } = parsed.pagination\n const totalPages = Math.ceil(total / limit) || 1\n\n const response: PaginatedResponse<T> = {\n data,\n meta: {\n page,\n limit,\n total,\n totalPages,\n hasNext: page < totalPages,\n hasPrev: page > 1,\n },\n }\n\n return this.json(response)\n }\n\n // ── Server-Sent Events ──────────────────────────────────────────────\n\n /**\n * Start an SSE (Server-Sent Events) stream.\n * Sets the correct headers and returns helpers to send events.\n *\n * @example\n * ```ts\n * @Get('/events')\n * async stream(ctx: RequestContext) {\n * const sse = ctx.sse()\n *\n * const interval = setInterval(() => {\n * sse.send({ time: new Date().toISOString() }, 'tick')\n * }, 1000)\n *\n * sse.onClose(() => clearInterval(interval))\n * }\n * ```\n */\n sse() {\n this.res.writeHead(200, {\n 'Content-Type': 'text/event-stream',\n 'Cache-Control': 'no-cache',\n Connection: 'keep-alive',\n 'X-Accel-Buffering': 'no',\n })\n this.res.flushHeaders()\n\n const closeCallbacks: Array<() => void> = []\n\n this.req.on('close', () => {\n for (const cb of closeCallbacks) cb()\n })\n\n return {\n /** Send an SSE event with optional event name and id */\n send: (data: any, event?: string, id?: string) => {\n if (id) this.res.write(`id: ${id}\\n`)\n if (event) this.res.write(`event: ${event}\\n`)\n this.res.write(`data: ${JSON.stringify(data)}\\n\\n`)\n },\n /** Send a comment (keeps connection alive) */\n comment: (text: string) => {\n this.res.write(`: ${text}\\n\\n`)\n },\n /** Register a callback when the client disconnects */\n onClose: (fn: () => void) => {\n closeCallbacks.push(fn)\n },\n /** End the SSE stream */\n close: () => {\n this.res.end()\n },\n }\n }\n}\n\n/**\n * Short alias for `RequestContext` parameterised by a route shape.\n *\n * Use with `kick typegen`'s generated `KickRoutes` namespace for\n * fully-typed `ctx.params`, `ctx.body`, and `ctx.query`. Metadata\n * typing (`ctx.get()`, `ctx.set()`, `ctx.user`) comes from\n * `ContextMeta` augmentation and works on all `RequestContext` instances.\n *\n * @example\n * ```ts\n * @Get('/:id')\n * getUser(ctx: Ctx<KickRoutes.UserController['getUser']>) {\n * ctx.params.id // typed from RouteShape\n * ctx.body // typed from RouteShape\n * ctx.user // typed from ContextMeta\n * ctx.get('tenant') // typed from ContextMeta\n * }\n * ```\n */\nexport type Ctx<TRoute extends RouteShape = RouteShape> = RequestContext<\n TRoute extends { body: infer B } ? B : any,\n TRoute extends { params: infer P } ? P : any,\n TRoute extends { query: infer Q } ? Q : any\n>\n\n/**\n * Global ambient registry of typed routes, populated by `kick typegen`.\n *\n * Each interface inside `KickRoutes` corresponds to a controller class;\n * each property is one route method on that controller. The values\n * conform to `RouteShape`.\n *\n * Empty by default — declarations come from `.kickjs/types/routes.d.ts`\n * generated alongside the rest of the typegen output.\n */\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace KickRoutes {}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyDA,IAAa,iBAAb,MAAsE;CACpE,YACE,KACA,KACA,MACA;AAHgB,OAAA,MAAA;AACA,OAAA,MAAA;AACA,OAAA,OAAA;;;;;;;CAQlB,IAAY,WAA6B;EACvC,MAAM,IAAI,KAAK;AACf,MAAI,CAAC,EAAE,UAAW,GAAE,4BAAY,IAAI,KAAkB;AACtD,SAAO,EAAE;;CAKX,IAAI,OAAc;AAChB,SAAO,KAAK,IAAI;;CAGlB,IAAI,SAAkB;AACpB,SAAO,KAAK,IAAI;;CAGlB,IAAI,QAAgB;AAClB,SAAO,KAAK,IAAI;;C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AAe,KAAK,GAAG;;GAGzB,aAAa;AACX,SAAK,IAAI,KAAK;;GAEjB"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import { createLogger } from "../../core/logger.mjs";
12
12
  import { HttpException } from "../../core/errors.mjs";
13
- import "../../core-Bi6XNE_C.mjs";
13
+ import "../../core-NDLlQziD.mjs";
14
14
  //#region src/http/middleware/error-handler.ts
15
15
  const log = createLogger("ErrorHandler");
16
16
  /** Catch-all for unmatched routes */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,7 +9,7 @@
9
9
  * @license MIT
10
10
  */
11
11
  import { createLogger } from "../../core/logger.mjs";
12
- import "../../core-Bi6XNE_C.mjs";
12
+ import "../../core-NDLlQziD.mjs";
13
13
  //#region src/http/middleware/request-logger.ts
14
14
  /**
15
15
  * Middleware that logs every request with method, URL, status, duration, and request ID.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as __require } from "../../chunk-C9ew9lwC.mjs";
11
+ import { t as __require } from "../../chunk-BfOl01nR.mjs";
12
12
  import { Logger } from "../../core/logger.mjs";
13
- import "../../core-Bi6XNE_C.mjs";
13
+ import "../../core-NDLlQziD.mjs";
14
14
  import { join, resolve } from "node:path";
15
15
  import { existsSync, readFileSync } from "node:fs";
16
16
  //#region src/http/middleware/spa.ts
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,7 +9,7 @@
9
9
  * @license MIT
10
10
  */
11
11
  import { HttpException, HttpStatus } from "../../core/errors.mjs";
12
- import "../../core-Bi6XNE_C.mjs";
12
+ import "../../core-NDLlQziD.mjs";
13
13
  //#region src/http/middleware/validate.ts
14
14
  function toValidationException(error, message, useFirstIssueMessage) {
15
15
  const issues = error.issues || [];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,7 +9,7 @@
9
9
  * @license MIT
10
10
  */
11
11
  import { Logger } from "../../core/logger.mjs";
12
- import "../../core-Bi6XNE_C.mjs";
12
+ import "../../core-NDLlQziD.mjs";
13
13
  import { resolve } from "node:path";
14
14
  //#region src/http/middleware/views.ts
15
15
  const log = Logger.for("ViewEngine");
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
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 parseSearchQuery, i as parseQuery, n as parseFilters, o as parseSort, r as parsePagination, s as FILTER_OPERATORS, t as buildQueryParams } from "../../query-BTaH2fIN.mjs";
11
+ 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-o6_fDG4v.mjs";
12
12
  export { FILTER_OPERATORS, buildQueryParams, parseFilters, parsePagination, parseQuery, parseSearchQuery, parseSort };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs v3.1.0
2
+ * @forinda/kickjs v3.1.2
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -9,9 +9,9 @@
9
9
  * @license MIT
10
10
  */
11
11
  import { METADATA } from "../core/interfaces.mjs";
12
- import { a as getMethodMeta, o as getMethodMetaOrUndefined, t as getClassMeta } from "../metadata-BcaUHcSD.mjs";
13
- import { t as Container } from "../container-DILIivpO.mjs";
14
- import "../core-Bi6XNE_C.mjs";
12
+ import { a as getMethodMeta, o as getMethodMetaOrUndefined, t as getClassMeta } from "../metadata-Dp3Ozdr5.mjs";
13
+ import { t as Container } from "../container-BQ-X3dXH.mjs";
14
+ import "../core-NDLlQziD.mjs";
15
15
  import { RequestContext } from "./context.mjs";
16
16
  import { validate } from "./middleware/validate.mjs";
17
17
  import { buildUploadMiddleware } from "./middleware/upload.mjs";