@gravito/signal 3.1.0 → 3.1.2
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/index.cjs +55126 -81925
- package/dist/index.d.ts +513 -1
- package/dist/index.js +61492 -0
- package/dist/index.mjs +55301 -82110
- package/package.json +12 -1
- package/CHANGELOG.md +0 -74
- package/build.ts +0 -133
- package/dist/index.cjs.map +0 -712
- package/dist/index.mjs.map +0 -710
- package/doc/ADVANCED_RENDERING.md +0 -71
- package/doc/DISTRIBUTED_MESSAGING.md +0 -79
- package/doc/OPTIMIZATION_PLAN.md +0 -496
- package/package.json.bak +0 -75
- package/scripts/check-coverage.ts +0 -64
- package/src/Mailable.ts +0 -674
- package/src/OrbitSignal.ts +0 -451
- package/src/Queueable.ts +0 -9
- package/src/TypedMailable.ts +0 -96
- package/src/dev/DevMailbox.ts +0 -146
- package/src/dev/DevServer.ts +0 -192
- package/src/dev/storage/FileMailboxStorage.ts +0 -66
- package/src/dev/storage/MailboxStorage.ts +0 -15
- package/src/dev/storage/MemoryMailboxStorage.ts +0 -36
- package/src/dev/ui/mailbox.ts +0 -77
- package/src/dev/ui/preview.ts +0 -103
- package/src/dev/ui/shared.ts +0 -60
- package/src/errors.ts +0 -69
- package/src/events.ts +0 -72
- package/src/index.ts +0 -41
- package/src/renderers/HtmlRenderer.ts +0 -41
- package/src/renderers/MjmlRenderer.ts +0 -73
- package/src/renderers/ReactMjmlRenderer.ts +0 -94
- package/src/renderers/ReactRenderer.ts +0 -66
- package/src/renderers/Renderer.ts +0 -67
- package/src/renderers/TemplateRenderer.ts +0 -84
- package/src/renderers/VueMjmlRenderer.ts +0 -99
- package/src/renderers/VueRenderer.ts +0 -71
- package/src/renderers/mjml-templates.ts +0 -50
- package/src/transports/BaseTransport.ts +0 -148
- package/src/transports/LogTransport.ts +0 -55
- package/src/transports/MemoryTransport.ts +0 -55
- package/src/transports/SesTransport.ts +0 -129
- package/src/transports/SmtpTransport.ts +0 -184
- package/src/transports/Transport.ts +0 -45
- package/src/types.ts +0 -309
- package/src/utils/html.ts +0 -43
- package/src/webhooks/SendGridWebhookDriver.ts +0 -80
- package/src/webhooks/SesWebhookDriver.ts +0 -44
- package/tests/DevMailbox.test.ts +0 -54
- package/tests/FileMailboxStorage.test.ts +0 -56
- package/tests/MjmlLayout.test.ts +0 -28
- package/tests/MjmlRenderer.test.ts +0 -53
- package/tests/OrbitSignalWebhook.test.ts +0 -56
- package/tests/ReactMjmlRenderer.test.ts +0 -33
- package/tests/SendGridWebhookDriver.test.ts +0 -69
- package/tests/SesWebhookDriver.test.ts +0 -46
- package/tests/VueMjmlRenderer.test.ts +0 -35
- package/tests/dev-server.test.ts +0 -66
- package/tests/log-transport.test.ts +0 -21
- package/tests/mailable-extra.test.ts +0 -68
- package/tests/mailable.test.ts +0 -77
- package/tests/orbit-signal.test.ts +0 -43
- package/tests/renderers.test.ts +0 -58
- package/tests/template-renderer.test.ts +0 -24
- package/tests/transports.test.ts +0 -52
- package/tests/ui.test.ts +0 -37
- package/tsconfig.build.json +0 -24
- package/tsconfig.json +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -7,26 +7,538 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* Queue-able interface from the stream package.
|
|
12
|
+
*
|
|
13
|
+
* Defines the contract for messages that can be queued for asynchronous processing,
|
|
14
|
+
* enabling email mailables to be dispatched to background workers.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link Mailable} For messages that implement this interface
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
10
19
|
export type { Queueable } from '@gravito/stream';
|
|
20
|
+
/**
|
|
21
|
+
* Development mailbox for capturing and previewing sent emails.
|
|
22
|
+
*
|
|
23
|
+
* Provides an in-memory storage mechanism for intercepting emails during development.
|
|
24
|
+
* Works with DevServer to display a preview UI at a configured endpoint (default: /__mail).
|
|
25
|
+
*
|
|
26
|
+
* @see {@link OrbitSignal} For development mode configuration
|
|
27
|
+
* @see {@link MailboxEntry} For mailbox data structure
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
11
30
|
export { DevMailbox, type MailboxEntry } from './dev/DevMailbox';
|
|
31
|
+
/**
|
|
32
|
+
* Mail error codes and transport error class.
|
|
33
|
+
*
|
|
34
|
+
* Provides structured error information for mail delivery failures, including
|
|
35
|
+
* categorized error codes (CONNECTION_FAILED, AUTH_FAILED, RATE_LIMIT, etc.)
|
|
36
|
+
* and the MailTransportError exception class for programmatic error handling.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { MailTransportError, MailErrorCode } from '@gravito/signal'
|
|
41
|
+
*
|
|
42
|
+
* try {
|
|
43
|
+
* await transport.send(message)
|
|
44
|
+
* } catch (error) {
|
|
45
|
+
* if (error instanceof MailTransportError) {
|
|
46
|
+
* if (error.code === MailErrorCode.RATE_LIMIT) {
|
|
47
|
+
* // Implement exponential backoff
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @see {@link Transport} For implementations that throw these errors
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
12
56
|
export { MailErrorCode, MailTransportError } from './errors';
|
|
57
|
+
/**
|
|
58
|
+
* Mail lifecycle event types and handlers.
|
|
59
|
+
*
|
|
60
|
+
* Provides event types and interfaces for subscribing to key moments in the
|
|
61
|
+
* email delivery process: beforeRender, afterRender, beforeSend, afterSend,
|
|
62
|
+
* sendFailed, and webhookReceived. Enables logging, analytics, and custom
|
|
63
|
+
* processing during mail service operations.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { OrbitSignal, type MailEvent } from '@gravito/signal'
|
|
68
|
+
*
|
|
69
|
+
* mail.on('afterSend', (event: MailEvent) => {
|
|
70
|
+
* console.log('Sent to:', event.message?.to[0].address)
|
|
71
|
+
* })
|
|
72
|
+
*
|
|
73
|
+
* mail.on('sendFailed', (event: MailEvent) => {
|
|
74
|
+
* console.error('Failed:', event.error?.message)
|
|
75
|
+
* })
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @see {@link OrbitSignal} For event subscription API
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
13
81
|
export type { MailEvent, MailEventHandler, MailEventType } from './events';
|
|
82
|
+
/**
|
|
83
|
+
* Base class for all mailable messages.
|
|
84
|
+
*
|
|
85
|
+
* Provides a fluent API to build email envelopes and render content using
|
|
86
|
+
* multiple rendering engines (HTML, Prism templates, React, Vue). Supports
|
|
87
|
+
* background queuing via the Queueable interface and integration with the
|
|
88
|
+
* OrbitSignal service for sending.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* import { Mailable } from '@gravito/signal'
|
|
93
|
+
*
|
|
94
|
+
* class WelcomeEmail extends Mailable {
|
|
95
|
+
* constructor(private user: User) {
|
|
96
|
+
* super()
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* build() {
|
|
100
|
+
* return this
|
|
101
|
+
* .to(this.user.email)
|
|
102
|
+
* .subject('Welcome!')
|
|
103
|
+
* .view('emails/welcome', { name: this.user.name })
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
*
|
|
107
|
+
* await mail.send(new WelcomeEmail(user))
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @see {@link TypedMailable} For type-safe data passing
|
|
111
|
+
* @see {@link OrbitSignal} For sending integration
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
14
114
|
export { Mailable } from './Mailable';
|
|
115
|
+
/**
|
|
116
|
+
* Type-safe mailable base class with compile-time data validation.
|
|
117
|
+
*
|
|
118
|
+
* Extends Mailable to provide generic type parameters for email data,
|
|
119
|
+
* ensuring template variables and component props are correctly typed
|
|
120
|
+
* and validated at build time. Improves developer experience and reduces
|
|
121
|
+
* runtime errors in complex email workflows.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* import { TypedMailable } from '@gravito/signal'
|
|
126
|
+
*
|
|
127
|
+
* interface WelcomeData {
|
|
128
|
+
* name: string
|
|
129
|
+
* activationUrl: string
|
|
130
|
+
* }
|
|
131
|
+
*
|
|
132
|
+
* class WelcomeEmail extends TypedMailable<WelcomeData> {
|
|
133
|
+
* protected data: WelcomeData
|
|
134
|
+
*
|
|
135
|
+
* build() {
|
|
136
|
+
* return this
|
|
137
|
+
* .to(this.data.email)
|
|
138
|
+
* .view('emails/welcome', this.data)
|
|
139
|
+
* }
|
|
140
|
+
* }
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @see {@link Mailable} For base functionality
|
|
144
|
+
* @see {@link Renderer} For rendering engines
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
export { TypedMailable } from './TypedMailable';
|
|
148
|
+
/**
|
|
149
|
+
* OrbitSignal - The central email service orbit for Gravito.
|
|
150
|
+
*
|
|
151
|
+
* A production-ready email service providing multi-transport support, automatic
|
|
152
|
+
* retry with exponential backoff, event-driven lifecycle hooks, and development
|
|
153
|
+
* tooling. Integrates seamlessly with Gravito's orbit system and queue infrastructure.
|
|
154
|
+
*
|
|
155
|
+
* Supports multiple transports (SMTP, AWS SES, Log, Memory) and rendering engines
|
|
156
|
+
* (HTML, Prism templates, React, Vue). In development mode, captures emails in an
|
|
157
|
+
* in-memory mailbox and displays a preview UI.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* import { OrbitSignal, SmtpTransport } from '@gravito/signal'
|
|
162
|
+
*
|
|
163
|
+
* const mail = new OrbitSignal({
|
|
164
|
+
* transport: new SmtpTransport({
|
|
165
|
+
* host: 'smtp.mailtrap.io',
|
|
166
|
+
* port: 2525,
|
|
167
|
+
* auth: { user: 'username', pass: 'password' }
|
|
168
|
+
* }),
|
|
169
|
+
* from: { name: 'My App', address: 'noreply@myapp.com' },
|
|
170
|
+
* devMode: process.env.NODE_ENV === 'development'
|
|
171
|
+
* })
|
|
172
|
+
*
|
|
173
|
+
* mail.install(core)
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* // Sending with events
|
|
179
|
+
* mail.on('beforeSend', async (event) => {
|
|
180
|
+
* console.log('Sending to:', event.message?.to[0].address)
|
|
181
|
+
* })
|
|
182
|
+
*
|
|
183
|
+
* await mail.send(new WelcomeEmail(user))
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @see {@link Mailable} For creating email messages
|
|
187
|
+
* @see {@link Transport} For custom transport implementations
|
|
188
|
+
* @see {@link MailEvent} For lifecycle event types
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
15
191
|
export { OrbitSignal } from './OrbitSignal';
|
|
192
|
+
/**
|
|
193
|
+
* Raw HTML content renderer.
|
|
194
|
+
*
|
|
195
|
+
* Renders plain HTML strings as email content. Suitable for pre-rendered
|
|
196
|
+
* HTML or when using other templating libraries. Performs minimal processing.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* import { Mailable, HtmlRenderer } from '@gravito/signal'
|
|
201
|
+
*
|
|
202
|
+
* class RawHtmlEmail extends Mailable {
|
|
203
|
+
* build() {
|
|
204
|
+
* return this
|
|
205
|
+
* .to('user@example.com')
|
|
206
|
+
* .html('<h1>Hello</h1><p>This is HTML</p>')
|
|
207
|
+
* }
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @see {@link Renderer} For the renderer interface
|
|
212
|
+
* @public
|
|
213
|
+
*/
|
|
16
214
|
export { HtmlRenderer } from './renderers/HtmlRenderer';
|
|
215
|
+
/**
|
|
216
|
+
* MJML (Responsive Email Markup Language) template renderer.
|
|
217
|
+
*
|
|
218
|
+
* Renders MJML template syntax and converts it to optimized, responsive HTML
|
|
219
|
+
* suitable for all email clients. MJML abstracts away CSS and media queries
|
|
220
|
+
* complexity while ensuring broad compatibility.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* import { Mailable, MjmlRenderer } from '@gravito/signal'
|
|
225
|
+
*
|
|
226
|
+
* class MjmlEmail extends Mailable {
|
|
227
|
+
* build() {
|
|
228
|
+
* return this
|
|
229
|
+
* .to('user@example.com')
|
|
230
|
+
* .view('emails/welcome.mjml', { name: 'Alice' })
|
|
231
|
+
* }
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* @see {@link ReactMjmlRenderer} For React components
|
|
236
|
+
* @see {@link VueMjmlRenderer} For Vue components
|
|
237
|
+
* @see {@link Renderer} For the renderer interface
|
|
238
|
+
* @public
|
|
239
|
+
*/
|
|
17
240
|
export { MjmlRenderer } from './renderers/MjmlRenderer';
|
|
241
|
+
/**
|
|
242
|
+
* Built-in MJML email templates and utilities.
|
|
243
|
+
*
|
|
244
|
+
* Pre-built responsive email template components and helpers for common
|
|
245
|
+
* use cases, reducing boilerplate when creating MJML-based emails.
|
|
246
|
+
*
|
|
247
|
+
* @see {@link MjmlRenderer} For MJML rendering
|
|
248
|
+
* @see {@link ReactMjmlRenderer} For React + MJML
|
|
249
|
+
* @public
|
|
250
|
+
*/
|
|
18
251
|
export * from './renderers/mjml-templates';
|
|
252
|
+
/**
|
|
253
|
+
* React component renderer with MJML support.
|
|
254
|
+
*
|
|
255
|
+
* Renders React components as email content with MJML syntax support,
|
|
256
|
+
* enabling you to build emails using familiar React patterns while maintaining
|
|
257
|
+
* responsive email best practices.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```typescript
|
|
261
|
+
* import { Mailable, ReactMjmlRenderer } from '@gravito/signal'
|
|
262
|
+
*
|
|
263
|
+
* const WelcomeComponent = ({ name }: { name: string }) => (
|
|
264
|
+
* <mjml>
|
|
265
|
+
* <mj-body>
|
|
266
|
+
* <mj-section>
|
|
267
|
+
* <mj-column><mj-text>Welcome, {name}!</mj-text></mj-column>
|
|
268
|
+
* </mj-section>
|
|
269
|
+
* </mj-body>
|
|
270
|
+
* </mjml>
|
|
271
|
+
* )
|
|
272
|
+
*
|
|
273
|
+
* class ReactEmail extends Mailable {
|
|
274
|
+
* build() {
|
|
275
|
+
* return this
|
|
276
|
+
* .to('user@example.com')
|
|
277
|
+
* .react(WelcomeComponent, { name: 'Alice' })
|
|
278
|
+
* }
|
|
279
|
+
* }
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
* @see {@link VueMjmlRenderer} For Vue component rendering
|
|
283
|
+
* @see {@link Renderer} For the renderer interface
|
|
284
|
+
* @public
|
|
285
|
+
*/
|
|
19
286
|
export { ReactMjmlRenderer } from './renderers/ReactMjmlRenderer';
|
|
287
|
+
/**
|
|
288
|
+
* Renderer abstractions for email content generation.
|
|
289
|
+
*
|
|
290
|
+
* Defines the interface and return type for building custom content renderers,
|
|
291
|
+
* enabling support for additional templating engines beyond the built-in
|
|
292
|
+
* HTML, Prism, React, and Vue implementations.
|
|
293
|
+
*
|
|
294
|
+
* @see {@link HtmlRenderer} For raw HTML content
|
|
295
|
+
* @see {@link TemplateRenderer} For Prism template rendering
|
|
296
|
+
* @see {@link ReactMjmlRenderer} For React component rendering
|
|
297
|
+
* @see {@link VueMjmlRenderer} For Vue component rendering
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
20
300
|
export type { Renderer, RenderResult } from './renderers/Renderer';
|
|
301
|
+
/**
|
|
302
|
+
* Prism templating engine renderer for email content.
|
|
303
|
+
*
|
|
304
|
+
* Renders Blade-style templates using the Prism template engine. Supports
|
|
305
|
+
* variables, control structures, and template inheritance for complex
|
|
306
|
+
* email layouts and components.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```typescript
|
|
310
|
+
* import { Mailable, TemplateRenderer } from '@gravito/signal'
|
|
311
|
+
*
|
|
312
|
+
* class TemplateEmail extends Mailable {
|
|
313
|
+
* build() {
|
|
314
|
+
* return this
|
|
315
|
+
* .to('user@example.com')
|
|
316
|
+
* .view('emails/welcome', { name: 'Alice' })
|
|
317
|
+
* }
|
|
318
|
+
* }
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* @see {@link Renderer} For the renderer interface
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
21
324
|
export { TemplateRenderer } from './renderers/TemplateRenderer';
|
|
325
|
+
/**
|
|
326
|
+
* Vue component renderer with MJML support.
|
|
327
|
+
*
|
|
328
|
+
* Renders Vue single-file components or templates as email content with MJML
|
|
329
|
+
* syntax support, enabling Vue developers to build emails using familiar
|
|
330
|
+
* patterns while maintaining responsive email best practices.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* import { Mailable, VueMjmlRenderer } from '@gravito/signal'
|
|
335
|
+
*
|
|
336
|
+
* class VueEmail extends Mailable {
|
|
337
|
+
* build() {
|
|
338
|
+
* return this
|
|
339
|
+
* .to('user@example.com')
|
|
340
|
+
* .vue('emails/welcome.vue', { name: 'Alice' })
|
|
341
|
+
* }
|
|
342
|
+
* }
|
|
343
|
+
* ```
|
|
344
|
+
*
|
|
345
|
+
* @see {@link ReactMjmlRenderer} For React component rendering
|
|
346
|
+
* @see {@link Renderer} For the renderer interface
|
|
347
|
+
* @public
|
|
348
|
+
*/
|
|
22
349
|
export { VueMjmlRenderer } from './renderers/VueMjmlRenderer';
|
|
23
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Base transport class with automatic retry and backoff logic.
|
|
352
|
+
*
|
|
353
|
+
* Provides common functionality for all transports, including exponential
|
|
354
|
+
* backoff retry strategy, connection management, and error handling.
|
|
355
|
+
* Extend this class to implement custom transport drivers.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```typescript
|
|
359
|
+
* import { BaseTransport, type TransportOptions } from '@gravito/signal'
|
|
360
|
+
*
|
|
361
|
+
* class CustomTransport extends BaseTransport {
|
|
362
|
+
* async send(message) {
|
|
363
|
+
* // Custom delivery logic
|
|
364
|
+
* }
|
|
365
|
+
* }
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @see {@link SmtpTransport} For production SMTP implementation
|
|
369
|
+
* @see {@link Transport} For the interface
|
|
370
|
+
* @public
|
|
371
|
+
*/
|
|
24
372
|
export { BaseTransport, type TransportOptions } from './transports/BaseTransport';
|
|
373
|
+
/**
|
|
374
|
+
* Console logging transport for development environments.
|
|
375
|
+
*
|
|
376
|
+
* Logs all emails to the console instead of sending them. Useful for
|
|
377
|
+
* local development and testing to avoid sending real emails to users.
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```typescript
|
|
381
|
+
* import { LogTransport } from '@gravito/signal'
|
|
382
|
+
*
|
|
383
|
+
* const mail = new OrbitSignal({
|
|
384
|
+
* transport: new LogTransport(),
|
|
385
|
+
* from: { address: 'dev@localhost' }
|
|
386
|
+
* })
|
|
387
|
+
* ```
|
|
388
|
+
*
|
|
389
|
+
* @see {@link MemoryTransport} For in-memory testing
|
|
390
|
+
* @public
|
|
391
|
+
*/
|
|
25
392
|
export { LogTransport } from './transports/LogTransport';
|
|
393
|
+
/**
|
|
394
|
+
* In-memory transport for testing email workflows.
|
|
395
|
+
*
|
|
396
|
+
* Stores sent emails in memory without actual transmission. Perfect for
|
|
397
|
+
* unit tests and integration tests where email sending needs to be verified
|
|
398
|
+
* without external dependencies.
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```typescript
|
|
402
|
+
* import { MemoryTransport } from '@gravito/signal'
|
|
403
|
+
*
|
|
404
|
+
* const transport = new MemoryTransport()
|
|
405
|
+
* const mail = new OrbitSignal({
|
|
406
|
+
* transport,
|
|
407
|
+
* from: { address: 'test@example.com' }
|
|
408
|
+
* })
|
|
409
|
+
*
|
|
410
|
+
* await mail.send(email)
|
|
411
|
+
* assert.equal(transport.sentMessages.length, 1)
|
|
412
|
+
* ```
|
|
413
|
+
*
|
|
414
|
+
* @see {@link LogTransport} For development logging
|
|
415
|
+
* @public
|
|
416
|
+
*/
|
|
26
417
|
export { MemoryTransport } from './transports/MemoryTransport';
|
|
418
|
+
/**
|
|
419
|
+
* AWS SES email transport with automatic retry and rate limit handling.
|
|
420
|
+
*
|
|
421
|
+
* Delivers emails via Amazon Simple Email Service with built-in support
|
|
422
|
+
* for authentication, rate limiting awareness, and automatic retry with
|
|
423
|
+
* exponential backoff suitable for production AWS environments.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```typescript
|
|
427
|
+
* import { SesTransport } from '@gravito/signal'
|
|
428
|
+
*
|
|
429
|
+
* const mail = new OrbitSignal({
|
|
430
|
+
* transport: new SesTransport({
|
|
431
|
+
* region: 'us-east-1',
|
|
432
|
+
* retries: 3,
|
|
433
|
+
* retryDelay: 1000,
|
|
434
|
+
* retryMultiplier: 2
|
|
435
|
+
* }),
|
|
436
|
+
* from: { address: 'verified@example.com' }
|
|
437
|
+
* })
|
|
438
|
+
* ```
|
|
439
|
+
*
|
|
440
|
+
* @see {@link SmtpTransport} For SMTP alternative
|
|
441
|
+
* @see {@link SesWebhookDriver} For bounce/complaint handling
|
|
442
|
+
* @public
|
|
443
|
+
*/
|
|
27
444
|
export { SesTransport } from './transports/SesTransport';
|
|
445
|
+
/**
|
|
446
|
+
* SMTP email transport with connection pooling and automatic retry.
|
|
447
|
+
*
|
|
448
|
+
* Delivers emails via standard SMTP protocol with support for TLS/SSL,
|
|
449
|
+
* connection pooling, and automatic retry with exponential backoff.
|
|
450
|
+
* Compatible with any SMTP server (Gmail, Mailtrap, AWS SES SMTP, etc.).
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* import { SmtpTransport } from '@gravito/signal'
|
|
455
|
+
*
|
|
456
|
+
* const mail = new OrbitSignal({
|
|
457
|
+
* transport: new SmtpTransport({
|
|
458
|
+
* host: 'smtp.mailtrap.io',
|
|
459
|
+
* port: 2525,
|
|
460
|
+
* auth: { user: 'username', pass: 'password' },
|
|
461
|
+
* poolSize: 10
|
|
462
|
+
* }),
|
|
463
|
+
* from: { address: 'noreply@example.com' }
|
|
464
|
+
* })
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* @see {@link SesTransport} For AWS SES integration
|
|
468
|
+
* @see {@link BaseTransport} For base retry logic
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
28
471
|
export { SmtpTransport } from './transports/SmtpTransport';
|
|
472
|
+
/**
|
|
473
|
+
* Transport interface and implementations for email delivery.
|
|
474
|
+
*
|
|
475
|
+
* Defines the contract for email delivery mechanisms and provides built-in
|
|
476
|
+
* transports: SmtpTransport (standard email servers), SesTransport (AWS SES),
|
|
477
|
+
* LogTransport (console output), and MemoryTransport (testing).
|
|
478
|
+
*
|
|
479
|
+
* @see {@link SmtpTransport} For SMTP server integration
|
|
480
|
+
* @see {@link SesTransport} For AWS SES integration
|
|
481
|
+
* @see {@link LogTransport} For development logging
|
|
482
|
+
* @see {@link MemoryTransport} For testing
|
|
483
|
+
* @public
|
|
484
|
+
*/
|
|
29
485
|
export type { Transport } from './transports/Transport';
|
|
486
|
+
/**
|
|
487
|
+
* Email message types and configuration interfaces.
|
|
488
|
+
*
|
|
489
|
+
* Provides TypeScript interfaces for:
|
|
490
|
+
* - Address: Email address with optional display name
|
|
491
|
+
* - Attachment: File attachment configuration
|
|
492
|
+
* - Envelope: Complete email envelope (from, to, cc, bcc, etc.)
|
|
493
|
+
* - MailConfig: OrbitSignal configuration options
|
|
494
|
+
* - Message: Finalized message ready for transport
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* import type { Address, Attachment, Message, MailConfig } from '@gravito/signal'
|
|
499
|
+
*
|
|
500
|
+
* const config: MailConfig = {
|
|
501
|
+
* transport: new SmtpTransport({ ... }),
|
|
502
|
+
* from: { name: 'App', address: 'noreply@app.com' }
|
|
503
|
+
* }
|
|
504
|
+
* ```
|
|
505
|
+
*
|
|
506
|
+
* @public
|
|
507
|
+
*/
|
|
30
508
|
export type { Address, Attachment, Envelope, MailConfig, Message, } from './types';
|
|
509
|
+
/**
|
|
510
|
+
* SendGrid webhook driver for handling bounce and complaint events.
|
|
511
|
+
*
|
|
512
|
+
* Processes webhook notifications from SendGrid (bounces, complaints, etc.)
|
|
513
|
+
* and converts them into standardized mail events for logging and analytics.
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```typescript
|
|
517
|
+
* import { SendGridWebhookDriver } from '@gravito/signal'
|
|
518
|
+
*
|
|
519
|
+
* const driver = new SendGridWebhookDriver()
|
|
520
|
+
* mail.registerWebhookDriver('sendgrid', driver)
|
|
521
|
+
* ```
|
|
522
|
+
*
|
|
523
|
+
* @see {@link SesWebhookDriver} For AWS SES webhooks
|
|
524
|
+
* @public
|
|
525
|
+
*/
|
|
31
526
|
export { type SendGridWebhookConfig, SendGridWebhookDriver } from './webhooks/SendGridWebhookDriver';
|
|
527
|
+
/**
|
|
528
|
+
* AWS SES webhook driver for handling bounce and complaint events.
|
|
529
|
+
*
|
|
530
|
+
* Processes SNS notifications from AWS SES (bounces, complaints, etc.)
|
|
531
|
+
* and converts them into standardized mail events for logging and analytics.
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```typescript
|
|
535
|
+
* import { SesWebhookDriver } from '@gravito/signal'
|
|
536
|
+
*
|
|
537
|
+
* const driver = new SesWebhookDriver()
|
|
538
|
+
* mail.registerWebhookDriver('ses', driver)
|
|
539
|
+
* ```
|
|
540
|
+
*
|
|
541
|
+
* @see {@link SendGridWebhookDriver} For SendGrid webhooks
|
|
542
|
+
* @public
|
|
543
|
+
*/
|
|
32
544
|
export { SesWebhookDriver } from './webhooks/SesWebhookDriver';
|