@guren/server 1.3.0 → 1.4.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 (42) hide show
  1. package/dist/{Application-DImeY-VW.d.ts → Application-BvBqgc2k.d.ts} +194 -14
  2. package/dist/{AuthManager-BU8ZvenF.d.ts → AuthManager-C84xF5ks.d.ts} +1 -1
  3. package/dist/{BroadcastManager-CGWl9rUO.d.ts → BroadcastManager-D8KoJxiV.d.ts} +21 -0
  4. package/dist/{CacheManager-BkvHEOZX.d.ts → CacheManager-BmDzUKrF.d.ts} +17 -0
  5. package/dist/{ConsoleKernel-COKndy_V.d.ts → ConsoleKernel-Dw9X9qZY.d.ts} +1 -1
  6. package/dist/{McpServiceProvider-RNTDHZAZ.js → McpServiceProvider-TZWQWXCT.js} +2 -2
  7. package/dist/{Scheduler-BstvSca7.d.ts → Scheduler-pZiT8i57.d.ts} +2 -0
  8. package/dist/{api-token-CB12xnVg.d.ts → api-token-COQHXyM_.d.ts} +68 -1
  9. package/dist/auth/index.d.ts +5 -5
  10. package/dist/auth/index.js +1 -1
  11. package/dist/authorization/index.js +2 -2
  12. package/dist/broadcasting/index.d.ts +2 -2
  13. package/dist/broadcasting/index.js +2 -1
  14. package/dist/cache/index.d.ts +2 -2
  15. package/dist/cache/index.js +2 -1
  16. package/dist/{chunk-EGU5KB7V.js → chunk-4SBGSJNT.js} +31 -1
  17. package/dist/{chunk-THSX7OOR.js → chunk-63SKW5PS.js} +3 -0
  18. package/dist/{chunk-VY2JPS6V.js → chunk-AUXQISW5.js} +83 -11
  19. package/dist/chunk-DCYKSYAT.js +63 -0
  20. package/dist/{chunk-ZRBLZY3M.js → chunk-FZD2AKJI.js} +1 -1
  21. package/dist/{chunk-CSP7W3WY.js → chunk-JIT7QVMJ.js} +2 -2
  22. package/dist/{chunk-HKQSAFSN.js → chunk-MC752CQT.js} +15 -0
  23. package/dist/{chunk-J753UWAY.js → chunk-NQCZQAJL.js} +93 -28
  24. package/dist/{chunk-STZUODC3.js → chunk-NYQGAWDN.js} +44 -1
  25. package/dist/{chunk-44F7JQ7I.js → chunk-XMQZENBP.js} +35 -1
  26. package/dist/{client-CKXJLsTe.d.ts → client-BQwF2b9Y.d.ts} +7 -0
  27. package/dist/{email-verification-D9u7krkn.d.ts → email-verification-H_WlpsVH.d.ts} +1 -1
  28. package/dist/{errors-JOOPDDQ6.js → errors-PUNHAFL2.js} +1 -1
  29. package/dist/index.d.ts +16 -16
  30. package/dist/index.js +181 -85
  31. package/dist/lambda/index.d.ts +7 -7
  32. package/dist/mcp/index.d.ts +53 -19
  33. package/dist/mcp/index.js +2 -2
  34. package/dist/notifications/index.d.ts +7 -7
  35. package/dist/queue/index.d.ts +7 -7
  36. package/dist/redis/index.d.ts +11 -21
  37. package/dist/redis/index.js +42 -6
  38. package/dist/runtime/index.d.ts +7 -7
  39. package/dist/runtime/index.js +1 -1
  40. package/dist/scheduling/index.d.ts +2 -2
  41. package/dist/scheduling/index.js +2 -1
  42. package/package.json +2 -2
