sdk-aws-lambda 0.2.0 → 0.4.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/dist/contract/cli/asGenArgs.d.ts +21 -0
- package/dist/contract/cli/asGenArgs.js +69 -0
- package/dist/contract/cli/asGenArgs.js.map +1 -0
- package/dist/contract/cli/gen.d.ts +23 -0
- package/dist/contract/cli/gen.js +72 -0
- package/dist/contract/cli/gen.js.map +1 -0
- package/dist/domain.objects/ApiGatewayRequestPayload.d.ts +12 -0
- package/dist/domain.objects/ApiGatewayRequestPayload.js +3 -0
- package/dist/domain.objects/ApiGatewayRequestPayload.js.map +1 -0
- package/dist/domain.objects/ApiGatewayResponse.d.ts +30 -0
- package/dist/domain.objects/ApiGatewayResponse.js +3 -0
- package/dist/domain.objects/ApiGatewayResponse.js.map +1 -0
- package/dist/domain.objects/ApiGatewayResponsePayload.d.ts +30 -0
- package/dist/domain.objects/ApiGatewayResponsePayload.js +3 -0
- package/dist/domain.objects/ApiGatewayResponsePayload.js.map +1 -0
- package/dist/domain.objects/DomainObjectCaptured.d.ts +51 -0
- package/dist/domain.objects/DomainObjectCaptured.js +8 -0
- package/dist/domain.objects/DomainObjectCaptured.js.map +1 -0
- package/dist/domain.objects/GeneratedFile.d.ts +18 -0
- package/dist/domain.objects/GeneratedFile.js +8 -0
- package/dist/domain.objects/GeneratedFile.js.map +1 -0
- package/dist/domain.objects/HttpStatusCode.d.ts +1 -0
- package/dist/domain.objects/HttpStatusCode.js +1 -0
- package/dist/domain.objects/HttpStatusCode.js.map +1 -1
- package/dist/domain.objects/LambdaCredentialsAbsentError.d.ts +11 -0
- package/dist/domain.objects/LambdaCredentialsAbsentError.js +16 -0
- package/dist/domain.objects/LambdaCredentialsAbsentError.js.map +1 -0
- package/dist/domain.objects/LambdaDomainObjectNotCapturableError.d.ts +12 -0
- package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js +17 -0
- package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js.map +1 -0
- package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.d.ts +14 -0
- package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js +19 -0
- package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/TranslateLog.d.ts +29 -0
- package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js +3 -0
- package/dist/domain.operations/genLambdaEndpoint/TranslateLog.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.d.ts +29 -0
- package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js +30 -0
- package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.d.ts +36 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js +3 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.d.ts +19 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js +24 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.d.ts +26 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js +31 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +33 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +39 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.d.ts +27 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js +118 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +76 -36
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +153 -45
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.d.ts +8 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js +34 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.d.ts +19 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js +36 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.d.ts +7 -24
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +19 -103
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.d.ts +20 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js +48 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.d.ts +16 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +32 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +6 -22
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +24 -18
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.d.ts +11 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +12 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.d.ts +37 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js +24 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.d.ts +18 -10
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +20 -23
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +29 -6
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +23 -28
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +16 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +9 -13
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +27 -6
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +29 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +12 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +27 -2
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +34 -13
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.d.ts +16 -0
- package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js +36 -0
- package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.d.ts +10 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js +18 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.d.ts +14 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +44 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.d.ts +11 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js +42 -0
- package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/banner.d.ts +9 -0
- package/dist/domain.operations/genServiceSdk/gen.file/banner.js +16 -0
- package/dist/domain.operations/genServiceSdk/gen.file/banner.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.d.ts +20 -0
- package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js +44 -0
- package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.d.ts +13 -0
- package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js +49 -0
- package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +16 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +39 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.d.ts +35 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +189 -0
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +15 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +37 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.d.ts +26 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js +106 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.d.ts +15 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +51 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.d.ts +14 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +68 -0
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/genServiceSdk.d.ts +20 -0
- package/dist/domain.operations/genServiceSdk/genServiceSdk.js +88 -0
- package/dist/domain.operations/genServiceSdk/genServiceSdk.js.map +1 -0
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +49 -4
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -1
- package/dist/index.d.ts +38 -2
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/package.json +18 -14
- package/readme.md +50 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "sdk-aws-lambda",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4.0",
|
|
6
6
|
"repository": "ehmpathy/sdk-aws-lambda",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
|
|
8
8
|
"keywords": [
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"bugs": "https://github.com/ehmpathy/sdk-aws-lambda/issues",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
|
+
"bin": {
|
|
22
|
+
"sdk-aws-lambda": "dist/contract/cli/gen.js"
|
|
23
|
+
},
|
|
21
24
|
"engines": {
|
|
22
25
|
"node": ">=8.0.0"
|
|
23
26
|
},
|
|
@@ -42,38 +45,39 @@
|
|
|
42
45
|
"test:lint:biome": "biome check --diagnostic-level=error",
|
|
43
46
|
"test:lint:biome:all": "biome check",
|
|
44
47
|
"test:lint": "npm run test:lint:biome && npm run test:lint:deps",
|
|
45
|
-
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([
|
|
46
|
-
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([
|
|
47
|
-
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([
|
|
48
|
+
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ \"${THOROUGH:-}\" != \"true\" ] && echo '--changedSince=origin/main') $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
|
|
49
|
+
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ \"${THOROUGH:-}\" != \"true\" ] && echo '--changedSince=origin/main') $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
|
|
50
|
+
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
|
|
48
51
|
"test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
|
|
49
|
-
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([
|
|
52
|
+
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ \"${RESNAP:-}\" = \"true\" ] && echo '--updateSnapshot')",
|
|
50
53
|
"prepush": "npm run test && npm run build",
|
|
51
54
|
"prepublish": "npm run build",
|
|
52
55
|
"preversion": "npm run prepush",
|
|
53
56
|
"postversion": "git push origin HEAD --tags --no-verify",
|
|
54
57
|
"prepare:husky": "husky install && chmod ug+x .husky/*",
|
|
55
|
-
"prepare:rhachet": "rhachet init --
|
|
58
|
+
"prepare:rhachet": "rhachet init --hooks --roles mechanic architect ergonomist driver reviewer dreamer behaver dispatcher",
|
|
56
59
|
"prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
|
|
57
60
|
"upgrade:rhachet": "rhachet upgrade"
|
|
58
61
|
},
|
|
59
62
|
"dependencies": {
|
|
60
63
|
"@aws-sdk/client-lambda": "3.1045.0",
|
|
64
|
+
"@biomejs/biome": "2.3.8",
|
|
61
65
|
"@ehmpathy/error-fns": "^1.3.7",
|
|
62
66
|
"@middy/core": "4.7.0",
|
|
63
67
|
"@middy/http-cors": "4.7.0",
|
|
64
68
|
"@middy/http-json-body-parser": "4.7.0",
|
|
65
69
|
"@middy/http-response-serializer": "4.7.0",
|
|
66
70
|
"@middy/http-security-headers": "4.7.0",
|
|
67
|
-
"domain-objects": "0.
|
|
71
|
+
"domain-objects": "0.33.0",
|
|
68
72
|
"helpful-errors": "1.7.3",
|
|
69
73
|
"sdk-environment": "0.1.5",
|
|
70
74
|
"sdk-logs": "0.9.0",
|
|
71
75
|
"simple-in-memory-cache": "0.4.0",
|
|
76
|
+
"type-fns": "1.21.4",
|
|
72
77
|
"with-simple-cache": "0.15.3",
|
|
73
78
|
"zod": "4.4.3"
|
|
74
79
|
},
|
|
75
80
|
"devDependencies": {
|
|
76
|
-
"@biomejs/biome": "2.3.8",
|
|
77
81
|
"@commitlint/cli": "19.5.0",
|
|
78
82
|
"@commitlint/config-conventional": "19.5.0",
|
|
79
83
|
"@swc/core": "1.15.3",
|
|
@@ -96,13 +100,13 @@
|
|
|
96
100
|
"esbuild-register": "3.6.0",
|
|
97
101
|
"husky": "8.0.3",
|
|
98
102
|
"jest": "30.2.0",
|
|
99
|
-
"rhachet": "1.
|
|
100
|
-
"rhachet-brains-anthropic": "0.4.
|
|
101
|
-
"rhachet-brains-fireworksai": "0.1.
|
|
103
|
+
"rhachet": "1.47.5",
|
|
104
|
+
"rhachet-brains-anthropic": "0.4.3",
|
|
105
|
+
"rhachet-brains-fireworksai": "0.1.6",
|
|
102
106
|
"rhachet-brains-xai": "0.3.3",
|
|
103
|
-
"rhachet-roles-bhrain": "0.
|
|
104
|
-
"rhachet-roles-bhuild": "0.21.
|
|
105
|
-
"rhachet-roles-ehmpathy": "1.
|
|
107
|
+
"rhachet-roles-bhrain": "0.34.1",
|
|
108
|
+
"rhachet-roles-bhuild": "0.21.36",
|
|
109
|
+
"rhachet-roles-ehmpathy": "1.38.12",
|
|
106
110
|
"rhachet-roles-rhachet": "0.1.7",
|
|
107
111
|
"test-fns": "1.15.8",
|
|
108
112
|
"tsc-alias": "1.8.10",
|
package/readme.md
CHANGED
|
@@ -99,11 +99,46 @@ const contracts = await getAllLambdaContracts(
|
|
|
99
99
|
// returns: { getUser: {...schema}, getSettings: {...schema} }
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
# the http wire response
|
|
103
|
+
|
|
104
|
+
`forApiGateway()` handlers own their **exact wire response** — any status, any headers, any body, or
|
|
105
|
+
none at all. return an `ApiGatewayResponse`, and it reaches the wire as written.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { forApiGateway, asApiGatewayResponseSchema } from 'sdk-aws-lambda';
|
|
109
|
+
|
|
110
|
+
export const handler = forApiGateway({
|
|
111
|
+
schema: {
|
|
112
|
+
input: z.any(), // a twilio form blob
|
|
113
|
+
output: asApiGatewayResponseSchema({ body: z.undefined() }),
|
|
114
|
+
},
|
|
115
|
+
invoke: async ({ event }) => ({ status: 204 }), // 204, no body
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
| return | wire |
|
|
120
|
+
|---|---|
|
|
121
|
+
| `{ body: x }` | 200 + json — the convenient default |
|
|
122
|
+
| `{ status: 204 }` | 204, no body, **no `content-type`** |
|
|
123
|
+
| `{ status: 308, headers: { Location } }` | a redirect |
|
|
124
|
+
| `{ headers: { 'Content-Type': 'text/xml' }, body: xml }` | your bytes, verbatim |
|
|
125
|
+
| `{}` | ⛔ a **compile error** — at least one key is required |
|
|
126
|
+
|
|
127
|
+
set a `Content-Type` yourself and the serializer stands aside, so xml/text reach the wire
|
|
128
|
+
byte-identical. omit it with a body and you get `application/json`.
|
|
129
|
+
|
|
130
|
+
### schema is required; `z.any()` is the opt-out
|
|
131
|
+
|
|
132
|
+
`schema.output` describes what `invoke` **returns** (the envelope), so
|
|
133
|
+
`asApiGatewayResponseSchema({ body })` wraps a body schema into it. a required field with a visible
|
|
134
|
+
opt-out keeps validation and introspection on one code path, and puts the choice where a reviewer can
|
|
135
|
+
see it.
|
|
136
|
+
|
|
102
137
|
# features
|
|
103
138
|
|
|
104
139
|
- **genLambdaEndpoint** — define lambda endpoints with validation, log capture, error classification
|
|
105
140
|
- `genLambdaEndpoint()` — direct invoke (default)
|
|
106
|
-
- `forApiGateway()` — http via api gateway
|
|
141
|
+
- `forApiGateway()` — http via api gateway, with full wire-response control (above)
|
|
107
142
|
- **askLambdaEndpoint** — ask another lambda with typed request/response, automatic trail propagation
|
|
108
143
|
- **trace-id propagation** — pass `log` and trail.exid auto-threads through the call chain
|
|
109
144
|
- **introspection** — expose json-schema via `{ introspect: 'schema' }` (prep only)
|
|
@@ -111,4 +146,17 @@ const contracts = await getAllLambdaContracts(
|
|
|
111
146
|
|
|
112
147
|
# docs
|
|
113
148
|
|
|
114
|
-
|
|
149
|
+
**this readme is the consumer doc.** the contract, the migration, and the live defects are all
|
|
150
|
+
above — you need read no further to use the package.
|
|
151
|
+
|
|
152
|
+
the links below are **internal design records**, kept for a maintainer who wants the reasons:
|
|
153
|
+
|
|
154
|
+
- ⚠️ they are **not in the npm tarball** (`"files": ["/dist"]`), so they open on github only
|
|
155
|
+
- ⚠️ they are process journals — fulcrum tables, review-round narration, references to briefs that
|
|
156
|
+
live outside this package. they read as a decision log, never as a guide
|
|
157
|
+
|
|
158
|
+
<!-- prettier-ignore -->
|
|
159
|
+
| record | holds |
|
|
160
|
+
|---|---|
|
|
161
|
+
| [the wire-response design](./.behavior/v2026_08_03.feat-apigateway-wire-response/1.vision.yield.md) | why the contract widened rather than grew a peer, its four named pipeline points, and each deferred defect with its clamp |
|
|
162
|
+
| [the endpoint vocabulary](./.behavior/v2026_05_08.rename/1.vision.yield.md) | how `LambdaEndpoint` and its slug were named |
|