@aligent/aws-wrappers 0.5.10 → 0.5.11

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 (56) hide show
  1. package/README.md +36 -9
  2. package/cjs/index.cjs +279 -125
  3. package/cjs/package.json +2 -2
  4. package/cjs/src/dynamodb/dynamodb.d.ts +23 -4
  5. package/cjs/src/dynamodb/dynamodb.d.ts.map +1 -1
  6. package/cjs/src/s3/s3.d.ts +6 -1
  7. package/cjs/src/s3/s3.d.ts.map +1 -1
  8. package/cjs/src/secrets-manager/secrets-manager.d.ts +3 -1
  9. package/cjs/src/secrets-manager/secrets-manager.d.ts.map +1 -1
  10. package/cjs/src/sns/sns.d.ts +8 -5
  11. package/cjs/src/sns/sns.d.ts.map +1 -1
  12. package/cjs/src/sqs/sqs.d.ts +7 -3
  13. package/cjs/src/sqs/sqs.d.ts.map +1 -1
  14. package/cjs/src/ssm/ssm.d.ts +3 -1
  15. package/cjs/src/ssm/ssm.d.ts.map +1 -1
  16. package/cjs/src/util/batch-operation-error.d.ts +19 -2
  17. package/cjs/src/util/batch-operation-error.d.ts.map +1 -1
  18. package/cjs/src/util/json.d.ts +14 -0
  19. package/cjs/src/util/json.d.ts.map +1 -0
  20. package/docs/index/classes/APIGatewayService.md +6 -6
  21. package/docs/index/classes/APIGatewayV2Service.md +5 -5
  22. package/docs/index/classes/BatchOperationError.md +15 -6
  23. package/docs/index/classes/DynamoDBService.md +39 -16
  24. package/docs/index/classes/EventBridgeService.md +3 -3
  25. package/docs/index/classes/LambdaFunctionError.md +7 -7
  26. package/docs/index/classes/LambdaService.md +3 -3
  27. package/docs/index/classes/S3Service.md +24 -16
  28. package/docs/index/classes/SESService.md +4 -4
  29. package/docs/index/classes/SNSService.md +12 -9
  30. package/docs/index/classes/SQSService.md +14 -10
  31. package/docs/index/classes/SSMService.md +10 -8
  32. package/docs/index/classes/SchedulerService.md +11 -11
  33. package/docs/index/classes/SecretsManagerService.md +11 -9
  34. package/docs/index/classes/StepFunctionsService.md +6 -6
  35. package/docs/index/interfaces/BatchFailedEntry.md +6 -5
  36. package/docs/index/interfaces/EmptyBucketPageResult.md +2 -2
  37. package/docs/testing/testing/functions/createMockService.md +1 -1
  38. package/esm/index.mjs +280 -126
  39. package/esm/package.json +2 -2
  40. package/esm/src/dynamodb/dynamodb.d.ts +23 -4
  41. package/esm/src/dynamodb/dynamodb.d.ts.map +1 -1
  42. package/esm/src/s3/s3.d.ts +6 -1
  43. package/esm/src/s3/s3.d.ts.map +1 -1
  44. package/esm/src/secrets-manager/secrets-manager.d.ts +3 -1
  45. package/esm/src/secrets-manager/secrets-manager.d.ts.map +1 -1
  46. package/esm/src/sns/sns.d.ts +8 -5
  47. package/esm/src/sns/sns.d.ts.map +1 -1
  48. package/esm/src/sqs/sqs.d.ts +7 -3
  49. package/esm/src/sqs/sqs.d.ts.map +1 -1
  50. package/esm/src/ssm/ssm.d.ts +3 -1
  51. package/esm/src/ssm/ssm.d.ts.map +1 -1
  52. package/esm/src/util/batch-operation-error.d.ts +19 -2
  53. package/esm/src/util/batch-operation-error.d.ts.map +1 -1
  54. package/esm/src/util/json.d.ts +14 -0
  55. package/esm/src/util/json.d.ts.map +1 -0
  56. package/package.json +2 -2
package/cjs/index.cjs CHANGED
@@ -146,6 +146,110 @@ class APIGatewayService {
146
146
  }
147
147
  }
148
148
 
