sdk-aws-lambda 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/contract/cli/gen.js +18 -0
  2. package/dist/contract/cli/gen.js.map +1 -1
  3. package/dist/domain.objects/AwsIdentitySynthetic.d.ts +20 -0
  4. package/dist/domain.objects/AwsIdentitySynthetic.js +24 -0
  5. package/dist/domain.objects/AwsIdentitySynthetic.js.map +1 -0
  6. package/dist/domain.objects/LambdaEndpointDialect.d.ts +19 -0
  7. package/dist/domain.objects/LambdaEndpointDialect.js +3 -0
  8. package/dist/domain.objects/LambdaEndpointDialect.js.map +1 -0
  9. package/dist/domain.objects/LambdaEndpointErrorResponseBody.d.ts +70 -0
  10. package/dist/domain.objects/LambdaEndpointErrorResponseBody.js +41 -0
  11. package/dist/domain.objects/LambdaEndpointErrorResponseBody.js.map +1 -0
  12. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.d.ts +7 -0
  13. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.js +13 -0
  14. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.js.map +1 -0
  15. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.d.ts +36 -0
  16. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.js +88 -0
  17. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.constants.js.map +1 -0
  18. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.d.ts +81 -0
  19. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.d.ts +75 -0
  20. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js +163 -0
  21. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromApiGateway.js.map +1 -0
  22. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromKinesis.d.ts +32 -0
  23. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromKinesis.js +55 -0
  24. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromKinesis.js.map +1 -0
  25. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromS3.d.ts +40 -0
  26. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromS3.js +71 -0
  27. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromS3.js.map +1 -0
  28. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSns.d.ts +27 -0
  29. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSns.js +51 -0
  30. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSns.js.map +1 -0
  31. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSqs.d.ts +35 -0
  32. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSqs.js +50 -0
  33. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.fromSqs.js.map +1 -0
  34. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.js +59 -0
  35. package/dist/domain.operations/asLambdaEvent/asLambdaEvent.js.map +1 -0
  36. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.d.ts +2 -1
  37. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js +19 -18
  38. package/dist/domain.operations/askLambdaEndpoint/askLambdaEndpoint.js.map +1 -1
  39. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js +1 -1
  40. package/dist/domain.operations/askLambdaEndpoint/invoke/executeLambdaInvocation.js.map +1 -1
  41. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.d.ts +24 -0
  42. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js +24 -0
  43. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/asApiGatewayResponseSchema.js.map +1 -1
  44. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.d.ts +19 -0
  45. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/genLambdaEndpoint.forApiGateway.js.map +1 -1
  46. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js +7 -7
  47. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forApiGateway/middleware/genZodBodyValidationMiddleware.js.map +1 -1
  48. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.d.ts +37 -10
  49. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js +3 -2
  50. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/genLambdaEndpoint.forAskEndpoint.js.map +1 -1
  51. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js +6 -6
  52. package/dist/domain.operations/genLambdaEndpoint/genLambdaEndpoint.forAskEndpoint/middleware/genZodEventValidationMiddleware.js.map +1 -1
  53. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.d.ts +1 -1
  54. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js +19 -1
  55. package/dist/domain.operations/genLambdaEndpoint/middleware/genInternalServiceErrorMiddleware.js.map +1 -1
  56. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.d.ts +0 -4
  57. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js +224 -3
  58. package/dist/domain.operations/genLambdaEndpoint/middleware/genIntrospectionMiddleware.getJsonSchemaFromZod.js.map +1 -1
  59. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.d.ts +12 -4
  60. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js +12 -4
  61. package/dist/domain.operations/genLambdaEndpoint/middleware/genZodOutputValidationMiddleware.js.map +1 -1
  62. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.d.ts +6 -19
  63. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js +6 -1
  64. package/dist/domain.operations/genLambdaEndpoint/middleware/getErrorResponseBody.js.map +1 -1
  65. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.d.ts +1 -1
  66. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js +1 -1
  67. package/dist/domain.operations/genLambdaEndpoint/middleware/getUnwrappedEventWithExid.js.map +1 -1
  68. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.d.ts +22 -0
  69. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js +29 -0
  70. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedInput.js.map +1 -0
  71. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.d.ts +35 -0
  72. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js +58 -1
  73. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidatedOutput.js.map +1 -1
  74. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.d.ts +1 -0
  75. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js +65 -9
  76. package/dist/domain.operations/genLambdaEndpoint/middleware/getValidationError.js.map +1 -1
  77. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.d.ts +20 -0
  78. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js +31 -2
  79. package/dist/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.js.map +1 -1
  80. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js +24 -19
  81. package/dist/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.js.map +1 -1
  82. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.d.ts +10 -3
  83. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js +10 -3
  84. package/dist/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.js.map +1 -1
  85. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js +9 -23
  86. package/dist/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.js.map +1 -1
  87. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js +11 -18
  88. package/dist/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.js.map +1 -1
  89. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.d.ts +59 -0
  90. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js +87 -0
  91. package/dist/domain.operations/genServiceSdk/getAllJsonSchemaNodes.js.map +1 -0
  92. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js +16 -35
  93. package/dist/domain.operations/getAllLambdaContracts/getAllLambdaContracts.js.map +1 -1
  94. package/dist/domain.operations/lambdaEndpointWire/context/getExidFromContext.js.map +1 -0
  95. package/dist/domain.operations/lambdaEndpointWire/context/getLogForExidExtraction.js.map +1 -0
  96. package/dist/domain.operations/lambdaEndpointWire/context/getOneTrailExid.d.ts +36 -0
  97. package/dist/domain.operations/lambdaEndpointWire/context/getOneTrailExid.js +53 -0
  98. package/dist/domain.operations/lambdaEndpointWire/context/getOneTrailExid.js.map +1 -0
  99. package/dist/domain.operations/lambdaEndpointWire/error/getIsContempErrorTagged.d.ts +1 -0
  100. package/dist/domain.operations/lambdaEndpointWire/error/getIsContempErrorTagged.js +32 -0
  101. package/dist/domain.operations/lambdaEndpointWire/error/getIsContempErrorTagged.js.map +1 -0
  102. package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.d.ts +63 -0
  103. package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.js +39 -0
  104. package/dist/domain.operations/lambdaEndpointWire/error/getIsLambdaErrorResponse.js.map +1 -0
  105. package/dist/domain.operations/lambdaEndpointWire/error/getLambdaErrorMetadata.js.map +1 -0
  106. package/dist/domain.operations/lambdaEndpointWire/error/getStackTraceString.js.map +1 -0
  107. package/dist/domain.operations/lambdaEndpointWire/error/throwIfCredentialsError.d.ts +54 -0
  108. package/dist/domain.operations/lambdaEndpointWire/error/throwIfCredentialsError.js +107 -0
  109. package/dist/domain.operations/lambdaEndpointWire/error/throwIfCredentialsError.js.map +1 -0
  110. package/dist/domain.operations/{genLambdaEndpoint/middleware → lambdaEndpointWire/frame}/getIsWrappedPayload.d.ts +6 -0
  111. package/dist/domain.operations/lambdaEndpointWire/frame/getIsWrappedPayload.js.map +1 -0
  112. package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.d.ts +45 -0
  113. package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js +173 -0
  114. package/dist/domain.operations/lambdaEndpointWire/getParsedResponse.js.map +1 -0
  115. package/dist/domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage.d.ts +21 -0
  116. package/dist/domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage.js +33 -0
  117. package/dist/domain.operations/lambdaEndpointWire/serde/asUnprefixedErrorMessage.js.map +1 -0
  118. package/dist/domain.operations/lambdaEndpointWire/serde/getDecodedPayload.js.map +1 -0
  119. package/dist/domain.operations/lambdaEndpointWire/serde/getParsedJson.js.map +1 -0
  120. package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.d.ts +24 -0
  121. package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.js +70 -0
  122. package/dist/domain.operations/runLambdaEndpoint/context/asLambdaContext.js.map +1 -0
  123. package/dist/domain.operations/runLambdaEndpoint/dialect/LambdaEndpointRunOutput.d.ts +67 -0
  124. package/dist/domain.operations/runLambdaEndpoint/dialect/LambdaEndpointRunOutput.js +3 -0
  125. package/dist/domain.operations/runLambdaEndpoint/dialect/LambdaEndpointRunOutput.js.map +1 -0
  126. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointDialect.d.ts +26 -0
  127. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointDialect.js +43 -0
  128. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointDialect.js.map +1 -0
  129. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.d.ts +47 -0
  130. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.js +89 -0
  131. package/dist/domain.operations/runLambdaEndpoint/dialect/asLambdaEndpointOutput.js.map +1 -0
  132. package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.d.ts +73 -0
  133. package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.js +108 -0
  134. package/dist/domain.operations/runLambdaEndpoint/dialect/isLambdaEndpointErrorEnvelope.js.map +1 -0
  135. package/dist/domain.operations/runLambdaEndpoint/error/isErrorLike.d.ts +50 -0
  136. package/dist/domain.operations/runLambdaEndpoint/error/isErrorLike.js +55 -0
  137. package/dist/domain.operations/runLambdaEndpoint/error/isErrorLike.js.map +1 -0
  138. package/dist/domain.operations/runLambdaEndpoint/guard/assertEventIsGiven.d.ts +56 -0
  139. package/dist/domain.operations/runLambdaEndpoint/guard/assertEventIsGiven.js +57 -0
  140. package/dist/domain.operations/runLambdaEndpoint/guard/assertEventIsGiven.js.map +1 -0
  141. package/dist/domain.operations/runLambdaEndpoint/guard/assertHandlerIsRunnable.d.ts +16 -0
  142. package/dist/domain.operations/runLambdaEndpoint/guard/assertHandlerIsRunnable.js +71 -0
  143. package/dist/domain.operations/runLambdaEndpoint/guard/assertHandlerIsRunnable.js.map +1 -0
  144. package/dist/domain.operations/runLambdaEndpoint/local/asLocalRunIdentity.d.ts +48 -0
  145. package/dist/domain.operations/runLambdaEndpoint/local/asLocalRunIdentity.js +57 -0
  146. package/dist/domain.operations/runLambdaEndpoint/local/asLocalRunIdentity.js.map +1 -0
  147. package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.d.ts +18 -0
  148. package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.js +239 -0
  149. package/dist/domain.operations/runLambdaEndpoint/local/getOneHandlerFromServerlessYml.js.map +1 -0
  150. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.d.ts +82 -0
  151. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.js +67 -0
  152. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.js.map +1 -0
  153. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.d.ts +120 -0
  154. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js +119 -0
  155. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onReferenced.js.map +1 -0
  156. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.d.ts +98 -0
  157. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js +176 -0
  158. package/dist/domain.operations/runLambdaEndpoint/runLambdaEndpoint.onSerialized.js.map +1 -0
  159. package/dist/domain.operations/runLambdaEndpoint/serde/asFramedPayload.d.ts +41 -0
  160. package/dist/domain.operations/runLambdaEndpoint/serde/asFramedPayload.js +62 -0
  161. package/dist/domain.operations/runLambdaEndpoint/serde/asFramedPayload.js.map +1 -0
  162. package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.d.ts +40 -0
  163. package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.js +68 -0
  164. package/dist/domain.operations/runLambdaEndpoint/serde/asWireFunctionErrorPayload.js.map +1 -0
  165. package/dist/domain.operations/runLambdaEndpoint/serde/asWirePayload.d.ts +34 -0
  166. package/dist/domain.operations/runLambdaEndpoint/serde/asWirePayload.js +39 -0
  167. package/dist/domain.operations/runLambdaEndpoint/serde/asWirePayload.js.map +1 -0
  168. package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.d.ts +25 -0
  169. package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.js +85 -0
  170. package/dist/domain.operations/runLambdaEndpoint/serde/asWireStripped.js.map +1 -0
  171. package/dist/index.d.ts +34 -0
  172. package/dist/index.js +50 -1
  173. package/dist/index.js.map +1 -1
  174. package/package.json +4 -3
  175. package/readme.md +188 -48
  176. package/dist/domain.operations/askLambdaEndpoint/context/getExidFromContext.js.map +0 -1
  177. package/dist/domain.operations/askLambdaEndpoint/context/getLogForExidExtraction.js.map +0 -1
  178. package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.d.ts +0 -42
  179. package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.js +0 -21
  180. package/dist/domain.operations/askLambdaEndpoint/error/getIsLambdaErrorResponse.js.map +0 -1
  181. package/dist/domain.operations/askLambdaEndpoint/error/getLambdaErrorMetadata.js.map +0 -1
  182. package/dist/domain.operations/askLambdaEndpoint/error/getStackTraceString.js.map +0 -1
  183. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.d.ts +0 -13
  184. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js +0 -26
  185. package/dist/domain.operations/askLambdaEndpoint/serde/asUnprefixedErrorMessage.js.map +0 -1
  186. package/dist/domain.operations/askLambdaEndpoint/serde/getDecodedPayload.js.map +0 -1
  187. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedJson.js.map +0 -1
  188. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.d.ts +0 -15
  189. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js +0 -100
  190. package/dist/domain.operations/askLambdaEndpoint/serde/getParsedResponse.js.map +0 -1
  191. package/dist/domain.operations/genLambdaEndpoint/middleware/getIsWrappedPayload.js.map +0 -1
  192. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getExidFromContext.d.ts +0 -0
  193. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getExidFromContext.js +0 -0
  194. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getLogForExidExtraction.d.ts +0 -0
  195. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/context/getLogForExidExtraction.js +0 -0
  196. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getLambdaErrorMetadata.d.ts +0 -0
  197. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getLambdaErrorMetadata.js +0 -0
  198. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getStackTraceString.d.ts +0 -0
  199. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/error/getStackTraceString.js +0 -0
  200. /package/dist/domain.operations/{genLambdaEndpoint/middleware → lambdaEndpointWire/frame}/getIsWrappedPayload.js +0 -0
  201. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getDecodedPayload.d.ts +0 -0
  202. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getDecodedPayload.js +0 -0
  203. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getParsedJson.d.ts +0 -0
  204. /package/dist/domain.operations/{askLambdaEndpoint → lambdaEndpointWire}/serde/getParsedJson.js +0 -0
