sdk-aws-lambda 0.5.0 → 0.7.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.objects/ApiGatewayRequestEventOnwire.d.ts +18 -0
- package/dist/domain.objects/ApiGatewayRequestEventOnwire.js +3 -0
- package/dist/domain.objects/ApiGatewayRequestEventOnwire.js.map +1 -0
- package/dist/domain.objects/ApiGatewayResponse.d.ts +17 -10
- package/dist/domain.objects/{ApiGatewayResponsePayload.d.ts → ApiGatewayResponseOnwire.d.ts} +8 -4
- package/dist/domain.objects/{ApiGatewayRequestPayload.js → ApiGatewayResponseOnwire.js} +1 -1
- package/dist/domain.objects/ApiGatewayResponseOnwire.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/InvokeInputSuperset.d.ts +125 -0
- package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js → InvokeInputSuperset.js} +1 -1
- package/dist/domain.operations/genLambdaEndpoint/InvokeInputSuperset.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/TranslateLog.d.ts +0 -17
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.d.ts +27 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/ApiGatewayRequestEventUnified.d.ts +100 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/ApiGatewayRequestEventUnified.js +3 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/ApiGatewayRequestEventUnified.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayRequestEventUnified.d.ts +34 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayRequestEventUnified.js +141 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayRequestEventUnified.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.d.ts +22 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.js +27 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{asApiGatewayResponsePayloadJson.d.ts → asApiGatewayResponseOnwireJson.d.ts} +11 -11
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{asApiGatewayResponsePayloadJson.js → asApiGatewayResponseOnwireJson.js} +12 -12
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwireJson.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +39 -13
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +37 -11
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.d.ts +35 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.js +44 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +95 -39
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +88 -62
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getAllWirePayloadKeysFound.d.ts → getAllResponseOnwireKeysFound.d.ts} +2 -2
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllResponseOnwireKeysFound.js +43 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllResponseOnwireKeysFound.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV1ApiGatewayEvent.d.ts → getIsV1ApiGatewayRequestEvent.d.ts} +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV1ApiGatewayEvent.js → getIsV1ApiGatewayRequestEvent.js} +4 -4
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayRequestEvent.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV2ApiGatewayEvent.d.ts → getIsV2ApiGatewayRequestEvent.d.ts} +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV2ApiGatewayEvent.js → getIsV2ApiGatewayRequestEvent.js} +4 -4
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayRequestEvent.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.d.ts +8 -5
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js +11 -8
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/{genApiGatewayEventNormalizationMiddleware.d.ts → genApiGatewayRequestEventNormalizationMiddleware.d.ts} +3 -3
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/{genApiGatewayEventNormalizationMiddleware.js → genApiGatewayRequestEventNormalizationMiddleware.js} +8 -8
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.d.ts +4 -4
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js +5 -5
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.d.ts +36 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.js +113 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.d.ts +125 -0
- package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js → genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js} +32 -16
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.d.ts +18 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.js +29 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.d.ts +23 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.js +38 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/SqsEventDecoded.d.ts +123 -0
- package/dist/{domain.objects/ApiGatewayResponsePayload.js → domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/SqsEventDecoded.js} +1 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/SqsEventDecoded.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsEventDecoded.d.ts +23 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsEventDecoded.js +33 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsEventDecoded.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsHeadersOnwire.d.ts +30 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsHeadersOnwire.js +38 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsHeadersOnwire.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordDecoded.d.ts +30 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordDecoded.js +86 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordDecoded.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.d.ts +26 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.js +32 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.d.ts +82 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js +108 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.d.ts +121 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +97 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.d.ts +52 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js +68 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getIsSqsEvent.d.ts +21 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getIsSqsEvent.js +36 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getIsSqsEvent.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.d.ts +46 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.js +79 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.js +31 -0
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.d.ts +8 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +19 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +10 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +0 -4
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js +224 -3
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.d.ts +12 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.js +23 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +17 -6
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +16 -18
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +16 -18
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.d.ts +5 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +5 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +22 -14
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +23 -15
- package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.d.ts +19 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js +26 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js.map +1 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.d.ts +17 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js +40 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +15 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +97 -9
- package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.d.ts +20 -0
- package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js +31 -2
- package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js.map +1 -1
- package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.d.ts +78 -0
- package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js +103 -0
- package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js.map +1 -0
- package/dist/domain.operations/genServiceSdk/gen.file/banner.d.ts +2 -3
- package/dist/domain.operations/genServiceSdk/gen.file/banner.js +2 -3
- package/dist/domain.operations/genServiceSdk/gen.file/banner.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +7 -2
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +7 -2
- package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +24 -19
- package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +10 -3
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +10 -3
- package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +9 -23
- package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +11 -18
- package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -1
- package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.d.ts +59 -0
- package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js +87 -0
- package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js.map +1 -0
- package/dist/index.d.ts +63 -18
- package/dist/index.js +45 -14
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/readme.md +212 -60
- package/dist/domain.objects/ApiGatewayRequestPayload.d.ts +0 -12
- package/dist/domain.objects/ApiGatewayRequestPayload.js.map +0 -1
- package/dist/domain.objects/ApiGatewayResponsePayload.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.d.ts +0 -36
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.d.ts +0 -19
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js +0 -24
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.d.ts +0 -27
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js +0 -118
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js +0 -34
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayEvent.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.d.ts +0 -27
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +0 -54
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +0 -64
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.d.ts +0 -20
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +0 -31
- package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +0 -1
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.d.ts +0 -5
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js +0 -16
- package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js.map +0 -1
|
@@ -16,31 +16,32 @@ const genIntrospectionMiddleware_1 = require("../middleware/genIntrospectionMidd
|
|
|
16
16
|
const genIoLoggerMiddleware_1 = require("../middleware/genIoLoggerMiddleware");
|
|
17
17
|
const genTrailMiddleware_1 = require("../middleware/genTrailMiddleware");
|
|
18
18
|
const getValidatedOutput_1 = require("../middleware/getValidatedOutput");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
19
|
+
const setEventFrozen_1 = require("../setEventFrozen");
|
|
20
|
+
const asApiGatewayRequestEventUnified_1 = require("./asApiGatewayRequestEventUnified");
|
|
21
|
+
const asApiGatewayResponseOnwire_1 = require("./asApiGatewayResponseOnwire");
|
|
22
|
+
const asApiGatewayResponseOnwireJson_1 = require("./asApiGatewayResponseOnwireJson");
|
|
23
|
+
const getAllResponseOnwireKeysFound_1 = require("./getAllResponseOnwireKeysFound");
|
|
23
24
|
const isApiGatewayResponse_1 = require("./isApiGatewayResponse");
|
|
24
|
-
const
|
|
25
|
+
const genApiGatewayRequestEventNormalizationMiddleware_1 = require("./middleware/genApiGatewayRequestEventNormalizationMiddleware");
|
|
25
26
|
const genContentTypeCoherenceMiddleware_1 = require("./middleware/genContentTypeCoherenceMiddleware");
|
|
26
|
-
const
|
|
27
|
+
const genZodInputValidationMiddleware_1 = require("./middleware/genZodInputValidationMiddleware");
|
|
27
28
|
/** .what = converts this sdk's cors config into `@middy/http-cors` options */
|
|
28
29
|
const corsInputToCorsConfig = (cors) => {
|
|
29
30
|
return {
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
-
* NEVER pass a key you do not mean to set — not `maxAge`, not any later addition
|
|
32
|
+
* .what = supplies either `origin` or `origins`, and omits the key it does not supply
|
|
33
33
|
* .why = `@middy/http-cors` merges as `{ ...defaults, ...opts }` (`index.cjs:44-47`), so an
|
|
34
|
-
* explicit `undefined`
|
|
34
|
+
* explicit `undefined` clobbers the default. its `origins` default is `[]` and
|
|
35
35
|
* `getOrigin` opens with `options.origins.length` (`index.cjs:12-13`), so
|
|
36
36
|
* `origins: undefined` throws from `after` and turns every success into a 500
|
|
37
|
+
* .note = so pass no key you do not mean to set — not `maxAge`, not any later addition
|
|
37
38
|
*/
|
|
38
39
|
...(cors.origins === '*' ? { origin: '*' } : { origins: cors.origins }),
|
|
39
40
|
credentials: cors.credentials,
|
|
40
41
|
headers: cors.headers ?? 'content-type,authorization',
|
|
41
42
|
/**
|
|
42
|
-
*
|
|
43
|
-
* `OPTIONS` short-circuit — limit 1 on `CorsConfig`. blast radius, probed:
|
|
43
|
+
* .absent by choice = `disableBeforePreflightResponse: false` would turn on the vendor's
|
|
44
|
+
* `OPTIONS` short-circuit — limit 1 on `CorsConfig`. blast radius, probed: one case
|
|
44
45
|
* (`[case11]` moves to a 204). left because it changes `OPTIONS` for every
|
|
45
46
|
* cors-configured handler, and one that answers `OPTIONS` itself would lose the request
|
|
46
47
|
*/
|
|
@@ -57,7 +58,7 @@ const serializers = [
|
|
|
57
58
|
* .why = adds cors, security headers, error conversion, body serialization, and validation
|
|
58
59
|
*/
|
|
59
60
|
const forApiGateway = (config, context) => {
|
|
60
|
-
const deserialize = config.deserialize ??
|
|
61
|
+
const deserialize = config.deserialize ?? asApiGatewayRequestEventUnified_1.DESERIALIZE_DEFAULT;
|
|
61
62
|
/**
|
|
62
63
|
* .what = the handler's own step: invoke, assure, validate, encode
|
|
63
64
|
* .why = by here the chain has reconciled the request and refused a wrong body shape, so
|
|
@@ -67,13 +68,34 @@ const forApiGateway = (config, context) => {
|
|
|
67
68
|
// read the trail log `genTrailMiddleware` wrote; the cast lives in the shared reader
|
|
68
69
|
const { log } = (0, asContextLogTrail_1.asContextLogTrail)({ context: lambdaContext });
|
|
69
70
|
/**
|
|
70
|
-
* .
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
71
|
+
* .what = seals the envelope before the handler can touch it
|
|
72
|
+
* .why = `event` IS middy's `request.event`, by reference, and two vendors read it in their
|
|
73
|
+
* `after` hooks — after `invoke` has returned. a handler that writes through it
|
|
74
|
+
* corrupts what they read, with no error anywhere
|
|
75
|
+
* .why deep = a shallow freeze leaves `event.headers`, `event.params`, and `event._.raw`
|
|
76
|
+
* writable, and `headers` is exactly the object `@middy/http-cors` reads
|
|
77
|
+
* (`index.js:83`)
|
|
78
|
+
* .why safe = measured across the five installed `@middy/*` packages: 8 reads of
|
|
79
|
+
* `request.event`, and 0 writes. every sdk write to it is a `before` hook, so none
|
|
80
|
+
* survives to here (`domain.terms/event.md`)
|
|
81
|
+
*
|
|
82
|
+
* .residual = `@middy/http-json-body-parser` does write `request.event.body`
|
|
83
|
+
* (`index.js:25`) and would throw under this freeze. it is imported nowhere in
|
|
84
|
+
* `src/` — this sdk parses the body itself, in `asApiGatewayRequestEventUnified`
|
|
85
|
+
*/
|
|
86
|
+
const eventFrozen = (0, setEventFrozen_1.setEventFrozen)({ event });
|
|
87
|
+
/**
|
|
88
|
+
* .what = hands over the pair plus the envelope; the two lifted fields are PROJECTIONS of
|
|
89
|
+
* its slots
|
|
90
|
+
* .note = read from `eventFrozen` rather than `event` — it is the SAME reference (the freeze
|
|
91
|
+
* is in place), and the narrowed type is what carries the readonly guarantee to the
|
|
92
|
+
* handler. a read off `event` would hand over the pre-freeze type and silently drop it
|
|
75
93
|
*/
|
|
76
|
-
const response = await config.invoke({
|
|
94
|
+
const response = await config.invoke({
|
|
95
|
+
headers: eventFrozen.headers,
|
|
96
|
+
payload: eventFrozen.payload,
|
|
97
|
+
event: eventFrozen,
|
|
98
|
+
}, { log });
|
|
77
99
|
/**
|
|
78
100
|
* .what = refuses the aws WIRE shape, and names the rename that fixes it
|
|
79
101
|
* .why = `isApiGatewayResponse` rejects it too, but `withAssure` takes a name and no message,
|
|
@@ -83,16 +105,16 @@ const forApiGateway = (config, context) => {
|
|
|
83
105
|
* ConstraintError would answer 400 and tell the caller THEY erred, which is false
|
|
84
106
|
* (invariant.badrequesterror-not-lambda-error)
|
|
85
107
|
*/
|
|
86
|
-
const
|
|
87
|
-
? (0,
|
|
108
|
+
const keysOfResponseOnwire = typeof response === 'object' && response !== null
|
|
109
|
+
? (0, getAllResponseOnwireKeysFound_1.getAllResponseOnwireKeysFound)({ response })
|
|
88
110
|
: [];
|
|
89
|
-
if (
|
|
90
|
-
helpful_errors_1.MalfunctionError.throw('handler returned the aws
|
|
91
|
-
|
|
111
|
+
if (keysOfResponseOnwire.length)
|
|
112
|
+
helpful_errors_1.MalfunctionError.throw('handler returned the aws ApiGatewayResponseOnwire shape rather than an ApiGatewayResponse', {
|
|
113
|
+
keysOfResponseOnwire,
|
|
92
114
|
fix: 'rename `statusCode` to `status`, and return the body as a value rather than a JSON string',
|
|
93
115
|
response,
|
|
94
116
|
});
|
|
95
|
-
// the throw above took every wire
|
|
117
|
+
// the throw above took every response-wire shape, so this closes the REST — a string, an
|
|
96
118
|
// array, a null. one names a fix for the likely mistake; this one covers the others
|
|
97
119
|
isApiGatewayResponse_1.isApiGatewayResponse.assure(response);
|
|
98
120
|
// validate the whole response envelope against the declared output schema
|
|
@@ -101,7 +123,7 @@ const forApiGateway = (config, context) => {
|
|
|
101
123
|
schema: config.schema.output,
|
|
102
124
|
});
|
|
103
125
|
// the wire encode — status defaults here, before any middleware observes the response
|
|
104
|
-
return (0,
|
|
126
|
+
return (0, asApiGatewayResponseOnwire_1.asApiGatewayResponseOnwire)({ response: validatedResponse });
|
|
105
127
|
};
|
|
106
128
|
// 0. content-type coherence (after + onError) - drops Content-Type when the body is absent
|
|
107
129
|
// 1. constraint error (onError) - a caller fault becomes a 400
|
|
@@ -113,49 +135,50 @@ const forApiGateway = (config, context) => {
|
|
|
113
135
|
// 7. event normalization (before) - reconciles a v1/v2 request
|
|
114
136
|
// 8. trail (before) - injects trail context
|
|
115
137
|
// 9. introspection (before) - short-circuits an introspect request
|
|
116
|
-
// 10.
|
|
138
|
+
// 10. input validation (before) - validates { headers, payload } against schema.input
|
|
117
139
|
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
140
|
+
// the order carries the load, on two axes — middy holds the hook phases in opposite orders, and
|
|
141
|
+
// a break on either axis no-ops silently: no throw, no log, no type error. state your entry's
|
|
142
|
+
// needs against both before you place it.
|
|
121
143
|
//
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
//
|
|
144
|
+
// `before` — forward order. an entry that reads what another `before` produces sits at a
|
|
145
|
+
// higher index. producers: 7 -> unified `request.event`; 8 -> `request.context.log` +
|
|
146
|
+
// `isContempCaller`; 10 -> the validated `event.headers` + `event.payload`
|
|
125
147
|
//
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
148
|
+
// `after` / `onError` — reverse order, since middy `unshift`s them. an entry whose `onError`
|
|
149
|
+
// reads `request.response` sits at a lower index than the builders (1,2) that set it.
|
|
150
|
+
// entry 0 is last on both hooks, the only slot that can correct a header the serializer
|
|
151
|
+
// already stamped
|
|
130
152
|
//
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
//
|
|
153
|
+
// the `onError` family that reads `request.response` — membership by cause, never by guard
|
|
154
|
+
// syntax (the vendors test `=== undefined`, the io logger tests truthiness):
|
|
155
|
+
// 0 genContentTypeCoherenceMiddleware -> runs last, sees the response
|
|
156
|
+
// 3 genIoLoggerMiddleware -> runs early, response undefined
|
|
157
|
+
// 5 @middy/http-cors -> so no cors on a 4xx/5xx
|
|
158
|
+
// 6 @middy/http-security-headers -> so no owasp on a 4xx/5xx
|
|
137
159
|
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
160
|
+
// the three that no-op are one deferred fix — the reorder also moves the success-path `after`
|
|
161
|
+
// order for every handler. the `before` axis is violated too; see the note on entry 3.
|
|
162
|
+
// `.dream/v2026_09_22.fix.no-cors-or-owasp-headers-on-error-responses.md`
|
|
140
163
|
const middlewares = [
|
|
141
164
|
(0, genContentTypeCoherenceMiddleware_1.genContentTypeCoherenceMiddleware)(),
|
|
142
165
|
/**
|
|
143
|
-
* .note = both keep the invocation a
|
|
166
|
+
* .note = both keep the invocation a success — a caller fault must not emit a cloudwatch
|
|
144
167
|
* error (invariant.badrequesterror-not-lambda-error) — and the 500 body carries a
|
|
145
168
|
* generic message plus the correlation id, never the error's own message
|
|
146
169
|
*
|
|
147
|
-
* .note = this family is
|
|
170
|
+
* .note = this family is always-ancient by construction, so the shared middleware's
|
|
148
171
|
* `isContempCaller` branch resolves one way and needs no guard: an http payload is
|
|
149
172
|
* an api-gateway envelope, which `getIsWrappedPayload` cannot match, and where trail
|
|
150
173
|
* never ran `asContextTrailed` defaults the flag to `false`
|
|
151
174
|
*/
|
|
152
175
|
(0, genConstraintErrorMiddleware_1.genConstraintErrorMiddleware)({
|
|
153
|
-
asOutputAfter: (
|
|
176
|
+
asOutputAfter: (payload) => (0, asApiGatewayResponseOnwireJson_1.asApiGatewayResponseOnwireJson)({ status: 400, payload }),
|
|
154
177
|
}),
|
|
155
178
|
(0, genInternalServiceErrorMiddleware_1.genInternalServiceErrorMiddleware)({
|
|
156
|
-
asOutputAfter: ({ exid }) => (0,
|
|
179
|
+
asOutputAfter: ({ exid }) => (0, asApiGatewayResponseOnwireJson_1.asApiGatewayResponseOnwireJson)({
|
|
157
180
|
status: 500,
|
|
158
|
-
|
|
181
|
+
payload: {
|
|
159
182
|
errorMessage: 'internal server error',
|
|
160
183
|
errorType: 'InternalServiceError',
|
|
161
184
|
...(exid ? { correlationId: exid } : {}),
|
|
@@ -163,9 +186,9 @@ const forApiGateway = (config, context) => {
|
|
|
163
186
|
}),
|
|
164
187
|
}),
|
|
165
188
|
/**
|
|
166
|
-
*
|
|
189
|
+
* .breaks the `before` axis, deliberately — this reads `request.context.log`, which
|
|
167
190
|
* `genTrailMiddleware` (8) produces, so `handler.input` never logs. the record is on
|
|
168
|
-
* `logTranslate`; the repair moves
|
|
191
|
+
* `logTranslate`; the repair moves trail to index 3, never this entry — trail declares
|
|
169
192
|
* only a `before`, so its move cannot disturb the `after`/`onError` order
|
|
170
193
|
*/
|
|
171
194
|
(0, genIoLoggerMiddleware_1.genIoLoggerMiddleware)({ logTranslate: config.logTranslate }),
|
|
@@ -174,36 +197,39 @@ const forApiGateway = (config, context) => {
|
|
|
174
197
|
defaultContentType: 'application/json',
|
|
175
198
|
}),
|
|
176
199
|
/**
|
|
177
|
-
*
|
|
200
|
+
* .breaks the `onError` axis, deliberately — these two sit below the error builders, so
|
|
178
201
|
* their `onError` hooks run first, see no response, and no-op. that is limit 2 on
|
|
179
202
|
* `CorsConfig`. the repair also moves their `after` hooks relative to the serializer,
|
|
180
|
-
* so it changes every
|
|
203
|
+
* so it changes every success response's headers too
|
|
181
204
|
*/
|
|
182
205
|
...(config.cors ? [(0, http_cors_1.default)(corsInputToCorsConfig(config.cors))] : []),
|
|
183
206
|
(0, http_security_headers_1.default)({
|
|
184
207
|
frameOptions: { action: 'DENY' },
|
|
185
208
|
}),
|
|
186
|
-
(0,
|
|
209
|
+
(0, genApiGatewayRequestEventNormalizationMiddleware_1.genApiGatewayRequestEventNormalizationMiddleware)({
|
|
210
|
+
parsePayload: deserialize.payload,
|
|
211
|
+
}),
|
|
187
212
|
(0, genTrailMiddleware_1.genTrailMiddleware)(),
|
|
188
213
|
(0, genIntrospectionMiddleware_1.genIntrospectionMiddleware)({
|
|
189
214
|
schema: config.schema,
|
|
190
215
|
env: context?.env,
|
|
191
216
|
/**
|
|
192
|
-
* .what = this family keeps `inputAfter` at `event.
|
|
217
|
+
* .what = this family keeps `inputAfter` at `event.payload`, and owes an
|
|
218
|
+
* `ApiGatewayResponseOnwire` back
|
|
193
219
|
* .why = `request.event` must stay http-shaped for `@middy/http-cors`, so the caller's
|
|
194
|
-
* value rides at `event.
|
|
195
|
-
* short-circuit bypasses the serializer, so the body is
|
|
220
|
+
* value rides at `event.payload` rather than in the event's place. and the
|
|
221
|
+
* short-circuit bypasses the serializer, so the body is encoded here
|
|
196
222
|
*/
|
|
197
|
-
asInputAfter: (request) => request.event?.
|
|
198
|
-
asOutputAfter: (schema) => (0,
|
|
223
|
+
asInputAfter: (request) => request.event?.payload,
|
|
224
|
+
asOutputAfter: (schema) => (0, asApiGatewayResponseOnwireJson_1.asApiGatewayResponseOnwireJson)({ status: 200, payload: schema }),
|
|
199
225
|
}),
|
|
200
|
-
(0,
|
|
226
|
+
(0, genZodInputValidationMiddleware_1.genZodInputValidationMiddleware)({ schema: config.schema.input }),
|
|
201
227
|
];
|
|
202
228
|
/**
|
|
203
229
|
* .as = the chain translates both ends, and typescript cannot track a transform across a
|
|
204
230
|
* middleware chain:
|
|
205
|
-
* - input:
|
|
206
|
-
* - output:
|
|
231
|
+
* - input: ApiGatewayRequestEventOnwire -> TPayload (before logic)
|
|
232
|
+
* - output: ApiGatewayResponseOnwire<TBody> -> ApiGatewayResponseOnwire (after)
|
|
207
233
|
* the second is the serializer's step — it encodes the body to bytes
|
|
208
234
|
* .removal = drops if middy gains typed inference across `.use`; every shape it spans is
|
|
209
235
|
* already named, so only the cast is owed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genLambdaEndpoint.forApiGateway.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAChC,iEAAwC;AACxC,+FAAqE;AACrE,yFAA+D;AAE/D,mDAAkD;AAQlD,4DAAyD;AACzD,6FAA0F;AAC1F,uGAAoG;AACpG,yFAAsF;AACtF,+EAA4E;AAC5E,yEAAsE;AACtE,yEAAsE;
|
|
1
|
+
{"version":3,"file":"genLambdaEndpoint.forApiGateway.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* .what = lists which aws wire
|
|
2
|
+
* .what = lists which aws response-wire keys a handler's response carries
|
|
3
3
|
* .why = one detector, so the public type-check and the handler-side guard cannot drift. the
|
|
4
4
|
* check needs a boolean; the guard needs the key NAMES to tell the author the fix
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const getAllResponseOnwireKeysFound: (input: {
|
|
7
7
|
response: object;
|
|
8
8
|
}) => string[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllResponseOnwireKeysFound = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = the wire keys an author who knows aws's response shape writes from habit, every one
|
|
6
|
+
* of which the encode would drop without a word
|
|
7
|
+
*
|
|
8
|
+
* .note = two of these are severe, and both for one reason: the field's name changed, so a
|
|
9
|
+
* return that still uses the wire word is silently wrong rather than refused —
|
|
10
|
+
*
|
|
11
|
+
* statusCode -> status `status ?? 200` replaces a caller's 404 with a 200, and
|
|
12
|
+
* double-encodes the body they already stringified
|
|
13
|
+
* body -> payload the response emits empty and the author sees a bare 200
|
|
14
|
+
*
|
|
15
|
+
* the rest are deferred keys, quieter and equally silent
|
|
16
|
+
* .note = `body` is clamped by `[case15][t1]` — drop it from this record and that one test goes
|
|
17
|
+
* red (a 200 where a 500 is due) while its four siblings stay green
|
|
18
|
+
* (`rule.require.clamp-edge-cases`)
|
|
19
|
+
*
|
|
20
|
+
* .note = a `Record<K, true>` rather than a `string[]`, so the compiler holds it exhaustive: a
|
|
21
|
+
* list proves each entry is real and says not one word about an absent one, which is the
|
|
22
|
+
* drift that matters. drop a key and tsc raises TS2741
|
|
23
|
+
*/
|
|
24
|
+
const IS_KEY_OF_RESPONSE_WIRE_UNREAD = {
|
|
25
|
+
statusCode: true,
|
|
26
|
+
body: true,
|
|
27
|
+
multiValueHeaders: true,
|
|
28
|
+
isBase64Encoded: true,
|
|
29
|
+
cookies: true,
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* .what = the same list, as keys
|
|
33
|
+
* .why = one source of truth, so the exhaustive map and the iterated list cannot drift apart
|
|
34
|
+
*/
|
|
35
|
+
const KEYS_OF_RESPONSE_WIRE = Object.keys(IS_KEY_OF_RESPONSE_WIRE_UNREAD);
|
|
36
|
+
/**
|
|
37
|
+
* .what = lists which aws response-wire keys a handler's response carries
|
|
38
|
+
* .why = one detector, so the public type-check and the handler-side guard cannot drift. the
|
|
39
|
+
* check needs a boolean; the guard needs the key NAMES to tell the author the fix
|
|
40
|
+
*/
|
|
41
|
+
const getAllResponseOnwireKeysFound = (input) => KEYS_OF_RESPONSE_WIRE.filter((key) => key in input.response);
|
|
42
|
+
exports.getAllResponseOnwireKeysFound = getAllResponseOnwireKeysFound;
|
|
43
|
+
//# sourceMappingURL=getAllResponseOnwireKeysFound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllResponseOnwireKeysFound.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllResponseOnwireKeysFound.ts"],"names":[],"mappings":";;;AAqBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,8BAA8B,GAClC;IACE,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,IAAI;IACV,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,OAAO,EAAE,IAAI;CACd,CAAC;AAEJ;;;GAGG;AACH,MAAM,qBAAqB,GAAa,MAAM,CAAC,IAAI,CACjD,8BAA8B,CAC/B,CAAC;AAEF;;;;GAIG;AACI,MAAM,6BAA6B,GAAG,CAAC,KAE7C,EAAY,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;AAFhE,QAAA,6BAA6B,iCAEmC"}
|
|
@@ -3,4 +3,4 @@ import type { APIGatewayProxyEvent } from 'aws-lambda';
|
|
|
3
3
|
* .what = type guard for API Gateway v1 (REST API) events
|
|
4
4
|
* .why = enables detection of event format for middleware
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const getIsV1ApiGatewayRequestEvent: (event: unknown) => event is APIGatewayProxyEvent;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getIsV1ApiGatewayRequestEvent = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* .what = type guard for API Gateway v1 (REST API) events
|
|
6
6
|
* .why = enables detection of event format for middleware
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const getIsV1ApiGatewayRequestEvent = (event) => {
|
|
9
9
|
if (!event || typeof event !== 'object')
|
|
10
10
|
return false;
|
|
11
11
|
const obj = event;
|
|
12
12
|
// v1 events have httpMethod (v2 uses requestContext.http.method)
|
|
13
13
|
return typeof obj.httpMethod === 'string';
|
|
14
14
|
};
|
|
15
|
-
exports.
|
|
16
|
-
//# sourceMappingURL=
|
|
15
|
+
exports.getIsV1ApiGatewayRequestEvent = getIsV1ApiGatewayRequestEvent;
|
|
16
|
+
//# sourceMappingURL=getIsV1ApiGatewayRequestEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIsV1ApiGatewayRequestEvent.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayRequestEvent.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAC3C,KAAc,EACiB,EAAE;IACjC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,GAAG,GAAG,KAAgC,CAAC;IAE7C,iEAAiE;IACjE,OAAO,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,CAAC;AAC5C,CAAC,CAAC;AARW,QAAA,6BAA6B,iCAQxC"}
|
|
@@ -3,4 +3,4 @@ import type { APIGatewayProxyEventV2 } from 'aws-lambda';
|
|
|
3
3
|
* .what = type guard for api gateway v2 (http api) events
|
|
4
4
|
* .why = enables detection of event format for middleware
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const getIsV2ApiGatewayRequestEvent: (event: unknown) => event is APIGatewayProxyEventV2;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getIsV2ApiGatewayRequestEvent = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* .what = type guard for api gateway v2 (http api) events
|
|
6
6
|
* .why = enables detection of event format for middleware
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const getIsV2ApiGatewayRequestEvent = (event) => {
|
|
9
9
|
if (!event || typeof event !== 'object')
|
|
10
10
|
return false;
|
|
11
11
|
const obj = event;
|
|
12
12
|
// v2 events have version field set to '2.0'
|
|
13
13
|
return obj.version === '2.0';
|
|
14
14
|
};
|
|
15
|
-
exports.
|
|
16
|
-
//# sourceMappingURL=
|
|
15
|
+
exports.getIsV2ApiGatewayRequestEvent = getIsV2ApiGatewayRequestEvent;
|
|
16
|
+
//# sourceMappingURL=getIsV2ApiGatewayRequestEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getIsV2ApiGatewayRequestEvent.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayRequestEvent.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAC3C,KAAc,EACmB,EAAE;IACnC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,GAAG,GAAG,KAAgC,CAAC;IAE7C,4CAA4C;IAC5C,OAAO,GAAG,CAAC,OAAO,KAAK,KAAK,CAAC;AAC/B,CAAC,CAAC;AARW,QAAA,6BAA6B,iCAQxC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiGatewayResponse } from '../../../domain.objects/ApiGatewayResponse';
|
|
2
2
|
/**
|
|
3
3
|
* .what = checks that a value is an ApiGatewayResponse — an object with at least one of
|
|
4
|
-
* status, headers, or
|
|
4
|
+
* status, headers, or payload, and none of the aws response-wire keys
|
|
5
5
|
* .why = the type refuses `{}` at compile time, but a handler's return crosses an
|
|
6
6
|
* `unknown` boundary at run time (a js caller, an `any`, a cast). this is the
|
|
7
7
|
* runtime backstop for the invariants the type holds
|
|
@@ -10,10 +10,13 @@ import type { ApiGatewayResponse } from '../../../domain.objects/ApiGatewayRespo
|
|
|
10
10
|
* `schema.output`'s job; this exists so an empty, non-object, or wire-shaped return
|
|
11
11
|
* fails loud HERE rather than reach middy's `statusCode ??= 500` and emit a silent 500
|
|
12
12
|
*
|
|
13
|
-
* .note = the foreign-key half closes a
|
|
14
|
-
* `{ statusCode: 404, body: JSON.stringify(x) }` — the aws-native shape
|
|
15
|
-
*
|
|
16
|
-
* pass. it then lost its 404 to `status ?? 200` and had its body encoded twice
|
|
13
|
+
* .note = the foreign-key half closes a hazard the cardinality half cannot see.
|
|
14
|
+
* `{ statusCode: 404, body: JSON.stringify(x) }` — the aws-native shape — satisfies the
|
|
15
|
+
* cardinality half, then loses its 404 to `status ?? 200` and has its body encoded twice
|
|
17
16
|
* (rule.forbid.failhide)
|
|
17
|
+
*
|
|
18
|
+
* .note = `body` is a foreign key, since the envelope's body slot is `payload`, and
|
|
19
|
+
* `asApiGatewayResponseOnwire` reads `'payload' in response` — so it would drop a `body`
|
|
20
|
+
* with no word. the foreign-key half turns that silent drop into a throw that names the fix
|
|
18
21
|
*/
|
|
19
22
|
export declare const isApiGatewayResponse: import("type-fns").AssessWithAssure<unknown, ApiGatewayResponse<unknown>>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isApiGatewayResponse = void 0;
|
|
4
4
|
const type_fns_1 = require("type-fns");
|
|
5
|
-
const
|
|
5
|
+
const getAllResponseOnwireKeysFound_1 = require("./getAllResponseOnwireKeysFound");
|
|
6
6
|
/**
|
|
7
7
|
* .what = checks that a value is an ApiGatewayResponse — an object with at least one of
|
|
8
|
-
* status, headers, or
|
|
8
|
+
* status, headers, or payload, and none of the aws response-wire keys
|
|
9
9
|
* .why = the type refuses `{}` at compile time, but a handler's return crosses an
|
|
10
10
|
* `unknown` boundary at run time (a js caller, an `any`, a cast). this is the
|
|
11
11
|
* runtime backstop for the invariants the type holds
|
|
@@ -14,11 +14,14 @@ const getAllWirePayloadKeysFound_1 = require("./getAllWirePayloadKeysFound");
|
|
|
14
14
|
* `schema.output`'s job; this exists so an empty, non-object, or wire-shaped return
|
|
15
15
|
* fails loud HERE rather than reach middy's `statusCode ??= 500` and emit a silent 500
|
|
16
16
|
*
|
|
17
|
-
* .note = the foreign-key half closes a
|
|
18
|
-
* `{ statusCode: 404, body: JSON.stringify(x) }` — the aws-native shape
|
|
19
|
-
*
|
|
20
|
-
* pass. it then lost its 404 to `status ?? 200` and had its body encoded twice
|
|
17
|
+
* .note = the foreign-key half closes a hazard the cardinality half cannot see.
|
|
18
|
+
* `{ statusCode: 404, body: JSON.stringify(x) }` — the aws-native shape — satisfies the
|
|
19
|
+
* cardinality half, then loses its 404 to `status ?? 200` and has its body encoded twice
|
|
21
20
|
* (rule.forbid.failhide)
|
|
21
|
+
*
|
|
22
|
+
* .note = `body` is a foreign key, since the envelope's body slot is `payload`, and
|
|
23
|
+
* `asApiGatewayResponseOnwire` reads `'payload' in response` — so it would drop a `body`
|
|
24
|
+
* with no word. the foreign-key half turns that silent drop into a throw that names the fix
|
|
22
25
|
*/
|
|
23
26
|
exports.isApiGatewayResponse = (0, type_fns_1.withAssure)((input) => {
|
|
24
27
|
// reject a non-object; a response is always an envelope
|
|
@@ -28,9 +31,9 @@ exports.isApiGatewayResponse = (0, type_fns_1.withAssure)((input) => {
|
|
|
28
31
|
if (Array.isArray(input))
|
|
29
32
|
return false;
|
|
30
33
|
// reject the aws wire shape; no step here reads its keys, so they would vanish
|
|
31
|
-
if ((0,
|
|
34
|
+
if ((0, getAllResponseOnwireKeysFound_1.getAllResponseOnwireKeysFound)({ response: input }).length)
|
|
32
35
|
return false;
|
|
33
36
|
// require at least one of the three fields — this is what PickAny encodes
|
|
34
|
-
return 'status' in input || 'headers' in input || '
|
|
37
|
+
return 'status' in input || 'headers' in input || 'payload' in input;
|
|
35
38
|
}, { name: 'isApiGatewayResponse' });
|
|
36
39
|
//# sourceMappingURL=isApiGatewayResponse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isApiGatewayResponse.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAGtC,
|
|
1
|
+
{"version":3,"file":"isApiGatewayResponse.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAGtC,mFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,oBAAoB,GAAG,IAAA,qBAAU,EAC5C,CAAC,KAAc,EAAwC,EAAE;IACvD,wDAAwD;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAE9D,2DAA2D;IAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEvC,+EAA+E;IAC/E,IAAI,IAAA,6DAA6B,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAE5E,0EAA0E;IAC1E,OAAO,QAAQ,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,CAAC;AACvE,CAAC,EACD,EAAE,IAAI,EAAE,sBAAsB,EAAE,CACjC,CAAC"}
|
|
@@ -4,12 +4,12 @@ import type middy from '@middy/core';
|
|
|
4
4
|
* .why = the api-gateway chain must read the same whichever version the trigger delivers, so
|
|
5
5
|
* this runs first and every step after it reads one shape
|
|
6
6
|
*
|
|
7
|
-
* .note = this DELEGATES to `
|
|
7
|
+
* .note = this DELEGATES to `asApiGatewayRequestEventUnified` rather than hold its own copy of the
|
|
8
8
|
* reconcile logic. one guarantee, one implementation, two entry points — a second
|
|
9
9
|
* copy would be the parallel code path (rule.forbid.parallel-codepaths)
|
|
10
10
|
*/
|
|
11
|
-
export declare const
|
|
12
|
-
|
|
11
|
+
export declare const genApiGatewayRequestEventNormalizationMiddleware: (input: {
|
|
12
|
+
parsePayload: boolean;
|
|
13
13
|
}) => {
|
|
14
14
|
before: middy.MiddlewareFn<any, any>;
|
|
15
15
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.genApiGatewayRequestEventNormalizationMiddleware = void 0;
|
|
4
|
+
const asApiGatewayRequestEventUnified_1 = require("../asApiGatewayRequestEventUnified");
|
|
5
5
|
/**
|
|
6
6
|
* .what = replaces the event with the v1/v2-reconciled shape
|
|
7
7
|
* .why = the api-gateway chain must read the same whichever version the trigger delivers, so
|
|
8
8
|
* this runs first and every step after it reads one shape
|
|
9
9
|
*
|
|
10
|
-
* .note = this DELEGATES to `
|
|
10
|
+
* .note = this DELEGATES to `asApiGatewayRequestEventUnified` rather than hold its own copy of the
|
|
11
11
|
* reconcile logic. one guarantee, one implementation, two entry points — a second
|
|
12
12
|
* copy would be the parallel code path (rule.forbid.parallel-codepaths)
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
14
|
+
const genApiGatewayRequestEventNormalizationMiddleware = (input) => {
|
|
15
15
|
const before = async (request) => {
|
|
16
16
|
/**
|
|
17
17
|
* .as = both casts exist because this middleware is typed `<any, any>`, so `request.event`
|
|
18
18
|
* is `any` on the way in and its declared type on the way out. the transform is
|
|
19
|
-
* real — `
|
|
19
|
+
* real — `ApiGatewayRequestEventOnwire` becomes `ApiGatewayRequestEventUnified` — and middy
|
|
20
20
|
* cannot track a shape change across a `before` hook
|
|
21
21
|
* .removal = drops when middy gains typed inference across `.use`, at which point the
|
|
22
22
|
* middleware's own two type parameters name these shapes and no cast is owed
|
|
23
23
|
*
|
|
24
24
|
* .note = DELIBERATE MUTATION — `request` is middy's only channel to hand a value onward
|
|
25
25
|
*/
|
|
26
|
-
request.event = (0,
|
|
26
|
+
request.event = (0, asApiGatewayRequestEventUnified_1.asApiGatewayRequestEventUnified)({ wire: request.event }, { deserialize: { payload: input.parsePayload } });
|
|
27
27
|
};
|
|
28
28
|
return { before };
|
|
29
29
|
};
|
|
30
|
-
exports.
|
|
31
|
-
//# sourceMappingURL=
|
|
30
|
+
exports.genApiGatewayRequestEventNormalizationMiddleware = genApiGatewayRequestEventNormalizationMiddleware;
|
|
31
|
+
//# sourceMappingURL=genApiGatewayRequestEventNormalizationMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genApiGatewayRequestEventNormalizationMiddleware.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.ts"],"names":[],"mappings":";;;AAGA,wFAAqF;AAErF;;;;;;;;GAQG;AACI,MAAM,gDAAgD,GAAG,CAAC,KAEhE,EAEC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D;;;;;;;;;WASG;QACH,OAAO,CAAC,KAAK,GAAG,IAAA,iEAA+B,EAC7C,EAAE,IAAI,EAAE,OAAO,CAAC,KAAqC,EAAE,EACvD,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,EAAE,CACd,CAAC;IACvC,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAvBW,QAAA,gDAAgD,oDAuB3D"}
|
|
@@ -5,10 +5,10 @@ import type middy from '@middy/core';
|
|
|
5
5
|
* the defect this whole affordance exists to retire. a 204 and a 308 each reach the wire
|
|
6
6
|
* body-less and would otherwise claim `application/json`
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
* so index 0 runs
|
|
10
|
-
* the header, and later than the error builders that set `request.response`.
|
|
11
|
-
* else, the `onError` hook meets an absent response and returns early
|
|
8
|
+
* .note = must be registered first in the chain array. middy `unshift`s `after` and `onError`,
|
|
9
|
+
* so index 0 runs last on both — the only position later than the serializer that
|
|
10
|
+
* stamps the header, and later than the error builders that set `request.response`.
|
|
11
|
+
* anywhere else, the `onError` hook meets an absent response and returns early
|
|
12
12
|
*
|
|
13
13
|
* .note = the same function serves both hooks, so one implementation holds the guarantee on
|
|
14
14
|
* either path. no error response is body-less today, so `onError` finds no work yet; it
|
|
@@ -7,10 +7,10 @@ exports.genContentTypeCoherenceMiddleware = void 0;
|
|
|
7
7
|
* the defect this whole affordance exists to retire. a 204 and a 308 each reach the wire
|
|
8
8
|
* body-less and would otherwise claim `application/json`
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* so index 0 runs
|
|
12
|
-
* the header, and later than the error builders that set `request.response`.
|
|
13
|
-
* else, the `onError` hook meets an absent response and returns early
|
|
10
|
+
* .note = must be registered first in the chain array. middy `unshift`s `after` and `onError`,
|
|
11
|
+
* so index 0 runs last on both — the only position later than the serializer that
|
|
12
|
+
* stamps the header, and later than the error builders that set `request.response`.
|
|
13
|
+
* anywhere else, the `onError` hook meets an absent response and returns early
|
|
14
14
|
*
|
|
15
15
|
* .note = the same function serves both hooks, so one implementation holds the guarantee on
|
|
16
16
|
* either path. no error response is body-less today, so `onError` finds no work yet; it
|
|
@@ -29,7 +29,7 @@ const genContentTypeCoherenceMiddleware = () => {
|
|
|
29
29
|
* declares the shape this chain always puts there — `httpSecurityHeaders`, `httpCors`,
|
|
30
30
|
* and the error builders each write a flat string map
|
|
31
31
|
* .removal = drops when middy gains typed response inference, at which point
|
|
32
|
-
* `
|
|
32
|
+
* `ApiGatewayResponseOnwire['headers']` types this member directly
|
|
33
33
|
*/
|
|
34
34
|
const headers = request.response.headers;
|
|
35
35
|
if (!headers)
|