@guren/server 2.15.0 → 2.17.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 (302) hide show
  1. package/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
  2. package/dist/{Hash-C8aejmi8.js → Hash-D2DFd8xX.js} +7 -57
  3. package/dist/{HttpException-BkS3euNG.js → HttpException-BlQ2yEmT.js} +2 -79
  4. package/dist/{Job-BVT813DO.js → Job-DxQK8h3P.js} +24 -179
  5. package/dist/{McpServiceProvider-BawsYjgN.js → McpServiceProvider-Zihx3Bjq.js} +35 -20
  6. package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
  7. package/dist/agent/AgentApprovalRequested.d.ts +11 -39
  8. package/dist/agent/approval-status.d.ts +56 -0
  9. package/dist/agent/approval.d.ts +76 -187
  10. package/dist/agent/audit-emitter.d.ts +16 -44
  11. package/dist/agent/audit.d.ts +20 -56
  12. package/dist/agent/derive.d.ts +32 -66
  13. package/dist/agent/dispatch.d.ts +38 -90
  14. package/dist/agent/events.d.ts +17 -23
  15. package/dist/agent/gate.d.ts +118 -0
  16. package/dist/agent/meta-tools.d.ts +18 -46
  17. package/dist/agent/pipeline.d.ts +234 -0
  18. package/dist/agent/public.d.ts +6 -25
  19. package/dist/agent/public.js +1 -1
  20. package/dist/agent/redact.d.ts +16 -38
  21. package/dist/agent/scopes.d.ts +55 -69
  22. package/dist/auth/AgentPrincipalGuard.d.ts +49 -0
  23. package/dist/auth/AuthManager.d.ts +22 -43
  24. package/dist/auth/AuthenticatableModel.d.ts +2 -2
  25. package/dist/auth/SessionGuard.d.ts +0 -1
  26. package/dist/auth/TokenGuard.d.ts +6 -26
  27. package/dist/auth/api-token.d.ts +16 -148
  28. package/dist/auth/context.d.ts +5 -10
  29. package/dist/auth/email-verification.d.ts +29 -127
  30. package/dist/auth/index.js +1 -1
  31. package/dist/auth/oauth/index.d.ts +35 -57
  32. package/dist/auth/password/DefaultHasher.d.ts +5 -14
  33. package/dist/auth/password/PasswordHasher.d.ts +5 -13
  34. package/dist/auth/password/hash-format.d.ts +5 -13
  35. package/dist/auth/password-reset.d.ts +16 -42
  36. package/dist/auth/providers/ModelUserProvider.d.ts +3 -4
  37. package/dist/auth/providers/UserProvider.d.ts +4 -4
  38. package/dist/auth/signed-token.d.ts +18 -0
  39. package/dist/auth/types.d.ts +9 -32
  40. package/dist/auth/utils.d.ts +6 -27
  41. package/dist/{auth-DkYoAPVn.js → auth-Gg54ppQi.js} +279 -519
  42. package/dist/authorization/Gate.d.ts +9 -145
  43. package/dist/authorization/Policy.d.ts +6 -53
  44. package/dist/authorization/index.js +1 -1
  45. package/dist/authorization/middleware.d.ts +16 -62
  46. package/dist/authorization/types.d.ts +8 -64
  47. package/dist/{authorization-CdfbCj8J.js → authorization-CdEWZZw3.js} +44 -309
  48. package/dist/broadcasting/BroadcastManager.d.ts +29 -149
  49. package/dist/broadcasting/channels/Channel.d.ts +1 -19
  50. package/dist/broadcasting/channels/PresenceChannel.d.ts +1 -55
  51. package/dist/broadcasting/channels/PrivateChannel.d.ts +1 -23
  52. package/dist/broadcasting/drivers/MemoryDriver.d.ts +18 -70
  53. package/dist/broadcasting/drivers/RedisDriver.d.ts +3 -80
  54. package/dist/broadcasting/drivers/index.d.ts +1 -1
  55. package/dist/broadcasting/index.d.ts +1 -1
  56. package/dist/broadcasting/index.js +1 -1
  57. package/dist/broadcasting/types.d.ts +7 -88
  58. package/dist/{broadcasting-BwodCA4q.js → broadcasting-B5RzB0A2.js} +87 -414
  59. package/dist/cache/CacheManager.d.ts +8 -62
  60. package/dist/cache/TaggedCache.d.ts +2 -35
  61. package/dist/cache/index.js +1 -1
  62. package/dist/cache/stores/FileStore.d.ts +2 -36
  63. package/dist/cache/stores/MemoryStore.d.ts +2 -26
  64. package/dist/cache/stores/RedisStore.d.ts +1 -29
  65. package/dist/cache/types.d.ts +21 -128
  66. package/dist/{cache-BYnZf2FR.js → cache-BOOIr324.js} +19 -198
  67. package/dist/client-C4TEr_Dd.js +9 -0
  68. package/dist/console/Command.d.ts +17 -126
  69. package/dist/console/ConsoleKernel.d.ts +2 -74
  70. package/dist/console/Input.d.ts +5 -113
  71. package/dist/console/Output.d.ts +3 -99
  72. package/dist/console/types.d.ts +3 -33
  73. package/dist/container/Container.d.ts +12 -103
  74. package/dist/container/ServiceProvider.d.ts +17 -61
  75. package/dist/container/bindings.d.ts +5 -26
  76. package/dist/container/defineModule.d.ts +16 -54
  77. package/dist/container/definePlugin.d.ts +12 -45
  78. package/dist/container/types.d.ts +2 -34
  79. package/dist/context-CXk_umpT.js +21 -0
  80. package/dist/database/Factory.d.ts +4 -57
  81. package/dist/database/Seeder.d.ts +8 -46
  82. package/dist/database/SeederRunner.d.ts +3 -33
  83. package/dist/database/types.d.ts +3 -24
  84. package/dist/discovery/AutoDiscovery.d.ts +10 -82
  85. package/dist/{dispatch-erOS9epZ.js → dispatch-BAwzftws.js} +32 -79
  86. package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +2 -5
  87. package/dist/docs-viewer/endpoint.d.ts +5 -11
  88. package/dist/encryption/Encrypter.d.ts +5 -71
  89. package/dist/encryption/Hash.d.ts +7 -57
  90. package/dist/encryption/Random.d.ts +6 -99
  91. package/dist/encryption/index.js +3 -3
  92. package/dist/encryption/types.d.ts +10 -72
  93. package/dist/{encryption-D99Vmls3.js → encryption-uwP3Di4D.js} +9 -78
  94. package/dist/{endpoint-D6GIqOpe.js → endpoint-BXipU2Jj.js} +6 -12
  95. package/dist/endpoint-Dsw3Acvq.js +26 -0
  96. package/dist/errors/ExceptionHandler.d.ts +3 -90
  97. package/dist/errors/HttpException.d.ts +2 -79
  98. package/dist/errors/debug-page.d.ts +3 -17
  99. package/dist/errors/error-page.d.ts +1 -0
  100. package/dist/errors/exceptions/AuthenticationException.d.ts +2 -24
  101. package/dist/errors/exceptions/AuthorizationException.d.ts +1 -24
  102. package/dist/errors/exceptions/MethodNotAllowedException.d.ts +1 -23
  103. package/dist/errors/exceptions/NotFoundHttpException.d.ts +1 -27
  104. package/dist/errors/exceptions/ValidationException.d.ts +2 -43
  105. package/dist/errors/types.d.ts +1 -25
  106. package/dist/{errors-BgeOl_DC.js → errors-JpkcCjjn.js} +3 -41
  107. package/dist/events/Event.d.ts +1 -28
  108. package/dist/events/EventManager.d.ts +5 -107
  109. package/dist/events/Listener.d.ts +7 -55
  110. package/dist/events/builtin.d.ts +0 -24
  111. package/dist/events/index.js +1 -1
  112. package/dist/events/types.d.ts +4 -22
  113. package/dist/{events-aIH_bWRx.js → events-DOmAHDeP.js} +11 -191
  114. package/dist/facades/index.d.ts +2 -14
  115. package/dist/health/HealthCheck.d.ts +0 -24
  116. package/dist/health/HealthManager.d.ts +0 -36
  117. package/dist/health/checks/CacheCheck.d.ts +2 -17
  118. package/dist/health/checks/CustomCheck.d.ts +0 -9
  119. package/dist/health/checks/DatabaseCheck.d.ts +2 -17
  120. package/dist/health/checks/MemoryCheck.d.ts +3 -12
  121. package/dist/health/checks/RedisCheck.d.ts +1 -13
  122. package/dist/health/checks/StorageCheck.d.ts +2 -17
  123. package/dist/health/index.js +1 -1
  124. package/dist/health/types.d.ts +4 -24
  125. package/dist/{health-VWdWXRwh.js → health-DQSvUplL.js} +1 -76
  126. package/dist/hot-disposables-B5BXqaIH.js +167 -0
  127. package/dist/hot-reload/hot-disposables.d.ts +22 -74
  128. package/dist/hot-reload/testing.d.ts +4 -9
  129. package/dist/http/Application.d.ts +77 -205
  130. package/dist/http/FormRequest.d.ts +4 -55
  131. package/dist/http/dev-assets.d.ts +13 -31
  132. package/dist/http/dev-banner.d.ts +2 -5
  133. package/dist/http/inertia-assets.d.ts +3 -6
  134. package/dist/http/middleware/capabilities.d.ts +27 -50
  135. package/dist/http/middleware/cors.d.ts +4 -29
  136. package/dist/http/middleware/csp.d.ts +2 -25
  137. package/dist/http/middleware/csrf.d.ts +28 -95
  138. package/dist/http/middleware/detect-locale.d.ts +7 -27
  139. package/dist/http/middleware/force-https.d.ts +6 -24
  140. package/dist/http/middleware/host-authorization.d.ts +2 -12
  141. package/dist/http/middleware/index.d.ts +1 -1
  142. package/dist/http/middleware/loopback-guard.d.ts +15 -33
  143. package/dist/http/middleware/rate-limit.d.ts +29 -126
  144. package/dist/http/middleware/redirect-safety.d.ts +2 -20
  145. package/dist/http/middleware/request-id.d.ts +1 -14
  146. package/dist/http/middleware/request-logging.d.ts +2 -13
  147. package/dist/http/middleware/response-headers.d.ts +5 -13
  148. package/dist/http/middleware/security-headers.d.ts +2 -16
  149. package/dist/http/middleware/session.d.ts +15 -34
  150. package/dist/http/middleware/validation-errors-cookie.d.ts +7 -18
  151. package/dist/http/middleware/validation.d.ts +8 -63
  152. package/dist/http/public-assets.d.ts +11 -7
  153. package/dist/http/request.d.ts +32 -118
  154. package/dist/http/resources/CursorPaginator.d.ts +5 -64
  155. package/dist/http/resources/Paginator.d.ts +7 -84
  156. package/dist/http/resources/Resource.d.ts +9 -65
  157. package/dist/http/resources/ResourceCollection.d.ts +5 -39
  158. package/dist/http/resources/types.d.ts +10 -30
  159. package/dist/http/static-documents.d.ts +10 -20
  160. package/dist/http/validation/Validator.d.ts +25 -85
  161. package/dist/http/validation/rules.d.ts +48 -147
  162. package/dist/http/validation/types.d.ts +16 -61
  163. package/dist/http/vite-assets.d.ts +5 -28
  164. package/dist/http/vite-dev-server.d.ts +6 -9
  165. package/dist/http/vite-manifest.d.ts +19 -33
  166. package/dist/i18n/I18nManager.d.ts +12 -78
  167. package/dist/i18n/Translator.d.ts +3 -54
  168. package/dist/i18n/index.js +1 -1
  169. package/dist/i18n/loaders/JsonLoader.d.ts +4 -31
  170. package/dist/i18n/loaders/MemoryLoader.d.ts +1 -21
  171. package/dist/i18n/pluralization.d.ts +4 -13
  172. package/dist/i18n/types.d.ts +17 -69
  173. package/dist/{i18n-mcWi7LCd.js → i18n-Cg1aajRP.js} +31 -225
  174. package/dist/index.d.ts +11 -4
  175. package/dist/index.js +1186 -3040
  176. package/dist/internal/agent-preflight.d.ts +9 -21
  177. package/dist/internal/agent-principal.d.ts +32 -0
  178. package/dist/internal/request.d.ts +6 -19
  179. package/dist/internal/request.js +1 -1
  180. package/dist/internal/route-path.d.ts +9 -21
  181. package/dist/internal/route-path.js +9 -21
  182. package/dist/internal/zod-compat.d.ts +55 -122
  183. package/dist/internal/zod-compat.js +39 -70
  184. package/dist/internal/zod-json-schema.d.ts +18 -54
  185. package/dist/internal/zod-json-schema.js +46 -123
  186. package/dist/jsx-runtime.d.ts +3 -8
  187. package/dist/lambda/index.d.ts +17 -79
  188. package/dist/lambda/index.js +11 -59
  189. package/dist/logging/LogManager.d.ts +1 -51
  190. package/dist/logging/Logger.d.ts +8 -47
  191. package/dist/logging/channels/ConsoleChannel.d.ts +1 -3
  192. package/dist/logging/channels/DailyFileChannel.d.ts +1 -3
  193. package/dist/logging/channels/FileChannel.d.ts +1 -3
  194. package/dist/logging/daily-file-path.d.ts +7 -16
  195. package/dist/logging/index.js +1 -1
  196. package/dist/logging/types.d.ts +13 -45
  197. package/dist/{logging-B-kngi3q.js → logging-zOY1XCtq.js} +52 -141
  198. package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
  199. package/dist/mail/Mail.d.ts +10 -106
  200. package/dist/mail/MailManager.d.ts +2 -60
  201. package/dist/mail/index.js +1 -1
  202. package/dist/mail/transports/LogTransport.d.ts +1 -4
  203. package/dist/mail/transports/MemoryTransport.d.ts +1 -63
  204. package/dist/mail/transports/ResendTransport.d.ts +1 -23
  205. package/dist/mail/transports/SmtpTransport.d.ts +1 -31
  206. package/dist/mail/types.d.ts +28 -150
  207. package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
  208. package/dist/mcp/McpServiceProvider.d.ts +4 -10
  209. package/dist/mcp/create-mcp-server.d.ts +42 -57
  210. package/dist/mcp/endpoint.d.ts +12 -36
  211. package/dist/mcp/index.js +1 -1
  212. package/dist/mvc/Controller.d.ts +46 -227
  213. package/dist/mvc/Router.d.ts +50 -129
  214. package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
  215. package/dist/mvc/inertia/shared.d.ts +6 -19
  216. package/dist/mvc/mount-route.d.ts +2 -6
  217. package/dist/mvc/view.d.ts +1 -2
  218. package/dist/notifications/Notification.d.ts +8 -75
  219. package/dist/notifications/NotificationManager.d.ts +15 -88
  220. package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
  221. package/dist/notifications/channels/MailChannel.d.ts +2 -31
  222. package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
  223. package/dist/notifications/channels/SlackChannel.d.ts +3 -48
  224. package/dist/notifications/index.js +1 -1
  225. package/dist/notifications/notifiable-type.d.ts +3 -6
  226. package/dist/notifications/registry.d.ts +8 -27
  227. package/dist/notifications/types.d.ts +16 -53
  228. package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
  229. package/dist/providers/AuthServiceProvider.d.ts +1 -3
  230. package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
  231. package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
  232. package/dist/providers/CacheServiceProvider.d.ts +1 -3
  233. package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
  234. package/dist/providers/ErrorServiceProvider.d.ts +1 -4
  235. package/dist/providers/EventServiceProvider.d.ts +1 -3
  236. package/dist/providers/HealthServiceProvider.d.ts +1 -3
  237. package/dist/providers/I18nServiceProvider.d.ts +6 -10
  238. package/dist/providers/InertiaServiceProvider.d.ts +1 -4
  239. package/dist/providers/LogServiceProvider.d.ts +1 -3
  240. package/dist/providers/MailServiceProvider.d.ts +1 -3
  241. package/dist/providers/NotificationServiceProvider.d.ts +1 -3
  242. package/dist/providers/OAuthServiceProvider.d.ts +1 -3
  243. package/dist/providers/QueueServiceProvider.d.ts +1 -3
  244. package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
  245. package/dist/providers/StorageServiceProvider.d.ts +1 -3
  246. package/dist/queue/FailedJobReporter.d.ts +1 -24
  247. package/dist/queue/Job.d.ts +12 -99
  248. package/dist/queue/QueueManager.d.ts +6 -57
  249. package/dist/queue/Worker.d.ts +4 -65
  250. package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
  251. package/dist/queue/drivers/RedisDriver.d.ts +7 -65
  252. package/dist/queue/drivers/SqsDriver.d.ts +6 -57
  253. package/dist/queue/drivers/SyncDriver.d.ts +10 -13
  254. package/dist/queue/index.js +2 -2
  255. package/dist/queue/types.d.ts +10 -92
  256. package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
  257. package/dist/redis/RedisApiTokenStore.d.ts +4 -56
  258. package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
  259. package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
  260. package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
  261. package/dist/redis/RedisRateLimitStore.d.ts +16 -49
  262. package/dist/redis/RedisSessionStore.d.ts +3 -44
  263. package/dist/redis/client.d.ts +2 -32
  264. package/dist/redis/index.js +47 -232
  265. package/dist/redis/redis-values.d.ts +6 -12
  266. package/dist/redis/scan-keys.d.ts +1 -4
  267. package/dist/request-CLOYytGP.js +68 -0
  268. package/dist/runtime/index.d.ts +2 -0
  269. package/dist/runtime/index.js +50 -92
  270. package/dist/scheduling/CronParser.d.ts +0 -29
  271. package/dist/scheduling/Schedule.d.ts +1 -153
  272. package/dist/scheduling/ScheduledTask.d.ts +0 -31
  273. package/dist/scheduling/Scheduler.d.ts +0 -70
  274. package/dist/scheduling/index.js +1 -1
  275. package/dist/scheduling/types.d.ts +4 -65
  276. package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
  277. package/dist/storage/StorageManager.d.ts +0 -48
  278. package/dist/storage/drivers/LocalDriver.d.ts +1 -25
  279. package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
  280. package/dist/storage/drivers/S3Driver.d.ts +6 -36
  281. package/dist/storage/drivers/s3-acl.d.ts +5 -10
  282. package/dist/storage/index.js +1 -1
  283. package/dist/storage/types.d.ts +27 -265
  284. package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
  285. package/dist/support/contained-path.d.ts +10 -20
  286. package/dist/support/error-polyfill.d.ts +4 -6
  287. package/dist/support/expiry.d.ts +17 -33
  288. package/dist/support/expiry.js +17 -33
  289. package/dist/support/import-map.d.ts +3 -7
  290. package/dist/support/inertia-defaults.d.ts +5 -10
  291. package/dist/support/redirect-target.d.ts +4 -6
  292. package/dist/support/stack-frames.d.ts +11 -50
  293. package/dist/support/trim-slashes.d.ts +4 -7
  294. package/dist/support/warn-once.d.ts +2 -6
  295. package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
  296. package/dist/{vite-manifest-w_RSOvQW.js → vite-manifest-B_Iy5183.js} +34 -58
  297. package/package.json +2 -2
  298. package/dist/client-Dd7vLcqp.js +0 -27
  299. package/dist/context-DoD0c7J_.js +0 -26
  300. package/dist/endpoint-D-20PiHY.js +0 -46
  301. package/dist/hot-disposables-WsTX2ySN.js +0 -281
  302. package/dist/request-CVQwpu2J.js +0 -129