@@ -50,6 +50,24 @@ const isConstraintError = (error) => error instanceof helpful_errors_1.Constrain
50
50
  /**
51
51
  * .what = map a thrown error to its semantic exit code
52
52
  * .why = constraint errors (caller must fix) exit 2; malfunctions exit 1
53
+ *
54
+ * ## 🔴 why an UNCLASSIFIED error exits 1, and must never exit 2
55
+ *
56
+ * exit 2 is a claim about WHOSE fault it is — `rule.require.exit-code-semantics`
57
+ * fixes it as *the caller must repair their own input*. so a default of 2 would
58
+ * send a developer to hunt through their own arguments for a fault this cli
59
+ * could not classify at all.
60
+ *
61
+ * ⇒ when the blame is unproven, 1 is the honest answer: it reports a
62
+ * server-side malfunction, which is what an unrecognized throw IS from this
63
+ * cli's vantage. the asymmetry is the point — a malfunction mislabelled a
64
+ * constraint sends the caller on that hunt AND suppresses the retry a
65
+ * transient fault deserves, where the reverse merely over-reports.
66
+ *
67
+ * .note = the two `1` arms are deliberately NOT collapsed. the
68
+ * `MalfunctionError` arm states an intent (this IS a malfunction); the final
69
+ * arm states a default (the class was unrecognized). to merge them would
70
+ * erase which of the two a given exit came from.
53
71
  */
