@guren/server 2.1.1 → 2.3.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 (281) hide show
  1. package/dist/{DocsViewerServiceProvider-D7RGJPGM.js → DocsViewerServiceProvider-RUYDFBMW.js} +2 -2
  2. package/dist/McpServiceProvider-FRJ5O7LT.js +8 -0
  3. package/dist/auth/AuthManager.d.ts +30 -0
  4. package/dist/auth/AuthenticatableModel.d.ts +25 -0
  5. package/dist/auth/RequestAuthContext.d.ts +24 -0
  6. package/dist/auth/SessionGuard.d.ts +31 -0
  7. package/dist/auth/api-token.d.ts +299 -0
  8. package/dist/auth/email-verification.d.ts +203 -0
  9. package/dist/auth/index.d.ts +18 -110
  10. package/dist/auth/index.js +4 -1
  11. package/dist/auth/oauth/index.d.ts +239 -0
  12. package/dist/auth/password/DefaultHasher.d.ts +13 -0
  13. package/dist/auth/password/NodeHasher.d.ts +22 -0
  14. package/dist/auth/password/PasswordHasher.d.ts +5 -0
  15. package/dist/auth/password/ScryptHasher.d.ts +26 -0
  16. package/dist/auth/password-reset.d.ts +91 -0
  17. package/dist/auth/providers/ModelUserProvider.d.ts +36 -0
  18. package/dist/auth/providers/UserProvider.d.ts +9 -0
  19. package/dist/auth/types.d.ts +102 -0
  20. package/dist/auth/utils.d.ts +39 -0
  21. package/dist/{Gate-CynjZCtS.d.ts → authorization/Gate.d.ts} +30 -111
  22. package/dist/authorization/Policy.d.ts +77 -0
  23. package/dist/authorization/index.d.ts +5 -129
  24. package/dist/authorization/index.js +3 -1
  25. package/dist/authorization/middleware.d.ts +49 -0
  26. package/dist/authorization/types.d.ts +108 -0
  27. package/dist/broadcasting/BroadcastManager.d.ts +205 -0
  28. package/dist/broadcasting/channels/Channel.d.ts +28 -0
  29. package/dist/broadcasting/channels/PresenceChannel.d.ts +72 -0
  30. package/dist/broadcasting/channels/PrivateChannel.d.ts +32 -0
  31. package/dist/broadcasting/channels/index.d.ts +3 -0
  32. package/dist/broadcasting/drivers/MemoryDriver.d.ts +93 -0
  33. package/dist/broadcasting/drivers/RedisDriver.d.ts +112 -0
  34. package/dist/broadcasting/drivers/index.d.ts +2 -0
  35. package/dist/broadcasting/index.d.ts +6 -233
  36. package/dist/broadcasting/index.js +1 -1
  37. package/dist/broadcasting/typed.d.ts +23 -0
  38. package/dist/broadcasting/types.d.ts +155 -0
  39. package/dist/cache/CacheManager.d.ts +87 -0
  40. package/dist/cache/TaggedCache.d.ts +62 -0
  41. package/dist/cache/index.d.ts +6 -233
  42. package/dist/cache/index.js +1 -1
  43. package/dist/cache/stores/FileStore.d.ts +64 -0
  44. package/dist/cache/stores/MemoryStore.d.ts +52 -0
  45. package/dist/cache/stores/RedisStore.d.ts +53 -0
  46. package/dist/{CacheManager-BmDzUKrF.d.ts → cache/types.d.ts} +26 -99
  47. package/dist/chunk-3KV5X2FL.js +31 -0
  48. package/dist/{chunk-TVY72CLV.js → chunk-4VE3LYOM.js} +3 -2
  49. package/dist/{chunk-DSDX3ASM.js → chunk-5WL2FTC4.js} +67 -85
  50. package/dist/{chunk-5SZTEZ22.js → chunk-6IGN233M.js} +15 -8
  51. package/dist/{chunk-FZD2AKJI.js → chunk-7OB2YXRE.js} +56 -28
  52. package/dist/{chunk-WIXGT4TN.js → chunk-A5JJ7XTH.js} +8 -2
  53. package/dist/{chunk-CWI4AJ47.js → chunk-HPET6XY5.js} +13 -9
  54. package/dist/{chunk-A3ISJVEV.js → chunk-HR2KZ3WL.js} +23 -5
  55. package/dist/{chunk-BZMZEFRG.js → chunk-LHR6OHI7.js} +11 -0
  56. package/dist/{chunk-JBG4AR24.js → chunk-Q2P6YLRR.js} +8 -2
  57. package/dist/{chunk-J6ETA476.js → chunk-TVV5YNEC.js} +101 -9
  58. package/dist/console/Command.d.ts +179 -0
  59. package/dist/{ConsoleKernel-CJg975mp.d.ts → console/ConsoleKernel.d.ts} +4 -6
  60. package/dist/console/Input.d.ts +140 -0
  61. package/dist/console/Output.d.ts +161 -0
  62. package/dist/console/index.d.ts +5 -0
  63. package/dist/console/types.d.ts +106 -0
  64. package/dist/container/Container.d.ts +148 -0
  65. package/dist/container/ServiceProvider.d.ts +103 -0
  66. package/dist/container/bindings.d.ts +55 -0
  67. package/dist/container/defineModule.d.ts +88 -0
  68. package/dist/container/definePlugin.d.ts +62 -0
  69. package/dist/container/index.d.ts +8 -0
  70. package/dist/container/types.d.ts +73 -0
  71. package/dist/database/Factory.d.ts +82 -0
  72. package/dist/database/Seeder.d.ts +35 -0
  73. package/dist/database/SeederRunner.d.ts +41 -0
  74. package/dist/database/index.d.ts +4 -0
  75. package/dist/database/types.d.ts +49 -0
  76. package/dist/discovery/AutoDiscovery.d.ts +113 -0
  77. package/dist/discovery/index.d.ts +2 -0
  78. package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +12 -0
  79. package/dist/docs-viewer/endpoint.d.ts +29 -0
  80. package/dist/encryption/Encrypter.d.ts +96 -0
  81. package/dist/encryption/Hash.d.ts +69 -0
  82. package/dist/encryption/MessageSigner.d.ts +21 -0
  83. package/dist/encryption/Random.d.ts +119 -0
  84. package/dist/encryption/app-key.d.ts +12 -0
  85. package/dist/encryption/index.d.ts +10 -222
  86. package/dist/encryption/signed-url.d.ts +9 -0
  87. package/dist/encryption/types.d.ts +103 -0
  88. package/dist/errors/ExceptionHandler.d.ts +118 -0
  89. package/dist/errors/HttpException.d.ts +106 -0
  90. package/dist/errors/debug-page.d.ts +22 -0
  91. package/dist/errors/error-page.d.ts +1 -0
  92. package/dist/errors/exceptions/AuthenticationException.d.ts +32 -0
  93. package/dist/errors/exceptions/AuthorizationException.d.ts +32 -0
  94. package/dist/errors/exceptions/MethodNotAllowedException.d.ts +31 -0
  95. package/dist/errors/exceptions/NotFoundHttpException.d.ts +36 -0
  96. package/dist/errors/exceptions/ValidationException.d.ts +60 -0
  97. package/dist/errors/exceptions/index.d.ts +5 -0
  98. package/dist/errors/index.d.ts +5 -0
  99. package/dist/errors/types.d.ts +43 -0
  100. package/dist/events/Event.d.ts +33 -0
  101. package/dist/{EventManager-CmIoLt7r.d.ts → events/EventManager.d.ts} +4 -86
  102. package/dist/events/Listener.d.ts +79 -0
  103. package/dist/events/builtin.d.ts +73 -0
  104. package/dist/events/index.d.ts +6 -155
  105. package/dist/events/types.d.ts +48 -0
  106. package/dist/facades/index.d.ts +31 -0
  107. package/dist/health/HealthCheck.d.ts +34 -0
  108. package/dist/health/HealthManager.d.ts +53 -0
  109. package/dist/health/checks/CacheCheck.d.ts +35 -0
  110. package/dist/health/checks/CustomCheck.d.ts +23 -0
  111. package/dist/health/checks/DatabaseCheck.d.ts +33 -0
  112. package/dist/health/checks/MemoryCheck.d.ts +32 -0
  113. package/dist/health/checks/RedisCheck.d.ts +27 -0
  114. package/dist/health/checks/StorageCheck.d.ts +35 -0
  115. package/dist/health/checks/index.d.ts +12 -0
  116. package/dist/health/index.d.ts +5 -185
  117. package/dist/health/types.d.ts +52 -0
  118. package/dist/hot-reload/hot-disposables.d.ts +96 -0
  119. package/dist/hot-reload/testing.d.ts +14 -0
  120. package/dist/http/Application.d.ts +199 -0
  121. package/dist/http/FormRequest.d.ts +73 -0
  122. package/dist/http/dev-assets.d.ts +62 -0
  123. package/dist/http/dev-banner.d.ts +7 -0
  124. package/dist/http/inertia-assets.d.ts +31 -0
  125. package/dist/http/middleware/auth.d.ts +13 -0
  126. package/dist/http/middleware/capabilities.d.ts +22 -0
  127. package/dist/http/middleware/cors.d.ts +40 -0
  128. package/dist/http/middleware/csp.d.ts +59 -0
  129. package/dist/http/middleware/csrf.d.ts +121 -0
  130. package/dist/http/middleware/detect-locale.d.ts +65 -0
  131. package/dist/http/middleware/force-https.d.ts +34 -0
  132. package/dist/http/middleware/host-authorization.d.ts +24 -0
  133. package/dist/http/middleware/index.d.ts +19 -0
  134. package/dist/http/middleware/loopback-guard.d.ts +51 -0
  135. package/dist/{rate-limit-D9J2b4S1.d.ts → http/middleware/rate-limit.d.ts} +22 -50
  136. package/dist/http/middleware/redirect-safety.d.ts +29 -0
  137. package/dist/http/middleware/request-id.d.ts +19 -0
  138. package/dist/http/middleware/request-logging.d.ts +16 -0
  139. package/dist/http/middleware/response-headers.d.ts +18 -0
  140. package/dist/http/middleware/security-headers.d.ts +49 -0
  141. package/dist/http/middleware/session.d.ts +93 -0
  142. package/dist/http/middleware/validation.d.ts +94 -0
  143. package/dist/http/public-assets.d.ts +15 -0
  144. package/dist/http/request.d.ts +24 -0
  145. package/dist/http/resources/CursorPaginator.d.ts +106 -0
  146. package/dist/http/resources/Paginator.d.ts +130 -0
  147. package/dist/http/resources/Resource.d.ts +67 -0
  148. package/dist/http/resources/ResourceCollection.d.ts +60 -0
  149. package/dist/http/resources/index.d.ts +6 -0
  150. package/dist/http/resources/types.d.ts +91 -0
  151. package/dist/http/validation/Validator.d.ts +128 -0
  152. package/dist/http/validation/index.d.ts +3 -0
  153. package/dist/http/validation/rules.d.ts +196 -0
  154. package/dist/http/validation/types.d.ts +96 -0
  155. package/dist/http/vite-dev-server.d.ts +27 -0
  156. package/dist/i18n/I18nManager.d.ts +114 -0
  157. package/dist/i18n/Translator.d.ts +80 -0
  158. package/dist/i18n/index.d.ts +6 -101
  159. package/dist/i18n/index.js +5 -3
  160. package/dist/i18n/loaders/JsonLoader.d.ts +47 -0
  161. package/dist/i18n/loaders/MemoryLoader.d.ts +37 -0
  162. package/dist/i18n/pluralization.d.ts +19 -0
  163. package/dist/i18n/types.d.ts +106 -0
  164. package/dist/index.d.ts +69 -2605
  165. package/dist/index.js +405 -180
  166. package/dist/lambda/index.d.ts +17 -37
  167. package/dist/logging/LogManager.d.ts +83 -0
  168. package/dist/logging/Logger.d.ts +76 -0
  169. package/dist/logging/channels/ConsoleChannel.d.ts +11 -0
  170. package/dist/logging/channels/DailyFileChannel.d.ts +20 -0
  171. package/dist/logging/channels/FileChannel.d.ts +15 -0
  172. package/dist/logging/index.d.ts +8 -50
  173. package/dist/logging/types.d.ts +96 -0
  174. package/dist/mail/Mail.d.ts +138 -0
  175. package/dist/mail/MailManager.d.ts +79 -0
  176. package/dist/mail/address.d.ts +8 -0
  177. package/dist/mail/index.d.ts +7 -316
  178. package/dist/mail/transports/LogTransport.d.ts +19 -0
  179. package/dist/mail/transports/MemoryTransport.d.ts +84 -0
  180. package/dist/mail/transports/ResendTransport.d.ts +32 -0
  181. package/dist/mail/transports/SmtpTransport.d.ts +40 -0
  182. package/dist/{MailManager-DpMvYiP9.d.ts → mail/types.d.ts} +11 -92
  183. package/dist/mcp/McpServiceProvider.d.ts +17 -0
  184. package/dist/mcp/create-mcp-server.d.ts +152 -0
  185. package/dist/mcp/endpoint.d.ts +47 -0
  186. package/dist/mcp/index.d.ts +3 -185
  187. package/dist/mcp/index.js +3 -3
  188. package/dist/mvc/Controller.d.ts +326 -0
  189. package/dist/mvc/Router.d.ts +239 -0
  190. package/dist/mvc/ViewEngine.d.ts +11 -0
  191. package/dist/mvc/inertia/InertiaEngine.d.ts +114 -0
  192. package/dist/mvc/inertia/shared.d.ts +90 -0
  193. package/dist/mvc/mount-route.d.ts +10 -0
  194. package/dist/notifications/Notification.d.ts +99 -0
  195. package/dist/notifications/NotificationManager.d.ts +150 -0
  196. package/dist/notifications/channels/DatabaseChannel.d.ts +55 -0
  197. package/dist/notifications/channels/MailChannel.d.ts +45 -0
  198. package/dist/notifications/channels/MemoryChannel.d.ts +85 -0
  199. package/dist/notifications/channels/SlackChannel.d.ts +73 -0
  200. package/dist/notifications/channels/index.d.ts +4 -0
  201. package/dist/notifications/index.d.ts +6 -322
  202. package/dist/notifications/notifiable-type.d.ts +10 -0
  203. package/dist/notifications/registry.d.ts +39 -0
  204. package/dist/notifications/types.d.ts +162 -0
  205. package/dist/providers/AuthServiceProvider.d.ts +7 -0
  206. package/dist/providers/AuthorizationServiceProvider.d.ts +9 -0
  207. package/dist/providers/BroadcastServiceProvider.d.ts +7 -0
  208. package/dist/providers/CacheServiceProvider.d.ts +7 -0
  209. package/dist/providers/EncryptionServiceProvider.d.ts +7 -0
  210. package/dist/providers/ErrorServiceProvider.d.ts +9 -0
  211. package/dist/providers/EventServiceProvider.d.ts +7 -0
  212. package/dist/providers/HealthServiceProvider.d.ts +7 -0
  213. package/dist/providers/I18nServiceProvider.d.ts +27 -0
  214. package/dist/providers/InertiaServiceProvider.d.ts +20 -0
  215. package/dist/providers/LogServiceProvider.d.ts +7 -0
  216. package/dist/providers/MailServiceProvider.d.ts +7 -0
  217. package/dist/providers/NotificationServiceProvider.d.ts +8 -0
  218. package/dist/providers/OAuthServiceProvider.d.ts +7 -0
  219. package/dist/providers/QueueServiceProvider.d.ts +7 -0
  220. package/dist/providers/SchedulingServiceProvider.d.ts +7 -0
  221. package/dist/providers/StorageServiceProvider.d.ts +7 -0
  222. package/dist/providers/index.d.ts +17 -0
  223. package/dist/queue/FailedJobReporter.d.ts +40 -0
  224. package/dist/queue/Job.d.ts +140 -0
  225. package/dist/queue/QueueManager.d.ts +79 -0
  226. package/dist/queue/Worker.d.ts +99 -0
  227. package/dist/queue/drivers/MemoryDriver.d.ts +60 -0
  228. package/dist/queue/drivers/RedisDriver.d.ts +96 -0
  229. package/dist/queue/drivers/SqsDriver.d.ts +108 -0
  230. package/dist/queue/drivers/SyncDriver.d.ts +28 -0
  231. package/dist/queue/index.d.ts +9 -453
  232. package/dist/queue/types.d.ts +171 -0
  233. package/dist/redis/RedisApiTokenStore.d.ts +78 -0
  234. package/dist/redis/RedisEmailVerificationStore.d.ts +54 -0
  235. package/dist/redis/RedisOAuthStateStore.d.ts +26 -0
  236. package/dist/redis/RedisPasswordResetStore.d.ts +57 -0
  237. package/dist/redis/RedisRateLimitStore.d.ts +77 -0
  238. package/dist/redis/RedisSessionStore.d.ts +61 -0
  239. package/dist/redis/client.d.ts +41 -0
  240. package/dist/redis/index.d.ts +14 -356
  241. package/dist/redis/index.js +45 -9
  242. package/dist/redis/redis-values.d.ts +17 -0
  243. package/dist/redis/scan-keys.d.ts +6 -0
  244. package/dist/runtime/index.d.ts +8 -95
  245. package/dist/runtime/index.js +101 -68
  246. package/dist/scheduling/CronParser.d.ts +37 -0
  247. package/dist/scheduling/Schedule.d.ts +229 -0
  248. package/dist/scheduling/ScheduledTask.d.ts +47 -0
  249. package/dist/scheduling/Scheduler.d.ts +99 -0
  250. package/dist/scheduling/index.d.ts +5 -41
  251. package/dist/scheduling/types.d.ts +97 -0
  252. package/dist/storage/StorageManager.d.ts +65 -0
  253. package/dist/storage/drivers/LocalDriver.d.ts +55 -0
  254. package/dist/storage/drivers/MemoryDriver.d.ts +66 -0
  255. package/dist/storage/drivers/S3Driver.d.ts +72 -0
  256. package/dist/storage/index.d.ts +5 -197
  257. package/dist/{StorageManager-oZTHqaza.d.ts → storage/types.d.ts} +10 -77
  258. package/dist/support/contained-path.d.ts +26 -0
  259. package/dist/support/error-polyfill.d.ts +9 -0
  260. package/dist/support/expiry.d.ts +47 -0
  261. package/dist/support/expiry.js +12 -0
  262. package/dist/support/import-map.d.ts +13 -0
  263. package/dist/support/redirect-target.d.ts +11 -0
  264. package/dist/support/stack-frames.d.ts +56 -0
  265. package/dist/support/trim-slashes.d.ts +11 -0
  266. package/dist/vite/index.d.ts +2 -35
  267. package/dist/vite/index.js +0 -3
  268. package/dist/vite/plugin.d.ts +34 -0
  269. package/package.json +7 -3
  270. package/dist/AuthManager-DBP4KYsx.d.ts +0 -79
  271. package/dist/BroadcastManager-D8KoJxiV.d.ts +0 -492
  272. package/dist/HealthManager-DUyMIzsZ.d.ts +0 -141
  273. package/dist/I18nManager-BiSoczfV.d.ts +0 -275
  274. package/dist/LogManager-7mxnkaPM.d.ts +0 -256
  275. package/dist/McpServiceProvider-7BB5FPF3.js +0 -8
  276. package/dist/Scheduler-pZiT8i57.d.ts +0 -471
  277. package/dist/api-token-D24VPr_E.d.ts +0 -663
  278. package/dist/app-key-CsBfRC_Q.d.ts +0 -214
  279. package/dist/email-verification-Dx426KLn.d.ts +0 -336
  280. package/dist/index-9_Jzj5jo.d.ts +0 -7
  281. package/dist/validation-yAL53e1S.d.ts +0 -2610
