@aligent/aws-wrappers 0.5.7 → 0.5.8

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 (33) hide show
  1. package/README.md +19 -3
  2. package/cjs/index.cjs +115 -61
  3. package/cjs/package.json +14 -14
  4. package/cjs/src/index.d.ts +1 -0
  5. package/cjs/src/index.d.ts.map +1 -1
  6. package/cjs/src/s3/s3.d.ts +26 -4
  7. package/cjs/src/s3/s3.d.ts.map +1 -1
  8. package/cjs/src/util/batch-operation-error.d.ts +25 -2
  9. package/cjs/src/util/batch-operation-error.d.ts.map +1 -1
  10. package/docs/index/classes/APIGatewayService.md +6 -6
  11. package/docs/index/classes/APIGatewayV2Service.md +5 -5
  12. package/docs/index/classes/BatchOperationError.md +9 -6
  13. package/docs/index/classes/DynamoDBService.md +34 -12
  14. package/docs/index/classes/S3Service.md +42 -19
  15. package/docs/index/classes/SNSService.md +4 -4
  16. package/docs/index/classes/SQSService.md +7 -7
  17. package/docs/index/classes/SSMService.md +9 -7
  18. package/docs/index/classes/SchedulerService.md +11 -11
  19. package/docs/index/classes/SecretsManagerService.md +10 -8
  20. package/docs/index/classes/StepFunctionsService.md +6 -6
  21. package/docs/index/interfaces/BatchFailedEntry.md +5 -5
  22. package/docs/index/interfaces/EmptyBucketPageResult.md +23 -0
  23. package/docs/index/modules.md +1 -0
  24. package/docs/testing/testing/functions/createMockService.md +5 -1
  25. package/esm/index.mjs +115 -61
  26. package/esm/package.json +14 -14
  27. package/esm/src/index.d.ts +1 -0
  28. package/esm/src/index.d.ts.map +1 -1
  29. package/esm/src/s3/s3.d.ts +26 -4
  30. package/esm/src/s3/s3.d.ts.map +1 -1
  31. package/esm/src/util/batch-operation-error.d.ts +25 -2
  32. package/esm/src/util/batch-operation-error.d.ts.map +1 -1
  33. package/package.json +14 -14
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` and `SNSService.publishBatch`.
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`, `S3Service.deleteObjects` and `S3Service.emptyBucket`.
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 the per-chunk SDK outputs exactly as before.
33
33
 
@@ -48,7 +48,7 @@ try {
48
48
  }
49
49
  ```
50
50
 
51
- - `failed` carries only the entry identifier, error code and message — never message bodies, attributes or any other payload.
51
+ - `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.
52
52
  - 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`.
53
53
  - A warning is logged with the failure count and error codes, and no payload, at every log level.
54
54
  - 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.
@@ -104,9 +104,25 @@ await s3.deleteObjects('my-bucket', ['key1', 'key2']); // auto-chunked to 1000 k
104
104
  await s3.emptyBucket('my-bucket'); // unversioned buckets only — see below
105
105
  ```
106
106
 
107
+ `deleteObjects` and `emptyBucket` throw a `BatchOperationError` when S3 reports that it could not delete one or more keys — see "Batch semantics". `failed[].id` is the object key.
108
+
109
+ `emptyBucket` returns only the keys that were actually deleted. A page with failures does not stop the run: every page is attempted, then one aggregated `BatchOperationError` is thrown. Its `results` hold one `{ deletedKeys }` per page, so the caller can tell which keys were deleted and which failed:
110
+
111
+ ```ts
112
+ try {
113
+ const deleted = await s3.emptyBucket('my-bucket');
114
+ } catch (error) {
115
+ if (error instanceof BatchOperationError) {
116
+ const deleted = error.results.flatMap(page => page.deletedKeys);
117
+ const stuck = error.failed.map(entry => entry.id); // [{ id: key, code, message }]
118
+ }
119
+ throw error;
120
+ }
121
+ ```
122
+
107
123
  Input shapes are intentionally tight (`Bucket`, `Key`, `Body` and similar). Callers needing SDK-specific options like server-side encryption or tagging should use `S3Client` directly.
