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
package/dist/index.d.ts CHANGED
@@ -2,6 +2,10 @@
2
2
  * sdk-aws-lambda
3
3
  *
4
4
  * define endpoints, ask endpoints, auto-propagate trace-ids.
5
+ *
6
+ * .note = the trace-id propagates lambda to lambda, via the `{ event, trail }` wrapper
7
+ * `askLambdaEndpoint` sends. it does not cross an http or a queue boundary — those
8
+ * triggers mint a fresh `exid` per invoke (`domain.terms/trail.md`)
5
9
  */
6
10
  export { BadRequestError } from 'helpful-errors';
7
11
  /**
@@ -11,9 +15,9 @@ export { BadRequestError } from 'helpful-errors';
11
15
  * library that makes process-lifetime state owes the caller a way to release it
12
16
  */
13
17
  export { delLambdaSdks } from './access/sdks/lambda/genLambdaSdk';
14
- export type { ApiGatewayRequestPayload } from './domain.objects/ApiGatewayRequestPayload';
18
+ export type { ApiGatewayRequestEventOnwire } from './domain.objects/ApiGatewayRequestEventOnwire';
15
19
  export type { ApiGatewayResponse } from './domain.objects/ApiGatewayResponse';
16
- export type { ApiGatewayResponsePayload } from './domain.objects/ApiGatewayResponsePayload';
20
+ export type { ApiGatewayResponseOnwire } from './domain.objects/ApiGatewayResponseOnwire';
17
21
  export type { ContextAwsLambdaCaller } from './domain.objects/ContextAwsLambdaCaller';
18
22
  export type { ContextAwsLambdaServer, EnvAccess, EnvConfig, } from './domain.objects/ContextAwsLambdaServer';
19
23
  export { GeneratedFile } from './domain.objects/GeneratedFile';
@@ -35,23 +39,36 @@ export { asCacheWithoutSet } from './domain.operations/askLambdaEndpoint/cache/a
35
39
  export { getAskLambdaCacheKey } from './domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey';
36
40
  export { asLambdaEndpoint } from './domain.operations/asLambdaEndpoint/asLambdaEndpoint';
37
41
  export { asLambdaEvent } from './domain.operations/asLambdaEvent/asLambdaEvent';