@@ -1,106 +1,29 @@
1
1
  import type { ErrorResponse } from './types.js';
2
- /**
3
- * Base HTTP exception class.
4
- *
5
- * @example
6
- * ```typescript
7
- * // Using factory methods
8
- * throw HttpException.notFound('User not found')
9
- * throw HttpException.unauthorized('Invalid credentials')
10
- *
11
- * // Custom status code
12
- * throw new HttpException(418, "I'm a teapot")
13
- *
14
- * // With validation errors
15
- * throw HttpException.unprocessable('Validation failed', {
16
- * email: ['Email is required', 'Email must be valid'],
17
- * password: ['Password is too short'],
18
- * })
19
- * ```
20
- */
2
+ /** Base HTTP exception class. */
21
3
  export declare class HttpException extends Error {
22
- /**
23
- * HTTP status code.
24
- */
25
4
  readonly statusCode: number;
26
- /**
27
- * Validation or field-specific errors.
28
- */
29
5
  readonly errors?: Record<string, string[]>;
30
- /**
31
- * Additional error data.
32
- */
33
6
  readonly data?: Record<string, unknown>;
34
7
  constructor(statusCode: number, message: string, errors?: Record<string, string[]>, data?: Record<string, unknown>);
35
- /**
36
- * Convert to response format.
37
- */
38
8
  toResponse(debug?: boolean): {
39
9
  status: number;
40
10
  body: ErrorResponse;
41
11
  };
42
- /**
43
- * Convert to JSON.
44
- */
45
12
  toJSON(): Record<string, unknown>;
46
- /**
47
- * Create a 400 Bad Request exception.
48
- */
49
13
  static badRequest(message?: string): HttpException;
50
- /**
51
- * Create a 401 Unauthorized exception.
52
- */
53
14
  static unauthorized(message?: string): HttpException;
54
- /**
55
- * Create a 403 Forbidden exception.
56
- */
57
15
  static forbidden(message?: string): HttpException;
58
- /**
59
- * Create a 404 Not Found exception.
60
- */
61
16
  static notFound(message?: string): HttpException;
62
- /**
63
- * Create a 405 Method Not Allowed exception.
64
- */
65
17
  static methodNotAllowed(message?: string): HttpException;
66
- /**
67
- * Create a 409 Conflict exception.
68
- */
69
18
  static conflict(message?: string): HttpException;
70
- /**
71
- * Create a 410 Gone exception.
72
- */
73
19
  static gone(message?: string): HttpException;
74
- /**
75
- * Create a 422 Unprocessable Entity exception.
76
- */
77
20
  static unprocessable(message?: string, errors?: Record<string, string[]>): HttpException;
78
- /**
79
- * Create a 429 Too Many Requests exception.
80
- */
81
21
  static tooManyRequests(message?: string): HttpException;
82
- /**
83
- * Create a 500 Internal Server Error exception.
84
- */
85
22
  static internal(message?: string): HttpException;
86
- /**
87
- * Create a 501 Not Implemented exception.
88
- */
89
23
  static notImplemented(message?: string): HttpException;
90
- /**
91
- * Create a 502 Bad Gateway exception.
92
- */
93
24
  static badGateway(message?: string): HttpException;
94
- /**
95
- * Create a 503 Service Unavailable exception.
96
- */
97
25
  static serviceUnavailable(message?: string): HttpException;
98
- /**
99
- * Create a 504 Gateway Timeout exception.
100
- */
101
26
  static gatewayTimeout(message?: string): HttpException;
102
- /**
103
- * Check if an error is an HTTP exception.
104
- */
27
+ /** Duck-typed: an exception from another copy of the package still passes. */
105
28
  static isHttpException(error: unknown): error is HttpException;
106
29
  }
