sdk-aws-lambda 0.1.0 → 0.2.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/{domain.operations/askLambdaEndpoint/invoke/genLambdaClient.d.ts → access/sdks/lambda/genLambdaSdk.d.ts} +2 -2
- package/dist/{domain.operations/askLambdaEndpoint/invoke/genLambdaClient.js → access/sdks/lambda/genLambdaSdk.js} +7 -7
- package/dist/access/sdks/lambda/genLambdaSdk.js.map +1 -0
- package/dist/{domain.operations/askLambdaEndpoint/invoke → access/sdks/lambda}/sdkLambdaInvoke.d.ts +6 -2
- package/dist/{domain.operations/askLambdaEndpoint/invoke → access/sdks/lambda}/sdkLambdaInvoke.js +6 -3
- package/dist/access/sdks/lambda/sdkLambdaInvoke.js.map +1 -0
- package/dist/domain.objects/ContextAwsLambdaCaller.d.ts +25 -0
- package/dist/domain.objects/ContextAwsLambdaCaller.js +3 -0
- package/dist/domain.objects/ContextAwsLambdaCaller.js.map +1 -0
- package/dist/domain.objects/ContextAwsLambdaServer.d.ts +30 -0
- package/dist/domain.objects/ContextAwsLambdaServer.js +3 -0
- package/dist/domain.objects/ContextAwsLambdaServer.js.map +1 -0
- package/dist/domain.objects/HttpStatusCode.d.ts +2 -2
- package/dist/domain.objects/HttpStatusCode.js +3 -3
- package/dist/domain.objects/LambdaEndpoint.d.ts +35 -0
- package/dist/domain.objects/LambdaEndpoint.js +10 -0
- package/dist/domain.objects/LambdaEndpoint.js.map +1 -0
- package/dist/domain.objects/LambdaEndpointError.d.ts +5 -8
- package/dist/domain.objects/LambdaEndpointError.js.map +1 -1
- package/dist/domain.objects/LambdaEndpointSchema.d.ts +9 -0
- package/dist/domain.objects/LambdaEndpointSchema.js +3 -0
- package/dist/domain.objects/LambdaEndpointSchema.js.map +1 -0
- package/dist/domain.objects/LambdaFunctionNotFoundError.d.ts +10 -0
- package/dist/domain.objects/LambdaFunctionNotFoundError.js +15 -0
- package/dist/domain.objects/LambdaFunctionNotFoundError.js.map +1 -0
- package/dist/domain.objects/LambdaIntrospectionBlockedError.d.ts +10 -0
- package/dist/domain.objects/LambdaIntrospectionBlockedError.js +15 -0
- package/dist/domain.objects/LambdaIntrospectionBlockedError.js.map +1 -0
- package/dist/domain.objects/LambdaIntrospectionNotSupportedError.d.ts +18 -0
- package/dist/domain.objects/LambdaIntrospectionNotSupportedError.js +15 -0
- package/dist/domain.objects/LambdaIntrospectionNotSupportedError.js.map +1 -0
- package/dist/domain.objects/LambdaServiceNotFoundError.d.ts +10 -0
- package/dist/domain.objects/LambdaServiceNotFoundError.js +15 -0
- package/dist/domain.objects/LambdaServiceNotFoundError.js.map +1 -0
- package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.d.ts +20 -0
- package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.js +47 -0
- package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +2 -12
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +13 -22
- package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.d.ts +2 -2
- package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.d.ts +3 -4
- package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js +17 -5
- package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.d.ts +1 -1
- package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.js +3 -3
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.d.ts +13 -8
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +20 -19
- package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.d.ts +13 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js +26 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js.map +1 -0
- package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.d.ts +2 -2
- package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js +15 -14
- package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +15 -8
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +16 -9
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.d.ts +3 -3
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.js +5 -5
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js +88 -63
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +7 -9
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +14 -11
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +22 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +7 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js +13 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.d.ts +5 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js +16 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +53 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +12 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.d.ts +33 -0
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +89 -0
- package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.d.ts +6 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.js +12 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.js.map +1 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.d.ts +15 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.js +44 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.js.map +1 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.d.ts +16 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.js +26 -0
- package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.js.map +1 -0
- package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.d.ts +16 -0
- package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.js +76 -0
- package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.js.map +1 -0
- package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.d.ts +32 -0
- package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js +112 -0
- package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/package.json +45 -41
- package/readme.md +64 -4
- package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.d.ts +0 -11
- package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js +0 -21
- package/dist/domain.operations/askLambdaEndpoint/context/getAccessFromContext.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/invoke/genLambdaClient.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/invoke/sdkLambdaInvoke.js.map +0 -1
- package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.d.ts +0 -9
- package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js +0 -12
- package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.js.map +0 -1
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.2.0",
|
|
6
6
|
"repository": "ehmpathy/sdk-aws-lambda",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
|
|
8
8
|
"keywords": [
|
|
@@ -24,6 +24,38 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"/dist"
|
|
26
26
|
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build:ts": "tsc -p ./tsconfig.build.json",
|
|
29
|
+
"commit:with-cli": "npx cz",
|
|
30
|
+
"fix:format:biome": "biome check --write",
|
|
31
|
+
"fix:format": "npm run fix:format:biome",
|
|
32
|
+
"fix:lint": "biome check --write",
|
|
33
|
+
"fix": "npm run fix:format && npm run fix:lint",
|
|
34
|
+
"build:clean": "chmod -R u+w dist 2>/dev/null; rm -rf dist/",
|
|
35
|
+
"build:compile": "tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json",
|
|
36
|
+
"build": "npm run build:clean && npm run build:compile && npm run build:complete --if-present",
|
|
37
|
+
"test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
|
|
38
|
+
"test:types": "tsc -p ./tsconfig.json --noEmit",
|
|
39
|
+
"test:format:biome": "biome format",
|
|
40
|
+
"test:format": "npm run test:format:biome",
|
|
41
|
+
"test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
|
|
42
|
+
"test:lint:biome": "biome check --diagnostic-level=error",
|
|
43
|
+
"test:lint:biome:all": "biome check",
|
|
44
|
+
"test:lint": "npm run test:lint:biome && npm run test:lint:deps",
|
|
45
|
+
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
46
|
+
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
47
|
+
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
48
|
+
"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 $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
50
|
+
"prepush": "npm run test && npm run build",
|
|
51
|
+
"prepublish": "npm run build",
|
|
52
|
+
"preversion": "npm run prepush",
|
|
53
|
+
"postversion": "git push origin HEAD --tags --no-verify",
|
|
54
|
+
"prepare:husky": "husky install && chmod ug+x .husky/*",
|
|
55
|
+
"prepare:rhachet": "rhachet init --keys --hooks --roles mechanic behaver driver reviewer librarian ergonomist architect dispatcher",
|
|
56
|
+
"prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
|
|
57
|
+
"upgrade:rhachet": "rhachet upgrade"
|
|
58
|
+
},
|
|
27
59
|
"dependencies": {
|
|
28
60
|
"@aws-sdk/client-lambda": "3.1045.0",
|
|
29
61
|
"@ehmpathy/error-fns": "^1.3.7",
|
|
@@ -34,6 +66,7 @@
|
|
|
34
66
|
"@middy/http-security-headers": "4.7.0",
|
|
35
67
|
"domain-objects": "0.31.10",
|
|
36
68
|
"helpful-errors": "1.7.3",
|
|
69
|
+
"sdk-environment": "0.1.5",
|
|
37
70
|
"sdk-logs": "0.9.0",
|
|
38
71
|
"simple-in-memory-cache": "0.4.0",
|
|
39
72
|
"with-simple-cache": "0.15.3",
|
|
@@ -54,7 +87,7 @@
|
|
|
54
87
|
"archiver": "8.0.0",
|
|
55
88
|
"cz-conventional-changelog": "3.3.0",
|
|
56
89
|
"declapract": "^0.13.18",
|
|
57
|
-
"declapract-typescript-ehmpathy": "^0.
|
|
90
|
+
"declapract-typescript-ehmpathy": "^0.49.4",
|
|
58
91
|
"declastruct": "1.7.3",
|
|
59
92
|
"declastruct-aws": "^1.5.2",
|
|
60
93
|
"declastruct-github": "1.3.0",
|
|
@@ -63,14 +96,14 @@
|
|
|
63
96
|
"esbuild-register": "3.6.0",
|
|
64
97
|
"husky": "8.0.3",
|
|
65
98
|
"jest": "30.2.0",
|
|
66
|
-
"rhachet": "1.
|
|
67
|
-
"rhachet-brains-anthropic": "
|
|
68
|
-
"rhachet-brains-fireworksai": "
|
|
69
|
-
"rhachet-brains-xai": "
|
|
70
|
-
"rhachet-roles-bhrain": "0.29.
|
|
71
|
-
"rhachet-roles-bhuild": "0.21.
|
|
72
|
-
"rhachet-roles-ehmpathy": "1.
|
|
73
|
-
"rhachet-roles-rhachet": "
|
|
99
|
+
"rhachet": "1.42.4",
|
|
100
|
+
"rhachet-brains-anthropic": "0.4.1",
|
|
101
|
+
"rhachet-brains-fireworksai": "0.1.3",
|
|
102
|
+
"rhachet-brains-xai": "0.3.3",
|
|
103
|
+
"rhachet-roles-bhrain": "0.29.12",
|
|
104
|
+
"rhachet-roles-bhuild": "0.21.18",
|
|
105
|
+
"rhachet-roles-ehmpathy": "1.37.1",
|
|
106
|
+
"rhachet-roles-rhachet": "0.1.7",
|
|
74
107
|
"test-fns": "1.15.8",
|
|
75
108
|
"tsc-alias": "1.8.10",
|
|
76
109
|
"tsx": "4.20.6",
|
|
@@ -82,34 +115,5 @@
|
|
|
82
115
|
"path": "./node_modules/cz-conventional-changelog"
|
|
83
116
|
}
|
|
84
117
|
},
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
"commit:with-cli": "npx cz",
|
|
88
|
-
"fix:format:biome": "biome check --write",
|
|
89
|
-
"fix:format": "npm run fix:format:biome",
|
|
90
|
-
"fix:lint": "biome check --write",
|
|
91
|
-
"fix": "npm run fix:format && npm run fix:lint",
|
|
92
|
-
"build:clean": "chmod -R u+w dist 2>/dev/null; rm -rf dist/",
|
|
93
|
-
"build:compile": "tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json",
|
|
94
|
-
"build": "npm run build:clean && npm run build:compile && npm run build:complete --if-present",
|
|
95
|
-
"test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
|
|
96
|
-
"test:types": "tsc -p ./tsconfig.json --noEmit",
|
|
97
|
-
"test:format:biome": "biome format",
|
|
98
|
-
"test:format": "npm run test:format:biome",
|
|
99
|
-
"test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
|
|
100
|
-
"test:lint:biome": "biome check --diagnostic-level=error",
|
|
101
|
-
"test:lint:biome:all": "biome check",
|
|
102
|
-
"test:lint": "npm run test:lint:biome && npm run test:lint:deps",
|
|
103
|
-
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
104
|
-
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
105
|
-
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
106
|
-
"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",
|
|
107
|
-
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
|
|
108
|
-
"prepush": "npm run test && npm run build",
|
|
109
|
-
"prepublish": "npm run build",
|
|
110
|
-
"preversion": "npm run prepush",
|
|
111
|
-
"postversion": "git push origin HEAD --tags --no-verify",
|
|
112
|
-
"prepare:husky": "husky install && chmod ug+x .husky/*",
|
|
113
|
-
"prepare:rhachet": "rhachet init --hooks --roles mechanic behaver driver architect ergonomist reviewer dreamer dispatcher"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
118
|
+
"packageManager": "pnpm@10.24.0"
|
|
119
|
+
}
|
package/readme.md
CHANGED
|
@@ -33,21 +33,81 @@ import { askLambdaEndpoint } from 'sdk-aws-lambda';
|
|
|
33
33
|
|
|
34
34
|
const result = await askLambdaEndpoint<TRequest, TResponse>(
|
|
35
35
|
{
|
|
36
|
-
which: { service: 'svc-jobs', function: 'getJobByUuid' },
|
|
36
|
+
which: { service: 'svc-jobs', access: 'prep', function: 'getJobByUuid' },
|
|
37
37
|
event: { uuid },
|
|
38
38
|
},
|
|
39
|
-
{ log
|
|
39
|
+
{ log }, // trail auto-extracted and injected into event; env optional (region)
|
|
40
40
|
);
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
## introspection
|
|
44
|
+
|
|
45
|
+
endpoints with zod schemas support runtime introspection. send `{ introspect: 'schema' }` to get the json-schema:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { askLambdaEndpoint } from 'sdk-aws-lambda';
|
|
49
|
+
|
|
50
|
+
// get schema from any endpoint
|
|
51
|
+
const schema = await askLambdaEndpoint(
|
|
52
|
+
{
|
|
53
|
+
which: { service: 'svc-user', access: 'prep', function: 'getUser' },
|
|
54
|
+
event: { introspect: 'schema' },
|
|
55
|
+
},
|
|
56
|
+
{ log },
|
|
57
|
+
);
|
|
58
|
+
// returns: { input: {...jsonSchema}, output: {...jsonSchema} }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
introspection requires `env.access === 'prep'`. in prod, throws ConstraintError.
|
|
62
|
+
|
|
63
|
+
### define an endpoint with introspection
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { genLambdaEndpoint } from 'sdk-aws-lambda';
|
|
67
|
+
import { z } from 'zod';
|
|
68
|
+
|
|
69
|
+
const inputSchema = z.object({ userId: z.string().uuid() });
|
|
70
|
+
const outputSchema = z.object({ name: z.string(), email: z.string() });
|
|
71
|
+
|
|
72
|
+
export const handler = genLambdaEndpoint(
|
|
73
|
+
{
|
|
74
|
+
schema: { input: inputSchema, output: outputSchema },
|
|
75
|
+
invoke: async ({ event }) => {
|
|
76
|
+
return { name: 'alice', email: 'alice@example.com' };
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{ env: { access: 'prep' } }, // or env: async () => getEnvConfig()
|
|
80
|
+
);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### contract discovery (for sdk generation)
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { getAllLambdaContracts, getOneLambdaContract } from 'sdk-aws-lambda';
|
|
87
|
+
|
|
88
|
+
// get schema for one endpoint
|
|
89
|
+
const contract = await getOneLambdaContract(
|
|
90
|
+
{ which: { service: 'svc-user', access: 'prep', function: 'getUser' } },
|
|
91
|
+
{ env: { region: 'us-east-1' } },
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// get schemas for all endpoints in a service (keyed by bare function name)
|
|
95
|
+
const contracts = await getAllLambdaContracts(
|
|
96
|
+
{ which: { service: 'svc-user', access: 'prep' } },
|
|
97
|
+
{ env: { region: 'us-east-1' } },
|
|
98
|
+
);
|
|
99
|
+
// returns: { getUser: {...schema}, getSettings: {...schema} }
|
|
100
|
+
```
|
|
101
|
+
|
|
43
102
|
# features
|
|
44
103
|
|
|
45
104
|
- **genLambdaEndpoint** — define lambda endpoints with validation, log capture, error classification
|
|
46
105
|
- `genLambdaEndpoint()` — direct invoke (default)
|
|
47
|
-
-
|
|
48
|
-
- `.for.sqs` — sqs queue consumer
|
|
106
|
+
- `forApiGateway()` — http via api gateway
|
|
49
107
|
- **askLambdaEndpoint** — ask another lambda with typed request/response, automatic trail propagation
|
|
50
108
|
- **trace-id propagation** — pass `log` and trail.exid auto-threads through the call chain
|
|
109
|
+
- **introspection** — expose json-schema via `{ introspect: 'schema' }` (prep only)
|
|
110
|
+
- **contract discovery** — `getOneLambdaContract`, `getAllLambdaContracts` for sdk generation
|
|
51
111
|
|
|
52
112
|
# docs
|
|
53
113
|
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* .what = extracts access level from context
|
|
3
|
-
* .why = named transformer for clear narrative in orchestrator
|
|
4
|
-
*
|
|
5
|
-
* .note = throws if access is not provided — no fallbacks
|
|
6
|
-
*/
|
|
7
|
-
export declare const getAccessFromContext: (input: {
|
|
8
|
-
env: {
|
|
9
|
-
access: string | null;
|
|
10
|
-
} | null;
|
|
11
|
-
}) => string;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAccessFromContext = void 0;
|
|
4
|
-
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
-
/**
|
|
6
|
-
* .what = extracts access level from context
|
|
7
|
-
* .why = named transformer for clear narrative in orchestrator
|
|
8
|
-
*
|
|
9
|
-
* .note = throws if access is not provided — no fallbacks
|
|
10
|
-
*/
|
|
11
|
-
const getAccessFromContext = (input) => {
|
|
12
|
-
// require explicit access from context
|
|
13
|
-
if (input.env?.access)
|
|
14
|
-
return input.env.access;
|
|
15
|
-
// fail loud: no fallbacks
|
|
16
|
-
throw new helpful_errors_1.MalfunctionError('access not provided: context.env.access is required', {
|
|
17
|
-
hint: 'pass env.access in context (test | prep | prod)',
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
exports.getAccessFromContext = getAccessFromContext;
|
|
21
|
-
//# sourceMappingURL=getAccessFromContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAccessFromContext.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/context/getAccessFromContext.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAElD;;;;;GAKG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAEpC,EAAU,EAAE;IACX,uCAAuC;IACvC,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;IAE/C,0BAA0B;IAC1B,MAAM,IAAI,iCAAgB,CACxB,qDAAqD,EACrD;QACE,IAAI,EAAE,iDAAiD;KACxD,CACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"genLambdaClient.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/invoke/genLambdaClient.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAEtD;;;GAGG;AACI,MAAM,eAAe,GAAG,CAAC,KAG/B,EAAgB,EAAE;IACjB,qCAAqC;IACrC,IAAI,KAAK,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC;IAEhC,iEAAiE;IACjE,OAAO,IAAI,4BAAY,CACrB,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CACtD,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,eAAe,mBAW1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdkLambdaInvoke.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/invoke/sdkLambdaInvoke.ts"],"names":[],"mappings":";;;AAAA,0DAA0E;AAY1E;;;GAGG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,KAIrC,EAAiC,EAAE;IAClC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CACpC,IAAI,6BAAa,CAAC;QAChB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KACpD,CAAC,CACH,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* .what = transforms service, access, and function into aws lambda function name
|
|
3
|
-
* .why = aws lambda name convention follows ${service}-${access}-${function} pattern
|
|
4
|
-
*/
|
|
5
|
-
export declare const getLambdaFunctionName: (input: {
|
|
6
|
-
service: string;
|
|
7
|
-
access: string;
|
|
8
|
-
function: string;
|
|
9
|
-
}) => string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLambdaFunctionName = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* .what = transforms service, access, and function into aws lambda function name
|
|
6
|
-
* .why = aws lambda name convention follows ${service}-${access}-${function} pattern
|
|
7
|
-
*/
|
|
8
|
-
const getLambdaFunctionName = (input) => {
|
|
9
|
-
return `${input.service}-${input.access}-${input.function}`;
|
|
10
|
-
};
|
|
11
|
-
exports.getLambdaFunctionName = getLambdaFunctionName;
|
|
12
|
-
//# sourceMappingURL=getLambdaFunctionName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getLambdaFunctionName.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/getLambdaFunctionName.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAIrC,EAAU,EAAE;IACX,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC9D,CAAC,CAAC;AANW,QAAA,qBAAqB,yBAMhC"}
|