@aligent/aws-wrappers 0.5.9 → 0.5.10

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 (39) hide show
  1. package/README.md +43 -2
  2. package/cjs/index.cjs +148 -8
  3. package/cjs/package.json +2 -1
  4. package/cjs/src/eventbridge/eventbridge.d.ts.map +1 -1
  5. package/cjs/src/index.d.ts +1 -0
  6. package/cjs/src/index.d.ts.map +1 -1
  7. package/cjs/src/ses/ses.d.ts +64 -0
  8. package/cjs/src/ses/ses.d.ts.map +1 -0
  9. package/cjs/src/util/chunk.d.ts +8 -0
  10. package/cjs/src/util/chunk.d.ts.map +1 -1
  11. package/docs/index/classes/APIGatewayService.md +6 -6
  12. package/docs/index/classes/APIGatewayV2Service.md +5 -5
  13. package/docs/index/classes/BatchOperationError.md +5 -5
  14. package/docs/index/classes/DynamoDBService.md +12 -12
  15. package/docs/index/classes/EventBridgeService.md +3 -3
  16. package/docs/index/classes/LambdaFunctionError.md +7 -7
  17. package/docs/index/classes/LambdaService.md +3 -3
  18. package/docs/index/classes/S3Service.md +15 -15
  19. package/docs/index/classes/SESService.md +123 -0
  20. package/docs/index/classes/SNSService.md +4 -4
  21. package/docs/index/classes/SQSService.md +7 -7
  22. package/docs/index/classes/SSMService.md +7 -7
  23. package/docs/index/classes/SchedulerService.md +11 -11
  24. package/docs/index/classes/SecretsManagerService.md +8 -8
  25. package/docs/index/classes/StepFunctionsService.md +6 -6
  26. package/docs/index/interfaces/BatchFailedEntry.md +4 -4
  27. package/docs/index/interfaces/EmptyBucketPageResult.md +2 -2
  28. package/docs/index/modules.md +1 -0
  29. package/docs/testing/testing/functions/createMockService.md +1 -1
  30. package/esm/index.mjs +148 -9
  31. package/esm/package.json +2 -1
  32. package/esm/src/eventbridge/eventbridge.d.ts.map +1 -1
  33. package/esm/src/index.d.ts +1 -0
  34. package/esm/src/index.d.ts.map +1 -1
  35. package/esm/src/ses/ses.d.ts +64 -0
  36. package/esm/src/ses/ses.d.ts.map +1 -0
  37. package/esm/src/util/chunk.d.ts +8 -0
  38. package/esm/src/util/chunk.d.ts.map +1 -1
  39. package/package.json +2 -1
package/README.md CHANGED
@@ -27,7 +27,7 @@ Every wrapper emits one `logger.info` line per SDK call with a per-method safe-f
27
27
 
28
28
  ### Batch semantics
29
29
 
30
- Batch methods split your entries into chunks of the size the AWS API allows and send one request per chunk. AWS reports rejected entries inside an otherwise successful response, so a resolved request does not mean every entry was accepted. Currently covered: `SQSService.sendMessageBatch`, `SQSService.deleteMessageBatch`, `SNSService.publishBatch`, `EventBridgeService.putEvents`, `S3Service.deleteObjects`, `S3Service.emptyBucket` and, when `required` is set, `SSMService.getParameters`.
30
+ Batch methods split your entries into chunks of the size the AWS API allows and send one request per chunk. AWS reports rejected entries inside an otherwise successful response, so a resolved request does not mean every entry was accepted. Currently covered: `SQSService.sendMessageBatch`, `SQSService.deleteMessageBatch`, `SNSService.publishBatch`, `SESService.sendBulkEmail`, `EventBridgeService.putEvents`, `S3Service.deleteObjects`, `S3Service.emptyBucket` and, when `required` is set, `SSMService.getParameters`.
31
31
 
32
32
  Every chunk is sent first. If any entry was rejected, the method then throws a single `BatchOperationError`. A call where nothing was rejected returns exactly what it did before.