@@ -1,22 +1,8 @@
1
1
  import type { MiddlewareHandler } from 'hono';
2
- /**
3
- * Render a rich HTML debug error page for development mode.
4
- *
5
- * When an error occurs and NODE_ENV is not 'production', this function
6
- * generates a helpful page displaying the error class, message, stack trace
7
- * with source context, and request details.
8
- */
2
+ /** Development-only error page: exposes the stack trace and request details. */
9
3
  export declare function renderDebugPage(error: Error, request?: Request): string;
10
4
  /**
11
- * Middleware that catches errors and renders a debug page in development.
12
- * In production (NODE_ENV === 'production'), errors are re-thrown so
13
- * downstream handlers or the ExceptionHandler can process them normally.
14
- *
15
- * @example
16
- * ```typescript
17
- * import { debugErrorMiddleware } from '@guren/server/errors/debug-page'
18
- *
19
- * app.use('*', debugErrorMiddleware())
20
- * ```
5
+ * Renders a debug page in development; in production the error is re-thrown for
6
+ * the ExceptionHandler.
21
7
  */
22
8
  export declare function debugErrorMiddleware(): MiddlewareHandler;
@@ -1 +1,2 @@
1
+ /** Production error page: no stack traces or internal details are exposed. */
1
2
  export declare function renderErrorPage(statusCode: number, message?: string): string;