108
124
 
109
- `emptyBucket` streams the listing page-by-page and delegates each page to `deleteObjects`, so peak memory stays bounded by one page regardless of bucket size. It empties **unversioned buckets only**: it paginates `ListObjectsV2`, which reports current object versions and never noncurrent versions or delete markers. Against a versioned bucket the call succeeds and the bucket then *looks* empty to `ListObjectsV2` — but the deletes only added delete markers, so every object version is still stored. You will still be billed for that storage, and `DeleteBucket` will fail with `BucketNotEmpty`. Emptying a versioned bucket needs `ListObjectVersions` plus per-version deletes — use `S3Client` directly.
125
+ `emptyBucket` streams the listing page-by-page and delegates each page to `deleteObjects`, so only one page of SDK responses is held at a time; the list of deleted keys it returns is the one thing that grows with the bucket. It empties **unversioned buckets only**: it paginates `ListObjectsV2`, which reports current object versions and never noncurrent versions or delete markers. Against a versioned bucket the call succeeds and the bucket then *looks* empty to `ListObjectsV2` — but the deletes only added delete markers, so every object version is still stored. You will still be billed for that storage, and `DeleteBucket` will fail with `BucketNotEmpty`. Emptying a versioned bucket needs `ListObjectVersions` plus per-version deletes — use `S3Client` directly.
110
126
 
111
127
  ## DynamoDB
112
128
 
package/cjs/index.cjs CHANGED
@@ -513,6 +513,81 @@ class DynamoDBService {
513
513
  }
514
514
  }
515
515
 
516
+ /**
517
+ * Thrown by the batch methods once every chunk has been sent and at least one
518
+ * entry was rejected.
519
+ *
520
+ * `results` holds the raw SDK output of every chunk, so the outputs of the
521
+ * entries that succeeded (message ids, sequence numbers) stay readable. The
522
+ * one exception is `S3.emptyBucket`, whose `results` are per-page deleted keys.
523
+ * `failed` is the normalised list of rejected entries across all chunks.
524
+ *
525
+ * Match on `name` rather than `instanceof` if both the CJS and ESM builds of
526
+ * this package may be loaded in one process.
527
+ */
528
+ class BatchOperationError extends Error {
529
+ results;
530
+ failed;
531
+ name = 'BatchOperationError';
532
+ constructor(results, failed) {
533
+ super(`Batch operation failed for ${failed.length} entries (${distinctCodes(failed).join(', ')})`);
534
+ this.results = results;
535
+ this.failed = failed;
536
+ }
537
+ }
538
+ /**
539
+ * SQS and SNS report rejected entries under `Failed` on an otherwise
540
+ * successful response, so a resolved chunk does not mean every entry was
541
+ * accepted. Returns `results` untouched when nothing failed; otherwise warns
542
+ * and throws a {@link BatchOperationError}.
543
+ *
544
+ * Only id, code and message are copied out — never the entry itself — so
545
+ * neither the error nor the warning can leak a payload.
546
+ */
547
+ function throwIfAnyFailed(logger, operation, results) {
548
+ const failed = results.flatMap(result => (result.Failed ?? []).map(({ Id, Code, Message }) => ({
549
+ id: Id,
550
+ code: Code,
551
+ message: Message,
552
+ })));
553
+ return throwIfAny(logger, operation, results, failed);
554
+ }
555
+ /**
556
+ * S3 reports undeleted keys under `Errors` on an otherwise successful
557
+ * `DeleteObjects` response. Same contract as {@link throwIfAnyFailed}; the
558
+ * key is carried as the failed entry's `id`, and `VersionId` is dropped.
559
+ */
560
+ function throwIfAnyDeleteErrors(logger, operation, results) {
561
+ const failed = results.flatMap(result => (result.Errors ?? []).map(({ Key, Code, Message }) => ({
562
+ id: Key,
563
+ code: Code,
564
+ message: Message,
565
+ })));
566
+ return throwIfAny(logger, operation, results, failed);
567
+ }
568
+ /**
569
+ * Throws a {@link BatchOperationError} for operations whose `results` aren't a
570
+ * plain list of SDK outputs, such as `S3.emptyBucket`. Returns `results`
571
+ * untouched when `failed` is empty.
572
+ */
573
+ function throwIfAny(logger, operation, results, failed) {
574
+ if (failed.length === 0)
575
+ return results;
576
+ logger.warn(`${operation} had rejected entries`, {
577
+ failedCount: failed.length,
578
+ codes: distinctCodes(failed),
579
+ });
580
+ throw new BatchOperationError(results, failed);
581
+ }
582
+ /**
583
+ * Distinct error codes in first-seen order, for the error message and the
584
+ * warning log line.
585
+ */
586
+ function distinctCodes(failed) {
587
+ const codes = failed.flatMap(entry => (entry.code === undefined ? [] : [entry.code]));
588
+ return [...new Set(codes)];
589
+ }
590
+
516
591
  /**
517
592
  * Split a list into consecutive chunks of at most `size` items, mirroring the
518
593
  * per-request caps the AWS APIs enforce on batch operations.
@@ -717,6 +792,12 @@ class S3Service {
717
792
  * Delete multiple objects from S3, auto-chunking the request into batches
718
793
  * of 1000 keys (the S3-enforced DeleteObjects limit). Returns one output
719
794
  * per chunk.
795
+ *
796
+ * Every chunk is sent before the outcome is judged. If S3 reported a
797
+ * per-key delete error, a {@link BatchOperationError} is then thrown
798
+ * carrying the per-chunk results and the failed keys. Request-level SDK
799
+ * exceptions (throttling, access denied) propagate unchanged and
800
+ * immediately, so earlier chunks may already have been deleted.
720
801
  */
