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
@@ -4,22 +4,78 @@ exports.getValidationError = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
5
  const getZodIssuesSummary_1 = require("./getZodIssuesSummary");
6
6
  /**
7
- * .what = format issues summary for error message
8
- * .why = extract message format from orchestrator
7
+ * .what = the FIX half of the message a caller meets when their input is refused
8
+ * .why = `rule.require.errors-name-the-fix` asks an error for three parts — what, why, and the
9
+ * concrete next move. the zod summary supplies the first two (`(root): expected object,
10
+ * received string` names the path and the mismatch) and says NOT ONE WORD about what to
11
+ * do, so the caller is left to infer it
12
+ *
13
+ * ⚠️ .why it names no MECHANISM = two mechanisms were considered and each is false somewhere:
14
+ * - *"introspect the schema with `{ introspect: 'schema' }`"* — `genIntrospectionMiddleware`
15
+ * gates on `env.access === 'prep'` (`genIntrospectionMiddleware.ts:63`), so the hint would
16
+ * be a dead end in prod
17
+ * - *"check the `deserialize` option"* — refuted in a prior round: it is meaningless at the
18
+ * ask-endpoint border, which shares this builder
19
+ * ⇒ so the hint names the ACT, which is true at both borders and in every env. a hint that is
20
+ * false in one env is worse than none, since a caller spends the trip before they learn it
9
21
  */
10
- const getIssuesMessage = (input) => {
11
- return input.issues
12
- .map((issue) => `${issue.path}: ${issue.message}`)
13
- .join('; ');
14
- };
22
+ /**
23
+ * ⚠️ .why DOUBLE quotes, where this repo's formatter prefers single = the possessive. biome
24
+ * picks the delimiter that needs fewer escapes, so a string that carries `'` takes `"`
25
+ *
26
+ * .the history, since the possessive was deferred for three rounds = "the endpoint declared
27
+ * input schema" shipped first, and three reviewers read it as a defect. the answer each
28
+ * round was a deferral: the string is emitted verbatim by four ACCEPTANCE snapshots whose
29
+ * suite cannot run here, so a source edit would leave four snapshots stale with no run to
30
+ * prove they moved right — the CLEAN half of `rule.always.fix-forward-under-scouts-honor`
31
+ *
32
+ * ⇒ the deferral rested on an absence nobody had measured. a grep of the SUBJECT found
33
+ * 22 byte-identical hits across 8 files, and SEVEN of them are UNIT snapshots — among
34
+ * them `genLambdaEndpoint.forApiGateway.test.ts.snap`, which carries the fully-escaped
35
+ * JSON-in-string form the acceptance hits have. so a unit run proves the identical
36
+ * transformation on the identical shape (rule.require.positive-control-before-absence-claims)
37
+ * ⇒ the repair is one `sedreplace` over all 8 files, then a unit run with NO `--resnap`.
38
+ * green means the hand-applied edit equals what the code emits, byte for byte
39
+ */
40
+ const VALIDATION_HINT_GENERIC = "send a value that satisfies the endpoint's declared input schema — correct each path named in `issues`";
41
+ /**
42
+ * .what = the hint a caller meets when EVERY issue already names its own fix
43
+ * .why = the generic hint above makes a CLAIM — *"the value you sent does not satisfy the
44
+ * schema"* — and on the constructor-reject path that claim is FALSE. `X.contract()`
45
+ * coerces, so the schema ACCEPTED the payload and the class constructor refused it
46
+ * afterward. the caller did exactly what the generic hint asks, and has no move at all
47
+ * ⇒ so the two hints fork on OBSERVED DATA — the issue set — never on handed config,
48
+ * which is the fork `rule.forbid.parallel-codepaths` permits
49
+ */
50
+ const VALIDATION_HINT_SELF_NAMED = 'each entry in `issues` names its own fix — apply the one at the path named there. ⚠️ where a message says the schema ACCEPTED the value, the fix belongs to the endpoint author, never to the caller';
51
+ /**
52
+ * .what = the marker that says an issue carries its own fix, so a generic one would displace it
53
+ * .why = ⚠️ `code === 'custom'` was proposed as the discriminator and is MEASURED over-broad. a
54
+ * constructor reject and a plain `.refine()` emit byte-identical issue shapes —
55
+ * `{ code: 'custom', path, message }`, with no field that separates them — and a
56
+ * `.refine()` IS part of the declared schema, so the generic hint is CORRECT there. to
57
+ * suppress on `custom` would strip right guidance from a real caller fault
58
+ * (probe: `.agent/.notes/probe.issue-discriminators.ts`, q1 vs q2)
59
+ *
60
+ * .why a MESSAGE check is acceptable where a dependency's message is normally not a contract =
61
+ * it degrades to today's behavior. `domain-objects` documents this convention outright —
62
+ * *"the message names the fix"* (`node_modules/domain-objects/readme.md:675`) — and our
63
+ * own `rule.require.errors-name-the-fix` mandates the same token. if upstream rewords it,
64
+ * the generic hint is appended exactly as it is today, so no new failure mode opens
65
+ */
66
+ const FIX_NAMED_MARKER = 'fix:';
15
67
  /**
16
68
  * .what = transforms zod validation error into ConstraintError
17
69
  * .why = callers need friendly error messages for invalid input
18
70
  */