@@ -1,32 +1,10 @@
1
1
  import { HttpException } from '../HttpException.js';
2
- /**
3
- * Authentication exception.
4
- *
5
- * Thrown when a user is not authenticated or credentials are invalid.
6
- *
7
- * @example
8
- * ```typescript
9
- * throw new AuthenticationException()
10
- * throw new AuthenticationException('Invalid token')
11
- * throw new AuthenticationException('Session expired', 'login')
12
- * ```
13
- */
2
+ /** 401: the user is not authenticated, or the credentials were invalid. */
14
3
  export declare class AuthenticationException extends HttpException {
15
- /**
16
- * The guard that threw the exception.
17
- */
4
+ /** The guard that threw. */
18
5
  readonly guard?: string;
19
- /**
20
- * URL to redirect to for authentication.
21
- */
22
6
  readonly redirectTo?: string;
23
7
  constructor(message?: string, guard?: string, redirectTo?: string);
24
- /**
25
- * Create exception with redirect URL.
26
- */
27
8
  static withRedirect(redirectTo: string, message?: string): AuthenticationException;
28
- /**
29
- * Create exception for a specific guard.
30
- */
31
9
  static forGuard(guard: string, message?: string): AuthenticationException;
32
10
  }
@@ -1,32 +1,9 @@
1
1
  import { HttpException } from '../HttpException.js';
