@guren/server 2.14.0 → 2.16.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 (297) hide show
  1. package/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
  2. package/dist/{Hash-CzrwKeDp.js → Hash-D2DFd8xX.js} +12 -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-nNcbCIQX.js} +11 -20
  6. package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
  7. package/dist/agent/AgentApprovalRequested.d.ts +31 -0
  8. package/dist/agent/approval.d.ts +184 -0
  9. package/dist/agent/audit-emitter.d.ts +36 -0
  10. package/dist/agent/audit.d.ts +67 -0
  11. package/dist/agent/derive.d.ts +32 -66
  12. package/dist/agent/dispatch.d.ts +53 -63
  13. package/dist/agent/events.d.ts +11 -19
  14. package/dist/agent/meta-tools.d.ts +34 -0
  15. package/dist/agent/public.d.ts +14 -0
  16. package/dist/agent/public.js +2 -0
  17. package/dist/agent/redact.d.ts +16 -38
  18. package/dist/agent/scopes.d.ts +23 -69
  19. package/dist/auth/AuthManager.d.ts +19 -40
  20. package/dist/auth/AuthenticatableModel.d.ts +2 -2
  21. package/dist/auth/SessionGuard.d.ts +0 -1
  22. package/dist/auth/TokenGuard.d.ts +6 -26
  23. package/dist/auth/api-token.d.ts +16 -148
  24. package/dist/auth/context.d.ts +5 -10
  25. package/dist/auth/email-verification.d.ts +29 -127
  26. package/dist/auth/index.js +1 -1
  27. package/dist/auth/oauth/index.d.ts +35 -57
  28. package/dist/auth/password/DefaultHasher.d.ts +9 -5
  29. package/dist/auth/password/PasswordHasher.d.ts +7 -0
  30. package/dist/auth/password/hash-format.d.ts +11 -0
  31. package/dist/auth/password-reset.d.ts +16 -42
  32. package/dist/auth/providers/ModelUserProvider.d.ts +3 -4
  33. package/dist/auth/providers/UserProvider.d.ts +4 -4
  34. package/dist/auth/signed-token.d.ts +18 -0
  35. package/dist/auth/types.d.ts +9 -32
  36. package/dist/auth/utils.d.ts +6 -27
  37. package/dist/{auth-BSUc14CD.js → auth-CbdPH4Cd.js} +252 -496
  38. package/dist/authorization/Gate.d.ts +9 -145
  39. package/dist/authorization/Policy.d.ts +6 -53
  40. package/dist/authorization/index.js +1 -1
  41. package/dist/authorization/middleware.d.ts +16 -62
  42. package/dist/authorization/types.d.ts +8 -64
  43. package/dist/{authorization-CdfbCj8J.js → authorization-CdEWZZw3.js} +44 -309
  44. package/dist/broadcasting/BroadcastManager.d.ts +29 -149
  45. package/dist/broadcasting/channels/Channel.d.ts +1 -19
  46. package/dist/broadcasting/channels/PresenceChannel.d.ts +1 -55
  47. package/dist/broadcasting/channels/PrivateChannel.d.ts +1 -23
  48. package/dist/broadcasting/drivers/MemoryDriver.d.ts +18 -70
  49. package/dist/broadcasting/drivers/RedisDriver.d.ts +3 -80
  50. package/dist/broadcasting/drivers/index.d.ts +1 -1
  51. package/dist/broadcasting/index.d.ts +1 -1
  52. package/dist/broadcasting/index.js +1 -1
  53. package/dist/broadcasting/types.d.ts +7 -88
  54. package/dist/{broadcasting-BxU-LIfF.js → broadcasting-B5RzB0A2.js} +87 -414
  55. package/dist/cache/CacheManager.d.ts +8 -62
  56. package/dist/cache/TaggedCache.d.ts +2 -35
  57. package/dist/cache/index.js +1 -1
  58. package/dist/cache/stores/FileStore.d.ts +2 -36
  59. package/dist/cache/stores/MemoryStore.d.ts +2 -26
  60. package/dist/cache/stores/RedisStore.d.ts +1 -29
  61. package/dist/cache/types.d.ts +21 -128
  62. package/dist/{cache-BYnZf2FR.js → cache-BOOIr324.js} +19 -198
  63. package/dist/client-C4TEr_Dd.js +9 -0
  64. package/dist/console/Command.d.ts +17 -126
  65. package/dist/console/ConsoleKernel.d.ts +2 -74
  66. package/dist/console/Input.d.ts +5 -113
  67. package/dist/console/Output.d.ts +3 -99
  68. package/dist/console/types.d.ts +3 -33
  69. package/dist/container/Container.d.ts +12 -103
  70. package/dist/container/ServiceProvider.d.ts +17 -61
  71. package/dist/container/bindings.d.ts +10 -12
  72. package/dist/container/defineModule.d.ts +16 -54
  73. package/dist/container/definePlugin.d.ts +12 -45
  74. package/dist/container/types.d.ts +2 -34
  75. package/dist/context-CXk_umpT.js +21 -0
  76. package/dist/database/Factory.d.ts +4 -57
  77. package/dist/database/Seeder.d.ts +8 -46
  78. package/dist/database/SeederRunner.d.ts +3 -33
  79. package/dist/database/types.d.ts +3 -24
  80. package/dist/discovery/AutoDiscovery.d.ts +10 -82
  81. package/dist/dispatch-BAwzftws.js +238 -0
  82. package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +2 -5
  83. package/dist/docs-viewer/endpoint.d.ts +5 -11
  84. package/dist/encryption/Encrypter.d.ts +5 -71
  85. package/dist/encryption/Hash.d.ts +7 -57
  86. package/dist/encryption/Random.d.ts +6 -99
  87. package/dist/encryption/index.js +3 -3
  88. package/dist/encryption/types.d.ts +10 -72
  89. package/dist/{encryption-DJtkkhiw.js → encryption-uwP3Di4D.js} +13 -79
  90. package/dist/{endpoint-D6GIqOpe.js → endpoint-BXipU2Jj.js} +6 -12
  91. package/dist/endpoint-Dsw3Acvq.js +26 -0
  92. package/dist/errors/ExceptionHandler.d.ts +3 -90
  93. package/dist/errors/HttpException.d.ts +2 -79
  94. package/dist/errors/debug-page.d.ts +3 -17
  95. package/dist/errors/error-page.d.ts +1 -0
  96. package/dist/errors/exceptions/AuthenticationException.d.ts +2 -24
  97. package/dist/errors/exceptions/AuthorizationException.d.ts +1 -24
  98. package/dist/errors/exceptions/MethodNotAllowedException.d.ts +1 -23
  99. package/dist/errors/exceptions/NotFoundHttpException.d.ts +1 -27
  100. package/dist/errors/exceptions/ValidationException.d.ts +2 -43
  101. package/dist/errors/types.d.ts +1 -25
  102. package/dist/{errors-BgeOl_DC.js → errors-JpkcCjjn.js} +3 -41
  103. package/dist/events/Event.d.ts +1 -28
  104. package/dist/events/EventManager.d.ts +5 -107
  105. package/dist/events/Listener.d.ts +7 -55
  106. package/dist/events/builtin.d.ts +0 -24
  107. package/dist/events/index.js +1 -1
  108. package/dist/events/types.d.ts +4 -22
  109. package/dist/{events-aIH_bWRx.js → events-DOmAHDeP.js} +11 -191
  110. package/dist/facades/index.d.ts +2 -14
  111. package/dist/health/HealthCheck.d.ts +0 -24
  112. package/dist/health/HealthManager.d.ts +0 -36
  113. package/dist/health/checks/CacheCheck.d.ts +2 -17
  114. package/dist/health/checks/CustomCheck.d.ts +0 -9
  115. package/dist/health/checks/DatabaseCheck.d.ts +2 -17
  116. package/dist/health/checks/MemoryCheck.d.ts +3 -12
  117. package/dist/health/checks/RedisCheck.d.ts +1 -13
  118. package/dist/health/checks/StorageCheck.d.ts +2 -17
  119. package/dist/health/index.js +1 -1
  120. package/dist/health/types.d.ts +4 -24
  121. package/dist/{health-VWdWXRwh.js → health-DQSvUplL.js} +1 -76
  122. package/dist/hot-disposables-B5BXqaIH.js +167 -0
  123. package/dist/hot-reload/hot-disposables.d.ts +22 -74
  124. package/dist/hot-reload/testing.d.ts +4 -9
  125. package/dist/http/Application.d.ts +62 -208
  126. package/dist/http/FormRequest.d.ts +4 -55
  127. package/dist/http/dev-assets.d.ts +16 -18
  128. package/dist/http/dev-banner.d.ts +2 -5
  129. package/dist/http/inertia-assets.d.ts +3 -6
  130. package/dist/http/middleware/capabilities.d.ts +27 -50
  131. package/dist/http/middleware/cors.d.ts +4 -29
  132. package/dist/http/middleware/csp.d.ts +2 -25
  133. package/dist/http/middleware/csrf.d.ts +20 -95
  134. package/dist/http/middleware/detect-locale.d.ts +7 -27
  135. package/dist/http/middleware/force-https.d.ts +6 -24
  136. package/dist/http/middleware/host-authorization.d.ts +2 -12
  137. package/dist/http/middleware/loopback-guard.d.ts +15 -33
  138. package/dist/http/middleware/rate-limit.d.ts +29 -126
  139. package/dist/http/middleware/redirect-safety.d.ts +2 -20
  140. package/dist/http/middleware/request-id.d.ts +1 -14
  141. package/dist/http/middleware/request-logging.d.ts +2 -13
  142. package/dist/http/middleware/response-headers.d.ts +5 -13
  143. package/dist/http/middleware/security-headers.d.ts +2 -16
  144. package/dist/http/middleware/session.d.ts +15 -34
  145. package/dist/http/middleware/validation-errors-cookie.d.ts +7 -18
  146. package/dist/http/middleware/validation.d.ts +8 -63
  147. package/dist/http/public-assets.d.ts +14 -0
  148. package/dist/http/request.d.ts +49 -48
  149. package/dist/http/resources/CursorPaginator.d.ts +5 -64
  150. package/dist/http/resources/Paginator.d.ts +7 -84
  151. package/dist/http/resources/Resource.d.ts +9 -65
  152. package/dist/http/resources/ResourceCollection.d.ts +5 -39
  153. package/dist/http/resources/types.d.ts +10 -30
  154. package/dist/http/static-documents.d.ts +21 -0
  155. package/dist/http/validation/Validator.d.ts +25 -85
  156. package/dist/http/validation/rules.d.ts +48 -147
  157. package/dist/http/validation/types.d.ts +16 -61
  158. package/dist/http/vite-assets.d.ts +5 -28
  159. package/dist/http/vite-dev-server.d.ts +6 -9
  160. package/dist/http/vite-manifest.d.ts +19 -33
  161. package/dist/i18n/I18nManager.d.ts +12 -78
  162. package/dist/i18n/Translator.d.ts +3 -54
  163. package/dist/i18n/index.js +1 -1
  164. package/dist/i18n/loaders/JsonLoader.d.ts +4 -31
  165. package/dist/i18n/loaders/MemoryLoader.d.ts +1 -21
  166. package/dist/i18n/pluralization.d.ts +4 -13
  167. package/dist/i18n/types.d.ts +17 -69
  168. package/dist/{i18n-mcWi7LCd.js → i18n-Cg1aajRP.js} +31 -225
  169. package/dist/index.d.ts +13 -4
  170. package/dist/index.js +1036 -3080
  171. package/dist/internal/agent-preflight.d.ts +9 -21
  172. package/dist/internal/request.d.ts +10 -17
  173. package/dist/internal/request.js +2 -2
  174. package/dist/internal/route-path.d.ts +9 -21
  175. package/dist/internal/route-path.js +9 -21
  176. package/dist/internal/zod-compat.d.ts +55 -122
  177. package/dist/internal/zod-compat.js +39 -70
  178. package/dist/internal/zod-json-schema.d.ts +18 -54
  179. package/dist/internal/zod-json-schema.js +46 -123
  180. package/dist/jsx-runtime.d.ts +3 -8
  181. package/dist/lambda/index.d.ts +17 -79
  182. package/dist/lambda/index.js +11 -59
  183. package/dist/logging/LogManager.d.ts +1 -51
  184. package/dist/logging/Logger.d.ts +8 -47
  185. package/dist/logging/channels/ConsoleChannel.d.ts +1 -3
  186. package/dist/logging/channels/DailyFileChannel.d.ts +1 -5
  187. package/dist/logging/channels/FileChannel.d.ts +1 -3
  188. package/dist/logging/daily-file-path.d.ts +15 -0
  189. package/dist/logging/index.d.ts +1 -0
  190. package/dist/logging/index.js +2 -2
  191. package/dist/logging/types.d.ts +13 -45
  192. package/dist/{logging-CPaRMuPP.js → logging-zOY1XCtq.js} +83 -129
  193. package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
  194. package/dist/mail/Mail.d.ts +10 -106
  195. package/dist/mail/MailManager.d.ts +2 -60
  196. package/dist/mail/index.js +1 -1
  197. package/dist/mail/transports/LogTransport.d.ts +1 -4
  198. package/dist/mail/transports/MemoryTransport.d.ts +1 -63
  199. package/dist/mail/transports/ResendTransport.d.ts +1 -23
  200. package/dist/mail/transports/SmtpTransport.d.ts +1 -31
  201. package/dist/mail/types.d.ts +28 -150
  202. package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
  203. package/dist/mcp/McpServiceProvider.d.ts +4 -10
  204. package/dist/mcp/create-mcp-server.d.ts +25 -57
  205. package/dist/mcp/endpoint.d.ts +12 -36
  206. package/dist/mcp/index.js +1 -1
  207. package/dist/mvc/Controller.d.ts +46 -253
  208. package/dist/mvc/Router.d.ts +50 -129
  209. package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
  210. package/dist/mvc/inertia/shared.d.ts +6 -19
  211. package/dist/mvc/mount-route.d.ts +2 -6
  212. package/dist/mvc/view.d.ts +1 -2
  213. package/dist/notifications/Notification.d.ts +8 -75
  214. package/dist/notifications/NotificationManager.d.ts +15 -88
  215. package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
  216. package/dist/notifications/channels/MailChannel.d.ts +2 -31
  217. package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
  218. package/dist/notifications/channels/SlackChannel.d.ts +3 -48
  219. package/dist/notifications/index.js +1 -1
  220. package/dist/notifications/notifiable-type.d.ts +3 -6
  221. package/dist/notifications/registry.d.ts +8 -27
  222. package/dist/notifications/types.d.ts +16 -53
  223. package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
  224. package/dist/providers/AuthServiceProvider.d.ts +1 -3
  225. package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
  226. package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
  227. package/dist/providers/CacheServiceProvider.d.ts +1 -3
  228. package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
  229. package/dist/providers/ErrorServiceProvider.d.ts +1 -4
  230. package/dist/providers/EventServiceProvider.d.ts +1 -3
  231. package/dist/providers/HealthServiceProvider.d.ts +1 -3
  232. package/dist/providers/I18nServiceProvider.d.ts +6 -10
  233. package/dist/providers/InertiaServiceProvider.d.ts +1 -4
  234. package/dist/providers/LogServiceProvider.d.ts +1 -3
  235. package/dist/providers/MailServiceProvider.d.ts +1 -3
  236. package/dist/providers/NotificationServiceProvider.d.ts +1 -3
  237. package/dist/providers/OAuthServiceProvider.d.ts +1 -3
  238. package/dist/providers/QueueServiceProvider.d.ts +1 -3
  239. package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
  240. package/dist/providers/StorageServiceProvider.d.ts +1 -3
  241. package/dist/queue/FailedJobReporter.d.ts +1 -24
  242. package/dist/queue/Job.d.ts +12 -99
  243. package/dist/queue/QueueManager.d.ts +6 -57
  244. package/dist/queue/Worker.d.ts +4 -65
  245. package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
  246. package/dist/queue/drivers/RedisDriver.d.ts +7 -65
  247. package/dist/queue/drivers/SqsDriver.d.ts +6 -57
  248. package/dist/queue/drivers/SyncDriver.d.ts +10 -13
  249. package/dist/queue/index.js +2 -2
  250. package/dist/queue/types.d.ts +10 -92
  251. package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
  252. package/dist/redis/RedisApiTokenStore.d.ts +4 -56
  253. package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
  254. package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
  255. package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
  256. package/dist/redis/RedisRateLimitStore.d.ts +16 -49
  257. package/dist/redis/RedisSessionStore.d.ts +3 -44
  258. package/dist/redis/client.d.ts +2 -32
  259. package/dist/redis/index.js +47 -232
  260. package/dist/redis/redis-values.d.ts +6 -12
  261. package/dist/redis/scan-keys.d.ts +1 -4
  262. package/dist/request-CLOYytGP.js +68 -0
  263. package/dist/runtime/index.d.ts +2 -0
  264. package/dist/runtime/index.js +108 -74
  265. package/dist/scheduling/CronParser.d.ts +0 -29
  266. package/dist/scheduling/Schedule.d.ts +1 -153
  267. package/dist/scheduling/ScheduledTask.d.ts +0 -31
  268. package/dist/scheduling/Scheduler.d.ts +0 -70
  269. package/dist/scheduling/index.js +1 -1
  270. package/dist/scheduling/types.d.ts +4 -65
  271. package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
  272. package/dist/storage/StorageManager.d.ts +0 -48
  273. package/dist/storage/drivers/LocalDriver.d.ts +1 -25
  274. package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
  275. package/dist/storage/drivers/S3Driver.d.ts +6 -36
  276. package/dist/storage/drivers/s3-acl.d.ts +5 -10
  277. package/dist/storage/index.js +1 -1
  278. package/dist/storage/types.d.ts +27 -265
  279. package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
  280. package/dist/support/contained-path.d.ts +10 -20
  281. package/dist/support/error-polyfill.d.ts +4 -6
  282. package/dist/support/expiry.d.ts +17 -33
  283. package/dist/support/expiry.js +17 -33
  284. package/dist/support/import-map.d.ts +3 -7
  285. package/dist/support/inertia-defaults.d.ts +5 -10
  286. package/dist/support/redirect-target.d.ts +4 -6
  287. package/dist/support/stack-frames.d.ts +11 -50
  288. package/dist/support/trim-slashes.d.ts +4 -7
  289. package/dist/support/warn-once.d.ts +2 -6
  290. package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
  291. package/dist/{vite-manifest-BGfWbPYp.js → vite-manifest-CTQp-SOo.js} +34 -58
  292. package/package.json +6 -2
  293. package/dist/client-Dd7vLcqp.js +0 -27
  294. package/dist/context-DoD0c7J_.js +0 -26
  295. package/dist/endpoint-D-20PiHY.js +0 -46
  296. package/dist/hot-disposables-WsTX2ySN.js +0 -281
  297. package/dist/request-CRVuIiQr.js +0 -78