33
33
 
@@ -50,7 +50,7 @@ try {
50
50
  ```
51
51
 
52
52
  - `failed` carries only the entry identifier, error code and message — never message bodies, attributes or any other payload. For S3 the identifier is the object key; for SSM it is the parameter path.
53
- - `EventBridgeService.putEvents` entries have no identifier of their own, so for that method `id` is the entry's index in the `Entries` list you passed in, as a string.
53
+ - `EventBridgeService.putEvents` and `SESService.sendBulkEmail` entries have no identifier of their own, so for those methods `id` is the entry's index in the `Entries` / `BulkEmailEntries` list you passed in, as a string.
54
54
  - The error has a stable `name` of `'BatchOperationError'`. If both the CJS and ESM builds of this package can be loaded in one process, check `error.name` instead of `instanceof`.
55
55
  - A warning is logged with the failure count and error codes, and no payload, at every log level.
56
56
  - Request-level SDK exceptions (throttling, access denied, network errors) are **not** wrapped. They propagate unchanged and immediately, so earlier chunks may already have been sent and the caller cannot tell which. Treat those as "outcome unknown" and make the operation safe to repeat.
@@ -485,6 +485,47 @@ await truncSns.publish({ TopicArn, Message: huge, Subject: long });
485
485
  await truncSns.publish({ TopicArn, Message: huge }, { truncate: false });
486
486
  ```
487
487
 
488
+ ## SES
489
+
490
+ Wraps the SES v2 API (`@aws-sdk/client-sesv2`), not the legacy v1 API. Inputs and outputs are the SDK's own types, and no defaults are baked in: `FromEmailAddress`, `ConfigurationSetName` and the rest come from you on every call. Template, identity and suppression-list management is not wrapped — use the SDK client directly or infrastructure as code.
491
+
492
+ ```ts
493
+ import { SESService } from '@aligent/aws-wrappers';
494
+
495
+ const ses = new SESService();
496
+
497
+ // Simple, Raw or Template content — pass whichever `Content` shape SES accepts.
498
+ const { MessageId } = await ses.sendEmail({
499
+ FromEmailAddress: 'orders@example.com',
500
+ Destination: { ToAddresses: [customerEmail] },
501
+ Content: {
502
+ Template: {
503
+ TemplateName: 'order-confirmation',
504
+ TemplateData: JSON.stringify({ orderNumber }),
505
+ },
506
+ },
507
+ });
508
+
509
+ // sendBulkEmail auto-chunks BulkEmailEntries to the SES-enforced 50-entry limit and
510
+ // throws a BatchOperationError if SES rejects any entry — see "Batch semantics".
511
+ await ses.sendBulkEmail({
512
+ FromEmailAddress: 'orders@example.com',
513
+ DefaultContent: { Template: { TemplateName: 'order-confirmation', TemplateData: '{}' } },
514
+ BulkEmailEntries: customers.map(({ email, data }) => ({
515
+ Destination: { ToAddresses: [email] },
516
+ ReplacementEmailContent: {
517
+ ReplacementTemplate: { ReplacementTemplateData: JSON.stringify(data) },
518
+ },
519
+ })),
520
+ });
521
+ ```
522
+
523
+ - SES answers HTTP 200 for a bulk send even when individual entries fail, so `sendBulkEmail` checks every entry's `Status` after all chunks are sent. Anything other than `SUCCESS` (including an entry SES returned no result for) ends up in `BatchOperationError.failed`, with `id` set to the entry's index in `BulkEmailEntries`, `code` set to the SES status and `message` set to the SES error text. `error.results` holds each chunk's output, so you can retry just the failed indexes.
524
+ - Sending is not idempotent: retrying the whole `sendBulkEmail` call after a `BatchOperationError` re-sends the entries that already succeeded.
525
+ - `sendEmail` is a pure pass-through. SDK exceptions such as `MessageRejected` or `SendingPausedException` propagate unchanged, and so do request-level failures from `sendBulkEmail`.
526
+ - At INFO the log line shows only routing metadata (`FromEmailAddressIdentityArn`, `ConfigurationSetName`, tags, `EndpointId`, `TenantName`), the template name, and a recipient or entry count. Sender, recipient and reply-to addresses, subjects, bodies and template data are omitted.
527
+ - There is no `truncate` option: a silently truncated email is worse than the SDK rejecting an oversized one.
528
+
488
529
  ## API Gateway
489
530
 
490
531
  Read-only lookups against the control plane. `APIGatewayService` wraps REST APIs (v1); `APIGatewayV2Service` wraps HTTP and WebSocket APIs (v2). List methods are auto-paginated and return flat arrays.
package/cjs/index.cjs CHANGED
@@ -12,6 +12,7 @@ var clientS3 = require('@aws-sdk/client-s3');
12
12
  var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
13
13
  var clientScheduler = require('@aws-sdk/client-scheduler');
14
14
  var clientSecretsManager = require('@aws-sdk/client-secrets-manager');
15
+ var clientSesv2 = require('@aws-sdk/client-sesv2');
15
16
  var clientSfn = require('@aws-sdk/client-sfn');
16
17
  var clientSns = require('@aws-sdk/client-sns');
17
18
  var clientSqs = require('@aws-sdk/client-sqs');
@@ -606,6 +607,16 @@ function chunk(items, size) {
606
607
  }
607
608
  return chunks;
608
609
  }
