stratal 0.0.19 → 0.0.21
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.
- package/dist/{base-email.provider-mjynzewK.mjs → base-email.provider-CfQCA08m.mjs} +1 -1
- package/dist/{base-email.provider-mjynzewK.mjs.map → base-email.provider-CfQCA08m.mjs.map} +1 -1
- package/dist/bin/cloudflare-workers-loader.mjs.map +1 -1
- package/dist/bin/quarry.mjs +6 -0
- package/dist/bin/quarry.mjs.map +1 -1
- package/dist/cache/index.d.mts +2 -154
- package/dist/cache/index.d.mts.map +1 -1
- package/dist/cache/index.mjs +6 -6
- package/dist/cache/index.mjs.map +1 -1
- package/dist/cache.service-DsnKuNyO.d.mts +156 -0
- package/dist/cache.service-DsnKuNyO.d.mts.map +1 -0
- package/dist/cache.tokens-B7Rw1C9Q.mjs +6 -0
- package/dist/cache.tokens-B7Rw1C9Q.mjs.map +1 -0
- package/dist/command-BgSlsS4M.mjs.map +1 -1
- package/dist/{command-DsQq56Lp.d.mts → command-Cmmf0oHX.d.mts} +2 -2
- package/dist/{command-DsQq56Lp.d.mts.map → command-Cmmf0oHX.d.mts.map} +1 -1
- package/dist/config/index.d.mts +3 -3
- package/dist/config/index.mjs +5 -3
- package/dist/config/index.mjs.map +1 -1
- package/dist/{consumer-registry-Doom7BEh.d.mts → consumer-registry-B7yUNh0q.d.mts} +1 -1
- package/dist/{consumer-registry-Doom7BEh.d.mts.map → consumer-registry-B7yUNh0q.d.mts.map} +1 -1
- package/dist/{controller.decorator-LZY9aHYG.mjs → controller.decorator-B9vwn0zK.mjs} +3 -3
- package/dist/{controller.decorator-LZY9aHYG.mjs.map → controller.decorator-B9vwn0zK.mjs.map} +1 -1
- package/dist/cron/index.d.mts +2 -2
- package/dist/cron/index.mjs +1 -1
- package/dist/{cron-manager-RuPtFVLy.d.mts → cron-manager-CmTimEjf.d.mts} +3 -3
- package/dist/cron-manager-CmTimEjf.d.mts.map +1 -0
- package/dist/{cron-manager-C30t9UZM.mjs → cron-manager-DQSK8uoV.mjs} +10 -4
- package/dist/cron-manager-DQSK8uoV.mjs.map +1 -0
- package/dist/di/index.d.mts +1 -1
- package/dist/di/index.mjs +2 -2
- package/dist/email/index.d.mts +3 -3
- package/dist/email/index.mjs +13 -8
- package/dist/email/index.mjs.map +1 -1
- package/dist/{en-rHmW6vD9.mjs → en-DSH_bhh6.mjs} +7 -1
- package/dist/en-DSH_bhh6.mjs.map +1 -0
- package/dist/{env-CamWD-U1.d.mts → env-D1rcZ8_r.d.mts} +1 -1
- package/dist/env-D1rcZ8_r.d.mts.map +1 -0
- package/dist/errors/index.d.mts +1 -1
- package/dist/errors/index.mjs +1 -1
- package/dist/{errors-B4pYgYON.mjs → errors-COW9-Mar.mjs} +35 -10
- package/dist/errors-COW9-Mar.mjs.map +1 -0
- package/dist/{errors-BUyUfr2Z.mjs → errors-ORxu1-Bb.mjs} +2 -2
- package/dist/{errors-BUyUfr2Z.mjs.map → errors-ORxu1-Bb.mjs.map} +1 -1
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.mjs +1 -1
- package/dist/{events-COKixqnG.mjs → events-CzCV8jI8.mjs} +4 -2
- package/dist/{events-COKixqnG.mjs.map → events-CzCV8jI8.mjs.map} +1 -1
- package/dist/{gateway-context-cqZ8wMoi.mjs → gateway-context-CXmXtaUP.mjs} +5 -8
- package/dist/{gateway-context-cqZ8wMoi.mjs.map → gateway-context-CXmXtaUP.mjs.map} +1 -1
- package/dist/guards/index.d.mts +3 -3
- package/dist/guards/index.mjs +1 -1
- package/dist/{guards-DMbsAxSX.mjs → guards-DU1_J9YA.mjs} +2 -1
- package/dist/{guards-DMbsAxSX.mjs.map → guards-DU1_J9YA.mjs.map} +1 -1
- package/dist/{http-method.decorator-BT3ufnz8.mjs → http-method.decorator-BrgHMdLQ.mjs} +3 -3
- package/dist/{http-method.decorator-BT3ufnz8.mjs.map → http-method.decorator-BrgHMdLQ.mjs.map} +1 -1
- package/dist/i18n/index.d.mts +2 -2
- package/dist/i18n/index.mjs +2 -2
- package/dist/i18n/messages/en/index.d.mts +1 -1
- package/dist/i18n/messages/en/index.mjs +1 -1
- package/dist/i18n/utils/index.mjs +1 -1
- package/dist/i18n/validation/index.d.mts +2 -2
- package/dist/i18n/validation/index.mjs +2 -2
- package/dist/{i18n.module-CI_prYFD.mjs → i18n.module-CzXLW9Hy.mjs} +242 -50
- package/dist/i18n.module-CzXLW9Hy.mjs.map +1 -0
- package/dist/{index-SHx31sBJ.d.mts → index-7-hU3GTV.d.mts} +1 -1
- package/dist/{index-SHx31sBJ.d.mts.map → index-7-hU3GTV.d.mts.map} +1 -1
- package/dist/{index-B437eK7p.d.mts → index-Bnpfq6uk.d.mts} +58 -10
- package/dist/index-Bnpfq6uk.d.mts.map +1 -0
- package/dist/{index-DPFqRs8L.d.mts → index-ByOyTmqf.d.mts} +317 -205
- package/dist/index-ByOyTmqf.d.mts.map +1 -0
- package/dist/{index-DFhEeFfC.d.mts → index-C1KvMncZ.d.mts} +7 -1
- package/dist/{index-DFhEeFfC.d.mts.map → index-C1KvMncZ.d.mts.map} +1 -1
- package/dist/{index-CWRS7Ri3.d.mts → index-DBd_2wv8.d.mts} +1 -1
- package/dist/{index-CWRS7Ri3.d.mts.map → index-DBd_2wv8.d.mts.map} +1 -1
- package/dist/{index-Dnqm9ZB6.d.mts → index-DUzWs0z7.d.mts} +5 -5
- package/dist/{index-Dnqm9ZB6.d.mts.map → index-DUzWs0z7.d.mts.map} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/is-command-C6a7WTPw.mjs.map +1 -1
- package/dist/is-seeder-CebjZCDn.mjs.map +1 -1
- package/dist/logger/index.d.mts +1 -1
- package/dist/logger/index.mjs +1 -1
- package/dist/{logger-V6Ms3QnQ.mjs → logger-DlV7NtvD.mjs} +8 -4
- package/dist/{logger-V6Ms3QnQ.mjs.map → logger-DlV7NtvD.mjs.map} +1 -1
- package/dist/macroable/index.d.mts +1 -1
- package/dist/macroable-BmufBshB.mjs.map +1 -1
- package/dist/module/index.d.mts +2 -2
- package/dist/module/index.mjs +1 -1
- package/dist/{module-qGE_1duv.mjs → module-BzLg57FK.mjs} +139 -5
- package/dist/module-BzLg57FK.mjs.map +1 -0
- package/dist/openapi/index.d.mts +3 -3
- package/dist/openapi/index.mjs +2 -2
- package/dist/{openapi-tools.service-CYWGuhue.mjs → openapi-tools.service-Zs-Ewv7F.mjs} +1 -1
- package/dist/{openapi-tools.service-CYWGuhue.mjs.map → openapi-tools.service-Zs-Ewv7F.mjs.map} +1 -1
- package/dist/{openapi.service-Bv_NioM9.d.mts → openapi.service-Bt9bCIrd.d.mts} +3 -3
- package/dist/{openapi.service-Bv_NioM9.d.mts.map → openapi.service-Bt9bCIrd.d.mts.map} +1 -1
- package/dist/quarry/index.d.mts +6 -6
- package/dist/quarry/index.mjs +2 -2
- package/dist/{quarry-registry-DFfRRkA7.mjs → quarry-registry-BwY2hOxm.mjs} +18 -7
- package/dist/{quarry-registry-DFfRRkA7.mjs.map → quarry-registry-BwY2hOxm.mjs.map} +1 -1
- package/dist/queue/index.d.mts +2 -2
- package/dist/queue/index.mjs +3 -2
- package/dist/queue/index.mjs.map +1 -1
- package/dist/{queue.module-P-G-nCYz.mjs → queue.module-BhCjZp6H.mjs} +13 -4
- package/dist/{queue.module-P-G-nCYz.mjs.map → queue.module-BhCjZp6H.mjs.map} +1 -1
- package/dist/{r2-storage.provider-LdzK9tfG.mjs → r2-storage.provider-DuonKeYm.mjs} +6 -3
- package/dist/{r2-storage.provider-LdzK9tfG.mjs.map → r2-storage.provider-DuonKeYm.mjs.map} +1 -1
- package/dist/rate-limit.decorator-6qzNcSOt.mjs +55 -0
- package/dist/rate-limit.decorator-6qzNcSOt.mjs.map +1 -0
- package/dist/rate-limiter/index.d.mts +420 -0
- package/dist/rate-limiter/index.d.mts.map +1 -0
- package/dist/rate-limiter/index.mjs +374 -0
- package/dist/rate-limiter/index.mjs.map +1 -0
- package/dist/{resend.provider-bwILp0WI.mjs → resend.provider-DB4IlFjG.mjs} +3 -2
- package/dist/{resend.provider-bwILp0WI.mjs.map → resend.provider-DB4IlFjG.mjs.map} +1 -1
- package/dist/router/index.d.mts +2 -2
- package/dist/router/index.mjs +6 -6
- package/dist/seeder/index.d.mts +3 -3
- package/dist/seeder/index.mjs +1 -1
- package/dist/{seeder-BcqIFa2X.mjs → seeder-zoEfEw9i.mjs} +6 -3
- package/dist/{seeder-BcqIFa2X.mjs.map → seeder-zoEfEw9i.mjs.map} +1 -1
- package/dist/{setup-CtekcwuO.mjs → setup-CefZKV_e.mjs} +1 -1
- package/dist/{setup-CtekcwuO.mjs.map → setup-CefZKV_e.mjs.map} +1 -1
- package/dist/{signed-url-COX7cCWR.mjs → signed-url-BQPbv2In.mjs} +1 -1
- package/dist/{signed-url-COX7cCWR.mjs.map → signed-url-BQPbv2In.mjs.map} +1 -1
- package/dist/{smtp.provider-B07yuARi.mjs → smtp.provider-B6D7zuWX.mjs} +3 -2
- package/dist/{smtp.provider-B07yuARi.mjs.map → smtp.provider-B6D7zuWX.mjs.map} +1 -1
- package/dist/storage/index.d.mts +3 -3
- package/dist/storage/index.mjs +2 -2
- package/dist/storage/providers/index.d.mts +2 -2
- package/dist/storage/providers/index.mjs +1 -1
- package/dist/{storage-P6X4h9So.mjs → storage-D8CBP72Z.mjs} +14 -9
- package/dist/{storage-P6X4h9So.mjs.map → storage-D8CBP72Z.mjs.map} +1 -1
- package/dist/{storage-provider.interface-CC1nniHk.d.mts → storage-provider.interface-Bd6vA4ak.d.mts} +2 -2
- package/dist/{storage-provider.interface-CC1nniHk.d.mts.map → storage-provider.interface-Bd6vA4ak.d.mts.map} +1 -1
- package/dist/{stratal-BCiwCFN9.mjs → stratal-CNwpbSZl.mjs} +12 -10
- package/dist/stratal-CNwpbSZl.mjs.map +1 -0
- package/dist/{types-DIWemRad.d.mts → types-cySNS_lp.d.mts} +1 -1
- package/dist/types-cySNS_lp.d.mts.map +1 -0
- package/dist/{usage-generator-MBcRo0Q2.mjs → usage-generator-BUdlhnCK.mjs} +1 -1
- package/dist/{usage-generator-MBcRo0Q2.mjs.map → usage-generator-BUdlhnCK.mjs.map} +1 -1
- package/dist/{validation-Dbg3ehdP.mjs → validation-DtJwAv7O.mjs} +62 -8
- package/dist/validation-DtJwAv7O.mjs.map +1 -0
- package/dist/websocket/index.d.mts +8 -3
- package/dist/websocket/index.d.mts.map +1 -1
- package/dist/websocket/index.mjs +1 -1
- package/dist/workers/index.d.mts +2 -2
- package/dist/workers/index.mjs +2 -2
- package/dist/workers/index.mjs.map +1 -1
- package/package.json +18 -14
- package/dist/cron-manager-C30t9UZM.mjs.map +0 -1
- package/dist/cron-manager-RuPtFVLy.d.mts.map +0 -1
- package/dist/en-rHmW6vD9.mjs.map +0 -1
- package/dist/env-CamWD-U1.d.mts.map +0 -1
- package/dist/errors-B4pYgYON.mjs.map +0 -1
- package/dist/i18n.module-CI_prYFD.mjs.map +0 -1
- package/dist/index-B437eK7p.d.mts.map +0 -1
- package/dist/index-DPFqRs8L.d.mts.map +0 -1
- package/dist/module-qGE_1duv.mjs.map +0 -1
- package/dist/stratal-BCiwCFN9.mjs.map +0 -1
- package/dist/types-DIWemRad.d.mts.map +0 -1
- package/dist/validation-Dbg3ehdP.mjs.map +0 -1
package/dist/{http-method.decorator-BT3ufnz8.mjs.map → http-method.decorator-BrgHMdLQ.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-method.decorator-
|
|
1
|
+
{"version":3,"file":"http-method.decorator-BrgHMdLQ.mjs","names":[],"sources":["../src/router/decorators/http-method.decorator.ts"],"sourcesContent":["import { z } from '../../i18n/validation'\nimport { ROUTE_METADATA_KEYS } from '../constants'\nimport type { ExplicitRouteMetadata, HttpMethod, RouteConfig } from '../types'\n\n/**\n * Creates an HTTP method decorator factory for the given HTTP method.\n *\n * The returned decorator stores {@link ExplicitRouteMetadata} on the method and\n * tracks the method name under {@link ROUTE_METADATA_KEYS.DECORATED_METHODS}\n * on the controller prototype so they can be discovered at registration time.\n */\nfunction createHttpMethodDecorator(method: HttpMethod) {\n return function (path: string, config?: RouteConfig) {\n return function (\n target: object,\n propertyKey: string,\n descriptor: PropertyDescriptor\n ) {\n const metadata: ExplicitRouteMetadata = {\n type: 'explicit',\n method,\n path,\n config: config ?? { response: z.any() },\n }\n\n Reflect.defineMetadata(\n ROUTE_METADATA_KEYS.ROUTE_CONFIG,\n metadata,\n target,\n propertyKey\n )\n\n // Track this method as decorated on the prototype\n const existing: string[] =\n (Reflect.getOwnMetadata(ROUTE_METADATA_KEYS.DECORATED_METHODS, target) as string[] | undefined) ?? []\n existing.push(propertyKey)\n Reflect.defineMetadata(ROUTE_METADATA_KEYS.DECORATED_METHODS, existing, target)\n\n return descriptor\n }\n }\n}\n\n/**\n * Registers a GET route on the controller method.\n *\n * @param path - Route path relative to the controller base path\n * @param config - Optional route configuration (response schema, body, params, etc.)\n *\n * @example\n * ```typescript\n * @Controller('/api/v1/users')\n * class UsersController {\n * @Get('/', { response: z.array(userSchema), summary: 'List users' })\n * async list(ctx: RouterContext) { ... }\n *\n * @Get('/:id', { params: z.object({ id: z.string().uuid() }), response: userSchema })\n * async getUser(ctx: RouterContext) { ... }\n * }\n * ```\n */\nexport const Get = createHttpMethodDecorator('get')\n\n/**\n * Registers a POST route on the controller method.\n *\n * @param path - Route path relative to the controller base path\n * @param config - Optional route configuration (response schema, body, params, etc.)\n *\n * @example\n * ```typescript\n * @Controller('/api/v1/users')\n * class UsersController {\n * @Post('/', { body: createUserSchema, response: userSchema, statusCode: 201 })\n * async createUser(ctx: RouterContext) { ... }\n * }\n * ```\n */\nexport const Post = createHttpMethodDecorator('post')\n\n/**\n * Registers a PUT route on the controller method.\n *\n * @param path - Route path relative to the controller base path\n * @param config - Optional route configuration\n */\nexport const Put = createHttpMethodDecorator('put')\n\n/**\n * Registers a PATCH route on the controller method.\n *\n * @param path - Route path relative to the controller base path\n * @param config - Optional route configuration\n */\nexport const Patch = createHttpMethodDecorator('patch')\n\n/**\n * Registers a DELETE route on the controller method.\n *\n * @param path - Route path relative to the controller base path\n * @param config - Optional route configuration\n */\nexport const Delete = createHttpMethodDecorator('delete')\n\n/**\n * Registers an ALL (any HTTP method) route on the controller method.\n * Routes using @All are registered without OpenAPI validation\n * since OpenAPI does not support a catch-all HTTP method.\n *\n * @param path - Route path relative to the controller base path\n * @param config - Optional route configuration\n */\nexport const All = createHttpMethodDecorator('all')\n"],"mappings":";;;;;;;;;;AAWA,SAAS,0BAA0B,QAAoB;CACrD,OAAO,SAAU,MAAc,QAAsB;EACnD,OAAO,SACL,QACA,aACA,YACA;GACA,MAAM,WAAkC;IACtC,MAAM;IACN;IACA;IACA,QAAQ,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE;IACxC;GAED,QAAQ,eACN,oBAAoB,cACpB,UACA,QACA,YACD;GAGD,MAAM,WACH,QAAQ,eAAe,oBAAoB,mBAAmB,OAAO,IAA6B,EAAE;GACvG,SAAS,KAAK,YAAY;GAC1B,QAAQ,eAAe,oBAAoB,mBAAmB,UAAU,OAAO;GAE/E,OAAO;;;;;;;;;;;;;;;;;;;;;;AAuBb,MAAa,MAAM,0BAA0B,MAAM;;;;;;;;;;;;;;;;AAiBnD,MAAa,OAAO,0BAA0B,OAAO;;;;;;;AAQrD,MAAa,MAAM,0BAA0B,MAAM;;;;;;;AAQnD,MAAa,QAAQ,0BAA0B,QAAQ;;;;;;;AAQvD,MAAa,SAAS,0BAA0B,SAAS;;;;;;;;;AAUzD,MAAa,MAAM,0BAA0B,MAAM"}
|
package/dist/i18n/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as LocaleNotSupportedError, C as DetectionStrategy, D as buildDetectorOptions, E as ResolvedI18nOptions, O as resolveI18nOptions, S as I18nModule, T as LanguageDetectionOptions, _ as Messages, b as messages, g as MessageRegistry, h as MessageLoaderService, k as TranslationMissingError, m as I18nContextMiddleware, v as getLocales, w as I18nModuleOptions, x as I18N_TOKENS, y as getMessages } from "../index-
|
|
2
|
-
import { C as
|
|
1
|
+
import { A as LocaleNotSupportedError, C as DetectionStrategy, D as buildDetectorOptions, E as ResolvedI18nOptions, O as resolveI18nOptions, S as I18nModule, T as LanguageDetectionOptions, _ as Messages, b as messages, g as MessageRegistry, h as MessageLoaderService, k as TranslationMissingError, m as I18nContextMiddleware, v as getLocales, w as I18nModuleOptions, x as I18N_TOKENS, y as getMessages } from "../index-ByOyTmqf.mjs";
|
|
2
|
+
import { C as MessageParams, S as MessageKeys, T as SystemMessageKeys, _ as AppMessageNamespaces, b as II18nService, g as AppMessageKeys, v as AppMessages, w as Prefixes, x as MessageKeyPrefix, y as DeepKeys } from "../index-Bnpfq6uk.mjs";
|
|
3
3
|
export { AppMessageKeys, AppMessageNamespaces, AppMessages, DeepKeys, DetectionStrategy, I18N_TOKENS, I18nContextMiddleware, I18nModule, I18nModuleOptions, II18nService, LanguageDetectionOptions, LocaleNotSupportedError, MessageKeyPrefix, MessageKeys, MessageLoaderService, MessageParams, MessageRegistry, Messages, Prefixes, ResolvedI18nOptions, SystemMessageKeys, TranslationMissingError, buildDetectorOptions, getLocales, getMessages, messages, resolveI18nOptions };
|
package/dist/i18n/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { w as I18N_TOKENS } from "../errors-
|
|
2
|
-
import { B as LocaleNotSupportedError, F as getMessages, H as I18nContextMiddleware, I as messages, L as buildDetectorOptions, M as MessageRegistry, N as MessageLoaderService, P as getLocales, R as resolveI18nOptions, t as I18nModule, z as TranslationMissingError } from "../i18n.module-
|
|
1
|
+
import { w as I18N_TOKENS } from "../errors-COW9-Mar.mjs";
|
|
2
|
+
import { B as LocaleNotSupportedError, F as getMessages, H as I18nContextMiddleware, I as messages, L as buildDetectorOptions, M as MessageRegistry, N as MessageLoaderService, P as getLocales, R as resolveI18nOptions, t as I18nModule, z as TranslationMissingError } from "../i18n.module-CzXLW9Hy.mjs";
|
|
3
3
|
export { I18N_TOKENS, I18nContextMiddleware, I18nModule, LocaleNotSupportedError, MessageLoaderService, MessageRegistry, TranslationMissingError, buildDetectorOptions, getLocales, getMessages, messages, resolveI18nOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as errors, i as emails, n as zodI18n, o as common, r as validation } from "../../../index-
|
|
1
|
+
import { a as errors, i as emails, n as zodI18n, o as common, r as validation } from "../../../index-C1KvMncZ.mjs";
|
|
2
2
|
export { common, emails, errors, validation, zodI18n };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as errors, i as emails, n as zodI18n, o as common, r as validation } from "../../../en-
|
|
1
|
+
import { a as errors, i as emails, n as zodI18n, o as common, r as validation } from "../../../en-DSH_bhh6.mjs";
|
|
2
2
|
export { common, emails, errors, validation, zodI18n };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as setupI18nCompiler } from "../../setup-
|
|
1
|
+
import { t as setupI18nCompiler } from "../../setup-CefZKV_e.mjs";
|
|
2
2
|
export { setupI18nCompiler };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as runWithErrorMapContext, d as LocaleProvider, f as ZodCustomIssue, i as ZodError, l as ErrorMapContext, n as OpenAPIObject, o as z, p as
|
|
1
|
+
import { c as runWithErrorMapContext, d as LocaleProvider, f as ZodCustomIssue, h as withI18n, i as ZodError, l as ErrorMapContext, m as cuid2, n as OpenAPIObject, o as z, p as CUID2_REGEX, r as PathItemObject, s as backendErrorMap, t as OpenAPIHono, u as I18nErrorMetadata } from "../../index-Bnpfq6uk.mjs";
|
|
2
2
|
export * from "@hono/zod-openapi";
|
|
3
3
|
export * from "zod";
|
|
4
|
-
export { ErrorMapContext, I18nErrorMetadata, LocaleProvider, OpenAPIHono, OpenAPIObject, PathItemObject, ZodCustomIssue, ZodError, backendErrorMap, runWithErrorMapContext, withI18n, z };
|
|
4
|
+
export { CUID2_REGEX, ErrorMapContext, I18nErrorMetadata, LocaleProvider, OpenAPIHono, OpenAPIObject, PathItemObject, ZodCustomIssue, ZodError, backendErrorMap, cuid2, runWithErrorMapContext, withI18n, z };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as CUID2_REGEX, c as backendErrorMap, i as z, l as runWithErrorMapContext, n as ZodError, o as cuid2, s as withI18n, t as OpenAPIHono } from "../../validation-DtJwAv7O.mjs";
|
|
2
2
|
export * from "@hono/zod-openapi";
|
|
3
|
-
export { OpenAPIHono, ZodError, backendErrorMap, runWithErrorMapContext, withI18n, z };
|
|
3
|
+
export { CUID2_REGEX, OpenAPIHono, ZodError, backendErrorMap, cuid2, runWithErrorMapContext, withI18n, z };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { A as Scope, D as runWithContainer, E as getContainer, H as ApplicationError, V as ROUTER_TOKENS, a as createHttpExceptionContext, c as DEFAULT_CONTENT_TYPE, d as ROUTER_CONTEXT_KEYS, f as ROUTE_METADATA_KEYS, k as ERROR_CODES, l as HTTP_METHODS, m as VERSION_NEUTRAL, p as SECURITY_SCHEMES, s as RouterContext, u as METHOD_STATUS_CODES, w as I18N_TOKENS } from "./errors-
|
|
2
|
-
import { a as __decorate, d as CONTAINER_TOKEN, f as DI_TOKENS, g as getMethodInjections, o as __decorateParam, p as Transient, s as __decorateMetadata, u as LOGGER_TOKENS } from "./logger-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as OPENAPI_TOKENS } from "./openapi-tools.service-
|
|
6
|
-
import { t as en_exports } from "./en-
|
|
7
|
-
import { i as getMethodGuards, r as getControllerGuards, t as GuardExecutionService } from "./guards-
|
|
8
|
-
import { n as getControllerOptions, r as getControllerRoute } from "./controller.decorator-
|
|
9
|
-
import { c as getWsOnMessageMethod, d as isGateway, o as getWsOnCloseMethod, s as getWsOnErrorMethod, t as GatewayContext } from "./gateway-context-
|
|
10
|
-
import "./http-method.decorator-
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
1
|
+
import { A as Scope, D as runWithContainer, E as getContainer, H as ApplicationError, V as ROUTER_TOKENS, a as createHttpExceptionContext, c as DEFAULT_CONTENT_TYPE, d as ROUTER_CONTEXT_KEYS, f as ROUTE_METADATA_KEYS, k as ERROR_CODES, l as HTTP_METHODS, m as VERSION_NEUTRAL, p as SECURITY_SCHEMES, s as RouterContext, u as METHOD_STATUS_CODES, w as I18N_TOKENS } from "./errors-COW9-Mar.mjs";
|
|
2
|
+
import { a as __decorate, d as CONTAINER_TOKEN, f as DI_TOKENS, g as getMethodInjections, o as __decorateParam, p as Transient, s as __decorateMetadata, u as LOGGER_TOKENS } from "./logger-DlV7NtvD.mjs";
|
|
3
|
+
import { S as createThrottleMiddleware, b as ControllerRegistrationError, c as InvalidSignatureError, d as MissingRouteParamError, f as ResponseValidationError, g as RouteNotFoundError, h as SchemaValidationError, k as Module, l as MiddlewareNextCalledMultipleTimesError, o as DomainMismatchError, p as RouteNameNotFoundError, s as DuplicateRouteNameError, u as MissingEnvironmentVariableError, v as OpenAPIRouteRegistrationError, x as ControllerMethodNotFoundError, y as HonoAppAlreadyConfiguredError } from "./module-BzLg57FK.mjs";
|
|
4
|
+
import { c as backendErrorMap, i as z, l as runWithErrorMapContext, r as validation_exports, t as OpenAPIHono } from "./validation-DtJwAv7O.mjs";
|
|
5
|
+
import { n as OPENAPI_TOKENS } from "./openapi-tools.service-Zs-Ewv7F.mjs";
|
|
6
|
+
import { t as en_exports } from "./en-DSH_bhh6.mjs";
|
|
7
|
+
import { i as getMethodGuards, r as getControllerGuards, t as GuardExecutionService } from "./guards-DU1_J9YA.mjs";
|
|
8
|
+
import { n as getControllerOptions, r as getControllerRoute } from "./controller.decorator-B9vwn0zK.mjs";
|
|
9
|
+
import { c as getWsOnMessageMethod, d as isGateway, o as getWsOnCloseMethod, s as getWsOnErrorMethod, t as GatewayContext } from "./gateway-context-CXmXtaUP.mjs";
|
|
10
|
+
import "./http-method.decorator-BrgHMdLQ.mjs";
|
|
11
|
+
import { n as getRateLimits } from "./rate-limit.decorator-6qzNcSOt.mjs";
|
|
12
|
+
import { n as verifySignedUrl, t as signUrl } from "./signed-url-BQPbv2In.mjs";
|
|
13
|
+
import { t as setupI18nCompiler } from "./setup-CefZKV_e.mjs";
|
|
13
14
|
import { inject } from "tsyringe";
|
|
14
15
|
import { createCoreContext, translate } from "@intlify/core-base";
|
|
15
16
|
import { swaggerUI } from "@hono/swagger-ui";
|
|
@@ -22,6 +23,7 @@ import { languageDetector } from "hono/language";
|
|
|
22
23
|
* Must run after LocaleExtractionMiddleware sets the locale.
|
|
23
24
|
*/
|
|
24
25
|
let I18nContextMiddleware = class I18nContextMiddleware {
|
|
26
|
+
i18n;
|
|
25
27
|
constructor(i18n) {
|
|
26
28
|
this.i18n = i18n;
|
|
27
29
|
}
|
|
@@ -40,6 +42,7 @@ I18nContextMiddleware = __decorate([
|
|
|
40
42
|
//#endregion
|
|
41
43
|
//#region src/openapi/services/openapi-config.service.ts
|
|
42
44
|
let OpenAPIConfigService = class OpenAPIConfigService {
|
|
45
|
+
baseOptions;
|
|
43
46
|
overrides = [];
|
|
44
47
|
constructor(baseOptions) {
|
|
45
48
|
this.baseOptions = baseOptions;
|
|
@@ -209,6 +212,8 @@ function deepMerge(target, source) {
|
|
|
209
212
|
//#endregion
|
|
210
213
|
//#region src/i18n/services/message-loader.service.ts
|
|
211
214
|
let MessageLoaderService = class MessageLoaderService {
|
|
215
|
+
registry;
|
|
216
|
+
options;
|
|
212
217
|
cache;
|
|
213
218
|
contextCache;
|
|
214
219
|
locales;
|
|
@@ -730,6 +735,67 @@ function createMiddlewareChain(classes) {
|
|
|
730
735
|
};
|
|
731
736
|
}
|
|
732
737
|
//#endregion
|
|
738
|
+
//#region src/router/trailing-slash.ts
|
|
739
|
+
/**
|
|
740
|
+
* Apply a trailing-slash mode to a URL or path.
|
|
741
|
+
*
|
|
742
|
+
* - `'ignore'` — return as-is.
|
|
743
|
+
* - `'always'` — append `/` to the pathname unless it already has one.
|
|
744
|
+
* Skipped when the last segment contains `.` (file-like paths) and for the
|
|
745
|
+
* root `/` path.
|
|
746
|
+
* - `'never'` — strip a trailing `/` from the pathname. Skipped for root.
|
|
747
|
+
*
|
|
748
|
+
* Preserves query string and hash. Handles both relative paths
|
|
749
|
+
* (`/foo?x=1`) and absolute URLs (`https://host/foo?x=1`).
|
|
750
|
+
*
|
|
751
|
+
* Used by URL-generation helpers and the redirect middleware so canonical
|
|
752
|
+
* form is computed in one place.
|
|
753
|
+
*/
|
|
754
|
+
function applyTrailingSlash(url, mode) {
|
|
755
|
+
if (mode === "ignore") return url;
|
|
756
|
+
const isAbsolute = /^https?:\/\//i.test(url);
|
|
757
|
+
const parsed = isAbsolute ? new URL(url) : new URL(url, "http://placeholder.local");
|
|
758
|
+
const path = parsed.pathname;
|
|
759
|
+
if (path === "/") return url;
|
|
760
|
+
const hasTrailing = path.endsWith("/");
|
|
761
|
+
if (mode === "always" && !hasTrailing) {
|
|
762
|
+
if (path.slice(path.lastIndexOf("/") + 1).includes(".")) return url;
|
|
763
|
+
parsed.pathname = `${path}/`;
|
|
764
|
+
} else if (mode === "never" && hasTrailing) parsed.pathname = path.slice(0, -1);
|
|
765
|
+
else return url;
|
|
766
|
+
return isAbsolute ? parsed.toString() : `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
767
|
+
}
|
|
768
|
+
//#endregion
|
|
769
|
+
//#region src/router/middleware/trailing-slash-redirect.ts
|
|
770
|
+
const REDIRECT_STATUS = 308;
|
|
771
|
+
/**
|
|
772
|
+
* Create a Hono middleware that canonicalises trailing slashes via 308 redirects.
|
|
773
|
+
*
|
|
774
|
+
* - `'ignore'` — returns `null`; routes match both `/foo` and `/foo/` natively
|
|
775
|
+
* (Hono handles this when constructed with `strict: false`).
|
|
776
|
+
* - `'always'` — non-trailing requests redirect to the trailing-slash form.
|
|
777
|
+
* Paths whose last segment contains `.` (e.g. `/api/openapi.json`) are skipped.
|
|
778
|
+
* - `'never'` — trailing requests redirect to the non-trailing form.
|
|
779
|
+
*
|
|
780
|
+
* Root (`/`) is always passed through unchanged.
|
|
781
|
+
*
|
|
782
|
+
* 308 is used so that POST/PUT/PATCH bodies survive the redirect.
|
|
783
|
+
*
|
|
784
|
+
* Location headers are emitted as path-relative URIs so the user agent
|
|
785
|
+
* resolves them against the effective request URI — sidestepping scheme
|
|
786
|
+
* mismatches behind HTTPS-terminating proxies that proxy HTTPS pages to an
|
|
787
|
+
* HTTP-speaking backend (which would otherwise produce a mixed-content block).
|
|
788
|
+
*/
|
|
789
|
+
function createTrailingSlashRedirect(mode) {
|
|
790
|
+
if (mode === "ignore") return null;
|
|
791
|
+
return async (c, next) => {
|
|
792
|
+
const url = new URL(c.req.url);
|
|
793
|
+
const canonicalPath = applyTrailingSlash(url.pathname, mode);
|
|
794
|
+
if (canonicalPath === url.pathname) return next();
|
|
795
|
+
return c.redirect(`${canonicalPath}${url.search}`, REDIRECT_STATUS);
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
//#endregion
|
|
733
799
|
//#region src/router/decorators/route.decorator.ts
|
|
734
800
|
/**
|
|
735
801
|
* Decorator to add OpenAPI metadata to a controller method using convention-based routing.
|
|
@@ -988,10 +1054,34 @@ function toRoutingOpenAPIPath(path) {
|
|
|
988
1054
|
* Scoring: static = 0, `:param{constraint}` = 5, `:param` = 10, wildcard `{.+}` / `{.*}` = 100.
|
|
989
1055
|
*
|
|
990
1056
|
* Packed as: score * 10000 - segmentCount (negative segment count so more segments = lower key = higher priority)
|
|
1057
|
+
*
|
|
1058
|
+
* Locale variants score against the path with the leading `/:locale{…}` segment
|
|
1059
|
+
* stripped — the variant's score therefore matches its primary, but its larger
|
|
1060
|
+
* segment count makes it sort just before the primary. Without this, a primary
|
|
1061
|
+
* catch-all (e.g. `/:slug{.+}`) gobbles locale-prefixed URLs because Hono picks
|
|
1062
|
+
* whichever matching route was registered first.
|
|
991
1063
|
*/
|
|
992
|
-
function getPathSpecificityKey(
|
|
1064
|
+
function getPathSpecificityKey(route) {
|
|
1065
|
+
const segmentCount = countSegments(route.path);
|
|
1066
|
+
const scoringPath = route.isLocaleVariant ? route.path.replace(/^\/:locale\{[^}]*\}/, "") || "/" : route.path;
|
|
993
1067
|
let score = 0;
|
|
994
|
-
let
|
|
1068
|
+
let i = 0;
|
|
1069
|
+
while (i < scoringPath.length) {
|
|
1070
|
+
if (scoringPath.charCodeAt(i) === 47) {
|
|
1071
|
+
i++;
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
let end = scoringPath.indexOf("/", i);
|
|
1075
|
+
if (end === -1) end = scoringPath.length;
|
|
1076
|
+
const segment = scoringPath.substring(i, end);
|
|
1077
|
+
if (segment.includes("{.+}") || segment.includes("{.*}")) score += 100;
|
|
1078
|
+
else if (segment.charCodeAt(0) === 58) score += segment.includes("{") ? 5 : 10;
|
|
1079
|
+
i = end;
|
|
1080
|
+
}
|
|
1081
|
+
return score * 1e4 - segmentCount;
|
|
1082
|
+
}
|
|
1083
|
+
function countSegments(path) {
|
|
1084
|
+
let count = 0;
|
|
995
1085
|
let i = 0;
|
|
996
1086
|
while (i < path.length) {
|
|
997
1087
|
if (path.charCodeAt(i) === 47) {
|
|
@@ -1000,13 +1090,10 @@ function getPathSpecificityKey(path) {
|
|
|
1000
1090
|
}
|
|
1001
1091
|
let end = path.indexOf("/", i);
|
|
1002
1092
|
if (end === -1) end = path.length;
|
|
1003
|
-
|
|
1004
|
-
const segment = path.substring(i, end);
|
|
1005
|
-
if (segment.includes("{.+}") || segment.includes("{.*}")) score += 100;
|
|
1006
|
-
else if (segment.charCodeAt(0) === 58) score += segment.includes("{") ? 5 : 10;
|
|
1093
|
+
count++;
|
|
1007
1094
|
i = end;
|
|
1008
1095
|
}
|
|
1009
|
-
return
|
|
1096
|
+
return count;
|
|
1010
1097
|
}
|
|
1011
1098
|
/**
|
|
1012
1099
|
* Compute a specificity score for route ordering.
|
|
@@ -1027,11 +1114,13 @@ function getPathSpecificityScore(path) {
|
|
|
1027
1114
|
*
|
|
1028
1115
|
* 1. Static paths before parameterized before wildcards
|
|
1029
1116
|
* 2. More segments = more specific (tie-breaker)
|
|
1030
|
-
* 3.
|
|
1117
|
+
* 3. Locale-prefixed variants before their primary (so a locale-prefixed
|
|
1118
|
+
* request matches the variant first; a primary catch-all would otherwise
|
|
1119
|
+
* swallow the locale prefix into its param)
|
|
1031
1120
|
*/
|
|
1032
1121
|
function sortRoutesBySpecificity(routes) {
|
|
1033
1122
|
const keys = /* @__PURE__ */ new Map();
|
|
1034
|
-
for (const route of routes) keys.set(route, getPathSpecificityKey(route
|
|
1123
|
+
for (const route of routes) keys.set(route, getPathSpecificityKey(route));
|
|
1035
1124
|
const copy = routes.slice();
|
|
1036
1125
|
copy.sort((a, b) => keys.get(a) - keys.get(b));
|
|
1037
1126
|
return copy;
|
|
@@ -1099,6 +1188,12 @@ const invokeHandler = (instance, method, ...args) => {
|
|
|
1099
1188
|
}
|
|
1100
1189
|
};
|
|
1101
1190
|
let RouteRegistrationService = class RouteRegistrationService {
|
|
1191
|
+
logger;
|
|
1192
|
+
registry;
|
|
1193
|
+
routerResolver;
|
|
1194
|
+
localePathService;
|
|
1195
|
+
app;
|
|
1196
|
+
moduleRegistry;
|
|
1102
1197
|
controllerClasses = /* @__PURE__ */ new Map();
|
|
1103
1198
|
upgradeWebSocketFn = null;
|
|
1104
1199
|
constructor(logger, registry, routerResolver, localePathService, app, moduleRegistry) {
|
|
@@ -1138,10 +1233,12 @@ let RouteRegistrationService = class RouteRegistrationService {
|
|
|
1138
1233
|
const controllerOpts = getControllerOptions(ControllerClass);
|
|
1139
1234
|
const controllerGuards = getControllerGuards(ControllerClass)?.guards ?? [];
|
|
1140
1235
|
const routerConfig = this.routerResolver?.resolveForController(ControllerClass) ?? { middleware: [] };
|
|
1236
|
+
const classThrottleMiddleware = Array.from(new Set(getRateLimits(ControllerClass).map(createThrottleMiddleware)));
|
|
1141
1237
|
const basePath = routerConfig.prefix ? this.joinPaths(routerConfig.prefix, controllerRoute) : controllerRoute;
|
|
1142
1238
|
const effectiveVersion = controllerOpts?.version ?? routerConfig.version;
|
|
1143
1239
|
const effectiveDomain = controllerOpts?.domain ?? routerConfig.domain;
|
|
1144
1240
|
if (isWsGateway) {
|
|
1241
|
+
const wsMiddleware = [...routerConfig.middleware, ...classThrottleMiddleware];
|
|
1145
1242
|
const expandedRoutes = this.registry.register({
|
|
1146
1243
|
method: "ws",
|
|
1147
1244
|
basePath,
|
|
@@ -1150,10 +1247,10 @@ let RouteRegistrationService = class RouteRegistrationService {
|
|
|
1150
1247
|
controller: ControllerClass.name,
|
|
1151
1248
|
action: "ws",
|
|
1152
1249
|
hidden: routerConfig.hideFromDocs ?? false,
|
|
1153
|
-
middleware:
|
|
1250
|
+
middleware: wsMiddleware.map((m) => m.name)
|
|
1154
1251
|
});
|
|
1155
1252
|
for (const route of expandedRoutes) actions.set(route, () => {
|
|
1156
|
-
if (
|
|
1253
|
+
if (wsMiddleware.length > 0) this.app.use(route.path, createMiddlewareChain(wsMiddleware));
|
|
1157
1254
|
if (effectiveDomain) {
|
|
1158
1255
|
const domainHandler = createDomainMiddleware(effectiveDomain);
|
|
1159
1256
|
this.app.use(route.path, domainHandler);
|
|
@@ -1167,6 +1264,7 @@ let RouteRegistrationService = class RouteRegistrationService {
|
|
|
1167
1264
|
this.controllerClasses.set(className, ControllerClass);
|
|
1168
1265
|
const prototype = ControllerClass.prototype;
|
|
1169
1266
|
if (prototype.handle) {
|
|
1267
|
+
const wildcardMiddleware = [...routerConfig.middleware, ...classThrottleMiddleware];
|
|
1170
1268
|
const expandedRoutes = this.registry.register({
|
|
1171
1269
|
method: "all",
|
|
1172
1270
|
basePath,
|
|
@@ -1175,10 +1273,10 @@ let RouteRegistrationService = class RouteRegistrationService {
|
|
|
1175
1273
|
controller: className,
|
|
1176
1274
|
action: "handle",
|
|
1177
1275
|
hidden: routerConfig.hideFromDocs ?? false,
|
|
1178
|
-
middleware:
|
|
1276
|
+
middleware: wildcardMiddleware.map((m) => m.name)
|
|
1179
1277
|
});
|
|
1180
1278
|
for (const route of expandedRoutes) actions.set(route, () => {
|
|
1181
|
-
if (
|
|
1279
|
+
if (wildcardMiddleware.length > 0) this.app.use(route.path, createMiddlewareChain(wildcardMiddleware));
|
|
1182
1280
|
this.registerWildcardRoute(ControllerClass, route.path);
|
|
1183
1281
|
});
|
|
1184
1282
|
return;
|
|
@@ -1204,12 +1302,26 @@ let RouteRegistrationService = class RouteRegistrationService {
|
|
|
1204
1302
|
const routerName = routerConfig.name;
|
|
1205
1303
|
const controllerName = controllerOpts?.name;
|
|
1206
1304
|
const effectiveNamePrefix = routerName && controllerName ? `${routerName}${controllerName}` : routerName ?? controllerName;
|
|
1207
|
-
const middlewareNames = routerConfig.middleware.map((m) => m.name);
|
|
1208
1305
|
for (const { method: methodName, meta } of methodMetadata) {
|
|
1209
1306
|
const resolved = this.resolveMethodAndPath(meta, methodName, basePath, className);
|
|
1210
1307
|
if (!resolved) continue;
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1308
|
+
const methodThrottleMiddleware = getRateLimits(prototype, methodName).map(createThrottleMiddleware);
|
|
1309
|
+
const effectiveMiddleware = Array.from(new Set([
|
|
1310
|
+
...routerConfig.middleware,
|
|
1311
|
+
...classThrottleMiddleware,
|
|
1312
|
+
...methodThrottleMiddleware
|
|
1313
|
+
]));
|
|
1314
|
+
const middlewareNames = effectiveMiddleware.map((m) => m.name);
|
|
1315
|
+
const { httpMethod, fullPath, routeConfig: rawRouteConfig, statusCodeOverride } = resolved;
|
|
1316
|
+
let mergedParams = rawRouteConfig.params;
|
|
1317
|
+
if (routerConfig.params) {
|
|
1318
|
+
const prefixShape = routerConfig.params.shape;
|
|
1319
|
+
mergedParams = mergedParams ? mergedParams.extend(prefixShape) : routerConfig.params.extend({});
|
|
1320
|
+
}
|
|
1321
|
+
const routeConfig = mergedParams === rawRouteConfig.params ? rawRouteConfig : {
|
|
1322
|
+
...rawRouteConfig,
|
|
1323
|
+
params: mergedParams
|
|
1324
|
+
};
|
|
1213
1325
|
const hideFromDocs = routeConfig.hideFromDocs ?? routerHidden ?? controllerHidden;
|
|
1214
1326
|
let routeName;
|
|
1215
1327
|
if (routeConfig.name) routeName = effectiveNamePrefix ? `${effectiveNamePrefix}${routeConfig.name}` : routeConfig.name;
|
|
@@ -1251,7 +1363,7 @@ let RouteRegistrationService = class RouteRegistrationService {
|
|
|
1251
1363
|
path: route.path,
|
|
1252
1364
|
methodName
|
|
1253
1365
|
});
|
|
1254
|
-
if (
|
|
1366
|
+
if (effectiveMiddleware.length > 0) this.app.use(route.path, createMiddlewareChain(effectiveMiddleware));
|
|
1255
1367
|
if (allGuards.length > 0) this.app.use(route.path, this.createGuardMiddleware(allGuards));
|
|
1256
1368
|
this.app.all(route.path, handler);
|
|
1257
1369
|
return;
|
|
@@ -1266,7 +1378,7 @@ let RouteRegistrationService = class RouteRegistrationService {
|
|
|
1266
1378
|
tags: metadata.tags,
|
|
1267
1379
|
hidden: route.hidden
|
|
1268
1380
|
});
|
|
1269
|
-
const wrappedHandler = this.wrapHandlerWithChain(handler,
|
|
1381
|
+
const wrappedHandler = this.wrapHandlerWithChain(handler, effectiveMiddleware, allGuards);
|
|
1270
1382
|
this.app.openapi(openApiRoute, wrappedHandler);
|
|
1271
1383
|
if (!route.hidden) {
|
|
1272
1384
|
const { hide: _, ...specRoute } = openApiRoute;
|
|
@@ -1629,12 +1741,16 @@ let HonoApp = class HonoApp extends OpenAPIHono {
|
|
|
1629
1741
|
* Used by private methods to register middleware without going through the override.
|
|
1630
1742
|
*/
|
|
1631
1743
|
nativeUse;
|
|
1632
|
-
constructor(container, logger) {
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1744
|
+
constructor(container, logger, application) {
|
|
1745
|
+
const trailingSlash = application.config.trailingSlash ?? "ignore";
|
|
1746
|
+
super({
|
|
1747
|
+
strict: false,
|
|
1748
|
+
defaultHook: (result, c) => {
|
|
1749
|
+
if (!result.success) throw new SchemaValidationError(result.error);
|
|
1750
|
+
const override = c.get("validationSuccessResponse");
|
|
1751
|
+
if (override) return override;
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1638
1754
|
this._container = container;
|
|
1639
1755
|
this._logger = logger;
|
|
1640
1756
|
this.nativeUse = this.use;
|
|
@@ -1649,6 +1765,8 @@ let HonoApp = class HonoApp extends OpenAPIHono {
|
|
|
1649
1765
|
}
|
|
1650
1766
|
return this.nativeUse(...args);
|
|
1651
1767
|
});
|
|
1768
|
+
const trailingSlashRedirect = createTrailingSlashRedirect(trailingSlash);
|
|
1769
|
+
if (trailingSlashRedirect) this.nativeUse("*", trailingSlashRedirect);
|
|
1652
1770
|
this.setupRequestScope();
|
|
1653
1771
|
this.applyGlobalMiddleware();
|
|
1654
1772
|
}
|
|
@@ -1691,11 +1809,17 @@ HonoApp = __decorate([
|
|
|
1691
1809
|
Transient(),
|
|
1692
1810
|
__decorateParam(0, inject(CONTAINER_TOKEN)),
|
|
1693
1811
|
__decorateParam(1, inject(LOGGER_TOKENS.LoggerService)),
|
|
1694
|
-
|
|
1812
|
+
__decorateParam(2, inject(DI_TOKENS.Application)),
|
|
1813
|
+
__decorateMetadata("design:paramtypes", [
|
|
1814
|
+
Object,
|
|
1815
|
+
Object,
|
|
1816
|
+
Object
|
|
1817
|
+
])
|
|
1695
1818
|
], HonoApp);
|
|
1696
1819
|
//#endregion
|
|
1697
1820
|
//#region src/router/services/locale-path.service.ts
|
|
1698
1821
|
let LocalePathService = class LocalePathService {
|
|
1822
|
+
honoApp;
|
|
1699
1823
|
_config;
|
|
1700
1824
|
_pathDetectionEnabled;
|
|
1701
1825
|
_prefixDefaultLocale;
|
|
@@ -1840,10 +1964,23 @@ VersioningService = __decorate([
|
|
|
1840
1964
|
], VersioningService);
|
|
1841
1965
|
//#endregion
|
|
1842
1966
|
//#region src/router/route-registry.ts
|
|
1967
|
+
const CONCRETE_HTTP_METHODS = [
|
|
1968
|
+
"get",
|
|
1969
|
+
"post",
|
|
1970
|
+
"put",
|
|
1971
|
+
"delete",
|
|
1972
|
+
"patch",
|
|
1973
|
+
"head",
|
|
1974
|
+
"options",
|
|
1975
|
+
"trace"
|
|
1976
|
+
];
|
|
1843
1977
|
let RouteRegistry = class RouteRegistry {
|
|
1978
|
+
versioningService;
|
|
1979
|
+
localePathService;
|
|
1844
1980
|
routes = [];
|
|
1845
1981
|
namedRoutes = /* @__PURE__ */ new Map();
|
|
1846
1982
|
_sortedCache = null;
|
|
1983
|
+
_routeToNameCache = null;
|
|
1847
1984
|
constructor(versioningService, localePathService) {
|
|
1848
1985
|
this.versioningService = versioningService;
|
|
1849
1986
|
this.localePathService = localePathService;
|
|
@@ -1894,6 +2031,7 @@ let RouteRegistry = class RouteRegistry {
|
|
|
1894
2031
|
}
|
|
1895
2032
|
}
|
|
1896
2033
|
this._sortedCache = null;
|
|
2034
|
+
this._routeToNameCache = null;
|
|
1897
2035
|
return expandedRoutes;
|
|
1898
2036
|
}
|
|
1899
2037
|
/** Get a named route by name */
|
|
@@ -1904,7 +2042,26 @@ let RouteRegistry = class RouteRegistry {
|
|
|
1904
2042
|
has(name) {
|
|
1905
2043
|
return this.namedRoutes.has(name);
|
|
1906
2044
|
}
|
|
1907
|
-
/**
|
|
2045
|
+
/**
|
|
2046
|
+
* Resolve a Hono-style route path pattern (e.g. as exposed by `c.req.routePath`)
|
|
2047
|
+
* back to its registered name, scoped to the request's HTTP method. Locale variant
|
|
2048
|
+
* paths resolve to the canonical primary route name. Method matching is
|
|
2049
|
+
* case-insensitive; routes registered with `'all'` resolve under any verb.
|
|
2050
|
+
*/
|
|
2051
|
+
findNameByRoute(method, path) {
|
|
2052
|
+
this._routeToNameCache ??= this.buildRouteToNameCache();
|
|
2053
|
+
return this._routeToNameCache.get(`${method.toLowerCase()}:${path}`);
|
|
2054
|
+
}
|
|
2055
|
+
buildRouteToNameCache() {
|
|
2056
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2057
|
+
for (const route of this.namedRoutes.values()) {
|
|
2058
|
+
const methods = route.method === "all" ? CONCRETE_HTTP_METHODS : [route.method];
|
|
2059
|
+
const paths = route.localePaths ? [route.path, ...route.localePaths] : [route.path];
|
|
2060
|
+
for (const m of methods) for (const p of paths) cache.set(`${m}:${p}`, route.name);
|
|
2061
|
+
}
|
|
2062
|
+
return cache;
|
|
2063
|
+
}
|
|
2064
|
+
/** Get all routes sorted by specificity (static > param > wildcard, locale variant before its primary) */
|
|
1908
2065
|
all() {
|
|
1909
2066
|
this._sortedCache ??= sortRoutesBySpecificity(this.routes);
|
|
1910
2067
|
return this._sortedCache;
|
|
@@ -1923,6 +2080,17 @@ RouteRegistry = __decorate([
|
|
|
1923
2080
|
//#endregion
|
|
1924
2081
|
//#region src/router/uri.ts
|
|
1925
2082
|
/**
|
|
2083
|
+
* Encode a value for use as a path parameter.
|
|
2084
|
+
*
|
|
2085
|
+
* Splits on `/` and encodes each segment with `encodeURIComponent`, so callers
|
|
2086
|
+
* can pass slash-containing values for catch-all params (e.g. `:slug{.+}`) and
|
|
2087
|
+
* still get a usable URL — `'auth/login'` becomes `'auth/login'`, not
|
|
2088
|
+
* `'auth%2Flogin'`. Single segments behave exactly like `encodeURIComponent`.
|
|
2089
|
+
*/
|
|
2090
|
+
function encodePathParam(value) {
|
|
2091
|
+
return value.split("/").map(encodeURIComponent).join("/");
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
1926
2094
|
* Build a URL from a registered route, filling path/domain params and appending extras as query string.
|
|
1927
2095
|
*
|
|
1928
2096
|
* Pure function — no request context needed. Used by both the `Uri` class and the standalone `route()` function.
|
|
@@ -1945,7 +2113,7 @@ function buildRouteUrl(route, name, params) {
|
|
|
1945
2113
|
for (const paramName of route.paramNames) {
|
|
1946
2114
|
const value = allParams[paramName];
|
|
1947
2115
|
if (value === void 0) throw new MissingRouteParamError(paramName, name, route.path);
|
|
1948
|
-
url = url.replace(new RegExp(`:${paramName}(\\{[^}]*\\})?`),
|
|
2116
|
+
url = url.replace(new RegExp(`:${paramName}(\\{[^}]*\\})?`), encodePathParam(value));
|
|
1949
2117
|
consumedKeys.add(paramName);
|
|
1950
2118
|
}
|
|
1951
2119
|
let domain;
|
|
@@ -1967,10 +2135,14 @@ function buildRouteUrl(route, name, params) {
|
|
|
1967
2135
|
return url;
|
|
1968
2136
|
}
|
|
1969
2137
|
let Uri = class Uri {
|
|
2138
|
+
registry;
|
|
2139
|
+
routerContext;
|
|
1970
2140
|
_defaults = {};
|
|
1971
|
-
|
|
2141
|
+
trailingSlash;
|
|
2142
|
+
constructor(registry, routerContext, application) {
|
|
1972
2143
|
this.registry = registry;
|
|
1973
2144
|
this.routerContext = routerContext;
|
|
2145
|
+
this.trailingSlash = application.config.trailingSlash ?? "ignore";
|
|
1974
2146
|
}
|
|
1975
2147
|
/**
|
|
1976
2148
|
* Set default URL parameters for this request.
|
|
@@ -1985,6 +2157,16 @@ let Uri = class Uri {
|
|
|
1985
2157
|
};
|
|
1986
2158
|
}
|
|
1987
2159
|
/**
|
|
2160
|
+
* Read the currently configured default URL parameters.
|
|
2161
|
+
*
|
|
2162
|
+
* Used by frameworks that need to share these with the client (e.g. the
|
|
2163
|
+
* Inertia adapter ships them as a shared prop so `route()` calls in the
|
|
2164
|
+
* browser auto-fill the same sticky params as the server).
|
|
2165
|
+
*/
|
|
2166
|
+
getDefaults() {
|
|
2167
|
+
return { ...this._defaults };
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
1988
2170
|
* Generate a URL from a named route.
|
|
1989
2171
|
*
|
|
1990
2172
|
* Keys matching `:param` placeholders fill the path.
|
|
@@ -2003,10 +2185,10 @@ let Uri = class Uri {
|
|
|
2003
2185
|
route(name, params, options) {
|
|
2004
2186
|
const registeredRoute = this.registry.get(name);
|
|
2005
2187
|
if (!registeredRoute) throw new RouteNameNotFoundError(name);
|
|
2006
|
-
let url = buildRouteUrl(registeredRoute, name, {
|
|
2188
|
+
let url = applyTrailingSlash(buildRouteUrl(registeredRoute, name, {
|
|
2007
2189
|
...this._defaults,
|
|
2008
2190
|
...params
|
|
2009
|
-
});
|
|
2191
|
+
}), this.trailingSlash);
|
|
2010
2192
|
if (options?.absolute && !url.startsWith("http")) url = `${new URL(this.routerContext.c.req.url).origin}${url}`;
|
|
2011
2193
|
return url;
|
|
2012
2194
|
}
|
|
@@ -2054,14 +2236,14 @@ let Uri = class Uri {
|
|
|
2054
2236
|
* Get the current request URL pathname (without query string).
|
|
2055
2237
|
*/
|
|
2056
2238
|
current() {
|
|
2057
|
-
return new URL(this.routerContext.c.req.url).pathname;
|
|
2239
|
+
return applyTrailingSlash(new URL(this.routerContext.c.req.url).pathname, this.trailingSlash);
|
|
2058
2240
|
}
|
|
2059
2241
|
/**
|
|
2060
2242
|
* Get the current request URL with query string (pathname + search).
|
|
2061
2243
|
*/
|
|
2062
2244
|
full() {
|
|
2063
2245
|
const parsed = new URL(this.routerContext.c.req.url);
|
|
2064
|
-
return `${parsed.pathname}${parsed.search}
|
|
2246
|
+
return applyTrailingSlash(`${parsed.pathname}${parsed.search}`, this.trailingSlash);
|
|
2065
2247
|
}
|
|
2066
2248
|
/**
|
|
2067
2249
|
* Get the previous request URL from the Referer header.
|
|
@@ -2093,7 +2275,7 @@ let Uri = class Uri {
|
|
|
2093
2275
|
* @param options - URL generation options
|
|
2094
2276
|
*/
|
|
2095
2277
|
to(path, queryParams, options) {
|
|
2096
|
-
let url = path;
|
|
2278
|
+
let url = applyTrailingSlash(path, this.trailingSlash);
|
|
2097
2279
|
if (queryParams) {
|
|
2098
2280
|
const entries = Object.entries(queryParams);
|
|
2099
2281
|
if (entries.length > 0) {
|
|
@@ -2113,7 +2295,7 @@ let Uri = class Uri {
|
|
|
2113
2295
|
query(path, queryParams) {
|
|
2114
2296
|
const parsed = new URL(path, "https://placeholder.local");
|
|
2115
2297
|
for (const [key, value] of Object.entries(queryParams)) parsed.searchParams.set(key, value);
|
|
2116
|
-
return `${parsed.pathname}${parsed.search}
|
|
2298
|
+
return applyTrailingSlash(`${parsed.pathname}${parsed.search}`, this.trailingSlash);
|
|
2117
2299
|
}
|
|
2118
2300
|
getAppSecret() {
|
|
2119
2301
|
const secret = this.routerContext.c.env.APP_SECRET;
|
|
@@ -2125,7 +2307,12 @@ Uri = __decorate([
|
|
|
2125
2307
|
Transient(),
|
|
2126
2308
|
__decorateParam(0, inject(ROUTER_TOKENS.RouteRegistry)),
|
|
2127
2309
|
__decorateParam(1, inject(ROUTER_TOKENS.RouterContext)),
|
|
2128
|
-
|
|
2310
|
+
__decorateParam(2, inject(DI_TOKENS.Application)),
|
|
2311
|
+
__decorateMetadata("design:paramtypes", [
|
|
2312
|
+
Object,
|
|
2313
|
+
Object,
|
|
2314
|
+
Object
|
|
2315
|
+
])
|
|
2129
2316
|
], Uri);
|
|
2130
2317
|
//#endregion
|
|
2131
2318
|
//#region src/router/route-url.ts
|
|
@@ -2155,9 +2342,12 @@ Uri = __decorate([
|
|
|
2155
2342
|
* ```
|
|
2156
2343
|
*/
|
|
2157
2344
|
function route(name, params) {
|
|
2158
|
-
const
|
|
2345
|
+
const container = getContainer();
|
|
2346
|
+
const registry = container.resolve(ROUTER_TOKENS.RouteRegistry);
|
|
2347
|
+
const application = container.resolve(DI_TOKENS.Application);
|
|
2348
|
+
const registeredRoute = registry.get(name);
|
|
2159
2349
|
if (!registeredRoute) throw new RouteNameNotFoundError(name);
|
|
2160
|
-
return buildRouteUrl(registeredRoute, name, params);
|
|
2350
|
+
return applyTrailingSlash(buildRouteUrl(registeredRoute, name, params), application.config.trailingSlash ?? "ignore");
|
|
2161
2351
|
}
|
|
2162
2352
|
//#endregion
|
|
2163
2353
|
//#region src/router/middleware/verify-signature.middleware.ts
|
|
@@ -2200,6 +2390,8 @@ var VerifySignatureMiddleware = class {
|
|
|
2200
2390
|
* Uses pre-built CoreContext from MessageLoaderService (singleton) for zero-cost lookups.
|
|
2201
2391
|
*/
|
|
2202
2392
|
let I18nService = class I18nService {
|
|
2393
|
+
loader;
|
|
2394
|
+
routerContext;
|
|
2203
2395
|
constructor(loader, routerContext) {
|
|
2204
2396
|
this.loader = loader;
|
|
2205
2397
|
this.routerContext = routerContext;
|
|
@@ -2337,4 +2529,4 @@ I18nModule = _I18nModule = __decorate([Module({ providers: [
|
|
|
2337
2529
|
//#endregion
|
|
2338
2530
|
export { OpenAPIModule as A, LocaleNotSupportedError as B, validationErrorResponseSchema as C, createMiddlewareChain as D, getRouteMetadata as E, getMessages as F, I18nContextMiddleware as H, messages as I, buildDetectorOptions as L, MessageRegistry as M, MessageLoaderService as N, createDomainMiddleware as O, getLocales as P, resolveI18nOptions as R, uuidParamSchema as S, getRouteDecoratedMethods as T, OpenAPIConfigService as V, commonErrorSchemas as _, buildRouteUrl as a, paginationQuerySchema as b, LocalePathService as c, extractDomainParamNames as d, extractParamNames as f, toOpenAPIPath as g, sortRoutesBySpecificity as h, Uri as i, OpenAPIService as j, parseDomainPattern as k, HonoApp as l, getPathSpecificityScore as m, VerifySignatureMiddleware as n, RouteRegistry as o, generateConventionRouteName as p, route as r, VersioningService as s, I18nModule as t, RouteRegistrationService as u, errorResponseSchema as v, Route as w, successMessageSchema as x, paginatedResponseSchema as y, TranslationMissingError as z };
|
|
2339
2531
|
|
|
2340
|
-
//# sourceMappingURL=i18n.module-
|
|
2532
|
+
//# sourceMappingURL=i18n.module-CzXLW9Hy.mjs.map
|