@aligent/aws-wrappers 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ new XService({ logger?, client? })
21
21
 
22
22
  ### Log redaction
23
23
 
24
- Every wrapper emits one `logger.info` line per SDK call with a per-method safe-field allowlist (omitting payloads, secret material, and PII recipient identifiers). Set `POWERTOOLS_LOG_LEVEL=DEBUG` to unlock the full SDK input in those log lines — useful for local development and incident triage. See `packages/aws-wrappers/CLAUDE.md` for the per-method allowlists currently in force.
24
+ Every wrapper emits one `logger.info` line per SDK call with a per-method safe-field allowlist (omitting payloads, secret material, and PII recipient identifiers). Set `POWERTOOLS_LOG_LEVEL` to either `DEBUG` or `TRACE` to unlock the full SDK input in those log lines — useful for local development and incident triage. Both levels unlock because Powertools orders `TRACE` as more verbose than `DEBUG`; every level from `INFO` upwards redacts. See `packages/aws-wrappers/CLAUDE.md` for the per-method allowlists currently in force.
25
25
 
26
26
  ### X-Ray outside Lambda
27
27
 
@@ -232,7 +232,7 @@ const schedules = await scheduler.listSchedules({ GroupName: 'default' });
232
232
  await scheduler.deleteSchedule({ Name: 'nightly-sync' });