721
802
  async deleteObjects(bucket, keys) {
722
803
  this.logger.info('Deleting S3 objects', {
@@ -732,13 +813,20 @@ class S3Service {
732
813
  Delete: { Objects: batch.map(Key => ({ Key })) },
733
814
  })));
734
815
  }
735
- return results;
816
+ return throwIfAnyDeleteErrors(this.logger, 'S3 deleteObjects', results);
736
817
  }
737
818
  /**
738
819
  * Delete every object in an **unversioned** bucket. Streams the listing
739
- * page-by-page and delegates each page's deletion to `deleteObjects`, so
740
- * peak memory stays bounded by one page (~1000 keys) regardless of bucket
741
- * size.
820
+ * page-by-page and delegates each page's deletion to `deleteObjects`, so no
821
+ * more than one page (~1000 keys) of SDK responses is held at a time. The
822
+ * only thing that grows with the bucket is the list of deleted keys this
823
+ * method returns.
824
+ *
825
+ * A page with per-key delete errors does not stop the run: every page is
826
+ * attempted, then one {@link BatchOperationError} is thrown carrying every
827
+ * failed key in `failed` and, per page, the keys that were deleted in
828
+ * `results`. Request-level SDK exceptions propagate unchanged and
829
+ * immediately, so earlier pages may already have been deleted.
742
830
  *
743
831
  * **Versioned buckets are out of scope.** This paginates `ListObjectsV2`,
744
832
  * which reports only current object versions — never noncurrent versions or
@@ -749,20 +837,39 @@ class S3Service {
749
837
  * versioned bucket requires `ListObjectVersions` and per-version deletes;
750
838
  * use `S3Client` directly for that.
751
839
  *
752
- * @returns The keys this call issued deletes for.
840
+ * @returns The keys that were deleted.
841
+ * @throws {BatchOperationError} If S3 could not delete one or more keys.
753
842
  */