19
71
  const getValidationError = (input) => {
20
72
  const issues = (0, getZodIssuesSummary_1.getZodIssuesSummary)({ issues: input.error.issues });
21
- const issuesMessage = getIssuesMessage({ issues });
22
- return new helpful_errors_1.ConstraintError(`validation failed: ${issuesMessage}`, { issues });
73
+ const issuesMessage = (0, getZodIssuesSummary_1.asZodIssuesMessage)({ issues });
74
+ // every issue names its own fix -> a generic one would name a DIFFERENT fix beside it
75
+ const hint = issues.every((issue) => issue.message.includes(FIX_NAMED_MARKER))
76
+ ? VALIDATION_HINT_SELF_NAMED
77
+ : VALIDATION_HINT_GENERIC;
78
+ return new helpful_errors_1.ConstraintError(`validation failed: ${issuesMessage}`, { issues, hint });
23
79
  };
24
80
  exports.getValidationError = getValidationError;
25
81
  //# sourceMappingURL=getValidationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+DAG+B;AAM/B;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAoC,EAAU,EAAE;IACxE,OAAO,KAAK,CAAC,MAAM;SAChB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;SACjD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAA4C,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEnD,OAAO,IAAI,gCAAe,CACxB,sBAAsB,aAAa,EAAE,EACrC,EAAE,MAAM,EAAE,CACX,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,kBAAkB,sBAU7B"}