149
+ /**
150
+ * Thrown by the batch methods once every chunk has been sent and at least one
151
+ * entry was rejected.
152
+ *
153
+ * `results` holds the raw SDK output of every chunk, so the outputs of the
154
+ * entries that succeeded (message ids, sequence numbers) stay readable. The
155
+ * exceptions are `S3.emptyBucket`, whose `results` are per-page deleted keys,
156
+ * `SSM.getParameters`, whose `results` are empty, and the DynamoDB batch
157
+ * methods, whose `results` hold a single output (the last response, with the
158
+ * `Responses` merged so far for `batchGet`) carrying what is still pending.
159
+ * `failed` is the normalised list of rejected entries across all chunks.
160
+ *
161
+ * Do not pass the error object itself to a logger. `results` is an enumerable
162
+ * property and the Powertools logger serialises every enumerable property of
163
+ * an error, so `logger.error('…', error)` writes `results` to the log — which
164
+ * for the DynamoDB batch methods holds the caller's keys and items. Log `name`,
165
+ * `message` and `failed`, which never carry a payload, and read `results` only
166
+ * to retry or recover.
167
+ *
168
+ * Match on `name` rather than `instanceof` if both the CJS and ESM builds of
169
+ * this package may be loaded in one process.
170
+ */
171
+ class BatchOperationError extends Error {
172
+ results;
173
+ failed;
174
+ name = 'BatchOperationError';
175
+ constructor(results, failed) {
176
+ super(failureMessage(failed));
177
+ this.results = results;
178
+ this.failed = failed;
179
+ }
180
+ }
181
+ function failureMessage(failed) {
182
+ const noun = failed.length === 1 ? 'entry' : 'entries';
183
+ const codes = distinctCodes(failed);
184
+ const suffix = codes.length === 0 ? '' : ` (${codes.join(', ')})`;
185
+ return `Batch operation failed for ${failed.length} ${noun}${suffix}`;
186
+ }
187
+ /**
188
+ * SQS and SNS report rejected entries under `Failed` on an otherwise
189
+ * successful response, so a resolved chunk does not mean every entry was
190
+ * accepted. Extracts those entries and delegates to {@link throwIfAny}.
191
+ *
192
+ * Only id, code and message are copied out — never the entry itself — so
193
+ * neither the error nor the warning can leak a payload.
194
+ */
195
+ function throwIfAnyFailed(logger, operation, results) {
196
+ const failed = results.flatMap(result => (result.Failed ?? []).map(({ Id, Code, Message }) => ({
197
+ id: Id,
198
+ code: Code,
199
+ message: Message,
200
+ })));
201
+ return throwIfAny(logger, operation, results, failed);
202
+ }
203
+ /**
204
+ * S3 reports undeleted keys under `Errors` on an otherwise successful
205
+ * `DeleteObjects` response. Same contract as {@link throwIfAnyFailed}; the
206
+ * key is carried as the failed entry's `id`, and `VersionId` is dropped.
207
+ */
208
+ function throwIfAnyDeleteErrors(logger, operation, results) {
209
+ const failed = results.flatMap(result => (result.Errors ?? []).map(({ Key, Code, Message }) => ({
210
+ id: Key,
211
+ code: Code,
212
+ message: Message,
213
+ })));
214
+ return throwIfAny(logger, operation, results, failed);
215
+ }
216
+ /**
217
+ * Warn-and-throw step for services whose responses don't use the SQS/SNS
218
+ * `Failed` shape and so extract their own rejected entries (`EventBridge.putEvents`),
219
+ * or whose `results` aren't a plain list of SDK outputs (`S3.emptyBucket`).
220
+ * Returns `results` untouched when `failed` is empty.
221
+ *
222
+ * Callers must build `failed` by copying id, code and message explicitly —
223
+ * never by spreading the SDK entry — because it goes straight into the error
224
+ * and the warning.
225
+ */
226
+ function throwIfAny(logger, operation, results, failed) {
227
+ if (failed.length === 0)
228
+ return results;
229
+ return throwBatchFailure(logger, operation, results, failed);
230
+ }
231
+ /**
232
+ * The warn-and-throw half of {@link throwIfAny}, for callers that already know
233
+ * `failed` is non-empty and need the compiler to see that the call never
234
+ * returns. The same rule applies: build `failed` by copying id, code and
235
+ * message explicitly.
236
+ */
237
+ function throwBatchFailure(logger, operation, results, failed) {
238
+ logger.warn(`${operation} had rejected entries`, {
239
+ failedCount: failed.length,
240
+ codes: distinctCodes(failed),
241
+ });
242
+ throw new BatchOperationError(results, failed);
243
+ }
244
+ /**
245
+ * Distinct error codes in first-seen order, for the error message and the
246
+ * warning log line.
247
+ */
248
+ function distinctCodes(failed) {
249
+ const codes = failed.flatMap(entry => (entry.code === undefined ? [] : [entry.code]));
250
+ return [...new Set(codes)];
251
+ }
252
+
149
253
  /**
150
254
  * Whether the logger is verbose enough that full SDK inputs may be written to
151
255
  * the log. The unlock rule is documented on {@link redactInput}.
@@ -181,6 +285,29 @@ const BATCH_GET_BASE_DELAY_MS = 200;
181
285
  function summariseTables(input) {
182
286
  return { tables: Object.keys(input.RequestItems ?? {}) };
183
287
  }
288
+ /**
289
+ * The tables that still have unprocessed keys or writes. Tables whose list is
290
+ * empty are dropped, so an empty result means there is nothing left to retry.
291
+ */
292
+ function pendingCounts(unprocessed, countOf) {
293
+ return Object.entries(unprocessed)
294
+ .map(([table, entry]) => ({ table, count: countOf(entry) ?? 0 }))
295
+ .filter(({ count }) => count > 0);
296
+ }
297
+ /**
298
+ * One failed entry per request still unprocessed after the final attempt. The
299
+ * `id` is the table name plus the position within that table's unprocessed
300
+ * list — deliberately not the key or item, which is caller data and must not
301
+ * reach the error message or the warning. The position indexes into the
302
+ * `UnprocessedKeys` / `UnprocessedItems` the error carries in `results`.
303
+ */
304
+ function unprocessedEntries(pending, code, attempts) {
305
+ return pending.flatMap(({ table, count }) => Array.from({ length: count }, (_, index) => ({
306
+ id: `${table}[${index}]`,
307
+ code,
308
+ message: `Still unprocessed after ${attempts} attempts`,
309
+ })));
310
+ }
184
311
  /**
185
312
  * Fields safe to log at INFO. Omits `Key` (may carry customer IDs / tenant IDs).
186
313
  */
