@guren/server 2.1.1 → 2.2.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 (270) hide show
  1. package/dist/{McpServiceProvider-7BB5FPF3.js → McpServiceProvider-GRDYNEQG.js} +1 -1
  2. package/dist/auth/AuthManager.d.ts +30 -0
  3. package/dist/auth/AuthenticatableModel.d.ts +25 -0
  4. package/dist/auth/RequestAuthContext.d.ts +24 -0
  5. package/dist/auth/SessionGuard.d.ts +31 -0
  6. package/dist/auth/api-token.d.ts +299 -0
  7. package/dist/auth/email-verification.d.ts +203 -0
  8. package/dist/auth/index.d.ts +18 -110
  9. package/dist/auth/index.js +3 -1
  10. package/dist/auth/oauth/index.d.ts +239 -0
  11. package/dist/auth/password/DefaultHasher.d.ts +13 -0
  12. package/dist/auth/password/NodeHasher.d.ts +22 -0
  13. package/dist/auth/password/PasswordHasher.d.ts +5 -0
  14. package/dist/auth/password/ScryptHasher.d.ts +26 -0
  15. package/dist/auth/password-reset.d.ts +91 -0
  16. package/dist/auth/providers/ModelUserProvider.d.ts +36 -0
  17. package/dist/auth/providers/UserProvider.d.ts +9 -0
  18. package/dist/auth/types.d.ts +102 -0
  19. package/dist/auth/utils.d.ts +39 -0
  20. package/dist/{Gate-CynjZCtS.d.ts → authorization/Gate.d.ts} +30 -111
  21. package/dist/authorization/Policy.d.ts +77 -0
  22. package/dist/authorization/index.d.ts +5 -129
  23. package/dist/authorization/index.js +3 -1
  24. package/dist/authorization/middleware.d.ts +49 -0
  25. package/dist/authorization/types.d.ts +108 -0
  26. package/dist/broadcasting/BroadcastManager.d.ts +205 -0
  27. package/dist/broadcasting/channels/Channel.d.ts +28 -0
  28. package/dist/broadcasting/channels/PresenceChannel.d.ts +72 -0
  29. package/dist/broadcasting/channels/PrivateChannel.d.ts +32 -0
  30. package/dist/broadcasting/channels/index.d.ts +3 -0
  31. package/dist/broadcasting/drivers/MemoryDriver.d.ts +93 -0
  32. package/dist/broadcasting/drivers/RedisDriver.d.ts +112 -0
  33. package/dist/broadcasting/drivers/index.d.ts +2 -0
  34. package/dist/broadcasting/index.d.ts +6 -233
  35. package/dist/broadcasting/index.js +1 -1
  36. package/dist/broadcasting/typed.d.ts +23 -0
  37. package/dist/broadcasting/types.d.ts +155 -0
  38. package/dist/cache/CacheManager.d.ts +87 -0
  39. package/dist/cache/TaggedCache.d.ts +62 -0
  40. package/dist/cache/index.d.ts +6 -233
  41. package/dist/cache/index.js +1 -1
  42. package/dist/cache/stores/FileStore.d.ts +64 -0
  43. package/dist/cache/stores/MemoryStore.d.ts +52 -0
  44. package/dist/cache/stores/RedisStore.d.ts +53 -0
  45. package/dist/{CacheManager-BmDzUKrF.d.ts → cache/types.d.ts} +26 -99
  46. package/dist/{chunk-TVY72CLV.js → chunk-4VE3LYOM.js} +3 -2
  47. package/dist/{chunk-FZD2AKJI.js → chunk-7OB2YXRE.js} +56 -28
  48. package/dist/{chunk-J6ETA476.js → chunk-BUQXOZCT.js} +93 -5
  49. package/dist/{chunk-DSDX3ASM.js → chunk-CDZUNKI6.js} +65 -83
  50. package/dist/{chunk-CWI4AJ47.js → chunk-HPET6XY5.js} +13 -9
  51. package/dist/{chunk-A3ISJVEV.js → chunk-HR2KZ3WL.js} +23 -5
  52. package/dist/{chunk-5SZTEZ22.js → chunk-PZKUDFMW.js} +11 -8
  53. package/dist/console/Command.d.ts +179 -0
  54. package/dist/{ConsoleKernel-CJg975mp.d.ts → console/ConsoleKernel.d.ts} +4 -6
  55. package/dist/console/Input.d.ts +140 -0
  56. package/dist/console/Output.d.ts +161 -0
  57. package/dist/console/index.d.ts +5 -0
  58. package/dist/console/types.d.ts +106 -0
  59. package/dist/container/Container.d.ts +148 -0
  60. package/dist/container/ServiceProvider.d.ts +103 -0
  61. package/dist/container/bindings.d.ts +55 -0
  62. package/dist/container/defineModule.d.ts +88 -0
  63. package/dist/container/definePlugin.d.ts +62 -0
  64. package/dist/container/index.d.ts +8 -0
  65. package/dist/container/types.d.ts +73 -0
  66. package/dist/database/Factory.d.ts +82 -0
  67. package/dist/database/Seeder.d.ts +35 -0
  68. package/dist/database/SeederRunner.d.ts +41 -0
  69. package/dist/database/index.d.ts +4 -0
  70. package/dist/database/types.d.ts +49 -0
  71. package/dist/discovery/AutoDiscovery.d.ts +113 -0
  72. package/dist/discovery/index.d.ts +2 -0
  73. package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +12 -0
  74. package/dist/docs-viewer/endpoint.d.ts +19 -0
  75. package/dist/encryption/Encrypter.d.ts +96 -0
  76. package/dist/encryption/Hash.d.ts +69 -0
  77. package/dist/encryption/MessageSigner.d.ts +21 -0
  78. package/dist/encryption/Random.d.ts +119 -0
  79. package/dist/encryption/app-key.d.ts +12 -0
  80. package/dist/encryption/index.d.ts +10 -222
  81. package/dist/encryption/signed-url.d.ts +9 -0
  82. package/dist/encryption/types.d.ts +103 -0
  83. package/dist/errors/ExceptionHandler.d.ts +118 -0
  84. package/dist/errors/HttpException.d.ts +106 -0
  85. package/dist/errors/debug-page.d.ts +22 -0
  86. package/dist/errors/error-page.d.ts +1 -0
  87. package/dist/errors/exceptions/AuthenticationException.d.ts +32 -0
  88. package/dist/errors/exceptions/AuthorizationException.d.ts +32 -0
  89. package/dist/errors/exceptions/MethodNotAllowedException.d.ts +31 -0
  90. package/dist/errors/exceptions/NotFoundHttpException.d.ts +36 -0
  91. package/dist/errors/exceptions/ValidationException.d.ts +60 -0
  92. package/dist/errors/exceptions/index.d.ts +5 -0
  93. package/dist/errors/index.d.ts +5 -0
  94. package/dist/errors/types.d.ts +43 -0
  95. package/dist/events/Event.d.ts +33 -0
  96. package/dist/{EventManager-CmIoLt7r.d.ts → events/EventManager.d.ts} +4 -86
  97. package/dist/events/Listener.d.ts +79 -0
  98. package/dist/events/builtin.d.ts +73 -0
  99. package/dist/events/index.d.ts +6 -155
  100. package/dist/events/types.d.ts +48 -0
  101. package/dist/facades/index.d.ts +31 -0
  102. package/dist/health/HealthCheck.d.ts +34 -0
  103. package/dist/health/HealthManager.d.ts +53 -0
  104. package/dist/health/checks/CacheCheck.d.ts +35 -0
  105. package/dist/health/checks/CustomCheck.d.ts +23 -0
  106. package/dist/health/checks/DatabaseCheck.d.ts +33 -0
  107. package/dist/health/checks/MemoryCheck.d.ts +32 -0
  108. package/dist/health/checks/RedisCheck.d.ts +27 -0
  109. package/dist/health/checks/StorageCheck.d.ts +35 -0
  110. package/dist/health/checks/index.d.ts +12 -0
  111. package/dist/health/index.d.ts +5 -185
  112. package/dist/health/types.d.ts +52 -0
  113. package/dist/hot-reload/hot-disposables.d.ts +96 -0
  114. package/dist/hot-reload/testing.d.ts +14 -0
  115. package/dist/http/Application.d.ts +187 -0
  116. package/dist/http/FormRequest.d.ts +73 -0
  117. package/dist/http/dev-assets.d.ts +51 -0
  118. package/dist/http/dev-banner.d.ts +7 -0
  119. package/dist/http/inertia-assets.d.ts +22 -0
  120. package/dist/http/middleware/auth.d.ts +13 -0
  121. package/dist/http/middleware/capabilities.d.ts +22 -0
  122. package/dist/http/middleware/cors.d.ts +40 -0
  123. package/dist/http/middleware/csp.d.ts +59 -0
  124. package/dist/http/middleware/csrf.d.ts +121 -0
  125. package/dist/http/middleware/detect-locale.d.ts +65 -0
  126. package/dist/http/middleware/force-https.d.ts +34 -0
  127. package/dist/http/middleware/host-authorization.d.ts +24 -0
  128. package/dist/http/middleware/index.d.ts +19 -0
  129. package/dist/http/middleware/loopback-guard.d.ts +38 -0
  130. package/dist/{rate-limit-D9J2b4S1.d.ts → http/middleware/rate-limit.d.ts} +22 -50
  131. package/dist/http/middleware/redirect-safety.d.ts +29 -0
  132. package/dist/http/middleware/request-id.d.ts +19 -0
  133. package/dist/http/middleware/request-logging.d.ts +16 -0
  134. package/dist/http/middleware/security-headers.d.ts +49 -0
  135. package/dist/http/middleware/session.d.ts +93 -0
  136. package/dist/http/middleware/validation.d.ts +94 -0
  137. package/dist/http/public-assets.d.ts +15 -0
  138. package/dist/http/request.d.ts +24 -0
  139. package/dist/http/resources/CursorPaginator.d.ts +106 -0
  140. package/dist/http/resources/Paginator.d.ts +130 -0
  141. package/dist/http/resources/Resource.d.ts +67 -0
  142. package/dist/http/resources/ResourceCollection.d.ts +60 -0
  143. package/dist/http/resources/index.d.ts +6 -0
  144. package/dist/http/resources/types.d.ts +91 -0
  145. package/dist/http/validation/Validator.d.ts +128 -0
  146. package/dist/http/validation/index.d.ts +3 -0
  147. package/dist/http/validation/rules.d.ts +196 -0
  148. package/dist/http/validation/types.d.ts +96 -0
  149. package/dist/http/vite-dev-server.d.ts +27 -0
  150. package/dist/i18n/I18nManager.d.ts +114 -0
  151. package/dist/i18n/Translator.d.ts +80 -0
  152. package/dist/i18n/index.d.ts +6 -101
  153. package/dist/i18n/index.js +5 -3
  154. package/dist/i18n/loaders/JsonLoader.d.ts +47 -0
  155. package/dist/i18n/loaders/MemoryLoader.d.ts +37 -0
  156. package/dist/i18n/pluralization.d.ts +19 -0
  157. package/dist/i18n/types.d.ts +106 -0
  158. package/dist/index.d.ts +69 -2605
  159. package/dist/index.js +332 -152
  160. package/dist/lambda/index.d.ts +17 -37
  161. package/dist/logging/LogManager.d.ts +83 -0
  162. package/dist/logging/Logger.d.ts +76 -0
  163. package/dist/logging/channels/ConsoleChannel.d.ts +11 -0
  164. package/dist/logging/channels/DailyFileChannel.d.ts +20 -0
  165. package/dist/logging/channels/FileChannel.d.ts +15 -0
  166. package/dist/logging/index.d.ts +8 -50
  167. package/dist/logging/types.d.ts +96 -0
  168. package/dist/mail/Mail.d.ts +138 -0
  169. package/dist/mail/MailManager.d.ts +79 -0
  170. package/dist/mail/address.d.ts +8 -0
  171. package/dist/mail/index.d.ts +7 -316
  172. package/dist/mail/transports/LogTransport.d.ts +19 -0
  173. package/dist/mail/transports/MemoryTransport.d.ts +84 -0
  174. package/dist/mail/transports/ResendTransport.d.ts +32 -0
  175. package/dist/mail/transports/SmtpTransport.d.ts +40 -0
  176. package/dist/{MailManager-DpMvYiP9.d.ts → mail/types.d.ts} +11 -92
  177. package/dist/mcp/McpServiceProvider.d.ts +17 -0
  178. package/dist/mcp/create-mcp-server.d.ts +144 -0
  179. package/dist/mcp/endpoint.d.ts +29 -0
  180. package/dist/mcp/index.d.ts +3 -185
  181. package/dist/mcp/index.js +1 -1
  182. package/dist/mvc/Controller.d.ts +326 -0
  183. package/dist/mvc/Router.d.ts +239 -0
  184. package/dist/mvc/ViewEngine.d.ts +11 -0
  185. package/dist/mvc/inertia/InertiaEngine.d.ts +114 -0
  186. package/dist/mvc/inertia/shared.d.ts +90 -0
  187. package/dist/mvc/mount-route.d.ts +10 -0
  188. package/dist/notifications/Notification.d.ts +99 -0
  189. package/dist/notifications/NotificationManager.d.ts +150 -0
  190. package/dist/notifications/channels/DatabaseChannel.d.ts +55 -0
  191. package/dist/notifications/channels/MailChannel.d.ts +45 -0
  192. package/dist/notifications/channels/MemoryChannel.d.ts +85 -0
  193. package/dist/notifications/channels/SlackChannel.d.ts +73 -0
  194. package/dist/notifications/channels/index.d.ts +4 -0
  195. package/dist/notifications/index.d.ts +6 -322
  196. package/dist/notifications/notifiable-type.d.ts +10 -0
  197. package/dist/notifications/registry.d.ts +39 -0
  198. package/dist/notifications/types.d.ts +162 -0
  199. package/dist/providers/AuthServiceProvider.d.ts +7 -0
  200. package/dist/providers/AuthorizationServiceProvider.d.ts +9 -0
  201. package/dist/providers/BroadcastServiceProvider.d.ts +7 -0
  202. package/dist/providers/CacheServiceProvider.d.ts +7 -0
  203. package/dist/providers/EncryptionServiceProvider.d.ts +7 -0
  204. package/dist/providers/ErrorServiceProvider.d.ts +9 -0
  205. package/dist/providers/EventServiceProvider.d.ts +7 -0
  206. package/dist/providers/HealthServiceProvider.d.ts +7 -0
  207. package/dist/providers/I18nServiceProvider.d.ts +27 -0
  208. package/dist/providers/InertiaServiceProvider.d.ts +20 -0
  209. package/dist/providers/LogServiceProvider.d.ts +7 -0
  210. package/dist/providers/MailServiceProvider.d.ts +7 -0
  211. package/dist/providers/NotificationServiceProvider.d.ts +8 -0
  212. package/dist/providers/OAuthServiceProvider.d.ts +7 -0
  213. package/dist/providers/QueueServiceProvider.d.ts +7 -0
  214. package/dist/providers/SchedulingServiceProvider.d.ts +7 -0
  215. package/dist/providers/StorageServiceProvider.d.ts +7 -0
  216. package/dist/providers/index.d.ts +17 -0
  217. package/dist/queue/FailedJobReporter.d.ts +40 -0
  218. package/dist/queue/Job.d.ts +140 -0
  219. package/dist/queue/QueueManager.d.ts +79 -0
  220. package/dist/queue/Worker.d.ts +99 -0
  221. package/dist/queue/drivers/MemoryDriver.d.ts +60 -0
  222. package/dist/queue/drivers/RedisDriver.d.ts +96 -0
  223. package/dist/queue/drivers/SqsDriver.d.ts +108 -0
  224. package/dist/queue/drivers/SyncDriver.d.ts +28 -0
  225. package/dist/queue/index.d.ts +9 -453
  226. package/dist/queue/types.d.ts +171 -0
  227. package/dist/redis/RedisApiTokenStore.d.ts +78 -0
  228. package/dist/redis/RedisEmailVerificationStore.d.ts +54 -0
  229. package/dist/redis/RedisOAuthStateStore.d.ts +26 -0
  230. package/dist/redis/RedisPasswordResetStore.d.ts +57 -0
  231. package/dist/redis/RedisRateLimitStore.d.ts +77 -0
  232. package/dist/redis/RedisSessionStore.d.ts +61 -0
  233. package/dist/redis/client.d.ts +41 -0
  234. package/dist/redis/index.d.ts +14 -356
  235. package/dist/redis/index.js +5 -2
  236. package/dist/redis/scan-keys.d.ts +6 -0
  237. package/dist/runtime/index.d.ts +8 -95
  238. package/dist/runtime/index.js +1 -1
  239. package/dist/scheduling/CronParser.d.ts +37 -0
  240. package/dist/scheduling/Schedule.d.ts +229 -0
  241. package/dist/scheduling/ScheduledTask.d.ts +47 -0
  242. package/dist/scheduling/Scheduler.d.ts +99 -0
  243. package/dist/scheduling/index.d.ts +5 -41
  244. package/dist/scheduling/types.d.ts +97 -0
  245. package/dist/storage/StorageManager.d.ts +65 -0
  246. package/dist/storage/drivers/LocalDriver.d.ts +55 -0
  247. package/dist/storage/drivers/MemoryDriver.d.ts +66 -0
  248. package/dist/storage/drivers/S3Driver.d.ts +72 -0
  249. package/dist/storage/index.d.ts +5 -197
  250. package/dist/{StorageManager-oZTHqaza.d.ts → storage/types.d.ts} +10 -77
  251. package/dist/support/error-polyfill.d.ts +9 -0
  252. package/dist/support/import-map.d.ts +13 -0
  253. package/dist/support/redirect-target.d.ts +11 -0
  254. package/dist/support/stack-frames.d.ts +56 -0
  255. package/dist/support/trim-slashes.d.ts +11 -0
  256. package/dist/vite/index.d.ts +2 -35
  257. package/dist/vite/index.js +0 -3
  258. package/dist/vite/plugin.d.ts +34 -0
  259. package/package.json +3 -3
  260. package/dist/AuthManager-DBP4KYsx.d.ts +0 -79
  261. package/dist/BroadcastManager-D8KoJxiV.d.ts +0 -492
  262. package/dist/HealthManager-DUyMIzsZ.d.ts +0 -141
  263. package/dist/I18nManager-BiSoczfV.d.ts +0 -275
  264. package/dist/LogManager-7mxnkaPM.d.ts +0 -256
  265. package/dist/Scheduler-pZiT8i57.d.ts +0 -471
  266. package/dist/api-token-D24VPr_E.d.ts +0 -663
  267. package/dist/app-key-CsBfRC_Q.d.ts +0 -214
  268. package/dist/email-verification-Dx426KLn.d.ts +0 -336
  269. package/dist/index-9_Jzj5jo.d.ts +0 -7
  270. package/dist/validation-yAL53e1S.d.ts +0 -2610
