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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as Constructor } from "./types-
|
|
2
|
-
import { t as Macroable } from "./index-
|
|
3
|
-
import { t as StratalEnv } from "./env-
|
|
4
|
-
import { t as index_d_exports } from "./index-
|
|
5
|
-
import { a as index_d_exports$1, b as
|
|
6
|
-
import { i as LoggerService, l as LogLevel } from "./index-
|
|
1
|
+
import { t as Constructor } from "./types-cySNS_lp.mjs";
|
|
2
|
+
import { t as Macroable } from "./index-7-hU3GTV.mjs";
|
|
3
|
+
import { t as StratalEnv } from "./env-D1rcZ8_r.mjs";
|
|
4
|
+
import { t as index_d_exports } from "./index-C1KvMncZ.mjs";
|
|
5
|
+
import { C as MessageParams, S as MessageKeys, a as index_d_exports$1, b as II18nService, i as ZodError, o as z, t as OpenAPIHono, x as MessageKeyPrefix } from "./index-Bnpfq6uk.mjs";
|
|
6
|
+
import { i as LoggerService, l as LogLevel } from "./index-DBd_2wv8.mjs";
|
|
7
7
|
import { DependencyContainer, DependencyContainer as DependencyContainer$1, container as container$1, delay, inject as inject$1, injectable as injectable$1, instancePerContainerCachingFactory as instancePerContainerCachingFactory$1, singleton } from "tsyringe";
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
9
|
import { SSEMessage, SSEStreamingApi, SSEStreamingApi as SSEStreamingApi$1 } from "hono/streaming";
|
|
@@ -316,6 +316,47 @@ interface SerializedRoute {
|
|
|
316
316
|
* Serialized from `RouteRegistry.named()` on the server, consumed by `useRoute()` on the client.
|
|
317
317
|
*/
|
|
318
318
|
type SerializedRoutes = Record<string, SerializedRoute>;
|
|
319
|
+
/**
|
|
320
|
+
* Snapshot of the route bound to the current request — shared with the client
|
|
321
|
+
* so URL helpers can answer "which route am I on?", "what are its params?",
|
|
322
|
+
* and "which sticky defaults should I auto-apply?" without parsing the URL.
|
|
323
|
+
*
|
|
324
|
+
* Discriminated by `name`. When `StratalRouteMap` is augmented, narrowing on
|
|
325
|
+
* `name` strictly types `params` per route:
|
|
326
|
+
*
|
|
327
|
+
* ```ts
|
|
328
|
+
* if (route.name === 'users.show') {
|
|
329
|
+
* route.params.id // typed as string
|
|
330
|
+
* }
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
type CurrentRoute = { [K in RouteName]: {
|
|
334
|
+
name: K;
|
|
335
|
+
params: NonNullable<RouteParams<K>>;
|
|
336
|
+
defaults: Record<string, string>;
|
|
337
|
+
} }[RouteName] | {
|
|
338
|
+
name: null;
|
|
339
|
+
params: Record<string, string>;
|
|
340
|
+
defaults: Record<string, string>;
|
|
341
|
+
};
|
|
342
|
+
/**
|
|
343
|
+
* All valid arguments to `current(name)` — strict route names plus dotted
|
|
344
|
+
* wildcard patterns like `'users.*'` derived from real route prefixes.
|
|
345
|
+
*
|
|
346
|
+
* When `StratalRouteMap` is augmented and contains `'admin.users.show'`,
|
|
347
|
+
* valid wildcards are `'admin.*'` and `'admin.users.*'`. When un-augmented,
|
|
348
|
+
* collapses to `string`. When augmented but no route name has a `.`
|
|
349
|
+
* separator, the wildcard alternative resolves to `never` and the union
|
|
350
|
+
* collapses to just `RouteName`.
|
|
351
|
+
*/
|
|
352
|
+
type RouteMatcher = keyof StratalRouteMap extends never ? string : RouteName | `${RoutePrefixes<RouteName>}.*`;
|
|
353
|
+
/**
|
|
354
|
+
* Recursively split a dotted name into all its prefix segments.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* RoutePrefixes<'admin.users.show'> // 'admin' | 'admin.users'
|
|
358
|
+
*/
|
|
359
|
+
type RoutePrefixes<S extends string> = S extends `${infer Head}.${infer Rest}` ? Head | `${Head}.${RoutePrefixes<Rest>}` : never;
|
|
319
360
|
//#endregion
|
|
320
361
|
//#region src/di/tokens.d.ts
|
|
321
362
|
/**
|
|
@@ -525,6 +566,7 @@ declare const ROUTE_METADATA_KEYS: {
|
|
|
525
566
|
readonly WS_ON_MESSAGE: symbol;
|
|
526
567
|
readonly WS_ON_CLOSE: symbol;
|
|
527
568
|
readonly WS_ON_ERROR: symbol;
|
|
569
|
+
readonly RATE_LIMIT: symbol;
|
|
528
570
|
};
|
|
529
571
|
/**
|
|
530
572
|
* Security scheme identifiers for OpenAPI
|
|
@@ -770,6 +812,15 @@ interface ControllerOptions {
|
|
|
770
812
|
*/
|
|
771
813
|
domain?: string;
|
|
772
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
* Trailing-slash handling for incoming requests.
|
|
817
|
+
*
|
|
818
|
+
* - `'ignore'` (default) — match both `/foo` and `/foo/` for the same route, no redirect.
|
|
819
|
+
* - `'always'` — non-trailing requests redirect (308) to the trailing-slash form.
|
|
820
|
+
* Paths whose last segment contains `.` (e.g. `/api/openapi.json`) are skipped.
|
|
821
|
+
* - `'never'` — trailing requests redirect (308) to the non-trailing form.
|
|
822
|
+
*/
|
|
823
|
+
type TrailingSlashMode = 'ignore' | 'always' | 'never';
|
|
773
824
|
/**
|
|
774
825
|
* Versioning configuration for the application.
|
|
775
826
|
* Enables URI-based API versioning when provided to Stratal config.
|
|
@@ -809,100 +860,6 @@ interface LocalePathConfig {
|
|
|
809
860
|
defaultLocale: string | null;
|
|
810
861
|
}
|
|
811
862
|
//#endregion
|
|
812
|
-
//#region src/router/hono-app.d.ts
|
|
813
|
-
/**
|
|
814
|
-
* HonoApp — extends OpenAPIHono with Stratal-specific setup
|
|
815
|
-
*
|
|
816
|
-
* - Request scope middleware (child container per request)
|
|
817
|
-
* - Global middleware (CORS, logging, error handling)
|
|
818
|
-
* - defaultHook for validation errors
|
|
819
|
-
* - `use()` overload for Stratal middleware classes
|
|
820
|
-
* - `configure()` for OpenAPI, routes, and 404
|
|
821
|
-
*/
|
|
822
|
-
declare class HonoApp extends OpenAPIHono<RouterEnv> {
|
|
823
|
-
private configured;
|
|
824
|
-
private readonly _container;
|
|
825
|
-
private readonly _logger;
|
|
826
|
-
/**
|
|
827
|
-
* Reference to the original Hono `use` implementation.
|
|
828
|
-
* Captured in constructor after super() sets it as an instance property.
|
|
829
|
-
* Used by private methods to register middleware without going through the override.
|
|
830
|
-
*/
|
|
831
|
-
private nativeUse;
|
|
832
|
-
constructor(container: Container, logger: LoggerService);
|
|
833
|
-
/**
|
|
834
|
-
* Apply global middleware (logger + error handler).
|
|
835
|
-
* Called by Application after locale middleware is applied by LocalePathService.
|
|
836
|
-
*/
|
|
837
|
-
private applyGlobalMiddleware;
|
|
838
|
-
/**
|
|
839
|
-
* Configure OpenAPI endpoints, controller routes, and 404 handler.
|
|
840
|
-
* Called once by Application.initialize().
|
|
841
|
-
*/
|
|
842
|
-
configure(): Promise<void>;
|
|
843
|
-
private setupRequestScope;
|
|
844
|
-
private handleException;
|
|
845
|
-
}
|
|
846
|
-
//#endregion
|
|
847
|
-
//#region src/router/services/locale-path.service.d.ts
|
|
848
|
-
/**
|
|
849
|
-
* A resolved path with locale variant metadata.
|
|
850
|
-
*/
|
|
851
|
-
interface ResolvedPath {
|
|
852
|
-
/** The fully resolved path (may include /:locale prefix) */
|
|
853
|
-
path: string;
|
|
854
|
-
/** Whether this path is a locale-prefixed variant */
|
|
855
|
-
isLocaleVariant: boolean;
|
|
856
|
-
}
|
|
857
|
-
/**
|
|
858
|
-
* Resolves locale path variants for route paths.
|
|
859
|
-
*
|
|
860
|
-
* Computes `LocalePathConfig` from `I18nModuleOptions` and provides
|
|
861
|
-
* path expansion for locale-prefixed route variants.
|
|
862
|
-
*
|
|
863
|
-
* Also applies language detection and default locale redirect middleware
|
|
864
|
-
* to HonoApp when resolved from the container.
|
|
865
|
-
*
|
|
866
|
-
* Registered as a singleton in the container.
|
|
867
|
-
*/
|
|
868
|
-
declare class LocalePathService {
|
|
869
|
-
private readonly honoApp;
|
|
870
|
-
private readonly _config;
|
|
871
|
-
private readonly _pathDetectionEnabled;
|
|
872
|
-
private readonly _prefixDefaultLocale;
|
|
873
|
-
constructor(container: Container, honoApp: HonoApp);
|
|
874
|
-
/** Whether path-based locale detection is enabled */
|
|
875
|
-
get enabled(): boolean;
|
|
876
|
-
/** The computed locale path config, or null if path detection is disabled */
|
|
877
|
-
get localePathConfig(): LocalePathConfig | null;
|
|
878
|
-
/** The prefixDefaultLocale setting (false, true, or 'redirect') */
|
|
879
|
-
get prefixDefaultLocale(): false | true | 'redirect';
|
|
880
|
-
/**
|
|
881
|
-
* Expand a path into primary + locale-prefixed variants.
|
|
882
|
-
*
|
|
883
|
-
* @param path - The base path to expand
|
|
884
|
-
* @returns Array of resolved paths with locale metadata
|
|
885
|
-
*/
|
|
886
|
-
resolve(path: string): ResolvedPath[];
|
|
887
|
-
/**
|
|
888
|
-
* Build a Hono regex constraint from prefixed locales.
|
|
889
|
-
* e.g., `{en|de|fr}` — restricts `:locale` to only match known values.
|
|
890
|
-
*/
|
|
891
|
-
private buildLocaleConstraint;
|
|
892
|
-
/**
|
|
893
|
-
* Apply Hono's languageDetector middleware and bridge the detected language
|
|
894
|
-
* to Stratal's LOCALE context variable.
|
|
895
|
-
*/
|
|
896
|
-
private setupLanguageDetection;
|
|
897
|
-
/**
|
|
898
|
-
* Redirect requests that include the default locale prefix to the unprefixed path.
|
|
899
|
-
* For example, `/en/users` → 301 redirect to `/users`.
|
|
900
|
-
*
|
|
901
|
-
* Only active when `prefixDefaultLocale` is `'redirect'`.
|
|
902
|
-
*/
|
|
903
|
-
private setupDefaultLocaleRedirect;
|
|
904
|
-
}
|
|
905
|
-
//#endregion
|
|
906
863
|
//#region src/execution-context.d.ts
|
|
907
864
|
interface StratalExecutionContext {
|
|
908
865
|
waitUntil(promise: Promise<unknown>): void;
|
|
@@ -1648,6 +1605,100 @@ interface Middleware {
|
|
|
1648
1605
|
handle(ctx: RouterContext, next: Next$1): Promise<Response | void>;
|
|
1649
1606
|
}
|
|
1650
1607
|
//#endregion
|
|
1608
|
+
//#region src/router/hono-app.d.ts
|
|
1609
|
+
/**
|
|
1610
|
+
* HonoApp — extends OpenAPIHono with Stratal-specific setup
|
|
1611
|
+
*
|
|
1612
|
+
* - Request scope middleware (child container per request)
|
|
1613
|
+
* - Global middleware (CORS, logging, error handling)
|
|
1614
|
+
* - defaultHook for validation errors
|
|
1615
|
+
* - `use()` overload for Stratal middleware classes
|
|
1616
|
+
* - `configure()` for OpenAPI, routes, and 404
|
|
1617
|
+
*/
|
|
1618
|
+
declare class HonoApp extends OpenAPIHono<RouterEnv> {
|
|
1619
|
+
private configured;
|
|
1620
|
+
private readonly _container;
|
|
1621
|
+
private readonly _logger;
|
|
1622
|
+
/**
|
|
1623
|
+
* Reference to the original Hono `use` implementation.
|
|
1624
|
+
* Captured in constructor after super() sets it as an instance property.
|
|
1625
|
+
* Used by private methods to register middleware without going through the override.
|
|
1626
|
+
*/
|
|
1627
|
+
private nativeUse;
|
|
1628
|
+
constructor(container: Container, logger: LoggerService, application: Application);
|
|
1629
|
+
/**
|
|
1630
|
+
* Apply global middleware (logger + error handler).
|
|
1631
|
+
* Called by Application after locale middleware is applied by LocalePathService.
|
|
1632
|
+
*/
|
|
1633
|
+
private applyGlobalMiddleware;
|
|
1634
|
+
/**
|
|
1635
|
+
* Configure OpenAPI endpoints, controller routes, and 404 handler.
|
|
1636
|
+
* Called once by Application.initialize().
|
|
1637
|
+
*/
|
|
1638
|
+
configure(): Promise<void>;
|
|
1639
|
+
private setupRequestScope;
|
|
1640
|
+
private handleException;
|
|
1641
|
+
}
|
|
1642
|
+
//#endregion
|
|
1643
|
+
//#region src/router/services/locale-path.service.d.ts
|
|
1644
|
+
/**
|
|
1645
|
+
* A resolved path with locale variant metadata.
|
|
1646
|
+
*/
|
|
1647
|
+
interface ResolvedPath {
|
|
1648
|
+
/** The fully resolved path (may include /:locale prefix) */
|
|
1649
|
+
path: string;
|
|
1650
|
+
/** Whether this path is a locale-prefixed variant */
|
|
1651
|
+
isLocaleVariant: boolean;
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Resolves locale path variants for route paths.
|
|
1655
|
+
*
|
|
1656
|
+
* Computes `LocalePathConfig` from `I18nModuleOptions` and provides
|
|
1657
|
+
* path expansion for locale-prefixed route variants.
|
|
1658
|
+
*
|
|
1659
|
+
* Also applies language detection and default locale redirect middleware
|
|
1660
|
+
* to HonoApp when resolved from the container.
|
|
1661
|
+
*
|
|
1662
|
+
* Registered as a singleton in the container.
|
|
1663
|
+
*/
|
|
1664
|
+
declare class LocalePathService {
|
|
1665
|
+
private readonly honoApp;
|
|
1666
|
+
private readonly _config;
|
|
1667
|
+
private readonly _pathDetectionEnabled;
|
|
1668
|
+
private readonly _prefixDefaultLocale;
|
|
1669
|
+
constructor(container: Container, honoApp: HonoApp);
|
|
1670
|
+
/** Whether path-based locale detection is enabled */
|
|
1671
|
+
get enabled(): boolean;
|
|
1672
|
+
/** The computed locale path config, or null if path detection is disabled */
|
|
1673
|
+
get localePathConfig(): LocalePathConfig | null;
|
|
1674
|
+
/** The prefixDefaultLocale setting (false, true, or 'redirect') */
|
|
1675
|
+
get prefixDefaultLocale(): false | true | 'redirect';
|
|
1676
|
+
/**
|
|
1677
|
+
* Expand a path into primary + locale-prefixed variants.
|
|
1678
|
+
*
|
|
1679
|
+
* @param path - The base path to expand
|
|
1680
|
+
* @returns Array of resolved paths with locale metadata
|
|
1681
|
+
*/
|
|
1682
|
+
resolve(path: string): ResolvedPath[];
|
|
1683
|
+
/**
|
|
1684
|
+
* Build a Hono regex constraint from prefixed locales.
|
|
1685
|
+
* e.g., `{en|de|fr}` — restricts `:locale` to only match known values.
|
|
1686
|
+
*/
|
|
1687
|
+
private buildLocaleConstraint;
|
|
1688
|
+
/**
|
|
1689
|
+
* Apply Hono's languageDetector middleware and bridge the detected language
|
|
1690
|
+
* to Stratal's LOCALE context variable.
|
|
1691
|
+
*/
|
|
1692
|
+
private setupLanguageDetection;
|
|
1693
|
+
/**
|
|
1694
|
+
* Redirect requests that include the default locale prefix to the unprefixed path.
|
|
1695
|
+
* For example, `/en/users` → 301 redirect to `/users`.
|
|
1696
|
+
*
|
|
1697
|
+
* Only active when `prefixDefaultLocale` is `'redirect'`.
|
|
1698
|
+
*/
|
|
1699
|
+
private setupDefaultLocaleRedirect;
|
|
1700
|
+
}
|
|
1701
|
+
//#endregion
|
|
1651
1702
|
//#region src/router/router.internals.d.ts
|
|
1652
1703
|
/**
|
|
1653
1704
|
* Symbol keys for Router internal accessors.
|
|
@@ -1742,6 +1793,20 @@ declare class Router {
|
|
|
1742
1793
|
name(prefix: string): this;
|
|
1743
1794
|
/** Middleware applied to controllers in this scope */
|
|
1744
1795
|
middleware(...middlewares: Constructor<Middleware>[]): this;
|
|
1796
|
+
/**
|
|
1797
|
+
* Apply a named rate limiter to controllers in this scope.
|
|
1798
|
+
*
|
|
1799
|
+
* The named limiter must be registered via `RateLimiterRegistry.for(name, ...)`
|
|
1800
|
+
* (typically inside a module's `onInitialize` hook), and the user must
|
|
1801
|
+
* import `RateLimiterModule.forRoot({ store: ... })` in their AppModule.
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* ```typescript
|
|
1805
|
+
* router.prefix('/uploads').throttle('uploads')
|
|
1806
|
+
* router.group([AdminController], (admin) => admin.throttle('admin'))
|
|
1807
|
+
* ```
|
|
1808
|
+
*/
|
|
1809
|
+
throttle(name: string): this;
|
|
1745
1810
|
/** API version for controllers in this scope */
|
|
1746
1811
|
version(version: string | string[]): this;
|
|
1747
1812
|
/** Hide/show routes in this scope from OpenAPI docs */
|
|
@@ -1892,6 +1957,114 @@ declare class ModuleRegistry {
|
|
|
1892
1957
|
private collectIfListener;
|
|
1893
1958
|
}
|
|
1894
1959
|
//#endregion
|
|
1960
|
+
//#region src/router/services/versioning.service.d.ts
|
|
1961
|
+
/**
|
|
1962
|
+
* Resolves version prefixes for route paths.
|
|
1963
|
+
*
|
|
1964
|
+
* Handles VERSION_NEUTRAL, multi-version arrays, default version fallback,
|
|
1965
|
+
* and configurable prefix (default: 'v').
|
|
1966
|
+
*
|
|
1967
|
+
* Registered as a singleton in the container.
|
|
1968
|
+
*/
|
|
1969
|
+
declare class VersioningService {
|
|
1970
|
+
private readonly options;
|
|
1971
|
+
constructor(app: Application);
|
|
1972
|
+
/** Whether versioning is enabled */
|
|
1973
|
+
get enabled(): boolean;
|
|
1974
|
+
/**
|
|
1975
|
+
* Resolve versioned paths for a base path.
|
|
1976
|
+
*
|
|
1977
|
+
* @param basePath - The base path (e.g., '/users')
|
|
1978
|
+
* @param version - Explicit version from controller/router config
|
|
1979
|
+
* @returns Array of versioned path strings (e.g., ['/v1/users', '/v2/users'])
|
|
1980
|
+
*/
|
|
1981
|
+
resolve(basePath: string, version?: string | string[] | typeof VERSION_NEUTRAL): string[];
|
|
1982
|
+
}
|
|
1983
|
+
//#endregion
|
|
1984
|
+
//#region src/router/route-registry.d.ts
|
|
1985
|
+
/**
|
|
1986
|
+
* A single registered route in the application.
|
|
1987
|
+
* Tracks both named and unnamed routes, HTTP and WebSocket.
|
|
1988
|
+
*/
|
|
1989
|
+
interface RegisteredRoute {
|
|
1990
|
+
/** Route name for URL generation (undefined = unnamed, still tracked) */
|
|
1991
|
+
name?: string;
|
|
1992
|
+
/** HTTP method or 'ws' for WebSocket gateways */
|
|
1993
|
+
method: HttpMethod | 'ws';
|
|
1994
|
+
/** Primary path in Hono-style :param format */
|
|
1995
|
+
path: string;
|
|
1996
|
+
/** Locale-prefixed path variants (e.g., '/:locale/users/:id') */
|
|
1997
|
+
localePaths?: string[];
|
|
1998
|
+
/** Parameter names extracted from path */
|
|
1999
|
+
paramNames: string[];
|
|
2000
|
+
/** Domain pattern (e.g., '{tenant}.example.com') */
|
|
2001
|
+
domain?: string;
|
|
2002
|
+
/** Parameter names extracted from domain */
|
|
2003
|
+
domainParamNames: string[];
|
|
2004
|
+
/** Controller class name */
|
|
2005
|
+
controller: string;
|
|
2006
|
+
/** Controller method name */
|
|
2007
|
+
action: string;
|
|
2008
|
+
/** Whether the route is hidden from OpenAPI docs */
|
|
2009
|
+
hidden: boolean;
|
|
2010
|
+
/** Middleware class names applied to this route */
|
|
2011
|
+
middleware: string[];
|
|
2012
|
+
/** Whether this is a locale-prefixed variant */
|
|
2013
|
+
isLocaleVariant?: boolean;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Input for registering a route. The registry auto-extracts param names
|
|
2017
|
+
* and expands versioned/locale paths via injected services.
|
|
2018
|
+
*/
|
|
2019
|
+
type RouteRegistrationInput = Omit<RegisteredRoute, 'paramNames' | 'domainParamNames' | 'path' | 'localePaths' | 'isLocaleVariant'> & {
|
|
2020
|
+
/** Base path before versioning/locale expansion */basePath: string; /** Version from controller/router config (used by VersioningService). Accepts VERSION_NEUTRAL symbol. */
|
|
2021
|
+
version?: string | string[] | typeof VERSION_NEUTRAL; /** Pre-computed param names (optional, auto-extracted if omitted) */
|
|
2022
|
+
paramNames?: string[]; /** Pre-computed domain param names (optional, auto-extracted if omitted) */
|
|
2023
|
+
domainParamNames?: string[];
|
|
2024
|
+
};
|
|
2025
|
+
/**
|
|
2026
|
+
* Central registry for all application routes.
|
|
2027
|
+
* Single source of truth — used by `route:list`, `route:types`, and URL generation.
|
|
2028
|
+
*
|
|
2029
|
+
* Routes are automatically expanded via VersioningService and LocalePathService
|
|
2030
|
+
* during registration, and sorted by specificity when retrieved via `all()`.
|
|
2031
|
+
*
|
|
2032
|
+
* Registered as a singleton in the container.
|
|
2033
|
+
*/
|
|
2034
|
+
declare class RouteRegistry {
|
|
2035
|
+
private readonly versioningService;
|
|
2036
|
+
private readonly localePathService;
|
|
2037
|
+
private readonly routes;
|
|
2038
|
+
private readonly namedRoutes;
|
|
2039
|
+
private _sortedCache;
|
|
2040
|
+
private _routeToNameCache;
|
|
2041
|
+
constructor(versioningService: VersioningService, localePathService: LocalePathService);
|
|
2042
|
+
/**
|
|
2043
|
+
* Register a route. Expands via VersioningService + LocalePathService.
|
|
2044
|
+
* Named routes must have unique names.
|
|
2045
|
+
*
|
|
2046
|
+
* @returns Array of expanded RegisteredRoute entries (primary + locale variants)
|
|
2047
|
+
* @throws DuplicateRouteNameError if a named route with the same name already exists
|
|
2048
|
+
*/
|
|
2049
|
+
register(input: RouteRegistrationInput): RegisteredRoute[];
|
|
2050
|
+
/** Get a named route by name */
|
|
2051
|
+
get(name: string): RegisteredRoute | undefined;
|
|
2052
|
+
/** Check if a named route exists */
|
|
2053
|
+
has(name: string): boolean;
|
|
2054
|
+
/**
|
|
2055
|
+
* Resolve a Hono-style route path pattern (e.g. as exposed by `c.req.routePath`)
|
|
2056
|
+
* back to its registered name, scoped to the request's HTTP method. Locale variant
|
|
2057
|
+
* paths resolve to the canonical primary route name. Method matching is
|
|
2058
|
+
* case-insensitive; routes registered with `'all'` resolve under any verb.
|
|
2059
|
+
*/
|
|
2060
|
+
findNameByRoute(method: string, path: string): string | undefined;
|
|
2061
|
+
private buildRouteToNameCache;
|
|
2062
|
+
/** Get all routes sorted by specificity (static > param > wildcard, locale variant before its primary) */
|
|
2063
|
+
all(): RegisteredRoute[];
|
|
2064
|
+
/** Get only named routes */
|
|
2065
|
+
named(): RegisteredRoute[];
|
|
2066
|
+
}
|
|
2067
|
+
//#endregion
|
|
1895
2068
|
//#region src/router/router-resolver.d.ts
|
|
1896
2069
|
/**
|
|
1897
2070
|
* Resolved configuration for a single controller.
|
|
@@ -2181,10 +2354,13 @@ declare function getPathSpecificityScore(path: string): number;
|
|
|
2181
2354
|
*
|
|
2182
2355
|
* 1. Static paths before parameterized before wildcards
|
|
2183
2356
|
* 2. More segments = more specific (tie-breaker)
|
|
2184
|
-
* 3.
|
|
2357
|
+
* 3. Locale-prefixed variants before their primary (so a locale-prefixed
|
|
2358
|
+
* request matches the variant first; a primary catch-all would otherwise
|
|
2359
|
+
* swallow the locale prefix into its param)
|
|
2185
2360
|
*/
|
|
2186
2361
|
declare function sortRoutesBySpecificity<T extends {
|
|
2187
2362
|
path: string;
|
|
2363
|
+
isLocaleVariant?: boolean;
|
|
2188
2364
|
}>(routes: T[]): T[];
|
|
2189
2365
|
//#endregion
|
|
2190
2366
|
//#region src/router/utils/route-name.d.ts
|
|
@@ -2864,6 +3040,16 @@ interface ApplicationConfig {
|
|
|
2864
3040
|
* When provided, enables URI-based versioning for controllers.
|
|
2865
3041
|
*/
|
|
2866
3042
|
versioning?: VersioningOptions;
|
|
3043
|
+
/**
|
|
3044
|
+
* Trailing-slash handling for incoming requests.
|
|
3045
|
+
*
|
|
3046
|
+
* Defaults to `'ignore'` — both `/foo` and `/foo/` resolve to the same route.
|
|
3047
|
+
*
|
|
3048
|
+
* - `'ignore'` — match both, no redirect.
|
|
3049
|
+
* - `'always'` — non-trailing requests redirect (308) to the trailing-slash form.
|
|
3050
|
+
* - `'never'` — trailing requests redirect (308) to the non-trailing form.
|
|
3051
|
+
*/
|
|
3052
|
+
trailingSlash?: TrailingSlashMode;
|
|
2867
3053
|
/**
|
|
2868
3054
|
* Custom exception handler class.
|
|
2869
3055
|
*
|
|
@@ -3003,105 +3189,6 @@ declare class Application {
|
|
|
3003
3189
|
private initializeExceptionHandler;
|
|
3004
3190
|
}
|
|
3005
3191
|
//#endregion
|
|
3006
|
-
//#region src/router/services/versioning.service.d.ts
|
|
3007
|
-
/**
|
|
3008
|
-
* Resolves version prefixes for route paths.
|
|
3009
|
-
*
|
|
3010
|
-
* Handles VERSION_NEUTRAL, multi-version arrays, default version fallback,
|
|
3011
|
-
* and configurable prefix (default: 'v').
|
|
3012
|
-
*
|
|
3013
|
-
* Registered as a singleton in the container.
|
|
3014
|
-
*/
|
|
3015
|
-
declare class VersioningService {
|
|
3016
|
-
private readonly options;
|
|
3017
|
-
constructor(app: Application);
|
|
3018
|
-
/** Whether versioning is enabled */
|
|
3019
|
-
get enabled(): boolean;
|
|
3020
|
-
/**
|
|
3021
|
-
* Resolve versioned paths for a base path.
|
|
3022
|
-
*
|
|
3023
|
-
* @param basePath - The base path (e.g., '/users')
|
|
3024
|
-
* @param version - Explicit version from controller/router config
|
|
3025
|
-
* @returns Array of versioned path strings (e.g., ['/v1/users', '/v2/users'])
|
|
3026
|
-
*/
|
|
3027
|
-
resolve(basePath: string, version?: string | string[] | typeof VERSION_NEUTRAL): string[];
|
|
3028
|
-
}
|
|
3029
|
-
//#endregion
|
|
3030
|
-
//#region src/router/route-registry.d.ts
|
|
3031
|
-
/**
|
|
3032
|
-
* A single registered route in the application.
|
|
3033
|
-
* Tracks both named and unnamed routes, HTTP and WebSocket.
|
|
3034
|
-
*/
|
|
3035
|
-
interface RegisteredRoute {
|
|
3036
|
-
/** Route name for URL generation (undefined = unnamed, still tracked) */
|
|
3037
|
-
name?: string;
|
|
3038
|
-
/** HTTP method or 'ws' for WebSocket gateways */
|
|
3039
|
-
method: HttpMethod | 'ws';
|
|
3040
|
-
/** Primary path in Hono-style :param format */
|
|
3041
|
-
path: string;
|
|
3042
|
-
/** Locale-prefixed path variants (e.g., '/:locale/users/:id') */
|
|
3043
|
-
localePaths?: string[];
|
|
3044
|
-
/** Parameter names extracted from path */
|
|
3045
|
-
paramNames: string[];
|
|
3046
|
-
/** Domain pattern (e.g., '{tenant}.example.com') */
|
|
3047
|
-
domain?: string;
|
|
3048
|
-
/** Parameter names extracted from domain */
|
|
3049
|
-
domainParamNames: string[];
|
|
3050
|
-
/** Controller class name */
|
|
3051
|
-
controller: string;
|
|
3052
|
-
/** Controller method name */
|
|
3053
|
-
action: string;
|
|
3054
|
-
/** Whether the route is hidden from OpenAPI docs */
|
|
3055
|
-
hidden: boolean;
|
|
3056
|
-
/** Middleware class names applied to this route */
|
|
3057
|
-
middleware: string[];
|
|
3058
|
-
/** Whether this is a locale-prefixed variant */
|
|
3059
|
-
isLocaleVariant?: boolean;
|
|
3060
|
-
}
|
|
3061
|
-
/**
|
|
3062
|
-
* Input for registering a route. The registry auto-extracts param names
|
|
3063
|
-
* and expands versioned/locale paths via injected services.
|
|
3064
|
-
*/
|
|
3065
|
-
type RouteRegistrationInput = Omit<RegisteredRoute, 'paramNames' | 'domainParamNames' | 'path' | 'localePaths' | 'isLocaleVariant'> & {
|
|
3066
|
-
/** Base path before versioning/locale expansion */basePath: string; /** Version from controller/router config (used by VersioningService). Accepts VERSION_NEUTRAL symbol. */
|
|
3067
|
-
version?: string | string[] | typeof VERSION_NEUTRAL; /** Pre-computed param names (optional, auto-extracted if omitted) */
|
|
3068
|
-
paramNames?: string[]; /** Pre-computed domain param names (optional, auto-extracted if omitted) */
|
|
3069
|
-
domainParamNames?: string[];
|
|
3070
|
-
};
|
|
3071
|
-
/**
|
|
3072
|
-
* Central registry for all application routes.
|
|
3073
|
-
* Single source of truth — used by `route:list`, `route:types`, and URL generation.
|
|
3074
|
-
*
|
|
3075
|
-
* Routes are automatically expanded via VersioningService and LocalePathService
|
|
3076
|
-
* during registration, and sorted by specificity when retrieved via `all()`.
|
|
3077
|
-
*
|
|
3078
|
-
* Registered as a singleton in the container.
|
|
3079
|
-
*/
|
|
3080
|
-
declare class RouteRegistry {
|
|
3081
|
-
private readonly versioningService;
|
|
3082
|
-
private readonly localePathService;
|
|
3083
|
-
private readonly routes;
|
|
3084
|
-
private readonly namedRoutes;
|
|
3085
|
-
private _sortedCache;
|
|
3086
|
-
constructor(versioningService: VersioningService, localePathService: LocalePathService);
|
|
3087
|
-
/**
|
|
3088
|
-
* Register a route. Expands via VersioningService + LocalePathService.
|
|
3089
|
-
* Named routes must have unique names.
|
|
3090
|
-
*
|
|
3091
|
-
* @returns Array of expanded RegisteredRoute entries (primary + locale variants)
|
|
3092
|
-
* @throws DuplicateRouteNameError if a named route with the same name already exists
|
|
3093
|
-
*/
|
|
3094
|
-
register(input: RouteRegistrationInput): RegisteredRoute[];
|
|
3095
|
-
/** Get a named route by name */
|
|
3096
|
-
get(name: string): RegisteredRoute | undefined;
|
|
3097
|
-
/** Check if a named route exists */
|
|
3098
|
-
has(name: string): boolean;
|
|
3099
|
-
/** Get all routes sorted by specificity (static > param > wildcard, primary before locale) */
|
|
3100
|
-
all(): RegisteredRoute[];
|
|
3101
|
-
/** Get only named routes */
|
|
3102
|
-
named(): RegisteredRoute[];
|
|
3103
|
-
}
|
|
3104
|
-
//#endregion
|
|
3105
3192
|
//#region src/router/uri.d.ts
|
|
3106
3193
|
/**
|
|
3107
3194
|
* Options for URL generation methods.
|
|
@@ -3150,7 +3237,8 @@ declare class Uri {
|
|
|
3150
3237
|
private readonly registry;
|
|
3151
3238
|
private readonly routerContext;
|
|
3152
3239
|
private _defaults;
|
|
3153
|
-
|
|
3240
|
+
private readonly trailingSlash;
|
|
3241
|
+
constructor(registry: RouteRegistry, routerContext: RouterContext, application: Application);
|
|
3154
3242
|
/**
|
|
3155
3243
|
* Set default URL parameters for this request.
|
|
3156
3244
|
* Applied to all subsequent `route()` calls — explicit params override defaults.
|
|
@@ -3158,6 +3246,14 @@ declare class Uri {
|
|
|
3158
3246
|
* @param params - Default parameters (e.g., `{ locale: 'en' }`)
|
|
3159
3247
|
*/
|
|
3160
3248
|
defaults(params: Record<string, string>): void;
|
|
3249
|
+
/**
|
|
3250
|
+
* Read the currently configured default URL parameters.
|
|
3251
|
+
*
|
|
3252
|
+
* Used by frameworks that need to share these with the client (e.g. the
|
|
3253
|
+
* Inertia adapter ships them as a shared prop so `route()` calls in the
|
|
3254
|
+
* browser auto-fill the same sticky params as the server).
|
|
3255
|
+
*/
|
|
3256
|
+
getDefaults(): Record<string, string>;
|
|
3161
3257
|
/**
|
|
3162
3258
|
* Generate a URL from a named route.
|
|
3163
3259
|
*
|
|
@@ -3280,6 +3376,11 @@ declare class RouterContext<T extends RouterEnv = RouterEnv> extends Macroable {
|
|
|
3280
3376
|
* Access for advanced use cases not covered by helper methods
|
|
3281
3377
|
*/
|
|
3282
3378
|
constructor(c: Context<T>);
|
|
3379
|
+
/**
|
|
3380
|
+
* Cloudflare-provided request properties (geo, TLS, bot management, etc.).
|
|
3381
|
+
* Always available on Cloudflare Workers requests via `c.req.raw.cf`.
|
|
3382
|
+
*/
|
|
3383
|
+
get cf(): CfProperties;
|
|
3283
3384
|
/**
|
|
3284
3385
|
* Get request-scoped DI container
|
|
3285
3386
|
* Contains request-specific services and context (AuthContext)
|
|
@@ -3309,10 +3410,20 @@ declare class RouterContext<T extends RouterEnv = RouterEnv> extends Macroable {
|
|
|
3309
3410
|
*/
|
|
3310
3411
|
json(data: object | null, status?: ContentfulStatusCode): Response;
|
|
3311
3412
|
/**
|
|
3312
|
-
* Get route parameter value
|
|
3413
|
+
* Get route parameter value(s).
|
|
3414
|
+
*
|
|
3415
|
+
* Reads the validated, Zod-coerced param record from `c.req.valid('param')`,
|
|
3416
|
+
* which is what `@hono/zod-openapi` populates for every route registered
|
|
3417
|
+
* via `app.openapi(...)`. Bare `c.req.param()` returns `undefined` for those
|
|
3418
|
+
* routes — always go through the validated record.
|
|
3419
|
+
*
|
|
3420
|
+
* - With a key → returns the single string value.
|
|
3421
|
+
* - With no args → returns the full `Record<string, string>` (or `{}` when
|
|
3422
|
+
* the matched route has no path params).
|
|
3313
3423
|
*
|
|
3314
3424
|
* @param key - Parameter name (e.g., 'id' for /users/:id)
|
|
3315
3425
|
*/
|
|
3426
|
+
param(): Record<string, string>;
|
|
3316
3427
|
param(key: string): string;
|
|
3317
3428
|
/**
|
|
3318
3429
|
* Get query parameter value
|
|
@@ -3914,7 +4025,8 @@ declare const ERROR_CODES: {
|
|
|
3914
4025
|
/** Generic resource not found */readonly NOT_FOUND: 4000; /** Route/endpoint not found */
|
|
3915
4026
|
readonly ROUTE_NOT_FOUND: 4004; /** Resource conflict or duplicate */
|
|
3916
4027
|
readonly CONFLICT: 4100; /** Resource already exists */
|
|
3917
|
-
readonly ALREADY_EXISTS: 4101;
|
|
4028
|
+
readonly ALREADY_EXISTS: 4101; /** Rate limit exceeded */
|
|
4029
|
+
readonly TOO_MANY_REQUESTS: 4290;
|
|
3918
4030
|
};
|
|
3919
4031
|
/**
|
|
3920
4032
|
* Validation Errors (1000-1999)
|
|
@@ -4314,5 +4426,5 @@ declare class StratalNotInitializedError extends ApplicationError {
|
|
|
4314
4426
|
constructor();
|
|
4315
4427
|
}
|
|
4316
4428
|
//#endregion
|
|
4317
|
-
export {
|
|
4318
|
-
//# sourceMappingURL=index-
|
|
4429
|
+
export { DuplicateRouteNameError as $, TrailingSlashMode as $n, ModuleRegistry as $t, LocaleNotSupportedError as A, ValueProvider as An, container$1 as Ar, Delete as At, ContextQueryResult as B, ControllerOptions as Bn, PredicateContainer as Br, extractDomainParamNames as Bt, DetectionStrategy as C, ModuleContext as Cn, RoutePrefixes as Cr, successMessageSchema as Ct, buildDetectorOptions as D, OnShutdown as Dn, Container as Dr, getRouteDecoratedMethods as Dt, ResolvedI18nOptions as E, OnInitialize as En, StratalRouteMap as Er, Route as Et, QueueExceptionContext as F, RenderableCallback as Fn, singleton as Fr, Controller as Ft, buildRouteUrl as G, RouteBodyObject as Gn, Environment as Gr, toOpenAPIPath as Gt, SignedUriOptions as H, ExplicitRouteMetadata as Hn, ExtensionDecorator as Hr, generateConventionRouteName as Ht, createCliExceptionContext as I, Reportable as In, ConditionalBindingBuilder as Ir, getControllerOptions as It, ApplicationOptions as J, RouteResponse as Jn, RouteRegistrationService as Jt, Application as K, RouteConfig as Kn, ErrorResponse as Kr, route as Kt, createCronExceptionContext as L, ReportableCallback as Ln, ConditionalBindingBuilderImpl as Lr, getControllerRoute as Lt, CronExceptionContext as M, ApplicationErrorConstructor as Mn, inject$1 as Mr, Patch as Mt, ExceptionContext as N, ContextCallback as Nn, injectable$1 as Nr, Post as Nt, resolveI18nOptions as O, Provider as On, ContainerOptions as Or, getRouteMetadata as Ot, HttpExceptionContext as P, LogSeverity as Pn, instancePerContainerCachingFactory$1 as Pr, Put as Pt, DomainMismatchError as Q, SecurityScheme as Qn, VersioningService as Qt, createHttpExceptionContext as R, RespondCallback as Rn, ConditionalBindingGive as Rr, getControllerVersion as Rt, I18nModule as S, ModuleClass as Sn, RouteParams as Sr, paginationQuerySchema as St, LanguageDetectionOptions as T, OnException as Tn, SerializedRoutes as Tr, validationErrorResponseSchema as Tt, Uri as U, LocalePathConfig as Un, Scope as Ur, getPathSpecificityScore as Ut, RouterContext as V, ConventionRouteMetadata as Vn, ContainerLike as Vr, extractParamNames as Vt, UriOptions as W, RouteBody as Wn, WhenOptions as Wr, sortRoutesBySpecificity as Wt, SSEStreamingApi$1 as X, RouterEnv as Xn, RouteRegistrationInput as Xt, SSEMessage as Y, RouteResponseObject as Yn, RegisteredRoute as Yt, StreamingApi$1 as Z, RouterVariables as Zn, RouteRegistry as Zt, Messages as _, ClassProvider as _n, DIToken as _r, createDomainMiddleware as _t, InternalError as a, HonoApp as an, VERSION_NEUTRAL as ar, RouteNameNotFoundError as at, messages as b, FactoryProvider as bn, RouteMatcher as br, errorResponseSchema as bt, getHttpStatus as c, IController as cn, runWithContainer as cr, RouteNotFoundError as ct, ApplicationError as d, CommandResult as dn, Transient as dr, HonoAppAlreadyConfiguredError as dt, RouteConfigurable as en, VersioningOptions as er, InvalidSignatureError as et, ERROR_CODES as f, ParsedArgument as fn, INJECT_PARAM_METADATA_KEY as fr, ControllerRegistrationError as ft, MessageRegistry as g, AsyncModuleOptions as gn, CONTAINER_TOKEN as gr, VerifySignatureMiddleware as gt, MessageLoaderService as h, Quarry as hn, getMethodInjections as hr, verifySignedUrl as ht, isApplicationError as i, ResolvedPath as in, SECURITY_SCHEMES as ir, ResponseValidationError as it, CliExceptionContext as j, ExceptionHandler as jn, delay as jr, Get as jt, TranslationMissingError as k, RegistryEntry as kn, DependencyContainer$1 as kr, All as kt, resolveHttpStatus as l, CommandInput as ln, RequestScopeOperationNotAllowedError as lr, OpenAPIValidationError as lt, I18nContextMiddleware as m, ParsedSignature as mn, ParamInjection as mr, signUrl as mt, RequestContainerNotInitializedError as n, RouterGroupConfig as nn, ROUTER_CONTEXT_KEYS as nr, MissingEnvironmentVariableError as nt, HttpException as o, Middleware as on, containerStorage as or, RouterUseScopeError as ot, ErrorCode as p, ParsedOption as pn, InjectParam as pr, SignedUrlOptions as pt, ApplicationConfig as q, RouteMetadata as qn, isErrorResponse as qr, ROUTER_TOKENS as qt, ContainerNotInitializedError as r, LocalePathService as rn, ROUTE_METADATA_KEYS as rr, MissingRouteParamError as rt, abort as s, Next$1 as sn, getContainer as sr, SchemaValidationError as st, StratalNotInitializedError as t, Router as tn, HTTP_METHODS as tr, MiddlewareNextCalledMultipleTimesError as tt, DefaultExceptionHandler as u, CommandInternals as un, ConditionalBindingFallbackError as ur, OpenAPIRouteRegistrationError as ut, getLocales as v, DynamicModule as vn, DI_TOKENS as vr, parseDomainPattern as vt, I18nModuleOptions as w, ModuleOptions as wn, SerializedRoute as wr, uuidParamSchema as wt, I18N_TOKENS as x, InjectionToken$2 as xn, RouteName as xr, paginatedResponseSchema as xt, getMessages as y, ExistingProvider as yn, CurrentRoute as yr, commonErrorSchemas as yt, createQueueExceptionContext as z, StratalExecutionContext as zn, ConditionalBindingUse as zr, createMiddlewareChain as zt };
|
|
4430
|
+
//# sourceMappingURL=index-ByOyTmqf.d.mts.map
|