@@ -0,0 +1,73 @@
1
+ import type { NotificationChannel, Notifiable, SlackMessage } from '../types.js';
2
+ import type { Notification } from '../Notification.js';
3
+ /**
4
+ * Slack notification channel.
5
+ *
6
+ * Sends notifications to Slack via incoming webhooks.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const slackChannel = new SlackChannel('https://hooks.slack.com/services/...')
11
+ * notifications.registerChannel('slack', slackChannel)
12
+ *
13
+ * // In notification class:
14
+ * toSlack(notifiable: Notifiable): SlackMessage {
15
+ * return {
16
+ * text: `Order #${this.order.id} has been shipped!`,
17
+ * blocks: [
18
+ * {
19
+ * type: 'section',
20
+ * text: {
21
+ * type: 'mrkdwn',
22
+ * text: `*Order Shipped*\nOrder #${this.order.id} is on its way!`,
23
+ * },
24
+ * },
25
+ * ],
26
+ * }
27
+ * }
28
+ * ```
29
+ */
30
+ export declare class SlackChannel implements NotificationChannel {
31
+ private webhookUrl;
32
+ private options;
33
+ readonly name = "slack";
34
+ constructor(webhookUrl: string, options?: SlackChannelOptions);
35
+ /**
36
+ * Send the notification to Slack.
37
+ */
38
+ send(notifiable: Notifiable, notification: Notification): Promise<void>;
39
+ /**
40
+ * Build the Slack webhook payload.
41
+ */
42
+ protected buildPayload(message: SlackMessage): SlackWebhookPayload;
43
+ }
44
+ /**
45
+ * Slack channel options.
46
+ */
47
+ export interface SlackChannelOptions {
48
+ /**
49
+ * Default username for messages.
50
+ */
51
+ username?: string;
52
+ /**
53
+ * Default icon emoji for messages.
54
+ */
55
+ iconEmoji?: string;
56
+ /**
57
+ * Default icon URL for messages.
58
+ */
59
+ iconUrl?: string;
60
+ }
61
+ /**
62
+ * Slack webhook payload.
63
+ */
64
+ interface SlackWebhookPayload {
65
+ text?: string;
66
+ blocks?: unknown[];
67
+ attachments?: unknown[];
68
+ channel?: string;
69
+ username?: string;
70
+ icon_emoji?: string;
71
+ icon_url?: string;
72
+ }
73
+ export {};
@@ -0,0 +1,4 @@
1
+ export { MailChannel, type MailChannelOptions } from './MailChannel.js';
2
+ export { DatabaseChannel } from './DatabaseChannel.js';
3
+ export { SlackChannel, type SlackChannelOptions } from './SlackChannel.js';
4
+ export { MemoryChannel } from './MemoryChannel.js';
@@ -1,322 +1,6 @@
1
- import { ab as Notification, aa as Notifiable, ad as NotificationChannel, B as DatabaseNotification, z as DatabaseChannelOptions, aK as SlackMessage, aB as SentNotification } from '../validation-yAL53e1S.js';
2
- export { ac as NotificationAttachment, ae as NotificationChannelFactory, af as NotificationClass, ag as NotificationMailMessage, N as NotificationManager, ah as NotificationManagerOptions, aI as SlackAttachment, aJ as SlackBlock, aY as createNotificationManager, b7 as getNotificationManager, bm as setNotificationManager } from '../validation-yAL53e1S.js';
3
- import { M as MailManager } from '../MailManager-DpMvYiP9.js';
4
- import 'hono';
5
- import '../api-token-D24VPr_E.js';
6
- import '../AuthManager-DBP4KYsx.js';
7
- import '@guren/orm';
8
- import 'vite';
9
- import '../EventManager-CmIoLt7r.js';
10
- import '../CacheManager-BmDzUKrF.js';
11
- import '../LogManager-7mxnkaPM.js';
12
- import '../I18nManager-BiSoczfV.js';
13
- import '../BroadcastManager-D8KoJxiV.js';
14
- import '../index-9_Jzj5jo.js';
15
- import '../app-key-CsBfRC_Q.js';
16
- import '../StorageManager-oZTHqaza.js';
17
- import '../HealthManager-DUyMIzsZ.js';
18
- import '../Scheduler-pZiT8i57.js';
19
- import '../Gate-CynjZCtS.js';
20
-
21
- /**
22
- * A notification class usable for queue reconstruction.
23
- *
24
- * Only the prototype and name are required: queued notifications are rebuilt
25
- * with `Object.create(prototype)` and never constructed, so classes with
26
- * required constructor arguments are supported.
27
- */
28
- interface NotificationConstructor {
29
- readonly name: string;
30
- readonly prototype: Notification;
31
- }
32
- /**
33
- * Register a notification class so queued instances can be rebuilt.
34
- *
35
- * Notifications are registered automatically when they are queued, which
36
- * covers delivery by a worker running in the same process. A worker running
37
- * in a separate process must register them explicitly at boot.
38
- *
39
- * Type names must be unique within an application: as with the job registry,
40
- * registering a second class under an existing type replaces the first.
41
- *
42
- * @param notificationClass - The notification class to register
43
- * @param type - Registry key, defaulting to the class's own `type` value
44
- *
45
- * @example
46
- * ```typescript
47
- * registerNotification(OrderShipped)
48
- * ```
49
- */
50
- declare function registerNotification(notificationClass: NotificationConstructor, type?: string): void;
51
- /**
52
- * Get a registered notification class by type.
53
- */
54
- declare function getNotification(type: string): NotificationConstructor | undefined;
55
- /**
56
- * Clear all registered notifications (for testing).
57
- */
58
- declare function clearNotificationRegistry(): void;
59
-
60
- /**
61
- * Resolve the stable type name of a notifiable.
62
- *
63
- * Channels that record which entity a notification belongs to should use this
64
- * rather than reading `constructor.name` directly: a notifiable rebuilt from a
65
- * queue payload carries its original name in `notifiableType`, and its
66
- * constructor is a plain object.
67
- */
68
- declare function resolveNotifiableType(notifiable: Notifiable): string;
69
-
70
- /**
71
- * Mail notification channel.
72
- *
73
- * Sends notifications via email using the MailManager.
74
- *
75
- * @example
76
- * ```typescript
77
- * const mailChannel = new MailChannel(mailManager)
78
- * notifications.registerChannel('mail', mailChannel)
79
- *
80
- * // In notification class:
81
- * toMail(notifiable: Notifiable): NotificationMailMessage {
82
- * return {
83
- * subject: 'Order Shipped',
84
- * html: '<p>Your order has shipped!</p>',
85
- * }
86
- * }
87
- * ```
88
- */
89
- declare class MailChannel implements NotificationChannel {
90
- private mailManager;
91
- private options;
92
- readonly name = "mail";
93
- constructor(mailManager: MailManager, options?: MailChannelOptions);
94
- /**
95
- * Send the notification via mail.
96
- */
97
- send(notifiable: Notifiable, notification: Notification): Promise<void>;
98
- }
99
- /**
100
- * Mail channel options.
101
- */
102
- interface MailChannelOptions {
103
- /**
104
- * Default from address.
105
- */
106
- from?: string;
107
- /**
108
- * Transport name to use.
109
- */
110
- transport?: string;
111
- }
112
-
113
- /**
114
- * Database notification channel.
115
- *
116
- * Stores notifications in the database for in-app notifications.
117
- *
118
- * @example
119
- * ```typescript
120
- * const dbChannel = new DatabaseChannel({
121
- * store: async (notifiable, notification) => {
122
- * await db.insert(notifications).values(notification)
123
- * },
124
- * })
125
- * notifications.registerChannel('database', dbChannel)
126
- *
127
- * // In notification class:
128
- * toDatabase(notifiable: Notifiable): Record<string, unknown> {
129
- * return {
130
- * orderId: this.order.id,
131
- * message: 'Your order has shipped',
132
- * }
133
- * }
134
- * ```
135
- */
136
- declare class DatabaseChannel implements NotificationChannel {
137
- private options;
138
- readonly name = "database";
139
- protected stored: DatabaseNotification[];
140
- constructor(options?: DatabaseChannelOptions);
141
- /**
142
- * Send the notification to the database.
143
- */
144
- send(notifiable: Notifiable, notification: Notification): Promise<void>;
145
- /**
146
- * Get the notifiable ID.
147
- */
148
- protected getNotifiableId(notifiable: Notifiable): string | number;
149
- /**
150
- * Get the notifiable type.
151
- */
152
- protected getNotifiableType(notifiable: Notifiable): string;
153
- /**
154
- * Get all stored notifications (for testing).
155
- */
156
- getStored(): DatabaseNotification[];
157
- /**
158
- * Get stored notifications for a notifiable.
159
- */
160
- getStoredFor(notifiable: Notifiable): DatabaseNotification[];
161
- /**
162
- * Clear stored notifications (for testing).
163
- */
164
- clear(): void;
165
- }
166
-
167
- /**
168
- * Slack notification channel.
169
- *
170
- * Sends notifications to Slack via incoming webhooks.
171
- *
172
- * @example
173
- * ```typescript
174
- * const slackChannel = new SlackChannel('https://hooks.slack.com/services/...')
175
- * notifications.registerChannel('slack', slackChannel)
176
- *
177
- * // In notification class:
178
- * toSlack(notifiable: Notifiable): SlackMessage {
179
- * return {
180
- * text: `Order #${this.order.id} has been shipped!`,
181
- * blocks: [
182
- * {
183
- * type: 'section',
184
- * text: {
185
- * type: 'mrkdwn',
186
- * text: `*Order Shipped*\nOrder #${this.order.id} is on its way!`,
187
- * },
188
- * },
189
- * ],
190
- * }
191
- * }
192
- * ```
193
- */
194
- declare class SlackChannel implements NotificationChannel {
195
- private webhookUrl;
196
- private options;
197
- readonly name = "slack";
198
- constructor(webhookUrl: string, options?: SlackChannelOptions);
199
- /**
200
- * Send the notification to Slack.
201
- */
202
- send(notifiable: Notifiable, notification: Notification): Promise<void>;
203
- /**
204
- * Build the Slack webhook payload.
205
- */
206
- protected buildPayload(message: SlackMessage): SlackWebhookPayload;
207
- }
208
- /**
209
- * Slack channel options.
210
- */
211
- interface SlackChannelOptions {
212
- /**
213
- * Default username for messages.
214
- */
215
- username?: string;
216
- /**
217
- * Default icon emoji for messages.
218
- */
219
- iconEmoji?: string;
220
- /**
221
- * Default icon URL for messages.
222
- */
223
- iconUrl?: string;
224
- }
225
- /**
226
- * Slack webhook payload.
227
- */
228
- interface SlackWebhookPayload {
229
- text?: string;
230
- blocks?: unknown[];
231
- attachments?: unknown[];
232
- channel?: string;
233
- username?: string;
234
- icon_emoji?: string;
235
- icon_url?: string;
236
- }
237
-
238
- /**
239
- * Memory notification channel for testing.
240
- *
241
- * Stores all sent notifications in memory for assertions.
242
- *
243
- * @example
244
- * ```typescript
245
- * const memoryChannel = new MemoryChannel()
246
- * notifications.registerChannel('memory', memoryChannel)
247
- *
248
- * await notifications.send(user, new OrderShipped(order))
249
- *
250
- * memoryChannel.assertSentTo(user, 'OrderShipped')
251
- * memoryChannel.assertCount(1)
252
- * ```
253
- */
254
- declare class MemoryChannel implements NotificationChannel {
255
- readonly name = "memory";
256
- /**
257
- * All sent notifications.
258
- */
259
- sent: SentNotification[];
260
- /**
261
- * Send (store) the notification.
262
- */
263
- send(notifiable: Notifiable, notification: Notification): Promise<void>;
264
- /**
265
- * Assert that a notification was sent to a notifiable.
266
- */
267
- assertSentTo(notifiable: Notifiable, notificationType?: string): void;
268
- /**
269
- * Assert that a notification was not sent to a notifiable.
270
- */
271
- assertNotSentTo(notifiable: Notifiable, notificationType?: string): void;
272
- /**
273
- * Assert the total count of sent notifications.
274
- */
275
- assertCount(count: number): void;
276
- /**
277
- * Assert that a notification type was sent.
278
- */
279
- assertSent(notificationType: string): void;
280
- /**
281
- * Assert that a notification type was not sent.
282
- */
283
- assertNotSent(notificationType: string): void;
284
- /**
285
- * Assert that no notifications were sent.
286
- */
287
- assertNothingSent(): void;
288
- /**
289
- * Get notifications sent to a specific notifiable.
290
- */
291
- getSentTo(notifiable: Notifiable): SentNotification[];
292
- /**
293
- * Get notifications of a specific type.
294
- */
295
- getSentOfType(notificationType: string): SentNotification[];
296
- /**
297
- * Check if a notification was sent to a notifiable.
298
- */
299
- hasSentTo(notifiable: Notifiable, notificationType?: string): boolean;
300
- /**
301
- * Check if a notification type was sent.
302
- */
303
- hasSent(notificationType: string): boolean;
304
- /**
305
- * Get the count of sent notifications.
306
- */
307
- count(): number;
308
- /**
309
- * Get the last sent notification.
310
- */
311
- last(): SentNotification | undefined;
312
- /**
313
- * Get the first sent notification.
314
- */
315
- first(): SentNotification | undefined;
316
- /**
317
- * Clear all sent notifications.
318
- */
319
- clear(): void;
320
- }
321
-
322
- export { DatabaseChannel, DatabaseChannelOptions, DatabaseNotification, MailChannel, type MailChannelOptions, MemoryChannel, Notifiable, Notification, NotificationChannel, type NotificationConstructor, SentNotification, SlackChannel, type SlackChannelOptions, SlackMessage, clearNotificationRegistry, getNotification, registerNotification, resolveNotifiableType };
1
+ export type { NotificationChannel, Notifiable, DatabaseNotification, NotificationMailMessage, NotificationAttachment, SlackMessage, SlackBlock, SlackAttachment, NotificationChannelFactory, NotificationManagerOptions, DatabaseChannelOptions, SentNotification, NotificationClass, } from './types.js';
2
+ export { Notification } from './Notification.js';
3
+ export { NotificationManager, setNotificationManager, getNotificationManager, createNotificationManager, } from './NotificationManager.js';
4
+ export { registerNotification, getNotification, clearNotificationRegistry, type NotificationConstructor, } from './registry.js';
5
+ export { resolveNotifiableType } from './notifiable-type.js';
6
+ export { MailChannel, type MailChannelOptions, DatabaseChannel, SlackChannel, type SlackChannelOptions, MemoryChannel, } from './channels/index.js';
@@ -0,0 +1,10 @@
1
+ import type { Notifiable } from './types.js';
2
+ /**
3
+ * Resolve the stable type name of a notifiable.
4
+ *
5
+ * Channels that record which entity a notification belongs to should use this
6
+ * rather than reading `constructor.name` directly: a notifiable rebuilt from a
7
+ * queue payload carries its original name in `notifiableType`, and its
8
+ * constructor is a plain object.
9
+ */
10
+ export declare function resolveNotifiableType(notifiable: Notifiable): string;
@@ -0,0 +1,39 @@
1
+ import type { Notification } from './Notification.js';
2
+ /**
3
+ * A notification class usable for queue reconstruction.
4
+ *
5
+ * Only the prototype and name are required: queued notifications are rebuilt
6
+ * with `Object.create(prototype)` and never constructed, so classes with
7
+ * required constructor arguments are supported.
8
+ */
9
+ export interface NotificationConstructor {
10
+ readonly name: string;
11
+ readonly prototype: Notification;
12
+ }
13
+ /**
14
+ * Register a notification class so queued instances can be rebuilt.
15
+ *
16
+ * Notifications are registered automatically when they are queued, which
17
+ * covers delivery by a worker running in the same process. A worker running
18
+ * in a separate process must register them explicitly at boot.
19
+ *
20
+ * Type names must be unique within an application: as with the job registry,
21
+ * registering a second class under an existing type replaces the first.
22
+ *
23
+ * @param notificationClass - The notification class to register
24
+ * @param type - Registry key, defaulting to the class's own `type` value
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * registerNotification(OrderShipped)
29
+ * ```
30
+ */
31
+ export declare function registerNotification(notificationClass: NotificationConstructor, type?: string): void;
32
+ /**
33
+ * Get a registered notification class by type.
34
+ */
35
+ export declare function getNotification(type: string): NotificationConstructor | undefined;
36
+ /**
37
+ * Clear all registered notifications (for testing).
38
+ */
39
+ export declare function clearNotificationRegistry(): void;
@@ -0,0 +1,162 @@
1
+ import type { Notification } from './Notification.js';
2
+ /**
3
+ * Notification channel interface.
4
+ */
5
+ export interface NotificationChannel {
6
+ readonly name: string;
7
+ send(notifiable: Notifiable, notification: Notification): Promise<void>;
8
+ }
9
+ /**
10
+ * Notifiable entity interface.
11
+ */
12
+ export interface Notifiable {
13
+ /**
14
+ * Get the notification routing information for a given channel.
15
+ */
16
+ routeNotificationFor(channel: string): string | null;
17
+ /**
18
+ * Stable type name for this notifiable (optional).
19
+ *
20
+ * Defaults to the constructor name. Set this when the notifiable is rebuilt
21
+ * from a queue payload, or when the class name is not durable (bundlers that
22
+ * mangle identifiers).
23
+ */
24
+ notifiableType?: string;
25
+ /**
26
+ * Database notifications (optional).
27
+ */
28
+ notifications?: DatabaseNotification[];
29
+ }
30
+ /**
31
+ * Database notification record.
32
+ */
33
+ export interface DatabaseNotification {
34
+ id: string;
35
+ type: string;
36
+ notifiableId: string | number;
37
+ notifiableType: string;
38
+ data: Record<string, unknown>;
39
+ readAt: Date | null;
40
+ createdAt: Date;
41
+ }
42
+ /**
43
+ * Mail message for notifications.
44
+ */
45
+ export interface NotificationMailMessage {
46
+ subject: string;
47
+ html?: string;
48
+ text?: string;
49
+ from?: string;
50
+ replyTo?: string;
51
+ cc?: string | string[];
52
+ bcc?: string | string[];
53
+ attachments?: NotificationAttachment[];
54
+ }
55
+ /**
56
+ * Notification attachment.
57
+ */
58
+ export interface NotificationAttachment {
59
+ filename: string;
60
+ content?: string | Buffer;
61
+ path?: string;
62
+ contentType?: string;
63
+ }
64
+ /**
65
+ * Slack message for notifications.
66
+ */
67
+ export interface SlackMessage {
68
+ text?: string;
69
+ blocks?: SlackBlock[];
70
+ attachments?: SlackAttachment[];
71
+ channel?: string;
72
+ username?: string;
73
+ icon_emoji?: string;
74
+ icon_url?: string;
75
+ }
76
+ /**
77
+ * Slack block.
78
+ */
79
+ export interface SlackBlock {
80
+ type: string;
81
+ text?: {
82
+ type: string;
83
+ text: string;
84
+ emoji?: boolean;
85
+ };
86
+ elements?: unknown[];
87
+ accessory?: unknown;
88
+ fields?: Array<{
89
+ type: string;
90
+ text: string;
91
+ }>;
92
+ [key: string]: unknown;
93
+ }
94
+ /**
95
+ * Slack attachment.
96
+ */
97
+ export interface SlackAttachment {
98
+ color?: string;
99
+ fallback?: string;
100
+ pretext?: string;
101
+ author_name?: string;
102
+ author_link?: string;
103
+ author_icon?: string;
104
+ title?: string;
105
+ title_link?: string;
106
+ text?: string;
107
+ fields?: Array<{
108
+ title: string;
109
+ value: string;
110
+ short?: boolean;
111
+ }>;
112
+ image_url?: string;
113
+ thumb_url?: string;
114
+ footer?: string;
115
+ footer_icon?: string;
116
+ ts?: number;
117
+ }
118
+ /**
119
+ * Notification channel factory.
120
+ */
121
+ export interface NotificationChannelFactory {
122
+ (config: Record<string, unknown>): NotificationChannel;
123
+ }
124
+ /**
125
+ * Notification manager options.
126
+ */
127
+ export interface NotificationManagerOptions {
128
+ channels?: Record<string, NotificationChannel>;
129
+ channelFactories?: Record<string, NotificationChannelFactory>;
130
+ }
131
+ /**
132
+ * Database channel options.
133
+ */
134
+ export interface DatabaseChannelOptions {
135
+ /**
136
+ * Callback to store the notification.
137
+ */
138
+ store?: (notifiable: Notifiable, notification: DatabaseNotification) => Promise<void>;
139
+ }
140
+ /**
141
+ * Sent notification record (for testing).
142
+ */
143
+ export interface SentNotification {
144
+ notifiable: Notifiable;
145
+ notification: Notification;
146
+ channels: string[];
147
+ timestamp: Date;
148
+ }
149
+ /**
150
+ * Notification class type.
151
+ */
152
+ export interface NotificationClass<T extends Notification = Notification> {
153
+ new (...args: unknown[]): T;
154
+ shouldQueue?: boolean;
155
+ queue?: string;
156
+ delay?: number;
157
+ getQueueConfig?: () => {
158
+ shouldQueue: boolean;
159
+ queue?: string;
160
+ delay?: number;
161
+ };
162
+ }
@@ -0,0 +1,7 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Sets up authentication guards, session middleware, and auth context.
4
+ */
5
+ export declare class AuthServiceProvider extends ServiceProvider {
6
+ register(): void;
7
+ }
@@ -0,0 +1,9 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Binds the Gate as a singleton in the container and exposes it as the
4
+ * global gate so `getGate()`, `can()`, and controller authorization helpers
5
+ * work without manual wiring.
6
+ */
7
+ export declare class AuthorizationServiceProvider extends ServiceProvider {
8
+ register(): void;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Binds the BroadcastManager as a singleton in the container.
4
+ */
5
+ export declare class BroadcastServiceProvider extends ServiceProvider {
6
+ register(): void;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Binds the CacheManager as a singleton in the container.
4
+ */
5
+ export declare class CacheServiceProvider extends ServiceProvider {
6
+ register(): void;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Binds the Encrypter as a singleton in the container.
4
+ */
5
+ export declare class EncryptionServiceProvider extends ServiceProvider {
6
+ register(): void;
7
+ }
@@ -0,0 +1,9 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Binds the ExceptionHandler as a singleton in the container
4
+ * and attaches it as global error-handling middleware.
5
+ */
6
+ export declare class ErrorServiceProvider extends ServiceProvider {
7
+ register(): void;
8
+ boot(): void;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Binds the EventManager as a singleton in the container.
4
+ */
5
+ export declare class EventServiceProvider extends ServiceProvider {
6
+ register(): void;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { ServiceProvider } from '../container/ServiceProvider.js';
2
+ /**
3
+ * Binds the HealthManager as a singleton in the container.
4
+ */
5
+ export declare class HealthServiceProvider extends ServiceProvider {
6
+ register(): void;
7
+ }