@guren/server 1.5.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/{AuthManager-C84xF5ks.d.ts → AuthManager-DBP4KYsx.d.ts} +1 -1
  2. package/dist/{ConsoleKernel-D0dkFt6u.d.ts → ConsoleKernel-CJg975mp.d.ts} +1 -1
  3. package/dist/DocsViewerServiceProvider-D7RGJPGM.js +75 -0
  4. package/dist/{I18nManager-CmUqj6bU.d.ts → I18nManager-BiSoczfV.d.ts} +1 -1
  5. package/dist/McpServiceProvider-7BB5FPF3.js +8 -0
  6. package/dist/auth/index.d.ts +39 -29
  7. package/dist/auth/index.js +2 -2
  8. package/dist/broadcasting/index.js +2 -2
  9. package/dist/cache/index.js +2 -2
  10. package/dist/chunk-2V3YID4H.js +20 -0
  11. package/dist/chunk-AZOYI43J.js +18 -0
  12. package/dist/{chunk-DCYKSYAT.js → chunk-B5E5VBDI.js} +54 -2
  13. package/dist/{chunk-NYQGAWDN.js → chunk-BZMZEFRG.js} +7 -11
  14. package/dist/{chunk-4SBGSJNT.js → chunk-CWI4AJ47.js} +2 -1
  15. package/dist/{chunk-NQCZQAJL.js → chunk-DSDX3ASM.js} +21 -2
  16. package/dist/{chunk-SHYRVOMJ.js → chunk-EARA7JM4.js} +3 -3
  17. package/dist/{chunk-MC752CQT.js → chunk-EI5GYMAT.js} +2 -1
  18. package/dist/{chunk-AUXQISW5.js → chunk-HONCNQXZ.js} +38 -5
  19. package/dist/{chunk-CSRQTEQA.js → chunk-HWEWL6TE.js} +6 -1
  20. package/dist/chunk-JBG4AR24.js +18 -0
  21. package/dist/{chunk-RNXTRWKL.js → chunk-K6CUBJX6.js} +9 -15
  22. package/dist/{chunk-Z3HXKWI6.js → chunk-KTNJG7R7.js} +4 -0
  23. package/dist/{chunk-74HTZG3V.js → chunk-LAJQCSSF.js} +24 -0
  24. package/dist/{chunk-H32L2NE3.js → chunk-LVJCZCAV.js} +20 -13
  25. package/dist/{chunk-5AD7LYWO.js → chunk-N7PLD7MB.js} +9 -8
  26. package/dist/{chunk-ONSDE37A.js → chunk-SFQP6O52.js} +1 -0
  27. package/dist/{chunk-XMQZENBP.js → chunk-TVY72CLV.js} +3 -1
  28. package/dist/chunk-WIXGT4TN.js +18 -0
  29. package/dist/{email-verification-H_WlpsVH.d.ts → email-verification-D60YF2ZO.d.ts} +5 -3
  30. package/dist/encryption/index.js +2 -2
  31. package/dist/events/index.js +1 -1
  32. package/dist/i18n/index.d.ts +2 -2
  33. package/dist/index.d.ts +333 -333
  34. package/dist/index.js +242 -88
  35. package/dist/lambda/index.d.ts +5 -5
  36. package/dist/mail/index.js +3 -2
  37. package/dist/mcp/index.d.ts +14 -4
  38. package/dist/mcp/index.js +3 -2
  39. package/dist/notifications/index.d.ts +5 -5
  40. package/dist/notifications/index.js +3 -2
  41. package/dist/queue/index.d.ts +5 -5
  42. package/dist/queue/index.js +1 -1
  43. package/dist/redis/index.d.ts +4 -4
  44. package/dist/redis/index.js +7 -0
  45. package/dist/runtime/index.d.ts +5 -5
  46. package/dist/runtime/index.js +24 -9
  47. package/dist/scheduling/index.js +2 -2
  48. package/dist/storage/index.js +2 -1
  49. package/dist/{Application-Bi-olFMF.d.ts → validation-yAL53e1S.d.ts} +776 -721
  50. package/package.json +3 -3
  51. package/dist/McpServiceProvider-TZWQWXCT.js +0 -7
  52. package/dist/{api-token-COQHXyM_.d.ts → api-token-D24VPr_E.d.ts} +101 -101
  53. package/dist/{client-BQwF2b9Y.d.ts → rate-limit-D9J2b4S1.d.ts} +36 -36
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { E as ErrorResponse, a as Container, e as ServiceProviderConstructor, S as ServiceProvider, I as InputInterface, P as ParsedSignature, f as OptionDefinition, g as CommandInstance, O as OutputInterface, h as ServiceBindings, Q as QueueManager, N as NotificationManager } from './Application-Bi-olFMF.js';
2
- export { A as Application, i as ApplicationListenOptions, j as ApplicationOptions, k as ArgumentDefinition, m as AuthPayload, n as AuthPluginOptions, o as CSRF_FORM_FIELD, p as CSRF_HEADER_NAME, q as CSRF_TOKEN_KEY, C as CommandClass, b as ConsoleKernelOptions, r as ContainerProvider, t as ContextualBinding, u as ContextualBindingBuilder, v as ContextualNeedsBuilder, w as Controller, x as ControllerInertiaProps, y as CsrfOptions, z as DatabaseChannelOptions, B as DatabaseNotification, F as ExceptionClass, H as ExceptionHandler, J as ExceptionHandlerOptions, K as ExceptionRenderer, L as ExceptionReporter, M as FailedJob, R as GurenModule, T as HostAuthorizationOptions, U as HstsOptions, V as InertiaDocumentContext, W as InertiaDocumentOptions, X as InertiaOptions, Y as InertiaPagePayload, Z as InertiaResponse, _ as InertiaSharedProps, $ as InertiaSsrContext, a0 as InertiaSsrOptions, a1 as InertiaSsrRenderer, a2 as InertiaSsrResult, a3 as InferInertiaProps, a4 as Job, a5 as JobClass, a6 as JobFailureHandler, a7 as JobHandler, a8 as JobOptions, a9 as ModuleDefinition, aa as Notifiable, ab as Notification, ac as NotificationAttachment, ad as NotificationChannel, ae as NotificationChannelFactory, af as NotificationClass, ag as NotificationMailMessage, ah as NotificationManagerOptions, ai as ProgressInterface, aj as PromptInterface, ak as ProviderManager, al as QueueConfig, am as QueueDriver, an as QueueDriverFactory, ao as QueuedJob, ap as RendererRegistration, aq as ResolvedSharedInertiaProps, ar as ResourceRouteOptions, as as RouteBuilder, at as RouteContractOptions, au as RouteDefinition, av as RouteOpenApiMetadata, aw as RouteResourceAction, ax as Router, ay as ScheduledCommand, az as SecurityHeadersOptions, aA as SentNotification, aB as ServiceBinding, aC as ServiceClass, aD as ServiceFactory, aE as ServiceProviderClass, aF as ServiceProviderOptions, aG as SharedInertiaPropsResolver, aH as SlackAttachment, aI as SlackBlock, aJ as SlackMessage, aK as VALIDATED_DATA_KEY, aL as ValidateRequestOptions, aM as ValidationSchema, aN as WorkerOptions, aO as abort, aP as abortIf, aQ as abortUnless, aR as clearJobRegistry, aS as createApp, aT as createContainer, aU as createCsrfMiddleware, aV as createExceptionHandler, aW as createHostAuthorizationMiddleware, aX as createNotificationManager, aY as createQueueManager, aZ as createSecurityHeaders, a_ as csrfField, a$ as defineModule, b0 as formatValidationErrors, b1 as getContainer, b2 as getCsrfToken, b3 as getExceptionHandler, b4 as getInertiaSharedPropsResolver, b5 as getJob, b6 as getNotificationManager, b7 as getQueueDriver, b8 as getRegisteredJobs, b9 as getValidatedData, ba as inertia, bb as mountModuleRoutes, bc as parseRequestPayload, bd as registerJob, be as resolve, bf as resolveJobName, bg as setContainer, bh as setExceptionHandler, bi as setInertiaDocument, bj as setInertiaSharedProps, bk as setInertiaSsrRenderer, bl as setNotificationManager, bm as setQueueDriver, bn as shareInertiaProps, bo as validate, bp as validateRequest, bq as validateRequestWith, br as validateSafe, bs as verifyCsrfToken } from './Application-Bi-olFMF.js';
1
+ import { E as ErrorResponse, S as ServiceProvider, a as Container, e as ServiceProviderConstructor, I as InputInterface, P as ParsedSignature, f as OptionDefinition, g as CommandInstance, O as OutputInterface, h as ServiceBindings, Q as QueueManager, N as NotificationManager } from './validation-yAL53e1S.js';
2
+ export { A as Application, i as ApplicationListenOptions, j as ApplicationOptions, k as ArgumentDefinition, m as AuthPayload, n as AuthPluginOptions, o as CSRF_FORM_FIELD, p as CSRF_HEADER_NAME, q as CSRF_TOKEN_KEY, C as CommandClass, b as ConsoleKernelOptions, r as ContainerProvider, t as ContextualBinding, u as ContextualBindingBuilder, v as ContextualNeedsBuilder, w as Controller, x as ControllerInertiaProps, y as CsrfOptions, z as DatabaseChannelOptions, B as DatabaseNotification, F as ExceptionClass, H as ExceptionHandler, J as ExceptionHandlerOptions, K as ExceptionRenderer, L as ExceptionReporter, M as FailedJob, R as GurenModule, T as HostAuthorizationOptions, U as HstsOptions, V as InertiaDocumentContext, W as InertiaDocumentOptions, X as InertiaOptions, Y as InertiaPagePayload, Z as InertiaResponse, _ as InertiaSharedProps, $ as InertiaSsrContext, a0 as InertiaSsrOptions, a1 as InertiaSsrRenderer, a2 as InertiaSsrResult, a3 as InferInertiaProps, a4 as Job, a5 as JobClass, a6 as JobFailureHandler, a7 as JobHandler, a8 as JobOptions, a9 as ModuleDefinition, aa as Notifiable, ab as Notification, ac as NotificationAttachment, ad as NotificationChannel, ae as NotificationChannelFactory, af as NotificationClass, ag as NotificationMailMessage, ah as NotificationManagerOptions, ai as ProgressInterface, aj as PromptInterface, ak as ProviderManager, al as QueueConfig, am as QueueDriver, an as QueueDriverFactory, ao as QueuedJob, ap as RendererRegistration, aq as ResolvedSharedInertiaProps, ar as ResourceRouteOptions, as as RouteBuilder, at as RouteContractOptions, au as RouteDefinition, av as RouteMiddlewareInput, aw as RouteOpenApiMetadata, ax as RouteResourceAction, ay as Router, az as ScheduledCommand, aA as SecurityHeadersOptions, aB as SentNotification, aC as ServiceBinding, aD as ServiceClass, aE as ServiceFactory, aF as ServiceProviderClass, aG as ServiceProviderOptions, aH as SharedInertiaPropsResolver, aI as SlackAttachment, aJ as SlackBlock, aK as SlackMessage, aL as VALIDATED_DATA_KEY, aM as ValidateRequestOptions, aN as ValidationSchema, aO as WorkerOptions, aP as abort, aQ as abortIf, aR as abortUnless, aS as clearJobRegistry, aT as createApp, aU as createContainer, aV as createCsrfMiddleware, aW as createExceptionHandler, aX as createHostAuthorizationMiddleware, aY as createNotificationManager, aZ as createQueueManager, a_ as createSecurityHeaders, a$ as csrfField, b0 as defineModule, b1 as formatValidationErrors, b2 as getContainer, b3 as getCsrfToken, b4 as getExceptionHandler, b5 as getInertiaSharedPropsResolver, b6 as getJob, b7 as getNotificationManager, b8 as getQueueDriver, b9 as getRegisteredJobs, ba as getValidatedData, bb as inertia, bc as mountModuleRoutes, bd as parseRequestPayload, be as registerJob, bf as resolve, bg as resolveJobName, bh as setContainer, bi as setExceptionHandler, bj as setInertiaDocument, bk as setInertiaSharedProps, bl as setInertiaSsrRenderer, bm as setNotificationManager, bn as setQueueDriver, bo as shareInertiaProps, bp as validate, bq as validateRequest, br as validateRequestWith, bs as validateSafe, bt as verifyCsrfToken } from './validation-yAL53e1S.js';
3
3
  import * as hono from 'hono';
