stratal 0.0.25 → 0.0.26

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 (134) hide show
  1. package/dist/bin/quarry.mjs +60 -4
  2. package/dist/bin/quarry.mjs.map +1 -1
  3. package/dist/cache/index.d.mts +1 -1
  4. package/dist/cache/index.mjs +2 -2
  5. package/dist/{command-4HnKnC-G.d.mts → command-DoBD2Cwl.d.mts} +2 -2
  6. package/dist/{command-4HnKnC-G.d.mts.map → command-DoBD2Cwl.d.mts.map} +1 -1
  7. package/dist/config/index.d.mts +1 -1
  8. package/dist/config/index.mjs +2 -2
  9. package/dist/{controller.decorator-DKeZ71aP.mjs → controller.decorator-YSTPQntu.mjs} +3 -3
  10. package/dist/{controller.decorator-DKeZ71aP.mjs.map → controller.decorator-YSTPQntu.mjs.map} +1 -1
  11. package/dist/cron/index.d.mts +1 -1
  12. package/dist/cron/index.mjs +1 -1
  13. package/dist/{cron.module-DgxLe8Xy.mjs → cron.module-C81HTzR7.mjs} +3 -3
  14. package/dist/{cron.module-DgxLe8Xy.mjs.map → cron.module-C81HTzR7.mjs.map} +1 -1
  15. package/dist/di/index.d.mts +2 -2
  16. package/dist/di/index.mjs +2 -2
  17. package/dist/{di-B0NXIdRF.mjs → di-D7qmrAir.mjs} +44 -3
  18. package/dist/di-D7qmrAir.mjs.map +1 -0
  19. package/dist/email/index.d.mts +2 -2
  20. package/dist/email/index.mjs +3 -3
  21. package/dist/errors/index.d.mts +2 -2
  22. package/dist/errors/index.mjs +3 -3
  23. package/dist/{errors-EUtwVfNm.mjs → errors-C01O2T-n.mjs} +19 -4
  24. package/dist/errors-C01O2T-n.mjs.map +1 -0
  25. package/dist/events/index.mjs +1 -1
  26. package/dist/{events-zbCMY_Gf.mjs → events-BhEQuT1X.mjs} +2 -2
  27. package/dist/{events-zbCMY_Gf.mjs.map → events-BhEQuT1X.mjs.map} +1 -1
  28. package/dist/{exception-context-Bd5Hk2c_.mjs → exception-context-D-kvney-.mjs} +2 -2
  29. package/dist/{exception-context-Bd5Hk2c_.mjs.map → exception-context-D-kvney-.mjs.map} +1 -1
  30. package/dist/{gateway-context-I0tKgGfh.mjs → gateway-context-m7kEzRa2.mjs} +4 -4
  31. package/dist/{gateway-context-I0tKgGfh.mjs.map → gateway-context-m7kEzRa2.mjs.map} +1 -1
  32. package/dist/guards/index.d.mts +1 -1
  33. package/dist/{hono-app-C7-1m9eK.mjs → hono-app-COAgmutc.mjs} +18 -11
  34. package/dist/hono-app-COAgmutc.mjs.map +1 -0
  35. package/dist/{http-method.decorator-xCuGoZPC.mjs → http-method.decorator-BljM8BDj.mjs} +2 -2
  36. package/dist/{http-method.decorator-xCuGoZPC.mjs.map → http-method.decorator-BljM8BDj.mjs.map} +1 -1
  37. package/dist/i18n/index.d.mts +10 -3
  38. package/dist/i18n/index.d.mts.map +1 -1
  39. package/dist/i18n/index.mjs +3 -3
  40. package/dist/{i18n.module-JOPUNpvi.mjs → i18n.module-B2DvWUPa.mjs} +24 -9
  41. package/dist/i18n.module-B2DvWUPa.mjs.map +1 -0
  42. package/dist/{index-BPJSBHhq.d.mts → index-CNuFQSNj.d.mts} +6 -4
  43. package/dist/{index-BPJSBHhq.d.mts.map → index-CNuFQSNj.d.mts.map} +1 -1
  44. package/dist/{index-C_t8VVQD.d.mts → index-uybm0bhQ.d.mts} +100 -6
  45. package/dist/index-uybm0bhQ.d.mts.map +1 -0
  46. package/dist/index.d.mts +3 -3
  47. package/dist/index.mjs +2 -2
  48. package/dist/{lazy-module-loader-DZQxOgRZ.d.mts → lazy-module-loader-M6YKudNL.d.mts} +2 -2
  49. package/dist/{lazy-module-loader-DZQxOgRZ.d.mts.map → lazy-module-loader-M6YKudNL.d.mts.map} +1 -1
  50. package/dist/{locale-path.service-DzA01Kvc.mjs → locale-path.service-CH0CaxwH.mjs} +3 -3
  51. package/dist/{locale-path.service-DzA01Kvc.mjs.map → locale-path.service-CH0CaxwH.mjs.map} +1 -1
  52. package/dist/{locale-url.service-DwTXZid3.mjs → locale-url.service-6bgia24_.mjs} +2 -2
  53. package/dist/{locale-url.service-DwTXZid3.mjs.map → locale-url.service-6bgia24_.mjs.map} +1 -1
  54. package/dist/logger/index.mjs +1 -1
  55. package/dist/module/index.d.mts +2 -2
  56. package/dist/module/index.mjs +2 -2
  57. package/dist/{module-registry-MfWmniZ7.mjs → module-registry-NxX5O0Qk.mjs} +4 -4
  58. package/dist/{module-registry-MfWmniZ7.mjs.map → module-registry-NxX5O0Qk.mjs.map} +1 -1
  59. package/dist/openapi/index.d.mts +2 -2
  60. package/dist/openapi/index.mjs +1 -1
  61. package/dist/{openapi-BKDwQKh-.mjs → openapi-CMwuCp31.mjs} +3 -3
  62. package/dist/{openapi-BKDwQKh-.mjs.map → openapi-CMwuCp31.mjs.map} +1 -1
  63. package/dist/{openapi.service-CM40bnBB.d.mts → openapi.service-2rvJBCEg.d.mts} +2 -2
  64. package/dist/{openapi.service-CM40bnBB.d.mts.map → openapi.service-2rvJBCEg.d.mts.map} +1 -1
  65. package/dist/quarry/index.d.mts +3 -3
  66. package/dist/quarry/index.mjs +1 -1
  67. package/dist/quarry/runner.d.mts +6 -6
  68. package/dist/quarry/runner.mjs +5 -5
  69. package/dist/{quarry-registry-CsStq0DB.d.mts → quarry-registry-DRnV-DDa.d.mts} +3 -3
  70. package/dist/{quarry-registry-CsStq0DB.d.mts.map → quarry-registry-DRnV-DDa.d.mts.map} +1 -1
  71. package/dist/{quarry.module-BOgcNJMU.mjs → quarry.module-CcGxU2dJ.mjs} +3 -3
  72. package/dist/{quarry.module-BOgcNJMU.mjs.map → quarry.module-CcGxU2dJ.mjs.map} +1 -1
  73. package/dist/queue/index.d.mts +1 -1
  74. package/dist/queue/index.mjs +2 -2
  75. package/dist/{queue.module-DSAH88gZ.mjs → queue.module-CEs4_kEM.mjs} +15 -8
  76. package/dist/{queue.module-DSAH88gZ.mjs.map → queue.module-CEs4_kEM.mjs.map} +1 -1
  77. package/dist/{r2-storage.provider-BJ4j23W6.mjs → r2-storage.provider-BoZmR6Ut.mjs} +2 -2
  78. package/dist/{r2-storage.provider-BJ4j23W6.mjs.map → r2-storage.provider-BoZmR6Ut.mjs.map} +1 -1
  79. package/dist/{rate-limit.decorator-B35jBEVD.mjs → rate-limit.decorator-Djs4oYDB.mjs} +2 -2
  80. package/dist/{rate-limit.decorator-B35jBEVD.mjs.map → rate-limit.decorator-Djs4oYDB.mjs.map} +1 -1
  81. package/dist/rate-limiter/index.d.mts +54 -47
  82. package/dist/rate-limiter/index.d.mts.map +1 -1
  83. package/dist/rate-limiter/index.mjs +16 -7
  84. package/dist/rate-limiter/index.mjs.map +1 -1
  85. package/dist/{route-registration.service-HN8WgIis.mjs → route-registration.service-CDPQKpm4.mjs} +9 -9
  86. package/dist/{route-registration.service-HN8WgIis.mjs.map → route-registration.service-CDPQKpm4.mjs.map} +1 -1
  87. package/dist/{route-registry-CtW26Suv.mjs → route-registry-BvLJisvK.mjs} +3 -3
  88. package/dist/{route-registry-CtW26Suv.mjs.map → route-registry-BvLJisvK.mjs.map} +1 -1
  89. package/dist/router/index.d.mts +2 -2
  90. package/dist/router/index.mjs +16 -16
  91. package/dist/{router-OCnf4VB6.mjs → router-DwyqEXgf.mjs} +13 -13
  92. package/dist/{router-OCnf4VB6.mjs.map → router-DwyqEXgf.mjs.map} +1 -1
  93. package/dist/{router-resolver-CMNuw-s0.mjs → router-resolver-sUV_jTrU.mjs} +2 -2
  94. package/dist/{router-resolver-CMNuw-s0.mjs.map → router-resolver-sUV_jTrU.mjs.map} +1 -1
  95. package/dist/seeder/index.d.mts +2 -2
  96. package/dist/seeder/index.mjs +3 -3
  97. package/dist/{seeder-DI-rUoZx.mjs → seeder-BPGY5rUb.mjs} +4 -4
  98. package/dist/{seeder-DI-rUoZx.mjs.map → seeder-BPGY5rUb.mjs.map} +1 -1
  99. package/dist/{seeder-registry-B5FwBeCU.mjs → seeder-registry-DEvCycsT.mjs} +3 -3
  100. package/dist/{seeder-registry-B5FwBeCU.mjs.map → seeder-registry-DEvCycsT.mjs.map} +1 -1
  101. package/dist/{seeder.module-DaY0RYoB.mjs → seeder.module-CIwQbdN4.mjs} +2 -2
  102. package/dist/{seeder.module-DaY0RYoB.mjs.map → seeder.module-CIwQbdN4.mjs.map} +1 -1
  103. package/dist/storage/index.d.mts +1 -1
  104. package/dist/storage/index.mjs +2 -2
  105. package/dist/storage/providers/index.mjs +1 -1
  106. package/dist/{storage-BE6-kzaN.mjs → storage-C30X81CS.mjs} +7 -7
  107. package/dist/{storage-BE6-kzaN.mjs.map → storage-C30X81CS.mjs.map} +1 -1
  108. package/dist/{storage.error-Dai3rShJ.mjs → storage.error-BStXPmO4.mjs} +2 -2
  109. package/dist/{storage.error-Dai3rShJ.mjs.map → storage.error-BStXPmO4.mjs.map} +1 -1
  110. package/dist/{stratal-DtAj21uF.mjs → stratal-BL6FKUM_.mjs} +84 -35
  111. package/dist/stratal-BL6FKUM_.mjs.map +1 -0
  112. package/dist/{stratal-Bmc6WT3k.d.mts → stratal-D5j_I14G.d.mts} +13 -3
  113. package/dist/stratal-D5j_I14G.d.mts.map +1 -0
  114. package/dist/trailing-slash-2SctvePW.mjs +80 -0
  115. package/dist/trailing-slash-2SctvePW.mjs.map +1 -0
  116. package/dist/{uri-h6ITRpqr.mjs → uri-iwofWJ_T.mjs} +12 -10
  117. package/dist/uri-iwofWJ_T.mjs.map +1 -0
  118. package/dist/{versioning.service-B4rtmgMQ.mjs → versioning.service-CCa2oYMJ.mjs} +3 -3
  119. package/dist/{versioning.service-B4rtmgMQ.mjs.map → versioning.service-CCa2oYMJ.mjs.map} +1 -1
  120. package/dist/websocket/index.d.mts +1 -1
  121. package/dist/websocket/index.mjs +1 -1
  122. package/dist/workers/index.d.mts +1 -1
  123. package/dist/workers/index.mjs +2 -2
  124. package/package.json +1 -1
  125. package/dist/di-B0NXIdRF.mjs.map +0 -1
  126. package/dist/errors-EUtwVfNm.mjs.map +0 -1
  127. package/dist/hono-app-C7-1m9eK.mjs.map +0 -1
  128. package/dist/i18n.module-JOPUNpvi.mjs.map +0 -1
  129. package/dist/index-C_t8VVQD.d.mts.map +0 -1
  130. package/dist/stratal-Bmc6WT3k.d.mts.map +0 -1
  131. package/dist/stratal-DtAj21uF.mjs.map +0 -1
  132. package/dist/trailing-slash-CFyw8nYu.mjs +0 -34
  133. package/dist/trailing-slash-CFyw8nYu.mjs.map +0 -1
  134. package/dist/uri-h6ITRpqr.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"locale-path.service-DzA01Kvc.mjs","names":[],"sources":["../src/i18n/i18n.options.ts","../src/router/services/locale-path.service.ts"],"sourcesContent":["/**\n * I18n Module Options\n *\n * Configuration options for the I18n dynamic module.\n * Use with I18nModule.forRoot() to configure locale settings.\n * Use I18nModule.registerMessages() to add translations.\n */\n\nimport type { DetectorOptions } from 'hono/language';\n\n/**\n * Detection strategy for locale resolution\n *\n * - `'cookie'` — reads from the `locale` cookie (default)\n * - `'header'` — reads from the `Accept-Language` header\n * - `'querystring'` — reads from the `?locale=` query parameter\n * - `'path'` — reads from the first URL path segment (e.g., `/en/api/users`)\n */\nexport type DetectionStrategy = 'cookie' | 'header' | 'querystring' | 'path'\n\ninterface BaseDetection {\n /** Set to false to disable language detection entirely. @default true */\n enabled?: boolean\n}\n\n/**\n * Language detection options (discriminated by strategy)\n *\n * @example Cookie detection (default)\n * ```typescript\n * { strategy: 'cookie' }\n * ```\n *\n * @example Header detection\n * ```typescript\n * { strategy: 'header' }\n * ```\n *\n * @example Path detection\n * ```typescript\n * { strategy: 'path' }\n * ```\n *\n * @example Disable detection\n * ```typescript\n * { enabled: false }\n * ```\n */\nexport type LanguageDetectionOptions =\n | (BaseDetection & { strategy?: 'cookie'; cookieOptions?: DetectorOptions['cookieOptions'] })\n | (BaseDetection & { strategy: 'header' })\n | (BaseDetection & { strategy: 'querystring' })\n | (BaseDetection & {\n strategy: 'path'\n /**\n * Controls whether the default locale gets a URL path prefix.\n *\n * - `false` (default) — The default locale has no prefix (`/users`), other locales\n * are prefixed (`/fr/users`). Requests to the prefixed default locale (`/en/users`) return 404.\n * - `'redirect'` — Same as `false`, but requests to the prefixed default locale\n * (`/en/users`) are 301-redirected to the unprefixed path (`/users`).\n * - `true` — All locales are prefixed (`/en/users`, `/fr/users`).\n *\n * @default false\n */\n prefixDefaultLocale?: false | true | 'redirect'\n })\n | { enabled: false }\n\n/**\n * Options for configuring the I18n module\n *\n * @example\n * ```typescript\n * I18nModule.forRoot({\n * defaultLocale: 'en',\n * fallbackLocale: 'en',\n * locales: ['en', 'fr'],\n * detection: { strategy: 'header' },\n * })\n * ```\n */\nexport interface I18nModuleOptions {\n /**\n * Default locale for the application\n * @default 'en'\n */\n defaultLocale?: string\n\n /**\n * Fallback locale when translation is missing\n * @default 'en'\n */\n fallbackLocale?: string\n\n /**\n * List of supported locales\n * Request locales not in this list will fall back to defaultLocale\n */\n locales?: string[]\n\n /**\n * Language detection configuration\n * Controls how the locale is extracted from incoming requests\n */\n detection?: LanguageDetectionOptions\n}\n\n/**\n * Resolved options with all defaults applied\n * Used internally by I18n services\n */\nexport interface ResolvedI18nOptions {\n defaultLocale: string\n fallbackLocale: string\n locales: string[]\n detection: {\n enabled: boolean\n strategy: DetectionStrategy\n /** Resolved value of the path detection `prefixDefaultLocale` option. Only meaningful when `strategy` is `'path'`. */\n prefixDefaultLocale: false | true | 'redirect'\n }\n}\n\n/**\n * Resolve I18n options with defaults\n */\nexport function resolveI18nOptions(options?: I18nModuleOptions): ResolvedI18nOptions {\n const detection = options?.detection\n const enabled = detection ? (detection.enabled !== false) : true\n const strategy: DetectionStrategy = (detection && 'strategy' in detection) ? detection.strategy ?? 'cookie' : 'cookie'\n const prefixDefaultLocale: false | true | 'redirect' =\n (detection && 'prefixDefaultLocale' in detection && detection.prefixDefaultLocale !== undefined)\n ? detection.prefixDefaultLocale\n : false\n\n return {\n defaultLocale: options?.defaultLocale ?? 'en',\n fallbackLocale: options?.fallbackLocale ?? 'en',\n locales: options?.locales ?? ['en'],\n detection: { enabled, strategy, prefixDefaultLocale },\n }\n}\n\n/**\n * Build Hono languageDetector options from I18n module options\n */\nexport function buildDetectorOptions(options?: I18nModuleOptions): Partial<DetectorOptions> {\n const resolved = resolveI18nOptions(options)\n const strategy = resolved.detection.strategy\n\n const detectorOptions: Partial<DetectorOptions> = {\n order: [strategy],\n fallbackLanguage: resolved.defaultLocale,\n supportedLanguages: resolved.locales,\n lookupCookie: 'locale',\n lookupQueryString: 'locale',\n lookupFromPathIndex: 0,\n ignoreCase: true,\n }\n\n if (strategy === 'cookie') {\n detectorOptions.caches = ['cookie']\n if (options?.detection && 'cookieOptions' in options.detection && options.detection.cookieOptions) {\n detectorOptions.cookieOptions = options.detection.cookieOptions\n }\n } else {\n detectorOptions.caches = false\n }\n\n return detectorOptions\n}\n","import type { Context, MiddlewareHandler } from 'hono'\nimport { languageDetector } from 'hono/language'\nimport { inject } from '../../di'\nimport type { Container } from '../../di/container'\nimport { Singleton } from '../../di/decorators'\nimport { CONTAINER_TOKEN } from '../../di/tokens'\nimport { buildDetectorOptions, type I18nModuleOptions } from '../../i18n/i18n.options'\nimport { I18N_TOKENS } from '../../i18n/i18n.tokens'\nimport { ROUTER_CONTEXT_KEYS } from '../constants'\nimport type { HonoApp } from '../hono-app'\nimport { ROUTER_TOKENS } from '../router.tokens'\nimport type { LocalePathConfig, RouterEnv } from '../types'\n\n/**\n * A resolved path with locale variant metadata.\n */\nexport interface ResolvedPath {\n /** The fully resolved path (may include /:locale prefix) */\n path: string\n /** Whether this path is a locale-prefixed variant */\n isLocaleVariant: boolean\n}\n\n/**\n * Resolves locale path variants for route paths.\n *\n * Computes `LocalePathConfig` from `I18nModuleOptions` and provides\n * path expansion for locale-prefixed route variants.\n *\n * Also applies language detection and default locale redirect middleware\n * to HonoApp when resolved from the container.\n *\n * Registered as a singleton in the container.\n */\n@Singleton()\nexport class LocalePathService {\n private readonly _config: LocalePathConfig | null\n private readonly _pathDetectionEnabled: boolean\n private readonly _prefixDefaultLocale: false | true | 'redirect'\n\n constructor(\n @inject(CONTAINER_TOKEN) container: Container,\n @inject(ROUTER_TOKENS.HonoApp) private readonly honoApp: HonoApp,\n ) {\n const i18nOptions = container.isRegistered(I18N_TOKENS.Options)\n ? container.resolve<I18nModuleOptions>(I18N_TOKENS.Options)\n : undefined\n\n const detection = i18nOptions?.detection\n const detectionEnabled = detection ? detection.enabled !== false : true\n const strategy = (detection && 'strategy' in detection && detection.strategy) ?? 'cookie'\n\n this._pathDetectionEnabled = detectionEnabled && strategy === 'path'\n this._prefixDefaultLocale = (detection && 'prefixDefaultLocale' in detection && detection.prefixDefaultLocale !== undefined)\n ? detection.prefixDefaultLocale\n : false\n\n if (this._pathDetectionEnabled) {\n const allLocales = i18nOptions?.locales ?? ['en']\n const defaultLocale = i18nOptions?.defaultLocale ?? 'en'\n\n this._config = this._prefixDefaultLocale === true\n ? { allLocales, prefixedLocales: allLocales, defaultLocale: null }\n : { allLocales, prefixedLocales: allLocales.filter(l => l !== defaultLocale), defaultLocale }\n } else {\n this._config = null\n }\n\n // Apply locale middleware to HonoApp\n if (detectionEnabled) {\n this.setupLanguageDetection(i18nOptions)\n }\n if (this._config?.defaultLocale && this._prefixDefaultLocale === 'redirect') {\n this.setupDefaultLocaleRedirect(this._config.defaultLocale)\n }\n }\n\n /** Whether path-based locale detection is enabled */\n get enabled(): boolean {\n return this._pathDetectionEnabled\n }\n\n /** The computed locale path config, or null if path detection is disabled */\n get localePathConfig(): LocalePathConfig | null {\n return this._config\n }\n\n /** The prefixDefaultLocale setting (false, true, or 'redirect') */\n get prefixDefaultLocale(): false | true | 'redirect' {\n return this._prefixDefaultLocale\n }\n\n /**\n * Expand a path into primary + locale-prefixed variants.\n *\n * @param path - The base path to expand\n * @returns Array of resolved paths with locale metadata\n */\n resolve(path: string): ResolvedPath[] {\n if (!this._config) {\n return [{ path, isLocaleVariant: false }]\n }\n\n const constraint = this.buildLocaleConstraint()\n const suffix = path === '/' ? '' : path\n\n // All locales prefixed (prefixDefaultLocale: true)\n if (this._config.defaultLocale === null) {\n return [{ path: `/:locale${constraint}${suffix}`, isLocaleVariant: true }]\n }\n\n // Default locale unprefixed, other locales prefixed\n const result: ResolvedPath[] = [{ path, isLocaleVariant: false }]\n\n // Only add /:locale route when there are non-default locales to match\n // (z.enum requires at least one value)\n if (this._config.prefixedLocales.length > 0) {\n result.push({ path: `/:locale${constraint}${suffix}`, isLocaleVariant: true })\n }\n\n return result\n }\n\n /**\n * Build a Hono regex constraint from prefixed locales.\n * e.g., `{en|de|fr}` — restricts `:locale` to only match known values.\n */\n private buildLocaleConstraint(): string {\n const locales = this._config!.defaultLocale === null\n ? this._config!.allLocales\n : this._config!.prefixedLocales\n return `{${locales.join('|')}}`\n }\n\n /**\n * Apply Hono's languageDetector middleware and bridge the detected language\n * to Stratal's LOCALE context variable.\n */\n private setupLanguageDetection(i18nOptions?: I18nModuleOptions): void {\n const detectorOptions = buildDetectorOptions(i18nOptions)\n\n // Apply Hono's languageDetector\n this.honoApp.use('*', languageDetector(detectorOptions) as MiddlewareHandler<RouterEnv>)\n\n // Bridge: sync Hono's 'language' variable to Stratal's LOCALE context key\n this.honoApp.use('*', async (c: Context<RouterEnv>, next: () => Promise<void>) => {\n const language = c.get('language')\n if (language) {\n c.set(ROUTER_CONTEXT_KEYS.LOCALE, language)\n }\n await next()\n })\n }\n\n /**\n * Redirect requests that include the default locale prefix to the unprefixed path.\n * For example, `/en/users` → 301 redirect to `/users`.\n *\n * Only active when `prefixDefaultLocale` is `'redirect'`.\n */\n private setupDefaultLocaleRedirect(defaultLocale: string): void {\n const prefix = `/${defaultLocale}`\n this.honoApp.use('*', async (c: Context<RouterEnv>, next: () => Promise<void>) => {\n const path = new URL(c.req.url).pathname\n if (path === prefix || path.startsWith(`${prefix}/`)) {\n const stripped = path.slice(prefix.length) || '/'\n return c.redirect(stripped, 301)\n }\n await next()\n })\n }\n}\n"],"mappings":";;;;;;;;;;AA+HA,SAAgB,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iBAAiB,eAAe,CAAiC;EAGvF,KAAK,QAAQ,IAAI,KAAK,OAAO,GAAuB,SAA8B;GAChF,MAAM,WAAW,EAAE,IAAI,UAAU;GACjC,IAAI,UACF,EAAE,IAAI,oBAAoB,QAAQ,QAAQ;GAE5C,MAAM,KAAK;EACb,CAAC;CACH;;;;;;;CAQA,2BAAmC,eAA6B;EAC9D,MAAM,SAAS,IAAI;EACnB,KAAK,QAAQ,IAAI,KAAK,OAAO,GAAuB,SAA8B;GAChF,MAAM,OAAO,IAAI,IAAI,EAAE,IAAI,GAAG,EAAE;GAChC,IAAI,SAAS,UAAU,KAAK,WAAW,GAAG,OAAO,EAAE,GAAG;IACpD,MAAM,WAAW,KAAK,MAAM,OAAO,MAAM,KAAK;IAC9C,OAAO,EAAE,SAAS,UAAU,GAAG;GACjC;GACA,MAAM,KAAK;EACb,CAAC;CACH;AACF;;CAzIC,UAAU;oBAON,OAAO,eAAe,CAAA;oBACtB,OAAO,cAAc,OAAO,CAAA"}
