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.
Files changed (183) hide show
  1. package/dist/domain.objects/ApiGatewayRequestEventOnwire.d.ts +18 -0
  2. package/dist/domain.objects/ApiGatewayRequestEventOnwire.js +3 -0
  3. package/dist/domain.objects/ApiGatewayRequestEventOnwire.js.map +1 -0
  4. package/dist/domain.objects/ApiGatewayResponse.d.ts +17 -10
  5. package/dist/domain.objects/{ApiGatewayResponsePayload.d.ts → ApiGatewayResponseOnwire.d.ts} +8 -4
  6. package/dist/domain.objects/{ApiGatewayRequestPayload.js → ApiGatewayResponseOnwire.js} +1 -1
  7. package/dist/domain.objects/ApiGatewayResponseOnwire.js.map +1 -0
  8. package/dist/domain.operations/genLambdaEndpoint/InvokeInputSuperset.d.ts +125 -0
  9. package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js → InvokeInputSuperset.js} +1 -1
  10. package/dist/domain.operations/genLambdaEndpoint/InvokeInputSuperset.js.map +1 -0
  11. package/dist/domain.operations/genLambdaEndpoint/TranslateLog.d.ts +0 -17
  12. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.d.ts +27 -0
  13. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/ApiGatewayRequestEventUnified.d.ts +100 -0
  14. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/ApiGatewayRequestEventUnified.js +3 -0
  15. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/ApiGatewayRequestEventUnified.js.map +1 -0
  16. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayRequestEventUnified.d.ts +34 -0
  17. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayRequestEventUnified.js +141 -0
  18. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayRequestEventUnified.js.map +1 -0
  19. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.d.ts +22 -0
  20. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.js +27 -0
  21. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.js.map +1 -0
  22. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{asApiGatewayResponsePayloadJson.d.ts → asApiGatewayResponseOnwireJson.d.ts} +11 -11
  23. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{asApiGatewayResponsePayloadJson.js → asApiGatewayResponseOnwireJson.js} +12 -12
  24. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwireJson.js.map +1 -0
  25. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +39 -13
  26. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +37 -11
  27. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -1
  28. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.d.ts +35 -0
  29. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.js +44 -0
  30. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.js.map +1 -0
  31. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +95 -39
  32. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +88 -62
  33. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  34. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getAllWirePayloadKeysFound.d.ts → getAllResponseOnwireKeysFound.d.ts} +2 -2
  35. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllResponseOnwireKeysFound.js +43 -0
  36. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllResponseOnwireKeysFound.js.map +1 -0
  37. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV1ApiGatewayEvent.d.ts → getIsV1ApiGatewayRequestEvent.d.ts} +1 -1
  38. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV1ApiGatewayEvent.js → getIsV1ApiGatewayRequestEvent.js} +4 -4
  39. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayRequestEvent.js.map +1 -0
  40. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV2ApiGatewayEvent.d.ts → getIsV2ApiGatewayRequestEvent.d.ts} +1 -1
  41. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/{getIsV2ApiGatewayEvent.js → getIsV2ApiGatewayRequestEvent.js} +4 -4
  42. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayRequestEvent.js.map +1 -0
  43. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.d.ts +8 -5
  44. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js +11 -8
  45. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js.map +1 -1
  46. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/{genApiGatewayEventNormalizationMiddleware.d.ts → genApiGatewayRequestEventNormalizationMiddleware.d.ts} +3 -3
  47. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/{genApiGatewayEventNormalizationMiddleware.js → genApiGatewayRequestEventNormalizationMiddleware.js} +8 -8
  48. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js.map +1 -0
  49. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.d.ts +4 -4
  50. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js +5 -5
  51. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.d.ts +36 -0
  52. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.js +113 -0
  53. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.js.map +1 -0
  54. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.d.ts +125 -0
  55. package/dist/domain.operations/genLambdaEndpoint/{genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js → genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js} +32 -16
  56. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -0
  57. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.d.ts +18 -0
  58. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.js +29 -0
  59. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.js.map +1 -0
  60. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.d.ts +23 -0
  61. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.js +38 -0
  62. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.js.map +1 -0
  63. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/SqsEventDecoded.d.ts +123 -0
  64. package/dist/{domain.objects/ApiGatewayResponsePayload.js → domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/SqsEventDecoded.js} +1 -1
  65. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/SqsEventDecoded.js.map +1 -0
  66. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsEventDecoded.d.ts +23 -0
  67. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsEventDecoded.js +33 -0
  68. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsEventDecoded.js.map +1 -0
  69. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsHeadersOnwire.d.ts +30 -0
  70. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsHeadersOnwire.js +38 -0
  71. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsHeadersOnwire.js.map +1 -0
  72. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordDecoded.d.ts +30 -0
  73. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordDecoded.js +86 -0
  74. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordDecoded.js.map +1 -0
  75. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.d.ts +26 -0
  76. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.js +32 -0
  77. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.js.map +1 -0
  78. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.d.ts +82 -0
  79. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js +108 -0
  80. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js.map +1 -0
  81. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.d.ts +121 -0
  82. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +97 -0
  83. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -0
  84. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.d.ts +52 -0
  85. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js +68 -0
  86. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js.map +1 -0
  87. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getIsSqsEvent.d.ts +21 -0
  88. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getIsSqsEvent.js +36 -0
  89. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getIsSqsEvent.js.map +1 -0
  90. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.d.ts +46 -0
  91. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.js +79 -0
  92. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.js.map +1 -0
  93. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.js +31 -0
  94. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.js.map +1 -0
  95. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.d.ts +8 -4
  96. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -1
  97. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +1 -1
  98. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +19 -1
  99. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
  100. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.d.ts +10 -4
  101. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +0 -4
  102. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js +224 -3
  103. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -1
  104. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.d.ts +12 -0
  105. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.js +23 -0
  106. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.js.map +1 -0
  107. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js +17 -6
  108. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -1
  109. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +16 -18
  110. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +16 -18
  111. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
  112. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.d.ts +5 -0
  113. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +5 -0
  114. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
  115. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +22 -14
  116. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +23 -15
  117. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
  118. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.d.ts +19 -0
  119. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js +26 -0
  120. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js.map +1 -0
  121. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.d.ts +17 -0
  122. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js +40 -1
  123. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js.map +1 -1
  124. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +15 -0
  125. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +97 -9
  126. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
  127. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.d.ts +20 -0
  128. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js +31 -2
  129. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js.map +1 -1
  130. package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.d.ts +78 -0
  131. package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js +103 -0
  132. package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js.map +1 -0
  133. package/dist/domain.operations/genServiceSdk/gen.file/banner.d.ts +2 -3
  134. package/dist/domain.operations/genServiceSdk/gen.file/banner.js +2 -3
  135. package/dist/domain.operations/genServiceSdk/gen.file/banner.js.map +1 -1
  136. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +7 -2
  137. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +7 -2
  138. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -1
  139. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +24 -19
  140. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -1
  141. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +10 -3
  142. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +10 -3
  143. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -1
  144. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +9 -23
  145. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -1
  146. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +11 -18
  147. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -1
  148. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.d.ts +59 -0
  149. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js +87 -0
  150. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js.map +1 -0
  151. package/dist/index.d.ts +63 -18
  152. package/dist/index.js +45 -14
  153. package/dist/index.js.map +1 -1
  154. package/package.json +6 -6
  155. package/readme.md +212 -60
  156. package/dist/domain.objects/ApiGatewayRequestPayload.d.ts +0 -12
  157. package/dist/domain.objects/ApiGatewayRequestPayload.js.map +0 -1
  158. package/dist/domain.objects/ApiGatewayResponsePayload.js.map +0 -1
  159. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.d.ts +0 -36
  160. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent.js.map +0 -1
  161. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.d.ts +0 -19
  162. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js +0 -24
  163. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayload.js.map +0 -1
  164. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponsePayloadJson.js.map +0 -1
  165. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.d.ts +0 -27
  166. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js +0 -118
  167. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asUnifiedApiGatewayEvent.js.map +0 -1
  168. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js +0 -34
  169. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllWirePayloadKeysFound.js.map +0 -1
  170. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayEvent.js.map +0 -1
  171. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayEvent.js.map +0 -1
  172. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware.js.map +0 -1
  173. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.d.ts +0 -27
  174. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +0 -54
  175. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +0 -1
  176. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +0 -64
  177. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +0 -1
  178. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.d.ts +0 -20
  179. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +0 -31
  180. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +0 -1
  181. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.d.ts +0 -5
  182. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js +0 -16
  183. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionPayload.js.map +0 -1