54
72
  const getExitForError = (input) => {
55
73
  if (isConstraintError(input.error))
@@ -1 +1 @@
1
- {"version":3,"file":"gen.js","sourceRoot":"","sources":["../../../src/contract/cli/gen.ts"],"names":[],"mappings":";;;;AAEA,mDAAmE;AACnE,uCAAoE;AAGpE,uFAAoF;AACpF,2CAAwC;AAExC;;;;;;;;;;GAUG;AACI,MAAM,GAAG,GAAG,KAAK,EACtB,KAEC,EACD,OAGC,EACkD,EAAE;IACrD,MAAM,GAAG,GACP,OAAO,EAAE,GAAG,IAAI,IAAA,6BAAkB,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC;IAErE,IAAI,CAAC;QACH,kEAAkE;QAClE,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAE7C,sEAAsE;QACtE,MAAM,IAAA,6BAAa,EACjB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EACrD,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CACzD,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,2EAA2E;QAC3E,2EAA2E;QAC3E,sCAAsC;QACtC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAhCW,QAAA,GAAG,OAgCd;AAEF;;;;;;;;GAQG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAW,EAAE,CACpD,KAAK,YAAY,gCAAe,CAAC;AAEnC;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,KAAyB,EAAU,EAAE;IAC5D,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC,KAAK,YAAY,iCAAgB;QAAE,OAAO,CAAC,CAAC;IACtD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,yDAAyD;AACzD,0BAA0B;AAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAA,WAAG,EAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACjC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1B,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"gen.js","sourceRoot":"","sources":["../../../src/contract/cli/gen.ts"],"names":[],"mappings":";;;;AAEA,mDAAmE;AACnE,uCAAoE;AAGpE,uFAAoF;AACpF,2CAAwC;AAExC;;;;;;;;;;GAUG;AACI,MAAM,GAAG,GAAG,KAAK,EACtB,KAEC,EACD,OAGC,EACkD,EAAE;IACrD,MAAM,GAAG,GACP,OAAO,EAAE,GAAG,IAAI,IAAA,6BAAkB,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC;IAErE,IAAI,CAAC;QACH,kEAAkE;QAClE,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAE7C,sEAAsE;QACtE,MAAM,IAAA,6BAAa,EACjB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EACrD,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CACzD,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,2EAA2E;QAC3E,2EAA2E;QAC3E,sCAAsC;QACtC,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,GAAG,CAAC,KAAK,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAhCW,QAAA,GAAG,OAgCd;AAEF;;;;;;;;GAQG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAW,EAAE,CACpD,KAAK,YAAY,gCAAe,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,eAAe,GAAG,CAAC,KAAyB,EAAU,EAAE;IAC5D,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,KAAK,CAAC,KAAK,YAAY,iCAAgB;QAAE,OAAO,CAAC,CAAC;IACtD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,yDAAyD;AACzD,0BAA0B;AAC1B,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAA,WAAG,EAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACjC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1B,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE;QACV,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * .what = the synthetic aws coordinates a no-cloud run stamps into arns
3
+ * .why = a run that addresses no real account still has to emit well-formed
4
+ * arns — an event envelope carries them, and so does a lambda context.
5
+ * both need a region and an account, and neither may invent its own.
6
+ *
7
+ * 🔴 this file is the WHOLE-convention owner — the event factories, the local
8
+ * run identity, and the lambda context all read it. a duplicate of these two
9
+ * values is INERT until the edit that splits it, and no gate can catch the
10
+ * split: every copy is a valid arn on its own.
11
+ *
12
+ * ⚠️ the `_SYNTHETIC` suffix carries weight. this repo also reads a REAL region
13
+ * from `process.env.AWS_REGION` (`genLambdaSdk`), so a bare `AWS_REGION`
14
+ * names two things one import apart (`rule.forbid.ambiguous-labels`).
15
+ *
16
+ * .note = the account is `000000000000` deliberately — a fabricated-but-plausible
17
+ * id would invite a handler to parse it; twelve zeros read as synthetic.
18
+ */
19
+ export declare const AWS_REGION_SYNTHETIC = "us-east-1";
20
+ export declare const AWS_ACCOUNT_SYNTHETIC = "000000000000";
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AWS_ACCOUNT_SYNTHETIC = exports.AWS_REGION_SYNTHETIC = void 0;
4
+ /**
5
+ * .what = the synthetic aws coordinates a no-cloud run stamps into arns
6
+ * .why = a run that addresses no real account still has to emit well-formed
7
+ * arns — an event envelope carries them, and so does a lambda context.
8
+ * both need a region and an account, and neither may invent its own.
9
+ *
10
+ * 🔴 this file is the WHOLE-convention owner — the event factories, the local
11
+ * run identity, and the lambda context all read it. a duplicate of these two
12
+ * values is INERT until the edit that splits it, and no gate can catch the
13
+ * split: every copy is a valid arn on its own.
14
+ *
15
+ * ⚠️ the `_SYNTHETIC` suffix carries weight. this repo also reads a REAL region
16
+ * from `process.env.AWS_REGION` (`genLambdaSdk`), so a bare `AWS_REGION`
17
+ * names two things one import apart (`rule.forbid.ambiguous-labels`).
18
+ *
19
+ * .note = the account is `000000000000` deliberately — a fabricated-but-plausible
20
+ * id would invite a handler to parse it; twelve zeros read as synthetic.
21
+ */
22
+ exports.AWS_REGION_SYNTHETIC = 'us-east-1';
23
+ exports.AWS_ACCOUNT_SYNTHETIC = '000000000000';
24
+ //# sourceMappingURL=AwsIdentitySynthetic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AwsIdentitySynthetic.js","sourceRoot":"","sources":["../../src/domain.objects/AwsIdentitySynthetic.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,oBAAoB,GAAG,WAAW,CAAC;AACnC,QAAA,qBAAqB,GAAG,cAAc,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * .what = which error dialect an endpoint answers a caller fault in
3
+ * .why = an endpoint shapes its constraint envelope by what the CALLER sent:
4
+ * a `{ event, trail }` wrapper marks a contemp caller; a flat payload
5
+ * marks an ancient one (invariant.ancient-vs-contemp-callers)
6
+ *
7
+ * | dialect | the payload sent | the envelope returned |
8
+ * |---------|------------------|-----------------------|
9
+ * | contemp | `{ event, trail }` | `{ error: { _serde, class, message } }` |
10
+ * | ancient | the event, flat | `{ errorMessage, errorType }` |
11
+ *
12
+ * .note = contemp is the DEFAULT, per rule.require.contemp-contracts-default.
13
+ * ancient is opt-in, for an endpoint that still serves a legacy caller.
14
+ *
15
+ * .note = it lives here because two peer operations name it —
16
+ * `askLambdaEndpoint` and `runLambdaEndpoint`
17
+ * (rule.prefer.most-common-denominator).
18
+ */
19
+ export type LambdaEndpointDialect = 'contemp' | 'ancient';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=LambdaEndpointDialect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaEndpointDialect.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpointDialect.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * .what = the two error-envelope shapes a lambda endpoint answers with, one per
3
+ * caller dialect
4
+ * .why = a domain shape two operations share: `genLambdaEndpoint` WRITES it (the
5
+ * constraint middleware returns it) and `runLambdaEndpoint` TYPES it (the dialect
6
+ * generic puts it in the public return). their common ancestor is
7
+ * `domain.objects/` (rule.prefer.most-common-denominator).
8
+ *
9
+ * @see invariant.ancient-vs-contemp-callers — why two shapes rather than one
10
+ */
11
+ /**
12
+ * the ancient envelope — flat, for a caller that predates the trail wrapper
13
+ *
14
+ * ⚠️ an ancient caller reads `errorType` and branches on the string, so these field
15
+ * names are a contract with code we do not own.
16
+ */
17
+ export interface LambdaEndpointErrorResponseBodyAncient {
18
+ errorMessage: string;
19
+ errorType: string;
20
+ /**
21
+ * .note = the legacy wire name, NOT a synonym we coined. the producer this sdk
22
+ * replaces emits it verbatim — `ehmpathy/simple-lambda-handlers`,
23
+ * `badRequestErrorMiddleware.ts:88,99`. contemp's peer field is `cause`, and
24
+ * that one IS ours to choose.
25
+ */
26
+ causeMessage?: string;
27
+ details?: unknown;
28
+ }
29
+ /**
30
+ * .what = the stable PREFIX of the contemp serde tag — the whole discriminator
31
+ * .why = 🔴 one WRITER for three operations to compare against. a producer and a
32
+ * detector that disagree do not fail loudly — the detector simply stops to
33
+ * recognize the envelope, and a caller fault reads as a success payload.
34
+ */
35
+ export declare const LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP_PREFIX: "LambdaEndpointError::contemp";
36
+ /**
37
+ * the codec version of the contemp envelope's on-wire shape.
38
+ * bump ONLY when the shape below changes in a way a decoder must branch on.
39
+ *
40
+ * 🟡 the `v` earns its character: `@v1` cannot be misread as a count, an index, or
41
+ * a package version, where a bare `@1` can.
42
+ *
43
+ * .note = the CODEC's version, not the service's. it is hand-maintained here
44
+ * rather than read from `package.json` (which `rootDir: 'src'` also forbids).
45
+ */
46
+ export declare const LAMBDA_ENDPOINT_ERROR_CODEC_VERSION_CONTEMP: "v1";
47
+ /**
48
+ * the full contemp serde tag — prefix + codec version.
49
+ *
50
+ * 🔴 producers stamp THIS; detectors match the PREFIX and read the version as
51
+ * opaque data. a tag compared by EQUALITY is a wire break on every release — a
52
+ * service on `v1` would stop to recognize a `v2` envelope, and per the prefix
53
+ * docblock that failure is silent.
54
+ */
55
+ export declare const LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP: "LambdaEndpointError::contemp@v1";
56
+ /**
57
+ * the contemp envelope — nested under `error`, with an explicit versioned serde tag
58
+ *
59
+ * `_serde` is typed as a `${prefix}@${string}` template, NOT the exact current tag:
60
+ * a decoder must accept any codec version, while a producer writes the current one.
61
+ */
62
+ export interface LambdaEndpointErrorResponseBodyContemp {
63
+ error: {
64
+ _serde: `${typeof LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP_PREFIX}@${string}`;
65
+ class: string;
66
+ message: string;
67
+ cause?: string;
68
+ details?: unknown;
69
+ };
70
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * .what = the two error-envelope shapes a lambda endpoint answers with, one per
4
+ * caller dialect
5
+ * .why = a domain shape two operations share: `genLambdaEndpoint` WRITES it (the
6
+ * constraint middleware returns it) and `runLambdaEndpoint` TYPES it (the dialect
7
+ * generic puts it in the public return). their common ancestor is
8
+ * `domain.objects/` (rule.prefer.most-common-denominator).
9
+ *
10
+ * @see invariant.ancient-vs-contemp-callers — why two shapes rather than one
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP = exports.LAMBDA_ENDPOINT_ERROR_CODEC_VERSION_CONTEMP = exports.LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP_PREFIX = void 0;
14
+ /**
15
+ * .what = the stable PREFIX of the contemp serde tag — the whole discriminator
16
+ * .why = 🔴 one WRITER for three operations to compare against. a producer and a
17
+ * detector that disagree do not fail loudly — the detector simply stops to
18
+ * recognize the envelope, and a caller fault reads as a success payload.
19
+ */
20
+ exports.LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP_PREFIX = 'LambdaEndpointError::contemp';
21
+ /**
22
+ * the codec version of the contemp envelope's on-wire shape.
23
+ * bump ONLY when the shape below changes in a way a decoder must branch on.
24
+ *
25
+ * 🟡 the `v` earns its character: `@v1` cannot be misread as a count, an index, or
26
+ * a package version, where a bare `@1` can.
27
+ *
28
+ * .note = the CODEC's version, not the service's. it is hand-maintained here
29
+ * rather than read from `package.json` (which `rootDir: 'src'` also forbids).
30
+ */
31
+ exports.LAMBDA_ENDPOINT_ERROR_CODEC_VERSION_CONTEMP = 'v1';
32
+ /**
33
+ * the full contemp serde tag — prefix + codec version.
34
+ *
35
+ * 🔴 producers stamp THIS; detectors match the PREFIX and read the version as
36
+ * opaque data. a tag compared by EQUALITY is a wire break on every release — a
37
+ * service on `v1` would stop to recognize a `v2` envelope, and per the prefix
38
+ * docblock that failure is silent.
39
+ */
40
+ exports.LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP = `${exports.LAMBDA_ENDPOINT_ERROR_SERDE_CONTEMP_PREFIX}@${exports.LAMBDA_ENDPOINT_ERROR_CODEC_VERSION_CONTEMP}`;
41
+ //# sourceMappingURL=LambdaEndpointErrorResponseBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LambdaEndpointErrorResponseBody.js","sourceRoot":"","sources":["../../src/domain.objects/LambdaEndpointErrorResponseBody.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAqBH;;;;;GAKG;AACU,QAAA,0CAA0C,GACrD,8BAAuC,CAAC;AAE1C;;;;;;;;;GASG;AACU,QAAA,2CAA2C,GAAG,IAAa,CAAC;AAEzE;;;;;;;GAOG;AACU,QAAA,mCAAmC,GAC9C,GAAG,kDAA0C,IAAI,mDAA2C,EAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * .what = mints the synthetic per-record uuid the sqs/sns fixtures stamp
3
+ * .why = `beefbeef` marks it synthetic; the rest is real v4 entropy, so two
4
+ * fixtures in one store cannot collide. valid v4 shape, so a uuid regex passes.
5
+ * .note = NOT deterministic. to assert on an id, override `record`.
6
+ */
7
+ export declare const asExampleUuid: () => string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asExampleUuid = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ /**
6
+ * .what = mints the synthetic per-record uuid the sqs/sns fixtures stamp
7
+ * .why = `beefbeef` marks it synthetic; the rest is real v4 entropy, so two
8
+ * fixtures in one store cannot collide. valid v4 shape, so a uuid regex passes.
9
+ * .note = NOT deterministic. to assert on an id, override `record`.
10
+ */
11
+ const asExampleUuid = () => `beefbeef${(0, node_crypto_1.randomUUID)().slice(8)}`;
12
+ exports.asExampleUuid = asExampleUuid;
13
+ //# sourceMappingURL=asLambdaEvent.asExampleUuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asLambdaEvent.asExampleUuid.js","sourceRoot":"","sources":["../../../src/domain.operations/asLambdaEvent/asLambdaEvent.asExampleUuid.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC;;;;;GAKG;AACI,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,WAAW,IAAA,wBAAU,GAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAAjE,QAAA,aAAa,iBAAoD"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 🔴 the aws region and account live at `domain.objects/AwsIdentitySynthetic`,
3
+ * and are NOT re-exported from here — a forwarder would be a second address
4
+ * for one value (`rule.forbid.barrel-exports`). import them directly.
5
+ */
6
+ /**
7
+ * .what = the instant every event factory stamps into its envelope
8
+ * .why = a source envelope carries a timestamp, and a fixture must be
9
+ * deterministic — so the instant is frozen rather than read from a clock.
10
+ * `2025-09-08T00:00:00Z`.
11
+ *
12
+ * 🔴 **the UNIT is in the name because aws does not agree with itself.** sqs and
13
+ * api gateway stamp epoch MILLIS; kinesis stamps epoch SECONDS. the two
14
+ * literals differ by a factor of 1000, so side by side they read as a typo:
15
+ *
16
+ * requestTimeEpoch: 1757289600000 ← api gateway, millis
17
+ * approximateArrivalTimestamp: 1757289600 ← kinesis, SECONDS
18
+ *
19
+ * ⇒ the seconds value is DERIVED from the millis one rather than declared, so
20
+ * the two cannot drift and the relation is on the page
21
+ * (`rule.forbid.magic-values`).
22
+ *
23
+ * ⚠️ it is a placeholder, never a real instant. a test that asserts on it asserts
24
+ * on a fixture default — override `record` instead.
25
+ *
26
+ * 🔴 the ISO form is DERIVED for the same reason, and it is the representation a
27
+ * numeric-literal grep cannot reach — so it is the one most apt to keep a
28
+ * hand-written copy and drift a year, with no gate able to object (both
29
+ * strings are valid stamps of their own type).
30
+ *
31
+ * ⇒ all three flow from one literal. a factory that needs a fourth DERIVES it.
32
+ */
33
+ export declare const AWS_EVENT_AT_EPOCH_MS = 1757289600000;
34
+ export declare const AWS_EVENT_AT_EPOCH_S: number;
35
+ export declare const AWS_EVENT_AT_ISO: string;
36
+ export declare const AWS_EVENT_AT_CLF: string;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * 🔴 the aws region and account live at `domain.objects/AwsIdentitySynthetic`,
4
+ * and are NOT re-exported from here — a forwarder would be a second address
5
+ * for one value (`rule.forbid.barrel-exports`). import them directly.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AWS_EVENT_AT_CLF = exports.AWS_EVENT_AT_ISO = exports.AWS_EVENT_AT_EPOCH_S = exports.AWS_EVENT_AT_EPOCH_MS = void 0;
9
+ /**
10
+ * .what = the instant every event factory stamps into its envelope
11
+ * .why = a source envelope carries a timestamp, and a fixture must be
12
+ * deterministic — so the instant is frozen rather than read from a clock.
13
+ * `2025-09-08T00:00:00Z`.
14
+ *
15
+ * 🔴 **the UNIT is in the name because aws does not agree with itself.** sqs and
16
+ * api gateway stamp epoch MILLIS; kinesis stamps epoch SECONDS. the two
17
+ * literals differ by a factor of 1000, so side by side they read as a typo:
18
+ *
19
+ * requestTimeEpoch: 1757289600000 ← api gateway, millis
20
+ * approximateArrivalTimestamp: 1757289600 ← kinesis, SECONDS
21
+ *
22
+ * ⇒ the seconds value is DERIVED from the millis one rather than declared, so
23
+ * the two cannot drift and the relation is on the page
24
+ * (`rule.forbid.magic-values`).
25
+ *
26
+ * ⚠️ it is a placeholder, never a real instant. a test that asserts on it asserts
27
+ * on a fixture default — override `record` instead.
28
+ *
29
+ * 🔴 the ISO form is DERIVED for the same reason, and it is the representation a
30
+ * numeric-literal grep cannot reach — so it is the one most apt to keep a
31
+ * hand-written copy and drift a year, with no gate able to object (both
32
+ * strings are valid stamps of their own type).
33
+ *
34
+ * ⇒ all three flow from one literal. a factory that needs a fourth DERIVES it.
35
+ */
36
+ exports.AWS_EVENT_AT_EPOCH_MS = 1757289600000;
37
+ exports.AWS_EVENT_AT_EPOCH_S = exports.AWS_EVENT_AT_EPOCH_MS / 1000;
38
+ exports.AWS_EVENT_AT_ISO = new Date(exports.AWS_EVENT_AT_EPOCH_MS).toISOString();
39
+ /**
40
+ * .what = casts an epoch into the CLF stamp api gateway sends as `requestTime`
41
+ * .why = api gateway sends BOTH stamps on every request — `requestTimeEpoch` (a
42
+ * number) and `requestTime` (common log format, `08/Sep/2025:00:00:00 +0000`).
43
+ * a handler that reads the human one saw `undefined` in a test and a value
44
+ * in production, which is the wire-infidelity class this whole family exists
45
+ * to remove, reproduced on a peer field.
46
+ *
47
+ * .how = derived from the ONE literal above. a hand-written CLF string that
48
+ * drifted from the epoch would name two instants in one envelope, and no gate
49
+ * could catch it — both are valid stamps of their own kind.
50
+ *
51
+ * .note = the offset is `+0000` unconditionally, because aws stamps utc and the
52
+ * epoch above is utc. a local-time derivation would drift by the builder's
53
+ * timezone and make the fixture non-deterministic across machines.
54
+ */
55
+ const asClfStamp = (epochMs) => {
56
+ const at = new Date(epochMs);
57
+ const months = [
58
+ 'Jan',
59
+ 'Feb',
60
+ 'Mar',
61
+ 'Apr',
62
+ 'May',
63
+ 'Jun',
64
+ 'Jul',
65
+ 'Aug',
66
+ 'Sep',
67
+ 'Oct',
68
+ 'Nov',
69
+ 'Dec',
70
+ ];
71
+ const pad = (value) => String(value).padStart(2, '0');
72
+ return [
73
+ pad(at.getUTCDate()),
74
+ '/',
75
+ months[at.getUTCMonth()],
76
+ '/',
77
+ at.getUTCFullYear(),
78
+ ':',
79
+ pad(at.getUTCHours()),
80
+ ':',
81
+ pad(at.getUTCMinutes()),
82
+ ':',
83
+ pad(at.getUTCSeconds()),
84
+ ' +0000',
85
+ ].join('');
86
+ };
87
+ exports.AWS_EVENT_AT_CLF = asClfStamp(exports.AWS_EVENT_AT_EPOCH_MS);
88
+ //# sourceMappingURL=asLambdaEvent.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asLambdaEvent.constants.js","sourceRoot":"","sources":["../../../src/domain.operations/asLambdaEvent/asLambdaEvent.constants.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,qBAAqB,GAAG,aAAiB,CAAC;AAC1C,QAAA,oBAAoB,GAAG,6BAAqB,GAAG,IAAI,CAAC;AACpD,QAAA,gBAAgB,GAAG,IAAI,IAAI,CAAC,6BAAqB,CAAC,CAAC,WAAW,EAAE,CAAC;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,GAAG,CAAC,OAAe,EAAU,EAAE;IAC7C,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG;QACb,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;KACN,CAAC;IACF,MAAM,GAAG,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEtE,OAAO;QACL,GAAG,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;QACpB,GAAG;QACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QACxB,GAAG;QACH,EAAE,CAAC,cAAc,EAAE;QACnB,GAAG;QACH,GAAG,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QACrB,GAAG;QACH,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACvB,GAAG;QACH,GAAG,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACvB,QAAQ;KACT,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC,CAAC;AAEW,QAAA,gBAAgB,GAAG,UAAU,CAAC,6BAAqB,CAAC,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * .what = casts a payload into the envelope its event source delivers
3
+ * .why = a lambda endpoint is woken by an EVENT SOURCE, and each source wraps the
4
+ * payload in its own envelope before the handler sees it. to run an
5
+ * endpoint against a source, a test must construct that envelope — and the
6
+ * envelope is aws-shaped, wide, and mostly irrelevant to the handler under
7
+ * test (define.lambda-event-source).
8
+ *
9
+ * | source | the envelope | the payload lives at |
10
+ * |--------|--------------|----------------------|
11
+ * | **ask** | none — the event IS the payload | the event itself |
12
+ * | **apiGateway** | `{ body, headers, httpMethod, requestContext, … }` | `body`, as a json string |
13
+ * | **sqs** | `{ Records: [{ body, … }] }` | `Records[].body`, as a json string |
14
+ * | **sns** | `{ Records: [{ Sns: { Message, … } }] }` | `Records[].Sns.Message` |
15
+ * | **kinesis** | `{ Records: [{ kinesis: { data, … } }] }` | `Records[].kinesis.data`, base64 |
16
+ * | **s3** | `{ Records: [{ s3: { bucket, object, … } }] }` | the object ref — there is no payload |
17
+ *
18
+ * ## the name
19
+ *
20
+ * **`as`, because it is a cast, never a construction.** the operation takes a
21
+ * payload and casts it into an envelope shape — no identity, no persistence, no
22
+ * findsert — so the transformer prefix applies (`rule.require.get-set-gen-verbs`).
23
+ *
24
+ * **`from`, because it names provenance.** the lambda event, as it arrives *from*
25
+ * sqs. ⚠️ `for` would invert the arrow: the event does not go to sqs, it comes
26
+ * from it.
27
+ *
28
+ * ⚠️ **`$Slug` is taken.** in `define.lambda-endpoint-ubiqlang`, `slug` is the
29
+ * endpoint's serialized key (`svc-invoice-prep-getInvoice`), so `from$Slug`
30
+ * would read as *"from the endpoint slug"* and invert the sense
31
+ * (`rule.forbid.term.addition.ambiguous`).
32
+ *
33
+ * ⚠️ **there is no `fromAsk`, deliberately.** the ask source wraps naught — the
34
+ * event IS the payload — so a factory for it would be an identity function.
35
+ * a member that constructs no envelope, on an object whose whole purpose is to
36
+ * construct envelopes, would imply one exists. pass the event directly.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const event = asLambdaEvent.fromSqs({ messages: [JSON.stringify(task)] });
41
+ * const event = asLambdaEvent.fromApiGateway({ body, httpMethod: 'POST' });
42
+ * ```
43
+ */
44
+ export declare const asLambdaEvent: {
45
+ fromApiGateway: (input: {
46
+ body?: unknown;
47
+ httpMethod?: string | undefined;
48
+ path?: string | undefined;
49
+ headers?: Record<string, string> | undefined;
50
+ queryStringParameters?: Record<string, string> | null | undefined;
51
+ pathParameters?: Record<string, string> | null | undefined;
52
+ isBase64Encoded?: boolean | undefined;
53
+ requestContext?: (Partial<Omit<import("aws-lambda").APIGatewayEventRequestContext, "identity">> & {
54
+ identity?: Partial<import("aws-lambda").APIGatewayEventIdentity> | undefined;
55
+ }) | undefined;
56
+ }) => import("aws-lambda").APIGatewayProxyEvent;
57
+ fromKinesis: (input: {
58
+ records: string[];
59
+ record?: Partial<import("aws-lambda").KinesisStreamRecord> | undefined;
60
+ stream?: string | undefined;
61
+ }) => import("aws-lambda").KinesisStreamEvent;
62
+ fromS3: (input: {
63
+ objects: {
64
+ bucket: string;
65
+ key: string;
66
+ size?: number | undefined;
67
+ }[];
68
+ eventName?: string | undefined;
69
+ record?: Partial<import("aws-lambda").S3EventRecord> | undefined;
70
+ }) => import("aws-lambda").S3Event;
71
+ fromSns: (input: {
72
+ messages: string[];
73
+ record?: Partial<import("aws-lambda").SNSEventRecord> | undefined;
74
+ topic?: string | undefined;
75
+ }) => import("aws-lambda").SNSEvent;
76
+ fromSqs: (input: {
77
+ messages: string[];
78
+ record?: Partial<import("aws-lambda").SQSRecord> | undefined;
79
+ queue?: string | undefined;
80
+ }) => import("aws-lambda").SQSEvent;
81
+ };
@@ -0,0 +1,75 @@
1
+ import type { APIGatewayEventIdentity, APIGatewayEventRequestContext, APIGatewayProxyEvent } from 'aws-lambda';
2
+ /**
3
+ * .what = casts a body into the api-gateway envelope aws delivers
4
+ * .why = an api-gateway handler receives `{ body, headers, httpMethod, path,
5
+ * requestContext, ... }`, and the payload lives at `body` as a JSON STRING
6
+ *
7
+ * 🔴 .the fixture must not manufacture the defect it is meant to expose
8
+ *
9
+ * the incumbent omits two fields aws always sends, and each breaks the handler:
10
+ *
11
+ * | omitted | the result |
12
+ * |---|---|
13
+ * | `requestContext` | `forApiGateway` derefs `requestContext.requestId` ⇒ `TypeError` ⇒ handler answers 500 ⇒ every assertion past the status check is unreachable |
14
+ * | `Accept` header | middy matches no response serializer ⇒ `body` comes back an OBJECT where api gateway needs a string ⇒ every `JSON.parse(result.body)` fails |
15
+ *
16
+ * ⚠️ three consumers have already forked a local repair (`ahbode/svc-gateway`,
17
+ * `svc-funnel-comms`, `svc-quotes`), and the svc-gateway fork names the
18
+ * upstream half: `ehmpathy/sdk-aws-lambda#18`. a fixture three consumers fork
19
+ * is a fixture whose CONTRACT is wrong, so this fixes it.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const event = asLambdaEvent.fromApiGateway({ body: { slug }, httpMethod: 'POST' });
24
+ *
25
+ * // a test whose SUBJECT is the metadata sets it — the override wins
26
+ * const event = asLambdaEvent.fromApiGateway({
27
+ * body,
28
+ * requestContext: { identity: { sourceIp: '10.0.0.1' } },
29
+ * });
30
+ * ```
31
+ */
32
+ export declare const fromApiGateway: (input: {
33
+ /**
34
+ * the request body. an object is json-stringified, as a caller's request would send it.
35
+ */
36
+ body?: unknown;
37
+ /**
38
+ * the http method. GET by default.
39
+ */
40
+ httpMethod?: string;
41
+ /**
42
+ * the request path
43
+ */
44
+ path?: string;
45
+ /**
46
+ * headers to merge over the wire-faithful defaults
47
+ */
48
+ headers?: Record<string, string>;
49
+ /**
50
+ * query string parameters
51
+ */
52
+ queryStringParameters?: Record<string, string> | null;
53
+ /**
54
+ * path parameters
55
+ */
56
+ pathParameters?: Record<string, string> | null;
57
+ /**
58
+ * whether aws judged the body a base64-encoded binary. false by default.
59
+ *
60
+ * aws decides this from the request headers, so a test whose SUBJECT is a
61
+ * binary body must be able to say so (ref: aws binary-media-types).
62
+ */
63
+ isBase64Encoded?: boolean;
64
+ /**
65
+ * requestContext fields to merge over the defaults
66
+ *
67
+ * 🔴 `identity` is partial TOO. a plain `Partial<…RequestContext>` leaves it
68
+ * whole, so `{ identity: { sourceIp } }` would demand all ~15 fields — and
69
+ * the merge below already supports that override. narrow it and the type
70
+ * forbids what the implementation supports.
71
+ */
72
+ requestContext?: Partial<Omit<APIGatewayEventRequestContext, 'identity'>> & {
73
+ identity?: Partial<APIGatewayEventIdentity>;
74
+ };
75
+ }) => APIGatewayProxyEvent;