754
843
  async emptyBucket(bucket) {
755
844
  this.logger.info('Emptying S3 bucket', { input: { bucket } });
756
845
  const paginator = clientS3.paginateListObjectsV2({ client: this.client }, { Bucket: bucket });
757
- const deletedKeys = [];
846
+ const pages = [];
847
+ const failed = [];
758
848
  for await (const page of paginator) {
759
849
  const keys = (page.Contents ?? []).flatMap(o => (o.Key ? [o.Key] : []));
760
850
  if (keys.length === 0)
761
851
  continue;
852
+ const outcome = await this.deletePage(bucket, keys);
853
+ pages.push({ deletedKeys: outcome.deletedKeys });
854
+ failed.push(...outcome.failed);
855
+ }
856
+ throwIfAny(this.logger, 'S3 emptyBucket', pages, failed);
857
+ return pages.flatMap(page => page.deletedKeys);
858
+ }
859
+ async deletePage(bucket, keys) {
860
+ try {
762
861
  await this.deleteObjects(bucket, keys);
763
- deletedKeys.push(...keys);
862
+ return { deletedKeys: keys, failed: [] };
863
+ }
864
+ catch (error) {
865
+ if (!(error instanceof BatchOperationError))
866
+ throw error;
867
+ const failedKeys = new Set(error.failed.map(entry => entry.id));
868
+ return {
869
+ deletedKeys: keys.filter(key => !failedKeys.has(key)),
870
+ failed: error.failed,
871
+ };
764
872
  }
765
- return deletedKeys;
766
873
  }
767
874
  }
768
875
 
@@ -1113,59 +1220,6 @@ class StepFunctionsService {
1113
1220
  }
1114
1221
  }
1115
1222
 