@@ -0,0 +1,36 @@
1
+ import type middy from '@middy/core';
2
+ import type { ZodSchema } from 'zod';
3
+ import type { ApiGatewayHeadersDeclared } from '../ApiGatewayRequestEventUnified';
4
+ /**
5
+ * .what = validates the pair a caller may constrain — `{ headers?, payload }` — against
6
+ * `schema.input`, then writes the validated values back into the envelope
7
+ * .why = `headers` and `payload` are projections of the envelope's own slots, so the handler's
8
+ * bag and `event.headers` / `event.payload` are one object each. that holds only while
9
+ * this step replaces the envelope's values rather than parse beside them — a side bag
10
+ * would leave the envelope stale, silently (`domain.terms/headers.md`)
11
+ *
12
+ * .note = the pair, never the whole event: `request.event` must stay http-shaped through the
13
+ * chain. `@middy/http-cors` reads `request.event.headers` and derives the http method
14
+ * from `request.event` in its `after` hook (`@middy/http-cors/index.js:38,83,106`), so
15
+ * the caller's value cannot take the event's place
16
+ *
17
+ * .note = the constraint is sharper than "http-shaped", and the precise form is what any future
18
+ * input translate must honor. cors picks its method extractor by
19
+ * `request.event.version ?? '1.0'` (`index.js:38,106`), and
20
+ * `ApiGatewayRequestEventUnified` declares no `version` — so cors always falls to its v1
21
+ * extractor, `(event) => event.httpMethod`. that works only because the unified shape
22
+ * carries `httpMethod` and `headers` at its top level under v1's own names
23
+ * .note = `httpMethod` is a compat key rather than this shape's word — the shape names the
24
+ * method `method`, and `httpMethod` rides beside it solely because cors reads that name
25
+ * verbatim. it is absent from the interface and present on the object
26
+ * (`asApiGatewayRequestEventUnified.ts`), so a reader who greps the interface will not
27
+ * find it
28
+ */
29
+ export declare const genZodInputValidationMiddleware: <THeaders extends ApiGatewayHeadersDeclared, TPayload>(input: {
30
+ schema: ZodSchema<{
31
+ headers?: THeaders;
32
+ payload: TPayload;
33
+ }>;
34
+ }) => {
35
+ before: middy.MiddlewareFn<any, any>;
36
+ };
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genZodInputValidationMiddleware = void 0;
4
+ const getValidatedInput_1 = require("../../middleware/getValidatedInput");
5
+ /**
6
+ * .what = validates the pair a caller may constrain — `{ headers?, payload }` — against
7
+ * `schema.input`, then writes the validated values back into the envelope
8
+ * .why = `headers` and `payload` are projections of the envelope's own slots, so the handler's
9
+ * bag and `event.headers` / `event.payload` are one object each. that holds only while
10
+ * this step replaces the envelope's values rather than parse beside them — a side bag
11
+ * would leave the envelope stale, silently (`domain.terms/headers.md`)
12
+ *
13
+ * .note = the pair, never the whole event: `request.event` must stay http-shaped through the
14
+ * chain. `@middy/http-cors` reads `request.event.headers` and derives the http method
15
+ * from `request.event` in its `after` hook (`@middy/http-cors/index.js:38,83,106`), so
16
+ * the caller's value cannot take the event's place
17
+ *
18
+ * .note = the constraint is sharper than "http-shaped", and the precise form is what any future
19
+ * input translate must honor. cors picks its method extractor by
20
+ * `request.event.version ?? '1.0'` (`index.js:38,106`), and
21
+ * `ApiGatewayRequestEventUnified` declares no `version` — so cors always falls to its v1
22
+ * extractor, `(event) => event.httpMethod`. that works only because the unified shape
23
+ * carries `httpMethod` and `headers` at its top level under v1's own names
24
+ * .note = `httpMethod` is a compat key rather than this shape's word — the shape names the
25
+ * method `method`, and `httpMethod` rides beside it solely because cors reads that name
26
+ * verbatim. it is absent from the interface and present on the object
27
+ * (`asApiGatewayRequestEventUnified.ts`), so a reader who greps the interface will not
28
+ * find it
29
+ */
30
+ const genZodInputValidationMiddleware = (input) => {
31
+ const before = async (request) => {
32
+ /**
33
+ * .as = this middleware is typed `<any, any>`, so middy hands `request.event` over as
34
+ * `any`. the value IS a `ApiGatewayRequestEventUnified` by this point — the chain registers
35
+ * `genApiGatewayRequestEventNormalizationMiddleware` ahead of this one, and that is the
36
+ * middleware that writes the reconciled shape into the slot
37
+ * .removal = drops when middy gains typed inference across `.use`, at which point this
38
+ * middleware's own type parameters name the slot's shape and no cast is owed
39
+ *
40
+ * .note = a cast to this slot owes this `.as` / `.removal` pair at both sites — here, and at
41
+ * `asApiGatewayRequestEventUnified`'s read one file over. a convention applied to
42
+ * one of two sites is a class left open (rule.require.sweep-the-defect-class)
43
+ * .why not a shared reader = the two sites read the slot at different pipeline points, so
44
+ * they cast to different types — `ApiGatewayRequestEventOnwire` there, the
45
+ * reconciled shape here. a reader over two types at two points buys a type
46
+ * parameter and hides no complexity (rule.prefer.wet-over-dry)
47
+ */
48
+ const event = request.event;
49
+ /**
50
+ * the two slots a caller may constrain, read from the envelope the reconcile produced
51
+ *
52
+ * .note = `headers` is the WHOLE WIRE BAG, never the author's declared subset — and that
53
+ * asymmetry is the one footgun this design carries. the readme's phrase, "your schema
54
+ * governs the keys it declares", is true of the write-back below and false of this
55
+ * line. so a `.strict()` (or `z.strictObject`) header schema refuses every real
56
+ * request: api gateway always injects `host`, `x-forwarded-for`, `x-amzn-trace-id`,
57
+ * and cloudfront's own keys. measured — a strict bag yields `unrecognized_keys` on
58
+ * path `headers`, where the same schema in zod's default (strip) mode parses clean
59
+ *
60
+ * .why not a subset parse, which would make `.strict()` inert = the sdk cannot know which
61
+ * keys a schema declares without a reach into zod's internals, and that read fails
62
+ * open on a union, an effect, or a refinement. so the whole bag is what it can
63
+ * honestly hand over
64
+ * .why the remedy sits in `getValidationError` = the failure is already loud and total, so
65
+ * what it lacks is the cure rather than the symptom
66
+ * (`rule.require.errors-name-the-fix`). clamped by `[case5]` / `[case6]` there — the
67
+ * second is the positive control, since `.strict()` on `payload` is correct and must
68
+ * not draw the hint
69
+ */
70
+ const inputAfter = (0, getValidatedInput_1.getValidatedInput)({
71
+ schema: input.schema,
72
+ value: { headers: event.headers, payload: event.payload },
73
+ });
74
+ /**
75
+ * .note = deliberate mutation — `request` is middy's only channel to hand a value onward,
76
+ * and `event` is an alias of `request.event`, so these write through to the chain
77
+ * .note = a sweep for this class must match the alias as well as the receiver
78
+ * (`^\s*(event|response|payload)\.\w+\s*=`); a grep anchored on `request.` alone
79
+ * misses these two lines
80
+ */
81
+ /**
82
+ * .what = headers merge. the author's schema governs the keys it declares; every other wire
83
+ * key survives untouched
84
+ * .why = zod strips unknown keys, so a schema like `headers: z.object({ authorization })`
85
+ * yields a bag with no `origin` — and `@middy/http-cors` reads `origin` out of this
86
+ * very slot in its `after` hook. a wholesale replace does not merely starve cors, it
87
+ * makes cors emit a wrong answer: with `origins: [a, b]` an absent origin returns
88
+ * `options.origins[0]` unconditionally (`@middy/http-cors/index.js:2-14`), so a caller
89
+ * from `b` receives `Access-Control-Allow-Origin: a` and the browser refuses a
90
+ * response this sdk allowlisted
91
+ * .why a merge and not a replace = the axis is who else reads the slot
92
+ * (`rule.require.read-the-slot-a-dependency-reads`). cors reads `origin`
93
+ * (`index.js:84`) and `@middy/http-response-serializer` reads `accept`
94
+ * (`index.js:25`), so the wire bag is not the author's to delete from. the body has no
95
+ * such reader, which is why its rule below differs
96
+ * .note = the merge also absorbs the absent key: an author who declares no `headers` gets
97
+ * `result.data.headers === undefined`, and a spread of `undefined` is a no-op. so one
98
+ * rule serves both cases, and no branch is owed
99
+ */
100
+ event.headers = { ...event.headers, ...inputAfter.headers };
101
+ /**
102
+ * .what = payload replaces. the validated value takes the slot outright
103
+ * .why = the body is wholly the handler's — no middleware and no vendor reads it — so the
104
+ * schema's output is the only value that belongs here. it is also what lets
105
+ * `event.payload` carry the validated body, so the `invoke` hand-off owes no `as`-cast
106
+ * (`domain.terms/payload.md`)
107
+ */
108
+ event.payload = inputAfter.payload;
109
+ };
110
+ return { before };
111
+ };
112
+ exports.genZodInputValidationMiddleware = genZodInputValidationMiddleware;
113
+ //# sourceMappingURL=genZodInputValidationMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genZodInputValidationMiddleware.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.ts"],"names":[],"mappings":";;;AAGA,0EAAuE;AAMvE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,MAAM,+BAA+B,GAAG,CAe7C,KAED,EAEC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D;;;;;;;;;;;;;;;WAeG;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,KAAsC,CAAC;QAE7D;;;;;;;;;;;;;;;;;;;;WAoBG;QACH,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC;YACnC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;SAC1D,CAAC,CAAC;QAEH;;;;;;WAMG;QAEH;;;;;;;;;;;;;;;;;;WAkBG;QACH,KAAK,CAAC,OAAO,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;QAE5D;;;;;;WAMG;QACH,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACrC,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAzGW,QAAA,+BAA+B,mCAyG1C"}
@@ -0,0 +1,125 @@
1
+ import middy from '@middy/core';
2
+ import type { Context } from 'aws-lambda';
3
+ import type { ContextLogTrail } from 'sdk-logs';
4
+ import type { ZodSchema } from 'zod';
5
+ import type { ContextAwsLambdaServer } from '../../../domain.objects/ContextAwsLambdaServer';
6
+ import type { WrappedPayload } from '../../lambdaEndpointWire/frame/getIsWrappedPayload';
7
+ import { type FrozenDeep } from '../setEventFrozen';
8
+ import type { TranslateLog } from '../TranslateLog';
9
+ /**
10
+ * .what = wrapped payload format: event nested under `event` key with trail
11
+ * .why = re-exported from its canonical owner (`lambdaEndpointWire/frame`), the common
12
+ * ancestor of the three contexts that touch the frame — askLambdaEndpoint and
13
+ * runLambdaEndpoint/serde emit it, getUnwrappedEventWithExid reads it. one
14
+ * declaration, never a structural twin (`rule.prefer.most-common-denominator`)
15
+ */
16
+ export type { WrappedPayload };
17
+ /**
18
+ * .what = flat payload format: trail mixed into input
19
+ * .why = direct invocation or legacy callers may send this format
20
+ */
21
+ export type FlatPayload<TInput> = TInput & {
22
+ trail?: {
23
+ exid?: string;
24
+ } | null;
25
+ };
26
+ /**
27
+ * .what = union of all valid lambda handler input formats
28
+ * .why = handler accepts both wrapped and flat formats at runtime
29
+ */
30
+ export type LambdaHandlerInput<TInput> = FlatPayload<TInput> | WrappedPayload<TInput>;
31
+ /**
32
+ * .what = a direct invoke as it arrived on the wire — wrapped with a trail, or flat
33
+ */
34
+ export type AskEventOnwire = LambdaHandlerInput<unknown>;
35
+ /**
36
+ * .what = a direct invoke with its two arrival formats reconciled
37
+ * .why = `askLambdaEndpoint` sends `{ event, trail }` and a manual invoke sends the value flat;
38
+ * a handler that reads either is format-locked. `Unified` names that reconciliation, as it
39
+ * names the v1/v2 one at api gateway. the raw arrival is at `_.raw`
40
+ *
41
+ * .note = the envelope's body slot is `payload`, as in every family, so `payload ===
42
+ * event.payload` holds here too (`domain.terms/payload.md`). the trail rides
43
+ * `context.log.trail`, never this envelope (`domain.terms/trail.md`)
44
+ */
45
+ export interface AskEventUnified<TPayload> {
46
+ /**
47
+ * .what = the body — validated against `schema.input` by the time `invoke` runs
48
+ */
49
+ payload: TPayload;
50
+ /**
51
+ * .what = the ejection route — the invoke exactly as it arrived, trail wrapper included
52
+ */
53
+ _: {
54
+ raw: AskEventOnwire;
55
+ };
56
+ }
57
+ /**
58
+ * .what = endpoint operation signature type
59
+ * .why = named type for the invoke function
60
+ */
61
+ export type EndpointOperation<TInput, TOutput> = (input: {
62
+ /**
63
+ * .what = the body, parsed and validated — the value the handler was written to act on
64
+ * .note = the same object as `event.payload`, never a copy
65
+ */
66
+ payload: FrozenDeep<TInput>;
67
+ /**
68
+ * .what = the whole object that arrived, reconciled (`domain.terms/event.md`)
69
+ * .why frozen = every family freezes what it hands `invoke`
70
+ * (`rule.require.frozen-invoke-inputs`)
71
+ */
72
+ event: FrozenDeep<AskEventUnified<TInput>>;
73
+ }, context: ContextLogTrail) => Promise<TOutput>;
74
+ /**
75
+ * .what = sdk contract type for genLambdaEndpoint input
76
+ * .why = exported for consumer type inference
77
+ *
78
+ * ⚠️ .why `TInputBefore` exists = a zod schema is a CODEC, so it holds two faces, and they
79
+ * differ the moment a `.transform()` or an `X.contract()` sits in it. `ZodSchema<T>`
80
+ * is `ZodType<Output, Input>` with `Input` left at `unknown` — so one parameter named
81
+ * only the face the HANDLER sees, and the face the CALLER sends had no name at all
82
+ *
83
+ * - `TInput` = `inputAfter` — what `invoke` receives. an `X.contract()` position
84
+ * yields `WithImmute<Surfer>` here
85
+ * - `TInputBefore` = the WIRE face — what a caller puts on the wire. the same position
86
+ * yields the plain `Surfer` shape here
87
+ *
88
+ * ⇒ this is the TYPE-side twin of the `{ io: 'input' }` publish repair: both say the wire
89
+ * face is what crosses the border, and both were wrong in the same direction before.
90
+ * measured — a `[case11]` payload of plain objects failed to compile against a schema
91
+ * with three `X.contract()` positions, because the handler's own parameter demanded the
92
+ * instance face it is the codec's job to PRODUCE
93
+ *
94
+ * .note = it defaults to `TInput`, so every schema with no codec in it binds both to one type
95
+ * and no extant consumer sees a change (rule.require.retest-the-model-on-every-family
96
+ * — the pair collapses per-consumer here, which that rule names as the legitimate case)
97
+ *
98
+ * .note = the names trace to this repo's extant position vocabulary — `inputBefore` /
99
+ * `inputAfter` (rule.prefer.names-by-position-over-claim)
100
+ */
101
+ export type GenLambdaEndpointInput<TInput, TOutput, TInputBefore = TInput> = {
102
+ schema: {
103
+ input: ZodSchema<TInput, TInputBefore>;
104
+ output: ZodSchema<TOutput>;
105
+ };
106
+ invoke: EndpointOperation<TInput, TOutput>;
107
+ logTranslate?: TranslateLog;
108
+ };
109
+ /**
110
+ * .what = sdk contract type for genLambdaEndpoint context
111
+ * .why = exported for consumer type inference; the shared handler-side context
112
+ * ({ env?: EnvConfig; log? }) reused by genLambdaEndpoint + forApiGateway
113
+ */
114
+ export type GenLambdaEndpointContext = ContextAwsLambdaServer;
115
+ /**
116
+ * .what = generates a lambda handler with validation and trail context, for a DIRECT invoke
117
+ * .why = standardizes handler creation with schema validation and observability. the chain:
118
+ * constraint error (a caller fault becomes a response object, never a throw), internal
119
+ * service error (logs loudly), io logger, trail, input + output validation
120
+ *
121
+ * .note = this is a leaf of the `genLambdaEndpoint` family, and it is exported under its own
122
+ * variant name only. it is never re-exported bare from `src/index.ts` — a caller
123
+ * reaches it as `genLambdaEndpoint.forAsk` (`rule.forbid.unqualified-variant-exports`)
124
+ */
125
+ export declare const forAsk: <TInput, TOutput, TInputBefore = TInput>(input: GenLambdaEndpointInput<TInput, TOutput, TInputBefore>, context?: ContextAwsLambdaServer) => middy.MiddyfiedHandler<LambdaHandlerInput<TInputBefore>, TOutput, Error, Context>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.genLambdaEndpoint = void 0;
6
+ exports.forAsk = void 0;
7
7
  const core_1 = __importDefault(require("@middy/core"));
