@vyriy/handler 0.5.5 → 0.6.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
@@ -122,6 +122,42 @@ export const handler = sns(async (event) => {
122
122
  });
123
123
  ```
124
124
 
125
+ Use a prebuilt DynamoDB Streams handler chain:
126
+
127
+ ```ts
128
+ import { dynamodb } from '@vyriy/handler';
129
+
130
+ export const handler = dynamodb(async (event) => {
131
+ for (const record of event.Records) {
132
+ console.info(record.eventName);
133
+ }
134
+ });
135
+ ```
136
+
137
+ Use a prebuilt S3 event handler chain:
138
+
139
+ ```ts
140
+ import { s3 } from '@vyriy/handler';
141
+
142
+ export const handler = s3(async (event) => {
143
+ for (const record of event.Records) {
144
+ console.info(record.s3.bucket.name, record.s3.object.key);
145
+ }
146
+ });
147
+ ```
148
+
149
+ Use a prebuilt SES receipt handler chain:
150
+
151
+ ```ts
152
+ import { ses } from '@vyriy/handler';
153
+
154
+ export const handler = ses(async (event) => {
155
+ for (const record of event.Records) {
156
+ console.info(record.ses.mail.messageId, record.ses.mail.source);
157
+ }
158
+ });
159
+ ```
160
+
125
161
  Use a prebuilt schedule handler chain:
126
162
 
127
163
  ```ts