610
+ /**
611
+ * The index, as a string, that an entry had in the list `chunk` split, given
612
+ * its chunk number and its position within that chunk. Batch operations whose
613
+ * entries carry no identifier of their own report failures by this index.
614
+ * `chunk` fills every chunk but the last, so the chunk's offset is the chunk
615
+ * number times the chunk size.
616
+ */
617
+ function originalIndex(chunkIndex, chunkSize, position) {
618
+ return String(chunkIndex * chunkSize + position);
619
+ }
609
620
 
610
621
  const PUT_EVENTS_LIMIT = 10;
611
622
  /**
@@ -615,13 +626,8 @@ const PUT_EVENTS_LIMIT = 10;
615
626
  function summariseEntries$1({ EndpointId, Entries }) {
616
627
  return { EndpointId, entryCount: Entries?.length ?? 0 };
617
628
  }
618
- /**
619
- * Chunks are full except the last, so the caller's original index of a
620
- * rejected entry is the chunk's offset (chunk number times the chunk size)
621
- * plus its position within the chunk.
622
- */
623
629
  function extractPutEventsFailures(results) {
624
- return results.flatMap((result, chunkIndex) => extractChunkFailures(result, chunkIndex * PUT_EVENTS_LIMIT));
630
+ return results.flatMap(extractChunkFailures);
625
631
  }
626
632
  /**
627
633
  * `PutEvents` reports a rejected entry by an error code on the result entry at
@@ -630,10 +636,10 @@ function extractPutEventsFailures(results) {
630
636
  * Copies only code and message out, never the request entry, so neither the
631
637
  * error nor the warning can carry event detail.
632
638
  */
