@igniter-js/mail 0.1.0 → 0.1.1

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.d.ts CHANGED
@@ -1,35 +1,20 @@
1
- import { StandardSchemaV1, IgniterLogger, IgniterJobQueueAdapter, JobQueueConfig, JobLimiter, IgniterError } from '@igniter-js/core';
1
+ import { StandardSchemaV1, JobLimiter, IgniterLogger, IgniterJobQueueAdapter, IgniterError } from '@igniter-js/core';
2
+ import { I as IgniterMailAdapter } from './adapter-BhnIsrlh.js';
3
+ export { b as IgniterMailAdapterCredentials, a as IgniterMailAdapterSendParams } from './adapter-BhnIsrlh.js';
4
+ import { IgniterTelemetryManager } from '@igniter-js/telemetry';
5
+ import { IgniterMailTelemetryEvents } from './telemetry/index.js';
2
6
  import { ReactElement } from 'react';
7
+ import 'zod';
3
8
 
4
- /**
5
- * Parameters used by a mail adapter to send an email.
6
- */
7
- interface MailAdapterSendParams {
8
- /** Recipient email address. */
9
- to: string;
10
- /** Email subject. */
11
- subject: string;
12
- /** HTML body. */
13
- html: string;
14
- /** Plain-text body. */
15
- text: string;
16
- /** Optional provider-level scheduled send date. */
17
- scheduledAt?: Date;
18
- }
19
- /**
20
- * Adapter interface used by {@link IgniterMail}.
21
- *
22
- * Adapters will eventually be imported from `@igniter-js/mail/adapters`.
23
- */
24
- interface MailAdapter {
25
- /** Sends an email using the underlying provider. */
26
- send: (params: MailAdapterSendParams) => Promise<void>;
27
- }
9
+ type IgniterMailTelemetryRegistry = {
10
+ [K in IgniterMailTelemetryEvents["namespace"]]: IgniterMailTelemetryEvents["events"];
11
+ };
12
+ type IgniterMailTelemetry = IgniterTelemetryManager<IgniterMailTelemetryRegistry>;
28
13
 
29
14
  /**
30
15
  * Email template definition used by {@link IgniterMail}.
31
16
  */