1116
- /**
1117
- * Thrown by the batch methods once every chunk has been sent and at least one
1118
- * entry was rejected.
1119
- *
1120
- * `results` holds the raw SDK output of every chunk, so the outputs of the
1121
- * entries that succeeded (message ids, sequence numbers) stay readable.
1122
- * `failed` is the normalised list of rejected entries across all chunks.
1123
- *
1124
- * Match on `name` rather than `instanceof` if both the CJS and ESM builds of
1125
- * this package may be loaded in one process.
1126
- */
1127
- class BatchOperationError extends Error {
1128
- results;
1129
- failed;
1130
- name = 'BatchOperationError';
1131
- constructor(results, failed) {
1132
- super(`Batch operation failed for ${failed.length} entries (${distinctCodes(failed).join(', ')})`);
1133
- this.results = results;
1134
- this.failed = failed;
1135
- }
1136
- }
1137
- /**
1138
- * SQS and SNS report rejected entries under `Failed` on an otherwise
1139
- * successful response, so a resolved chunk does not mean every entry was
1140
- * accepted. Returns `results` untouched when nothing failed; otherwise warns
1141
- * and throws a {@link BatchOperationError}.
1142
- *
1143
- * Only id, code and message are copied out — never the entry itself — so
1144
- * neither the error nor the warning can leak a payload.
1145
- */
1146
- function throwIfAnyFailed(logger, operation, results) {
1147
- const failed = results.flatMap(result => (result.Failed ?? []).map(({ Id, Code, Message }) => ({
1148
- id: Id,
1149
- code: Code,
1150
- message: Message,
1151
- })));
1152
- if (failed.length === 0)
1153
- return results;
1154
- logger.warn(`${operation} had rejected entries`, {
1155
- failedCount: failed.length,
1156
- codes: distinctCodes(failed),
1157
- });
1158
- throw new BatchOperationError(results, failed);
1159
- }
1160
- /**
1161
- * Distinct error codes in first-seen order, for the error message and the
1162
- * warning log line.
1163
- */
1164
- function distinctCodes(failed) {
1165
- const codes = failed.flatMap(entry => (entry.code === undefined ? [] : [entry.code]));
1166
- return [...new Set(codes)];
1167
- }
1168
-
1169
1223
  /**
1170
1224
  * Truncate a UTF-8 string to fit within `maxBytes` when encoded as UTF-8.
1171
1225
  *
package/cjs/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -43,19 +43,19 @@
43
43
  "directory": "packages/aws-wrappers"
44
44
  },
45
45
  "dependencies": {
46
- "@aws-lambda-powertools/logger": "^2.33.1",
47
- "@aws-sdk/client-api-gateway": "^3.1127.0",
48
- "@aws-sdk/client-apigatewayv2": "^3.1127.0",
49
- "@aws-sdk/client-dynamodb": "^3.1127.0",
50
- "@aws-sdk/client-s3": "^3.1127.0",
51
- "@aws-sdk/client-scheduler": "^3.1127.0",
52
- "@aws-sdk/client-secrets-manager": "^3.1127.0",
53
- "@aws-sdk/client-sfn": "^3.1127.0",
54
- "@aws-sdk/client-sns": "^3.1127.0",
55
- "@aws-sdk/client-sqs": "^3.1127.0",
56
- "@aws-sdk/client-ssm": "^3.1127.0",
57
- "@aws-sdk/lib-dynamodb": "^3.1127.0",
58
- "@aws-sdk/s3-request-presigner": "^3.1127.0",
46
+ "@aws-lambda-powertools/logger": "^2.36.0",
47
+ "@aws-sdk/client-api-gateway": "^3.1160.0",
48
+ "@aws-sdk/client-apigatewayv2": "^3.1160.0",
49
+ "@aws-sdk/client-dynamodb": "^3.1160.0",
50
+ "@aws-sdk/client-s3": "^3.1160.0",
51
+ "@aws-sdk/client-scheduler": "^3.1160.0",
52
+ "@aws-sdk/client-secrets-manager": "^3.1160.0",
53
+ "@aws-sdk/client-sfn": "^3.1160.0",
54
+ "@aws-sdk/client-sns": "^3.1160.0",
55
+ "@aws-sdk/client-sqs": "^3.1160.0",
56
+ "@aws-sdk/client-ssm": "^3.1160.0",
57
+ "@aws-sdk/lib-dynamodb": "^3.1160.0",
58
+ "@aws-sdk/s3-request-presigner": "^3.1160.0",
59
59
  "aws-xray-sdk-core": "^3.12.0"
60
60
  },
61
61
  "author": "Aligent",
@@ -2,6 +2,7 @@ export { APIGatewayV2Service } from './api-gateway-v2/api-gateway-v2.js';
2
2
  export { APIGatewayService } from './api-gateway/api-gateway.js';
3
3
  export { DynamoDBService } from './dynamodb/dynamodb.js';
4
4
  export { S3Service } from './s3/s3.js';
5
+ export type { EmptyBucketPageResult } from './s3/s3.js';
5
6
  export { SchedulerService } from './scheduler/scheduler.js';
6
7
  export { SecretsManagerService } from './secrets-manager/secrets-manager.js';
7
8
  export { StepFunctionsService } from './sfn/sfn.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,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,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"}
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,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"}
@@ -1,5 +1,12 @@
1
1
  import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
2
2
  import { CopyObjectCommandInput, CopyObjectCommandOutput, DeleteObjectCommandInput, DeleteObjectCommandOutput, DeleteObjectsCommandOutput, GetObjectCommandInput, GetObjectCommandOutput, HeadObjectCommandInput, HeadObjectCommandOutput, PutObjectCommandInput, PutObjectCommandOutput, S3Client } from '@aws-sdk/client-s3';
3
+ /**
4
+ * One page of an `emptyBucket` run, as carried in `BatchOperationError.results`.
5
+ */
6
+ export interface EmptyBucketPageResult {
7
+ /** The keys of this page that S3 deleted. */
8
+ deletedKeys: string[];
9
+ }
3
10
  /** Tight wrapper input type for `putObject`. */
