@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 +2 -2
- package/cjs/index.cjs +83 -56
- package/cjs/package.json +1 -1
- package/cjs/src/dynamodb/dynamodb.d.ts +4 -0
- package/cjs/src/s3/s3.d.ts +4 -0
- package/cjs/src/scheduler/scheduler.d.ts +6 -4
- package/cjs/src/secrets-manager/secrets-manager.d.ts +7 -6
- package/cjs/src/sfn/sfn.d.ts +4 -0
- package/cjs/src/sns/sns.d.ts +5 -2
- package/cjs/src/sqs/sqs.d.ts +5 -2
- package/cjs/src/ssm/ssm.d.ts +4 -0
- package/cjs/src/util/redact.d.ts +14 -4
- package/docs/classes/DynamoDBService.md +16 -12
- package/docs/classes/S3Service.md +19 -15
- package/docs/classes/SNSService.md +9 -6
- package/docs/classes/SQSService.md +12 -9
- package/docs/classes/SSMService.md +11 -7
- package/docs/classes/SchedulerService.md +17 -15
- package/docs/classes/SecretsManagerService.md +15 -14
- package/docs/classes/StepFunctionsService.md +10 -6
- package/esm/index.mjs +84 -57
- package/esm/package.json +1 -1
- package/esm/src/dynamodb/dynamodb.d.ts +4 -0
- package/esm/src/s3/s3.d.ts +4 -0
- package/esm/src/scheduler/scheduler.d.ts +6 -4
- package/esm/src/secrets-manager/secrets-manager.d.ts +7 -6
- package/esm/src/sfn/sfn.d.ts +4 -0
- package/esm/src/sns/sns.d.ts +5 -2
- package/esm/src/sqs/sqs.d.ts +5 -2
- package/esm/src/ssm/ssm.d.ts +4 -0
- package/esm/src/util/redact.d.ts +14 -4
- package/package.json +1 -1
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: SecretsManagerService
|
|
8
8
|
|
|
9
|
-
Defined in: [secrets-manager/secrets-manager.ts:
|
|
9
|
+
Defined in: [secrets-manager/secrets-manager.ts:75](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L75)
|
|
10
10
|
|
|
11
11
|
Wrapper around the AWS Secrets Manager 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
|
Write operations (`createSecret`, `updateSecret`, `putSecretValue`,
|
|
15
19
|
`deleteSecret`) are exposed for convenience but should be used with care:
|
|
16
20
|
secret lifecycle is usually managed by IaC (CDK / Terraform). Prefer IaC
|
|
@@ -26,7 +30,7 @@ mutable values.
|
|
|
26
30
|
|
|
27
31
|
> **new SecretsManagerService**(`opts?`): `SecretsManagerService`
|
|
28
32
|
|
|
29
|
-
Defined in: [secrets-manager/secrets-manager.ts:
|
|
33
|
+
Defined in: [secrets-manager/secrets-manager.ts:86](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L86)
|
|
30
34
|
|
|
31
35
|
#### Parameters
|
|
32
36
|
|
|
@@ -59,11 +63,10 @@ which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
|
59
63
|
|
|
60
64
|
> **createSecret**(`input`): `Promise`\<`CreateSecretCommandOutput`\>
|
|
61
65
|
|
|
62
|
-
Defined in: [secrets-manager/secrets-manager.ts:
|
|
66
|
+
Defined in: [secrets-manager/secrets-manager.ts:123](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L123)
|
|
63
67
|
|
|
64
68
|
Create a new secret. At INFO level the log line includes only identity
|
|
65
|
-
and non-secret metadata
|
|
66
|
-
input (including `SecretString` / `SecretBinary`).
|
|
69
|
+
and non-secret metadata.
|
|
67
70
|
|
|
68
71
|
Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
|
|
69
72
|
dynamically-issued credentials only.
|
|
@@ -86,7 +89,7 @@ dynamically-issued credentials only.
|
|
|
86
89
|
|
|
87
90
|
> **deleteSecret**(`input`): `Promise`\<`DeleteSecretCommandOutput`\>
|
|
88
91
|
|
|
89
|
-
Defined in: [secrets-manager/secrets-manager.ts:163](https://github.com/aligent/microservice-development-utilities/blob/
|
|
92
|
+
Defined in: [secrets-manager/secrets-manager.ts:163](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L163)
|
|
90
93
|
|
|
91
94
|
Delete a secret. Pass `ForceDeleteWithoutRecovery: true` to bypass the
|
|
92
95
|
default 7-30 day recovery window (irreversible).
|
|
@@ -111,7 +114,7 @@ Prefer IaC (CDK / Terraform) for secret lifecycle.
|
|
|
111
114
|
|
|
112
115
|
> **getJsonSecret**\<`T`\>(`secretId`): `Promise`\<`T`\>
|
|
113
116
|
|
|
114
|
-
Defined in: [secrets-manager/secrets-manager.ts:
|
|
117
|
+
Defined in: [secrets-manager/secrets-manager.ts:110](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L110)
|
|
115
118
|
|
|
116
119
|
Fetch a secret and parse it as JSON.
|
|
117
120
|
|
|
@@ -149,7 +152,7 @@ If the secret has no `SecretString` or the value is not valid JSON.
|
|
|
149
152
|
|
|
150
153
|
> **getSecret**(`secretId`): `Promise`\<`string`\>
|
|
151
154
|
|
|
152
|
-
Defined in: [secrets-manager/secrets-manager.ts:
|
|
155
|
+
Defined in: [secrets-manager/secrets-manager.ts:98](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L98)
|
|
153
156
|
|
|
154
157
|
Fetch a secret's string value from Secrets Manager.
|
|
155
158
|
|
|
@@ -180,11 +183,10 @@ stores binary data).
|
|
|
180
183
|
|
|
181
184
|
> **putSecretValue**(`input`): `Promise`\<`PutSecretValueCommandOutput`\>
|
|
182
185
|
|
|
183
|
-
Defined in: [secrets-manager/secrets-manager.ts:150](https://github.com/aligent/microservice-development-utilities/blob/
|
|
186
|
+
Defined in: [secrets-manager/secrets-manager.ts:150](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L150)
|
|
184
187
|
|
|
185
188
|
Store a new version of a secret's value. At INFO level the log line
|
|
186
|
-
omits `SecretString` / `SecretBinary
|
|
187
|
-
unlocks the full input.
|
|
189
|
+
omits `SecretString` / `SecretBinary`.
|
|
188
190
|
|
|
189
191
|
Typically used by rotation flows.
|
|
190
192
|
|
|
@@ -206,11 +208,10 @@ Typically used by rotation flows.
|
|
|
206
208
|
|
|
207
209
|
> **updateSecret**(`input`): `Promise`\<`UpdateSecretCommandOutput`\>
|
|
208
210
|
|
|
209
|
-
Defined in: [secrets-manager/secrets-manager.ts:
|
|
211
|
+
Defined in: [secrets-manager/secrets-manager.ts:137](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/secrets-manager/secrets-manager.ts#L137)
|
|
210
212
|
|
|
211
213
|
Update an existing secret's metadata or value. At INFO level the log
|
|
212
|
-
line omits `SecretString` / `SecretBinary
|
|
213
|
-
unlocks the full input.
|
|
214
|
+
line omits `SecretString` / `SecretBinary`.
|
|
214
215
|
|
|
215
216
|
Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
|
|
216
217
|
runtime metadata updates only.
|
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: StepFunctionsService
|
|
8
8
|
|
|
9
|
-
Defined in: [sfn/sfn.ts:
|
|
9
|
+
Defined in: [sfn/sfn.ts:40](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/sfn/sfn.ts#L40)
|
|
10
10
|
|
|
11
11
|
Wrapper around the AWS Step Functions 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
|
## Constructors
|
|
15
19
|
|
|
16
20
|
<a id="constructor"></a>
|
|
@@ -19,7 +23,7 @@ Powertools logging and X-Ray tracing by default.
|
|
|
19
23
|
|
|
20
24
|
> **new StepFunctionsService**(`opts?`): `StepFunctionsService`
|
|
21
25
|
|
|
22
|
-
Defined in: [sfn/sfn.ts:
|
|
26
|
+
Defined in: [sfn/sfn.ts:50](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/sfn/sfn.ts#L50)
|
|
23
27
|
|
|
24
28
|
#### Parameters
|
|
25
29
|
|
|
@@ -51,7 +55,7 @@ which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
|
51
55
|
|
|
52
56
|
> **describeExecution**(`input`): `Promise`\<`DescribeExecutionCommandOutput`\>
|
|
53
57
|
|
|
54
|
-
Defined in: [sfn/sfn.ts:
|
|
58
|
+
Defined in: [sfn/sfn.ts:83](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/sfn/sfn.ts#L83)
|
|
55
59
|
|
|
56
60
|
Describe an existing Step Functions execution.
|
|
57
61
|
|
|
@@ -73,7 +77,7 @@ Describe an existing Step Functions execution.
|
|
|
73
77
|
|
|
74
78
|
> **listExecutions**(`input`): `Promise`\<`ExecutionListItem`[]\>
|
|
75
79
|
|
|
76
|
-
Defined in: [sfn/sfn.ts:
|
|
80
|
+
Defined in: [sfn/sfn.ts:60](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/sfn/sfn.ts#L60)
|
|
77
81
|
|
|
78
82
|
List all executions for a state machine, auto-paginating across all
|
|
79
83
|
pages. Typically bounded by `statusFilter` and state-machine retention,
|
|
@@ -97,7 +101,7 @@ so the flat-array shape is safe in practice.
|
|
|
97
101
|
|
|
98
102
|
> **startExecution**(`input`): `Promise`\<`StartExecutionCommandOutput`\>
|
|
99
103
|
|
|
100
|
-
Defined in: [sfn/sfn.ts:
|
|
104
|
+
Defined in: [sfn/sfn.ts:73](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/sfn/sfn.ts#L73)
|
|
101
105
|
|
|
102
106
|
Start a new Step Functions execution.
|
|
103
107
|
|
|
@@ -119,7 +123,7 @@ Start a new Step Functions execution.
|
|
|
119
123
|
|
|
120
124
|
> **stopExecution**(`input`): `Promise`\<`StopExecutionCommandOutput`\>
|
|
121
125
|
|
|
122
|
-
Defined in: [sfn/sfn.ts:
|
|
126
|
+
Defined in: [sfn/sfn.ts:93](https://github.com/aligent/microservice-development-utilities/blob/a2bb34fea27b6af8b52791a3302aefd2b6af331f/packages/aws-wrappers/src/sfn/sfn.ts#L93)
|
|
123
127
|
|
|
124
128
|
Stop an in-progress Step Functions execution.
|
|
125
129
|
|
package/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from '@aws-lambda-powertools/logger';
|
|
1
|
+
import { LogLevelThreshold, Logger } from '@aws-lambda-powertools/logger';
|
|
2
2
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
3
3
|
import { DynamoDBDocumentClient, paginateQuery, paginateScan, GetCommand, PutCommand, UpdateCommand, DeleteCommand, QueryCommand, ScanCommand, BatchGetCommand, BatchWriteCommand } from '@aws-sdk/lib-dynamodb';
|
|
4
4
|
import xray from 'aws-xray-sdk-core';
|
|
@@ -131,13 +131,25 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
131
131
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Whether the logger is verbose enough that full SDK inputs — payloads, secret
|
|
136
|
+
* material and PII — may be written to the log.
|
|
137
|
+
*
|
|
138
|
+
* **This is the only place in the package that reads the log level.** Never
|
|
139
|
+
* compare `logger.getLevelName()` yourself: Powertools orders `TRACE` as *more*
|
|
140
|
+
* verbose than `DEBUG` (thresholds 6 and 8), so the obvious
|
|
141
|
+
* `getLevelName() === 'DEBUG'` check silently redacts at the most verbose level
|
|
142
|
+
* available. Route every disclosure decision through this predicate instead.
|
|
143
|
+
*/
|
|
144
|
+
function shouldLogFullInput(logger) {
|
|
145
|
+
return LogLevelThreshold[logger.getLevelName()] <= LogLevelThreshold.DEBUG;
|
|
146
|
+
}
|
|
134
147
|
/**
|
|
135
148
|
* Return a log-safe projection of `input` based on the logger's configured level.
|
|
136
149
|
*
|
|
137
|
-
* At
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* and PII.
|
|
150
|
+
* At the verbose levels — see {@link shouldLogFullInput} — the full input is
|
|
151
|
+
* returned unchanged: operators who asked for that verbosity have explicitly
|
|
152
|
+
* opted into seeing everything, including payloads, secret material and PII.
|
|
141
153
|
*
|
|
142
154
|
* At any other level, only the fields listed in `safeFields` are included.
|
|
143
155
|
* Missing fields are silently skipped — the result type narrows to
|
|
@@ -148,7 +160,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
148
160
|
* the design rationale and conventions on building the safe-field lists.
|
|
149
161
|
*/
|
|
150
162
|
function filterFieldsForLogLevel(logger, input, safeFields) {
|
|
151
|
-
if (logger
|
|
163
|
+
if (shouldLogFullInput(logger))
|
|
152
164
|
return input;
|
|
153
165
|
var out = {};
|
|
154
166
|
for (var _i = 0, safeFields_1 = safeFields; _i < safeFields_1.length; _i++) {
|
|
@@ -163,7 +175,6 @@ var BATCH_WRITE_MAX_ATTEMPTS = 5;
|
|
|
163
175
|
var BATCH_WRITE_BASE_DELAY_MS = 200;
|
|
164
176
|
/**
|
|
165
177
|
* Fields safe to log at INFO. Omits `Key` (may carry customer IDs / tenant IDs).
|
|
166
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
167
178
|
*/
|
|
168
179
|
var GET_ITEM_SAFE_FIELDS = [
|
|
169
180
|
'TableName',
|
|
@@ -175,7 +186,6 @@ var GET_ITEM_SAFE_FIELDS = [
|
|
|
175
186
|
/**
|
|
176
187
|
* Fields safe to log at INFO. Omits `Item` (the payload itself) and
|
|
177
188
|
* `ExpressionAttributeValues` (values bound to ConditionExpression, often PII).
|
|
178
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
179
189
|
*/
|
|
180
190
|
var PUT_ITEM_SAFE_FIELDS = [
|
|
181
191
|
'TableName',
|
|
@@ -188,7 +198,6 @@ var PUT_ITEM_SAFE_FIELDS = [
|
|
|
188
198
|
];
|
|
189
199
|
/**
|
|
190
200
|
* Fields safe to log at INFO. Omits `Key` and `ExpressionAttributeValues`.
|
|
191
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
192
201
|
*/
|
|
193
202
|
var UPDATE_ITEM_SAFE_FIELDS = [
|
|
194
203
|
'TableName',
|
|
@@ -203,7 +212,6 @@ var UPDATE_ITEM_SAFE_FIELDS = [
|
|
|
203
212
|
/**
|
|
204
213
|
* Fields safe to log at INFO. Omits `Key` and `ExpressionAttributeValues`
|
|
205
214
|
* (the latter binds to ConditionExpression and may carry PII).
|
|
206
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
207
215
|
*/
|
|
208
216
|
var DELETE_ITEM_SAFE_FIELDS = [
|
|
209
217
|
'TableName',
|
|
@@ -217,8 +225,7 @@ var DELETE_ITEM_SAFE_FIELDS = [
|
|
|
217
225
|
/**
|
|
218
226
|
* Fields safe to log at INFO for `query` and `paginateItems`. Omits
|
|
219
227
|
* `ExpressionAttributeValues` (values often carry PII) and `ExclusiveStartKey`
|
|
220
|
-
* (pagination cursor includes Key shape).
|
|
221
|
-
* the full input.
|
|
228
|
+
* (pagination cursor includes Key shape).
|
|
222
229
|
*/
|
|
223
230
|
var QUERY_SAFE_FIELDS = [
|
|
224
231
|
'TableName',
|
|
@@ -236,7 +243,6 @@ var QUERY_SAFE_FIELDS = [
|
|
|
236
243
|
/**
|
|
237
244
|
* Fields safe to log at INFO for `scan` and `paginateScan`. Omits
|
|
238
245
|
* `ExpressionAttributeValues` and `ExclusiveStartKey`.
|
|
239
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
240
246
|
*/
|
|
241
247
|
var SCAN_SAFE_FIELDS = [
|
|
242
248
|
'TableName',
|
|
@@ -260,6 +266,10 @@ var backoffDelay = function (attempt) {
|
|
|
260
266
|
* Wrapper around the AWS DynamoDB Document client providing structured
|
|
261
267
|
* Powertools logging and X-Ray tracing by default.
|
|
262
268
|
*
|
|
269
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
270
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
271
|
+
* `TRACE`) log full SDK inputs.
|
|
272
|
+
*
|
|
263
273
|
* Items are automatically marshalled / unmarshalled via the document client —
|
|
264
274
|
* callers work with plain TypeScript objects in both directions.
|
|
265
275
|
*/
|
|
@@ -438,12 +448,12 @@ var DynamoDBService = /** @class */ (function () {
|
|
|
438
448
|
*/
|
|
439
449
|
DynamoDBService.prototype.batchGet = function (input) {
|
|
440
450
|
return __awaiter(this, void 0, void 0, function () {
|
|
441
|
-
var
|
|
451
|
+
var logFullInput;
|
|
442
452
|
var _a;
|
|
443
453
|
return __generator(this, function (_b) {
|
|
444
|
-
|
|
454
|
+
logFullInput = shouldLogFullInput(this.logger);
|
|
445
455
|
this.logger.info('Batch getting DynamoDB items', {
|
|
446
|
-
input:
|
|
456
|
+
input: logFullInput ? input : { tables: Object.keys((_a = input.RequestItems) !== null && _a !== void 0 ? _a : {}) },
|
|
447
457
|
});
|
|
448
458
|
return [2 /*return*/, this.client.send(new BatchGetCommand(input))];
|
|
449
459
|
});
|
|
@@ -456,14 +466,14 @@ var DynamoDBService = /** @class */ (function () {
|
|
|
456
466
|
*/
|
|
457
467
|
DynamoDBService.prototype.batchWrite = function (input) {
|
|
458
468
|
return __awaiter(this, void 0, void 0, function () {
|
|
459
|
-
var
|
|
469
|
+
var logFullInput, current, attempt, response, unprocessed;
|
|
460
470
|
var _a;
|
|
461
471
|
return __generator(this, function (_b) {
|
|
462
472
|
switch (_b.label) {
|
|
463
473
|
case 0:
|
|
464
|
-
|
|
474
|
+
logFullInput = shouldLogFullInput(this.logger);
|
|
465
475
|
this.logger.info('Batch writing DynamoDB items', {
|
|
466
|
-
input:
|
|
476
|
+
input: logFullInput ? input : { tables: Object.keys((_a = input.RequestItems) !== null && _a !== void 0 ? _a : {}) },
|
|
467
477
|
});
|
|
468
478
|
current = input;
|
|
469
479
|
attempt = 0;
|
|
@@ -635,13 +645,11 @@ var DEFAULT_PRESIGNED_URL_EXPIRES_IN_SECONDS = 3600;
|
|
|
635
645
|
var DELETE_OBJECTS_BATCH_LIMIT = 1000;
|
|
636
646
|
/**
|
|
637
647
|
* Fields safe to log at INFO for `putObject`. Omits `Body` (object payload).
|
|
638
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
639
648
|
*/
|
|
640
649
|
var PUT_OBJECT_SAFE_FIELDS = ['Bucket', 'Key'];
|
|
641
650
|
/**
|
|
642
651
|
* Fields safe to log at INFO for `putJsonObject`. Omits `Body` (the
|
|
643
652
|
* unserialised JSON payload). `Metadata` is included (operational labels).
|
|
644
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
645
653
|
*/
|
|
646
654
|
var PUT_JSON_OBJECT_SAFE_FIELDS = [
|
|
647
655
|
'Bucket',
|
|
@@ -652,6 +660,10 @@ var PUT_JSON_OBJECT_SAFE_FIELDS = [
|
|
|
652
660
|
* Wrapper around the AWS S3 client providing structured Powertools logging
|
|
653
661
|
* and X-Ray tracing by default.
|
|
654
662
|
*
|
|
663
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
664
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
665
|
+
* `TRACE`) log full SDK inputs.
|
|
666
|
+
*
|
|
655
667
|
* Input shapes are intentionally tight (Bucket/Key/Body only). Callers
|
|
656
668
|
* needing SDK-level options not exposed here (server-side encryption,
|
|
657
669
|
* tagging, version IDs) should use `S3Client` directly.
|
|
@@ -974,13 +986,13 @@ var S3Service = /** @class */ (function () {
|
|
|
974
986
|
*/
|
|
975
987
|
S3Service.prototype.deleteObjects = function (bucket, keys) {
|
|
976
988
|
return __awaiter(this, void 0, void 0, function () {
|
|
977
|
-
var
|
|
989
|
+
var logFullInput, results, i, batch, _a, _b;
|
|
978
990
|
return __generator(this, function (_c) {
|
|
979
991
|
switch (_c.label) {
|
|
980
992
|
case 0:
|
|
981
|
-
|
|
993
|
+
logFullInput = shouldLogFullInput(this.logger);
|
|
982
994
|
this.logger.info('Deleting S3 objects', {
|
|
983
|
-
input:
|
|
995
|
+
input: logFullInput ? { bucket: bucket, keys: keys } : { bucket: bucket, keyCount: keys.length },
|
|
984
996
|
});
|
|
985
997
|
results = [];
|
|
986
998
|
i = 0;
|
|
@@ -1082,12 +1094,13 @@ var S3Service = /** @class */ (function () {
|
|
|
1082
1094
|
* bespoke case: keep every top-level field and shallow-strip only
|
|
1083
1095
|
* `Target.Input`.
|
|
1084
1096
|
*
|
|
1085
|
-
* At
|
|
1086
|
-
*
|
|
1097
|
+
* At the verbose levels — see {@link shouldLogFullInput} — the input is
|
|
1098
|
+
* returned unchanged: operators who asked for that verbosity have opted into
|
|
1099
|
+
* seeing payloads and PII.
|
|
1087
1100
|
*/
|
|
1088
1101
|
function redactTargetInput(logger, input) {
|
|
1089
1102
|
var _a;
|
|
1090
|
-
if (logger
|
|
1103
|
+
if (shouldLogFullInput(logger))
|
|
1091
1104
|
return input;
|
|
1092
1105
|
if (((_a = input.Target) === null || _a === void 0 ? void 0 : _a.Input) === undefined)
|
|
1093
1106
|
return input;
|
|
@@ -1098,6 +1111,10 @@ function redactTargetInput(logger, input) {
|
|
|
1098
1111
|
* Wrapper around the AWS EventBridge Scheduler client providing structured
|
|
1099
1112
|
* Powertools logging and X-Ray tracing by default.
|
|
1100
1113
|
*
|
|
1114
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
1115
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
1116
|
+
* `TRACE`) log full SDK inputs.
|
|
1117
|
+
*
|
|
1101
1118
|
* Covers CRUD on schedules and their groups. Named `SchedulerService` (not
|
|
1102
1119
|
* `EventBridgeSchedulerService`) so it doesn't collide with a future wrapper
|
|
1103
1120
|
* over the separate EventBridge bus/rules API (`@aws-sdk/client-eventbridge`).
|
|
@@ -1120,8 +1137,7 @@ var SchedulerService = /** @class */ (function () {
|
|
|
1120
1137
|
}
|
|
1121
1138
|
/**
|
|
1122
1139
|
* Create a new schedule. At INFO the log line omits `Target.Input` (the
|
|
1123
|
-
* target payload, a PII carrier)
|
|
1124
|
-
* full input.
|
|
1140
|
+
* target payload, a PII carrier).
|
|
1125
1141
|
*/
|
|
1126
1142
|
SchedulerService.prototype.createSchedule = function (input) {
|
|
1127
1143
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1153,8 +1169,7 @@ var SchedulerService = /** @class */ (function () {
|
|
|
1153
1169
|
* your behalf: deep-merging a `Target` (with its mutually-exclusive
|
|
1154
1170
|
* target-type params) has no single correct semantics.
|
|
1155
1171
|
*
|
|
1156
|
-
* At INFO the log line omits `Target.Input
|
|
1157
|
-
* unlocks the full input.
|
|
1172
|
+
* At INFO the log line omits `Target.Input`.
|
|
1158
1173
|
*/
|
|
1159
1174
|
SchedulerService.prototype.updateSchedule = function (input) {
|
|
1160
1175
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1323,8 +1338,7 @@ var SchedulerService = /** @class */ (function () {
|
|
|
1323
1338
|
|
|
1324
1339
|
/**
|
|
1325
1340
|
* Fields safe to log at INFO level. Omits `SecretString` and `SecretBinary` —
|
|
1326
|
-
* the secret material itself.
|
|
1327
|
-
* input.
|
|
1341
|
+
* the secret material itself.
|
|
1328
1342
|
*/
|
|
1329
1343
|
var CREATE_SECRET_SAFE_FIELDS = [
|
|
1330
1344
|
'Name',
|
|
@@ -1360,6 +1374,10 @@ var DELETE_SECRET_SAFE_FIELDS = [
|
|
|
1360
1374
|
* Wrapper around the AWS Secrets Manager client providing structured
|
|
1361
1375
|
* Powertools logging and X-Ray tracing by default.
|
|
1362
1376
|
*
|
|
1377
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
1378
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
1379
|
+
* `TRACE`) log full SDK inputs.
|
|
1380
|
+
*
|
|
1363
1381
|
* Write operations (`createSecret`, `updateSecret`, `putSecretValue`,
|
|
1364
1382
|
* `deleteSecret`) are exposed for convenience but should be used with care:
|
|
1365
1383
|
* secret lifecycle is usually managed by IaC (CDK / Terraform). Prefer IaC
|
|
@@ -1419,8 +1437,7 @@ var SecretsManagerService = /** @class */ (function () {
|
|
|
1419
1437
|
};
|
|
1420
1438
|
/**
|
|
1421
1439
|
* Create a new secret. At INFO level the log line includes only identity
|
|
1422
|
-
* and non-secret metadata
|
|
1423
|
-
* input (including `SecretString` / `SecretBinary`).
|
|
1440
|
+
* and non-secret metadata.
|
|
1424
1441
|
*
|
|
1425
1442
|
* Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
|
|
1426
1443
|
* dynamically-issued credentials only.
|
|
@@ -1437,8 +1454,7 @@ var SecretsManagerService = /** @class */ (function () {
|
|
|
1437
1454
|
};
|
|
1438
1455
|
/**
|
|
1439
1456
|
* Update an existing secret's metadata or value. At INFO level the log
|
|
1440
|
-
* line omits `SecretString` / `SecretBinary
|
|
1441
|
-
* unlocks the full input.
|
|
1457
|
+
* line omits `SecretString` / `SecretBinary`.
|
|
1442
1458
|
*
|
|
1443
1459
|
* Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
|
|
1444
1460
|
* runtime metadata updates only.
|
|
@@ -1455,8 +1471,7 @@ var SecretsManagerService = /** @class */ (function () {
|
|
|
1455
1471
|
};
|
|
1456
1472
|
/**
|
|
1457
1473
|
* Store a new version of a secret's value. At INFO level the log line
|
|
1458
|
-
* omits `SecretString` / `SecretBinary
|
|
1459
|
-
* unlocks the full input.
|
|
1474
|
+
* omits `SecretString` / `SecretBinary`.
|
|
1460
1475
|
*
|
|
1461
1476
|
* Typically used by rotation flows.
|
|
1462
1477
|
*/
|
|
@@ -1508,7 +1523,7 @@ var SecretsManagerService = /** @class */ (function () {
|
|
|
1508
1523
|
/**
|
|
1509
1524
|
* Fields safe to log at INFO for `startExecution`. Omits `input` — the SFN
|
|
1510
1525
|
* execution payload, which routinely carries PII (customer IDs, addresses,
|
|
1511
|
-
* order contents, etc.).
|
|
1526
|
+
* order contents, etc.).
|
|
1512
1527
|
*/
|
|
1513
1528
|
var START_EXECUTION_SAFE_FIELDS = [
|
|
1514
1529
|
'stateMachineArn',
|
|
@@ -1518,6 +1533,10 @@ var START_EXECUTION_SAFE_FIELDS = [
|
|
|
1518
1533
|
/**
|
|
1519
1534
|
* Wrapper around the AWS Step Functions client providing structured
|
|
1520
1535
|
* Powertools logging and X-Ray tracing by default.
|
|
1536
|
+
*
|
|
1537
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
1538
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
1539
|
+
* `TRACE`) log full SDK inputs.
|
|
1521
1540
|
*/
|
|
1522
1541
|
var StepFunctionsService = /** @class */ (function () {
|
|
1523
1542
|
/**
|
|
@@ -1663,7 +1682,7 @@ var SNS_SUBJECT_MAX_CHARS = 100;
|
|
|
1663
1682
|
* Fields safe to log at INFO level for `publish`. Omits `Message`, `Subject`,
|
|
1664
1683
|
* `MessageAttributes`, and `PhoneNumber` — payloads, user-visible content
|
|
1665
1684
|
* (subjects often carry order numbers / customer names), and PII recipient
|
|
1666
|
-
* identifiers.
|
|
1685
|
+
* identifiers.
|
|
1667
1686
|
*/
|
|
1668
1687
|
var PUBLISH_SAFE_FIELDS = [
|
|
1669
1688
|
'TopicArn',
|
|
@@ -1675,6 +1694,10 @@ var PUBLISH_SAFE_FIELDS = [
|
|
|
1675
1694
|
/**
|
|
1676
1695
|
* Wrapper around the AWS SNS client providing structured Powertools logging
|
|
1677
1696
|
* and X-Ray tracing by default.
|
|
1697
|
+
*
|
|
1698
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
1699
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
1700
|
+
* `TRACE`) log full SDK inputs.
|
|
1678
1701
|
*/
|
|
1679
1702
|
var SNSService = /** @class */ (function () {
|
|
1680
1703
|
/**
|
|
@@ -1698,8 +1721,7 @@ var SNSService = /** @class */ (function () {
|
|
|
1698
1721
|
* Publish a single message to an SNS topic.
|
|
1699
1722
|
*
|
|
1700
1723
|
* At INFO level the log line includes only routing / dedup metadata; see
|
|
1701
|
-
* `PUBLISH_SAFE_FIELDS` for the list.
|
|
1702
|
-
* unlocks the full input.
|
|
1724
|
+
* `PUBLISH_SAFE_FIELDS` for the list.
|
|
1703
1725
|
*
|
|
1704
1726
|
* @param input - PublishCommandInput including TopicArn and Message.
|
|
1705
1727
|
*/
|
|
@@ -1743,15 +1765,15 @@ var SNSService = /** @class */ (function () {
|
|
|
1743
1765
|
*/
|
|
1744
1766
|
SNSService.prototype.publishBatch = function (input) {
|
|
1745
1767
|
return __awaiter(this, void 0, void 0, function () {
|
|
1746
|
-
var entries,
|
|
1768
|
+
var entries, logFullInput, results, i, chunk, _a, _b;
|
|
1747
1769
|
var _c;
|
|
1748
1770
|
return __generator(this, function (_d) {
|
|
1749
1771
|
switch (_d.label) {
|
|
1750
1772
|
case 0:
|
|
1751
1773
|
entries = (_c = input.PublishBatchRequestEntries) !== null && _c !== void 0 ? _c : [];
|
|
1752
|
-
|
|
1774
|
+
logFullInput = shouldLogFullInput(this.logger);
|
|
1753
1775
|
this.logger.info('Publishing SNS message batch', {
|
|
1754
|
-
input:
|
|
1776
|
+
input: logFullInput ? input : { TopicArn: input.TopicArn, entryCount: entries.length },
|
|
1755
1777
|
});
|
|
1756
1778
|
results = [];
|
|
1757
1779
|
i = 0;
|
|
@@ -1780,7 +1802,6 @@ var SQS_MESSAGE_BODY_MAX_BYTES = 256 * 1024;
|
|
|
1780
1802
|
/**
|
|
1781
1803
|
* Fields safe to log at INFO level for `sendMessage`. Omits `MessageBody` and
|
|
1782
1804
|
* `MessageAttributes` — both carry payload content.
|
|
1783
|
-
* `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full input.
|
|
1784
1805
|
*/
|
|
1785
1806
|
var SEND_MESSAGE_SAFE_FIELDS = [
|
|
1786
1807
|
'QueueUrl',
|
|
@@ -1791,6 +1812,10 @@ var SEND_MESSAGE_SAFE_FIELDS = [
|
|
|
1791
1812
|
/**
|
|
1792
1813
|
* Wrapper around the AWS SQS client providing structured Powertools logging
|
|
1793
1814
|
* and X-Ray tracing by default.
|
|
1815
|
+
*
|
|
1816
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
1817
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
1818
|
+
* `TRACE`) log full SDK inputs.
|
|
1794
1819
|
*/
|
|
1795
1820
|
var SQSService = /** @class */ (function () {
|
|
1796
1821
|
/**
|
|
@@ -1813,8 +1838,7 @@ var SQSService = /** @class */ (function () {
|
|
|
1813
1838
|
* Send a single message to an SQS queue.
|
|
1814
1839
|
*
|
|
1815
1840
|
* At INFO level the log line includes only queue routing / FIFO metadata;
|
|
1816
|
-
* see `SEND_MESSAGE_SAFE_FIELDS`.
|
|
1817
|
-
* full input.
|
|
1841
|
+
* see `SEND_MESSAGE_SAFE_FIELDS`.
|
|
1818
1842
|
*/
|
|
1819
1843
|
SQSService.prototype.sendMessage = function (input, opts) {
|
|
1820
1844
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1883,15 +1907,15 @@ var SQSService = /** @class */ (function () {
|
|
|
1883
1907
|
*/
|
|
1884
1908
|
SQSService.prototype.sendMessageBatch = function (input) {
|
|
1885
1909
|
return __awaiter(this, void 0, void 0, function () {
|
|
1886
|
-
var entries,
|
|
1910
|
+
var entries, logFullInput, results, i, chunk, _a, _b;
|
|
1887
1911
|
var _c;
|
|
1888
1912
|
return __generator(this, function (_d) {
|
|
1889
1913
|
switch (_d.label) {
|
|
1890
1914
|
case 0:
|
|
1891
1915
|
entries = (_c = input.Entries) !== null && _c !== void 0 ? _c : [];
|
|
1892
|
-
|
|
1916
|
+
logFullInput = shouldLogFullInput(this.logger);
|
|
1893
1917
|
this.logger.info('Sending SQS message batch', {
|
|
1894
|
-
input:
|
|
1918
|
+
input: logFullInput ? input : { QueueUrl: input.QueueUrl, entryCount: entries.length },
|
|
1895
1919
|
});
|
|
1896
1920
|
results = [];
|
|
1897
1921
|
i = 0;
|
|
@@ -1919,15 +1943,15 @@ var SQSService = /** @class */ (function () {
|
|
|
1919
1943
|
*/
|
|
1920
1944
|
SQSService.prototype.deleteMessageBatch = function (input) {
|
|
1921
1945
|
return __awaiter(this, void 0, void 0, function () {
|
|
1922
|
-
var entries,
|
|
1946
|
+
var entries, logFullInput, results, i, chunk, _a, _b;
|
|
1923
1947
|
var _c;
|
|
1924
1948
|
return __generator(this, function (_d) {
|
|
1925
1949
|
switch (_d.label) {
|
|
1926
1950
|
case 0:
|
|
1927
1951
|
entries = (_c = input.Entries) !== null && _c !== void 0 ? _c : [];
|
|
1928
|
-
|
|
1952
|
+
logFullInput = shouldLogFullInput(this.logger);
|
|
1929
1953
|
this.logger.info('Deleting SQS message batch', {
|
|
1930
|
-
input:
|
|
1954
|
+
input: logFullInput ? input : { QueueUrl: input.QueueUrl, entryCount: entries.length },
|
|
1931
1955
|
});
|
|
1932
1956
|
results = [];
|
|
1933
1957
|
i = 0;
|
|
@@ -1953,8 +1977,7 @@ var SQSService = /** @class */ (function () {
|
|
|
1953
1977
|
|
|
1954
1978
|
/**
|
|
1955
1979
|
* Fields safe to log at INFO level for `putParameter`. Omits `Value` (the
|
|
1956
|
-
* parameter content itself).
|
|
1957
|
-
* input.
|
|
1980
|
+
* parameter content itself).
|
|
1958
1981
|
*/
|
|
1959
1982
|
var PUT_PARAMETER_SAFE_FIELDS = [
|
|
1960
1983
|
'Name',
|
|
@@ -1974,6 +1997,10 @@ var PUT_PARAMETER_SAFE_FIELDS = [
|
|
|
1974
1997
|
* `WithDecryption` — callers needing plaintext should use `SSMClient`
|
|
1975
1998
|
* directly.
|
|
1976
1999
|
*
|
|
2000
|
+
* Where a method's input carries payloads, secret material or PII, the INFO
|
|
2001
|
+
* log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
|
|
2002
|
+
* `TRACE`) log full SDK inputs.
|
|
2003
|
+
*
|
|
1977
2004
|
* Write operations (`putParameter`, `deleteParameter`) are exposed for
|
|
1978
2005
|
* convenience but should be used with care: parameter lifecycle is usually
|
|
1979
2006
|
* managed by IaC (CDK / Terraform). Prefer IaC for anything that exists at
|
package/esm/package.json
CHANGED
|
@@ -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
|
*/
|
package/esm/src/s3/s3.d.ts
CHANGED
|
@@ -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)
|
|
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
|
|
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
|
/**
|