1
+ {"version":3,"file":"getValidationError.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getValidationError.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAGjD,+DAI+B;AAO/B;;;;;;;;;;;;;;;GAeG;AACH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,uBAAuB,GAC3B,wGAAwG,CAAC;AAE3G;;;;;;;;GAQG;AACH,MAAM,0BAA0B,GAC9B,sMAAsM,CAAC;AAEzM;;;;;;;;;;;;;;GAcG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAA4C,EAAE;IAC7C,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,IAAA,wCAAkB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAErD,sFAAsF;IACtF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAC5E,CAAC,CAAC,0BAA0B;QAC5B,CAAC,CAAC,uBAAuB,CAAC;IAE5B,OAAO,IAAI,gCAAe,CACxB,sBAAsB,aAAa,EAAE,EACrC,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B"}
@@ -7,7 +7,27 @@ export interface ZodIssueSummary {
7
7
  /**
8
8
  * .what = transforms zod issues array into friendly summary format
9
9
  * .why = standard zod error format across validation boundaries
10
+ *
11
+ * .note = this is the ONE place a zod path becomes a string, so the root token lands once and
12
+ * reaches every surface: the input border's message (`getValidationError`), and the
13
+ * metadata of BOTH borders (`getValidatedInput` + `getValidatedOutput`). a repair at
14
+ * the render site instead would have left the output border and the metadata unfixed
10
15
  */
11
16
  export declare const getZodIssuesSummary: (input: {
12
17
  issues: ZodIssue[];
13
18
  }) => ZodIssueSummary[];
19
+ /**
20
+ * .what = renders a summary as the one-line `path: message` list an error carries in its title
21
+ * .why = an error's `.message` is the only part a log line, a stack trace, or a caller's
22
+ * `console.error` shows without a decode of the metadata — so the PATHS have to be in it
23
+ * (rule.require.errors-name-the-fix: what went wrong, and where)
24
+ *
25
+ * .note = it lives HERE, beside `getZodIssuesSummary`, rather than at either border. the two
26
+ * borders throw different classes (`ConstraintError` in, `MalfunctionError` out) and
27
+ * name different fixes — but the RENDER of a path list is one guarantee, so it has one
28
+ * home (rule.forbid.parallel-codepaths). a copy at the second border is the copy that
29
+ * would rot, and the root-token note above already names every surface this must reach
30
+ */
31
+ export declare const asZodIssuesMessage: (input: {
32
+ issues: ZodIssueSummary[];
33
+ }) => string;
@@ -1,16 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getZodIssuesSummary = void 0;
3
+ exports.asZodIssuesMessage = exports.getZodIssuesSummary = void 0;
4
+ /**
5
+ * .what = the token a ROOT-level issue occupies the `path` slot with
6
+ * .why = zod reports a root-level fault as an EMPTY path array, and the plain join of one is
7
+ * `''` — which renders as a bare `: ` at the one site that prints a path beside a
8
+ * message, and as `"path": ""` in the metadata `helpful-errors` serializes into that
9
+ * same string. both read as an ABSENT location rather than as the root, and the two
10
+ * shapes a caller most often hits at the body border — a raw string and a null — are
11
+ * BOTH root-level, so this is the common surface rather than an edge of it
12
+ */
13
+ const PATH_ROOT = '(root)';
4
14
  /**
5
15
  * .what = transforms zod issues array into friendly summary format
6
16
  * .why = standard zod error format across validation boundaries
17
+ *
18
+ * .note = this is the ONE place a zod path becomes a string, so the root token lands once and
19
+ * reaches every surface: the input border's message (`getValidationError`), and the
20
+ * metadata of BOTH borders (`getValidatedInput` + `getValidatedOutput`). a repair at
21
+ * the render site instead would have left the output border and the metadata unfixed
7
22
  */
8
23
  const getZodIssuesSummary = (input) => {
9
24
  return input.issues.map((issue) => ({
10
- path: issue.path.join('.'),
25
+ path: issue.path.length ? issue.path.join('.') : PATH_ROOT,
11
26
  message: issue.message,
12
27
  code: issue.code,
13
28
  }));
14
29
  };
15
30
  exports.getZodIssuesSummary = getZodIssuesSummary;
31
+ /**
32
+ * .what = renders a summary as the one-line `path: message` list an error carries in its title
33
+ * .why = an error's `.message` is the only part a log line, a stack trace, or a caller's
34
+ * `console.error` shows without a decode of the metadata — so the PATHS have to be in it
35
+ * (rule.require.errors-name-the-fix: what went wrong, and where)
36
+ *
37
+ * .note = it lives HERE, beside `getZodIssuesSummary`, rather than at either border. the two
38
+ * borders throw different classes (`ConstraintError` in, `MalfunctionError` out) and
39
+ * name different fixes — but the RENDER of a path list is one guarantee, so it has one
40
+ * home (rule.forbid.parallel-codepaths). a copy at the second border is the copy that
41
+ * would rot, and the root-token note above already names every surface this must reach
42
+ */
43
+ const asZodIssuesMessage = (input) => input.issues.map((issue) => `${issue.path}: ${issue.message}`).join('; ');
44
+ exports.asZodIssuesMessage = asZodIssuesMessage;
16
45
  //# sourceMappingURL=getZodIssuesSummary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getZodIssuesSummary.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAEnC,EAAqB,EAAE;IACtB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B"}
1
+ {"version":3,"file":"getZodIssuesSummary.js","sourceRoot":"","sources":["../../../../src/domain.operations/genLambdaEndpoint/middleware/getZodIssuesSummary.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;GAQG;AACH,MAAM,SAAS,GAAG,QAAQ,CAAC;AAE3B;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAEnC,EAAqB,EAAE;IACtB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QAC1D,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AAEF;;;;;;;;;;;GAWG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAElC,EAAU,EAAE,CACX,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAH/D,QAAA,kBAAkB,sBAG6C"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRefGenericsUsed = exports.getTypescriptFromJsonSchema = void 0;
4
4
  const helpful_errors_1 = require("helpful-errors");
5
+ const getAllJsonSchemaNodes_1 = require("../getAllJsonSchemaNodes");
5
6
  /**
6
7
  * .what = compile a json-schema into a TypeScript type literal string
7
8
  * .why = the codegen needs typed shapes for mechanism args/returns + resource
@@ -68,6 +69,23 @@ const asType = (node, dobjRefs, skipRootPragma = false) => {
68
69
  return asArray(node, dobjRefs);
69
70
  if (type === 'object')
70
71
  return asObject(node, dobjRefs);
72
+ // `not: {}` → void. the node declares that NO json value is valid at this position —
73
+ // the shape `getJsonSchemaFromZod` emits for a `z.undefined()` / `z.void()` position,
74
+ // and the shape zod itself emits for `z.never()`
75
+ //
76
+ // .why `void` and not `never` = it must read correctly at BOTH positions this node
77
+ // reaches. as a mechanism's return, `Promise<void>` is right and `Promise<never>`
78
+ // would claim the call cannot return at all; as a key, `k?: void` permits the key
79
+ // to be absent, which is what the position accepts. `void` is the one TS type that
80
+ // is correct in each
81
+ //
82
+ // ⚠️ .why it is NOT left to the `unknown` fallthrough below = `unknown` says "any value
83
+ // may be here", which is the exact inverse of what this node declares. so the
84
+ // generated client would carry a rubber-stamp for the one position whose contract
85
+ // is the most precise one available (rule.forbid.failhide)
86
+ const not = node.not;
87
+ if (not && Object.keys(not).length === 0)
88
+ return 'void';
71
89
  // no recognizable shape → unknown (surfaces upstream schema looseness)
72
90
  return 'unknown';
73
91
  };
@@ -130,7 +148,7 @@ const REF_GENERIC_BY = {
130
148
  };
131
149
  /**
132
150
  * .what = read the `x-domain-object-ref` pragma off a schema node (the reference
133
- * pragma stamped by `X.contract.ref(by)` in domain-objects@0.33.0)
151
+ * pragma stamped by `X.contract().ref(by)` in domain-objects)
134
152
  * .why = a reference field carries only the referenced dobj (`of`) + which key (`by`)
135
153
  */
136
154
  const asRefPragma = (node) => node['x-domain-object-ref'];
@@ -161,27 +179,14 @@ const asRefType = (node, dobjRefs) => {
161
179
  */
162
180
  const getRefGenericsUsed = (input) => {
163
181
  const used = new Set();
164
- collectRefGenerics(input.schema, input.dobjRefs, used);
182
+ for (const node of (0, getAllJsonSchemaNodes_1.getAllJsonSchemaNodes)({ root: input.schema })) {
183
+ const ref = asRefPragma(node);
184
+ if (ref && input.dobjRefs[ref.of])
185
+ used.add(REF_GENERIC_BY[ref.by]);
186
+ }
165
187
  return [...used].sort();
166
188
  };
167
189
  exports.getRefGenericsUsed = getRefGenericsUsed;
168
- /**
169
- * .what = recursively collect the ref generics used across a schema tree
170
- */
171
- const collectRefGenerics = (node, dobjRefs, used) => {
172
- if (typeof node !== 'object' || node === null)
173
- return;
174
- const ref = asRefPragma(node);
175
- if (ref && dobjRefs[ref.of])
176
- used.add(REF_GENERIC_BY[ref.by]);
177
- for (const value of Object.values(node)) {
178
- if (Array.isArray(value))
179
- for (const item of value)
180
- collectRefGenerics(item, dobjRefs, used);
181
- else
182
- collectRefGenerics(value, dobjRefs, used);
183
- }
184
- };
185
190
  /**
186
191
  * .what = render a property key, quoted when it is not a valid identifier
187
192
  */
@@ -1 +1 @@
1
- {"version":3,"file":"getTypescriptFromJsonSchema.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.ts"],"names":[],"mappings":";;;AACA,mDAAyD;AAGzD;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAI3C,EAAU,EAAE,CACX,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC;AAL5D,QAAA,2BAA2B,+BAKiC;AAEzE;;;GAGG;AACH,MAAM,MAAM,GAAG,CACb,IAAgB,EAChB,QAAgC,EAChC,cAAc,GAAG,KAAK,EACd,EAAE;IACV,6EAA6E;IAC7E,wFAAwF;IACxF,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAE5B,8EAA8E;IAC9E,4EAA4E;IAC5E,MAAM,MAAM,GAAI,IAAiD,CAC/D,iBAAiB,CAClB,CAAC;IACF,IAAI,CAAC,cAAc,IAAI,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;QACpD,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAW,CAAC;IAEzC,uBAAuB;IACvB,IAAI,OAAO,IAAI,IAAI;QAAE,OAAO,SAAS,CAAE,IAA2B,CAAC,KAAK,CAAC,CAAC;IAE1E,2BAA2B;IAC3B,MAAM,UAAU,GAAI,IAA6B,CAAC,IAAI,CAAC;IACvD,I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B;AAEF;;GAEG;AACH,MAAM,kBAAkB,GAAG,CACzB,IAAa,EACb,QAAgC,EAChC,IAAiB,EACX,EAAE;IACR,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO;IAEtD,MAAM,GAAG,GAAG,WAAW,CAAC,IAAkB,CAAC,CAAC;IAC5C,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAE9D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAA+B,CAAC,EAAE,CAAC;QACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;;YAChE,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,KAAK,GAAG,CAAC,GAAW,EAAU,EAAE,CACpC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"getTypescriptFromJsonSchema.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.mechanism/getTypescriptFromJsonSchema.ts"],"names":[],"mappings":";;;AACA,mDAAyD;AAGzD,oEAAiE;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,2BAA2B,GAAG,CAAC,KAI3C,EAAU,EAAE,CACX,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE,EAAE,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC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,CAAC;AAZW,QAAA,kBAAkB,sBAY7B;AAEF;;GAEG;AACH,MAAM,KAAK,GAAG,CAAC,GAAW,EAAU,EAAE,CACpC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC"}
@@ -4,11 +4,18 @@ import type { DomainObjectCaptured } from '../../../domain.objects/DomainObjectC
4
4
  * .what = read the `x-domain-object` pragma off one json-schema node → a
5
5
  * DomainObjectCaptured, or null when the node carries no pragma
6
6
  * .why = a captured node identifies a domain-object only if its schema was built
7
- * from `SomeDobj.contract`; a plain shape has no pragma and stays a plain type
7
+ * from `X.contract()`; a plain shape has no pragma and stays a plain type
8
8
  *
9
- * .kind = domain-objects@0.33.0 stamps the true `kind` on the pragma (via getKind).
9
+ * .kind = domain-objects stamps the true `kind` on the pragma (via getKind) since 0.33.0.
10
10
  * read it directly; fall back to the legacy `primary`-non-empty heuristic
11
- * only for a pre-0.33 producer whose pragma omits `kind` (cross-version safe)
11
+ * only for a pre-0.33 producer whose pragma omits `kind`
12
+ *
13
+ * .note = ⚠️ that fallback is REAL backcompat, and it holds for a reason this repo's own
14
+ * version cannot settle: the pragma's producer is the REMOTE lambda under
15
+ * introspection, which runs its own `domain-objects` on its own release cadence.
16
+ * so our bump to 0.34.0 does not retire a pre-0.33 producer — a peer service
17
+ * still on 0.32.x emits a `kind`-less pragma, and to drop the fallback would
18
+ * mis-type its every entity as a literal, silently
12
19
  */
13
20
  export declare const asDomainObjectPragma: (input: {
14
21
  node: JSONSchema;
@@ -5,11 +5,18 @@ exports.asDomainObjectPragma = void 0;
5
5
  * .what = read the `x-domain-object` pragma off one json-schema node → a
6
6
  * DomainObjectCaptured, or null when the node carries no pragma
7
7
  * .why = a captured node identifies a domain-object only if its schema was built
8
- * from `SomeDobj.contract`; a plain shape has no pragma and stays a plain type
8
+ * from `X.contract()`; a plain shape has no pragma and stays a plain type
9
9
  *
10
- * .kind = domain-objects@0.33.0 stamps the true `kind` on the pragma (via getKind).
10
+ * .kind = domain-objects stamps the true `kind` on the pragma (via getKind) since 0.33.0.
11
11
  * read it directly; fall back to the legacy `primary`-non-empty heuristic
12
- * only for a pre-0.33 producer whose pragma omits `kind` (cross-version safe)
12
+ * only for a pre-0.33 producer whose pragma omits `kind`
13
+ *
14
+ * .note = ⚠️ that fallback is REAL backcompat, and it holds for a reason this repo's own
15
+ * version cannot settle: the pragma's producer is the REMOTE lambda under
16
+ * introspection, which runs its own `domain-objects` on its own release cadence.
17
+ * so our bump to 0.34.0 does not retire a pre-0.33 producer — a peer service
18
+ * still on 0.32.x emits a `kind`-less pragma, and to drop the fallback would
19
+ * mis-type its every entity as a literal, silently
13
20
  */
14
21
  const asDomainObjectPragma = (input) => {
15
22
  // read the pragma keyword off the node (absent → not a domain-object)
@@ -1 +1 @@
1
- {"version":3,"file":"asDomainObjectPragma.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAEpC,EAA+B,EAAE;IAChC,sEAAsE;IACtE,MAAM,MAAM,GAAI,KAAK,CAAC,IAAmD,CACvE,iBAAiB,CAClB,CAAC;IACF,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,sEAAsE;IACtE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAEnC,0EAA0E;IAC1E,MAAM,IAAI,GACR,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI;QACJ,OAAO;QACP,MAAM;QACN,KAAK;QACL,MAAM;QACN,KAAK,EAAE,KAAK,CAAC,IAAI;KACM,CAAC;AAC5B,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B"}
1
+ {"version":3,"file":"asDomainObjectPragma.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/asDomainObjectPragma.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAEpC,EAA+B,EAAE;IAChC,sEAAsE;IACtE,MAAM,MAAM,GAAI,KAAK,CAAC,IAAmD,CACvE,iBAAiB,CAClB,CAAC;IACF,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,sEAAsE;IACtE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAEnC,0EAA0E;IAC1E,MAAM,IAAI,GACR,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI;QACJ,OAAO;QACP,MAAM;QACN,KAAK;QACL,MAAM;QACN,KAAK,EAAE,KAAK,CAAC,IAAI;KACM,CAAC;AAC5B,CAAC,CAAC;AA5BW,QAAA,oBAAoB,wBA4B/B"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assertAllDomainObjectRefsBind = void 0;
4
4
  const LambdaDomainObjectRefUnbindableError_1 = require("../../../domain.objects/LambdaDomainObjectRefUnbindableError");
5
+ const getAllJsonSchemaNodes_1 = require("../getAllJsonSchemaNodes");
5
6
  /**
6
7
  * .what = verify every `x-domain-object-ref` across a service's contracts names a
7
8
  * dobj that is captured in full (present in `capturedNames`)
@@ -15,10 +16,13 @@ const LambdaDomainObjectRefUnbindableError_1 = require("../../../domain.objects/
15
16
  const assertAllDomainObjectRefsBind = (input) => {
16
17
  const referencedNames = new Set();
17
18
  // walk each endpoint's input + output schema trees for ref-pragma names
18
- for (const schema of Object.values(input.contracts)) {
19
- collectRefNames({ node: schema.input, into: referencedNames });
20
- collectRefNames({ node: schema.output, into: referencedNames });
21
- }
19
+ for (const schema of Object.values(input.contracts))
20
+ for (const root of [schema.input, schema.output])
21
+ for (const node of (0, getAllJsonSchemaNodes_1.getAllJsonSchemaNodes)({ root })) {
22
+ const ref = node['x-domain-object-ref'];
23
+ if (ref?.of)
24
+ referencedNames.add(ref.of);
25
+ }
22
26
  // every referenced name must be captured in full; else the ref cannot bind
23
27
  const unbound = [...referencedNames]
24
28
  .filter((name) => !input.capturedNames.has(name))
@@ -26,26 +30,8 @@ const assertAllDomainObjectRefsBind = (input) => {
26
30
  if (unbound.length > 0)
27
31
  throw new LambdaDomainObjectRefUnbindableError_1.LambdaDomainObjectRefUnbindableError(`domain-object reference(s) cannot bind: ${unbound.join(', ')} — referenced by key but captured by no endpoint`, {
28
32
  unbound,
29
- hint: 'surface each referenced domain-object in full on some endpoint of this service (return it whole via `.contract`) so the codegen can declare its resource',
33
+ hint: 'surface each referenced domain-object in full on some endpoint of this service (return it whole via `X.contract()`) so the codegen can declare its resource',
30
34
  });
31
35
  };
32
36
  exports.assertAllDomainObjectRefsBind = assertAllDomainObjectRefsBind;
33
- /**
34
- * .what = recursively read every `x-domain-object-ref` name in a schema tree
35
- */
36
- const collectRefNames = (input) => {
37
- const { node, into } = input;
38
- if (typeof node !== 'object' || node === null)
39
- return;
40
- const ref = node['x-domain-object-ref'];
41
- if (ref?.of)
42
- into.add(ref.of);
43
- for (const value of Object.values(node)) {
44
- if (Array.isArray(value))
45
- for (const item of value)
46
- collectRefNames({ node: item, into });
47
- else
48
- collectRefNames({ node: value, into });
49
- }
50
- };
51
37
  //# sourceMappingURL=assertAllDomainObjectRefsBind.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assertAllDomainObjectRefsBind.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.ts"],"names":[],"mappings":";;;AAEA,uHAAoH;AAGpH;;;;;;;;;GASG;AACI,MAAM,6BAA6B,GAAG,CAAC,KAG7C,EAAQ,EAAE;IACT,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAE1C,wEAAwE;IACxE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;QAC/D,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,2EAA2E;IAC3E,MAAM,OAAO,GAAG,CAAC,GAAG,eAAe,CAAC;SACjC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAChD,IAAI,EAAE,CAAC;IACV,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QACpB,MAAM,IAAI,2EAAoC,CAC5C,2CAA2C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAC/G;YACE,OAAO;YACP,IAAI,EAAE,0JAA0J;SACjK,CACF,CAAC;AACN,CAAC,CAAC;AAxBW,QAAA,6BAA6B,iCAwBxC;AAEF;;GAEG;AACH,MAAM,eAAe,GAAG,CAAC,KAA2C,EAAQ,EAAE;IAC5E,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAC7B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO;IAEtD,MAAM,GAAG,GAAI,IAA0D,CACrE,qBAAqB,CACtB,CAAC;IACF,IAAI,GAAG,EAAE,EAAE;QAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAE9B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAA+B,CAAC,EAAE,CAAC;QACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;;YAC7D,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"assertAllDomainObjectRefsBind.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/assertAllDomainObjectRefsBind.ts"],"names":[],"mappings":";;;AAEA,uHAAoH;AAEpH,oEAAiE;AAEjE;;;;;;;;;GASG;AACI,MAAM,6BAA6B,GAAG,CAAC,KAG7C,EAAQ,EAAE;IACT,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAE1C,wEAAwE;IACxE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QACjD,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;YAC9C,KAAK,MAAM,IAAI,IAAI,IAAA,6CAAqB,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;gBACnD,MAAM,GAAG,GAAI,IAA0D,CACrE,qBAAqB,CACtB,CAAC;gBACF,IAAI,GAAG,EAAE,EAAE;oBAAE,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC3C,CAAC;IAEL,2EAA2E;IAC3E,MAAM,OAAO,GAAG,CAAC,GAAG,eAAe,CAAC;SACjC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SAChD,IAAI,EAAE,CAAC;IACV,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QACpB,MAAM,IAAI,2EAAoC,CAC5C,2CAA2C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAC/G;YACE,OAAO;YACP,IAAI,EAAE,6JAA6J;SACpK,CACF,CAAC;AACN,CAAC,CAAC;AA5BW,QAAA,6BAA6B,iCA4BxC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAllDomainObjectsFromContracts = void 0;
4
4
  const LambdaDomainObjectNotCapturableError_1 = require("../../../domain.objects/LambdaDomainObjectNotCapturableError");
5
+ const getAllJsonSchemaNodes_1 = require("../getAllJsonSchemaNodes");
5
6
  const asDomainObjectPragma_1 = require("./asDomainObjectPragma");
6
7
  /**
7
8
  * .what = collect every domain-object captured across a service's contracts,
@@ -16,23 +17,23 @@ const getAllDomainObjectsFromContracts = (input) => {
16
17
  // collect every dobj contract from every endpoint's input + output schemas
17
18
  const captured = new Map();
18
19
  // walk each endpoint's input and output schema trees
19
- for (const schema of Object.values(input.contracts)) {
20
- collectFromNode({ node: schema.input, captured });
21
- collectFromNode({ node: schema.output, captured });
22
- }
20
+ for (const schema of Object.values(input.contracts))
21
+ for (const root of [schema.input, schema.output])
22
+ for (const node of (0, getAllJsonSchemaNodes_1.getAllJsonSchemaNodes)({ root }))
23
+ captureDomainObjectAt({ node, captured });
23
24
  // return the de-duplicated contracts in stable (name-sorted) order
24
25
  return [...captured.values()].sort((a, b) => a.name.localeCompare(b.name));
25
26
  };
26
27
  exports.getAllDomainObjectsFromContracts = getAllDomainObjectsFromContracts;
27
28
  /**
28
- * .what = recursively walk a json-schema node, collect every `x-domain-object`
29
- * .why = a dobj can appear at any depth (properties, items, $defs, anyOf, etc.)
29
+ * .what = capture ONE node, if it carries an `x-domain-object` pragma
30
+ * .why = the descent that reaches every node is `getAllJsonSchemaNodes`; what is left here
31
+ * is this file's own semantics — the pragma read, the uc.9 guard, and the de-dup.
32
+ * a dobj can appear at any depth (properties, items, $defs, anyOf, etc.), and the
33
+ * walker reaches each without this function aware of the shape it sat in
30
34
  */
31
- const collectFromNode = (input) => {
35
+ const captureDomainObjectAt = (input) => {
32
36
  const { node, captured } = input;
33
- // skip non-object nodes (leaves like strings/booleans/numbers)
34
- if (typeof node !== 'object' || node === null)
35
- return;
36
37
  // capture this node if it carries a domain-object pragma
37
38
  const contract = (0, asDomainObjectPragma_1.asDomainObjectPragma)({ node: node });
38
39
  if (contract) {
@@ -46,14 +47,6 @@ const collectFromNode = (input) => {
46
47
  if (!captured.has(contract.name))
47
48
  captured.set(contract.name, contract);
48
49
  }
49
- // recurse into every child value (arrays + nested objects)
50
- for (const value of Object.values(node)) {
51
- if (Array.isArray(value))
52
- for (const item of value)
53
- collectFromNode({ node: item, captured });
54
- else
55
- collectFromNode({ node: value, captured });
56
- }
57
50
  };
58
51
  /**
59
52
  * .what = decide whether a schema node has an object shape we can reconstruct
@@ -1 +1 @@
1
- {"version":3,"file":"getAllDomainObjectsFromContracts.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.ts"],"names":[],"mappings":";;;AAGA,uHAAoH;AAEpH,iEAA8D;AAE9D;;;;;;;;GAQG;AACI,MAAM,gCAAgC,GA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,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1E,CAAC;IAED,2DAA2D;IAC3D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAA+B,CAAC,EAAE,CAAC;QACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;;YACjE,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAW,EAAE;IACrD,MAAM,UAAU,GAAI,IAAiC,CAAC,UAAU,CAAC;IACjE,OAAO,CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CACnC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"getAllDomainObjectsFromContracts.js","sourceRoot":"","sources":["../../../../src/domain.operations/genServiceSdk/gen.resource/getAllDomainObjectsFromContracts.ts"],"names":[],"mappings":";;;AAGA,uHAAoH;AAEpH,oEAAiE;AACjE,iEAA8D;AAE9D;;;;;;;;GAQG;AACI,MAAM,gCAAgC,GAAG,CAAC,KAEhD,EAA0B,EAAE;IAC3B,2EAA2E;IAC3E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IAEzD,qDAAqD;IACrD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QACjD,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,CAA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CACL,OAAO,UAAU,KAAK,QAAQ;QAC9B,UAAU,KAAK,IAAI;QACnB,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CACnC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * .what = every object node in a json-schema tree, in pre-order
3
+ * .why = three call sites each hand-rolled this identical recursive descent, which clears
4
+ * `rule.prefer.wet-over-dry`'s rule-of-three by a wide margin. each one wanted the
5
+ * SAME traversal and a DIFFERENT thing per node, so the walk was all they shared
6
+ *
7
+ * .the three it replaces:
8
+ * - `collectRefNames` — `gen.resource/assertAllDomainObjectRefsBind.ts`
9
+ * - `collectFromNode` — `gen.resource/getAllDomainObjectsFromContracts.ts`
10
+ * - `collectRefGenerics` — `gen.mechanism/getTypescriptFromJsonSchema.ts`
11
+ *
12
+ * .why it returns a LIST rather than takes a `visit` callback = a list turns each caller's
13
+ * body into a flat `for` loop it can read in one pass. a callback keeps the inversion
14
+ * of control the hand-rolled recursion already had, so it would have collapsed the
15
+ * duplication and left the decode cost (`rule.forbid.inline-decode-friction`), and
16
+ * its name would have had to start with a verb the repo does not sanction
17
+ * (`rule.require.get-set-gen-verbs`)
18
+ *
19
+ * .why it lives HERE = `gen.resource/` and `gen.mechanism/` are the two consumers, so
20
+ * `genServiceSdk/` is their common ancestor (`rule.prefer.most-common-denominator`).
21
+ * it is not lifted higher: no third subtree asks for it
22
+ *
23
+ * ⚠️ .why PRE-ORDER is part of the contract = one caller
24
+ * (`getAllDomainObjectsFromContracts`) keeps the FIRST capture of a repeated name and
25
+ * throws on the first uncapturable one, so the order a node is met in is observable. a
26
+ * post-order or breadth-first walk would change which duplicate wins and which node the
27
+ * throw names
28
+ *
29
+ * .note = it descends EVERY value of every object, so `properties`, `items`, `$defs`,
30
+ * `anyOf`, and any keyword a future zod emits are all reached with no edit here.
31
+ * that is the property the three hand-rolled copies each had, and each had to keep
32
+ *
33
+ * ⚠️ .why a VISITED set = a graph that cycles by IDENTITY has no base case here, so the
34
+ * descent recurses until the stack blows — a `RangeError` with no diagnostic, at all
35
+ * three consumers at once. the three hand-rolled copies each carried the same hole;
36
+ * one shared walk is what lets ONE guard close it (that correctness fix is the payoff
37
+ * the extraction was argued on, so it belongs here rather than deferred)
38
+ *
39
+ * - today's real inputs are acyclic: `z.toJSONSchema` emits a self-reference as the
40
+ * STRING `'#'`, which is a leaf, so no shipped fixture reaches the guard
41
+ * - ⇒ so this guards against a shape zod does not emit TODAY, and against the
42
+ * hand-built fixture that a caller of this now-shared primitive may hand it
43
+ *
44
+ * ⚠️ .the consequence is WIDER than a cycle, and it is deliberate = the set dedupes by
45
+ * REFERENCE, so a DAG — one object reachable by two distinct paths — is now recorded
46
+ * ONCE rather than twice. measured against all three consumers before it landed:
47
+ *
48
+ * - `assertAllDomainObjectRefsBind` -> `referencedNames.add(ref.of)` — a Set
49
+ * - `getAllDomainObjectsFromContracts` -> a Map keyed by name, first wins — set-like
50
+ * - `getTypescriptFromJsonSchema` -> `used.add(REF_GENERIC_BY[…])` — a Set
51
+ *
52
+ * ⇒ every one accumulates set-semantically by NAME, so a second visit to the SAME
53
+ * object adds no entry any of them can observe. a caller that COUNTED nodes would
54
+ * observe it, and no such caller exists — `[case6]` states the property so a future
55
+ * one meets it as a contract rather than as a surprise
56
+ */
57
+ export declare const getAllJsonSchemaNodes: (input: {
58
+ root: unknown;
59
+ }) => object[];
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllJsonSchemaNodes = void 0;
4
+ /**
5
+ * .what = every object node in a json-schema tree, in pre-order
6
+ * .why = three call sites each hand-rolled this identical recursive descent, which clears
7
+ * `rule.prefer.wet-over-dry`'s rule-of-three by a wide margin. each one wanted the
8
+ * SAME traversal and a DIFFERENT thing per node, so the walk was all they shared
9
+ *
10
+ * .the three it replaces:
11
+ * - `collectRefNames` — `gen.resource/assertAllDomainObjectRefsBind.ts`
12
+ * - `collectFromNode` — `gen.resource/getAllDomainObjectsFromContracts.ts`
13
+ * - `collectRefGenerics` — `gen.mechanism/getTypescriptFromJsonSchema.ts`
14
+ *
15
+ * .why it returns a LIST rather than takes a `visit` callback = a list turns each caller's
16
+ * body into a flat `for` loop it can read in one pass. a callback keeps the inversion
17
+ * of control the hand-rolled recursion already had, so it would have collapsed the
18
+ * duplication and left the decode cost (`rule.forbid.inline-decode-friction`), and
19
+ * its name would have had to start with a verb the repo does not sanction
20
+ * (`rule.require.get-set-gen-verbs`)
21
+ *
22
+ * .why it lives HERE = `gen.resource/` and `gen.mechanism/` are the two consumers, so
23
+ * `genServiceSdk/` is their common ancestor (`rule.prefer.most-common-denominator`).
24
+ * it is not lifted higher: no third subtree asks for it
25
+ *
26
+ * ⚠️ .why PRE-ORDER is part of the contract = one caller
27
+ * (`getAllDomainObjectsFromContracts`) keeps the FIRST capture of a repeated name and
28
+ * throws on the first uncapturable one, so the order a node is met in is observable. a
29
+ * post-order or breadth-first walk would change which duplicate wins and which node the
30
+ * throw names
31
+ *
32
+ * .note = it descends EVERY value of every object, so `properties`, `items`, `$defs`,
33
+ * `anyOf`, and any keyword a future zod emits are all reached with no edit here.
34
+ * that is the property the three hand-rolled copies each had, and each had to keep
35
+ *
36
+ * ⚠️ .why a VISITED set = a graph that cycles by IDENTITY has no base case here, so the
37
+ * descent recurses until the stack blows — a `RangeError` with no diagnostic, at all
38
+ * three consumers at once. the three hand-rolled copies each carried the same hole;
39
+ * one shared walk is what lets ONE guard close it (that correctness fix is the payoff
40
+ * the extraction was argued on, so it belongs here rather than deferred)
41
+ *
42
+ * - today's real inputs are acyclic: `z.toJSONSchema` emits a self-reference as the
43
+ * STRING `'#'`, which is a leaf, so no shipped fixture reaches the guard
44
+ * - ⇒ so this guards against a shape zod does not emit TODAY, and against the
45
+ * hand-built fixture that a caller of this now-shared primitive may hand it
46
+ *
47
+ * ⚠️ .the consequence is WIDER than a cycle, and it is deliberate = the set dedupes by
48
+ * REFERENCE, so a DAG — one object reachable by two distinct paths — is now recorded
49
+ * ONCE rather than twice. measured against all three consumers before it landed:
50
+ *
51
+ * - `assertAllDomainObjectRefsBind` -> `referencedNames.add(ref.of)` — a Set
52
+ * - `getAllDomainObjectsFromContracts` -> a Map keyed by name, first wins — set-like
53
+ * - `getTypescriptFromJsonSchema` -> `used.add(REF_GENERIC_BY[…])` — a Set
54
+ *
55
+ * ⇒ every one accumulates set-semantically by NAME, so a second visit to the SAME
56
+ * object adds no entry any of them can observe. a caller that COUNTED nodes would
57
+ * observe it, and no such caller exists — `[case6]` states the property so a future
58
+ * one meets it as a contract rather than as a surprise
59
+ */
60
+ const getAllJsonSchemaNodes = (input) => {
61
+ const nodes = [];
62
+ // track nodes already recorded, so a cycle terminates and a DAG is not double-counted
63
+ const visited = new WeakSet();
64
+ const descend = (node) => {
65
+ // skip leaves — a string, a number, a boolean, a null carries no node
66
+ if (typeof node !== 'object' || node === null)
67
+ return;
68
+ // stop at a node already met, so a cycle by identity terminates rather than overflows
69
+ if (visited.has(node))
70
+ return;
71
+ visited.add(node);
72
+ // record this node BEFORE its children, so the list reads in pre-order
73
+ nodes.push(node);
74
+ // descend into every child value, arrays and nested objects alike
75
+ for (const value of Object.values(node)) {
76
+ if (Array.isArray(value))
77
+ for (const item of value)
78
+ descend(item);
79
+ else
80
+ descend(value);
81
+ }
82
+ };
83
+ descend(input.root);
84
+ return nodes;
85
+ };
86
+ exports.getAllJsonSchemaNodes = getAllJsonSchemaNodes;
87
+ //# sourceMappingURL=getAllJsonSchemaNodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllJsonSchemaNodes.js","sourceRoot":"","sources":["../../../src/domain.operations/genServiceSdk/getAllJsonSchemaNodes.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACI,MAAM,qBAAqB,GAAG,CAAC,KAAwB,EAAY,EAAE;IAC1E,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,sFAAsF;IACtF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAU,CAAC;IAEtC,MAAM,OAAO,GAAG,CAAC,IAAa,EAAQ,EAAE;QACtC,sEAAsE;QACtE,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO;QAEtD,sFAAsF;QACtF,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAElB,uEAAuE;QACvE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjB,kEAAkE;QAClE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAA+B,CAAC,EAAE,CAAC;YACnE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBAAE,KAAK,MAAM,IAAI,IAAI,KAAK;oBAAE,OAAO,CAAC,IAAI,CAAC,CAAC;;gBAC7D,OAAO,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AA1BW,QAAA,qBAAqB,yBA0BhC"}