sdk-aws-lambda 0.6.0 → 0.7.1

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