sdk-aws-lambda 0.8.0 → 0.8.2

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 (277) hide show
  1. package/dist/access/sdks/lambda/genLambdaSdk.js.map +1 -1
  2. package/dist/access/sdks/lambda/sdkLambdaInvoke.js.map +1 -1
  3. package/dist/contract/cli/asGenArgs.js.map +1 -1
  4. package/dist/contract/cli/gen.js.map +1 -1
  5. package/dist/domain.objects/DomainObjectCaptured.d.ts +3 -1
  6. package/dist/domain.objects/DomainObjectCaptured.js.map +1 -1
  7. package/dist/domain.objects/GeneratedFile.js.map +1 -1
  8. package/dist/domain.objects/HttpStatusCode.js.map +1 -1
  9. package/dist/domain.objects/LambdaCredentialsAbsentError.js.map +1 -1
  10. package/dist/domain.objects/LambdaDomainObjectNotCapturableError.js.map +1 -1
  11. package/dist/domain.objects/LambdaDomainObjectRefUnbindableError.js.map +1 -1
  12. package/dist/domain.objects/LambdaEndpoint.d.ts +2 -2
  13. package/dist/domain.objects/LambdaEndpoint.js.map +1 -1
  14. package/dist/domain.objects/LambdaEndpointError.d.ts +1 -1
  15. package/dist/domain.objects/LambdaEndpointError.js.map +1 -1
  16. package/dist/domain.objects/LambdaEndpointErrorResponseBody.d.ts +2 -2
  17. package/dist/domain.objects/LambdaEndpointErrorResponseBody.js.map +1 -1
  18. package/dist/domain.objects/LambdaEndpointRefusal.d.ts +25 -0
  19. package/dist/domain.objects/LambdaEndpointRefusal.js +19 -0
  20. package/dist/domain.objects/LambdaEndpointRefusal.js.map +1 -0
  21. package/dist/domain.objects/LambdaEndpointRefusedError.d.ts +25 -0
  22. package/dist/domain.objects/LambdaEndpointRefusedError.js +28 -0
  23. package/dist/domain.objects/LambdaEndpointRefusedError.js.map +1 -0
  24. package/dist/domain.objects/LambdaEndpointSchema.d.ts +3 -1
  25. package/dist/domain.objects/LambdaEventSchemaSource.d.ts +1 -1
  26. package/dist/domain.objects/LambdaFunctionNotFoundError.js.map +1 -1
  27. package/dist/domain.objects/LambdaIntrospectionBlockedError.js.map +1 -1
  28. package/dist/domain.objects/LambdaIntrospectionNotSupportedError.js.map +1 -1
  29. package/dist/domain.objects/LambdaServiceNotFoundError.js.map +1 -1
  30. package/dist/domain.objects/TrailExidHeader.d.ts +1 -1
  31. package/dist/domain.operations/asLambdaEndpoint/asLambdaEndpoint.js.map +1 -1
  32. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.js.map +1 -1
  33. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.d.ts +1 -1
  34. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.js +1 -1
  35. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.js.map +1 -1
  36. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.d.ts +10 -36
  37. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js +1 -1
  38. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js.map +1 -1
  39. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromKinesis.js.map +1 -1
  40. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromS3.js.map +1 -1
  41. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSns.js.map +1 -1
  42. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSqs.js.map +1 -1
  43. package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.js +1 -1
  44. package/dist/domain.operations/asLambdaEventSchema/asLambdaEventPayloadSchema.js.map +1 -1
  45. package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.js +2 -2
  46. package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromKinesis.js.map +1 -1
  47. package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.js +2 -2
  48. package/dist/domain.operations/asLambdaEventSchema/asLambdaEventSchema.fromSns.js.map +1 -1
  49. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +4 -41
  50. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.d.ts +11 -2
  51. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js +8 -3
  52. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.js.map +1 -1
  53. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.d.ts +10 -0
  54. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js +19 -7
  55. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.js.map +1 -1
  56. package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.d.ts +17 -0
  57. package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.js +22 -0
  58. package/dist/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.js.map +1 -0
  59. package/dist/domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet.js.map +1 -1
  60. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.d.ts +1 -1
  61. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.js +1 -1
  62. package/dist/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.js.map +1 -1
  63. package/dist/domain.operations/askLambdaEndpoint/cache/getAskLambdaCacheKey.js.map +1 -1
  64. package/dist/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.js.map +1 -1
  65. package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.d.ts +1 -1
  66. package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.js +1 -1
  67. package/dist/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.js.map +1 -1
  68. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.d.ts +2 -0
  69. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +3 -2
  70. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
  71. package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.d.ts +9 -5
  72. package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js +29 -11
  73. package/dist/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.js.map +1 -1
  74. package/dist/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.js.map +1 -1
  75. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpMethod.js.map +1 -1
  76. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.js.map +1 -1
  77. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.js +2 -2
  78. package/dist/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.js.map +1 -1
  79. package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.d.ts +15 -0
  80. package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.js +43 -0
  81. package/dist/domain.operations/askLambdaEndpoint/serde/asLambdaEndpointRefusal.js.map +1 -0
  82. package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.d.ts +11 -0
  83. package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.js +15 -0
  84. package/dist/domain.operations/askLambdaEndpoint/serde/getIsHttpThrottle.js.map +1 -0
  85. package/dist/domain.operations/askLambdaEndpoint/serde/getLambdaPayload.js.map +1 -1
  86. package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.js +1 -1
  87. package/dist/domain.operations/askLambdaEndpoint/serde/getOneBodyFromHttpText.js.map +1 -1
  88. package/dist/domain.operations/askLambdaEndpoint/serde/getOneCorrelationIdFromBody.js.map +1 -1
  89. package/dist/domain.operations/genLambdaEndpoint/asContextLogTrail.js.map +1 -1
  90. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.d.ts +6 -4
  91. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayRequestEventUnified.js.map +1 -1
  92. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwire.js.map +1 -1
  93. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseOnwireJson.js.map +1 -1
  94. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -1
  95. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asCorsHeadersWithTrail.js.map +1 -1
  96. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asHeaderKeysLowercased.js.map +1 -1
  97. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +1 -1
  98. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js +9 -9
  99. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  100. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getAllResponseOnwireKeysFound.js.map +1 -1
  101. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getCorsOrigin.js.map +1 -1
  102. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV1ApiGatewayRequestEvent.js.map +1 -1
  103. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/getIsV2ApiGatewayRequestEvent.js.map +1 -1
  104. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/isApiGatewayResponse.js.map +1 -1
  105. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js +2 -2
  106. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genApiGatewayRequestEventNormalizationMiddleware.js.map +1 -1
  107. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genContentTypeCoherenceMiddleware.js.map +1 -1
  108. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.d.ts +15 -2
  109. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.js +1 -1
  110. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodInputValidationMiddleware.js.map +1 -1
  111. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.d.ts +2 -2
  112. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js +9 -9
  113. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/genLambdaEndpoint.forAsk.js.map +1 -1
  114. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genAskEventOnwireCaptureMiddleware.js.map +1 -1
  115. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.js +3 -3
  116. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genLambdaEventRefusedLogMiddleware.js.map +1 -1
  117. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.js +1 -1
  118. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/genZodEventValidationMiddleware.js.map +1 -1
  119. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/getAllLambdaEventIds.js.map +1 -1
  120. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAsk/middleware/logLambdaEventRefused.js.map +1 -1
  121. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsBatchResponse.js.map +1 -1
  122. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsEventDecoded.js.map +1 -1
  123. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsHeadersOnwire.js.map +1 -1
  124. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordDecoded.js.map +1 -1
  125. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/asSqsRecordIds.js.map +1 -1
  126. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.d.ts +4 -2
  127. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.d.ts +1 -1
  128. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js +3 -3
  129. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perBatch.js.map +1 -1
  130. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.d.ts +1 -1
  131. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js +4 -4
  132. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genLambdaEndpoint.forSqs.perRecord.js.map +1 -1
  133. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.d.ts +1 -1
  134. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js +3 -3
  135. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/genSqsEndpointMiddlewares.js.map +1 -1
  136. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getAllSqsIdsRetried.js.map +1 -1
  137. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getAllSqsIdsUnclaimable.js.map +1 -1
  138. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getAllSqsSuccessRefsMalformed.js.map +1 -1
  139. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/getIsSqsEvent.js.map +1 -1
  140. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/isSqsSuccessRef.js.map +1 -1
  141. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/logSqsRecordInvalid.js.map +1 -1
  142. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/logSqsRecordRefused.js.map +1 -1
  143. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.js +1 -1
  144. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordValidated.js.map +1 -1
  145. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.js +1 -1
  146. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forSqs/setSqsRecordsValidated.js.map +1 -1
  147. package/dist/domain.operations/genLambdaEndpoint/middleware/asCallerFault.js.map +1 -1
  148. package/dist/domain.operations/genLambdaEndpoint/middleware/asContextTrailed.js.map +1 -1
  149. package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.d.ts +17 -0
  150. package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.js +26 -0
  151. package/dist/domain.operations/genLambdaEndpoint/middleware/asLogMethodOfFailure.js.map +1 -0
  152. package/dist/domain.operations/genLambdaEndpoint/middleware/genConstraintErrorMiddleware.js.map +1 -1
  153. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +2 -2
  154. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
  155. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +4 -2
  156. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -1
  157. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.isIntrospectionInput.js.map +1 -1
  158. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.js.map +1 -1
  159. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.d.ts +16 -1
  160. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js +34 -13
  161. package/dist/domain.operations/genLambdaEndpoint/middleware/genIoLoggerMiddleware.js.map +1 -1
  162. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js +2 -2
  163. package/dist/domain.operations/genLambdaEndpoint/middleware/genTrailMiddleware.js.map +1 -1
  164. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
  165. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -1
  166. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsConstraintError.js.map +1 -1
  167. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsFrozenMutatorRefusal.js.map +1 -1
  168. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.d.ts +1 -1
  169. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js +1 -1
  170. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js.map +1 -1
  171. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js.map +1 -1
  172. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js.map +1 -1
  173. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
  174. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js.map +1 -1
  175. package/dist/domain.operations/genLambdaEndpoint/setEventFrozen.js.map +1 -1
  176. package/dist/domain.operations/genServiceSdk/asServiceSymbols/asServiceSymbols.js.map +1 -1
  177. package/dist/domain.operations/genServiceSdk/gen.file/asBarrelFileSource.js.map +1 -1
  178. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js +2 -2
  179. package/dist/domain.operations/genServiceSdk/gen.file/asMechanismsFileSource.js.map +1 -1
  180. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js +2 -2
  181. package/dist/domain.operations/genServiceSdk/gen.file/asResourcesFileSource.js.map +1 -1
  182. package/dist/domain.operations/genServiceSdk/gen.file/formatTypescript.js.map +1 -1
  183. package/dist/domain.operations/genServiceSdk/gen.file/setGeneratedFilesBatch.js.map +1 -1
  184. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.d.ts +2 -0
  185. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js +8 -4
  186. package/dist/domain.operations/genServiceSdk/gen.mechanism/asMechanismFnSource.js.map +1 -1
  187. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.d.ts +3 -1
  188. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +1 -1
  189. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -1
  190. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +3 -1
  191. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -1
  192. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js +1 -1
  193. package/dist/domain.operations/genServiceSdk/gen.resource/asResourceClassSource.js.map +1 -1
  194. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +1 -1
  195. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -1
  196. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +1 -1
  197. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -1
  198. package/dist/domain.operations/genServiceSdk/genServiceSdk.js +1 -1
  199. package/dist/domain.operations/genServiceSdk/genServiceSdk.js.map +1 -1
  200. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js.map +1 -1
  201. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +5 -27
  202. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -1
  203. package/dist/domain.operations/getAllLambdaContracts/lambdaContract/asContractRecord.js.map +1 -1
  204. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/getAllLambdaFunctionsByPrefix.js.map +1 -1
  205. package/dist/domain.operations/getAllLambdaContracts/lambdaFunction/sdkLambdaGetAllFunctions.js.map +1 -1
  206. package/dist/domain.operations/getOneLambdaContract/asLambdaEndpointSchema.js.map +1 -1
  207. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js +3 -25
  208. package/dist/domain.operations/getOneLambdaContract/getOneLambdaContract.js.map +1 -1
  209. package/dist/domain.operations/lambdaEndpointWire/context/getExidFromContext.js.map +1 -1
  210. package/dist/domain.operations/lambdaEndpointWire/context/getLogForExidExtraction.js.map +1 -1
  211. package/dist/domain.operations/lambdaEndpointWire/context/getOneTrailExid.js.map +1 -1
  212. package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.d.ts +22 -0
  213. package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.js +34 -0
  214. package/dist/domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal.js.map +1 -0
  215. package/dist/domain.operations/lambdaEndpointWire/error/getIsContempErrorTagged.js.map +1 -1
  216. package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.d.ts +1 -1
  217. package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.js.map +1 -1
  218. package/dist/domain.operations/lambdaEndpointWire/error/getLambdaErrorMetadata.js.map +1 -1
  219. package/dist/domain.operations/lambdaEndpointWire/error/getStackTraceString.js.map +1 -1
  220. package/dist/domain.operations/lambdaEndpointWire/error/throwIfCredentialsError.js.map +1 -1
  221. package/dist/domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey.js.map +1 -1
  222. package/dist/domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders.js.map +1 -1
  223. package/dist/domain.operations/lambdaEndpointWire/frame/getIsWrappedPayload.js.map +1 -1
  224. package/dist/domain.operations/lambdaEndpointWire/frame/getOneLambdaEventSchemaSource.js.map +1 -1
  225. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfEvent.js.map +1 -1
  226. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailCarrierOfHandler.js.map +1 -1
  227. package/dist/domain.operations/lambdaEndpointWire/frame/getOneTrailExidFromHeaders.js.map +1 -1
  228. package/dist/domain.operations/lambdaEndpointWire/frame/isEventDeclaredAsApiGateway.js.map +1 -1
  229. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExid.js.map +1 -1
  230. package/dist/domain.operations/lambdaEndpointWire/frame/isTrailExidHeaderMalformed.js.map +1 -1
  231. package/dist/domain.operations/lambdaEndpointWire/frame/setEventDeclaredAsApiGateway.js.map +1 -1
  232. package/dist/domain.operations/lambdaEndpointWire/frame/setHandlerTrailCarrier.js.map +1 -1
  233. package/dist/domain.operations/lambdaEndpointWire/frame/setLambdaEventSchemaSource.js.map +1 -1
  234. package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.d.ts +15 -4
  235. package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js +32 -17
  236. package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js.map +1 -1
  237. package/dist/domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage.js.map +1 -1
  238. package/dist/domain.operations/lambdaEndpointWire/serde/getDecodedPayload.js.map +1 -1
  239. package/dist/domain.operations/lambdaEndpointWire/serde/getParsedJson.js.map +1 -1
  240. package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.d.ts +1 -1
  241. package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.js +1 -1
  242. package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.js.map +1 -1
  243. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointDialect.js.map +1 -1
  244. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.d.ts +2 -1
  245. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.js +2 -1
  246. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.js.map +1 -1
  247. package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.d.ts +1 -1
  248. package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.js +1 -1
  249. package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.js.map +1 -1
  250. package/dist/domain.operations/runLambdaEndpoint/error/isErrorLike.js.map +1 -1
  251. package/dist/domain.operations/runLambdaEndpoint/guard/assertEventIsGiven.js.map +1 -1
  252. package/dist/domain.operations/runLambdaEndpoint/guard/assertHandlerIsRunnable.js.map +1 -1
  253. package/dist/domain.operations/runLambdaEndpoint/local/asLocalRunIdentity.js.map +1 -1
  254. package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.js +19 -30
  255. package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.js.map +1 -1
  256. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.d.ts +4 -23
  257. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.d.ts +1 -1
  258. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js +2 -2
  259. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js.map +1 -1
  260. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +18 -6
  261. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -1
  262. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js +3 -3
  263. package/dist/domain.operations/runLambdaEndpoint/serde/asCarriedPayload.js.map +1 -1
  264. package/dist/domain.operations/runLambdaEndpoint/serde/asErrorTypeOfErrorLike.js.map +1 -1
  265. package/dist/domain.operations/runLambdaEndpoint/serde/asFramedPayload.js.map +1 -1
  266. package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.js +1 -1
  267. package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.js.map +1 -1
  268. package/dist/domain.operations/runLambdaEndpoint/serde/asWirePayload.js.map +1 -1
  269. package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.js +1 -1
  270. package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.js.map +1 -1
  271. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js +1 -1
  272. package/dist/domain.operations/runLambdaEndpoint/serde/getOneTrailWithExid.js.map +1 -1
  273. package/dist/index.d.ts +7 -0
  274. package/dist/index.js +3 -1
  275. package/dist/index.js.map +1 -1
  276. package/package.json +53 -32
  277. package/readme.md +42 -2
