@parmana/shared 0.0.0-stage → 2.0.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 (433) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +16 -2
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/config/ApiKeyEntry.d.ts +97 -0
  6. package/dist/config/ApiKeyEntry.d.ts.map +1 -0
  7. package/dist/config/ApiKeyEntry.js +2 -0
  8. package/dist/config/ApiKeyEntry.js.map +1 -0
  9. package/dist/config/Config.d.ts +227 -0
  10. package/dist/config/Config.d.ts.map +1 -0
  11. package/dist/config/Config.js +172 -0
  12. package/dist/config/Config.js.map +1 -0
  13. package/dist/config/ConfigLoader.d.ts +5 -0
  14. package/dist/config/ConfigLoader.d.ts.map +1 -0
  15. package/dist/config/ConfigLoader.js +8 -0
  16. package/dist/config/ConfigLoader.js.map +1 -0
  17. package/dist/config/ConfigUtils.d.ts +6 -0
  18. package/dist/config/ConfigUtils.d.ts.map +1 -0
  19. package/dist/config/ConfigUtils.js +8 -0
  20. package/dist/config/ConfigUtils.js.map +1 -0
  21. package/dist/config/ConfigValidation.d.ts +30 -0
  22. package/dist/config/ConfigValidation.d.ts.map +1 -0
  23. package/dist/config/ConfigValidation.js +191 -0
  24. package/dist/config/ConfigValidation.js.map +1 -0
  25. package/dist/config/CryptoAlgorithms.d.ts +38 -0
  26. package/dist/config/CryptoAlgorithms.d.ts.map +1 -0
  27. package/dist/config/CryptoAlgorithms.js +38 -0
  28. package/dist/config/CryptoAlgorithms.js.map +1 -0
  29. package/dist/config/Doctor.d.ts +46 -0
  30. package/dist/config/Doctor.d.ts.map +1 -0
  31. package/dist/config/Doctor.js +781 -0
  32. package/dist/config/Doctor.js.map +1 -0
  33. package/dist/config/KeyProviders.d.ts +9 -0
  34. package/dist/config/KeyProviders.d.ts.map +1 -0
  35. package/dist/config/KeyProviders.js +8 -0
  36. package/dist/config/KeyProviders.js.map +1 -0
  37. package/dist/config/SecretsProviders.d.ts +6 -0
  38. package/dist/config/SecretsProviders.d.ts.map +1 -0
  39. package/dist/config/SecretsProviders.js +5 -0
  40. package/dist/config/SecretsProviders.js.map +1 -0
  41. package/dist/config/StorageProviders.d.ts +18 -0
  42. package/dist/config/StorageProviders.d.ts.map +1 -0
  43. package/dist/config/StorageProviders.js +20 -0
  44. package/dist/config/StorageProviders.js.map +1 -0
  45. package/dist/config/TrustProfiles.d.ts +5 -0
  46. package/dist/config/TrustProfiles.d.ts.map +1 -0
  47. package/dist/config/TrustProfiles.js +4 -0
  48. package/dist/config/TrustProfiles.js.map +1 -0
  49. package/dist/config/index.d.ts +12 -0
  50. package/dist/config/index.d.ts.map +1 -0
  51. package/dist/config/index.js +12 -0
  52. package/dist/config/index.js.map +1 -0
  53. package/dist/domain/approval-artifact.d.ts +136 -0
  54. package/dist/domain/approval-artifact.d.ts.map +1 -0
  55. package/dist/domain/approval-artifact.js +2 -0
  56. package/dist/domain/approval-artifact.js.map +1 -0
  57. package/dist/domain/approval-issuer.d.ts +52 -0
  58. package/dist/domain/approval-issuer.d.ts.map +1 -0
  59. package/dist/domain/approval-issuer.js +2 -0
  60. package/dist/domain/approval-issuer.js.map +1 -0
  61. package/dist/domain/authority-grant.d.ts +54 -0
  62. package/dist/domain/authority-grant.d.ts.map +1 -0
  63. package/dist/domain/authority-grant.js +2 -0
  64. package/dist/domain/authority-grant.js.map +1 -0
  65. package/dist/domain/authority.d.ts +42 -0
  66. package/dist/domain/authority.d.ts.map +1 -0
  67. package/dist/domain/authority.js +11 -0
  68. package/dist/domain/authority.js.map +1 -0
  69. package/dist/domain/authorization.d.ts +54 -0
  70. package/dist/domain/authorization.d.ts.map +1 -0
  71. package/dist/domain/authorization.js +2 -0
  72. package/dist/domain/authorization.js.map +1 -0
  73. package/dist/domain/business-signal-source.d.ts +52 -0
  74. package/dist/domain/business-signal-source.d.ts.map +1 -0
  75. package/dist/domain/business-signal-source.js +2 -0
  76. package/dist/domain/business-signal-source.js.map +1 -0
  77. package/dist/domain/business-transaction.d.ts +99 -0
  78. package/dist/domain/business-transaction.d.ts.map +1 -0
  79. package/dist/domain/business-transaction.js +16 -0
  80. package/dist/domain/business-transaction.js.map +1 -0
  81. package/dist/domain/business-validation.d.ts +177 -0
  82. package/dist/domain/business-validation.d.ts.map +1 -0
  83. package/dist/domain/business-validation.js +60 -0
  84. package/dist/domain/business-validation.js.map +1 -0
  85. package/dist/domain/challenge-record.d.ts +181 -0
  86. package/dist/domain/challenge-record.d.ts.map +1 -0
  87. package/dist/domain/challenge-record.js +2 -0
  88. package/dist/domain/challenge-record.js.map +1 -0
  89. package/dist/domain/decision.d.ts +97 -0
  90. package/dist/domain/decision.d.ts.map +1 -0
  91. package/dist/domain/decision.js +9 -0
  92. package/dist/domain/decision.js.map +1 -0
  93. package/dist/domain/evidence-anchor.d.ts +54 -0
  94. package/dist/domain/evidence-anchor.d.ts.map +1 -0
  95. package/dist/domain/evidence-anchor.js +2 -0
  96. package/dist/domain/evidence-anchor.js.map +1 -0
  97. package/dist/domain/executable-content.d.ts +45 -0
  98. package/dist/domain/executable-content.d.ts.map +1 -0
  99. package/dist/domain/executable-content.js +39 -0
  100. package/dist/domain/executable-content.js.map +1 -0
  101. package/dist/domain/execution-audit-event.d.ts +65 -0
  102. package/dist/domain/execution-audit-event.d.ts.map +1 -0
  103. package/dist/domain/execution-audit-event.js +2 -0
  104. package/dist/domain/execution-audit-event.js.map +1 -0
  105. package/dist/domain/execution-authorization.d.ts +224 -0
  106. package/dist/domain/execution-authorization.d.ts.map +1 -0
  107. package/dist/domain/execution-authorization.js +2 -0
  108. package/dist/domain/execution-authorization.js.map +1 -0
  109. package/dist/domain/execution-evidence.d.ts +38 -0
  110. package/dist/domain/execution-evidence.d.ts.map +1 -0
  111. package/dist/domain/execution-evidence.js +2 -0
  112. package/dist/domain/execution-evidence.js.map +1 -0
  113. package/dist/domain/execution-intent.d.ts +92 -0
  114. package/dist/domain/execution-intent.d.ts.map +1 -0
  115. package/dist/domain/execution-intent.js +2 -0
  116. package/dist/domain/execution-intent.js.map +1 -0
  117. package/dist/domain/execution-metadata.d.ts +8 -0
  118. package/dist/domain/execution-metadata.d.ts.map +1 -0
  119. package/dist/domain/execution-metadata.js +2 -0
  120. package/dist/domain/execution-metadata.js.map +1 -0
  121. package/dist/domain/execution-outcome-store.d.ts +49 -0
  122. package/dist/domain/execution-outcome-store.d.ts.map +1 -0
  123. package/dist/domain/execution-outcome-store.js +10 -0
  124. package/dist/domain/execution-outcome-store.js.map +1 -0
  125. package/dist/domain/execution-result.d.ts +49 -0
  126. package/dist/domain/execution-result.d.ts.map +1 -0
  127. package/dist/domain/execution-result.js +2 -0
  128. package/dist/domain/execution-result.js.map +1 -0
  129. package/dist/domain/execution-trust-record.d.ts +142 -0
  130. package/dist/domain/execution-trust-record.d.ts.map +1 -0
  131. package/dist/domain/execution-trust-record.js +2 -0
  132. package/dist/domain/execution-trust-record.js.map +1 -0
  133. package/dist/domain/execution.d.ts +108 -0
  134. package/dist/domain/execution.d.ts.map +1 -0
  135. package/dist/domain/execution.js +18 -0
  136. package/dist/domain/execution.js.map +1 -0
  137. package/dist/domain/external-connector.d.ts +68 -0
  138. package/dist/domain/external-connector.d.ts.map +1 -0
  139. package/dist/domain/external-connector.js +2 -0
  140. package/dist/domain/external-connector.js.map +1 -0
  141. package/dist/domain/index.d.ts +37 -0
  142. package/dist/domain/index.d.ts.map +1 -0
  143. package/dist/domain/index.js +37 -0
  144. package/dist/domain/index.js.map +1 -0
  145. package/dist/domain/intent.d.ts +66 -0
  146. package/dist/domain/intent.d.ts.map +1 -0
  147. package/dist/domain/intent.js +2 -0
  148. package/dist/domain/intent.js.map +1 -0
  149. package/dist/domain/metadata.d.ts +53 -0
  150. package/dist/domain/metadata.d.ts.map +1 -0
  151. package/dist/domain/metadata.js +11 -0
  152. package/dist/domain/metadata.js.map +1 -0
  153. package/dist/domain/override.d.ts +39 -0
  154. package/dist/domain/override.d.ts.map +1 -0
  155. package/dist/domain/override.js +2 -0
  156. package/dist/domain/override.js.map +1 -0
  157. package/dist/domain/pending-policy-change.d.ts +109 -0
  158. package/dist/domain/pending-policy-change.d.ts.map +1 -0
  159. package/dist/domain/pending-policy-change.js +12 -0
  160. package/dist/domain/pending-policy-change.js.map +1 -0
  161. package/dist/domain/policy-change-approval-record.d.ts +81 -0
  162. package/dist/domain/policy-change-approval-record.d.ts.map +1 -0
  163. package/dist/domain/policy-change-approval-record.js +2 -0
  164. package/dist/domain/policy-change-approval-record.js.map +1 -0
  165. package/dist/domain/policy-change-step-up-authorization.d.ts +97 -0
  166. package/dist/domain/policy-change-step-up-authorization.d.ts.map +1 -0
  167. package/dist/domain/policy-change-step-up-authorization.js +2 -0
  168. package/dist/domain/policy-change-step-up-authorization.js.map +1 -0
  169. package/dist/domain/policy-reference.d.ts +58 -0
  170. package/dist/domain/policy-reference.d.ts.map +1 -0
  171. package/dist/domain/policy-reference.js +2 -0
  172. package/dist/domain/policy-reference.js.map +1 -0
  173. package/dist/domain/receipt.d.ts +72 -0
  174. package/dist/domain/receipt.d.ts.map +1 -0
  175. package/dist/domain/receipt.js +2 -0
  176. package/dist/domain/receipt.js.map +1 -0
  177. package/dist/domain/refusal-record.d.ts +110 -0
  178. package/dist/domain/refusal-record.d.ts.map +1 -0
  179. package/dist/domain/refusal-record.js +2 -0
  180. package/dist/domain/refusal-record.js.map +1 -0
  181. package/dist/domain/release-approval.d.ts +14 -0
  182. package/dist/domain/release-approval.d.ts.map +1 -0
  183. package/dist/domain/release-approval.js +2 -0
  184. package/dist/domain/release-approval.js.map +1 -0
  185. package/dist/domain/signals.d.ts +10 -0
  186. package/dist/domain/signals.d.ts.map +1 -0
  187. package/dist/domain/signals.js +2 -0
  188. package/dist/domain/signals.js.map +1 -0
  189. package/dist/domain/signature-entry.d.ts +23 -0
  190. package/dist/domain/signature-entry.d.ts.map +1 -0
  191. package/dist/domain/signature-entry.js +2 -0
  192. package/dist/domain/signature-entry.js.map +1 -0
  193. package/dist/domain/signature.d.ts +26 -0
  194. package/dist/domain/signature.d.ts.map +1 -0
  195. package/dist/domain/signature.js +2 -0
  196. package/dist/domain/signature.js.map +1 -0
  197. package/dist/domain/unsigned-execution-trust-record.d.ts +7 -0
  198. package/dist/domain/unsigned-execution-trust-record.d.ts.map +1 -0
  199. package/dist/domain/unsigned-execution-trust-record.js +2 -0
  200. package/dist/domain/unsigned-execution-trust-record.js.map +1 -0
  201. package/dist/domain/verification.d.ts +48 -0
  202. package/dist/domain/verification.d.ts.map +1 -0
  203. package/dist/domain/verification.js +9 -0
  204. package/dist/domain/verification.js.map +1 -0
  205. package/dist/errors/approval-issuer-change-not-found-error.d.ts +9 -0
  206. package/dist/errors/approval-issuer-change-not-found-error.d.ts.map +1 -0
  207. package/dist/errors/approval-issuer-change-not-found-error.js +11 -0
  208. package/dist/errors/approval-issuer-change-not-found-error.js.map +1 -0
  209. package/dist/errors/authority-grant-change-not-found-error.d.ts +9 -0
  210. package/dist/errors/authority-grant-change-not-found-error.d.ts.map +1 -0
  211. package/dist/errors/authority-grant-change-not-found-error.js +11 -0
  212. package/dist/errors/authority-grant-change-not-found-error.js.map +1 -0
  213. package/dist/errors/authority-required-error.d.ts +5 -0
  214. package/dist/errors/authority-required-error.d.ts.map +1 -0
  215. package/dist/errors/authority-required-error.js +7 -0
  216. package/dist/errors/authority-required-error.js.map +1 -0
  217. package/dist/errors/authorization-no-longer-valid-error.d.ts +19 -0
  218. package/dist/errors/authorization-no-longer-valid-error.d.ts.map +1 -0
  219. package/dist/errors/authorization-no-longer-valid-error.js +23 -0
  220. package/dist/errors/authorization-no-longer-valid-error.js.map +1 -0
  221. package/dist/errors/authorization-required-error.d.ts +5 -0
  222. package/dist/errors/authorization-required-error.d.ts.map +1 -0
  223. package/dist/errors/authorization-required-error.js +7 -0
  224. package/dist/errors/authorization-required-error.js.map +1 -0
  225. package/dist/errors/business-signal-source-change-not-found-error.d.ts +9 -0
  226. package/dist/errors/business-signal-source-change-not-found-error.d.ts.map +1 -0
  227. package/dist/errors/business-signal-source-change-not-found-error.js +11 -0
  228. package/dist/errors/business-signal-source-change-not-found-error.js.map +1 -0
  229. package/dist/errors/business-transaction-not-found-error.d.ts +5 -0
  230. package/dist/errors/business-transaction-not-found-error.d.ts.map +1 -0
  231. package/dist/errors/business-transaction-not-found-error.js +7 -0
  232. package/dist/errors/business-transaction-not-found-error.js.map +1 -0
  233. package/dist/errors/challenge-record-not-found-error.d.ts +9 -0
  234. package/dist/errors/challenge-record-not-found-error.d.ts.map +1 -0
  235. package/dist/errors/challenge-record-not-found-error.js +11 -0
  236. package/dist/errors/challenge-record-not-found-error.js.map +1 -0
  237. package/dist/errors/conflict-error.d.ts +5 -0
  238. package/dist/errors/conflict-error.d.ts.map +1 -0
  239. package/dist/errors/conflict-error.js +7 -0
  240. package/dist/errors/conflict-error.js.map +1 -0
  241. package/dist/errors/connector-not-registered-error.d.ts +21 -0
  242. package/dist/errors/connector-not-registered-error.d.ts.map +1 -0
  243. package/dist/errors/connector-not-registered-error.js +24 -0
  244. package/dist/errors/connector-not-registered-error.js.map +1 -0
  245. package/dist/errors/decision-not-approved-error.d.ts +5 -0
  246. package/dist/errors/decision-not-approved-error.d.ts.map +1 -0
  247. package/dist/errors/decision-not-approved-error.js +7 -0
  248. package/dist/errors/decision-not-approved-error.js.map +1 -0
  249. package/dist/errors/duplicate-business-transaction-error.d.ts +26 -0
  250. package/dist/errors/duplicate-business-transaction-error.d.ts.map +1 -0
  251. package/dist/errors/duplicate-business-transaction-error.js +28 -0
  252. package/dist/errors/duplicate-business-transaction-error.js.map +1 -0
  253. package/dist/errors/external-connector-change-not-found-error.d.ts +9 -0
  254. package/dist/errors/external-connector-change-not-found-error.d.ts.map +1 -0
  255. package/dist/errors/external-connector-change-not-found-error.js +11 -0
  256. package/dist/errors/external-connector-change-not-found-error.js.map +1 -0
  257. package/dist/errors/forbidden-error.d.ts +5 -0
  258. package/dist/errors/forbidden-error.d.ts.map +1 -0
  259. package/dist/errors/forbidden-error.js +7 -0
  260. package/dist/errors/forbidden-error.js.map +1 -0
  261. package/dist/errors/index.d.ts +30 -0
  262. package/dist/errors/index.d.ts.map +1 -0
  263. package/dist/errors/index.js +30 -0
  264. package/dist/errors/index.js.map +1 -0
  265. package/dist/errors/intent-required-error.d.ts +5 -0
  266. package/dist/errors/intent-required-error.d.ts.map +1 -0
  267. package/dist/errors/intent-required-error.js +7 -0
  268. package/dist/errors/intent-required-error.js.map +1 -0
  269. package/dist/errors/non-human-caller-denied-error.d.ts +10 -0
  270. package/dist/errors/non-human-caller-denied-error.d.ts.map +1 -0
  271. package/dist/errors/non-human-caller-denied-error.js +12 -0
  272. package/dist/errors/non-human-caller-denied-error.js.map +1 -0
  273. package/dist/errors/nonce-already-consumed-error.d.ts +26 -0
  274. package/dist/errors/nonce-already-consumed-error.d.ts.map +1 -0
  275. package/dist/errors/nonce-already-consumed-error.js +29 -0
  276. package/dist/errors/nonce-already-consumed-error.js.map +1 -0
  277. package/dist/errors/outcome-unknown-error.d.ts +15 -0
  278. package/dist/errors/outcome-unknown-error.d.ts.map +1 -0
  279. package/dist/errors/outcome-unknown-error.js +19 -0
  280. package/dist/errors/outcome-unknown-error.js.map +1 -0
  281. package/dist/errors/override-not-allowed-error.d.ts +5 -0
  282. package/dist/errors/override-not-allowed-error.d.ts.map +1 -0
  283. package/dist/errors/override-not-allowed-error.js +7 -0
  284. package/dist/errors/override-not-allowed-error.js.map +1 -0
  285. package/dist/errors/parmana-error.d.ts +15 -0
  286. package/dist/errors/parmana-error.d.ts.map +1 -0
  287. package/dist/errors/parmana-error.js +21 -0
  288. package/dist/errors/parmana-error.js.map +1 -0
  289. package/dist/errors/pending-policy-change-not-found-error.d.ts +9 -0
  290. package/dist/errors/pending-policy-change-not-found-error.d.ts.map +1 -0
  291. package/dist/errors/pending-policy-change-not-found-error.js +11 -0
  292. package/dist/errors/pending-policy-change-not-found-error.js.map +1 -0
  293. package/dist/errors/policy-not-found-error.d.ts +5 -0
  294. package/dist/errors/policy-not-found-error.d.ts.map +1 -0
  295. package/dist/errors/policy-not-found-error.js +7 -0
  296. package/dist/errors/policy-not-found-error.js.map +1 -0
  297. package/dist/errors/receipt-generation-error.d.ts +5 -0
  298. package/dist/errors/receipt-generation-error.d.ts.map +1 -0
  299. package/dist/errors/receipt-generation-error.js +7 -0
  300. package/dist/errors/receipt-generation-error.js.map +1 -0
  301. package/dist/errors/same-actor-cannot-approve-own-change-error.d.ts +12 -0
  302. package/dist/errors/same-actor-cannot-approve-own-change-error.d.ts.map +1 -0
  303. package/dist/errors/same-actor-cannot-approve-own-change-error.js +15 -0
  304. package/dist/errors/same-actor-cannot-approve-own-change-error.js.map +1 -0
  305. package/dist/errors/step-up-authorization-invalid-error.d.ts +25 -0
  306. package/dist/errors/step-up-authorization-invalid-error.d.ts.map +1 -0
  307. package/dist/errors/step-up-authorization-invalid-error.js +28 -0
  308. package/dist/errors/step-up-authorization-invalid-error.js.map +1 -0
  309. package/dist/errors/trust-chain-validation-error.d.ts +5 -0
  310. package/dist/errors/trust-chain-validation-error.d.ts.map +1 -0
  311. package/dist/errors/trust-chain-validation-error.js +7 -0
  312. package/dist/errors/trust-chain-validation-error.js.map +1 -0
  313. package/dist/errors/unauthorized-error.d.ts +5 -0
  314. package/dist/errors/unauthorized-error.d.ts.map +1 -0
  315. package/dist/errors/unauthorized-error.js +7 -0
  316. package/dist/errors/unauthorized-error.js.map +1 -0
  317. package/dist/errors/validation-error.d.ts +5 -0
  318. package/dist/errors/validation-error.d.ts.map +1 -0
  319. package/dist/errors/validation-error.js +7 -0
  320. package/dist/errors/validation-error.js.map +1 -0
  321. package/dist/errors/verification-failed-error.d.ts +5 -0
  322. package/dist/errors/verification-failed-error.d.ts.map +1 -0
  323. package/dist/errors/verification-failed-error.js +7 -0
  324. package/dist/errors/verification-failed-error.js.map +1 -0
  325. package/dist/gateway/GatewayAuthentication.d.ts +8 -0
  326. package/dist/gateway/GatewayAuthentication.d.ts.map +1 -0
  327. package/dist/gateway/GatewayAuthentication.js +2 -0
  328. package/dist/gateway/GatewayAuthentication.js.map +1 -0
  329. package/dist/gateway/GatewayAuthenticationClaims.d.ts +10 -0
  330. package/dist/gateway/GatewayAuthenticationClaims.d.ts.map +1 -0
  331. package/dist/gateway/GatewayAuthenticationClaims.js +2 -0
  332. package/dist/gateway/GatewayAuthenticationClaims.js.map +1 -0
  333. package/dist/gateway/GatewayAuthenticationPayload.d.ts +15 -0
  334. package/dist/gateway/GatewayAuthenticationPayload.d.ts.map +1 -0
  335. package/dist/gateway/GatewayAuthenticationPayload.js +2 -0
  336. package/dist/gateway/GatewayAuthenticationPayload.js.map +1 -0
  337. package/dist/gateway/SignedGatewayAuthentication.d.ts +9 -0
  338. package/dist/gateway/SignedGatewayAuthentication.d.ts.map +1 -0
  339. package/dist/gateway/SignedGatewayAuthentication.js +2 -0
  340. package/dist/gateway/SignedGatewayAuthentication.js.map +1 -0
  341. package/dist/gateway/index.d.ts +4 -0
  342. package/dist/gateway/index.d.ts.map +1 -0
  343. package/dist/gateway/index.js +4 -0
  344. package/dist/gateway/index.js.map +1 -0
  345. package/dist/index.d.ts +19 -0
  346. package/dist/index.d.ts.map +1 -0
  347. package/dist/index.js +19 -0
  348. package/dist/index.js.map +1 -0
  349. package/dist/logging/Logger.d.ts +65 -0
  350. package/dist/logging/Logger.d.ts.map +1 -0
  351. package/dist/logging/Logger.js +97 -0
  352. package/dist/logging/Logger.js.map +1 -0
  353. package/dist/network/externalEndpointAddress.d.ts +48 -0
  354. package/dist/network/externalEndpointAddress.d.ts.map +1 -0
  355. package/dist/network/externalEndpointAddress.js +147 -0
  356. package/dist/network/externalEndpointAddress.js.map +1 -0
  357. package/dist/repositories/approval-issuer-repository.d.ts +31 -0
  358. package/dist/repositories/approval-issuer-repository.d.ts.map +1 -0
  359. package/dist/repositories/approval-issuer-repository.js +2 -0
  360. package/dist/repositories/approval-issuer-repository.js.map +1 -0
  361. package/dist/repositories/authority-grant-repository.d.ts +22 -0
  362. package/dist/repositories/authority-grant-repository.d.ts.map +1 -0
  363. package/dist/repositories/authority-grant-repository.js +2 -0
  364. package/dist/repositories/authority-grant-repository.js.map +1 -0
  365. package/dist/repositories/business-signal-source-repository.d.ts +17 -0
  366. package/dist/repositories/business-signal-source-repository.d.ts.map +1 -0
  367. package/dist/repositories/business-signal-source-repository.js +2 -0
  368. package/dist/repositories/business-signal-source-repository.js.map +1 -0
  369. package/dist/repositories/business-transaction-repository.d.ts +34 -0
  370. package/dist/repositories/business-transaction-repository.d.ts.map +1 -0
  371. package/dist/repositories/business-transaction-repository.js +2 -0
  372. package/dist/repositories/business-transaction-repository.js.map +1 -0
  373. package/dist/repositories/caller-key-revocation-repository.d.ts +26 -0
  374. package/dist/repositories/caller-key-revocation-repository.d.ts.map +1 -0
  375. package/dist/repositories/caller-key-revocation-repository.js +2 -0
  376. package/dist/repositories/caller-key-revocation-repository.js.map +1 -0
  377. package/dist/repositories/challenge-record-repository.d.ts +67 -0
  378. package/dist/repositories/challenge-record-repository.d.ts.map +1 -0
  379. package/dist/repositories/challenge-record-repository.js +76 -0
  380. package/dist/repositories/challenge-record-repository.js.map +1 -0
  381. package/dist/repositories/execution-intent-repository.d.ts +38 -0
  382. package/dist/repositories/execution-intent-repository.d.ts.map +1 -0
  383. package/dist/repositories/execution-intent-repository.js +2 -0
  384. package/dist/repositories/execution-intent-repository.js.map +1 -0
  385. package/dist/repositories/execution-trust-record-repository.d.ts +62 -0
  386. package/dist/repositories/execution-trust-record-repository.d.ts.map +1 -0
  387. package/dist/repositories/execution-trust-record-repository.js +2 -0
  388. package/dist/repositories/execution-trust-record-repository.js.map +1 -0
  389. package/dist/repositories/external-connector-repository.d.ts +37 -0
  390. package/dist/repositories/external-connector-repository.d.ts.map +1 -0
  391. package/dist/repositories/external-connector-repository.js +2 -0
  392. package/dist/repositories/external-connector-repository.js.map +1 -0
  393. package/dist/repositories/handbook-download-lead-repository.d.ts +18 -0
  394. package/dist/repositories/handbook-download-lead-repository.d.ts.map +1 -0
  395. package/dist/repositories/handbook-download-lead-repository.js +2 -0
  396. package/dist/repositories/handbook-download-lead-repository.js.map +1 -0
  397. package/dist/repositories/inbound-decision-repository.d.ts +72 -0
  398. package/dist/repositories/inbound-decision-repository.d.ts.map +1 -0
  399. package/dist/repositories/inbound-decision-repository.js +10 -0
  400. package/dist/repositories/inbound-decision-repository.js.map +1 -0
  401. package/dist/repositories/inbound-outcome-repository.d.ts +23 -0
  402. package/dist/repositories/inbound-outcome-repository.d.ts.map +1 -0
  403. package/dist/repositories/inbound-outcome-repository.js +2 -0
  404. package/dist/repositories/inbound-outcome-repository.js.map +1 -0
  405. package/dist/repositories/index.d.ts +17 -0
  406. package/dist/repositories/index.d.ts.map +1 -0
  407. package/dist/repositories/index.js +17 -0
  408. package/dist/repositories/index.js.map +1 -0
  409. package/dist/repositories/pending-policy-change-repository.d.ts +72 -0
  410. package/dist/repositories/pending-policy-change-repository.d.ts.map +1 -0
  411. package/dist/repositories/pending-policy-change-repository.js +46 -0
  412. package/dist/repositories/pending-policy-change-repository.js.map +1 -0
  413. package/dist/repositories/policy-change-approval-record-repository.d.ts +39 -0
  414. package/dist/repositories/policy-change-approval-record-repository.d.ts.map +1 -0
  415. package/dist/repositories/policy-change-approval-record-repository.js +2 -0
  416. package/dist/repositories/policy-change-approval-record-repository.js.map +1 -0
  417. package/dist/repositories/policy-repository.d.ts +15 -0
  418. package/dist/repositories/policy-repository.d.ts.map +1 -0
  419. package/dist/repositories/policy-repository.js +2 -0
  420. package/dist/repositories/policy-repository.js.map +1 -0
  421. package/dist/repositories/refusal-record-repository.d.ts +13 -0
  422. package/dist/repositories/refusal-record-repository.d.ts.map +1 -0
  423. package/dist/repositories/refusal-record-repository.js +2 -0
  424. package/dist/repositories/refusal-record-repository.js.map +1 -0
  425. package/dist/types/Json.d.ts +7 -0
  426. package/dist/types/Json.d.ts.map +1 -0
  427. package/dist/types/Json.js +2 -0
  428. package/dist/types/Json.js.map +1 -0
  429. package/dist/utils/normalize-policy.d.ts +16 -0
  430. package/dist/utils/normalize-policy.d.ts.map +1 -0
  431. package/dist/utils/normalize-policy.js +10 -0
  432. package/dist/utils/normalize-policy.js.map +1 -0
  433. package/package.json +39 -4