2
- /**
3
- * Authorization exception.
4
- *
5
- * Thrown when a user is authenticated but not authorized to perform an action.
6
- *
7
- * @example
8
- * ```typescript
9
- * throw new AuthorizationException()
10
- * throw new AuthorizationException('You cannot edit this post')
11
- * throw new AuthorizationException('Access denied', 'edit', 'Post')
12
- * ```
13
- */
2
+ /** 403: the user is authenticated but not allowed to perform the action. */
14
3
  export declare class AuthorizationException extends HttpException {
15
- /**
16
- * The action that was attempted.
17
- */
18
4
  readonly action?: string;
19
- /**
20
- * The resource that was being accessed.
21
- */
22
5
  readonly resource?: string;
23
6
  constructor(message?: string, action?: string, resource?: string);
24
- /**
25
- * Create exception for a specific action and resource.
26
- */
27
7
  static forAction(action: string, resource?: string): AuthorizationException;
28
- /**
29
- * Deny access to a resource.
30
- */
31
8
  static deny(resource?: string): AuthorizationException;
32
9
  }
@@ -1,31 +1,9 @@
1
1
  import { HttpException } from '../HttpException.js';
2
- /**
3
- * Method Not Allowed exception.
4
- *
5
- * Thrown when an HTTP method is not allowed for a route.
6
- *
7
- * @example
8
- * ```typescript
9
- * throw new MethodNotAllowedException()
10
- * throw new MethodNotAllowedException('POST', ['GET', 'HEAD'])
11
- * ```
12
- */
2
+ /** 405: the HTTP method is not allowed for the route. */
13
3
  export declare class MethodNotAllowedException extends HttpException {
14
- /**
15
- * The HTTP method that was attempted.
16
- */
17
4
  readonly method?: string;
18
- /**
19
- * The allowed HTTP methods.
20
- */
21
5
  readonly allowedMethods?: string[];
22
6
  constructor(method?: string, allowedMethods?: string[], message?: string);
23
- /**
24
- * Get the Allow header value.
25
- */
26
7
  getAllowHeader(): string;
27
- /**
28
- * Create exception with method details.
29
- */
30
8
  static forMethod(method: string, allowedMethods: string[]): MethodNotAllowedException;
31
9
  }