4
4
  import { Context, MiddlewareHandler } from 'hono';
5
5
  export { Context } from 'hono';
6
- import { P as PasswordHasher } from './AuthManager-C84xF5ks.js';
7
- export { A as AuthManager, B as BaseUserProvider, M as ModelUserProvider } from './AuthManager-C84xF5ks.js';
6
+ import { P as PasswordHasher } from './AuthManager-DBP4KYsx.js';
7
+ export { A as AuthManager, B as BaseUserProvider, M as ModelUserProvider } from './AuthManager-DBP4KYsx.js';
8
8
  export { AuthenticatableModel, NodeHasher, ScryptHasher, SessionGuard } from './auth/index.js';
9
- export { b as EmailVerificationConfig, a as EmailVerificationToken, c as EmailVerificationTokenResult, E as EmailVerificationTokenStore, M as MemoryEmailVerificationStore, d as MemoryPasswordResetStore, e as PasswordResetConfig, f as PasswordResetTokenResult, P as PasswordResetTokenStore, g as buildPasswordResetUrl, h as buildVerificationUrl, i as completeEmailVerification, j as completePasswordReset, k as createEmailVerificationToken, l as createPasswordResetToken, m as isEmailVerified, p as parsePasswordResetUrl, n as parseVerificationUrl, r as requireVerifiedEmail, v as verifyEmailToken, o as verifyPasswordResetToken } from './email-verification-H_WlpsVH.js';
10
- import { g as AuthContext } from './api-token-COQHXyM_.js';
11
- export { m as API_TOKEN_KEY, j as ApiToken, i as ApiTokenStore, a as AuthCredentials, c as AuthManagerOptions, A as Authenticatable, B as BearerTokenMiddlewareOptions, n as CreateApiTokenOptions, o as CreateApiTokenResult, D as DefaultSanitizedKeys, e as Guard, d as GuardContext, G as GuardFactory, M as MemoryApiTokenStore, p as MemoryOAuthStateStore, q as MemorySessionStore, r as OAuthAuthorizeOptions, s as OAuthCallbackPayload, t as OAuthFallbackEmail, l as OAuthManager, u as OAuthManagerOptions, v as OAuthProviderConfig, w as OAuthProviderFactoryInput, x as OAuthStateConfig, k as OAuthStatePayload, O as OAuthStateStore, y as OAuthTokenResult, z as OAuthUserProfile, P as ProviderFactory, E as Sanitized, F as Session, h as SessionData, S as SessionStore, U as UserProvider, H as buildOAuthAuthorizeUrl, I as buildOAuthRedirectUrl, J as createApiToken, K as createBearerTokenMiddleware, L as createDiscordOAuthProviderConfig, N as createGitHubOAuthProviderConfig, Q as createGoogleOAuthProviderConfig, R as createOAuthManager, T as createOAuthState, V as createSessionMiddleware, W as exchangeOAuthCode, X as fetchOAuthUserProfile, Y as getApiToken, Z as getApiTokenOrFail, _ as getSessionFromContext, $ as getUserApiTokens, a0 as parseApiToken, a1 as parseOAuthRedirectUrl, a2 as revokeAllApiTokens, a3 as revokeApiToken, a4 as sanitizeOAuthRedirect, a5 as tokenCan, a6 as tokenCanAll, a7 as tokenCanAny, a8 as verifyApiToken, a9 as verifyOAuthState } from './api-token-COQHXyM_.js';
9
+ export { b as EmailVerificationConfig, a as EmailVerificationToken, c as EmailVerificationTokenResult, E as EmailVerificationTokenStore, M as MemoryEmailVerificationStore, d as MemoryPasswordResetStore, e as PasswordResetConfig, f as PasswordResetTokenResult, P as PasswordResetTokenStore, g as buildPasswordResetUrl, h as buildVerificationUrl, i as completeEmailVerification, j as completePasswordReset, k as createEmailVerificationToken, l as createPasswordResetToken, m as isEmailVerified, p as parsePasswordResetUrl, n as parseVerificationUrl, r as requireVerifiedEmail, v as verifyEmailToken, o as verifyPasswordResetToken } from './email-verification-D60YF2ZO.js';
10
+ import { g as AuthContext } from './api-token-D24VPr_E.js';
11
+ export { m as API_TOKEN_KEY, j as ApiToken, i as ApiTokenStore, a as AuthCredentials, c as AuthManagerOptions, A as Authenticatable, B as BearerTokenMiddlewareOptions, n as CreateApiTokenOptions, o as CreateApiTokenResult, D as DefaultSanitizedKeys, e as Guard, d as GuardContext, G as GuardFactory, M as MemoryApiTokenStore, p as MemoryOAuthStateStore, q as MemorySessionStore, r as OAuthAuthorizeOptions, s as OAuthCallbackPayload, t as OAuthFallbackEmail, l as OAuthManager, u as OAuthManagerOptions, v as OAuthProviderConfig, w as OAuthProviderFactoryInput, x as OAuthStateConfig, k as OAuthStatePayload, O as OAuthStateStore, y as OAuthTokenResult, z as OAuthUserProfile, P as ProviderFactory, E as Sanitized, F as Session, h as SessionData, S as SessionStore, U as UserProvider, H as buildOAuthAuthorizeUrl, I as buildOAuthRedirectUrl, J as createApiToken, K as createBearerTokenMiddleware, L as createDiscordOAuthProviderConfig, N as createGitHubOAuthProviderConfig, Q as createGoogleOAuthProviderConfig, R as createOAuthManager, T as createOAuthState, V as createSessionMiddleware, W as exchangeOAuthCode, X as fetchOAuthUserProfile, Y as getApiToken, Z as getApiTokenOrFail, _ as getSessionFromContext, $ as getUserApiTokens, a0 as parseApiToken, a1 as parseOAuthRedirectUrl, a2 as revokeAllApiTokens, a3 as revokeApiToken, a4 as sanitizeOAuthRedirect, a5 as tokenCan, a6 as tokenCanAll, a7 as tokenCanAny, a8 as verifyApiToken, a9 as verifyOAuthState } from './api-token-D24VPr_E.js';
12
12
  export { M as Middleware, d as defineMiddleware, j as jsonResponse } from './index-9_Jzj5jo.js';