4
11
  type PutObjectInput = Required<Pick<PutObjectCommandInput, 'Bucket' | 'Key' | 'Body'>>;
5
12
  /** Tight wrapper input type for `putJsonObject`. */
@@ -122,13 +129,26 @@ export declare class S3Service {
122
129
  * Delete multiple objects from S3, auto-chunking the request into batches
123
130
  * of 1000 keys (the S3-enforced DeleteObjects limit). Returns one output
124
131
  * per chunk.
132
+ *
133
+ * Every chunk is sent before the outcome is judged. If S3 reported a
134
+ * per-key delete error, a {@link BatchOperationError} is then thrown
135
+ * carrying the per-chunk results and the failed keys. Request-level SDK
136
+ * exceptions (throttling, access denied) propagate unchanged and
137
+ * immediately, so earlier chunks may already have been deleted.
125
138
  */
126
139
  deleteObjects(bucket: string, keys: string[]): Promise<DeleteObjectsCommandOutput[]>;
127
140
  /**
128
141
  * Delete every object in an **unversioned** bucket. Streams the listing
129
- * page-by-page and delegates each page's deletion to `deleteObjects`, so
130
- * peak memory stays bounded by one page (~1000 keys) regardless of bucket
131
- * size.
142
+ * page-by-page and delegates each page's deletion to `deleteObjects`, so no
143
+ * more than one page (~1000 keys) of SDK responses is held at a time. The
144
+ * only thing that grows with the bucket is the list of deleted keys this
145
+ * method returns.
146
+ *
147
+ * A page with per-key delete errors does not stop the run: every page is
148
+ * attempted, then one {@link BatchOperationError} is thrown carrying every
149
+ * failed key in `failed` and, per page, the keys that were deleted in
150
+ * `results`. Request-level SDK exceptions propagate unchanged and
151
+ * immediately, so earlier pages may already have been deleted.
132
152
  *
133
153
  * **Versioned buckets are out of scope.** This paginates `ListObjectsV2`,
134
154
  * which reports only current object versions — never noncurrent versions or
@@ -139,9 +159,11 @@ export declare class S3Service {
139
159
  * versioned bucket requires `ListObjectVersions` and per-version deletes;
140
160
  * use `S3Client` directly for that.
141
161
  *
142
- * @returns The keys this call issued deletes for.
162
+ * @returns The keys that were deleted.
163
+ * @throws {BatchOperationError} If S3 could not delete one or more keys.
143
164
  */
144
165
  emptyBucket(bucket: string): Promise<string[]>;
166
+ private deletePage;
145
167
  }
146
168
  export {};
147
169
  //# sourceMappingURL=s3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../../src/s3/s3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEH,sBAAsB,EACtB,uBAAuB,EAEvB,wBAAwB,EACxB,yBAAyB,EAEzB,0BAA0B,EAE1B,qBAAqB,EACrB,sBAAsB,EAEtB,sBAAsB,EACtB,uBAAuB,EAGvB,qBAAqB,EACrB,sBAAsB,EACtB,QAAQ,EACX,MAAM,oBAAoB,CAAC;AAW5B,gDAAgD;AAChD,KAAK,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;AAE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AAwB,EAAE,QAAQ,GAAG,KAAK,CAAC,CAAC,GAClE,OAAO,CAAC,yBAAyB,CAAC;IAKrC;;;;;;;;;;OAUG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC;IAqB1F;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YAgBtC,UAAU;CAgB3B"}
@@ -2,7 +2,7 @@ import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
2
2
  /**
3
3
  * One entry a batch operation rejected. Deliberately limited to identifier,
4
4
  * code and message so the error never carries message bodies, attributes or
5
- * any other payload the caller sent.
5
+ * any other payload the caller sent. For S3 the identifier is the object key.
6
6
  */