@@ -1,36 +1,10 @@
1
1
  import { HttpException } from '../HttpException.js';
2
- /**
3
- * Not Found HTTP exception.
4
- *
5
- * Thrown when a requested resource cannot be found.
6
- *
7
- * @example
8
- * ```typescript
9
- * throw new NotFoundHttpException()
10
- * throw new NotFoundHttpException('User not found')
11
- * throw NotFoundHttpException.forModel('User', 123)
12
- * ```
13
- */
2
+ /** 404: the requested resource could not be found. */
14
3
  export declare class NotFoundHttpException extends HttpException {
15
- /**
16
- * The type of resource that was not found.
17
- */
18
4
  readonly resourceType?: string;
19
- /**
20
- * The ID of the resource that was not found.
21
- */
22
5
  readonly resourceId?: string | number;
23
6
  constructor(message?: string, resourceType?: string, resourceId?: string | number);
24
- /**
25
- * Create exception for a model not found.
26
- */
27
7
  static forModel(model: string, id: string | number): NotFoundHttpException;
28
- /**
29
- * Create exception for a route not found.
30
- */
31
8
  static forRoute(path: string): NotFoundHttpException;
32
- /**
33
- * Create exception for a resource not found.
34
- */
35
9
  static forResource(resource: string): NotFoundHttpException;
36
10
  }
@@ -1,56 +1,15 @@
1
1
  import { HttpException } from '../HttpException.js';
2
- /**
3
- * Validation exception.
4
- *
5
- * Thrown when request validation fails.
6
- *
7
- * @example
8
- * ```typescript
9
- * throw new ValidationException({
10
- * email: ['Email is required', 'Email must be valid'],
11
- * password: ['Password is too short'],
12
- * })
13
- * ```
14
- */
2
+ /** 422: request validation failed. */
15
3
  export declare class ValidationException extends HttpException {
16
4
  constructor(errors: Record<string, string[]>, message?: string);
17
- /**
18
- * Create from Zod error.
19
- */
20
5
  static fromZodError(zodError: ZodLikeError): ValidationException;
21
- /**
22
- * Get errors for a specific field.
23
- */
24
6
  getFieldErrors(field: string): string[];
25
- /**
26
- * Check if a field has errors.
27
- */
28
7
  hasFieldError(field: string): boolean;
29
- /**
30
- * Get the first error for a field.
31
- */
32
8
  getFirstError(field: string): string | null;
33
- /**
34
- * Get all error messages as a flat array.
35
- */
36
9
  getAllMessages(): string[];
37
- /**
38
- * Create a ValidationException from a plain messages object.
39
- *
40
- * Useful for business-logic validation (e.g. duplicate email checks)
41
- * where Zod is not involved.
42
- *
43
- * @example
44
- * ```typescript
45
- * throw ValidationException.withMessages({ email: 'Email already registered' })
46
- * throw ValidationException.withMessages({ email: ['Must be unique', 'Must be corporate'] })
47
- * ```
48
- */
10
+ /** For business-logic validation, where Zod is not involved. */
49
11
  static withMessages(messages: Record<string, string | string[]>): ValidationException;
50
12
  }