package/dist/index.d.ts CHANGED
@@ -1,2605 +1,69 @@
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
- import * as hono from 'hono';
4
- import { Context, MiddlewareHandler } from 'hono';
5
- export { Context } from 'hono';
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
- 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-Dx426KLn.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
- export { M as Middleware, d as defineMiddleware, j as jsonResponse } from './index-9_Jzj5jo.js';
13
- import { E as EventManager } from './EventManager-CmIoLt7r.js';
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';
15
- export { ApplicationShutdown, ApplicationStarted, JobFailed, JobProcessed, Listener, ListenerClass, RequestFinished, RequestReceived, UserAuthenticated, UserLoggedOut } from './events/index.js';
16
- export { FailedJobHandler, FailedJobInfo, FailedJobReporter, MemoryDriver, MemoryDriver as MemoryQueueDriver, RedisDriver, RedisDriverOptions, RedisDriver as RedisQueueDriver, SqsDriver, SyncDriver, SyncDriver as SyncQueueDriver, Worker, WorkerEvents, createSqsAdapter, processJob } from './queue/index.js';
17
- import { M as MailManager } from './MailManager-DpMvYiP9.js';
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
- export { LogTransport, Mail, MemoryTransport, ResendTransport, SmtpTransport, getMailManager, mail, setMailManager } from './mail/index.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
- export { FileStore as FileCacheStore, MemoryStore as MemoryCacheStore, RedisStore as RedisCacheStore, TaggedCache } from './cache/index.js';
23
- import { S as StorageManager } from './StorageManager-oZTHqaza.js';
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
- export { LocalDriver as LocalStorageDriver, MemoryDriver as MemoryStorageDriver, S3Driver } from './storage/index.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
- export { getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, matchesCron, parseCron, toTimezone } from './scheduling/index.js';
29
- import { L as LogManager } from './LogManager-7mxnkaPM.js';
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
- export { ConsoleChannel, DailyFileChannel, FileChannel } from './logging/index.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
- export { JsonLoader, MemoryLoader, getPluralizationRule, pluralizationRules, selectPluralForm } from './i18n/index.js';
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
- export { CacheCheck, CacheCheckOptions, CacheStoreInterface, CustomCheck, CustomCheckCallback, DatabaseCheck, DatabaseCheckOptions, DatabaseConnection, MemoryCheck, MemoryCheckOptions, RedisCheck, RedisCheckOptions, RedisClient, StorageCheck, StorageCheckOptions, StorageDriverInterface, customCheck } from './health/index.js';
37
- export { DatabaseChannel, MailChannel, MailChannelOptions, MemoryChannel, NotificationConstructor, SlackChannel, SlackChannelOptions, clearNotificationRegistry, getNotification, registerNotification, resolveNotifiableType } from './notifications/index.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
- export { RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, createTypedBroadcaster } from './broadcasting/index.js';
41
- import * as readline from 'readline';
42
- export { C as ConsoleKernel, c as createConsoleKernel } from './ConsoleKernel-CJg975mp.js';
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
- export { AuthorizedContext, Policy, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, definePolicy, withAuthorization } from './authorization/index.js';
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
- 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 './rate-limit-D9J2b4S1.js';
48
- import 'vite';
49
- import '@guren/orm';
50
- import 'ioredis';
51
-
52
- interface RequireAuthOptions {
53
- redirectTo?: string;
54
- status?: number;
55
- responseFactory?: () => Response;
56
- }
57
- declare const AUTH_CONTEXT_KEY = "guren:auth";
58
- declare function attachAuthContext(contextFactory: (ctx: Context) => AuthContext): MiddlewareHandler;
59
- declare function requireAuthenticated(options?: RequireAuthOptions): MiddlewareHandler;
60
- declare function requireGuest(options?: RequireAuthOptions): MiddlewareHandler;
61
-
62
- type ViewRenderer = (template: string, props: Record<string, unknown>) => Response | Promise<Response>;
63
- /**
64
- * Registry for view renderers. Engines are typically registered via service
65
- * providers so applications can opt into or replace implementations.
66
- */
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>;
72
- }
73
-
74
- /**
75
- * Base HTTP exception class.
76
- *
77
- * @example
78
- * ```typescript
79
- * // Using factory methods
80
- * throw HttpException.notFound('User not found')
81
- * throw HttpException.unauthorized('Invalid credentials')
82
- *
83
- * // Custom status code
84
- * throw new HttpException(418, "I'm a teapot")
85
- *
86
- * // With validation errors
87
- * throw HttpException.unprocessable('Validation failed', {
88
- * email: ['Email is required', 'Email must be valid'],
89
- * password: ['Password is too short'],
90
- * })
91
- * ```
92
- */
93
- declare class HttpException extends Error {
94
- /**
95
- * HTTP status code.
96
- */
97
- readonly statusCode: number;
98
- /**
99
- * Validation or field-specific errors.
100
- */
101
- readonly errors?: Record<string, string[]>;
102
- /**
103
- * Additional error data.
104
- */
105
- readonly data?: Record<string, unknown>;
106
- constructor(statusCode: number, message: string, errors?: Record<string, string[]>, data?: Record<string, unknown>);
107
- /**
108
- * Convert to response format.
109
- */
110
- toResponse(debug?: boolean): {
111
- status: number;
112
- body: ErrorResponse;
113
- };
114
- /**
115
- * Convert to JSON.
116
- */
117
- toJSON(): Record<string, unknown>;
118
- /**
119
- * Create a 400 Bad Request exception.
120
- */
121
- static badRequest(message?: string): HttpException;
122
- /**
123
- * Create a 401 Unauthorized exception.
124
- */
125
- static unauthorized(message?: string): HttpException;
126
- /**
127
- * Create a 403 Forbidden exception.
128
- */
129
- static forbidden(message?: string): HttpException;
130
- /**
131
- * Create a 404 Not Found exception.
132
- */
133
- static notFound(message?: string): HttpException;
134
- /**
135
- * Create a 405 Method Not Allowed exception.
136
- */
137
- static methodNotAllowed(message?: string): HttpException;
138
- /**
139
- * Create a 409 Conflict exception.
140
- */
141
- static conflict(message?: string): HttpException;
142
- /**
143
- * Create a 410 Gone exception.
144
- */
145
- static gone(message?: string): HttpException;
146
- /**
147
- * Create a 422 Unprocessable Entity exception.
148
- */
149
- static unprocessable(message?: string, errors?: Record<string, string[]>): HttpException;
150
- /**
151
- * Create a 429 Too Many Requests exception.
152
- */
153
- static tooManyRequests(message?: string): HttpException;
154
- /**
155
- * Create a 500 Internal Server Error exception.
156
- */
157
- static internal(message?: string): HttpException;
158
- /**
159
- * Create a 501 Not Implemented exception.
160
- */
161
- static notImplemented(message?: string): HttpException;
162
- /**
163
- * Create a 502 Bad Gateway exception.
164
- */
165
- static badGateway(message?: string): HttpException;
166
- /**
167
- * Create a 503 Service Unavailable exception.
168
- */
169
- static serviceUnavailable(message?: string): HttpException;
170
- /**
171
- * Create a 504 Gateway Timeout exception.
172
- */
173
- static gatewayTimeout(message?: string): HttpException;
174
- /**
175
- * Check if an error is an HTTP exception.
176
- */
177
- static isHttpException(error: unknown): error is HttpException;
178
- }
179
-
180
- /**
181
- * Validation exception.
182
- *
183
- * Thrown when request validation fails.
184
- *
185
- * @example
186
- * ```typescript
187
- * throw new ValidationException({
188
- * email: ['Email is required', 'Email must be valid'],
189
- * password: ['Password is too short'],
190
- * })
191
- * ```
192
- */
193
- declare class ValidationException extends HttpException {
194
- constructor(errors: Record<string, string[]>, message?: string);
195
- /**
196
- * Create from Zod error.
197
- */
198
- static fromZodError(zodError: ZodLikeError): ValidationException;
199
- /**
200
- * Get errors for a specific field.
201
- */
202
- getFieldErrors(field: string): string[];
203
- /**
204
- * Check if a field has errors.
205
- */
206
- hasFieldError(field: string): boolean;
207
- /**
208
- * Get the first error for a field.
209
- */
210
- getFirstError(field: string): string | null;
211
- /**
212
- * Get all error messages as a flat array.
213
- */
214
- getAllMessages(): string[];
215
- /**
216
- * Create a ValidationException from a plain messages object.
217
- *
218
- * Useful for business-logic validation (e.g. duplicate email checks)
219
- * where Zod is not involved.
220
- *
221
- * @example
222
- * ```typescript
223
- * throw ValidationException.withMessages({ email: 'Email already registered' })
224
- * throw ValidationException.withMessages({ email: ['Must be unique', 'Must be corporate'] })
225
- * ```
226
- */
227
- static withMessages(messages: Record<string, string | string[]>): ValidationException;
228
- }
229
- /**
230
- * Zod-like error interface for compatibility.
231
- */
232
- interface ZodLikeError {
233
- issues: Array<{
234
- path: PropertyKey[];
235
- message: string;
236
- }>;
237
- }
238
-
239
- /**
240
- * Authentication exception.
241
- *
242
- * Thrown when a user is not authenticated or credentials are invalid.
243
- *
244
- * @example
245
- * ```typescript
246
- * throw new AuthenticationException()
247
- * throw new AuthenticationException('Invalid token')
248
- * throw new AuthenticationException('Session expired', 'login')
249
- * ```
250
- */
251
- declare class AuthenticationException extends HttpException {
252
- /**
253
- * The guard that threw the exception.
254
- */
255
- readonly guard?: string;
256
- /**
257
- * URL to redirect to for authentication.
258
- */
259
- readonly redirectTo?: string;
260
- constructor(message?: string, guard?: string, redirectTo?: string);
261
- /**
262
- * Create exception with redirect URL.
263
- */
264
- static withRedirect(redirectTo: string, message?: string): AuthenticationException;
265
- /**
266
- * Create exception for a specific guard.
267
- */
268
- static forGuard(guard: string, message?: string): AuthenticationException;
269
- }
270
-
271
- /**
272
- * Authorization exception.
273
- *
274
- * Thrown when a user is authenticated but not authorized to perform an action.
275
- *
276
- * @example
277
- * ```typescript
278
- * throw new AuthorizationException()
279
- * throw new AuthorizationException('You cannot edit this post')
280
- * throw new AuthorizationException('Access denied', 'edit', 'Post')
281
- * ```
282
- */
283
- declare class AuthorizationException extends HttpException {
284
- /**
285
- * The action that was attempted.
286
- */
287
- readonly action?: string;
288
- /**
289
- * The resource that was being accessed.
290
- */
291
- readonly resource?: string;
292
- constructor(message?: string, action?: string, resource?: string);
293
- /**
294
- * Create exception for a specific action and resource.
295
- */
296
- static forAction(action: string, resource?: string): AuthorizationException;
297
- /**
298
- * Deny access to a resource.
299
- */
300
- static deny(resource?: string): AuthorizationException;
301
- }
302
-
303
- /**
304
- * Not Found HTTP exception.
305
- *
306
- * Thrown when a requested resource cannot be found.
307
- *
308
- * @example
309
- * ```typescript
310
- * throw new NotFoundHttpException()
311
- * throw new NotFoundHttpException('User not found')
312
- * throw NotFoundHttpException.forModel('User', 123)
313
- * ```
314
- */
315
- declare class NotFoundHttpException extends HttpException {
316
- /**
317
- * The type of resource that was not found.
318
- */
319
- readonly resourceType?: string;
320
- /**
321
- * The ID of the resource that was not found.
322
- */
323
- readonly resourceId?: string | number;
324
- constructor(message?: string, resourceType?: string, resourceId?: string | number);
325
- /**
326
- * Create exception for a model not found.
327
- */
328
- static forModel(model: string, id: string | number): NotFoundHttpException;
329
- /**
330
- * Create exception for a route not found.
331
- */
332
- static forRoute(path: string): NotFoundHttpException;
333
- /**
334
- * Create exception for a resource not found.
335
- */
336
- static forResource(resource: string): NotFoundHttpException;
337
- }
338
-
339
- /**
340
- * Method Not Allowed exception.
341
- *
342
- * Thrown when an HTTP method is not allowed for a route.
343
- *
344
- * @example
345
- * ```typescript
346
- * throw new MethodNotAllowedException()
347
- * throw new MethodNotAllowedException('POST', ['GET', 'HEAD'])
348
- * ```
349
- */
350
- declare class MethodNotAllowedException extends HttpException {
351
- /**
352
- * The HTTP method that was attempted.
353
- */
354
- readonly method?: string;
355
- /**
356
- * The allowed HTTP methods.
357
- */
358
- readonly allowedMethods?: string[];
359
- constructor(method?: string, allowedMethods?: string[], message?: string);
360
- /**
361
- * Get the Allow header value.
362
- */
363
- getAllowHeader(): string;
364
- /**
365
- * Create exception with method details.
366
- */
367
- static forMethod(method: string, allowedMethods: string[]): MethodNotAllowedException;
368
- }
369
-
370
- declare function renderErrorPage(statusCode: number, message?: string): string;
371
-
372
- /**
373
- * Registers the Inertia view engine and wires up validation error handling
374
- * for Inertia requests (Laravel-style automatic redirect with flashed errors).
375
- */
376
- declare class InertiaServiceProvider extends ServiceProvider {
377
- register(): void;
378
- boot(): void;
379
- /**
380
- * Register a custom renderer for ValidationException on Inertia requests.
381
- * Non-Inertia requests fall through to the default JSON 422 response.
382
- */
383
- private registerValidationRenderer;
384
- /**
385
- * Wrap existing shared props resolver to auto-inject flashed `errors`.
386
- */
387
- private registerSharedErrors;
388
- }
389
-
390
- /**
391
- * Sets up authentication guards, session middleware, and auth context.
392
- */
393
- declare class AuthServiceProvider extends ServiceProvider {
394
- register(): void;
395
- }
396
-
397
- /**
398
- * Binds OAuthManager as a singleton in the container.
399
- */
400
- declare class OAuthServiceProvider extends ServiceProvider {
401
- register(): void;
402
- }
403
-
404
- /**
405
- * Binds the EventManager as a singleton in the container.
406
- */
407
- declare class EventServiceProvider extends ServiceProvider {
408
- register(): void;
409
- }
410
-
411
- /**
412
- * Binds the CacheManager as a singleton in the container.
413
- */
414
- declare class CacheServiceProvider extends ServiceProvider {
415
- register(): void;
416
- }
417
-
418
- /**
419
- * Binds the QueueManager as a singleton in the container.
420
- */
421
- declare class QueueServiceProvider extends ServiceProvider {
422
- register(): void;
423
- }
424
-
425
- /**
426
- * Binds the MailManager as a singleton in the container.
427
- */
428
- declare class MailServiceProvider extends ServiceProvider {
429
- register(): void;
430
- }
431
-
432
- /**
433
- * Binds the LogManager as a singleton in the container.
434
- */
435
- declare class LogServiceProvider extends ServiceProvider {
436
- register(): void;
437
- }
438
-
439
- /**
440
- * Binds the I18nManager as a singleton in the container.
441
- */
442
- declare class I18nServiceProvider extends ServiceProvider {
443
- register(): void;
444
- }
445
-
446
- /**
447
- * Binds the NotificationManager as a singleton in the container.
448
- */
449
- declare class NotificationServiceProvider extends ServiceProvider {
450
- register(): void;
451
- boot(): void;
452
- }
453
-
454
- /**
455
- * Binds the BroadcastManager as a singleton in the container.
456
- */
457
- declare class BroadcastServiceProvider extends ServiceProvider {
458
- register(): void;
459
- }
460
-
461
- /**
462
- * Binds the Encrypter as a singleton in the container.
463
- */
464
- declare class EncryptionServiceProvider extends ServiceProvider {
465
- register(): void;
466
- }
467
-
468
- /**
469
- * Binds the StorageManager as a singleton in the container.
470
- */
471
- declare class StorageServiceProvider extends ServiceProvider {
472
- register(): void;
473
- }
474
-
475
- /**
476
- * Binds the HealthManager as a singleton in the container.
477
- */
478
- declare class HealthServiceProvider extends ServiceProvider {
479
- register(): void;
480
- }
481
-
482
- /**
483
- * Binds the Scheduler as a singleton in the container.
484
- */
485
- declare class SchedulingServiceProvider extends ServiceProvider {
486
- register(): void;
487
- }
488
-
489
- /**
490
- * Binds the Gate as a singleton in the container and exposes it as the
491
- * global gate so `getGate()`, `can()`, and controller authorization helpers
492
- * work without manual wiring.
493
- */
494
- declare class AuthorizationServiceProvider extends ServiceProvider {
495
- register(): void;
496
- }
497
-
498
- /**
499
- * Binds the ExceptionHandler as a singleton in the container
500
- * and attaches it as global error-handling middleware.
501
- */
502
- declare class ErrorServiceProvider extends ServiceProvider {
503
- register(): void;
504
- boot(): void;
505
- }
506
-
507
- /**
508
- * Validation rule function type.
509
- */
510
- type ValidationRule<T = unknown> = (value: T, field: string, data: Record<string, unknown>) => true | string | Promise<true | string>;
511
- /**
512
- * Validation rule definition.
513
- */
514
- interface RuleDefinition {
515
- name: string;
516
- validate: ValidationRule;
517
- message?: string;
518
- }
519
- /**
520
- * Validation result.
521
- */
522
- interface ValidationResult {
523
- success: boolean;
524
- data?: Record<string, unknown>;
525
- errors?: Record<string, string[]>;
526
- }
527
- /**
528
- * File validation options.
529
- */
530
- interface FileValidationOptions {
531
- /**
532
- * Maximum file size in bytes.
533
- */
534
- maxSize?: number;
535
- /**
536
- * Allowed MIME types.
537
- */
538
- mimes?: string[];
539
- /**
540
- * Allowed file extensions.
541
- */
542
- extensions?: string[];
543
- /**
544
- * Minimum file size in bytes.
545
- */
546
- minSize?: number;
547
- }
548
- /**
549
- * Image validation options.
550
- */
551
- interface ImageValidationOptions extends FileValidationOptions {
552
- /**
553
- * Maximum width in pixels.
554
- */
555
- maxWidth?: number;
556
- /**
557
- * Maximum height in pixels.
558
- */
559
- maxHeight?: number;
560
- /**
561
- * Minimum width in pixels.
562
- */
563
- minWidth?: number;
564
- /**
565
- * Minimum height in pixels.
566
- */
567
- minHeight?: number;
568
- /**
569
- * Required aspect ratio (width/height).
570
- */
571
- ratio?: number;
572
- /**
573
- * Allowed aspect ratio tolerance.
574
- */
575
- ratioTolerance?: number;
576
- }
577
- /**
578
- * Validator options.
579
- */
580
- interface ValidatorOptions {
581
- /**
582
- * Stop on first error for each field.
583
- * @default true
584
- */
585
- stopOnFirstError?: boolean;
586
- /**
587
- * Custom error messages.
588
- */
589
- messages?: Record<string, string>;
590
- /**
591
- * Custom attribute names for error messages.
592
- */
593
- attributes?: Record<string, string>;
594
- }
595
- /**
596
- * File-like interface for validation.
597
- */
598
- interface FileLike {
599
- name: string;
600
- size: number;
601
- type: string;
602
- }
603
-
604
- /**
605
- * Base class for form request validation.
606
- *
607
- * FormRequest encapsulates both validation rules and authorization logic
608
- * for a single request type. Extend this class and define `rules()` and
609
- * optionally `authorize()` to create type-safe request validation.
610
- *
611
- * @example
612
- * ```typescript
613
- * interface StorePostData {
614
- * title: string
615
- * content: string
616
- * status: 'draft' | 'published'
617
- * }
618
- *
619
- * class StorePostRequest extends FormRequest<StorePostData> {
620
- * rules() {
621
- * return {
622
- * title: [required(), stringRule(), min(3), max(255)],
623
- * content: [required(), stringRule()],
624
- * status: [required(), inValues(['draft', 'published'])],
625
- * }
626
- * }
627
- *
628
- * authorize() {
629
- * return this.user() !== null
630
- * }
631
- * }
632
- *
633
- * // In controller:
634
- * const data = await this.validate(StorePostRequest)
635
- * // data is typed as StorePostData
636
- * ```
637
- */
638
- /**
639
- * @deprecated Legacy compatibility layer — prefer schema-first validation
640
- * via `this.validateBody()` / `validateQuery()` / `validateParams()`.
641
- */
642
- declare abstract class FormRequest<T = Record<string, unknown>> {
643
- protected ctx: Context;
644
- /**
645
- * Define validation rules for this request.
646
- * Return an object mapping field names to arrays of validation rules.
647
- */
648
- abstract rules(): Record<string, ValidationRule[]>;
649
- /**
650
- * Determine if the user is authorized to make this request.
651
- * Override to implement authorization logic. Defaults to true.
652
- */
653
- authorize(): boolean | Promise<boolean>;
654
- /**
655
- * Custom error messages for validation rules.
656
- * Override to provide custom messages.
657
- */
658
- messages(): Record<string, string>;
659
- /**
660
- * Custom attribute names for validation errors.
661
- * Override to provide human-readable field names.
662
- */
663
- attributes(): Record<string, string>;
664
- /**
665
- * Get the authenticated user from the request context.
666
- */
667
- protected user(): unknown;
668
- /**
669
- * Handle the form request: authorize, parse body, validate, return typed data.
670
- * @internal Called by Controller.validate()
671
- */
672
- handle(ctx: Context): Promise<T>;
673
- private parseBody;
674
- }
675
-
676
- /**
677
- * Field validator builder.
678
- */
679
- declare class FieldValidator {
680
- private field;
681
- private _rules;
682
- private isNullable;
683
- private isSometimes;
684
- private bailOnFirstError;
685
- private conditions;
686
- constructor(field: string);
687
- /**
688
- * Add a validation rule.
689
- */
690
- rule(rule: ValidationRule): this;
691
- /**
692
- * Add multiple validation rules.
693
- */
694
- rules(...rules: ValidationRule[]): this;
695
- /**
696
- * Mark field as nullable (allows null values).
697
- */
698
- nullable(): this;
699
- /**
700
- * Only validate if field is present.
701
- */
702
- sometimes(): this;
703
- /**
704
- * Stop validation on first error.
705
- */
706
- bail(): this;
707
- /**
708
- * Continue validation even after errors.
709
- */
710
- continueOnError(): this;
711
- /**
712
- * Add a condition - only validate if condition is true.
713
- */
714
- when(condition: (data: Record<string, unknown>) => boolean): this;
715
- /**
716
- * Add a condition - only validate if condition is false.
717
- */
718
- unless(condition: (data: Record<string, unknown>) => boolean): this;
719
- /**
720
- * Validate the field.
721
- */
722
- validate(value: unknown, data: Record<string, unknown>, options?: ValidatorOptions): Promise<string[]>;
723
- /**
724
- * Format error message.
725
- */
726
- private formatMessage;
727
- /**
728
- * Get the field name.
729
- */
730
- getField(): string;
731
- }
732
- /**
733
- * Validator class for validating data against rules.
734
- *
735
- * @example
736
- * ```typescript
737
- * import { Validator, required, email, min } from '@guren/server'
738
- *
739
- * const validator = new Validator()
740
- * .field('name', required(), min(2))
741
- * .field('email', required(), email())
742
- * .field('password', required(), min(8))
743
- * .field('password_confirmation', required())
744
- *
745
- * const result = await validator.validate(data)
746
- * if (!result.success) {
747
- * console.log(result.errors)
748
- * }
749
- * ```
750
- */
751
- declare class Validator {
752
- private fields;
753
- private options;
754
- /**
755
- * Create a new validator.
756
- */
757
- constructor(options?: ValidatorOptions);
758
- /**
759
- * Add a field with rules.
760
- */
761
- field(name: string, ...rules: ValidationRule[]): this;
762
- /**
763
- * Add a field validator.
764
- */
765
- addField(validator: FieldValidator): this;
766
- /**
767
- * Get a field validator for fluent configuration.
768
- */
769
- for(name: string): FieldValidator;
770
- /**
771
- * Set custom error messages.
772
- */
773
- messages(messages: Record<string, string>): this;
774
- /**
775
- * Set custom attribute names.
776
- */
777
- attributes(attributes: Record<string, string>): this;
778
- /**
779
- * Validate data.
780
- */
781
- validate(data: Record<string, unknown>): Promise<ValidationResult>;
782
- /**
783
- * Validate and throw if invalid.
784
- */
785
- validateOrThrow(data: Record<string, unknown>): Promise<Record<string, unknown>>;
786
- /**
787
- * Create a new validator from rules object.
788
- */
789
- static make(rules: Record<string, ValidationRule[]>, options?: ValidatorOptions): Validator;
790
- }
791
- /**
792
- * Create a new validator.
793
- */
794
- declare function createValidator(options?: ValidatorOptions): Validator;
795
- /**
796
- * Quick validate function.
797
- */
798
- declare function quickValidate(data: Record<string, unknown>, rules: Record<string, ValidationRule[]>, options?: ValidatorOptions): Promise<ValidationResult>;
799
- /**
800
- * Quick validate and throw function.
801
- */
802
- declare function quickValidateOrThrow(data: Record<string, unknown>, rules: Record<string, ValidationRule[]>, options?: ValidatorOptions): Promise<Record<string, unknown>>;
803
-
804
- /**
805
- * Built-in validation rules.
806
- */
807
- /**
808
- * Required rule - value must be present and not empty.
809
- */
810
- declare function required(): ValidationRule;
811
- /**
812
- * Nullable rule - allows null values (removes other validation if null).
813
- */
814
- declare function nullable(): ValidationRule;
815
- /**
816
- * Required if another field equals a value.
817
- */
818
- declare function requiredIf(field: string, value: unknown): ValidationRule;
819
- /**
820
- * Required unless another field equals a value.
821
- */
822
- declare function requiredUnless(field: string, value: unknown): ValidationRule;
823
- /**
824
- * Required with - field is required if any of the other fields are present.
825
- */
826
- declare function requiredWith(...fields: string[]): ValidationRule;
827
- /**
828
- * Required without - field is required if any of the other fields are not present.
829
- */
830
- declare function requiredWithout(...fields: string[]): ValidationRule;
831
- /**
832
- * String rule - value must be a string.
833
- */
834
- declare function string(): ValidationRule;
835
- /**
836
- * Numeric rule - value must be a number.
837
- */
838
- declare function numeric(): ValidationRule;
839
- /**
840
- * Integer rule - value must be an integer.
841
- */
842
- declare function integer(): ValidationRule;
843
- /**
844
- * Boolean rule - value must be a boolean.
845
- */
846
- declare function boolean(): ValidationRule;
847
- /**
848
- * Array rule - value must be an array.
849
- */
850
- declare function array(): ValidationRule;
851
- /**
852
- * Object rule - value must be an object.
853
- */
854
- declare function object(): ValidationRule;
855
- /**
856
- * Email rule - value must be a valid email.
857
- */
858
- declare function email(): ValidationRule;
859
- /**
860
- * URL rule - value must be a valid URL.
861
- */
862
- declare function url(): ValidationRule;
863
- /**
864
- * UUID rule - value must be a valid UUID.
865
- */
866
- declare function uuid(): ValidationRule;
867
- /**
868
- * Minimum rule - value must be at least min.
869
- */
870
- declare function min(minValue: number): ValidationRule;
871
- /**
872
- * Maximum rule - value must be at most max.
873
- */
874
- declare function max(maxValue: number): ValidationRule;
875
- /**
876
- * Between rule - value must be between min and max.
877
- */
878
- declare function between(minValue: number, maxValue: number): ValidationRule;
879
- /**
880
- * Size rule - value must be exactly size.
881
- */
882
- declare function size(exactSize: number): ValidationRule;
883
- /**
884
- * In rule - value must be in the given array.
885
- */
886
- declare function inValues(values: unknown[]): ValidationRule;
887
- /**
888
- * Not in rule - value must not be in the given array.
889
- */
890
- declare function notIn(values: unknown[]): ValidationRule;
891
- /**
892
- * Regex rule - value must match the regex.
893
- */
894
- declare function regex(pattern: RegExp): ValidationRule;
895
- /**
896
- * Confirmed rule - field must have a matching field_confirmation.
897
- */
898
- declare function confirmed(): ValidationRule;
899
- /**
900
- * Same rule - field must match another field.
901
- */
902
- declare function same(otherField: string): ValidationRule;
903
- /**
904
- * Different rule - field must be different from another field.
905
- */
906
- declare function different(otherField: string): ValidationRule;
907
- /**
908
- * After rule - date must be after another date.
909
- */
910
- declare function after(date: string | Date): ValidationRule;
911
- /**
912
- * After or equal rule - date must be after or equal to another date.
913
- */
914
- declare function afterOrEqual(date: string | Date): ValidationRule;
915
- /**
916
- * Before rule - date must be before another date.
917
- */
918
- declare function before(date: string | Date): ValidationRule;
919
- /**
920
- * Before or equal rule - date must be before or equal to another date.
921
- */
922
- declare function beforeOrEqual(date: string | Date): ValidationRule;
923
- /**
924
- * Date rule - value must be a valid date.
925
- */
926
- declare function date(): ValidationRule;
927
- /**
928
- * Date format rule - value must match the given format.
929
- */
930
- declare function dateFormat(format: string): ValidationRule;
931
- /**
932
- * Alpha rule - value must only contain letters.
933
- */
934
- declare function alpha(): ValidationRule;
935
- /**
936
- * Alpha numeric rule - value must only contain letters and numbers.
937
- */
938
- declare function alphaNum(): ValidationRule;
939
- /**
940
- * Alpha dash rule - value must only contain letters, numbers, dashes, and underscores.
941
- */
942
- declare function alphaDash(): ValidationRule;
943
- /**
944
- * Starts with rule - value must start with one of the given prefixes.
945
- */
946
- declare function startsWith(...prefixes: string[]): ValidationRule;
947
- /**
948
- * Ends with rule - value must end with one of the given suffixes.
949
- */
950
- declare function endsWith(...suffixes: string[]): ValidationRule;
951
- /**
952
- * JSON rule - value must be a valid JSON string.
953
- */
954
- declare function json(): ValidationRule;
955
- /**
956
- * IP rule - value must be a valid IP address.
957
- */
958
- declare function ip(): ValidationRule;
959
- /**
960
- * IPv4 rule - value must be a valid IPv4 address.
961
- */
962
- declare function ipv4(): ValidationRule;
963
- /**
964
- * IPv6 rule - value must be a valid IPv6 address.
965
- */
966
- declare function ipv6(): ValidationRule;
967
- /**
968
- * File rule - validates a file object.
969
- */
970
- declare function file(options?: FileValidationOptions): ValidationRule;
971
- /**
972
- * Image rule - validates an image file.
973
- */
974
- declare function image(options?: ImageValidationOptions): ValidationRule;
975
- /**
976
- * Mimes rule - validates file MIME types.
977
- */
978
- declare function mimes(...mimeTypes: string[]): ValidationRule;
979
- /**
980
- * Max file size rule.
981
- */
982
- declare function maxFileSize(bytes: number): ValidationRule;
983
- /**
984
- * Min file size rule.
985
- */
986
- declare function minFileSize(bytes: number): ValidationRule;
987
- /**
988
- * Custom rule - create a custom validation rule.
989
- */
990
- declare function custom(validate: (value: unknown, field: string, data: Record<string, unknown>) => boolean | string | Promise<boolean | string>, message?: string): ValidationRule;
991
- /**
992
- * Unique rule (async) - checks uniqueness via callback.
993
- */
994
- declare function unique(callback: (value: unknown, field: string) => Promise<boolean>): ValidationRule;
995
- /**
996
- * Exists rule (async) - checks existence via callback.
997
- */
998
- declare function exists(callback: (value: unknown, field: string) => Promise<boolean>): ValidationRule;
999
-
1000
- /**
1001
- * Seeder class interface.
1002
- */
1003
- interface SeederClass {
1004
- new (): Seeder;
1005
- }
1006
- /**
1007
- * Abstract seeder interface.
1008
- */
1009
- interface Seeder {
1010
- run(): Promise<void>;
1011
- }
1012
- /**
1013
- * Factory class interface.
1014
- */
1015
- interface FactoryClass<T> {
1016
- new (): Factory<T>;
1017
- }
1018
- /**
1019
- * Abstract factory interface.
1020
- */
1021
- interface Factory<T> {
1022
- definition(): Partial<T>;
1023
- make(overrides?: Partial<T>): T;
1024
- makeMany(count: number, overrides?: Partial<T>): T[];
1025
- create(overrides?: Partial<T>): Promise<T>;
1026
- createMany(count: number, overrides?: Partial<T>): Promise<T[]>;
1027
- }
1028
- /**
1029
- * Seeder runner options.
1030
- */
1031
- interface SeederRunnerOptions {
1032
- /**
1033
- * Path to seeders directory.
1034
- */
1035
- seedersPath?: string;
1036
- /**
1037
- * Default seeder class name.
1038
- */
1039
- defaultSeeder?: string;
1040
- /**
1041
- * Force run in production.
1042
- */
1043
- force?: boolean;
1044
- /**
1045
- * Silent mode (no console output).
1046
- */
1047
- silent?: boolean;
1048
- }
1049
-
1050
- /**
1051
- * Reset called seeders tracking (for testing).
1052
- */
1053
- declare function resetCalledSeeders(): void;
1054
- /**
1055
- * Abstract base class for database seeders.
1056
- */
1057
- declare abstract class BaseSeeder {
1058
- /**
1059
- * Run the seeder.
1060
- */
1061
- abstract run(): Promise<void>;
1062
- /**
1063
- * Call another seeder.
1064
- */
1065
- protected call(SeederClass: SeederClass): Promise<void>;
1066
- /**
1067
- * Call another seeder only once.
1068
- * Useful for avoiding duplicate data when seeders have dependencies.
1069
- */
1070
- protected callOnce(SeederClass: SeederClass): Promise<void>;
1071
- /**
1072
- * Call multiple seeders in sequence.
1073
- */
1074
- protected callMany(seeders: SeederClass[]): Promise<void>;
1075
- /**
1076
- * Call multiple seeders in parallel.
1077
- */
1078
- protected callParallel(seeders: SeederClass[]): Promise<void>;
1079
- }
1080
-
1081
- /**
1082
- * State definition for factories.
1083
- */
1084
- type StateDefinition<T> = Partial<T> | ((attributes: Partial<T>) => Partial<T>);
1085
- /**
1086
- * Abstract base class for model factories.
1087
- */
1088
- declare abstract class BaseFactory<T> {
1089
- private _sequence;
1090
- private _states;
1091
- private _activeStates;
1092
- private _afterCreatingCallbacks;
1093
- private _afterMakingCallbacks;
1094
- /**
1095
- * Get the current sequence number.
1096
- */
1097
- protected get sequence(): number;
1098
- /**
1099
- * Define the default attributes for the model.
1100
- */
1101
- abstract definition(): Partial<T>;
1102
- /**
1103
- * Create a model instance (to be overridden for persistence).
1104
- */
1105
- protected persist(attributes: Partial<T>): Promise<T>;
1106
- /**
1107
- * Define a state.
1108
- */
1109
- state(name: string, state: StateDefinition<T>): this;
1110
- /**
1111
- * Apply a state to the factory.
1112
- */
1113
- withState(name: string): this;
1114
- /**
1115
- * Apply multiple states.
1116
- */
1117
- withStates(...names: string[]): this;
1118
- /**
1119
- * Register a callback to run after creating.
1120
- */
1121
- afterCreating(callback: (model: T) => void | Promise<void>): this;
1122
- /**
1123
- * Register a callback to run after making.
1124
- */
1125
- afterMaking(callback: (model: T) => void | Promise<void>): this;
1126
- /**
1127
- * Make a model instance without persisting.
1128
- */
1129
- make(overrides?: Partial<T>): T;
1130
- /**
1131
- * Make multiple model instances without persisting.
1132
- */
1133
- makeMany(count: number, overrides?: Partial<T>): T[];
1134
- /**
1135
- * Create and persist a model instance.
1136
- */
1137
- create(overrides?: Partial<T>): Promise<T>;
1138
- /**
1139
- * Create and persist multiple model instances.
1140
- */
1141
- createMany(count: number, overrides?: Partial<T>): Promise<T[]>;
1142
- /**
1143
- * Reset the sequence counter.
1144
- */
1145
- resetSequence(): this;
1146
- /**
1147
- * Clear active states.
1148
- */
1149
- clearStates(): this;
1150
- /**
1151
- * Create a new factory instance with fresh state.
1152
- */
1153
- fresh(): this;
1154
- }
1155
-
1156
- /**
1157
- * Helper to create a simple factory with a definition function.
1158
- */
1159
- declare function defineFactory<T>(definition: (sequence: number) => Partial<T>, persist?: (attributes: Partial<T>) => Promise<T>): BaseFactory<T>;
1160
-
1161
- /**
1162
- * Seeder runner for executing database seeders.
1163
- */
1164
- declare class SeederRunner {
1165
- private options;
1166
- private seeders;
1167
- constructor(options?: SeederRunnerOptions);
1168
- /**
1169
- * Register a seeder class.
1170
- */
1171
- register(name: string, seeder: SeederClass): this;
1172
- /**
1173
- * Register multiple seeder classes.
1174
- */
1175
- registerMany(seeders: Record<string, SeederClass>): this;
1176
- /**
1177
- * Run a specific seeder by name or class.
1178
- */
1179
- run(seeder?: string | SeederClass): Promise<void>;
1180
- /**
1181
- * Run multiple seeders in sequence.
1182
- */
1183
- runMany(seeders: Array<string | SeederClass>): Promise<void>;
1184
- /**
1185
- * Resolve a seeder by name.
1186
- */
1187
- private resolveSeeder;
1188
- /**
1189
- * Get available seeders from the seeders directory.
1190
- */
1191
- getAvailableSeeders(): Promise<string[]>;
1192
- /**
1193
- * Log a message if not silent.
1194
- */
1195
- private log;
1196
- }
1197
- /**
1198
- * Create a seeder runner.
1199
- */
1200
- declare function createSeederRunner(options?: SeederRunnerOptions): SeederRunner;
1201
-
1202
- /**
1203
- * Resource data type.
1204
- */
1205
- type ResourceData = Record<string, unknown>;
1206
- type ValidationErrors<TField extends string = string> = Partial<Record<TField | 'message', string>>;
1207
- /**
1208
- * Pagination meta information.
1209
- */
1210
- interface PaginationMeta {
1211
- currentPage: number;
1212
- lastPage: number;
1213
- perPage: number;
1214
- total: number;
1215
- from: number | null;
1216
- to: number | null;
1217
- }
1218
- /**
1219
- * Pagination links.
1220
- */
1221
- interface PaginationPageLink {
1222
- page: number;
1223
- url: string | null;
1224
- active: boolean;
1225
- }
1226
- interface PaginationLinks {
1227
- first: string | null;
1228
- last: string | null;
1229
- prev: string | null;
1230
- next: string | null;
1231
- pages: PaginationPageLink[];
1232
- }
1233
- /**
1234
- * Paginated response structure.
1235
- */
1236
- interface PaginatedResponse<T> {
1237
- data: T[];
1238
- meta: PaginationMeta;
1239
- links: PaginationLinks;
1240
- }
1241
- interface PaginatedPageProps<T> extends Record<string, unknown> {
1242
- data: T[];
1243
- pagination: {
1244
- meta: PaginationMeta;
1245
- links: PaginationLinks;
1246
- };
1247
- }
1248
- /**
1249
- * Cursor pagination meta information.
1250
- */
1251
- interface CursorPaginationMeta {
1252
- perPage: number;
1253
- nextCursor: string | null;
1254
- prevCursor: string | null;
1255
- hasMore: boolean;
1256
- }
1257
- /**
1258
- * Cursor paginated response structure.
1259
- */
1260
- interface CursorPaginatedResponse<T> {
1261
- data: T[];
1262
- meta: CursorPaginationMeta;
1263
- }
1264
- /**
1265
- * Paginator options.
1266
- */
1267
- interface PaginatorOptions {
1268
- path?: string;
1269
- query?: Record<string, string>;
1270
- fragment?: string;
1271
- }
1272
- /**
1273
- * Cursor paginator options.
1274
- */
1275
- interface CursorPaginatorOptions {
1276
- cursorName?: string;
1277
- parameters?: Record<string, string>;
1278
- }
1279
- /**
1280
- * Resource class type.
1281
- */
1282
- interface ResourceClass<T, R extends BaseResource<T>> {
1283
- new (resource: T): R;
1284
- }
1285
- /**
1286
- * Base resource interface.
1287
- */
1288
- interface BaseResource<T> {
1289
- toArray(): ResourceData;
1290
- toJSON(): ResourceData;
1291
- }
1292
- type InferResourceData<TResource extends BaseResource<unknown>> = ReturnType<TResource['toJSON']>;
1293
-
1294
- /**
1295
- * Abstract base class for API resources.
1296
- * Transforms model data into API response format.
1297
- */
1298
- declare abstract class Resource<T> {
1299
- /**
1300
- * The underlying resource.
1301
- */
1302
- protected resource: T;
1303
- /**
1304
- * Additional data to merge with the resource.
1305
- */
1306
- protected additionalData: ResourceData;
1307
- constructor(resource: T);
1308
- /**
1309
- * Transform the resource into an array/object.
1310
- * Must be implemented by subclasses.
1311
- */
1312
- abstract toArray(): ResourceData;
1313
- /**
1314
- * Transform the resource to JSON.
1315
- */
1316
- toJSON(): ResourceData;
1317
- /**
1318
- * Add additional data to the resource.
1319
- */
1320
- additional(data: ResourceData): this;
1321
- /**
1322
- * Conditionally include a value.
1323
- */
1324
- when<V>(condition: boolean, value: V | (() => V)): V | undefined;
1325
- /**
1326
- * Conditionally include a value with a default.
1327
- */
1328
- whenOr<V>(condition: boolean, value: V | (() => V), defaultValue: V): V;
1329
- /**
1330
- * Include a value only if a relation is loaded.
1331
- */
1332
- whenLoaded<V>(relation: string, value: V | (() => V), defaultValue?: V): V | undefined;
1333
- /**
1334
- * Include a value only if it's not null/undefined.
1335
- */
1336
- whenNotNull<V>(value: V | null | undefined): V | undefined;
1337
- /**
1338
- * Merge another resource's data.
1339
- */
1340
- merge(data: ResourceData): ResourceData;
1341
- /**
1342
- * Create a new resource instance.
1343
- */
1344
- static make<T, R extends Resource<T>>(this: new (resource: T) => R, resource: T): R;
1345
- /**
1346
- * Create a collection of resources.
1347
- */
1348
- static collection<T, R extends Resource<T>>(this: new (resource: T) => R, resources: T[]): ResourceData[];
1349
- }
1350
- /**
1351
- * Create a resource collection from a resource class.
1352
- */
1353
- declare function collect<T, R extends Resource<T>>(resources: T[], resourceClass: ResourceClass<T, R>): ResourceData[];
1354
- /**
1355
- * Simple resource wrapper for objects without transformation.
1356
- */
1357
- declare class JsonResource<T extends Record<string, unknown>> extends Resource<T> {
1358
- toArray(): ResourceData;
1359
- }
1360
-
1361
- interface PaginatedResultLike<T> {
1362
- data: T[];
1363
- meta: {
1364
- total: number;
1365
- perPage: number;
1366
- currentPage: number;
1367
- };
1368
- }
1369
- /**
1370
- * Paginator for offset-based pagination.
1371
- */
1372
- declare class Paginator<T> {
1373
- protected _items: T[];
1374
- protected _total: number;
1375
- protected _perPage: number;
1376
- protected _currentPage: number;
1377
- protected _options: PaginatorOptions;
1378
- constructor(items: T[], total: number, perPage: number, currentPage: number, options?: PaginatorOptions);
1379
- /**
1380
- * Get the paginated items.
1381
- */
1382
- items(): T[];
1383
- /**
1384
- * Get total number of items.
1385
- */
1386
- total(): number;
1387
- /**
1388
- * Get items per page.
1389
- */
1390
- perPage(): number;
1391
- /**
1392
- * Get current page number.
1393
- */
1394
- currentPage(): number;
1395
- /**
1396
- * Get last page number.
1397
- */
1398
- lastPage(): number;
1399
- /**
1400
- * Check if there are more pages.
1401
- */
1402
- hasMorePages(): boolean;
1403
- /**
1404
- * Check if on first page.
1405
- */
1406
- onFirstPage(): boolean;
1407
- /**
1408
- * Check if on last page.
1409
- */
1410
- onLastPage(): boolean;
1411
- /**
1412
- * Get the "from" index (1-based).
1413
- */
1414
- firstItem(): number | null;
1415
- /**
1416
- * Get the "to" index (1-based).
1417
- */
1418
- lastItem(): number | null;
1419
- /**
1420
- * Get the number of items on current page.
1421
- */
1422
- count(): number;
1423
- /**
1424
- * Check if the paginator is empty.
1425
- */
1426
- isEmpty(): boolean;
1427
- /**
1428
- * Check if the paginator is not empty.
1429
- */
1430
- isNotEmpty(): boolean;
1431
- /**
1432
- * Get pagination meta information.
1433
- */
1434
- meta(): PaginationMeta;
1435
- /**
1436
- * Build URL for a page.
1437
- */
1438
- protected url(page: number): string;
1439
- /**
1440
- * Get pagination links.
1441
- */
1442
- links(): PaginationLinks;
1443
- /**
1444
- * Set the base path for pagination links.
1445
- */
1446
- withPath(path: string): this;
1447
- /**
1448
- * Set query parameters for pagination links.
1449
- */
1450
- withQuery(query: Record<string, string>): this;
1451
- /**
1452
- * Set fragment for pagination links.
1453
- */
1454
- fragment(fragment: string): this;
1455
- /**
1456
- * Transform items to resources.
1457
- */
1458
- toResource<R extends Resource<T>>(resourceClass: ResourceClass<T, R>): PaginatedResponse<ResourceData>;
1459
- /**
1460
- * Transform to JSON.
1461
- */
1462
- toJSON(): PaginatedResponse<T>;
1463
- /**
1464
- * Map over items.
1465
- */
1466
- map<U>(callback: (item: T, index: number) => U): Paginator<U>;
1467
- /**
1468
- * Get items as array.
1469
- */
1470
- toArray(): T[];
1471
- /**
1472
- * Iterate over items.
1473
- */
1474
- [Symbol.iterator](): Iterator<T>;
1475
- /**
1476
- * Create paginator from array (slices the array).
1477
- */
1478
- static fromArray<T>(items: T[], page: number, perPage: number, options?: PaginatorOptions): Paginator<T>;
1479
- /**
1480
- * Create paginator from an ORM-style paginated result.
1481
- */
1482
- static fromPaginatedResult<T>(result: PaginatedResultLike<T>, options?: PaginatorOptions): Paginator<T>;
1483
- }
1484
- /**
1485
- * Create a paginator.
1486
- */
1487
- declare function paginate<T>(result: PaginatedResultLike<T>, options?: PaginatorOptions): Paginator<T>;
1488
- declare function paginate<T>(items: T[], total: number, perPage: number, currentPage: number, options?: PaginatorOptions): Paginator<T>;
1489
-
1490
- /**
1491
- * Collection of resources with additional metadata.
1492
- */
1493
- declare class ResourceCollection<T, R extends Resource<T>> {
1494
- protected resources: T[];
1495
- protected resourceClass: ResourceClass<T, R>;
1496
- protected additionalData: ResourceData;
1497
- protected wrapKey: string | null;
1498
- constructor(resources: T[], resourceClass: ResourceClass<T, R>);
1499
- /**
1500
- * Transform all resources to an array.
1501
- */
1502
- toArray(): ResourceData[];
1503
- /**
1504
- * Add additional data to the collection response.
1505
- */
1506
- additional(data: ResourceData): this;
1507
- /**
1508
- * Set the wrapper key for the collection.
1509
- */
1510
- wrap(key: string | null): this;
1511
- /**
1512
- * Disable wrapping.
1513
- */
1514
- withoutWrapping(): this;
1515
- /**
1516
- * Get the number of resources.
1517
- */
1518
- count(): number;
1519
- /**
1520
- * Check if collection is empty.
1521
- */
1522
- isEmpty(): boolean;
1523
- /**
1524
- * Check if collection is not empty.
1525
- */
1526
- isNotEmpty(): boolean;
1527
- /**
1528
- * Transform to JSON response.
1529
- */
1530
- toJSON(): ResourceData;
1531
- /**
1532
- * Map over the resources.
1533
- */
1534
- map<U>(callback: (resource: T, index: number) => U): U[];
1535
- /**
1536
- * Filter resources.
1537
- */
1538
- filter(callback: (resource: T, index: number) => boolean): ResourceCollection<T, R>;
1539
- /**
1540
- * Get the underlying resources.
1541
- */
1542
- all(): T[];
1543
- /**
1544
- * Create a resource collection.
1545
- */
1546
- static make<T, R extends Resource<T>>(resources: T[], resourceClass: ResourceClass<T, R>): ResourceCollection<T, R>;
1547
- }
1548
-
1549
- /**
1550
- * Cursor paginator for cursor-based pagination.
1551
- * Ideal for infinite scroll and real-time data.
1552
- */
1553
- declare class CursorPaginator<T> {
1554
- protected _items: T[];
1555
- protected _perPage: number;
1556
- protected _currentCursor: string | null;
1557
- protected _nextCursor: string | null;
1558
- protected _prevCursor: string | null;
1559
- protected _hasMore: boolean;
1560
- protected _options: CursorPaginatorOptions;
1561
- constructor(items: T[], perPage: number, hasMore: boolean, options?: CursorPaginatorOptions & {
1562
- currentCursor?: string | null;
1563
- nextCursor?: string | null;
1564
- prevCursor?: string | null;
1565
- });
1566
- /**
1567
- * Get the paginated items.
1568
- */
1569
- items(): T[];
1570
- /**
1571
- * Get items per page.
1572
- */
1573
- perPage(): number;
1574
- /**
1575
- * Get the current cursor.
1576
- */
1577
- currentCursor(): string | null;
1578
- /**
1579
- * Get the next cursor.
1580
- */
1581
- nextCursor(): string | null;
1582
- /**
1583
- * Get the previous cursor.
1584
- */
1585
- prevCursor(): string | null;
1586
- /**
1587
- * Check if there are more items.
1588
- */
1589
- hasMorePages(): boolean;
1590
- /**
1591
- * Check if there are previous items.
1592
- */
1593
- hasPreviousPages(): boolean;
1594
- /**
1595
- * Get the number of items.
1596
- */
1597
- count(): number;
1598
- /**
1599
- * Check if empty.
1600
- */
1601
- isEmpty(): boolean;
1602
- /**
1603
- * Check if not empty.
1604
- */
1605
- isNotEmpty(): boolean;
1606
- /**
1607
- * Get cursor pagination meta.
1608
- */
1609
- meta(): CursorPaginationMeta;
1610
- /**
1611
- * Transform items to resources.
1612
- */
1613
- toResource<R extends Resource<T>>(resourceClass: ResourceClass<T, R>): CursorPaginatedResponse<ResourceData>;
1614
- /**
1615
- * Transform to JSON.
1616
- */
1617
- toJSON(): CursorPaginatedResponse<T>;
1618
- /**
1619
- * Map over items.
1620
- */
1621
- map<U>(callback: (item: T, index: number) => U): CursorPaginator<U>;
1622
- /**
1623
- * Get items as array.
1624
- */
1625
- toArray(): T[];
1626
- /**
1627
- * Iterate over items.
1628
- */
1629
- [Symbol.iterator](): Iterator<T>;
1630
- /**
1631
- * Create cursor paginator from array with ID-based cursor.
1632
- */
1633
- static fromArray<T extends {
1634
- id: string | number;
1635
- }>(items: T[], cursor: string | null, perPage: number, options?: CursorPaginatorOptions): CursorPaginator<T>;
1636
- }
1637
- /**
1638
- * Encode a cursor value.
1639
- */
1640
- declare function encodeCursor(value: string | number | Date): string;
1641
- /**
1642
- * Decode a cursor value.
1643
- */
1644
- declare function decodeCursor(cursor: string): string;
1645
- /**
1646
- * Create a cursor paginator.
1647
- */
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>;
1714
-
1715
- /**
1716
- * Parse a command signature into argument and option definitions.
1717
- *
1718
- * Signature format:
1719
- * - `command:name` - Command name
1720
- * - `{argument}` - Required argument
1721
- * - `{argument?}` - Optional argument
1722
- * - `{argument=default}` - Argument with default
1723
- * - `{argument*}` - Array argument (must be last)
1724
- * - `{--option}` - Boolean option (flag)
1725
- * - `{--option=}` - Option that requires a value
1726
- * - `{--option=default}` - Option with default value
1727
- * - `{-o|--option}` - Option with shortcut
1728
- * - `{--option=*}` - Array option
1729
- * - `{argument : Description}` - Argument with a description
1730
- * - `{--option= : Description}` - Option with a description
1731
- *
1732
- * A description is separated from the token by a colon with whitespace on at
1733
- * least one side, so it may contain spaces and colons freely. Requiring that
1734
- * whitespace keeps colons inside default values (`{--url=https://example.com}`)
1735
- * out of descriptions.
1736
- *
1737
- * A colon with no whitespace at all (`{argument:Description}`) is accepted for
1738
- * a single-word description, but only on a token carrying no other marker:
1739
- * `{argument?}`, `{argument*}` and `{--option=default}` must use the spaced
1740
- * form, since their markers are stripped before that fallback runs.
1741
- *
1742
- * @example
1743
- * ```typescript
1744
- * parseSignature('users:create {name} {--admin} {--role=user}')
1745
- * // => {
1746
- * // name: 'users:create',
1747
- * // arguments: [{ name: 'name', required: true, array: false }],
1748
- * // options: [
1749
- * // { name: 'admin', requiresValue: false },
1750
- * // { name: 'role', requiresValue: true, defaultValue: 'user' }
1751
- * // ]
1752
- * // }
1753
- *
1754
- * parseSignature('users:create {name : The full name} {--admin : Grant admin rights}')
1755
- * // => arguments[0].description === 'The full name'
1756
- * // options[0].description === 'Grant admin rights'
1757
- * ```
1758
- */
1759
- declare function parseSignature(signature: string): ParsedSignature;
1760
- /**
1761
- * Console input handler.
1762
- *
1763
- * @example
1764
- * ```typescript
1765
- * const input = new Input('users:create {name} {--admin}', ['John', '--admin'])
1766
- * input.argument('name') // => 'John'
1767
- * input.option('admin') // => true
1768
- * ```
1769
- */
1770
- declare class Input implements InputInterface {
1771
- /**
1772
- * Parsed signature.
1773
- */
1774
- protected parsed: ParsedSignature;
1775
- /**
1776
- * Parsed argument values.
1777
- */
1778
- protected argumentValues: Record<string, string | string[]>;
1779
- /**
1780
- * Parsed option values.
1781
- */
1782
- protected optionValues: Record<string, string | boolean | string[]>;
1783
- constructor(signature: string, argv?: string[]);
1784
- /**
1785
- * Parse command line arguments.
1786
- */
1787
- protected parseArgv(argv: string[]): void;
1788
- /**
1789
- * Parse a long option.
1790
- */
1791
- protected parseLongOption(option: string, argv: string[], index: number): void;
1792
- /**
1793
- * Parse a short option.
1794
- */
1795
- protected parseShortOption(option: string, argv: string[], index: number): void;
1796
- /**
1797
- * Map positional arguments to definitions.
1798
- */
1799
- protected mapArguments(args: string[]): void;
1800
- /**
1801
- * Find an option definition by name.
1802
- */
1803
- protected findOption(name: string): OptionDefinition | undefined;
1804
- /**
1805
- * Find an option definition by shortcut.
1806
- */
1807
- protected findOptionByShortcut(shortcut: string): OptionDefinition | undefined;
1808
- /**
1809
- * Check if an option requires a value.
1810
- */
1811
- protected optionRequiresValue(name: string): boolean;
1812
- /**
1813
- * Get an argument value.
1814
- */
1815
- argument<T = string>(name: string): T;
1816
- /**
1817
- * Get all argument values.
1818
- */
1819
- arguments(): Record<string, string | string[]>;
1820
- /**
1821
- * Get an option value.
1822
- */
1823
- option<T = string | boolean>(name: string): T | undefined;
1824
- /**
1825
- * Get all option values.
1826
- */
1827
- options(): Record<string, string | boolean | string[]>;
1828
- /**
1829
- * Check if an option was provided.
1830
- */
1831
- hasOption(name: string): boolean;
1832
- /**
1833
- * Get the parsed signature.
1834
- */
1835
- getSignature(): ParsedSignature;
1836
- /**
1837
- * Get the command name.
1838
- */
1839
- getCommandName(): string;
1840
- }
1841
-
1842
- /**
1843
- * Base command class for console commands.
1844
- *
1845
- * @example
1846
- * ```typescript
1847
- * export class CreateUserCommand extends Command {
1848
- * static signature = 'users:create {email} {--admin} {--role=user}'
1849
- * static description = 'Create a new user'
1850
- *
1851
- * async handle(): Promise<void> {
1852
- * const email = this.argument('email')
1853
- * const isAdmin = this.hasOption('admin')
1854
- * const role = this.option('role', 'user')
1855
- *
1856
- * const password = await this.secret('Enter password:')
1857
- * const confirm = await this.confirm(`Create user ${email}?`)
1858
- *
1859
- * if (!confirm) {
1860
- * this.warn('Cancelled')
1861
- * return
1862
- * }
1863
- *
1864
- * this.info(`Creating user: ${email}`)
1865
- * this.success('User created!')
1866
- * }
1867
- * }
1868
- * ```
1869
- */
1870
- declare abstract class Command implements CommandInstance {
1871
- /**
1872
- * The command signature.
1873
- * Format: 'command:name {arg} {--option}'
1874
- * Tokens may carry a description: 'command:name {arg : What it is}'
1875
- * See `parseSignature` for the full grammar.
1876
- */
1877
- static signature: string;
1878
- /**
1879
- * The command description.
1880
- */
1881
- static description: string;
1882
- /**
1883
- * The command input.
1884
- */
1885
- protected input: Input;
1886
- /**
1887
- * The command output.
1888
- */
1889
- protected output: OutputInterface;
1890
- /**
1891
- * The service container.
1892
- */
1893
- protected container?: Container;
1894
- constructor(container?: Container);
1895
- /**
1896
- * Set the input for this command.
1897
- */
1898
- setInput(argv: string[]): void;
1899
- /**
1900
- * Set the output for this command.
1901
- */
1902
- setOutput(output: OutputInterface): void;
1903
- /**
1904
- * Execute the command.
1905
- */
1906
- run(): Promise<number>;
1907
- /**
1908
- * Handle the command.
1909
- * Must be implemented by subclasses.
1910
- */
1911
- abstract handle(): Promise<number | void>;
1912
- /**
1913
- * Get an argument value.
1914
- */
1915
- argument<T = string>(name: string): T;
1916
- /**
1917
- * Get all arguments.
1918
- */
1919
- arguments(): Record<string, string | string[]>;
1920
- /**
1921
- * Get an option value with optional default.
1922
- */
1923
- option<T = string>(name: string, defaultValue?: T): T;
1924
- /**
1925
- * Get all options.
1926
- */
1927
- options(): Record<string, string | boolean | string[]>;
1928
- /**
1929
- * Check if an option was provided.
1930
- */
1931
- hasOption(name: string): boolean;
1932
- /**
1933
- * Output an info message.
1934
- */
1935
- info(message: string): void;
1936
- /**
1937
- * Output an error message.
1938
- */
1939
- error(message: string): void;
1940
- /**
1941
- * Output a warning message.
1942
- */
1943
- warn(message: string): void;
1944
- /**
1945
- * Output a success message.
1946
- */
1947
- success(message: string): void;
1948
- /**
1949
- * Output a plain line.
1950
- */
1951
- line(message: string): void;
1952
- /**
1953
- * Output new lines.
1954
- */
1955
- newLine(count?: number): void;
1956
- /**
1957
- * Output a table.
1958
- */
1959
- table(headers: string[], rows: string[][]): void;
1960
- /**
1961
- * Ask a question and get user input.
1962
- */
1963
- ask(question: string, defaultValue?: string): Promise<string>;
1964
- /**
1965
- * Ask for confirmation.
1966
- */
1967
- confirm(question: string, defaultValue?: boolean): Promise<boolean>;
1968
- /**
1969
- * Present choices to the user.
1970
- */
1971
- choice<T extends string>(question: string, choices: T[], defaultValue?: T): Promise<T>;
1972
- /**
1973
- * Ask for secret input (password).
1974
- */
1975
- secret(question: string): Promise<string>;
1976
- /**
1977
- * Create a readline interface.
1978
- */
1979
- protected createReadline(): readline.Interface;
1980
- /**
1981
- * Process items with progress output.
1982
- */
1983
- withProgress<T>(items: T[], callback: (item: T, index: number) => Promise<void>): Promise<void>;
1984
- /**
1985
- * Kernel reference for calling other commands.
1986
- */
1987
- protected kernel?: {
1988
- handle(argv: string[]): Promise<number>;
1989
- };
1990
- /**
1991
- * Set the kernel reference.
1992
- */
1993
- setKernel(kernel: {
1994
- handle(argv: string[]): Promise<number>;
1995
- }): void;
1996
- /**
1997
- * Call another command.
1998
- */
1999
- call(command: string, args?: string[]): Promise<number>;
2000
- /**
2001
- * Resolve a service from the container.
2002
- */
2003
- protected resolve<T>(key: string): T;
2004
- /**
2005
- * Get the command signature.
2006
- */
2007
- getSignature(): string;
2008
- /**
2009
- * Get the command description.
2010
- */
2011
- getDescription(): string;
2012
- /**
2013
- * Get the command name.
2014
- */
2015
- getName(): string;
2016
- }
2017
-
2018
- /**
2019
- * ANSI color codes.
2020
- */
2021
- declare const COLORS: {
2022
- readonly reset: "\u001B[0m";
2023
- readonly bold: "\u001B[1m";
2024
- readonly dim: "\u001B[2m";
2025
- readonly black: "\u001B[30m";
2026
- readonly red: "\u001B[31m";
2027
- readonly green: "\u001B[32m";
2028
- readonly yellow: "\u001B[33m";
2029
- readonly blue: "\u001B[34m";
2030
- readonly magenta: "\u001B[35m";
2031
- readonly cyan: "\u001B[36m";
2032
- readonly white: "\u001B[37m";
2033
- readonly bgRed: "\u001B[41m";
2034
- readonly bgGreen: "\u001B[42m";
2035
- readonly bgYellow: "\u001B[43m";
2036
- readonly bgBlue: "\u001B[44m";
2037
- readonly bgMagenta: "\u001B[45m";
2038
- readonly bgCyan: "\u001B[46m";
2039
- readonly bgWhite: "\u001B[47m";
2040
- };
2041
- /**
2042
- * Console output handler.
2043
- *
2044
- * @example
2045
- * ```typescript
2046
- * const output = new Output()
2047
- * output.info('Processing...')
2048
- * output.success('Done!')
2049
- * output.table(['Name', 'Age'], [['John', '30'], ['Jane', '25']])
2050
- * ```
2051
- */
2052
- declare class Output implements OutputInterface {
2053
- /**
2054
- * Whether to use colors.
2055
- */
2056
- protected useColors: boolean;
2057
- /**
2058
- * Output stream.
2059
- */
2060
- protected stdout: NodeJS.WriteStream;
2061
- /**
2062
- * Error stream.
2063
- */
2064
- protected stderr: NodeJS.WriteStream;
2065
- constructor(options?: {
2066
- colors?: boolean;
2067
- stdout?: NodeJS.WriteStream;
2068
- stderr?: NodeJS.WriteStream;
2069
- });
2070
- /**
2071
- * Apply color to text.
2072
- */
2073
- protected color(text: string, ...codes: string[]): string;
2074
- /**
2075
- * Output an info message.
2076
- */
2077
- info(message: string): void;
2078
- /**
2079
- * Output an error message.
2080
- */
2081
- error(message: string): void;
2082
- /**
2083
- * Output a warning message.
2084
- */
2085
- warn(message: string): void;
2086
- /**
2087
- * Output a success message.
2088
- */
2089
- success(message: string): void;
2090
- /**
2091
- * Output a plain line.
2092
- */
2093
- line(message: string): void;
2094
- /**
2095
- * Output new lines.
2096
- */
2097
- newLine(count?: number): void;
2098
- /**
2099
- * Output a table.
2100
- */
2101
- table(headers: string[], rows: string[][]): void;
2102
- /**
2103
- * Write raw text without newline.
2104
- */
2105
- write(message: string): void;
2106
- /**
2107
- * Write a line to stdout.
2108
- */
2109
- protected writeLine(message: string): void;
2110
- /**
2111
- * Write a line to stderr.
2112
- */
2113
- protected writeErrorLine(message: string): void;
2114
- /**
2115
- * Output a comment.
2116
- */
2117
- comment(message: string): void;
2118
- /**
2119
- * Output a question.
2120
- */
2121
- question(message: string): void;
2122
- /**
2123
- * Output a bulleted list.
2124
- */
2125
- listing(items: string[]): void;
2126
- /**
2127
- * Output text with specific color.
2128
- */
2129
- colored(message: string, color: keyof typeof COLORS): void;
2130
- /**
2131
- * Create a progress bar string.
2132
- */
2133
- progressBar(current: number, total: number, width?: number): string;
2134
- /**
2135
- * Clear the current line.
2136
- */
2137
- clearLine(): void;
2138
- /**
2139
- * Check if colors are enabled.
2140
- */
2141
- isColored(): boolean;
2142
- /**
2143
- * Enable or disable colors.
2144
- */
2145
- setColors(enabled: boolean): void;
2146
- }
2147
- /**
2148
- * Output that collects messages instead of printing.
2149
- * Useful for testing.
2150
- */
2151
- declare class BufferedOutput extends Output {
2152
- /**
2153
- * Collected messages.
2154
- */
2155
- protected buffer: string[];
2156
- constructor();
2157
- protected writeLine(message: string): void;
2158
- protected writeErrorLine(message: string): void;
2159
- write(message: string): void;
2160
- /**
2161
- * Get all output as array.
2162
- */
2163
- getLines(): string[];
2164
- /**
2165
- * Get all output as string.
2166
- */
2167
- getOutput(): string;
2168
- /**
2169
- * Clear the buffer.
2170
- */
2171
- clear(): void;
2172
- /**
2173
- * Check if buffer contains a string.
2174
- */
2175
- contains(text: string): boolean;
2176
- }
2177
-
2178
- /**
2179
- * Create a proxy-based facade that lazily resolves a service from an application container.
2180
- *
2181
- * The returned proxy intercepts all property access and method calls,
2182
- * resolving the underlying service from the container on each access.
2183
- * This ensures that container fakes and flushes are respected.
2184
- *
2185
- * @example
2186
- * ```typescript
2187
- * import { createFacades } from '@guren/server/facades'
2188
- *
2189
- * const { Cache, Events } = createFacades(container)
2190
- * await Cache.get('key')
2191
- * Events.emit('user.created', payload)
2192
- * ```
2193
- */
2194
- declare function createFacade<K extends keyof ServiceBindings>(container: Pick<Container, 'make'>, key: K): ServiceBindings[K];
2195
- declare function createFacades(container: Pick<Container, 'make'>): {
2196
- readonly Cache: CacheManager;
2197
- readonly Events: EventManager;
2198
- readonly Queue: QueueManager;
2199
- readonly Mail: MailManager;
2200
- readonly Log: LogManager;
2201
- readonly I18n: I18nManager;
2202
- readonly Notifications: NotificationManager;
2203
- readonly Broadcast: BroadcastManager;
2204
- readonly Storage: StorageManager;
2205
- readonly Scheduler: Scheduler;
2206
- };
2207
-
2208
- /**
2209
- * Options for configuring the auto-discovery engine.
2210
- */
2211
- interface DiscoveryOptions {
2212
- /** Base path for scanning. Defaults to `process.cwd()`. */
2213
- basePath?: string;
2214
- /** Whether to discover service providers in `app/Providers/`. Defaults to `true`. */
2215
- providers?: boolean;
2216
- /** Whether to discover event listeners in `app/Listeners/`. Defaults to `true`. */
2217
- listeners?: boolean;
2218
- /** Whether to discover jobs in `app/Jobs/`. Defaults to `true`. */
2219
- jobs?: boolean;
2220
- /** Whether to discover events in `app/Events/`. Defaults to `true`. */
2221
- events?: boolean;
2222
- }
2223
- /**
2224
- * Result of the auto-discovery scan.
2225
- */
2226
- interface DiscoveryResult {
2227
- /** Discovered service provider classes. */
2228
- providers: Array<new (...args: unknown[]) => unknown>;
2229
- /** Discovered event listeners with their associated event name. */
2230
- listeners: Array<{
2231
- event: string;
2232
- listener: new () => unknown;
2233
- }>;
2234
- /** Discovered job classes. */
2235
- jobs: Array<new () => unknown>;
2236
- /** Discovered event classes. */
2237
- events: Array<new () => unknown>;
2238
- }
2239
- /**
2240
- * Auto-discovery engine that scans application directories and discovers
2241
- * framework components (providers, listeners, jobs, events).
2242
- *
2243
- * Uses `Bun.Glob` to scan directories and dynamic `import()` to load modules.
2244
- *
2245
- * @example
2246
- * ```typescript
2247
- * const discovery = new AutoDiscovery({ basePath: '/app' })
2248
- * const result = await discovery.discover()
2249
- *
2250
- * // Register discovered providers
2251
- * for (const ProviderClass of result.providers) {
2252
- * providerManager.register(ProviderClass)
2253
- * }
2254
- *
2255
- * // Register discovered listeners
2256
- * for (const { event, listener } of result.listeners) {
2257
- * eventManager.listen(event, listener)
2258
- * }
2259
- * ```
2260
- */
2261
- declare class AutoDiscovery {
2262
- private basePath;
2263
- private options;
2264
- constructor(options?: DiscoveryOptions);
2265
- /**
2266
- * Run the discovery scan across all enabled directories.
2267
- */
2268
- discover(): Promise<DiscoveryResult>;
2269
- /**
2270
- * Discover service providers in `app/Providers/`.
2271
- *
2272
- * A module is considered a provider if it exports a class (default or named)
2273
- * that has a `register` method (i.e., implements the Provider interface).
2274
- */
2275
- private discoverProviders;
2276
- /**
2277
- * Discover event listeners in `app/Listeners/`.
2278
- *
2279
- * A listener class must have a `static event` property (string) that indicates
2280
- * which event it handles, and a `handle` method.
2281
- */
2282
- private discoverListeners;
2283
- /**
2284
- * Discover jobs in `app/Jobs/`.
2285
- *
2286
- * A job class must have a `handle` method.
2287
- */
2288
- private discoverJobs;
2289
- /**
2290
- * Discover events in `app/Events/`.
2291
- *
2292
- * Any exported class from the Events directory is considered an event class.
2293
- */
2294
- private discoverEvents;
2295
- /**
2296
- * Scan a directory for TypeScript files using Bun.Glob.
2297
- * Returns an array of imported modules. Skips `index.ts` barrel files.
2298
- */
2299
- private scanDirectory;
2300
- /**
2301
- * Extract all class constructors (functions) from a module's exports.
2302
- */
2303
- private extractClasses;
2304
- /**
2305
- * Check if a value is a constructor function (class).
2306
- */
2307
- private isConstructor;
2308
- /**
2309
- * Check if a class looks like a service provider (has a `register` method).
2310
- */
2311
- private isProvider;
2312
- /**
2313
- * Get the `static event` property from a class, if it exists and is a string.
2314
- */
2315
- private getStaticEvent;
2316
- /**
2317
- * Check if a class has a `handle` method on its prototype.
2318
- */
2319
- private hasHandleMethod;
2320
- }
2321
-
2322
- /**
2323
- * Render a rich HTML debug error page for development mode.
2324
- *
2325
- * When an error occurs and NODE_ENV is not 'production', this function
2326
- * generates a helpful page displaying the error class, message, stack trace
2327
- * with source context, and request details.
2328
- */
2329
- declare function renderDebugPage(error: Error, request?: Request): string;
2330
- /**
2331
- * Middleware that catches errors and renders a debug page in development.
2332
- * In production (NODE_ENV === 'production'), errors are re-thrown so
2333
- * downstream handlers or the ExceptionHandler can process them normally.
2334
- *
2335
- * @example
2336
- * ```typescript
2337
- * import { debugErrorMiddleware } from '@guren/server/errors/debug-page'
2338
- *
2339
- * app.use('*', debugErrorMiddleware())
2340
- * ```
2341
- */
2342
- declare function debugErrorMiddleware(): MiddlewareHandler;
2343
-
2344
- /**
2345
- * Runtime-detecting password hasher: uses Bun's native scrypt implementation
2346
- * when running on Bun, and the Node.js crypto implementation otherwise
2347
- * (e.g. AWS Lambda on the Node runtime). This is the hasher behind the
2348
- * `Hash` export, so code written against `Hash` runs on both runtimes.
2349
- */
2350
- declare class DefaultHasher implements PasswordHasher {
2351
- private readonly delegate;
2352
- constructor();
2353
- hash(plain: string): Promise<string>;
2354
- verify(hashed: string, plain: string): Promise<boolean>;
2355
- }
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
- 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 };
1
+ export { Application, createApp } from './http/Application.js';
2
+ export type { Context, ApplicationListenOptions, ServiceProviderConstructor } from './http/Application.js';
3
+ export { parseRequestPayload, formatValidationErrors } from './http/request.js';
4
+ export { Controller } from './mvc/Controller.js';
5
+ export type { InertiaResponse, InferInertiaProps, ControllerInertiaProps, AuthPayload } from './mvc/Controller.js';
6
+ export { Router } from './mvc/Router.js';
7
+ export type { RouteBuilder, RouteContractOptions, RouteDefinition, RouteMiddlewareInput, RouteOpenApiMetadata, ResourceAction as RouteResourceAction, ResourceRouteOptions, } from './mvc/Router.js';
8
+ export { ViewEngine } from './mvc/ViewEngine.js';
9
+ export { inertia, setInertiaSsrRenderer, setInertiaDocument } from './mvc/inertia/InertiaEngine.js';
10
+ export { setInertiaSharedProps, getInertiaSharedPropsResolver, shareInertiaProps } from './mvc/inertia/shared.js';
11
+ export type { InertiaDocumentContext, InertiaDocumentOptions, InertiaOptions, InertiaPagePayload, InertiaSsrContext, InertiaSsrOptions, InertiaSsrRenderer, InertiaSsrResult, } from './mvc/inertia/InertiaEngine.js';
12
+ export type { SharedInertiaPropsResolver, InertiaSharedProps, ResolvedSharedInertiaProps, SharedPropsContainer, } from './mvc/inertia/shared.js';
13
+ export { InertiaServiceProvider, AuthServiceProvider, OAuthServiceProvider, EventServiceProvider, CacheServiceProvider, QueueServiceProvider, MailServiceProvider, LogServiceProvider, I18nServiceProvider, NotificationServiceProvider, BroadcastServiceProvider, EncryptionServiceProvider, StorageServiceProvider, HealthServiceProvider, SchedulingServiceProvider, AuthorizationServiceProvider, ErrorServiceProvider, } from './providers/index.js';
14
+ export { FormRequest } from './http/FormRequest.js';
15
+ export { AuthManager, SessionGuard, ModelUserProvider, BaseUserProvider, AuthenticatableModel, ScryptHasher, createPasswordResetToken, verifyPasswordResetToken, completePasswordReset, buildPasswordResetUrl, parsePasswordResetUrl, MemoryPasswordResetStore, createEmailVerificationToken, verifyEmailToken, completeEmailVerification, buildVerificationUrl, parseVerificationUrl, isEmailVerified, requireVerifiedEmail, MemoryEmailVerificationStore, createApiToken, parseApiToken, verifyApiToken, tokenCan, tokenCanAll, tokenCanAny, revokeApiToken, revokeAllApiTokens, getUserApiTokens, createBearerTokenMiddleware, getApiToken, getApiTokenOrFail, MemoryApiTokenStore, API_TOKEN_KEY, OAuthManager, MemoryOAuthStateStore, createOAuthManager, createOAuthState, verifyOAuthState, sanitizeOAuthRedirect, OAUTH_SESSION_BINDING_KEY, buildOAuthAuthorizeUrl, exchangeOAuthCode, fetchOAuthUserProfile, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createDiscordOAuthProviderConfig, buildOAuthRedirectUrl, parseOAuthRedirectUrl, } from './auth/index.js';
16
+ export type { AuthContext as AuthRuntimeContext, AuthCredentials, AuthManagerOptions, Authenticatable, Guard, GuardContext, GuardFactory, UserProvider, ProviderFactory, DefaultSanitizedKeys, Sanitized, PasswordResetConfig, PasswordResetTokenStore, PasswordResetTokenResult, EmailVerificationConfig, EmailVerificationTokenStore, EmailVerificationToken, EmailVerificationTokenResult, ApiToken, ApiTokenStore, CreateApiTokenOptions, CreateApiTokenResult, BearerTokenMiddlewareOptions, OAuthProviderConfig, OAuthTokenResult, OAuthUserProfile, OAuthFallbackEmail, OAuthStatePayload, OAuthStateStore, OAuthStateConfig, OAuthAuthorizeOptions, OAuthCallbackPayload, OAuthManagerOptions, OAuthProviderFactoryInput, OAuthBindingSession, } from './auth/index.js';
17
+ export { defineMiddleware, jsonResponse, createSessionMiddleware, MemorySessionStore, getSessionFromContext, requireAuthenticated, requireGuest, attachAuthContext, createCsrfMiddleware, getCsrfToken, csrfField, verifyCsrfToken, CSRF_TOKEN_KEY, CSRF_HEADER_NAME, CSRF_FORM_FIELD, validateRequest, validateRequestWith, getValidatedData, validate, validateSafe, VALIDATED_DATA_KEY, createRateLimitMiddleware, getRateLimitInfo, resetRateLimit, MemoryRateLimitStore, SlidingWindowRateLimitStore, createSecurityHeaders, createCspMiddleware, getCspNonce, CSP_NONCE_KEY, createHostAuthorizationMiddleware, createCorsMiddleware, createRedirectSafetyMiddleware, isSafeRedirectUrl, createForceHttpsMiddleware, requestIdMiddleware, requestLoggingMiddleware, detectLocaleMiddleware, LOCALE_CONTEXT_KEY, getRequestLocale, getRequestTranslator, } from './http/middleware/index.js';
18
+ export { AUTH_CONTEXT_KEY } from './http/middleware/auth.js';
19
+ export type { Middleware, Session, SessionData, SessionStore, AuthContext, RequireAuthOptions, CsrfOptions, ValidationSchema, ValidateRequestOptions, RateLimitOptions, RateLimitStore, RateLimitEntry, RateLimitInfo, SecurityHeadersOptions, HstsOptions, CspOptions, CspDirectives, HostAuthorizationOptions, CorsOptions, RedirectSafetyOptions, ForceHttpsOptions, DetectLocaleOptions, DetectLocaleVariables, TranslatorBinding, LocaleSource, } from './http/middleware/index.js';
20
+ export { Validator, FieldValidator, createValidator, quickValidate, quickValidateOrThrow, required, nullable, requiredIf, requiredUnless, requiredWith, requiredWithout, string as stringRule, numeric, integer, boolean as booleanRule, array as arrayRule, object as objectRule, email as emailRule, url as urlRule, uuid as uuidRule, ip, ipv4, ipv6, json as jsonRule, alpha, alphaNum, alphaDash, regex, min, max, between, size, inValues, notIn, confirmed, same, different, date as dateRule, dateFormat, after, afterOrEqual, before, beforeOrEqual, startsWith, endsWith, file as fileRule, image as imageRule, mimes, maxFileSize, minFileSize, custom, unique, exists, } from './http/validation/index.js';
21
+ export type { ValidationRule, RuleDefinition, ValidationResult, FileValidationOptions, ImageValidationOptions, ValidatorOptions, FileLike, } from './http/validation/index.js';
22
+ export { Event, EventManager, createEventManager, Listener, RequestReceived, RequestFinished, UserAuthenticated, UserLoggedOut, JobProcessed, JobFailed, ApplicationStarted, ApplicationShutdown, } from './events/index.js';
23
+ export type { EventClass, EventListener, ListenerOptions, RegisteredListener, EventSubscription, ListenerClass, } from './events/index.js';
24
+ export { Job, Worker, QueueManager, MemoryDriver, SyncDriver, RedisDriver, MemoryDriver as MemoryQueueDriver, SyncDriver as SyncQueueDriver, RedisDriver as RedisQueueDriver, setQueueDriver, getQueueDriver, registerJob, getJob, getRegisteredJobs, clearJobRegistry, resolveJobName, createQueueManager, processJob, FailedJobReporter, } from './queue/index.js';
25
+ export type { QueuedJob, FailedJob, QueueDriver, JobOptions, WorkerOptions, JobHandler, JobFailureHandler, JobClass, WorkerEvents, QueueConfig, QueueDriverFactory, RedisDriverOptions, FailedJobInfo, FailedJobHandler, } from './queue/index.js';
26
+ export { Mail, mail, MailManager, createMailManager, setMailManager, getMailManager, SmtpTransport, ResendTransport, MemoryTransport, LogTransport, } from './mail/index.js';
27
+ export type { MailAddress, MailAttachment, MailMessage, SendResult, MailTransport, MailTransportFactory, MailTransportConfig, MailConfig, SmtpTransportOptions, ResendTransportOptions, MemoryTransportOptions, } from './mail/index.js';
28
+ export { CacheManager, MemoryStore as MemoryCacheStore, RedisStore as RedisCacheStore, FileStore as FileCacheStore, TaggedCache, createCacheManager, } from './cache/index.js';
29
+ export type { CacheStore, CacheConfig, CacheStoreFactory, } from './cache/index.js';
30
+ export { StorageManager, LocalDriver as LocalStorageDriver, MemoryDriver as MemoryStorageDriver, S3Driver, createStorageManager, } from './storage/index.js';
31
+ export type { StorageDriver, StorageConfig, DiskConfig, StorageDriverFactory, PutOptions, FileMetadata, } from './storage/index.js';
32
+ export { Scheduler, Schedule, PendingSchedule, ScheduledTask, parseCron, matchesCron, getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, toTimezone, createScheduler, } from './scheduling/index.js';
33
+ export type { TaskCallback, TaskDefinition, SchedulerOptions, ParsedCron, JobClass as ScheduledJobClass, } from './scheduling/index.js';
34
+ export { Logger, filterSensitiveData, LogManager, ConsoleChannel, FileChannel, DailyFileChannel, LOG_LEVEL_PRIORITY, createLogManager, setLogManager, getLogManager, } from './logging/index.js';
35
+ export type { LogLevel, LogContext, LogEntry, LogChannel, LogChannelFactory, LogChannelConfig, ConsoleChannelConfig, FileChannelConfig, DailyFileChannelConfig, StackChannelConfig, LogConfig, LogFormatter, LoggerOptions, } from './logging/index.js';
36
+ export { Translator, I18nManager, JsonLoader, MemoryLoader, pluralizationRules, getPluralizationRule, selectPluralForm, createI18n, setI18n, getI18n, tryGetI18n, t, tc, } from './i18n/index.js';
37
+ export type { TranslationMessages, ReplacementValues, PluralizationRule, TranslationLoader, TranslatorOptions, I18nConfig, TranslationLoaderFactory, GurenTranslationKeys, RegisteredTranslationKey, } from './i18n/index.js';
38
+ export { BaseSeeder, Seeder, resetCalledSeeders, BaseFactory, Factory, defineFactory, SeederRunner, createSeederRunner, } from './database/index.js';
39
+ export type { SeederClass, SeederInterface, FactoryClass, FactoryInterface, SeederRunnerOptions, } from './database/index.js';
40
+ export { Resource, JsonResource, collect, ResourceCollection, Paginator, paginate, CursorPaginator, cursorPaginate, encodeCursor, decodeCursor, } from './http/resources/index.js';
41
+ export type { ResourceData, ValidationErrors, PaginationMeta, PaginationLinks, PaginationPageLink, PaginatedResponse, PaginatedPageProps, PaginatedResultLike, CursorPaginationMeta, CursorPaginatedResponse, PaginatorOptions, CursorPaginatorOptions, ResourceClass, BaseResource, InferResourceData, } from './http/resources/index.js';
42
+ export { HealthCheck, HealthManager, createHealthManager, DatabaseCheck, RedisCheck, CacheCheck, StorageCheck, MemoryCheck, CustomCheck, customCheck, } from './health/index.js';
43
+ export type { HealthStatus, CheckResult, HealthReport, HealthCheckOptions, HealthMiddlewareOptions, DatabaseConnection, DatabaseCheckOptions, RedisClient, RedisCheckOptions, CacheStoreInterface, CacheCheckOptions, StorageDriverInterface, StorageCheckOptions, MemoryCheckOptions, CustomCheckCallback, } from './health/index.js';
44
+ export { Notification, NotificationManager, createNotificationManager, setNotificationManager, getNotificationManager, MailChannel, DatabaseChannel, SlackChannel, MemoryChannel, registerNotification, getNotification, clearNotificationRegistry, resolveNotifiableType, } from './notifications/index.js';
45
+ export type { NotificationConstructor, NotificationChannel, Notifiable, DatabaseNotification, NotificationMailMessage, NotificationAttachment, SlackMessage, SlackBlock, SlackAttachment, NotificationChannelFactory, NotificationManagerOptions, DatabaseChannelOptions, SentNotification, NotificationClass, MailChannelOptions, SlackChannelOptions, } from './notifications/index.js';
46
+ export { BroadcastManager, createBroadcastManager, setBroadcastManager, getBroadcastManager, Channel, PrivateChannel, PresenceChannel, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, } from './broadcasting/index.js';
47
+ export type { BroadcastEvent, BroadcastDriver, PresenceBroadcastDriver, ChannelAuthorizer, PresenceChannelAuthorizer, PresenceMember, SSEClient, WebSocketClient, BroadcastManagerOptions, BroadcastDriverFactory, ChannelRegistration, SSEMiddlewareOptions, AuthMiddlewareOptions, BroadcastableEvent, RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, } from './broadcasting/index.js';
48
+ export { Container, createContainer, setContainer, getContainer, resolve, ServiceProvider, ProviderManager, definePlugin, defineModule, mountModuleRoutes, } from './container/index.js';
49
+ export type { PluginDefinition, PluginFactory, ModuleDefinition, GurenModule, ServiceFactory, ServiceClass, ServiceBinding, ServiceBindings, ContextualBindingBuilder, ContextualNeedsBuilder, ContextualBinding, ServiceProviderOptions, Provider as ContainerProvider, ServiceProviderClass, } from './container/index.js';
50
+ export { HttpException, ExceptionHandler, createExceptionHandler, setExceptionHandler, getExceptionHandler, abort, abortIf, abortUnless, ValidationException, AuthenticationException, AuthorizationException, NotFoundHttpException, MethodNotAllowedException, } from './errors/index.js';
51
+ export type { ErrorResponse, ExceptionHandlerOptions, ExceptionReporter, ExceptionRenderer, ExceptionClass, RendererRegistration, } from './errors/index.js';
52
+ export { Command, Input, Output, BufferedOutput, ConsoleKernel, createConsoleKernel, parseSignature, } from './console/index.js';
53
+ export type { ArgumentDefinition, OptionDefinition, ParsedSignature, CommandClass, CommandInstance, ConsoleKernelOptions, OutputInterface, InputInterface, ScheduledCommand, PromptInterface, ProgressInterface, } from './console/index.js';
54
+ export { Gate, Response as AuthResponse, createGate, setGate, getGate, defineGate, can, cannot, authorize as authorizeAbility, Policy, definePolicy, authorizeMiddleware, authorizeAllMiddleware, authorizeResourceMiddleware, withAuthorization, } from './authorization/index.js';
55
+ export type { AuthUser, GateCallback, GateDefinition, PolicyMethod, PolicyInterface, PolicyClass, AuthorizationResponse, GateOptions, AuthorizeOptions, PolicyRegistration, ResourceAction, ResponseBuilder, AuthorizedContext, } from './authorization/index.js';
56
+ export { Encrypter, generateKey, generateAppKey, normalizeAppKey, parseAppKey, parsePreviousAppKeys, getAppKeyringFromEnv, deriveAppKey, deriveAppKeyring, createEncrypter, setEncrypter, getEncrypter, encrypt, decrypt, MessageSigner, signUrl, verifySignedUrl, hash, hmac, verifyHmac, sha256, sha512, md5, hashPassword, verifyPassword, needsRehash, secureCompare, check as checkHash, randomString, random, randomHex, randomBase64, randomBase64Url, uuid, randomInt, urlSafeToken, generatePassword, generateOtp, generateSlug, shuffle, pick, sample, } from './encryption/index.js';
57
+ export type { AppKeyring, EncryptOptions, DecryptOptions, EncrypterConfig, EncryptedPayload, SignedMessageClaims, SignMessageOptions, VerifySignedMessageOptions, HashAlgorithm, HmacOptions, PasswordHashOptions, RandomStringOptions, SignedUrlOptions, VerifySignedUrlOptions, } from './encryption/index.js';
58
+ export { createFacade, createFacades } from './facades/index.js';
59
+ export { AutoDiscovery } from './discovery/index.js';
60
+ export type { DiscoveryOptions, DiscoveryResult } from './discovery/index.js';
61
+ export { renderDebugPage, debugErrorMiddleware } from './errors/debug-page.js';
62
+ export { renderErrorPage } from './errors/error-page.js';
63
+ export { NodeHasher } from './auth/password/NodeHasher.js';
64
+ export { DefaultHasher, DefaultHasher as Hash } from './auth/password/DefaultHasher.js';
65
+ export type { ApplicationOptions, AuthPluginOptions, I18nPluginOptions } from './http/Application.js';
66
+ export type { InertiaI18nProps } from './providers/I18nServiceProvider.js';
67
+ export { SqsDriver, createSqsAdapter } from './queue/drivers/SqsDriver.js';
68
+ export { createTypedBroadcaster } from './broadcasting/typed.js';
69
+ export { createRedisClient } from './redis/client.js';