633
- function extractChunkFailures(result, offset) {
639
+ function extractChunkFailures(result, chunkIndex) {
634
640
  return (result.Entries ?? [])
635
641
  .map(({ ErrorCode, ErrorMessage }, position) => ({
636
- id: String(offset + position),
642
+ id: originalIndex(chunkIndex, PUT_EVENTS_LIMIT, position),
637
643
  code: ErrorCode,
638
644
  message: ErrorMessage,
639
645
  }))
@@ -1391,6 +1397,139 @@ class SecretsManagerService {
1391
1397
  }
1392
1398
  }
1393
1399
 
1400
+ const SEND_BULK_EMAIL_LIMIT = 50;
1401
+ /**
1402
+ * Sent entries whose result isn't `SUCCESS`, identified by their original
1403
+ * index in the caller's `BulkEmailEntries`. Walks the entries that were sent
1404
+ * rather than the results that came back, so an entry SES returned no result
1405
+ * for counts as failed instead of passing unnoticed. Only status and error are
1406
+ * copied out, never the entry, so no destination can leak.
1407
+ */
1408
+ function extractBulkEmailFailures(sentChunks, results) {
1409
+ return sentChunks.flatMap((sent, chunkIndex) => sent.flatMap((_, entryIndex) => {
1410
+ const result = results[chunkIndex]?.BulkEmailEntryResults?.[entryIndex];
1411
+ if (result?.Status === 'SUCCESS')
1412
+ return [];
1413
+ return [
1414
+ {
1415
+ id: originalIndex(chunkIndex, SEND_BULK_EMAIL_LIMIT, entryIndex),
1416
+ code: result?.Status,
1417
+ message: result?.Error ?? result?.Status ?? 'No status returned for entry',
1418
+ },
1419
+ ];
1420
+ }));
1421
+ }
1422
+ /**
1423
+ * Safe log shape for `sendEmail`. Keeps routing metadata and reduces the
1424
+ * recipients to a count; the sender and reply-to addresses, the subject, the
1425
+ * body and any template data are omitted as PII or payload. The template name
1426
+ * is operational metadata, not PII, so it is kept.
1427
+ */
1428
+ function summariseSendEmail(input) {
1429
+ const { ToAddresses, CcAddresses, BccAddresses } = input.Destination ?? {};
1430
+ return {
1431
+ FromEmailAddressIdentityArn: input.FromEmailAddressIdentityArn,
1432
+ ConfigurationSetName: input.ConfigurationSetName,
1433
+ EmailTags: input.EmailTags,
1434
+ EndpointId: input.EndpointId,
1435
+ TenantName: input.TenantName,
1436
+ templateName: input.Content?.Template?.TemplateName,
1437
+ recipientCount: (ToAddresses?.length ?? 0) + (CcAddresses?.length ?? 0) + (BccAddresses?.length ?? 0),
1438
+ };
1439
+ }
1440
+ /**
1441
+ * Safe log shape for `sendBulkEmail`. The entries carry destinations and
1442
+ * replacement data, and the default template data may carry PII, so they are
1443
+ * reduced to a count and the template name.
1444
+ */
1445
+ function summariseSendBulkEmail(input) {
1446
+ return {
1447
+ FromEmailAddressIdentityArn: input.FromEmailAddressIdentityArn,
1448
+ ConfigurationSetName: input.ConfigurationSetName,
1449
+ DefaultEmailTags: input.DefaultEmailTags,
1450
+ EndpointId: input.EndpointId,
1451
+ TenantName: input.TenantName,
1452
+ templateName: input.DefaultContent?.Template?.TemplateName,
1453
+ entryCount: input.BulkEmailEntries?.length ?? 0,
1454
+ };
1455
+ }
1456
+ /**
1457
+ * Wrapper around the AWS SES v2 client providing structured Powertools logging
1458
+ * and X-Ray tracing by default.
1459
+ *
1460
+ * Wraps SES v2 (`@aws-sdk/client-sesv2`), not the legacy v1 API. No defaults
1461
+ * are baked in: every send option, including `FromEmailAddress` and
1462
+ * `ConfigurationSetName`, comes from the caller.
1463
+ *
1464
+ * Where a method's input carries payloads or PII, the INFO log line omits
1465
+ * them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or `TRACE`) log full
1466
+ * SDK inputs.
1467
+ */
1468
+ class SESService {
1469
+ client;
1470
+ logger;
1471
+ /**
1472
+ * @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
1473
+ * which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
1474
+ * @param opts.client - Optional pre-configured `SESv2Client`. When supplied,
1475
+ * the wrapper does not apply X-Ray instrumentation.
1476
+ */
1477
+ constructor(opts) {
1478
+ this.client = opts?.client ?? xray.captureAWSv3Client(new clientSesv2.SESv2Client());
1479
+ this.logger = opts?.logger ?? new logger.Logger();
1480
+ }
1481
+ /**
1482
+ * Send a single email (Simple, Raw or Template content).
1483
+ *
1484
+ * At INFO level the log line includes only routing metadata and a
1485
+ * recipient count; see `summariseSendEmail`.
1486
+ *
1487
+ * Pass-through: SDK exceptions (`MessageRejected`, `SendingPausedException`,
1488
+ * …) propagate unwrapped.
1489
+ *
1490
+ * @returns The SDK output, including `MessageId`.
1491
+ */
1492
+ async sendEmail(input) {
1493
+ this.logger.info('Sending SES email', {
1494
+ input: redactInput(this.logger, input, summariseSendEmail),
1495
+ });
1496
+ return this.client.send(new clientSesv2.SendEmailCommand(input));
1497
+ }
1498
+ /**
1499
+ * Send a templated email to many destinations. SES caps `SendBulkEmail`
1500
+ * at 50 entries per request, so this method auto-chunks `BulkEmailEntries`
1501
+ * and sends one request per chunk, in order. Every chunk shares the other
1502
+ * input fields.
1503
+ *
1504
+ * At INFO level the log line includes only routing metadata, the template
1505
+ * name and an entry count; see `summariseSendBulkEmail`.
1506
+ *
1507
+ * SES answers HTTP 200 even when entries fail, so every chunk is sent
1508
+ * before the outcome is judged. If any entry's `Status` isn't `SUCCESS`
1509
+ * (or SES returned no result for it), a {@link BatchOperationError} is thrown whose
1510
+ * `failed[].id` is the entry's original index in `BulkEmailEntries` as a
1511
+ * string, and whose `results` are the per-chunk outputs — so a caller can
1512
+ * retry only the failed indexes. Request-level SDK exceptions are not
1513
+ * wrapped.
1514
+ *
1515
+ * Sending is not idempotent: retrying the whole batch after a throw
1516
+ * re-sends the entries that succeeded.
1517
+ *
1518
+ * @returns One SDK output per request sent.
1519
+ */
1520
+ async sendBulkEmail(input) {
1521
+ this.logger.info('Sending SES bulk email', {
1522
+ input: redactInput(this.logger, input, summariseSendBulkEmail),
1523
+ });
1524
+ const results = [];
1525
+ const sentChunks = chunk(input.BulkEmailEntries ?? [], SEND_BULK_EMAIL_LIMIT);
1526
+ for (const entries of sentChunks) {
1527
+ results.push(await this.client.send(new clientSesv2.SendBulkEmailCommand({ ...input, BulkEmailEntries: entries })));
1528
+ }
1529
+ return throwIfAny(this.logger, 'SES sendBulkEmail', results, extractBulkEmailFailures(sentChunks, results));
1530
+ }
1531
+ }
1532
+
1394
1533
  /**
1395
1534
  * Fields safe to log at INFO for `startExecution`. Omits `input` — the SFN
1396
1535
  * execution payload, which routinely carries PII (customer IDs, addresses,
@@ -1945,6 +2084,7 @@ exports.EventBridgeService = EventBridgeService;
1945
2084
  exports.LambdaFunctionError = LambdaFunctionError;
1946
2085
  exports.LambdaService = LambdaService;
1947
2086
  exports.S3Service = S3Service;
2087
+ exports.SESService = SESService;
1948
2088
  exports.SNSService = SNSService;
1949
2089
  exports.SQSService = SQSService;
1950
2090
  exports.SSMService = SSMService;
package/cjs/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -52,6 +52,7 @@
52
52
  "@aws-sdk/client-s3": "^3.1160.0",
53
53
  "@aws-sdk/client-scheduler": "^3.1160.0",
54
54
  "@aws-sdk/client-secrets-manager": "^3.1160.0",
55
+ "@aws-sdk/client-sesv2": "^3.1160.0",
55
56
  "@aws-sdk/client-sfn": "^3.1160.0",
56
57
  "@aws-sdk/client-sns": "^3.1160.0",
57
58
  "@aws-sdk/client-sqs": "^3.1160.0",
@@ -1 +1 @@
1
- {"version":3,"file":"eventbridge.d.ts","sourceRoot":"","sources":["../../../../src/eventbridge/eventbridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACH,iBAAiB,EAEjB,qBAAqB,EACrB,sBAAsB,EAEzB,MAAM,6BAA6B,CAAC;AA4CrC;;;;;;;;;;GAUG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,iBAAiB,CAAA;KAAE;IAK3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,SAAS,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAkBnF"}
1
+ {"version":3,"file":"eventbridge.d.ts","sourceRoot":"","sources":["../../../../src/eventbridge/eventbridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACH,iBAAiB,EAEjB,qBAAqB,EACrB,sBAAsB,EAEzB,MAAM,6BAA6B,CAAC;AAwCrC;;;;;;;;;;GAUG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,iBAAiB,CAAA;KAAE;IAK3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,SAAS,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAkBnF"}
@@ -7,6 +7,7 @@ export { S3Service } from './s3/s3.js';
7
7
  export type { EmptyBucketPageResult } from './s3/s3.js';
8
8
  export { SchedulerService } from './scheduler/scheduler.js';
9
9
  export { SecretsManagerService } from './secrets-manager/secrets-manager.js';
10
+ export { SESService } from './ses/ses.js';
10
11
  export { StepFunctionsService } from './sfn/sfn.js';
11
12
  export { SNSService } from './sns/sns.js';
12
13
  export { SQSService } from './sqs/sqs.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
2
+ import { SendBulkEmailCommandInput, SendBulkEmailCommandOutput, SendEmailCommandInput, SendEmailCommandOutput, SESv2Client } from '@aws-sdk/client-sesv2';
3
+ /**
4
+ * Wrapper around the AWS SES v2 client providing structured Powertools logging
5
+ * and X-Ray tracing by default.
6
+ *
7
+ * Wraps SES v2 (`@aws-sdk/client-sesv2`), not the legacy v1 API. No defaults
8
+ * are baked in: every send option, including `FromEmailAddress` and
9
+ * `ConfigurationSetName`, comes from the caller.
10
+ *
11
+ * Where a method's input carries payloads or PII, the INFO log line omits
12
+ * them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or `TRACE`) log full
13
+ * SDK inputs.
14
+ */
15
+ export declare class SESService {
16
+ private readonly client;
17
+ private readonly logger;
18
+ /**
19
+ * @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
20
+ * which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
21
+ * @param opts.client - Optional pre-configured `SESv2Client`. When supplied,
22
+ * the wrapper does not apply X-Ray instrumentation.
23
+ */
24
+ constructor(opts?: {
25
+ logger?: LoggerInterface;
26
+ client?: SESv2Client;
27
+ });
28
+ /**
29
+ * Send a single email (Simple, Raw or Template content).
30
+ *
31
+ * At INFO level the log line includes only routing metadata and a
32
+ * recipient count; see `summariseSendEmail`.
33
+ *
34
+ * Pass-through: SDK exceptions (`MessageRejected`, `SendingPausedException`,
35
+ * …) propagate unwrapped.
36
+ *
37
+ * @returns The SDK output, including `MessageId`.
38
+ */
39
+ sendEmail(input: SendEmailCommandInput): Promise<SendEmailCommandOutput>;
40
+ /**
41
+ * Send a templated email to many destinations. SES caps `SendBulkEmail`
42
+ * at 50 entries per request, so this method auto-chunks `BulkEmailEntries`
43
+ * and sends one request per chunk, in order. Every chunk shares the other
44
+ * input fields.
45
+ *
46
+ * At INFO level the log line includes only routing metadata, the template
47
+ * name and an entry count; see `summariseSendBulkEmail`.
48
+ *
49
+ * SES answers HTTP 200 even when entries fail, so every chunk is sent
50
+ * before the outcome is judged. If any entry's `Status` isn't `SUCCESS`
51
+ * (or SES returned no result for it), a {@link BatchOperationError} is thrown whose
52
+ * `failed[].id` is the entry's original index in `BulkEmailEntries` as a
53
+ * string, and whose `results` are the per-chunk outputs — so a caller can
54
+ * retry only the failed indexes. Request-level SDK exceptions are not
55
+ * wrapped.
56
+ *
57
+ * Sending is not idempotent: retrying the whole batch after a throw
58
+ * re-sends the entries that succeeded.
59
+ *
60
+ * @returns One SDK output per request sent.
61
+ */
62
+ sendBulkEmail(input: SendBulkEmailCommandInput): Promise<SendBulkEmailCommandOutput[]>;
63
+ }
64
+ //# sourceMappingURL=ses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ses.d.ts","sourceRoot":"","sources":["../../../../src/ses/ses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAGH,yBAAyB,EACzB,0BAA0B,EAE1B,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACd,MAAM,uBAAuB,CAAC;AA4F/B;;;;;;;;;;;GAWG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE;IAKrE;;;;;;;;;;OAUG;IACG,SAAS,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAO9E;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,aAAa,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAoB/F"}
@@ -3,4 +3,12 @@
3
3
  * per-request caps the AWS APIs enforce on batch operations.
4
4
  */
5
5
  export declare function chunk<T>(items: readonly T[], size: number): T[][];
6
+ /**
7
+ * The index, as a string, that an entry had in the list `chunk` split, given
8
+ * its chunk number and its position within that chunk. Batch operations whose
9
+ * entries carry no identifier of their own report failures by this index.
10
+ * `chunk` fills every chunk but the last, so the chunk's offset is the chunk
11
+ * number times the chunk size.
12
+ */
13
+ export declare function originalIndex(chunkIndex: number, chunkSize: number, position: number): string;
6
14
  //# sourceMappingURL=chunk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../../src/util/chunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAMjE"}
1
+ {"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../../src/util/chunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAMjE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7F"}
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: APIGatewayService
8
8
 
9
- Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:30](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L30)
9
+ Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:30](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L30)
10
10
 