42
+ /**
43
+ * .what = the `genLambdaEndpoint` family —
44
+ * `{ forAsk, forApiGateway, forSqs: { perRecord, perBatch } }`
45
+ * .why = no variant is exported bare beside it, so autocomplete enumerates the family
46
+ * (`rule.forbid.unqualified-variant-exports`)
47
+ */
48
+ export { genLambdaEndpoint } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint';
49
+ export type { ApiGatewayHeadersDeclared, ApiGatewayHeadersMerged, ApiGatewayHeadersOnwire, ApiGatewayRequestEventUnified, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/ApiGatewayRequestEventUnified';
38
50
  export { asApiGatewayResponseSchema } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema';
39
51
  export type { CorsConfig, ForApiGatewayContext, ForApiGatewayInput, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
40
- export { forApiGateway } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway';
41
52
  export { isApiGatewayResponse } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse';
42
- export { genApiGatewayEventNormalizationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware';
53
+ export { genApiGatewayRequestEventNormalizationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware';
43
54
  export { genContentTypeCoherenceMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware';
44
- export { genZodBodyValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware';
45
- export type { UnifiedApiGatewayEvent } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/UnifiedApiGatewayEvent';
46
- export type { EndpointOperation, FlatPayload, GenLambdaEndpointContext, GenLambdaEndpointInput, LambdaHandlerInput, WrappedPayload, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint';
47
- export { genLambdaEndpoint } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint';
48
- export { genZodEventValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware';
55
+ export { genZodInputValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware';
56
+ export type { EndpointOperation, FlatPayload, GenLambdaEndpointContext, GenLambdaEndpointInput, LambdaHandlerInput, WrappedPayload, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk';
57
+ export { genZodEventValidationMiddleware } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware';
58
+ /**
59
+ * .what = the `forSqs` sub-family's types, through `SqsEventDecoded`
60
+ * .why = each is reachable from `ForSqsPerRecordInput` / `ForSqsPerBatchInput`, so a consumer
61
+ * must be able to name it
62
+ * .note = the chain's own operations (`asSqsEventDecoded`, `setSqsRecordValidated`, …) stay
63
+ * unexported, as do the api-gateway peers
64
+ */
65
+ export type { ForSqsPerBatchInput, SqsRecordSuccessRef, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch';
66
+ export type { ForSqsPerRecordInput } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord';
67
+ export type { SqsEventDecoded, SqsHeadersDeclared, SqsHeadersMerged, SqsHeadersOnwire, SqsRecordDecoded, SqsRecordDecodedShape, } from './domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/SqsEventDecoded';
49
68
  /**
50
69
  * .what = the shared `request.context` reader every exported middleware uses
51
- * .why = it centralizes the one cast that reaches the trail fields this sdk itself wrote onto
52
- * the lambda context. a consumer who authors a PEER of the exported middlewares would
53
- * otherwise restate that cast — the exact sprawl this reader exists to retire
54
- * (rule.forbid.as-cast)
70
+ * .why = it holds the one cast to the trail fields this sdk writes, so a consumer who authors a
71
+ * peer middleware need not restate it (rule.forbid.as-cast)
55
72
  */
56
73
  export { asContextTrailed, type ContextTrailed, } from './domain.operations/genLambdaEndpoint/middleware/asContextTrailed';
57
74
  export { genConstraintErrorMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware';
@@ -62,18 +79,46 @@ export { genTrailMiddleware } from './domain.operations/genLambdaEndpoint/middle
62
79
  export { genZodOutputValidationMiddleware } from './domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware';
63
80
  /**
64
81
  * .what = the two error-body shapes `genConstraintErrorMiddleware.asOutputAfter` receives
65
- * .why = that middleware is public, so its OWN parameter type must be nameable by a consumer.
66
- * an unexported parameter type forces an `any` or a hand-copied re-declaration at the
67
- * public boundary (rule.forbid.as-cast)
82
+ * .why = a public middleware's parameter types must be nameable by a consumer
68
83
  */
69
84
  export type { LambdaEndpointErrorResponseBodyAncient, LambdaEndpointErrorResponseBodyContemp, } from './domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody';
70
85
  /**
86
+ * .what = the two ROOT primitives a consumer needs to validate a border in a chain of their own
87
+ * .why = the advanced-use exports above are middlewares, and the one on the OUTPUT side —
88
+ * `genZodOutputValidationMiddleware` — is positionally ambiguous by its own admission
89
+ * (F33). so a consumer who wanted to validate output safely had exactly one public tool,
90
+ * and it was the foot-gun: the atom was hidden and the risky composite was public
91
+ *
92
+ * these two are unambiguous by construction — each takes the value it validates as an
93
+ * argument rather than reads it out of a slot whose type depends on registration order.
94
+ * so a consumer builds their own correctly-ordered step and the ambiguity never reaches it
95
+ *
96
+ * .note = this does NOT settle F33. that fulcrum asks whether the middleware should keep its
97
+ * export at all, and it belongs to the bound that shipped it
98
+ * (`.behavior/v2026_08_03.feat-apigateway-wire-response/`). what this changes is that the
99
+ * ambiguous export is no longer the ONLY option — which is the half that needed no
100
+ * wisher call, because it breaks no consumer (rule.always.fix-forward-under-scouts-honor)
101
+ *
102
+ * .note = each metadata type rides along for the same reason `LambdaEndpointErrorResponseBody*`
103
+ * does — a consumer who catches the throw must be able to NAME what `.metadata` holds,
104
+ * or they reach for an `as`-cast at the public boundary (rule.forbid.as-cast)
105
+ */
106
+ export { getValidatedInput } from './domain.operations/genLambdaEndpoint/middleware/getValidatedInput';
107
+ export { getValidatedOutput, type OutputValidationErrorMetadata, } from './domain.operations/genLambdaEndpoint/middleware/getValidatedOutput';
108
+ export type { ValidationErrorMetadata } from './domain.operations/genLambdaEndpoint/middleware/getValidationError';
109
+ export type { ZodIssueSummary } from './domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary';
110
+ /**
111
+ * .what = types reachable from the public `ForApiGatewayInput` signature
112
+ * .why = a consumer who declares a handler apart from the call site must be able to name them
113
+ */
114
+ export type { FrozenDeep } from './domain.operations/genLambdaEndpoint/setEventFrozen';
115
+ /**
116
+ * .what = the `logTranslate` config type
71
117
  * .note = `TranslateLog` is public because `logTranslate` accepts it, and it replaces the
72
118
  * formerly-public `IoLogTranslate`. its three designed peers — `Translate<TShapes>`,
73
119
  * `LambdaEndpointShapes`, `Translator<TFrom, TInto>` — are DELETED rather than
74
120
  * unexported: no config field ever accepted a `Translate`, so all three would ship with
75
- * zero consumers (rule.prefer.wet-over-dry). the design survives in `1.vision.yield.md`,
76
- * so a later round restores a TERM from a record rather than a dead declaration
121
+ * zero consumers (rule.prefer.wet-over-dry)
77
122
  */
78
123
  export type { TranslateLog } from './domain.operations/genLambdaEndpoint/TranslateLog';
79
124
  export { genServiceSdk } from './domain.operations/genServiceSdk/genServiceSdk';
package/dist/index.js CHANGED
@@ -3,9 +3,13 @@
3
3
  * sdk-aws-lambda
4
4
  *
5
5
  * define endpoints, ask endpoints, auto-propagate trace-ids.
6
+ *
7
+ * .note = the trace-id propagates lambda to lambda, via the `{ event, trail }` wrapper
8
+ * `askLambdaEndpoint` sends. it does not cross an http or a queue boundary — those
9
+ * triggers mint a fresh `exid` per invoke (`domain.terms/trail.md`)
6
10
  */
7
11
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.runLambdaEndpoint = exports.isLambdaEndpointErrorEnvelopeContemp = exports.isLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointErrorEnvelopeContemp = exports.asLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointOutput = exports.asLambdaContext = exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genLambdaEndpoint = exports.genZodBodyValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.forApiGateway = exports.asApiGatewayResponseSchema = exports.asLambdaEvent = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.delLambdaSdks = exports.BadRequestError = void 0;
12
+ exports.runLambdaEndpoint = exports.isLambdaEndpointErrorEnvelopeContemp = exports.isLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointErrorEnvelopeContemp = exports.asLambdaEndpointErrorEnvelopeAncient = exports.asLambdaEndpointOutput = exports.asLambdaContext = exports.getOneLambdaContract = exports.getAllLambdaFunctionsByPrefix = exports.getAllLambdaContracts = exports.genServiceSdk = exports.getValidatedOutput = exports.getValidatedInput = exports.genZodOutputValidationMiddleware = exports.genTrailMiddleware = exports.genIoLoggerMiddleware = exports.genIntrospectionMiddleware = exports.genInternalServiceErrorMiddleware = exports.genConstraintErrorMiddleware = exports.asContextTrailed = exports.genZodEventValidationMiddleware = exports.genZodInputValidationMiddleware = exports.genContentTypeCoherenceMiddleware = exports.genApiGatewayRequestEventNormalizationMiddleware = exports.isApiGatewayResponse = exports.asApiGatewayResponseSchema = exports.genLambdaEndpoint = exports.asLambdaEvent = exports.asLambdaEndpoint = exports.getAskLambdaCacheKey = exports.asCacheWithoutSet = exports.askLambdaEndpoint = exports.LambdaServiceNotFoundError = exports.LambdaIntrospectionNotSupportedError = exports.LambdaIntrospectionBlockedError = exports.LambdaFunctionNotFoundError = exports.LambdaEndpointError = exports.LambdaEndpoint = exports.LambdaDomainObjectRefUnbindableError = exports.LambdaDomainObjectNotCapturableError = exports.LambdaCredentialsAbsentError = exports.HttpStatusCode = exports.GeneratedFile = exports.delLambdaSdks = exports.BadRequestError = void 0;
9
13
  // re-export from helpful-errors for convenience
10
14
  var helpful_errors_1 = require("helpful-errors");
11
15
  Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return helpful_errors_1.BadRequestError; } });
@@ -53,28 +57,30 @@ Object.defineProperty(exports, "asLambdaEndpoint", { enumerable: true, get: func
53
57
  // test utils — the event source axis (construct the envelope a source delivers)
54
58
  var asLambdaEvent_1 = require("./domain.operations/asLambdaEvent/asLambdaEvent");
55
59
  Object.defineProperty(exports, "asLambdaEvent", { enumerable: true, get: function () { return asLambdaEvent_1.asLambdaEvent; } });
60
+ /**
61
+ * .what = the `genLambdaEndpoint` family —
62
+ * `{ forAsk, forApiGateway, forSqs: { perRecord, perBatch } }`
63
+ * .why = no variant is exported bare beside it, so autocomplete enumerates the family
64
+ * (`rule.forbid.unqualified-variant-exports`)
65
+ */
66
+ var genLambdaEndpoint_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint");
67
+ Object.defineProperty(exports, "genLambdaEndpoint", { enumerable: true, get: function () { return genLambdaEndpoint_1.genLambdaEndpoint; } });
56
68
  var asApiGatewayResponseSchema_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema");
57
69
  Object.defineProperty(exports, "asApiGatewayResponseSchema", { enumerable: true, get: function () { return asApiGatewayResponseSchema_1.asApiGatewayResponseSchema; } });
58
- var genLambdaEndpoint_forApiGateway_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway");
59
- Object.defineProperty(exports, "forApiGateway", { enumerable: true, get: function () { return genLambdaEndpoint_forApiGateway_1.forApiGateway; } });
60
70
  var isApiGatewayResponse_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse");
61
71
  Object.defineProperty(exports, "isApiGatewayResponse", { enumerable: true, get: function () { return isApiGatewayResponse_1.isApiGatewayResponse; } });
62
- var genApiGatewayEventNormalizationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayEventNormalizationMiddleware");
63
- Object.defineProperty(exports, "genApiGatewayEventNormalizationMiddleware", { enumerable: true, get: function () { return genApiGatewayEventNormalizationMiddleware_1.genApiGatewayEventNormalizationMiddleware; } });
72
+ var genApiGatewayRequestEventNormalizationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware");
73
+ Object.defineProperty(exports, "genApiGatewayRequestEventNormalizationMiddleware", { enumerable: true, get: function () { return genApiGatewayRequestEventNormalizationMiddleware_1.genApiGatewayRequestEventNormalizationMiddleware; } });
64
74
  var genContentTypeCoherenceMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware");
65
75
  Object.defineProperty(exports, "genContentTypeCoherenceMiddleware", { enumerable: true, get: function () { return genContentTypeCoherenceMiddleware_1.genContentTypeCoherenceMiddleware; } });
66
- var genZodBodyValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware");
67
- Object.defineProperty(exports, "genZodBodyValidationMiddleware", { enumerable: true, get: function () { return genZodBodyValidationMiddleware_1.genZodBodyValidationMiddleware; } });
68
- var genLambdaEndpoint_forAskEndpoint_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint");
69
- Object.defineProperty(exports, "genLambdaEndpoint", { enumerable: true, get: function () { return genLambdaEndpoint_forAskEndpoint_1.genLambdaEndpoint; } });
70
- var genZodEventValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware");
76
+ var genZodInputValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware");
77
+ Object.defineProperty(exports, "genZodInputValidationMiddleware", { enumerable: true, get: function () { return genZodInputValidationMiddleware_1.genZodInputValidationMiddleware; } });
78
+ var genZodEventValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware");
71
79
  Object.defineProperty(exports, "genZodEventValidationMiddleware", { enumerable: true, get: function () { return genZodEventValidationMiddleware_1.genZodEventValidationMiddleware; } });
72
80
  /**
73
81
  * .what = the shared `request.context` reader every exported middleware uses
74
- * .why = it centralizes the one cast that reaches the trail fields this sdk itself wrote onto
75
- * the lambda context. a consumer who authors a PEER of the exported middlewares would
76
- * otherwise restate that cast — the exact sprawl this reader exists to retire
77
- * (rule.forbid.as-cast)
82
+ * .why = it holds the one cast to the trail fields this sdk writes, so a consumer who authors a
83
+ * peer middleware need not restate it (rule.forbid.as-cast)
78
84
  */
79
85
  var asContextTrailed_1 = require("./domain.operations/genLambdaEndpoint/middleware/asContextTrailed");
80
86
  Object.defineProperty(exports, "asContextTrailed", { enumerable: true, get: function () { return asContextTrailed_1.asContextTrailed; } });
@@ -91,6 +97,31 @@ var genTrailMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middle
91
97
  Object.defineProperty(exports, "genTrailMiddleware", { enumerable: true, get: function () { return genTrailMiddleware_1.genTrailMiddleware; } });
92
98
  var genZodOutputValidationMiddleware_1 = require("./domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware");
93
99
  Object.defineProperty(exports, "genZodOutputValidationMiddleware", { enumerable: true, get: function () { return genZodOutputValidationMiddleware_1.genZodOutputValidationMiddleware; } });
100
+ /**
101
+ * .what = the two ROOT primitives a consumer needs to validate a border in a chain of their own
102
+ * .why = the advanced-use exports above are middlewares, and the one on the OUTPUT side —
103
+ * `genZodOutputValidationMiddleware` — is positionally ambiguous by its own admission
104
+ * (F33). so a consumer who wanted to validate output safely had exactly one public tool,
105
+ * and it was the foot-gun: the atom was hidden and the risky composite was public
106
+ *
107
+ * these two are unambiguous by construction — each takes the value it validates as an
108
+ * argument rather than reads it out of a slot whose type depends on registration order.
109
+ * so a consumer builds their own correctly-ordered step and the ambiguity never reaches it
110
+ *
111
+ * .note = this does NOT settle F33. that fulcrum asks whether the middleware should keep its
112
+ * export at all, and it belongs to the bound that shipped it
113
+ * (`.behavior/v2026_08_03.feat-apigateway-wire-response/`). what this changes is that the
114
+ * ambiguous export is no longer the ONLY option — which is the half that needed no
115
+ * wisher call, because it breaks no consumer (rule.always.fix-forward-under-scouts-honor)
116
+ *
117
+ * .note = each metadata type rides along for the same reason `LambdaEndpointErrorResponseBody*`
118
+ * does — a consumer who catches the throw must be able to NAME what `.metadata` holds,
119
+ * or they reach for an `as`-cast at the public boundary (rule.forbid.as-cast)
120
+ */
121
+ var getValidatedInput_1 = require("./domain.operations/genLambdaEndpoint/middleware/getValidatedInput");
122
+ Object.defineProperty(exports, "getValidatedInput", { enumerable: true, get: function () { return getValidatedInput_1.getValidatedInput; } });
123
+ var getValidatedOutput_1 = require("./domain.operations/genLambdaEndpoint/middleware/getValidatedOutput");
124
+ Object.defineProperty(exports, "getValidatedOutput", { enumerable: true, get: function () { return getValidatedOutput_1.getValidatedOutput; } });
94
125
  // sdk codegen (generate a per-service sdk from introspection)
95
126
  var genServiceSdk_1 = require("./domain.operations/genServiceSdk/genServiceSdk");
96
127
  Object.defineProperty(exports, "genServiceSdk", { enumerable: true, get: function () { return genServiceSdk_1.genServiceSdk; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AAExB;;;;;GAKG;AACH,kEAAkE;AAAzD,6GAAA,aAAa,OAAA;AAWtB,gEAA+D;AAAtD,8GAAA,aAAa,OAAA;AACtB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,8FAA6F;AAApF,4IAAA,4BAA4B,OAAA;AACrC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AAEvB,4EAA2E;AAAlE,0HAAA,mBAAmB,OAAA;AAE5B,4BAA4B;AAC5B,4FAA2F;AAAlF,0IAAA,2BAA2B,OAAA;AACpC,oGAAmG;AAA1F,kJAAA,+BAA+B,OAAA;AACxC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,0FAAyF;AAAhF,wIAAA,0BAA0B,OAAA;AAKnC,oBAAoB;AACpB,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA;AAC1B,mGAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,yGAAwG;AAA/F,4HAAA,oBAAoB,OAAA;AAC7B,eAAe;AACf,0FAAyF;AAAhF,oHAAA,gBAAgB,OAAA;AACzB,gFAAgF;AAChF,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,+IAA8I;AAArI,wIAAA,0BAA0B,OAAA;AAMnC,yJAAsI;AAA7H,gIAAA,aAAa,OAAA;AACtB,mIAAkI;AAAzH,4HAAA,oBAAoB,OAAA;AAC7B,wLAAuL;AAA9K,sKAAA,yCAAyC,OAAA;AAClD,wKAAuK;AAA9J,sJAAA,iCAAiC,OAAA;AAC1C,kKAAiK;AAAxJ,gJAAA,8BAA8B,OAAA;AAUvC,4JAA4I;AAAnI,qIAAA,iBAAiB,OAAA;AAC1B,qKAAoK;AAA3J,kJAAA,+BAA+B,OAAA;AACxC;;;;;;GAMG;AACH,sGAG2E;AAFzE,oHAAA,gBAAgB,OAAA;AAGlB,8HAA6H;AAApH,4IAAA,4BAA4B,OAAA;AACrC,wIAAuI;AAA9H,sJAAA,iCAAiC,OAAA;AAC1C,0HAAyH;AAAhH,wIAAA,0BAA0B,OAAA;AACnC,gHAA+G;AAAtG,8HAAA,qBAAqB,OAAA;AAC9B,gCAAgC;AAChC,0GAAyG;AAAhG,wHAAA,kBAAkB,OAAA;AAC3B,sIAAqI;AAA5H,oJAAA,gCAAgC,OAAA;AAoBzC,8DAA8D;AAC9D,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,0CAA0C;AAC1C,yGAIyE;AADvE,8HAAA,qBAAqB,OAAA;AAEvB,wIAAuI;AAA9H,8IAAA,6BAA6B,OAAA;AACtC,sGAIuE;AADrE,4HAAA,oBAAoB,OAAA;AAEtB,gFAAgF;AAChF,iGAAgG;AAAvF,kHAAA,eAAe,OAAA;AACxB,8EAA8E;AAC9E,yEAAyE;AACzE,+EAA+E;AAC/E,4EAA4E;AAC5E,4CAA4C;AAC5C,+GAA8G;AAArG,gIAAA,sBAAsB,OAAA;AAC/B,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,0CAA0C;AAC1C,6HAKqF;AAJnF,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AAMtC,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,gDAAgD;AAChD,iDAAiD;AAAxC,iHAAA,eAAe,OAAA;AAExB;;;;;GAKG;AACH,kEAAkE;AAAzD,6GAAA,aAAa,OAAA;AAWtB,gEAA+D;AAAtD,8GAAA,aAAa,OAAA;AACtB,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AACvB,8FAA6F;AAApF,4IAAA,4BAA4B,OAAA;AACrC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,kEAAiE;AAAxD,gHAAA,cAAc,OAAA;AAEvB,4EAA2E;AAAlE,0HAAA,mBAAmB,OAAA;AAE5B,4BAA4B;AAC5B,4FAA2F;AAAlF,0IAAA,2BAA2B,OAAA;AACpC,oGAAmG;AAA1F,kJAAA,+BAA+B,OAAA;AACxC,8GAA6G;AAApG,4JAAA,oCAAoC,OAAA;AAC7C,0FAAyF;AAAhF,wIAAA,0BAA0B,OAAA;AAKnC,oBAAoB;AACpB,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA;AAC1B,mGAAkG;AAAzF,sHAAA,iBAAiB,OAAA;AAC1B,yGAAwG;AAA/F,4HAAA,oBAAoB,OAAA;AAC7B,eAAe;AACf,0FAAyF;AAAhF,oHAAA,gBAAgB,OAAA;AACzB,gFAAgF;AAChF,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB;;;;;GAKG;AACH,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA;AAO1B,+IAA8I;AAArI,wIAAA,0BAA0B,OAAA;AAMnC,mIAAkI;AAAzH,4HAAA,oBAAoB,OAAA;AAC7B,sMAAqM;AAA5L,oLAAA,gDAAgD,OAAA;AACzD,wKAAuK;AAA9J,sJAAA,iCAAiC,OAAA;AAC1C,oKAAmK;AAA1J,kJAAA,+BAA+B,OAAA;AASxC,6JAA4J;AAAnJ,kJAAA,+BAA+B,OAAA;AAqBxC;;;;GAIG;AACH,sGAG2E;AAFzE,oHAAA,gBAAgB,OAAA;AAGlB,8HAA6H;AAApH,4IAAA,4BAA4B,OAAA;AACrC,wIAAuI;AAA9H,sJAAA,iCAAiC,OAAA;AAC1C,0HAAyH;AAAhH,wIAAA,0BAA0B,OAAA;AACnC,gHAA+G;AAAtG,8HAAA,qBAAqB,OAAA;AAC9B,gCAAgC;AAChC,0GAAyG;AAAhG,wHAAA,kBAAkB,OAAA;AAC3B,sIAAqI;AAA5H,oJAAA,gCAAgC,OAAA;AASzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wGAAuG;AAA9F,sHAAA,iBAAiB,OAAA;AAC1B,0GAG6E;AAF3E,wHAAA,kBAAkB,OAAA;AAmBpB,8DAA8D;AAC9D,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,0CAA0C;AAC1C,yGAIyE;AADvE,8HAAA,qBAAqB,OAAA;AAEvB,wIAAuI;AAA9H,8IAAA,6BAA6B,OAAA;AACtC,sGAIuE;AADrE,4HAAA,oBAAoB,OAAA;AAEtB,gFAAgF;AAChF,iGAAgG;AAAvF,kHAAA,eAAe,OAAA;AACxB,8EAA8E;AAC9E,yEAAyE;AACzE,+EAA+E;AAC/E,4EAA4E;AAC5E,4CAA4C;AAC5C,+GAA8G;AAArG,gIAAA,sBAAsB,OAAA;AAC/B,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,0CAA0C;AAC1C,6HAKqF;AAJnF,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AACpC,qJAAA,oCAAoC,OAAA;AAMtC,6FAA4F;AAAnF,sHAAA,iBAAiB,OAAA"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "sdk-aws-lambda",
3
3
  "author": "ehmpathy",
4
4
  "description": "a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.",
5
- "version": "0.5.0",
5
+ "version": "0.7.0",
6
6
  "repository": "ehmpathy/sdk-aws-lambda",
7
7
  "homepage": "https://github.com/ehmpathy/sdk-aws-lambda",
8
8
  "keywords": [
@@ -68,7 +68,7 @@
68
68
  "@middy/http-json-body-parser": "4.7.0",
69
69
  "@middy/http-response-serializer": "4.7.0",
70
70
  "@middy/http-security-headers": "4.7.0",
71
- "domain-objects": "0.33.0",
71
+ "domain-objects": "0.34.0",
72
72
  "helpful-errors": "1.7.3",
73
73
  "sdk-environment": "0.1.5",
74
74
  "sdk-logs": "0.9.0",
@@ -101,13 +101,13 @@
101
101
  "esbuild-register": "3.6.0",
102
102
  "husky": "8.0.3",
103
103
  "jest": "30.2.0",
104
- "rhachet": "1.47.5",
104
+ "rhachet": "1.48.0",
105
105
  "rhachet-brains-anthropic": "0.4.3",
106
- "rhachet-brains-fireworksai": "0.1.7",
106
+ "rhachet-brains-fireworksai": "0.2.3",
107
107
  "rhachet-brains-xai": "0.3.3",
108
- "rhachet-roles-bhrain": "0.37.0",
108
+ "rhachet-roles-bhrain": "0.37.2",
109
109
  "rhachet-roles-bhuild": "0.21.36",
110
- "rhachet-roles-ehmpathy": "1.38.12",
110
+ "rhachet-roles-ehmpathy": "1.39.1",
111
111
  "rhachet-roles-rhachet": "0.1.7",
112
112
  "test-fns": "1.15.8",
113
113
  "tsc-alias": "1.8.10",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # sdk-aws-lambda
2
2
 
3
- a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, auto-propagate trace-ids.
3
+ a simple and opinionated sdk for aws lambda. define endpoints, ask endpoints, trace calls across them.
4
4
 
5
5
  # installation
6
6
 
@@ -12,34 +12,165 @@ npm install --save sdk-aws-lambda
12
12
 
13
13
  ## define an endpoint
14
14
 
15
+ one family, one leaf per trigger:
16
+
17
+ | leaf | trigger |
18
+ |---|---|
19
+ | `genLambdaEndpoint.forAsk` | a direct invoke, e.g. via `askLambdaEndpoint` |
20
+ | `genLambdaEndpoint.forApiGateway` | http, via api gateway |
21
+ | `genLambdaEndpoint.forSqs.perRecord` | one queue message per invoke |
22
+ | `genLambdaEndpoint.forSqs.perBatch` | a whole queue batch per invoke |
23
+
24
+ ### genLambdaEndpoint.forAsk
25
+
26
+ a direct invoke, e.g. from `askLambdaEndpoint`.
27
+
15
28
  ```ts
16
29
  import { genLambdaEndpoint } from 'sdk-aws-lambda';
17
30
 
18
- export const handler = genLambdaEndpoint(
31
+ export const handler = genLambdaEndpoint.forAsk(
19
32
  {
20
33
  schema,
21
- invoke: async ({ event }, { log }) => {
22
- // log has trail context from caller
34
+ invoke: async ({ payload }, { log }) => {
35
+ // payload is the validated body; log has trail context from caller
23
36
  },
24
37
  },
25
38
  { log }, // optional, auto-generated otherwise
26
39
  );
27
40
  ```
28
41
 
42
+ ### genLambdaEndpoint.forApiGateway
43
+
44
+ http, via api gateway.
45
+
46
+ ```ts
47
+ import { genLambdaEndpoint, asApiGatewayResponseSchema } from 'sdk-aws-lambda';
48
+
49
+ export const handler = genLambdaEndpoint.forApiGateway({
50
+ schema: {
51
+ input: z.object({
52
+ headers: z.object({ authorization: z.string() }), // optional key — omit to validate no header
53
+ payload: z.object({ to: z.string() }),
54
+ }),
55
+ output: asApiGatewayResponseSchema({ body: z.object({ sent: z.boolean() }) }),
56
+ },
57
+ invoke: async ({ headers, payload }, context) => ({
58
+ body: await sendMessage({ to: payload.to, authorization: headers.authorization }, context),
59
+ }),
60
+ });
61
+ ```
62
+
63
+ `headers` keys are lowercased. `event` carries six keys:
64
+
65
+ | key | holds |
66
+ |---|---|
67
+ | `method` | the http method |
68
+ | `headers` | the request headers |
69
+ | `payload` | the body |
70
+ | `codec` | `{ base64 }` — how the body arrived |
71
+ | `params` | `{ path, query }` — the url parameter bags |
72
+ | `_` | `{ raw }` — the wire event before reconciliation |
73
+
74
+ ⇒ zoom in: [headers](./.agent/repo=.this/role=any/briefs/domain.terms/headers.md) ·
75
+ [event](./.agent/repo=.this/role=any/briefs/domain.terms/event.md)
76
+
77
+ #### the wire response
78
+
79
+ a handler owns its **exact wire response** — any status, any headers, any body, or none at all.
80
+ return an `ApiGatewayResponse`, and it reaches the wire as written.
81
+
82
+ ```ts
83
+ export const handler = genLambdaEndpoint.forApiGateway({
84
+ schema: {
85
+ input: z.any(), // a twilio form blob
86
+ output: asApiGatewayResponseSchema({ body: z.undefined() }), // carries no body
87
+ },
88
+ invoke: async () => ({ status: 204 }), // 204, no body
89
+ });
90
+ ```
91
+
92
+ | return | wire |
93
+ |---|---|
94
+ | `{ body: x }` | 200 + json — the convenient default |
95
+ | `{ status: 204 }` | 204, no body, **no `content-type`** |
96
+ | `{ status: 308, headers: { Location } }` | a redirect |
97
+ | `{ headers: { 'Content-Type': 'text/xml' }, body: xml }` | your bytes, verbatim |
98
+ | `{}` | ⛔ a **compile error** — at least one key is required |
99
+
100
+ set a `Content-Type` yourself and the serializer stands aside, so xml/text reach the wire
101
+ byte-identical. omit it with a body and you get `application/json`.
102
+
103
+ #### the body-less response
104
+
105
+ `schema.output` describes what `invoke` **returns** (the envelope), so
106
+ `asApiGatewayResponseSchema({ body })` wraps a body schema into it.
107
+
108
+ for a response that carries **no body at all** — a 204, a redirect — declare the body
109
+ `z.undefined()`:
110
+
111
+ <!-- prettier-ignore -->
112
+ | you declare | the published `body` slot | reads as |
113
+ |---|---|---|
114
+ | `z.undefined()` · `z.void()` · `z.never()` | `{ "not": {} }` | **"no body is ever carried"** |
115
+ | `z.any()` · `z.unknown()` | `{}` | ⛔ the rubber-stamp — every value reads as valid |
116
+ | `z.null()` | `{ "type": "null" }` | ⛔ claims the wire carries the four bytes `null` |
117
+
118
+ all of them behave identically at **runtime**: each accepts `{ status: 204 }` and each still refuses
119
+ an accidental `{ body: 'oops' }`. only the published contract differs, which is why the wrong choice
120
+ ships green.
121
+
122
+ ### genLambdaEndpoint.forSqs
123
+
124
+ a queue, one leaf per cardinality.
125
+
126
+ ```ts
127
+ // one message per invoke — requires batchSize: 1
128
+ export const handler = genLambdaEndpoint.forSqs.perRecord({
129
+ schema: {
130
+ input: z.object({
131
+ headers: z.object({ source: z.string().optional() }), // message attributes
132
+ payload: z.object({ orderId: z.string() }),
133
+ }),
134
+ },
135
+ invoke: async ({ payload, headers }, context) =>
136
+ fulfilOrder({ orderId: payload.orderId, source: headers.source ?? null }, context),
137
+ });
138
+
139
+ // a whole batch per invoke — name the records that succeeded
140
+ export const handler = genLambdaEndpoint.forSqs.perBatch({
141
+ schema: { input: z.object({ payload: z.object({ orderId: z.string() }) }) },
142
+ invoke: async ({ records }, context) => {
143
+ const succeeded = [];
144
+ for (const record of records) {
145
+ await fulfilOrder({ orderId: record.payload.orderId, source: null }, context).then(
146
+ () => succeeded.push(record),
147
+ () => null, // unreported, so sqs retries it
148
+ );
149
+ }
150
+ return { successes: succeeded };
151
+ },
152
+ });
153
+ ```
154
+
155
+ `perBatch` fails safe: any record not returned in `successes` is retried, and an answer the sdk
156
+ cannot read retries the whole batch. its event source must declare
157
+ `functionResponseTypes: ['ReportBatchItemFailures']`.
158
+
159
+ ⇒ zoom in: [records](./.agent/repo=.this/role=any/briefs/domain.terms/records.md)
160
+
29
161
  ## ask an endpoint
30
162
 
31
163
  ```ts
32
164
  import { askLambdaEndpoint } from 'sdk-aws-lambda';
33
165
 
34
166
  const result = await askLambdaEndpoint<TRequest, TResponse>(
35
- {
36
- which: { service: 'svc-jobs', function: 'getJobByUuid' },
37
- event: { uuid },
38
- },
39
- { log, env: { access: 'prep' } }, // access completes the slug; trail auto-propagates
167
+ { which: { service: 'svc-jobs', function: 'getJobByUuid' }, event: { uuid } },
168
+ { log, env: { access: 'prep' } },
40
169
  );
41
170
  ```
42
171
 
172
+ the caller's `trail.exid` rides along, so logs correlate across the call.
173
+
43
174
  ## run an endpoint, in a test
44
175
 
45
176
  | you call | you hold | a caller fault arrives as |
@@ -68,7 +199,7 @@ await expect(
68
199
  {
69
200
  which: { service: 'svc-jobs', function: 'getJobByUuid' },
70
201
  event: { uuid: 'bad' },
71
- at: 'cloud', // or 'local' — resolve the handler from serverless.yml
202
+ at: 'cloud', // or 'local' — look up the handler in serverless.yml
72
203
  },
73
204
  { log, env: { access: 'prep' } },
74
205
  ),
@@ -129,92 +260,113 @@ const event = asLambdaEvent.fromApiGateway({
129
260
 
130
261
  ## introspection
131
262
 
132
- endpoints with zod schemas expose their schema at runtime:
263
+ in `prep`, an endpoint returns its json-schema when asked with `{ introspect: 'schema' }`; in prod
264
+ it throws a `ConstraintError`. `getOneLambdaContract` and `getAllLambdaContracts` collect them for
265
+ sdk generation:
133
266
 
134
267
  ```ts
135
- const schema = await askLambdaEndpoint(
136
- {
137
- which: { service: 'svc-user', function: 'getUser' },
138
- event: { introspect: 'schema' },
139
- },
140
- { log, env: { access: 'prep' } },
268
+ import { getAllLambdaContracts } from 'sdk-aws-lambda';
269
+
270
+ const contracts = await getAllLambdaContracts(
271
+ { which: { service: 'svc-user' } },
272
+ { env: { access: 'prep', region: 'us-east-1' } },
141
273
  );
142
- // returns: { input: {...jsonSchema}, output: {...jsonSchema} }
274
+ // { getUser: {...schema}, getSettings: {...schema} }
143
275
  ```
144
276
 
145
- requires `env.access === 'prep'`. in prod, it throws a `ConstraintError`.
277
+ ## validate the input only
146
278
 
147
- ## contract discovery
279
+ `schema.output` is required. for an endpoint that returns no value, declare `z.void()`:
148
280
 
149
281
  ```ts
150
- import { getAllLambdaContracts, getOneLambdaContract } from 'sdk-aws-lambda';
151
-
152
- const contract = await getOneLambdaContract(
153
- { which: { service: 'svc-user', function: 'getUser' } },
154
- { env: { access: 'prep', region: 'us-east-1' } },
155
- );
156
-
157
- const contracts = await getAllLambdaContracts(
158
- { which: { service: 'svc-user' } },
159
- { env: { access: 'prep', region: 'us-east-1' } },
282
+ export const handler = genLambdaEndpoint.forAsk(
283
+ {
284
+ schema: { input: inputSchema, output: z.void() },
285
+ invoke: async ({ payload }, context) => { await doTheWork({ job: payload }, context); },
286
+ },
287
+ { env: { access: 'prep' } },
160
288
  );
161
- // returns: { getUser: {...schema}, getSettings: {...schema} }
162
289
  ```
163
290
 
164
- # the http wire response
291
+ `z.void()`, `z.undefined()`, `z.null()` and `z.never()` each publish an honest contract. avoid
292
+ `z.any()` and `z.unknown()` — they publish `{}`, which tells a caller that **any** value is valid.
293
+
294
+ ## domain objects at the border
165
295
 
166
- `forApiGateway()` handlers own their **exact wire response** — any status, any headers, any body, or
167
- none at all. return an `ApiGatewayResponse`, and it reaches the wire as written.
296
+ declare a domain object in the schema and `invoke` receives the **instance**, not the plain object
297
+ zod yields. no `as` cast, no per-field rebuild:
168
298
 
169
299
  ```ts
170
- import { forApiGateway, asApiGatewayResponseSchema } from 'sdk-aws-lambda';
300
+ import { Surfer } from './domain.objects/Surfer';
171
301
 
172
- export const handler = forApiGateway({
173
- schema: {
174
- input: z.any(), // a twilio form blob
175
- output: asApiGatewayResponseSchema({ body: z.undefined() }),
302
+ export const handler = genLambdaEndpoint.forAsk(
303
+ {
304
+ schema: { input: z.object({ surfer: Surfer.contract() }), output: z.void() },
305
+ invoke: async ({ payload }, context) =>
306
+ bookSurfLesson({ surfer: payload.surfer }, context), // payload.surfer instanceof Surfer
176
307
  },
177
- invoke: async ({ event }) => ({ status: 204 }), // 204, no body
178
- });
308
+ { env: { access: 'prep' } },
309
+ );
179
310
  ```
180
311
 
181
- | return | wire |
182
- |---|---|
183
- | `{ body: x }` | 200 + json — the convenient default |
184
- | `{ status: 204 }` | 204, no body, **no `content-type`** |
185
- | `{ status: 308, headers: { Location } }` | a redirect |
186
- | `{ headers: { 'Content-Type': 'text/xml' }, body: xml }` | your bytes, verbatim |
187
- | `{}` | ⛔ a **compile error** — at least one key is required |
312
+ `X.contract()` reaches every depth — not the top level alone:
188
313
 
189
- set a `Content-Type` yourself and the serializer stands aside, so xml/text reach the wire
190
- byte-identical. omit it with a body and you get `application/json`.
314
+ ```ts
315
+ schema: {
316
+ input: z.object({
317
+ surfer: Surfer.contract(), // depth 0
318
+ signup: z.object({ // a PLAIN wrapper...
319
+ spot: SurfSpot.contract(), // ...and the dobj one level under it
320
+ }).nullable(),
321
+ boards: z.array(Surfboard.contract()), // every element of the array
322
+ report: WaveReport.contract(), // its `static nested` rebuilds `report.spot`
323
+ }),
324
+ output: z.void(),
325
+ },
326
+ ```
191
327
 
192
- ### schema is required; `z.any()` is the opt-out
328
+ a value that fails the domain object's own constructor **fails loud at the border** and never reaches
329
+ `invoke` half-built.
193
330
 
194
- `schema.output` describes what `invoke` **returns** (the envelope), so
195
- `asApiGatewayResponseSchema({ body })` wraps a body schema into it. a required field with a visible
196
- opt-out keeps validation and introspection on one code path, and puts the choice where a reviewer can
197
- see it.
331
+ what a caller of your generated cross-service client sees is the **wire** shape —
332
+ `{ surfer: { uuid, name } }` — never the instance. the two differ by design: the wire is what
333
+ crosses, the instance is what you hold once through.
334
+
335
+ two syntax notes:
336
+
337
+ ```ts
338
+ // a dobj that names ITSELF must defer, per js class-field order
339
+ static schema = z.object({ replies: z.array(z.lazy(() => Comment.contract())) });
340
+
341
+ // .ref() goes on the raw contract, before any chain
342
+ z.object({ rider: Surfer.contract().ref('primary') }).optional()
343
+ ```
198
344
 
199
345
  # features
200
346
 
201
347
  - **genLambdaEndpoint** — define endpoints with validation, log capture, error classification
202
- - `genLambdaEndpoint()` — direct invoke (default)
203
- - `forApiGateway()` — http via api gateway, with full wire-response control (above)
348
+ - `genLambdaEndpoint.forAsk()` — direct invoke
349
+ - `genLambdaEndpoint.forApiGateway()` — http via api gateway, with full wire-response control
350
+ - `genLambdaEndpoint.forSqs.perRecord()` — one queue message per invoke
351
+ - `genLambdaEndpoint.forSqs.perBatch()` — a whole queue batch per invoke, fail-safe
352
+ - **domain objects at the border** — `X.contract()` in a schema hands `invoke` real instances, at
353
+ every depth, with no `as` cast (above)
204
354
  - **askLambdaEndpoint** — ask another lambda with typed request/response, automatic trail propagation
205
355
  - **runLambdaEndpoint** — run an endpoint from a test
206
356
  - `onReferenced()` — you hold the handler; a caller fault is **returned**
207
357
  - `onSerialized()` — you hold the slug; a caller fault **throws**. `at: 'cloud' | 'local'`
208
358
  - **asLambdaEvent** — cast a payload into the envelope aws delivers, wire-faithful by default
209
359
  - `fromApiGateway()`, `fromSqs()`, `fromSns()`, `fromKinesis()`, `fromS3()`
210
- - **trace-id propagation** — pass `log`, and `trail.exid` threads through the call chain
211
- - **introspection** — expose json-schema via `{ introspect: 'schema' }` (prep only)
212
- - **contract discovery** — `getOneLambdaContract`, `getAllLambdaContracts`
360
+ - **trace-id propagation** — pass `log`, and `trail.exid` threads through the lambda-to-lambda call
361
+ chain. http and sqs triggers mint a fresh `exid` per invoke
362
+ - **introspection** — expose json-schema via `{ introspect: 'schema' }` (prep only), collected by
363
+ `getOneLambdaContract` / `getAllLambdaContracts` for sdk generation
213
364
 
214
365
  # docs
215
366
 
216
367
  design records, on github only — they ship in no tarball.
217
368
 
369
+ - [domain terms](./.agent/repo=.this/role=any/briefs/domain.terms/.readme.md) — `payload`, `headers`, `event`, `records`, `trail`, and the edge cases of each
218
370
  - [run boundary](./.agent/repo=.this/role=any/briefs/define.lambda-endpoint-run-boundary.md) — serialized vs referenced, and why the error stance inverts
219
371
  - [event source](./.agent/repo=.this/role=any/briefs/define.lambda-event-source.md) — which envelope each aws source wraps a payload in
220
372
  - [wire response](./.behavior/v2026_08_03.feat-apigateway-wire-response/1.vision.yield.md) — how the api-gateway response contract was shaped