@@ -11,7 +11,7 @@ import {
11
11
  getExceptionHandler,
12
12
  renderErrorPage,
13
13
  setExceptionHandler
14
- } from "./chunk-THSX7OOR.js";
14
+ } from "./chunk-63SKW5PS.js";
15
15
  import {
16
16
  AuthenticationException,
17
17
  HttpException
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { E as ErrorResponse, C as Container, c as ServiceProviderConstructor, S as ServiceProvider, d as ServiceBindings, Q as QueueManager, N as NotificationManager } from './Application-DImeY-VW.js';
2
- export { A as Application, e as ApplicationListenOptions, f as ApplicationOptions, g as AuthPayload, h as AuthPluginOptions, i as CSRF_FORM_FIELD, j as CSRF_HEADER_NAME, k as CSRF_TOKEN_KEY, P as ContainerProvider, m as ContextualBinding, n as ContextualBindingBuilder, o as ContextualNeedsBuilder, p as Controller, q as ControllerInertiaProps, r as CsrfOptions, t as DatabaseChannelOptions, u as DatabaseNotification, v as ExceptionClass, w as ExceptionHandler, x as ExceptionHandlerOptions, y as ExceptionRenderer, z as ExceptionReporter, F as FailedJob, H as HostAuthorizationOptions, B as HstsOptions, I as InertiaOptions, J as InertiaPagePayload, K as InertiaResponse, L as InertiaSharedProps, M as InertiaSsrContext, O as InertiaSsrOptions, R as InertiaSsrRenderer, T as InertiaSsrResult, U as InferInertiaProps, V as Job, W as JobClass, X as JobFailureHandler, Y as JobHandler, Z as JobOptions, _ as Notifiable, $ as Notification, a0 as NotificationAttachment, a1 as NotificationChannel, a2 as NotificationChannelFactory, a3 as NotificationClass, a4 as NotificationMailMessage, a5 as NotificationManagerOptions, a6 as ProviderManager, a7 as QueueConfig, a8 as QueueDriver, a9 as QueueDriverFactory, aa as QueuedJob, ab as RendererRegistration, ac as ResolvedSharedInertiaProps, ad as ResourceRouteOptions, ae as RouteBuilder, af as RouteContractOptions, ag as RouteDefinition, ah as RouteOpenApiMetadata, ai as RouteResourceAction, aj as Router, ak as SecurityHeadersOptions, al as SentNotification, am as ServiceBinding, an as ServiceClass, ao as ServiceFactory, ap as ServiceProviderClass, aq as ServiceProviderOptions, ar as SharedInertiaPropsResolver, as as SlackAttachment, at as SlackBlock, au as SlackMessage, av as VALIDATED_DATA_KEY, aw as ValidateRequestOptions, ax as ValidationSchema, ay as WorkerOptions, az as abort, aA as abortIf, aB as abortUnless, aC as clearJobRegistry, aD as createApp, aE as createContainer, aF as createCsrfMiddleware, aG as createExceptionHandler, aH as createHostAuthorizationMiddleware, aI as createNotificationManager, aJ as createQueueManager, aK as createSecurityHeaders, aL as csrfField, aM as formatValidationErrors, aN as getContainer, aO as getCsrfToken, aP as getExceptionHandler, aQ as getInertiaSharedPropsResolver, aR as getJob, aS as getNotificationManager, aT as getQueueDriver, aU as getRegisteredJobs, aV as getValidatedData, aW as inertia, aX as parseRequestPayload, aY as registerJob, aZ as resolve, a_ as setContainer, a$ as setExceptionHandler, b0 as setInertiaSharedProps, b1 as setNotificationManager, b2 as setQueueDriver, b3 as shareInertiaProps, b4 as validate, b5 as validateRequest, b6 as validateRequestWith, b7 as validateSafe, b8 as verifyCsrfToken } from './Application-DImeY-VW.js';
1
+ import { E as ErrorResponse, C as Container, c as ServiceProviderConstructor, S as ServiceProvider, d as ServiceBindings, Q as QueueManager, N as NotificationManager } from './Application-BvBqgc2k.js';
2
+ export { A as Application, e as ApplicationListenOptions, f as ApplicationOptions, g as AuthPayload, h as AuthPluginOptions, i as CSRF_FORM_FIELD, j as CSRF_HEADER_NAME, k as CSRF_TOKEN_KEY, P as ContainerProvider, m as ContextualBinding, n as ContextualBindingBuilder, o as ContextualNeedsBuilder, p as Controller, q as ControllerInertiaProps, r as CsrfOptions, t as DatabaseChannelOptions, u as DatabaseNotification, v as ExceptionClass, w as ExceptionHandler, x as ExceptionHandlerOptions, y as ExceptionRenderer, z as ExceptionReporter, F as FailedJob, B as GurenModule, H as HostAuthorizationOptions, I as HstsOptions, J as InertiaDocumentContext, K as InertiaDocumentOptions, L as InertiaOptions, M as InertiaPagePayload, O as InertiaResponse, R as InertiaSharedProps, T as InertiaSsrContext, U as InertiaSsrOptions, V as InertiaSsrRenderer, W as InertiaSsrResult, X as InferInertiaProps, Y as Job, Z as JobClass, _ as JobFailureHandler, $ as JobHandler, a0 as JobOptions, a1 as ModuleDefinition, a2 as Notifiable, a3 as Notification, a4 as NotificationAttachment, a5 as NotificationChannel, a6 as NotificationChannelFactory, a7 as NotificationClass, a8 as NotificationMailMessage, a9 as NotificationManagerOptions, aa as ProviderManager, ab as QueueConfig, ac as QueueDriver, ad as QueueDriverFactory, ae as QueuedJob, af as RendererRegistration, ag as ResolvedSharedInertiaProps, ah as ResourceRouteOptions, ai as RouteBuilder, aj as RouteContractOptions, ak as RouteDefinition, al as RouteOpenApiMetadata, am as RouteResourceAction, an as Router, ao as SecurityHeadersOptions, ap as SentNotification, aq as ServiceBinding, ar as ServiceClass, as as ServiceFactory, at as ServiceProviderClass, au as ServiceProviderOptions, av as SharedInertiaPropsResolver, aw as SlackAttachment, ax as SlackBlock, ay as SlackMessage, az as VALIDATED_DATA_KEY, aA as ValidateRequestOptions, aB as ValidationSchema, aC as WorkerOptions, aD as abort, aE as abortIf, aF as abortUnless, aG as clearJobRegistry, aH as createApp, aI as createContainer, aJ as createCsrfMiddleware, aK as createExceptionHandler, aL as createHostAuthorizationMiddleware, aM as createNotificationManager, aN as createQueueManager, aO as createSecurityHeaders, aP as csrfField, aQ as defineModule, aR as formatValidationErrors, aS as getContainer, aT as getCsrfToken, aU as getExceptionHandler, aV as getInertiaSharedPropsResolver, aW as getJob, aX as getNotificationManager, aY as getQueueDriver, aZ as getRegisteredJobs, a_ as getValidatedData, a$ as inertia, b0 as mountModuleRoutes, b1 as parseRequestPayload, b2 as registerJob, b3 as resolve, b4 as setContainer, b5 as setExceptionHandler, b6 as setInertiaDocument, b7 as setInertiaSharedProps, b8 as setInertiaSsrRenderer, b9 as setNotificationManager, ba as setQueueDriver, bb as shareInertiaProps, bc as validate, bd as validateRequest, be as validateRequestWith, bf as validateSafe, bg as verifyCsrfToken } from './Application-BvBqgc2k.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-BU8ZvenF.js';
7
- export { A as AuthManager, B as BaseUserProvider, M as ModelUserProvider } from './AuthManager-BU8ZvenF.js';
6
+ import { P as PasswordHasher } from './AuthManager-C84xF5ks.js';
7
+ export { A as AuthManager, B as BaseUserProvider, M as ModelUserProvider } from './AuthManager-C84xF5ks.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-D9u7krkn.js';
10
- import { g as AuthContext } from './api-token-CB12xnVg.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, l as OAuthManager, t as OAuthManagerOptions, u as OAuthProviderConfig, v as OAuthProviderFactoryInput, w as OAuthStateConfig, k as OAuthStatePayload, O as OAuthStateStore, x as OAuthTokenResult, y as OAuthUserProfile, P as ProviderFactory, z as Sanitized, E as Session, h as SessionData, S as SessionStore, U as UserProvider, F as buildOAuthAuthorizeUrl, H as buildOAuthRedirectUrl, I as createApiToken, J as createBearerTokenMiddleware, K as createDiscordOAuthProviderConfig, L as createGitHubOAuthProviderConfig, N as createGoogleOAuthProviderConfig, Q as createOAuthManager, R as createOAuthState, T as createSessionMiddleware, V as exchangeOAuthCode, W as fetchOAuthUserProfile, X as getApiToken, Y as getApiTokenOrFail, Z as getSessionFromContext, _ as getUserApiTokens, $ as parseApiToken, a0 as parseOAuthRedirectUrl, a1 as revokeAllApiTokens, a2 as revokeApiToken, a3 as sanitizeOAuthRedirect, a4 as tokenCan, a5 as tokenCanAll, a6 as tokenCanAny, a7 as verifyApiToken, a8 as verifyOAuthState } from './api-token-CB12xnVg.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';
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';
@@ -17,14 +17,14 @@ export { FailedJobHandler, FailedJobInfo, FailedJobReporter, MemoryDriver, Memor
17
17
  import { M as MailManager } from './MailManager-DpMvYiP9.js';
18
18
  export { a as MailAddress, b as MailAttachment, c as MailConfig, d as MailMessage, e as MailTransport, f as MailTransportConfig, g as MailTransportFactory, h as MemoryTransportOptions, R as ResendTransportOptions, S as SendResult, i as SmtpTransportOptions, j as createMailManager } from './MailManager-DpMvYiP9.js';
19
19
  export { LogTransport, Mail, MemoryTransport, ResendTransport, SmtpTransport, getMailManager, mail, setMailManager } from './mail/index.js';
20
- import { C as CacheManager } from './CacheManager-BkvHEOZX.js';
21
- export { a as CacheConfig, b as CacheStore, c as CacheStoreFactory, d as createCacheManager } from './CacheManager-BkvHEOZX.js';
20
+ import { C as CacheManager } from './CacheManager-BmDzUKrF.js';
21
+ export { a as CacheConfig, b as CacheStore, c as CacheStoreFactory, d as createCacheManager } from './CacheManager-BmDzUKrF.js';
22
22
  export { FileStore as FileCacheStore, MemoryStore as MemoryCacheStore, RedisStore as RedisCacheStore, TaggedCache } from './cache/index.js';
23
23
  import { S as StorageManager } from './StorageManager-oZTHqaza.js';
24
24
  export { D as DiskConfig, F as FileMetadata, P as PutOptions, a as StorageConfig, b as StorageDriver, c as StorageDriverFactory, d as createStorageManager } from './StorageManager-oZTHqaza.js';
25
25
  export { LocalDriver as LocalStorageDriver, MemoryDriver as MemoryStorageDriver, S3Driver } from './storage/index.js';
26
- import { S as Scheduler } from './Scheduler-BstvSca7.js';
27
- export { P as ParsedCron, a as PendingSchedule, b as Schedule, J as ScheduledJobClass, c as ScheduledTask, d as SchedulerOptions, T as TaskCallback, e as TaskDefinition, f as createScheduler } from './Scheduler-BstvSca7.js';
26
+ import { S as Scheduler } from './Scheduler-pZiT8i57.js';
27
+ export { P as ParsedCron, a as PendingSchedule, b as Schedule, J as ScheduledJobClass, c as ScheduledTask, d as SchedulerOptions, T as TaskCallback, e as TaskDefinition, f as createScheduler } from './Scheduler-pZiT8i57.js';
28
28
  export { getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, matchesCron, parseCron, toTimezone } from './scheduling/index.js';
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';
@@ -35,17 +35,17 @@ export { JsonLoader, MemoryLoader, getPluralizationRule, pluralizationRules, sel
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';
37
37
  export { DatabaseChannel, MailChannel, MailChannelOptions, MemoryChannel, SlackChannel, SlackChannelOptions } from './notifications/index.js';
38
- import { B as BroadcastManager } from './BroadcastManager-CGWl9rUO.js';
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-CGWl9rUO.js';
38
+ import { B as BroadcastManager } from './BroadcastManager-D8KoJxiV.js';
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
- import { I as InputInterface, P as ParsedSignature, O as OptionDefinition, a as CommandInstance, b as OutputInterface } from './ConsoleKernel-COKndy_V.js';
42
- export { A as ArgumentDefinition, c as CommandClass, C as ConsoleKernel, d as ConsoleKernelOptions, e as ProgressInterface, f as PromptInterface, S as ScheduledCommand, g as createConsoleKernel } from './ConsoleKernel-COKndy_V.js';
41
+ import { I as InputInterface, P as ParsedSignature, O as OptionDefinition, a as CommandInstance, b as OutputInterface } from './ConsoleKernel-Dw9X9qZY.js';
42
+ export { A as ArgumentDefinition, c as CommandClass, C as ConsoleKernel, d as ConsoleKernelOptions, e as ProgressInterface, f as PromptInterface, S as ScheduledCommand, g as createConsoleKernel } from './ConsoleKernel-Dw9X9qZY.js';
43
43
  import * as readline from 'readline';
44
44
  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';
45
45
  export { AuthorizedContext, Policy, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, definePolicy, withAuthorization } from './authorization/index.js';
46
46
  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';
47
47
  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';
48
- 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-CKXJLsTe.js';
48
+ 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';
49
49
  import 'vite';
50
50
  import '@guren/orm';
51
51
  import 'ioredis';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  logDevServerBanner,
3
3
  parseImportMap,
4
4
  startViteDevServer
5
- } from "./chunk-CSP7W3WY.js";
5
+ } from "./chunk-JIT7QVMJ.js";
6
6
  import {
7
7
  PendingSchedule,
8
8
  Schedule,
@@ -16,7 +16,7 @@ import {
16
16
  matchesCron,
17
17
  parseCron,
18
18
  toTimezone
19
- } from "./chunk-HKQSAFSN.js";
19
+ } from "./chunk-MC752CQT.js";
20
20
  import {
21
21
  LocalDriver,
22
22
  MemoryDriver as MemoryDriver3,
@@ -63,9 +63,11 @@ import {
63
63
  setMailManager
64
64
  } from "./chunk-EDRGAM6G.js";
65
65
  import {
66
+ MCP_ENDPOINT_PATH,
66
67
  ProviderManager,
67
- ServiceProvider
68
- } from "./chunk-STZUODC3.js";
68
+ ServiceProvider,
69
+ isMcpEndpointEnabled
70
+ } from "./chunk-NYQGAWDN.js";
69
71
  import {
70
72
  DatabaseChannel,
71
73
  MailChannel,
@@ -162,7 +164,7 @@ import {
162
164
  verifyEmailToken,
163
165
  verifyOAuthState,
164
166
  verifyPasswordResetToken
165
- } from "./chunk-VY2JPS6V.js";
167
+ } from "./chunk-AUXQISW5.js";
166
168
  import {
167
169
  Gate,
168
170
  Policy,
@@ -179,7 +181,7 @@ import {
179
181
  getGate,
180
182
  setGate,
181
183
  withAuthorization
182
- } from "./chunk-ZRBLZY3M.js";
184
+ } from "./chunk-FZD2AKJI.js";
183
185
  import {
184
186
  AuthorizationException,
185
187
  ExceptionHandler,
@@ -193,7 +195,7 @@ import {
193
195
  getExceptionHandler,
194
196
  renderErrorPage,
195
197
  setExceptionHandler
196
- } from "./chunk-THSX7OOR.js";
198
+ } from "./chunk-63SKW5PS.js";
197
199
  import {
198
200
  AuthenticationException,
199
201
  HttpException
@@ -212,7 +214,7 @@ import {
212
214
  getBroadcastManager,
213
215
  parseRequestPayload,
214
216
  setBroadcastManager
215
- } from "./chunk-44F7JQ7I.js";
217
+ } from "./chunk-XMQZENBP.js";
216
218
  import {
217
219
  CacheManager,
218
220
  FileStore,
@@ -220,7 +222,11 @@ import {
220
222
  RedisStore,
221
223
  TaggedCache,
222
224
  createCacheManager
223
- } from "./chunk-EGU5KB7V.js";
225
+ } from "./chunk-4SBGSJNT.js";
226
+ import {
227
+ claimHotDisposable,
228
+ isHotReloadRuntime
229
+ } from "./chunk-DCYKSYAT.js";
224
230
  import {
225
231
  Encrypter,
226
232
  createEncrypter,
@@ -385,6 +391,8 @@ var Router = class {
385
391
  middlewareAliases = /* @__PURE__ */ new Map();
386
392
  middlewareGroups = /* @__PURE__ */ new Map();
387
393
  modelBindings = /* @__PURE__ */ new Map();
394
+ /** Model class names for router-level bind(param, Model) calls — resolver-only binds carry no name. */
395
+ modelBindingNames = /* @__PURE__ */ new Map();
388
396
  aliasMiddleware(name, handler) {
389
397
  this.middlewareAliases.set(name, handler);
390
398
  return this;
@@ -399,6 +407,7 @@ var Router = class {
399
407
  bind(param, modelOrResolver) {
400
408
  if (typeof modelOrResolver === "function" && "findOrFail" in modelOrResolver) {
401
409
  const model = modelOrResolver;
410
+ if (model.name) this.modelBindingNames.set(param, model.name);
402
411
  this.modelBindings.set(param, async (value) => {
403
412
  return model.findOrFail(value);
404
413
  });
@@ -480,9 +489,10 @@ var Router = class {
480
489
  this.middlewareAliases.clear();
481
490
  this.middlewareGroups.clear();
482
491
  this.modelBindings.clear();
492
+ this.modelBindingNames.clear();
483
493
  }
484
494
  definitions() {
485
- return this.registry.map(({ method, path, name, schemas, openapi, routeMiddlewareNames, middlewares, handler }) => ({
495
+ return this.registry.map(({ method, path, name, schemas, openapi, routeMiddlewareNames, middlewares, handler, bindings }) => ({
486
496
  method,
487
497
  path,
488
498
  name,
@@ -490,6 +500,7 @@ var Router = class {
490
500
  middlewareNames: [...routeMiddlewareNames],
491
501
  hasInlineMiddleware: middlewares.length > 0,
492
502
  controller: isControllerAction(handler) ? { name: handler[0].name, action: String(handler[1]) } : void 0,
503
+ bindings: serializeBindings(path, bindings, this.modelBindingNames),
493
504
  ...openapi
494
505
  }));
495
506
  }
@@ -818,6 +829,17 @@ function buildResponse(result) {
818
829
  }
819
830
  return new Response(String(result));
820
831
  }
832
+ function serializeBindings(path, routeBindings, routerBindingNames) {
833
+ const entries = /* @__PURE__ */ new Map();
834
+ for (const param of path.match(/:(\w+)/g) ?? []) {
835
+ const name = routerBindingNames.get(param.slice(1));
836
+ if (name) entries.set(param.slice(1), name);
837
+ }
838
+ for (const [param, model] of routeBindings ?? []) {
839
+ if (model.name) entries.set(param, model.name);
840
+ }
841
+ return entries.size > 0 ? Object.fromEntries(entries) : void 0;
842
+ }
821
843
  function isControllerAction(action) {
822
844
  return Array.isArray(action);
823
845
  }
@@ -855,7 +877,31 @@ function definePlugin(definition) {
855
877
  };
856
878
  }
857
879
 
880
+ // src/container/defineModule.ts
881
+ function defineModule(definition) {
882
+ return {
883
+ name: definition.name,
884
+ prefix: definition.prefix,
885
+ routes: definition.routes,
886
+ providers: definition.providers ?? []
887
+ };
888
+ }
889
+ async function mountModuleRoutes(router, gurenModule) {
890
+ const registrar = gurenModule.routes;
891
+ if (!registrar) return;
892
+ if (!gurenModule.prefix) {
893
+ await registrar(router);
894
+ return;
895
+ }
896
+ let pending = void 0;
897
+ router.group(gurenModule.prefix, (grouped) => {
898
+ pending = registrar(grouped);
899
+ });
900
+ await pending;
901
+ }
902
+
858
903
  // src/http/middleware/csrf.ts
904
+ import { getCookie } from "hono/cookie";
859
905
  var CSRF_TOKEN_KEY = "_csrf_token";
860
906
  var CSRF_HEADER_NAME = "X-CSRF-TOKEN";
861
907
  var XSRF_HEADER_NAME = "X-XSRF-TOKEN";
@@ -863,11 +909,29 @@ var XSRF_COOKIE_NAME = "XSRF-TOKEN";
863
909
  var CSRF_FORM_FIELD = "_token";
864
910
  var DEFAULT_PROTECTED_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
865
911
  var DEFAULT_COOKIE_SECURE = typeof process !== "undefined" ? process.env.NODE_ENV === "production" : true;
866
- function generateToken() {
867
- const bytes = new Uint8Array(32);
912
+ var CSRF_CONTEXT_KEY = "guren:csrf-token";
913
+ var CSRF_PURPOSE = "csrf";
914
+ function createCsrfSigner() {
915
+ return new MessageSigner(deriveAppKeyring(getAppKeyringFromEnv(), "csrf-token"));
916
+ }
917
+ function randomNonce() {
918
+ const bytes = new Uint8Array(16);
868
919
  globalThis.crypto.getRandomValues(bytes);
869
920
  return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
870
921
  }
922
+ function bindableSessionId(session) {
923
+ return session && !session.isNew ? session.id : void 0;
924
+ }
925
+ function mintCsrfToken(sessionId) {
926
+ const signer = createCsrfSigner();
927
+ return sessionId ? signer.sign({ sid: sessionId }, { purpose: CSRF_PURPOSE }) : signer.sign({ n: randomNonce() }, { purpose: CSRF_PURPOSE });
928
+ }
929
+ function verifiedClaims(token) {
930
+ return createCsrfSigner().verify(token, { purpose: CSRF_PURPOSE });
931
+ }
932
+ function claimsUsableFor(claims, boundId) {
933
+ return claims.sid !== void 0 ? claims.sid === boundId : boundId === void 0;
934
+ }
871
935
  function matchesPattern(path, pattern) {
872
936
  if (pattern.endsWith("/*")) {
873
937
  const prefix = pattern.slice(0, -2);
@@ -878,16 +942,25 @@ function matchesPattern(path, pattern) {
878
942
  function isExcluded(path, excludePatterns) {
879
943
  return excludePatterns.some((pattern) => matchesPattern(path, pattern));
880
944
  }
945
+ function isMcpEndpointRequest(path) {
946
+ return path === MCP_ENDPOINT_PATH && isMcpEndpointEnabled();
947
+ }
881
948
  function getCsrfToken(ctx) {
882
- const session = getSessionFromContext(ctx);
883
- if (!session) {
884
- throw new Error("CSRF middleware requires session middleware to be registered first.");
949
+ const pending = ctx.get(CSRF_CONTEXT_KEY);
950
+ if (pending) {
951
+ return pending;
885
952
  }
886
- let token = session.get(CSRF_TOKEN_KEY);
887
- if (!token) {
888
- token = generateToken();
889
- session.set(CSRF_TOKEN_KEY, token);
953
+ const boundId = bindableSessionId(getSessionFromContext(ctx));
954
+ const cookieToken = getCookie(ctx, XSRF_COOKIE_NAME);
955
+ if (cookieToken) {
956
+ const claims = verifiedClaims(cookieToken);
957
+ if (claims && claimsUsableFor(claims, boundId)) {
958
+ ctx.set(CSRF_CONTEXT_KEY, cookieToken);
959
+ return cookieToken;
960
+ }
890
961
  }
962
+ const token = mintCsrfToken(boundId);
963
+ ctx.set(CSRF_CONTEXT_KEY, token);
891
964
  return token;
892
965
  }
893
966
  function csrfField(ctx) {
@@ -898,22 +971,22 @@ function verifyCsrfToken(ctx, token) {
898
971
  if (!token) {
899
972
  return false;
900
973
  }
901
- const session = getSessionFromContext(ctx);
902
- if (!session) {
903
- return false;
904
- }
905
- const sessionToken = session.get(CSRF_TOKEN_KEY);
906
- if (!sessionToken) {
907
- return false;
908
- }
909
- if (token.length !== sessionToken.length) {
910
- return false;
911
- }
912
- let result = 0;
913
- for (let i = 0; i < token.length; i++) {
914
- result |= token.charCodeAt(i) ^ sessionToken.charCodeAt(i);
974
+ const claims = verifiedClaims(token);
975
+ if (claims) {
976
+ if (claims.sid !== void 0) {
977
+ const boundId = bindableSessionId(getSessionFromContext(ctx));
978
+ if (boundId !== void 0 && secureCompare(claims.sid, boundId)) {
979
+ return true;
980
+ }
981
+ } else {
982
+ const cookieToken = getCookie(ctx, XSRF_COOKIE_NAME);
983
+ if (cookieToken && secureCompare(token, cookieToken)) {
984
+ return true;
985
+ }
986
+ }
915
987
  }
916
- return result === 0;
988
+ const sessionToken = getSessionFromContext(ctx)?.get(CSRF_TOKEN_KEY);
989
+ return sessionToken !== void 0 && secureCompare(token, sessionToken);
917
990
  }
918
991
  async function getTokenFromRequest(ctx) {
919
992
  const headerToken = ctx.req.header(CSRF_HEADER_NAME);
@@ -959,10 +1032,6 @@ function createCsrfMiddleware(options = {}) {
959
1032
  } = options;
960
1033
  const protectedMethods = new Set(methods.map((m) => m.toUpperCase()));
961
1034
  return async (ctx, next) => {
962
- const session = getSessionFromContext(ctx);
963
- if (!session) {
964
- throw new Error("CSRF middleware requires session middleware to be registered first.");
965
- }
966
1035
  const method = ctx.req.method.toUpperCase();
967
1036
  const path = new URL(ctx.req.url).pathname;
968
1037
  if (!protectedMethods.has(method)) {
@@ -973,7 +1042,7 @@ function createCsrfMiddleware(options = {}) {
973
1042
  }
974
1043
  return;
975
1044
  }
976
- if (isExcluded(path, exclude)) {
1045
+ if (isExcluded(path, exclude) || isMcpEndpointRequest(path)) {
977
1046
  await next();
978
1047
  return;
979
1048
  }
@@ -1052,16 +1121,31 @@ function validateSafe(schema, data) {
1052
1121
  // src/http/middleware/rate-limit.ts
1053
1122
  var BaseMemoryStore = class {
1054
1123
  cleanupInterval;
1124
+ /**
1125
+ * This store's claim on its hot-reload slot, if it holds one.
1126
+ *
1127
+ * Unlike the cache sweep, this interval is not `unref()`ed, so a leaked one
1128
+ * both duplicates work and keeps the process alive on its own.
1129
+ */
1130
+ hotReloadClaim;
1055
1131
  constructor(cleanupIntervalMs = 6e4) {
1056
- if (cleanupIntervalMs > 0) {
1057
- this.cleanupInterval = setInterval(() => this.cleanup(), cleanupIntervalMs);
1132
+ if (cleanupIntervalMs <= 0) {
1133
+ return;
1058
1134
  }
1135
+ this.cleanupInterval = setInterval(() => this.cleanup(), cleanupIntervalMs);
1136
+ this.hotReloadClaim = claimHotDisposable(
1137
+ "rate-limit-store",
1138
+ isHotReloadRuntime() ? new Error().stack : void 0,
1139
+ this.constructor.name,
1140
+ () => this.destroy()
1141
+ );
1059
1142
  }
1060
1143
  destroy() {
1061
1144
  if (this.cleanupInterval) {
1062
1145
  clearInterval(this.cleanupInterval);
1063
1146
  this.cleanupInterval = void 0;
1064
1147
  }
1148
+ this.hotReloadClaim?.release();
1065
1149
  }
1066
1150
  };
1067
1151
  var MemoryRateLimitStore = class extends BaseMemoryStore {
@@ -1553,7 +1637,7 @@ function requestLoggingMiddleware() {
1553
1637
 
1554
1638
  // src/http/middleware/detect-locale.ts
1555
1639
  import { createMiddleware as createMiddleware3 } from "hono/factory";
1556
- import { getCookie } from "hono/cookie";
1640
+ import { getCookie as getCookie2 } from "hono/cookie";
1557
1641
  import { parseAccept } from "hono/utils/accept";
1558
1642
  var LOCALE_CONTEXT_KEY = "locale";
1559
1643
  var DEFAULT_SOURCES = ["query", "cookie", "header"];
@@ -1615,7 +1699,7 @@ function detectLocaleMiddleware(options) {
1615
1699
  return createMiddleware3(async (c, next) => {
1616
1700
  const readers = {
1617
1701
  query: () => match(c.req.query(queryParam)),
1618
- cookie: () => match(getCookie(c, cookieName)),
1702
+ cookie: () => match(getCookie2(c, cookieName)),
1619
1703
  header: () => matchHeader(c.req.header("Accept-Language"))
1620
1704
  };
1621
1705
  let resolved = fallback;
@@ -1815,6 +1899,14 @@ var ErrorServiceProvider = class extends ServiceProvider {
1815
1899
  import { isAbsolute, resolve as resolvePath } from "path";
1816
1900
  import { pathToFileURL } from "url";
1817
1901
  ensureErrorStackTracePolyfill();
1902
+ var documentOptions;
1903
+ function setInertiaDocument(options) {
1904
+ documentOptions = options;
1905
+ }
1906
+ var defaultSsrRenderer;
1907
+ function setInertiaSsrRenderer(renderer) {
1908
+ defaultSsrRenderer = renderer;
1909
+ }
1818
1910
  var DEFAULT_TITLE = "Guren";
1819
1911
  var DEV_FALLBACK_IMPORT_MAP = {
1820
1912
  react: "https://esm.sh/react@19.0.0?dev",
@@ -1889,7 +1981,16 @@ async function renderDocument(page, options) {
1889
1981
  const importMap = JSON.stringify({ imports: importMapEntries }, null, 2);
1890
1982
  const serializedPage = serializePage(page);
1891
1983
  const stylesheetLinks = renderStyles(styles);
1892
- const docsHeadBootstrap = renderDocsHeadBootstrap(page.component);
1984
+ const criticalCss = resolveDocumentValue(
1985
+ "criticalCss",
1986
+ options,
1987
+ page.component
1988
+ );
1989
+ const prepaintScript = resolveDocumentValue(
1990
+ "prepaintScript",
1991
+ options,
1992
+ page.component
1993
+ );
1893
1994
  const ssrResult = await tryRenderSsr(page, options);
1894
1995
  const headElements = (ssrResult?.head ?? []).map(normalizeHeadElement);
1895
1996
  const hasCustomTitle = headElements.some(
@@ -1899,14 +2000,17 @@ async function renderDocument(page, options) {
1899
2000
  '<meta charset="utf-8" />',
1900
2001
  '<meta name="viewport" content="width=device-width, initial-scale=1" />',
1901
2002
  hasCustomTitle ? "" : `<title>${title}</title>`,
1902
- docsHeadBootstrap,
2003
+ // Both must precede the stylesheet links: they exist to settle the first
2004
+ // paint before the app's own CSS arrives.
2005
+ criticalCss ? `<style id="guren-critical">${criticalCss}</style>` : "",
2006
+ prepaintScript ? `<script>${prepaintScript}</script>` : "",
1903
2007
  stylesheetLinks,
1904
2008
  ...headElements,
1905
2009
  Object.keys(importMapEntries).length > 0 ? `<script type="importmap">${importMap}</script>` : "",
1906
2010
  `<script>window.__INERTIA_PAGE__ = ${serializedPage};</script>`
1907
2011
  ].filter((segment) => segment && segment.length > 0);
1908
2012
  const appMarkup = ssrResult?.body ?? `<script data-page="app" type="application/json">${serializedPage}</script><div id="app"></div>`;
1909
- const bodyClass = resolveBodyClass(page.component);
2013
+ const bodyClass = resolveDocumentValue("bodyClass", options, page.component);
1910
2014
  const bodyAttributes = bodyClass ? ` class="${escapeAttribute(bodyClass)}"` : "";
1911
2015
  const lang = escapeAttribute(options.lang ?? "en");
1912
2016
  return `<!DOCTYPE html>
@@ -1926,7 +2030,7 @@ async function tryRenderSsr(page, options) {
1926
2030
  return void 0;
1927
2031
  }
1928
2032
  const manifest = (ssrOptions?.manifest ?? process.env.GUREN_INERTIA_SSR_MANIFEST)?.trim() || void 0;
1929
- const renderer = ssrOptions?.render ?? await loadSsrRenderer(
2033
+ const renderer = ssrOptions?.render ?? defaultSsrRenderer ?? await loadSsrRenderer(
1930
2034
  ssrOptions?.entry ?? process.env.GUREN_INERTIA_SSR_ENTRY
1931
2035
  );
1932
2036
  if (!renderer) {
@@ -2014,36 +2118,13 @@ function normalizeHeadElement(element) {
2014
2118
  (_match, file2, query = "") => `href="/public/assets/${file2}${query}"`
2015
2119
  );
2016
2120
  }
2017
- function resolveBodyClass(componentName) {
2018
- return componentName.startsWith("Docs/") ? "docs-theme" : "";
2019
- }
2020
- function renderDocsHeadBootstrap(componentName) {
2021
- if (!componentName.startsWith("Docs/")) {
2022
- return "";
2121
+ function resolveDocumentValue(key, options, componentName) {
2122
+ const override = options[key];
2123
+ if (override !== void 0) {
2124
+ return override;
2023
2125
  }
2024
- const criticalStyles = [
2025
- "html,body{background:#ffffff;color:#1f2937;}",
2026
- "body.docs-theme{background:#ffffff;color:#1f2937;}",
2027
- "html.dark,html.dark body,html.dark body.docs-theme{background:#1a1a2e;color:#e0def4;}",
2028
- ".size-4{width:1rem;height:1rem;}",
2029
- ".size-5{width:1.25rem;height:1.25rem;}",
2030
- ".size-6{width:1.5rem;height:1.5rem;}",
2031
- ".size-8{width:2rem;height:2rem;}",
2032
- ".size-9{width:2.25rem;height:2.25rem;}"
2033
- ].join("");
2034
- const prepaintScript = [
2035
- "(function(){",
2036
- "try{",
2037
- "var mode=localStorage.getItem('guren-color-mode')||'system';",
2038
- "var dark=mode==='dark'||(mode!=='light'&&window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches);",
2039
- "var root=document.documentElement;",
2040
- "root.classList.toggle('dark',dark);",
2041
- "root.style.colorScheme=dark?'dark':'light';",
2042
- "}catch(_){",
2043
- "}",
2044
- "})();"
2045
- ].join("");
2046
- return `<style id="guren-docs-critical">${criticalStyles}</style><script>${prepaintScript}</script>`;
2126
+ const value = documentOptions?.[key];
2127
+ return (typeof value === "function" ? value({ component: componentName }) : value) ?? "";
2047
2128
  }
2048
2129
  function serializePage(page) {
2049
2130
  return JSON.stringify(page).replace(/[<\u2028\u2029]/gu, (char) => {
@@ -2306,7 +2387,11 @@ var Application = class {
2306
2387
  this.hono.use("*", attachAuthContext((ctx) => this.authManager.createAuthContext(ctx)));
2307
2388
  }
2308
2389
  this.providerManager.register(AuthorizationServiceProvider);
2309
- const userProviders = Array.isArray(this.options.providers) ? this.options.providers : [];
2390
+ const moduleProviders = (this.options.modules ?? []).flatMap((module) => module.providers);
2391
+ const userProviders = [
2392
+ ...Array.isArray(this.options.providers) ? this.options.providers : [],
2393
+ ...moduleProviders
2394
+ ];
2310
2395
  const hasUserErrorProvider = userProviders.some(
2311
2396
  (provider) => provider === ErrorServiceProvider || provider.prototype instanceof ErrorServiceProvider
2312
2397
  );
@@ -2350,8 +2435,13 @@ var Application = class {
2350
2435
  * Mounts the application router onto the Hono instance.
2351
2436
  */
2352
2437
  async mountRoutes() {
2353
- if (this.options.routes && !this.routesRegistered) {
2354
- await this.options.routes(this.router);
2438
+ if (!this.routesRegistered) {
2439
+ if (this.options.routes) {
2440
+ await this.options.routes(this.router);
2441
+ }
2442
+ for (const gurenModule of this.options.modules ?? []) {
2443
+ await mountModuleRoutes(this.router, gurenModule);
2444
+ }
2355
2445
  this.routesRegistered = true;
2356
2446
  }
2357
2447
  this.router.mount(this.hono, { container: this.container });
@@ -2389,16 +2479,15 @@ var Application = class {
2389
2479
  this.hono.use("*", createHostAuthorizationMiddleware(hostAuthorization));
2390
2480
  }
2391
2481
  /**
2392
- * Mounts the MCP endpoint at /_guren/mcp when explicitly enabled.
2393
- * Requires GUREN_MCP=1 environment variable. Never active in production.
2482
+ * Mounts the MCP endpoint at /_guren/mcp when enabled.
2394
2483
  * This allows AI coding agents to introspect the project.
2395
2484
  */
2396
2485
  async mountMcpEndpoint() {
2397
- if (typeof process === "undefined" || process.env?.NODE_ENV === "production" || process.env?.GUREN_MCP !== "1") {
2486
+ if (!isMcpEndpointEnabled()) {
2398
2487
  return;
2399
2488
  }
2400
2489
  try {
2401
- const { McpServiceProvider } = await import("./McpServiceProvider-RNTDHZAZ.js");
2490
+ const { McpServiceProvider } = await import("./McpServiceProvider-TZWQWXCT.js");
2402
2491
  const provider = new McpServiceProvider(this.container);
2403
2492
  provider.register();
2404
2493
  await provider.boot();
@@ -2451,7 +2540,10 @@ var Application = class {
2451
2540
  const server = Bun.serve({
2452
2541
  port,
2453
2542
  hostname,
2454
- fetch: (request) => this.fetch(request)
2543
+ // `{ server }` is Bun's convention for reaching the live server from a
2544
+ // handler; middleware reads `ctx.env.server.requestIP()` through it to
2545
+ // learn the socket peer (the MCP access guard, the rate limiter).
2546
+ fetch: (request, server2) => this.fetch(request, { server: server2 })
2455
2547
  });
2456
2548
  this.bunServer = server;
2457
2549
  setActiveBunServer(server);
@@ -3268,7 +3360,7 @@ var Validator = class _Validator {
3268
3360
  async validateOrThrow(data) {
3269
3361
  const result = await this.validate(data);
3270
3362
  if (!result.success) {
3271
- const { ValidationException: ValidationException2 } = await import("./errors-JOOPDDQ6.js");
3363
+ const { ValidationException: ValidationException2 } = await import("./errors-PUNHAFL2.js");
3272
3364
  throw new ValidationException2(result.errors);
3273
3365
  }
3274
3366
  return result.data;
@@ -6625,6 +6717,7 @@ export {
6625
6717
  defineFactory,
6626
6718
  defineGate,
6627
6719
  defineMiddleware,
6720
+ defineModule,
6628
6721
  definePlugin,
6629
6722
  definePolicy,
6630
6723
  deriveAppKey,
@@ -6695,6 +6788,7 @@ export {
6695
6788
  mimes,
6696
6789
  min,
6697
6790
  minFileSize,
6791
+ mountModuleRoutes,
6698
6792
  needsRehash,
6699
6793
  normalizeAppKey,
6700
6794
  notIn,
@@ -6752,7 +6846,9 @@ export {
6752
6846
  setExceptionHandler,
6753
6847
  setGate,
6754
6848
  setI18n,
6849
+ setInertiaDocument,
6755
6850
  setInertiaSharedProps,
6851
+ setInertiaSsrRenderer,
6756
6852
  setLogManager,
6757
6853
  setMailManager,
6758
6854
  setNotificationManager,