11
11
  Read-only wrapper around the API Gateway (REST API, v1) control-plane client
12
12
  providing structured Powertools logging and X-Ray tracing by default.
@@ -24,7 +24,7 @@ output; the wrapper never logs output, and no input carries secrets.
24
24
 
25
25
  > **new APIGatewayService**(`opts?`): `APIGatewayService`
26
26
 
27
- Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:40](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L40)
27
+ Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:40](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L40)
28
28
 
29
29
  #### Parameters
30
30
 
@@ -56,7 +56,7 @@ which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
56
56
 
57
57
  > **getApiKey**(`input`): `Promise`\<`GetApiKeyCommandOutput`\>
58
58
 
59
- Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:71](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L71)
59
+ Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:71](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L71)
60
60
 
61
61
  Fetch a single API key, including its secret value.
62
62
 
@@ -82,7 +82,7 @@ NotFoundException when the key does not exist.
82
82
 
83
83
  > **getApiKeys**(`input?`): `Promise`\<`ApiKey`[]\>
84
84
 
85
- Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:59](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L59)
85
+ Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:59](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L59)
86
86
 
87
87
  List API keys, including their secret values. Auto-paginated.
88
88
 
@@ -104,7 +104,7 @@ List API keys, including their secret values. Auto-paginated.
104
104
 
105
105
  > **getResources**(`input`): `Promise`\<`Resource`[]\>