@@ -397,63 +524,101 @@ class DynamoDBService {
397
524
  /**
398
525
  * Batch-get items from one or more DynamoDB tables, retrying
399
526
  * `UnprocessedKeys` with jittered exponential backoff. Up to 5 attempts
400
- * (200ms base delay). Throws when keys remain unprocessed after the final
401
- * attempt. `Responses` are merged across attempts, keyed by table name.
527
+ * (200ms base delay). `Responses` are merged across attempts, keyed by
528
+ * table name.
402
529
  *
403
530
  * Note: this method is intentionally **not** generic. `BatchGet`'s
404
531
  * `Responses` field is a multi-table `Record<string, item[]>` whose item
405
532
  * shapes can differ per table — no single `T` can soundly describe it.
406
533
  * Callers should narrow the result type at the call site.
534
+ *
535
+ * @throws {@link BatchOperationError} when keys remain unprocessed after
536
+ * the final attempt. `results` holds one output: the merged `Responses`
537
+ * retrieved so far, plus the still-pending `UnprocessedKeys` to retry.
538
+ * `failed` has one entry per pending key with `code: 'UnprocessedKeys'`
539
+ * and an `id` of `<table>[<index>]`, the key's position in
540
+ * `results[0].UnprocessedKeys[<table>].Keys`. The `failed` list never
541
+ * carries key values; `results` does, as it is data the caller requested,
542
+ * so don't log the error object itself (see {@link BatchOperationError}).
543
+ * Request-level SDK exceptions propagate unchanged.
407
544
  */
408
545
  async batchGet(input) {
409
546
  this.logger.info('Batch getting DynamoDB items', {
410
547
  input: redactInput(this.logger, input, summariseTables),
411
548
  });
412
- let current = input;
413
549
  const mergedResponses = {};
414
- for (let attempt = 0; attempt < BATCH_GET_MAX_ATTEMPTS; attempt++) {
415
- const response = await this.client.send(new libDynamodb.BatchGetCommand(current));
550
+ const attempt = async (request) => {
551
+ const response = await this.client.send(new libDynamodb.BatchGetCommand(request));
416
552
  for (const [table, items] of Object.entries(response.Responses ?? {})) {
417
553
  mergedResponses[table] = [...(mergedResponses[table] ?? []), ...items];
418
554
  }
419
- const unprocessed = response.UnprocessedKeys;
420
- if (!unprocessed || Object.keys(unprocessed).length === 0) {
421
- return { ...response, Responses: mergedResponses };
422
- }
555
+ const unprocessed = response.UnprocessedKeys ?? {};
556
+ return {
557
+ output: { ...response, Responses: mergedResponses },
558
+ unprocessed,
559
+ pending: pendingCounts(unprocessed, ({ Keys }) => Keys?.length),
560
+ };
561
+ };
562
+ let current = input;
563
+ for (let attemptNumber = 1; attemptNumber < BATCH_GET_MAX_ATTEMPTS; attemptNumber++) {
564
+ const { output, unprocessed, pending } = await attempt(current);
565
+ if (pending.length === 0)
566
+ return output;
423
567
  this.logger.warn('Retrying unprocessed DynamoDB items', {
424
- attempt: attempt + 1,
425
- tables: Object.keys(unprocessed),
568
+ attempt: attemptNumber,
569
+ tables: pending.map(({ table }) => table),
426
570
  });
427
- if (attempt < BATCH_GET_MAX_ATTEMPTS - 1)
428
- await sleep(backoffDelay(attempt, BATCH_GET_BASE_DELAY_MS));
571
+ await sleep(backoffDelay(attemptNumber - 1, BATCH_GET_BASE_DELAY_MS));
429
572
  current = { ...input, RequestItems: unprocessed };
430
573
  }
431
- throw new Error(`batchGet failed after ${BATCH_GET_MAX_ATTEMPTS} attempts`);
574
+ const { output, pending } = await attempt(current);
575
+ if (pending.length === 0)
576
+ return output;
577
+ return throwBatchFailure(this.logger, 'DynamoDB batchGet', [output], unprocessedEntries(pending, 'UnprocessedKeys', BATCH_GET_MAX_ATTEMPTS));
432
578
  }
433
579
  /**
434
580
  * Batch-write items to DynamoDB, retrying `UnprocessedItems` with jittered
435
- * exponential backoff. Up to 5 attempts (200ms base delay). Throws when
436
- * items remain unprocessed after the final attempt.
581
+ * exponential backoff. Up to 5 attempts (200ms base delay).
582
+ *
583
+ * @throws {@link BatchOperationError} when items remain unprocessed after
584
+ * the final attempt. `results` holds one output: the last response, whose
585
+ * `UnprocessedItems` are the writes still to retry. `failed` has one entry
586
+ * per pending write with `code: 'UnprocessedItems'` and an `id` of
587
+ * `<table>[<index>]`, the write's position in
588
+ * `results[0].UnprocessedItems[<table>]`. The `failed` list never carries
589
+ * item data; `results` does, as it is data the caller supplied, so don't
590
+ * log the error object itself (see {@link BatchOperationError}).
591
+ * Request-level SDK exceptions propagate unchanged.
437
592
  */
438
593
  async batchWrite(input) {
439
594
  this.logger.info('Batch writing DynamoDB items', {
440
595
  input: redactInput(this.logger, input, summariseTables),
441
596
  });
597
+ const attempt = async (request) => {
598
+ const response = await this.client.send(new libDynamodb.BatchWriteCommand(request));
599
+ const unprocessed = response.UnprocessedItems ?? {};
600
+ return {
601
+ response,
602
+ unprocessed,
603
+ pending: pendingCounts(unprocessed, writes => writes.length),
604
+ };
605
+ };
442
606
  let current = input;
443
- for (let attempt = 0; attempt < BATCH_WRITE_MAX_ATTEMPTS; attempt++) {
444
- const response = await this.client.send(new libDynamodb.BatchWriteCommand(current));
445
- const unprocessed = response.UnprocessedItems;
446
- if (!unprocessed || Object.keys(unprocessed).length === 0)
607
+ for (let attemptNumber = 1; attemptNumber < BATCH_WRITE_MAX_ATTEMPTS; attemptNumber++) {
608
+ const { response, unprocessed, pending } = await attempt(current);
609
+ if (pending.length === 0)
447
610
  return response;
448
611
  this.logger.warn('Retrying unprocessed DynamoDB items', {
449
- attempt: attempt + 1,
450
- tables: Object.keys(unprocessed),
612
+ attempt: attemptNumber,
613
+ tables: pending.map(({ table }) => table),
451
614
  });
452
- if (attempt < BATCH_WRITE_MAX_ATTEMPTS - 1)
453
- await sleep(backoffDelay(attempt, BATCH_WRITE_BASE_DELAY_MS));
615
+ await sleep(backoffDelay(attemptNumber - 1, BATCH_WRITE_BASE_DELAY_MS));
454
616
  current = { ...input, RequestItems: unprocessed };
455
617
  }
456
- throw new Error(`batchWrite failed after ${BATCH_WRITE_MAX_ATTEMPTS} attempts`);
618
+ const { response, pending } = await attempt(current);
619
+ if (pending.length === 0)
620
+ return response;
621
+ return throwBatchFailure(this.logger, 'DynamoDB batchWrite', [response], unprocessedEntries(pending, 'UnprocessedItems', BATCH_WRITE_MAX_ATTEMPTS));
457
622
  }
458
623
  /**
459
624
  * Paginate over Query results, yielding one unmarshalled item at a time.
@@ -516,86 +681,6 @@ class DynamoDBService {
516
681
  }
517
682
  }
518
683
 
519
- /**
520
- * Thrown by the batch methods once every chunk has been sent and at least one
521
- * entry was rejected.
522
- *
523
- * `results` holds the raw SDK output of every chunk, so the outputs of the
524
- * entries that succeeded (message ids, sequence numbers) stay readable. The
525
- * exceptions are `S3.emptyBucket`, whose `results` are per-page deleted keys,
526
- * and `SSM.getParameters`, whose `results` are empty.
527
- * `failed` is the normalised list of rejected entries across all chunks.
528
- *
529
- * Match on `name` rather than `instanceof` if both the CJS and ESM builds of
530
- * this package may be loaded in one process.
531
- */
532
- class BatchOperationError extends Error {
533
- results;
534
- failed;
535
- name = 'BatchOperationError';
536
- constructor(results, failed) {
537
- super(`Batch operation failed for ${failed.length} entries (${distinctCodes(failed).join(', ')})`);
538
- this.results = results;
539
- this.failed = failed;
540
- }
541
- }
542
- /**
543
- * SQS and SNS report rejected entries under `Failed` on an otherwise
544
- * successful response, so a resolved chunk does not mean every entry was
545
- * accepted. Extracts those entries and delegates to {@link throwIfAny}.
546
- *
547
- * Only id, code and message are copied out — never the entry itself — so
548
- * neither the error nor the warning can leak a payload.
549
- */
550
- function throwIfAnyFailed(logger, operation, results) {
551
- const failed = results.flatMap(result => (result.Failed ?? []).map(({ Id, Code, Message }) => ({
552
- id: Id,
553
- code: Code,
554
- message: Message,
555
- })));
556
- return throwIfAny(logger, operation, results, failed);
557
- }
558
- /**
559
- * S3 reports undeleted keys under `Errors` on an otherwise successful
560
- * `DeleteObjects` response. Same contract as {@link throwIfAnyFailed}; the
561
- * key is carried as the failed entry's `id`, and `VersionId` is dropped.
562
- */
563
- function throwIfAnyDeleteErrors(logger, operation, results) {
564
- const failed = results.flatMap(result => (result.Errors ?? []).map(({ Key, Code, Message }) => ({
565
- id: Key,
566
- code: Code,
567
- message: Message,
568
- })));
569
- return throwIfAny(logger, operation, results, failed);
570
- }
571
- /**
572
- * Warn-and-throw step for services whose responses don't use the SQS/SNS
573
- * `Failed` shape and so extract their own rejected entries (`EventBridge.putEvents`),
574
- * or whose `results` aren't a plain list of SDK outputs (`S3.emptyBucket`).
575
- * Returns `results` untouched when `failed` is empty.
576
- *
577
- * Callers must build `failed` by copying id, code and message explicitly —
578
- * never by spreading the SDK entry — because it goes straight into the error
579
- * and the warning.
580
- */
581
- function throwIfAny(logger, operation, results, failed) {
582
- if (failed.length === 0)
583
- return results;
584
- logger.warn(`${operation} had rejected entries`, {
585
- failedCount: failed.length,
586
- codes: distinctCodes(failed),
587
- });
588
- throw new BatchOperationError(results, failed);
589
- }
590
- /**
591
- * Distinct error codes in first-seen order, for the error message and the
592
- * warning log line.
593
- */
594
- function distinctCodes(failed) {
595
- const codes = failed.flatMap(entry => (entry.code === undefined ? [] : [entry.code]));
596
- return [...new Set(codes)];
597
- }
598
-
599
684
  /**
600
685
  * Split a list into consecutive chunks of at most `size` items, mirroring the
601
686
  * per-request caps the AWS APIs enforce on batch operations.
@@ -842,8 +927,34 @@ class LambdaService {
842
927
  }
843
928
  }
844
929
 
930
+ /**
931
+ * `JSON.parse` that never leaks the parsed text. V8's `SyntaxError` message
932
+ * embeds a snippet of the input (`Unexpected token 'h', ..."assword": hunter2}"
933
+ * is not valid JSON`), and the wrappers parse secrets and stored objects, so
934
+ * letting it through would put that content into the caller's error logs.
935
+ *
936
+ * The original error is deliberately not attached as `cause`: loggers serialise
937
+ * `cause` and its message carries the snippet. `context` should identify the
938
+ * source (a secret id, a bucket and key) so the failure is still diagnosable.
939
+ *
940
+ * @throws An `Error` naming `context`, without any of the input text.
941
+ */
942
+ function parseJson(text, context) {
943
+ try {
944
+ return JSON.parse(text);
945
+ }
946
+ catch {
947
+ throw new Error(`${context} does not contain valid JSON`);
948
+ }
949
+ }
950
+
845
951
  const DEFAULT_PRESIGNED_URL_EXPIRES_IN_SECONDS = 3600;
846
952
  const DELETE_OBJECTS_BATCH_LIMIT = 1000;
953
+ /**
954
+ * `Key` is `string | undefined` here because the SDK types a required `Key`
955
+ * that way even through `Required<Pick<...>>`.
956
+ */
957
+ const parseJsonObject = (body, bucket, key) => parseJson(body, `S3 object s3://${bucket}/${key}`);
847
958
  /**
848
959
  * Fields safe to log at INFO for `putObject`. Omits `Body` (object payload).
849
960
  */
@@ -938,13 +1049,15 @@ class S3Service {
938
1049
  * Get an object from S3 and parse it as JSON.
939
1050
  * @template T - Expected type of the parsed value.
940
1051
  * @returns The parsed value, or `undefined` if the response has no body.
941
- * @throws If the body is non-empty and not valid JSON.
1052
+ * @throws If the body is non-empty and not valid JSON. The error names the
1053
+ * object and never includes any of its content, unlike the native
1054
+ * `SyntaxError`.
942
1055
  */
943
1056
  async getJsonObject(input) {
944
1057
  this.logger.info('Getting S3 JSON object', { input });
945
1058
  const response = await this.client.send(new clientS3.GetObjectCommand(input));
946
1059
  const body = await response.Body?.transformToString();
947
- return body ? JSON.parse(body) : undefined;
1060
+ return body ? parseJsonObject(body, input.Bucket, input.Key) : undefined;
948
1061
  }
949
1062
  /**
950
1063
  * Fetch the metadata for an S3 object without downloading its body.
@@ -974,6 +1087,9 @@ class S3Service {
974
1087
  * List and JSON-parse every object under a bucket and optional prefix.
975
1088
  * Auto-paginated. Objects without a body are skipped.
976
1089
  * @template T - Expected type of each parsed object.
1090
+ * @throws If any object is not valid JSON. The error names that object's
1091
+ * key and never includes any of its content, unlike the native
1092
+ * `SyntaxError`; objects after it are not fetched.
977
1093
  */
978
1094
  async getAllObjects(bucket, prefix) {
979
1095
  this.logger.info('Getting all S3 objects', { input: { bucket, prefix } });
@@ -986,7 +1102,7 @@ class S3Service {
986
1102
  const response = await this.client.send(new clientS3.GetObjectCommand({ Bucket: bucket, Key: object.Key }));
987
1103
  const body = await response.Body?.transformToString();
988
1104
  if (body)
989
- bodies.push(JSON.parse(body));
1105
+ bodies.push(parseJsonObject(body, bucket, object.Key));
990
1106
  }
991
1107
  }
992
1108
  return bodies;
@@ -1331,12 +1447,14 @@ class SecretsManagerService {
1331
1447
  * @param secretId - The ARN or friendly name of the secret.
1332
1448
  * @template T - Expected shape of the parsed secret.
1333
1449
  * @returns The parsed secret value.
1334
- * @throws If the secret has no `SecretString` or the value is not valid JSON.
1450
+ * @throws If the secret has no `SecretString`, or the value is not valid
1451
+ * JSON. The latter error names the secret and never includes any of its
1452
+ * value, unlike the native `SyntaxError`.
1335
1453
  */
1336
1454
  async getJsonSecret(secretId) {
1337
1455
  this.logger.info('Fetching JSON secret', { input: { secretId } });
1338
1456
  const secretString = await this.fetchSecretString(secretId);
1339
- return JSON.parse(secretString);
1457
+ return parseJson(secretString, `Secret '${secretId}'`);
1340
1458
  }
1341
1459
  /**
1342
1460
  * Create a new secret. At INFO level the log line includes only identity
@@ -1630,8 +1748,16 @@ function truncateCodepoints(str, maxChars) {
1630
1748
  }
1631
1749
 
1632
1750
  const PUBLISH_BATCH_LIMIT = 10;
1751
+ /**
1752
+ * The default `MaximumMessageSize` of an SNS topic. Topics can be raised to
1753
+ * 1 MiB, but the wrapper does not know a topic's setting, so it cuts at the
1754
+ * size every topic accepts. Message attributes count toward the topic limit
1755
+ * too and are not truncated, so a message at this size plus attributes can
1756
+ * still be rejected.
1757
+ */
1633
1758
  const SNS_MESSAGE_MAX_BYTES = 256 * 1024;
1634
- const SNS_SUBJECT_MAX_CHARS = 100;
1759
+ /** SNS requires a subject of *less than* 100 characters, so 99 is the maximum. */
1760
+ const SNS_SUBJECT_MAX_CHARS = 99;
1635
1761
  /**
1636
1762
  * Fields safe to log at INFO level for `publish`. Omits `Message`, `Subject`,
1637
1763
  * `MessageAttributes`, and `PhoneNumber` — payloads, user-visible content
@@ -1662,11 +1788,14 @@ class SNSService {
1662
1788
  * which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
1663
1789
  * @param opts.client - Optional pre-configured `SNSClient`. When supplied,
1664
1790
  * the wrapper does not apply X-Ray instrumentation.
1665
- * @param opts.truncate - When `true`, oversized `Message` / `Subject` are
1666
- * truncated (byte-safe / codepoint-safe) before sending instead of failing
1667
- * at the SDK. Defaults to `false` — the SDK throws on oversize, which is
1668
- * usually the right failure mode. Each `publish` call can override via
1669
- * its own `truncate` option.
1791
+ * @param opts.truncate - When `true`, an oversized `Message` (above 256 KiB,
1792
+ * the default topic limit — raising a topic's `MaximumMessageSize` does not
1793
+ * raise this cut-off) or `Subject` (above 99 characters) is truncated
1794
+ * (byte-safe / codepoint-safe) before sending instead of failing at the
1795
+ * SDK. Truncating a structured `Message` such as JSON can leave it invalid.
1796
+ * Defaults to `false` — the SDK throws on oversize, which is usually the
1797
+ * right failure mode. Each `publish` call can override via its own
1798
+ * `truncate` option.
1670
1799
  */
1671
1800
  constructor(opts) {
1672
1801
  this.client = opts?.client ?? xray.captureAWSv3Client(new clientSns.SNSClient());
@@ -1752,7 +1881,12 @@ class SNSService {
1752
1881
  }
1753
1882
 
1754
1883
  const SQS_BATCH_LIMIT = 10;
1755
- const SQS_MESSAGE_BODY_MAX_BYTES = 256 * 1024;
1884
+ /**
1885
+ * The SQS maximum message size. A queue's own `MaximumMessageSize` may be set
1886
+ * lower, and the wrapper cannot see it, so a queue configured below this still
1887
+ * rejects a body truncated to it.
1888
+ */
1889
+ const SQS_MESSAGE_BODY_MAX_BYTES = 1024 * 1024;
1756
1890
  /**
1757
1891
  * Fields safe to log at INFO level for `sendMessage`. Omits `MessageBody` and
1758
1892
  * `MessageAttributes` — both carry payload content.
@@ -1787,9 +1921,13 @@ class SQSService {
1787
1921
  * which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
1788
1922
  * @param opts.client - Optional pre-configured `SQSClient`. When supplied,
1789
1923
  * the wrapper does not apply X-Ray instrumentation.
1790
- * @param opts.truncate - When `true`, oversized `MessageBody` is truncated
1791
- * (byte-safe) before sending instead of failing at the SDK. Defaults to
1792
- * `false`. Each `sendMessage` call can override via its own `truncate`
1924
+ * @param opts.truncate - When `true`, a `MessageBody` above 1 MiB is
1925
+ * truncated (byte-safe) before sending instead of failing at the SDK. This
1926
+ * is the SQS maximum; a queue configured with a lower `MaximumMessageSize`
1927
+ * is not known to the wrapper. Message attributes count toward the limit
1928
+ * too and are not truncated.
1929
+ * Truncating a structured body such as JSON can leave it invalid. Defaults
1930
+ * to `false`. Each `sendMessage` call can override via its own `truncate`
1793
1931
  * option.
1794
1932
  */
1795
1933
  constructor(opts) {
@@ -1899,6 +2037,20 @@ class SQSService {
1899
2037
  }
1900
2038
 
1901
2039
  const GET_PARAMETERS_LIMIT = 10;
2040
+ /**
2041
+ * Every string a caller may have used to request this parameter. SSM answers
2042
+ * with the plain `Name` whatever was requested, so an ARN or a
2043
+ * `name:version` / `name:label` selector can only be matched through `ARN`
2044
+ * and `Selector`. A response carrying a `Selector` is keyed by its selector
2045
+ * forms only, so it can't shadow a request for the unversioned parameter.
2046
+ * `Selector` already carries its leading colon (`:3`, `:prod`).
2047
+ */
2048
+ function requestKeys({ Name, ARN, Selector }) {
2049
+ const identifiers = [Name, ARN].filter((id) => id !== undefined);
2050
+ if (Selector === undefined)
2051
+ return identifiers;
2052
+ return identifiers.map(id => `${id}${Selector}`);
2053
+ }
1902
2054
  /**
1903
2055
  * One failed entry per alias whose path SSM reported as invalid, so two
1904
2056
  * aliases sharing a missing path are both named.
@@ -1998,7 +2150,9 @@ class SSMService {
1998
2150
  * alias in `message`. Request-level SDK exceptions are not wrapped.
1999
2151
  *
2000
2152
  * @param aliases - Record mapping each desired local alias to its SSM
2001
- * parameter name (or ARN).
2153
+ * parameter name, ARN, or a `name:version` / `name:label` selector. The
2154
+ * value is matched back to the response by the name, ARN and selector SSM
2155
+ * reports, so each of those forms resolves to its own parameter.
2002
2156
  * @param opts.required - Throw when any requested parameter does not
2003
2157
  * exist. Defaults to `false`.
2004
2158
  * @returns A record keyed by the same aliases, mapping each to the
@@ -2008,7 +2162,7 @@ class SSMService {
2008
2162
  async getParameters(aliases, opts) {
2009
2163
  this.logger.info('Fetching SSM parameters', { input: { aliases } });
2010
2164
  const names = Object.values(aliases);
2011
- const byPath = new Map();
2165
+ const byRequest = new Map();
2012
2166
  const invalidPaths = new Set();
2013
2167
  for (const batch of chunk(names, GET_PARAMETERS_LIMIT)) {
2014
2168
  const response = await this.client.send(new clientSsm.GetParametersCommand({
@@ -2016,8 +2170,8 @@ class SSMService {
2016
2170
  WithDecryption: true,
2017
2171
  }));
2018
2172
  for (const parameter of response.Parameters ?? []) {
2019
- if (parameter.Name !== undefined)
2020
- byPath.set(parameter.Name, parameter.Value);
2173
+ for (const key of requestKeys(parameter))
2174
+ byRequest.set(key, parameter.Value);
2021
2175
  }
2022
2176
  for (const name of response.InvalidParameters ?? [])
2023
2177
  invalidPaths.add(name);
@@ -2028,7 +2182,7 @@ class SSMService {
2028
2182
  }
2029
2183
  const result = {};
2030
2184
  for (const alias of Object.keys(aliases)) {
2031
- result[alias] = byPath.get(aliases[alias]);
2185
+ result[alias] = byRequest.get(aliases[alias]);
2032
2186
  }
2033
2187
  return result;
2034
2188
  }
package/cjs/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
5
  "engines": {
6
- "node": ">=18"
6
+ "node": ">=20"
7
7
  },
8
8
  "main": "./index.cjs.js",
9
9
  "module": "./esm/index.mjs",
@@ -105,19 +105,38 @@ export declare class DynamoDBService {
105
105
  /**
106
106
  * Batch-get items from one or more DynamoDB tables, retrying
107
107
  * `UnprocessedKeys` with jittered exponential backoff. Up to 5 attempts
108
- * (200ms base delay). Throws when keys remain unprocessed after the final
109
- * attempt. `Responses` are merged across attempts, keyed by table name.
108
+ * (200ms base delay). `Responses` are merged across attempts, keyed by
109
+ * table name.
110
110
  *
111
111
  * Note: this method is intentionally **not** generic. `BatchGet`'s
112
112
  * `Responses` field is a multi-table `Record<string, item[]>` whose item
113
113
  * shapes can differ per table — no single `T` can soundly describe it.
114
114
  * Callers should narrow the result type at the call site.
115
+ *
116
+ * @throws {@link BatchOperationError} when keys remain unprocessed after
117
+ * the final attempt. `results` holds one output: the merged `Responses`
118
+ * retrieved so far, plus the still-pending `UnprocessedKeys` to retry.
119
+ * `failed` has one entry per pending key with `code: 'UnprocessedKeys'`
120
+ * and an `id` of `<table>[<index>]`, the key's position in
121
+ * `results[0].UnprocessedKeys[<table>].Keys`. The `failed` list never
122
+ * carries key values; `results` does, as it is data the caller requested,
123
+ * so don't log the error object itself (see {@link BatchOperationError}).
124
+ * Request-level SDK exceptions propagate unchanged.
115
125
  */
116
126
  batchGet(input: BatchGetCommandInput): Promise<BatchGetCommandOutput>;
117
127
  /**
118
128
  * Batch-write items to DynamoDB, retrying `UnprocessedItems` with jittered
119
- * exponential backoff. Up to 5 attempts (200ms base delay). Throws when
120
- * items remain unprocessed after the final attempt.
129
+ * exponential backoff. Up to 5 attempts (200ms base delay).
130
+ *
131
+ * @throws {@link BatchOperationError} when items remain unprocessed after
132
+ * the final attempt. `results` holds one output: the last response, whose
133
+ * `UnprocessedItems` are the writes still to retry. `failed` has one entry
134
+ * per pending write with `code: 'UnprocessedItems'` and an `id` of
135
+ * `<table>[<index>]`, the write's position in
136
+ * `results[0].UnprocessedItems[<table>]`. The `failed` list never carries
137
+ * item data; `results` does, as it is data the caller supplied, so don't
138
+ * log the error object itself (see {@link BatchOperationError}).
139
+ * Request-level SDK exceptions propagate unchanged.
121
140
  */
122
141
  batchWrite(input: BatchWriteCommandInput): Promise<BatchWriteCommandOutput>;
123
142
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dynamodb.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;;;;;;;;;;;;;;OAyBG;IACI,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5E,KAAK,EAAE,iBAAiB,GACzB,cAAc,CAAC,CAAC,CAAC;IAWpB;;;;;;;;OAQG;IACI,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3E,KAAK,EAAE,gBAAgB,GACxB,cAAc,CAAC,CAAC,CAAC;CAUvB"}
@@ -75,7 +75,9 @@ export declare class S3Service {
75
75
  * Get an object from S3 and parse it as JSON.
76
76
  * @template T - Expected type of the parsed value.
77
77
  * @returns The parsed value, or `undefined` if the response has no body.
78
- * @throws If the body is non-empty and not valid JSON.
78
+ * @throws If the body is non-empty and not valid JSON. The error names the
79
+ * object and never includes any of its content, unlike the native
80
+ * `SyntaxError`.
79
81
  */
80
82
  getJsonObject<T>(input: Required<Pick<GetObjectCommandInput, 'Bucket' | 'Key'>>): Promise<T | undefined>;
81
83
  /**
@@ -95,6 +97,9 @@ export declare class S3Service {
95
97
  * List and JSON-parse every object under a bucket and optional prefix.
96
98
  * Auto-paginated. Objects without a body are skipped.
97
99
  * @template T - Expected type of each parsed object.
100
+ * @throws If any object is not valid JSON. The error names that object's
101
+ * key and never includes any of its content, unlike the native
102
+ * `SyntaxError`; objects after it are not fetched.
98
103
  */
99
104
  getAllObjects<T>(bucket: string, prefix?: string): Promise<T[]>;
100
105
  /**