@aligent/aws-wrappers 0.5.8 → 0.5.10
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 +130 -3
- package/cjs/index.cjs +424 -11
- package/cjs/package.json +4 -1
- package/cjs/src/eventbridge/eventbridge.d.ts +58 -0
- package/cjs/src/eventbridge/eventbridge.d.ts.map +1 -0
- package/cjs/src/index.d.ts +4 -0
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/lambda/lambda.d.ts +54 -0
- package/cjs/src/lambda/lambda.d.ts.map +1 -0
- package/cjs/src/scheduler/scheduler.d.ts +3 -2
- package/cjs/src/scheduler/scheduler.d.ts.map +1 -1
- package/cjs/src/ses/ses.d.ts +64 -0
- package/cjs/src/ses/ses.d.ts.map +1 -0
- package/cjs/src/ssm/ssm.d.ts +18 -3
- package/cjs/src/ssm/ssm.d.ts.map +1 -1
- package/cjs/src/util/batch-operation-error.d.ts +13 -7
- package/cjs/src/util/batch-operation-error.d.ts.map +1 -1
- package/cjs/src/util/chunk.d.ts +8 -0
- package/cjs/src/util/chunk.d.ts.map +1 -1
- package/cjs/src/util/lambda-function-error.d.ts +36 -0
- package/cjs/src/util/lambda-function-error.d.ts.map +1 -0
- package/docs/index/classes/APIGatewayService.md +6 -6
- package/docs/index/classes/APIGatewayV2Service.md +5 -5
- package/docs/index/classes/BatchOperationError.md +7 -6
- package/docs/index/classes/DynamoDBService.md +12 -12
- package/docs/index/classes/EventBridgeService.md +99 -0
- package/docs/index/classes/LambdaFunctionError.md +283 -0
- package/docs/index/classes/LambdaService.md +95 -0
- package/docs/index/classes/S3Service.md +15 -15
- package/docs/index/classes/SESService.md +123 -0
- package/docs/index/classes/SNSService.md +4 -4
- package/docs/index/classes/SQSService.md +7 -7
- package/docs/index/classes/SSMService.md +33 -10
- package/docs/index/classes/SchedulerService.md +14 -13
- package/docs/index/classes/SecretsManagerService.md +8 -8
- package/docs/index/classes/StepFunctionsService.md +6 -6
- package/docs/index/interfaces/BatchFailedEntry.md +6 -5
- package/docs/index/interfaces/EmptyBucketPageResult.md +2 -2
- package/docs/index/modules.md +4 -0
- package/docs/testing/testing/functions/createMockService.md +1 -1
- package/esm/index.mjs +421 -12
- package/esm/package.json +4 -1
- package/esm/src/eventbridge/eventbridge.d.ts +58 -0
- package/esm/src/eventbridge/eventbridge.d.ts.map +1 -0
- package/esm/src/index.d.ts +4 -0
- package/esm/src/index.d.ts.map +1 -1
- package/esm/src/lambda/lambda.d.ts +54 -0
- package/esm/src/lambda/lambda.d.ts.map +1 -0
- package/esm/src/scheduler/scheduler.d.ts +3 -2
- package/esm/src/scheduler/scheduler.d.ts.map +1 -1
- package/esm/src/ses/ses.d.ts +64 -0
- package/esm/src/ses/ses.d.ts.map +1 -0
- package/esm/src/ssm/ssm.d.ts +18 -3
- package/esm/src/ssm/ssm.d.ts.map +1 -1
- package/esm/src/util/batch-operation-error.d.ts +13 -7
- package/esm/src/util/batch-operation-error.d.ts.map +1 -1
- package/esm/src/util/chunk.d.ts +8 -0
- package/esm/src/util/chunk.d.ts.map +1 -1
- package/esm/src/util/lambda-function-error.d.ts +36 -0
- package/esm/src/util/lambda-function-error.d.ts.map +1 -0
- package/package.json +4 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
|
|
2
|
+
import { InvokeCommandInput, InvokeCommandOutput, LambdaClient } from '@aws-sdk/client-lambda';
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper around the AWS Lambda client providing structured Powertools logging
|
|
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.
|
|
10
|
+
*
|
|
11
|
+
* Covers `invoke` only.
|
|
12
|
+
*/
|
|
13
|
+
export declare class LambdaService {
|
|
14
|
+
private readonly client;
|
|
15
|
+
private readonly logger;
|
|
16
|
+
/**
|
|
17
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
18
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
19
|
+
* @param opts.client - Optional pre-configured `LambdaClient`. When
|
|
20
|
+
* supplied, the wrapper does not apply X-Ray instrumentation.
|
|
21
|
+
*/
|
|
22
|
+
constructor(opts?: {
|
|
23
|
+
logger?: LoggerInterface;
|
|
24
|
+
client?: LambdaClient;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Invoke a Lambda function. The input is the SDK input unchanged and the
|
|
28
|
+
* output is the SDK output unchanged: `Payload` stays a `Uint8Array` you
|
|
29
|
+
* decode yourself. Choose synchronous, asynchronous or dry-run invocation
|
|
30
|
+
* with `InvocationType`; omitting it means synchronous (`RequestResponse`).
|
|
31
|
+
*
|
|
32
|
+
* Lambda answers HTTP 200 even when the invoked function threw, flagging it
|
|
33
|
+
* with `FunctionError` on the response. If that marker is present this
|
|
34
|
+
* method warns and throws a {@link LambdaFunctionError} carrying the
|
|
35
|
+
* function name, the marker, and the error type and message parsed from the
|
|
36
|
+
* payload when it has the usual JSON shape. The raw output and the stack
|
|
37
|
+
* trace are deliberately left off the error.
|
|
38
|
+
*
|
|
39
|
+
* The marker only appears on synchronous responses, so the check is
|
|
40
|
+
* unconditional: asynchronous (`Event`) and `DryRun` responses return
|
|
41
|
+
* without throwing. Failures of asynchronous invocations are therefore not
|
|
42
|
+
* observable here; they belong to dead-letter queues and destinations on
|
|
43
|
+
* the invoked function. No status code check is added; service-level
|
|
44
|
+
* errors such as throttling are thrown by the SDK and propagate unwrapped.
|
|
45
|
+
*
|
|
46
|
+
* At INFO level the log line includes only the function name, invocation
|
|
47
|
+
* type, qualifier, log type and tenant id. `Payload` and `ClientContext` are
|
|
48
|
+
* omitted, and responses are never logged.
|
|
49
|
+
*
|
|
50
|
+
* @param input - InvokeCommandInput including FunctionName.
|
|
51
|
+
*/
|
|
52
|
+
invoke(input: InvokeCommandInput): Promise<InvokeCommandOutput>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=lambda.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lambda.d.ts","sourceRoot":"","sources":["../../../../src/lambda/lambda.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEH,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACf,MAAM,wBAAwB,CAAC;AAkBhC;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,YAAY,CAAA;KAAE;IAKtE;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAiBxE"}
|
|
@@ -9,8 +9,9 @@ import { CreateScheduleCommandInput, CreateScheduleCommandOutput, CreateSchedule
|
|
|
9
9
|
* `TRACE`) log full SDK inputs.
|
|
10
10
|
*
|
|
11
11
|
* Covers CRUD on schedules and their groups. Named `SchedulerService` (not
|
|
12
|
-
* `EventBridgeSchedulerService`) so it doesn't collide with
|
|
13
|
-
* over the separate EventBridge bus/rules API
|
|
12
|
+
* `EventBridgeSchedulerService`) so it doesn't collide with `EventBridgeService`,
|
|
13
|
+
* the wrapper over the separate EventBridge bus/rules API
|
|
14
|
+
* (`@aws-sdk/client-eventbridge`).
|
|
14
15
|
*
|
|
15
16
|
* `FlexibleTimeWindow` is required by `CreateSchedule` and is passed through
|
|
16
17
|
* untouched — the wrapper bakes in no default, so the caller must state their
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/scheduler/scheduler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEH,0BAA0B,EAC1B,2BAA2B,EAE3B,+BAA+B,EAC/B,gCAAgC,EAEhC,0BAA0B,EAC1B,2BAA2B,EAE3B,+BAA+B,EAC/B,gCAAgC,EAEhC,uBAAuB,EACvB,wBAAwB,EAExB,4BAA4B,EAC5B,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EAGzB,oBAAoB,EACpB,eAAe,EACf,eAAe,EAGf,0BAA0B,EAC1B,2BAA2B,EAC9B,MAAM,2BAA2B,CAAC;AAwBnC
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/scheduler/scheduler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAEH,0BAA0B,EAC1B,2BAA2B,EAE3B,+BAA+B,EAC/B,gCAAgC,EAEhC,0BAA0B,EAC1B,2BAA2B,EAE3B,+BAA+B,EAC/B,gCAAgC,EAEhC,uBAAuB,EACvB,wBAAwB,EAExB,4BAA4B,EAC5B,6BAA6B,EAC7B,8BAA8B,EAC9B,yBAAyB,EAGzB,oBAAoB,EACpB,eAAe,EACf,eAAe,EAGf,0BAA0B,EAC1B,2BAA2B,EAC9B,MAAM,2BAA2B,CAAC;AAwBnC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,eAAe,CAAA;KAAE;IAKzE;;;OAGG;IACG,cAAc,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAO7F;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAKpF;;;;;;;;;;;;OAYG;IACG,cAAc,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAO7F;;OAEG;IACG,cAAc,CAAC,KAAK,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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
|
|
2
|
+
import { SendBulkEmailCommandInput, SendBulkEmailCommandOutput, SendEmailCommandInput, SendEmailCommandOutput, SESv2Client } from '@aws-sdk/client-sesv2';
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper around the AWS SES v2 client providing structured Powertools logging
|
|
5
|
+
* and X-Ray tracing by default.
|
|
6
|
+
*
|
|
7
|
+
* Wraps SES v2 (`@aws-sdk/client-sesv2`), not the legacy v1 API. No defaults
|
|
8
|
+
* are baked in: every send option, including `FromEmailAddress` and
|
|
9
|
+
* `ConfigurationSetName`, comes from the caller.
|
|
10
|
+
*
|
|
11
|
+
* Where a method's input carries payloads or PII, the INFO log line omits
|
|
12
|
+
* them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or `TRACE`) log full
|
|
13
|
+
* SDK inputs.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SESService {
|
|
16
|
+
private readonly client;
|
|
17
|
+
private readonly logger;
|
|
18
|
+
/**
|
|
19
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
20
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
21
|
+
* @param opts.client - Optional pre-configured `SESv2Client`. When supplied,
|
|
22
|
+
* the wrapper does not apply X-Ray instrumentation.
|
|
23
|
+
*/
|
|
24
|
+
constructor(opts?: {
|
|
25
|
+
logger?: LoggerInterface;
|
|
26
|
+
client?: SESv2Client;
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Send a single email (Simple, Raw or Template content).
|
|
30
|
+
*
|
|
31
|
+
* At INFO level the log line includes only routing metadata and a
|
|
32
|
+
* recipient count; see `summariseSendEmail`.
|
|
33
|
+
*
|
|
34
|
+
* Pass-through: SDK exceptions (`MessageRejected`, `SendingPausedException`,
|
|
35
|
+
* …) propagate unwrapped.
|
|
36
|
+
*
|
|
37
|
+
* @returns The SDK output, including `MessageId`.
|
|
38
|
+
*/
|
|
39
|
+
sendEmail(input: SendEmailCommandInput): Promise<SendEmailCommandOutput>;
|
|
40
|
+
/**
|
|
41
|
+
* Send a templated email to many destinations. SES caps `SendBulkEmail`
|
|
42
|
+
* at 50 entries per request, so this method auto-chunks `BulkEmailEntries`
|
|
43
|
+
* and sends one request per chunk, in order. Every chunk shares the other
|
|
44
|
+
* input fields.
|
|
45
|
+
*
|
|
46
|
+
* At INFO level the log line includes only routing metadata, the template
|
|
47
|
+
* name and an entry count; see `summariseSendBulkEmail`.
|
|
48
|
+
*
|
|
49
|
+
* SES answers HTTP 200 even when entries fail, so every chunk is sent
|
|
50
|
+
* before the outcome is judged. If any entry's `Status` isn't `SUCCESS`
|
|
51
|
+
* (or SES returned no result for it), a {@link BatchOperationError} is thrown whose
|
|
52
|
+
* `failed[].id` is the entry's original index in `BulkEmailEntries` as a
|
|
53
|
+
* string, and whose `results` are the per-chunk outputs — so a caller can
|
|
54
|
+
* retry only the failed indexes. Request-level SDK exceptions are not
|
|
55
|
+
* wrapped.
|
|
56
|
+
*
|
|
57
|
+
* Sending is not idempotent: retrying the whole batch after a throw
|
|
58
|
+
* re-sends the entries that succeeded.
|
|
59
|
+
*
|
|
60
|
+
* @returns One SDK output per request sent.
|
|
61
|
+
*/
|
|
62
|
+
sendBulkEmail(input: SendBulkEmailCommandInput): Promise<SendBulkEmailCommandOutput[]>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=ses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ses.d.ts","sourceRoot":"","sources":["../../../../src/ses/ses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAGH,yBAAyB,EACzB,0BAA0B,EAE1B,qBAAqB,EACrB,sBAAsB,EACtB,WAAW,EACd,MAAM,uBAAuB,CAAC;AA4F/B;;;;;;;;;;;GAWG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE;IAKrE;;;;;;;;;;OAUG;IACG,SAAS,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAO9E;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,aAAa,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC;CAoB/F"}
|
package/esm/src/ssm/ssm.d.ts
CHANGED
|
@@ -34,6 +34,9 @@ export declare class SSMService {
|
|
|
34
34
|
* @param name - The parameter name (or ARN).
|
|
35
35
|
* @returns The parameter value, or `undefined` if the parameter has no
|
|
36
36
|
* value set.
|
|
37
|
+
* @throws When the parameter does not exist (the SDK's
|
|
38
|
+
* `ParameterNotFound`). {@link SSMService.getParameters} instead returns
|
|
39
|
+
* `undefined` for a missing parameter unless `required` is set.
|
|
37
40
|
*/
|
|
38
41
|
getParameter(name: string): Promise<string | undefined>;
|
|
39
42
|
/**
|
|
@@ -54,13 +57,25 @@ export declare class SSMService {
|
|
|
54
57
|
* the underlying parameter names and sends one request per chunk,
|
|
55
58
|
* merging the results before building the alias-keyed return value.
|
|
56
59
|
*
|
|
60
|
+
* Unlike {@link SSMService.getParameter}, which throws when the parameter
|
|
61
|
+
* does not exist, a missing parameter here maps to `undefined` — so a
|
|
62
|
+
* typo'd path surfaces later as an undefined value. Pass
|
|
63
|
+
* `{ required: true }` to fail fast instead: every chunk is still sent,
|
|
64
|
+
* then a {@link BatchOperationError} is thrown whose `failed` entries
|
|
65
|
+
* carry each missing path as `id`, the code `ParameterNotFound`, and the
|
|
66
|
+
* alias in `message`. Request-level SDK exceptions are not wrapped.
|
|
67
|
+
*
|
|
57
68
|
* @param aliases - Record mapping each desired local alias to its SSM
|
|
58
69
|
* parameter name (or ARN).
|
|
70
|
+
* @param opts.required - Throw when any requested parameter does not
|
|
71
|
+
* exist. Defaults to `false`.
|
|
59
72
|
* @returns A record keyed by the same aliases, mapping each to the
|
|
60
|
-
* parameter's value, or `undefined` when the parameter is missing
|
|
61
|
-
* no value.
|
|
73
|
+
* parameter's value, or `undefined` when the parameter is missing (unless
|
|
74
|
+
* `required` is set) or has no value.
|
|
62
75
|
*/
|
|
63
|
-
getParameters<K extends string>(aliases: Record<K, string
|
|
76
|
+
getParameters<K extends string>(aliases: Record<K, string>, opts?: {
|
|
77
|
+
required?: boolean;
|
|
78
|
+
}): Promise<Record<K, string | undefined>>;
|
|
64
79
|
/**
|
|
65
80
|
* Create or update an SSM parameter. The log line omits `Value` to avoid
|
|
66
81
|
* leaking secret material.
|
package/esm/src/ssm/ssm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssm.d.ts","sourceRoot":"","sources":["../../../../src/ssm/ssm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAKH,SAAS,EAET,wBAAwB,EACxB,yBAAyB,EACzB,SAAS,EACZ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ssm.d.ts","sourceRoot":"","sources":["../../../../src/ssm/ssm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAKH,SAAS,EAET,wBAAwB,EACxB,yBAAyB,EACzB,SAAS,EACZ,MAAM,qBAAqB,CAAC;AA2C7B;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAE;IAKnE;;;;;;;;OAQG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQ7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,aAAa,CAAC,CAAC,SAAS,MAAM,EAChC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,EAC1B,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAC9B,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAiCzC;;;;;;OAMG;IACG,YAAY,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAOvF;;;;;OAKG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlD;;;;;;;;;;OAUG;IACG,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CAWhG"}
|
|
@@ -2,7 +2,8 @@ import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
|
|
|
2
2
|
/**
|
|
3
3
|
* One entry a batch operation rejected. Deliberately limited to identifier,
|
|
4
4
|
* code and message so the error never carries message bodies, attributes or
|
|
5
|
-
* any other payload the caller sent. For S3 the identifier is the object key
|
|
5
|
+
* any other payload the caller sent. For S3 the identifier is the object key;
|
|
6
|
+
* for SSM it is the parameter path.
|
|
6
7
|
*/
|
|
7
8
|
export interface BatchFailedEntry {
|
|
8
9
|
id: string | undefined;
|
|
@@ -15,7 +16,8 @@ export interface BatchFailedEntry {
|
|
|
15
16
|
*
|
|
16
17
|
* `results` holds the raw SDK output of every chunk, so the outputs of the
|
|
17
18
|
* entries that succeeded (message ids, sequence numbers) stay readable. The
|
|
18
|
-
*
|
|
19
|
+
* exceptions are `S3.emptyBucket`, whose `results` are per-page deleted keys,
|
|
20
|
+
* and `SSM.getParameters`, whose `results` are empty.
|
|
19
21
|
* `failed` is the normalised list of rejected entries across all chunks.
|
|
20
22
|
*
|
|
21
23
|
* Match on `name` rather than `instanceof` if both the CJS and ESM builds of
|
|
@@ -38,8 +40,7 @@ interface RejectedEntry {
|
|
|
38
40
|
/**
|
|
39
41
|
* SQS and SNS report rejected entries under `Failed` on an otherwise
|
|
40
42
|
* successful response, so a resolved chunk does not mean every entry was
|
|
41
|
-
* accepted.
|
|
42
|
-
* and throws a {@link BatchOperationError}.
|
|
43
|
+
* accepted. Extracts those entries and delegates to {@link throwIfAny}.
|
|
43
44
|
*
|
|
44
45
|
* Only id, code and message are copied out — never the entry itself — so
|
|
45
46
|
* neither the error nor the warning can leak a payload.
|
|
@@ -64,9 +65,14 @@ export declare function throwIfAnyDeleteErrors<TResult extends {
|
|
|
64
65
|
Errors?: DeleteError[] | undefined;
|
|
65
66
|
}>(logger: LoggerInterface, operation: string, results: TResult[]): TResult[];
|
|
66
67
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* Warn-and-throw step for services whose responses don't use the SQS/SNS
|
|
69
|
+
* `Failed` shape and so extract their own rejected entries (`EventBridge.putEvents`),
|
|
70
|
+
* or whose `results` aren't a plain list of SDK outputs (`S3.emptyBucket`).
|
|
71
|
+
* Returns `results` untouched when `failed` is empty.
|
|
72
|
+
*
|
|
73
|
+
* Callers must build `failed` by copying id, code and message explicitly —
|
|
74
|
+
* never by spreading the SDK entry — because it goes straight into the error
|
|
75
|
+
* and the warning.
|
|
70
76
|
*/
|
|
71
77
|
export declare function throwIfAny<TResult>(logger: LoggerInterface, operation: string, results: TResult[], failed: BatchFailedEntry[]): TResult[];
|
|
72
78
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-operation-error.d.ts","sourceRoot":"","sources":["../../../../src/util/batch-operation-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E
|
|
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;;;;;GAKG;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;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAmB,CAAC,OAAO,GAAG,OAAO,CAAE,SAAQ,KAAK;IAIzD,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE;IAC3B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,EAAE;IAJvC,SAAkB,IAAI,yBAAyB;gBAGlC,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,gBAAgB,EAAE;CAM1C;AAED;;GAEG;AACH,UAAU,aAAa;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS;IAAE,MAAM,CAAC,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;CAAE,EACrF,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAAE,GACnB,OAAO,EAAE,CASX;AAED;;GAEG;AACH,UAAU,WAAW;IACjB,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS;IAAE,MAAM,CAAC,EAAE,WAAW,EAAE,GAAG,SAAS,CAAA;CAAE,EACzF,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAAE,GACnB,OAAO,EAAE,CASX;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAC9B,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,gBAAgB,EAAE,GAC3B,OAAO,EAAE,CAQX"}
|
package/esm/src/util/chunk.d.ts
CHANGED
|
@@ -3,4 +3,12 @@
|
|
|
3
3
|
* per-request caps the AWS APIs enforce on batch operations.
|
|
4
4
|
*/
|
|
5
5
|
export declare function chunk<T>(items: readonly T[], size: number): T[][];
|
|
6
|
+
/**
|
|
7
|
+
* The index, as a string, that an entry had in the list `chunk` split, given
|
|
8
|
+
* its chunk number and its position within that chunk. Batch operations whose
|
|
9
|
+
* entries carry no identifier of their own report failures by this index.
|
|
10
|
+
* `chunk` fills every chunk but the last, so the chunk's offset is the chunk
|
|
11
|
+
* number times the chunk size.
|
|
12
|
+
*/
|
|
13
|
+
export declare function originalIndex(chunkIndex: number, chunkSize: number, position: number): string;
|
|
6
14
|
//# sourceMappingURL=chunk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../../src/util/chunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAMjE"}
|
|
1
|
+
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../../src/util/chunk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAMjE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface ParsedErrorPayload {
|
|
2
|
+
errorType: string | undefined;
|
|
3
|
+
errorMessage: string | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Thrown by `LambdaService.invoke` when a synchronous invocation reached the
|
|
7
|
+
* function but the function itself failed. Lambda reports that as an HTTP 200
|
|
8
|
+
* carrying a function error marker, so the SDK does not throw.
|
|
9
|
+
*
|
|
10
|
+
* `functionError` is the SDK's marker (`Handled` or `Unhandled`).
|
|
11
|
+
* `errorType` and `errorMessage` are parsed from the response payload when it
|
|
12
|
+
* has the usual `{ errorType, errorMessage }` JSON shape, otherwise undefined.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately excludes the raw SDK output and the stack trace: either can
|
|
15
|
+
* contain the caller's payload or PII.
|
|
16
|
+
*
|
|
17
|
+
* Match on `name` rather than `instanceof` if both the CJS and ESM builds of
|
|
18
|
+
* this package may be loaded in one process.
|
|
19
|
+
*/
|
|
20
|
+
export declare class LambdaFunctionError extends Error {
|
|
21
|
+
readonly functionName: string | undefined;
|
|
22
|
+
readonly functionError: string;
|
|
23
|
+
readonly name = "LambdaFunctionError";
|
|
24
|
+
readonly errorType: string | undefined;
|
|
25
|
+
readonly errorMessage: string | undefined;
|
|
26
|
+
constructor(functionName: string | undefined, functionError: string, payload: Pick<LambdaFunctionError, 'errorType' | 'errorMessage'>);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Reads `errorType` and `errorMessage` out of a function error payload.
|
|
30
|
+
* Anything that is not a JSON object with string fields yields undefined for
|
|
31
|
+
* that field rather than failing, because the payload is whatever the invoked
|
|
32
|
+
* function (or runtime) chose to return.
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseFunctionErrorPayload(payload: Uint8Array | undefined): ParsedErrorPayload;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=lambda-function-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lambda-function-error.d.ts","sourceRoot":"","sources":["../../../../src/util/lambda-function-error.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IACxB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAMtC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS;IACzC,QAAQ,CAAC,aAAa,EAAE,MAAM;IANlC,SAAkB,IAAI,yBAAyB;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;gBAG7B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,EAC9B,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,GAAG,cAAc,CAAC;CAMvE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,kBAAkB,CAiB7F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aligent/aws-wrappers",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
4
4
|
"description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -47,9 +47,12 @@
|
|
|
47
47
|
"@aws-sdk/client-api-gateway": "^3.1160.0",
|
|
48
48
|
"@aws-sdk/client-apigatewayv2": "^3.1160.0",
|
|
49
49
|
"@aws-sdk/client-dynamodb": "^3.1160.0",
|
|
50
|
+
"@aws-sdk/client-eventbridge": "^3.1160.0",
|
|
51
|
+
"@aws-sdk/client-lambda": "^3.1160.0",
|
|
50
52
|
"@aws-sdk/client-s3": "^3.1160.0",
|
|
51
53
|
"@aws-sdk/client-scheduler": "^3.1160.0",
|
|
52
54
|
"@aws-sdk/client-secrets-manager": "^3.1160.0",
|
|
55
|
+
"@aws-sdk/client-sesv2": "^3.1160.0",
|
|
53
56
|
"@aws-sdk/client-sfn": "^3.1160.0",
|
|
54
57
|
"@aws-sdk/client-sns": "^3.1160.0",
|
|
55
58
|
"@aws-sdk/client-sqs": "^3.1160.0",
|