8
8
  const asContextLogTrail_1 = require("../asContextLogTrail");
9
9
  const genConstraintErrorMiddleware_1 = require("../middleware/genConstraintErrorMiddleware");
@@ -12,32 +12,46 @@ const genIntrospectionMiddleware_1 = require("../middleware/genIntrospectionMidd
12
12
  const genIoLoggerMiddleware_1 = require("../middleware/genIoLoggerMiddleware");
13
13
  const genTrailMiddleware_1 = require("../middleware/genTrailMiddleware");
14
14
  const getValidatedOutput_1 = require("../middleware/getValidatedOutput");
15
+ const setEventFrozen_1 = require("../setEventFrozen");
16
+ const genAskEventOnwireCaptureMiddleware_1 = require("./middleware/genAskEventOnwireCaptureMiddleware");
15
17
  const genZodEventValidationMiddleware_1 = require("./middleware/genZodEventValidationMiddleware");
16
18
  /**
17
- * .what = generates a lambda handler with validation and trail context
19
+ * .what = generates a lambda handler with validation and trail context, for a DIRECT invoke
18
20
  * .why = standardizes handler creation with schema validation and observability. the chain:
19
21
  * constraint error (a caller fault becomes a response object, never a throw), internal
20
22
  * service error (logs loudly), io logger, trail, input + output validation
23
+ *
24
+ * .note = this is a leaf of the `genLambdaEndpoint` family, and it is exported under its own
25
+ * variant name only. it is never re-exported bare from `src/index.ts` — a caller
26
+ * reaches it as `genLambdaEndpoint.forAsk` (`rule.forbid.unqualified-variant-exports`)
21
27
  */
22
- const genLambdaEndpoint = (
23
- // typed by the EXPORTED contract rather than an inline restatement — the two were hand-synced
24
- // before, and a rename that reached only one of them would have compiled
28
+ const forAsk = (
29
+ // typed by the exported contract rather than an inline restatement, so the two cannot drift
25
30
  input, context) => {
26
31
  // build logic that invokes user handler and validates output
27
32
  const logic = async (event, lambdaContext) => {
28
33
  // read the trail log `genTrailMiddleware` wrote; the cast lives in the shared reader
29
34
  const { log } = (0, asContextLogTrail_1.asContextLogTrail)({ context: lambdaContext });
30
- // invoke user handler
31
- const response = await input.invoke({ event }, { log });
35
+ /**
36
+ * .what = seals the envelope before the handler's turn
37
+ * .where = after the validator, which has already written the envelope into `request.event`,
38
+ * so what freezes IS what the handler reads
39
+ * .why = every family freezes, through this one shared helper
40
+ * (`rule.require.frozen-invoke-inputs`)
41
+ */
42
+ const eventFrozen = (0, setEventFrozen_1.setEventFrozen)({ event });
43
+ // invoke user handler; `payload` is the envelope's own slot, so the two stay one object
44
+ const response = await input.invoke({ payload: eventFrozen.payload, event: eventFrozen }, { log });
32
45
  // validate output and return typed result
33
46
  return (0, getValidatedOutput_1.getValidatedOutput)({ response, schema: input.schema.output });
34
47
  };
35
48
  // middleware order matters:
36
49
  // 1. error handlers (onError) - must be first to catch errors from all other middleware
37
- // 2. trail (onBefore) - injects trail context (must be early so isContempCaller is set for error handlers)
38
- // 3. io logger - logs input/output for debug
39
- // 4. introspection (onBefore) - intercepts introspect requests, returns schema
40
- // 5. validation (onBefore) - validates event against schema
50
+ // 2. onwire capture (onBefore) - keeps the raw invoke, before trail unwraps it
51
+ // 3. trail (onBefore) - injects trail context (must be early so isContempCaller is set for error handlers)
52
+ // 4. io logger - logs input/output for debug
53
+ // 5. introspection (onBefore) - intercepts introspect requests, returns schema
54
+ // 6. validation (onBefore) - validates the body, then writes the envelope into `request.event`
41
55
  const middlewares = [
42
56
  /**
43
57
  * .note = this family's response IS its payload, so a caller fault renders as the body
@@ -46,23 +60,25 @@ input, context) => {
46
60
  */
47
61
  (0, genConstraintErrorMiddleware_1.genConstraintErrorMiddleware)({ asOutputAfter: (body) => body }),
48
62
  (0, genInternalServiceErrorMiddleware_1.genInternalServiceErrorMiddleware)({ asOutputAfter: false }),
63
+ (0, genAskEventOnwireCaptureMiddleware_1.genAskEventOnwireCaptureMiddleware)(),
49
64
  (0, genTrailMiddleware_1.genTrailMiddleware)(),
50
65
  (0, genIoLoggerMiddleware_1.genIoLoggerMiddleware)({ logTranslate: input.logTranslate }),
51
66
  (0, genIntrospectionMiddleware_1.genIntrospectionMiddleware)({
52
67
  schema: input.schema,
53
68
  env: context?.env,
54
- // this family carries `inputAfter` at `event` itself, and its response IS its payload
69
+ // introspection runs before validation, so `request.event` still holds the bare body here
55
70
  asInputAfter: (request) => request.event,
56
71
  asOutputAfter: (schema) => schema,
57
72
  }),
58
73
  (0, genZodEventValidationMiddleware_1.genZodEventValidationMiddleware)({ schema: input.schema.input }),
59
74
  ];
60
75
  /**
61
- * .as = assertion needed because middleware transforms LambdaHandlerInput<TInput> to TInput
62
- * before logic runs, but typescript cannot track this transformation through middy
76
+ * .as = assertion needed because middleware transforms LambdaHandlerInput<TInputBefore> into
77
+ * AskEventUnified<TInput> before logic runs — it unwraps the frame, runs the codec, and
78
+ * builds the envelope — but typescript cannot track that through middy
63
79
  * .removal = if middy gains typed middleware inference, remove cast
64
80
  */
65
81
  return (0, core_1.default)(logic).use(middlewares);
66
82
  };
67
- exports.genLambdaEndpoint = genLambdaEndpoint;
68
- //# sourceMappingURL=genLambdaEndpoint.forAskEndpoint.js.map
83
+ exports.forAsk = forAsk;
84
+ //# sourceMappingURL=genLambdaEndpoint.forAsk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genLambdaEndpoint.forAsk.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAgC;AAOhC,4DAAyD;AACzD,6FAA0F;AAC1F,uGAAoG;AACpG,yFAAsF;AACtF,+EAA4E;AAC5E,yEAAsE;AACtE,yEAAsE;AACtE,sDAAoE;AAEpE,wGAAqG;AACrG,kGAA+F;AAqH/F;;;;;;;;;GASG;AACI,MAAM,MAAM,GAAG;AACpB,4FAA4F;AAC5F,KAA4D,EAC5D,OAAgC,EAQhC,EAAE;IACF,6DAA6D;IAC7D,MAAM,KAAK,GAAG,KAAK,EACjB,KAA8B,EAC9B,aAAsB,EACJ,EAAE;QACpB,qFAAqF;QACrF,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,qCAAiB,EAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;QAE9D;;;;;;WAMG;QACH,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAE9C,wFAAwF;QACxF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CACjC,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,EACpD,EAAE,GAAG,EAAE,CACR,CAAC;QAEF,0CAA0C;QAC1C,OAAO,IAAA,uCAAkB,EAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC;IAEF,4BAA4B;IAC5B,wFAAwF;IACxF,+EAA+E;IAC/E,2GAA2G;IAC3G,6CAA6C;IAC7C,+EAA+E;IAC/E,+FAA+F;IAC/F,MAAM,WAAW,GAAG;QAClB;;;;WAIG;QACH,IAAA,2DAA4B,EAAC,EAAE,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;QAC/D,IAAA,qEAAiC,EAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAC3D,IAAA,uEAAkC,GAAE;QACpC,IAAA,uCAAkB,GAAE;QACpB,IAAA,6CAAqB,EAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;QAC3D,IAAA,uDAA0B,EAAC;YACzB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,GAAG,EAAE,OAAO,EAAE,GAAG;YACjB,0FAA0F;YAC1F,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK;YACxC,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;SAClC,CAAC;QACF,IAAA,iEAA+B,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KAChE,CAAC;IAEF;;;;;OAKG;IACH,OAAO,IAAA,cAAK,EACV,KAGqB,CACtB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACrB,CAAC,CAAC;AA/EW,QAAA,MAAM,UA+EjB"}
@@ -0,0 +1,18 @@
1
+ import type middy from '@middy/core';
2
+ /**
3
+ * .what = the key under which the raw invoke rides in middy's `request.internal`
4
+ * .why = one name, shared by the writer and the reader, so the two cannot drift
5
+ */
6
+ export declare const KEY_OF_ASK_EVENT_ONWIRE = "askEventOnwire";
7
+ /**
8
+ * .what = keeps the invoke exactly as it arrived, before `genTrailMiddleware` unwraps it
9
+ * .why = the envelope's `_.raw` must hold what arrived — trail wrapper included — and the trail
10
+ * step replaces `request.event` with the unwrapped body. so the raw value is saved first
11
+ *
12
+ * .why `request.internal` = middy's sanctioned side-channel between middlewares; no vendor
13
+ * middleware reads our key (`rule.require.read-the-slot-a-dependency-reads`)
14
+ * .where = anywhere ahead of `genTrailMiddleware` in the chain
15
+ */
16
+ export declare const genAskEventOnwireCaptureMiddleware: () => {
17
+ before: middy.MiddlewareFn<any, any>;
18
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genAskEventOnwireCaptureMiddleware = exports.KEY_OF_ASK_EVENT_ONWIRE = void 0;
4
+ /**
5
+ * .what = the key under which the raw invoke rides in middy's `request.internal`
6
+ * .why = one name, shared by the writer and the reader, so the two cannot drift
7
+ */
8
+ exports.KEY_OF_ASK_EVENT_ONWIRE = 'askEventOnwire';
9
+ /**
10
+ * .what = keeps the invoke exactly as it arrived, before `genTrailMiddleware` unwraps it
11
+ * .why = the envelope's `_.raw` must hold what arrived — trail wrapper included — and the trail
12
+ * step replaces `request.event` with the unwrapped body. so the raw value is saved first
13
+ *
14
+ * .why `request.internal` = middy's sanctioned side-channel between middlewares; no vendor
15
+ * middleware reads our key (`rule.require.read-the-slot-a-dependency-reads`)
16
+ * .where = anywhere ahead of `genTrailMiddleware` in the chain
17
+ */
18
+ const genAskEventOnwireCaptureMiddleware = () => {
19
+ const before = async (request) => {
20
+ // .note = deliberate mutation — `request` is middy's only channel to hand a value onward
21
+ request.internal = {
22
+ ...request.internal,
23
+ [exports.KEY_OF_ASK_EVENT_ONWIRE]: request.event,
24
+ };
25
+ };
26
+ return { before };
27
+ };
28
+ exports.genAskEventOnwireCaptureMiddleware = genAskEventOnwireCaptureMiddleware;
29
+ //# sourceMappingURL=genAskEventOnwireCaptureMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genAskEventOnwireCaptureMiddleware.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACU,QAAA,uBAAuB,GAAG,gBAAgB,CAAC;AAExD;;;;;;;;GAQG;AACI,MAAM,kCAAkC,GAAG,GAEhD,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,yFAAyF;QACzF,OAAO,CAAC,QAAQ,GAAG;YACjB,GAAG,OAAO,CAAC,QAAQ;YACnB,CAAC,+BAAuB,CAAC,EAAE,OAAO,CAAC,KAAK;SACzC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AAZW,QAAA,kCAAkC,sCAY7C"}
@@ -0,0 +1,23 @@
1
+ import type middy from '@middy/core';
2
+ import type { ZodSchema } from 'zod';
3
+ /**
4
+ * .what = validates the body against a zod schema, then writes the reconciled envelope
5
+ * `{ payload, _: { raw } }` into `request.event`
6
+ * .why = the ask-endpoint family reaches this step with the unwrapped body AT `request.event`,
7
+ * so the body is what the schema describes. the envelope is built here, after the parse,
8
+ * so its `payload` slot holds the VALIDATED value — the projection `payload ===
9
+ * event.payload` rests on it (`domain.terms/payload.md`)
10
+ *
11
+ * .why not shared with its api-gateway peer = `genZodInputValidationMiddleware` differs on two
12
+ * axes, and each alone would be enough:
13
+ * - the home — that chain must keep `request.event` http-shaped for
14
+ * `@middy/http-cors`, so its body rides at `event.payload` of an envelope it did
15
+ * not build. this one builds its own envelope
16
+ * - the shape — its schema describes a pair (`{ headers?, payload }`) and it writes
17
+ * back into two envelope slots. this one describes a single value
18
+ */
19
+ export declare const genZodEventValidationMiddleware: <TInput>(input: {
20
+ schema: ZodSchema<TInput>;
21
+ }) => {
22
+ before: middy.MiddlewareFn<any, any>;
23
+ };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genZodEventValidationMiddleware = void 0;
4
+ const getValidatedInput_1 = require("../../middleware/getValidatedInput");
5
+ const genAskEventOnwireCaptureMiddleware_1 = require("./genAskEventOnwireCaptureMiddleware");
6
+ /**
7
+ * .what = validates the body against a zod schema, then writes the reconciled envelope
8
+ * `{ payload, _: { raw } }` into `request.event`
9
+ * .why = the ask-endpoint family reaches this step with the unwrapped body AT `request.event`,
10
+ * so the body is what the schema describes. the envelope is built here, after the parse,
11
+ * so its `payload` slot holds the VALIDATED value — the projection `payload ===
12
+ * event.payload` rests on it (`domain.terms/payload.md`)
13
+ *
14
+ * .why not shared with its api-gateway peer = `genZodInputValidationMiddleware` differs on two
15
+ * axes, and each alone would be enough:
16
+ * - the home — that chain must keep `request.event` http-shaped for
17
+ * `@middy/http-cors`, so its body rides at `event.payload` of an envelope it did
18
+ * not build. this one builds its own envelope
19
+ * - the shape — its schema describes a pair (`{ headers?, payload }`) and it writes
20
+ * back into two envelope slots. this one describes a single value
21
+ */
22
+ const genZodEventValidationMiddleware = (input) => {
23
+ const before = async (request) => {
24
+ const inputAfter = (0, getValidatedInput_1.getValidatedInput)({
25
+ schema: input.schema,
26
+ value: request.event,
27
+ });
28
+ // write the envelope, with the parsed (transformed) body in its payload slot
29
+ // .note = deliberate mutation — `request` is middy's only channel to hand a value onward
30
+ request.event = {
31
+ payload: inputAfter,
32
+ _: { raw: request.internal?.[genAskEventOnwireCaptureMiddleware_1.KEY_OF_ASK_EVENT_ONWIRE] },
33
+ };
34
+ };
35
+ return { before };
36
+ };
37
+ exports.genZodEventValidationMiddleware = genZodEventValidationMiddleware;
38
+ //# sourceMappingURL=genZodEventValidationMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genZodEventValidationMiddleware.js","sourceRoot":"","sources":["../../../../../src/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.ts"],"names":[],"mappings":";;;AAGA,0EAAuE;AACvE,6FAA+E;AAE/E;;;;;;;;;;;;;;;GAeG;AACI,MAAM,+BAA+B,GAAG,CAAS,KAEvD,EAEC,EAAE;IACF,MAAM,MAAM,GAAiC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7D,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC;YACnC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;QAEH,6EAA6E;QAC7E,yFAAyF;QACzF,OAAO,CAAC,KAAK,GAAG;YACd,OAAO,EAAE,UAAU;YACnB,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,4DAAuB,CAAC,EAAE;SACxD,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AApBW,QAAA,+BAA+B,mCAoB1C"}
@@ -0,0 +1,123 @@
1
+ import type { SQSEvent, SQSRecord } from 'aws-lambda';
2
+ /**
3
+ * .what = the header bag as the wire carries it — one name per value, each a string or absent
4
+ * .why = `headers` names the metadata bag that rides beside the body, in any transport that
5
+ * carries one. sqs calls it `messageAttributes`; same concept, same word
6
+ * (`domain.terms/headers.md`)
7
+ *
8
+ * .note = flat, where aws wraps each value as `{ stringValue, dataType }`. the wrapper is a codec
9
+ * detail rather than a second dimension; the typed bag is at `_.raw.messageAttributes`
10
+ * .note = a `Binary` attribute's `binaryValue` lands here under its own name. to carry only
11
+ * `stringValue` would make a binary attribute read as absent
12
+ * .note = aws declares `stringListValues` / `binaryListValues` "Not implemented. Reserved for
13
+ * future use.", so neither is carried
14
+ */
15
+ export type SqsHeadersOnwire = Record<string, string | undefined>;
16
+ /**
17
+ * .what = the shape an author's `schema.input.headers` may name — the wire bag, or absent
18
+ * .why = the `headers` key is optional, so header enforcement is opt-in and no extant sender can
19
+ * be refused by a schema that never mentioned them (`rule.require.explicit-optout`)
20
+ *
21
+ * .note = bound rather than free, because the validator spreads the validated headers back over
22
+ * the wire bag: `{ ...'abc' }` yields `{ 0: 'a', 1: 'b', 2: 'c' }` — a char map under the
23
+ * name of a header bag. the bound is the only layer that refuses it
24
+ */
25
+ export type SqsHeadersDeclared = SqsHeadersOnwire | undefined;
26
+ /**
27
+ * .what = the header bag a handler receives — the declared keys, beside every other attribute set
28
+ * .why = the validator writes headers back as a merge rather than a replace, so the emitted value
29
+ * carries both. a type of `THeadersDeclared` alone would regress the bag's open read
30
+ *
31
+ * .note = a conditional rather than a bare intersection: `SqsHeadersDeclared` admits `undefined`,
32
+ * and `undefined & Record<string, string | undefined>` reduces to `never` — so the bare
33
+ * form would hand a `never` to every handler that omits the `headers` key
34
+ * .note = clamped at the type level by `perRecord`'s `[case13]`, on both arms
35
+ */
36
+ export type SqsHeadersMerged<THeadersDeclared extends SqsHeadersDeclared> = THeadersDeclared extends undefined ? SqsHeadersOnwire : SqsHeadersOnwire & THeadersDeclared;
37
+ /**
38
+ * .what = the two slots a caller may constrain on one sqs record
39
+ * .why = the validator writes the validated values back into the envelope, so the envelope's
40
+ * types must move with the caller's schema. without the parameter, `payload` could only be
41
+ * `unknown` and an `as`-cast would return at the `invoke` hand-off
42
+ *
43
+ * .note = the shape describes ONE record, in both variants. `perBatch` applies it N times rather
44
+ * than widen it, which is what lets one `schema.input` serve both
45
+ */
46
+ export interface SqsRecordDecodedShape {
47
+ headers: SqsHeadersOnwire;
48
+ payload: unknown;
49
+ }
50
+ /**
51
+ * .what = one sqs message, with its body decoded and its attributes flattened
52
+ * .why `Decoded` and not `Unified` = `Unified` names a v1/v2 split reconciled, and sqs has no
53
+ * version axis — one wire shape serves every queue. `Decoded` names the state of the
54
+ * value: aws hands the body over as a string and the attributes inside a vendor wrapper
55
+ *
56
+ * .note = header keys are carried verbatim, where the api-gateway family lowercases them. rfc
57
+ * 9110 §5.1 makes http field names case-insensitive; sqs attribute names are
58
+ * case-sensitive, so a fold here would merge two values the sender kept apart
59
+ * .note = there is no `SqsEventOnwire` alias. sqs's wire form is a single vendor type, `SQSEvent`,
60
+ * already named; the api-gateway alias exists because its wire form is an unnamed union
61
+ * .note = `headers` and `payload` are the handler's projections of these slots — one object each,
62
+ * never a copy. that holds only because the validator replaces the values here
63
+ */
64
+ export interface SqsRecordDecoded<TShape extends SqsRecordDecodedShape = SqsRecordDecodedShape> {
65
+ /**
66
+ * .what = the message's own identifier, as sqs issued it
67
+ * .why `id` and not `messageId` = the type already says `SqsRecord`, so `message` would restate
68
+ * a dimension the name carries. aws's wire name is `messageId`
69
+ * .note = `perRecord` never reads it. `perBatch` returns
70
+ * `{ batchItemFailures: [{ itemIdentifier }] }`, and this is the value that goes in
71
+ */
72
+ id: string;
73
+ /**
74
+ * .what = the message attributes the sender set, flattened to one name per value
75
+ * .note = keys are verbatim — sqs attribute names are case-sensitive
76
+ * .note = validated against `schema.input.headers` where the author declared one; an absent key
77
+ * constrains naught
78
+ */
79
+ headers: TShape['headers'];
80
+ /**
81
+ * .what = the body — parsed, and validated by the time `logic` runs
82
+ * .why = the sdk's word for the body in every family. an sqs message has a body, so it has a
83
+ * payload (`domain.terms/payload.md`)
84
+ * .note = there is no unvalidated parsed body on this shape. the untouched wire string is at
85
+ * `_.raw.body`, for a handler that must verify a signature over the exact bytes
86
+ */
87
+ payload: TShape['payload'];
88
+ /**
89
+ * .what = the ejection route — the vendor record, before this shape decoded it
90
+ * .why = `_` marks an escape hatch rather than a paved path. `receiptHandle`,
91
+ * `attributes.ApproximateReceiveCount`, `md5OfBody`, and the typed `messageAttributes`
92
+ * bag each live here
93
+ * .note = the vendor record by identity, never a copy — clamped by `perRecord`'s `[case12]`. a
94
+ * copy is invisible to a field check and drops whatever field the next handler needs
95
+ */
96
+ _: {
97
+ raw: SQSRecord;
98
+ };
99
+ }
100
+ /**
101
+ * .what = an sqs invoke, with every record decoded
102
+ * .why = `event` is the whole object that arrived, in every family. an sqs invoke carries N
103
+ * messages, so the whole object is the batch rather than one message of it
104
+ * (`domain.terms/event.md`)
105
+ *
106
+ * .note = the same shape for both variants. `perRecord` receives the whole event and refuses a
107
+ * batch of more than one, loudly — so `event.records.length` is a fact about the invoke
108
+ * rather than about the variant, and a handler that reads it reads the truth in both
109
+ */
110
+ export interface SqsEventDecoded<TShape extends SqsRecordDecodedShape = SqsRecordDecodedShape> {
111
+ /**
112
+ * .what = the messages this invoke carries, in the order sqs delivered them
113
+ * .why `records` and not `Records` = aws capitalizes it on the wire; this shape does not. the
114
+ * untouched bag is at `_.raw.Records`
115
+ */
116
+ records: SqsRecordDecoded<TShape>[];
117
+ /**
118
+ * .what = the ejection route — the wire form, before this shape decoded it
119
+ */
120
+ _: {
121
+ raw: SQSEvent;
122
+ };
123
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ApiGatewayResponsePayload.js.map
3
+ //# sourceMappingURL=SqsEventDecoded.js.map