7
7
  export interface BatchFailedEntry {
8
8
  id: string | undefined;
@@ -14,7 +14,8 @@ export interface BatchFailedEntry {
14
14
  * entry was rejected.
15
15
  *
16
16
  * `results` holds the raw SDK output of every chunk, so the outputs of the
17
- * entries that succeeded (message ids, sequence numbers) stay readable.
17
+ * entries that succeeded (message ids, sequence numbers) stay readable. The
18
+ * one exception is `S3.emptyBucket`, whose `results` are per-page deleted keys.
18
19
  * `failed` is the normalised list of rejected entries across all chunks.
19
20
  *
20
21
  * Match on `name` rather than `instanceof` if both the CJS and ESM builds of
@@ -46,5 +47,27 @@ interface RejectedEntry {
46
47
  export declare function throwIfAnyFailed<TResult extends {
47
48
  Failed?: RejectedEntry[] | undefined;
48
49
  }>(logger: LoggerInterface, operation: string, results: TResult[]): TResult[];
50
+ /**
51
+ * The shape S3 `DeleteObjects` uses for a key it could not delete.
52
+ */
53
+ interface DeleteError {
54
+ Key?: string | undefined;
55
+ Code?: string | undefined;
56
+ Message?: string | undefined;
57
+ }
58
+ /**
59
+ * S3 reports undeleted keys under `Errors` on an otherwise successful
60
+ * `DeleteObjects` response. Same contract as {@link throwIfAnyFailed}; the
61
+ * key is carried as the failed entry's `id`, and `VersionId` is dropped.
62
+ */
63
+ export declare function throwIfAnyDeleteErrors<TResult extends {
64
+ Errors?: DeleteError[] | undefined;
65
+ }>(logger: LoggerInterface, operation: string, results: TResult[]): TResult[];
66
+ /**
67
+ * Throws a {@link BatchOperationError} for operations whose `results` aren't a
68
+ * plain list of SDK outputs, such as `S3.emptyBucket`. Returns `results`
69
+ * untouched when `failed` is empty.
70
+ */
71
+ export declare function throwIfAny<TResult>(logger: LoggerInterface, operation: string, results: TResult[], failed: BatchFailedEntry[]): TResult[];
49
72
  export {};
50
73
  //# sourceMappingURL=batch-operation-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch-operation-error.d.ts","sourceRoot":"","sources":["../../../../src/util/batch-operation-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAE,SAAQ,KAAK;IAIzD,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE;IAC3B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,EAAE;IAJvC,SAAkB,IAAI,yBAAyB;gBAGlC,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,gBAAgB,EAAE;CAM1C;AAED;;GAEG;AACH,UAAU,aAAa;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS;IAAE,MAAM,CAAC,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;CAAE,EACrF,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAAE,GACnB,OAAO,EAAE,CAeX"}
1
+ {"version":3,"file":"batch-operation-error.d.ts","sourceRoot":"","sources":["../../../../src/util/batch-operation-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAE,SAAQ,KAAK;IAIzD,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE;IAC3B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,EAAE;IAJvC,SAAkB,IAAI,yBAAyB;gBAGlC,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,gBAAgB,EAAE;CAM1C;AAED;;GAEG;AACH,UAAU,aAAa;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS;IAAE,MAAM,CAAC,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;CAAE,EACrF,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAAE,GACnB,OAAO,EAAE,CASX;AAED;;GAEG;AACH,UAAU,WAAW;IACjB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS;IAAE,MAAM,CAAC,EAAE,WAAW,EAAE,GAAG,SAAS,CAAA;CAAE,EACzF,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAAE,GACnB,OAAO,EAAE,CASX;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAC9B,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,gBAAgB,EAAE,GAC3B,OAAO,EAAE,CAQX"}
@@ -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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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/759389988566c2660b19633a1e23f3f871a9f03a/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/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/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,13 +6,14 @@
6
6
 
7
7
  # Class: BatchOperationError\<TResult\>
8
8
 
9
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:25](https://github.com/aligent/microservice-development-utilities/blob/759389988566c2660b19633a1e23f3f871a9f03a/packages/aws-wrappers/src/util/batch-operation-error.ts#L25)
9
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:26](https://github.com/aligent/microservice-development-utilities/blob/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/packages/aws-wrappers/src/util/batch-operation-error.ts#L26)
10
10
 
11
11
  Thrown by the batch methods once every chunk has been sent and at least one
12
12
  entry was rejected.
13
13
 
14
14
  `results` holds the raw SDK output of every chunk, so the outputs of the
15
- entries that succeeded (message ids, sequence numbers) stay readable.
15
+ entries that succeeded (message ids, sequence numbers) stay readable. The
16
+ one exception is `S3.emptyBucket`, whose `results` are per-page deleted keys.
16
17
  `failed` is the normalised list of rejected entries across all chunks.
17
18
 
18
19
  Match on `name` rather than `instanceof` if both the CJS and ESM builds of
@@ -24,6 +25,8 @@ this package may be loaded in one process.
24
25
 
25
26
  ## Type Parameters
26
27
 
28
+ <a id="tresult"></a>
29
+
27
30
  ### TResult
28
31
 
29
32
  `TResult` = `unknown`
@@ -36,7 +39,7 @@ this package may be loaded in one process.
36
39
 
37
40
  > **new BatchOperationError**\<`TResult`\>(`results`, `failed`): `BatchOperationError`\<`TResult`\>
38
41
 
39
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:28](https://github.com/aligent/microservice-development-utilities/blob/759389988566c2660b19633a1e23f3f871a9f03a/packages/aws-wrappers/src/util/batch-operation-error.ts#L28)
42
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:29](https://github.com/aligent/microservice-development-utilities/blob/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/packages/aws-wrappers/src/util/batch-operation-error.ts#L29)
40
43
 
41
44
  #### Parameters
42
45
 
@@ -78,7 +81,7 @@ Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:24
78
81
 
79
82
  > `readonly` **failed**: [`BatchFailedEntry`](../interfaces/BatchFailedEntry.md)[]
80
83
 
81
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:30](https://github.com/aligent/microservice-development-utilities/blob/759389988566c2660b19633a1e23f3f871a9f03a/packages/aws-wrappers/src/util/batch-operation-error.ts#L30)
84
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:31](https://github.com/aligent/microservice-development-utilities/blob/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/packages/aws-wrappers/src/util/batch-operation-error.ts#L31)
82
85
 
83
86
  ***
84
87
 
@@ -102,7 +105,7 @@ Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1075
102
105
 
103
106
  > `readonly` **name**: `"BatchOperationError"` = `'BatchOperationError'`
104
107
 
105
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:26](https://github.com/aligent/microservice-development-utilities/blob/759389988566c2660b19633a1e23f3f871a9f03a/packages/aws-wrappers/src/util/batch-operation-error.ts#L26)
108
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:27](https://github.com/aligent/microservice-development-utilities/blob/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/packages/aws-wrappers/src/util/batch-operation-error.ts#L27)
106
109
 
107
110
  #### Overrides
108
111
 
@@ -116,7 +119,7 @@ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:26](https:/
116
119
 
117
120
  > `readonly` **results**: `TResult`[]
118
121
 
119
- Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:29](https://github.com/aligent/microservice-development-utilities/blob/759389988566c2660b19633a1e23f3f871a9f03a/packages/aws-wrappers/src/util/batch-operation-error.ts#L29)
122
+ Defined in: [packages/aws-wrappers/src/util/batch-operation-error.ts:30](https://github.com/aligent/microservice-development-utilities/blob/8b1bfce9cb585c7bb3b8f4bf6535b1058f295574/packages/aws-wrappers/src/util/batch-operation-error.ts#L30)
120
123
 
121
124
  ***
122
125