@guren/server 0.2.0-alpha.6 → 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.
- package/dist/Application-DtWDHXr1.d.ts +2110 -0
- package/dist/BroadcastManager-AkIWUGJo.d.ts +466 -0
- package/dist/CacheManager-BkvHEOZX.d.ts +244 -0
- package/dist/ConsoleKernel-CqCVrdZs.d.ts +207 -0
- package/dist/EventManager-CmIoLt7r.d.ts +207 -0
- package/dist/Gate-CNkBYf8m.d.ts +268 -0
- package/dist/HealthManager-DUyMIzsZ.d.ts +141 -0
- package/dist/I18nManager-Dtgzsf5n.d.ts +270 -0
- package/dist/LogManager-7mxnkaPM.d.ts +256 -0
- package/dist/MailManager-DpMvYiP9.d.ts +292 -0
- package/dist/Scheduler-BstvSca7.d.ts +469 -0
- package/dist/StorageManager-oZTHqaza.d.ts +337 -0
- package/dist/api-token-JOif2CtG.d.ts +1792 -0
- package/dist/app-key-CsBfRC_Q.d.ts +214 -0
- package/dist/auth/index.d.ts +418 -0
- package/dist/auth/index.js +6742 -0
- package/dist/authorization/index.d.ts +129 -0
- package/dist/authorization/index.js +621 -0
- package/dist/broadcasting/index.d.ts +233 -0
- package/dist/broadcasting/index.js +907 -0
- package/dist/cache/index.d.ts +233 -0
- package/dist/cache/index.js +817 -0
- package/dist/encryption/index.d.ts +222 -0
- package/dist/encryption/index.js +602 -0
- package/dist/events/index.d.ts +155 -0
- package/dist/events/index.js +330 -0
- package/dist/health/index.d.ts +185 -0
- package/dist/health/index.js +379 -0
- package/dist/i18n/index.d.ts +101 -0
- package/dist/i18n/index.js +597 -0
- package/dist/index-9_Jzj5jo.d.ts +7 -0
- package/dist/index.d.ts +2628 -619
- package/dist/index.js +22229 -3116
- package/dist/lambda/index.d.ts +156 -0
- package/dist/lambda/index.js +91 -0
- package/dist/logging/index.d.ts +50 -0
- package/dist/logging/index.js +557 -0
- package/dist/mail/index.d.ts +288 -0
- package/dist/mail/index.js +695 -0
- package/dist/mcp/index.d.ts +139 -0
- package/dist/mcp/index.js +382 -0
- package/dist/notifications/index.d.ts +271 -0
- package/dist/notifications/index.js +741 -0
- package/dist/queue/index.d.ts +423 -0
- package/dist/queue/index.js +958 -0
- package/dist/runtime/index.d.ts +93 -0
- package/dist/runtime/index.js +834 -0
- package/dist/scheduling/index.d.ts +41 -0
- package/dist/scheduling/index.js +836 -0
- package/dist/storage/index.d.ts +196 -0
- package/dist/storage/index.js +832 -0
- package/dist/vite/index.js +203 -3
- package/package.json +93 -6
- package/dist/chunk-FK2XQSBF.js +0 -160
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { e as MailTransport, i as SmtpTransportOptions, d as MailMessage, S as SendResult, R as ResendTransportOptions, h as MemoryTransportOptions, M as MailManager, a as MailAddress, b as MailAttachment } from '../MailManager-DpMvYiP9.js';
|
|
2
|
+
export { c as MailConfig, f as MailTransportConfig, g as MailTransportFactory, j as createMailManager } from '../MailManager-DpMvYiP9.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SMTP mail transport using Nodemailer.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const transport = new SmtpTransport({
|
|
10
|
+
* host: 'smtp.example.com',
|
|
11
|
+
* port: 587,
|
|
12
|
+
* auth: {
|
|
13
|
+
* user: 'user@example.com',
|
|
14
|
+
* pass: 'password',
|
|
15
|
+
* },
|
|
16
|
+
* })
|
|
17
|
+
*
|
|
18
|
+
* await transport.send({
|
|
19
|
+
* from: { email: 'sender@example.com' },
|
|
20
|
+
* to: [{ email: 'recipient@example.com' }],
|
|
21
|
+
* subject: 'Hello',
|
|
22
|
+
* text: 'Hello World!',
|
|
23
|
+
* })
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare class SmtpTransport implements MailTransport {
|
|
27
|
+
readonly name = "smtp";
|
|
28
|
+
private readonly transporter;
|
|
29
|
+
constructor(options: SmtpTransportOptions);
|
|
30
|
+
/**
|
|
31
|
+
* Send an email via SMTP.
|
|
32
|
+
*/
|
|
33
|
+
send(message: MailMessage): Promise<SendResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Verify SMTP connection.
|
|
36
|
+
*/
|
|
37
|
+
verify(): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Close the transport.
|
|
40
|
+
*/
|
|
41
|
+
close(): void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Resend mail transport.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const transport = new ResendTransport({
|
|
50
|
+
* apiKey: process.env.RESEND_API_KEY,
|
|
51
|
+
* })
|
|
52
|
+
*
|
|
53
|
+
* await transport.send({
|
|
54
|
+
* from: { email: 'sender@example.com' },
|
|
55
|
+
* to: [{ email: 'recipient@example.com' }],
|
|
56
|
+
* subject: 'Hello',
|
|
57
|
+
* html: '<p>Hello World!</p>',
|
|
58
|
+
* })
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare class ResendTransport implements MailTransport {
|
|
62
|
+
readonly name = "resend";
|
|
63
|
+
private readonly apiKey;
|
|
64
|
+
private readonly baseUrl;
|
|
65
|
+
constructor(options: ResendTransportOptions);
|
|
66
|
+
/**
|
|
67
|
+
* Format email address for Resend API.
|
|
68
|
+
*/
|
|
69
|
+
private formatAddress;
|
|
70
|
+
/**
|
|
71
|
+
* Send an email via Resend API.
|
|
72
|
+
*/
|
|
73
|
+
send(message: MailMessage): Promise<SendResult>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* In-memory mail transport for testing.
|
|
78
|
+
*
|
|
79
|
+
* Stores all sent messages in memory for inspection.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const transport = new MemoryTransport()
|
|
84
|
+
*
|
|
85
|
+
* await transport.send({
|
|
86
|
+
* from: { email: 'sender@example.com' },
|
|
87
|
+
* to: [{ email: 'recipient@example.com' }],
|
|
88
|
+
* subject: 'Hello',
|
|
89
|
+
* text: 'Hello World!',
|
|
90
|
+
* })
|
|
91
|
+
*
|
|
92
|
+
* // Inspect sent messages
|
|
93
|
+
* const messages = transport.getMessages()
|
|
94
|
+
* console.log(messages[0].subject) // 'Hello'
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare class MemoryTransport implements MailTransport {
|
|
98
|
+
readonly name = "memory";
|
|
99
|
+
private messages;
|
|
100
|
+
private simulateFailure;
|
|
101
|
+
private failureMessage;
|
|
102
|
+
constructor(options?: MemoryTransportOptions);
|
|
103
|
+
/**
|
|
104
|
+
* Send an email (stores in memory).
|
|
105
|
+
*/
|
|
106
|
+
send(message: MailMessage): Promise<SendResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Get all sent messages.
|
|
109
|
+
*/
|
|
110
|
+
getMessages(): MailMessage[];
|
|
111
|
+
/**
|
|
112
|
+
* Get the last sent message.
|
|
113
|
+
*/
|
|
114
|
+
getLastMessage(): MailMessage | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Find messages by recipient email.
|
|
117
|
+
*/
|
|
118
|
+
findByRecipient(email: string): MailMessage[];
|
|
119
|
+
/**
|
|
120
|
+
* Find messages by subject.
|
|
121
|
+
*/
|
|
122
|
+
findBySubject(subject: string): MailMessage[];
|
|
123
|
+
/**
|
|
124
|
+
* Check if any message was sent to a recipient.
|
|
125
|
+
*/
|
|
126
|
+
hasSentTo(email: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Check if any message was sent with a subject.
|
|
129
|
+
*/
|
|
130
|
+
hasSentWithSubject(subject: string): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Get the count of sent messages.
|
|
133
|
+
*/
|
|
134
|
+
count(): number;
|
|
135
|
+
/**
|
|
136
|
+
* Clear all stored messages.
|
|
137
|
+
*/
|
|
138
|
+
clear(): void;
|
|
139
|
+
/**
|
|
140
|
+
* Set whether to simulate failures.
|
|
141
|
+
*/
|
|
142
|
+
setSimulateFailure(simulate: boolean, message?: string): void;
|
|
143
|
+
/**
|
|
144
|
+
* Assert that a message was sent to a recipient.
|
|
145
|
+
* Throws if no message was found.
|
|
146
|
+
*/
|
|
147
|
+
assertSentTo(email: string): void;
|
|
148
|
+
/**
|
|
149
|
+
* Assert that a message was sent with a subject.
|
|
150
|
+
* Throws if no message was found.
|
|
151
|
+
*/
|
|
152
|
+
assertSentWithSubject(subject: string): void;
|
|
153
|
+
/**
|
|
154
|
+
* Assert that exactly n messages were sent.
|
|
155
|
+
* Throws if count doesn't match.
|
|
156
|
+
*/
|
|
157
|
+
assertSentCount(count: number): void;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Fluent mail builder for composing and sending emails.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* import { mail, createMailManager } from '@guren/server/mail'
|
|
166
|
+
*
|
|
167
|
+
* const manager = createMailManager({ ... })
|
|
168
|
+
*
|
|
169
|
+
* // Send a simple email
|
|
170
|
+
* await mail(manager)
|
|
171
|
+
* .to('user@example.com')
|
|
172
|
+
* .subject('Hello!')
|
|
173
|
+
* .text('Hello World!')
|
|
174
|
+
* .send()
|
|
175
|
+
*
|
|
176
|
+
* // Send an HTML email with template
|
|
177
|
+
* await mail(manager)
|
|
178
|
+
* .to('user@example.com')
|
|
179
|
+
* .subject('Welcome!')
|
|
180
|
+
* .html('<h1>Welcome to our app!</h1>')
|
|
181
|
+
* .attach({ filename: 'guide.pdf', path: './guide.pdf' })
|
|
182
|
+
* .send()
|
|
183
|
+
*
|
|
184
|
+
* // Queue the email for async sending
|
|
185
|
+
* await mail(manager)
|
|
186
|
+
* .to('user@example.com')
|
|
187
|
+
* .subject('Report')
|
|
188
|
+
* .html('<p>Your report is ready</p>')
|
|
189
|
+
* .queue('emails')
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
declare class Mail {
|
|
193
|
+
private readonly manager;
|
|
194
|
+
private message;
|
|
195
|
+
private transportName?;
|
|
196
|
+
constructor(manager: MailManager);
|
|
197
|
+
/**
|
|
198
|
+
* Set the sender address.
|
|
199
|
+
*/
|
|
200
|
+
from(address: string | MailAddress): this;
|
|
201
|
+
/**
|
|
202
|
+
* Add a recipient.
|
|
203
|
+
*/
|
|
204
|
+
to(address: string | MailAddress): this;
|
|
205
|
+
/**
|
|
206
|
+
* Add multiple recipients.
|
|
207
|
+
*/
|
|
208
|
+
toMany(addresses: (string | MailAddress)[]): this;
|
|
209
|
+
/**
|
|
210
|
+
* Add a CC recipient.
|
|
211
|
+
*/
|
|
212
|
+
cc(address: string | MailAddress): this;
|
|
213
|
+
/**
|
|
214
|
+
* Add a BCC recipient.
|
|
215
|
+
*/
|
|
216
|
+
bcc(address: string | MailAddress): this;
|
|
217
|
+
/**
|
|
218
|
+
* Set the reply-to address.
|
|
219
|
+
*/
|
|
220
|
+
replyTo(address: string | MailAddress): this;
|
|
221
|
+
/**
|
|
222
|
+
* Set the subject.
|
|
223
|
+
*/
|
|
224
|
+
subject(subject: string): this;
|
|
225
|
+
/**
|
|
226
|
+
* Set the plain text body.
|
|
227
|
+
*/
|
|
228
|
+
text(content: string): this;
|
|
229
|
+
/**
|
|
230
|
+
* Set the HTML body.
|
|
231
|
+
*/
|
|
232
|
+
html(content: string): this;
|
|
233
|
+
/**
|
|
234
|
+
* Render a React component as HTML body.
|
|
235
|
+
* Requires @react-email/render to be installed.
|
|
236
|
+
*
|
|
237
|
+
* @param component - React component function
|
|
238
|
+
* @param props - Props to pass to the component
|
|
239
|
+
*/
|
|
240
|
+
template<P extends Record<string, unknown>>(component: (props: P) => unknown, props: P): Promise<this>;
|
|
241
|
+
/**
|
|
242
|
+
* Add an attachment.
|
|
243
|
+
*/
|
|
244
|
+
attach(attachment: MailAttachment): this;
|
|
245
|
+
/**
|
|
246
|
+
* Add a custom header.
|
|
247
|
+
*/
|
|
248
|
+
header(key: string, value: string): this;
|
|
249
|
+
/**
|
|
250
|
+
* Specify which transport to use.
|
|
251
|
+
*/
|
|
252
|
+
via(transport: string): this;
|
|
253
|
+
/**
|
|
254
|
+
* Build the final message.
|
|
255
|
+
*/
|
|
256
|
+
buildMessage(): MailMessage;
|
|
257
|
+
/**
|
|
258
|
+
* Send the email immediately.
|
|
259
|
+
*/
|
|
260
|
+
send(): Promise<SendResult>;
|
|
261
|
+
/**
|
|
262
|
+
* Queue the email for async sending.
|
|
263
|
+
*/
|
|
264
|
+
queue(queueName?: string): Promise<string>;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Set the global mail manager for queue jobs.
|
|
268
|
+
*/
|
|
269
|
+
declare function setMailManager(manager: MailManager): void;
|
|
270
|
+
/**
|
|
271
|
+
* Get the global mail manager.
|
|
272
|
+
*/
|
|
273
|
+
declare function getMailManager(): MailManager | null;
|
|
274
|
+
/**
|
|
275
|
+
* Create a new mail builder.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* await mail(manager)
|
|
280
|
+
* .to('user@example.com')
|
|
281
|
+
* .subject('Hello')
|
|
282
|
+
* .text('Hello World!')
|
|
283
|
+
* .send()
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
declare function mail(manager: MailManager): Mail;
|
|
287
|
+
|
|
288
|
+
export { Mail, MailAddress, MailAttachment, MailManager, MailMessage, MailTransport, MemoryTransport, MemoryTransportOptions, ResendTransport, ResendTransportOptions, SendResult, SmtpTransport, SmtpTransportOptions, getMailManager, mail, setMailManager };
|