106
106
 
107
- Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:83](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L83)
107
+ Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:83](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L83)
108
108
 
109
109
  List every resource (path) of a REST API, which is how REST APIs expose
110
110
  their routes. Pass `embed: ['methods']` to include each resource's
@@ -128,7 +128,7 @@ methods. Auto-paginated.
128
128
 
129
129
  > **getRestApis**(`input?`): `Promise`\<`RestApi`[]\>
130
130
 
131
- Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:48](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L48)
131
+ Defined in: [packages/aws-wrappers/src/api-gateway/api-gateway.ts:48](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L48)
132
132
 
133
133
  List every REST API in the account and region. Auto-paginated.
134
134
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: APIGatewayV2Service
8
8
 
9
- Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:26](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L26)
9
+ Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:26](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L26)
10
10
 
11
11
  Read-only wrapper around the API Gateway v2 (HTTP and WebSocket APIs)
12
12
  control-plane client providing structured Powertools logging and X-Ray
@@ -23,7 +23,7 @@ follow `NextToken` manually.
23
23
 
24
24
  > **new APIGatewayV2Service**(`opts?`): `APIGatewayV2Service`
25
25
 
26
- Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:36](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L36)
26
+ Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:36](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L36)
27
27
 
28
28
  #### Parameters
29
29
 
@@ -55,7 +55,7 @@ which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
55
55
 