51
- /**
52
- * Zod-like error interface for compatibility.
53
- */
54
13
  interface ZodLikeError {
55
14
  issues: Array<{
56
15
  path: PropertyKey[];
@@ -1,42 +1,18 @@
1
1
  import type { Context } from '../http/Application.js';
2
- /**
3
- * Error response structure.
4
- */
5
2
  export interface ErrorResponse {
6
3
  message: string;
7
4
  errors?: Record<string, string[]>;
8
5
  stack?: string;
9
6
  exception?: string;
10
7
  }
11
- /**
12
- * Exception handler options.
13
- */
14
8
  export interface ExceptionHandlerOptions {
15
- /**
16
- * Whether to show detailed error information.
17
- * Default: true in development, false in production.
18
- */
9
+ /** @default true in development, false in production */
19
10
  debug?: boolean;
20
- /**
21
- * Custom debug detection function.
22
- */
23
11
  isDebug?: () => boolean;
24
12
  }
25
- /**
26
- * Exception reporter callback.
27
- */
28
13
  export type ExceptionReporter = (error: Error) => void | Promise<void>;
29
- /**
30
- * Exception renderer callback.
31
- */
32
14
  export type ExceptionRenderer<T extends Error = Error> = (error: T, ctx: Context) => Response | Promise<Response>;
33
- /**
34
- * Exception class type.
35
- */
36
15
  export type ExceptionClass<T extends Error = Error> = new (...args: any[]) => T;
37
- /**
38
- * Renderer registration.
39
- */
40
16
  export interface RendererRegistration {
41
17
  errorClass: ExceptionClass;
42
18
  renderer: ExceptionRenderer;
@@ -1,27 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { t as HttpException } from "./HttpException-BkS3euNG.js";
2
+ import { t as HttpException } from "./HttpException-BlQ2yEmT.js";
3
3
  //#region src/errors/exceptions/ValidationException.ts
4
- /**
5
- * Validation exception.
6
- *
7
- * Thrown when request validation fails.
8
- *
9
- * @example
10
- * ```typescript
11
- * throw new ValidationException({
12
- * email: ['Email is required', 'Email must be valid'],
13
- * password: ['Password is too short'],
14
- * })
15
- * ```
16
- */
4
+ /** 422: request validation failed. */
17
5
  var ValidationException = class ValidationException extends HttpException {
18
6
  constructor(errors, message = "The given data was invalid.") {
19
7
  super(422, message, errors);
20
8
  this.name = "ValidationException";
21
9
  }
22
- /**
23
- * Create from Zod error.
24
- */
25
10
  static fromZodError(zodError) {
26
11
  const errors = {};
27
12
  for (const issue of zodError.issues) {
@@ -31,43 +16,20 @@ var ValidationException = class ValidationException extends HttpException {
31
16
  }
32
17
  return new ValidationException(errors);
33
18
  }
34
- /**
35
- * Get errors for a specific field.
36
- */
37
19
  getFieldErrors(field) {
38
20
  return this.errors?.[field] ?? [];
39
21
  }
40
- /**
41
- * Check if a field has errors.
42
- */
43
22
  hasFieldError(field) {
44
23
  return (this.errors?.[field]?.length ?? 0) > 0;
45
24
  }
46
- /**
47
- * Get the first error for a field.
48
- */
49
25
  getFirstError(field) {
50
26
  return this.errors?.[field]?.[0] ?? null;
51
27
  }
52
- /**
53
- * Get all error messages as a flat array.
54
- */
55
28
  getAllMessages() {
56
29
  if (!this.errors) return [];
57
30
  return Object.values(this.errors).flat();
58
31
  }
59
- /**
60
- * Create a ValidationException from a plain messages object.
61
- *
62
- * Useful for business-logic validation (e.g. duplicate email checks)
63
- * where Zod is not involved.
64
- *
65
- * @example
66
- * ```typescript
67
- * throw ValidationException.withMessages({ email: 'Email already registered' })
68
- * throw ValidationException.withMessages({ email: ['Must be unique', 'Must be corporate'] })
69
- * ```
70
- */
32
+ /** For business-logic validation, where Zod is not involved. */
71
33
  static withMessages(messages) {
72
34
  const errors = {};
73
35
  for (const [key, value] of Object.entries(messages)) errors[key] = Array.isArray(value) ? value : [value];
@@ -1,33 +1,6 @@
1
- /**
2
- * Base class for all application events.
3
- *
4
- * @example
5
- * ```ts
6
- * class UserRegistered extends Event {
7
- * constructor(
8
- * public readonly userId: string,
9
- * public readonly email: string
10
- * ) {
11
- * super()
12
- * }
13
- * }
14
- *
15
- * // Emit the event
16
- * await events.emit(new UserRegistered('123', 'user@example.com'))
17
- * ```
18
- */
1
+ /** Base class for all application events. */
19
2
  export declare abstract class Event {
20
- /**
21
- * Timestamp when the event was created.
22
- */
23
3
  readonly timestamp: Date;
24
- /**
25
- * Get the event name (class name by default).
26
- * Override this to customize the event name.
27
- */
28
4
  static get eventName(): string;
29
- /**
30
- * Get the event name from an instance.
31
- */
32
5
  get eventName(): string;
33
6
  }
@@ -1,125 +1,23 @@
1
1
  import type { Event } from './Event.js';
2
2
  import type { EventClass, EventListener, ListenerOptions, EventSubscription } from './types.js';
3
- /**
4
- * Event manager for registering listeners and emitting events.
5
- *
6
- * @example
7
- * ```ts
8
- * const events = new EventManager()
9
- *
10
- * // Register a listener
11
- * events.on(UserRegistered, async (event) => {
12
- * console.log(`User ${event.userId} registered`)
13
- * await sendWelcomeEmail(event.email)
14
- * })
15
- *
16
- * // Register a one-time listener
17
- * events.once(AppStarted, () => {
18
- * console.log('App started!')
19
- * })
20
- *
21
- * // Emit an event
22
- * await events.emit(new UserRegistered('123', 'user@example.com'))
23
- * ```
24
- */
3
+ /** Registers listeners and emits events. */
25
4
  export declare class EventManager {
26
5
  private readonly listeners;
27
- /**
28
- * Queue dispatcher function (set when Queue system is integrated).
29
- */
30
6
  private queueDispatcher?;
31
- /**
32
- * Register a listener for an event.
33
- *
34
- * @param event - Event class to listen for
35
- * @param listener - Listener function
36
- * @param options - Listener options
37
- * @returns Subscription handle for unsubscribing
38
- *
39
- * @example
40
- * ```ts
41
- * // Basic usage
42
- * events.on(UserRegistered, (e) => console.log(e.email))
43
- *
44
- * // With options
45
- * events.on(UserRegistered, (e) => sendEmail(e), { priority: 10 })
46
- *
47
- * // Unsubscribe later
48
- * const sub = events.on(UserRegistered, handler)
49
- * sub.unsubscribe()
50
- * ```
51
- */
52
7
  on<T extends Event>(event: EventClass<T> | string, listener: EventListener<T>, options?: ListenerOptions): EventSubscription;
53
- /**
54
- * Register a one-time listener for an event.
55
- * The listener will be automatically removed after the first invocation.
56
- *
57
- * @param event - Event class to listen for
58
- * @param listener - Listener function
59
- * @param options - Additional listener options (once is always true)
60
- * @returns Subscription handle for unsubscribing
61
- */
62
8
  once<T extends Event>(event: EventClass<T> | string, listener: EventListener<T>, options?: Omit<ListenerOptions, 'once'>): EventSubscription;
63
- /**
64
- * Remove a listener for an event.
65
- *
66
- * @param event - Event class
67
- * @param listener - Listener to remove (if omitted, all listeners for the event are removed)
68
- */
9
+ /** Omitting `listener` removes every listener for the event. */
69
10
  off<T extends Event>(event: EventClass<T> | string, listener?: EventListener<T>): void;
70
- /**
71
- * Emit an event to all registered listeners.
72
- * Listeners are executed in order of priority (highest first).
73
- * Async listeners are awaited sequentially.
74
- *
75
- * @param event - Event instance to emit
76
- *
77
- * @example
78
- * ```ts
79
- * await events.emit(new UserRegistered('123', 'user@example.com'))
80
- * ```
81
- */
11
+ /** Highest priority first, awaited one at a time. */
82
12
  emit<T extends Event>(event: T): Promise<void>;
83
- /**
84
- * Emit an event to all registered listeners in parallel.
85
- * Use this when listener execution order doesn't matter and you want faster execution.
86
- *
87
- * @param event - Event instance to emit
88
- */
13
+ /** {@link emit} without the ordering guarantee. */
89
14
  emitParallel<T extends Event>(event: T): Promise<void>;
90
- /**
91
- * Check if an event has any listeners registered.
92
- *
93
- * @param event - Event class or event name
94
- */
95
15
  hasListeners(event: EventClass | string): boolean;
96
- /**
97
- * Get all listeners for an event.
98
- *
99
- * @param event - Event class or event name
100
- */
101
16
  getListeners<T extends Event>(event: EventClass<T> | string): EventListener<T>[];
102
- /**
103
- * Get the count of listeners for an event.
104
- *
105
- * @param event - Event class or event name
106
- */
107
17
  listenerCount(event: EventClass | string): number;
108
- /**
109
- * Get all registered event names.
110
- */
111
18
  eventNames(): string[];
112
- /**
113
- * Remove all listeners for all events.
114
- */
115
19
  removeAllListeners(): void;
116
- /**
117
- * Set the queue dispatcher function.
118
- * This is called by the Queue system when it's integrated.
119
- */
20
+ /** Called by the Queue system when it is integrated. */
120
21
  setQueueDispatcher(dispatcher: (queueName: string, eventName: string, event: Event) => Promise<void>): void;
121
22
  }
122
- /**
123
- * Create a new EventManager instance.
124
- */
125
23
  export declare function createEventManager(): EventManager;