@fmontoya/aws-ses-adapter 1.0.0 → 1.2.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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Fabian Montoya
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fabian Montoya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @fmontoya/aws-ses-adapter
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@fmontoya/aws-ses-adapter)](https://www.npmjs.com/package/@fmontoya/aws-ses-adapter)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@fmontoya/aws-ses-adapter)](https://www.npmjs.com/package/@fmontoya/aws-ses-adapter)
5
+ [![license](https://img.shields.io/npm/l/@fmontoya/aws-ses-adapter)](./LICENSE)
6
+ [![node](https://img.shields.io/node/v/@fmontoya/aws-ses-adapter)](https://www.npmjs.com/package/@fmontoya/aws-ses-adapter)
7
+
3
8
  A lightweight TypeScript adapter that simplifies the [AWS SES](https://aws.amazon.com/ses/) email sending API for Node.js.
4
9
 
5
10
  - **Zero-boilerplate** — one `init()` call, then just `sendEmail()`
@@ -32,6 +37,7 @@ A lightweight TypeScript adapter that simplifies the [AWS SES](https://aws.amazo
32
37
  - [Express.js](#expressjs)
33
38
  - [NestJS](#nestjs)
34
39
  - [TypeScript Types](#typescript-types)
40
+ - [Contributing](#contributing)
35
41
  - [License](#license)
36
42
 
37
43
  ---
@@ -70,8 +76,10 @@ import { init } from '@fmontoya/aws-ses-adapter';
70
76
 
71
77
  init({
72
78
  region: 'us-east-1',
73
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
74
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
79
+ credentials: {
80
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
81
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
82
+ },
75
83
  defaultFrom: 'noreply@example.com',
76
84
  });
77
85
  ```
@@ -97,12 +105,14 @@ console.log('Sent! Message ID:', result.messageId);
97
105
 
98
106
  ### Via `init()` options
99
107
 
100
- | Option | Type | Required | Description |
101
- | ----------------- | -------- | -------- | ------------------------------------------------------------- |
102
- | `region` | `string` | Yes\* | AWS region where SES is configured (e.g. `us-east-1`). |
103
- | `accessKeyId` | `string` | Yes\* | AWS access key ID. |
104
- | `secretAccessKey` | `string` | Yes\* | AWS secret access key. |
105
- | `defaultFrom` | `string` | No | Default "From" address used when `from` is omitted per-email. |
108
+ | Option | Type | Required | Description |
109
+ | -------------------------------- | -------- | -------- | ------------------------------------------------------------- |
110
+ | `region` | `string` | Yes\* | AWS region where SES is configured (e.g. `us-east-1`). |
111
+ | `credentials.accessKeyId` | `string` | Yes\* | AWS access key ID. |
112
+ | `credentials.secretAccessKey` | `string` | Yes\* | AWS secret access key. |
113
+ | `defaultFrom` | `string` | No | Default "From" address used when `from` is omitted per-email. |
114
+ | `accessKeyId` _(deprecated)_ | `string` | — | Use `credentials.accessKeyId` instead. |
115
+ | `secretAccessKey` _(deprecated)_ | `string` | — | Use `credentials.secretAccessKey` instead. |
106
116
 
107
117
  \* Required unless the corresponding environment variable is set.
108
118
 
@@ -137,8 +147,10 @@ import { init } from '@fmontoya/aws-ses-adapter';
137
147
 
138
148
  init({
139
149
  region: 'us-east-1',
140
- accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
141
- secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
150
+ credentials: {
151
+ accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
152
+ secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
153
+ },
142
154
  defaultFrom: 'noreply@example.com',
143
155
  });
144
156
  ```
@@ -277,8 +289,10 @@ import { SesAdapter } from '@fmontoya/aws-ses-adapter';
277
289
 
278
290
  const adapter = new SesAdapter({
279
291
  region: 'eu-west-1',
280
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
281
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
292
+ credentials: {
293
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
294
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
295
+ },
282
296
  defaultFrom: 'noreply@myapp.com',
283
297
  });
284
298
 
@@ -393,8 +407,10 @@ import { EmailService } from './email.service';
393
407
  const { SesAdapter } = require('@fmontoya/aws-ses-adapter');
394
408
  return new SesAdapter({
395
409
  region: process.env.AWS_SES_REGION,
396
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
397
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
410
+ credentials: {
411
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
412
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
413
+ },
398
414
  defaultFrom: process.env.AWS_SES_FROM_EMAIL,
399
415
  });
400
416
  },
@@ -439,6 +455,14 @@ import type {
439
455
 
440
456
  ---
441
457
 
458
+ ## Contributing
459
+
460
+ Contributions are welcome! Please read the [Contributing Guide](./CONTRIBUTING.md) to get started.
461
+
462
+ This project follows the [Contributor Covenant](./CODE_OF_CONDUCT.md) code of conduct.
463
+
464
+ ---
465
+
442
466
  ## License
443
467
 
444
468
  [MIT](./LICENSE) © [FabianMontoya](https://github.com/FabianMontoya)
package/dist/index.d.mts CHANGED
@@ -9,10 +9,13 @@
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
+ * // Recommended: use the credentials object
12
13
  * const config: SesAdapterConfig = {
13
14
  * region: 'us-east-1',
14
- * accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
15
- * secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
15
+ * credentials: {
16
+ * accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
17
+ * secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
18
+ * },
16
19
  * defaultFrom: 'noreply@example.com',
17
20
  * };
18
21
  * ```
@@ -23,14 +26,36 @@ interface SesAdapterConfig {
23
26
  * Falls back to the `AWS_SES_REGION` environment variable if not provided.
24
27
  */
25
28
  region?: string;
29
+ /**
30
+ * AWS credentials for authentication.
31
+ * Takes precedence over the deprecated top-level `accessKeyId` and `secretAccessKey` fields.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * credentials: {
36
+ * accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
37
+ * secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
38
+ * }
39
+ * ```
40
+ */
41
+ credentials?: {
42
+ /** AWS access key ID. Required when `credentials` is provided. */
43
+ accessKeyId: string;
44
+ /** AWS secret access key. Required when `credentials` is provided. */
45
+ secretAccessKey: string;
46
+ };
26
47
  /**
27
48
  * AWS access key ID for authentication.
28
49
  * Falls back to the `AWS_ACCESS_KEY_ID` environment variable if not provided.
50
+ *
51
+ * @deprecated Use `credentials.accessKeyId` instead.
29
52
  */
30
53
  accessKeyId?: string;
31
54
  /**
32
55
  * AWS secret access key for authentication.
33
56
  * Falls back to the `AWS_SECRET_ACCESS_KEY` environment variable if not provided.
57
+ *
58
+ * @deprecated Use `credentials.secretAccessKey` instead.
34
59
  */
35
60
  secretAccessKey?: string;
36
61
  /**
@@ -196,6 +221,36 @@ declare class SesAdapter {
196
221
  * @throws {SesConfigError} When required configuration fields are missing.
197
222
  */
198
223
  constructor(userConfig?: SesAdapterConfig);
224
+ /**
225
+ * Validates that at least one body content field (`html` or `text`) is provided.
226
+ *
227
+ * @param options - Object containing optional `html` and `text` fields.
228
+ * @throws {SesValidationError} When neither field is present.
229
+ *
230
+ * @internal
231
+ */
232
+ private validateBodyOptions;
233
+ /**
234
+ * Resolves the sender address from the per-call option or the adapter default.
235
+ *
236
+ * @param from - The per-call "from" address, if provided.
237
+ * @returns The resolved sender address.
238
+ * @throws {SesValidationError} When no sender address can be determined.
239
+ *
240
+ * @internal
241
+ */
242
+ private resolveFrom;
243
+ /**
244
+ * Dispatches a raw MIME message via `SendRawEmailCommand`.
245
+ *
246
+ * @param rawMessage - The raw MIME string to send.
247
+ * @param errorContext - Human-readable context prepended to error messages.
248
+ * @returns A promise resolving to a {@link SendEmailResult}.
249
+ * @throws {SesSendError} When the AWS SES API call fails.
250
+ *
251
+ * @internal
252
+ */
253
+ private dispatchRawEmail;
199
254
  /**
200
255
  * Sends an email using AWS SES.
201
256
  *
@@ -329,7 +384,7 @@ declare class SesAdapter {
329
384
  *
330
385
  * @example
331
386
  * ```ts
332
- * import { sendEmail } from 'aws-ses-adapter';
387
+ * import { sendEmail } from '@fmontoya/aws-ses-adapter';
333
388
  *
334
389
  * // Calling sendEmail before init() throws this error
335
390
  * try {
@@ -353,7 +408,7 @@ declare class SesNotInitializedError extends Error {
353
408
  *
354
409
  * @example
355
410
  * ```ts
356
- * import { init } from 'aws-ses-adapter';
411
+ * import { init } from '@fmontoya/aws-ses-adapter';
357
412
  *
358
413
  * try {
359
414
  * init({}); // No region, no env vars set
@@ -378,7 +433,7 @@ declare class SesConfigError extends Error {
378
433
  *
379
434
  * @example
380
435
  * ```ts
381
- * import { sendEmail, SesSendError } from 'aws-ses-adapter';
436
+ * import { sendEmail, SesSendError } from '@fmontoya/aws-ses-adapter';
382
437
  *
383
438
  * try {
384
439
  * await sendEmail({ to: 'user@example.com', subject: 'Hi', text: 'Hello' });
@@ -405,7 +460,7 @@ declare class SesSendError extends Error {
405
460
  *
406
461
  * @example
407
462
  * ```ts
408
- * import { sendEmail, SesValidationError } from 'aws-ses-adapter';
463
+ * import { sendEmail, SesValidationError } from '@fmontoya/aws-ses-adapter';
409
464
  *
410
465
  * try {
411
466
  * // Missing both html and text
@@ -435,19 +490,21 @@ declare class SesValidationError extends Error {
435
490
  *
436
491
  * **1. Initialize once** (at application startup):
437
492
  * ```ts
438
- * import { init } from 'aws-ses-adapter';
493
+ * import { init } from '@fmontoya/aws-ses-adapter';
439
494
  *
440
495
  * init({
441
496
  * region: 'us-east-1',
442
- * accessKeyId: 'YOUR_KEY',
443
- * secretAccessKey: 'YOUR_SECRET',
497
+ * credentials: {
498
+ * accessKeyId: 'YOUR_KEY',
499
+ * secretAccessKey: 'YOUR_SECRET',
500
+ * },
444
501
  * defaultFrom: 'noreply@example.com',
445
502
  * });
446
503
  * ```
447
504
  *
448
505
  * **2. Use anywhere** in your application:
449
506
  * ```ts
450
- * import { sendEmail } from 'aws-ses-adapter';
507
+ * import { sendEmail } from '@fmontoya/aws-ses-adapter';
451
508
  *
452
509
  * await sendEmail({
453
510
  * to: 'user@example.com',
@@ -473,8 +530,9 @@ declare class SesValidationError extends Error {
473
530
  * which is useful for reconfiguration during testing.
474
531
  *
475
532
  * Credentials are resolved in the following order:
476
- * 1. Values provided in the `config` argument.
477
- * 2. Environment variables (`AWS_SES_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`).
533
+ * 1. `config.credentials.accessKeyId` / `config.credentials.secretAccessKey`
534
+ * 2. `config.accessKeyId` / `config.secretAccessKey` _(deprecated)_
535
+ * 3. Environment variables (`AWS_SES_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
478
536
  *
479
537
  * @param config - Optional configuration. Omit any field to fall back to environment variables.
480
538
  * @throws {SesConfigError} When required credentials cannot be resolved.
@@ -484,8 +542,10 @@ declare class SesValidationError extends Error {
484
542
  * // Using explicit credentials
485
543
  * init({
486
544
  * region: 'us-east-1',
487
- * accessKeyId: process.env.MY_KEY_ID,
488
- * secretAccessKey: process.env.MY_SECRET,
545
+ * credentials: {
546
+ * accessKeyId: process.env.MY_KEY_ID,
547
+ * secretAccessKey: process.env.MY_SECRET,
548
+ * },
489
549
  * defaultFrom: 'no-reply@myapp.com',
490
550
  * });
491
551
  *
@@ -508,7 +568,7 @@ declare function init(config?: SesAdapterConfig): void;
508
568
  *
509
569
  * @example
510
570
  * ```ts
511
- * import { sendEmail } from 'aws-ses-adapter';
571
+ * import { sendEmail } from '@fmontoya/aws-ses-adapter';
512
572
  *
513
573
  * const result = await sendEmail({
514
574
  * to: 'alice@example.com',
@@ -539,7 +599,7 @@ declare function sendEmail(options: SendEmailOptions): Promise<SendEmailResult>;
539
599
  *
540
600
  * @example
541
601
  * ```ts
542
- * import { sendEmailWithAttachments } from 'aws-ses-adapter';
602
+ * import { sendEmailWithAttachments } from '@fmontoya/aws-ses-adapter';
543
603
  * import { readFileSync } from 'fs';
544
604
  *
545
605
  * const result = await sendEmailWithAttachments({
@@ -573,7 +633,7 @@ declare function sendEmailWithAttachments(options: SendEmailWithAttachmentsOptio
573
633
  *
574
634
  * @example
575
635
  * ```ts
576
- * import { sendRawEmail } from 'aws-ses-adapter';
636
+ * import { sendRawEmail } from '@fmontoya/aws-ses-adapter';
577
637
  *
578
638
  * const mime = [
579
639
  * 'From: sender@example.com',
@@ -596,7 +656,7 @@ declare function sendRawEmail(rawMessage: string): Promise<SendEmailResult>;
596
656
  *
597
657
  * @example
598
658
  * ```ts
599
- * import { isInitialized } from 'aws-ses-adapter';
659
+ * import { isInitialized } from '@fmontoya/aws-ses-adapter';
600
660
  *
601
661
  * if (!isInitialized()) {
602
662
  * init();
@@ -612,7 +672,7 @@ declare function isInitialized(): boolean;
612
672
  *
613
673
  * @example
614
674
  * ```ts
615
- * import { hasDefaultFrom } from 'aws-ses-adapter';
675
+ * import { hasDefaultFrom } from '@fmontoya/aws-ses-adapter';
616
676
  *
617
677
  * console.log(hasDefaultFrom()); // => true
618
678
  * ```
@@ -627,7 +687,7 @@ declare function hasDefaultFrom(): boolean;
627
687
  *
628
688
  * @example
629
689
  * ```ts
630
- * import { getDefaultFrom } from 'aws-ses-adapter';
690
+ * import { getDefaultFrom } from '@fmontoya/aws-ses-adapter';
631
691
  *
632
692
  * const from = getDefaultFrom();
633
693
  * // => 'noreply@example.com' or undefined
@@ -642,7 +702,7 @@ declare function getDefaultFrom(): string | undefined;
642
702
  *
643
703
  * @example
644
704
  * ```ts
645
- * import { getRegion } from 'aws-ses-adapter';
705
+ * import { getRegion } from '@fmontoya/aws-ses-adapter';
646
706
  *
647
707
  * console.log(getRegion()); // => 'us-east-1'
648
708
  * ```
package/dist/index.d.ts CHANGED
@@ -9,10 +9,13 @@
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
+ * // Recommended: use the credentials object
12
13
  * const config: SesAdapterConfig = {
13
14
  * region: 'us-east-1',
14
- * accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
15
- * secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
15
+ * credentials: {
16
+ * accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
17
+ * secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
18
+ * },
16
19
  * defaultFrom: 'noreply@example.com',
17
20
  * };
18
21
  * ```
@@ -23,14 +26,36 @@ interface SesAdapterConfig {
23
26
  * Falls back to the `AWS_SES_REGION` environment variable if not provided.
24
27
  */
25
28
  region?: string;
29
+ /**
30
+ * AWS credentials for authentication.
31
+ * Takes precedence over the deprecated top-level `accessKeyId` and `secretAccessKey` fields.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * credentials: {
36
+ * accessKeyId: 'AKIAIOSFODNN7EXAMPLE',
37
+ * secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
38
+ * }
39
+ * ```
40
+ */
41
+ credentials?: {
42
+ /** AWS access key ID. Required when `credentials` is provided. */
43
+ accessKeyId: string;
44
+ /** AWS secret access key. Required when `credentials` is provided. */
45
+ secretAccessKey: string;
46
+ };
26
47
  /**
27
48
  * AWS access key ID for authentication.
28
49
  * Falls back to the `AWS_ACCESS_KEY_ID` environment variable if not provided.
50
+ *
51
+ * @deprecated Use `credentials.accessKeyId` instead.
29
52
  */
30
53
  accessKeyId?: string;
31
54
  /**
32
55
  * AWS secret access key for authentication.
33
56
  * Falls back to the `AWS_SECRET_ACCESS_KEY` environment variable if not provided.
57
+ *
58
+ * @deprecated Use `credentials.secretAccessKey` instead.
34
59
  */
35
60
  secretAccessKey?: string;
36
61
  /**
@@ -196,6 +221,36 @@ declare class SesAdapter {
196
221
  * @throws {SesConfigError} When required configuration fields are missing.
197
222
  */
198
223
  constructor(userConfig?: SesAdapterConfig);
224
+ /**
225
+ * Validates that at least one body content field (`html` or `text`) is provided.
226
+ *
227
+ * @param options - Object containing optional `html` and `text` fields.
228
+ * @throws {SesValidationError} When neither field is present.
229
+ *
230
+ * @internal
231
+ */
232
+ private validateBodyOptions;
233
+ /**
234
+ * Resolves the sender address from the per-call option or the adapter default.
235
+ *
236
+ * @param from - The per-call "from" address, if provided.
237
+ * @returns The resolved sender address.
238
+ * @throws {SesValidationError} When no sender address can be determined.
239
+ *
240
+ * @internal
241
+ */
242
+ private resolveFrom;
243
+ /**
244
+ * Dispatches a raw MIME message via `SendRawEmailCommand`.
245
+ *
246
+ * @param rawMessage - The raw MIME string to send.
247
+ * @param errorContext - Human-readable context prepended to error messages.
248
+ * @returns A promise resolving to a {@link SendEmailResult}.
249
+ * @throws {SesSendError} When the AWS SES API call fails.
250
+ *
251
+ * @internal
252
+ */
253
+ private dispatchRawEmail;
199
254
  /**
200
255
  * Sends an email using AWS SES.
201
256
  *
@@ -329,7 +384,7 @@ declare class SesAdapter {
329
384
  *
330
385
  * @example
331
386
  * ```ts
332
- * import { sendEmail } from 'aws-ses-adapter';
387
+ * import { sendEmail } from '@fmontoya/aws-ses-adapter';
333
388
  *
334
389
  * // Calling sendEmail before init() throws this error
335
390
  * try {
@@ -353,7 +408,7 @@ declare class SesNotInitializedError extends Error {
353
408
  *
354
409
  * @example
355
410
  * ```ts
356
- * import { init } from 'aws-ses-adapter';
411
+ * import { init } from '@fmontoya/aws-ses-adapter';
357
412
  *
358
413
  * try {
359
414
  * init({}); // No region, no env vars set
@@ -378,7 +433,7 @@ declare class SesConfigError extends Error {
378
433
  *
379
434
  * @example
380
435
  * ```ts
381
- * import { sendEmail, SesSendError } from 'aws-ses-adapter';
436
+ * import { sendEmail, SesSendError } from '@fmontoya/aws-ses-adapter';
382
437
  *
383
438
  * try {
384
439
  * await sendEmail({ to: 'user@example.com', subject: 'Hi', text: 'Hello' });
@@ -405,7 +460,7 @@ declare class SesSendError extends Error {
405
460
  *
406
461
  * @example
407
462
  * ```ts
408
- * import { sendEmail, SesValidationError } from 'aws-ses-adapter';
463
+ * import { sendEmail, SesValidationError } from '@fmontoya/aws-ses-adapter';
409
464
  *
410
465
  * try {
411
466
  * // Missing both html and text
@@ -435,19 +490,21 @@ declare class SesValidationError extends Error {
435
490
  *
436
491
  * **1. Initialize once** (at application startup):
437
492
  * ```ts
438
- * import { init } from 'aws-ses-adapter';
493
+ * import { init } from '@fmontoya/aws-ses-adapter';
439
494
  *
440
495
  * init({
441
496
  * region: 'us-east-1',
442
- * accessKeyId: 'YOUR_KEY',
443
- * secretAccessKey: 'YOUR_SECRET',
497
+ * credentials: {
498
+ * accessKeyId: 'YOUR_KEY',
499
+ * secretAccessKey: 'YOUR_SECRET',
500
+ * },
444
501
  * defaultFrom: 'noreply@example.com',
445
502
  * });
446
503
  * ```
447
504
  *
448
505
  * **2. Use anywhere** in your application:
449
506
  * ```ts
450
- * import { sendEmail } from 'aws-ses-adapter';
507
+ * import { sendEmail } from '@fmontoya/aws-ses-adapter';
451
508
  *
452
509
  * await sendEmail({
453
510
  * to: 'user@example.com',
@@ -473,8 +530,9 @@ declare class SesValidationError extends Error {
473
530
  * which is useful for reconfiguration during testing.
474
531
  *
475
532
  * Credentials are resolved in the following order:
476
- * 1. Values provided in the `config` argument.
477
- * 2. Environment variables (`AWS_SES_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`).
533
+ * 1. `config.credentials.accessKeyId` / `config.credentials.secretAccessKey`
534
+ * 2. `config.accessKeyId` / `config.secretAccessKey` _(deprecated)_
535
+ * 3. Environment variables (`AWS_SES_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
478
536
  *
479
537
  * @param config - Optional configuration. Omit any field to fall back to environment variables.
480
538
  * @throws {SesConfigError} When required credentials cannot be resolved.
@@ -484,8 +542,10 @@ declare class SesValidationError extends Error {
484
542
  * // Using explicit credentials
485
543
  * init({
486
544
  * region: 'us-east-1',
487
- * accessKeyId: process.env.MY_KEY_ID,
488
- * secretAccessKey: process.env.MY_SECRET,
545
+ * credentials: {
546
+ * accessKeyId: process.env.MY_KEY_ID,
547
+ * secretAccessKey: process.env.MY_SECRET,
548
+ * },
489
549
  * defaultFrom: 'no-reply@myapp.com',
490
550
  * });
491
551
  *
@@ -508,7 +568,7 @@ declare function init(config?: SesAdapterConfig): void;
508
568
  *
509
569
  * @example
510
570
  * ```ts
511
- * import { sendEmail } from 'aws-ses-adapter';
571
+ * import { sendEmail } from '@fmontoya/aws-ses-adapter';
512
572
  *
513
573
  * const result = await sendEmail({
514
574
  * to: 'alice@example.com',
@@ -539,7 +599,7 @@ declare function sendEmail(options: SendEmailOptions): Promise<SendEmailResult>;
539
599
  *
540
600
  * @example
541
601
  * ```ts
542
- * import { sendEmailWithAttachments } from 'aws-ses-adapter';
602
+ * import { sendEmailWithAttachments } from '@fmontoya/aws-ses-adapter';
543
603
  * import { readFileSync } from 'fs';
544
604
  *
545
605
  * const result = await sendEmailWithAttachments({
@@ -573,7 +633,7 @@ declare function sendEmailWithAttachments(options: SendEmailWithAttachmentsOptio
573
633
  *
574
634
  * @example
575
635
  * ```ts
576
- * import { sendRawEmail } from 'aws-ses-adapter';
636
+ * import { sendRawEmail } from '@fmontoya/aws-ses-adapter';
577
637
  *
578
638
  * const mime = [
579
639
  * 'From: sender@example.com',
@@ -596,7 +656,7 @@ declare function sendRawEmail(rawMessage: string): Promise<SendEmailResult>;
596
656
  *
597
657
  * @example
598
658
  * ```ts
599
- * import { isInitialized } from 'aws-ses-adapter';
659
+ * import { isInitialized } from '@fmontoya/aws-ses-adapter';
600
660
  *
601
661
  * if (!isInitialized()) {
602
662
  * init();
@@ -612,7 +672,7 @@ declare function isInitialized(): boolean;
612
672
  *
613
673
  * @example
614
674
  * ```ts
615
- * import { hasDefaultFrom } from 'aws-ses-adapter';
675
+ * import { hasDefaultFrom } from '@fmontoya/aws-ses-adapter';
616
676
  *
617
677
  * console.log(hasDefaultFrom()); // => true
618
678
  * ```
@@ -627,7 +687,7 @@ declare function hasDefaultFrom(): boolean;
627
687
  *
628
688
  * @example
629
689
  * ```ts
630
- * import { getDefaultFrom } from 'aws-ses-adapter';
690
+ * import { getDefaultFrom } from '@fmontoya/aws-ses-adapter';
631
691
  *
632
692
  * const from = getDefaultFrom();
633
693
  * // => 'noreply@example.com' or undefined
@@ -642,7 +702,7 @@ declare function getDefaultFrom(): string | undefined;
642
702
  *
643
703
  * @example
644
704
  * ```ts
645
- * import { getRegion } from 'aws-ses-adapter';
705
+ * import { getRegion } from '@fmontoya/aws-ses-adapter';
646
706
  *
647
707
  * console.log(getRegion()); // => 'us-east-1'
648
708
  * ```