@@ -1,3 +1,4 @@
1
+ import { viaApiGateway } from './askLambdaEndpoint.viaApiGateway';
1
2
  import { viaInvoke } from './askLambdaEndpoint.viaInvoke';
2
3
  /**
3
4
  * .what = the `askLambdaEndpoint` family — every road a caller takes to an endpoint, under one name
@@ -14,47 +15,9 @@ import { viaInvoke } from './askLambdaEndpoint.viaInvoke';
14
15
  * compatibility: a family that had shipped no bare name would be a plain object, as
15
16
  * `genLambdaEndpoint` is
16
17
  */
17
- export declare const askLambdaEndpoint: (<TRequest, TResponse>(input: {
18
- which: {
19
- service: string;
20
- function: string;
21
- };
22
- event: TRequest;
23
- struct?: {
24
- payload?: import("../..").LambdaEndpointDialect | undefined;
25
- } | undefined;
26
- }, context: import("../..").ContextAwsLambdaCaller & {
27
- cache?: {
28
- response?: import("with-simple-cache").SimpleCache<TResponse> | undefined;
29
- dedupe?: import("simple-in-memory-cache").SimpleInMemoryCache<TResponse> | undefined;
30
- } | undefined;
31
- }) => Promise<TResponse>) & {
32
- viaInvoke: <TRequest, TResponse>(input: {
33
- which: {
34
- service: string;
35
- function: string;
36
- };
37
- event: TRequest;
38
- struct?: {
39
- payload?: import("../..").LambdaEndpointDialect | undefined;
40
- } | undefined;
41
- }, context: import("../..").ContextAwsLambdaCaller & {
42
- cache?: {
43
- response?: import("with-simple-cache").SimpleCache<TResponse> | undefined;
44
- dedupe?: import("simple-in-memory-cache").SimpleInMemoryCache<TResponse> | undefined;
45
- } | undefined;
46
- }) => Promise<TResponse>;
47
- viaApiGateway: <TResponse_1 = unknown>(input: {
48
- url: string;
49
- method?: string | undefined;
50
- headers?: Record<string, string> | undefined;
51
- body?: unknown;
52
- }, context: import("sdk-logs").ContextLogTrail) => Promise<{
53
- status: number;
54
- headers: Record<string, string>;
55
- text: string;
56
- body: TResponse_1 | null;
57
- }>;
18
+ export declare const askLambdaEndpoint: typeof viaInvoke & {
19
+ viaInvoke: typeof viaInvoke;
20
+ viaApiGateway: typeof viaApiGateway;
58
21
  };
59
22
  /**
60
23
  * .what = input type for askLambdaEndpoint
@@ -1,15 +1,17 @@
1
1
  import type { ContextLogTrail } from 'sdk-logs';
2
+ import type { LambdaEndpointRefusal } from '../../domain.objects/LambdaEndpointRefusal';
2
3
  /**
3
4
  * .what = asks an api gateway endpoint over http, opted into the contemp dialect with the caller's trail
4
5
  * .why = an aws-delivered event cannot hold a `{ event, trail }` wrapper, so the opt-in and the
5
6
  * trail ride the request's own `x-trail-exid` header. this sends it, and casts a fault back
6
- * into the throw `askLambdaEndpoint` gives, so one catch block serves both roads
7
+ * into the throw `askLambdaEndpoint` gives, so one catch block for a refusal serves both roads
7
8
  * (`invariant.ancient-vs-contemp-callers.md`, `domain.terms/x-trail-exid.md`)
8
9
  *
9
10
  * | answer | the caller gets |
10
11
  * |--------|-----------------|
11
12
  * | < 400 | `{ status, headers, text, body }` — `body` is the json, or null where the answer has none |
12
- * | 4xx | a thrown `ConstraintError`, with the endpoint's message |
13
+ * | 4xx, save 429 | a thrown `LambdaEndpointRefusedError` (or `ConstraintError`, with `refusal: { as: 'ConstraintError' }`), with the endpoint's message |
14
+ * | 429 | a thrown `MalfunctionError` under either opt: a throttle, not a refusal; `retry-after` rides `metadata.headers` |
13
15
  * | 5xx | a thrown `MalfunctionError`, with the `correlationId` that finds the log line |
14
16
  *
15
17
  * .note = takes the standard http request — `{ url, method, headers, body }` — as fetch does, and
@@ -27,6 +29,13 @@ export declare const viaApiGateway: <TResponse = unknown>(input: {
27
29
  method?: string;
28
30
  headers?: Record<string, string>;
29
31
  body?: unknown;
32
+ /**
33
+ * .what = the class a 4xx answer is thrown as (a 429 excepted: it is a throttle, a `MalfunctionError`)
34
+ * .why = this caller composed the request, so by default a refusal is this caller's own
35
+ * malfunction, as on the invoke road
36
+ * .default = { as: 'LambdaEndpointRefusedError' }
37
+ */
38
+ refusal?: LambdaEndpointRefusal;
30
39
  }, context: ContextLogTrail) => Promise<{
31
40
  status: number;
32
41
  headers: Record<string, string>;
@@ -1,25 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.viaApiGateway = void 0;
4
- const getOneTrailExid_1 = require("../lambdaEndpointWire/context/getOneTrailExid");
4
+ const getOneTrailExid_1 = require("../../domain.operations/lambdaEndpointWire/context/getOneTrailExid");
5
5
  const executeHttpRequest_1 = require("./invoke/executeHttpRequest");
6
6
  const asErrorFromHttpResponse_1 = require("./serde/asErrorFromHttpResponse");
7
7
  const asHeadersRecord_1 = require("./serde/asHeadersRecord");
8
8
  const asHttpMethod_1 = require("./serde/asHttpMethod");
9
9
  const asHttpRequestBody_1 = require("./serde/asHttpRequestBody");
10
10
  const asHttpRequestHeaders_1 = require("./serde/asHttpRequestHeaders");
11
+ const asLambdaEndpointRefusal_1 = require("./serde/asLambdaEndpointRefusal");
11
12
  const getOneBodyFromHttpText_1 = require("./serde/getOneBodyFromHttpText");
12
13
  /**
13
14
  * .what = asks an api gateway endpoint over http, opted into the contemp dialect with the caller's trail
14
15
  * .why = an aws-delivered event cannot hold a `{ event, trail }` wrapper, so the opt-in and the
15
16
  * trail ride the request's own `x-trail-exid` header. this sends it, and casts a fault back
16
- * into the throw `askLambdaEndpoint` gives, so one catch block serves both roads
17
+ * into the throw `askLambdaEndpoint` gives, so one catch block for a refusal serves both roads
17
18
  * (`invariant.ancient-vs-contemp-callers.md`, `domain.terms/x-trail-exid.md`)
18
19
  *
19
20
  * | answer | the caller gets |
20
21
  * |--------|-----------------|
21
22
  * | < 400 | `{ status, headers, text, body }` — `body` is the json, or null where the answer has none |
22
- * | 4xx | a thrown `ConstraintError`, with the endpoint's message |
23
+ * | 4xx, save 429 | a thrown `LambdaEndpointRefusedError` (or `ConstraintError`, with `refusal: { as: 'ConstraintError' }`), with the endpoint's message |
24
+ * | 429 | a thrown `MalfunctionError` under either opt: a throttle, not a refusal; `retry-after` rides `metadata.headers` |
23
25
  * | 5xx | a thrown `MalfunctionError`, with the `correlationId` that finds the log line |
24
26
  *
25
27
  * .note = takes the standard http request — `{ url, method, headers, body }` — as fetch does, and
@@ -33,6 +35,8 @@ const getOneBodyFromHttpText_1 = require("./serde/getOneBodyFromHttpText");
33
35
  * dependency, and sets no timeout: fetch waits as long as the endpoint does
34
36
  */
35
37
  const viaApiGateway = async (input, context) => {
38
+ // refuse an unknown refusal opt before any request is sent
39
+ const refusal = (0, asLambdaEndpointRefusal_1.asLambdaEndpointRefusal)({ declared: input.refusal });
36
40
  // the caller's exid, or a generated one — the same call `askLambdaEndpoint` makes
37
41
  const exid = (0, getOneTrailExid_1.getOneTrailExid)({ log: context.log });
38
42
  // send the request, opted in by the trail header
@@ -60,6 +64,7 @@ const viaApiGateway = async (input, context) => {
60
64
  headers,
61
65
  url: input.url,
62
66
  exid,
67
+ refusal,
63
68
  });
64
69
  if (error)
65
70
  throw error;
@@ -1 +1 @@
1
- {"version":3,"file":"askLambdaEndpoint.viaApiGateway.js","sourceRoot":"","sources":["../../../src/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.ts"],"names":[],"mappings":";;;AAEA,mFAAgF;AAChF,oEAAiE;AACjE,6EAA0E;AAC1E,6DAA0D;AAC1D,uDAAoD;AACpD,iEAA8D;AAC9D,uEAAoE;AACpE,2EAAwE;AAExE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,MAAM,aAAa,GAAG,KAAK,EAChC,KAKC,EACD,OAAwB,EAMvB,EAAE;IACH,kFAAkF;IAClF,MAAM,IAAI,GAAG,IAAA,iCAAe,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEnD,iDAAiD;IACjD,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,MAAM,IAAA,uCAAkB,EAAC;QACxC,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAA,2BAAY,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,EAAE,IAAA,2CAAoB,EAAC;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,EAAE,IAAI,EAAE;SAChB,CAAC;QACF,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI;KACL,CAAC,CAAC;IAEH,uEAAuE;IACvE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,GAAG,IAAA,+CAAsB,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAE9C,6DAA6D;IAC7D,MAAM,OAAO,GAAG,IAAA,iCAAe,EAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAA,iDAAuB,EAAC;QACpC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI;QACJ,IAAI;QACJ,OAAO;QACP,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI;KACL,CAAC,CAAC;IACH,IAAI,KAAK;QAAE,MAAM,KAAK,CAAC;IAEvB;;;;;OAKG;IACH,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,OAAO;QACP,IAAI;QACJ,IAAI,EAAE,IAAwB;KAC/B,CAAC;AACJ,CAAC,CAAC;AA3DW,QAAA,aAAa,iBA2DxB"}
1
+ {"version":3,"file":"askLambdaEndpoint.viaApiGateway.js","sourceRoot":"","sources":["../../../src/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaApiGateway.ts"],"names":[],"mappings":";;;AAGA,wGAAqG;AAErG,oEAAiE;AACjE,6EAA0E;AAC1E,6DAA0D;AAC1D,uDAAoD;AACpD,iEAA8D;AAC9D,uEAAoE;AACpE,6EAA0E;AAC1E,2EAAwE;AAExE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,aAAa,GAAG,KAAK,EAChC,KAYC,EACD,OAAwB,EAMvB,EAAE;IACH,2DAA2D;IAC3D,MAAM,OAAO,GAAG,IAAA,iDAAuB,EAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAErE,kFAAkF;IAClF,MAAM,IAAI,GAAG,IAAA,iCAAe,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEnD,iDAAiD;IACjD,MAAM,OA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emoryCache } from 'simple-in-memory-cache';
2
2
  import type { SimpleCache } from 'with-simple-cache';
3
3
  import type { ContextAwsLambdaCaller } from '../../domain.objects/ContextAwsLambdaCaller';
4
4
  import type { LambdaEndpointDialect } from '../../domain.objects/LambdaEndpointDialect';
5
+ import type { LambdaEndpointRefusal } from '../../domain.objects/LambdaEndpointRefusal';
5
6
  /**
6
7
  * .what = invokes a lambda endpoint with trail propagation, over the aws lambda invoke api
7
8
  * .why = enables service-to-service calls with observability
@@ -29,6 +30,15 @@ export declare const viaInvoke: <TRequest, TResponse>(input: {
29
30
  */
30
31
  payload?: LambdaEndpointDialect;
31
32
  };
33
+ /**
34
+ * .what = the class a peer's refusal (its ConstraintError / BadRequestError) is thrown as
35
+ * .why = this caller composed the request, so by default a refusal is this caller's own
36
+ * malfunction — an api-gateway caller answers 500, never a 400 its caller cannot fix
37
+ * .default = { as: 'LambdaEndpointRefusedError' }
38
+ * .note = name `{ as: 'ConstraintError' }` only where the request forwards your own caller's
39
+ * input verbatim, so the fault truly is theirs to fix
40
+ */
41
+ refusal?: LambdaEndpointRefusal;
32
42
  }, context: ContextAwsLambdaCaller & {
33
43
  cache?: {
34
44
  response?: SimpleCache<TResponse>;
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.viaInvoke = void 0;
4
4
  const genLambdaSdk_1 = require("../../access/sdks/lambda/genLambdaSdk");
5
- const asLambdaEndpoint_1 = require("../asLambdaEndpoint/asLambdaEndpoint");
6
- const getOneTrailExid_1 = require("../lambdaEndpointWire/context/getOneTrailExid");
5
+ const asLambdaEndpoint_1 = require("../../domain.operations/asLambdaEndpoint/asLambdaEndpoint");
6
+ const getOneTrailExid_1 = require("../../domain.operations/lambdaEndpointWire/context/getOneTrailExid");
7
+ const asAskLambdaCacheKeyOfRefusal_1 = require("./cache/asAskLambdaCacheKeyOfRefusal");
7
8
  const asCachedExecutor_1 = require("./cache/asCachedExecutor");
8
9
  const getAskLambdaCacheKey_1 = require("./cache/getAskLambdaCacheKey");
10
+ const asLambdaEndpointRefusal_1 = require("./serde/asLambdaEndpointRefusal");
9
11
  const getLambdaPayload_1 = require("./serde/getLambdaPayload");
10
12
  /**
11
13
  * .what = invokes a lambda endpoint with trail propagation, over the aws lambda invoke api
@@ -17,6 +19,8 @@ const getLambdaPayload_1 = require("./serde/getLambdaPayload");
17
19
  * .note = use struct: 'ancient' for handlers that don't understand wrapped payloads
18
20
  */
19
21
  const viaInvoke = async (input, context) => {
22
+ // refuse an unknown refusal opt before any invoke is sent
23
+ const refusal = (0, asLambdaEndpointRefusal_1.asLambdaEndpointRefusal)({ declared: input.refusal });
20
24
  // extract or generate the trail exid, and report the fallback if one was made.
21
25
  // shared with `runLambdaEndpoint.onSerialized` so the two loci cannot diverge
22
26
  // on the diagnostic — see `getOneTrailExid` for why that parity is structural
@@ -48,15 +52,23 @@ const viaInvoke = async (input, context) => {
48
52
  env: { region: context.env.region },
49
53
  });
50
54
  // prepare invocation input + context
51
- const invocationInput = { endpoint, payload, exid };
55
+ const invocationInput = {
56
+ endpoint,
57
+ payload,
58
+ exid,
59
+ refusal,
60
+ };
52
61
  const invocationContext = {
53
62
  sdkLambda,
54
63
  log: context.log,
55
64
  };
56
- // build cache key generator
57
- const getCacheKey = () => (0, getAskLambdaCacheKey_1.getAskLambdaCacheKey)({
58
- endpoint,
59
- event: input.event,
65
+ // build cache key generator; a pass-through ask never shares a key with a default ask
66
+ const getCacheKey = () => (0, asAskLambdaCacheKeyOfRefusal_1.asAskLambdaCacheKeyOfRefusal)({
67
+ key: (0, getAskLambdaCacheKey_1.getAskLambdaCacheKey)({
68
+ endpoint,
69
+ event: input.event,
70
+ }),
71
+ refusal,
60
72
  });
61
73
  // get executor with cache wrapper
62
74
  const execute = (0, asCachedExecutor_1.asCachedExecutor)({
@@ -1 +1 @@
1
- {"version":3,"file":"askLambdaEndpoint.viaInvoke.js","sourceRoot":"","sources":["../../../src/domain.operations/askLambdaEndpoint/askLambdaEnd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CAAC;IAEH,qCAAqC;IACrC,MAAM,eAAe,GAAoB,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACrE,MAAM,iBAAiB,GAAsB;QAC3C,SAAS;QACT,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC;IAEF,4BAA4B;IAC5B,MAAM,WAAW,GAAG,GAAW,EAAE,CAC/B,IAAA,2CAAoB,EAAC;QACnB,QAAQ;QACR,KAAK,EAAE,KAAK,CAAC,KAAgC;KAC9C,CAAC,CAAC;IAEL,kCAAkC;IAClC,MAAM,OAAO,GAAG,IAAA,mCAAgB,EAAY;QAC1C,GAAG,OAAO,CAAC,KAAK;QAChB,WAAW;KACZ,CAAC,CAAC;IAEH,qBAAqB;IACrB,OAAO,OAAO,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC,CAAC;AApFW,QAAA,SAAS,aAoFpB"}
1
+ {"version":3,"file":"askLambdaEndpoint.viaInvoke.js","sourceRoot":"","sources":["../../../src/domain.operations/askLambdaEndpoint/askLambdaEndpoint.viaInvoke.ts"],"names":[],"mappings":";;;AAGA,wEAAqE;AAIrE,gGAA6F;AAC7F,wGAAqG;AAErG,uFAAoF;AACpF,+DAA4D;AAC5D,uEAAoE;AAKpE,6EAA0E;AAC1E,+DAA4D;AAE5D;;;;;;;;GAQG;AACI,MAAM,SAAS,GAAG,KAAK,EAC5B,KA2BC,EACD,OAKC,EACmB,EAAE;IACtB,0DAA0D;IAC1D,MAAM,OAAO,GAAG,IAAA,iDAAuB,EAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAErE,+EAA+E;IAC/E,8EAA8E;IAC9E,8EAA8E;IAC9E,yBAAyB;IACzB,MAAM,IAAI,GAAG,IAAA,iCAAe,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEnD,wEAAwE;IACxE,MAAM,QAAQ,GAAG,IAAA,mCAAgB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OAAO,GAAG,IAAA,mCAAgB,EAAY;QAC1C,GAAG,OAAO,CAAC,KAAK;QAChB,WAAW;KACZ,CAAC,CAAC;IAEH,qBAAqB;IACrB,OAAO,OAAO,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;AACrD,CAAC,CAAC;AAxGW,QAAA,SAAS,GAAT,SAAS,CAwGpB"}
@@ -0,0 +1,17 @@
1
+ import type { LambdaEndpointRefusal } from '../../../domain.objects/LambdaEndpointRefusal';
2
+ /**
3
+ * .what = the cache key of one ask, under the refusal opt it was asked with
4
+ * .why = the dedupe cache shares one in-flight promise per key, and a rejection's class depends on
5
+ * the opt. so a pass-through ask must never share a key with a default ask, or a caller
6
+ * could catch the class the other caller asked for (sdk-aws-lambda#77)
7
+ *
8
+ * .note = the default opt keeps the key it had before the opt existed, so the public
9
+ * `getAskLambdaCacheKey` and every extant cached entry stay as they were
10
+ * .note = the cost: a pass-through ask no longer shares a cached success with a default ask of
11
+ * the same event. a class-neutral throw cast at the `viaInvoke` boundary would keep those
12
+ * hits, but needs a marker that tells a peer refusal from a local `ConstraintError`
13
+ */
14
+ export declare const asAskLambdaCacheKeyOfRefusal: (input: {
15
+ key: string;
16
+ refusal: LambdaEndpointRefusal;
17
+ }) => string;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asAskLambdaCacheKeyOfRefusal = void 0;
4
+ /**
5
+ * .what = the cache key of one ask, under the refusal opt it was asked with
6
+ * .why = the dedupe cache shares one in-flight promise per key, and a rejection's class depends on
7
+ * the opt. so a pass-through ask must never share a key with a default ask, or a caller
8
+ * could catch the class the other caller asked for (sdk-aws-lambda#77)
9
+ *
10
+ * .note = the default opt keeps the key it had before the opt existed, so the public
11
+ * `getAskLambdaCacheKey` and every extant cached entry stay as they were
12
+ * .note = the cost: a pass-through ask no longer shares a cached success with a default ask of
13
+ * the same event. a class-neutral throw cast at the `viaInvoke` boundary would keep those
14
+ * hits, but needs a marker that tells a peer refusal from a local `ConstraintError`
15
+ */
16
+ const asAskLambdaCacheKeyOfRefusal = (input) => {
17
+ if (input.refusal.as === 'LambdaEndpointRefusedError')
18
+ return input.key;
19
+ return `${input.key}::refusal=${input.refusal.as}`;
20
+ };
21
+ exports.asAskLambdaCacheKeyOfRefusal = asAskLambdaCacheKeyOfRefusal;
22
+ //# sourceMappingURL=asAskLambdaCacheKeyOfRefusal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asAskLambdaCacheKeyOfRefusal.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asAskLambdaCacheKeyOfRefusal.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;GAWG;AACI,MAAM,4BAA4B,GAAG,CAAC,KAG5C,EAAU,EAAE;IACX,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,4BAA4B;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC;IACxE,OAAO,GAAG,KAAK,CAAC,GAAG,aAAa,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;AACrD,CAAC,CAAC;AANW,QAAA,4BAA4B,GAA5B,4BAA4B,CAMvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"asCacheWithoutSet.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACI,MAAM,iBAAiB,GAAG,CAAI,KAAqB,EAAkB,EAAE,CAC5E,CAAC;IACC,GAAG,KAAK;IACR,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAA0B;CACzC,CAAmB,CAAC;AAJV,QAAA,iBAAiB,qBAIP"}
1
+ {"version":3,"file":"asCacheWithoutSet.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCacheWithoutSet.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACI,MAAM,iBAAiB,GAAG,CAAI,KAAqB,EAAkB,EAAE,CAC5E,CAAC;IACC,GAAG,KAAK;IACR,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAA0B;CACzC,CAAmB,CAAC;AAJV,QAAA,iBAAiB,GAAjB,iBAAiB,CAIP"}
@@ -1,6 +1,6 @@
1
1
  import type { SimpleInMemoryCache } from 'simple-in-memory-cache';
2
2
  import { type SimpleCache } from 'with-simple-cache';
3
- import { type InvocationContext, type InvocationInput } from '../invoke/executeLambdaInvocation';
3
+ import { type InvocationContext, type InvocationInput } from '../../../domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation';
4
4
  /**
5
5
  * .what = executor type for lambda invocation
6
6
  * .why = typed for cache wrapper composition
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.asCachedExecutor = void 0;
4
4
  const with_simple_cache_1 = require("with-simple-cache");
5
- const executeLambdaInvocation_1 = require("../invoke/executeLambdaInvocation");
5
+ const executeLambdaInvocation_1 = require("../../../domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation");
6
6
  /**
7
7
  * .what = wraps executor with cache if caches provided
8
8
  * .why = extracts cache selection logic from orchestrator
@@ -1 +1 @@
1
- {"version":3,"file":"asCachedExecutor.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.ts"],"names":[],"mappings":";;;AACA,yDAA2E;AAE3E,+EAI2C;AAW3C;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAY,KAI3C,EAA6B,EAAE;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,iDAAoD,CAAC;IAE9D,+CAA+C;IAC/C,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;YACnD,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK,CAAC,QAAQ;gBACtB,aAAa,EAAE,KAAK,CAAC,MAAM;aAC5B;YACD,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;SACtC,CAA8B,CAAC;IAClC,CAAC;IAED,oBAAoB;IACpB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;QACnD,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;KACtC,CAA8B,CAAC;AAClC,CAAC,CAAC;AAzBW,QAAA,gBAAgB,oBAyB3B"}
1
+ {"version":3,"file":"asCachedExecutor.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/cache/asCachedExecutor.ts"],"names":[],"mappings":";;;AACA,yDAA2E;AAE3E,sHAIkF;AAWlF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAY,KAI3C,EAA6B,EAAE;IAC9B,+CAA+C;IAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ;QACjB,OAAO,iDAAoD,CAAC;IAE9D,+CAA+C;IAC/C,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;YACnD,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK,CAAC,QAAQ;gBACtB,aAAa,EAAE,KAAK,CAAC,MAAM;aAC5B;YACD,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;SACtC,CAA8B,CAAC;IAClC,CAAC;IAED,oBAAoB;IACpB,OAAO,IAAA,wCAAoB,EAAC,iDAAuB,EAAE;QACnD,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,WAAW,EAAE;KACtC,CAA8B,CAAC;AAClC,CAAC,CAAC;AAzBW,QAAA,gBAAgB,GAAhB,gBAAgB,CAyB3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"getAskLambdaCacheKey.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaE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AAQ,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE5E,sCAAsC;IACtC,MAAM,SAAS,GAAG,QAAQ;SACvB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;SACzB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAEzB,6CAA6C;IAC7C,MAAM,UAAU,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SACpC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SAChC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC,CAAC;AAlBW,QAAA,oBAAoB,GAApB,oBAAoB,CAkB/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"getStatusCodeHint.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAU,EAAE;IAC9D,uCAAuC;IACvC,IAAI,UAAU,KAAK,GAAG;QAAE,OAAO,6CAA6C,CAAC;IAC7E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,iEAAiE,CAAC;IAC3E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,uFAAuF,CAAC;IACjG,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,sDAAsD,CAAC;IAChE,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,qEAAqE,CAAC;IAC/E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,mEAAmE,CAAC;IAC7E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,2DAA2D,CAAC;IACrE,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,gEAAgE,CAAC;IAC1E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,8DAA8D,CAAC;IACxE,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,qDAAqD,CAAC;IAE/D,oCAAoC;IACpC,OAAO,UAAU,UAAU,wDAAwD,CAAC;AACtF,CAAC,CAAC;AAxBW,QAAA,iBAAiB,qBAwB5B"}
1
+ {"version":3,"file":"getStatusCodeHint.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/error/getStatusCodeHint.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAU,EAAE;IAC9D,uCAAuC;IACvC,IAAI,UAAU,KAAK,GAAG;QAAE,OAAO,6CAA6C,CAAC;IAC7E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,iEAAiE,CAAC;IAC3E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,uFAAuF,CAAC;IACjG,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,sDAAsD,CAAC;IAChE,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,qEAAqE,CAAC;IAC/E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,mEAAmE,CAAC;IAC7E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,2DAA2D,CAAC;IACrE,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,gEAAgE,CAAC;IAC1E,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,8DAA8D,CAAC;IACxE,IAAI,UAAU,KAAK,GAAG;QACpB,OAAO,qDAAqD,CAAC;IAE/D,oCAAoC;IACpC,OAAO,UAAU,UAAU,wDAAwD,CAAC;AACtF,CAAC,CAAC;AAxBW,QAAA,iBAAiB,GAAjB,iBAAiB,CAwB5B"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * .what = sends one http request with the runtime's global fetch, and names the request on a fault
3
3
  * .why = a network fault leaves fetch as a bare `TypeError: fetch failed`, which names no url, no
4
- * method, and no trail exid. the reader at 3am needs all three
4
+ * method, and no trail exid. the on-call reader needs all three
5
5
  *
6
6
  * .note = the peer of `executeLambdaInvocation`: the raw i/o boundary for the http road
7
7
  * .note = every fault is caught and re-thrown, never hidden. `cause` rides along where the fault is
@@ -5,7 +5,7 @@ const helpful_errors_1 = require("helpful-errors");
5
5
  /**
6
6
  * .what = sends one http request with the runtime's global fetch, and names the request on a fault
7
7
  * .why = a network fault leaves fetch as a bare `TypeError: fetch failed`, which names no url, no
8
- * method, and no trail exid. the reader at 3am needs all three
8
+ * method, and no trail exid. the on-call reader needs all three
9
9
  *
10
10
  * .note = the peer of `executeLambdaInvocation`: the raw i/o boundary for the http road
11
11
  * .note = every fault is caught and re-thrown, never hidden. `cause` rides along where the fault is
@@ -1 +1 @@
1
- {"version":3,"file":"executeHttpRequest.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAElD;;;;;;;;;GASG;AACI,MAAM,kBAAkB,GAAG,KAAK,EAAE,KAMxC,EAAqB,EAAE;IACtB,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE;YAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,iCAAgB,CAAC,6CAA6C,EAAE;YACxE,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC;YAC3B,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AAtBW,QAAA,kBAAkB,sBAsB7B"}
1
+ {"version":3,"file":"executeHttpRequest.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/invoke/executeHttpRequest.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAElD;;;;;;;;;GASG;AACI,MAAM,kBAAkB,GAAG,KAAK,EAAE,KAMxC,EAAqB,EAAE;IACtB,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE;YAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,iCAAgB,CAAC,6CAA6C,EAAE;YACxE,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC;YAC3B,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AAtBW,QAAA,kBAAkB,GAAlB,kBAAkB,CAsB7B"}
@@ -1,5 +1,6 @@
1
1
  import type { LambdaClient } from '@aws-sdk/client-lambda';
2
2
  import type { LambdaEndpoint } from '../../../domain.objects/LambdaEndpoint';
3
+ import type { LambdaEndpointRefusal } from '../../../domain.objects/LambdaEndpointRefusal';
3
4
  /**
4
5
  * .what = minimal log interface for lambda invocation
5
6
  * .why = accepts console, sdk-logs LogMethods, or any object with debug method
@@ -15,6 +16,7 @@ export type InvocationInput = {
15
16
  endpoint: LambdaEndpoint;
16
17
  payload: unknown;
17
18
  exid: string;
19
+ refusal: LambdaEndpointRefusal;
18
20
  };
19
21
  /**
20
22
  * .what = invocation context for lambda execution
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.executeLambdaInvocation = void 0;
4
4
  const sdkLambdaInvoke_1 = require("../../../access/sdks/lambda/sdkLambdaInvoke");
5
5
  const LambdaEndpointError_1 = require("../../../domain.objects/LambdaEndpointError");
6
- const getParsedResponse_1 = require("../../lambdaEndpointWire/getParsedResponse");
7
- const getStatusCodeHint_1 = require("../error/getStatusCodeHint");
6
+ const getStatusCodeHint_1 = require("../../../domain.operations/askLambdaEndpoint/error/getStatusCodeHint");
7
+ const getParsedResponse_1 = require("../../../domain.operations/lambdaEndpointWire/getParsedResponse");
8
8
  /**
9
9
  * .what = the core lambda invocation logic
10
10
  * .why = extracted to enable cache wrapper composition
@@ -49,6 +49,7 @@ const executeLambdaInvocation = async (input, context) => {
49
49
  functionError: result.functionError,
50
50
  endpoint: input.endpoint,
51
51
  exid: input.exid,
52
+ refusal: input.refusal,
52
53
  });
53
54
  // log result
54
55
  context.log?.debug('askLambdaEndpoint.result', {
@@ -1 +1 @@
1
- {"version":3,"file":"executeLambdaInvocation.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.ts"],"names":[],"mappings":";;;AAEA,iFAA8E;AAE9E,qFAAkF;AAClF,kFAA+E;AAC/E,kEAA+D;AA6B/D;;;GAGG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAC1C,KAAsB,EACtB,OAA0B,EACN,EAAE;IACtB,iBAAiB;IACjB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,0BAA0B,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;QACzB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;IAEH,iC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AAa;IACb,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,0BAA0B,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;QACzB,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AA1DW,QAAA,uBAAuB,2BA0DlC"}
1
+ {"version":3,"file":"executeLambdaInvocation.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.ts"],"names":[],"mappings":";;;AAEA,8EAA2E;AAE3E,kFAA+E;AAE/E,yGAAsG;AACtG,oGAAiG;AA8BjG;;;GAGG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAC1C,KAAsB,EACtB,OAA0B,EACN,EAAE;IACtB,iBAAiB;IACjB,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,0BAA0B,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;QACzB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC;IAEH,iCAAiC;IACjC,8EAA8E;IAC9E,iFAAiF;IACjF,gEAAgE;IAChE,uDAAuD;IACvD,MAAM,MAAM,GAAG,MAAM,IAAA,iCAAe,EAClC,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EACrD,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CACjC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACzB,sCAAsC;QACtC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QAE3C,+DAA+D;QAC/D,MAAM,IAAI,yCAAmB,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,EAAE;YACzE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,gFAAgF;IAChF,6EAA6E;IAC7E,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC;IAC1C,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACvB,0DAA0D;QAC1D,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;QACjD,MAAM,IAAI,yCAAmB,CAAC,6BAA6B,UAAU,EAAE,EAAE;YACvE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB;IACjB,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAY;QAC5C,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAC;IAEH,aAAa;IACb,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,0BAA0B,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;QACzB,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AA3DW,QAAA,uBAAuB,GAAvB,uBAAuB,CA2DlC"}
@@ -1,4 +1,6 @@
1
- import { ConstraintError, MalfunctionError } from 'helpful-errors';
1
+ import { type ConstraintError, MalfunctionError } from 'helpful-errors';
2
+ import type { LambdaEndpointRefusal } from '../../../domain.objects/LambdaEndpointRefusal';
3
+ import type { LambdaEndpointRefusedError } from '../../../domain.objects/LambdaEndpointRefusedError';
2
4
  /**
3
5
  * .what = casts an http response into the error a caller should throw, or null for a success
4
6
  * .why = an api gateway endpoint answers a fault as a RETURNED http response, never a lambda error
@@ -8,7 +10,8 @@ import { ConstraintError, MalfunctionError } from 'helpful-errors';
8
10
  * | status | the error | because |
9
11
  * |--------|-----------|---------|
10
12
  * | < 400 | none | a success. a redirect is followed by fetch by default, so a 3xx seldom arrives here |
11
- * | 4xx | `ConstraintError` | the caller must fix the request |
13
+ * | 4xx, save 429 | the `refusal` class: `LambdaEndpointRefusedError` by default, `ConstraintError` on opt-in | this caller composed the request, so the refusal is its own malfunction — unless it forwards its own caller's input |
14
+ * | 429 | `MalfunctionError`, under either opt | a throttle, not a refusal: the same request succeeds after `retry-after` |
12
15
  * | 5xx | `MalfunctionError` | the endpoint must fix itself; its `correlationId` finds the log line |
13
16
  *
14
17
  * .note = the message comes from the body's contemp envelope when it has one, else from the
@@ -18,8 +21,8 @@ import { ConstraintError, MalfunctionError } from 'helpful-errors';
18
21
  * .note = the raw answer text rides the error metadata, cut to a bound, so a message no arm reads
19
22
  * (an old endpoint's flat body, a proxy's html page) is never lost to the caller. it is null
20
23
  * where the message came from the contemp envelope, which is the text already. the
21
- * response headers ride it too, so a deliberate refusal (a 429 and its `retry-after`) can be
22
- * read from the thrown error
24
+ * response headers ride it too, so a throttle's `retry-after` can be read from the thrown
25
+ * error
23
26
  */
24
27
  export declare const asErrorFromHttpResponse: (input: {
25
28
  status: number;
@@ -28,4 +31,5 @@ export declare const asErrorFromHttpResponse: (input: {
28
31
  headers: Record<string, string>;
29
32
  url: string;
30
33
  exid: string;
31
- }) => ConstraintError | MalfunctionError | null;
34
+ refusal: LambdaEndpointRefusal;
35
+ }) => ConstraintError | LambdaEndpointRefusedError | MalfunctionError | null;
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.asErrorFromHttpResponse = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
5
  const HttpStatusCode_1 = require("../../../domain.objects/HttpStatusCode");
6
- const getIsLambdaErrorResponse_1 = require("../../lambdaEndpointWire/error/getIsLambdaErrorResponse");
7
- const asUnprefixedErrorMessage_1 = require("../../lambdaEndpointWire/serde/asUnprefixedErrorMessage");
6
+ const asErrorFromPeerRefusal_1 = require("../../../domain.operations/lambdaEndpointWire/error/asErrorFromPeerRefusal");
7
+ const getIsLambdaErrorResponse_1 = require("../../../domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse");
8
+ const asUnprefixedErrorMessage_1 = require("../../../domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage");
9
+ const getIsHttpThrottle_1 = require("./getIsHttpThrottle");
8
10
  const getOneCorrelationIdFromBody_1 = require("./getOneCorrelationIdFromBody");
9
11
  const ERROR_TEXT_LENGTH_MAX = 1000;
10
12
  /**
@@ -16,7 +18,8 @@ const ERROR_TEXT_LENGTH_MAX = 1000;
16
18
  * | status | the error | because |
17
19
  * |--------|-----------|---------|
18
20
  * | < 400 | none | a success. a redirect is followed by fetch by default, so a 3xx seldom arrives here |
19
- * | 4xx | `ConstraintError` | the caller must fix the request |
21
+ * | 4xx, save 429 | the `refusal` class: `LambdaEndpointRefusedError` by default, `ConstraintError` on opt-in | this caller composed the request, so the refusal is its own malfunction — unless it forwards its own caller's input |
22
+ * | 429 | `MalfunctionError`, under either opt | a throttle, not a refusal: the same request succeeds after `retry-after` |
20
23
  * | 5xx | `MalfunctionError` | the endpoint must fix itself; its `correlationId` finds the log line |
21
24
  *
22
25
  * .note = the message comes from the body's contemp envelope when it has one, else from the
@@ -26,14 +29,18 @@ const ERROR_TEXT_LENGTH_MAX = 1000;
26
29
  * .note = the raw answer text rides the error metadata, cut to a bound, so a message no arm reads
27
30
  * (an old endpoint's flat body, a proxy's html page) is never lost to the caller. it is null
28
31
  * where the message came from the contemp envelope, which is the text already. the
29
- * response headers ride it too, so a deliberate refusal (a 429 and its `retry-after`) can be
30
- * read from the thrown error
32
+ * response headers ride it too, so a throttle's `retry-after` can be read from the thrown
33
+ * error
31
34
  */
32
35
  const asErrorFromHttpResponse = (input) => {
33
36
  if (input.status < HttpStatusCode_1.HttpStatusCode.BAD_REQUEST_400)
34
37
  return null;
35
- const message = (0, getIsLambdaErrorResponse_1.getIsContempErrorResponse)(input.body)
36
- ? (0, asUnprefixedErrorMessage_1.asUnprefixedErrorMessage)({ message: input.body.error.message })
38
+ // the envelope, resolved once: every field below reads it, or the status where there is none
39
+ const envelope = (0, getIsLambdaErrorResponse_1.getIsContempErrorResponse)(input.body)
40
+ ? input.body.error
41
+ : null;
42
+ const message = envelope
43
+ ? (0, asUnprefixedErrorMessage_1.asUnprefixedErrorMessage)({ message: envelope.message })
37
44
  : `the endpoint answered http ${input.status}`;
38
45
  const metadata = {
39
46
  url: input.url,
@@ -42,13 +49,24 @@ const asErrorFromHttpResponse = (input) => {
42
49
  correlationId: (0, getOneCorrelationIdFromBody_1.getOneCorrelationIdFromBody)({ body: input.body }),
43
50
  // the raw text rides only where the message did not come from it: an envelope's message is
44
51
  // the text already, and a second copy would bury the fix a person reads first
45
- text: (0, getIsLambdaErrorResponse_1.getIsContempErrorResponse)(input.body)
46
- ? null
47
- : input.text.slice(0, ERROR_TEXT_LENGTH_MAX),
52
+ text: envelope ? null : input.text.slice(0, ERROR_TEXT_LENGTH_MAX),
48
53
  headers: input.headers,
49
54
  };
55
+ // a 429: a throttle, not a refusal — the same request succeeds after `retry-after`, so it is a
56
+ // server fault under either opt, its headers kept for the retry (`domain.terms/refusal.md`)
57
+ if ((0, getIsHttpThrottle_1.getIsHttpThrottle)({ status: input.status }))
58
+ return new helpful_errors_1.MalfunctionError(message, metadata);
59
+ // any other 4xx: the endpoint refused the request this caller composed; the opt names the class
60
+ // .note = the peer's verdict is its envelope's class where it sent one, else the status alone
50
61
  if (input.status < HttpStatusCode_1.HttpStatusCode.INTERNAL_SERVER_ERROR_500)
51
- return new helpful_errors_1.ConstraintError(message, metadata);
62
+ return (0, asErrorFromPeerRefusal_1.asErrorFromPeerRefusal)({
63
+ refusal: input.refusal,
64
+ peer: input.url,
65
+ message,
66
+ errorType: envelope ? envelope.class : `http ${input.status}`,
67
+ metadata,
68
+ });
69
+ // a 5xx: the endpoint must fix itself
52
70
  return new helpful_errors_1.MalfunctionError(message, metadata);
53
71
  };
54
72
  exports.asErrorFromHttpResponse = asErrorFromHttpResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"asErrorFromHttpResponse.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.ts"],"names":[],"mappings":";;;AAAA,mDAAmE;AAEnE,2EAAwE;AACxE,sGAAoG;AACpG,sGAAmG;AACnG,+EAA4E;AAE5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAOvC,EAA6C,EAAE;IAC9C,IAAI,KAAK,CAAC,MAAM,GAAG,+BAAc,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAE/D,MAAM,OAAO,GAAG,IAAA,oDAAyB,EAAC,KAAK,CAAC,IAAI,CAAC;QACnD,CAAC,CAAC,IAAA,mDAAwB,EAAC,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACjE,CAAC,CAAC,8BAA8B,KAAK,CAAC,MAAM,EAAE,CAAC;IAEjD,MAAM,QAAQ,GAAG;QACf,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EAAE,IAAA,yDAA2B,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QAChE,2FAA2F;QAC3F,8EAA8E;QAC9E,IAAI,EAAE,IAAA,oDAAyB,EAAC,KAAK,CAAC,IAAI,CAAC;YACzC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC;QAC9C,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;IAEF,IAAI,KAAK,CAAC,MAAM,GAAG,+BAAc,CAAC,yBAAyB;QACzD,OAAO,IAAI,gCAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChD,OAAO,IAAI,iCAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC,CAAC;AA9BW,QAAA,uBAAuB,2BA8BlC"}
1
+ {"version":3,"file":"asErrorFromHttpResponse.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asErrorFromHttpResponse.ts"],"names":[],"mappings":";;;AAAA,mDAAwE;AAExE,wEAAqE;AAGrE,oHAAiH;AACjH,wHAAsH;AACtH,wHAAqH;AAErH,2DAAwD;AACxD,+EAA4E;AAE5E,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAQvC,EAA0E,EAAE;IAC3E,IAAI,KAAK,CAAC,MAAM,GAAG,+BAAc,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAE/D,6FAA6F;IAC7F,MAAM,QAAQ,GAAG,IAAA,oDAAyB,EAAC,KAAK,CAAC,IAAI,CAAC;QACpD,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK;QAClB,CAAC,CAAC,IAAI,CAAC;IACT,MAAM,OAAO,GAAG,QAAQ;QACtB,CAAC,CAAC,IAAA,mDAAwB,EAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;QACzD,CAAC,CAAC,8BAA8B,KAAK,CAAC,MAAM,EAAE,CAAC;IAEjD,MAAM,QAAQ,GAAG;QACf,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,aAAa,EAAE,IAAA,yDAA2B,EAA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EAAE;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B"}
1
+ {"version":3,"file":"asHeadersRecord.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHeadersRecord.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACI,MAAM,eAAe,GAAG,CAAC,KAE/B,EAA0B,EAAE;IAC3B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,eAAe,GAAf,eAAe,CAQ1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"asHttpMethod.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpMethod.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACI,MAAM,YAAY,GAAG,CAAC,KAG5B,EAAU,EAAE;IACX,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}
1
+ {"version":3,"file":"asHttpMethod.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpMethod.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACI,MAAM,YAAY,GAAG,CAAC,KAG5B,EAAU,EAAE;IACX,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IACtC,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC,CAAC;AANW,QAAA,YAAY,GAAZ,YAAY,CAMvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"asHttpRequestBody.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAE7C;;;;;;;;;;GAUG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAEjC,EAA4D,EAAE;IAC7D,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC5E,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAChC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACjD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC9E,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
1
+ {"version":3,"file":"asHttpRequestBody.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpRequestBody.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAM,iBAAiB,GAAG,kBAAkB,CAAC;AAE7C;;;;;;;;;;GAUG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAEjC,EAA4D,EAAE;IAC7D,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC5E,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAChC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACjD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC9E,CAAC,CAAC;AAPW,QAAA,iBAAiB,GAAjB,iBAAiB,CAO5B"}
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.asHttpRequestHeaders = void 0;
4
4
  const TrailExidHeader_1 = require("../../../domain.objects/TrailExidHeader");
5
- const asHeadersWithoutKey_1 = require("../../lambdaEndpointWire/frame/asHeadersWithoutKey");
6
- const asTrailExidHeaders_1 = require("../../lambdaEndpointWire/frame/asTrailExidHeaders");
5
+ const asHeadersWithoutKey_1 = require("../../../domain.operations/lambdaEndpointWire/frame/asHeadersWithoutKey");
6
+ const asTrailExidHeaders_1 = require("../../../domain.operations/lambdaEndpointWire/frame/asTrailExidHeaders");
7
7
  const CONTENT_TYPE_HEADER = 'content-type';
8
8
  /**
9
9
  * .what = the headers an http request is sent with: the body's content type, the caller's, and the trail's
@@ -1 +1 @@
1
- {"version":3,"file":"asHttpRequestHeaders.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.ts"],"names":[],"mappings":";;;AAAA,6EAA4E;AAC5E,4FAAyF;AACzF,0FAAuF;AAEvF,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAIpC,EAA0B,EAAE;IAC3B,MAAM,eAAe,GAAG,IAAA,yCAAmB,EAAC;QAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,EAAE,mCAAiB;KACvB,CAAC,CAAC;IACH,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAC1D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,mBAAmB,CACrD,CAAC;IACF,OAAO;QACL,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,kBAAkB;YAC1C,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE;YAC9C,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,eAAe;QAClB,GAAG,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KAC9C,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,oBAAoB,wBAmB/B"}
1
+ {"version":3,"file":"asHttpRequestHeaders.js","sourceRoot":"","sources":["../../../../src/domain.operations/askLambdaEndpoint/serde/asHttpRequestHeaders.ts"],"names":[],"mappings":";;;AAAA,0EAAyE;AACzE,8GAA2G;AAC3G,4GAAyG;AAEzG,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAIpC,EAA0B,EAAE;IAC3B,MAAM,eAAe,GAAG,IAAA,yCAAmB,EAAC;QAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,EAAE,mCAAiB;KACvB,CAAC,CAAC;IACH,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAC1D,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,mBAAmB,CACrD,CAAC;IACF,OAAO;QACL,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,kBAAkB;YAC1C,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC,WAAW,EAAE;YAC9C,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,eAAe;QAClB,GAAG,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KAC9C,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,oBAAoB,GAApB,oBAAoB,CAmB/B"}
@@ -0,0 +1,15 @@
1
+ import { type LambdaEndpointRefusal } from '../../../domain.objects/LambdaEndpointRefusal';
2
+ /**
3
+ * .what = casts a declared `refusal` opt into one this sdk can honor, and refuses any other
4
+ * .why = the cast branches on one literal, so a typo or a config-driven value
5
+ * (`{ as: 'constraintError' }`) would fall to the default class, and the thrown message
6
+ * would then tell the caller to set the very opt they believe they set. a published sdk
7
+ * boundary is validated at runtime or it is not validated (rule.forbid.unexpected-defaults),
8
+ * as `asLambdaEndpointDialect` does for its peer field
9
+ *
10
+ * .note = refused at the ask, before any request is sent, so a bad opt fails on the first call —
11
+ * never only on the first peer refusal, which may come weeks later
12
+ */
13
+ export declare const asLambdaEndpointRefusal: (input: {
14
+ declared?: unknown;
15
+ }) => LambdaEndpointRefusal;