32
- interface IgniterMailTemplate<TSchema extends StandardSchemaV1> {
17
+ interface IgniterMailTemplateBuilt<TSchema extends StandardSchemaV1> {
33
18
  /** Default subject for the template (can be overridden per-send). */
34
19
  subject: string;
35
20
  /** Schema used to validate and infer template payload. */
@@ -40,38 +25,38 @@ interface IgniterMailTemplate<TSchema extends StandardSchemaV1> {
40
25
  /**
41
26
  * Extracts the valid template keys from a template map.
42
27
  */
43
- type MailTemplateKey<TTemplates extends object> = {
44
- [K in keyof TTemplates]: TTemplates[K] extends IgniterMailTemplate<any> ? K : never;
28
+ type IgniterMailTemplateKey<TTemplates extends object> = {
29
+ [K in keyof TTemplates]: TTemplates[K] extends IgniterMailTemplateBuilt<any> ? K : never;
45
30
  }[keyof TTemplates] & string;
46
31
  /**
47
32
  * Extracts the payload type from a template.
48
33
  */
49
- type MailTemplatePayload<TTemplate> = TTemplate extends IgniterMailTemplate<infer TSchema> ? StandardSchemaV1.InferInput<TSchema> : never;
34
+ type IgniterMailTemplatePayload<TTemplate> = TTemplate extends IgniterMailTemplateBuilt<infer TSchema> ? StandardSchemaV1.InferInput<TSchema> : never;
50
35
 
51
36
  /**
52
37
  * Type inference helper exposed by the runtime instance.
53
38
  */
54
39
  type IgniterMailInfer<TTemplates extends object> = {
55
40
  /** Union of valid template keys. */
56
- readonly Templates: MailTemplateKey<TTemplates>;
41
+ readonly Templates: IgniterMailTemplateKey<TTemplates>;
57
42
  /** Payloads by template. */
58
43
  readonly Payloads: {
59
- [K in MailTemplateKey<TTemplates>]: MailTemplatePayload<TTemplates[K]>;
44
+ [K in IgniterMailTemplateKey<TTemplates>]: IgniterMailTemplatePayload<TTemplates[K]>;
60
45
  };
61
46
  /**
62
47
  * Union of valid `mail.send()` inputs.
63
48
  * Useful for type-level consumption.
64
49
  */
65
50
  readonly SendInput: {
66
- [K in MailTemplateKey<TTemplates>]: IgniterMailSendParams<TTemplates, K>;
67
- }[MailTemplateKey<TTemplates>];
51
+ [K in IgniterMailTemplateKey<TTemplates>]: IgniterMailSendParams<TTemplates, K>;
52
+ }[IgniterMailTemplateKey<TTemplates>];
68
53
  /**
69
54
  * Tuple form of `mail.schedule()` inputs.
70
55
  */
71
56
  readonly ScheduleInput: [
72
57
  {
73
- [K in MailTemplateKey<TTemplates>]: IgniterMailSendParams<TTemplates, K>;
74
- }[MailTemplateKey<TTemplates>],
58
+ [K in IgniterMailTemplateKey<TTemplates>]: IgniterMailSendParams<TTemplates, K>;
59
+ }[IgniterMailTemplateKey<TTemplates>],
75
60
  Date
76
61
  ];
77
62
  };
@@ -79,14 +64,10 @@ type IgniterMailInfer<TTemplates extends object> = {
79
64
  * Queue options used when scheduling or enqueuing send jobs.
80
65
  */
81
66
  type IgniterMailQueueOptions = {
82
- /** Namespace used to compose the job id (default: "mail"). */
83
- namespace?: string;
84
- /** Task key used to compose the job id (default: "send"). */
85
- task?: string;
86
- /** Human-readable job name (default: "send"). */
87
- name?: string;
88
- /** Queue config for this job. */
89
- queue?: JobQueueConfig;
67
+ /** Job name (default: "send"). */
68
+ job?: string;
69
+ /** Queue name. */
70
+ queue?: string;
90
71
  /** Number of retry attempts on failure. */
91
72
  attempts?: number;
92
73
  /** Job priority (higher value = higher priority). */
@@ -106,15 +87,13 @@ type IgniterMailQueueOptions = {
106
87
  type IgniterMailQueueConfig = {
107
88
  /** Queue adapter instance. */
108
89
  adapter: IgniterJobQueueAdapter<any>;
109
- /** Fully qualified job id. */
110
- id: string;
111
90
  /** Optional queue options. */
112
91
  options?: IgniterMailQueueOptions;
113
92
  };
114
93
  /**
115
94
  * Parameters required to send an email using a template.
116
95
  */
117
- interface IgniterMailSendParams<TTemplates extends object, TSelectedTemplate extends MailTemplateKey<TTemplates>> {
96
+ interface IgniterMailSendParams<TTemplates extends object, TSelectedTemplate extends IgniterMailTemplateKey<TTemplates>> {
118
97
  /** Recipient email address. */
119
98
  to: string;
120
99
  /** Optional subject override. */
@@ -122,7 +101,7 @@ interface IgniterMailSendParams<TTemplates extends object, TSelectedTemplate ext
122
101
  /** Template key. */
123
102
  template: TSelectedTemplate;
124
103
  /** Template payload (validated using StandardSchema when provided). */
125
- data: MailTemplatePayload<TTemplates[TSelectedTemplate]>;
104
+ data: IgniterMailTemplatePayload<TTemplates[TSelectedTemplate]>;
126
105
  }
127
106
  /**
128
107
  * Hooks invoked by the runtime.
@@ -138,33 +117,20 @@ interface IgniterMailHooks<TTemplates extends object> {
138
117
  /**
139
118
  * Options used to initialize {@link IgniterMail}.
140
119
  */
141
- interface IgniterMailOptions<TTemplates extends object = Record<string, IgniterMailTemplate<any>>> extends IgniterMailHooks<TTemplates> {
120
+ interface IgniterMailOptions<TTemplates extends object = Record<string, IgniterMailTemplateBuilt<any>>> extends IgniterMailHooks<TTemplates> {
142
121
  /** Default FROM address used by the adapter. */
143
122
  from: string;
144
123
  /** Adapter implementation. */
145
- adapter: MailAdapter;
124
+ adapter: IgniterMailAdapter;
146
125
  /** Template registry. */
147
126
  templates: TTemplates;
148
127
  /** Optional logger used for debug/info/error logging. */
149
128
  logger?: IgniterLogger;
129
+ /** Optional telemetry instance for observability. */
130
+ telemetry?: IgniterMailTelemetry;
150
131
  /** Optional queue configuration for asynchronous delivery. */
151
132
  queue?: IgniterMailQueueConfig;
152
133
  }
153
- /**
154
- * Legacy initializer options.
155
- *
156
- * Kept for backwards compatibility with older integrations.
157
- */
158
- interface LegacyIgniterMailOptions<TTemplates extends object = Record<string, IgniterMailTemplate<any>>> extends IgniterMailHooks<TTemplates> {
159
- /** Provider secret/token. */
160
- secret: string;
161
- /** Default FROM address. */
162
- from: string;
163
- /** Adapter factory. */
164
- adapter: (options: LegacyIgniterMailOptions<any>) => MailAdapter;
165
- /** Template registry. */
166
- templates: TTemplates;
167
- }
168
134
  /**
169
135
  * Public interface implemented by {@link IgniterMail}.
170
136
  */
@@ -175,192 +141,41 @@ interface IIgniterMail<TTemplates extends object> {
175
141
  */
176
142
  readonly $Infer: IgniterMailInfer<TTemplates>;
177
143
  /** Sends an email immediately. */
178
- send: <TSelectedTemplate extends MailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>) => Promise<void>;
179
- /** Schedules an email for a future date (queue if configured, otherwise setTimeout). */
180
- schedule: <TSelectedTemplate extends MailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>, date: Date) => Promise<void>;
181
- }
182
- /**
183
- * Helper for creating a passthrough `StandardSchemaV1` validator.
184
- */
185
- declare function createPassthroughSchema(): StandardSchemaV1;
186
-
187
- /**
188
- * Postmark adapter builder.
189
- *
190
- * Notes:
191
- * - This implementation uses `fetch` (no SDK dependency).
192
- * - Designed to be extracted to `@igniter-js/mail/adapters/postmark`.
193
- */
194
- declare class PostmarkMailAdapterBuilder {
195
- private secret?;
196
- private from?;
197
- /** Creates a new builder instance. */
198
- static create(): PostmarkMailAdapterBuilder;
199
- /** Sets the Postmark Server Token. */
200
- withSecret(secret: string): this;
201
- /** Sets the default FROM address used when sending emails via Postmark. */
202
- withFrom(from: string): this;
203
- /** Builds the adapter instance. */
204
- build(): MailAdapter;
205
- }
206
- /**
207
- * Legacy adapter factory.
208
- */
209
- declare const postmarkAdapter: (options: LegacyIgniterMailOptions) => MailAdapter;
210
-
211
- declare class ResendMailAdapterBuilder {
212
- private secret?;
213
- private from?;
214
- /** Creates a new builder instance. */
215
- static create(): ResendMailAdapterBuilder;
216
- /** Sets the Resend API key. */
217
- withSecret(secret: string): this;
218
- /** Sets the default FROM address used when sending emails via Resend. */
219
- withFrom(from: string): this;
220
- /** Builds the adapter instance. */
221
- build(): MailAdapter;
222
- }
223
- /**
224
- * Legacy adapter factory.
225
- */
226
- declare const resendAdapter: (options: LegacyIgniterMailOptions) => MailAdapter;
227
-
228
- /**
229
- * SendGrid adapter builder.
230
- *
231
- * Notes:
232
- * - This implementation uses `fetch` (no SDK dependency).
233
- * - Designed to be extracted to `@igniter-js/mail/adapters/sendgrid`.
234
- */
235
- declare class SendGridMailAdapterBuilder {
236
- private secret?;
237
- private from?;
238
- /** Creates a new builder instance. */
239
- static create(): SendGridMailAdapterBuilder;
240
- /** Sets the SendGrid API key. */
241
- withSecret(secret: string): this;
242
- /** Sets the default FROM address used when sending emails via SendGrid. */
243
- withFrom(from: string): this;
244
- /** Builds the adapter instance. */
245
- build(): MailAdapter;
246
- }
247
- /**
248
- * Legacy adapter factory.
249
- */
250
- declare const sendgridAdapter: (options: LegacyIgniterMailOptions) => MailAdapter;
251
-
252
- declare class SmtpMailAdapterBuilder {
253
- private secret?;
254
- private from?;
255
- /** Creates a new builder instance. */
256
- static create(): SmtpMailAdapterBuilder;
257
- /** Sets the SMTP connection URL (e.g. `smtps://user:pass@host:port`). */
258
- withSecret(secret: string): this;
259
- /** Sets the default FROM address used when sending emails via SMTP. */
260
- withFrom(from: string): this;
261
- /** Builds the adapter instance. */
262
- build(): MailAdapter;
263
- }
264
- /**
265
- * Legacy adapter factory.
266
- */
267
- declare const smtpAdapter: (options: LegacyIgniterMailOptions) => MailAdapter;
268
-
269
- /**
270
- * In-memory message captured by {@link TestMailAdapter}.
271
- */
272
- type TestMailMessage = MailAdapterSendParams & {
273
- /** Timestamp when `send()` was called. */
274
- at: Date;
275
- };
276
- /**
277
- * A test-focused adapter that captures emails in memory.
278
- *
279
- * Why this exists:
280
- * - Allows unit tests to assert subjects/recipients/content without hitting a real provider.
281
- * - Can optionally log the send operation for local debugging.
282
- *
283
- * This adapter is intentionally dependency-free so it can live in `@igniter-js/mail/adapters`.
284
- */
285
- type TestMailAdapter = MailAdapter & {
286
- /** Captured sent messages, in order. */
287
- readonly sent: TestMailMessage[];
288
- /** Clears captured messages. */
289
- reset: () => void;
290
- /** Returns the last captured message (if any). */
291
- last: () => TestMailMessage | undefined;
292
- };
293
- type CreateTestMailAdapterOptions = {
294
- /** Optional logger; defaults to `console`. */
295
- logger?: Pick<IgniterLogger, 'info'>;
296
- /** Whether to suppress logs. Default: `false`. */
297
- silent?: boolean;
298
- };
299
- /**
300
- * Creates a {@link TestMailAdapter}.
301
- */
302
- declare function createTestMailAdapter(options?: CreateTestMailAdapterOptions): TestMailAdapter;
303
-
304
- /**
305
- * Webhook adapter builder.
306
- *
307
- * This adapter posts the email payload to an arbitrary HTTP endpoint.
308
- *
309
- * Why this exists:
310
- * - Useful for low-code automation (Make/Zapier/n8n) or custom internal relays.
311
- * - Dependency-free (uses `fetch`).
312
- * - Easy to extract as `@igniter-js/mail/adapters/webhook`.
313
- */
314
- declare class WebhookMailAdapterBuilder {
315
- private url?;
316
- private from?;
317
- /** Creates a new builder instance. */
318
- static create(): WebhookMailAdapterBuilder;
319
- /**
320
- * Sets the webhook URL.
321
- *
322
- * Note: when using `IgniterMailBuilder.withAdapter('webhook', secret)`, the `secret`
323
- * is treated as the webhook URL.
324
- */
325
- withUrl(url: string): this;
326
- /** Sets the default FROM address. */
327
- withFrom(from: string): this;
328
- /** Builds the adapter instance. */
329
- build(): MailAdapter;
144
+ send: <TSelectedTemplate extends IgniterMailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>) => Promise<void>;
145
+ /** Schedules an email for a future date (requires queue adapter). */
146
+ schedule: <TSelectedTemplate extends IgniterMailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>, date: Date) => Promise<void>;
330
147
  }
331
- /**
332
- * Legacy adapter factory.
333
- */
334
- declare const webhookAdapter: (options: LegacyIgniterMailOptions) => MailAdapter;
335
148
 
336
149
  /**
337
150
  * Builder for {@link IgniterMail}.
338
151
  *
339
152
  * This API is designed to remain stable when extracted to `@igniter-js/mail`.
340
153
  */
341
- declare class IgniterMailBuilder<TTemplates extends object = Record<never, never>> {
342
- private readonly factory;
154
+ declare class IgniterMailBuilder<TTemplates extends Record<string, IgniterMailTemplateBuilt<any>> = Record<string, IgniterMailTemplateBuilt<any>>> {
343
155
  private from?;
344
156
  private adapter?;
345
157
  private templates;
346
158
  private logger?;
159
+ private telemetry?;
347
160
  private queue?;
348
- private onSendStarted?;
349
- private onSendError?;
350
- private onSendSuccess?;
161
+ private onSendStartedHandler?;
162
+ private onSendErrorHandler?;
163
+ private onSendSuccessHandler?;
351
164
  private constructor();
352
165
  /**
353
166
  * Creates a new builder.
354
167
  */
355
- static create(factory: (options: IgniterMailOptions<any>) => IIgniterMail<any>): IgniterMailBuilder<Record<never, never>>;
168
+ static create(): IgniterMailBuilder<{}>;
356
169
  /** Sets the default FROM address. */
357
170
  withFrom(from: string): this;
358
171
  /** Attaches a logger instance. */
359
172
  withLogger(logger: IgniterLogger): this;
173
+ /** Attaches a telemetry instance for observability. */
174
+ withTelemetry(telemetry: IgniterMailTelemetry): this;
360
175
  /**
361
176
  * Enables queue delivery.
362
177
  *
363
- * If configured, `IgniterMail.schedule()` will enqueue jobs instead of using `setTimeout`.
178
+ * When configured, `IgniterMail.schedule()` will enqueue jobs using the queue adapter.
364
179
  */
365
180
  withQueue(adapter: IgniterJobQueueAdapter<any>, options?: IgniterMailQueueOptions): this;
366
181
  /**
@@ -369,53 +184,55 @@ declare class IgniterMailBuilder<TTemplates extends object = Record<never, never
369
184
  * - Use an adapter instance for full control.
370
185
  * - Or pass a provider key + secret for built-in adapters.
371
186
  */
372
- withAdapter(adapter: MailAdapter): this;
187
+ withAdapter(adapter: IgniterMailAdapter): this;
373
188
  withAdapter(provider: string, secret: string): this;
374
189
  /**
375
190
  * Registers a template.
376
191
  */
377
- addTemplate<TKey extends string, TTemplate extends IgniterMailTemplate<any>>(key: TKey, template: TTemplate): IgniterMailBuilder<TTemplates & Record<TKey, TTemplate>>;
192
+ addTemplate<TKey extends string, TTemplate extends IgniterMailTemplateBuilt<any>>(key: TKey, template: TTemplate): IgniterMailBuilder<TTemplates & { [K in TKey]: TTemplate; }>;
378
193
  /** Hook invoked before sending. */
379
- withOnSendStarted(onSendStarted: (params: IgniterMailSendParams<Record<string, IgniterMailTemplate<any>>, any>) => Promise<void>): this;
194
+ onSendStarted(handler: (params: IgniterMailSendParams<Record<string, IgniterMailTemplateBuilt<any>>, any>) => Promise<void>): this;
380
195
  /** Hook invoked on error. */
381
- withOnSendError(onSendError: (params: IgniterMailSendParams<Record<string, IgniterMailTemplate<any>>, any>, error: Error) => Promise<void>): this;
196
+ onSendError(handler: (params: IgniterMailSendParams<Record<string, IgniterMailTemplateBuilt<any>>, any>, error: Error) => Promise<void>): this;
382
197
  /** Hook invoked on success. */
383
- withOnSendSuccess(onSendSuccess: (params: IgniterMailSendParams<Record<string, IgniterMailTemplate<any>>, any>) => Promise<void>): this;
198
+ onSendSuccess(handler: (params: IgniterMailSendParams<Record<string, IgniterMailTemplateBuilt<any>>, any>) => Promise<void>): this;
384
199
  /**
385
200
  * Builds the {@link IgniterMail} instance.
386
201
  */
387
202
  build(): IIgniterMail<TTemplates>;
388
203
  }
204
+ declare const IgniterMail: typeof IgniterMailBuilder;
389
205
 
390
206
  /**
391
207
  * Builder for {@link IgniterMailTemplate}.
392
208
  */
393
- declare class MailTemplateBuilder<TSchema extends StandardSchemaV1 = StandardSchemaV1> {
209
+ declare class IgniterMailTemplateBuilder<TSchema extends StandardSchemaV1 = StandardSchemaV1> {
394
210
  private subject?;
395
211
  private schema?;
396
212
  private render?;
397
213
  /** Creates a new builder instance. */
398
- static create(): MailTemplateBuilder<any>;
214
+ static create(): IgniterMailTemplateBuilder<any>;
399
215
  /** Sets the default subject for the template. */
400
216
  withSubject(subject: string): this;
401
217
  /** Attaches the schema used to validate and infer payload types. */
402
- withSchema<TNextSchema extends StandardSchemaV1>(schema: TNextSchema): MailTemplateBuilder<TNextSchema>;
218
+ withSchema<TNextSchema extends StandardSchemaV1>(schema: TNextSchema): IgniterMailTemplateBuilder<TNextSchema>;
403
219
  /** Sets the React Email render function for the template. */
404
220
  withRender(render: (data: StandardSchemaV1.InferInput<TSchema>) => ReactElement): this;
405
221
  /** Builds the template definition. */
406
- build(): IgniterMailTemplate<TSchema>;
222
+ build(): IgniterMailTemplateBuilt<TSchema>;
407
223
  }
224
+ declare const IgniterMailTemplate: typeof IgniterMailTemplateBuilder;
408
225
 
409
226
  /**
410
227
  * Mail runtime for Igniter.js.
411
228
  *
412
229
  * This class is designed to be extracted into the `@igniter-js/mail` package.
413
230
  */
414
- declare class IgniterMail<TTemplates extends object> implements IIgniterMail<TTemplates> {
415
- private static instance;
231
+ declare class IgniterMailManagerCore<TTemplates extends object> implements IIgniterMail<TTemplates> {
416
232
  private readonly adapter;
417
233
  private readonly templates;
418
234
  private readonly logger?;
235
+ private readonly telemetry?;
419
236
  private readonly queue?;
420
237
  private queueJobRegistered;
421
238
  private queueJobRegistering?;
@@ -431,37 +248,22 @@ declare class IgniterMail<TTemplates extends object> implements IIgniterMail<TTe
431
248
  /**
432
249
  * Sends an email immediately.
433
250
  */
434
- send<TSelectedTemplate extends MailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>): Promise<void>;
251
+ send<TSelectedTemplate extends IgniterMailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>): Promise<void>;
435
252
  /**
436
253
  * Schedules an email for a future date.
437
254
  *
438
- * If a queue is configured, this method enqueues a job.
439
- * Otherwise, it uses a best-effort `setTimeout`.
255
+ * Requires a queue adapter; otherwise it throws.
440
256
  */
441
- schedule<TSelectedTemplate extends MailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>, date: Date): Promise<void>;
257
+ schedule<TSelectedTemplate extends IgniterMailTemplateKey<TTemplates>>(params: IgniterMailSendParams<TTemplates, TSelectedTemplate>, date: Date): Promise<void>;
442
258
  private onSendStarted;
443
259
  private onSendError;
444
260
  private onSendSuccess;
445
- /** Helper to declare adapter factories. */
446
- static adapter: <TOptions>(adapter: (options: TOptions) => MailAdapter) => (options: TOptions) => MailAdapter;
447
- /** Helper to declare templates with inferred payload types. */
448
- static template: <TSchema extends StandardSchemaV1>(template: IgniterMailTemplate<TSchema>) => IgniterMailTemplate<TSchema>;
449
- /**
450
- * Creates a new builder instance.
451
- */
452
- static create: () => IgniterMailBuilder<Record<never, never>>;
453
- /**
454
- * Initializes (singleton) instance.
455
- *
456
- * Prefer using {@link IgniterMail.create} for new code.
457
- */
458
- static initialize: <TEmailTemplates extends object>(options: IgniterMailOptions<TEmailTemplates> | LegacyIgniterMailOptions<TEmailTemplates>) => IgniterMail<TEmailTemplates>;
459
261
  }
460
262
 
461
263
  /**
462
264
  * Known error codes thrown by `@igniter-js/mail` runtime.
463
265
  */
464
- type IgniterMailErrorCode = 'MAIL_PROVIDER_FROM_REQUIRED' | 'MAIL_PROVIDER_ADAPTER_REQUIRED' | 'MAIL_PROVIDER_ADAPTER_SECRET_REQUIRED' | 'MAIL_PROVIDER_ADAPTER_NOT_FOUND' | 'MAIL_PROVIDER_TEMPLATES_REQUIRED' | 'MAIL_PROVIDER_TEMPLATE_NOT_FOUND' | 'MAIL_PROVIDER_TEMPLATE_DATA_INVALID' | 'MAIL_PROVIDER_SCHEDULE_DATE_INVALID' | 'MAIL_PROVIDER_SEND_FAILED' | 'MAIL_PROVIDER_SCHEDULE_FAILED' | 'MAIL_ADAPTER_CONFIGURATION_INVALID' | 'MAIL_TEMPLATE_CONFIGURATION_INVALID';
266
+ type IgniterMailErrorCode = 'MAIL_PROVIDER_FROM_REQUIRED' | 'MAIL_PROVIDER_ADAPTER_REQUIRED' | 'MAIL_PROVIDER_ADAPTER_SECRET_REQUIRED' | 'MAIL_PROVIDER_ADAPTER_NOT_FOUND' | 'MAIL_PROVIDER_TEMPLATES_REQUIRED' | 'MAIL_PROVIDER_TEMPLATE_NOT_FOUND' | 'MAIL_PROVIDER_TEMPLATE_DATA_INVALID' | 'MAIL_PROVIDER_SCHEDULE_DATE_INVALID' | 'MAIL_PROVIDER_SEND_FAILED' | 'MAIL_PROVIDER_SCHEDULE_FAILED' | 'MAIL_ADAPTER_CONFIGURATION_INVALID' | 'MAIL_TEMPLATE_CONFIGURATION_INVALID' | 'MAIL_PROVIDER_SCHEDULE_QUEUE_NOT_CONFIGURED';
465
267
  /**
466
268
  * Payload used to create an {@link IgniterMailError}.
467
269
  */
@@ -496,15 +298,19 @@ declare class IgniterMailError extends IgniterError {
496
298
  }
497
299
 
498
300
  /**
499
- * Resolves a legacy adapter factory by key.
500
- */
501
- declare const getAdapter: (adapter: string) => (options: LegacyIgniterMailOptions) => MailAdapter;
502
-
503
- /**
504
- * Validates an unknown input using `StandardSchemaV1` when the schema provides `~standard.validate`.
505
- *
506
- * If the schema does not provide a validator, this function returns the input as-is.
301
+ * Schema utilities for `@igniter-js/mail`.
507
302
  */
508
- declare function validateStandardSchemaInput<TSchema extends StandardSchemaV1>(schema: TSchema, input: unknown): Promise<StandardSchemaV1.InferInput<TSchema>>;
303
+ declare class IgniterMailSchema {
304
+ /**
305
+ * Validates an unknown input using `StandardSchemaV1` when the schema provides `~standard.validate`.
306
+ *
307
+ * If the schema does not provide a validator, this method returns the input as-is.
308
+ */
309
+ static validateInput<TSchema extends StandardSchemaV1>(schema: TSchema, input: unknown): Promise<StandardSchemaV1.InferInput<TSchema>>;
310
+ /**
311
+ * Creates a passthrough StandardSchema validator.
312
+ */
313
+ static createPassthroughSchema(): StandardSchemaV1;
314
+ }
509
315
 
510
- export { type CreateTestMailAdapterOptions, type IIgniterMail, IgniterMail, IgniterMailBuilder, IgniterMailError, type IgniterMailErrorCode, type IgniterMailErrorPayload, type IgniterMailHooks, type IgniterMailInfer, type IgniterMailOptions, type IgniterMailQueueConfig, type IgniterMailQueueOptions, type IgniterMailSendParams, type IgniterMailTemplate, type LegacyIgniterMailOptions, type MailAdapter, type MailAdapterSendParams, MailTemplateBuilder, type MailTemplateKey, type MailTemplatePayload, PostmarkMailAdapterBuilder, ResendMailAdapterBuilder, SendGridMailAdapterBuilder, SmtpMailAdapterBuilder, type TestMailAdapter, type TestMailMessage, WebhookMailAdapterBuilder, createPassthroughSchema, createTestMailAdapter, getAdapter, postmarkAdapter, resendAdapter, sendgridAdapter, smtpAdapter, validateStandardSchemaInput, webhookAdapter };
316
+ export { type IIgniterMail, IgniterMail, IgniterMailAdapter, IgniterMailBuilder, IgniterMailError, type IgniterMailErrorCode, type IgniterMailErrorPayload, type IgniterMailHooks, type IgniterMailInfer, IgniterMailManagerCore, type IgniterMailOptions, type IgniterMailQueueConfig, type IgniterMailQueueOptions, IgniterMailSchema, type IgniterMailSendParams, IgniterMailTemplate, IgniterMailTemplateBuilder, type IgniterMailTemplateBuilt, type IgniterMailTemplateKey, type IgniterMailTemplatePayload };