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
package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js
CHANGED
|
@@ -6,36 +6,44 @@ const getValidatedOutput_1 = require("./getValidatedOutput");
|
|
|
6
6
|
* .what = middleware that validates handler output against a zod schema
|
|
7
7
|
* .why = ensures type-safe output before the response is returned
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* .note = which shape this validates depends on where you register it. it reads
|
|
10
|
+
* `request.response`, and on the api-gateway path that slot holds a different type at
|
|
11
|
+
* different points in the chain:
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* before the output translator -> `ApiGatewayResponse<TBody>` (the handler's shape)
|
|
15
|
-
* after the output translator -> `ApiGatewayResponsePayload` (the wire form, body
|
|
16
|
-
* already a string)
|
|
13
|
+
* before the output translator -> `ApiGatewayResponse<TBody>` (the handler's shape)
|
|
14
|
+
* after the output translator -> `ApiGatewayResponseOnwire` (the wire form, body
|
|
15
|
+
* already a string)
|
|
17
16
|
*
|
|
18
17
|
* a schema written for one refuses the other, so a caller who composes this into a
|
|
19
18
|
* custom chain validates whichever shape their registration order produces. the
|
|
20
|
-
* signature cannot warn them — `request.response` is `unknown` to middy, so both bind
|
|
19
|
+
* signature cannot warn them — `request.response` is `unknown` to middy, so both bind
|
|
21
20
|
*
|
|
22
|
-
* .note =
|
|
23
|
-
* tracked as
|
|
24
|
-
*
|
|
21
|
+
* .note = unresolved, not a defect — this export carries two contracts with no discriminant.
|
|
22
|
+
* tracked as F33 in the fulcrum table of
|
|
23
|
+
* `.behavior/v2026_08_03.feat-apigateway-wire-response/1.vision.yield.md`, where the
|
|
24
|
+
* three options (deprecate, add a `point` discriminant, accept) are spelled out. the
|
|
25
|
+
* route is named in full on purpose: a later route adds its own `1.vision.yield.md`,
|
|
26
|
+
* and a bare filename then resolves to a table with no F33 in it.
|
|
25
27
|
*
|
|
26
28
|
* no shipped chain registers it — both families validate inline instead, because each
|
|
27
29
|
* knows which of the two shapes it holds at that moment and this middleware cannot. so
|
|
28
|
-
* the open question is one of surface area, never of a live defect
|
|
30
|
+
* the open question is one of surface area, never of a live defect
|
|
29
31
|
*
|
|
30
|
-
* .note = the validation itself is delegated to `getValidatedOutput`, as both input-side
|
|
31
|
-
* delegate to `
|
|
32
|
+
* .note = the validation itself is delegated to `getValidatedOutput`, exactly as both input-side
|
|
33
|
+
* peers delegate to `getValidatedInput` — one guarantee, one implementation, per border
|
|
32
34
|
* (rule.forbid.parallel-codepaths)
|
|
35
|
+
*
|
|
36
|
+
* the two root primitives are peers rather than one, because they make DIFFERENT
|
|
37
|
+
* guarantees: a bad input is the caller's fault and raises a `ConstraintError`, while a
|
|
38
|
+
* bad output is the server's fault and raises a `MalfunctionError`
|
|
39
|
+
* (rule.require.failloud). to merge them would need an error-class argument, which is a
|
|
40
|
+
* fork on handed config — the shape that rule forbids
|
|
33
41
|
*/
|
|
34
42
|
const genZodOutputValidationMiddleware = (input) => {
|
|
35
43
|
return {
|
|
36
44
|
after: async (request) => {
|
|
37
45
|
// replace response with validated data (defaults + transforms applied)
|
|
38
|
-
// .note =
|
|
46
|
+
// .note = deliberate mutation — `request` is middy's only channel to hand a value onward
|
|
39
47
|
request.response = (0, getValidatedOutput_1.getValidatedOutput)({
|
|
40
48
|
response: request.response,
|
|
41
49
|
schema: input.schema,
|
package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genZodOutputValidationMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.ts"],"names":[],"mappings":";;;AAGA,6DAA0D;AAE1D
|
|
1
|
+
{"version":3,"file":"genZodOutputValidationMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.ts"],"names":[],"mappings":";;;AAGA,6DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACI,MAAM,gCAAgC,GAAG,CAAU,KAEzD,EAAyC,EAAE;IAC1C,OAAO;QACL,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACvB,uEAAuE;YACvE,yFAAyF;YACzF,OAAO,CAAC,QAAQ,GAAG,IAAA,uCAAkB,EAAC;gBACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,gCAAgC,oCAa3C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ZodSchema } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* .what = validate a caller's value against an endpoint's input schema, and hand back the
|
|
4
|
+
* parsed result
|
|
5
|
+
* .why = this is the ONE root primitive for the input border. every family reaches it, so a
|
|
6
|
+
* guarantee added here — a coerce, a redaction, an error shape — lands once
|
|
7
|
+
*
|
|
8
|
+
* .note = the families differ only in WHICH VALUE they hand in, never in what validation means:
|
|
9
|
+
* `forAsk` hands the unwrapped body; `forApiGateway` and `forSqs` hand the
|
|
10
|
+
* `{ headers, payload }` pair. each family writes the result back into its own slots
|
|
11
|
+
*
|
|
12
|
+
* .note = the result is the POST-parse shape, so a schema that coerces (any `X.contract()`
|
|
13
|
+
* position) yields live domain instances rather than the plain objects that crossed the
|
|
14
|
+
* wire. the caller assigns it into its own slot
|
|
15
|
+
*/
|
|
16
|
+
export declare const getValidatedInput: <TInput>(input: {
|
|
17
|
+
schema: ZodSchema<TInput>;
|
|
18
|
+
value: unknown;
|
|
19
|
+
}) => TInput;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getValidatedInput = void 0;
|
|
4
|
+
const getValidationError_1 = require("./getValidationError");
|
|
5
|
+
/**
|
|
6
|
+
* .what = validate a caller's value against an endpoint's input schema, and hand back the
|
|
7
|
+
* parsed result
|
|
8
|
+
* .why = this is the ONE root primitive for the input border. every family reaches it, so a
|
|
9
|
+
* guarantee added here — a coerce, a redaction, an error shape — lands once
|
|
10
|
+
*
|
|
11
|
+
* .note = the families differ only in WHICH VALUE they hand in, never in what validation means:
|
|
12
|
+
* `forAsk` hands the unwrapped body; `forApiGateway` and `forSqs` hand the
|
|
13
|
+
* `{ headers, payload }` pair. each family writes the result back into its own slots
|
|
14
|
+
*
|
|
15
|
+
* .note = the result is the POST-parse shape, so a schema that coerces (any `X.contract()`
|
|
16
|
+
* position) yields live domain instances rather than the plain objects that crossed the
|
|
17
|
+
* wire. the caller assigns it into its own slot
|
|
18
|
+
*/
|
|
19
|
+
const getValidatedInput = (input) => {
|
|
20
|
+
const result = input.schema.safeParse(input.value);
|
|
21
|
+
if (!result.success)
|
|
22
|
+
throw (0, getValidationError_1.getValidationError)({ error: result.error });
|
|
23
|
+
return result.data;
|
|
24
|
+
};
|
|
25
|
+
exports.getValidatedInput = getValidatedInput;
|
|
26
|
+
//# sourceMappingURL=getValidatedInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getValidatedInput.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.ts"],"names":[],"mappings":";;;AAEA,6DAA0D;AAE1D;;;;;;;;;;;;;GAaG;AACI,MAAM,iBAAiB,GAAG,CAAS,KAGzC,EAAU,EAAE;IACX,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import type { ZodType } from 'zod';
|
|
2
|
+
import { type ZodIssueSummary } from './getZodIssuesSummary';
|
|
3
|
+
export interface OutputValidationErrorMetadata {
|
|
4
|
+
issues: ZodIssueSummary[];
|
|
5
|
+
hint: string;
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* .what = validates output against schema and returns typed result
|
|
4
9
|
* .why = named transformer for decode-friction-free validation in orchestrators
|
|
10
|
+
*
|
|
11
|
+
* .note = this is the ONE output-side validator, and the two families that answer a caller —
|
|
12
|
+
* `forAsk` and `forApiGateway` — call it DIRECTLY in their `logic`. so a repair here lands
|
|
13
|
+
* at both borders at once, as `getValidatedInput` does on the input side
|
|
14
|
+
*
|
|
15
|
+
* .why NOT through `genZodOutputValidationMiddleware` = that export wraps this function for a
|
|
16
|
+
* consumer who composes their own chain; no shipped chain registers it
|
|
17
|
+
*
|
|
18
|
+
* .why the parameter is `response` where its input twin takes `value` = at THIS border the value
|
|
19
|
+
* has one home — `request.response` — so the name states the slot. at the input border
|
|
20
|
+
* each family hands a different value, so `value` is the neutral name there
|
|
21
|
+
* (rule.prefer.names-by-position-over-claim)
|
|
5
22
|
*/
|
|
6
23
|
export declare const getValidatedOutput: <TOutput>(input: {
|
|
7
24
|
response: unknown;
|
|
@@ -3,15 +3,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getValidatedOutput = void 0;
|
|
4
4
|
const helpful_errors_1 = require("helpful-errors");
|
|
5
5
|
const getZodIssuesSummary_1 = require("./getZodIssuesSummary");
|
|
6
|
+
/**
|
|
7
|
+
* .what = the FIX half of the message a HANDLER AUTHOR meets when their own return is refused
|
|
8
|
+
* .why = `rule.require.errors-name-the-fix` asks for what, why, and the concrete next move. the
|
|
9
|
+
* zod summary supplies the first two; the third has to name an act the reader can perform
|
|
10
|
+
*
|
|
11
|
+
* ⚠️ .why it names a DIFFERENT fix than the input border = the audience inverts. an input
|
|
12
|
+
* failure is the CALLER's to fix, so its hint tells them what to send. an output failure
|
|
13
|
+
* is the HANDLER's to fix, and the caller has no move available at all — which is why
|
|
14
|
+
* this throws `MalfunctionError` where the input border throws `ConstraintError`
|
|
15
|
+
* (invariant.badrequesterror-not-lambda-error)
|
|
16
|
+
*
|
|
17
|
+
* 🔴 .why the constructor is named as a FACT rather than as the FIX = a prior draft of this hint
|
|
18
|
+
* read *"hand back the INSTANCE (`new X({ … })`) rather than a plain object"*, on the
|
|
19
|
+
* premise that `X.contract()` refuses a prop bag here. **that premise is measured FALSE.**
|
|
20
|
+
*
|
|
21
|
+
* - `X.contract()` COERCES, so a bag whose fields are correct PARSES and is handed back
|
|
22
|
+
* as an instance. the shape a handler returns is a TYPE-level contract, never a
|
|
23
|
+
* runtime gate, and the compiler enforces it unevenly — it demands the instance only
|
|
24
|
+
* where a union in the schema blocks inference of `TOutput` from the `invoke` return
|
|
25
|
+
* - ⇒ so bag-vs-instance is ORTHOGONAL to pass-vs-fail, and the DATA is what decides.
|
|
26
|
+
* a bag with a field absent throws HERE; `new X({ … })` built from that same data
|
|
27
|
+
* throws EARLIER, at construction, on the identical path
|
|
28
|
+
* - ⇒ a hint that names the constructor therefore names a move that does not fix the
|
|
29
|
+
* failure it is attached to, which is the defect `rule.require.errors-name-the-fix`
|
|
30
|
+
* exists to prevent
|
|
31
|
+
*/
|
|
32
|
+
const OUTPUT_VALIDATION_HINT = 'the handler returned a value its own declared output schema refuses — correct each path named in `issues`. ⚠️ a plain object is NOT the cause: `X.contract()` coerces, so a bag whose fields are correct parses here. `new X({ … })` is the TYPE-level contract, and it checks these same paths at construction instead';
|
|
6
33
|
/**
|
|
7
34
|
* .what = validates output against schema and returns typed result
|
|
8
35
|
* .why = named transformer for decode-friction-free validation in orchestrators
|
|
36
|
+
*
|
|
37
|
+
* .note = this is the ONE output-side validator, and the two families that answer a caller —
|
|
38
|
+
* `forAsk` and `forApiGateway` — call it DIRECTLY in their `logic`. so a repair here lands
|
|
39
|
+
* at both borders at once, as `getValidatedInput` does on the input side
|
|
40
|
+
*
|
|
41
|
+
* .why NOT through `genZodOutputValidationMiddleware` = that export wraps this function for a
|
|
42
|
+
* consumer who composes their own chain; no shipped chain registers it
|
|
43
|
+
*
|
|
44
|
+
* .why the parameter is `response` where its input twin takes `value` = at THIS border the value
|
|
45
|
+
* has one home — `request.response` — so the name states the slot. at the input border
|
|
46
|
+
* each family hands a different value, so `value` is the neutral name there
|
|
47
|
+
* (rule.prefer.names-by-position-over-claim)
|
|
9
48
|
*/
|
|
10
49
|
const getValidatedOutput = (input) => {
|
|
11
50
|
const result = input.schema.safeParse(input.response);
|
|
12
51
|
if (!result.success) {
|
|
13
52
|
const issues = (0, getZodIssuesSummary_1.getZodIssuesSummary)({ issues: result.error.issues });
|
|
14
|
-
throw new helpful_errors_1.MalfunctionError(
|
|
53
|
+
throw new helpful_errors_1.MalfunctionError(`output validation failed: ${(0, getZodIssuesSummary_1.asZodIssuesMessage)({ issues })}`, { issues, hint: OUTPUT_VALIDATION_HINT });
|
|
15
54
|
}
|
|
16
55
|
return result.data;
|
|
17
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValidatedOutput.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAGlD,+
|
|
1
|
+
{"version":3,"file":"getValidatedOutput.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAGlD,+DAI+B;AAO/B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,sBAAsB,GAC1B,yTAAyT,CAAC;AAE5T;;;;;;;;;;;;;;;GAeG;AACI,MAAM,kBAAkB,GAAG,CAAU,KAG3C,EAAW,EAAE;IACZ,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACtD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,MAAM,IAAI,iCAAgB,CACxB,6BAA6B,IAAA,wCAAkB,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAC7D,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,EAAE,CACzC,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAbW,QAAA,kBAAkB,sBAa7B"}
|
|
@@ -3,10 +3,25 @@ import type { ZodError } from 'zod';
|
|
|
3
3
|
import { type ZodIssueSummary } from './getZodIssuesSummary';
|
|
4
4
|
export interface ValidationErrorMetadata {
|
|
5
5
|
issues: ZodIssueSummary[];
|
|
6
|
+
hint: string;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* .what = transforms zod validation error into ConstraintError
|
|
9
10
|
* .why = callers need friendly error messages for invalid input
|
|
11
|
+
*
|
|
12
|
+
* .why the hint ships on the wire, though it addresses the author and not the caller = a strict
|
|
13
|
+
* header bag refuses 100% of traffic, so this message can only ever be read in a broken
|
|
14
|
+
* deployment — the author's own first request is the first to meet it. there is no
|
|
15
|
+
* author-only channel here in any case: `getErrorResponseBody` already forwards this
|
|
16
|
+
* error's metadata as `details`
|
|
17
|
+
*
|
|
18
|
+
* .why not refused at gen time, which would be one rung higher = a `toJSONSchema` probe of
|
|
19
|
+
* `schema.input` could read `additionalProperties: false` and throw at construction. it
|
|
20
|
+
* is refused on two counts: the failure here is already loud and total — never silent —
|
|
21
|
+
* and the ladder in `rule.prefer.prevent-over-correct` exists to close silent failures;
|
|
22
|
+
* and the probe throws on schemas it cannot represent, so the guard would need a
|
|
23
|
+
* swallowed error to stay safe, which trades a documented footgun for an undocumented
|
|
24
|
+
* failure mode (`rule.forbid.failhide`)
|
|
10
25
|
*/
|
|
11
26
|
export declare const getValidationError: (input: {
|
|
12
27
|
error: ZodError;
|
|
@@ -4,22 +4,110 @@ exports.getValidationError = void 0;
|
|
|
4
4
|
const helpful_errors_1 = require("helpful-errors");
|
|
5
5
|
const getZodIssuesSummary_1 = require("./getZodIssuesSummary");
|
|
6
6
|
/**
|
|
7
|
-
* .what =
|
|
8
|
-
* .why =
|
|
7
|
+
* .what = the FIX half of the message a caller meets when their input is refused
|
|
8
|
+
* .why = `rule.require.errors-name-the-fix` asks an error for three parts — what, why, and the
|
|
9
|
+
* concrete next move. the zod summary supplies the first two (`(root): expected object,
|
|
10
|
+
* received string` names the path and the mismatch) and says NOT ONE WORD about what to
|
|
11
|
+
* do, so the caller is left to infer it
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ .why it names no MECHANISM = two mechanisms were considered and each is false somewhere:
|
|
14
|
+
* - *"introspect the schema with `{ introspect: 'schema' }`"* — `genIntrospectionMiddleware`
|
|
15
|
+
* gates on `env.access === 'prep'` (`genIntrospectionMiddleware.ts:63`), so the hint would
|
|
16
|
+
* be a dead end in prod
|
|
17
|
+
* - *"check the `deserialize` option"* — meaningless at the ask-endpoint border, which shares
|
|
18
|
+
* this builder
|
|
19
|
+
* ⇒ so the hint names the ACT, which is true at both borders and in every env. a hint that is
|
|
20
|
+
* false in one env is worse than none, since a caller spends the trip before they learn it
|
|
9
21
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
/**
|
|
23
|
+
* ⚠️ .why DOUBLE quotes, where this repo's formatter prefers single = the possessive. biome
|
|
24
|
+
* picks the delimiter that needs fewer escapes, so a string that carries `'` takes `"`
|
|
25
|
+
*
|
|
26
|
+
* .note = this string is emitted verbatim into unit AND acceptance snapshots, in the same
|
|
27
|
+
* escaped JSON-in-string form. to reword it: `sedreplace` the old text across every
|
|
28
|
+
* snapshot, then run unit with NO `--resnap` — green proves the hand edit matches the
|
|
29
|
+
* emit byte for byte, which covers the acceptance snaps that share the form
|
|
30
|
+
*/
|
|
31
|
+
const VALIDATION_HINT_GENERIC = "send a value that satisfies the endpoint's declared input schema — correct each path named in `issues`";
|
|
32
|
+
/**
|
|
33
|
+
* .what = the hint a caller meets when EVERY issue already names its own fix
|
|
34
|
+
* .why = the generic hint above makes a CLAIM — *"the value you sent does not satisfy the
|
|
35
|
+
* schema"* — and on the constructor-reject path that claim is FALSE. `X.contract()`
|
|
36
|
+
* coerces, so the schema ACCEPTED the payload and the class constructor refused it
|
|
37
|
+
* afterward. the caller did exactly what the generic hint asks, and has no move at all
|
|
38
|
+
* ⇒ so the two hints fork on OBSERVED DATA — the issue set — never on handed config,
|
|
39
|
+
* which is the fork `rule.forbid.parallel-codepaths` permits
|
|
40
|
+
*/
|
|
41
|
+
const VALIDATION_HINT_SELF_NAMED = 'each entry in `issues` names its own fix — apply the one at the path named there. ⚠️ where a message says the schema ACCEPTED the value, the fix belongs to the endpoint author, never to the caller';
|
|
42
|
+
/**
|
|
43
|
+
* .what = the marker that says an issue carries its own fix, so a generic one would displace it
|
|
44
|
+
* .why = ⚠️ `code === 'custom'` was proposed as the discriminator and is MEASURED over-broad. a
|
|
45
|
+
* constructor reject and a plain `.refine()` emit byte-identical issue shapes —
|
|
46
|
+
* `{ code: 'custom', path, message }`, with no field that separates them — and a
|
|
47
|
+
* `.refine()` IS part of the declared schema, so the generic hint is CORRECT there. to
|
|
48
|
+
* suppress on `custom` would strip right guidance from a real caller fault
|
|
49
|
+
* (probe: `.agent/.notes/probe.issue-discriminators.ts`, q1 vs q2)
|
|
50
|
+
*
|
|
51
|
+
* .why a MESSAGE check is acceptable where a dependency's message is normally not a contract =
|
|
52
|
+
* it degrades to today's behavior. `domain-objects` documents this convention outright —
|
|
53
|
+
* *"the message names the fix"* (`node_modules/domain-objects/readme.md:675`) — and our
|
|
54
|
+
* own `rule.require.errors-name-the-fix` mandates the same token. if upstream rewords it,
|
|
55
|
+
* the generic hint is appended exactly as it is today, so no new failure mode opens
|
|
56
|
+
*/
|
|
57
|
+
const FIX_NAMED_MARKER = 'fix:';
|
|
58
|
+
/**
|
|
59
|
+
* .what = detects the one validation failure whose cause is the author's schema rather than
|
|
60
|
+
* the caller's request — a `.strict()` (or `z.strictObject`) header bag
|
|
61
|
+
* .why = the sdk parses the whole wire header bag against `schema.input`, and api gateway
|
|
62
|
+
* injects keys no author declares (`host`, `x-forwarded-for`, `x-amzn-trace-id`, and
|
|
63
|
+
* cloudfront's own set). so a strict header schema refuses every real request — a total
|
|
64
|
+
* outage from an idiomatic zod instinct
|
|
65
|
+
* .note = scoped to the `headers` path deliberately. `.strict()` on `payload` is correct and
|
|
66
|
+
* safe: the body is wholly the handler's, so an undeclared key there really is a
|
|
67
|
+
* caller fault. the axis is who else writes into the bag
|
|
68
|
+
* (`rule.require.read-the-slot-a-dependency-reads`)
|
|
69
|
+
*/
|
|
70
|
+
const getIsStrictHeaderRefusal = (input) => input.issues.some((issue) => issue.code === 'unrecognized_keys' && issue.path === 'headers');
|
|
71
|
+
/**
|
|
72
|
+
* .what = the fix, named at the one moment an author is certain to read it
|
|
73
|
+
* .why = zod's own message names the SYMPTOM precisely (`Unrecognized keys: "host", …`) and
|
|
74
|
+
* the CURE not at all, so an author reads it as a question about api gateway rather
|
|
75
|
+
* than about their own schema (`rule.require.errors-name-the-fix`)
|
|
76
|
+
*/
|
|
77
|
+
const HINT_STRICT_HEADERS = ' — a `headers` schema must NOT be `.strict()`: this sdk parses the WHOLE wire bag, and api' +
|
|
78
|
+
' gateway injects keys you did not declare, so a strict bag refuses every real request. drop' +
|
|
79
|
+
' `.strict()` — zod strips undeclared keys by default, and the sdk merges your validated keys' +
|
|
80
|
+
' back over the wire bag, so no key is lost. (`.strict()` on `payload` stays safe.)';
|
|
15
81
|
/**
|
|
16
82
|
* .what = transforms zod validation error into ConstraintError
|
|
17
83
|
* .why = callers need friendly error messages for invalid input
|
|
84
|
+
*
|
|
85
|
+
* .why the hint ships on the wire, though it addresses the author and not the caller = a strict
|
|
86
|
+
* header bag refuses 100% of traffic, so this message can only ever be read in a broken
|
|
87
|
+
* deployment — the author's own first request is the first to meet it. there is no
|
|
88
|
+
* author-only channel here in any case: `getErrorResponseBody` already forwards this
|
|
89
|
+
* error's metadata as `details`
|
|
90
|
+
*
|
|
91
|
+
* .why not refused at gen time, which would be one rung higher = a `toJSONSchema` probe of
|
|
92
|
+
* `schema.input` could read `additionalProperties: false` and throw at construction. it
|
|
93
|
+
* is refused on two counts: the failure here is already loud and total — never silent —
|
|
94
|
+
* and the ladder in `rule.prefer.prevent-over-correct` exists to close silent failures;
|
|
95
|
+
* and the probe throws on schemas it cannot represent, so the guard would need a
|
|
96
|
+
* swallowed error to stay safe, which trades a documented footgun for an undocumented
|
|
97
|
+
* failure mode (`rule.forbid.failhide`)
|
|
18
98
|
*/
|
|
19
99
|
const getValidationError = (input) => {
|
|
20
100
|
const issues = (0, getZodIssuesSummary_1.getZodIssuesSummary)({ issues: input.error.issues });
|
|
21
|
-
const issuesMessage =
|
|
22
|
-
|
|
101
|
+
const issuesMessage = (0, getZodIssuesSummary_1.asZodIssuesMessage)({ issues });
|
|
102
|
+
// every issue names its own fix -> a generic one would name a DIFFERENT fix beside it
|
|
103
|
+
const hint = issues.every((issue) => issue.message.includes(FIX_NAMED_MARKER))
|
|
104
|
+
? VALIDATION_HINT_SELF_NAMED
|
|
105
|
+
: VALIDATION_HINT_GENERIC;
|
|
106
|
+
// a strict header bag is the one refusal whose cure is the author's, so it rides the title
|
|
107
|
+
const hintStrictHeaders = getIsStrictHeaderRefusal({ issues })
|
|
108
|
+
? HINT_STRICT_HEADERS
|
|
109
|
+
: '';
|
|
110
|
+
return new helpful_errors_1.ConstraintError(`validation failed: ${issuesMessage}${hintStrictHeaders}`, { issues, hint });
|
|
23
111
|
};
|
|
24
112
|
exports.getValidationError = getValidationError;
|
|
25
113
|
//# sourceMappingURL=getValidationError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+
|
|
1
|
+
{"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+DAI+B;AAO/B;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;;GAQG;AACH,MAAM,uBAAuB,GAC3B,wGAAwG,CAAC;AAE3G;;;;;;;;GAQG;AACH,MAAM,0BAA0B,GAC9B,sMAAsM,CAAC;AAEzM;;;;;;;;;;;;;;GAcG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,MAAM,wBAAwB,GAAG,CAAC,KAEjC,EAAW,EAAE,CACZ,KAAK,CAAC,MAAM,CAAC,IAAI,CACf,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,mBAAmB,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAC1E,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,mBAAmB,GACvB,4FAA4F;IAC5F,6FAA6F;IAC7F,8FAA8F;IAC9F,oFAAoF,CAAC;AAEvF;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAA4C,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,IAAA,wCAAkB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAErD,sFAAsF;IACtF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAC5E,CAAC,CAAC,0BAA0B;QAC5B,CAAC,CAAC,uBAAuB,CAAC;IAE5B,2FAA2F;IAC3F,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC5D,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,IAAI,gCAAe,CACxB,sBAAsB,aAAa,GAAG,iBAAiB,EAAE,EACzD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B"}
|
|
@@ -7,7 +7,27 @@ export interface ZodIssueSummary {
|
|
|
7
7
|
/**
|
|
8
8
|
* .what = transforms zod issues array into friendly summary format
|
|
9
9
|
* .why = standard zod error format across validation boundaries
|
|
10
|
+
*
|
|
11
|
+
* .note = this is the ONE place a zod path becomes a string, so the root token lands once and
|
|
12
|
+
* reaches every surface: the input border's message (`getValidationError`), and the
|
|
13
|
+
* metadata of BOTH borders (`getValidatedInput` + `getValidatedOutput`). a repair at
|
|
14
|
+
* the render site instead would have left the output border and the metadata unfixed
|
|
10
15
|
*/
|
|
11
16
|
export declare const getZodIssuesSummary: (input: {
|
|
12
17
|
issues: ZodIssue[];
|
|
13
18
|
}) => ZodIssueSummary[];
|
|
19
|
+
/**
|
|
20
|
+
* .what = renders a summary as the one-line `path: message` list an error carries in its title
|
|
21
|
+
* .why = an error's `.message` is the only part a log line, a stack trace, or a caller's
|
|
22
|
+
* `console.error` shows without a decode of the metadata — so the PATHS have to be in it
|
|
23
|
+
* (rule.require.errors-name-the-fix: what went wrong, and where)
|
|
24
|
+
*
|
|
25
|
+
* .note = it lives HERE, beside `getZodIssuesSummary`, rather than at either border. the two
|
|
26
|
+
* borders throw different classes (`ConstraintError` in, `MalfunctionError` out) and
|
|
27
|
+
* name different fixes — but the RENDER of a path list is one guarantee, so it has one
|
|
28
|
+
* home (rule.forbid.parallel-codepaths). a copy at the second border is the copy that
|
|
29
|
+
* would rot, and the root-token note above already names every surface this must reach
|
|
30
|
+
*/
|
|
31
|
+
export declare const asZodIssuesMessage: (input: {
|
|
32
|
+
issues: ZodIssueSummary[];
|
|
33
|
+
}) => string;
|
|
@@ -1,16 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getZodIssuesSummary = void 0;
|
|
3
|
+
exports.asZodIssuesMessage = exports.getZodIssuesSummary = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = the token a ROOT-level issue occupies the `path` slot with
|
|
6
|
+
* .why = zod reports a root-level fault as an EMPTY path array, and the plain join of one is
|
|
7
|
+
* `''` — which renders as a bare `: ` at the one site that prints a path beside a
|
|
8
|
+
* message, and as `"path": ""` in the metadata `helpful-errors` serializes into that
|
|
9
|
+
* same string. both read as an ABSENT location rather than as the root, and the two
|
|
10
|
+
* shapes a caller most often hits at the body border — a raw string and a null — are
|
|
11
|
+
* BOTH root-level, so this is the common surface rather than an edge of it
|
|
12
|
+
*/
|
|
13
|
+
const PATH_ROOT = '(root)';
|
|
4
14
|
/**
|
|
5
15
|
* .what = transforms zod issues array into friendly summary format
|
|
6
16
|
* .why = standard zod error format across validation boundaries
|
|
17
|
+
*
|
|
18
|
+
* .note = this is the ONE place a zod path becomes a string, so the root token lands once and
|
|
19
|
+
* reaches every surface: the input border's message (`getValidationError`), and the
|
|
20
|
+
* metadata of BOTH borders (`getValidatedInput` + `getValidatedOutput`). a repair at
|
|
21
|
+
* the render site instead would have left the output border and the metadata unfixed
|
|
7
22
|
*/
|
|
8
23
|
const getZodIssuesSummary = (input) => {
|
|
9
24
|
return input.issues.map((issue) => ({
|
|
10
|
-
path: issue.path.join('.'),
|
|
25
|
+
path: issue.path.length ? issue.path.join('.') : PATH_ROOT,
|
|
11
26
|
message: issue.message,
|
|
12
27
|
code: issue.code,
|
|
13
28
|
}));
|
|
14
29
|
};
|
|
15
30
|
exports.getZodIssuesSummary = getZodIssuesSummary;
|
|
31
|
+
/**
|
|
32
|
+
* .what = renders a summary as the one-line `path: message` list an error carries in its title
|
|
33
|
+
* .why = an error's `.message` is the only part a log line, a stack trace, or a caller's
|
|
34
|
+
* `console.error` shows without a decode of the metadata — so the PATHS have to be in it
|
|
35
|
+
* (rule.require.errors-name-the-fix: what went wrong, and where)
|
|
36
|
+
*
|
|
37
|
+
* .note = it lives HERE, beside `getZodIssuesSummary`, rather than at either border. the two
|
|
38
|
+
* borders throw different classes (`ConstraintError` in, `MalfunctionError` out) and
|
|
39
|
+
* name different fixes — but the RENDER of a path list is one guarantee, so it has one
|
|
40
|
+
* home (rule.forbid.parallel-codepaths). a copy at the second border is the copy that
|
|
41
|
+
* would rot, and the root-token note above already names every surface this must reach
|
|
42
|
+
*/
|
|
43
|
+
const asZodIssuesMessage = (input) => input.issues.map((issue) => `${issue.path}: ${issue.message}`).join('; ');
|
|
44
|
+
exports.asZodIssuesMessage = asZodIssuesMessage;
|
|
16
45
|
//# sourceMappingURL=getZodIssuesSummary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getZodIssuesSummary.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.ts"],"names":[],"mappings":";;;AAQA
|
|
1
|
+
{"version":3,"file":"getZodIssuesSummary.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;GAQG;AACH,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAEnC,EAAqB,EAAE;IACtB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QAC1D,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AAEF;;;;;;;;;;;GAWG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAAU,EAAE,CACX,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAH/D,QAAA,kBAAkB,sBAG6C"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = the type of what `setEventFrozen` produces — readonly all the way down
|
|
3
|
+
* .why = typescript's own `Readonly<T>` is shallow, so it refuses `event.x = 1` and allows
|
|
4
|
+
* `event.headers.x = 1`. the runtime freeze below is deep, so the two would disagree: a
|
|
5
|
+
* write one level in type-checks cleanly and then throws a `TypeError` in production,
|
|
6
|
+
* which turns a well-typed handler into a 500
|
|
7
|
+
* .why here = it is named for the mechanism it types (`setFrozenDeep`), so the contract and its
|
|
8
|
+
* enforcement sit in one file and cannot drift apart
|
|
9
|
+
*
|
|
10
|
+
* .note = a function passes through unmapped. `Object.freeze` does freeze a function, but to map
|
|
11
|
+
* over one would discard its call signature — and no field of this envelope is a
|
|
12
|
+
* function, so the arm is free and it guards the general case
|
|
13
|
+
* .note = `readonly` is a compile-time refusal only; it erases at runtime. the freeze is what
|
|
14
|
+
* enforces it, and this type is what announces it — neither replaces the other
|
|
15
|
+
* (`rule.prefer.prevent-over-correct`: refuse it at rung 1, report it at rung 4)
|
|
16
|
+
*/
|
|
17
|
+
export type FrozenDeep<T> = T extends (...args: never[]) => unknown ? T : T extends ReadonlyArray<infer TItem> ? ReadonlyArray<FrozenDeep<TItem>> : T extends object ? {
|
|
18
|
+
readonly [TKey in keyof T]: FrozenDeep<T[TKey]>;
|
|
19
|
+
} : T;
|
|
20
|
+
/**
|
|
21
|
+
* .what = seals the envelope before `invoke` receives it
|
|
22
|
+
* .why = the envelope outlives the handler's turn, so a write through it corrupts a value
|
|
23
|
+
* somebody else reads after `invoke` returns — with no type error and no throw. the freeze
|
|
24
|
+
* makes that unrepresentable
|
|
25
|
+
*
|
|
26
|
+
* .why every family freezes, with no exception = the membership rule is the hand-off, never the
|
|
27
|
+
* reader set. who reads the envelope after `invoke` differs per family — a vendor for
|
|
28
|
+
* `forApiGateway` (`@middy/http-cors` and `…response-serializer`, in their `after` hooks),
|
|
29
|
+
* the sdk itself for `forSqs.perBatch` (`idsInBatch` is built from `decoded.records` after
|
|
30
|
+
* `invoke`), and neither for `forSqs.perRecord` or `forAsk`. an empty column is a
|
|
31
|
+
* property of today, so a rule keyed to one expires silently the first commit that adds a
|
|
32
|
+
* post-invoke read (`rule.require.frozen-invoke-inputs`)
|
|
33
|
+
*
|
|
34
|
+
* .why the cost is paid on purpose = `FrozenDeep<TInput>` makes `event` unassignable to every
|
|
35
|
+
* mutable parameter a handler forwards it to, so a handler must declare its sinks
|
|
36
|
+
* readonly. a guarantee that holds on three variants of four is a trap for whoever moves
|
|
37
|
+
* between them
|
|
38
|
+
*
|
|
39
|
+
* .where = the family root rather than inside `forApiGateway`, because two variants of one family
|
|
40
|
+
* reach for it. lifted on the second use (`rule.prefer.most-common-denominator`)
|
|
41
|
+
*
|
|
42
|
+
* .note = the projections freeze with it, by design: `headers`, `payload`, and `records` are the
|
|
43
|
+
* envelope's own slots, so a handler mutates none (`domain.terms/event.md`)
|
|
44
|
+
* .note = `forSqs.perBatch`'s harm is the sharpest, and `[case17]` walks it end to end: a handler
|
|
45
|
+
* that forges `event.records[n].id` would rewrite the set the unknown-id guard checks
|
|
46
|
+
* against, so the guard passes and sqs is answered with an `itemIdentifier` it cannot
|
|
47
|
+
* match — the message the author meant to save is deleted, on a successful invocation
|
|
48
|
+
*
|
|
49
|
+
* .why a `WeakSet` = an envelope and its `_.raw` share sub-objects, so each is reachable by two
|
|
50
|
+
* paths and would otherwise be walked twice. measured in both families:
|
|
51
|
+
*
|
|
52
|
+
* apiGateway -> `queryStringParameters` and `pathParameters` pass by reference
|
|
53
|
+
* (`asApiGatewayRequestEventUnified.ts:68-69`)
|
|
54
|
+
* sqs -> `wire.Records[n]` is reachable as `event._.raw.Records[n]` and as
|
|
55
|
+
* `event.records[n]._.raw` (`asSqsEventDecoded.ts:37`,
|
|
56
|
+
* `asSqsRecordDecoded.ts:94`)
|
|
57
|
+
*
|
|
58
|
+
* it is not a cycle guard. no cycle is reachable from this event — `requestContext` is an
|
|
59
|
+
* explicit four-field copy of primitives and `headers` is a new object — though the set
|
|
60
|
+
* would terminate one a later author introduced
|
|
61
|
+
*
|
|
62
|
+
* .note = a frozen write throws in strict mode and no-ops in sloppy mode. every module this sdk
|
|
63
|
+
* ships is an es module, which is strict by construction, so the throw is the behavior a
|
|
64
|
+
* consumer meets (ecma-262 §11.2.2)
|
|
65
|
+
* .note = the throw's message is terse — node raises a bare `TypeError: Cannot assign to read
|
|
66
|
+
* only property …`, which names no cause and no remedy. `Object.freeze` accepts no
|
|
67
|
+
* message, and the only mechanism that could supply one is a `Proxy` — a different
|
|
68
|
+
* object, so `headers === event.headers` would stop to hold. the remedy is prevention
|
|
69
|
+
* instead: `FrozenDeep` refuses the write at compile time, so a type-checked consumer
|
|
70
|
+
* never reaches the message (`rule.prefer.prevent-over-correct`)
|
|
71
|
+
*
|
|
72
|
+
* .why it returns = the same reference, narrowed to `FrozenDeep`. it still freezes in place — the
|
|
73
|
+
* return is the type half of one act, so a caller receives the guarantee from the step
|
|
74
|
+
* that establishes it rather than asserts it by hand at the hand-off
|
|
75
|
+
*/
|
|
76
|
+
export declare const setEventFrozen: <TEvent>(input: {
|
|
77
|
+
event: TEvent;
|
|
78
|
+
}) => FrozenDeep<TEvent>;
|