1
+ {"version":3,"file":"locale-path.service-CH0CaxwH.mjs","names":[],"sources":["../src/i18n/i18n.options.ts","../src/router/services/locale-path.service.ts"],"sourcesContent":["/**\n * I18n Module Options\n *\n * Configuration options for the I18n dynamic module.\n * Use with I18nModule.forRoot() to configure locale settings.\n * Use I18nModule.registerMessages() to add translations.\n */\n\nimport type { DetectorOptions } from 'hono/language';\n\n/**\n * Detection strategy for locale resolution\n *\n * - `'cookie'` — reads from the `locale` cookie (default)\n * - `'header'` — reads from the `Accept-Language` header\n * - `'querystring'` — reads from the `?locale=` query parameter\n * - `'path'` — reads from the first URL path segment (e.g., `/en/api/users`)\n */\nexport type DetectionStrategy = 'cookie' | 'header' | 'querystring' | 'path'\n\ninterface BaseDetection {\n /** Set to false to disable language detection entirely. @default true */\n enabled?: boolean\n}\n\n/**\n * Language detection options (discriminated by strategy)\n *\n * @example Cookie detection (default)\n * ```typescript\n * { strategy: 'cookie' }\n * ```\n *\n * @example Header detection\n * ```typescript\n * { strategy: 'header' }\n * ```\n *\n * @example Path detection\n * ```typescript\n * { strategy: 'path' }\n * ```\n *\n * @example Disable detection\n * ```typescript\n * { enabled: false }\n * ```\n */\nexport type LanguageDetectionOptions =\n | (BaseDetection & { strategy?: 'cookie'; cookieOptions?: DetectorOptions['cookieOptions'] })\n | (BaseDetection & { strategy: 'header' })\n | (BaseDetection & { strategy: 'querystring' })\n | (BaseDetection & {\n strategy: 'path'\n /**\n * Controls whether the default locale gets a URL path prefix.\n *\n * - `false` (default) — The default locale has no prefix (`/users`), other locales\n * are prefixed (`/fr/users`). Requests to the prefixed default locale (`/en/users`) return 404.\n * - `'redirect'` — Same as `false`, but requests to the prefixed default locale\n * (`/en/users`) are 301-redirected to the unprefixed path (`/users`).\n * - `true` — All locales are prefixed (`/en/users`, `/fr/users`).\n *\n * @default false\n */\n prefixDefaultLocale?: false | true | 'redirect'\n })\n | { enabled: false }\n\n/**\n * Options for configuring the I18n module\n *\n * @example\n * ```typescript\n * I18nModule.forRoot({\n * defaultLocale: 'en',\n * fallbackLocale: 'en',\n * locales: ['en', 'fr'],\n * detection: { strategy: 'header' },\n * })\n * ```\n */\nexport interface I18nModuleOptions {\n /**\n * Default locale for the application\n * @default 'en'\n */\n defaultLocale?: string\n\n /**\n * Fallback locale when translation is missing\n * @default 'en'\n */\n fallbackLocale?: string\n\n /**\n * List of supported locales\n * Request locales not in this list will fall back to defaultLocale\n */\n locales?: string[]\n\n /**\n * Language detection configuration\n * Controls how the locale is extracted from incoming requests\n */\n detection?: LanguageDetectionOptions\n}\n\n/**\n * Resolved options with all defaults applied\n * Used internally by I18n services\n */\nexport interface ResolvedI18nOptions {\n defaultLocale: string\n fallbackLocale: string\n locales: string[]\n detection: {\n enabled: boolean\n strategy: DetectionStrategy\n /** Resolved value of the path detection `prefixDefaultLocale` option. Only meaningful when `strategy` is `'path'`. */\n prefixDefaultLocale: false | true | 'redirect'\n }\n}\n\n/**\n * Resolve I18n options with defaults\n */\nexport function resolveI18nOptions(options?: I18nModuleOptions): ResolvedI18nOptions {\n const detection = options?.detection\n const enabled = detection ? (detection.enabled !== false) : true\n const strategy: DetectionStrategy = (detection && 'strategy' in detection) ? detection.strategy ?? 'cookie' : 'cookie'\n const prefixDefaultLocale: false | true | 'redirect' =\n (detection && 'prefixDefaultLocale' in detection && detection.prefixDefaultLocale !== undefined)\n ? detection.prefixDefaultLocale\n : false\n\n return {\n defaultLocale: options?.defaultLocale ?? 'en',\n fallbackLocale: options?.fallbackLocale ?? 'en',\n locales: options?.locales ?? ['en'],\n detection: { enabled, strategy, prefixDefaultLocale },\n }\n}\n\n/**\n * Build Hono languageDetector options from I18n module options\n */\nexport function buildDetectorOptions(options?: I18nModuleOptions): Partial<DetectorOptions> {\n const resolved = resolveI18nOptions(options)\n const strategy = resolved.detection.strategy\n\n const detectorOptions: Partial<DetectorOptions> = {\n order: [strategy],\n fallbackLanguage: resolved.defaultLocale,\n supportedLanguages: resolved.locales,\n lookupCookie: 'locale',\n lookupQueryString: 'locale',\n lookupFromPathIndex: 0,\n ignoreCase: true,\n }\n\n if (strategy === 'cookie') {\n detectorOptions.caches = ['cookie']\n if (options?.detection && 'cookieOptions' in options.detection && options.detection.cookieOptions) {\n detectorOptions.cookieOptions = options.detection.cookieOptions\n }\n } else {\n detectorOptions.caches = false\n }\n\n return detectorOptions\n}\n","import type { Context, MiddlewareHandler } from 'hono'\nimport { languageDetector } from 'hono/language'\nimport { inject } from '../../di'\nimport type { Container } from '../../di/container'\nimport { Singleton } from '../../di/decorators'\nimport { CONTAINER_TOKEN } from '../../di/tokens'\nimport { buildDetectorOptions, type I18nModuleOptions } from '../../i18n/i18n.options'\nimport { I18N_TOKENS } from '../../i18n/i18n.tokens'\nimport { ROUTER_CONTEXT_KEYS } from '../constants'\nimport type { HonoApp } from '../hono-app'\nimport { ROUTER_TOKENS } from '../router.tokens'\nimport type { LocalePathConfig, RouterEnv } from '../types'\n\n/**\n * A resolved path with locale variant metadata.\n */\nexport interface ResolvedPath {\n /** The fully resolved path (may include /:locale prefix) */\n path: string\n /** Whether this path is a locale-prefixed variant */\n isLocaleVariant: boolean\n}\n\n/**\n * Resolves locale path variants for route paths.\n *\n * Computes `LocalePathConfig` from `I18nModuleOptions` and provides\n * path expansion for locale-prefixed route variants.\n *\n * Also applies language detection and default locale redirect middleware\n * to HonoApp when resolved from the container.\n *\n * Registered as a singleton in the container.\n */\n@Singleton()\nexport class LocalePathService {\n private readonly _config: LocalePathConfig | null\n private readonly _pathDetectionEnabled: boolean\n private readonly _prefixDefaultLocale: false | true | 'redirect'\n\n constructor(\n @inject(CONTAINER_TOKEN) container: Container,\n @inject(ROUTER_TOKENS.HonoApp) private readonly honoApp: HonoApp,\n ) {\n const i18nOptions = container.isRegistered(I18N_TOKENS.Options)\n ? container.resolve<I18nModuleOptions>(I18N_TOKENS.Options)\n : undefined\n\n const detection = i18nOptions?.detection\n const detectionEnabled = detection ? detection.enabled !== false : true\n const strategy = (detection && 'strategy' in detection && detection.strategy) ?? 'cookie'\n\n this._pathDetectionEnabled = detectionEnabled && strategy === 'path'\n this._prefixDefaultLocale = (detection && 'prefixDefaultLocale' in detection && detection.prefixDefaultLocale !== undefined)\n ? detection.prefixDefaultLocale\n : false\n\n if (this._pathDetectionEnabled) {\n const allLocales = i18nOptions?.locales ?? ['en']\n const defaultLocale = i18nOptions?.defaultLocale ?? 'en'\n\n this._config = this._prefixDefaultLocale === true\n ? { allLocales, prefixedLocales: allLocales, defaultLocale: null }\n : { allLocales, prefixedLocales: allLocales.filter(l => l !== defaultLocale), defaultLocale }\n } else {\n this._config = null\n }\n\n // Apply locale middleware to HonoApp\n if (detectionEnabled) {\n this.setupLanguageDetection(i18nOptions)\n }\n if (this._config?.defaultLocale && this._prefixDefaultLocale === 'redirect') {\n this.setupDefaultLocaleRedirect(this._config.defaultLocale)\n }\n }\n\n /** Whether path-based locale detection is enabled */\n get enabled(): boolean {\n return this._pathDetectionEnabled\n }\n\n /** The computed locale path config, or null if path detection is disabled */\n get localePathConfig(): LocalePathConfig | null {\n return this._config\n }\n\n /** The prefixDefaultLocale setting (false, true, or 'redirect') */\n get prefixDefaultLocale(): false | true | 'redirect' {\n return this._prefixDefaultLocale\n }\n\n /**\n * Expand a path into primary + locale-prefixed variants.\n *\n * @param path - The base path to expand\n * @returns Array of resolved paths with locale metadata\n */\n resolve(path: string): ResolvedPath[] {\n if (!this._config) {\n return [{ path, isLocaleVariant: false }]\n }\n\n const constraint = this.buildLocaleConstraint()\n const suffix = path === '/' ? '' : path\n\n // All locales prefixed (prefixDefaultLocale: true)\n if (this._config.defaultLocale === null) {\n return [{ path: `/:locale${constraint}${suffix}`, isLocaleVariant: true }]\n }\n\n // Default locale unprefixed, other locales prefixed\n const result: ResolvedPath[] = [{ path, isLocaleVariant: false }]\n\n // Only add /:locale route when there are non-default locales to match\n // (z.enum requires at least one value)\n if (this._config.prefixedLocales.length > 0) {\n result.push({ path: `/:locale${constraint}${suffix}`, isLocaleVariant: true })\n }\n\n return result\n }\n\n /**\n * Build a Hono regex constraint from prefixed locales.\n * e.g., `{en|de|fr}` — restricts `:locale` to only match known values.\n */\n private buildLocaleConstraint(): string {\n const locales = this._config!.defaultLocale === null\n ? this._config!.allLocales\n : this._config!.prefixedLocales\n return `{${locales.join('|')}}`\n }\n\n /**\n * Apply Hono's languageDetector middleware and bridge the detected language\n * to Stratal's LOCALE context variable.\n */\n private setupLanguageDetection(i18nOptions?: I18nModuleOptions): void {\n const detectorOptions = buildDetectorOptions(i18nOptions)\n\n // Apply Hono's languageDetector\n this.honoApp.use('*', languageDetector(detectorOptions) as MiddlewareHandler<RouterEnv>)\n\n // Bridge: sync Hono's 'language' variable to Stratal's LOCALE context key\n this.honoApp.use('*', async (c: Context<RouterEnv>, next: () => Promise<void>) => {\n const language = c.get('language')\n if (language) {\n c.set(ROUTER_CONTEXT_KEYS.LOCALE, language)\n }\n await next()\n })\n }\n\n /**\n * Redirect requests that include the default locale prefix to the unprefixed path.\n * For example, `/en/users` → 301 redirect to `/users`.\n *\n * Only active when `prefixDefaultLocale` is `'redirect'`.\n */\n private setupDefaultLocaleRedirect(defaultLocale: string): void {\n const prefix = `/${defaultLocale}`\n this.honoApp.use('*', async (c: Context<RouterEnv>, next: () => Promise<void>) => {\n const path = new URL(c.req.url).pathname\n if (path === prefix || path.startsWith(`${prefix}/`)) {\n const stripped = path.slice(prefix.length) || '/'\n return c.redirect(stripped, 301)\n }\n await next()\n })\n }\n}\n"],"mappings":";;;;;;;;;;AA+HA,SAAgB,mBAAmB,SAAkD;CACnF,MAAM,YAAY,SAAS;CAC3B,MAAM,UAAU,YAAa,UAAU,YAAY,QAAS;CAC5D,MAAM,WAA+B,aAAa,cAAc,YAAa,UAAU,YAAY,WAAW;CAC9G,MAAM,sBACH,aAAa,yBAAyB,aAAa,UAAU,wBAAwB,KAAA,IAClF,UAAU,sBACV;CAEN,OAAO;EACL,eAAe,SAAS,iBAAiB;EACzC,gBAAgB,SAAS,kBAAkB;EAC3C,SAAS,SAAS,WAAW,CAAC,IAAI;EAClC,WAAW;GAAE;GAAS;GAAU;EAAoB;CACtD;AACF;;;;AAKA,SAAgB,qBAAqB,SAAuD;CAC1F,MAAM,WAAW,mBAAmB,OAAO;CAC3C,MAAM,WAAW,SAAS,UAAU;CAEpC,MAAM,kBAA4C;EAChD,OAAO,CAAC,QAAQ;EAChB,kBAAkB,SAAS;EAC3B,oBAAoB,SAAS;EAC7B,cAAc;EACd,mBAAmB;EACnB,qBAAqB;EACrB,YAAY;CACd;CAEA,IAAI,aAAa,UAAU;EACzB,gBAAgB,SAAS,CAAC,QAAQ;EAClC,IAAI,SAAS,aAAa,mBAAmB,QAAQ,aAAa,QAAQ,UAAU,eAClF,gBAAgB,gBAAgB,QAAQ,UAAU;CAEtD,OACE,gBAAgB,SAAS;CAG3B,OAAO;AACT;;;;ACxIO,IAAA,oBAAA,MAAM,kBAAkB;CAOqB;CANlD;CACA;CACA;CAEA,YACE,WACA,SACA;EADgD,KAAA,UAAA;EAEhD,MAAM,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S,GACxC,OAAO,KAAK;GAAE,MAAM,WAAW,aAAa;GAAU,iBAAiB;EAAK,CAAC;EAG/E,OAAO;CACT;;;;;CAMA,wBAAwC;EAItC,OAAO,KAHS,KAAK,QAAS,kBAAkB,OAC5C,KAAK,QAAS,aACd,KAAK,QAAS,iBACC,KAAK,GAAG,EAAE;CAC/B;;;;;CAMA,uBAA+B,aAAuC;EACpE,MAAM,kBAAkB,qBAAqB,WAAW;EAGxD,KAAK,QAAQ,IAAI,KAAK,iBAAiB,eAAe,CAAiC;EAGvF,KAAK,QAAQ,IAAI,KAAK,OAAO,GAAuB,SAA8B;GAChF,MAAM,WAAW,EAAE,IAAI,UAAU;GACjC,IAAI,UACF,EAAE,IAAI,oBAAoB,QAAQ,QAAQ;GAE5C,MAAM,KAAK;EACb,CAAC;CACH;;;;;;;CAQA,2BAAmC,eAA6B;EAC9D,MAAM,SAAS,IAAI;EACnB,KAAK,QAAQ,IAAI,KAAK,OAAO,GAAuB,SAA8B;GAChF,MAAM,OAAO,IAAI,IAAI,EAAE,IAAI,GAAG,EAAE;GAChC,IAAI,SAAS,UAAU,KAAK,WAAW,GAAG,OAAO,EAAE,GAAG;IACpD,MAAM,WAAW,KAAK,MAAM,OAAO,MAAM,KAAK;IAC9C,OAAO,EAAE,SAAS,UAAU,GAAG;GACjC;GACA,MAAM,KAAK;EACb,CAAC;CACH;AACF;;CAzIC,UAAU;oBAON,OAAO,eAAe,CAAA;oBACtB,OAAO,cAAc,OAAO,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./chunk-BBjsoOtd.mjs";
2
- import { d as inject, s as Singleton, v as ROUTER_TOKENS } from "./di-B0NXIdRF.mjs";
2
+ import { b as ROUTER_TOKENS, l as Singleton, p as inject } from "./di-D7qmrAir.mjs";
3
3
  import { n as __decorateParam, t as __decorate } from "./decorate-CuAoSZvs.mjs";
4
4
  import { n as shouldPrefixLocale, r as stripLocalePrefix, t as applyLocalePrefix } from "./locale-url-nZrZxqJP.mjs";
5
5
  //#region src/router/services/locale-url.service.ts
@@ -38,4 +38,4 @@ LocaleUrlService = __decorate([Singleton(), __decorateParam(0, inject(ROUTER_TOK
38
38
  //#endregion
39
39
  export { locale_url_service_exports as n, LocaleUrlService as t };
40
40
 
41
- //# sourceMappingURL=locale-url.service-DwTXZid3.mjs.map
41
+ //# sourceMappingURL=locale-url.service-6bgia24_.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"locale-url.service-DwTXZid3.mjs","names":[],"sources":["../src/router/services/locale-url.service.ts"],"sourcesContent":["import { inject } from '../../di'\nimport { Singleton } from '../../di/decorators'\nimport { applyLocalePrefix, shouldPrefixLocale, stripLocalePrefix } from '../locale-url'\nimport { ROUTER_TOKENS } from '../router.tokens'\nimport type { LocaleUrlConfig } from '../types'\nimport { type LocalePathService } from './locale-path.service'\n\n/**\n * DI-friendly wrapper around the pure locale-url helpers.\n *\n * Binds {@link LocalePathService} config so consumers can call `applyPrefix`,\n * `stripPrefix`, and `shouldPrefix` without passing config every time.\n *\n * Useful for canonical URL generation, sitemap builders, redirect middleware,\n * hreflang link emission, and anywhere else a request handler needs to compute\n * locale-aware path variants.\n */\n@Singleton()\nexport class LocaleUrlService {\n constructor(\n @inject(ROUTER_TOKENS.LocalePathService) private readonly localePath: LocalePathService,\n ) { }\n\n /** Whether path-based locale detection is enabled — i.e., locales have URL-distinct path variants. */\n get pathEnabled(): boolean {\n return this.localePath.enabled\n }\n\n /** Whether the given locale should get a URL prefix under the current config. */\n shouldPrefix(locale: string): boolean {\n return shouldPrefixLocale(locale, this.toUrlConfig())\n }\n\n /** Prepend `/{locale}` to a pathname, respecting `prefixDefaultLocale`. */\n applyPrefix(pathname: string, locale: string): string {\n return applyLocalePrefix(pathname, locale, this.toUrlConfig())\n }\n\n /** Strip a known-locale prefix from the start of a pathname. */\n stripPrefix(pathname: string): string {\n const known = this.localePath.localePathConfig?.allLocales ?? []\n return stripLocalePrefix(pathname, known)\n }\n\n private toUrlConfig(): LocaleUrlConfig | undefined {\n const config = this.localePath.localePathConfig\n if (!config) return undefined\n return { defaultLocale: config.defaultLocale, prefixDefaultLocale: this.localePath.prefixDefaultLocale }\n }\n}\n"],"mappings":";;;;;;AAkBO,IAAA,mBAAA,MAAM,iBAAiB;CAEgC;CAD5D,YACE,YACA;EAD0D,KAAA,aAAA;CACxD;;CAGJ,IAAI,cAAuB;EACzB,OAAO,KAAK,WAAW;CACzB;;CAGA,aAAa,QAAyB;EACpC,OAAO,mBAAmB,QAAQ,KAAK,YAAY,CAAC;CACtD;;CAGA,YAAY,UAAkB,QAAwB;EACpD,OAAO,kBAAkB,UAAU,QAAQ,KAAK,YAAY,CAAC;CAC/D;;CAGA,YAAY,UAA0B;EAEpC,OAAO,kBAAkB,UADX,KAAK,WAAW,kBAAkB,cAAc,CAAC,CACvB;CAC1C;CAEA,cAAmD;EACjD,MAAM,SAAS,KAAK,WAAW;EAC/B,IAAI,CAAC,QAAQ,OAAO,KAAA;EACpB,OAAO;GAAE,eAAe,OAAO;GAAe,qBAAqB,KAAK,WAAW;EAAoB;CACzG;AACF;+BAhCC,UAAU,GAAA,gBAAA,GAGN,OAAO,cAAc,iBAAiB,CAAA,CAAA,GAAA,gBAAA"}
1
+ {"version":3,"file":"locale-url.service-6bgia24_.mjs","names":[],"sources":["../src/router/services/locale-url.service.ts"],"sourcesContent":["import { inject } from '../../di'\nimport { Singleton } from '../../di/decorators'\nimport { applyLocalePrefix, shouldPrefixLocale, stripLocalePrefix } from '../locale-url'\nimport { ROUTER_TOKENS } from '../router.tokens'\nimport type { LocaleUrlConfig } from '../types'\nimport { type LocalePathService } from './locale-path.service'\n\n/**\n * DI-friendly wrapper around the pure locale-url helpers.\n *\n * Binds {@link LocalePathService} config so consumers can call `applyPrefix`,\n * `stripPrefix`, and `shouldPrefix` without passing config every time.\n *\n * Useful for canonical URL generation, sitemap builders, redirect middleware,\n * hreflang link emission, and anywhere else a request handler needs to compute\n * locale-aware path variants.\n */\n@Singleton()\nexport class LocaleUrlService {\n constructor(\n @inject(ROUTER_TOKENS.LocalePathService) private readonly localePath: LocalePathService,\n ) { }\n\n /** Whether path-based locale detection is enabled — i.e., locales have URL-distinct path variants. */\n get pathEnabled(): boolean {\n return this.localePath.enabled\n }\n\n /** Whether the given locale should get a URL prefix under the current config. */\n shouldPrefix(locale: string): boolean {\n return shouldPrefixLocale(locale, this.toUrlConfig())\n }\n\n /** Prepend `/{locale}` to a pathname, respecting `prefixDefaultLocale`. */\n applyPrefix(pathname: string, locale: string): string {\n return applyLocalePrefix(pathname, locale, this.toUrlConfig())\n }\n\n /** Strip a known-locale prefix from the start of a pathname. */\n stripPrefix(pathname: string): string {\n const known = this.localePath.localePathConfig?.allLocales ?? []\n return stripLocalePrefix(pathname, known)\n }\n\n private toUrlConfig(): LocaleUrlConfig | undefined {\n const config = this.localePath.localePathConfig\n if (!config) return undefined\n return { defaultLocale: config.defaultLocale, prefixDefaultLocale: this.localePath.prefixDefaultLocale }\n }\n}\n"],"mappings":";;;;;;AAkBO,IAAA,mBAAA,MAAM,iBAAiB;CAEgC;CAD5D,YACE,YACA;EAD0D,KAAA,aAAA;CACxD;;CAGJ,IAAI,cAAuB;EACzB,OAAO,KAAK,WAAW;CACzB;;CAGA,aAAa,QAAyB;EACpC,OAAO,mBAAmB,QAAQ,KAAK,YAAY,CAAC;CACtD;;CAGA,YAAY,UAAkB,QAAwB;EACpD,OAAO,kBAAkB,UAAU,QAAQ,KAAK,YAAY,CAAC;CAC/D;;CAGA,YAAY,UAA0B;EAEpC,OAAO,kBAAkB,UADX,KAAK,WAAW,kBAAkB,cAAc,CAAC,CACvB;CAC1C;CAEA,cAAmD;EACjD,MAAM,SAAS,KAAK,WAAW;EAC/B,IAAI,CAAC,QAAQ,OAAO,KAAA;EACpB,OAAO;GAAE,eAAe,OAAO;GAAe,qBAAqB,KAAK,WAAW;EAAoB;CACzG;AACF;+BAhCC,UAAU,GAAA,gBAAA,GAGN,OAAO,cAAc,iBAAiB,CAAA,CAAA,GAAA,gBAAA"}
@@ -1,4 +1,4 @@
1
- import { c as Transient, d as inject } from "../di-B0NXIdRF.mjs";
1
+ import { p as inject, u as Transient } from "../di-D7qmrAir.mjs";
2
2
  import { n as __decorateParam, t as __decorate } from "../decorate-CuAoSZvs.mjs";
3
3
  //#region src/logger/logger.tokens.ts
4
4
  const LOGGER_TOKENS = {
@@ -1,6 +1,6 @@
1
- import { An as ExistingProvider, Dn as AsyncModuleOptions, Dr as ApplicationError, Fn as OnException, Hn as InjectionToken, In as OnInitialize, Ln as OnShutdown, Mn as ModuleClass, Nn as ModuleContext, On as ClassProvider, Pn as ModuleOptions, Rn as Provider, jn as FactoryProvider, kn as DynamicModule, ln as ModuleRegistry, zn as ValueProvider } from "../index-C_t8VVQD.mjs";
1
+ import { Bn as ModuleOptions, Fn as DynamicModule, Gn as ValueProvider, Hn as OnInitialize, In as ExistingProvider, Ir as ApplicationError, Jn as InjectionToken, Ln as FactoryProvider, Nn as AsyncModuleOptions, Pn as ClassProvider, Rn as ModuleClass, Un as OnShutdown, Vn as OnException, Wn as Provider, hn as ModuleRegistry, zn as ModuleContext } from "../index-uybm0bhQ.mjs";
2
2
  import { t as Constructor } from "../types-CmV_9xBD.mjs";
3
- import { n as ModuleRef, t as LazyModuleLoader } from "../lazy-module-loader-DZQxOgRZ.mjs";
3
+ import { n as ModuleRef, t as LazyModuleLoader } from "../lazy-module-loader-M6YKudNL.mjs";
4
4
 
5
5
  //#region src/module/module.error.d.ts
6
6
  declare class ModuleError extends ApplicationError {}
@@ -1,7 +1,7 @@
1
1
  import { a as ApplicationError } from "../container-storage-BmOJ4_Na.mjs";
2
- import "../errors-EUtwVfNm.mjs";
2
+ import "../errors-C01O2T-n.mjs";
3
3
  import { i as isModuleClass, n as Module, r as getModuleOptions, t as MODULE_OPTIONS_KEY } from "../module.decorator-CYHY6pG5.mjs";
4
- import { d as LazyModuleLoader, f as ModuleRef, t as ModuleRegistry } from "../module-registry-MfWmniZ7.mjs";
4
+ import { d as LazyModuleLoader, f as ModuleRef, t as ModuleRegistry } from "../module-registry-NxX5O0Qk.mjs";
5
5
  //#region src/module/module.error.ts
6
6
  var ModuleError = class extends ApplicationError {};
7
7
  //#endregion
@@ -1,9 +1,9 @@
1
- import { c as Transient, d as inject, n as CONTAINER_TOKEN, r as DI_TOKENS } from "./di-B0NXIdRF.mjs";
1
+ import { n as CONTAINER_TOKEN, p as inject, r as DI_TOKENS, u as Transient } from "./di-D7qmrAir.mjs";
2
2
  import { a as ApplicationError } from "./container-storage-BmOJ4_Na.mjs";
3
3
  import { n as __decorateParam, t as __decorate } from "./decorate-CuAoSZvs.mjs";
4
4
  import { LOGGER_TOKENS } from "./logger/index.mjs";
5
- import { u as HttpException } from "./errors-EUtwVfNm.mjs";
6
- import { s as isListener } from "./events-zbCMY_Gf.mjs";
5
+ import { d as HttpException } from "./errors-C01O2T-n.mjs";
6
+ import { s as isListener } from "./events-BhEQuT1X.mjs";
7
7
  import { r as getModuleOptions } from "./module.decorator-CYHY6pG5.mjs";
8
8
  import { t as isCommand } from "./is-command-CEPO9n8c.mjs";
9
9
  import { t as isSeeder } from "./is-seeder-Gvh_AM71.mjs";
@@ -551,4 +551,4 @@ var ModuleRegistry = class {
551
551
  //#endregion
552
552
  export { getGroups as a, RATE_LIMITER_TOKENS as c, LazyModuleLoader as d, ModuleRef as f, getGlobalMiddleware as i, RateLimiterError as l, Router as n, RouterError as o, getDefaultEntry as r, createThrottleMiddleware as s, ModuleRegistry as t, TooManyRequestsError as u };
553
553
 
554
- //# sourceMappingURL=module-registry-MfWmniZ7.mjs.map
554
+ //# sourceMappingURL=module-registry-NxX5O0Qk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-registry-MfWmniZ7.mjs","names":["internal.getDefaultEntry","internal.getGroups","internal.getGlobalMiddleware"],"sources":["../src/module/module-ref.ts","../src/module/lazy-module-loader.ts","../src/rate-limiter/errors.ts","../src/rate-limiter/rate-limiter.tokens.ts","../src/rate-limiter/throttle.middleware.ts","../src/router/router.error.ts","../src/router/router.internals.ts","../src/router/router.ts","../src/module/module-registry.ts"],"sourcesContent":["import type { Container } from '../di/container'\nimport type { InjectionToken } from '../di/types'\nimport type { Constructor } from '../types'\n\n/**\n * Handle to a lazily loaded module, returned by {@link LazyModuleLoader.load}.\n *\n * Resolves providers from the global container, so singletons registered by the\n * lazy module persist across requests.\n *\n * Note: request-scoped providers resolved via {@link ModuleRef.get} degrade to\n * transient instances (there is no ambient request scope here). To obtain a\n * true per-request instance, resolve the token from the request container\n * inside a request scope instead.\n */\nexport class ModuleRef {\n constructor(\n private readonly container: Container,\n /** The module class this ref was loaded from. */\n readonly moduleClass: Constructor,\n ) { }\n\n /** Resolve a provider from the lazily loaded module (global scope). */\n get<T>(token: InjectionToken<T>): T {\n return this.container.resolve(token)\n }\n\n /** Async variant of {@link ModuleRef.get}, matching the NestJS API shape. */\n resolve<T>(token: InjectionToken<T>): Promise<T> {\n return Promise.resolve(this.container.resolve(token))\n }\n}\n","import { inject } from '../di/decorators'\nimport type { Container } from '../di/container'\nimport { DI_TOKENS } from '../di/tokens'\nimport { LOGGER_TOKENS, type LoggerService } from '../logger'\nimport type { Constructor } from '../types'\nimport { ModuleRef } from './module-ref'\nimport type { ModuleRegistry } from './module-registry'\nimport type { DynamicModule, ModuleClass } from './types'\n\n/**\n * Loads modules on demand (NestJS-style), so optional features stay out of the\n * cold-start path until first use.\n *\n * Inject {@link DI_TOKENS.LazyModuleLoader} and call {@link load}:\n *\n * ```ts\n * const ref = await loader.load(() => import('./reports.module').then(m => m.ReportsModule))\n * const reports = ref.get(ReportService)\n * ```\n *\n * The loaded module's nested `imports` and `providers` are registered into the\n * global container and its `onInitialize` hook runs once. Controllers, queue\n * consumers, and cron jobs are skipped — that wiring is finalized at bootstrap.\n * Repeat loads of the same module return the cached {@link ModuleRef} without\n * re-registering.\n */\nexport class LazyModuleLoader {\n private readonly cache = new Map<Constructor, ModuleRef>()\n private readonly inFlight = new Map<Constructor, Promise<ModuleRef>>()\n\n constructor(\n @inject(DI_TOKENS.ModuleRegistry) private readonly registry: ModuleRegistry,\n @inject(DI_TOKENS.Container) private readonly container: Container,\n @inject(LOGGER_TOKENS.LoggerService) private readonly logger: LoggerService,\n ) { }\n\n async load(loaderFn: () => Promise<ModuleClass | DynamicModule>): Promise<ModuleRef> {\n const loaded = await loaderFn()\n const { moduleClass } = this.registry.resolveModule(loaded)\n\n const cached = this.cache.get(moduleClass)\n if (cached) return cached\n\n const inFlight = this.inFlight.get(moduleClass)\n if (inFlight) return inFlight\n\n const promise = this.registerAndBuild(moduleClass, loaded)\n this.inFlight.set(moduleClass, promise)\n try {\n return await promise\n } finally {\n this.inFlight.delete(moduleClass)\n }\n }\n\n private async registerAndBuild(\n moduleClass: Constructor,\n loaded: ModuleClass | DynamicModule,\n ): Promise<ModuleRef> {\n this.logger.debug(`Lazy loading module: ${moduleClass.name}`)\n await this.registry.registerLazy(loaded)\n const ref = new ModuleRef(this.container.getRootContainer(), moduleClass)\n this.cache.set(moduleClass, ref)\n return ref\n }\n}\n","import { ApplicationError, HttpException } from '../errors'\n\n/**\n * Thrown when a request exceeds a configured rate limit.\n *\n * HTTP Status: 429 Too Many Requests\n *\n * The {@link ExceptionHandler} renders the body via content negotiation\n * (HTML for HTML clients, JSON for everything else). Standard rate-limit\n * headers (`Retry-After`, `X-RateLimit-*`) are injected by the\n * `respond()` callback registered via `RateLimiterModule.onException`.\n */\nexport class TooManyRequestsError extends HttpException {\n constructor(\n public readonly info: { retryAfter: number; limit: number; resetAt: number },\n ) {\n super(429, 'Too many requests')\n }\n}\n\nexport class RateLimiterError extends ApplicationError {}\n","export const RATE_LIMITER_TOKENS = {\n Registry: Symbol.for('stratal:rate-limiter:registry'),\n Store: Symbol.for('stratal:rate-limiter:store'),\n StoreFactory: Symbol.for('stratal:rate-limiter:store-factory'),\n Options: Symbol.for('stratal:rate-limiter:options'),\n /**\n * Per-app marker registered by RateLimiterModule.onInitialize. Used by\n * ThrottleMiddleware to detect \"module not imported\".\n */\n ModuleMarker: Symbol.for('stratal:rate-limiter:module-marker'),\n} as const\n\nexport type RateLimiterToken = (typeof RATE_LIMITER_TOKENS)[keyof typeof RATE_LIMITER_TOKENS]\n","import { inject } from '../di'\nimport { CONTAINER_TOKEN, type Container } from '../di'\nimport { Transient } from '../di/decorators'\nimport type { Middleware, Next } from '../router/middleware.interface'\nimport type { RouterContext } from '../router/router-context'\nimport type { Constructor } from '../types'\nimport { RateLimiterError } from './errors'\nimport type { RateLimiterRegistry } from './rate-limiter-registry'\nimport { RATE_LIMITER_TOKENS } from './rate-limiter.tokens'\n\nconst cache = new Map<string, Constructor<Middleware>>()\n\n/**\n * Memoized factory that produces a Stratal `Middleware` class bound to a\n * named limiter. Calling twice with the same name returns the *same* class\n * — important for `Router.middleware` deduplication via class identity.\n *\n * Detection of \"module not imported\" works against a per-app marker\n * registered by `RateLimiterModule.onInitialize`. We check\n * `isRegistered(marker)` at request time before resolving Registry.\n */\nexport function createThrottleMiddleware(name: string): Constructor<Middleware> {\n const existing = cache.get(name)\n if (existing) return existing\n\n @Transient()\n class ThrottleMiddleware implements Middleware {\n constructor(\n @inject(CONTAINER_TOKEN) private readonly container: Container,\n ) {}\n\n handle(ctx: RouterContext, next: Next): Promise<Response | void> {\n if (!this.container.isRegistered(RATE_LIMITER_TOKENS.ModuleMarker)) {\n throw new RateLimiterError(`RateLimiterModule was not imported. Cannot resolve throttle \"${name}\". Import RateLimiterModule.forRoot({ store: ... }) in your AppModule.`)\n }\n const registry = this.container.resolve<RateLimiterRegistry>(RATE_LIMITER_TOKENS.Registry)\n return registry.handle(name, ctx, next)\n }\n }\n\n Object.defineProperty(ThrottleMiddleware, 'name', { value: `Throttle(${name})` })\n cache.set(name, ThrottleMiddleware)\n return ThrottleMiddleware\n}\n\n/**\n * Test-only escape hatch: clear the per-name middleware class cache.\n * Production code never needs this.\n */\nexport function _resetThrottleMiddlewareCache(): void {\n cache.clear()\n}\n","import { ApplicationError } from '../errors'\n\nexport class RouterError extends ApplicationError {}\n","/**\n * Symbol keys for Router internal accessors.\n *\n * These symbols are NOT exported from the public `stratal/router` barrel.\n * Only internal modules (RouterResolver) import them, keeping the Router's\n * public API clean — users never see these methods.\n *\n * Declared as individual unique symbols so TypeScript can distinguish\n * their return types in computed property access.\n *\n * @internal\n */\n\n/** @internal */\nexport const getDefaultEntry: unique symbol = Symbol('Router.getDefaultEntry')\n/** @internal */\nexport const getGroups: unique symbol = Symbol('Router.getGroups')\n/** @internal */\nexport const getGlobalMiddleware: unique symbol = Symbol('Router.getGlobalMiddleware')\n","import type { ZodObject } from '../i18n/validation/zod'\nimport { createThrottleMiddleware } from '../rate-limiter/throttle.middleware'\nimport type { Constructor } from '../types'\nimport { RouterError } from './router.error'\nimport type { Middleware } from './middleware.interface'\nimport * as internal from './router.internals'\n\n/**\n * Configuration for a sub-group created via `router.group()`.\n */\nexport interface RouterGroupConfig {\n prefix?: string\n domain?: string\n name?: string\n middleware?: Constructor<Middleware>[]\n version?: string | string[]\n hideFromDocs?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n params?: ZodObject<any>\n}\n\n/**\n * Internal entry representing a sub-group or the default scope.\n * @internal — used by RouterResolver, not exported publicly.\n */\nexport interface RouterEntry {\n prefix?: string\n domain?: string\n name?: string\n middleware: Constructor<Middleware>[]\n version?: string | string[]\n hideFromDocs?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n params?: ZodObject<any>\n /** Controllers in this entry. undefined = all controllers not in any sub-group */\n controllers?: Constructor[]\n}\n\n/**\n * Modules implement this to configure routes and middleware.\n * Replaces `MiddlewareConfigurable`.\n *\n * @example\n * ```typescript\n * @Module({ controllers: [UsersController, PostsController] })\n * export class ApiModule implements RouteConfigurable {\n * configureRoutes(router: Router): void {\n * router\n * .name('api.')\n * .middleware(CorsMiddleware)\n * .version('1')\n * }\n * }\n * ```\n */\nexport interface RouteConfigurable {\n configureRoutes(router: Router): void\n}\n\n/**\n * Fluent builder for route and middleware configuration.\n *\n * Scoped methods (`middleware()`, `prefix()`, `domain()`, `name()`, `version()`, `hideFromDocs()`)\n * apply only to this module's controllers or the sub-group's controllers.\n *\n * `use()` registers global middleware (all routes in the entire app).\n * Only callable on the root Router — throws inside `group()` callbacks.\n *\n * `group()` creates sub-groups for specific controllers with a callback.\n * Controllers in a sub-group are excluded from the parent scope.\n */\nexport class Router {\n private readonly _isChild: boolean\n private readonly _defaultEntry: RouterEntry = { middleware: [] }\n private readonly _groups: RouterEntry[] = []\n private readonly _globalMiddleware: Constructor<Middleware>[] = []\n\n constructor(isChild = false) {\n this._isChild = isChild\n }\n\n /** Dynamic path prefix. For shared segments like `/:companyId` */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n prefix(path: string, params?: ZodObject<any>): this {\n this._defaultEntry.prefix = path\n this._defaultEntry.params = params\n return this\n }\n\n /** Domain pattern for controllers in this scope */\n domain(pattern: string): this {\n this._defaultEntry.domain = pattern\n return this\n }\n\n /** Name prefix for routes in this scope */\n name(prefix: string): this {\n this._defaultEntry.name = prefix\n return this\n }\n\n /** Middleware applied to controllers in this scope */\n middleware(...middlewares: Constructor<Middleware>[]): this {\n this._defaultEntry.middleware.push(...middlewares)\n return this\n }\n\n /**\n * Apply a named rate limiter to controllers in this scope.\n *\n * The named limiter must be registered via `RateLimiterRegistry.for(name, ...)`\n * (typically inside a module's `onInitialize` hook), and the user must\n * import `RateLimiterModule.forRoot({ store: ... })` in their AppModule.\n *\n * @example\n * ```typescript\n * router.prefix('/uploads').throttle('uploads')\n * router.group([AdminController], (admin) => admin.throttle('admin'))\n * ```\n */\n throttle(name: string): this {\n this._defaultEntry.middleware.push(createThrottleMiddleware(name))\n return this\n }\n\n /** API version for controllers in this scope */\n version(version: string | string[]): this {\n this._defaultEntry.version = version\n return this\n }\n\n /** Hide/show routes in this scope from OpenAPI docs */\n hideFromDocs(hide = true): this {\n this._defaultEntry.hideFromDocs = hide\n return this\n }\n\n /**\n * Global middleware — applied to ALL routes in the entire app.\n * Only callable on the root Router. Throws if called inside `group()`.\n */\n use(...middlewares: Constructor<Middleware>[]): this {\n if (this._isChild) {\n throw new RouterError('router.use() is only allowed on the root Router. It cannot be called inside a group() callback.')\n }\n this._globalMiddleware.push(...middlewares)\n return this\n }\n\n /**\n * Create a sub-group for specific controllers/gateways.\n * Controllers in a sub-group are excluded from the parent (default) scope.\n * The callback receives a new Router (without `use()`) for fluent configuration.\n */\n group(controllers: Constructor[], callback: (router: Omit<Router, 'use'>) => void): this {\n const childRouter = new Router(true)\n callback(childRouter)\n\n this._groups.push({\n ...childRouter._defaultEntry,\n controllers,\n })\n return this\n }\n\n // --- Internal accessors via symbol keys (invisible to consumers) ---\n\n [internal.getDefaultEntry](): RouterEntry {\n return this._defaultEntry\n }\n\n [internal.getGroups](): RouterEntry[] {\n return this._groups\n }\n\n [internal.getGlobalMiddleware](): Constructor<Middleware>[] {\n return this._globalMiddleware\n }\n}\n","import type { Container } from '../di/container'\nimport { isListener } from '../events'\nimport type { LoggerService } from '../logger'\nimport { Router, type RouteConfigurable } from '../router/router'\nimport { isCommand } from '../quarry/is-command'\nimport { isSeeder } from '../seeder/is-seeder'\nimport type { Constructor } from '../types'\nimport { getModuleOptions } from './module.decorator'\nimport type { ExceptionHandler } from '../errors/exception-handler'\nimport type {\n DynamicModule,\n InjectionToken,\n ModuleClass,\n ModuleContext,\n ModuleOptions,\n OnException,\n OnInitialize,\n OnShutdown,\n Provider,\n} from './types'\n\n\ninterface RegisteredModule {\n moduleClass: Constructor\n options: ModuleOptions\n instance: object | null\n hasLifecycle: boolean\n}\n\nexport class ModuleRegistry {\n private modules: RegisteredModule[] = []\n private registeredClasses = new Set<Constructor>()\n private initialized = false\n\n private allControllers: Constructor[] = []\n private allConsumers: Constructor[] = []\n private allJobs: Constructor[] = []\n private allListeners: Constructor[] = []\n private allCommands: Constructor[] = []\n private allSeeders: Constructor[] = []\n private allRouterConfigs: { router: Router; controllers: Constructor[] }[] = []\n\n constructor(\n private readonly container: Container,\n private readonly logger: LoggerService\n ) { }\n\n register(moduleOrDynamic: ModuleClass | DynamicModule): void {\n const { moduleClass, options } = this.resolveModule(moduleOrDynamic)\n\n if (this.handleAlreadyRegistered(moduleClass, moduleOrDynamic)) return\n\n this.registeredClasses.add(moduleClass)\n this.logger.info(`Registering module: ${moduleClass.name}`)\n\n for (const ImportedModule of options.imports ?? []) {\n this.register(ImportedModule)\n }\n\n const registered = this.registerModuleNode(moduleClass, options, { includeHttpWiring: true })\n\n // Eager register() is synchronous and assumes the bootstrap initialize()\n // batch will run lifecycle hooks. If it's called AFTER initialization (e.g. a\n // built-in subsystem registered on first use), that batch has finished and\n // won't revisit this module — so a lifecycle hook would be silently dropped.\n // Surface it instead of failing silently; load such modules via\n // LazyModuleLoader (registerLazy), which runs onInitialize immediately.\n if (this.initialized && registered.hasLifecycle) {\n this.logger.warn(\n `Module ${moduleClass.name} was registered eagerly after initialization; its onInitialize/onShutdown/configureRoutes hooks will not run. Load it via LazyModuleLoader instead.`,\n )\n }\n }\n\n /**\n * Register a module on demand (NestJS-style lazy loading). Registers nested\n * imports recursively and providers, then runs `onInitialize` immediately\n * (the bootstrap-time batch {@link initialize} has already completed).\n *\n * Controllers, queue consumers, and cron jobs are SKIPPED — route, queue, and\n * cron wiring is finalized at bootstrap and cannot be extended at runtime.\n */\n async registerLazy(moduleOrDynamic: ModuleClass | DynamicModule): Promise<void> {\n const { moduleClass, options } = this.resolveModule(moduleOrDynamic)\n\n if (this.handleAlreadyRegistered(moduleClass, moduleOrDynamic)) return\n\n this.registeredClasses.add(moduleClass)\n this.logger.info(`Lazily registering module: ${moduleClass.name}`)\n\n for (const ImportedModule of options.imports ?? []) {\n await this.registerLazy(ImportedModule)\n }\n\n const registered = this.registerModuleNode(moduleClass, options, { includeHttpWiring: false })\n\n if (registered.hasLifecycle) {\n const instance = new registered.moduleClass()\n registered.instance = instance\n if (this.hasOnInitialize(instance)) {\n const context: ModuleContext = { container: this.container, logger: this.logger }\n this.logger.info(`Initializing (lazy): ${registered.moduleClass.name}`)\n await instance.onInitialize(context)\n }\n }\n }\n\n registerAll(modules: (ModuleClass | DynamicModule)[]): void {\n for (const module of modules) {\n this.register(module)\n }\n }\n\n hasRegistered(moduleClass: Constructor): boolean {\n return this.registeredClasses.has(moduleClass)\n }\n\n /**\n * Handle re-registration of an already-known module. For a DynamicModule,\n * its extra providers are wired (without re-running lifecycle); for a plain\n * class it is a no-op. Returns true when the module was already registered.\n */\n private handleAlreadyRegistered(\n moduleClass: Constructor,\n moduleOrDynamic: ModuleClass | DynamicModule,\n ): boolean {\n if (!this.registeredClasses.has(moduleClass)) return false\n\n if (this.isDynamicModule(moduleOrDynamic)) {\n this.logger.debug(`Module ${moduleClass.name} already registered, registering DynamicModule providers`)\n const { module: _, ...dynamicRest } = moduleOrDynamic\n for (const provider of dynamicRest.providers ?? []) {\n this.registerProvider(provider)\n }\n } else {\n this.logger.debug(`Module ${moduleClass.name} already registered, skipping`)\n }\n return true\n }\n\n /**\n * Register a single module's providers (and, for eager registration, its\n * controllers/consumers/jobs), detect lifecycle hooks, and record it.\n * Assumes the module's `imports` have already been registered by the caller.\n */\n private registerModuleNode(\n moduleClass: Constructor,\n options: ModuleOptions,\n { includeHttpWiring }: { includeHttpWiring: boolean },\n ): RegisteredModule {\n for (const provider of options.providers ?? []) {\n this.registerProvider(provider, { lazy: !includeHttpWiring, moduleName: moduleClass.name })\n }\n\n if (includeHttpWiring) {\n for (const controller of options.controllers ?? []) {\n this.container.register(controller)\n this.allControllers.push(controller)\n }\n\n for (const consumer of options.consumers ?? []) {\n this.container.register(consumer)\n this.allConsumers.push(consumer)\n this.logger.info(`Collected consumer: ${consumer.name}`, { queueCount: this.allConsumers.length })\n }\n\n for (const job of options.jobs ?? []) {\n this.container.register(job)\n this.allJobs.push(job)\n }\n } else {\n const skipped: string[] = []\n if (options.controllers?.length) skipped.push('controllers')\n if (options.consumers?.length) skipped.push('consumers')\n if (options.jobs?.length) skipped.push('jobs')\n if ('configureRoutes' in moduleClass.prototype) skipped.push('configureRoutes')\n if ('onException' in moduleClass.prototype) skipped.push('onException')\n if (skipped.length) {\n this.logger.warn(\n `Lazy module ${moduleClass.name} declares ${skipped.join('/')} which are skipped — ` +\n `route, queue, cron, and exception-handler wiring is finalized at bootstrap`,\n )\n }\n }\n\n const hasLifecycle =\n 'onInitialize' in moduleClass.prototype ||\n 'onShutdown' in moduleClass.prototype ||\n 'onException' in moduleClass.prototype ||\n 'configureRoutes' in moduleClass.prototype\n\n const registered: RegisteredModule = { moduleClass, options, instance: null, hasLifecycle }\n this.modules.push(registered)\n return registered\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) return\n\n this.logger.info('Initializing modules...')\n\n const context: ModuleContext = {\n container: this.container,\n logger: this.logger,\n }\n\n // Snapshot: a module's onInitialize may lazily load another module\n // (LazyModuleLoader.load → registerLazy), which pushes to this.modules and\n // initializes it itself. Iterating a snapshot prevents the batch loop from\n // re-visiting (and double-initializing) those lazily-added modules.\n for (const registered of [...this.modules]) {\n if (!registered.hasLifecycle) continue\n\n const instance = new registered.moduleClass()\n registered.instance = instance\n\n if (this.hasOnInitialize(instance)) {\n this.logger.info(`Initializing: ${registered.moduleClass.name}`)\n await instance.onInitialize(context)\n }\n }\n\n this.initialized = true\n this.logger.info('All modules initialized')\n }\n\n getAllControllers(): Constructor[] {\n return this.allControllers\n }\n\n getAllConsumers(): Constructor[] {\n return this.allConsumers\n }\n\n getAllJobs(): Constructor[] {\n return this.allJobs\n }\n\n getAllListeners(): Constructor[] {\n return this.allListeners\n }\n\n getAllCommands(): Constructor[] {\n return this.allCommands\n }\n\n getAllSeeders(): Constructor[] {\n return this.allSeeders\n }\n\n getAllRouterConfigs(): { router: Router; controllers: Constructor[] }[] {\n if (this.allRouterConfigs.length === 0) {\n for (const { moduleClass, options, instance } of this.modules) {\n if (instance && this.hasRouteConfigurable(instance)) {\n this.logger.debug(`Configuring routes for: ${moduleClass.name}`)\n const router = new Router()\n instance.configureRoutes(router)\n const moduleControllers = options.controllers ?? []\n this.allRouterConfigs.push({ router, controllers: moduleControllers })\n }\n }\n }\n return this.allRouterConfigs\n }\n\n configureExceptionHandlers(handler: ExceptionHandler): void {\n for (const { moduleClass, instance } of this.modules) {\n if (instance && this.hasOnException(instance)) {\n this.logger.debug(`Configuring exception handlers for: ${moduleClass.name}`)\n instance.onException(handler)\n }\n }\n }\n\n async shutdown(): Promise<void> {\n this.logger.info('Shutting down modules...')\n\n const context: ModuleContext = {\n container: this.container,\n logger: this.logger,\n }\n\n const reversed = [...this.modules].reverse()\n\n for (const { moduleClass, instance } of reversed) {\n if (instance && this.hasOnShutdown(instance)) {\n try {\n await instance.onShutdown(context)\n } catch (error) {\n this.logger.error(`Error shutting down ${moduleClass.name}:`, error as Error)\n }\n }\n }\n\n this.logger.info('All modules shut down')\n }\n\n private hasRouteConfigurable(instance: unknown): instance is RouteConfigurable {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'configureRoutes' in instance &&\n typeof (instance as RouteConfigurable).configureRoutes === 'function'\n )\n }\n\n private hasOnInitialize(instance: unknown): instance is OnInitialize {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'onInitialize' in instance &&\n typeof (instance as OnInitialize).onInitialize === 'function'\n )\n }\n\n private hasOnShutdown(instance: unknown): instance is OnShutdown {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'onShutdown' in instance &&\n typeof (instance as OnShutdown).onShutdown === 'function'\n )\n }\n\n private hasOnException(instance: unknown): instance is OnException {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'onException' in instance &&\n typeof (instance as OnException).onException === 'function'\n )\n }\n\n resolveModule(moduleOrDynamic: ModuleClass | DynamicModule): {\n moduleClass: Constructor\n options: ModuleOptions\n } {\n if (this.isDynamicModule(moduleOrDynamic)) {\n const { module: moduleClass, ...dynamicRest } = moduleOrDynamic\n\n const decoratorOptions = getModuleOptions(moduleClass) ?? {}\n const mergedOptions: ModuleOptions = {\n ...decoratorOptions,\n ...dynamicRest,\n providers: [...(decoratorOptions.providers ?? []), ...(dynamicRest.providers ?? [])],\n imports: [...(decoratorOptions.imports ?? [])],\n }\n\n return { moduleClass: moduleClass, options: mergedOptions }\n }\n\n const moduleClass = moduleOrDynamic as Constructor\n const options = getModuleOptions(moduleClass) ?? {}\n return { moduleClass, options }\n }\n\n isDynamicModule(value: unknown): value is DynamicModule {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'module' in value &&\n typeof (value as DynamicModule).module === 'function'\n )\n }\n\n private registerProvider(\n provider: Provider,\n { lazy = false, moduleName }: { lazy?: boolean; moduleName?: string } = {},\n ): void {\n if (lazy) {\n const token = this.providerToken(provider)\n // A lazy module registers onto the shared root container. If its token is\n // already bound (by an eagerly-registered or previously-loaded module),\n // overriding would silently clobber that binding — and break any\n // shared-singleton rendezvous. Keep the existing binding and warn.\n if (token !== null && this.container.isRegistered(token)) {\n this.logger.warn(\n `Lazy module ${moduleName ?? '(unknown)'} provides ${this.describeToken(token)}, ` +\n `which is already registered by another module — keeping the existing binding and ignoring the lazy provider.`,\n )\n return\n }\n }\n\n if (typeof provider === 'function') {\n this.container.register(provider as Constructor)\n this.collectIfListener(provider as Constructor)\n this.collectIfCommand(provider as Constructor)\n this.collectIfSeeder(provider as Constructor)\n } else if ('useClass' in provider) {\n this.container.register(provider.provide, provider.useClass as Constructor)\n this.collectIfListener(provider.useClass as Constructor)\n this.collectIfCommand(provider.useClass as Constructor)\n this.collectIfSeeder(provider.useClass as Constructor)\n } else if ('useValue' in provider) {\n this.container.registerValue(provider.provide, provider.useValue)\n } else if ('useFactory' in provider) {\n const { provide, useFactory, inject = [] } = provider\n this.container.registerFactory(provide, (c) => {\n const deps = inject.map((token) => c.resolve(token))\n return useFactory(...deps)\n })\n } else if ('useExisting' in provider) {\n this.container.registerExisting(provider.provide, provider.useExisting)\n }\n }\n\n /** The DI token a provider binds, for collision detection. */\n private providerToken(provider: Provider): InjectionToken | null {\n if (typeof provider === 'function') return provider as Constructor\n if ('provide' in provider) return provider.provide\n return null\n }\n\n private describeToken(token: InjectionToken): string {\n if (typeof token === 'function') return token.name\n if (typeof token === 'symbol') return token.toString()\n if (typeof token === 'string') return token\n return 'lazy token'\n }\n\n private collectIfCommand(providerClass: Constructor): void {\n if (isCommand(providerClass) && !this.allCommands.includes(providerClass)) {\n this.allCommands.push(providerClass)\n this.logger.debug(`Collected command: ${providerClass.name}`)\n }\n }\n\n private collectIfSeeder(providerClass: Constructor): void {\n if (isSeeder(providerClass) && !this.allSeeders.includes(providerClass)) {\n this.allSeeders.push(providerClass)\n this.logger.debug(`Collected seeder: ${providerClass.name}`)\n }\n }\n\n private collectIfListener(providerClass: Constructor): void {\n if (isListener(providerClass)) {\n // Register with the listener's own scope (`@Listener()` applies\n // `@Transient()`) rather than forcing a singleton: listeners are resolved\n // fresh per event from the emitting request scope, so a listener may inject\n // request-scoped providers (i18n, queue senders, auth context, …).\n this.container.register(providerClass)\n this.allListeners.push(providerClass)\n this.logger.debug(`Collected listener: ${providerClass.name}`)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,IAAa,YAAb,MAAuB;CAEF;CAER;CAHX,YACE,WAEA,aACA;EAHiB,KAAA,YAAA;EAER,KAAA,cAAA;CACP;;CAGJ,IAAO,OAA6B;EAClC,OAAO,KAAK,UAAU,QAAQ,KAAK;CACrC;;CAGA,QAAW,OAAsC;EAC/C,OAAO,QAAQ,QAAQ,KAAK,UAAU,QAAQ,KAAK,CAAC;CACtD;AACF;;;ACLO,IAAA,mBAAA,MAAM,iBAAiB;CAKyB;CACL;CACQ;CANxD,wBAAyB,IAAI,IAA4B;CACzD,2BAA4B,IAAI,IAAqC;CAErE,YACE,UACA,WACA,QACA;EAHmD,KAAA,WAAA;EACL,KAAA,YAAA;EACQ,KAAA,SAAA;CACpD;CAEJ,MAAM,KAAK,UAA0E;E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OAA+B;EACnD,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM;EAC9C,IAAI,OAAO,UAAU,UAAU,OAAO,MAAM,SAAS;EACrD,IAAI,OAAO,UAAU,UAAU,OAAO;EACtC,OAAO;CACT;CAEA,iBAAyB,eAAkC;EACzD,IAAI,UAAU,aAAa,KAAK,CAAC,KAAK,YAAY,SAAS,aAAa,GAAG;GACzE,KAAK,YAAY,KAAK,aAAa;GACnC,KAAK,OAAO,MAAM,sBAAsB,cAAc,MAAM;EAC9D;CACF;CAEA,gBAAwB,eAAkC;EACxD,IAAI,SAAS,aAAa,KAAK,CAAC,KAAK,WAAW,SAAS,aAAa,GAAG;GACvE,KAAK,WAAW,KAAK,aAAa;GAClC,KAAK,OAAO,MAAM,qBAAqB,cAAc,MAAM;EAC7D;CACF;CAEA,kBAA0B,eAAkC;EAC1D,IAAI,WAAW,aAAa,GAAG;GAK7B,KAAK,UAAU,SAAS,aAAa;GACrC,KAAK,aAAa,KAAK,aAAa;GACpC,KAAK,OAAO,MAAM,uBAAuB,cAAc,MAAM;EAC/D;CACF;AACF"}
1
+ {"version":3,"file":"module-registry-NxX5O0Qk.mjs","names":["internal.getDefaultEntry","internal.getGroups","internal.getGlobalMiddleware"],"sources":["../src/module/module-ref.ts","../src/module/lazy-module-loader.ts","../src/rate-limiter/errors.ts","../src/rate-limiter/rate-limiter.tokens.ts","../src/rate-limiter/throttle.middleware.ts","../src/router/router.error.ts","../src/router/router.internals.ts","../src/router/router.ts","../src/module/module-registry.ts"],"sourcesContent":["import type { Container } from '../di/container'\nimport type { InjectionToken } from '../di/types'\nimport type { Constructor } from '../types'\n\n/**\n * Handle to a lazily loaded module, returned by {@link LazyModuleLoader.load}.\n *\n * Resolves providers from the global container, so singletons registered by the\n * lazy module persist across requests.\n *\n * Note: request-scoped providers resolved via {@link ModuleRef.get} degrade to\n * transient instances (there is no ambient request scope here). To obtain a\n * true per-request instance, resolve the token from the request container\n * inside a request scope instead.\n */\nexport class ModuleRef {\n constructor(\n private readonly container: Container,\n /** The module class this ref was loaded from. */\n readonly moduleClass: Constructor,\n ) { }\n\n /** Resolve a provider from the lazily loaded module (global scope). */\n get<T>(token: InjectionToken<T>): T {\n return this.container.resolve(token)\n }\n\n /** Async variant of {@link ModuleRef.get}, matching the NestJS API shape. */\n resolve<T>(token: InjectionToken<T>): Promise<T> {\n return Promise.resolve(this.container.resolve(token))\n }\n}\n","import { inject } from '../di/decorators'\nimport type { Container } from '../di/container'\nimport { DI_TOKENS } from '../di/tokens'\nimport { LOGGER_TOKENS, type LoggerService } from '../logger'\nimport type { Constructor } from '../types'\nimport { ModuleRef } from './module-ref'\nimport type { ModuleRegistry } from './module-registry'\nimport type { DynamicModule, ModuleClass } from './types'\n\n/**\n * Loads modules on demand (NestJS-style), so optional features stay out of the\n * cold-start path until first use.\n *\n * Inject {@link DI_TOKENS.LazyModuleLoader} and call {@link load}:\n *\n * ```ts\n * const ref = await loader.load(() => import('./reports.module').then(m => m.ReportsModule))\n * const reports = ref.get(ReportService)\n * ```\n *\n * The loaded module's nested `imports` and `providers` are registered into the\n * global container and its `onInitialize` hook runs once. Controllers, queue\n * consumers, and cron jobs are skipped — that wiring is finalized at bootstrap.\n * Repeat loads of the same module return the cached {@link ModuleRef} without\n * re-registering.\n */\nexport class LazyModuleLoader {\n private readonly cache = new Map<Constructor, ModuleRef>()\n private readonly inFlight = new Map<Constructor, Promise<ModuleRef>>()\n\n constructor(\n @inject(DI_TOKENS.ModuleRegistry) private readonly registry: ModuleRegistry,\n @inject(DI_TOKENS.Container) private readonly container: Container,\n @inject(LOGGER_TOKENS.LoggerService) private readonly logger: LoggerService,\n ) { }\n\n async load(loaderFn: () => Promise<ModuleClass | DynamicModule>): Promise<ModuleRef> {\n const loaded = await loaderFn()\n const { moduleClass } = this.registry.resolveModule(loaded)\n\n const cached = this.cache.get(moduleClass)\n if (cached) return cached\n\n const inFlight = this.inFlight.get(moduleClass)\n if (inFlight) return inFlight\n\n const promise = this.registerAndBuild(moduleClass, loaded)\n this.inFlight.set(moduleClass, promise)\n try {\n return await promise\n } finally {\n this.inFlight.delete(moduleClass)\n }\n }\n\n private async registerAndBuild(\n moduleClass: Constructor,\n loaded: ModuleClass | DynamicModule,\n ): Promise<ModuleRef> {\n this.logger.debug(`Lazy loading module: ${moduleClass.name}`)\n await this.registry.registerLazy(loaded)\n const ref = new ModuleRef(this.container.getRootContainer(), moduleClass)\n this.cache.set(moduleClass, ref)\n return ref\n }\n}\n","import { ApplicationError, HttpException } from '../errors'\n\n/**\n * Thrown when a request exceeds a configured rate limit.\n *\n * HTTP Status: 429 Too Many Requests\n *\n * The {@link ExceptionHandler} renders the body via content negotiation\n * (HTML for HTML clients, JSON for everything else). Standard rate-limit\n * headers (`Retry-After`, `X-RateLimit-*`) are injected by the\n * `respond()` callback registered via `RateLimiterModule.onException`.\n */\nexport class TooManyRequestsError extends HttpException {\n constructor(\n public readonly info: { retryAfter: number; limit: number; resetAt: number },\n ) {\n super(429, 'Too many requests')\n }\n}\n\nexport class RateLimiterError extends ApplicationError {}\n","export const RATE_LIMITER_TOKENS = {\n Registry: Symbol.for('stratal:rate-limiter:registry'),\n Store: Symbol.for('stratal:rate-limiter:store'),\n StoreFactory: Symbol.for('stratal:rate-limiter:store-factory'),\n Options: Symbol.for('stratal:rate-limiter:options'),\n /**\n * Per-app marker registered by RateLimiterModule.onInitialize. Used by\n * ThrottleMiddleware to detect \"module not imported\".\n */\n ModuleMarker: Symbol.for('stratal:rate-limiter:module-marker'),\n} as const\n\nexport type RateLimiterToken = (typeof RATE_LIMITER_TOKENS)[keyof typeof RATE_LIMITER_TOKENS]\n","import { inject } from '../di'\nimport { CONTAINER_TOKEN, type Container } from '../di'\nimport { Transient } from '../di/decorators'\nimport type { Middleware, Next } from '../router/middleware.interface'\nimport type { RouterContext } from '../router/router-context'\nimport type { Constructor } from '../types'\nimport { RateLimiterError } from './errors'\nimport type { RateLimiterRegistry } from './rate-limiter-registry'\nimport { RATE_LIMITER_TOKENS } from './rate-limiter.tokens'\n\nconst cache = new Map<string, Constructor<Middleware>>()\n\n/**\n * Memoized factory that produces a Stratal `Middleware` class bound to a\n * named limiter. Calling twice with the same name returns the *same* class\n * — important for `Router.middleware` deduplication via class identity.\n *\n * Detection of \"module not imported\" works against a per-app marker\n * registered by `RateLimiterModule.onInitialize`. We check\n * `isRegistered(marker)` at request time before resolving Registry.\n */\nexport function createThrottleMiddleware(name: string): Constructor<Middleware> {\n const existing = cache.get(name)\n if (existing) return existing\n\n @Transient()\n class ThrottleMiddleware implements Middleware {\n constructor(\n @inject(CONTAINER_TOKEN) private readonly container: Container,\n ) {}\n\n handle(ctx: RouterContext, next: Next): Promise<Response | void> {\n if (!this.container.isRegistered(RATE_LIMITER_TOKENS.ModuleMarker)) {\n throw new RateLimiterError(`RateLimiterModule was not imported. Cannot resolve throttle \"${name}\". Import RateLimiterModule.forRoot({ store: ... }) in your AppModule.`)\n }\n const registry = this.container.resolve<RateLimiterRegistry>(RATE_LIMITER_TOKENS.Registry)\n return registry.handle(name, ctx, next)\n }\n }\n\n Object.defineProperty(ThrottleMiddleware, 'name', { value: `Throttle(${name})` })\n cache.set(name, ThrottleMiddleware)\n return ThrottleMiddleware\n}\n\n/**\n * Test-only escape hatch: clear the per-name middleware class cache.\n * Production code never needs this.\n */\nexport function _resetThrottleMiddlewareCache(): void {\n cache.clear()\n}\n","import { ApplicationError } from '../errors'\n\nexport class RouterError extends ApplicationError {}\n","/**\n * Symbol keys for Router internal accessors.\n *\n * These symbols are NOT exported from the public `stratal/router` barrel.\n * Only internal modules (RouterResolver) import them, keeping the Router's\n * public API clean — users never see these methods.\n *\n * Declared as individual unique symbols so TypeScript can distinguish\n * their return types in computed property access.\n *\n * @internal\n */\n\n/** @internal */\nexport const getDefaultEntry: unique symbol = Symbol('Router.getDefaultEntry')\n/** @internal */\nexport const getGroups: unique symbol = Symbol('Router.getGroups')\n/** @internal */\nexport const getGlobalMiddleware: unique symbol = Symbol('Router.getGlobalMiddleware')\n","import type { ZodObject } from '../i18n/validation/zod'\nimport { createThrottleMiddleware } from '../rate-limiter/throttle.middleware'\nimport type { Constructor } from '../types'\nimport { RouterError } from './router.error'\nimport type { Middleware } from './middleware.interface'\nimport * as internal from './router.internals'\n\n/**\n * Configuration for a sub-group created via `router.group()`.\n */\nexport interface RouterGroupConfig {\n prefix?: string\n domain?: string\n name?: string\n middleware?: Constructor<Middleware>[]\n version?: string | string[]\n hideFromDocs?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n params?: ZodObject<any>\n}\n\n/**\n * Internal entry representing a sub-group or the default scope.\n * @internal — used by RouterResolver, not exported publicly.\n */\nexport interface RouterEntry {\n prefix?: string\n domain?: string\n name?: string\n middleware: Constructor<Middleware>[]\n version?: string | string[]\n hideFromDocs?: boolean\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n params?: ZodObject<any>\n /** Controllers in this entry. undefined = all controllers not in any sub-group */\n controllers?: Constructor[]\n}\n\n/**\n * Modules implement this to configure routes and middleware.\n * Replaces `MiddlewareConfigurable`.\n *\n * @example\n * ```typescript\n * @Module({ controllers: [UsersController, PostsController] })\n * export class ApiModule implements RouteConfigurable {\n * configureRoutes(router: Router): void {\n * router\n * .name('api.')\n * .middleware(CorsMiddleware)\n * .version('1')\n * }\n * }\n * ```\n */\nexport interface RouteConfigurable {\n configureRoutes(router: Router): void\n}\n\n/**\n * Fluent builder for route and middleware configuration.\n *\n * Scoped methods (`middleware()`, `prefix()`, `domain()`, `name()`, `version()`, `hideFromDocs()`)\n * apply only to this module's controllers or the sub-group's controllers.\n *\n * `use()` registers global middleware (all routes in the entire app).\n * Only callable on the root Router — throws inside `group()` callbacks.\n *\n * `group()` creates sub-groups for specific controllers with a callback.\n * Controllers in a sub-group are excluded from the parent scope.\n */\nexport class Router {\n private readonly _isChild: boolean\n private readonly _defaultEntry: RouterEntry = { middleware: [] }\n private readonly _groups: RouterEntry[] = []\n private readonly _globalMiddleware: Constructor<Middleware>[] = []\n\n constructor(isChild = false) {\n this._isChild = isChild\n }\n\n /** Dynamic path prefix. For shared segments like `/:companyId` */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- ZodObject generics require any for flexible shape parameter\n prefix(path: string, params?: ZodObject<any>): this {\n this._defaultEntry.prefix = path\n this._defaultEntry.params = params\n return this\n }\n\n /** Domain pattern for controllers in this scope */\n domain(pattern: string): this {\n this._defaultEntry.domain = pattern\n return this\n }\n\n /** Name prefix for routes in this scope */\n name(prefix: string): this {\n this._defaultEntry.name = prefix\n return this\n }\n\n /** Middleware applied to controllers in this scope */\n middleware(...middlewares: Constructor<Middleware>[]): this {\n this._defaultEntry.middleware.push(...middlewares)\n return this\n }\n\n /**\n * Apply a named rate limiter to controllers in this scope.\n *\n * The named limiter must be registered via `RateLimiterRegistry.for(name, ...)`\n * (typically inside a module's `onInitialize` hook), and the user must\n * import `RateLimiterModule.forRoot({ store: ... })` in their AppModule.\n *\n * @example\n * ```typescript\n * router.prefix('/uploads').throttle('uploads')\n * router.group([AdminController], (admin) => admin.throttle('admin'))\n * ```\n */\n throttle(name: string): this {\n this._defaultEntry.middleware.push(createThrottleMiddleware(name))\n return this\n }\n\n /** API version for controllers in this scope */\n version(version: string | string[]): this {\n this._defaultEntry.version = version\n return this\n }\n\n /** Hide/show routes in this scope from OpenAPI docs */\n hideFromDocs(hide = true): this {\n this._defaultEntry.hideFromDocs = hide\n return this\n }\n\n /**\n * Global middleware — applied to ALL routes in the entire app.\n * Only callable on the root Router. Throws if called inside `group()`.\n */\n use(...middlewares: Constructor<Middleware>[]): this {\n if (this._isChild) {\n throw new RouterError('router.use() is only allowed on the root Router. It cannot be called inside a group() callback.')\n }\n this._globalMiddleware.push(...middlewares)\n return this\n }\n\n /**\n * Create a sub-group for specific controllers/gateways.\n * Controllers in a sub-group are excluded from the parent (default) scope.\n * The callback receives a new Router (without `use()`) for fluent configuration.\n */\n group(controllers: Constructor[], callback: (router: Omit<Router, 'use'>) => void): this {\n const childRouter = new Router(true)\n callback(childRouter)\n\n this._groups.push({\n ...childRouter._defaultEntry,\n controllers,\n })\n return this\n }\n\n // --- Internal accessors via symbol keys (invisible to consumers) ---\n\n [internal.getDefaultEntry](): RouterEntry {\n return this._defaultEntry\n }\n\n [internal.getGroups](): RouterEntry[] {\n return this._groups\n }\n\n [internal.getGlobalMiddleware](): Constructor<Middleware>[] {\n return this._globalMiddleware\n }\n}\n","import type { Container } from '../di/container'\nimport { isListener } from '../events'\nimport type { LoggerService } from '../logger'\nimport { Router, type RouteConfigurable } from '../router/router'\nimport { isCommand } from '../quarry/is-command'\nimport { isSeeder } from '../seeder/is-seeder'\nimport type { Constructor } from '../types'\nimport { getModuleOptions } from './module.decorator'\nimport type { ExceptionHandler } from '../errors/exception-handler'\nimport type {\n DynamicModule,\n InjectionToken,\n ModuleClass,\n ModuleContext,\n ModuleOptions,\n OnException,\n OnInitialize,\n OnShutdown,\n Provider,\n} from './types'\n\n\ninterface RegisteredModule {\n moduleClass: Constructor\n options: ModuleOptions\n instance: object | null\n hasLifecycle: boolean\n}\n\nexport class ModuleRegistry {\n private modules: RegisteredModule[] = []\n private registeredClasses = new Set<Constructor>()\n private initialized = false\n\n private allControllers: Constructor[] = []\n private allConsumers: Constructor[] = []\n private allJobs: Constructor[] = []\n private allListeners: Constructor[] = []\n private allCommands: Constructor[] = []\n private allSeeders: Constructor[] = []\n private allRouterConfigs: { router: Router; controllers: Constructor[] }[] = []\n\n constructor(\n private readonly container: Container,\n private readonly logger: LoggerService\n ) { }\n\n register(moduleOrDynamic: ModuleClass | DynamicModule): void {\n const { moduleClass, options } = this.resolveModule(moduleOrDynamic)\n\n if (this.handleAlreadyRegistered(moduleClass, moduleOrDynamic)) return\n\n this.registeredClasses.add(moduleClass)\n this.logger.info(`Registering module: ${moduleClass.name}`)\n\n for (const ImportedModule of options.imports ?? []) {\n this.register(ImportedModule)\n }\n\n const registered = this.registerModuleNode(moduleClass, options, { includeHttpWiring: true })\n\n // Eager register() is synchronous and assumes the bootstrap initialize()\n // batch will run lifecycle hooks. If it's called AFTER initialization (e.g. a\n // built-in subsystem registered on first use), that batch has finished and\n // won't revisit this module — so a lifecycle hook would be silently dropped.\n // Surface it instead of failing silently; load such modules via\n // LazyModuleLoader (registerLazy), which runs onInitialize immediately.\n if (this.initialized && registered.hasLifecycle) {\n this.logger.warn(\n `Module ${moduleClass.name} was registered eagerly after initialization; its onInitialize/onShutdown/configureRoutes hooks will not run. Load it via LazyModuleLoader instead.`,\n )\n }\n }\n\n /**\n * Register a module on demand (NestJS-style lazy loading). Registers nested\n * imports recursively and providers, then runs `onInitialize` immediately\n * (the bootstrap-time batch {@link initialize} has already completed).\n *\n * Controllers, queue consumers, and cron jobs are SKIPPED — route, queue, and\n * cron wiring is finalized at bootstrap and cannot be extended at runtime.\n */\n async registerLazy(moduleOrDynamic: ModuleClass | DynamicModule): Promise<void> {\n const { moduleClass, options } = this.resolveModule(moduleOrDynamic)\n\n if (this.handleAlreadyRegistered(moduleClass, moduleOrDynamic)) return\n\n this.registeredClasses.add(moduleClass)\n this.logger.info(`Lazily registering module: ${moduleClass.name}`)\n\n for (const ImportedModule of options.imports ?? []) {\n await this.registerLazy(ImportedModule)\n }\n\n const registered = this.registerModuleNode(moduleClass, options, { includeHttpWiring: false })\n\n if (registered.hasLifecycle) {\n const instance = new registered.moduleClass()\n registered.instance = instance\n if (this.hasOnInitialize(instance)) {\n const context: ModuleContext = { container: this.container, logger: this.logger }\n this.logger.info(`Initializing (lazy): ${registered.moduleClass.name}`)\n await instance.onInitialize(context)\n }\n }\n }\n\n registerAll(modules: (ModuleClass | DynamicModule)[]): void {\n for (const module of modules) {\n this.register(module)\n }\n }\n\n hasRegistered(moduleClass: Constructor): boolean {\n return this.registeredClasses.has(moduleClass)\n }\n\n /**\n * Handle re-registration of an already-known module. For a DynamicModule,\n * its extra providers are wired (without re-running lifecycle); for a plain\n * class it is a no-op. Returns true when the module was already registered.\n */\n private handleAlreadyRegistered(\n moduleClass: Constructor,\n moduleOrDynamic: ModuleClass | DynamicModule,\n ): boolean {\n if (!this.registeredClasses.has(moduleClass)) return false\n\n if (this.isDynamicModule(moduleOrDynamic)) {\n this.logger.debug(`Module ${moduleClass.name} already registered, registering DynamicModule providers`)\n const { module: _, ...dynamicRest } = moduleOrDynamic\n for (const provider of dynamicRest.providers ?? []) {\n this.registerProvider(provider)\n }\n } else {\n this.logger.debug(`Module ${moduleClass.name} already registered, skipping`)\n }\n return true\n }\n\n /**\n * Register a single module's providers (and, for eager registration, its\n * controllers/consumers/jobs), detect lifecycle hooks, and record it.\n * Assumes the module's `imports` have already been registered by the caller.\n */\n private registerModuleNode(\n moduleClass: Constructor,\n options: ModuleOptions,\n { includeHttpWiring }: { includeHttpWiring: boolean },\n ): RegisteredModule {\n for (const provider of options.providers ?? []) {\n this.registerProvider(provider, { lazy: !includeHttpWiring, moduleName: moduleClass.name })\n }\n\n if (includeHttpWiring) {\n for (const controller of options.controllers ?? []) {\n this.container.register(controller)\n this.allControllers.push(controller)\n }\n\n for (const consumer of options.consumers ?? []) {\n this.container.register(consumer)\n this.allConsumers.push(consumer)\n this.logger.info(`Collected consumer: ${consumer.name}`, { queueCount: this.allConsumers.length })\n }\n\n for (const job of options.jobs ?? []) {\n this.container.register(job)\n this.allJobs.push(job)\n }\n } else {\n const skipped: string[] = []\n if (options.controllers?.length) skipped.push('controllers')\n if (options.consumers?.length) skipped.push('consumers')\n if (options.jobs?.length) skipped.push('jobs')\n if ('configureRoutes' in moduleClass.prototype) skipped.push('configureRoutes')\n if ('onException' in moduleClass.prototype) skipped.push('onException')\n if (skipped.length) {\n this.logger.warn(\n `Lazy module ${moduleClass.name} declares ${skipped.join('/')} which are skipped — ` +\n `route, queue, cron, and exception-handler wiring is finalized at bootstrap`,\n )\n }\n }\n\n const hasLifecycle =\n 'onInitialize' in moduleClass.prototype ||\n 'onShutdown' in moduleClass.prototype ||\n 'onException' in moduleClass.prototype ||\n 'configureRoutes' in moduleClass.prototype\n\n const registered: RegisteredModule = { moduleClass, options, instance: null, hasLifecycle }\n this.modules.push(registered)\n return registered\n }\n\n async initialize(): Promise<void> {\n if (this.initialized) return\n\n this.logger.info('Initializing modules...')\n\n const context: ModuleContext = {\n container: this.container,\n logger: this.logger,\n }\n\n // Snapshot: a module's onInitialize may lazily load another module\n // (LazyModuleLoader.load → registerLazy), which pushes to this.modules and\n // initializes it itself. Iterating a snapshot prevents the batch loop from\n // re-visiting (and double-initializing) those lazily-added modules.\n for (const registered of [...this.modules]) {\n if (!registered.hasLifecycle) continue\n\n const instance = new registered.moduleClass()\n registered.instance = instance\n\n if (this.hasOnInitialize(instance)) {\n this.logger.info(`Initializing: ${registered.moduleClass.name}`)\n await instance.onInitialize(context)\n }\n }\n\n this.initialized = true\n this.logger.info('All modules initialized')\n }\n\n getAllControllers(): Constructor[] {\n return this.allControllers\n }\n\n getAllConsumers(): Constructor[] {\n return this.allConsumers\n }\n\n getAllJobs(): Constructor[] {\n return this.allJobs\n }\n\n getAllListeners(): Constructor[] {\n return this.allListeners\n }\n\n getAllCommands(): Constructor[] {\n return this.allCommands\n }\n\n getAllSeeders(): Constructor[] {\n return this.allSeeders\n }\n\n getAllRouterConfigs(): { router: Router; controllers: Constructor[] }[] {\n if (this.allRouterConfigs.length === 0) {\n for (const { moduleClass, options, instance } of this.modules) {\n if (instance && this.hasRouteConfigurable(instance)) {\n this.logger.debug(`Configuring routes for: ${moduleClass.name}`)\n const router = new Router()\n instance.configureRoutes(router)\n const moduleControllers = options.controllers ?? []\n this.allRouterConfigs.push({ router, controllers: moduleControllers })\n }\n }\n }\n return this.allRouterConfigs\n }\n\n configureExceptionHandlers(handler: ExceptionHandler): void {\n for (const { moduleClass, instance } of this.modules) {\n if (instance && this.hasOnException(instance)) {\n this.logger.debug(`Configuring exception handlers for: ${moduleClass.name}`)\n instance.onException(handler)\n }\n }\n }\n\n async shutdown(): Promise<void> {\n this.logger.info('Shutting down modules...')\n\n const context: ModuleContext = {\n container: this.container,\n logger: this.logger,\n }\n\n const reversed = [...this.modules].reverse()\n\n for (const { moduleClass, instance } of reversed) {\n if (instance && this.hasOnShutdown(instance)) {\n try {\n await instance.onShutdown(context)\n } catch (error) {\n this.logger.error(`Error shutting down ${moduleClass.name}:`, error as Error)\n }\n }\n }\n\n this.logger.info('All modules shut down')\n }\n\n private hasRouteConfigurable(instance: unknown): instance is RouteConfigurable {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'configureRoutes' in instance &&\n typeof (instance as RouteConfigurable).configureRoutes === 'function'\n )\n }\n\n private hasOnInitialize(instance: unknown): instance is OnInitialize {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'onInitialize' in instance &&\n typeof (instance as OnInitialize).onInitialize === 'function'\n )\n }\n\n private hasOnShutdown(instance: unknown): instance is OnShutdown {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'onShutdown' in instance &&\n typeof (instance as OnShutdown).onShutdown === 'function'\n )\n }\n\n private hasOnException(instance: unknown): instance is OnException {\n return (\n typeof instance === 'object' &&\n instance !== null &&\n 'onException' in instance &&\n typeof (instance as OnException).onException === 'function'\n )\n }\n\n resolveModule(moduleOrDynamic: ModuleClass | DynamicModule): {\n moduleClass: Constructor\n options: ModuleOptions\n } {\n if (this.isDynamicModule(moduleOrDynamic)) {\n const { module: moduleClass, ...dynamicRest } = moduleOrDynamic\n\n const decoratorOptions = getModuleOptions(moduleClass) ?? {}\n const mergedOptions: ModuleOptions = {\n ...decoratorOptions,\n ...dynamicRest,\n providers: [...(decoratorOptions.providers ?? []), ...(dynamicRest.providers ?? [])],\n imports: [...(decoratorOptions.imports ?? [])],\n }\n\n return { moduleClass: moduleClass, options: mergedOptions }\n }\n\n const moduleClass = moduleOrDynamic as Constructor\n const options = getModuleOptions(moduleClass) ?? {}\n return { moduleClass, options }\n }\n\n isDynamicModule(value: unknown): value is DynamicModule {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'module' in value &&\n typeof (value as DynamicModule).module === 'function'\n )\n }\n\n private registerProvider(\n provider: Provider,\n { lazy = false, moduleName }: { lazy?: boolean; moduleName?: string } = {},\n ): void {\n if (lazy) {\n const token = this.providerToken(provider)\n // A lazy module registers onto the shared root container. If its token is\n // already bound (by an eagerly-registered or previously-loaded module),\n // overriding would silently clobber that binding — and break any\n // shared-singleton rendezvous. Keep the existing binding and warn.\n if (token !== null && this.container.isRegistered(token)) {\n this.logger.warn(\n `Lazy module ${moduleName ?? '(unknown)'} provides ${this.describeToken(token)}, ` +\n `which is already registered by another module — keeping the existing binding and ignoring the lazy provider.`,\n )\n return\n }\n }\n\n if (typeof provider === 'function') {\n this.container.register(provider as Constructor)\n this.collectIfListener(provider as Constructor)\n this.collectIfCommand(provider as Constructor)\n this.collectIfSeeder(provider as Constructor)\n } else if ('useClass' in provider) {\n this.container.register(provider.provide, provider.useClass as Constructor)\n this.collectIfListener(provider.useClass as Constructor)\n this.collectIfCommand(provider.useClass as Constructor)\n this.collectIfSeeder(provider.useClass as Constructor)\n } else if ('useValue' in provider) {\n this.container.registerValue(provider.provide, provider.useValue)\n } else if ('useFactory' in provider) {\n const { provide, useFactory, inject = [] } = provider\n this.container.registerFactory(provide, (c) => {\n const deps = inject.map((token) => c.resolve(token))\n return useFactory(...deps)\n })\n } else if ('useExisting' in provider) {\n this.container.registerExisting(provider.provide, provider.useExisting)\n }\n }\n\n /** The DI token a provider binds, for collision detection. */\n private providerToken(provider: Provider): InjectionToken | null {\n if (typeof provider === 'function') return provider as Constructor\n if ('provide' in provider) return provider.provide\n return null\n }\n\n private describeToken(token: InjectionToken): string {\n if (typeof token === 'function') return token.name\n if (typeof token === 'symbol') return token.toString()\n if (typeof token === 'string') return token\n return 'lazy token'\n }\n\n private collectIfCommand(providerClass: Constructor): void {\n if (isCommand(providerClass) && !this.allCommands.includes(providerClass)) {\n this.allCommands.push(providerClass)\n this.logger.debug(`Collected command: ${providerClass.name}`)\n }\n }\n\n private collectIfSeeder(providerClass: Constructor): void {\n if (isSeeder(providerClass) && !this.allSeeders.includes(providerClass)) {\n this.allSeeders.push(providerClass)\n this.logger.debug(`Collected seeder: ${providerClass.name}`)\n }\n }\n\n private collectIfListener(providerClass: Constructor): void {\n if (isListener(providerClass)) {\n // Register with the listener's own scope (`@Listener()` applies\n // `@Transient()`) rather than forcing a singleton: listeners are resolved\n // fresh per event from the emitting request scope, so a listener may inject\n // request-scoped providers (i18n, queue senders, auth context, …).\n this.container.register(providerClass)\n this.allListeners.push(providerClass)\n this.logger.debug(`Collected listener: ${providerClass.name}`)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,IAAa,YAAb,MAAuB;CAEF;CAER;CAHX,YACE,WAEA,aACA;EAHiB,KAAA,YAAA;EAER,KAAA,cAAA;CACP;;CAGJ,IAAO,OAA6B;EAClC,OAAO,KAAK,UAAU,QAAQ,KAAK;CACrC;;CAGA,QAAW,OAAsC;EAC/C,OAAO,QAAQ,QAAQ,KAAK,UAAU,QAAQ,KAAK,CAAC;CACtD;AACF;;;ACLO,IAAA,mBAAA,MAAM,iBAAiB;CAKyB;CACL;CACQ;CANxD,wBAAyB,IAAI,IAA4B;CACzD,2BAA4B,IAAI,IAAqC;CAErE,YACE,UACA,WACA,QACA;EAHmD,KAAA,WAAA;EACL,KAAA,YAAA;EACQ,KAAA,SAAA;CACpD;CAEJ,MAAM,KAAK,UAA0E;EACnF,MAAM,SAAS,MAAM,SAAS;EAC9B,MAAM,EAAE,gBAAgB,KAAK,SAAS,cAAc,MAAM;EAE1D,MAAM,SAAS,KAAK,MAAM,IAAI,WAAW;EACzC,IAAI,QAAQ,OAAO;EAEnB,MAAM,WAAW,KAAK,SAAS,IAAI,WAAW;EAC9C,IAAI,UAAU,OAAO;EAErB,MAAM,UAAU,KAAK,iBAAiB,aAAa,MAAM;EACzD,KAAK,SAAS,IAAI,aAAa,OAAO;EACtC,IAAI;GACF,OAAO,MAAM;EACf,UAAU;GACR,KAAK,SAAS,OAAO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SAAS,aAAa,KAAK,CAAC,KAAK,WAAW,SAAS,aAAa,GAAG;GACvE,KAAK,WAAW,KAAK,aAAa;GAClC,KAAK,OAAO,MAAM,qBAAqB,cAAc,MAAM;EAC7D;CACF;CAEA,kBAA0B,eAAkC;EAC1D,IAAI,WAAW,aAAa,GAAG;GAK7B,KAAK,UAAU,SAAS,aAAa;GACrC,KAAK,aAAa,KAAK,aAAa;GACpC,KAAK,OAAO,MAAM,uBAAuB,cAAc,MAAM;EAC/D;CACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { Dn as AsyncModuleOptions, kn as DynamicModule, or as RouterEnv } from "../index-C_t8VVQD.mjs";
1
+ import { Fn as DynamicModule, Nn as AsyncModuleOptions, fr as RouterEnv } from "../index-uybm0bhQ.mjs";
2
2
  import { n as OpenAPIObject, r as PathItemObject } from "../zod-wecrEVAs.mjs";
3
- import { t as OpenAPIService } from "../openapi.service-CM40bnBB.mjs";
3
+ import { t as OpenAPIService } from "../openapi.service-2rvJBCEg.mjs";
4
4
  import { MiddlewareHandler } from "hono/types";
5
5
 
6
6
  //#region src/openapi/types.d.ts
@@ -1,3 +1,3 @@
1
1
  import { n as OPENAPI_TOKENS, t as OpenApiToolsService } from "../openapi-tools.service-BC5EC3R3.mjs";
2
- import { i as OpenAPIConfigService, n as OpenAPIService, r as OpenAPIConfigStore, t as OpenAPIModule } from "../openapi-BKDwQKh-.mjs";
2
+ import { i as OpenAPIConfigService, n as OpenAPIService, r as OpenAPIConfigStore, t as OpenAPIModule } from "../openapi-CMwuCp31.mjs";
3
3
  export { OPENAPI_TOKENS, OpenAPIConfigService, OpenAPIConfigStore, OpenAPIModule, OpenAPIService, OpenApiToolsService };
@@ -1,6 +1,6 @@
1
- import { d as inject, o as Request, s as Singleton } from "./di-B0NXIdRF.mjs";
1
+ import { c as Request, l as Singleton, p as inject } from "./di-D7qmrAir.mjs";
2
2
  import { n as __decorateParam, t as __decorate } from "./decorate-CuAoSZvs.mjs";
3
- import { d as SECURITY_SCHEMES, l as ROUTER_CONTEXT_KEYS } from "./exception-context-Bd5Hk2c_.mjs";
3
+ import { d as SECURITY_SCHEMES, l as ROUTER_CONTEXT_KEYS } from "./exception-context-D-kvney-.mjs";
4
4
  import { n as Module } from "./module.decorator-CYHY6pG5.mjs";
5
5
  import "./module/index.mjs";
6
6
  import { t as I18N_TOKENS } from "./i18n.tokens-CZ_v8oyS.mjs";
@@ -306,4 +306,4 @@ OpenAPIModule = _OpenAPIModule = __decorate([Module({ providers: [
306
306
  //#endregion
307
307
  export { OpenAPIConfigService as i, OpenAPIService as n, OpenAPIConfigStore as r, OpenAPIModule as t };
308
308
 
309
- //# sourceMappingURL=openapi-BKDwQKh-.mjs.map
309
+ //# sourceMappingURL=openapi-CMwuCp31.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"openapi-BKDwQKh-.mjs","names":[],"sources":["../src/openapi/services/openapi-config.service.ts","../src/openapi/services/openapi-config.store.ts","../src/openapi/services/openapi.service.ts","../src/openapi/openapi.module.ts"],"sourcesContent":["import { inject } from '../../di'\nimport { Request } from '../../di/decorators'\nimport { OPENAPI_TOKENS } from '../openapi.tokens'\nimport type {\n IOpenAPIConfigService,\n IOpenAPIConfigStore,\n OpenAPIConfigOverride,\n OpenAPIEffectiveConfig\n} from '../types'\n\n/**\n * OpenAPI Config Service\n *\n * Request-scoped service that manages OpenAPI configuration for the current request.\n * Supports runtime overrides via middleware while preserving base configuration.\n *\n * @example\n * ```typescript\n * // In middleware (e.g., RouteAccessMiddleware)\n * constructor(\n * @inject(OPENAPI_TOKENS.ConfigService) private openAPIConfig: IOpenAPIConfigService\n * ) {}\n *\n * async handle(ctx, next) {\n * this.openAPIConfig.override({\n * info: { title: 'Custom API' },\n * routeFilter: (path) => shouldInclude(path)\n * })\n * await next()\n * }\n * ```\n */\n@Request(OPENAPI_TOKENS.ConfigService)\nexport class OpenAPIConfigService implements IOpenAPIConfigService {\n private overrides: OpenAPIConfigOverride[] = []\n\n constructor(\n @inject(OPENAPI_TOKENS.ConfigStore) private store: IOpenAPIConfigStore\n ) { }\n\n /**\n * Add configuration override for this request.\n * Overrides are merged in the order they are added.\n */\n override(config: OpenAPIConfigOverride): void {\n this.overrides.push(config)\n }\n\n /** Get effective configuration (base merged with all overrides) */\n getEffectiveConfig(): OpenAPIEffectiveConfig {\n let effective = this.store.getBaseConfig()\n\n for (const override of this.overrides) {\n effective = this.mergeConfig(effective, override)\n }\n\n return effective\n }\n\n /**\n * Merge override into effective config.\n * Info is shallow-merged, routeFilter is replaced.\n */\n private mergeConfig(\n base: OpenAPIEffectiveConfig,\n override: OpenAPIConfigOverride\n ): OpenAPIEffectiveConfig {\n return {\n ...base,\n info: {\n ...base.info,\n ...(override.info && {\n title: override.info.title ?? base.info.title,\n version: override.info.version ?? base.info.version,\n description: override.info.description ?? base.info.description\n })\n },\n routeFilter: override.routeFilter ?? base.routeFilter\n }\n }\n}\n","import { inject } from '../../di'\nimport { Singleton } from '../../di/decorators'\nimport { OPENAPI_TOKENS } from '../openapi.tokens'\nimport type {\n IOpenAPIConfigStore,\n OpenAPIEffectiveConfig,\n OpenAPIModuleOptions\n} from '../types'\n\n/**\n * OpenAPI Config Store\n *\n * Singleton holder of the static base configuration (mount paths, base info,\n * security schemes) derived from `OpenAPIModule.forRoot()` options. It carries\n * no per-request state, so it is the thing to resolve when you need OpenAPI\n * config OUTSIDE a request scope — endpoint mounting at bootstrap, the\n * `mcp:serve` CLI command, etc. Resolving it never throws on its own.\n *\n * Per-request overrides live on {@link OpenAPIConfigService}, which reads the\n * base config from here and merges its overrides on top.\n */\n@Singleton(OPENAPI_TOKENS.ConfigStore)\nexport class OpenAPIConfigStore implements IOpenAPIConfigStore {\n constructor(\n @inject(OPENAPI_TOKENS.Options, { isOptional: true }) private baseOptions?: OpenAPIModuleOptions\n ) { }\n\n getBaseConfig(): OpenAPIEffectiveConfig {\n return {\n jsonPath: this.baseOptions?.jsonPath ?? '/api/openapi.json',\n ui: this.baseOptions?.ui,\n info: {\n title: this.baseOptions?.info?.title ?? 'API',\n version: this.baseOptions?.info?.version ?? '1.0.0',\n description: this.baseOptions?.info?.description\n },\n securitySchemes: this.baseOptions?.securitySchemes\n }\n }\n}\n","import type { Container } from '../../di/container'\nimport { Singleton } from '../../di/decorators'\nimport { I18N_TOKENS } from '../../i18n/i18n.tokens'\nimport type { II18nService } from '../../i18n/i18n.types'\nimport type { OpenAPIHono, OpenAPIObject, PathItemObject } from '../../i18n/validation/zod'\nimport { ROUTER_CONTEXT_KEYS, SECURITY_SCHEMES } from '../../router/constants'\nimport type { RouterEnv } from '../../router/types'\nimport { OPENAPI_TOKENS } from '../openapi.tokens'\nimport type { IOpenAPIConfigService, IOpenAPIConfigStore, OpenAPIEffectiveConfig } from '../types'\n\n/**\n * OpenAPI Service\n *\n * Generates OpenAPI specifications with support for:\n * - Runtime configuration via OpenAPIConfigService\n * - Route filtering via custom routeFilter\n * - i18n support for titles and descriptions\n * - Security scheme definitions\n *\n * Hidden routes (hideFromDocs) are excluded at registration time via\n * @hono/zod-openapi's `hide` option and don't appear in the spec.\n *\n * Configuration is resolved per-request from OpenAPIConfigService,\n * allowing middleware to override config based on domain context.\n */\n@Singleton(OPENAPI_TOKENS.OpenAPIService)\nexport class OpenAPIService {\n\n /**\n * Generate a filtered OpenAPI spec using the user's config.\n * Usable from both HTTP handlers and CLI commands.\n */\n getSpec(app: OpenAPIHono<RouterEnv>, container: Container): OpenAPIObject {\n const configService = container.resolve<IOpenAPIConfigService>(OPENAPI_TOKENS.ConfigService)\n const i18n = container.resolve<II18nService>(I18N_TOKENS.I18nService)\n const config = configService.getEffectiveConfig()\n\n const fullSpec = app.getOpenAPIDocument({\n openapi: '3.0.0',\n info: {\n version: config.info.version,\n title: config.info.title,\n description: config.info.description,\n },\n })\n\n // Security schemes\n fullSpec.components ??= {}\n fullSpec.components.securitySchemes = this.getSecuritySchemeDefinitions(i18n)\n\n // Apply custom routeFilter if provided\n if (config.routeFilter) {\n fullSpec.paths = this.filterRoutes(\n fullSpec.paths as Record<string, PathItemObject>,\n config,\n )\n }\n\n // Filter unreferenced schemas\n if (fullSpec.components.schemas) {\n fullSpec.components.schemas = this.filterSchemas(fullSpec as unknown as Record<string, unknown>) as typeof fullSpec.components.schemas\n }\n\n return fullSpec\n }\n\n /**\n * Setup OpenAPI documentation endpoints\n */\n setupEndpoints(app: OpenAPIHono<RouterEnv>, container: Container): void {\n // Endpoints are mounted at bootstrap (no request scope), so read the static\n // mount paths from the singleton config store — request overrides (info /\n // routeFilter) never affect jsonPath/ui and are resolved per request inside\n // the handlers below via the request-scoped config service.\n const config = container.resolve<IOpenAPIConfigStore>(OPENAPI_TOKENS.ConfigStore).getBaseConfig()\n const jsonPath = config.jsonPath\n const ui = config.ui\n\n // OpenAPI JSON spec endpoint\n app.get(jsonPath, (c) => {\n const requestContainer = c.get(ROUTER_CONTEXT_KEYS.REQUEST_CONTAINER)\n const fullSpec = this.getSpec(app, requestContainer)\n\n // Add servers (HTTP-specific — needs request URL context)\n const url = new URL(c.req.raw.url)\n const i18n = requestContainer.resolve<II18nService>(I18N_TOKENS.I18nService)\n fullSpec.servers = [{\n url: `${url.protocol}//${url.host}`,\n description: i18n.t('common.api.serverDescription'),\n }]\n\n return c.json(fullSpec)\n })\n this.nameLastHandler(app, 'OpenAPI', 'spec')\n\n // Docs UI endpoint\n if (ui !== false) {\n const uiPath = ui?.path ?? '/api/docs'\n const uiRenderer = ui?.renderer\n\n app.get(uiPath, async (c, next) => {\n const requestContainer = c.get(ROUTER_CONTEXT_KEYS.REQUEST_CONTAINER)\n const requestConfigService = requestContainer.resolve<IOpenAPIConfigService>(\n OPENAPI_TOKENS.ConfigService\n )\n const effectiveConfig = requestConfigService.getEffectiveConfig()\n const uiContext = { specUrl: effectiveConfig.jsonPath, title: effectiveConfig.info.title }\n\n if (uiRenderer) {\n return uiRenderer(uiContext)(c, next)\n }\n\n const { swaggerUI } = await import('@hono/swagger-ui')\n return swaggerUI<RouterEnv>({ url: uiContext.specUrl })(c, next)\n })\n this.nameLastHandler(app, 'OpenAPI', 'docs')\n }\n }\n\n private nameLastHandler(app: OpenAPIHono<RouterEnv>, controller: string, method: string): void {\n const last = app.routes[app.routes.length - 1]\n Object.defineProperty(last.handler, 'name', { value: `http:${controller}.${method}` })\n }\n\n /**\n * Get localized security scheme definitions\n */\n private getSecuritySchemeDefinitions(i18n: II18nService) {\n return {\n [SECURITY_SCHEMES.BEARER_AUTH]: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n description: i18n.t('common.api.security.bearerAuth')\n },\n [SECURITY_SCHEMES.API_KEY]: {\n type: 'apiKey',\n in: 'header',\n name: 'X-API-Key',\n description: i18n.t('common.api.security.apiKey')\n },\n [SECURITY_SCHEMES.SESSION_COOKIE]: {\n type: 'apiKey',\n in: 'cookie',\n name: 'session',\n description: i18n.t('common.api.security.sessionCookie')\n }\n } as const\n }\n\n /**\n * Filter OpenAPI paths using custom routeFilter\n */\n private filterRoutes(\n paths: Record<string, PathItemObject>,\n config: OpenAPIEffectiveConfig\n ): Record<string, PathItemObject> {\n const filteredPaths: Record<string, PathItemObject> = {}\n\n for (const [path, pathItem] of Object.entries(paths)) {\n if (config.routeFilter && !config.routeFilter(path, pathItem)) {\n continue\n }\n\n filteredPaths[path] = pathItem\n }\n\n return filteredPaths\n }\n\n /**\n * Filter unreferenced schemas from OpenAPI spec\n */\n private filterSchemas(spec: Record<string, unknown>): Record<string, unknown> {\n const referencedSchemas = new Set<string>()\n\n // Collect all schema references from paths\n this.collectSchemaRefs(spec.paths, referencedSchemas)\n\n // Filter schemas to only include referenced ones\n const filteredSchemas: Record<string, unknown> = {}\n const components = spec.components as Record<string, unknown> | undefined\n if (components?.schemas) {\n const allSchemas = components.schemas as Record<string, unknown>\n let prevSize = 0\n while (referencedSchemas.size > prevSize) {\n prevSize = referencedSchemas.size\n for (const [schemaName, schemaValue] of Object.entries(allSchemas)) {\n if (referencedSchemas.has(schemaName) && !filteredSchemas[schemaName]) {\n filteredSchemas[schemaName] = schemaValue\n this.collectSchemaRefs(schemaValue, referencedSchemas)\n }\n }\n }\n }\n\n return filteredSchemas\n }\n\n /**\n * Recursively collect all schema references from an object\n */\n private collectSchemaRefs(obj: unknown, refs: Set<string>): void {\n if (!obj || typeof obj !== 'object') {\n return\n }\n\n const record = obj as Record<string, unknown>\n\n // Check if this object has a $ref property\n if (record.$ref && typeof record.$ref === 'string') {\n // Extract schema name from $ref (format: #/components/schemas/SchemaName)\n const match = /^#\\/components\\/schemas\\/(.+)$/.exec(record.$ref)\n if (match) {\n refs.add(match[1])\n }\n }\n\n // Recursively check all properties\n if (Array.isArray(obj)) {\n for (const item of obj) {\n this.collectSchemaRefs(item, refs)\n }\n } else {\n for (const value of Object.values(record)) {\n this.collectSchemaRefs(value, refs)\n }\n }\n }\n}\n","/**\n * OpenAPI Module\n *\n * Provides configurable OpenAPI documentation endpoints with runtime override support.\n *\n * Features:\n * - Configurable paths for /openapi.json and /docs\n * - Runtime config overrides via middleware\n * - i18n support for titles and descriptions\n * - Route filtering via hideFromDocs and custom routeFilter\n *\n * @example Basic usage\n * ```typescript\n * @Module({\n * imports: [\n * OpenAPIModule.forRoot({\n * info: { title: 'My API', version: '1.0.0' }\n * })\n * ]\n * })\n * export class AppModule {}\n * ```\n *\n * @example With runtime override in middleware\n * ```typescript\n * // In RouteAccessMiddleware\n * constructor(\n * @inject(OPENAPI_TOKENS.ConfigService) private openAPIConfig: IOpenAPIConfigService\n * ) {}\n *\n * async handle(ctx, next) {\n * this.openAPIConfig.override({\n * info: { title: 'Custom API' },\n * routeFilter: (path) => this.shouldInclude(path)\n * })\n * await next()\n * }\n * ```\n */\n\nimport { Module } from '../module'\nimport type { AsyncModuleOptions, DynamicModule } from '../module/types'\nimport { OPENAPI_TOKENS } from './openapi.tokens'\nimport { OpenAPIConfigService, OpenAPIConfigStore, OpenAPIService } from './services'\nimport type { OpenAPIModuleOptions } from './types'\n\n/** Default options when none provided */\nconst DEFAULT_OPTIONS: OpenAPIModuleOptions = {\n jsonPath: '/api/openapi.json',\n info: {\n title: 'API',\n version: '1.0.0'\n }\n}\n\n@Module({\n providers: [\n // Static base config (singleton — resolvable outside a request scope)\n { provide: OPENAPI_TOKENS.ConfigStore, useClass: OpenAPIConfigStore },\n // OpenAPI config service (request-scoped, supports runtime overrides)\n { provide: OPENAPI_TOKENS.ConfigService, useClass: OpenAPIConfigService },\n // OpenAPI service (singleton — serves spec and docs endpoints)\n { provide: OPENAPI_TOKENS.OpenAPIService, useClass: OpenAPIService },\n ],\n})\nexport class OpenAPIModule {\n /**\n * Configure OpenAPI module with static options\n *\n * @param options - OpenAPI configuration (paths, info, security schemes)\n * @returns DynamicModule with options provider\n */\n static forRoot(options: OpenAPIModuleOptions = {}): DynamicModule {\n // Merge with defaults\n const mergedOptions: OpenAPIModuleOptions = {\n ...DEFAULT_OPTIONS,\n ...options,\n info: {\n ...DEFAULT_OPTIONS.info,\n ...options.info,\n title: options.info?.title ?? DEFAULT_OPTIONS.info?.title ?? 'API',\n version: options.info?.version ?? DEFAULT_OPTIONS.info?.version ?? '1.0.0',\n }\n }\n\n return {\n module: OpenAPIModule,\n providers: [\n { provide: OPENAPI_TOKENS.Options, useValue: mergedOptions }\n ]\n }\n }\n\n static forRootAsync(options: AsyncModuleOptions<OpenAPIModuleOptions>): DynamicModule {\n return {\n module: OpenAPIModule,\n providers: [\n {\n provide: OPENAPI_TOKENS.Options,\n useFactory: options.useFactory,\n inject: options.inject\n },\n ]\n }\n }\n}\n"],"mappings":";;;;;;;;AAiCO,IAAA,uBAAA,MAAM,qBAAsD;CAInB;CAH9C,YAA6C,CAAC;CAE9C,YACE,OACA;EAD4C,KAAA,QAAA;CAC1C;;;;;CAMJ,SAAS,QAAqC;EAC5C,KAAK,UAAU,KAAK,MAAM;CAC5B;;CAGA,qBAA6C;EAC3C,IAAI,YAAY,KAAK,MAAM,cAAc;EAEzC,KAAK,MAAM,YAAY,KAAK,WAC1B,YAAY,KAAK,YAAY,WAAW,Q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AAgB,UAAU;CAAe;AACrE,EACF,CAAC,CAAA,GAAA,aAAA"}
1
+ {"version":3,"file":"openapi-CMwuCp31.mjs","names":[],"sources":["../src/openapi/services/openapi-config.service.ts","../src/openapi/services/openapi-config.store.ts","../src/openapi/services/openapi.service.ts","../src/openapi/openapi.module.ts"],"sourcesContent":["import { inject } from '../../di'\nimport { Request } from '../../di/decorators'\nimport { OPENAPI_TOKENS } from '../openapi.tokens'\nimport type {\n IOpenAPIConfigService,\n IOpenAPIConfigStore,\n OpenAPIConfigOverride,\n OpenAPIEffectiveConfig\n} from '../types'\n\n/**\n * OpenAPI Config Service\n *\n * Request-scoped service that manages OpenAPI configuration for the current request.\n * Supports runtime overrides via middleware while preserving base configuration.\n *\n * @example\n * ```typescript\n * // In middleware (e.g., RouteAccessMiddleware)\n * constructor(\n * @inject(OPENAPI_TOKENS.ConfigService) private openAPIConfig: IOpenAPIConfigService\n * ) {}\n *\n * async handle(ctx, next) {\n * this.openAPIConfig.override({\n * info: { title: 'Custom API' },\n * routeFilter: (path) => shouldInclude(path)\n * })\n * await next()\n * }\n * ```\n */\n@Request(OPENAPI_TOKENS.ConfigService)\nexport class OpenAPIConfigService implements IOpenAPIConfigService {\n private overrides: OpenAPIConfigOverride[] = []\n\n constructor(\n @inject(OPENAPI_TOKENS.ConfigStore) private store: IOpenAPIConfigStore\n ) { }\n\n /**\n * Add configuration override for this request.\n * Overrides are merged in the order they are added.\n */\n override(config: OpenAPIConfigOverride): void {\n this.overrides.push(config)\n }\n\n /** Get effective configuration (base merged with all overrides) */\n getEffectiveConfig(): OpenAPIEffectiveConfig {\n let effective = this.store.getBaseConfig()\n\n for (const override of this.overrides) {\n effective = this.mergeConfig(effective, override)\n }\n\n return effective\n }\n\n /**\n * Merge override into effective config.\n * Info is shallow-merged, routeFilter is replaced.\n */\n private mergeConfig(\n base: OpenAPIEffectiveConfig,\n override: OpenAPIConfigOverride\n ): OpenAPIEffectiveConfig {\n return {\n ...base,\n info: {\n ...base.info,\n ...(override.info && {\n title: override.info.title ?? base.info.title,\n version: override.info.version ?? base.info.version,\n description: override.info.description ?? base.info.description\n })\n },\n routeFilter: override.routeFilter ?? base.routeFilter\n }\n }\n}\n","import { inject } from '../../di'\nimport { Singleton } from '../../di/decorators'\nimport { OPENAPI_TOKENS } from '../openapi.tokens'\nimport type {\n IOpenAPIConfigStore,\n OpenAPIEffectiveConfig,\n OpenAPIModuleOptions\n} from '../types'\n\n/**\n * OpenAPI Config Store\n *\n * Singleton holder of the static base configuration (mount paths, base info,\n * security schemes) derived from `OpenAPIModule.forRoot()` options. It carries\n * no per-request state, so it is the thing to resolve when you need OpenAPI\n * config OUTSIDE a request scope — endpoint mounting at bootstrap, the\n * `mcp:serve` CLI command, etc. Resolving it never throws on its own.\n *\n * Per-request overrides live on {@link OpenAPIConfigService}, which reads the\n * base config from here and merges its overrides on top.\n */\n@Singleton(OPENAPI_TOKENS.ConfigStore)\nexport class OpenAPIConfigStore implements IOpenAPIConfigStore {\n constructor(\n @inject(OPENAPI_TOKENS.Options, { isOptional: true }) private baseOptions?: OpenAPIModuleOptions\n ) { }\n\n getBaseConfig(): OpenAPIEffectiveConfig {\n return {\n jsonPath: this.baseOptions?.jsonPath ?? '/api/openapi.json',\n ui: this.baseOptions?.ui,\n info: {\n title: this.baseOptions?.info?.title ?? 'API',\n version: this.baseOptions?.info?.version ?? '1.0.0',\n description: this.baseOptions?.info?.description\n },\n securitySchemes: this.baseOptions?.securitySchemes\n }\n }\n}\n","import type { Container } from '../../di/container'\nimport { Singleton } from '../../di/decorators'\nimport { I18N_TOKENS } from '../../i18n/i18n.tokens'\nimport type { II18nService } from '../../i18n/i18n.types'\nimport type { OpenAPIHono, OpenAPIObject, PathItemObject } from '../../i18n/validation/zod'\nimport { ROUTER_CONTEXT_KEYS, SECURITY_SCHEMES } from '../../router/constants'\nimport type { RouterEnv } from '../../router/types'\nimport { OPENAPI_TOKENS } from '../openapi.tokens'\nimport type { IOpenAPIConfigService, IOpenAPIConfigStore, OpenAPIEffectiveConfig } from '../types'\n\n/**\n * OpenAPI Service\n *\n * Generates OpenAPI specifications with support for:\n * - Runtime configuration via OpenAPIConfigService\n * - Route filtering via custom routeFilter\n * - i18n support for titles and descriptions\n * - Security scheme definitions\n *\n * Hidden routes (hideFromDocs) are excluded at registration time via\n * @hono/zod-openapi's `hide` option and don't appear in the spec.\n *\n * Configuration is resolved per-request from OpenAPIConfigService,\n * allowing middleware to override config based on domain context.\n */\n@Singleton(OPENAPI_TOKENS.OpenAPIService)\nexport class OpenAPIService {\n\n /**\n * Generate a filtered OpenAPI spec using the user's config.\n * Usable from both HTTP handlers and CLI commands.\n */\n getSpec(app: OpenAPIHono<RouterEnv>, container: Container): OpenAPIObject {\n const configService = container.resolve<IOpenAPIConfigService>(OPENAPI_TOKENS.ConfigService)\n const i18n = container.resolve<II18nService>(I18N_TOKENS.I18nService)\n const config = configService.getEffectiveConfig()\n\n const fullSpec = app.getOpenAPIDocument({\n openapi: '3.0.0',\n info: {\n version: config.info.version,\n title: config.info.title,\n description: config.info.description,\n },\n })\n\n // Security schemes\n fullSpec.components ??= {}\n fullSpec.components.securitySchemes = this.getSecuritySchemeDefinitions(i18n)\n\n // Apply custom routeFilter if provided\n if (config.routeFilter) {\n fullSpec.paths = this.filterRoutes(\n fullSpec.paths as Record<string, PathItemObject>,\n config,\n )\n }\n\n // Filter unreferenced schemas\n if (fullSpec.components.schemas) {\n fullSpec.components.schemas = this.filterSchemas(fullSpec as unknown as Record<string, unknown>) as typeof fullSpec.components.schemas\n }\n\n return fullSpec\n }\n\n /**\n * Setup OpenAPI documentation endpoints\n */\n setupEndpoints(app: OpenAPIHono<RouterEnv>, container: Container): void {\n // Endpoints are mounted at bootstrap (no request scope), so read the static\n // mount paths from the singleton config store — request overrides (info /\n // routeFilter) never affect jsonPath/ui and are resolved per request inside\n // the handlers below via the request-scoped config service.\n const config = container.resolve<IOpenAPIConfigStore>(OPENAPI_TOKENS.ConfigStore).getBaseConfig()\n const jsonPath = config.jsonPath\n const ui = config.ui\n\n // OpenAPI JSON spec endpoint\n app.get(jsonPath, (c) => {\n const requestContainer = c.get(ROUTER_CONTEXT_KEYS.REQUEST_CONTAINER)\n const fullSpec = this.getSpec(app, requestContainer)\n\n // Add servers (HTTP-specific — needs request URL context)\n const url = new URL(c.req.raw.url)\n const i18n = requestContainer.resolve<II18nService>(I18N_TOKENS.I18nService)\n fullSpec.servers = [{\n url: `${url.protocol}//${url.host}`,\n description: i18n.t('common.api.serverDescription'),\n }]\n\n return c.json(fullSpec)\n })\n this.nameLastHandler(app, 'OpenAPI', 'spec')\n\n // Docs UI endpoint\n if (ui !== false) {\n const uiPath = ui?.path ?? '/api/docs'\n const uiRenderer = ui?.renderer\n\n app.get(uiPath, async (c, next) => {\n const requestContainer = c.get(ROUTER_CONTEXT_KEYS.REQUEST_CONTAINER)\n const requestConfigService = requestContainer.resolve<IOpenAPIConfigService>(\n OPENAPI_TOKENS.ConfigService\n )\n const effectiveConfig = requestConfigService.getEffectiveConfig()\n const uiContext = { specUrl: effectiveConfig.jsonPath, title: effectiveConfig.info.title }\n\n if (uiRenderer) {\n return uiRenderer(uiContext)(c, next)\n }\n\n const { swaggerUI } = await import('@hono/swagger-ui')\n return swaggerUI<RouterEnv>({ url: uiContext.specUrl })(c, next)\n })\n this.nameLastHandler(app, 'OpenAPI', 'docs')\n }\n }\n\n private nameLastHandler(app: OpenAPIHono<RouterEnv>, controller: string, method: string): void {\n const last = app.routes[app.routes.length - 1]\n Object.defineProperty(last.handler, 'name', { value: `http:${controller}.${method}` })\n }\n\n /**\n * Get localized security scheme definitions\n */\n private getSecuritySchemeDefinitions(i18n: II18nService) {\n return {\n [SECURITY_SCHEMES.BEARER_AUTH]: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n description: i18n.t('common.api.security.bearerAuth')\n },\n [SECURITY_SCHEMES.API_KEY]: {\n type: 'apiKey',\n in: 'header',\n name: 'X-API-Key',\n description: i18n.t('common.api.security.apiKey')\n },\n [SECURITY_SCHEMES.SESSION_COOKIE]: {\n type: 'apiKey',\n in: 'cookie',\n name: 'session',\n description: i18n.t('common.api.security.sessionCookie')\n }\n } as const\n }\n\n /**\n * Filter OpenAPI paths using custom routeFilter\n */\n private filterRoutes(\n paths: Record<string, PathItemObject>,\n config: OpenAPIEffectiveConfig\n ): Record<string, PathItemObject> {\n const filteredPaths: Record<string, PathItemObject> = {}\n\n for (const [path, pathItem] of Object.entries(paths)) {\n if (config.routeFilter && !config.routeFilter(path, pathItem)) {\n continue\n }\n\n filteredPaths[path] = pathItem\n }\n\n return filteredPaths\n }\n\n /**\n * Filter unreferenced schemas from OpenAPI spec\n */\n private filterSchemas(spec: Record<string, unknown>): Record<string, unknown> {\n const referencedSchemas = new Set<string>()\n\n // Collect all schema references from paths\n this.collectSchemaRefs(spec.paths, referencedSchemas)\n\n // Filter schemas to only include referenced ones\n const filteredSchemas: Record<string, unknown> = {}\n const components = spec.components as Record<string, unknown> | undefined\n if (components?.schemas) {\n const allSchemas = components.schemas as Record<string, unknown>\n let prevSize = 0\n while (referencedSchemas.size > prevSize) {\n prevSize = referencedSchemas.size\n for (const [schemaName, schemaValue] of Object.entries(allSchemas)) {\n if (referencedSchemas.has(schemaName) && !filteredSchemas[schemaName]) {\n filteredSchemas[schemaName] = schemaValue\n this.collectSchemaRefs(schemaValue, referencedSchemas)\n }\n }\n }\n }\n\n return filteredSchemas\n }\n\n /**\n * Recursively collect all schema references from an object\n */\n private collectSchemaRefs(obj: unknown, refs: Set<string>): void {\n if (!obj || typeof obj !== 'object') {\n return\n }\n\n const record = obj as Record<string, unknown>\n\n // Check if this object has a $ref property\n if (record.$ref && typeof record.$ref === 'string') {\n // Extract schema name from $ref (format: #/components/schemas/SchemaName)\n const match = /^#\\/components\\/schemas\\/(.+)$/.exec(record.$ref)\n if (match) {\n refs.add(match[1])\n }\n }\n\n // Recursively check all properties\n if (Array.isArray(obj)) {\n for (const item of obj) {\n this.collectSchemaRefs(item, refs)\n }\n } else {\n for (const value of Object.values(record)) {\n this.collectSchemaRefs(value, refs)\n }\n }\n }\n}\n","/**\n * OpenAPI Module\n *\n * Provides configurable OpenAPI documentation endpoints with runtime override support.\n *\n * Features:\n * - Configurable paths for /openapi.json and /docs\n * - Runtime config overrides via middleware\n * - i18n support for titles and descriptions\n * - Route filtering via hideFromDocs and custom routeFilter\n *\n * @example Basic usage\n * ```typescript\n * @Module({\n * imports: [\n * OpenAPIModule.forRoot({\n * info: { title: 'My API', version: '1.0.0' }\n * })\n * ]\n * })\n * export class AppModule {}\n * ```\n *\n * @example With runtime override in middleware\n * ```typescript\n * // In RouteAccessMiddleware\n * constructor(\n * @inject(OPENAPI_TOKENS.ConfigService) private openAPIConfig: IOpenAPIConfigService\n * ) {}\n *\n * async handle(ctx, next) {\n * this.openAPIConfig.override({\n * info: { title: 'Custom API' },\n * routeFilter: (path) => this.shouldInclude(path)\n * })\n * await next()\n * }\n * ```\n */\n\nimport { Module } from '../module'\nimport type { AsyncModuleOptions, DynamicModule } from '../module/types'\nimport { OPENAPI_TOKENS } from './openapi.tokens'\nimport { OpenAPIConfigService, OpenAPIConfigStore, OpenAPIService } from './services'\nimport type { OpenAPIModuleOptions } from './types'\n\n/** Default options when none provided */\nconst DEFAULT_OPTIONS: OpenAPIModuleOptions = {\n jsonPath: '/api/openapi.json',\n info: {\n title: 'API',\n version: '1.0.0'\n }\n}\n\n@Module({\n providers: [\n // Static base config (singleton — resolvable outside a request scope)\n { provide: OPENAPI_TOKENS.ConfigStore, useClass: OpenAPIConfigStore },\n // OpenAPI config service (request-scoped, supports runtime overrides)\n { provide: OPENAPI_TOKENS.ConfigService, useClass: OpenAPIConfigService },\n // OpenAPI service (singleton — serves spec and docs endpoints)\n { provide: OPENAPI_TOKENS.OpenAPIService, useClass: OpenAPIService },\n ],\n})\nexport class OpenAPIModule {\n /**\n * Configure OpenAPI module with static options\n *\n * @param options - OpenAPI configuration (paths, info, security schemes)\n * @returns DynamicModule with options provider\n */\n static forRoot(options: OpenAPIModuleOptions = {}): DynamicModule {\n // Merge with defaults\n const mergedOptions: OpenAPIModuleOptions = {\n ...DEFAULT_OPTIONS,\n ...options,\n info: {\n ...DEFAULT_OPTIONS.info,\n ...options.info,\n title: options.info?.title ?? DEFAULT_OPTIONS.info?.title ?? 'API',\n version: options.info?.version ?? DEFAULT_OPTIONS.info?.version ?? '1.0.0',\n }\n }\n\n return {\n module: OpenAPIModule,\n providers: [\n { provide: OPENAPI_TOKENS.Options, useValue: mergedOptions }\n ]\n }\n }\n\n static forRootAsync(options: AsyncModuleOptions<OpenAPIModuleOptions>): DynamicModule {\n return {\n module: OpenAPIModule,\n providers: [\n {\n provide: OPENAPI_TOKENS.Options,\n useFactory: options.useFactory,\n inject: options.inject\n },\n ]\n }\n }\n}\n"],"mappings":";;;;;;;;AAiCO,IAAA,uBAAA,MAAM,qBAAsD;CAInB;CAH9C,YAA6C,CAAC;CAE9C,YACE,OACA;EAD4C,KAAA,QAAA;CAC1C;;;;;CAMJ,SAAS,QAAqC;EAC5C,KAAK,UAAU,KAAK,MAAM;CAC5B;;CAGA,qBAA6C;EAC3C,IAAI,YAAY,KAAK,MAAM,cAAc;EAEzC,KAAK,MAAM,YAAY,KAAK,WAC1B,YAAY,KAAK,YAAY,WAAW,QAAQ;EAGlD,OAAO;CACT;;;;;CAMA,YACE,MACA,UACwB;EACxB,OAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG,KAAK;IACR,GAAI,SAAS,QAAQ;KACnB,OAAO,SAAS,KAAK,SAAS,KAAK,KAAK;KACxC,SAAS,SAAS,KAAK,WAAW,KAAK,KAAK;KAC5C,aAAa,SAAS,KAAK,eAAe,KAAK,KAAK;IACtD;GACF;GACA,aAAa,SAAS,eAAe,KAAK;EAC5C;CACF;AACF;mCAhDC,QAAQ,eAAe,aAAa,GAAA,gBAAA,GAKhC,OAAO,eAAe,WAAW,CAAA,CAAA,GAAA,oBAAA;;;ACf/B,IAAA,qBAAA,MAAM,mBAAk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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACsBxC,MAAM,kBAAwC;CAC5C,UAAU;CACV,MAAM;EACJ,OAAO;EACP,SAAS;CACX;AACF;AAYO,IAAA,gBAAA,iBAAA,MAAM,cAAc;;;;;;;CAOzB,OAAO,QAAQ,UAAgC,CAAC,GAAkB;EAEhE,MAAM,gBAAsC;GAC1C,GAAG;GACH,GAAG;GACH,MAAM;IACJ,GAAG,gBAAgB;IACnB,GAAG,QAAQ;IACX,OAAO,QAAQ,MAAM,SAAS,gBAAgB,MAAM,SAAS;IAC7D,SAAS,QAAQ,MAAM,WAAW,gBAAgB,MAAM,WAAW;GACrE;EACF;EAEA,OAAO;GACL,QAAA;GACA,WAAW,CACT;IAAE,SAAS,eAAe;IAAS,UAAU;GAAc,CAC7D;EACF;CACF;CAEA,OAAO,aAAa,SAAkE;EACpF,OAAO;GACL,QAAA;GACA,WAAW,CACT;IACE,SAAS,eAAe;IACxB,YAAY,QAAQ;IACpB,QAAQ,QAAQ;GAClB,CACF;EACF;CACF;AACF;6CAlDC,OAAO,EACN,WAAW;CAET;EAAE,SAAS,eAAe;EAAa,UAAU;CAAmB;CAEpE;EAAE,SAAS,eAAe;EAAe,UAAU;CAAqB;CAExE;EAAE,SAAS,eAAe;EAAgB,UAAU;CAAe;AACrE,EACF,CAAC,CAAA,GAAA,aAAA"}
@@ -1,4 +1,4 @@
1
- import { Y as Container, or as RouterEnv } from "./index-C_t8VVQD.mjs";
1
+ import { $ as Container, fr as RouterEnv } from "./index-uybm0bhQ.mjs";
2
2
  import { n as OpenAPIObject, t as OpenAPIHono } from "./zod-wecrEVAs.mjs";
3
3
 
4
4
  //#region src/openapi/services/openapi.service.d.ts
@@ -47,4 +47,4 @@ declare class OpenAPIService {
47
47
  }
48
48
  //#endregion
49
49
  export { OpenAPIService as t };
50
- //# sourceMappingURL=openapi.service-CM40bnBB.d.mts.map
50
+ //# sourceMappingURL=openapi.service-2rvJBCEg.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.service-CM40bnBB.d.mts","names":[],"sources":["../src/openapi/services/openapi.service.ts"],"mappings":";;;;;AAyBA;;;;;;;;;;;;;;cACa,cAAA;EAMH;;;;EAAR,OAAA,CAAQ,GAAA,EAAK,WAAA,CAAY,SAAA,GAAY,SAAA,EAAW,SAAA,GAAY,aAAA;EAqCxC;;;EAApB,cAAA,CAAe,GAAA,EAAK,WAAA,CAAY,SAAA,GAAY,SAAA,EAAW,SAAA;EAAA,QAkD/C,eAAA;EAAA;;;EAAA,QAQA,4BAAA;EA2EA;;AAAiB;EAAjB,QAjDA,YAAA;;;;UAoBA,aAAA;;;;UA6BA,iBAAA;AAAA"}
1
+ {"version":3,"file":"openapi.service-2rvJBCEg.d.mts","names":[],"sources":["../src/openapi/services/openapi.service.ts"],"mappings":";;;;;AAyBA;;;;;;;;;;;;;;cACa,cAAA;EAMH;;;;EAAR,OAAA,CAAQ,GAAA,EAAK,WAAA,CAAY,SAAA,GAAY,SAAA,EAAW,SAAA,GAAY,aAAA;EAqCxC;;;EAApB,cAAA,CAAe,GAAA,EAAK,WAAA,CAAY,SAAA,GAAY,SAAA,EAAW,SAAA;EAAA,QAkD/C,eAAA;EAAA;;;EAAA,QAQA,4BAAA;EA2EA;;AAAiB;EAAjB,QAjDA,YAAA;;;;UAoBA,aAAA;;;;UA6BA,iBAAA;AAAA"}
@@ -1,7 +1,7 @@
1
- import { Cn as ParsedArgument, En as Quarry, Sn as CommandResult, Tn as ParsedSignature, bn as CommandInput, wn as ParsedOption } from "../index-C_t8VVQD.mjs";
1
+ import { An as ParsedOption, En as CommandInput, Mn as Quarry, On as CommandResult, jn as ParsedSignature, kn as ParsedArgument } from "../index-uybm0bhQ.mjs";
2
2
  import { t as Constructor } from "../types-CmV_9xBD.mjs";
3
- import { t as Command } from "../command-4HnKnC-G.mjs";
4
- import { t as QuarryRegistry } from "../quarry-registry-CsStq0DB.mjs";
3
+ import { t as Command } from "../command-DoBD2Cwl.mjs";
4
+ import { t as QuarryRegistry } from "../quarry-registry-DRnV-DDa.mjs";
5
5
 
6
6
  //#region src/quarry/errors/command-not-found.error.d.ts
7
7
  /**
@@ -1,6 +1,6 @@
1
1
  import { n as CommandError, t as Command } from "../command-BvmUAPPQ.mjs";
2
2
  import { t as isCommand } from "../is-command-CEPO9n8c.mjs";
3
3
  import { t as CommandNotFoundError } from "../command-not-found.error-ONAZ2Bpk.mjs";
4
- import { i as parseSignature, r as QuarryRegistry, t as QuarryModule } from "../quarry.module-BOgcNJMU.mjs";
4
+ import { i as parseSignature, r as QuarryRegistry, t as QuarryModule } from "../quarry.module-CcGxU2dJ.mjs";
5
5
  import { t as generateUsage } from "../usage-generator-DAWYasuP.mjs";
6
6
  export { Command, CommandError, CommandNotFoundError, QuarryModule, QuarryRegistry, generateUsage, isCommand, parseSignature };
@@ -1,11 +1,11 @@
1
- import { ct as Application, d as ExceptionHandler, ln as ModuleRegistry, mn as LocalePathService, sn as RouteRegistry } from "../index-C_t8VVQD.mjs";
1
+ import { bn as LocalePathService, f as ExceptionHandler, ft as Application, hn as ModuleRegistry, pn as RouteRegistry } from "../index-uybm0bhQ.mjs";
2
2
  import { t as Constructor } from "../types-CmV_9xBD.mjs";
3
3
  import { n as ConsumerRegistry } from "../consumer-registry-D3iMTSdy.mjs";
4
- import { t as Stratal } from "../stratal-Bmc6WT3k.mjs";
5
- import { t as LazyModuleLoader } from "../lazy-module-loader-DZQxOgRZ.mjs";
6
- import { t as OpenAPIService } from "../openapi.service-CM40bnBB.mjs";
7
- import { t as Command } from "../command-4HnKnC-G.mjs";
8
- import { t as QuarryRegistry } from "../quarry-registry-CsStq0DB.mjs";
4
+ import { t as Stratal } from "../stratal-D5j_I14G.mjs";
5
+ import { t as LazyModuleLoader } from "../lazy-module-loader-M6YKudNL.mjs";
6
+ import { t as OpenAPIService } from "../openapi.service-2rvJBCEg.mjs";
7
+ import { t as Command } from "../command-DoBD2Cwl.mjs";
8
+ import { t as QuarryRegistry } from "../quarry-registry-DRnV-DDa.mjs";
9
9
 
10
10
  //#region src/quarry/builtin-quarry.module.d.ts
11
11
  /**
@@ -1,15 +1,15 @@
1
- import { d as inject, r as DI_TOKENS, v as ROUTER_TOKENS } from "../di-B0NXIdRF.mjs";
1
+ import { b as ROUTER_TOKENS, p as inject, r as DI_TOKENS } from "../di-D7qmrAir.mjs";
2
2
  import { n as __decorateParam, t as __decorate } from "../decorate-CuAoSZvs.mjs";
3
3
  import "../logger/index.mjs";
4
- import { a as getListenerHandlers } from "../events-zbCMY_Gf.mjs";
4
+ import { a as getListenerHandlers } from "../events-BhEQuT1X.mjs";
5
5
  import { n as Module } from "../module.decorator-CYHY6pG5.mjs";
6
6
  import { a as cyan, c as green, i as bold, l as red, t as Command, u as yellow } from "../command-BvmUAPPQ.mjs";
7
- import { t as Stratal } from "../stratal-DtAj21uF.mjs";
7
+ import { t as Stratal } from "../stratal-BL6FKUM_.mjs";
8
8
  import { t as QUEUE_TOKENS } from "../queue.tokens-DjHnFmre.mjs";
9
9
  import { t as I18N_TOKENS } from "../i18n.tokens-CZ_v8oyS.mjs";
10
10
  import { n as OPENAPI_TOKENS, t as OpenApiToolsService } from "../openapi-tools.service-BC5EC3R3.mjs";
11
11
  import { t as CommandNotFoundError } from "../command-not-found.error-ONAZ2Bpk.mjs";
12
- import { n as DbSeedListCommand, t as DbSeedCommand } from "../seeder-DI-rUoZx.mjs";
12
+ import { n as DbSeedListCommand, t as DbSeedCommand } from "../seeder-BPGY5rUb.mjs";
13
13
  import { z } from "zod";
14
14
  import { writeFileSync } from "node:fs";
15
15
  import { resolve } from "node:path";
@@ -863,7 +863,7 @@ let ScheduleListCommand = class ScheduleListCommand extends Command {
863
863
  this.loader = loader;
864
864
  }
865
865
  async handle() {
866
- const cron = (await this.loader.load(() => import("../cron.module-DgxLe8Xy.mjs").then((n) => n.n).then((m) => m.CronModule))).get(DI_TOKENS.Cron);
866
+ const cron = (await this.loader.load(() => import("../cron.module-C81HTzR7.mjs").then((n) => n.n).then((m) => m.CronModule))).get(DI_TOKENS.Cron);
867
867
  const schedules = cron.getAllSchedules();
868
868
  if (schedules.length === 0) {
869
869
  this.info("No cron jobs found");