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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asApiGatewayResponseOnwire = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = the default output translator: what `invoke` returns becomes the response wire
|
|
6
|
+
*
|
|
7
|
+
* .note = `status` defaults here, ahead of every middleware — middy's `normalizeHttpResponse`
|
|
8
|
+
* applies `statusCode ??= 500`, so a later default would put a server-fault on the wire
|
|
9
|
+
* for a handler that meant 200
|
|
10
|
+
*
|
|
11
|
+
* .note = this is the one line where the body changes its name. `payload` is the sdk's word for
|
|
12
|
+
* a body in both directions; `body` is aws's key on the wire result. the rename happens
|
|
13
|
+
* here and nowhere else, so no other file holds both senses at once
|
|
14
|
+
*
|
|
15
|
+
* .note = the body is omitted, never `''` — the serializer would encode `''` into `'""'`. it is
|
|
16
|
+
* left as the domain value for the serializer to encode one step later, which is what
|
|
17
|
+
* lets a handler's own `Content-Type` carry bytes through untouched. the omission holds
|
|
18
|
+
* at the wire rather than mid-chain: the serializer re-adds `body` as an own key with
|
|
19
|
+
* value `undefined`, which is benign and visible in the unit snapshots
|
|
20
|
+
*/
|
|
21
|
+
const asApiGatewayResponseOnwire = (input) => ({
|
|
22
|
+
statusCode: input.response.status ?? 200,
|
|
23
|
+
...(input.response.headers ? { headers: input.response.headers } : {}),
|
|
24
|
+
...('payload' in input.response ? { body: input.response.payload } : {}),
|
|
25
|
+
});
|
|
26
|
+
exports.asApiGatewayResponseOnwire = asApiGatewayResponseOnwire;
|
|
27
|
+
//# sourceMappingURL=asApiGatewayResponseOnwire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asApiGatewayResponseOnwire.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,0BAA0B,GAAG,CAAW,KAEpD,EAAsC,EAAE,CAAC,CAAC;IACzC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG;IACxC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,GAAG,CAAC,SAAS,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CACzE,CAAC,CAAC;AANU,QAAA,0BAA0B,8BAMpC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApiGatewayResponseOnwire } from '../../../domain.objects/ApiGatewayResponseOnwire';
|
|
2
2
|
/**
|
|
3
|
-
* .what = the wire
|
|
3
|
+
* .what = the response wire for a body this family must encode itself, as json
|
|
4
4
|
* .why = three middleware entries short-circuit the chain — the 400 builder, the 500 builder,
|
|
5
|
-
* and the introspection reply — and a short-circuit
|
|
5
|
+
* and the introspection reply — and a short-circuit bypasses the response serializer,
|
|
6
6
|
* so each owes the wire an already-encoded body plus its own `Content-Type`. all three
|
|
7
7
|
* route through here; a fourth short-circuit owes the same
|
|
8
8
|
*
|
|
9
|
-
* .note = this is the
|
|
10
|
-
* differ on exactly one axis —
|
|
11
|
-
* - `
|
|
9
|
+
* .note = this is the twin of `asApiGatewayResponseOnwire`, never a replacement. the two
|
|
10
|
+
* differ on exactly one axis — who encodes the body:
|
|
11
|
+
* - `asApiGatewayResponseOnwire` leaves the body a domain value, for the serializer
|
|
12
12
|
* to encode one step later. that is the handler's path
|
|
13
|
-
* -
|
|
13
|
+
* - this one encodes here, because no serializer step follows a short-circuit
|
|
14
14
|
*
|
|
15
15
|
* .note = the `Content-Type` is stamped unconditionally, which is also what makes the encode
|
|
16
16
|
* safe to do here: `genContentTypeCoherenceMiddleware` demands a body and a
|
|
17
17
|
* content-type agree, and `httpResponseSerializer` skips a response that already
|
|
18
18
|
* declares one — so a second encode cannot double-wrap this body
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* .note = the test doubles that restate this shape stay independent on purpose. a test that
|
|
21
21
|
* imported this transformer could no longer prove this transformer's shape
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const asApiGatewayResponseOnwireJson: (input: {
|
|
24
24
|
status: number;
|
|
25
|
-
|
|
26
|
-
}) =>
|
|
25
|
+
payload: unknown;
|
|
26
|
+
}) => ApiGatewayResponseOnwire;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.asApiGatewayResponseOnwireJson = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* .what = the wire
|
|
5
|
+
* .what = the response wire for a body this family must encode itself, as json
|
|
6
6
|
* .why = three middleware entries short-circuit the chain — the 400 builder, the 500 builder,
|
|
7
|
-
* and the introspection reply — and a short-circuit
|
|
7
|
+
* and the introspection reply — and a short-circuit bypasses the response serializer,
|
|
8
8
|
* so each owes the wire an already-encoded body plus its own `Content-Type`. all three
|
|
9
9
|
* route through here; a fourth short-circuit owes the same
|
|
10
10
|
*
|
|
11
|
-
* .note = this is the
|
|
12
|
-
* differ on exactly one axis —
|
|
13
|
-
* - `
|
|
11
|
+
* .note = this is the twin of `asApiGatewayResponseOnwire`, never a replacement. the two
|
|
12
|
+
* differ on exactly one axis — who encodes the body:
|
|
13
|
+
* - `asApiGatewayResponseOnwire` leaves the body a domain value, for the serializer
|
|
14
14
|
* to encode one step later. that is the handler's path
|
|
15
|
-
* -
|
|
15
|
+
* - this one encodes here, because no serializer step follows a short-circuit
|
|
16
16
|
*
|
|
17
17
|
* .note = the `Content-Type` is stamped unconditionally, which is also what makes the encode
|
|
18
18
|
* safe to do here: `genContentTypeCoherenceMiddleware` demands a body and a
|
|
19
19
|
* content-type agree, and `httpResponseSerializer` skips a response that already
|
|
20
20
|
* declares one — so a second encode cannot double-wrap this body
|
|
21
21
|
*
|
|
22
|
-
*
|
|
22
|
+
* .note = the test doubles that restate this shape stay independent on purpose. a test that
|
|
23
23
|
* imported this transformer could no longer prove this transformer's shape
|
|
24
24
|
*/
|
|
25
|
-
const
|
|
25
|
+
const asApiGatewayResponseOnwireJson = (input) => ({
|
|
26
26
|
statusCode: input.status,
|
|
27
|
-
body: JSON.stringify(input.
|
|
27
|
+
body: JSON.stringify(input.payload),
|
|
28
28
|
headers: { 'Content-Type': 'application/json' },
|
|
29
29
|
});
|
|
30
|
-
exports.
|
|
31
|
-
//# sourceMappingURL=
|
|
30
|
+
exports.asApiGatewayResponseOnwireJson = asApiGatewayResponseOnwireJson;
|
|
31
|
+
//# sourceMappingURL=asApiGatewayResponseOnwireJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asApiGatewayResponseOnwireJson.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwireJson.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,8BAA8B,GAAG,CAAC,KAG9C,EAA4B,EAAE,CAAC,CAAC;IAC/B,UAAU,EAAE,KAAK,CAAC,MAAM;IACxB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC;IACnC,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;CAChD,CAAC,CAAC;AAPU,QAAA,8BAA8B,kCAOxC"}
|
|
@@ -1,25 +1,51 @@
|
|
|
1
1
|
import { type ZodSchema } from 'zod';
|
|
2
2
|
import type { ApiGatewayResponse } from '../../../domain.objects/ApiGatewayResponse';
|
|
3
3
|
/**
|
|
4
|
-
* .what = lifts a
|
|
5
|
-
* .why = `schema.output` describes the whole response (`outputBefore`), never the
|
|
4
|
+
* .what = lifts a payload schema into the response-envelope schema
|
|
5
|
+
* .why = `schema.output` describes the whole response (`outputBefore`), never the payload
|
|
6
6
|
* inside it — so a reader can line the schema up against the pipeline. this keeps
|
|
7
7
|
* the common case a one-liner instead of a hand-written envelope per call site
|
|
8
8
|
*
|
|
9
|
-
* .note = `
|
|
10
|
-
* the argument must say which one it supplies
|
|
9
|
+
* .note = `payload` is named rather than positional because the envelope holds three fields, so
|
|
10
|
+
* the argument must say which one it supplies. it is the same word `ApiGatewayResponse`
|
|
11
|
+
* uses, deliberately — an argument that named the key `body` would reintroduce the one
|
|
12
|
+
* synonym this contract retires
|
|
11
13
|
*
|
|
12
|
-
* .note = every field is optional in the schema, since `PickAny` lets a handler supply
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* .note = every field is optional in the schema, since `PickAny` lets a handler supply any
|
|
15
|
+
* non-empty subset. the at-least-one rule is held by the type at compile time; this
|
|
16
|
+
* schema guards the field types
|
|
17
|
+
*
|
|
18
|
+
* .note for a BODY-LESS response = `z.undefined()`, `z.void()` and `z.never()` are now
|
|
19
|
+
* EQUIVALENT, and each publishes honestly. all three accept `{ status: 204 }`, all
|
|
20
|
+
* three refuse an accidental `{ body: 'oops' }`, and all three serialize to
|
|
21
|
+
* `{ "not": {} }` — "no body is ever carried". there is no introspection penalty
|
|
22
|
+
* for any of them
|
|
23
|
+
*
|
|
24
|
+
* ⇒ **`z.undefined()` is the named idiom** — the readme states it, this spec's
|
|
25
|
+
* cases declare it, and it names what the value IS: the `body` key is absent, and
|
|
26
|
+
* `undefined` is the js word for absent. `z.never()` is a type-theory bottom type,
|
|
27
|
+
* which claims more than the domain means
|
|
28
|
+
*
|
|
29
|
+
* what to AVOID is `z.any()` / `z.unknown()`, which publish `{}` — a rubber-stamp
|
|
30
|
+
* that tells a caller ANY body may arrive, the one your handler never sends as well
|
|
31
|
+
*
|
|
32
|
+
* ⚠️ .this was NOT always so = `z.undefined()` and `z.void()` used to throw
|
|
33
|
+
* `Undefined cannot be represented in JSON Schema`, and the throw took down
|
|
34
|
+
* `getAllLambdaContracts` for the WHOLE service once `{ introspect: 'schema' }`
|
|
35
|
+
* arrived in `prep`. it was position-INDEPENDENT, so the `.optional()` this function
|
|
36
|
+
* adds was no shelter. `getJsonSchemaFromZod` now renders both shapes via an
|
|
37
|
+
* `override`, so the hazard is closed at the one door rather than dodged per schema
|
|
38
|
+
* .measured = `[case17]` of the peer spec drives all three candidates through a REAL
|
|
39
|
+
* introspection request and grades each. `[t1]` goes red if the render
|
|
40
|
+
* regresses to a throw
|
|
15
41
|
*
|
|
16
42
|
* .as = zod cannot express "at least one key present", so it infers `{ status?, headers?,
|
|
17
|
-
*
|
|
43
|
+
* payload? }` — a superset of `PickAny` by exactly one member, `{}` — and no structural
|
|
18
44
|
* assignment relates the two
|
|
19
|
-
*
|
|
45
|
+
* .note for a direct consumer = this schema is publicly exported, and on its own it accepts
|
|
20
46
|
* `{}`. inside `forApiGateway` that is unreachable — `isApiGatewayResponse.assure`
|
|
21
47
|
* refuses an empty response before this schema is ever reached — but a consumer who
|
|
22
|
-
* validates against this schema
|
|
48
|
+
* validates against this schema directly inherits no such guard. so pair it with the
|
|
23
49
|
* `ApiGatewayResponse` type (which refuses `{}` at compile time) rather than treat a
|
|
24
50
|
* parse as the whole check
|
|
25
51
|
*
|
|
@@ -28,6 +54,6 @@ import type { ApiGatewayResponse } from '../../../domain.objects/ApiGatewayRespo
|
|
|
28
54
|
* compile-time guarantee lives in `ApiGatewayResponse` and the runtime guarantee
|
|
29
55
|
* lives here, and this cast is the seam between them
|
|
30
56
|
*/
|
|
31
|
-
export declare const asApiGatewayResponseSchema: <
|
|
32
|
-
|
|
33
|
-
}) => ZodSchema<ApiGatewayResponse<
|
|
57
|
+
export declare const asApiGatewayResponseSchema: <TPayload>(input: {
|
|
58
|
+
payload: ZodSchema<TPayload>;
|
|
59
|
+
}) => ZodSchema<ApiGatewayResponse<TPayload>>;
|
|
@@ -3,25 +3,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.asApiGatewayResponseSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
/**
|
|
6
|
-
* .what = lifts a
|
|
7
|
-
* .why = `schema.output` describes the whole response (`outputBefore`), never the
|
|
6
|
+
* .what = lifts a payload schema into the response-envelope schema
|
|
7
|
+
* .why = `schema.output` describes the whole response (`outputBefore`), never the payload
|
|
8
8
|
* inside it — so a reader can line the schema up against the pipeline. this keeps
|
|
9
9
|
* the common case a one-liner instead of a hand-written envelope per call site
|
|
10
10
|
*
|
|
11
|
-
* .note = `
|
|
12
|
-
* the argument must say which one it supplies
|
|
11
|
+
* .note = `payload` is named rather than positional because the envelope holds three fields, so
|
|
12
|
+
* the argument must say which one it supplies. it is the same word `ApiGatewayResponse`
|
|
13
|
+
* uses, deliberately — an argument that named the key `body` would reintroduce the one
|
|
14
|
+
* synonym this contract retires
|
|
13
15
|
*
|
|
14
|
-
* .note = every field is optional in the schema, since `PickAny` lets a handler supply
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* .note = every field is optional in the schema, since `PickAny` lets a handler supply any
|
|
17
|
+
* non-empty subset. the at-least-one rule is held by the type at compile time; this
|
|
18
|
+
* schema guards the field types
|
|
19
|
+
*
|
|
20
|
+
* .note for a BODY-LESS response = `z.undefined()`, `z.void()` and `z.never()` are now
|
|
21
|
+
* EQUIVALENT, and each publishes honestly. all three accept `{ status: 204 }`, all
|
|
22
|
+
* three refuse an accidental `{ body: 'oops' }`, and all three serialize to
|
|
23
|
+
* `{ "not": {} }` — "no body is ever carried". there is no introspection penalty
|
|
24
|
+
* for any of them
|
|
25
|
+
*
|
|
26
|
+
* ⇒ **`z.undefined()` is the named idiom** — the readme states it, this spec's
|
|
27
|
+
* cases declare it, and it names what the value IS: the `body` key is absent, and
|
|
28
|
+
* `undefined` is the js word for absent. `z.never()` is a type-theory bottom type,
|
|
29
|
+
* which claims more than the domain means
|
|
30
|
+
*
|
|
31
|
+
* what to AVOID is `z.any()` / `z.unknown()`, which publish `{}` — a rubber-stamp
|
|
32
|
+
* that tells a caller ANY body may arrive, the one your handler never sends as well
|
|
33
|
+
*
|
|
34
|
+
* ⚠️ .this was NOT always so = `z.undefined()` and `z.void()` used to throw
|
|
35
|
+
* `Undefined cannot be represented in JSON Schema`, and the throw took down
|
|
36
|
+
* `getAllLambdaContracts` for the WHOLE service once `{ introspect: 'schema' }`
|
|
37
|
+
* arrived in `prep`. it was position-INDEPENDENT, so the `.optional()` this function
|
|
38
|
+
* adds was no shelter. `getJsonSchemaFromZod` now renders both shapes via an
|
|
39
|
+
* `override`, so the hazard is closed at the one door rather than dodged per schema
|
|
40
|
+
* .measured = `[case17]` of the peer spec drives all three candidates through a REAL
|
|
41
|
+
* introspection request and grades each. `[t1]` goes red if the render
|
|
42
|
+
* regresses to a throw
|
|
17
43
|
*
|
|
18
44
|
* .as = zod cannot express "at least one key present", so it infers `{ status?, headers?,
|
|
19
|
-
*
|
|
45
|
+
* payload? }` — a superset of `PickAny` by exactly one member, `{}` — and no structural
|
|
20
46
|
* assignment relates the two
|
|
21
|
-
*
|
|
47
|
+
* .note for a direct consumer = this schema is publicly exported, and on its own it accepts
|
|
22
48
|
* `{}`. inside `forApiGateway` that is unreachable — `isApiGatewayResponse.assure`
|
|
23
49
|
* refuses an empty response before this schema is ever reached — but a consumer who
|
|
24
|
-
* validates against this schema
|
|
50
|
+
* validates against this schema directly inherits no such guard. so pair it with the
|
|
25
51
|
* `ApiGatewayResponse` type (which refuses `{}` at compile time) rather than treat a
|
|
26
52
|
* parse as the whole check
|
|
27
53
|
*
|
|
@@ -33,7 +59,7 @@ const zod_1 = require("zod");
|
|
|
33
59
|
const asApiGatewayResponseSchema = (input) => zod_1.z.object({
|
|
34
60
|
status: zod_1.z.number().optional(),
|
|
35
61
|
headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
36
|
-
|
|
62
|
+
payload: input.payload.optional(),
|
|
37
63
|
});
|
|
38
64
|
exports.asApiGatewayResponseSchema = asApiGatewayResponseSchema;
|
|
39
65
|
//# sourceMappingURL=asApiGatewayResponseSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asApiGatewayResponseSchema.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AAIxC
|
|
1
|
+
{"version":3,"file":"asApiGatewayResponseSchema.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AAIxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACI,MAAM,0BAA0B,GAAG,CAAW,KAEpD,EAA2C,EAAE,CAC5C,OAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpD,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE;CAClC,CAAuD,CAAC;AAP9C,QAAA,0BAA0B,8BAOoB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ApiGatewayHeadersOnwire } from './ApiGatewayRequestEventUnified';
|
|
2
|
+
/**
|
|
3
|
+
* .what = re-keys a header bag with every key lowercased
|
|
4
|
+
* .why = rfc 9110 §5.1 makes http field names case-insensitive, so a bag that distinguishes
|
|
5
|
+
* `Authorization` from `authorization` contradicts its own protocol. every runtime in
|
|
6
|
+
* this path already lowercases — node, express, api gateway v2 — and a verbatim
|
|
7
|
+
* passthrough would be a third behavior this sdk invented
|
|
8
|
+
*
|
|
9
|
+
* .why a named transformer = the fold earns a name a test can aim at and a reader can find,
|
|
10
|
+
* rather than an inline `Object.fromEntries` inside the reconcile
|
|
11
|
+
* (rule.require.named-transformers)
|
|
12
|
+
*
|
|
13
|
+
* .note = it also absorbs the absent bag. v1 declares `headers` required and v2 declares it
|
|
14
|
+
* optional, so the wire union's member is `… | undefined`. a transformer that returns
|
|
15
|
+
* a bag either way deletes the `as`-cast the reconcile would otherwise owe here
|
|
16
|
+
* (rule.forbid.as-cast)
|
|
17
|
+
*
|
|
18
|
+
* .note = a later duplicate key wins, which is what every http runtime does when it folds
|
|
19
|
+
* `Accept` onto `accept`. the case cannot be recovered afterward, and that is the
|
|
20
|
+
* point: a reader who needs the wire's own letter-case reads `event._.raw`
|
|
21
|
+
*
|
|
22
|
+
* .note = "later" is a property of the input's construction order, never of this function.
|
|
23
|
+
* `Object.entries` walks the bag in its own insertion order and `Object.fromEntries`
|
|
24
|
+
* writes in that same order, so this transformer inherits whatever order the party
|
|
25
|
+
* that built the bag chose — aws, for a real trigger; a fixture literal, for a test.
|
|
26
|
+
* so to pin which of `Accept` / `accept` survives, pin the bag, never this file
|
|
27
|
+
*
|
|
28
|
+
* .note = the `input: { headers }` bag is the repo's transformer shape, never decoration: it
|
|
29
|
+
* makes `{ headers: undefined }` read as *the bag was absent* rather than as *no
|
|
30
|
+
* argument was supplied*, which is exactly the distinction the note above turns on
|
|
31
|
+
* (rule.require.input-context-pattern)
|
|
32
|
+
*/
|
|
33
|
+
export declare const asHeaderKeysLowercased: (input: {
|
|
34
|
+
headers: ApiGatewayHeadersOnwire | undefined;
|
|
35
|
+
}) => ApiGatewayHeadersOnwire;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asHeaderKeysLowercased = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = re-keys a header bag with every key lowercased
|
|
6
|
+
* .why = rfc 9110 §5.1 makes http field names case-insensitive, so a bag that distinguishes
|
|
7
|
+
* `Authorization` from `authorization` contradicts its own protocol. every runtime in
|
|
8
|
+
* this path already lowercases — node, express, api gateway v2 — and a verbatim
|
|
9
|
+
* passthrough would be a third behavior this sdk invented
|
|
10
|
+
*
|
|
11
|
+
* .why a named transformer = the fold earns a name a test can aim at and a reader can find,
|
|
12
|
+
* rather than an inline `Object.fromEntries` inside the reconcile
|
|
13
|
+
* (rule.require.named-transformers)
|
|
14
|
+
*
|
|
15
|
+
* .note = it also absorbs the absent bag. v1 declares `headers` required and v2 declares it
|
|
16
|
+
* optional, so the wire union's member is `… | undefined`. a transformer that returns
|
|
17
|
+
* a bag either way deletes the `as`-cast the reconcile would otherwise owe here
|
|
18
|
+
* (rule.forbid.as-cast)
|
|
19
|
+
*
|
|
20
|
+
* .note = a later duplicate key wins, which is what every http runtime does when it folds
|
|
21
|
+
* `Accept` onto `accept`. the case cannot be recovered afterward, and that is the
|
|
22
|
+
* point: a reader who needs the wire's own letter-case reads `event._.raw`
|
|
23
|
+
*
|
|
24
|
+
* .note = "later" is a property of the input's construction order, never of this function.
|
|
25
|
+
* `Object.entries` walks the bag in its own insertion order and `Object.fromEntries`
|
|
26
|
+
* writes in that same order, so this transformer inherits whatever order the party
|
|
27
|
+
* that built the bag chose — aws, for a real trigger; a fixture literal, for a test.
|
|
28
|
+
* so to pin which of `Accept` / `accept` survives, pin the bag, never this file
|
|
29
|
+
*
|
|
30
|
+
* .note = the `input: { headers }` bag is the repo's transformer shape, never decoration: it
|
|
31
|
+
* makes `{ headers: undefined }` read as *the bag was absent* rather than as *no
|
|
32
|
+
* argument was supplied*, which is exactly the distinction the note above turns on
|
|
33
|
+
* (rule.require.input-context-pattern)
|
|
34
|
+
*/
|
|
35
|
+
const asHeaderKeysLowercased = (input) => {
|
|
36
|
+
if (!input.headers)
|
|
37
|
+
return {};
|
|
38
|
+
return Object.fromEntries(Object.entries(input.headers).map(([key, value]) => [
|
|
39
|
+
key.toLowerCase(),
|
|
40
|
+
value,
|
|
41
|
+
]));
|
|
42
|
+
};
|
|
43
|
+
exports.asHeaderKeysLowercased = asHeaderKeysLowercased;
|
|
44
|
+
//# sourceMappingURL=asHeaderKeysLowercased.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asHeaderKeysLowercased.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAEtC,EAA2B,EAAE;IAC5B,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAE9B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAClD,GAAG,CAAC,WAAW,EAAE;QACjB,KAAK;KACN,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC"}
|
|
@@ -2,30 +2,30 @@ import middy from '@middy/core';
|
|
|
2
2
|
import type { Context } from 'aws-lambda';
|
|
3
3
|
import type { ContextLogTrail } from 'sdk-logs';
|
|
4
4
|
import type { ZodSchema } from 'zod';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ApiGatewayRequestEventOnwire } from '../../../domain.objects/ApiGatewayRequestEventOnwire';
|
|
6
6
|
import type { ApiGatewayResponse } from '../../../domain.objects/ApiGatewayResponse';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ApiGatewayResponseOnwire } from '../../../domain.objects/ApiGatewayResponseOnwire';
|
|
8
8
|
import type { ContextAwsLambdaServer } from '../../../domain.objects/ContextAwsLambdaServer';
|
|
9
|
+
import { type FrozenDeep } from '../setEventFrozen';
|
|
9
10
|
import type { TranslateLog } from '../TranslateLog';
|
|
10
|
-
import type {
|
|
11
|
+
import type { ApiGatewayHeadersDeclared, ApiGatewayHeadersMerged, ApiGatewayRequestEventUnified } from './ApiGatewayRequestEventUnified';
|
|
11
12
|
/**
|
|
12
13
|
* .what = the cors contract for an api-gateway handler
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
* the
|
|
16
|
-
*
|
|
17
|
-
* `.behavior/…/seeds/issue.cors-and-headers-on-every-non-success-path.md`
|
|
15
|
+
* .limits = two, both live. `[case11]` and `[case8]` of `local.httpResponse.acceptance.test.ts`
|
|
16
|
+
* assert the limited bytes, and the writeup is
|
|
17
|
+
* `.behavior/v2026_08_03.feat-apigateway-wire-response/seeds/issue.cors-and-headers-on-every-non-success-path.md`
|
|
18
18
|
*
|
|
19
|
-
* 1.
|
|
19
|
+
* 1. a preflight is answered by YOUR HANDLER. `@middy/http-cors` defaults
|
|
20
20
|
* `disableBeforePreflightResponse: true` (`index.js:16`), so an `OPTIONS` falls through
|
|
21
21
|
* the chain — and succeeds only where `schema.input` accepts a body-less request
|
|
22
22
|
*
|
|
23
|
-
* 2.
|
|
24
|
-
* `if (request.response === undefined) return` and sit
|
|
23
|
+
* 2. no error response carries cors or owasp headers. both vendors' `onError` hooks open
|
|
24
|
+
* `if (request.response === undefined) return` and sit above the error builders that set
|
|
25
25
|
* it, so both no-op. every 400 and 500 ships bare
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
* `OPTIONS` at the gateway with a
|
|
27
|
+
* .unverified = whether either is reachable in a DEPLOYED api gateway, which commonly answers
|
|
28
|
+
* `OPTIONS` at the gateway with a mock integration. both are measured against the local
|
|
29
29
|
* harness, where every request reaches the handler
|
|
30
30
|
*/
|
|
31
31
|
export interface CorsConfig {
|
|
@@ -57,68 +57,124 @@ export interface CorsConfig {
|
|
|
57
57
|
/**
|
|
58
58
|
* .what = input type for forApiGateway
|
|
59
59
|
* .why = sdk contract type, exported for consumer type inference
|
|
60
|
+
*
|
|
61
|
+
* .why `THeaders` is bound = the validator spreads the validated headers back over the wire bag
|
|
62
|
+
* (`genZodInputValidationMiddleware.ts:111`), so a `THeaders` that is not a record spreads
|
|
63
|
+
* as one: `{ ...'abc' }` yields `{ 0: 'a', 1: 'b', 2: 'c' }`, injected into the very slot
|
|
64
|
+
* `@middy/http-cors` reads. unbound, `headers: z.string()` type-checks and then fails at
|
|
65
|
+
* run time with no throw (`rule.require.illegal-states-unrepresentable`)
|
|
66
|
+
*
|
|
67
|
+
* .why the bound is a NAMED type = it holds at three declaration sites, one of them a
|
|
68
|
+
* separately-importable public export with no clamp of its own. written out three times it
|
|
69
|
+
* is kept in sync by prose; named once, a divergence is a type error at the declaration
|
|
70
|
+
* that drifts. see `ApiGatewayHeadersDeclared` for the shape and its reason
|
|
60
71
|
*/
|
|
61
|
-
export type ForApiGatewayInput<
|
|
72
|
+
export type ForApiGatewayInput<THeaders extends ApiGatewayHeadersDeclared, TPayload, TBody> = {
|
|
62
73
|
schema: {
|
|
63
74
|
/**
|
|
64
|
-
* .what = describes `inputAfter` —
|
|
75
|
+
* .what = describes `inputAfter` — the PAIR `invoke` receives, `{ headers?, payload }`
|
|
65
76
|
* .why = guards the point of consequence on the way in: a caller who sent the wrong
|
|
66
77
|
* shape is refused before the handler runs
|
|
78
|
+
*
|
|
79
|
+
* .note = `payload` is REQUIRED and `headers` is OPTIONAL, and the asymmetry traces to an
|
|
80
|
+
* axis rather than to taste. body validation is an EXTANT guarantee — 78 sites
|
|
81
|
+
* already get it, so an absent key would silently drop it. header validation is a
|
|
82
|
+
* NEW capability — headers have never been validated, so an absent key is the
|
|
83
|
+
* status quo and no request that succeeds today can be refused
|
|
84
|
+
* (`domain.terms/headers.md`)
|
|
85
|
+
*
|
|
86
|
+
* .note = declare `headers` and zod strips the keys you did not name — but only from the
|
|
87
|
+
* value YOUR schema returns. the sdk merges that back over the wire bag, so
|
|
88
|
+
* `origin` and `accept` stay readable by the vendors that need them
|
|
67
89
|
*/
|
|
68
|
-
input: ZodSchema<
|
|
90
|
+
input: ZodSchema<{
|
|
91
|
+
headers?: THeaders;
|
|
92
|
+
payload: TPayload;
|
|
93
|
+
}>;
|
|
69
94
|
/**
|
|
70
95
|
* .what = describes `outputBefore` — the whole response `invoke` returns
|
|
71
96
|
* .why = guards the point of consequence on the way out: a handler that built the
|
|
72
97
|
* wrong response is refused before the encode turns it into bytes
|
|
73
98
|
*
|
|
74
99
|
* .note = this describes the ENVELOPE, never the body inside it. use
|
|
75
|
-
* `asApiGatewayResponseSchema({
|
|
100
|
+
* `asApiGatewayResponseSchema({ payload })` to lift a body schema into one, and
|
|
76
101
|
* `z.any()` to opt out of validation entirely
|
|
77
102
|
*/
|
|
78
103
|
output: ZodSchema<ApiGatewayResponse<TBody>>;
|
|
79
104
|
};
|
|
80
105
|
invoke: (input: {
|
|
81
106
|
/**
|
|
82
|
-
* .what =
|
|
107
|
+
* .what = the request headers, keys lowercased — rfc 9110 §5.1 makes http field names
|
|
108
|
+
* case-insensitive, so `headers['Authorization']` and `headers['authorization']`
|
|
109
|
+
* cannot be two different keys
|
|
110
|
+
* .why lifted = it is the transport's metadata bag beside the body, a slot every family
|
|
111
|
+
* that carries such a bag names `headers` (`rule.require.consistent-variant-contracts`)
|
|
112
|
+
* .note = this IS `event.headers` — one object, two access paths. never a copy
|
|
113
|
+
* .why frozen = it is a slot of the envelope, so it freezes with it. `FrozenDeep` is what
|
|
114
|
+
* says so at compile time; see `event` below
|
|
83
115
|
*/
|
|
84
|
-
|
|
116
|
+
headers: FrozenDeep<ApiGatewayHeadersMerged<THeaders>>;
|
|
85
117
|
/**
|
|
86
|
-
* .what = the
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
118
|
+
* .what = the body, parsed and validated against `schema.input.payload`
|
|
119
|
+
* .why the word = http's own — rfc 9110 calls it the "payload body". the untouched wire
|
|
120
|
+
* string is at `event._.raw.body`; there is no unvalidated parsed body anywhere
|
|
121
|
+
* .note = this IS `event.payload` — one object, two access paths
|
|
122
|
+
* .why frozen = same as `headers`: a slot of the envelope, sealed with it
|
|
123
|
+
*/
|
|
124
|
+
payload: FrozenDeep<TPayload>;
|
|
125
|
+
/**
|
|
126
|
+
* .what = the whole object that arrived, v1/v2 reconciled; the wire form is at `._.raw`
|
|
127
|
+
* .why frozen = this is middy's own `request.event`, by reference — the object
|
|
128
|
+
* `@middy/http-cors` and `@middy/http-response-serializer` read in their `after`
|
|
129
|
+
* hooks, AFTER the handler has returned. a write through it corrupts what a vendor
|
|
130
|
+
* reads, so the freeze makes that unrepresentable
|
|
131
|
+
* .why not a copy = a copy removes the same hazard and destroys the projection —
|
|
132
|
+
* `headers === event.headers` would stop to hold, and the two could drift
|
|
133
|
+
* (`domain.terms/event.md`)
|
|
134
|
+
* .why `FrozenDeep` and not `Readonly` = `Readonly<T>` is shallow, so it would refuse
|
|
135
|
+
* `event.x = 1` and allow `event.headers.x = 1` — a write the deep runtime freeze
|
|
136
|
+
* then throws on, in production, with a `TypeError` that names no cause. this type
|
|
137
|
+
* states the guarantee the freeze enforces
|
|
138
|
+
* (`rule.require.illegal-states-unrepresentable`)
|
|
90
139
|
*/
|
|
91
|
-
|
|
140
|
+
event: FrozenDeep<ApiGatewayRequestEventUnified<{
|
|
141
|
+
headers: ApiGatewayHeadersMerged<THeaders>;
|
|
142
|
+
payload: TPayload;
|
|
143
|
+
}>>;
|
|
92
144
|
}, context: ContextLogTrail) => Promise<ApiGatewayResponse<TBody>>;
|
|
93
145
|
/**
|
|
94
146
|
* .what = projections applied to the io before it reaches cloudwatch
|
|
95
147
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
148
|
+
* .defect = LIVE, NOT FIXED — `logTranslate.input` never runs for this family; only `.output`
|
|
149
|
+
* fires. so a projection written here to redact request bodies is dead code, and
|
|
150
|
+
* the log it would have shaped is never emitted at all. redact inside `invoke`
|
|
151
|
+
* instead
|
|
100
152
|
*
|
|
101
|
-
*
|
|
102
|
-
* `genTrailMiddleware`'s `before` writes — and trail sits at a
|
|
103
|
-
* has not run yet. `before` hooks run in
|
|
153
|
+
* .the cause = `genIoLoggerMiddleware`'s `before` reads `context.log`, which
|
|
154
|
+
* `genTrailMiddleware`'s `before` writes — and trail sits at a higher index, so it
|
|
155
|
+
* has not run yet. `before` hooks run in forward array order
|
|
104
156
|
*
|
|
105
|
-
*
|
|
106
|
-
* is its positive control — same middleware, same option, trail at a
|
|
157
|
+
* .proof it is live = `[case16][t1]` asserts the log branch does not run, and is
|
|
158
|
+
* green. `[t0]` is its positive control — same middleware, same option, trail at a
|
|
159
|
+
* lower index
|
|
107
160
|
*
|
|
108
|
-
*
|
|
109
|
-
* probed:
|
|
110
|
-
* move also puts trail ahead of event normalization
|
|
161
|
+
* .repair, unapplied = move `genTrailMiddleware()` from index 8 to index 3. blast
|
|
162
|
+
* radius, probed: one assertion. left because `main` carries the identical order
|
|
163
|
+
* and the move also puts trail ahead of event normalization
|
|
111
164
|
*/
|
|
112
165
|
logTranslate?: TranslateLog;
|
|
113
166
|
cors?: CorsConfig;
|
|
114
167
|
deserialize?: {
|
|
115
168
|
/**
|
|
116
|
-
* .what = whether to deserialize json body
|
|
117
|
-
* .why = converts json string body
|
|
169
|
+
* .what = whether to deserialize the json body into `event.payload`
|
|
170
|
+
* .why = converts a json string body into an object
|
|
171
|
+
*
|
|
172
|
+
* .note = the key is `payload` because that is the slot it fills — `event.payload`. a
|
|
173
|
+
* toggle that named a field no shape carries is a toggle a reader cannot line up
|
|
118
174
|
*
|
|
119
175
|
* defaults to true; set to false for raw string input
|
|
120
176
|
*/
|
|
121
|
-
|
|
177
|
+
payload: boolean;
|
|
122
178
|
};
|
|
123
179
|
};
|
|
124
180
|
/** .what = sdk contract type for forApiGateway context, exported for consumer inference */
|
|
@@ -127,4 +183,4 @@ export type ForApiGatewayContext = ContextAwsLambdaServer;
|
|
|
127
183
|
* .what = generates an api-gateway lambda handler with http features
|
|
128
184
|
* .why = adds cors, security headers, error conversion, body serialization, and validation
|
|
129
185
|
*/
|
|
130
|
-
export declare const forApiGateway: <
|
|
186
|
+
export declare const forApiGateway: <THeaders extends ApiGatewayHeadersDeclared, TPayload, TBody>(config: ForApiGatewayInput<THeaders, TPayload, TBody>, context?: ContextAwsLambdaServer) => middy.MiddyfiedHandler<ApiGatewayRequestEventOnwire, ApiGatewayResponseOnwire, Error, Context>;
|