@guren/server 0.2.0-alpha.7 → 1.0.0-rc.9

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 (54) hide show
  1. package/dist/Application-DtWDHXr1.d.ts +2110 -0
  2. package/dist/BroadcastManager-AkIWUGJo.d.ts +466 -0
  3. package/dist/CacheManager-BkvHEOZX.d.ts +244 -0
  4. package/dist/ConsoleKernel-CqCVrdZs.d.ts +207 -0
  5. package/dist/EventManager-CmIoLt7r.d.ts +207 -0
  6. package/dist/Gate-CNkBYf8m.d.ts +268 -0
  7. package/dist/HealthManager-DUyMIzsZ.d.ts +141 -0
  8. package/dist/I18nManager-Dtgzsf5n.d.ts +270 -0
  9. package/dist/LogManager-7mxnkaPM.d.ts +256 -0
  10. package/dist/MailManager-DpMvYiP9.d.ts +292 -0
  11. package/dist/Scheduler-BstvSca7.d.ts +469 -0
  12. package/dist/StorageManager-oZTHqaza.d.ts +337 -0
  13. package/dist/api-token-JOif2CtG.d.ts +1792 -0
  14. package/dist/app-key-CsBfRC_Q.d.ts +214 -0
  15. package/dist/auth/index.d.ts +418 -0
  16. package/dist/auth/index.js +6742 -0
  17. package/dist/authorization/index.d.ts +129 -0
  18. package/dist/authorization/index.js +621 -0
  19. package/dist/broadcasting/index.d.ts +233 -0
  20. package/dist/broadcasting/index.js +907 -0
  21. package/dist/cache/index.d.ts +233 -0
  22. package/dist/cache/index.js +817 -0
  23. package/dist/encryption/index.d.ts +222 -0
  24. package/dist/encryption/index.js +602 -0
  25. package/dist/events/index.d.ts +155 -0
  26. package/dist/events/index.js +330 -0
  27. package/dist/health/index.d.ts +185 -0
  28. package/dist/health/index.js +379 -0
  29. package/dist/i18n/index.d.ts +101 -0
  30. package/dist/i18n/index.js +597 -0
  31. package/dist/index-9_Jzj5jo.d.ts +7 -0
  32. package/dist/index.d.ts +2628 -619
  33. package/dist/index.js +22229 -3116
  34. package/dist/lambda/index.d.ts +156 -0
  35. package/dist/lambda/index.js +91 -0
  36. package/dist/logging/index.d.ts +50 -0
  37. package/dist/logging/index.js +557 -0
  38. package/dist/mail/index.d.ts +288 -0
  39. package/dist/mail/index.js +695 -0
  40. package/dist/mcp/index.d.ts +139 -0
  41. package/dist/mcp/index.js +382 -0
  42. package/dist/notifications/index.d.ts +271 -0
  43. package/dist/notifications/index.js +741 -0
  44. package/dist/queue/index.d.ts +423 -0
  45. package/dist/queue/index.js +958 -0
  46. package/dist/runtime/index.d.ts +93 -0
  47. package/dist/runtime/index.js +834 -0
  48. package/dist/scheduling/index.d.ts +41 -0
  49. package/dist/scheduling/index.js +836 -0
  50. package/dist/storage/index.d.ts +196 -0
  51. package/dist/storage/index.js +832 -0
  52. package/dist/vite/index.js +203 -3
  53. package/package.json +93 -6
  54. package/dist/chunk-FK2XQSBF.js +0 -160