@@ -0,0 +1,76 @@
1
+ import { ConflictError } from "../errors/index.js";
2
+ /**
3
+ * Forward-only lifecycle order a `status` append operation must
4
+ * respect. Index position, not the string values, is what "forward"
5
+ * means here.
6
+ */
7
+ const CHALLENGE_RECORD_STATUS_ORDER = [
8
+ "open",
9
+ "investigating",
10
+ "resolved",
11
+ ];
12
+ /**
13
+ * Pure, backend-independent enforcement of ChallengeRecord's
14
+ * append-only rules (RFC-0022 § Proposal 1): investigationSteps only
15
+ * grows; status only moves strictly forward (open -> investigating ->
16
+ * resolved), never backward or in place; finding/outcome/disclosure
17
+ * are each set at most once. Every ChallengeRecordRepository
18
+ * implementation should call this rather than re-implementing the
19
+ * same checks, so the enforcement is identical across backends (the
20
+ * same reasoning `isUniqueViolation` gave for a shared mapping across
21
+ * MemoryBusinessTransactionRepository / PostgresBusinessTransactionRepository).
22
+ *
23
+ * Throws ConflictError, never silently drops or overwrites, on any
24
+ * violation.
25
+ */
26
+ export function applyChallengeRecordAppend(record, operation, appliedAt) {
27
+ switch (operation.kind) {
28
+ case "investigation-step":
29
+ return {
30
+ ...record,
31
+ investigationSteps: [...record.investigationSteps, operation.step],
32
+ updatedAt: appliedAt,
33
+ };
34
+ case "status": {
35
+ const currentIndex = CHALLENGE_RECORD_STATUS_ORDER.indexOf(record.status);
36
+ const nextIndex = CHALLENGE_RECORD_STATUS_ORDER.indexOf(operation.status);
37
+ if (nextIndex <= currentIndex) {
38
+ throw new ConflictError(`Challenge Record '${record.challengeRecordId}' status cannot move from ` +
39
+ `'${record.status}' to '${operation.status}' -- status only ever moves forward ` +
40
+ "(open -> investigating -> resolved), never backward or in place. A challenge " +
41
+ "believed resolved that needs reopening should become a new ChallengeRecord " +
42
+ "linked via 'supersedes', not a status change on this one.");
43
+ }
44
+ return { ...record, status: operation.status, updatedAt: appliedAt };
45
+ }
46
+ case "finding": {
47
+ if (record.finding !== undefined) {
48
+ throw new ConflictError(`Challenge Record '${record.challengeRecordId}' already has a finding recorded ` +
49
+ `('${record.finding.outcome}') -- finding is immutable once set. A correction ` +
50
+ "should become a new ChallengeRecord linked via 'supersedes', not an edit here.");
51
+ }
52
+ return { ...record, finding: operation.finding, updatedAt: appliedAt };
53
+ }
54
+ case "outcome": {
55
+ if (record.outcome !== undefined) {
56
+ throw new ConflictError(`Challenge Record '${record.challengeRecordId}' already has an outcome recorded ` +
57
+ "-- outcome is immutable once set. A correction should become a new " +
58
+ "ChallengeRecord linked via 'supersedes', not an edit here.");
59
+ }
60
+ return { ...record, outcome: operation.outcome, updatedAt: appliedAt };
61
+ }
62
+ case "disclosure": {
63
+ if (record.disclosure !== undefined) {
64
+ throw new ConflictError(`Challenge Record '${record.challengeRecordId}' already has a disclosure recorded ` +
65
+ "-- disclosure is immutable once set. A correction should become a new " +
66
+ "ChallengeRecord linked via 'supersedes', not an edit here.");
67
+ }
68
+ return {
69
+ ...record,
70
+ disclosure: operation.disclosure,
71
+ updatedAt: appliedAt,
72
+ };
73
+ }
74
+ }
75
+ }
76
+ //# sourceMappingURL=challenge-record-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"challenge-record-repository.js","sourceRoot":"","sources":["../../src/repositories/challenge-record-repository.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAwDnD;;;;GAIG;AACH,MAAM,6BAA6B,GAAqC;IACtE,MAAM;IACN,eAAe;IACf,UAAU;CACX,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAuB,EACvB,SAAyC,EACzC,SAAe;IAEf,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,oBAAoB;YACvB,OAAO;gBACL,GAAG,MAAM;gBACT,kBAAkB,EAAE,CAAC,GAAG,MAAM,CAAC,kBAAkB,EAAE,SAAS,CAAC,IAAI,CAAC;gBAClE,SAAS,EAAE,SAAS;aACrB,CAAC;QAEJ,KAAK,QAAQ,EAAE,CAAC;YACd,MAAM,YAAY,GAAG,6BAA6B,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC1E,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAE1E,IAAI,SAAS,IAAI,YAAY,EAAE,CAAC;gBAC9B,MAAM,IAAI,aAAa,CACrB,qBAAqB,MAAM,CAAC,iBAAiB,4BAA4B;oBACvE,IAAI,MAAM,CAAC,MAAM,SAAS,SAAS,CAAC,MAAM,sCAAsC;oBAChF,+EAA+E;oBAC/E,6EAA6E;oBAC7E,2DAA2D,CAC9D,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;QACvE,CAAC;QAED,KAAK,SAAS,EAAE,CAAC;YACf,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACjC,MAAM,IAAI,aAAa,CACrB,qBAAqB,MAAM,CAAC,iBAAiB,mCAAmC;oBAC9E,KAAK,MAAM,CAAC,OAAO,CAAC,OAAO,oDAAoD;oBAC/E,gFAAgF,CACnF,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;QACzE,CAAC;QAED,KAAK,SAAS,EAAE,CAAC;YACf,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACjC,MAAM,IAAI,aAAa,CACrB,qBAAqB,MAAM,CAAC,iBAAiB,oCAAoC;oBAC/E,qEAAqE;oBACrE,4DAA4D,CAC/D,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;QACzE,CAAC;QAED,KAAK,YAAY,EAAE,CAAC;YAClB,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBACpC,MAAM,IAAI,aAAa,CACrB,qBAAqB,MAAM,CAAC,iBAAiB,sCAAsC;oBACjF,wEAAwE;oBACxE,4DAA4D,CAC/D,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,GAAG,MAAM;gBACT,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,SAAS,EAAE,SAAS;aACrB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { ExecutionIntent, ExecutionIntentFinalizationMode, ExecutionIntentResolution, StoredExecutionIntent } from "../domain/index.js";
2
+ export interface ExecutionIntentResolutionInput {
3
+ readonly resolution: ExecutionIntentResolution;
4
+ readonly note: string;
5
+ readonly resolvedBy?: string;
6
+ readonly resolvedAt: Date;
7
+ }
8
+ /**
9
+ * Persistence for Execution Intents (ADR-0012).
10
+ *
11
+ * `create` is the fail closed step: the runtime refuses to release an action
12
+ * if it cannot complete. The `mark*` methods only move operational status and
13
+ * never touch the signed intent. `markFinalized` must never move a
14
+ * FINALIZED intent backwards, and every `mark*` is safe to repeat.
15
+ */
16
+ export interface ExecutionIntentRepository {
17
+ create(intent: ExecutionIntent): Promise<ExecutionIntent>;
18
+ findByTransactionId(businessTransactionId: string): Promise<StoredExecutionIntent | null>;
19
+ /** PREPARED to RELEASED, saving the context needed to rebuild the record. */
20
+ markReleased(businessTransactionId: string, releasedContext: unknown, releasedAt: Date): Promise<void>;
21
+ /** Any state except FINALIZED to FINALIZED. */
22
+ markFinalized(businessTransactionId: string, trustRecordId: string, mode: ExecutionIntentFinalizationMode, finalizedAt: Date): Promise<void>;
23
+ /** PREPARED to ERRORED. */
24
+ markErrored(businessTransactionId: string, reason: string): Promise<void>;
25
+ /**
26
+ * PREPARED or ERRORED to RESOLVED. Returns true when this call moved the
27
+ * intent, and false when it was in any other state, so a caller can tell a
28
+ * lost race from a success. It never moves a RELEASED or FINALIZED intent.
29
+ */
30
+ markResolved(businessTransactionId: string, input: ExecutionIntentResolutionInput): Promise<boolean>;
31
+ /**
32
+ * Intents that are neither FINALIZED nor RESOLVED, oldest first. Used by
33
+ * operators to find released actions that have no signed Trust Record, and
34
+ * actions whose outcome nobody has reconciled yet.
35
+ */
36
+ listUnfinalized(limit: number): Promise<readonly StoredExecutionIntent[]>;
37
+ }
38
+ //# sourceMappingURL=execution-intent-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-intent-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/execution-intent-repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,+BAA+B,EAC/B,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAE/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE1D,mBAAmB,CACjB,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;IAEzC,6EAA6E;IAC7E,YAAY,CACV,qBAAqB,EAAE,MAAM,EAC7B,eAAe,EAAE,OAAO,EACxB,UAAU,EAAE,IAAI,GACf,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,+CAA+C;IAC/C,aAAa,CACX,qBAAqB,EAAE,MAAM,EAC7B,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,+BAA+B,EACrC,WAAW,EAAE,IAAI,GAChB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,2BAA2B;IAC3B,WAAW,CAAC,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1E;;;;OAIG;IACH,YAAY,CACV,qBAAqB,EAAE,MAAM,EAC7B,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,qBAAqB,EAAE,CAAC,CAAC;CAC3E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=execution-intent-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-intent-repository.js","sourceRoot":"","sources":["../../src/repositories/execution-intent-repository.ts"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ import { Execution, ExecutionTrustRecord, Override, Receipt, Verification } from "../domain/index.js";
2
+ /**
3
+ * Repository for immutable
4
+ * Execution Trust Records.
5
+ */
6
+ export interface ExecutionTrustRecordRepository {
7
+ create(record: ExecutionTrustRecord): Promise<ExecutionTrustRecord>;
8
+ findByTransactionId(businessTransactionId: string): Promise<ExecutionTrustRecord | null>;
9
+ /**
10
+ * Appends a new immutable Execution.
11
+ */
12
+ appendExecution(businessTransactionId: string, execution: Execution): Promise<void>;
13
+ /**
14
+ * @deprecated
15
+ *
16
+ * Parmana uses an append-only execution model.
17
+ *
18
+ * Execution state transitions must be represented
19
+ * by appending a new immutable Execution using
20
+ * appendExecution().
21
+ *
22
+ * This method exists only for backward
23
+ * compatibility and should not be used in new
24
+ * implementations.
25
+ */
26
+ replaceExecution(execution: Execution): Promise<void>;
27
+ /**
28
+ * Appends an immutable Override.
29
+ */
30
+ appendOverride(businessTransactionId: string, override: Override): Promise<void>;
31
+ /**
32
+ * Appends an immutable Verification.
33
+ */
34
+ appendVerification(businessTransactionId: string, verification: Verification): Promise<void>;
35
+ /**
36
+ * Appends an immutable Receipt.
37
+ */
38
+ appendReceipt(businessTransactionId: string, receipt: Receipt): Promise<void>;
39
+ /**
40
+ * Sums a numeric field of ExecutionEvidence.parameters across every
41
+ * successfully executed Execution (status COMPLETED, evidence.success
42
+ * true) whose evidence.action equals the given action and whose
43
+ * evidence.executedAt falls within [since, until).
44
+ *
45
+ * Reads only already-persisted, already-signed Execution Trust
46
+ * Record history -- no caller-supplied value influences the result.
47
+ * Added (TD-23 closure, Phase 3B) as the authoritative,
48
+ * reconciliation-grade source for cumulative authorization checks
49
+ * that previously trusted a caller-declared signal; a real-time gate
50
+ * may separately be enforced by its own atomic counter for reasons
51
+ * that gate's own callers document, but this method remains the
52
+ * ground truth to reconcile against.
53
+ *
54
+ * Optional: every pre-existing implementation of this interface
55
+ * (including the several inline test fakes across packages/runtime's
56
+ * own unit tests) must keep compiling and behaving identically
57
+ * without adding it. Only MemoryExecutionTrustRecordRepository and
58
+ * PostgresExecutionTrustRecordRepository implement it.
59
+ */
60
+ sumSuccessfulExecutionAmounts?(action: string, parameterKey: string, since: Date, until: Date): Promise<number>;
61
+ }
62
+ //# sourceMappingURL=execution-trust-record-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-trust-record-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/execution-trust-record-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,QAAQ,EACR,OAAO,EACP,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC7C,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEpE,mBAAmB,CACjB,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAExC;;OAEG;IACH,eAAe,CACb,qBAAqB,EAAE,MAAM,EAC7B,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;OAEG;IACH,cAAc,CACZ,qBAAqB,EAAE,MAAM,EAC7B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,kBAAkB,CAChB,qBAAqB,EAAE,MAAM,EAC7B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,qBAAqB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9E;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,6BAA6B,CAAC,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,IAAI,GACV,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=execution-trust-record-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-trust-record-repository.js","sourceRoot":"","sources":["../../src/repositories/execution-trust-record-repository.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import type { ExternalConnectorChange, ExternalConnectorRegistration } from "../domain/external-connector.js";
2
+ /**
3
+ * External connectors registered through maker checker, and the
4
+ * changes that register or revoke them (ADR-0013).
5
+ */
6
+ export interface ExternalConnectorRepository {
7
+ /**
8
+ * The active registration for a capability, or null.
9
+ */
10
+ findActive(capability: string): Promise<ExternalConnectorRegistration | null>;
11
+ /**
12
+ * Every registration, active and revoked.
13
+ */
14
+ listRegistrations(): Promise<readonly ExternalConnectorRegistration[]>;
15
+ /**
16
+ * Stores a new PENDING_APPROVAL change. Throws ConflictError when
17
+ * another change for the same capability is still pending.
18
+ */
19
+ createChange(change: ExternalConnectorChange): Promise<ExternalConnectorChange>;
20
+ findChange(changeId: string): Promise<ExternalConnectorChange | null>;
21
+ listChanges(status?: ExternalConnectorChange["status"]): Promise<readonly ExternalConnectorChange[]>;
22
+ /**
23
+ * Resolves a pending change to APPROVED and applies it, in one step:
24
+ * register adds an active registration, revoke marks the active one
25
+ * revoked. Throws ExternalConnectorChangeNotFoundError for an unknown
26
+ * id, and ConflictError when the change is no longer pending, the
27
+ * capability to register already has an active registration, or the
28
+ * capability to revoke has none. Nothing is written when it throws.
29
+ */
30
+ approveChange(changeId: string, approvedBy: string, at: Date): Promise<ExternalConnectorChange>;
31
+ /**
32
+ * Resolves a pending change to REJECTED. Throws as approveChange does
33
+ * for an unknown or already resolved change.
34
+ */
35
+ rejectChange(changeId: string, rejectedBy: string, rejectionReason: string, at: Date): Promise<ExternalConnectorChange>;
36
+ }
37
+ //# sourceMappingURL=external-connector-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-connector-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/external-connector-repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC,CAAC;IAE9E;;OAEG;IACH,iBAAiB,IAAI,OAAO,CAAC,SAAS,6BAA6B,EAAE,CAAC,CAAC;IAEvE;;;OAGG;IACH,YAAY,CACV,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAEpC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;IAEtE,WAAW,CACT,MAAM,CAAC,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GACzC,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC,CAAC;IAE/C;;;;;;;OAOG;IACH,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,IAAI,GACP,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAEpC;;;OAGG;IACH,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,EAAE,EAAE,IAAI,GACP,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACrC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=external-connector-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-connector-repository.js","sourceRoot":"","sources":["../../src/repositories/external-connector-repository.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ export interface HandbookDownloadLead {
2
+ readonly handbookDownloadLeadId: string;
3
+ readonly email: string;
4
+ readonly capturedAt: Date;
5
+ }
6
+ /**
7
+ * Repository for handbook download leads (docs/site/handbook/download.mdx).
8
+ *
9
+ * Deliberately write-mostly: an email address is captured before the
10
+ * PDF link unlocks, no verification email is sent, so this is a
11
+ * record of who asked, not a gate behind a confirmed inbox. See
12
+ * migration 20260916150000_add_handbook_download_leads.sql's own
13
+ * comment.
14
+ */
15
+ export interface HandbookDownloadLeadRepository {
16
+ create(lead: HandbookDownloadLead): Promise<HandbookDownloadLead>;
17
+ }
18
+ //# sourceMappingURL=handbook-download-lead-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handbook-download-lead-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/handbook-download-lead-repository.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,8BAA8B;IAC7C,MAAM,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACnE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=handbook-download-lead-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handbook-download-lead-repository.js","sourceRoot":"","sources":["../../src/repositories/handbook-download-lead-repository.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * An inbound refund decision Parmana issued (RFC-0025). Stored as issued: the signature is the
3
+ * one Parmana made over the canonical fields, so a stored record can be re-verified later.
4
+ */
5
+ export interface InboundDecisionRecord {
6
+ readonly decisionId: string;
7
+ readonly outcome: "approved" | "rejected";
8
+ readonly reason?: string;
9
+ readonly partnerId: string;
10
+ readonly paymentId: string;
11
+ readonly limitInr: number;
12
+ readonly expiresAt: string;
13
+ readonly audience: string;
14
+ readonly signature: string;
15
+ readonly issuedAt: Date;
16
+ }
17
+ /**
18
+ * Repository for inbound refund decisions (RFC-0025). Append-only: a decision is written once
19
+ * and never changed.
20
+ */
21
+ export interface InboundDecisionRepository {
22
+ /** Throws if a decision with the same decisionId already exists. */
23
+ append(record: InboundDecisionRecord): Promise<void>;
24
+ findById(decisionId: string): Promise<InboundDecisionRecord | null>;
25
+ }
26
+ /**
27
+ * A signed decision for an inbound request on any capability (RFC-0024). It is stored in the
28
+ * same table as refund decisions, in the columns added by the extension migration.
29
+ */
30
+ export interface InboundCheckRecord {
31
+ readonly decisionId: string;
32
+ readonly outcome: "approved" | "rejected";
33
+ readonly reason?: string;
34
+ readonly partnerId: string;
35
+ readonly capability: string;
36
+ readonly target?: string;
37
+ readonly amount?: number;
38
+ /** The policy that decided the request, and its version. Absent when no policy was run. */
39
+ readonly policyName?: string;
40
+ readonly policyVersion?: string;
41
+ readonly expiresAt: string;
42
+ readonly audience: string;
43
+ readonly signature: string;
44
+ readonly issuedAt: Date;
45
+ /** Who approved the request, when a verified human approval decided it (G-143). */
46
+ readonly approvedBy?: string;
47
+ readonly approvedKeyId?: string;
48
+ readonly approvalId?: string;
49
+ readonly approvedAt?: string;
50
+ }
51
+ /** An approval nonce to consume with a decision (G-143, O1). */
52
+ export interface ConsumedApprovalNonce {
53
+ readonly nonce: string;
54
+ readonly expiresAt: string;
55
+ }
56
+ /** A decision tried to use an approval that was already used. Nothing was recorded. */
57
+ export declare class ApprovalAlreadyUsedError extends Error {
58
+ readonly nonce: string;
59
+ constructor(nonce: string);
60
+ }
61
+ /** Repository for inbound checks (RFC-0024). Append-only: a decision is written once. */
62
+ export interface InboundCheckRepository {
63
+ /** Throws if a decision with the same decisionId already exists. */
64
+ append(record: InboundCheckRecord): Promise<void>;
65
+ /**
66
+ * Writes the decision and consumes the approvals it used, as one unit (G-143, O1). If any approval was
67
+ * already used, nothing is written and ApprovalAlreadyUsedError is thrown.
68
+ */
69
+ appendConsumingApprovals(record: InboundCheckRecord, approvals: readonly ConsumedApprovalNonce[]): Promise<void>;
70
+ findById(decisionId: string): Promise<InboundCheckRecord | null>;
71
+ }
72
+ //# sourceMappingURL=inbound-decision-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-decision-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/inbound-decision-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;CACrE;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,UAAU,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,uFAAuF;AACvF,qBAAa,wBAAyB,SAAQ,KAAK;aACrB,KAAK,EAAE,MAAM;IAAzC,YAA4B,KAAK,EAAE,MAAM,EAGxC;CACF;AAED,yFAAyF;AACzF,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;;OAGG;IACH,wBAAwB,CACtB,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,SAAS,qBAAqB,EAAE,GAC1C,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CAClE"}
@@ -0,0 +1,10 @@
1
+ /** A decision tried to use an approval that was already used. Nothing was recorded. */
2
+ export class ApprovalAlreadyUsedError extends Error {
3
+ nonce;
4
+ constructor(nonce) {
5
+ super("This approval has already been used.");
6
+ this.nonce = nonce;
7
+ this.name = "ApprovalAlreadyUsedError";
8
+ }
9
+ }
10
+ //# sourceMappingURL=inbound-decision-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-decision-repository.js","sourceRoot":"","sources":["../../src/repositories/inbound-decision-repository.ts"],"names":[],"mappings":"AA4DA,uFAAuF;AACvF,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IACrB,KAAK;IAAjC,YAA4B,KAAa;QACvC,KAAK,CAAC,sCAAsC,CAAC,CAAC;qBADpB,KAAK;QAE/B,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * What happened to an inbound refund after Parmana issued its decision (RFC-0025).
3
+ */
4
+ export interface InboundOutcomeRecord {
5
+ readonly decisionId: string;
6
+ readonly partnerId: string;
7
+ readonly orderId: string;
8
+ readonly paymentId: string;
9
+ readonly amountInr: number;
10
+ readonly status: "refunded" | "refused" | "error";
11
+ readonly refundId?: string;
12
+ readonly reason?: string;
13
+ readonly recordedAt: Date;
14
+ }
15
+ /**
16
+ * Append-only: one outcome per decision.
17
+ */
18
+ export interface InboundOutcomeRepository {
19
+ /** Returns false, and stores nothing, if an outcome for this decision already exists. */
20
+ append(record: InboundOutcomeRecord): Promise<boolean>;
21
+ findByDecisionId(decisionId: string): Promise<InboundOutcomeRecord | null>;
22
+ }
23
+ //# sourceMappingURL=inbound-outcome-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-outcome-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/inbound-outcome-repository.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,yFAAyF;IACzF,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvD,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CAC5E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=inbound-outcome-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound-outcome-repository.js","sourceRoot":"","sources":["../../src/repositories/inbound-outcome-repository.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ export * from "./business-transaction-repository.js";
2
+ export * from "./execution-trust-record-repository.js";
3
+ export * from "./execution-intent-repository.js";
4
+ export * from "./refusal-record-repository.js";
5
+ export * from "./challenge-record-repository.js";
6
+ export * from "./policy-repository.js";
7
+ export * from "./pending-policy-change-repository.js";
8
+ export * from "./approval-issuer-repository.js";
9
+ export * from "./caller-key-revocation-repository.js";
10
+ export * from "./external-connector-repository.js";
11
+ export * from "./business-signal-source-repository.js";
12
+ export * from "./authority-grant-repository.js";
13
+ export * from "./policy-change-approval-record-repository.js";
14
+ export * from "./handbook-download-lead-repository.js";
15
+ export * from "./inbound-decision-repository.js";
16
+ export * from "./inbound-outcome-repository.js";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,17 @@
1
+ export * from "./business-transaction-repository.js";
2
+ export * from "./execution-trust-record-repository.js";
3
+ export * from "./execution-intent-repository.js";
4
+ export * from "./refusal-record-repository.js";
5
+ export * from "./challenge-record-repository.js";
6
+ export * from "./policy-repository.js";
7
+ export * from "./pending-policy-change-repository.js";
8
+ export * from "./approval-issuer-repository.js";
9
+ export * from "./caller-key-revocation-repository.js";
10
+ export * from "./external-connector-repository.js";
11
+ export * from "./business-signal-source-repository.js";
12
+ export * from "./authority-grant-repository.js";
13
+ export * from "./policy-change-approval-record-repository.js";
14
+ export * from "./handbook-download-lead-repository.js";
15
+ export * from "./inbound-decision-repository.js";
16
+ export * from "./inbound-outcome-repository.js";
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { PendingPolicyChange, PendingPolicyChangeStatus } from "../domain/index.js";
2
+ /**
3
+ * One resolution of an existing PENDING_APPROVAL change. Exactly one
4
+ * of these per `resolve()` call -- mirrors
5
+ * ChallengeRecordAppendOperation's one-operation-at-a-time shape, for
6
+ * the same reason: every mutation should be an explicit, individually
7
+ * reviewable step.
8
+ */
9
+ export type PendingPolicyChangeResolution = {
10
+ readonly outcome: "approved";
11
+ readonly resolvedBy: string;
12
+ } | {
13
+ readonly outcome: "rejected";
14
+ readonly resolvedBy: string;
15
+ readonly rejectionReason: string;
16
+ };
17
+ /**
18
+ * Repository for Pending Policy Changes (Policy Governance,
19
+ * maker-checker).
20
+ */
21
+ export interface PendingPolicyChangeRepository {
22
+ /**
23
+ * Creates a new PENDING_APPROVAL change. Throws ConflictError if a
24
+ * PENDING_APPROVAL change already exists for the same (policyName,
25
+ * policyVersion) -- enforced by `assertNoConflictingPendingChange`
26
+ * below, which every implementation should call to keep the check
27
+ * identical across backends (same pattern
28
+ * ChallengeRecordRepository already uses for its own append-only
29
+ * invariants).
30
+ */
31
+ create(change: PendingPolicyChange): Promise<PendingPolicyChange>;
32
+ findById(pendingPolicyChangeId: string): Promise<PendingPolicyChange | null>;
33
+ /**
34
+ * The at-most-one PENDING_APPROVAL change for a given
35
+ * (policyName, policyVersion), or null if none exists.
36
+ */
37
+ findPending(policyName: string, policyVersion: string): Promise<PendingPolicyChange | null>;
38
+ /**
39
+ * Lists changes, optionally filtered by status. Omitting `status`
40
+ * returns every change regardless of lifecycle state.
41
+ */
42
+ list(status?: PendingPolicyChangeStatus): Promise<readonly PendingPolicyChange[]>;
43
+ /**
44
+ * Resolves an existing PENDING_APPROVAL change to APPROVED or
45
+ * REJECTED. Throws PendingPolicyChangeNotFoundError if no change
46
+ * exists for the given id, or ConflictError if the change is not
47
+ * currently PENDING_APPROVAL (see `applyPendingPolicyChangeResolution`,
48
+ * which every implementation should route through).
49
+ *
50
+ * Does NOT enforce maker != checker -- that check requires the
51
+ * resolving caller's own verified identity, which only the API/auth
52
+ * layer has. This method resolves whatever `resolvedBy` it is
53
+ * given.
54
+ */
55
+ resolve(pendingPolicyChangeId: string, resolution: PendingPolicyChangeResolution): Promise<PendingPolicyChange>;
56
+ }
57
+ /**
58
+ * Pure, backend-independent enforcement of the "exactly one
59
+ * PENDING_APPROVAL per (policyName, policyVersion)" invariant.
60
+ * Implementations call this with whatever PENDING_APPROVAL change (if
61
+ * any) they already found for the target (policyName, policyVersion)
62
+ * before inserting the new one.
63
+ */
64
+ export declare function assertNoConflictingPendingChange(policyName: string, policyVersion: string, existingPending: PendingPolicyChange | null): void;
65
+ /**
66
+ * Pure, backend-independent enforcement of
67
+ * PendingPolicyChangeRepository.resolve's transition rule: only a
68
+ * PENDING_APPROVAL change may be resolved, and only into a terminal
69
+ * state, exactly once.
70
+ */
71
+ export declare function applyPendingPolicyChangeResolution(existing: PendingPolicyChange, resolution: PendingPolicyChangeResolution, resolvedAt: Date): PendingPolicyChange;
72
+ //# sourceMappingURL=pending-policy-change-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-policy-change-repository.d.ts","sourceRoot":"","sources":["../../src/repositories/pending-policy-change-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,oBAAoB,CAAC;AAI5B;;;;;;GAMG;AACH,MAAM,MAAM,6BAA6B,GACrC;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC7D;IACE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC,CAAC;AAEN;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAElE,QAAQ,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IAE7E;;;OAGG;IACH,WAAW,CACT,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IAEvC;;;OAGG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,yBAAyB,GACjC,OAAO,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC;IAE3C;;;;;;;;;;;OAWG;IACH,OAAO,CACL,qBAAqB,EAAE,MAAM,EAC7B,UAAU,EAAE,6BAA6B,GACxC,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,mBAAmB,GAAG,IAAI,GAC1C,IAAI,CAWN;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,mBAAmB,EAC7B,UAAU,EAAE,6BAA6B,EACzC,UAAU,EAAE,IAAI,GACf,mBAAmB,CAwBrB"}
@@ -0,0 +1,46 @@
1
+ import { PendingPolicyChangeStatus, } from "../domain/index.js";
2
+ import { ConflictError } from "../errors/conflict-error.js";
3
+ /**
4
+ * Pure, backend-independent enforcement of the "exactly one
5
+ * PENDING_APPROVAL per (policyName, policyVersion)" invariant.
6
+ * Implementations call this with whatever PENDING_APPROVAL change (if
7
+ * any) they already found for the target (policyName, policyVersion)
8
+ * before inserting the new one.
9
+ */
10
+ export function assertNoConflictingPendingChange(policyName, policyVersion, existingPending) {
11
+ if (existingPending === null) {
12
+ return;
13
+ }
14
+ throw new ConflictError(`A PENDING_APPROVAL change already exists for policy '${policyName}' version ` +
15
+ `'${policyVersion}' (pendingPolicyChangeId '${existingPending.pendingPolicyChangeId}'). ` +
16
+ "It must be approved or rejected before a new proposal against the same policy " +
17
+ "version can be created.");
18
+ }
19
+ /**
20
+ * Pure, backend-independent enforcement of
21
+ * PendingPolicyChangeRepository.resolve's transition rule: only a
22
+ * PENDING_APPROVAL change may be resolved, and only into a terminal
23
+ * state, exactly once.
24
+ */
25
+ export function applyPendingPolicyChangeResolution(existing, resolution, resolvedAt) {
26
+ if (existing.status !== PendingPolicyChangeStatus.PENDING_APPROVAL) {
27
+ throw new ConflictError(`Pending Policy Change '${existing.pendingPolicyChangeId}' is already ` +
28
+ `'${existing.status}' -- only a PENDING_APPROVAL change can be approved or rejected.`);
29
+ }
30
+ if (resolution.outcome === "approved") {
31
+ return {
32
+ ...existing,
33
+ status: PendingPolicyChangeStatus.APPROVED,
34
+ resolvedBy: resolution.resolvedBy,
35
+ resolvedAt,
36
+ };
37
+ }
38
+ return {
39
+ ...existing,
40
+ status: PendingPolicyChangeStatus.REJECTED,
41
+ resolvedBy: resolution.resolvedBy,
42
+ resolvedAt,
43
+ rejectionReason: resolution.rejectionReason,
44
+ };
45
+ }
46
+ //# sourceMappingURL=pending-policy-change-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-policy-change-repository.js","sourceRoot":"","sources":["../../src/repositories/pending-policy-change-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAsE5D;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAC9C,UAAkB,EAClB,aAAqB,EACrB,eAA2C;IAE3C,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;QAC7B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,aAAa,CACrB,wDAAwD,UAAU,YAAY;QAC5E,IAAI,aAAa,6BAA6B,eAAe,CAAC,qBAAqB,MAAM;QACzF,gFAAgF;QAChF,yBAAyB,CAC5B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC,CAChD,QAA6B,EAC7B,UAAyC,EACzC,UAAgB;IAEhB,IAAI,QAAQ,CAAC,MAAM,KAAK,yBAAyB,CAAC,gBAAgB,EAAE,CAAC;QACnE,MAAM,IAAI,aAAa,CACrB,0BAA0B,QAAQ,CAAC,qBAAqB,eAAe;YACrE,IAAI,QAAQ,CAAC,MAAM,kEAAkE,CACxF,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACtC,OAAO;YACL,GAAG,QAAQ;YACX,MAAM,EAAE,yBAAyB,CAAC,QAAQ;YAC1C,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,UAAU;SACX,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,QAAQ;QACX,MAAM,EAAE,yBAAyB,CAAC,QAAQ;QAC1C,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,UAAU;QACV,eAAe,EAAE,UAAU,CAAC,eAAe;KAC5C,CAAC;AACJ,CAAC"}