@@ -1,102 +1,46 @@
1
1
  import type { Notifiable, NotificationChannel, NotificationChannelFactory, NotificationManagerOptions } from './types.js';
2
2
  import type { Notification } from './Notification.js';
3
3
  import { Job } from '../queue/index.js';
4
- /**
5
- * Notification manager for sending notifications through multiple channels.
6
- *
7
- * @example
8
- * ```typescript
9
- * const notifications = new NotificationManager()
10
- *
11
- * notifications
12
- * .registerChannel('mail', new MailChannel(mailManager))
13
- * .registerChannel('database', new DatabaseChannel())
14
- * .registerChannel('slack', new SlackChannel(webhookUrl))
15
- *
16
- * // Send notification
17
- * await notifications.send(user, new OrderShipped(order))
18
- *
19
- * // Send to multiple users
20
- * await notifications.sendToMany(admins, new NewUserRegistered(user))
21
- * ```
22
- */
4
+ /** Sends notifications through multiple registered channels. */
23
5
  export declare class NotificationManager {
24
6
  protected channels: Map<string, NotificationChannel>;
25
7
  protected channelFactories: Map<string, NotificationChannelFactory>;
26
8
  protected resolvedChannels: Map<string, NotificationChannel>;
27
9
  constructor(options?: NotificationManagerOptions);
28
- /**
29
- * Register a notification channel.
30
- */
31
10
  registerChannel(name: string, channel: NotificationChannel): this;
32
- /**
33
- * Register a notification channel factory.
34
- */
35
11
  registerChannelFactory(name: string, factory: NotificationChannelFactory): this;
36
- /**
37
- * Get a notification channel by name.
38
- */
39
12
  channel(name: string): NotificationChannel;
40
- /**
41
- * Check if a channel is registered.
42
- */
43
13
  hasChannel(name: string): boolean;
44
- /**
45
- * Get all registered channel names.
46
- */
47
14
  getChannelNames(): string[];
48
- /**
49
- * Send a notification to a notifiable entity.
50
- * Respects queue configuration on the notification class.
51
- */
15
+ /** Send a notification, respecting the queue config on its class. */
52
16
  send(notifiable: Notifiable, notification: Notification): Promise<void>;
53
- /**
54
- * Send a notification immediately (bypasses queue).
55
- */
17
+ /** Send a notification immediately, bypassing the queue. */
56
18
  sendNow(notifiable: Notifiable, notification: Notification): Promise<void>;
57
- /**
58
- * Queue a notification for later delivery.
59
- */
60
19
  protected queue(notifiable: Notifiable, notification: Notification, queueConfig: {
61
20
  queue?: string;
62
21
  delay?: number;
63
22
  }): Promise<void>;
64
- /**
65
- * Send notification to multiple notifiables.
66
- */
67
23
  sendToMany(notifiables: Notifiable[], notification: Notification): Promise<void>;
68
- /**
69
- * Send notification immediately to multiple notifiables.
70
- */
71
24
  sendNowToMany(notifiables: Notifiable[], notification: Notification): Promise<void>;
72
25
  /**
73
- * Serialize notifiable for queue storage.
74
- *
75
- * Routing is resolved here rather than in the worker: `routeNotificationFor`
76
- * is arbitrary user code — often a closure on an object literal — and cannot
77
- * be reconstructed from a payload.
78
- *
79
- * @param channels - Channels to resolve routes for
26
+ * Serialize a notifiable for queue storage. Routing is resolved here rather
27
+ * than in the worker: `routeNotificationFor` is arbitrary user code — often a
28
+ * closure on an object literal — and cannot be rebuilt from a payload.
80
29
  */
81
30
  protected serializeNotifiable(notifiable: Notifiable, channels?: string[]): SerializedNotifiable;
82
31
  /**
83
- * Serialize notification for queue storage.
84
- *
85
- * Only own enumerable properties are captured. Behaviour is restored by
86
- * rebuilding the registered class in the job handler, not by serializing it.
32
+ * Serialize a notification for queue storage. Only own enumerable properties
33
+ * are captured; behaviour is restored by rebuilding the registered class in
34
+ * the job handler.
87
35
  */
88
36
  protected serializeNotification(notification: Notification): SerializedNotification;
89
37
  /**
90
- * Bind this manager to the queued-notification job and register it.
91
- *
92
- * Call this during boot in a process that runs a worker but may never send
93
- * a notification itself: without it, the worker cannot resolve the job.
38
+ * Bind this manager to the queued-notification job and register it. Call it
39
+ * during boot in a process that runs a worker but may never send a
40
+ * notification itself, or the worker cannot resolve the job.
94
41
  */
95
42
  registerQueueJob(): typeof SendNotificationJob;
96
43
  }
