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/genInternalServiceErrorMiddleware.js
CHANGED
|
@@ -25,9 +25,27 @@ const genInternalServiceErrorMiddleware = (opts) => {
|
|
|
25
25
|
return;
|
|
26
26
|
// read the sdk-managed context once — trail may not have run yet
|
|
27
27
|
const { log } = (0, asContextTrailed_1.asContextTrailed)({ context: request.context });
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* .what = log the fault, and name WHICH endpoint raised it
|
|
30
|
+
* .why = the wire body a caller meets is deliberately generic — no internal detail, no
|
|
31
|
+
* secret — so cloudwatch is the only surface that can carry a diagnosis. it carried
|
|
32
|
+
* the message and the stack and never the endpoint, which is the half that matters
|
|
33
|
+
* most where the fault is service-wide: one bad schema position 500s
|
|
34
|
+
* `getAllLambdaContracts` for every endpoint beside it, and the log said WHAT broke
|
|
35
|
+
* without WHERE
|
|
36
|
+
*
|
|
37
|
+
* .note = `functionName` is aws's own field on the lambda `Context`, never one this sdk
|
|
38
|
+
* writes — so it is read straight off `request.context` rather than through
|
|
39
|
+
* `asContextTrailed`, which exists for the sdk-added fields only
|
|
40
|
+
*
|
|
41
|
+
* ⚠️ .why the WIRE body is still bare = whether a 500 may name an internal schema position
|
|
42
|
+
* at all is a disclosure call, and it belongs to the wisher — tracked as `F02`.
|
|
43
|
+
* a log line crosses no trust boundary, so THIS half needed no such call
|
|
44
|
+
*/
|
|
29
45
|
const logError = log?.error ?? console.error;
|
|
30
46
|
logError('handler.error', {
|
|
47
|
+
endpoint: request.context
|
|
48
|
+
?.functionName ?? null,
|
|
31
49
|
errorMessage: error.message,
|
|
32
50
|
stackTrace: error.stack,
|
|
33
51
|
});
|
package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genInternalServiceErrorMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.ts"],"names":[],"mappings":";;;AAEA,yDAAsD;AACtD,iEAA8D;AAE9D;;;;;;;;;GASG;AACI,MAAM,iCAAiC,GAAG,CAAC,IAqBjD,EAEC,EAAE;IACF,MAAM,OAAO,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,4DAA4D;QAC5D,yEAAyE;QACzE,MAAM,YAAY,GAAG,IAAA,2CAAoB,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,IAAI,YAAY;YAAE,OAAO;QAEzB,iEAAiE;QACjE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,mCAAgB,EAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAE/D
|
|
1
|
+
{"version":3,"file":"genInternalServiceErrorMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.ts"],"names":[],"mappings":";;;AAEA,yDAAsD;AACtD,iEAA8D;AAE9D;;;;;;;;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.why = enables runtime schema discovery for sdk generation
|
|
8
8
|
*
|
|
9
9
|
* behavior:
|
|
10
|
-
* - if
|
|
11
|
-
* - if
|
|
10
|
+
* - if `inputAfter` is { introspect: 'schema' } and env.access === 'prep': return schema
|
|
11
|
+
* - if `inputAfter` is { introspect: 'schema' } and env.access !== 'prep': fail fast
|
|
12
12
|
* - otherwise: pass through to handler
|
|
13
|
+
*
|
|
14
|
+
* .why `inputAfter` and not `payload` = this middleware serves both families, and they keep the
|
|
15
|
+
* caller's value in different places — `event.payload` for api-gateway, `event` itself
|
|
16
|
+
* for ask-endpoint. `inputAfter` is the position both share; `payload` is one family's
|
|
17
|
+
* word for a body (`domain.terms/payload.md`)
|
|
13
18
|
*/
|
|
14
19
|
export declare const genIntrospectionMiddleware: <TInput, TOutput>(opts: {
|
|
15
20
|
schema: {
|
|
@@ -23,13 +28,14 @@ export declare const genIntrospectionMiddleware: <TInput, TOutput>(opts: {
|
|
|
23
28
|
* knows which. the api-gateway chain must keep `request.event` HTTP-SHAPED, since
|
|
24
29
|
* `@middy/http-cors` reads `request.event.headers` and derives the http method from
|
|
25
30
|
* `request.event` in its `after` hook — so that family carries the value at
|
|
26
|
-
* `event.
|
|
31
|
+
* `event.payload`, while the ask-endpoint family carries it at `event` itself
|
|
27
32
|
*/
|
|
28
33
|
asInputAfter: (request: any) => unknown;
|
|
29
34
|
/**
|
|
30
35
|
* .what = renders the schema as this family's `outputAfter`, per family
|
|
31
36
|
* .why = the short-circuit writes STRAIGHT to the wire, so the shape is the family's own:
|
|
32
|
-
* api-gateway owes
|
|
37
|
+
* api-gateway owes an `ApiGatewayResponseOnwire`, while an ask-endpoint response goes
|
|
38
|
+
* to the wire as it stands
|
|
33
39
|
*/
|
|
34
40
|
asOutputAfter: (schema: LambdaEndpointSchema) => unknown;
|
|
35
41
|
}) => {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { JSONSchema } from 'zod/v4/core/json-schema';
|
|
3
|
-
/**
|
|
4
|
-
* .what = convert zod schema to JSON schema
|
|
5
|
-
* .why = encapsulates zod api for future error handler if needed
|
|
6
|
-
*/
|
|
7
3
|
export declare const getJsonSchemaFromZod: <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>(schema: T) => JSONSchema;
|
|
@@ -1,13 +1,234 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getJsonSchemaFromZod = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/**
|
|
6
|
-
* .what =
|
|
7
|
-
* .why =
|
|
7
|
+
* .what = publish a zod schema as the json-schema document a caller is typed against
|
|
8
|
+
* .why = this is the one door to `z.toJSONSchema` in src, so the wire face is a property of
|
|
9
|
+
* this function rather than a flag each caller must remember
|
|
10
|
+
*
|
|
11
|
+
* ✅ .the one-door claim is CLAMPED, never merely stated here —
|
|
12
|
+
* `genIntrospectionMiddleware.getJsonSchemaFromZod.integration.test.ts` reads the `src/` tree
|
|
13
|
+
* and grades both halves: exactly one prod call site (`[t1]`), and this face on it (`[t2]`).
|
|
14
|
+
* both rows were driven RED before the clamp was trusted — a throwaway second call site, and
|
|
15
|
+
* this flag flipped to `'output'`. so a second door added without the flag goes red in ci
|
|
16
|
+
* rather than reopens a service-wide crash silently
|
|
17
|
+
*
|
|
18
|
+
* .note = `{ io: 'input' }` is UNCONDITIONAL, at both borders. `io` names the SIDE of a
|
|
19
|
+
* contract (wire vs instance), never the BORDER of an endpoint (request vs response) —
|
|
20
|
+
* and the wire side is what crosses in both directions. on the response path
|
|
21
|
+
* `JSON.stringify` is the real encoder, and it emits the wire shape regardless of what
|
|
22
|
+
* output validation returns, so a published instance-face would describe a document no
|
|
23
|
+
* caller ever sends or receives
|
|
24
|
+
*
|
|
25
|
+
* ✅ .the DEPLOYED face is clamped too, byte-exact —
|
|
26
|
+
* `deployed.codegen.refs.acceptance.test.ts` `[case2]` calls `getOneLambdaContract` against
|
|
27
|
+
* the live `svc-trophy-prep-getTrophy` and pins every marker shape this function emits:
|
|
28
|
+
* `x-domain-object` on the trophy, plus `by: primary | unique | ref` beneath it. driven RED
|
|
29
|
+
* before it was trusted — this line swapped to `{ unrepresentable: 'any' }` (the `#33` shape)
|
|
30
|
+
* turned all three of its rows red while `returns the endpoint schema` stayed GREEN, which is
|
|
31
|
+
* the hazard exactly: the crash goes away and the pragmas are destroyed with no tell
|
|
32
|
+
* (rule.forbid.failhide). reverted to green
|
|
33
|
+
*
|
|
34
|
+
* .note = an ABSENT position publishes `{ not: {} }` rather than throws. `z.undefined()` and
|
|
35
|
+
* `z.void()` are the two shapes a handler that returns no value declares, and zod
|
|
36
|
+
* refuses to render either — so before this, such an endpoint could not introspect
|
|
37
|
+
* at all and its author reached for `z.unknown()`, which publishes `{}` and tells a
|
|
38
|
+
* caller every value is valid. `{ not: {} }` is the honest statement, and it reads
|
|
39
|
+
* correctly at both positions: at a root, the response carries no document; at a
|
|
40
|
+
* key, the key must be absent — which is exactly what `z.undefined()` accepts, so
|
|
41
|
+
* the key is dropped from `required` too. see `setAbsentPositionsRendered`
|
|
42
|
+
*
|
|
43
|
+
* .note = zod's default is `io: 'output'`, which asks what a parse hands BACK — a live class
|
|
44
|
+
* for any schema that coerces. that is not json, so the default throws
|
|
45
|
+
* `Transforms cannot be represented in JSON Schema` and takes down
|
|
46
|
+
* `getAllLambdaContracts` for the whole service. `X.contract()` always coerces, so
|
|
47
|
+
* every dobj position reaches that path
|
|
48
|
+
*
|
|
49
|
+
* ⚠️ .defect = LIVE, NOT FIXED — at the OUTPUT border this face DIVERGES from the document
|
|
50
|
+
* that crosses, for two shapes out of six measured
|
|
51
|
+
* .proof it is live = `[case5]` of the peer spec drives each shape through the real
|
|
52
|
+
* `getValidatedOutput` and serializes it as the runtime does, then grades
|
|
53
|
+
* the pair. the `.pipe()` and type-shift `.transform()` rows grade
|
|
54
|
+
* `CONTRADICTS`, and that grade is COMPUTED from the measured pair. both
|
|
55
|
+
* rows are GREEN, so the divergence is present
|
|
56
|
+
* .the class, measured = a coerced dobj AGREES exactly (the headline shape) · a plain schema
|
|
57
|
+
* agrees · `.default()` and `.catch()` UNDER-declare, so the face is
|
|
58
|
+
* weaker than the truth and never wrong · a `.pipe()` and a type-shift
|
|
59
|
+
* `.transform()` CONTRADICT, so the face names a type the document does
|
|
60
|
+
* not carry
|
|
61
|
+
* .why unrepaired = the only face that describes those two rows is `io: 'output'`, and it
|
|
62
|
+
* THROWS for every `X.contract()` position — the crash above. a per-schema
|
|
63
|
+
* choice between the faces is two code paths for one guarantee
|
|
64
|
+
* (rule.forbid.parallel-codepaths) plus a silent fallback
|
|
65
|
+
* (rule.forbid.failhide). so one face serves both borders, and the trade is
|
|
66
|
+
* DECLARED here rather than met in a generated caller
|
|
67
|
+
* .the trade, stated plainly = the discarded default was RIGHT for a `.pipe()` at the output
|
|
68
|
+
* border and could not serve a dobj at all. this one serves every
|
|
69
|
+
* dobj and is wrong for a `.pipe()`. the dobj is the shape this
|
|
70
|
+
* sdk exists to publish
|
|
71
|
+
* .both halves are MEASURED = `[case6]` of the peer spec drives the discarded face at a dobj
|
|
72
|
+
* and clamps the throw; `[case7]` drives it at the `.pipe()` and
|
|
73
|
+
* clamps that it does NOT throw and publishes `number`. so the
|
|
74
|
+
* sentence above cites a run rather than a recollection
|
|
75
|
+
* .the fix-forward path = `.dream/v2026_09_18.fix.published-face-contradicts-the-wire-for-a-pipe.md`
|
|
76
|
+
* carries the shape of the repair — the two faces reconcile only once
|
|
77
|
+
* zod can render a transform's output side, or once this sdk owns its
|
|
78
|
+
* own renderer. a per-schema choice is NOT that repair, and the dream
|
|
79
|
+
* records why, so the next traveler meets the measurement before the
|
|
80
|
+
* idea (rule.always.catch-dreams-for-followups)
|
|
8
81
|
*/
|
|
82
|
+
/**
|
|
83
|
+
* .what = the fix half of the message an engineer meets when the schema is not this zod's
|
|
84
|
+
* .why = `rule.require.errors-name-the-fix`. measured on `zod@4.4.3`: a schema object whose
|
|
85
|
+
* `_zod` marker is absent or hollow reaches zod's dispatch and raises a bare
|
|
86
|
+
* `TypeError: Cannot read properties of undefined (reading 'def')` — loud, and it names
|
|
87
|
+
* neither zod, nor the schema, nor the two-copy cause. so the engineer's path is a stack
|
|
88
|
+
* trace into a vendor file, with no clue what to change
|
|
89
|
+
*
|
|
90
|
+
* .note = the likeliest single cause is a SPLIT INSTALL: `package.json` declares `zod` a plain
|
|
91
|
+
* dependency with no peer range, and this function does a value import of `z` then
|
|
92
|
+
* renders a schema the CONSUMER's zod built. two copies in one `node_modules` and the
|
|
93
|
+
* markers no longer match. that is tracked as `F03`, and this hint is what makes the
|
|
94
|
+
* failure diagnosable while the manifest question stays open
|
|
95
|
+
*/
|
|
96
|
+
const FOREIGN_SCHEMA_HINT = "the value handed to `getJsonSchemaFromZod` does not carry this zod install's marker — most often two copies of `zod` in one `node_modules`, so a schema built by one is rendered by the other. run `npm ls zod` (or `pnpm why zod`) and dedupe to a single version";
|
|
97
|
+
/**
|
|
98
|
+
* .what = the zod node types that denote NO value at all
|
|
99
|
+
* .why = `z.undefined()` and `z.void()` both accept a handler that returns no value, and
|
|
100
|
+
* zod refuses to render either one — so an endpoint that returns no value could not
|
|
101
|
+
* introspect, and its author was pushed to `z.unknown()`, which publishes `{}` and
|
|
102
|
+
* tells a caller that ANY value is valid. that is the rubber-stamp this sdk exists
|
|
103
|
+
* to retire, surviving one corner in
|
|
104
|
+
*
|
|
105
|
+
* .the rendering = `{ not: {} }` — "no json value is valid here". true at BOTH positions:
|
|
106
|
+
* at a root it says the response carries no document; at a key it says the key must
|
|
107
|
+
* be absent, which is exactly what `z.undefined()` accepts
|
|
108
|
+
*/
|
|
109
|
+
const TYPES_ABSENT = ['undefined', 'void'];
|
|
110
|
+
/**
|
|
111
|
+
* .what = the zod node types whose EMPTY `{}` rendering is the truth rather than a silence
|
|
112
|
+
* .why = `unrepresentable: 'any'` below renders every un-renderable node as `{}`, which is
|
|
113
|
+
* indistinguishable from the `{}` these two produce honestly. so the set is named,
|
|
114
|
+
* and every OTHER empty node is re-raised by `setAbsentPositionsRendered`
|
|
115
|
+
*/
|
|
116
|
+
const TYPES_OPEN = ['unknown', 'any'];
|
|
117
|
+
/**
|
|
118
|
+
* .what = whether a zod node type denotes an absent value
|
|
119
|
+
*/
|
|
120
|
+
const getIsAbsentType = (type) => !!type && TYPES_ABSENT.includes(type);
|
|
121
|
+
/**
|
|
122
|
+
* .what = read a zod node's type off a `toJSONSchema` override context
|
|
123
|
+
* .why = the override hands the live schema object, and its type is the only signal that
|
|
124
|
+
* says WHICH position was rendered. one reader, so the shape of that reach is
|
|
125
|
+
* stated once rather than at each branch (rule.require.named-transformers)
|
|
126
|
+
*/
|
|
127
|
+
const getNodeType = (zodSchema) => zodSchema?._zod?.def?.type;
|
|
128
|
+
/**
|
|
129
|
+
* .what = whether a zod node hands its render off to another node it wraps
|
|
130
|
+
* .why = a wrapper's `{}` is INHERITED, never its own — so it must not be re-raised. measured:
|
|
131
|
+
* `asApiGatewayResponseSchema` writes `body: input.body.optional()`, so a perfectly
|
|
132
|
+
* legal `z.any()` body reaches the override as an `optional` node that renders `{}`,
|
|
133
|
+
* and a naive emptiness test refused it. that is a FALSE REFUSAL of the one shape the
|
|
134
|
+
* re-raise exists to permit
|
|
135
|
+
* .measured = `[case17][t2]` of `genLambdaEndpoint.forApiGateway.test.ts` went 200 -> 500 on
|
|
136
|
+
* the first draft of this branch, and is the clamp that holds it
|
|
137
|
+
*
|
|
138
|
+
* .note = the test is the PRESENCE OF AN INNER, never a list of wrapper names. a name list is
|
|
139
|
+
* a guess that goes stale the moment zod adds a wrapper; this reads the property the
|
|
140
|
+
* render actually depends on. the three shapes zod uses, measured on `4.4.3` against
|
|
141
|
+
* `json-schema-processors.cjs`: `def.innerType` (optional, nullable, default, prefault,
|
|
142
|
+
* nonoptional, readonly, catch, success), `def.in` / `def.out` (pipe, line 529), and
|
|
143
|
+
* `_zod.innerType` (lazy, line 558)
|
|
144
|
+
*
|
|
145
|
+
* ⚠️ .why it matters beyond the one false refusal = it makes the re-raise ORDER-INDEPENDENT.
|
|
146
|
+
* zod runs the override over `[...ctx.seen.entries()].reverse()`, which is deepest-first
|
|
147
|
+
* (`to-json-schema.cjs:302`) — but `flattenRef` recurses into a parent at line 279, so a
|
|
148
|
+
* wrapper CAN be overridden before its inner. with this test the verdict is the same either
|
|
149
|
+
* way, since the wrapper never carries a verdict of its own. the leaf always gets its own
|
|
150
|
+
* call, because every node `process` touches lands in `ctx.seen`
|
|
151
|
+
*/
|
|
152
|
+
const getIsNodeWithInner = (zodSchema) => {
|
|
153
|
+
const node = zodSchema;
|
|
154
|
+
return !!(node?._zod?.def?.innerType ??
|
|
155
|
+
node?._zod?.def?.in ??
|
|
156
|
+
node?._zod?.innerType);
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* .what = rewrite one rendered node so an ABSENT position publishes honestly, and so no
|
|
160
|
+
* OTHER un-renderable position is silenced by the blanket flag that makes this
|
|
161
|
+
* rewrite reachable
|
|
162
|
+
* .why = `unrepresentable: 'any'` is what stops zod's throw, and on its own it is a
|
|
163
|
+
* failhide at scale — measured on `zod@4.4.3`, it renders `date`, `bigint`,
|
|
164
|
+
* `symbol`, `map`, and `custom` each as `{}`, the same rubber-stamp. so the flag
|
|
165
|
+
* disarms the refusal globally and this re-arms it precisely (rule.forbid.failhide)
|
|
166
|
+
*
|
|
167
|
+
* ⚠️ .why it is NOT the `#33` hazard = that hazard is `unrepresentable: 'any'` used INSTEAD
|
|
168
|
+
* of `{ io: 'input' }`, which renders every coerced dobj as `{}` and destroys the
|
|
169
|
+
* `x-domain-object` pragma with no tell. here the flag rides BESIDE `io: 'input'`,
|
|
170
|
+
* which already resolves every transform — measured byte-identical for a dobj schema
|
|
171
|
+
* with and without the flag
|
|
172
|
+
*/
|
|
173
|
+
const setAbsentPositionsRendered = (ctx) => {
|
|
174
|
+
const type = getNodeType(ctx.zodSchema);
|
|
175
|
+
// an absent position publishes `{ not: {} }` — no json value is valid here
|
|
176
|
+
//
|
|
177
|
+
// ⚠️ .why the parent's `required` is left ALONE = a first draft stripped an absent key
|
|
178
|
+
// out of `required`, on the reasoning that the position accepts the key being
|
|
179
|
+
// omitted. MEASURED FALSE: `z.object({ b: z.undefined() }).safeParse({})` returns
|
|
180
|
+
// `success: false` on `zod@4.4.3` — zod demands the key be PRESENT and hold
|
|
181
|
+
// `undefined`. so the strip would have published a face that accepts a document the
|
|
182
|
+
// parse then rejects. left in place, `required: ['b']` beside `b: { not: {} }` is
|
|
183
|
+
// unsatisfiable by any json document, which is the truth exactly
|
|
184
|
+
// (`[case11][t2]` clamps both halves)
|
|
185
|
+
if (getIsAbsentType(type)) {
|
|
186
|
+
for (const key of Object.keys(ctx.jsonSchema))
|
|
187
|
+
delete ctx.jsonSchema[key];
|
|
188
|
+
ctx.jsonSchema.not = {};
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
// any OTHER position the blanket flag emptied is re-raised, and by NAME — zod's own
|
|
192
|
+
// message names the kind and never the field, so an engineer met a stack trace into a
|
|
193
|
+
// vendor file with no clue which position to change (rule.require.errors-name-the-fix)
|
|
194
|
+
//
|
|
195
|
+
// .why a node WITH AN INNER is skipped = its `{}` came from the node it wraps, and that
|
|
196
|
+
// node gets its own call. to re-raise here would name `optional` where the real
|
|
197
|
+
// culprit is `date`, and would refuse a legal `z.any().optional()` outright
|
|
198
|
+
if (Object.keys(ctx.jsonSchema).length === 0 &&
|
|
199
|
+
!TYPES_OPEN.includes(type ?? '') &&
|
|
200
|
+
!getIsNodeWithInner(ctx.zodSchema))
|
|
201
|
+
throw new helpful_errors_1.MalfunctionError(`introspection cannot render this schema: a '${type}' position has no json representation`, {
|
|
202
|
+
type,
|
|
203
|
+
hint: `replace the \`${type}\` position with a json-representable one (for a value that is genuinely open, \`z.unknown()\`; for one that is absent, \`z.undefined()\`)`,
|
|
204
|
+
});
|
|
205
|
+
};
|
|
9
206
|
const getJsonSchemaFromZod = (schema) => {
|
|
10
|
-
|
|
207
|
+
/**
|
|
208
|
+
* .what = refuse a schema this zod install cannot recognize, by NAME rather than by TypeError
|
|
209
|
+
* .why = the throw already happened one frame deeper, inside the vendor, with a message that
|
|
210
|
+
* names a property and not a cause (`[case8][t0]`, `[t1]`). this changes no path that
|
|
211
|
+
* succeeds today — it fires on exactly the set that already crashed, and hands that set
|
|
212
|
+
* an error an engineer can act on (rule.require.failloud)
|
|
213
|
+
*
|
|
214
|
+
* .note = it does NOT compare versions. two copies at the SAME version still carry distinct
|
|
215
|
+
* markers, and a version check would pass while the render fails — so the test is the
|
|
216
|
+
* marker itself, which is the property the render actually needs
|
|
217
|
+
*/
|
|
218
|
+
const marker = schema?._zod;
|
|
219
|
+
if (!marker?.def?.type)
|
|
220
|
+
throw new helpful_errors_1.MalfunctionError('introspection cannot render this schema: it carries no recognizable zod marker', { hint: FOREIGN_SCHEMA_HINT });
|
|
221
|
+
return zod_1.z.toJSONSchema(schema, {
|
|
222
|
+
io: 'input',
|
|
223
|
+
// .why the blanket + the override = zod refuses an un-renderable position by THROW,
|
|
224
|
+
// which took `z.undefined()` / `z.void()` off the table for every endpoint that
|
|
225
|
+
// introspects. the flag disarms that throw for every kind at once, and
|
|
226
|
+
// `setAbsentPositionsRendered` re-arms it for every kind but the two that have an
|
|
227
|
+
// honest rendering. neither half is safe alone: the flag alone is a failhide,
|
|
228
|
+
// the override alone never runs (zod throws before it returns)
|
|
229
|
+
unrepresentable: 'any',
|
|
230
|
+
override: setAbsentPositionsRendered,
|
|
231
|
+
});
|
|
11
232
|
};
|
|
12
233
|
exports.getJsonSchemaFromZod = getJsonSchemaFromZod;
|
|
13
234
|
//# sourceMappingURL=genIntrospectionMiddleware.getJsonSchemaFromZod.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genIntrospectionMiddleware.getJsonSchemaFromZod.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAGxB
|
|
1
|
+
{"version":3,"file":"genIntrospectionMiddleware.getJsonSchemaFromZod.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAClD,6BAAwB;AAGxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH;;;;;;;;;;;;;GAaG;AACH,MAAM,mBAAmB,GACvB,oQAAoQ,CAAC;AAEvQ;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,IAAwB,EAAW,EAAE,CAC5D,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAAC,SAAkB,EAAsB,EAAE,CAC5D,SAAoD,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,kBAAkB,GAAG,CAAC,SAAkB,EAAW,EAAE;IACzD,MAAM,IAAI,GAAG,SAEZ,CAAC;IACF,OAAO,CAAC,CAAC,CACP,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS;QAC1B,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QACnB,IAAI,EAAE,IAAI,EAAE,SAAS,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;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OAAC,CAAC,YAAY,CAAC,MAAM,EAAE;QAC5B,EAAE,EAAE,OAAO;QACX,oFAAoF;QACpF,qFAAqF;QACrF,4EAA4E;QAC5E,uFAAuF;QACvF,mFAAmF;QACnF,oEAAoE;QACpE,eAAe,EAAE,KAAK;QACtB,QAAQ,EAAE,0BAA0B;KACrC,CAAe,CAAC;AACnB,CAAC,CAAC;AAhCW,QAAA,oBAAoB,wBAgC/B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = detects whether a handler's `inputAfter` asks for schema introspection
|
|
3
|
+
* .why = lets the middleware answer the ask before the handler runs
|
|
4
|
+
*
|
|
5
|
+
* .why the name = this predicate serves BOTH endpoint families, and `payload` is the
|
|
6
|
+
* api-gateway family's own word for a BODY (`event.payload`, rfc 9110). the value it
|
|
7
|
+
* tests is the whole event for the ask-endpoint family, so `payload` would carry two
|
|
8
|
+
* senses at a seam with two callers (`domain.terms/payload.md`). `input` is the term
|
|
9
|
+
* both families share — it is the `(input, context)` word, and the position this value
|
|
10
|
+
* occupies is `inputAfter`
|
|
11
|
+
*/
|
|
12
|
+
export declare const isIntrospectionInput: (input: unknown) => boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIntrospectionInput = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* .what = detects whether a handler's `inputAfter` asks for schema introspection
|
|
6
|
+
* .why = lets the middleware answer the ask before the handler runs
|
|
7
|
+
*
|
|
8
|
+
* .why the name = this predicate serves BOTH endpoint families, and `payload` is the
|
|
9
|
+
* api-gateway family's own word for a BODY (`event.payload`, rfc 9110). the value it
|
|
10
|
+
* tests is the whole event for the ask-endpoint family, so `payload` would carry two
|
|
11
|
+
* senses at a seam with two callers (`domain.terms/payload.md`). `input` is the term
|
|
12
|
+
* both families share — it is the `(input, context)` word, and the position this value
|
|
13
|
+
* occupies is `inputAfter`
|
|
14
|
+
*/
|
|
15
|
+
const isIntrospectionInput = (input) => {
|
|
16
|
+
if (typeof input !== 'object' || input === null)
|
|
17
|
+
return false;
|
|
18
|
+
if (!('introspect' in input))
|
|
19
|
+
return false;
|
|
20
|
+
return input.introspect === 'schema';
|
|
21
|
+
};
|
|
22
|
+
exports.isIntrospectionInput = isIntrospectionInput;
|
|
23
|
+
//# sourceMappingURL=genIntrospectionMiddleware.isIntrospectionInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genIntrospectionMiddleware.isIntrospectionInput.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAc,EAAW,EAAE;IAC9D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,OAAQ,KAAiC,CAAC,UAAU,KAAK,QAAQ,CAAC;AACpE,CAAC,CAAC;AAJW,QAAA,oBAAoB,wBAI/B"}
|
|
@@ -3,21 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.genIntrospectionMiddleware = void 0;
|
|
4
4
|
const helpful_errors_1 = require("helpful-errors");
|
|
5
5
|
const genIntrospectionMiddleware_getJsonSchemaFromZod_1 = require("./genIntrospectionMiddleware.getJsonSchemaFromZod");
|
|
6
|
-
const
|
|
6
|
+
const genIntrospectionMiddleware_isIntrospectionInput_1 = require("./genIntrospectionMiddleware.isIntrospectionInput");
|
|
7
7
|
/**
|
|
8
8
|
* .what = middleware that intercepts introspection requests
|
|
9
9
|
* .why = enables runtime schema discovery for sdk generation
|
|
10
10
|
*
|
|
11
11
|
* behavior:
|
|
12
|
-
* - if
|
|
13
|
-
* - if
|
|
12
|
+
* - if `inputAfter` is { introspect: 'schema' } and env.access === 'prep': return schema
|
|
13
|
+
* - if `inputAfter` is { introspect: 'schema' } and env.access !== 'prep': fail fast
|
|
14
14
|
* - otherwise: pass through to handler
|
|
15
|
+
*
|
|
16
|
+
* .why `inputAfter` and not `payload` = this middleware serves both families, and they keep the
|
|
17
|
+
* caller's value in different places — `event.payload` for api-gateway, `event` itself
|
|
18
|
+
* for ask-endpoint. `inputAfter` is the position both share; `payload` is one family's
|
|
19
|
+
* word for a body (`domain.terms/payload.md`)
|
|
15
20
|
*/
|
|
16
21
|
const genIntrospectionMiddleware = (opts) => {
|
|
17
22
|
const before = async (request) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* .what = read `inputAfter` from wherever this family keeps it
|
|
25
|
+
* .why the name = `inputAfter` is a POSITION, and it is true of BOTH families. a local
|
|
26
|
+
* named `payload` would be the api-gateway family's own word (`event.payload`) put
|
|
27
|
+
* on a value that for the ask-endpoint family is the WHOLE event — one word, two
|
|
28
|
+
* senses, at a seam that serves two callers (`domain.terms/payload.md`)
|
|
29
|
+
*/
|
|
30
|
+
const inputAfter = opts.asInputAfter(request);
|
|
31
|
+
if (!(0, genIntrospectionMiddleware_isIntrospectionInput_1.isIntrospectionInput)(inputAfter))
|
|
21
32
|
return;
|
|
22
33
|
// extract env from config
|
|
23
34
|
const env = typeof opts.env === 'function' ? await opts.env() : opts.env;
|
package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genIntrospectionMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAKjD,uHAAyF;AACzF,
|
|
1
|
+
{"version":3,"file":"genIntrospectionMiddleware.js","sourceRoot":"","sources":["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OAAO,OAAO,CAAC,QAAQ,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AA3EW,QAAA,0BAA0B,8BA2ErC"}
|
|
@@ -4,29 +4,27 @@ import type { TranslateLog } from '../TranslateLog';
|
|
|
4
4
|
* .what = middleware that logs handler input and output
|
|
5
5
|
* .why = enables debug observability with optional redaction via translate.log
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* never runs. both shipped chains log the `errorMessage` / `stackTrace` branch
|
|
9
|
-
* instead.
|
|
7
|
+
* .defect = LIVE, NOT FIXED — on an error, the `request.response` branch of `onError` below
|
|
8
|
+
* never runs. both shipped chains log the `errorMessage` / `stackTrace` branch instead
|
|
10
9
|
*
|
|
11
10
|
* .the cause = middy `unshift`s `after` and `onError` hooks
|
|
12
|
-
* (`@middy/core/index.js:79-100`), so registration order
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* all. today it sits HIGHER in both.
|
|
11
|
+
* (`@middy/core/index.js:79-100`), so registration order reverses at run time: a higher
|
|
12
|
+
* array index runs earlier on the error path. `onError` here reads `request.response`,
|
|
13
|
+
* which exists only once an error-builder has set it — so this middleware must sit at a
|
|
14
|
+
* lower index than `genConstraintErrorMiddleware` / `genInternalServiceErrorMiddleware`
|
|
15
|
+
* for its response branch to observe a value at all. it sits higher in both
|
|
18
16
|
*
|
|
19
17
|
* .the repair, unapplied = move it below the error builders. left with the peer
|
|
20
|
-
* header-order defect
|
|
21
|
-
*
|
|
18
|
+
* header-order defect because that reorder also moves the success-path `after` order for
|
|
19
|
+
* every handler — a blast radius this wish's bound does not cover. the peer and the
|
|
20
|
+
* shared reorder both wait on
|
|
21
|
+
* `.dream/v2026_09_22.fix.no-cors-or-owasp-headers-on-error-responses.md`
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* ⚠️ the same mechanism binds a CUSTOM chain: place this below your own error
|
|
29
|
-
* builders, or its error-path response branch is dead there too.
|
|
23
|
+
* .note = do not delete the response branch as dead code. it names a real intent — on an error,
|
|
24
|
+
* log what the caller actually received — and it goes live the moment the reorder lands
|
|
25
|
+
* (rule.require.retest-the-model-on-every-family: prune a slot, never a name)
|
|
26
|
+
* .note = the same mechanism binds a custom chain: place this below your own error builders, or
|
|
27
|
+
* its error-path response branch is dead there too
|
|
30
28
|
*/
|
|
31
29
|
export declare const genIoLoggerMiddleware: (input?: {
|
|
32
30
|
logTranslate?: TranslateLog;
|
|
@@ -6,29 +6,27 @@ const asContextTrailed_1 = require("./asContextTrailed");
|
|
|
6
6
|
* .what = middleware that logs handler input and output
|
|
7
7
|
* .why = enables debug observability with optional redaction via translate.log
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* never runs. both shipped chains log the `errorMessage` / `stackTrace` branch
|
|
11
|
-
* instead.
|
|
9
|
+
* .defect = LIVE, NOT FIXED — on an error, the `request.response` branch of `onError` below
|
|
10
|
+
* never runs. both shipped chains log the `errorMessage` / `stackTrace` branch instead
|
|
12
11
|
*
|
|
13
12
|
* .the cause = middy `unshift`s `after` and `onError` hooks
|
|
14
|
-
* (`@middy/core/index.js:79-100`), so registration order
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* all. today it sits HIGHER in both.
|
|
13
|
+
* (`@middy/core/index.js:79-100`), so registration order reverses at run time: a higher
|
|
14
|
+
* array index runs earlier on the error path. `onError` here reads `request.response`,
|
|
15
|
+
* which exists only once an error-builder has set it — so this middleware must sit at a
|
|
16
|
+
* lower index than `genConstraintErrorMiddleware` / `genInternalServiceErrorMiddleware`
|
|
17
|
+
* for its response branch to observe a value at all. it sits higher in both
|
|
20
18
|
*
|
|
21
19
|
* .the repair, unapplied = move it below the error builders. left with the peer
|
|
22
|
-
* header-order defect
|
|
23
|
-
*
|
|
20
|
+
* header-order defect because that reorder also moves the success-path `after` order for
|
|
21
|
+
* every handler — a blast radius this wish's bound does not cover. the peer and the
|
|
22
|
+
* shared reorder both wait on
|
|
23
|
+
* `.dream/v2026_09_22.fix.no-cors-or-owasp-headers-on-error-responses.md`
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* ⚠️ the same mechanism binds a CUSTOM chain: place this below your own error
|
|
31
|
-
* builders, or its error-path response branch is dead there too.
|
|
25
|
+
* .note = do not delete the response branch as dead code. it names a real intent — on an error,
|
|
26
|
+
* log what the caller actually received — and it goes live the moment the reorder lands
|
|
27
|
+
* (rule.require.retest-the-model-on-every-family: prune a slot, never a name)
|
|
28
|
+
* .note = the same mechanism binds a custom chain: place this below your own error builders, or
|
|
29
|
+
* its error-path response branch is dead there too
|
|
32
30
|
*/
|
|
33
31
|
const genIoLoggerMiddleware = (input) => {
|
|
34
32
|
const translateInput = input?.logTranslate?.input ?? ((event) => event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;AAEtD
|
|
1
|
+
{"version":3,"file":"genIoLoggerMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.ts"],"names":[],"mappings":";;;AAGA,yDAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAErC,EAIC,EAAE;IACF,MAAM,cAAc,GAAG,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IACxE,MAAM,eAAe,GACnB,KAAK,EAAE,YAAY,EAAE,MAAM,IA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AE,OAAO,CAAC,KAAK,CAAC,OAAO;oBACnC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;iBAChC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC,CAAC;AA5CW,QAAA,qBAAqB,yBA4ChC"}
|
|
@@ -6,6 +6,11 @@ import type middy from '@middy/core';
|
|
|
6
6
|
* payload formats:
|
|
7
7
|
* - wrapped: { event: X, trail: { exid } } → extracts trail, unwraps to X
|
|
8
8
|
* - raw: X → generates trail, uses X as event
|
|
9
|
+
*
|
|
10
|
+
* .note = the wrapped arm is the only inbound source of an `exid`, and only `askLambdaEndpoint`
|
|
11
|
+
* sends that shape. so an api-gateway or an sqs envelope cannot match it, and both
|
|
12
|
+
* families mint a fresh id every invoke — a trace does not cross an http or a queue
|
|
13
|
+
* boundary (`domain.terms/trail.md`)
|
|
9
14
|
*/
|
|
10
15
|
export declare const genTrailMiddleware: () => {
|
|
11
16
|
before: middy.MiddlewareFn<any, any>;
|
|
@@ -11,6 +11,11 @@ const getUnwrappedEventWithExid_1 = require("./getUnwrappedEventWithExid");
|
|
|
11
11
|
* payload formats:
|
|
12
12
|
* - wrapped: { event: X, trail: { exid } } → extracts trail, unwraps to X
|
|
13
13
|
* - raw: X → generates trail, uses X as event
|
|
14
|
+
*
|
|
15
|
+
* .note = the wrapped arm is the only inbound source of an `exid`, and only `askLambdaEndpoint`
|
|
16
|
+
* sends that shape. so an api-gateway or an sqs envelope cannot match it, and both
|
|
17
|
+
* families mint a fresh id every invoke — a trace does not cross an http or a queue
|
|
18
|
+
* boundary (`domain.terms/trail.md`)
|
|
14
19
|
*/
|
|
15
20
|
const genTrailMiddleware = () => {
|
|
16
21
|
const before = async (request) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genTrailMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.ts"],"names":[],"mappings":";;;AACA,mCAAoC;AACpC,uCAIkB;AAElB,2EAAwE;AAExE
|
|
1
|
+
{"version":3,"file":"genTrailMiddleware.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.ts"],"names":[],"mappings":";;;AACA,mCAAoC;AACpC,uCAIkB;AAElB,2EAAwE;AAExE;;;;;;;;;;;;GAYG;AACI,MAAM,kBAAkB,GAAG,GAEhC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,kDAAkD;QAClD,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,GACxD,IAAA,qDAAyB,EAAC;YACxB,OAAO,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC,CAAC;QAEL,gCAAgC;QAChC,MAAM,IAAI,GAAG,eAAe,IAAI,QAAQ,IAAA,mBAAU,GAAE,EAAE,CAAC;QAEvD,eAAe;QACf,MAAM,KAAK,GAAa;YACtB,IAAI;YACJ,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,kCAAkC;QAClC,MAAM,eAAe,GAAG,IAAA,6BAAkB,EAAC;YACzC,KAAK;YACL,GAAG,EAAE,IAAI;SACV,CAAC,CAAC;QAEH,mCAAmC;QACnC,yFAAyF;QACzF,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC;QAE/B,kDAAkD;QAClD;;;;;;;;;;;WAWG;QACH,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAG3C,CAAC;QACF,OAAO,CAAC,OAAO,GAAG;YAChB,GAAG,aAAa;YAChB,GAAG,EAAE,eAAe,CAAC,GAAG;YACxB,eAAe;SAE+B,CAAC;IACnD,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAvDW,QAAA,kBAAkB,sBAuD7B"}
|
package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts
CHANGED
|
@@ -4,30 +4,38 @@ import type { ZodSchema } from 'zod';
|
|
|
4
4
|
* .what = middleware that validates handler output against a zod schema
|
|
5
5
|
* .why = ensures type-safe output before the response is returned
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* .note = which shape this validates depends on where you register it. it reads
|
|
8
|
+
* `request.response`, and on the api-gateway path that slot holds a different type at
|
|
9
|
+
* different points in the chain:
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* before the output translator -> `ApiGatewayResponse<TBody>` (the handler's shape)
|
|
13
|
-
* after the output translator -> `ApiGatewayResponsePayload` (the wire form, body
|
|
14
|
-
* already a string)
|
|
11
|
+
* before the output translator -> `ApiGatewayResponse<TBody>` (the handler's shape)
|
|
12
|
+
* after the output translator -> `ApiGatewayResponseOnwire` (the wire form, body
|
|
13
|
+
* already a string)
|
|
15
14
|
*
|
|
16
15
|
* a schema written for one refuses the other, so a caller who composes this into a
|
|
17
16
|
* custom chain validates whichever shape their registration order produces. the
|
|
18
|
-
* signature cannot warn them — `request.response` is `unknown` to middy, so both bind
|
|
17
|
+
* signature cannot warn them — `request.response` is `unknown` to middy, so both bind
|
|
19
18
|
*
|
|
20
|
-
* .note =
|
|
21
|
-
* tracked as
|
|
22
|
-
*
|
|
19
|
+
* .note = unresolved, not a defect — this export carries two contracts with no discriminant.
|
|
20
|
+
* tracked as F33 in the fulcrum table of
|
|
21
|
+
* `.behavior/v2026_08_03.feat-apigateway-wire-response/1.vision.yield.md`, where the
|
|
22
|
+
* three options (deprecate, add a `point` discriminant, accept) are spelled out. the
|
|
23
|
+
* route is named in full on purpose: a later route adds its own `1.vision.yield.md`,
|
|
24
|
+
* and a bare filename then resolves to a table with no F33 in it.
|
|
23
25
|
*
|
|
24
26
|
* no shipped chain registers it — both families validate inline instead, because each
|
|
25
27
|
* knows which of the two shapes it holds at that moment and this middleware cannot. so
|
|
26
|
-
* the open question is one of surface area, never of a live defect
|
|
28
|
+
* the open question is one of surface area, never of a live defect
|
|
27
29
|
*
|
|
28
|
-
* .note = the validation itself is delegated to `getValidatedOutput`, as both input-side
|
|
29
|
-
* delegate to `
|
|
30
|
+
* .note = the validation itself is delegated to `getValidatedOutput`, exactly as both input-side
|
|
31
|
+
* peers delegate to `getValidatedInput` — one guarantee, one implementation, per border
|
|
30
32
|
* (rule.forbid.parallel-codepaths)
|
|
33
|
+
*
|
|
34
|
+
* the two root primitives are peers rather than one, because they make DIFFERENT
|
|
35
|
+
* guarantees: a bad input is the caller's fault and raises a `ConstraintError`, while a
|
|
36
|
+
* bad output is the server's fault and raises a `MalfunctionError`
|
|
37
|
+
* (rule.require.failloud). to merge them would need an error-class argument, which is a
|
|
38
|
+
* fork on handed config — the shape that rule forbids
|
|
31
39
|
*/
|
|
32
40
|
export declare const genZodOutputValidationMiddleware: <TOutput>(input: {
|
|
33
41
|
schema: ZodSchema<TOutput>;
|