@@ -193,6 +229,15 @@ export const handler = compose(
193
229
  - `streamApi`
194
230
  Response streaming API Gateway chain with the same wrapper behavior as `api`. Handlers receive `(event, responseStream, context)` and write directly to the Lambda response stream.
195
231
 
232
+ - `dynamodb`
233
+ DynamoDB Streams chain with logging, timeout handling, context setup, smoke checks, and rethrown errors.
234
+
235
+ - `s3`
236
+ S3 event chain with logging, timeout handling, context setup, smoke checks, and rethrown errors.
237
+
238
+ - `ses`
239
+ SES receipt rule chain for incoming email processing with logging, timeout handling, context setup, smoke checks, and rethrown errors.
240
+
196
241
  - `schedule`
197
242
  EventBridge schedule chain with logging, timeout handling, context setup, smoke checks, and rethrown errors.
198
243
 
@@ -364,7 +409,7 @@ export const handler = withSmoke()(async () => {
364
409
  });
365
410
  ```
366
411
 
367
- `withSmoke()` is used by the API, schedule, SNS, and SQS chains.
412
+ `withSmoke()` is used by the API, DynamoDB Streams, S3, SES receipt, schedule, SNS, and SQS chains.
368
413
 
369
414
  ## Types
370
415
 
@@ -377,5 +422,6 @@ import type { Context, Decorator, Handler, HandlerParams, Response } from '@vyri
377
422
  ## Notes
378
423
 
379
424
  - `api` includes API-specific wrappers such as healthcheck handling, default headers, and CORS preflight handling
380
- - `schedule`, `sns`, and `sqs` use `withError()` so failures are rethrown for event-source retry behavior
425
+ - `dynamodb`, `s3`, `ses`, `schedule`, `sns`, and `sqs` use `withError()` so failures are rethrown for event-source retry behavior
426
+ - `ses` targets SES receipt rule Lambda events for incoming email; SES event publishing notifications can still be handled through the `sns` chain when delivered via SNS
381
427
  - `withSmoke()` delegates matching to `@vyriy/smoke` and returns its API Gateway-compatible response
package/dynamodb.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { DynamoDBStreamEvent } from 'aws-lambda';
2
+ export declare const dynamodb: import("./types.js").Decorator<DynamoDBStreamEvent, void>;
package/dynamodb.js ADDED
@@ -0,0 +1,7 @@
1
+ import { compose } from './compose.js';
2
+ import { withError } from './wrapper/error.js';
3
+ import { withLogger } from './wrapper/logger.js';
4
+ import { withTimeout } from './wrapper/timeout.js';
5
+ import { withContext } from './wrapper/context.js';
6
+ import { withSmoke } from './wrapper/smoke.js';
7
+ export const dynamodb = compose(withError(), withLogger(), withTimeout(), withContext(), withSmoke());
package/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  export * from './api.js';
2
2
  export * from './compose.js';
3
+ export * from './dynamodb.js';
3
4
  export * from './factory.js';
5
+ export * from './s3.js';
4
6
  export * from './schedule.js';
7
+ export * from './ses.js';
5
8
  export * from './sns.js';
6
9
  export * from './sqs.js';
7
10
  export * from './wrapper/context.js';
package/index.js CHANGED
@@ -1,7 +1,10 @@
1
1
  export * from './api.js';
2
2
  export * from './compose.js';
3
+ export * from './dynamodb.js';
3
4
  export * from './factory.js';
5
+ export * from './s3.js';
4
6
  export * from './schedule.js';
7
+ export * from './ses.js';
5
8
  export * from './sns.js';
6
9
  export * from './sqs.js';
7
10
  export * from './wrapper/context.js';
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@vyriy/handler",
3
- "version": "0.5.5",
3
+ "version": "0.6.0",
4
4
  "description": "Composable AWS Lambda handler chains and wrappers for Vyriy projects",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@types/aws-lambda": "^8.10.161",
8
- "@vyriy/chaos": "0.5.5",
9
- "@vyriy/config": "0.5.5",
10
- "@vyriy/logger": "0.5.5",
11
- "@vyriy/smoke": "0.5.5",
12
- "@vyriy/timeout": "0.5.5"
8
+ "@vyriy/chaos": "0.6.0",
9
+ "@vyriy/config": "0.6.0",
10
+ "@vyriy/logger": "0.6.0",
11
+ "@vyriy/smoke": "0.6.0",
12
+ "@vyriy/timeout": "0.6.0"
13
13
  },
14
14
  "agents": "./AGENTS.md",
15
15
  "license": "MIT",
@@ -46,6 +46,16 @@
46
46
  "import": "./compose.js",
47
47
  "default": "./compose.js"
48
48
  },
49
+ "./dynamodb": {
50
+ "types": "./dynamodb.d.ts",
51
+ "import": "./dynamodb.js",
52
+ "default": "./dynamodb.js"
53
+ },
54
+ "./dynamodb.js": {
55
+ "types": "./dynamodb.d.ts",
56
+ "import": "./dynamodb.js",
57
+ "default": "./dynamodb.js"
58
+ },
49
59
  "./factory": {
50
60
  "types": "./factory.d.ts",
51
61
  "import": "./factory.js",
@@ -66,6 +76,16 @@
66
76
  "import": "./index.js",
67
77
  "default": "./index.js"
68
78
  },
79
+ "./s3": {
80
+ "types": "./s3.d.ts",
81
+ "import": "./s3.js",
82
+ "default": "./s3.js"
83
+ },
84
+ "./s3.js": {
85
+ "types": "./s3.d.ts",
86
+ "import": "./s3.js",
87
+ "default": "./s3.js"
88
+ },
69
89
  "./schedule": {
70
90
  "types": "./schedule.d.ts",
71
91
  "import": "./schedule.js",
@@ -76,6 +96,16 @@
76
96
  "import": "./schedule.js",
77
97
  "default": "./schedule.js"
78
98
  },
99
+ "./ses": {
100
+ "types": "./ses.d.ts",
101
+ "import": "./ses.js",
102
+ "default": "./ses.js"
103
+ },
104
+ "./ses.js": {
105
+ "types": "./ses.d.ts",
106
+ "import": "./ses.js",
107
+ "default": "./ses.js"
108
+ },
79
109
  "./sns": {
80
110
  "types": "./sns.d.ts",
81
111
  "import": "./sns.js",
package/s3.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { S3Event } from 'aws-lambda';
2
+ export declare const s3: import("./types.js").Decorator<S3Event, void>;
package/s3.js ADDED
@@ -0,0 +1,7 @@
1
+ import { compose } from './compose.js';
2
+ import { withError } from './wrapper/error.js';
3
+ import { withLogger } from './wrapper/logger.js';
4
+ import { withTimeout } from './wrapper/timeout.js';
5
+ import { withContext } from './wrapper/context.js';
6
+ import { withSmoke } from './wrapper/smoke.js';
7
+ export const s3 = compose(withError(), withLogger(), withTimeout(), withContext(), withSmoke());
package/ses.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { SESEvent } from 'aws-lambda';
2
+ export declare const ses: import("./types.js").Decorator<SESEvent, void>;
package/ses.js ADDED
@@ -0,0 +1,7 @@
1
+ import { compose } from './compose.js';
2
+ import { withError } from './wrapper/error.js';
3
+ import { withLogger } from './wrapper/logger.js';
4
+ import { withTimeout } from './wrapper/timeout.js';
5
+ import { withContext } from './wrapper/context.js';
6
+ import { withSmoke } from './wrapper/smoke.js';
7
+ export const ses = compose(withError(), withLogger(), withTimeout(), withContext(), withSmoke());