56
56
  > **getApis**(`input?`): `Promise`\<`Api`[]\>
57
57
 
58
- Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:45](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L45)
58
+ Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:45](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L45)
59
59
 
60
60
  List every HTTP and WebSocket API in the account and region.
61
61
  Auto-paginated.
@@ -78,7 +78,7 @@ Auto-paginated.
78
78
 
79
79
  > **getRoute**(`input`): `Promise`\<`GetRouteCommandOutput`\>
80
80
 
81
- Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:58](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L58)
81
+ Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:58](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L58)
82
82
 
83
83
  Fetch a single route of an HTTP or WebSocket API.
84
84
 
@@ -104,7 +104,7 @@ NotFoundException when the route does not exist.
104
104
 
105
105
  > **getRoutes**(`input`): `Promise`\<`Route`[]\>
106
106
 
107
- Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:66](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L66)
107
+ Defined in: [packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts:66](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L66)
108
108
 
109
109
  List every route of an HTTP or WebSocket API. Auto-paginated.
110
110
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: BatchOperationError\<TResult\>
8
8
 
9
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:28](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/util/batch-operation-error.ts#L28)
9
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:28](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/util/batch-operation-error.ts#L28)
10
10
 
11
11
  Thrown by the batch methods once every chunk has been sent and at least one
12
12
  entry was rejected.
@@ -40,7 +40,7 @@ this package may be loaded in one process.
40
40
 
41
41
  > **new BatchOperationError**\<`TResult`\>(`results`, `failed`): `BatchOperationError`\<`TResult`\>
42
42
 
43
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:31](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/util/batch-operation-error.ts#L31)
43
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:31](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/util/batch-operation-error.ts#L31)
44
44
 
45
45
  #### Parameters
46
46
 
@@ -82,7 +82,7 @@ Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:24
82
82
 
83
83
  > `readonly` **failed**: [`BatchFailedEntry`](../interfaces/BatchFailedEntry.md)[]
84
84
 
85
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:33](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/util/batch-operation-error.ts#L33)
85
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:33](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/util/batch-operation-error.ts#L33)
86
86
 
87
87
  ***
88
88
 
@@ -106,7 +106,7 @@ Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1075
106
106
 
107
107
  > `readonly` **name**: `"BatchOperationError"` = `'BatchOperationError'`
108
108
 
109
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:29](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/util/batch-operation-error.ts#L29)
109
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:29](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/util/batch-operation-error.ts#L29)
110
110
 
111
111
  #### Overrides
112
112
 
@@ -120,7 +120,7 @@ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:29](https:/
120
120
 
121
121
  > `readonly` **results**: `TResult`[]
122
122
 
123
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:32](https://github.com/aligent/microservice-development-utilities/blob/3822f761bcc8572b495cfd407e000d4fed44d0ba/packages/aws-wrappers/src/util/batch-operation-error.ts#L32)
123
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:32](https://github.com/aligent/microservice-development-utilities/blob/e278ae3f29a38b1e451dd1bab16695aea28a55c1/packages/aws-wrappers/src/util/batch-operation-error.ts#L32)
124
124
 
125
125
  ***
126
126