13
13
  import { E as EventManager } from './EventManager-CmIoLt7r.js';
14
14
  export { a as Event, b as EventClass, c as EventListener, d as EventSubscription, L as ListenerOptions, R as RegisteredListener, e as createEventManager } from './EventManager-CmIoLt7r.js';
@@ -29,8 +29,8 @@ export { getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, matchesC
29
29
  import { L as LogManager } from './LogManager-7mxnkaPM.js';
30
30
  export { C as ConsoleChannelConfig, D as DailyFileChannelConfig, F as FileChannelConfig, a as LOG_LEVEL_PRIORITY, b as LogChannel, c as LogChannelConfig, d as LogChannelFactory, e as LogConfig, f as LogContext, g as LogEntry, h as LogFormatter, i as LogLevel, j as Logger, k as LoggerOptions, S as StackChannelConfig, l as createLogManager, m as filterSensitiveData, n as getLogManager, s as setLogManager } from './LogManager-7mxnkaPM.js';
31
31
  export { ConsoleChannel, DailyFileChannel, FileChannel } from './logging/index.js';
32
- import { I as I18nManager, T as Translator } from './I18nManager-CmUqj6bU.js';
33
- export { a as I18nConfig, P as PluralizationRule, R as ReplacementValues, b as TranslationLoader, c as TranslationLoaderFactory, d as TranslationMessages, e as TranslatorOptions, f as createI18n, g as getI18n, s as setI18n, t, h as tc } from './I18nManager-CmUqj6bU.js';
32
+ import { I as I18nManager, d as Translator } from './I18nManager-BiSoczfV.js';
33
+ export { a as I18nConfig, P as PluralizationRule, R as ReplacementValues, T as TranslationLoader, b as TranslationLoaderFactory, c as TranslationMessages, e as TranslatorOptions, f as createI18n, g as getI18n, s as setI18n, t, h as tc } from './I18nManager-BiSoczfV.js';
34
34
  export { JsonLoader, MemoryLoader, getPluralizationRule, pluralizationRules, selectPluralForm } from './i18n/index.js';
35
35
  export { C as CheckResult, a as HealthCheck, b as HealthCheckOptions, H as HealthManager, c as HealthMiddlewareOptions, d as HealthReport, e as HealthStatus, f as createHealthManager } from './HealthManager-DUyMIzsZ.js';
36
36
  export { CacheCheck, CacheCheckOptions, CacheStoreInterface, CustomCheck, CustomCheckCallback, DatabaseCheck, DatabaseCheckOptions, DatabaseConnection, MemoryCheck, MemoryCheckOptions, RedisCheck, RedisCheckOptions, RedisClient, StorageCheck, StorageCheckOptions, StorageDriverInterface, customCheck } from './health/index.js';
@@ -39,12 +39,12 @@ import { B as BroadcastManager } from './BroadcastManager-D8KoJxiV.js';
39
39
  export { A as AuthMiddlewareOptions, a as BroadcastDriver, b as BroadcastDriverFactory, c as BroadcastEvent, d as BroadcastManagerOptions, e as BroadcastableEvent, C as Channel, f as ChannelAuthorizer, g as ChannelRegistration, P as PresenceBroadcastDriver, h as PresenceChannel, i as PresenceChannelAuthorizer, j as PresenceMember, k as PrivateChannel, S as SSEClient, l as SSEMiddlewareOptions, W as WebSocketClient, m as createBroadcastManager, n as getBroadcastManager, s as setBroadcastManager } from './BroadcastManager-D8KoJxiV.js';
40
40
  export { RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, createTypedBroadcaster } from './broadcasting/index.js';
41
41
  import * as readline from 'readline';
42
- export { C as ConsoleKernel, c as createConsoleKernel } from './ConsoleKernel-D0dkFt6u.js';
42
+ export { C as ConsoleKernel, c as createConsoleKernel } from './ConsoleKernel-CJg975mp.js';
43
43
  export { R as AuthResponse, A as AuthUser, a as AuthorizationResponse, b as AuthorizeOptions, G as Gate, c as GateCallback, d as GateDefinition, e as GateOptions, P as PolicyClass, f as PolicyInterface, g as PolicyMethod, h as PolicyRegistration, i as ResourceAction, j as ResponseBuilder, k as authorizeAbility, l as can, m as cannot, n as createGate, o as defineGate, p as getGate, s as setGate } from './Gate-CynjZCtS.js';
44
44
  export { AuthorizedContext, Policy, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, definePolicy, withAuthorization } from './authorization/index.js';
45
45
  export { A as AppKeyring, D as DecryptOptions, a as EncryptOptions, b as EncryptedPayload, E as Encrypter, c as EncrypterConfig, H as HashAlgorithm, d as HmacOptions, P as PasswordHashOptions, R as RandomStringOptions, e as createEncrypter, f as decrypt, g as deriveAppKey, h as deriveAppKeyring, i as encrypt, j as generateAppKey, k as generateKey, l as getAppKeyringFromEnv, m as getEncrypter, n as normalizeAppKey, p as parseAppKey, o as parsePreviousAppKeys, s as setEncrypter } from './app-key-CsBfRC_Q.js';
46
46
  export { MessageSigner, SignMessageOptions, SignedMessageClaims, SignedUrlOptions, VerifySignedMessageOptions, VerifySignedUrlOptions, check as checkHash, generateOtp, generatePassword, generateSlug, hash, hashPassword, hmac, md5, needsRehash, pick, random, randomBase64, randomBase64Url, randomHex, randomInt, randomString, sample, secureCompare, sha256, sha512, shuffle, signUrl, urlSafeToken, uuid, verifyHmac, verifyPassword, verifySignedUrl } from './encryption/index.js';
47
- export { M as MemoryRateLimitStore, a as RateLimitEntry, d as RateLimitInfo, e as RateLimitOptions, R as RateLimitStore, S as SlidingWindowRateLimitStore, f as createRateLimitMiddleware, c as createRedisClient, g as getRateLimitInfo, r as resetRateLimit } from './client-BQwF2b9Y.js';
47
+ export { M as MemoryRateLimitStore, a as RateLimitEntry, d as RateLimitInfo, e as RateLimitOptions, R as RateLimitStore, S as SlidingWindowRateLimitStore, f as createRateLimitMiddleware, c as createRedisClient, g as getRateLimitInfo, r as resetRateLimit } from './rate-limit-D9J2b4S1.js';
48
48
  import 'vite';
49
49
  import '@guren/orm';
50
50
  import 'ioredis';
@@ -59,253 +59,17 @@ declare function attachAuthContext(contextFactory: (ctx: Context) => AuthContext
59
59
  declare function requireAuthenticated(options?: RequireAuthOptions): MiddlewareHandler;
60
60
  declare function requireGuest(options?: RequireAuthOptions): MiddlewareHandler;
61
61
 
62
- interface CspDirectives {
63
- defaultSrc?: string[];
64
- scriptSrc?: string[];
65
- styleSrc?: string[];
66
- imgSrc?: string[];
67
- fontSrc?: string[];
68
- connectSrc?: string[];
69
- mediaSrc?: string[];
70
- objectSrc?: string[];
71
- frameSrc?: string[];
72
- childSrc?: string[];
73
- workerSrc?: string[];
74
- frameAncestors?: string[];
75
- formAction?: string[];
76
- baseUri?: string[];
77
- manifestSrc?: string[];
78
- upgradeInsecureRequests?: boolean;
79
- blockAllMixedContent?: boolean;
80
- /** Escape hatch for directives not listed above. */
81
- [directive: string]: string[] | boolean | undefined;
82
- }
83
- interface CspOptions {
84
- /** CSP directives configuration. */
85
- directives?: CspDirectives;
86
- /** Use Content-Security-Policy-Report-Only instead. Default: false */
87
- reportOnly?: boolean;
88
- /** URI for CSP violation reports. */
89
- reportUri?: string;
90
- /** Generate a per-request nonce and auto-append to script-src and style-src. Default: false */
91
- useNonce?: boolean;
92
- }
93
- declare const CSP_NONCE_KEY = "csp-nonce";
94
- /**
95
- * Retrieve the CSP nonce for the current request.
96
- * Only available when `useNonce: true` is set.
97
- */
98
- declare function getCspNonce(ctx: Context): string;
99
- /**
100
- * Middleware that sets Content-Security-Policy headers.
101
- *
102
- * @example
103
- * ```ts
104
- * import { createCspMiddleware, getCspNonce } from '@guren/core'
105
- *
106
- * app.use('*', createCspMiddleware({
107
- * directives: {
108
- * defaultSrc: ["'self'"],
109
- * scriptSrc: ["'self'", 'https://cdn.example.com'],
110
- * styleSrc: ["'self'", "'unsafe-inline'"],
111
- * imgSrc: ["'self'", 'data:', 'https:'],
112
- * objectSrc: ["'none'"],
113
- * },
114
- * useNonce: true,
115
- * reportUri: '/csp-report',
116
- * }))
117
- * ```
118
- */
119
- declare function createCspMiddleware(options?: CspOptions): MiddlewareHandler;
120
-
121
- interface CorsOptions {
122
- /**
123
- * Allowed origins. Default: none (same-origin policy applies).
124
- * - A string: exact origin match (use '*' to allow all origins)
125
- * - An array of strings: multiple allowed origins
126
- * - A function: dynamic origin evaluation
127
- */
128
- origin?: string | string[] | ((origin: string, ctx: unknown) => string | undefined | null);
129
- /** Allowed HTTP methods. Default: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH'] */
130
- allowMethods?: string[];
131
- /** Allowed request headers. */
132
- allowHeaders?: string[];
133
- /** Headers exposed to the browser. */
134
- exposeHeaders?: string[];
135
- /** Preflight cache max-age in seconds. */
136
- maxAge?: number;
137
- /** Allow credentials (cookies, authorization headers). Default: false */
138
- credentials?: boolean;
139
- }
140
- /**
141
- * CORS middleware powered by Hono's built-in CORS support.
142
- *
143
- * @example
144
- * ```ts
145
- * import { createCorsMiddleware } from '@guren/core'
146
- *
147
- * // Allow specific origins
148
- * app.use('/api/*', createCorsMiddleware({
149
- * origin: ['https://example.com', 'https://app.example.com'],
150
- * credentials: true,
151
- * }))
152
- *
153
- * // Dynamic origin
154
- * app.use('/api/*', createCorsMiddleware({
155
- * origin: (origin) => origin.endsWith('.example.com') ? origin : null,
156
- * }))
157
- * ```
158
- */
159
- declare function createCorsMiddleware(options?: CorsOptions): MiddlewareHandler;
160
-
161
- interface RedirectSafetyOptions {
162
- /** Additional external hosts allowed as redirect targets. */
163
- allowedHosts?: string[];
164
- /** Fallback URL when an unsafe redirect is blocked. Default: '/' */
165
- fallbackUrl?: string;
166
- }
167
- /**
168
- * Middleware that prevents open redirect attacks by validating
169
- * redirect destinations in 3xx responses.
170
- *
171
- * @example
172
- * ```ts
173
- * import { createRedirectSafetyMiddleware } from '@guren/core'
174
- *
175
- * app.use('*', createRedirectSafetyMiddleware({
176
- * allowedHosts: ['accounts.google.com'],
177
- * }))
178
- * ```
179
- */
180
- declare function createRedirectSafetyMiddleware(options?: RedirectSafetyOptions): MiddlewareHandler;
181
- /**
182
- * Check whether a redirect URL is safe (same-origin or in the allowed list).
183
- *
184
- * @param url - The redirect target URL
185
- * @param requestUrl - The current request URL (used to determine the origin)
186
- * @param allowedHosts - Additional allowed external hosts
187
- */
188
- declare function isSafeRedirectUrl(url: string, requestUrl: string, allowedHosts?: string[]): boolean;
189
-
190
- interface ForceHttpsOptions {
191
- /**
192
- * HSTS max-age in seconds. Default: 31536000 (1 year).
193
- */
194
- hstsMaxAge?: number;
195
- /**
196
- * Include subdomains in HSTS. Default: true.
197
- */
198
- hstsIncludeSubDomains?: boolean;
199
- /**
200
- * Enable HSTS preload. Default: false.
201
- */
202
- hstsPreload?: boolean;
203
- /**
204
- * Paths to exclude from HTTPS redirect (e.g., health checks).
205
- */
206
- exclude?: string[];
207
- }
208
- /**
209
- * Middleware that redirects HTTP requests to HTTPS and sets the
210
- * Strict-Transport-Security header. Equivalent to Rails' `force_ssl`.
211
- *
212
- * @example
213
- * ```ts
214
- * import { createForceHttpsMiddleware } from '@guren/core'
215
- *
216
- * // In production only
217
- * if (process.env.NODE_ENV === 'production') {
218
- * app.use('*', createForceHttpsMiddleware())
219
- * }
220
- * ```
221
- */
222
- declare function createForceHttpsMiddleware(options?: ForceHttpsOptions): MiddlewareHandler;
223
-
224
- /**
225
- * Middleware that generates a unique request ID for each request.
226
- * Reads from the `X-Request-ID` header if present, otherwise generates one
227
- * using `crypto.randomUUID()`.
228
- * Attaches the ID to the Hono context (`c.get('requestId')`) and sets it
229
- * on the response header.
230
- *
231
- * @example
232
- * ```ts
233
- * import { requestIdMiddleware } from '@guren/core'
234
- *
235
- * app.use('*', requestIdMiddleware())
236
- * ```
237
- */
238
- declare function requestIdMiddleware(): hono.MiddlewareHandler<{
239
- Variables: {
240
- requestId: string;
241
- };
242
- }, string, {}, Response>;
243
-
62
+ type ViewRenderer = (template: string, props: Record<string, unknown>) => Response | Promise<Response>;
244
63
  /**
245
- * Middleware that logs HTTP requests with method, path, status, and duration.
246
- * Uses structured JSON format suitable for production monitoring and log collectors.
247
- *
248
- * Pairs well with {@link requestIdMiddleware} — if a `requestId` is set on the
249
- * context, it will be included in the log entry.
250
- *
251
- * @example
252
- * ```ts
253
- * import { requestIdMiddleware, requestLoggingMiddleware } from '@guren/core'
254
- *
255
- * app.use('*', requestIdMiddleware())
256
- * app.use('*', requestLoggingMiddleware())
257
- * ```
64
+ * Registry for view renderers. Engines are typically registered via service
65
+ * providers so applications can opt into or replace implementations.
258
66
  */
259
- declare function requestLoggingMiddleware(): hono.MiddlewareHandler<any, string, {}, Response>;
260
-
261
- /** Context key for the resolved request locale (read by Inertia for `<html lang>`). */
262
- declare const LOCALE_CONTEXT_KEY = "locale";
263
- type LocaleSource = 'query' | 'cookie' | 'header';
264
- /** Context variables set by {@link detectLocaleMiddleware}, for typing Hono apps. */
265
- type DetectLocaleVariables = {
266
- locale: string;
267
- t?: Translator['t'];
268
- tc?: Translator['tc'];
269
- };
270
- interface DetectLocaleOptions {
271
- /** Locales the app supports. Detection only ever resolves to one of these. */
272
- supported: readonly string[];
273
- /** Locale used when no source matches (defaults to the first supported locale). */
274
- fallback?: string;
275
- /** Detection order (defaults to `['query', 'cookie', 'header']`). */
276
- sources?: readonly LocaleSource[];
277
- /** Query parameter to read (defaults to `locale`). */
278
- queryParam?: string;
279
- /** Cookie to read (defaults to `locale`). */
280
- cookieName?: string;
281
- /**
282
- * i18n manager used to bind request-scoped `t`/`tc` translator helpers.
283
- * Defaults to the global manager when one was registered via `setI18n()`;
284
- * pass a manager explicitly (e.g. `app.container.make('i18n')`), or `false`
285
- * to skip the translator binding entirely.
286
- */
287
- i18n?: I18nManager | false;
67
+ declare class ViewEngine {
68
+ private static readonly engines;
69
+ static register(name: string, renderer: ViewRenderer): void;
70
+ static has(name: string): boolean;
71
+ static render(name: string, template: string, props: Record<string, unknown>): Response | Promise<Response>;
288
72
  }
289
- /**
290
- * Middleware that resolves the request locale from the query string, a cookie,
291
- * or the `Accept-Language` header — in that order by default — restricted to
292
- * the `supported` allowlist.
293
- *
294
- * The result is stored as the `locale` context variable, which Inertia
295
- * responses pick up for the root `<html lang>` attribute. When an i18n manager
296
- * is available (see the `i18n` option), request-scoped `t`/`tc` translator
297
- * helpers are attached as well.
298
- *
299
- * @example
300
- * ```ts
301
- * import { detectLocaleMiddleware } from '@guren/core'
302
- *
303
- * app.use('*', detectLocaleMiddleware({ supported: ['en', 'ja'] }))
304
- * ```
305
- */
306
- declare function detectLocaleMiddleware(options: DetectLocaleOptions): hono.MiddlewareHandler<{
307
- Variables: DetectLocaleVariables;
308
- }, string, {}, Response>;
309
73
 
310
74
  /**
311
75
  * Base HTTP exception class.
@@ -605,79 +369,6 @@ declare class MethodNotAllowedException extends HttpException {
605
369
 
606
370
  declare function renderErrorPage(statusCode: number, message?: string): string;
607
371
 
608
- /**
609
- * Declarative definition of a plugin's lifecycle hooks.
610
- *
611
- * `register` and `boot` mirror the ServiceProvider hooks and receive the
612
- * container plus the configuration captured by the plugin factory.
613
- */
614
- interface PluginDefinition<TConfig = void> {
615
- /**
616
- * Diagnostic name for the plugin (e.g. 'analytics').
617
- * Used to derive the generated provider class name.
618
- */
619
- name: string;
620
- /**
621
- * Register services into the container.
622
- * Called before any provider has booted.
623
- */
624
- register(container: Container, config: TConfig): void | Promise<void>;
625
- /**
626
- * Bootstrap after all providers have registered.
627
- */
628
- boot?(container: Container, config: TConfig): void | Promise<void>;
629
- /**
630
- * Defer instantiation until one of the `provides` services is resolved.
631
- * Maps to `ServiceProvider.deferred`.
632
- */
633
- deferred?: boolean;
634
- /**
635
- * Services bound by this plugin (required when `deferred` is true).
636
- * Maps to `ServiceProvider.provides`.
637
- */
638
- provides?: string[];
639
- }
640
- /**
641
- * A factory returned by `definePlugin()`. Each call produces an independent
642
- * ServiceProvider subclass with the given configuration captured in a closure.
643
- */
644
- type PluginFactory<TConfig = void> = (config: TConfig) => ServiceProviderConstructor;
645
- /**
646
- * Define a configurable Guren plugin without ServiceProvider boilerplate.
647
- *
648
- * Unlike storing configuration on a static class property, each factory call
649
- * returns a fresh provider class, so the same plugin can be registered twice
650
- * with different configurations.
651
- *
652
- * @example
653
- * ```typescript
654
- * export const analyticsPlugin = definePlugin<AnalyticsConfig>({
655
- * name: 'analytics',
656
- * register(container, config) {
657
- * container.singleton('analytics', () => new AnalyticsClient(config))
658
- * },
659
- * })
660
- *
661
- * // In the application:
662
- * createApp({
663
- * providers: [analyticsPlugin({ apiKey: process.env.ANALYTICS_API_KEY! })],
664
- * })
665
- * ```
666
- */
667
- declare function definePlugin<TConfig = void>(definition: PluginDefinition<TConfig>): PluginFactory<TConfig>;
668
-
669
- type ViewRenderer = (template: string, props: Record<string, unknown>) => Response | Promise<Response>;
670
- /**
671
- * Registry for view renderers. Engines are typically registered via service
672
- * providers so applications can opt into or replace implementations.
673
- */
674
- declare class ViewEngine {
675
- private static readonly engines;
676
- static register(name: string, renderer: ViewRenderer): void;
677
- static has(name: string): boolean;
678
- static render(name: string, template: string, props: Record<string, unknown>): Response | Promise<Response>;
679
- }
680
-
681
372
  /**
682
373
  * Registers the Inertia view engine and wires up validation error handling
683
374
  * for Inertia requests (Laravel-style automatic redirect with flashed errors).
@@ -1954,11 +1645,72 @@ declare function decodeCursor(cursor: string): string;
1954
1645
  /**
1955
1646
  * Create a cursor paginator.
1956
1647
  */
1957
- declare function cursorPaginate<T>(items: T[], perPage: number, hasMore: boolean, options?: CursorPaginatorOptions & {
1958
- currentCursor?: string | null;
1959
- nextCursor?: string | null;
1960
- prevCursor?: string | null;
1961
- }): CursorPaginator<T>;
1648
+ declare function cursorPaginate<T>(items: T[], perPage: number, hasMore: boolean, options?: CursorPaginatorOptions & {
1649
+ currentCursor?: string | null;
1650
+ nextCursor?: string | null;
1651
+ prevCursor?: string | null;
1652
+ }): CursorPaginator<T>;
1653
+
1654
+ /**
1655
+ * Declarative definition of a plugin's lifecycle hooks.
1656
+ *
1657
+ * `register` and `boot` mirror the ServiceProvider hooks and receive the
1658
+ * container plus the configuration captured by the plugin factory.
1659
+ */
1660
+ interface PluginDefinition<TConfig = void> {
1661
+ /**
1662
+ * Diagnostic name for the plugin (e.g. 'analytics').
1663
+ * Used to derive the generated provider class name.
1664
+ */
1665
+ name: string;
1666
+ /**
1667
+ * Register services into the container.
1668
+ * Called before any provider has booted.
1669
+ */
1670
+ register(container: Container, config: TConfig): void | Promise<void>;
1671
+ /**
1672
+ * Bootstrap after all providers have registered.
1673
+ */
1674
+ boot?(container: Container, config: TConfig): void | Promise<void>;
1675
+ /**
1676
+ * Defer instantiation until one of the `provides` services is resolved.
1677
+ * Maps to `ServiceProvider.deferred`.
1678
+ */
1679
+ deferred?: boolean;
1680
+ /**
1681
+ * Services bound by this plugin (required when `deferred` is true).
1682
+ * Maps to `ServiceProvider.provides`.
1683
+ */
1684
+ provides?: string[];
1685
+ }
1686
+ /**
1687
+ * A factory returned by `definePlugin()`. Each call produces an independent
1688
+ * ServiceProvider subclass with the given configuration captured in a closure.
1689
+ */
1690
+ type PluginFactory<TConfig = void> = (config: TConfig) => ServiceProviderConstructor;
1691
+ /**
1692
+ * Define a configurable Guren plugin without ServiceProvider boilerplate.
1693
+ *
1694
+ * Unlike storing configuration on a static class property, each factory call
1695
+ * returns a fresh provider class, so the same plugin can be registered twice
1696
+ * with different configurations.
1697
+ *
1698
+ * @example
1699
+ * ```typescript
1700
+ * export const analyticsPlugin = definePlugin<AnalyticsConfig>({
1701
+ * name: 'analytics',
1702
+ * register(container, config) {
1703
+ * container.singleton('analytics', () => new AnalyticsClient(config))
1704
+ * },
1705
+ * })
1706
+ *
1707
+ * // In the application:
1708
+ * createApp({
1709
+ * providers: [analyticsPlugin({ apiKey: process.env.ANALYTICS_API_KEY! })],
1710
+ * })
1711
+ * ```
1712
+ */
1713
+ declare function definePlugin<TConfig = void>(definition: PluginDefinition<TConfig>): PluginFactory<TConfig>;
1962
1714
 
1963
1715
  /**
1964
1716
  * Parse a command signature into argument and option definitions.
@@ -2602,4 +2354,252 @@ declare class DefaultHasher implements PasswordHasher {
2602
2354
  verify(hashed: string, plain: string): Promise<boolean>;
2603
2355
  }
2604
2356
 
2357
+ interface CspDirectives {
2358
+ defaultSrc?: string[];
2359
+ scriptSrc?: string[];
2360
+ styleSrc?: string[];
2361
+ imgSrc?: string[];
2362
+ fontSrc?: string[];
2363
+ connectSrc?: string[];
2364
+ mediaSrc?: string[];
2365
+ objectSrc?: string[];
2366
+ frameSrc?: string[];
2367
+ childSrc?: string[];
2368
+ workerSrc?: string[];
2369
+ frameAncestors?: string[];
2370
+ formAction?: string[];
2371
+ baseUri?: string[];
2372
+ manifestSrc?: string[];
2373
+ upgradeInsecureRequests?: boolean;
2374
+ blockAllMixedContent?: boolean;
2375
+ /** Escape hatch for directives not listed above. */
2376
+ [directive: string]: string[] | boolean | undefined;
2377
+ }
2378
+ interface CspOptions {
2379
+ /** CSP directives configuration. */
2380
+ directives?: CspDirectives;
2381
+ /** Use Content-Security-Policy-Report-Only instead. Default: false */
2382
+ reportOnly?: boolean;
2383
+ /** URI for CSP violation reports. */
2384
+ reportUri?: string;
2385
+ /** Generate a per-request nonce and auto-append to script-src and style-src. Default: false */
2386
+ useNonce?: boolean;
2387
+ }
2388
+ declare const CSP_NONCE_KEY = "csp-nonce";
2389
+ /**
2390
+ * Retrieve the CSP nonce for the current request.
2391
+ * Only available when `useNonce: true` is set.
2392
+ */
2393
+ declare function getCspNonce(ctx: Context): string;
2394
+ /**
2395
+ * Middleware that sets Content-Security-Policy headers.
2396
+ *
2397
+ * @example
2398
+ * ```ts
2399
+ * import { createCspMiddleware, getCspNonce } from '@guren/core'
2400
+ *
2401
+ * app.use('*', createCspMiddleware({
2402
+ * directives: {
2403
+ * defaultSrc: ["'self'"],
2404
+ * scriptSrc: ["'self'", 'https://cdn.example.com'],
2405
+ * styleSrc: ["'self'", "'unsafe-inline'"],
2406
+ * imgSrc: ["'self'", 'data:', 'https:'],
2407
+ * objectSrc: ["'none'"],
2408
+ * },
2409
+ * useNonce: true,
2410
+ * reportUri: '/csp-report',
2411
+ * }))
2412
+ * ```
2413
+ */
2414
+ declare function createCspMiddleware(options?: CspOptions): MiddlewareHandler;
2415
+
2416
+ interface CorsOptions {
2417
+ /**
2418
+ * Allowed origins. Default: none (same-origin policy applies).
2419
+ * - A string: exact origin match (use '*' to allow all origins)
2420
+ * - An array of strings: multiple allowed origins
2421
+ * - A function: dynamic origin evaluation
2422
+ */
2423
+ origin?: string | string[] | ((origin: string, ctx: unknown) => string | undefined | null);
2424
+ /** Allowed HTTP methods. Default: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH'] */
2425
+ allowMethods?: string[];
2426
+ /** Allowed request headers. */
2427
+ allowHeaders?: string[];
2428
+ /** Headers exposed to the browser. */
2429
+ exposeHeaders?: string[];
2430
+ /** Preflight cache max-age in seconds. */
2431
+ maxAge?: number;
2432
+ /** Allow credentials (cookies, authorization headers). Default: false */
2433
+ credentials?: boolean;
2434
+ }
2435
+ /**
2436
+ * CORS middleware powered by Hono's built-in CORS support.
2437
+ *
2438
+ * @example
2439
+ * ```ts
2440
+ * import { createCorsMiddleware } from '@guren/core'
2441
+ *
2442
+ * // Allow specific origins
2443
+ * app.use('/api/*', createCorsMiddleware({
2444
+ * origin: ['https://example.com', 'https://app.example.com'],
2445
+ * credentials: true,
2446
+ * }))
2447
+ *
2448
+ * // Dynamic origin
2449
+ * app.use('/api/*', createCorsMiddleware({
2450
+ * origin: (origin) => origin.endsWith('.example.com') ? origin : null,
2451
+ * }))
2452
+ * ```
2453
+ */
2454
+ declare function createCorsMiddleware(options?: CorsOptions): MiddlewareHandler;
2455
+
2456
+ interface RedirectSafetyOptions {
2457
+ /** Additional external hosts allowed as redirect targets. */
2458
+ allowedHosts?: string[];
2459
+ /** Fallback URL when an unsafe redirect is blocked. Default: '/' */
2460
+ fallbackUrl?: string;
2461
+ }
2462
+ /**
2463
+ * Middleware that prevents open redirect attacks by validating
2464
+ * redirect destinations in 3xx responses.
2465
+ *
2466
+ * @example
2467
+ * ```ts
2468
+ * import { createRedirectSafetyMiddleware } from '@guren/core'
2469
+ *
2470
+ * app.use('*', createRedirectSafetyMiddleware({
2471
+ * allowedHosts: ['accounts.google.com'],
2472
+ * }))
2473
+ * ```
2474
+ */
2475
+ declare function createRedirectSafetyMiddleware(options?: RedirectSafetyOptions): MiddlewareHandler;
2476
+ /**
2477
+ * Check whether a redirect URL is safe (same-origin or in the allowed list).
2478
+ *
2479
+ * @param url - The redirect target URL
2480
+ * @param requestUrl - The current request URL (used to determine the origin)
2481
+ * @param allowedHosts - Additional allowed external hosts
2482
+ */
2483
+ declare function isSafeRedirectUrl(url: string, requestUrl: string, allowedHosts?: string[]): boolean;
2484
+
2485
+ interface ForceHttpsOptions {
2486
+ /**
2487
+ * HSTS max-age in seconds. Default: 31536000 (1 year).
2488
+ */
2489
+ hstsMaxAge?: number;
2490
+ /**
2491
+ * Include subdomains in HSTS. Default: true.
2492
+ */
2493
+ hstsIncludeSubDomains?: boolean;
2494
+ /**
2495
+ * Enable HSTS preload. Default: false.
2496
+ */
2497
+ hstsPreload?: boolean;
2498
+ /**
2499
+ * Paths to exclude from HTTPS redirect (e.g., health checks).
2500
+ */
2501
+ exclude?: string[];
2502
+ }
2503
+ /**
2504
+ * Middleware that redirects HTTP requests to HTTPS and sets the
2505
+ * Strict-Transport-Security header. Equivalent to Rails' `force_ssl`.
2506
+ *
2507
+ * @example
2508
+ * ```ts
2509
+ * import { createForceHttpsMiddleware } from '@guren/core'
2510
+ *
2511
+ * // In production only
2512
+ * if (process.env.NODE_ENV === 'production') {
2513
+ * app.use('*', createForceHttpsMiddleware())
2514
+ * }
2515
+ * ```
2516
+ */
2517
+ declare function createForceHttpsMiddleware(options?: ForceHttpsOptions): MiddlewareHandler;
2518
+
2519
+ /**
2520
+ * Middleware that generates a unique request ID for each request.
2521
+ * Reads from the `X-Request-ID` header if present, otherwise generates one
2522
+ * using `crypto.randomUUID()`.
2523
+ * Attaches the ID to the Hono context (`c.get('requestId')`) and sets it
2524
+ * on the response header.
2525
+ *
2526
+ * @example
2527
+ * ```ts
2528
+ * import { requestIdMiddleware } from '@guren/core'
2529
+ *
2530
+ * app.use('*', requestIdMiddleware())
2531
+ * ```
2532
+ */
2533
+ declare function requestIdMiddleware(): hono.MiddlewareHandler<{
2534
+ Variables: {
2535
+ requestId: string;
2536
+ };
2537
+ }, string, {}, Response>;
2538
+
2539
+ /**
2540
+ * Middleware that logs HTTP requests with method, path, status, and duration.
2541
+ * Uses structured JSON format suitable for production monitoring and log collectors.
2542
+ *
2543
+ * Pairs well with {@link requestIdMiddleware} — if a `requestId` is set on the
2544
+ * context, it will be included in the log entry.
2545
+ *
2546
+ * @example
2547
+ * ```ts
2548
+ * import { requestIdMiddleware, requestLoggingMiddleware } from '@guren/core'
2549
+ *
2550
+ * app.use('*', requestIdMiddleware())
2551
+ * app.use('*', requestLoggingMiddleware())
2552
+ * ```
2553
+ */
2554
+ declare function requestLoggingMiddleware(): hono.MiddlewareHandler<any, string, {}, Response>;
2555
+
2556
+ /** Context key for the resolved request locale (read by Inertia for `<html lang>`). */
2557
+ declare const LOCALE_CONTEXT_KEY = "locale";
2558
+ type LocaleSource = 'query' | 'cookie' | 'header';
2559
+ /** Context variables set by {@link detectLocaleMiddleware}, for typing Hono apps. */
2560
+ type DetectLocaleVariables = {
2561
+ locale: string;
2562
+ t?: Translator['t'];
2563
+ tc?: Translator['tc'];
2564
+ };
2565
+ interface DetectLocaleOptions {
2566
+ /** Locales the app supports. Detection only ever resolves to one of these. */
2567
+ supported: readonly string[];
2568
+ /** Locale used when no source matches (defaults to the first supported locale). */
2569
+ fallback?: string;
2570
+ /** Detection order (defaults to `['query', 'cookie', 'header']`). */
2571
+ sources?: readonly LocaleSource[];
2572
+ /** Query parameter to read (defaults to `locale`). */
2573
+ queryParam?: string;
2574
+ /** Cookie to read (defaults to `locale`). */
2575
+ cookieName?: string;
2576
+ /**
2577
+ * i18n manager used to bind request-scoped `t`/`tc` translator helpers.
2578
+ * Defaults to the global manager when one was registered via `setI18n()`;
2579
+ * pass a manager explicitly (e.g. `app.container.make('i18n')`), or `false`
2580
+ * to skip the translator binding entirely.
2581
+ */
2582
+ i18n?: I18nManager | false;
2583
+ }
2584
+ /**
2585
+ * Middleware that resolves the request locale from the query string, a cookie,
2586
+ * or the `Accept-Language` header — in that order by default — restricted to
2587
+ * the `supported` allowlist.
2588
+ *
2589
+ * The result is stored as the `locale` context variable, which Inertia
2590
+ * responses pick up for the root `<html lang>` attribute. When an i18n manager
2591
+ * is available (see the `i18n` option), request-scoped `t`/`tc` translator
2592
+ * helpers are attached as well.
2593
+ *
2594
+ * @example
2595
+ * ```ts
2596
+ * import { detectLocaleMiddleware } from '@guren/core'
2597
+ *
2598
+ * app.use('*', detectLocaleMiddleware({ supported: ['en', 'ja'] }))
2599
+ * ```
2600
+ */
2601
+ declare function detectLocaleMiddleware(options: DetectLocaleOptions): hono.MiddlewareHandler<{
2602
+ Variables: DetectLocaleVariables;
2603
+ }, string, {}, Response>;
2604
+
2605
2605
  export { AUTH_CONTEXT_KEY, AuthContext, AuthContext as AuthRuntimeContext, AuthServiceProvider, AuthenticationException, AuthorizationException, AuthorizationServiceProvider, AutoDiscovery, BaseFactory, type BaseResource, BaseSeeder, BroadcastManager, BroadcastServiceProvider, BufferedOutput, CSP_NONCE_KEY, CacheManager, CacheServiceProvider, Command, CommandInstance, Container, type CorsOptions, type CspDirectives, type CspOptions, type CursorPaginatedResponse, type CursorPaginationMeta, CursorPaginator, type CursorPaginatorOptions, DefaultHasher, type DetectLocaleOptions, type DetectLocaleVariables, type DiscoveryOptions, type DiscoveryResult, EncryptionServiceProvider, ErrorResponse, ErrorServiceProvider, EventManager, EventServiceProvider, BaseFactory as Factory, type FactoryClass, type Factory as FactoryInterface, FieldValidator, type FileLike, type FileValidationOptions, type ForceHttpsOptions, FormRequest, DefaultHasher as Hash, HealthServiceProvider, HttpException, I18nManager, I18nServiceProvider, type ImageValidationOptions, InertiaServiceProvider, type InferResourceData, Input, InputInterface, JsonResource, LOCALE_CONTEXT_KEY, type LocaleSource, LogManager, LogServiceProvider, MailManager, MailServiceProvider, MethodNotAllowedException, NotFoundHttpException, NotificationManager, NotificationServiceProvider, OAuthServiceProvider, OptionDefinition, Output, OutputInterface, type PaginatedPageProps, type PaginatedResponse, type PaginatedResultLike, type PaginationLinks, type PaginationMeta, type PaginationPageLink, Paginator, type PaginatorOptions, ParsedSignature, type PluginDefinition, type PluginFactory, QueueManager, QueueServiceProvider, type RedirectSafetyOptions, type RequireAuthOptions, Resource, type ResourceClass, ResourceCollection, type ResourceData, type RuleDefinition, Scheduler, SchedulingServiceProvider, BaseSeeder as Seeder, type SeederClass, type Seeder as SeederInterface, SeederRunner, type SeederRunnerOptions, ServiceBindings, ServiceProvider, ServiceProviderConstructor, StorageManager, StorageServiceProvider, Translator, type ValidationErrors, ValidationException, type ValidationResult, type ValidationRule, Validator, type ValidatorOptions, ViewEngine, after, afterOrEqual, alpha, alphaDash, alphaNum, array as arrayRule, attachAuthContext, before, beforeOrEqual, between, boolean as booleanRule, collect, confirmed, createCorsMiddleware, createCspMiddleware, createFacade, createFacades, createForceHttpsMiddleware, createRedirectSafetyMiddleware, createSeederRunner, createValidator, cursorPaginate, custom, dateFormat, date as dateRule, debugErrorMiddleware, decodeCursor, defineFactory, definePlugin, detectLocaleMiddleware, different, email as emailRule, encodeCursor, endsWith, exists, file as fileRule, getCspNonce, image as imageRule, inValues, integer, ip, ipv4, ipv6, isSafeRedirectUrl, json as jsonRule, max, maxFileSize, mimes, min, minFileSize, notIn, nullable, numeric, object as objectRule, paginate, parseSignature, quickValidate, quickValidateOrThrow, regex, renderDebugPage, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, same, size, startsWith, string as stringRule, unique, url as urlRule, uuid as uuidRule };