97
- /**
98
- * Payload for queued notifications.
99
- */
100
44
  interface SendNotificationPayload {
101
45
  notifiableData: SerializedNotifiable;
102
46
  notificationData: SerializedNotification;
@@ -113,38 +57,21 @@ interface SerializedNotification {
113
57
  createdAt: string;
114
58
  data: Record<string, unknown>;
115
59
  }
116
- /**
117
- * Job for sending queued notifications.
118
- */
119
60
  declare class SendNotificationJob extends Job<SendNotificationPayload> {
120
61
  static jobName: string;
121
62
  static queue: string;
122
63
  static maxAttempts: number;
123
64
  static notificationManager: NotificationManager | null;
124
65
  handle(payload: SendNotificationPayload): Promise<void>;
125
- /**
126
- * Rebuild the notifiable from its serialized data.
127
- */
128
66
  protected rebuildNotifiable(serialized: SerializedNotifiable): Notifiable;
129
67
  /**
130
- * Rebuild a real notification instance from its serialized data.
131
- *
132
- * The class is looked up in the notification registry and instantiated via
133
- * its prototype, so prototype methods (`via`, `toMail`, `toDatabase`,
134
- * `toSlack`, `shouldSend`) are restored without running the constructor.
68
+ * Rebuild a real notification instance: the class is looked up in the
69
+ * registry and instantiated via its prototype, so prototype methods are
70
+ * restored without running the constructor.
135
71
  */
136
72
  protected rebuildNotification(type: string, serialized: SerializedNotification): Notification;
137
73
  }
138
- /**
139
- * Set the global notification manager.
140
- */
141
74
  export declare function setNotificationManager(manager: NotificationManager): void;
142
- /**
143
- * Get the global notification manager.
144
- */
145
75
  export declare function getNotificationManager(): NotificationManager;
146
- /**
147
- * Create a notification manager.
148
- */
149
76
  export declare function createNotificationManager(options?: NotificationManagerOptions): NotificationManager;
150
77
  export {};
@@ -1,55 +1,15 @@
1
1
  import type { NotificationChannel, Notifiable, DatabaseNotification, DatabaseChannelOptions } from '../types.js';
2
2
  import type { Notification } from '../Notification.js';
3
- /**
4
- * Database notification channel.
5
- *
6
- * Stores notifications in the database for in-app notifications.
7
- *
8
- * @example
9
- * ```typescript
10
- * const dbChannel = new DatabaseChannel({
11
- * store: async (notifiable, notification) => {
12
- * await db.insert(notifications).values(notification)
13
- * },
14
- * })
15
- * notifications.registerChannel('database', dbChannel)
16
- *
17
- * // In notification class:
18
- * toDatabase(notifiable: Notifiable): Record<string, unknown> {
19
- * return {
20
- * orderId: this.order.id,
21
- * message: 'Your order has shipped',
22
- * }
23
- * }
24
- * ```
25
- */
3
+ /** Database notification channel, for in-app notifications. */
26
4
  export declare class DatabaseChannel implements NotificationChannel {
27
5
  private options;
28
6
  readonly name = "database";
29
7
  protected stored: DatabaseNotification[];
30
8
  constructor(options?: DatabaseChannelOptions);
31
- /**
32
- * Send the notification to the database.
33
- */
34
9
  send(notifiable: Notifiable, notification: Notification): Promise<void>;
35
- /**
36
- * Get the notifiable ID.
37
- */
38
10
  protected getNotifiableId(notifiable: Notifiable): string | number;
39
- /**
40
- * Get the notifiable type.
41
- */
42
11
  protected getNotifiableType(notifiable: Notifiable): string;
43
- /**
44
- * Get all stored notifications (for testing).
45
- */
46
12
  getStored(): DatabaseNotification[];
47
- /**
48
- * Get stored notifications for a notifiable.
49
- */
50
13
  getStoredFor(notifiable: Notifiable): DatabaseNotification[];
51
- /**
52
- * Clear stored notifications (for testing).
53
- */
54
14
  clear(): void;
55
15
  }
@@ -1,45 +1,16 @@
1
1
  import type { NotificationChannel, Notifiable } from '../types.js';
2
2
  import type { Notification } from '../Notification.js';
3
3
  import type { MailManager } from '../../mail/MailManager.js';
4
- /**
5
- * Mail notification channel.
6
- *
7
- * Sends notifications via email using the MailManager.
8
- *
9
- * @example
10
- * ```typescript
11
- * const mailChannel = new MailChannel(mailManager)
12
- * notifications.registerChannel('mail', mailChannel)
13
- *
14
- * // In notification class:
15
- * toMail(notifiable: Notifiable): NotificationMailMessage {
16
- * return {
17
- * subject: 'Order Shipped',
18
- * html: '<p>Your order has shipped!</p>',
19
- * }
20
- * }
21
- * ```
22
- */
4
+ /** Mail notification channel: sends notifications through the MailManager. */
23
5
  export declare class MailChannel implements NotificationChannel {
24
6
  private mailManager;
25
7
  private options;
26
8
  readonly name = "mail";
27
9
  constructor(mailManager: MailManager, options?: MailChannelOptions);
28
- /**
29
- * Send the notification via mail.
30
- */
31
10
  send(notifiable: Notifiable, notification: Notification): Promise<void>;
32
11
  }
33
- /**
34
- * Mail channel options.
35
- */
12
+ /** Mail channel options. */
36
13
  export interface MailChannelOptions {
37
- /**
38
- * Default from address.
39
- */
40
14
  from?: string;
41
- /**
42
- * Transport name to use.
43
- */
44
15
  transport?: string;
45
16
  }
@@ -1,85 +1,25 @@
1
1
  import type { NotificationChannel, Notifiable, SentNotification } from '../types.js';
2
2
  import type { Notification } from '../Notification.js';
3
3
  /**
4
- * Memory notification channel for testing.
5
- *
6
- * Stores all sent notifications in memory for assertions.
7
- *
8
- * @example
9
- * ```typescript
10
- * const memoryChannel = new MemoryChannel()
11
- * notifications.registerChannel('memory', memoryChannel)
12
- *
13
- * await notifications.send(user, new OrderShipped(order))
14
- *
15
- * memoryChannel.assertSentTo(user, 'OrderShipped')
16
- * memoryChannel.assertCount(1)
17
- * ```
4
+ * Memory notification channel for testing: stores every sent notification in
5
+ * memory for assertions.
18
6
  */
19
7
  export declare class MemoryChannel implements NotificationChannel {
20
8
  readonly name = "memory";
21
- /**
22
- * All sent notifications.
23
- */
24
9
  sent: SentNotification[];
25
- /**
26
- * Send (store) the notification.
27
- */
28
10
  send(notifiable: Notifiable, notification: Notification): Promise<void>;
29
- /**
30
- * Assert that a notification was sent to a notifiable.
31
- */
32
11
  assertSentTo(notifiable: Notifiable, notificationType?: string): void;
33
- /**
34
- * Assert that a notification was not sent to a notifiable.
35
- */
36
12
  assertNotSentTo(notifiable: Notifiable, notificationType?: string): void;
37
- /**
38
- * Assert the total count of sent notifications.
39
- */
40
13
  assertCount(count: number): void;
41
- /**
42
- * Assert that a notification type was sent.
43
- */
44
14
  assertSent(notificationType: string): void;
45
- /**
46
- * Assert that a notification type was not sent.
47
- */
48
15
  assertNotSent(notificationType: string): void;
49
- /**
50
- * Assert that no notifications were sent.
51
- */
52
16
  assertNothingSent(): void;
53
- /**
54
- * Get notifications sent to a specific notifiable.
55
- */
56
17
  getSentTo(notifiable: Notifiable): SentNotification[];
57
- /**
58
- * Get notifications of a specific type.
59
- */
60
18
  getSentOfType(notificationType: string): SentNotification[];
61
- /**
62
- * Check if a notification was sent to a notifiable.
63
- */
64
19
  hasSentTo(notifiable: Notifiable, notificationType?: string): boolean;
65
- /**
66
- * Check if a notification type was sent.
67
- */
68
20
  hasSent(notificationType: string): boolean;
69
- /**
70
- * Get the count of sent notifications.
71
- */
72
21
  count(): number;
73
- /**
74
- * Get the last sent notification.
75
- */
76
22
  last(): SentNotification | undefined;
77
- /**
78
- * Get the first sent notification.
79
- */
80
23
  first(): SentNotification | undefined;
81
- /**
82
- * Clear all sent notifications.
83
- */
84
24
  clear(): void;
85
25
  }
@@ -1,66 +1,21 @@
1
1
  import type { NotificationChannel, Notifiable, SlackMessage } from '../types.js';
2
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
- */
3
+ /** Slack notification channel: sends notifications via incoming webhooks. */
30
4
  export declare class SlackChannel implements NotificationChannel {
31
5
  private webhookUrl;
32
6
  private options;
33
7
  readonly name = "slack";
34
8
  constructor(webhookUrl: string, options?: SlackChannelOptions);
35
- /**
36
- * Send the notification to Slack.
37
- */
38
9
  send(notifiable: Notifiable, notification: Notification): Promise<void>;
39
- /**
40
- * Build the Slack webhook payload.
41
- */
42
10
  protected buildPayload(message: SlackMessage): SlackWebhookPayload;
43
11
  }
44
- /**
45
- * Slack channel options.
46
- */
12
+ /** Slack channel options. */
47
13
  export interface SlackChannelOptions {
48
- /**
49
- * Default username for messages.
50
- */
51
14
  username?: string;
52
- /**
53
- * Default icon emoji for messages.
54
- */
55
15
  iconEmoji?: string;
56
- /**
57
- * Default icon URL for messages.
58
- */
59
16
  iconUrl?: string;
60
17
  }
61
- /**
62
- * Slack webhook payload.
63
- */
18
+ /** Slack webhook payload. */
64
19
  interface SlackWebhookPayload {
65
20
  text?: string;
66
21
  blocks?: unknown[];
@@ -1,2 +1,2 @@
1
- import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "../notifications-BGqmUNZ8.js";
1
+ import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "../notifications-okWFs9ly.js";
2
2
  export { DatabaseChannel, MailChannel, MemoryChannel, Notification, NotificationManager, SlackChannel, clearNotificationRegistry, createNotificationManager, getNotification, getNotificationManager, registerNotification, resolveNotifiableType, setNotificationManager };
@@ -1,10 +1,7 @@
1
1
  import type { Notifiable } from './types.js';
2
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.
3
+ * The stable type name of a notifiable. Channels must use this rather than
4
+ * `constructor.name`: one rebuilt from a queue payload carries its original
5
+ * name in `notifiableType` and has a plain object as its constructor.
9
6
  */
10
7
  export declare function resolveNotifiableType(notifiable: Notifiable): string;
@@ -1,39 +1,20 @@
1
1
  import type { Notification } from './Notification.js';
2
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.
3
+ * A notification class usable for queue reconstruction. Only the prototype and
4
+ * name are needed: queued notifications are rebuilt with
5
+ * `Object.create(prototype)`, so required constructor arguments are fine.
8
6
  */
9
7
  export interface NotificationConstructor {
10
8
  readonly name: string;
11
9
  readonly prototype: Notification;
12
10
  }
13
11
  /**
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
- * ```
12
+ * Register a notification class so queued instances can be rebuilt. Queueing
13
+ * registers automatically, which covers a worker in the same process; a worker
14
+ * in a separate process must register at boot. Type names must be unique — a
15
+ * second class under an existing type replaces the first.
30
16
  */
31
17
  export declare function registerNotification(notificationClass: NotificationConstructor, type?: string): void;
32
- /**
33
- * Get a registered notification class by type.
34
- */
35
18
  export declare function getNotification(type: string): NotificationConstructor | undefined;
36
- /**
37
- * Clear all registered notifications (for testing).
38
- */
19
+ /** Clear all registered notifications (for testing). */
39
20
  export declare function clearNotificationRegistry(): void;
@@ -1,35 +1,21 @@
1
1
  import type { Notification } from './Notification.js';
2
- /**
3
- * Notification channel interface.
4
- */
2
+ /** Notification channel interface. */
5
3
  export interface NotificationChannel {
6
4
  readonly name: string;
7
5
  send(notifiable: Notifiable, notification: Notification): Promise<void>;
8
6
  }
9
- /**
10
- * Notifiable entity interface.
11
- */
7
+ /** Notifiable entity interface. */
12
8
  export interface Notifiable {
13
- /**
14
- * Get the notification routing information for a given channel.
15
- */
16
9
  routeNotificationFor(channel: string): string | null;
17
10
  /**
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).
11
+ * Stable type name; defaults to the constructor name. Set it when the
12
+ * notifiable is rebuilt from a queue payload, or when the class name is not
13
+ * durable (bundlers that mangle identifiers).
23
14
  */
24
15
  notifiableType?: string;
25
- /**
26
- * Database notifications (optional).
27
- */
28
16
  notifications?: DatabaseNotification[];
29
17
  }
30
- /**
31
- * Database notification record.
32
- */
18
+ /** Database notification record. */
33
19
  export interface DatabaseNotification {
34
20
  id: string;
35
21
  type: string;
@@ -39,9 +25,7 @@ export interface DatabaseNotification {
39
25
  readAt: Date | null;
40
26
  createdAt: Date;
41
27
  }
42
- /**
43
- * Mail message for notifications.
44
- */
28
+ /** Mail message for notifications. */
45
29
  export interface NotificationMailMessage {
46
30
  subject: string;
47
31
  html?: string;
@@ -52,18 +36,14 @@ export interface NotificationMailMessage {
52
36
  bcc?: string | string[];
53
37
  attachments?: NotificationAttachment[];
54
38
  }
55
- /**
56
- * Notification attachment.
57
- */
39
+ /** Notification attachment. */
58
40
  export interface NotificationAttachment {
59
41
  filename: string;
60
42
  content?: string | Buffer;
61
43
  path?: string;
62
44
  contentType?: string;
63
45
  }
64
- /**
65
- * Slack message for notifications.
66
- */
46
+ /** Slack message for notifications. */
67
47
  export interface SlackMessage {
68
48
  text?: string;
69
49
  blocks?: SlackBlock[];
@@ -73,9 +53,7 @@ export interface SlackMessage {
73
53
  icon_emoji?: string;
74
54
  icon_url?: string;
75
55
  }
76
- /**
77
- * Slack block.
78
- */
56
+ /** Slack block. */
79
57
  export interface SlackBlock {
80
58
  type: string;
81
59
  text?: {
@@ -91,9 +69,7 @@ export interface SlackBlock {
91
69
  }>;
92
70
  [key: string]: unknown;
93
71
  }
94
- /**
95
- * Slack attachment.
96
- */
72
+ /** Slack attachment. */
97
73
  export interface SlackAttachment {
98
74
  color?: string;
99
75
  fallback?: string;
@@ -115,40 +91,27 @@ export interface SlackAttachment {
115
91
  footer_icon?: string;
116
92
  ts?: number;
117
93
  }
118
- /**
119
- * Notification channel factory.
120
- */
94
+ /** Notification channel factory. */
121
95
  export interface NotificationChannelFactory {
122
96
  (config: Record<string, unknown>): NotificationChannel;
123
97
  }
124
- /**
125
- * Notification manager options.
126
- */
98
+ /** Notification manager options. */
127
99
  export interface NotificationManagerOptions {
128
100
  channels?: Record<string, NotificationChannel>;
129
101
  channelFactories?: Record<string, NotificationChannelFactory>;
130
102
  }
131
- /**
132
- * Database channel options.
133
- */
103
+ /** Database channel options. */
134
104
  export interface DatabaseChannelOptions {
135
- /**
136
- * Callback to store the notification.
137
- */
138
105
  store?: (notifiable: Notifiable, notification: DatabaseNotification) => Promise<void>;
139
106
  }
140
- /**
141
- * Sent notification record (for testing).
142
- */
107
+ /** Sent notification record (for testing). */
143
108
  export interface SentNotification {
144
109
  notifiable: Notifiable;
145
110
  notification: Notification;
146
111
  channels: string[];
147
112
  timestamp: Date;
148
113
  }
149
- /**
150
- * Notification class type.
151
- */
114
+ /** Notification class type. */
152
115
  export interface NotificationClass<T extends Notification = Notification> {
153
116
  new (...args: unknown[]): T;
154
117
  shouldQueue?: boolean;