@@ -0,0 +1,271 @@
1
+ import { _ as NotificationChannel, X as Notifiable, Y as Notification, q as DatabaseNotification, p as DatabaseChannelOptions, as as SlackMessage, ai as SentNotification } from '../Application-DtWDHXr1.js';
2
+ export { Z as NotificationAttachment, $ as NotificationChannelFactory, a0 as NotificationClass, a1 as NotificationMailMessage, N as NotificationManager, a2 as NotificationManagerOptions, aq as SlackAttachment, ar as SlackBlock, aG as createNotificationManager, aP as getNotificationManager, a_ as setNotificationManager } from '../Application-DtWDHXr1.js';
3
+ import { M as MailManager } from '../MailManager-DpMvYiP9.js';
4
+ import 'hono';
5
+ import '../api-token-JOif2CtG.js';
6
+ import 'vite';
7
+ import '../EventManager-CmIoLt7r.js';
8
+ import '../CacheManager-BkvHEOZX.js';
9
+ import '../LogManager-7mxnkaPM.js';
10
+ import '../I18nManager-Dtgzsf5n.js';
11
+ import '../BroadcastManager-AkIWUGJo.js';
12
+ import '../index-9_Jzj5jo.js';
13
+ import '../app-key-CsBfRC_Q.js';
14
+ import '../StorageManager-oZTHqaza.js';
15
+ import '../HealthManager-DUyMIzsZ.js';
16
+ import '../Scheduler-BstvSca7.js';
17
+ import '../Gate-CNkBYf8m.js';
18
+
19
+ /**
20
+ * Mail notification channel.
21
+ *
22
+ * Sends notifications via email using the MailManager.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const mailChannel = new MailChannel(mailManager)
27
+ * notifications.registerChannel('mail', mailChannel)
28
+ *
29
+ * // In notification class:
30
+ * toMail(notifiable: Notifiable): NotificationMailMessage {
31
+ * return {
32
+ * subject: 'Order Shipped',
33
+ * html: '<p>Your order has shipped!</p>',
34
+ * }
35
+ * }
36
+ * ```
37
+ */
38
+ declare class MailChannel implements NotificationChannel {
39
+ private mailManager;
40
+ private options;
41
+ readonly name = "mail";
42
+ constructor(mailManager: MailManager, options?: MailChannelOptions);
43
+ /**
44
+ * Send the notification via mail.
45
+ */
46
+ send(notifiable: Notifiable, notification: Notification): Promise<void>;
47
+ }
48
+ /**
49
+ * Mail channel options.
50
+ */
51
+ interface MailChannelOptions {
52
+ /**
53
+ * Default from address.
54
+ */
55
+ from?: string;
56
+ /**
57
+ * Transport name to use.
58
+ */
59
+ transport?: string;
60
+ }
61
+
62
+ /**
63
+ * Database notification channel.
64
+ *
65
+ * Stores notifications in the database for in-app notifications.
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * const dbChannel = new DatabaseChannel({
70
+ * store: async (notifiable, notification) => {
71
+ * await db.insert(notifications).values(notification)
72
+ * },
73
+ * })
74
+ * notifications.registerChannel('database', dbChannel)
75
+ *
76
+ * // In notification class:
77
+ * toDatabase(notifiable: Notifiable): Record<string, unknown> {
78
+ * return {
79
+ * orderId: this.order.id,
80
+ * message: 'Your order has shipped',
81
+ * }
82
+ * }
83
+ * ```
84
+ */
85
+ declare class DatabaseChannel implements NotificationChannel {
86
+ private options;
87
+ readonly name = "database";
88
+ protected stored: DatabaseNotification[];
89
+ constructor(options?: DatabaseChannelOptions);
90
+ /**
91
+ * Send the notification to the database.
92
+ */
93
+ send(notifiable: Notifiable, notification: Notification): Promise<void>;
94
+ /**
95
+ * Get the notifiable ID.
96
+ */
97
+ protected getNotifiableId(notifiable: Notifiable): string | number;
98
+ /**
99
+ * Get the notifiable type.
100
+ */
101
+ protected getNotifiableType(notifiable: Notifiable): string;
102
+ /**
103
+ * Get all stored notifications (for testing).
104
+ */
105
+ getStored(): DatabaseNotification[];
106
+ /**
107
+ * Get stored notifications for a notifiable.
108
+ */
109
+ getStoredFor(notifiable: Notifiable): DatabaseNotification[];
110
+ /**
111
+ * Clear stored notifications (for testing).
112
+ */
113
+ clear(): void;
114
+ }
115
+
116
+ /**
117
+ * Slack notification channel.
118
+ *
119
+ * Sends notifications to Slack via incoming webhooks.
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * const slackChannel = new SlackChannel('https://hooks.slack.com/services/...')
124
+ * notifications.registerChannel('slack', slackChannel)
125
+ *
126
+ * // In notification class:
127
+ * toSlack(notifiable: Notifiable): SlackMessage {
128
+ * return {
129
+ * text: `Order #${this.order.id} has been shipped!`,
130
+ * blocks: [
131
+ * {
132
+ * type: 'section',
133
+ * text: {
134
+ * type: 'mrkdwn',
135
+ * text: `*Order Shipped*\nOrder #${this.order.id} is on its way!`,
136
+ * },
137
+ * },
138
+ * ],
139
+ * }
140
+ * }
141
+ * ```
142
+ */
143
+ declare class SlackChannel implements NotificationChannel {
144
+ private webhookUrl;
145
+ private options;
146
+ readonly name = "slack";
147
+ constructor(webhookUrl: string, options?: SlackChannelOptions);
148
+ /**
149
+ * Send the notification to Slack.
150
+ */
151
+ send(notifiable: Notifiable, notification: Notification): Promise<void>;
152
+ /**
153
+ * Build the Slack webhook payload.
154
+ */
155
+ protected buildPayload(message: SlackMessage): SlackWebhookPayload;
156
+ }
157
+ /**
158
+ * Slack channel options.
159
+ */
160
+ interface SlackChannelOptions {
161
+ /**
162
+ * Default username for messages.
163
+ */
164
+ username?: string;
165
+ /**
166
+ * Default icon emoji for messages.
167
+ */
168
+ iconEmoji?: string;
169
+ /**
170
+ * Default icon URL for messages.
171
+ */
172
+ iconUrl?: string;
173
+ }
174
+ /**
175
+ * Slack webhook payload.
176
+ */
177
+ interface SlackWebhookPayload {
178
+ text?: string;
179
+ blocks?: unknown[];
180
+ attachments?: unknown[];
181
+ channel?: string;
182
+ username?: string;
183
+ icon_emoji?: string;
184
+ icon_url?: string;
185
+ }
186
+
187
+ /**
188
+ * Memory notification channel for testing.
189
+ *
190
+ * Stores all sent notifications in memory for assertions.
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * const memoryChannel = new MemoryChannel()
195
+ * notifications.registerChannel('memory', memoryChannel)
196
+ *
197
+ * await notifications.send(user, new OrderShipped(order))
198
+ *
199
+ * memoryChannel.assertSentTo(user, 'OrderShipped')
200
+ * memoryChannel.assertCount(1)
201
+ * ```
202
+ */
203
+ declare class MemoryChannel implements NotificationChannel {
204
+ readonly name = "memory";
205
+ /**
206
+ * All sent notifications.
207
+ */
208
+ sent: SentNotification[];
209
+ /**
210
+ * Send (store) the notification.
211
+ */
212
+ send(notifiable: Notifiable, notification: Notification): Promise<void>;
213
+ /**
214
+ * Assert that a notification was sent to a notifiable.
215
+ */
216
+ assertSentTo(notifiable: Notifiable, notificationType?: string): void;
217
+ /**
218
+ * Assert that a notification was not sent to a notifiable.
219
+ */
220
+ assertNotSentTo(notifiable: Notifiable, notificationType?: string): void;
221
+ /**
222
+ * Assert the total count of sent notifications.
223
+ */
224
+ assertCount(count: number): void;
225
+ /**
226
+ * Assert that a notification type was sent.
227
+ */
228
+ assertSent(notificationType: string): void;
229
+ /**
230
+ * Assert that a notification type was not sent.
231
+ */
232
+ assertNotSent(notificationType: string): void;
233
+ /**
234
+ * Assert that no notifications were sent.
235
+ */
236
+ assertNothingSent(): void;
237
+ /**
238
+ * Get notifications sent to a specific notifiable.
239
+ */
240
+ getSentTo(notifiable: Notifiable): SentNotification[];
241
+ /**
242
+ * Get notifications of a specific type.
243
+ */
244
+ getSentOfType(notificationType: string): SentNotification[];
245
+ /**
246
+ * Check if a notification was sent to a notifiable.
247
+ */
248
+ hasSentTo(notifiable: Notifiable, notificationType?: string): boolean;
249
+ /**
250
+ * Check if a notification type was sent.
251
+ */
252
+ hasSent(notificationType: string): boolean;
253
+ /**
254
+ * Get the count of sent notifications.
255
+ */
256
+ count(): number;
257
+ /**
258
+ * Get the last sent notification.
259
+ */
260
+ last(): SentNotification | undefined;
261
+ /**
262
+ * Get the first sent notification.
263
+ */
264
+ first(): SentNotification | undefined;
265
+ /**
266
+ * Clear all sent notifications.
267
+ */
268
+ clear(): void;
269
+ }
270
+
271
+ export { DatabaseChannel, DatabaseChannelOptions, DatabaseNotification, MailChannel, type MailChannelOptions, MemoryChannel, Notifiable, Notification, NotificationChannel, SentNotification, SlackChannel, type SlackChannelOptions, SlackMessage };