@aligent/aws-wrappers 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/cjs/index.cjs +130 -144
- package/cjs/package.json +1 -1
- package/cjs/src/dynamodb/dynamodb.d.ts.map +1 -1
- package/cjs/src/s3/s3.d.ts.map +1 -1
- package/cjs/src/scheduler/scheduler.d.ts.map +1 -1
- package/cjs/src/sns/sns.d.ts +7 -0
- package/cjs/src/sns/sns.d.ts.map +1 -1
- package/cjs/src/sqs/sqs.d.ts +0 -7
- package/cjs/src/sqs/sqs.d.ts.map +1 -1
- package/cjs/src/util/batch-operation-error.d.ts +20 -3
- package/cjs/src/util/batch-operation-error.d.ts.map +1 -1
- package/cjs/src/util/redact.d.ts +17 -18
- package/cjs/src/util/redact.d.ts.map +1 -1
- package/docs/index/classes/APIGatewayService.md +6 -6
- package/docs/index/classes/APIGatewayV2Service.md +5 -5
- package/docs/index/classes/BatchOperationError.md +5 -5
- package/docs/index/classes/DynamoDBService.md +12 -12
- package/docs/index/classes/S3Service.md +15 -15
- package/docs/index/classes/SNSService.md +10 -4
- package/docs/index/classes/SQSService.md +7 -7
- package/docs/index/classes/SSMService.md +7 -7
- package/docs/index/classes/SchedulerService.md +11 -11
- package/docs/index/classes/SecretsManagerService.md +8 -8
- package/docs/index/classes/StepFunctionsService.md +6 -6
- package/docs/index/interfaces/BatchFailedEntry.md +4 -4
- package/docs/testing/testing/functions/createMockService.md +1 -1
- package/esm/index.mjs +130 -144
- package/esm/package.json +1 -1
- package/esm/src/dynamodb/dynamodb.d.ts.map +1 -1
- package/esm/src/s3/s3.d.ts.map +1 -1
- package/esm/src/scheduler/scheduler.d.ts.map +1 -1
- package/esm/src/sns/sns.d.ts +7 -0
- package/esm/src/sns/sns.d.ts.map +1 -1
- package/esm/src/sqs/sqs.d.ts +0 -7
- package/esm/src/sqs/sqs.d.ts.map +1 -1
- package/esm/src/util/batch-operation-error.d.ts +20 -3
- package/esm/src/util/batch-operation-error.d.ts.map +1 -1
- package/esm/src/util/redact.d.ts +17 -18
- package/esm/src/util/redact.d.ts.map +1 -1
- package/package.json +1 -1
package/esm/index.mjs
CHANGED
|
@@ -142,38 +142,22 @@ class APIGatewayService {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
* Whether the logger is verbose enough that full SDK inputs
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* **This is the only place in the package that reads the log level.** Never
|
|
149
|
-
* compare `logger.getLevelName()` yourself: Powertools orders `TRACE` as *more*
|
|
150
|
-
* verbose than `DEBUG` (thresholds 6 and 8), so the obvious
|
|
151
|
-
* `getLevelName() === 'DEBUG'` check silently redacts at the most verbose level
|
|
152
|
-
* available. Route every disclosure decision through this predicate instead.
|
|
145
|
+
* Whether the logger is verbose enough that full SDK inputs may be written to
|
|
146
|
+
* the log. The unlock rule is documented on {@link redactInput}.
|
|
153
147
|
*/
|
|
154
148
|
function shouldLogFullInput(logger) {
|
|
155
149
|
return LogLevelThreshold[logger.getLevelName()] <= LogLevelThreshold.DEBUG;
|
|
156
150
|
}
|
|
157
|
-
|
|
158
|
-
* Return a log-safe projection of `input` based on the logger's configured level.
|
|
159
|
-
*
|
|
160
|
-
* At the verbose levels — see {@link shouldLogFullInput} — the full input is
|
|
161
|
-
* returned unchanged: operators who asked for that verbosity have explicitly
|
|
162
|
-
* opted into seeing everything, including payloads, secret material and PII.
|
|
163
|
-
*
|
|
164
|
-
* At any other level, only the fields listed in `safeFields` are included.
|
|
165
|
-
* Missing fields are silently skipped — the result type narrows to
|
|
166
|
-
* `Pick<T, K>` accordingly.
|
|
167
|
-
*
|
|
168
|
-
* Used across the package so that the "what's safe to log at INFO" decision
|
|
169
|
-
* lives in one place. See `packages/aws-wrappers/CLAUDE.md` ("Logging") for
|
|
170
|
-
* the design rationale and conventions on building the safe-field lists.
|
|
171
|
-
*/
|
|
172
|
-
function filterFieldsForLogLevel(logger, input, safeFields) {
|
|
151
|
+
function redactInput(logger, input, project) {
|
|
173
152
|
if (shouldLogFullInput(logger))
|
|
174
153
|
return input;
|
|
154
|
+
if (typeof project === 'function')
|
|
155
|
+
return project(input);
|
|
156
|
+
return pickKeys(input, project);
|
|
157
|
+
}
|
|
158
|
+
function pickKeys(input, keys) {
|
|
175
159
|
const out = {};
|
|
176
|
-
for (const key of
|
|
160
|
+
for (const key of keys) {
|
|
177
161
|
if (key in input)
|
|
178
162
|
out[key] = input[key];
|
|
179
163
|
}
|
|
@@ -184,6 +168,14 @@ const BATCH_WRITE_MAX_ATTEMPTS = 5;
|
|
|
184
168
|
const BATCH_WRITE_BASE_DELAY_MS = 200;
|
|
185
169
|
const BATCH_GET_MAX_ATTEMPTS = 5;
|
|
186
170
|
const BATCH_GET_BASE_DELAY_MS = 200;
|
|
171
|
+
/**
|
|
172
|
+
* Safe log shape for the batch methods. `RequestItems` is keyed by table name
|
|
173
|
+
* with the payload (`Keys`, `Item`) nested inside each value, so it can't be
|
|
174
|
+
* an allowlisted field and is reduced to the table names instead.
|
|
175
|
+
*/
|
|
176
|
+
function summariseTables(input) {
|
|
177
|
+
return { tables: Object.keys(input.RequestItems ?? {}) };
|
|
178
|
+
}
|
|
187
179
|
/**
|
|
188
180
|
* Fields safe to log at INFO. Omits `Key` (may carry customer IDs / tenant IDs).
|
|
189
181
|
*/
|
|
@@ -312,7 +304,7 @@ class DynamoDBService {
|
|
|
312
304
|
*/
|
|
313
305
|
async getItem(input) {
|
|
314
306
|
this.logger.info('Getting DynamoDB item', {
|
|
315
|
-
input:
|
|
307
|
+
input: redactInput(this.logger, input, GET_ITEM_SAFE_FIELDS),
|
|
316
308
|
});
|
|
317
309
|
const response = await this.client.send(new GetCommand(input));
|
|
318
310
|
return response.Item;
|
|
@@ -324,7 +316,7 @@ class DynamoDBService {
|
|
|
324
316
|
*/
|
|
325
317
|
async putItem(input) {
|
|
326
318
|
this.logger.info('Putting DynamoDB item', {
|
|
327
|
-
input:
|
|
319
|
+
input: redactInput(this.logger, input, PUT_ITEM_SAFE_FIELDS),
|
|
328
320
|
});
|
|
329
321
|
return this.client.send(new PutCommand(input));
|
|
330
322
|
}
|
|
@@ -340,7 +332,7 @@ class DynamoDBService {
|
|
|
340
332
|
*/
|
|
341
333
|
async updateItem(input) {
|
|
342
334
|
this.logger.info('Updating DynamoDB item', {
|
|
343
|
-
input:
|
|
335
|
+
input: redactInput(this.logger, input, UPDATE_ITEM_SAFE_FIELDS),
|
|
344
336
|
});
|
|
345
337
|
const response = await this.client.send(new UpdateCommand(input));
|
|
346
338
|
return response;
|
|
@@ -353,7 +345,7 @@ class DynamoDBService {
|
|
|
353
345
|
*/
|
|
354
346
|
async deleteItem(input) {
|
|
355
347
|
this.logger.info('Deleting DynamoDB item', {
|
|
356
|
-
input:
|
|
348
|
+
input: redactInput(this.logger, input, DELETE_ITEM_SAFE_FIELDS),
|
|
357
349
|
});
|
|
358
350
|
const response = await this.client.send(new DeleteCommand(input));
|
|
359
351
|
return response;
|
|
@@ -366,7 +358,7 @@ class DynamoDBService {
|
|
|
366
358
|
*/
|
|
367
359
|
async query(input) {
|
|
368
360
|
this.logger.info('Querying DynamoDB', {
|
|
369
|
-
input:
|
|
361
|
+
input: redactInput(this.logger, input, QUERY_SAFE_FIELDS),
|
|
370
362
|
});
|
|
371
363
|
const response = await this.client.send(new QueryCommand(input));
|
|
372
364
|
return response;
|
|
@@ -392,7 +384,7 @@ class DynamoDBService {
|
|
|
392
384
|
*/
|
|
393
385
|
async scan(input) {
|
|
394
386
|
this.logger.info('Scanning DynamoDB', {
|
|
395
|
-
input:
|
|
387
|
+
input: redactInput(this.logger, input, SCAN_SAFE_FIELDS),
|
|
396
388
|
});
|
|
397
389
|
const response = await this.client.send(new ScanCommand(input));
|
|
398
390
|
return response;
|
|
@@ -409,13 +401,8 @@ class DynamoDBService {
|
|
|
409
401
|
* Callers should narrow the result type at the call site.
|
|
410
402
|
*/
|
|
411
403
|
async batchGet(input) {
|
|
412
|
-
// Inline verbosity check rather than `filterFieldsForLogLevel` because
|
|
413
|
-
// `RequestItems` is a `Record<tableName, KeysAndAttributes>` — the
|
|
414
|
-
// payload (`Keys[]`) lives inside the value, not as a top-level key
|
|
415
|
-
// the helper could pick or drop.
|
|
416
|
-
const logFullInput = shouldLogFullInput(this.logger);
|
|
417
404
|
this.logger.info('Batch getting DynamoDB items', {
|
|
418
|
-
input:
|
|
405
|
+
input: redactInput(this.logger, input, summariseTables),
|
|
419
406
|
});
|
|
420
407
|
let current = input;
|
|
421
408
|
const mergedResponses = {};
|
|
@@ -444,13 +431,8 @@ class DynamoDBService {
|
|
|
444
431
|
* items remain unprocessed after the final attempt.
|
|
445
432
|
*/
|
|
446
433
|
async batchWrite(input) {
|
|
447
|
-
// Inline verbosity check rather than `filterFieldsForLogLevel` because
|
|
448
|
-
// `RequestItems` is a `Record<tableName, WriteRequest[]>` — the
|
|
449
|
-
// payload (`PutRequest.Item` / `DeleteRequest.Key`) lives inside the
|
|
450
|
-
// value, not as a top-level key the helper could pick or drop.
|
|
451
|
-
const logFullInput = shouldLogFullInput(this.logger);
|
|
452
434
|
this.logger.info('Batch writing DynamoDB items', {
|
|
453
|
-
input:
|
|
435
|
+
input: redactInput(this.logger, input, summariseTables),
|
|
454
436
|
});
|
|
455
437
|
let current = input;
|
|
456
438
|
for (let attempt = 0; attempt < BATCH_WRITE_MAX_ATTEMPTS; attempt++) {
|
|
@@ -496,7 +478,7 @@ class DynamoDBService {
|
|
|
496
478
|
*/
|
|
497
479
|
async *paginateItems(input) {
|
|
498
480
|
this.logger.info('Paginating DynamoDB query', {
|
|
499
|
-
input:
|
|
481
|
+
input: redactInput(this.logger, input, QUERY_SAFE_FIELDS),
|
|
500
482
|
});
|
|
501
483
|
const paginator = paginateQuery({ client: this.client }, input);
|
|
502
484
|
for await (const page of paginator) {
|
|
@@ -517,7 +499,7 @@ class DynamoDBService {
|
|
|
517
499
|
*/
|
|
518
500
|
async *paginateScan(input) {
|
|
519
501
|
this.logger.info('Paginating DynamoDB scan', {
|
|
520
|
-
input:
|
|
502
|
+
input: redactInput(this.logger, input, SCAN_SAFE_FIELDS),
|
|
521
503
|
});
|
|
522
504
|
const paginator = paginateScan({ client: this.client }, input);
|
|
523
505
|
for await (const page of paginator) {
|
|
@@ -592,7 +574,7 @@ class S3Service {
|
|
|
592
574
|
*/
|
|
593
575
|
async putObject(input) {
|
|
594
576
|
this.logger.info('Putting S3 object', {
|
|
595
|
-
input:
|
|
577
|
+
input: redactInput(this.logger, input, PUT_OBJECT_SAFE_FIELDS),
|
|
596
578
|
});
|
|
597
579
|
return this.client.send(new PutObjectCommand(input));
|
|
598
580
|
}
|
|
@@ -607,7 +589,7 @@ class S3Service {
|
|
|
607
589
|
*/
|
|
608
590
|
async putJsonObject(input) {
|
|
609
591
|
this.logger.info('Putting S3 JSON object', {
|
|
610
|
-
input:
|
|
592
|
+
input: redactInput(this.logger, input, PUT_JSON_OBJECT_SAFE_FIELDS),
|
|
611
593
|
});
|
|
612
594
|
return this.client.send(new PutObjectCommand({
|
|
613
595
|
Bucket: input.Bucket,
|
|
@@ -735,12 +717,11 @@ class S3Service {
|
|
|
735
717
|
* per chunk.
|
|
736
718
|
*/
|
|
737
719
|
async deleteObjects(bucket, keys) {
|
|
738
|
-
// Inline verbosity check rather than `filterFieldsForLogLevel` because the
|
|
739
|
-
// safe log shape includes the computed `keyCount`, which isn't a key
|
|
740
|
-
// on any SDK input type.
|
|
741
|
-
const logFullInput = shouldLogFullInput(this.logger);
|
|
742
720
|
this.logger.info('Deleting S3 objects', {
|
|
743
|
-
input:
|
|
721
|
+
input: redactInput(this.logger, { bucket, keys }, input => ({
|
|
722
|
+
bucket: input.bucket,
|
|
723
|
+
keyCount: input.keys.length,
|
|
724
|
+
})),
|
|
744
725
|
});
|
|
745
726
|
const results = [];
|
|
746
727
|
for (const batch of chunk(keys, DELETE_OBJECTS_BATCH_LIMIT)) {
|
|
@@ -789,21 +770,14 @@ class S3Service {
|
|
|
789
770
|
* PII (customer IDs, order contents, etc.), the same risk profile as SFN's
|
|
790
771
|
* execution `input`.
|
|
791
772
|
*
|
|
792
|
-
* This can't
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
* `
|
|
797
|
-
*
|
|
798
|
-
* `Target.Input`.
|
|
799
|
-
*
|
|
800
|
-
* At the verbose levels — see {@link shouldLogFullInput} — the input is
|
|
801
|
-
* returned unchanged: operators who asked for that verbosity have opted into
|
|
802
|
-
* seeing payloads and PII.
|
|
773
|
+
* This can't be a key allowlist for {@link redactInput}: an allowlist picks
|
|
774
|
+
* **top-level** keys only, and the sensitive field is nested one level down
|
|
775
|
+
* inside `Target`. Allowlisting `Target` would leak `Input`; omitting `Target`
|
|
776
|
+
* would lose operationally-useful fields (`Arn`, `RoleArn`, `RetryPolicy`,
|
|
777
|
+
* `DeadLetterConfig`, the target-type params). So this is a projection
|
|
778
|
+
* function: keep every top-level field and shallow-strip only `Target.Input`.
|
|
803
779
|
*/
|
|
804
|
-
function
|
|
805
|
-
if (shouldLogFullInput(logger))
|
|
806
|
-
return input;
|
|
780
|
+
function stripTargetInput(input) {
|
|
807
781
|
if (input.Target?.Input === undefined)
|
|
808
782
|
return input;
|
|
809
783
|
const { Input: _input, ...safeTarget } = input.Target;
|
|
@@ -843,7 +817,9 @@ class SchedulerService {
|
|
|
843
817
|
* target payload, a PII carrier).
|
|
844
818
|
*/
|
|
845
819
|
async createSchedule(input) {
|
|
846
|
-
this.logger.info('Creating schedule', {
|
|
820
|
+
this.logger.info('Creating schedule', {
|
|
821
|
+
input: redactInput(this.logger, input, stripTargetInput),
|
|
822
|
+
});
|
|
847
823
|
return this.client.send(new CreateScheduleCommand(input));
|
|
848
824
|
}
|
|
849
825
|
/**
|
|
@@ -867,7 +843,9 @@ class SchedulerService {
|
|
|
867
843
|
* At INFO the log line omits `Target.Input`.
|
|
868
844
|
*/
|
|
869
845
|
async updateSchedule(input) {
|
|
870
|
-
this.logger.info('Updating schedule', {
|
|
846
|
+
this.logger.info('Updating schedule', {
|
|
847
|
+
input: redactInput(this.logger, input, stripTargetInput),
|
|
848
|
+
});
|
|
871
849
|
return this.client.send(new UpdateScheduleCommand(input));
|
|
872
850
|
}
|
|
873
851
|
/**
|
|
@@ -1017,7 +995,7 @@ class SecretsManagerService {
|
|
|
1017
995
|
*/
|
|
1018
996
|
async createSecret(input) {
|
|
1019
997
|
this.logger.info('Creating secret', {
|
|
1020
|
-
input:
|
|
998
|
+
input: redactInput(this.logger, input, CREATE_SECRET_SAFE_FIELDS),
|
|
1021
999
|
});
|
|
1022
1000
|
return this.client.send(new CreateSecretCommand(input));
|
|
1023
1001
|
}
|
|
@@ -1030,7 +1008,7 @@ class SecretsManagerService {
|
|
|
1030
1008
|
*/
|
|
1031
1009
|
async updateSecret(input) {
|
|
1032
1010
|
this.logger.info('Updating secret', {
|
|
1033
|
-
input:
|
|
1011
|
+
input: redactInput(this.logger, input, UPDATE_SECRET_SAFE_FIELDS),
|
|
1034
1012
|
});
|
|
1035
1013
|
return this.client.send(new UpdateSecretCommand(input));
|
|
1036
1014
|
}
|
|
@@ -1042,7 +1020,7 @@ class SecretsManagerService {
|
|
|
1042
1020
|
*/
|
|
1043
1021
|
async putSecretValue(input) {
|
|
1044
1022
|
this.logger.info('Putting secret value', {
|
|
1045
|
-
input:
|
|
1023
|
+
input: redactInput(this.logger, input, PUT_SECRET_VALUE_SAFE_FIELDS),
|
|
1046
1024
|
});
|
|
1047
1025
|
return this.client.send(new PutSecretValueCommand(input));
|
|
1048
1026
|
}
|
|
@@ -1054,7 +1032,7 @@ class SecretsManagerService {
|
|
|
1054
1032
|
*/
|
|
1055
1033
|
async deleteSecret(input) {
|
|
1056
1034
|
this.logger.info('Deleting secret', {
|
|
1057
|
-
input:
|
|
1035
|
+
input: redactInput(this.logger, input, DELETE_SECRET_SAFE_FIELDS),
|
|
1058
1036
|
});
|
|
1059
1037
|
return this.client.send(new DeleteSecretCommand(input));
|
|
1060
1038
|
}
|
|
@@ -1113,7 +1091,7 @@ class StepFunctionsService {
|
|
|
1113
1091
|
*/
|
|
1114
1092
|
async startExecution(input) {
|
|
1115
1093
|
this.logger.info('Starting Step Functions execution', {
|
|
1116
|
-
input:
|
|
1094
|
+
input: redactInput(this.logger, input, START_EXECUTION_SAFE_FIELDS),
|
|
1117
1095
|
});
|
|
1118
1096
|
return this.client.send(new StartExecutionCommand(input));
|
|
1119
1097
|
}
|
|
@@ -1133,6 +1111,59 @@ class StepFunctionsService {
|
|
|
1133
1111
|
}
|
|
1134
1112
|
}
|
|
1135
1113
|
|
|
1114
|
+
/**
|
|
1115
|
+
* Thrown by the batch methods once every chunk has been sent and at least one
|
|
1116
|
+
* entry was rejected.
|
|
1117
|
+
*
|
|
1118
|
+
* `results` holds the raw SDK output of every chunk, so the outputs of the
|
|
1119
|
+
* entries that succeeded (message ids, sequence numbers) stay readable.
|
|
1120
|
+
* `failed` is the normalised list of rejected entries across all chunks.
|
|
1121
|
+
*
|
|
1122
|
+
* Match on `name` rather than `instanceof` if both the CJS and ESM builds of
|
|
1123
|
+
* this package may be loaded in one process.
|
|
1124
|
+
*/
|
|
1125
|
+
class BatchOperationError extends Error {
|
|
1126
|
+
results;
|
|
1127
|
+
failed;
|
|
1128
|
+
name = 'BatchOperationError';
|
|
1129
|
+
constructor(results, failed) {
|
|
1130
|
+
super(`Batch operation failed for ${failed.length} entries (${distinctCodes(failed).join(', ')})`);
|
|
1131
|
+
this.results = results;
|
|
1132
|
+
this.failed = failed;
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* SQS and SNS report rejected entries under `Failed` on an otherwise
|
|
1137
|
+
* successful response, so a resolved chunk does not mean every entry was
|
|
1138
|
+
* accepted. Returns `results` untouched when nothing failed; otherwise warns
|
|
1139
|
+
* and throws a {@link BatchOperationError}.
|
|
1140
|
+
*
|
|
1141
|
+
* Only id, code and message are copied out — never the entry itself — so
|
|
1142
|
+
* neither the error nor the warning can leak a payload.
|
|
1143
|
+
*/
|
|
1144
|
+
function throwIfAnyFailed(logger, operation, results) {
|
|
1145
|
+
const failed = results.flatMap(result => (result.Failed ?? []).map(({ Id, Code, Message }) => ({
|
|
1146
|
+
id: Id,
|
|
1147
|
+
code: Code,
|
|
1148
|
+
message: Message,
|
|
1149
|
+
})));
|
|
1150
|
+
if (failed.length === 0)
|
|
1151
|
+
return results;
|
|
1152
|
+
logger.warn(`${operation} had rejected entries`, {
|
|
1153
|
+
failedCount: failed.length,
|
|
1154
|
+
codes: distinctCodes(failed),
|
|
1155
|
+
});
|
|
1156
|
+
throw new BatchOperationError(results, failed);
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Distinct error codes in first-seen order, for the error message and the
|
|
1160
|
+
* warning log line.
|
|
1161
|
+
*/
|
|
1162
|
+
function distinctCodes(failed) {
|
|
1163
|
+
const codes = failed.flatMap(entry => (entry.code === undefined ? [] : [entry.code]));
|
|
1164
|
+
return [...new Set(codes)];
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1136
1167
|
/**
|
|
1137
1168
|
* Truncate a UTF-8 string to fit within `maxBytes` when encoded as UTF-8.
|
|
1138
1169
|
*
|
|
@@ -1222,7 +1253,7 @@ class SNSService {
|
|
|
1222
1253
|
const shouldTruncate = opts?.truncate ?? this.truncate;
|
|
1223
1254
|
const effective = shouldTruncate ? this.applyTruncation(input) : input;
|
|
1224
1255
|
this.logger.info('Publishing SNS message', {
|
|
1225
|
-
input:
|
|
1256
|
+
input: redactInput(this.logger, effective, PUBLISH_SAFE_FIELDS),
|
|
1226
1257
|
});
|
|
1227
1258
|
return this.client.send(new PublishCommand(effective));
|
|
1228
1259
|
}
|
|
@@ -1260,16 +1291,22 @@ class SNSService {
|
|
|
1260
1291
|
* PublishBatch at 10 entries per request, so this method auto-chunks
|
|
1261
1292
|
* the caller's `PublishBatchRequestEntries` and sends one request per
|
|
1262
1293
|
* chunk, returning the array of outputs.
|
|
1294
|
+
*
|
|
1295
|
+
* Every chunk is sent before the outcome is judged. If SNS rejected any
|
|
1296
|
+
* entry, a {@link BatchOperationError} is then thrown carrying the
|
|
1297
|
+
* per-chunk results and the failed entries. Request-level SDK exceptions
|
|
1298
|
+
* (throttling, access denied) propagate unchanged and immediately, so
|
|
1299
|
+
* earlier chunks may already have been published.
|
|
1300
|
+
*
|
|
1263
1301
|
* @param input - PublishBatchCommandInput including TopicArn and entries.
|
|
1264
1302
|
*/
|
|
1265
1303
|
async publishBatch(input) {
|
|
1266
1304
|
const entries = input.PublishBatchRequestEntries ?? [];
|
|
1267
|
-
// Inline verbosity check rather than `filterFieldsForLogLevel` because the
|
|
1268
|
-
// safe log shape includes the computed `entryCount`, which isn't a key
|
|
1269
|
-
// on `PublishBatchCommandInput`.
|
|
1270
|
-
const logFullInput = shouldLogFullInput(this.logger);
|
|
1271
1305
|
this.logger.info('Publishing SNS message batch', {
|
|
1272
|
-
input:
|
|
1306
|
+
input: redactInput(this.logger, input, ({ TopicArn }) => ({
|
|
1307
|
+
TopicArn,
|
|
1308
|
+
entryCount: entries.length,
|
|
1309
|
+
})),
|
|
1273
1310
|
});
|
|
1274
1311
|
const results = [];
|
|
1275
1312
|
for (const batch of chunk(entries, PUBLISH_BATCH_LIMIT)) {
|
|
@@ -1278,39 +1315,9 @@ class SNSService {
|
|
|
1278
1315
|
PublishBatchRequestEntries: batch,
|
|
1279
1316
|
})));
|
|
1280
1317
|
}
|
|
1281
|
-
return results;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
/**
|
|
1286
|
-
* Thrown by the batch methods once every chunk has been sent and at least one
|
|
1287
|
-
* entry was rejected.
|
|
1288
|
-
*
|
|
1289
|
-
* `results` holds the raw SDK output of every chunk, so the outputs of the
|
|
1290
|
-
* entries that succeeded (message ids, sequence numbers) stay readable.
|
|
1291
|
-
* `failed` is the normalised list of rejected entries across all chunks.
|
|
1292
|
-
*
|
|
1293
|
-
* Match on `name` rather than `instanceof` if both the CJS and ESM builds of
|
|
1294
|
-
* this package may be loaded in one process.
|
|
1295
|
-
*/
|
|
1296
|
-
class BatchOperationError extends Error {
|
|
1297
|
-
results;
|
|
1298
|
-
failed;
|
|
1299
|
-
name = 'BatchOperationError';
|
|
1300
|
-
constructor(results, failed) {
|
|
1301
|
-
super(`Batch operation failed for ${failed.length} entries (${distinctCodes(failed).join(', ')})`);
|
|
1302
|
-
this.results = results;
|
|
1303
|
-
this.failed = failed;
|
|
1318
|
+
return throwIfAnyFailed(this.logger, 'SNS publishBatch', results);
|
|
1304
1319
|
}
|
|
1305
1320
|
}
|
|
1306
|
-
/**
|
|
1307
|
-
* Distinct error codes in first-seen order, for the error message and the
|
|
1308
|
-
* warning log line.
|
|
1309
|
-
*/
|
|
1310
|
-
function distinctCodes(failed) {
|
|
1311
|
-
const codes = failed.flatMap(entry => (entry.code === undefined ? [] : [entry.code]));
|
|
1312
|
-
return [...new Set(codes)];
|
|
1313
|
-
}
|
|
1314
1321
|
|
|
1315
1322
|
const SQS_BATCH_LIMIT = 10;
|
|
1316
1323
|
const SQS_MESSAGE_BODY_MAX_BYTES = 256 * 1024;
|
|
@@ -1324,6 +1331,13 @@ const SEND_MESSAGE_SAFE_FIELDS = [
|
|
|
1324
1331
|
'MessageGroupId',
|
|
1325
1332
|
'MessageDeduplicationId',
|
|
1326
1333
|
];
|
|
1334
|
+
/**
|
|
1335
|
+
* Safe log shape for the batch methods. The entries carry message bodies and
|
|
1336
|
+
* receipt handles, so they are reduced to a count.
|
|
1337
|
+
*/
|
|
1338
|
+
function summariseEntries(input) {
|
|
1339
|
+
return { QueueUrl: input.QueueUrl, entryCount: input.Entries?.length ?? 0 };
|
|
1340
|
+
}
|
|
1327
1341
|
/**
|
|
1328
1342
|
* Wrapper around the AWS SQS client providing structured Powertools logging
|
|
1329
1343
|
* and X-Ray tracing by default.
|
|
@@ -1361,7 +1375,7 @@ class SQSService {
|
|
|
1361
1375
|
const shouldTruncate = opts?.truncate ?? this.truncate;
|
|
1362
1376
|
const effective = shouldTruncate ? this.applyTruncation(input) : input;
|
|
1363
1377
|
this.logger.info('Sending SQS message', {
|
|
1364
|
-
input:
|
|
1378
|
+
input: redactInput(this.logger, effective, SEND_MESSAGE_SAFE_FIELDS),
|
|
1365
1379
|
});
|
|
1366
1380
|
return this.client.send(new SendMessageCommand(effective));
|
|
1367
1381
|
}
|
|
@@ -1405,26 +1419,6 @@ class SQSService {
|
|
|
1405
1419
|
this.logger.info('Deleting SQS message', { input });
|
|
1406
1420
|
return this.client.send(new DeleteMessageCommand(input));
|
|
1407
1421
|
}
|
|
1408
|
-
/**
|
|
1409
|
-
* SQS reports rejected entries under `Failed` on an otherwise successful
|
|
1410
|
-
* response, so a resolved chunk does not mean every entry was accepted.
|
|
1411
|
-
* Only id, code and message are copied out — never the entry itself — so
|
|
1412
|
-
* neither the error nor the warning can leak a payload.
|
|
1413
|
-
*/
|
|
1414
|
-
throwIfAnyFailed(operation, results) {
|
|
1415
|
-
const failed = results.flatMap(result => (result.Failed ?? []).map(({ Id, Code, Message }) => ({
|
|
1416
|
-
id: Id,
|
|
1417
|
-
code: Code,
|
|
1418
|
-
message: Message,
|
|
1419
|
-
})));
|
|
1420
|
-
if (failed.length === 0)
|
|
1421
|
-
return results;
|
|
1422
|
-
this.logger.warn(`${operation} had rejected entries`, {
|
|
1423
|
-
failedCount: failed.length,
|
|
1424
|
-
codes: distinctCodes(failed),
|
|
1425
|
-
});
|
|
1426
|
-
throw new BatchOperationError(results, failed);
|
|
1427
|
-
}
|
|
1428
1422
|
/**
|
|
1429
1423
|
* Send a batch of messages to an SQS queue. The SQS API caps
|
|
1430
1424
|
* SendMessageBatch at 10 entries per request, so this method auto-chunks
|
|
@@ -1438,18 +1432,14 @@ class SQSService {
|
|
|
1438
1432
|
*/
|
|
1439
1433
|
async sendMessageBatch(input) {
|
|
1440
1434
|
const entries = input.Entries ?? [];
|
|
1441
|
-
// Inline verbosity check rather than `filterFieldsForLogLevel` because the
|
|
1442
|
-
// safe log shape includes the computed `entryCount`, which isn't a key
|
|
1443
|
-
// on `SendMessageBatchCommandInput`.
|
|
1444
|
-
const logFullInput = shouldLogFullInput(this.logger);
|
|
1445
1435
|
this.logger.info('Sending SQS message batch', {
|
|
1446
|
-
input:
|
|
1436
|
+
input: redactInput(this.logger, input, summariseEntries),
|
|
1447
1437
|
});
|
|
1448
1438
|
const results = [];
|
|
1449
1439
|
for (const batch of chunk(entries, SQS_BATCH_LIMIT)) {
|
|
1450
1440
|
results.push(await this.client.send(new SendMessageBatchCommand({ ...input, Entries: batch })));
|
|
1451
1441
|
}
|
|
1452
|
-
return this.
|
|
1442
|
+
return throwIfAnyFailed(this.logger, 'SQS sendMessageBatch', results);
|
|
1453
1443
|
}
|
|
1454
1444
|
/**
|
|
1455
1445
|
* Delete a batch of messages from an SQS queue. The SQS API caps
|
|
@@ -1465,18 +1455,14 @@ class SQSService {
|
|
|
1465
1455
|
*/
|
|
1466
1456
|
async deleteMessageBatch(input) {
|
|
1467
1457
|
const entries = input.Entries ?? [];
|
|
1468
|
-
// Inline verbosity check rather than `filterFieldsForLogLevel` because the
|
|
1469
|
-
// safe log shape includes the computed `entryCount`, which isn't a key
|
|
1470
|
-
// on `DeleteMessageBatchCommandInput`.
|
|
1471
|
-
const logFullInput = shouldLogFullInput(this.logger);
|
|
1472
1458
|
this.logger.info('Deleting SQS message batch', {
|
|
1473
|
-
input:
|
|
1459
|
+
input: redactInput(this.logger, input, summariseEntries),
|
|
1474
1460
|
});
|
|
1475
1461
|
const results = [];
|
|
1476
1462
|
for (const batch of chunk(entries, SQS_BATCH_LIMIT)) {
|
|
1477
1463
|
results.push(await this.client.send(new DeleteMessageBatchCommand({ ...input, Entries: batch })));
|
|
1478
1464
|
}
|
|
1479
|
-
return this.
|
|
1465
|
+
return throwIfAnyFailed(this.logger, 'SQS deleteMessageBatch', results);
|
|
1480
1466
|
}
|
|
1481
1467
|
}
|
|
1482
1468
|
|
|
@@ -1590,7 +1576,7 @@ class SSMService {
|
|
|
1590
1576
|
*/
|
|
1591
1577
|
async putParameter(input) {
|
|
1592
1578
|
this.logger.info('Putting SSM parameter', {
|
|
1593
|
-
input:
|
|
1579
|
+
input: redactInput(this.logger, input, PUT_PARAMETER_SAFE_FIELDS),
|
|
1594
1580
|
});
|
|
1595
1581
|
return this.client.send(new PutParameterCommand(input));
|
|
1596
1582
|
}
|
package/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamodb.d.ts","sourceRoot":"","sources":["../../../../src/dynamodb/dynamodb.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAEH,oBAAoB,EACpB,qBAAqB,EAErB,sBAAsB,EACtB,uBAAuB,EAEvB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EAEtB,eAAe,EAIf,eAAe,EACf,gBAAgB,EAEhB,iBAAiB,EACjB,kBAAkB,EAElB,gBAAgB,EAChB,iBAAiB,EAEjB,kBAAkB,EAClB,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"dynamodb.d.ts","sourceRoot":"","sources":["../../../../src/dynamodb/dynamodb.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAEH,oBAAoB,EACpB,qBAAqB,EAErB,sBAAsB,EACtB,uBAAuB,EAEvB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EAEtB,eAAe,EAIf,eAAe,EACf,gBAAgB,EAEhB,iBAAiB,EACjB,kBAAkB,EAElB,gBAAgB,EAChB,iBAAiB,EAEjB,kBAAkB,EAClB,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;AAoH/B;;;GAGG;AACH,KAAK,YAAY,CAAC,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IA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AAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAK7F;;;;OAIG;IACG,aAAa,CAAC,KAAK,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAMlF;;;OAGG;IACG,mBAAmB,CACrB,KAAK,EAAE,+BAA+B,GACvC,OAAO,CAAC,gCAAgC,CAAC;IAK5C;;OAEG;IACG,gBAAgB,CAClB,KAAK,EAAE,4BAA4B,GACpC,OAAO,CAAC,6BAA6B,CAAC;IAKzC;;;;OAIG;IACG,mBAAmB,CACrB,KAAK,EAAE,+BAA+B,GACvC,OAAO,CAAC,gCAAgC,CAAC;IAK5C;;;OAGG;IACG,kBAAkB,CACpB,KAAK,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAKrC"}
|
package/esm/src/sns/sns.d.ts
CHANGED
|
@@ -52,6 +52,13 @@ export declare class SNSService {
|
|
|
52
52
|
* PublishBatch at 10 entries per request, so this method auto-chunks
|
|
53
53
|
* the caller's `PublishBatchRequestEntries` and sends one request per
|
|
54
54
|
* chunk, returning the array of outputs.
|
|
55
|
+
*
|
|
56
|
+
* Every chunk is sent before the outcome is judged. If SNS rejected any
|
|
57
|
+
* entry, a {@link BatchOperationError} is then thrown carrying the
|
|
58
|
+
* per-chunk results and the failed entries. Request-level SDK exceptions
|
|
59
|
+
* (throttling, access denied) propagate unchanged and immediately, so
|
|
60
|
+
* earlier chunks may already have been published.
|
|
61
|
+
*
|
|
55
62
|
* @param input - PublishBatchCommandInput including TopicArn and entries.
|
|
56
63
|
*/
|
|
57
64
|
publishBatch(input: PublishBatchCommandInput): Promise<PublishBatchCommandOutput[]>;
|
package/esm/src/sns/sns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sns.d.ts","sourceRoot":"","sources":["../../../../src/sns/sns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEH,wBAAwB,EACxB,yBAAyB,EAGzB,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACZ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"sns.d.ts","sourceRoot":"","sources":["../../../../src/sns/sns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEH,wBAAwB,EACxB,yBAAyB,EAGzB,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACZ,MAAM,qBAAqB,CAAC;AAyB7B;;;;;;;GAOG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC;;;;;;;;;;OAUG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;IAMvF;;;;;;;OAOG;IACG,OAAO,CACT,KAAK,EAAE,mBAAmB,EAC1B,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IAShC;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IA0BvB;;;;;;;;;;;;;OAaG;IACG,YAAY,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAqB5F"}
|
package/esm/src/sqs/sqs.d.ts
CHANGED
|
@@ -55,13 +55,6 @@ export declare class SQSService {
|
|
|
55
55
|
* Delete a single message from an SQS queue.
|
|
56
56
|
*/
|
|
57
57
|
deleteMessage(input: DeleteMessageCommandInput): Promise<DeleteMessageCommandOutput>;
|
|
58
|
-
/**
|
|
59
|
-
* SQS reports rejected entries under `Failed` on an otherwise successful
|
|
60
|
-
* response, so a resolved chunk does not mean every entry was accepted.
|
|
61
|
-
* Only id, code and message are copied out — never the entry itself — so
|
|
62
|
-
* neither the error nor the warning can leak a payload.
|
|
63
|
-
*/
|
|
64
|
-
private throwIfAnyFailed;
|
|
65
58
|
/**
|
|
66
59
|
* Send a batch of messages to an SQS queue. The SQS API caps
|
|
67
60
|
* SendMessageBatch at 10 entries per request, so this method auto-chunks
|
package/esm/src/sqs/sqs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqs.d.ts","sourceRoot":"","sources":["../../../../src/sqs/sqs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"sqs.d.ts","sourceRoot":"","sources":["../../../../src/sqs/sqs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEH,8BAA8B,EAC9B,+BAA+B,EAG/B,yBAAyB,EACzB,0BAA0B,EAC1B,OAAO,EAEP,0BAA0B,EAE1B,4BAA4B,EAC5B,6BAA6B,EAG7B,uBAAuB,EACvB,wBAAwB,EACxB,SAAS,EACZ,MAAM,qBAAqB,CAAC;AAgC7B;;;;;;;GAOG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IAEnC;;;;;;;;;OASG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;IAMvF;;;;;OAKG;IACG,WAAW,CACb,KAAK,EAAE,uBAAuB,EAC9B,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAC9B,OAAO,CAAC,wBAAwB,CAAC;IASpC;;;;;;OAMG;IACH,OAAO,CAAC,eAAe;IAkBvB;;;;;OAKG;IACG,eAAe,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAM5E;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAK1F;;;;;;;;;;OAUG;IACG,gBAAgB,CAClB,KAAK,EAAE,4BAA4B,GACpC,OAAO,CAAC,6BAA6B,EAAE,CAAC;IAc3C;;;;;;;;;;;OAWG;IACG,kBAAkB,CACpB,KAAK,EAAE,8BAA8B,GACtC,OAAO,CAAC,+BAA+B,EAAE,CAAC;CAahD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
|
|
1
2
|
/**
|
|
2
3
|
* One entry a batch operation rejected. Deliberately limited to identifier,
|
|
3
4
|
* code and message so the error never carries message bodies, attributes or
|
|
@@ -26,8 +27,24 @@ export declare class BatchOperationError<TResult = unknown> extends Error {
|
|
|
26
27
|
constructor(results: TResult[], failed: BatchFailedEntry[]);
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
* warning log line.
|
|
30
|
+
* The shape SQS and SNS share for a rejected entry in a batch response.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
interface RejectedEntry {
|
|
33
|
+
Id?: string | undefined;
|
|
34
|
+
Code?: string | undefined;
|
|
35
|
+
Message?: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* SQS and SNS report rejected entries under `Failed` on an otherwise
|
|
39
|
+
* successful response, so a resolved chunk does not mean every entry was
|
|
40
|
+
* accepted. Returns `results` untouched when nothing failed; otherwise warns
|
|
41
|
+
* and throws a {@link BatchOperationError}.
|
|
42
|
+
*
|
|
43
|
+
* Only id, code and message are copied out — never the entry itself — so
|
|
44
|
+
* neither the error nor the warning can leak a payload.
|
|
45
|
+
*/
|
|
46
|
+
export declare function throwIfAnyFailed<TResult extends {
|
|
47
|
+
Failed?: RejectedEntry[] | undefined;
|
|
48
|
+
}>(logger: LoggerInterface, operation: string, results: TResult[]): TResult[];
|
|
49
|
+
export {};
|
|
33
50
|
//# 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;;;;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
|
|
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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