233
233
  ```
234
234
 
235
- `Target.Input` is the payload handed to the target and is omitted from INFO logs (it routinely carries PII); `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
235
+ `Target.Input` is the payload handed to the target and is omitted from INFO logs (it routinely carries PII). See [Log redaction](#log-redaction) for how to unlock it.
236
236
 
237
237
  ```ts
238
238
  // Schedule groups. Groups have no update operation — only create, get,
package/cjs/index.cjs CHANGED
@@ -133,13 +133,25 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
133
133
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
134
134
  };
135
135
 
136
+ /**
137
+ * Whether the logger is verbose enough that full SDK inputs — payloads, secret
138
+ * material and PII — may be written to the log.
139
+ *
140
+ * **This is the only place in the package that reads the log level.** Never
141
+ * compare `logger.getLevelName()` yourself: Powertools orders `TRACE` as *more*
142
+ * verbose than `DEBUG` (thresholds 6 and 8), so the obvious
143
+ * `getLevelName() === 'DEBUG'` check silently redacts at the most verbose level
144
+ * available. Route every disclosure decision through this predicate instead.
145
+ */
146
+ function shouldLogFullInput(logger$1) {
147
+ return logger.LogLevelThreshold[logger$1.getLevelName()] <= logger.LogLevelThreshold.DEBUG;
148
+ }
136
149
  /**
137
150
  * Return a log-safe projection of `input` based on the logger's configured level.
138
151
  *
139
- * At `DEBUG`, the full input is returned unchanged — operators who set
140
- * `POWERTOOLS_LOG_LEVEL=DEBUG` (or call `logger.setLogLevel('DEBUG')`) have
141
- * explicitly opted into seeing everything, including payloads, secret material
142
- * and PII.
152
+ * At the verbose levels — see {@link shouldLogFullInput} — the full input is
153
+ * returned unchanged: operators who asked for that verbosity have explicitly
154
+ * opted into seeing everything, including payloads, secret material and PII.
143
155
  *
144
156
  * At any other level, only the fields listed in `safeFields` are included.
145
157
  * Missing fields are silently skipped — the result type narrows to
@@ -150,7 +162,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
150
162
  * the design rationale and conventions on building the safe-field lists.
151
163
  */
152
164
  function filterFieldsForLogLevel(logger, input, safeFields) {
153
- if (logger.getLevelName() === 'DEBUG')
165
+ if (shouldLogFullInput(logger))
154
166
  return input;
155
167
  var out = {};
156
168
  for (var _i = 0, safeFields_1 = safeFields; _i < safeFields_1.length; _i++) {
@@ -165,7 +177,6 @@ var BATCH_WRITE_MAX_ATTEMPTS = 5;
165
177
  var BATCH_WRITE_BASE_DELAY_MS = 200;
166
178
  /**
167
179
  * Fields safe to log at INFO. Omits `Key` (may carry customer IDs / tenant IDs).
168
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
169
180
  */
170
181
  var GET_ITEM_SAFE_FIELDS = [
171
182
  'TableName',
@@ -177,7 +188,6 @@ var GET_ITEM_SAFE_FIELDS = [
177
188
  /**
178
189
  * Fields safe to log at INFO. Omits `Item` (the payload itself) and
179
190
  * `ExpressionAttributeValues` (values bound to ConditionExpression, often PII).
180
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
181
191
  */
182
192
  var PUT_ITEM_SAFE_FIELDS = [
183
193
  'TableName',
@@ -190,7 +200,6 @@ var PUT_ITEM_SAFE_FIELDS = [
190
200
  ];
191
201
  /**
192
202
  * Fields safe to log at INFO. Omits `Key` and `ExpressionAttributeValues`.
193
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
194
203
  */
195
204
  var UPDATE_ITEM_SAFE_FIELDS = [
196
205
  'TableName',
@@ -205,7 +214,6 @@ var UPDATE_ITEM_SAFE_FIELDS = [
205
214
  /**
206
215
  * Fields safe to log at INFO. Omits `Key` and `ExpressionAttributeValues`
207
216
  * (the latter binds to ConditionExpression and may carry PII).
208
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
209
217
  */
210
218
  var DELETE_ITEM_SAFE_FIELDS = [
211
219
  'TableName',
@@ -219,8 +227,7 @@ var DELETE_ITEM_SAFE_FIELDS = [
219
227
  /**
220
228
  * Fields safe to log at INFO for `query` and `paginateItems`. Omits
221
229
  * `ExpressionAttributeValues` (values often carry PII) and `ExclusiveStartKey`
222
- * (pagination cursor includes Key shape). `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks
223
- * the full input.
230
+ * (pagination cursor includes Key shape).
224
231
  */
225
232
  var QUERY_SAFE_FIELDS = [
226
233
  'TableName',
@@ -238,7 +245,6 @@ var QUERY_SAFE_FIELDS = [
238
245
  /**
239
246
  * Fields safe to log at INFO for `scan` and `paginateScan`. Omits
240
247
  * `ExpressionAttributeValues` and `ExclusiveStartKey`.
241
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
242
248
  */
243
249
  var SCAN_SAFE_FIELDS = [
244
250
  'TableName',
@@ -262,6 +268,10 @@ var backoffDelay = function (attempt) {
262
268
  * Wrapper around the AWS DynamoDB Document client providing structured
263
269
  * Powertools logging and X-Ray tracing by default.
264
270
  *
271
+ * Where a method's input carries payloads, secret material or PII, the INFO
272
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
273
+ * `TRACE`) log full SDK inputs.
274
+ *
265
275
  * Items are automatically marshalled / unmarshalled via the document client —
266
276
  * callers work with plain TypeScript objects in both directions.
267
277
  */
@@ -440,12 +450,12 @@ var DynamoDBService = /** @class */ (function () {
440
450
  */
441
451
  DynamoDBService.prototype.batchGet = function (input) {
442
452
  return __awaiter(this, void 0, void 0, function () {
443
- var isDebug;
453
+ var logFullInput;
444
454
  var _a;
445
455
  return __generator(this, function (_b) {
446
- isDebug = this.logger.getLevelName() === 'DEBUG';
456
+ logFullInput = shouldLogFullInput(this.logger);
447
457
  this.logger.info('Batch getting DynamoDB items', {
448
- input: isDebug ? input : { tables: Object.keys((_a = input.RequestItems) !== null && _a !== void 0 ? _a : {}) },
458
+ input: logFullInput ? input : { tables: Object.keys((_a = input.RequestItems) !== null && _a !== void 0 ? _a : {}) },
449
459
  });
450
460
  return [2 /*return*/, this.client.send(new libDynamodb.BatchGetCommand(input))];
451
461
  });
@@ -458,14 +468,14 @@ var DynamoDBService = /** @class */ (function () {
458
468
  */
459
469
  DynamoDBService.prototype.batchWrite = function (input) {
460
470
  return __awaiter(this, void 0, void 0, function () {
461
- var isDebug, current, attempt, response, unprocessed;
471
+ var logFullInput, current, attempt, response, unprocessed;
462
472
  var _a;
463
473
  return __generator(this, function (_b) {
464
474
  switch (_b.label) {
465
475
  case 0:
466
- isDebug = this.logger.getLevelName() === 'DEBUG';
476
+ logFullInput = shouldLogFullInput(this.logger);
467
477
  this.logger.info('Batch writing DynamoDB items', {
468
- input: isDebug ? input : { tables: Object.keys((_a = input.RequestItems) !== null && _a !== void 0 ? _a : {}) },
478
+ input: logFullInput ? input : { tables: Object.keys((_a = input.RequestItems) !== null && _a !== void 0 ? _a : {}) },
469
479
  });
470
480
  current = input;
471
481
  attempt = 0;
@@ -637,13 +647,11 @@ var DEFAULT_PRESIGNED_URL_EXPIRES_IN_SECONDS = 3600;
637
647
  var DELETE_OBJECTS_BATCH_LIMIT = 1000;
638
648
  /**
639
649
  * Fields safe to log at INFO for `putObject`. Omits `Body` (object payload).
640
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
641
650
  */
642
651
  var PUT_OBJECT_SAFE_FIELDS = ['Bucket', 'Key'];
643
652
  /**
644
653
  * Fields safe to log at INFO for `putJsonObject`. Omits `Body` (the
645
654
  * unserialised JSON payload). `Metadata` is included (operational labels).
646
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
647
655
  */
648
656
  var PUT_JSON_OBJECT_SAFE_FIELDS = [
649
657
  'Bucket',
@@ -654,6 +662,10 @@ var PUT_JSON_OBJECT_SAFE_FIELDS = [
654
662
  * Wrapper around the AWS S3 client providing structured Powertools logging
655
663
  * and X-Ray tracing by default.
656
664
  *
665
+ * Where a method's input carries payloads, secret material or PII, the INFO
666
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
667
+ * `TRACE`) log full SDK inputs.
668
+ *
657
669
  * Input shapes are intentionally tight (Bucket/Key/Body only). Callers
658
670
  * needing SDK-level options not exposed here (server-side encryption,
659
671
  * tagging, version IDs) should use `S3Client` directly.
@@ -976,13 +988,13 @@ var S3Service = /** @class */ (function () {
976
988
  */
977
989
  S3Service.prototype.deleteObjects = function (bucket, keys) {
978
990
  return __awaiter(this, void 0, void 0, function () {
979
- var isDebug, results, i, batch, _a, _b;
991
+ var logFullInput, results, i, batch, _a, _b;
980
992
  return __generator(this, function (_c) {
981
993
  switch (_c.label) {
982
994
  case 0:
983
- isDebug = this.logger.getLevelName() === 'DEBUG';
995
+ logFullInput = shouldLogFullInput(this.logger);
984
996
  this.logger.info('Deleting S3 objects', {
985
- input: isDebug ? { bucket: bucket, keys: keys } : { bucket: bucket, keyCount: keys.length },
997
+ input: logFullInput ? { bucket: bucket, keys: keys } : { bucket: bucket, keyCount: keys.length },
986
998
  });
987
999
  results = [];
988
1000
  i = 0;
@@ -1084,12 +1096,13 @@ var S3Service = /** @class */ (function () {
1084
1096
  * bespoke case: keep every top-level field and shallow-strip only
1085
1097
  * `Target.Input`.
1086
1098
  *
1087
- * At `DEBUG` the input is returned unchanged — operators who set
1088
- * `POWERTOOLS_LOG_LEVEL=DEBUG` have opted into seeing payloads and PII.
1099
+ * At the verbose levels — see {@link shouldLogFullInput} — the input is
1100
+ * returned unchanged: operators who asked for that verbosity have opted into
1101
+ * seeing payloads and PII.
1089
1102
  */
1090
1103
  function redactTargetInput(logger, input) {
1091
1104
  var _a;
1092
- if (logger.getLevelName() === 'DEBUG')
1105
+ if (shouldLogFullInput(logger))
1093
1106
  return input;
1094
1107
  if (((_a = input.Target) === null || _a === void 0 ? void 0 : _a.Input) === undefined)
1095
1108
  return input;
@@ -1100,6 +1113,10 @@ function redactTargetInput(logger, input) {
1100
1113
  * Wrapper around the AWS EventBridge Scheduler client providing structured
1101
1114
  * Powertools logging and X-Ray tracing by default.
1102
1115
  *
1116
+ * Where a method's input carries payloads, secret material or PII, the INFO
1117
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
1118
+ * `TRACE`) log full SDK inputs.
1119
+ *
1103
1120
  * Covers CRUD on schedules and their groups. Named `SchedulerService` (not
1104
1121
  * `EventBridgeSchedulerService`) so it doesn't collide with a future wrapper
1105
1122
  * over the separate EventBridge bus/rules API (`@aws-sdk/client-eventbridge`).
@@ -1122,8 +1139,7 @@ var SchedulerService = /** @class */ (function () {
1122
1139
  }
1123
1140
  /**
1124
1141
  * Create a new schedule. At INFO the log line omits `Target.Input` (the
1125
- * target payload, a PII carrier); `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the
1126
- * full input.
1142
+ * target payload, a PII carrier).
1127
1143
  */
1128
1144
  SchedulerService.prototype.createSchedule = function (input) {
1129
1145
  return __awaiter(this, void 0, void 0, function () {
@@ -1155,8 +1171,7 @@ var SchedulerService = /** @class */ (function () {
1155
1171
  * your behalf: deep-merging a `Target` (with its mutually-exclusive
1156
1172
  * target-type params) has no single correct semantics.
1157
1173
  *
1158
- * At INFO the log line omits `Target.Input`; `POWERTOOLS_LOG_LEVEL=DEBUG`
1159
- * unlocks the full input.
1174
+ * At INFO the log line omits `Target.Input`.
1160
1175
  */
1161
1176
  SchedulerService.prototype.updateSchedule = function (input) {
1162
1177
  return __awaiter(this, void 0, void 0, function () {
@@ -1325,8 +1340,7 @@ var SchedulerService = /** @class */ (function () {
1325
1340
 
1326
1341
  /**
1327
1342
  * Fields safe to log at INFO level. Omits `SecretString` and `SecretBinary` —
1328
- * the secret material itself. `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full
1329
- * input.
1343
+ * the secret material itself.
1330
1344
  */
1331
1345
  var CREATE_SECRET_SAFE_FIELDS = [
1332
1346
  'Name',
@@ -1362,6 +1376,10 @@ var DELETE_SECRET_SAFE_FIELDS = [
1362
1376
  * Wrapper around the AWS Secrets Manager client providing structured
1363
1377
  * Powertools logging and X-Ray tracing by default.
1364
1378
  *
1379
+ * Where a method's input carries payloads, secret material or PII, the INFO
1380
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
1381
+ * `TRACE`) log full SDK inputs.
1382
+ *
1365
1383
  * Write operations (`createSecret`, `updateSecret`, `putSecretValue`,
1366
1384
  * `deleteSecret`) are exposed for convenience but should be used with care:
1367
1385
  * secret lifecycle is usually managed by IaC (CDK / Terraform). Prefer IaC
@@ -1421,8 +1439,7 @@ var SecretsManagerService = /** @class */ (function () {
1421
1439
  };
1422
1440
  /**
1423
1441
  * Create a new secret. At INFO level the log line includes only identity
1424
- * and non-secret metadata; `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full
1425
- * input (including `SecretString` / `SecretBinary`).
1442
+ * and non-secret metadata.
1426
1443
  *
1427
1444
  * Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
1428
1445
  * dynamically-issued credentials only.
@@ -1439,8 +1456,7 @@ var SecretsManagerService = /** @class */ (function () {
1439
1456
  };
1440
1457
  /**
1441
1458
  * Update an existing secret's metadata or value. At INFO level the log
1442
- * line omits `SecretString` / `SecretBinary`; `POWERTOOLS_LOG_LEVEL=DEBUG`
1443
- * unlocks the full input.
1459
+ * line omits `SecretString` / `SecretBinary`.
1444
1460
  *
1445
1461
  * Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
1446
1462
  * runtime metadata updates only.
@@ -1457,8 +1473,7 @@ var SecretsManagerService = /** @class */ (function () {
1457
1473
  };
1458
1474
  /**
1459
1475
  * Store a new version of a secret's value. At INFO level the log line
1460
- * omits `SecretString` / `SecretBinary`; `POWERTOOLS_LOG_LEVEL=DEBUG`
1461
- * unlocks the full input.
1476
+ * omits `SecretString` / `SecretBinary`.
1462
1477
  *
1463
1478
  * Typically used by rotation flows.
1464
1479
  */
@@ -1510,7 +1525,7 @@ var SecretsManagerService = /** @class */ (function () {
1510
1525
  /**
1511
1526
  * Fields safe to log at INFO for `startExecution`. Omits `input` — the SFN
1512
1527
  * execution payload, which routinely carries PII (customer IDs, addresses,
1513
- * order contents, etc.). `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
1528
+ * order contents, etc.).
1514
1529
  */
1515
1530
  var START_EXECUTION_SAFE_FIELDS = [
1516
1531
  'stateMachineArn',
@@ -1520,6 +1535,10 @@ var START_EXECUTION_SAFE_FIELDS = [
1520
1535
  /**
1521
1536
  * Wrapper around the AWS Step Functions client providing structured
1522
1537
  * Powertools logging and X-Ray tracing by default.
1538
+ *
1539
+ * Where a method's input carries payloads, secret material or PII, the INFO
1540
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
1541
+ * `TRACE`) log full SDK inputs.
1523
1542
  */
1524
1543
  var StepFunctionsService = /** @class */ (function () {
1525
1544
  /**
@@ -1665,7 +1684,7 @@ var SNS_SUBJECT_MAX_CHARS = 100;
1665
1684
  * Fields safe to log at INFO level for `publish`. Omits `Message`, `Subject`,
1666
1685
  * `MessageAttributes`, and `PhoneNumber` — payloads, user-visible content
1667
1686
  * (subjects often carry order numbers / customer names), and PII recipient
1668
- * identifiers. `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
1687
+ * identifiers.
1669
1688
  */
1670
1689
  var PUBLISH_SAFE_FIELDS = [
1671
1690
  'TopicArn',
@@ -1677,6 +1696,10 @@ var PUBLISH_SAFE_FIELDS = [
1677
1696
  /**
1678
1697
  * Wrapper around the AWS SNS client providing structured Powertools logging
1679
1698
  * and X-Ray tracing by default.
1699
+ *
1700
+ * Where a method's input carries payloads, secret material or PII, the INFO
1701
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
1702
+ * `TRACE`) log full SDK inputs.
1680
1703
  */
1681
1704
  var SNSService = /** @class */ (function () {
1682
1705
  /**
@@ -1700,8 +1723,7 @@ var SNSService = /** @class */ (function () {
1700
1723
  * Publish a single message to an SNS topic.
1701
1724
  *
1702
1725
  * At INFO level the log line includes only routing / dedup metadata; see
1703
- * `PUBLISH_SAFE_FIELDS` for the list. Setting `POWERTOOLS_LOG_LEVEL=DEBUG`
1704
- * unlocks the full input.
1726
+ * `PUBLISH_SAFE_FIELDS` for the list.
1705
1727
  *
1706
1728
  * @param input - PublishCommandInput including TopicArn and Message.
1707
1729
  */
@@ -1745,15 +1767,15 @@ var SNSService = /** @class */ (function () {
1745
1767
  */
1746
1768
  SNSService.prototype.publishBatch = function (input) {
1747
1769
  return __awaiter(this, void 0, void 0, function () {
1748
- var entries, isDebug, results, i, chunk, _a, _b;
1770
+ var entries, logFullInput, results, i, chunk, _a, _b;
1749
1771
  var _c;
1750
1772
  return __generator(this, function (_d) {
1751
1773
  switch (_d.label) {
1752
1774
  case 0:
1753
1775
  entries = (_c = input.PublishBatchRequestEntries) !== null && _c !== void 0 ? _c : [];
1754
- isDebug = this.logger.getLevelName() === 'DEBUG';
1776
+ logFullInput = shouldLogFullInput(this.logger);
1755
1777
  this.logger.info('Publishing SNS message batch', {
1756
- input: isDebug ? input : { TopicArn: input.TopicArn, entryCount: entries.length },
1778
+ input: logFullInput ? input : { TopicArn: input.TopicArn, entryCount: entries.length },
1757
1779
  });
1758
1780
  results = [];
1759
1781
  i = 0;
@@ -1782,7 +1804,6 @@ var SQS_MESSAGE_BODY_MAX_BYTES = 256 * 1024;
1782
1804
  /**
1783
1805
  * Fields safe to log at INFO level for `sendMessage`. Omits `MessageBody` and
1784
1806
  * `MessageAttributes` — both carry payload content.
1785
- * `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
1786
1807
  */
1787
1808
  var SEND_MESSAGE_SAFE_FIELDS = [
1788
1809
  'QueueUrl',
@@ -1793,6 +1814,10 @@ var SEND_MESSAGE_SAFE_FIELDS = [
1793
1814
  /**
1794
1815
  * Wrapper around the AWS SQS client providing structured Powertools logging
1795
1816
  * and X-Ray tracing by default.
1817
+ *
1818
+ * Where a method's input carries payloads, secret material or PII, the INFO
1819
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
1820
+ * `TRACE`) log full SDK inputs.
1796
1821
  */
1797
1822
  var SQSService = /** @class */ (function () {
1798
1823
  /**
@@ -1815,8 +1840,7 @@ var SQSService = /** @class */ (function () {
1815
1840
  * Send a single message to an SQS queue.
1816
1841
  *
1817
1842
  * At INFO level the log line includes only queue routing / FIFO metadata;
1818
- * see `SEND_MESSAGE_SAFE_FIELDS`. `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the
1819
- * full input.
1843
+ * see `SEND_MESSAGE_SAFE_FIELDS`.
1820
1844
  */
1821
1845
  SQSService.prototype.sendMessage = function (input, opts) {
1822
1846
  return __awaiter(this, void 0, void 0, function () {
@@ -1885,15 +1909,15 @@ var SQSService = /** @class */ (function () {
1885
1909
  */
1886
1910
  SQSService.prototype.sendMessageBatch = function (input) {
1887
1911
  return __awaiter(this, void 0, void 0, function () {
1888
- var entries, isDebug, results, i, chunk, _a, _b;
1912
+ var entries, logFullInput, results, i, chunk, _a, _b;
1889
1913
  var _c;
1890
1914
  return __generator(this, function (_d) {
1891
1915
  switch (_d.label) {
1892
1916
  case 0:
1893
1917
  entries = (_c = input.Entries) !== null && _c !== void 0 ? _c : [];
1894
- isDebug = this.logger.getLevelName() === 'DEBUG';
1918
+ logFullInput = shouldLogFullInput(this.logger);
1895
1919
  this.logger.info('Sending SQS message batch', {
1896
- input: isDebug ? input : { QueueUrl: input.QueueUrl, entryCount: entries.length },
1920
+ input: logFullInput ? input : { QueueUrl: input.QueueUrl, entryCount: entries.length },
1897
1921
  });
1898
1922
  results = [];
1899
1923
  i = 0;
@@ -1921,15 +1945,15 @@ var SQSService = /** @class */ (function () {
1921
1945
  */
1922
1946
  SQSService.prototype.deleteMessageBatch = function (input) {
1923
1947
  return __awaiter(this, void 0, void 0, function () {
1924
- var entries, isDebug, results, i, chunk, _a, _b;
1948
+ var entries, logFullInput, results, i, chunk, _a, _b;
1925
1949
  var _c;
1926
1950
  return __generator(this, function (_d) {
1927
1951
  switch (_d.label) {
1928
1952
  case 0:
1929
1953
  entries = (_c = input.Entries) !== null && _c !== void 0 ? _c : [];
1930
- isDebug = this.logger.getLevelName() === 'DEBUG';
1954
+ logFullInput = shouldLogFullInput(this.logger);
1931
1955
  this.logger.info('Deleting SQS message batch', {
1932
- input: isDebug ? input : { QueueUrl: input.QueueUrl, entryCount: entries.length },
1956
+ input: logFullInput ? input : { QueueUrl: input.QueueUrl, entryCount: entries.length },
1933
1957
  });
1934
1958
  results = [];
1935
1959
  i = 0;
@@ -1955,8 +1979,7 @@ var SQSService = /** @class */ (function () {
1955
1979
 
1956
1980
  /**
1957
1981
  * Fields safe to log at INFO level for `putParameter`. Omits `Value` (the
1958
- * parameter content itself). `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full
1959
- * input.
1982
+ * parameter content itself).
1960
1983
  */
1961
1984
  var PUT_PARAMETER_SAFE_FIELDS = [
1962
1985
  'Name',
@@ -1976,6 +1999,10 @@ var PUT_PARAMETER_SAFE_FIELDS = [
1976
1999
  * `WithDecryption` — callers needing plaintext should use `SSMClient`
1977
2000
  * directly.
1978
2001
  *
2002
+ * Where a method's input carries payloads, secret material or PII, the INFO
2003
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
2004
+ * `TRACE`) log full SDK inputs.
2005
+ *
1979
2006
  * Write operations (`putParameter`, `deleteParameter`) are exposed for
1980
2007
  * convenience but should be used with care: parameter lifecycle is usually
1981
2008
  * managed by IaC (CDK / Terraform). Prefer IaC for anything that exists at
package/cjs/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./esm/index.mjs",
@@ -11,6 +11,10 @@ type WithTypedKey<TInput, K extends Record<string, unknown>> = Omit<TInput, 'Key
11
11
  * Wrapper around the AWS DynamoDB Document client providing structured
12
12
  * Powertools logging and X-Ray tracing by default.
13
13
  *
14
+ * Where a method's input carries payloads, secret material or PII, the INFO
15
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
16
+ * `TRACE`) log full SDK inputs.
17
+ *
14
18
  * Items are automatically marshalled / unmarshalled via the document client —
15
19
  * callers work with plain TypeScript objects in both directions.
16
20
  */
@@ -13,6 +13,10 @@ type PutJsonObjectInput<T> = {
13
13
  * Wrapper around the AWS S3 client providing structured Powertools logging
14
14
  * and X-Ray tracing by default.
15
15
  *
16
+ * Where a method's input carries payloads, secret material or PII, the INFO
17
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
18
+ * `TRACE`) log full SDK inputs.
19
+ *
16
20
  * Input shapes are intentionally tight (Bucket/Key/Body only). Callers
17
21
  * needing SDK-level options not exposed here (server-side encryption,
18
22
  * tagging, version IDs) should use `S3Client` directly.
@@ -4,6 +4,10 @@ import { CreateScheduleCommandInput, CreateScheduleCommandOutput, CreateSchedule
4
4
  * Wrapper around the AWS EventBridge Scheduler client providing structured
5
5
  * Powertools logging and X-Ray tracing by default.
6
6
  *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
10
+ *
7
11
  * Covers CRUD on schedules and their groups. Named `SchedulerService` (not
8
12
  * `EventBridgeSchedulerService`) so it doesn't collide with a future wrapper
9
13
  * over the separate EventBridge bus/rules API (`@aws-sdk/client-eventbridge`).
@@ -27,8 +31,7 @@ export declare class SchedulerService {
27
31
  });
28
32
  /**
29
33
  * Create a new schedule. At INFO the log line omits `Target.Input` (the
30
- * target payload, a PII carrier); `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the
31
- * full input.
34
+ * target payload, a PII carrier).
32
35
  */
33
36
  createSchedule(input: CreateScheduleCommandInput): Promise<CreateScheduleCommandOutput>;
34
37
  /**
@@ -46,8 +49,7 @@ export declare class SchedulerService {
46
49
  * your behalf: deep-merging a `Target` (with its mutually-exclusive
47
50
  * target-type params) has no single correct semantics.
48
51
  *
49
- * At INFO the log line omits `Target.Input`; `POWERTOOLS_LOG_LEVEL=DEBUG`
50
- * unlocks the full input.
52
+ * At INFO the log line omits `Target.Input`.
51
53
  */
52
54
  updateSchedule(input: UpdateScheduleCommandInput): Promise<UpdateScheduleCommandOutput>;
53
55
  /**
@@ -4,6 +4,10 @@ import { CreateSecretCommandInput, CreateSecretCommandOutput, DeleteSecretComman
4
4
  * Wrapper around the AWS Secrets Manager client providing structured
5
5
  * Powertools logging and X-Ray tracing by default.
6
6
  *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
10
+ *
7
11
  * Write operations (`createSecret`, `updateSecret`, `putSecretValue`,
8
12
  * `deleteSecret`) are exposed for convenience but should be used with care:
9
13
  * secret lifecycle is usually managed by IaC (CDK / Terraform). Prefer IaC
@@ -43,8 +47,7 @@ export declare class SecretsManagerService {
43
47
  getJsonSecret<T>(secretId: string): Promise<T>;
44
48
  /**
45
49
  * Create a new secret. At INFO level the log line includes only identity
46
- * and non-secret metadata; `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full
47
- * input (including `SecretString` / `SecretBinary`).
50
+ * and non-secret metadata.
48
51
  *
49
52
  * Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
50
53
  * dynamically-issued credentials only.
@@ -52,8 +55,7 @@ export declare class SecretsManagerService {
52
55
  createSecret(input: CreateSecretCommandInput): Promise<CreateSecretCommandOutput>;
53
56
  /**
54
57
  * Update an existing secret's metadata or value. At INFO level the log
55
- * line omits `SecretString` / `SecretBinary`; `POWERTOOLS_LOG_LEVEL=DEBUG`
56
- * unlocks the full input.
58
+ * line omits `SecretString` / `SecretBinary`.
57
59
  *
58
60
  * Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
59
61
  * runtime metadata updates only.
@@ -61,8 +63,7 @@ export declare class SecretsManagerService {
61
63
  updateSecret(input: UpdateSecretCommandInput): Promise<UpdateSecretCommandOutput>;
62
64
  /**
63
65
  * Store a new version of a secret's value. At INFO level the log line
64
- * omits `SecretString` / `SecretBinary`; `POWERTOOLS_LOG_LEVEL=DEBUG`
65
- * unlocks the full input.
66
+ * omits `SecretString` / `SecretBinary`.
66
67
  *
67
68
  * Typically used by rotation flows.
68
69
  */
@@ -3,6 +3,10 @@ import { DescribeExecutionCommandInput, DescribeExecutionCommandOutput, Executio
3
3
  /**
4
4
  * Wrapper around the AWS Step Functions client providing structured
5
5
  * Powertools logging and X-Ray tracing by default.
6
+ *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
6
10
  */
7
11
  export declare class StepFunctionsService {
8
12
  private readonly client;
@@ -3,6 +3,10 @@ import { PublishBatchCommandInput, PublishBatchCommandOutput, PublishCommandInpu
3
3
  /**
4
4
  * Wrapper around the AWS SNS client providing structured Powertools logging
5
5
  * and X-Ray tracing by default.
6
+ *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
6
10
  */
7
11
  export declare class SNSService {
8
12
  private readonly client;
@@ -28,8 +32,7 @@ export declare class SNSService {
28
32
  * Publish a single message to an SNS topic.
29
33
  *
30
34
  * At INFO level the log line includes only routing / dedup metadata; see
31
- * `PUBLISH_SAFE_FIELDS` for the list. Setting `POWERTOOLS_LOG_LEVEL=DEBUG`
32
- * unlocks the full input.
35
+ * `PUBLISH_SAFE_FIELDS` for the list.
33
36
  *
34
37
  * @param input - PublishCommandInput including TopicArn and Message.
35
38
  */
@@ -3,6 +3,10 @@ import { DeleteMessageBatchCommandInput, DeleteMessageBatchCommandOutput, Delete
3
3
  /**
4
4
  * Wrapper around the AWS SQS client providing structured Powertools logging
5
5
  * and X-Ray tracing by default.
6
+ *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
6
10
  */
7
11
  export declare class SQSService {
8
12
  private readonly client;
@@ -27,8 +31,7 @@ export declare class SQSService {
27
31
  * Send a single message to an SQS queue.
28
32
  *
29
33
  * At INFO level the log line includes only queue routing / FIFO metadata;
30
- * see `SEND_MESSAGE_SAFE_FIELDS`. `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the
31
- * full input.
34
+ * see `SEND_MESSAGE_SAFE_FIELDS`.
32
35
  */
33
36
  sendMessage(input: SendMessageCommandInput, opts?: {
34
37
  truncate?: boolean;
@@ -6,6 +6,10 @@ import { Parameter, PutParameterCommandInput, PutParameterCommandOutput, SSMClie
6
6
  * `WithDecryption` — callers needing plaintext should use `SSMClient`
7
7
  * directly.
8
8
  *
9
+ * Where a method's input carries payloads, secret material or PII, the INFO
10
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
11
+ * `TRACE`) log full SDK inputs.
12
+ *
9
13
  * Write operations (`putParameter`, `deleteParameter`) are exposed for
10
14
  * convenience but should be used with care: parameter lifecycle is usually
11
15
  * managed by IaC (CDK / Terraform). Prefer IaC for anything that exists at
@@ -1,11 +1,21 @@
1
1
  import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
2
+ /**
3
+ * Whether the logger is verbose enough that full SDK inputs — payloads, secret
4
+ * material and PII — may be written to the log.
5
+ *
6
+ * **This is the only place in the package that reads the log level.** Never
7
+ * compare `logger.getLevelName()` yourself: Powertools orders `TRACE` as *more*
8
+ * verbose than `DEBUG` (thresholds 6 and 8), so the obvious
9
+ * `getLevelName() === 'DEBUG'` check silently redacts at the most verbose level
10
+ * available. Route every disclosure decision through this predicate instead.
11
+ */
12
+ export declare function shouldLogFullInput(logger: LoggerInterface): boolean;
2
13
  /**
3
14
  * Return a log-safe projection of `input` based on the logger's configured level.
4
15
  *
5
- * At `DEBUG`, the full input is returned unchanged — operators who set
6
- * `POWERTOOLS_LOG_LEVEL=DEBUG` (or call `logger.setLogLevel('DEBUG')`) have
7
- * explicitly opted into seeing everything, including payloads, secret material
8
- * and PII.
16
+ * At the verbose levels — see {@link shouldLogFullInput} — the full input is
17
+ * returned unchanged: operators who asked for that verbosity have explicitly
18
+ * opted into seeing everything, including payloads, secret material and PII.
9
19
  *
10
20
  * At any other level, only the fields listed in `safeFields` are included.
11
21
  * Missing fields are silently skipped — the result type narrows to