@ddd-ts-kit/testing 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. package/README.md +549 -2
  2. package/dist/builders/buildable.d.ts +7 -0
  3. package/dist/builders/buildable.d.ts.map +1 -0
  4. package/dist/builders/buildable.js +2 -0
  5. package/dist/builders/buildable.js.map +1 -0
  6. package/dist/builders/builder.d.ts +33 -0
  7. package/dist/builders/builder.d.ts.map +1 -0
  8. package/dist/builders/builder.js +66 -0
  9. package/dist/builders/builder.js.map +1 -0
  10. package/dist/builders/defaults.d.ts +6 -0
  11. package/dist/builders/defaults.d.ts.map +1 -0
  12. package/dist/builders/defaults.js +2 -0
  13. package/dist/builders/defaults.js.map +1 -0
  14. package/dist/builders/define-builder.d.ts +14 -0
  15. package/dist/builders/define-builder.d.ts.map +1 -0
  16. package/dist/builders/define-builder.js +10 -0
  17. package/dist/builders/define-builder.js.map +1 -0
  18. package/dist/builders/generic-builder.d.ts +16 -0
  19. package/dist/builders/generic-builder.d.ts.map +1 -0
  20. package/dist/builders/generic-builder.js +23 -0
  21. package/dist/builders/generic-builder.js.map +1 -0
  22. package/dist/builders/is-resolvable.d.ts +3 -0
  23. package/dist/builders/is-resolvable.d.ts.map +1 -0
  24. package/dist/builders/is-resolvable.js +5 -0
  25. package/dist/builders/is-resolvable.js.map +1 -0
  26. package/dist/builders/lazy.d.ts +4 -0
  27. package/dist/builders/lazy.d.ts.map +1 -0
  28. package/dist/builders/lazy.js +15 -0
  29. package/dist/builders/lazy.js.map +1 -0
  30. package/dist/builders/resolvable.d.ts +6 -0
  31. package/dist/builders/resolvable.d.ts.map +1 -0
  32. package/dist/builders/resolvable.js +2 -0
  33. package/dist/builders/resolvable.js.map +1 -0
  34. package/dist/builders/resolve.d.ts +4 -0
  35. package/dist/builders/resolve.d.ts.map +1 -0
  36. package/dist/builders/resolve.js +7 -0
  37. package/dist/builders/resolve.js.map +1 -0
  38. package/dist/builders/sequence.d.ts +10 -0
  39. package/dist/builders/sequence.d.ts.map +1 -0
  40. package/dist/builders/sequence.js +14 -0
  41. package/dist/builders/sequence.js.map +1 -0
  42. package/dist/contracts/awaitable.d.ts +2 -0
  43. package/dist/contracts/awaitable.d.ts.map +1 -0
  44. package/dist/contracts/awaitable.js +2 -0
  45. package/dist/contracts/awaitable.js.map +1 -0
  46. package/dist/contracts/cache-contract.d.ts +13 -0
  47. package/dist/contracts/cache-contract.d.ts.map +1 -0
  48. package/dist/contracts/cache-contract.js +81 -0
  49. package/dist/contracts/cache-contract.js.map +1 -0
  50. package/dist/contracts/contract-runner.d.ts +16 -0
  51. package/dist/contracts/contract-runner.d.ts.map +1 -0
  52. package/dist/contracts/contract-runner.js +2 -0
  53. package/dist/contracts/contract-runner.js.map +1 -0
  54. package/dist/contracts/contract-suite.d.ts +23 -0
  55. package/dist/contracts/contract-suite.d.ts.map +1 -0
  56. package/dist/contracts/contract-suite.js +39 -0
  57. package/dist/contracts/contract-suite.js.map +1 -0
  58. package/dist/contracts/criteria/criteria-case.d.ts +11 -0
  59. package/dist/contracts/criteria/criteria-case.d.ts.map +1 -0
  60. package/dist/contracts/criteria/criteria-case.js +2 -0
  61. package/dist/contracts/criteria/criteria-case.js.map +1 -0
  62. package/dist/contracts/criteria/criteria-contract-definition.d.ts +5 -0
  63. package/dist/contracts/criteria/criteria-contract-definition.d.ts.map +1 -0
  64. package/dist/contracts/criteria/criteria-contract-definition.js +20 -0
  65. package/dist/contracts/criteria/criteria-contract-definition.js.map +1 -0
  66. package/dist/contracts/criteria/criteria-contract-row.d.ts +15 -0
  67. package/dist/contracts/criteria/criteria-contract-row.d.ts.map +1 -0
  68. package/dist/contracts/criteria/criteria-contract-row.js +2 -0
  69. package/dist/contracts/criteria/criteria-contract-row.js.map +1 -0
  70. package/dist/contracts/criteria/criteria-contract-rows.d.ts +9 -0
  71. package/dist/contracts/criteria/criteria-contract-rows.d.ts.map +1 -0
  72. package/dist/contracts/criteria/criteria-contract-rows.js +55 -0
  73. package/dist/contracts/criteria/criteria-contract-rows.js.map +1 -0
  74. package/dist/contracts/criteria/group-cases.d.ts +4 -0
  75. package/dist/contracts/criteria/group-cases.d.ts.map +1 -0
  76. package/dist/contracts/criteria/group-cases.js +96 -0
  77. package/dist/contracts/criteria/group-cases.js.map +1 -0
  78. package/dist/contracts/criteria/operator-cases.d.ts +4 -0
  79. package/dist/contracts/criteria/operator-cases.d.ts.map +1 -0
  80. package/dist/contracts/criteria/operator-cases.js +122 -0
  81. package/dist/contracts/criteria/operator-cases.js.map +1 -0
  82. package/dist/contracts/criteria/scope-cases.d.ts +4 -0
  83. package/dist/contracts/criteria/scope-cases.d.ts.map +1 -0
  84. package/dist/contracts/criteria/scope-cases.js +73 -0
  85. package/dist/contracts/criteria/scope-cases.js.map +1 -0
  86. package/dist/contracts/criteria/sort-cases.d.ts +4 -0
  87. package/dist/contracts/criteria/sort-cases.d.ts.map +1 -0
  88. package/dist/contracts/criteria/sort-cases.js +54 -0
  89. package/dist/contracts/criteria/sort-cases.js.map +1 -0
  90. package/dist/contracts/criteria-contract.d.ts +20 -0
  91. package/dist/contracts/criteria-contract.d.ts.map +1 -0
  92. package/dist/contracts/criteria-contract.js +94 -0
  93. package/dist/contracts/criteria-contract.js.map +1 -0
  94. package/dist/contracts/event-bus-contract.d.ts +23 -0
  95. package/dist/contracts/event-bus-contract.d.ts.map +1 -0
  96. package/dist/contracts/event-bus-contract.js +122 -0
  97. package/dist/contracts/event-bus-contract.js.map +1 -0
  98. package/dist/contracts/failure-of.d.ts +3 -0
  99. package/dist/contracts/failure-of.d.ts.map +1 -0
  100. package/dist/contracts/failure-of.js +12 -0
  101. package/dist/contracts/failure-of.js.map +1 -0
  102. package/dist/contracts/full-envelope.d.ts +4 -0
  103. package/dist/contracts/full-envelope.d.ts.map +1 -0
  104. package/dist/contracts/full-envelope.js +12 -0
  105. package/dist/contracts/full-envelope.js.map +1 -0
  106. package/dist/contracts/job-scheduler-contract.d.ts +21 -0
  107. package/dist/contracts/job-scheduler-contract.d.ts.map +1 -0
  108. package/dist/contracts/job-scheduler-contract.js +181 -0
  109. package/dist/contracts/job-scheduler-contract.js.map +1 -0
  110. package/dist/contracts/lock-contract.d.ts +13 -0
  111. package/dist/contracts/lock-contract.d.ts.map +1 -0
  112. package/dist/contracts/lock-contract.js +90 -0
  113. package/dist/contracts/lock-contract.js.map +1 -0
  114. package/dist/contracts/logger/create-logger.d.ts +6 -0
  115. package/dist/contracts/logger/create-logger.d.ts.map +1 -0
  116. package/dist/contracts/logger/create-logger.js +2 -0
  117. package/dist/contracts/logger/create-logger.js.map +1 -0
  118. package/dist/contracts/logger/error-outline-of.d.ts +12 -0
  119. package/dist/contracts/logger/error-outline-of.d.ts.map +1 -0
  120. package/dist/contracts/logger/error-outline-of.js +27 -0
  121. package/dist/contracts/logger/error-outline-of.js.map +1 -0
  122. package/dist/contracts/logger/logged-line.d.ts +9 -0
  123. package/dist/contracts/logger/logged-line.d.ts.map +1 -0
  124. package/dist/contracts/logger/logged-line.js +2 -0
  125. package/dist/contracts/logger/logged-line.js.map +1 -0
  126. package/dist/contracts/logger/logger-contract-setup.d.ts +11 -0
  127. package/dist/contracts/logger/logger-contract-setup.d.ts.map +1 -0
  128. package/dist/contracts/logger/logger-contract-setup.js +2 -0
  129. package/dist/contracts/logger/logger-contract-setup.js.map +1 -0
  130. package/dist/contracts/logger/logger-entries-suite.d.ts +19 -0
  131. package/dist/contracts/logger/logger-entries-suite.d.ts.map +1 -0
  132. package/dist/contracts/logger/logger-entries-suite.js +177 -0
  133. package/dist/contracts/logger/logger-entries-suite.js.map +1 -0
  134. package/dist/contracts/logger/logger-shutdown-suite.d.ts +15 -0
  135. package/dist/contracts/logger/logger-shutdown-suite.d.ts.map +1 -0
  136. package/dist/contracts/logger/logger-shutdown-suite.js +98 -0
  137. package/dist/contracts/logger/logger-shutdown-suite.js.map +1 -0
  138. package/dist/contracts/logger/logger-under-contract.d.ts +9 -0
  139. package/dist/contracts/logger/logger-under-contract.d.ts.map +1 -0
  140. package/dist/contracts/logger/logger-under-contract.js +2 -0
  141. package/dist/contracts/logger/logger-under-contract.js.map +1 -0
  142. package/dist/contracts/logger/unreadable-total.d.ts +5 -0
  143. package/dist/contracts/logger/unreadable-total.d.ts.map +1 -0
  144. package/dist/contracts/logger/unreadable-total.js +9 -0
  145. package/dist/contracts/logger/unreadable-total.js.map +1 -0
  146. package/dist/contracts/logger-contract.d.ts +14 -0
  147. package/dist/contracts/logger-contract.d.ts.map +1 -0
  148. package/dist/contracts/logger-contract.js +12 -0
  149. package/dist/contracts/logger-contract.js.map +1 -0
  150. package/dist/contracts/outbox-store-contract.d.ts +36 -0
  151. package/dist/contracts/outbox-store-contract.d.ts.map +1 -0
  152. package/dist/contracts/outbox-store-contract.js +148 -0
  153. package/dist/contracts/outbox-store-contract.js.map +1 -0
  154. package/dist/contracts/processed-event-store-contract.d.ts +11 -0
  155. package/dist/contracts/processed-event-store-contract.d.ts.map +1 -0
  156. package/dist/contracts/processed-event-store-contract.js +40 -0
  157. package/dist/contracts/processed-event-store-contract.js.map +1 -0
  158. package/dist/contracts/rate-limiter-contract.d.ts +13 -0
  159. package/dist/contracts/rate-limiter-contract.d.ts.map +1 -0
  160. package/dist/contracts/rate-limiter-contract.js +86 -0
  161. package/dist/contracts/rate-limiter-contract.js.map +1 -0
  162. package/dist/contracts/read-model/everything.d.ts +5 -0
  163. package/dist/contracts/read-model/everything.d.ts.map +1 -0
  164. package/dist/contracts/read-model/everything.js +3 -0
  165. package/dist/contracts/read-model/everything.js.map +1 -0
  166. package/dist/contracts/read-model/read-model-store-suite.d.ts +14 -0
  167. package/dist/contracts/read-model/read-model-store-suite.d.ts.map +1 -0
  168. package/dist/contracts/read-model/read-model-store-suite.js +23 -0
  169. package/dist/contracts/read-model/read-model-store-suite.js.map +1 -0
  170. package/dist/contracts/read-model/read-model-store-under-contract.d.ts +11 -0
  171. package/dist/contracts/read-model/read-model-store-under-contract.d.ts.map +1 -0
  172. package/dist/contracts/read-model/read-model-store-under-contract.js +2 -0
  173. package/dist/contracts/read-model/read-model-store-under-contract.js.map +1 -0
  174. package/dist/contracts/read-model/rebuild-suite.d.ts +14 -0
  175. package/dist/contracts/read-model/rebuild-suite.d.ts.map +1 -0
  176. package/dist/contracts/read-model/rebuild-suite.js +116 -0
  177. package/dist/contracts/read-model/rebuild-suite.js.map +1 -0
  178. package/dist/contracts/read-model/row-of.d.ts +4 -0
  179. package/dist/contracts/read-model/row-of.d.ts.map +1 -0
  180. package/dist/contracts/read-model/row-of.js +10 -0
  181. package/dist/contracts/read-model/row-of.js.map +1 -0
  182. package/dist/contracts/read-model/rows-suite.d.ts +11 -0
  183. package/dist/contracts/read-model/rows-suite.d.ts.map +1 -0
  184. package/dist/contracts/read-model/rows-suite.js +122 -0
  185. package/dist/contracts/read-model/rows-suite.js.map +1 -0
  186. package/dist/contracts/read-model/source-of-truth.d.ts +17 -0
  187. package/dist/contracts/read-model/source-of-truth.d.ts.map +1 -0
  188. package/dist/contracts/read-model/source-of-truth.js +36 -0
  189. package/dist/contracts/read-model/source-of-truth.js.map +1 -0
  190. package/dist/contracts/read-model/stamped-at.d.ts +4 -0
  191. package/dist/contracts/read-model/stamped-at.d.ts.map +1 -0
  192. package/dist/contracts/read-model/stamped-at.js +5 -0
  193. package/dist/contracts/read-model/stamped-at.js.map +1 -0
  194. package/dist/contracts/read-model-store-contract.d.ts +15 -0
  195. package/dist/contracts/read-model-store-contract.d.ts.map +1 -0
  196. package/dist/contracts/read-model-store-contract.js +13 -0
  197. package/dist/contracts/read-model-store-contract.js.map +1 -0
  198. package/dist/contracts/repository-contract.d.ts +18 -0
  199. package/dist/contracts/repository-contract.d.ts.map +1 -0
  200. package/dist/contracts/repository-contract.js +103 -0
  201. package/dist/contracts/repository-contract.js.map +1 -0
  202. package/dist/contracts/unit-of-work/after-commit-suite.d.ts +12 -0
  203. package/dist/contracts/unit-of-work/after-commit-suite.d.ts.map +1 -0
  204. package/dist/contracts/unit-of-work/after-commit-suite.js +79 -0
  205. package/dist/contracts/unit-of-work/after-commit-suite.js.map +1 -0
  206. package/dist/contracts/unit-of-work/dispatch-suite.d.ts +14 -0
  207. package/dist/contracts/unit-of-work/dispatch-suite.d.ts.map +1 -0
  208. package/dist/contracts/unit-of-work/dispatch-suite.js +171 -0
  209. package/dist/contracts/unit-of-work/dispatch-suite.js.map +1 -0
  210. package/dist/contracts/unit-of-work/failure-suite.d.ts +17 -0
  211. package/dist/contracts/unit-of-work/failure-suite.d.ts.map +1 -0
  212. package/dist/contracts/unit-of-work/failure-suite.js +114 -0
  213. package/dist/contracts/unit-of-work/failure-suite.js.map +1 -0
  214. package/dist/contracts/unit-of-work/parcel.d.ts +11 -0
  215. package/dist/contracts/unit-of-work/parcel.d.ts.map +1 -0
  216. package/dist/contracts/unit-of-work/parcel.js +22 -0
  217. package/dist/contracts/unit-of-work/parcel.js.map +1 -0
  218. package/dist/contracts/unit-of-work/parcels.d.ts +10 -0
  219. package/dist/contracts/unit-of-work/parcels.d.ts.map +1 -0
  220. package/dist/contracts/unit-of-work/parcels.js +14 -0
  221. package/dist/contracts/unit-of-work/parcels.js.map +1 -0
  222. package/dist/contracts/unit-of-work/shipping-bench.d.ts +25 -0
  223. package/dist/contracts/unit-of-work/shipping-bench.d.ts.map +1 -0
  224. package/dist/contracts/unit-of-work/shipping-bench.js +58 -0
  225. package/dist/contracts/unit-of-work/shipping-bench.js.map +1 -0
  226. package/dist/contracts/unit-of-work/unit-of-work-under-contract.d.ts +22 -0
  227. package/dist/contracts/unit-of-work/unit-of-work-under-contract.d.ts.map +1 -0
  228. package/dist/contracts/unit-of-work/unit-of-work-under-contract.js +2 -0
  229. package/dist/contracts/unit-of-work/unit-of-work-under-contract.js.map +1 -0
  230. package/dist/contracts/unit-of-work-contract.d.ts +19 -0
  231. package/dist/contracts/unit-of-work-contract.d.ts.map +1 -0
  232. package/dist/contracts/unit-of-work-contract.js +19 -0
  233. package/dist/contracts/unit-of-work-contract.js.map +1 -0
  234. package/dist/contracts.d.ts +27 -0
  235. package/dist/contracts.d.ts.map +1 -0
  236. package/dist/contracts.js +17 -0
  237. package/dist/contracts.js.map +1 -0
  238. package/dist/coverage/affected-contexts.d.ts +7 -0
  239. package/dist/coverage/affected-contexts.d.ts.map +1 -0
  240. package/dist/coverage/affected-contexts.js +15 -0
  241. package/dist/coverage/affected-contexts.js.map +1 -0
  242. package/dist/coverage/contexts-in.d.ts +3 -0
  243. package/dist/coverage/contexts-in.d.ts.map +1 -0
  244. package/dist/coverage/contexts-in.js +13 -0
  245. package/dist/coverage/contexts-in.js.map +1 -0
  246. package/dist/coverage/coverage-layer.d.ts +4 -0
  247. package/dist/coverage/coverage-layer.d.ts.map +1 -0
  248. package/dist/coverage/coverage-layer.js +2 -0
  249. package/dist/coverage/coverage-layer.js.map +1 -0
  250. package/dist/coverage/coverage-rates.d.ts +8 -0
  251. package/dist/coverage/coverage-rates.d.ts.map +1 -0
  252. package/dist/coverage/coverage-rates.js +2 -0
  253. package/dist/coverage/coverage-rates.js.map +1 -0
  254. package/dist/coverage/governed-coverage.d.ts +23 -0
  255. package/dist/coverage/governed-coverage.d.ts.map +1 -0
  256. package/dist/coverage/governed-coverage.js +27 -0
  257. package/dist/coverage/governed-coverage.js.map +1 -0
  258. package/dist/coverage/governed-jest-coverage.d.ts +18 -0
  259. package/dist/coverage/governed-jest-coverage.d.ts.map +1 -0
  260. package/dist/coverage/governed-jest-coverage.js +23 -0
  261. package/dist/coverage/governed-jest-coverage.js.map +1 -0
  262. package/dist/coverage/governed-settings.d.ts +13 -0
  263. package/dist/coverage/governed-settings.d.ts.map +1 -0
  264. package/dist/coverage/governed-settings.js +49 -0
  265. package/dist/coverage/governed-settings.js.map +1 -0
  266. package/dist/coverage/held-layers.d.ts +17 -0
  267. package/dist/coverage/held-layers.d.ts.map +1 -0
  268. package/dist/coverage/held-layers.js +30 -0
  269. package/dist/coverage/held-layers.js.map +1 -0
  270. package/dist/coverage/measured-files.d.ts +4 -0
  271. package/dist/coverage/measured-files.d.ts.map +1 -0
  272. package/dist/coverage/measured-files.js +7 -0
  273. package/dist/coverage/measured-files.js.map +1 -0
  274. package/dist/coverage/measured-layers.d.ts +8 -0
  275. package/dist/coverage/measured-layers.d.ts.map +1 -0
  276. package/dist/coverage/measured-layers.js +14 -0
  277. package/dist/coverage/measured-layers.js.map +1 -0
  278. package/dist/coverage/reference-coverage.d.ts +33 -0
  279. package/dist/coverage/reference-coverage.d.ts.map +1 -0
  280. package/dist/coverage/reference-coverage.js +13 -0
  281. package/dist/coverage/reference-coverage.js.map +1 -0
  282. package/dist/coverage/unaffected-contexts.d.ts +10 -0
  283. package/dist/coverage/unaffected-contexts.d.ts.map +1 -0
  284. package/dist/coverage/unaffected-contexts.js +23 -0
  285. package/dist/coverage/unaffected-contexts.js.map +1 -0
  286. package/dist/coverage.d.ts +7 -0
  287. package/dist/coverage.d.ts.map +1 -0
  288. package/dist/coverage.js +5 -0
  289. package/dist/coverage.js.map +1 -0
  290. package/dist/e2e/collect-events.d.ts +9 -0
  291. package/dist/e2e/collect-events.d.ts.map +1 -0
  292. package/dist/e2e/collect-events.js +9 -0
  293. package/dist/e2e/collect-events.js.map +1 -0
  294. package/dist/e2e/create-http-client.d.ts +4 -0
  295. package/dist/e2e/create-http-client.d.ts.map +1 -0
  296. package/dist/e2e/create-http-client.js +7 -0
  297. package/dist/e2e/create-http-client.js.map +1 -0
  298. package/dist/e2e/database-reset.d.ts +8 -0
  299. package/dist/e2e/database-reset.d.ts.map +1 -0
  300. package/dist/e2e/database-reset.js +2 -0
  301. package/dist/e2e/database-reset.js.map +1 -0
  302. package/dist/e2e/event-recorder.d.ts +12 -0
  303. package/dist/e2e/event-recorder.d.ts.map +1 -0
  304. package/dist/e2e/event-recorder.js +2 -0
  305. package/dist/e2e/event-recorder.js.map +1 -0
  306. package/dist/e2e/event-type.d.ts +5 -0
  307. package/dist/e2e/event-type.d.ts.map +1 -0
  308. package/dist/e2e/event-type.js +2 -0
  309. package/dist/e2e/event-type.js.map +1 -0
  310. package/dist/e2e/eventually.d.ts +13 -0
  311. package/dist/e2e/eventually.d.ts.map +1 -0
  312. package/dist/e2e/eventually.js +27 -0
  313. package/dist/e2e/eventually.js.map +1 -0
  314. package/dist/e2e/expect-problem.d.ts +13 -0
  315. package/dist/e2e/expect-problem.d.ts.map +1 -0
  316. package/dist/e2e/expect-problem.js +27 -0
  317. package/dist/e2e/expect-problem.js.map +1 -0
  318. package/dist/e2e/expect-status.d.ts +7 -0
  319. package/dist/e2e/expect-status.d.ts.map +1 -0
  320. package/dist/e2e/expect-status.js +18 -0
  321. package/dist/e2e/expect-status.js.map +1 -0
  322. package/dist/e2e/fetch-client.d.ts +18 -0
  323. package/dist/e2e/fetch-client.d.ts.map +1 -0
  324. package/dist/e2e/fetch-client.js +56 -0
  325. package/dist/e2e/fetch-client.js.map +1 -0
  326. package/dist/e2e/http-client.d.ts +17 -0
  327. package/dist/e2e/http-client.d.ts.map +1 -0
  328. package/dist/e2e/http-client.js +2 -0
  329. package/dist/e2e/http-client.js.map +1 -0
  330. package/dist/e2e/http-headers.d.ts +2 -0
  331. package/dist/e2e/http-headers.d.ts.map +1 -0
  332. package/dist/e2e/http-headers.js +2 -0
  333. package/dist/e2e/http-headers.js.map +1 -0
  334. package/dist/e2e/http-response.d.ts +9 -0
  335. package/dist/e2e/http-response.d.ts.map +1 -0
  336. package/dist/e2e/http-response.js +2 -0
  337. package/dist/e2e/http-response.js.map +1 -0
  338. package/dist/e2e/listen-on-random-port.d.ts +13 -0
  339. package/dist/e2e/listen-on-random-port.d.ts.map +1 -0
  340. package/dist/e2e/listen-on-random-port.js +21 -0
  341. package/dist/e2e/listen-on-random-port.js.map +1 -0
  342. package/dist/e2e/lower-cased.d.ts +3 -0
  343. package/dist/e2e/lower-cased.d.ts.map +1 -0
  344. package/dist/e2e/lower-cased.js +6 -0
  345. package/dist/e2e/lower-cased.js.map +1 -0
  346. package/dist/e2e/request-options.d.ts +6 -0
  347. package/dist/e2e/request-options.d.ts.map +1 -0
  348. package/dist/e2e/request-options.js +2 -0
  349. package/dist/e2e/request-options.js.map +1 -0
  350. package/dist/e2e/running-server.d.ts +6 -0
  351. package/dist/e2e/running-server.d.ts.map +1 -0
  352. package/dist/e2e/running-server.js +2 -0
  353. package/dist/e2e/running-server.js.map +1 -0
  354. package/dist/e2e/start-test-server.d.ts +18 -0
  355. package/dist/e2e/start-test-server.d.ts.map +1 -0
  356. package/dist/e2e/start-test-server.js +14 -0
  357. package/dist/e2e/start-test-server.js.map +1 -0
  358. package/dist/e2e/subscribed-recorder.d.ts +17 -0
  359. package/dist/e2e/subscribed-recorder.d.ts.map +1 -0
  360. package/dist/e2e/subscribed-recorder.js +45 -0
  361. package/dist/e2e/subscribed-recorder.js.map +1 -0
  362. package/dist/e2e/without-trailing-slashes.d.ts +3 -0
  363. package/dist/e2e/without-trailing-slashes.d.ts.map +1 -0
  364. package/dist/e2e/without-trailing-slashes.js +9 -0
  365. package/dist/e2e/without-trailing-slashes.js.map +1 -0
  366. package/dist/e2e.d.ts +16 -0
  367. package/dist/e2e.d.ts.map +1 -0
  368. package/dist/e2e.js +8 -0
  369. package/dist/e2e.js.map +1 -0
  370. package/dist/execution/a-session.d.ts +4 -0
  371. package/dist/execution/a-session.d.ts.map +1 -0
  372. package/dist/execution/a-session.js +7 -0
  373. package/dist/execution/a-session.js.map +1 -0
  374. package/dist/execution/a-test-user.d.ts +4 -0
  375. package/dist/execution/a-test-user.d.ts.map +1 -0
  376. package/dist/execution/a-test-user.js +9 -0
  377. package/dist/execution/a-test-user.js.map +1 -0
  378. package/dist/execution/an-execution-context.d.ts +4 -0
  379. package/dist/execution/an-execution-context.d.ts.map +1 -0
  380. package/dist/execution/an-execution-context.js +7 -0
  381. package/dist/execution/an-execution-context.js.map +1 -0
  382. package/dist/execution/execution-context-builder.d.ts +37 -0
  383. package/dist/execution/execution-context-builder.d.ts.map +1 -0
  384. package/dist/execution/execution-context-builder.js +67 -0
  385. package/dist/execution/execution-context-builder.js.map +1 -0
  386. package/dist/execution/scoped.d.ts +8 -0
  387. package/dist/execution/scoped.d.ts.map +1 -0
  388. package/dist/execution/scoped.js +9 -0
  389. package/dist/execution/scoped.js.map +1 -0
  390. package/dist/execution/session-builder.d.ts +37 -0
  391. package/dist/execution/session-builder.d.ts.map +1 -0
  392. package/dist/execution/session-builder.js +71 -0
  393. package/dist/execution/session-builder.js.map +1 -0
  394. package/dist/faker/create-data-generator.d.ts +15 -0
  395. package/dist/faker/create-data-generator.d.ts.map +1 -0
  396. package/dist/faker/create-data-generator.js +24 -0
  397. package/dist/faker/create-data-generator.js.map +1 -0
  398. package/dist/faker/current-data-generator.d.ts +9 -0
  399. package/dist/faker/current-data-generator.d.ts.map +1 -0
  400. package/dist/faker/current-data-generator.js +16 -0
  401. package/dist/faker/current-data-generator.js.map +1 -0
  402. package/dist/faker/data-generator.d.ts +9 -0
  403. package/dist/faker/data-generator.d.ts.map +1 -0
  404. package/dist/faker/data-generator.js +2 -0
  405. package/dist/faker/data-generator.js.map +1 -0
  406. package/dist/faker/generated.d.ts +8 -0
  407. package/dist/faker/generated.d.ts.map +1 -0
  408. package/dist/faker/generated.js +10 -0
  409. package/dist/faker/generated.js.map +1 -0
  410. package/dist/faker/replay-hint.d.ts +2 -0
  411. package/dist/faker/replay-hint.d.ts.map +1 -0
  412. package/dist/faker/replay-hint.js +4 -0
  413. package/dist/faker/replay-hint.js.map +1 -0
  414. package/dist/faker/report-seed-on-failure.d.ts +11 -0
  415. package/dist/faker/report-seed-on-failure.d.ts.map +1 -0
  416. package/dist/faker/report-seed-on-failure.js +12 -0
  417. package/dist/faker/report-seed-on-failure.js.map +1 -0
  418. package/dist/faker.d.ts +7 -0
  419. package/dist/faker.d.ts.map +1 -0
  420. package/dist/faker.js +6 -0
  421. package/dist/faker.js.map +1 -0
  422. package/dist/harness/create-test-buses.d.ts +49 -0
  423. package/dist/harness/create-test-buses.d.ts.map +1 -0
  424. package/dist/harness/create-test-buses.js +35 -0
  425. package/dist/harness/create-test-buses.js.map +1 -0
  426. package/dist/index.d.ts +27 -0
  427. package/dist/index.d.ts.map +1 -0
  428. package/dist/index.js +19 -0
  429. package/dist/index.js.map +1 -0
  430. package/dist/repositories/in-memory-repository.d.ts +30 -0
  431. package/dist/repositories/in-memory-repository.d.ts.map +1 -0
  432. package/dist/repositories/in-memory-repository.js +58 -0
  433. package/dist/repositories/in-memory-repository.js.map +1 -0
  434. package/dist/repositories/snapshot-codec.d.ts +6 -0
  435. package/dist/repositories/snapshot-codec.d.ts.map +1 -0
  436. package/dist/repositories/snapshot-codec.js +2 -0
  437. package/dist/repositories/snapshot-codec.js.map +1 -0
  438. package/dist/repositories/snapshots.d.ts +5 -0
  439. package/dist/repositories/snapshots.d.ts.map +1 -0
  440. package/dist/repositories/snapshots.js +9 -0
  441. package/dist/repositories/snapshots.js.map +1 -0
  442. package/dist/scenarios/act.d.ts +5 -0
  443. package/dist/scenarios/act.d.ts.map +1 -0
  444. package/dist/scenarios/act.js +21 -0
  445. package/dist/scenarios/act.js.map +1 -0
  446. package/dist/scenarios/async-outcome.d.ts +5 -0
  447. package/dist/scenarios/async-outcome.d.ts.map +1 -0
  448. package/dist/scenarios/async-outcome.js +2 -0
  449. package/dist/scenarios/async-outcome.js.map +1 -0
  450. package/dist/scenarios/async-scenario.d.ts +5 -0
  451. package/dist/scenarios/async-scenario.d.ts.map +1 -0
  452. package/dist/scenarios/async-scenario.js +2 -0
  453. package/dist/scenarios/async-scenario.js.map +1 -0
  454. package/dist/scenarios/deferred-outcome.d.ts +18 -0
  455. package/dist/scenarios/deferred-outcome.d.ts.map +1 -0
  456. package/dist/scenarios/deferred-outcome.js +34 -0
  457. package/dist/scenarios/deferred-outcome.js.map +1 -0
  458. package/dist/scenarios/describe-event.d.ts +3 -0
  459. package/dist/scenarios/describe-event.d.ts.map +1 -0
  460. package/dist/scenarios/describe-event.js +6 -0
  461. package/dist/scenarios/describe-event.js.map +1 -0
  462. package/dist/scenarios/error-class.d.ts +2 -0
  463. package/dist/scenarios/error-class.d.ts.map +1 -0
  464. package/dist/scenarios/error-class.js +2 -0
  465. package/dist/scenarios/error-class.js.map +1 -0
  466. package/dist/scenarios/event-matcher.d.ts +11 -0
  467. package/dist/scenarios/event-matcher.d.ts.map +1 -0
  468. package/dist/scenarios/event-matcher.js +2 -0
  469. package/dist/scenarios/event-matcher.js.map +1 -0
  470. package/dist/scenarios/event-mismatches.d.ts +5 -0
  471. package/dist/scenarios/event-mismatches.d.ts.map +1 -0
  472. package/dist/scenarios/event-mismatches.js +33 -0
  473. package/dist/scenarios/event-mismatches.js.map +1 -0
  474. package/dist/scenarios/event-source.d.ts +6 -0
  475. package/dist/scenarios/event-source.d.ts.map +1 -0
  476. package/dist/scenarios/event-source.js +2 -0
  477. package/dist/scenarios/event-source.js.map +1 -0
  478. package/dist/scenarios/given.d.ts +9 -0
  479. package/dist/scenarios/given.d.ts.map +1 -0
  480. package/dist/scenarios/given.js +10 -0
  481. package/dist/scenarios/given.js.map +1 -0
  482. package/dist/scenarios/immediate-outcome.d.ts +18 -0
  483. package/dist/scenarios/immediate-outcome.d.ts.map +1 -0
  484. package/dist/scenarios/immediate-outcome.js +147 -0
  485. package/dist/scenarios/immediate-outcome.js.map +1 -0
  486. package/dist/scenarios/is-promise-like.d.ts +2 -0
  487. package/dist/scenarios/is-promise-like.d.ts.map +1 -0
  488. package/dist/scenarios/is-promise-like.js +4 -0
  489. package/dist/scenarios/is-promise-like.js.map +1 -0
  490. package/dist/scenarios/outcome.d.ts +17 -0
  491. package/dist/scenarios/outcome.d.ts.map +1 -0
  492. package/dist/scenarios/outcome.js +2 -0
  493. package/dist/scenarios/outcome.js.map +1 -0
  494. package/dist/scenarios/recorded.d.ts +10 -0
  495. package/dist/scenarios/recorded.d.ts.map +1 -0
  496. package/dist/scenarios/recorded.js +2 -0
  497. package/dist/scenarios/recorded.js.map +1 -0
  498. package/dist/scenarios/scenario.d.ts +18 -0
  499. package/dist/scenarios/scenario.d.ts.map +1 -0
  500. package/dist/scenarios/scenario.js +17 -0
  501. package/dist/scenarios/scenario.js.map +1 -0
  502. package/dist/scenarios/show.d.ts +3 -0
  503. package/dist/scenarios/show.d.ts.map +1 -0
  504. package/dist/scenarios/show.js +6 -0
  505. package/dist/scenarios/show.js.map +1 -0
  506. package/dist/secrecy/expect-no-secret.d.ts +9 -0
  507. package/dist/secrecy/expect-no-secret.d.ts.map +1 -0
  508. package/dist/secrecy/expect-no-secret.js +55 -0
  509. package/dist/secrecy/expect-no-secret.js.map +1 -0
  510. package/dist/vitest/compiler-script.d.ts +3 -0
  511. package/dist/vitest/compiler-script.d.ts.map +1 -0
  512. package/dist/vitest/compiler-script.js +18 -0
  513. package/dist/vitest/compiler-script.js.map +1 -0
  514. package/dist/vitest/decorator-compiler.d.ts +21 -0
  515. package/dist/vitest/decorator-compiler.d.ts.map +1 -0
  516. package/dist/vitest/decorator-compiler.js +112 -0
  517. package/dist/vitest/decorator-compiler.js.map +1 -0
  518. package/dist/vitest/decorator-coverage.d.ts +27 -0
  519. package/dist/vitest/decorator-coverage.d.ts.map +1 -0
  520. package/dist/vitest/decorator-coverage.js +41 -0
  521. package/dist/vitest/decorator-coverage.js.map +1 -0
  522. package/dist/vitest/decorators.d.ts +41 -0
  523. package/dist/vitest/decorators.d.ts.map +1 -0
  524. package/dist/vitest/decorators.js +49 -0
  525. package/dist/vitest/decorators.js.map +1 -0
  526. package/dist/vitest/is-record.d.ts +2 -0
  527. package/dist/vitest/is-record.d.ts.map +1 -0
  528. package/dist/vitest/is-record.js +4 -0
  529. package/dist/vitest/is-record.js.map +1 -0
  530. package/dist/vitest/project-options.d.ts +3 -0
  531. package/dist/vitest/project-options.d.ts.map +1 -0
  532. package/dist/vitest/project-options.js +2 -0
  533. package/dist/vitest/project-options.js.map +1 -0
  534. package/dist/vitest/single-file-project.d.ts +3 -0
  535. package/dist/vitest/single-file-project.d.ts.map +1 -0
  536. package/dist/vitest/single-file-project.js +26 -0
  537. package/dist/vitest/single-file-project.js.map +1 -0
  538. package/dist/vitest/source-map-of.d.ts +3 -0
  539. package/dist/vitest/source-map-of.d.ts.map +1 -0
  540. package/dist/vitest/source-map-of.js +14 -0
  541. package/dist/vitest/source-map-of.js.map +1 -0
  542. package/dist/vitest.d.ts +3 -0
  543. package/dist/vitest.d.ts.map +1 -0
  544. package/dist/vitest.js +3 -0
  545. package/dist/vitest.js.map +1 -0
  546. package/package.json +62 -4
@@ -0,0 +1,116 @@
1
+ import { ProjectionRebuild } from '@ddd-ts-kit/kernel';
2
+ import { ReadModelStoreSuite } from './read-model-store-suite.js';
3
+ import { rowOf as row } from './row-of.js';
4
+ import { SourceOfTruth } from './source-of-truth.js';
5
+ import { stampedAt as at } from './stamped-at.js';
6
+ /** A rebuild from the source of truth that loses no event, whatever happens while it runs. */
7
+ export class RebuildSuite extends ReadModelStoreSuite {
8
+ tests() {
9
+ this.closesAfterEach();
10
+ this.rebuilds();
11
+ this.rebuildsUnderEvents();
12
+ this.appliesAfterTheSwap();
13
+ this.rebuildsAroundDeletions();
14
+ this.survivesARebuild();
15
+ }
16
+ rebuilds() {
17
+ this.it('rebuilds from the source alone: wrong rows are corrected, rows the source does not hold are gone', async () => {
18
+ const source = this.sourceOf(['a1', 'a3', 'a4', 'a5'], 2);
19
+ await this.put({ ...row('a1'), title: 'wrong' }, at('evt-1', 1));
20
+ await this.put(row('a2'), at('evt-1', 1));
21
+ const report = await this.rebuild(source);
22
+ this.expect(report).toEqual({ copied: 4, reread: 0, rounds: 0 });
23
+ this.expect(source.exportedPages).toBe(2);
24
+ this.expect(await this.ids()).toEqual(['a1', 'a3', 'a4', 'a5']);
25
+ this.expect(await this.store.get('a1')).toEqual(row('a1'));
26
+ this.expect(await this.subject.table.rebuilding()).toBe(false);
27
+ });
28
+ this.it('leaves the table as it was when the export fails', async () => {
29
+ const source = this.sourceOf(['a1', 'a3', 'a4'], 2);
30
+ source.duringExport = () => Promise.reject(new Error('the source is down'));
31
+ await this.put(row('a2'), at('evt-1', 1));
32
+ this.expect(await this.rebuild(source).then(() => 'rebuilt', () => 'failed')).toBe('failed');
33
+ this.expect(await this.ids()).toEqual(['a2']);
34
+ this.expect(await this.subject.table.rebuilding()).toBe(false);
35
+ this.expect(await this.put(row('a5'), at('evt-2', 2))).toBe('applied');
36
+ });
37
+ }
38
+ rebuildsUnderEvents() {
39
+ for (const key of ['a1', 'a5']) {
40
+ this.it(`loses no event applied while it exports, ${key === 'a1' ? 'on a row already copied' : 'on a row not copied yet'}`, async () => {
41
+ const source = this.sourceOf(['a1', 'a3', 'a4', 'a5'], 2);
42
+ const renamed = { ...row(key), title: 'renamed meanwhile' };
43
+ source.duringExport = async () => {
44
+ source.put({ key, row: renamed, stamp: at('evt-9', 9) });
45
+ await this.store.upsertIfNewer(key, at('evt-9', 9), (current) => current === undefined ? undefined : renamed);
46
+ };
47
+ const report = await this.rebuild(source);
48
+ this.expect(await this.store.get(key)).toEqual(renamed);
49
+ this.expect(source.lookups).toEqual([[key]]);
50
+ this.expect(report.reread).toBe(1);
51
+ });
52
+ }
53
+ this.it('reads the touched keys again in rounds before it holds the writers', async () => {
54
+ const source = this.sourceOf(['a1', 'a3', 'a4'], 2);
55
+ source.duringExport = async () => {
56
+ source.put({ key: 'a3', row: { ...row('a3'), seats: 9 }, stamp: at('evt-9', 9) });
57
+ await this.put({ ...row('a3'), seats: 9 }, at('evt-9', 9));
58
+ };
59
+ const { table, unitOfWork } = this.subject;
60
+ const report = await new ProjectionRebuild({ table, source, unitOfWork, settledBelow: 0 }).run();
61
+ this.expect(report).toEqual({ copied: 3, reread: 1, rounds: 1 });
62
+ this.expect((await this.store.get('a3'))?.seats).toBe(9);
63
+ });
64
+ }
65
+ appliesAfterTheSwap() {
66
+ this.it('applies after the swap what the source did not hold yet, and only that', async () => {
67
+ await this.rebuild(this.sourceOf(['a1', 'a3'], 5));
68
+ this.expect(await this.put({ ...row('a1'), title: 'already in the export' }, at('evt-4', 4))).toBe('stale');
69
+ this.expect(await this.put({ ...row('a1'), title: 'new' }, at('evt-6', 6))).toBe('applied');
70
+ this.expect((await this.store.get('a1'))?.title).toBe('new');
71
+ });
72
+ }
73
+ rebuildsAroundDeletions() {
74
+ this.it('drops a row deleted while it exports, for good', async () => {
75
+ const source = this.sourceOf(['a1', 'a3', 'a4'], 2);
76
+ await this.put(row('a1'), at('evt-1', 1));
77
+ source.duringExport = async () => {
78
+ source.remove('a1');
79
+ await this.store.delete('a1', at('evt-9', 9));
80
+ };
81
+ await this.rebuild(source);
82
+ this.expect(await this.ids()).toEqual(['a3', 'a4']);
83
+ this.expect(await this.put(row('a1'), at('evt-5', 5))).toBe('stale');
84
+ });
85
+ this.it('keeps the trace of a row deleted before it started', async () => {
86
+ await this.put(row('a2'), at('evt-1', 1));
87
+ await this.store.delete('a2', at('evt-4', 4));
88
+ await this.rebuild(this.sourceOf(['a1'], 2));
89
+ this.expect(await this.put(row('a2'), at('evt-3', 3))).toBe('stale');
90
+ this.expect(await this.put(row('a2'), at('evt-9', 9))).toBe('applied');
91
+ this.expect(await this.ids()).toEqual(['a1', 'a2']);
92
+ });
93
+ }
94
+ survivesARebuild() {
95
+ this.it('is the same table after two rebuilds: keys stay unique, rows are written and listed', async () => {
96
+ await this.rebuild(this.sourceOf(['a1', 'a3'], 2));
97
+ await this.rebuild(this.sourceOf(['a1', 'a3', 'a4'], 3));
98
+ this.expect(await this.subject.table.insert({ key: 'a4', row: row('a4'), stamp: at('evt-9', 9) })).toBe(false);
99
+ this.expect(await this.put(row('a5'), at('evt-9', 9))).toBe('applied');
100
+ this.expect(await this.ids()).toEqual(['a1', 'a3', 'a4', 'a5']);
101
+ });
102
+ }
103
+ rebuild(source) {
104
+ const { table, unitOfWork } = this.subject;
105
+ return new ProjectionRebuild({ table, source, unitOfWork }).run();
106
+ }
107
+ /** A source holding these rows of the dataset, each stamped at the minute given. */
108
+ sourceOf(keys, minute) {
109
+ const source = new SourceOfTruth();
110
+ for (const key of keys) {
111
+ source.put({ key, row: row(key), stamp: at(`evt-${String(minute)}`, minute) });
112
+ }
113
+ return source;
114
+ }
115
+ }
116
+ //# sourceMappingURL=rebuild-suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rebuild-suite.js","sourceRoot":"","sources":["../../../src/contracts/read-model/rebuild-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgC,MAAM,oBAAoB,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,SAAS,IAAI,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAIlD,8FAA8F;AAC9F,MAAM,OAAO,YAAa,SAAQ,mBAAmB;IACzC,KAAK;QACb,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAEO,QAAQ;QACd,IAAI,CAAC,EAAE,CACL,kGAAkG,EAClG,KAAK,IAAI,EAAE;YACT,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAE1D,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YACjE,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,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../criteria/criteria-contract-row.js';
2
+ /** The row of the contract dataset with this id. */
3
+ export declare function rowOf(id: string): CriteriaContractRow;
4
+ //# sourceMappingURL=row-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-of.d.ts","sourceRoot":"","sources":["../../../src/contracts/read-model/row-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAGhF,oDAAoD;AACpD,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,mBAAmB,CAQrD"}
@@ -0,0 +1,10 @@
1
+ import { criteriaContractRows } from '../criteria/criteria-contract-rows.js';
2
+ /** The row of the contract dataset with this id. */
3
+ export function rowOf(id) {
4
+ const found = criteriaContractRows().find((candidate) => candidate.id === id);
5
+ if (found === undefined) {
6
+ throw new Error(`The contract dataset holds no row ${id}`);
7
+ }
8
+ return found;
9
+ }
10
+ //# sourceMappingURL=row-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-of.js","sourceRoot":"","sources":["../../../src/contracts/read-model/row-of.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,oDAAoD;AACpD,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,MAAM,KAAK,GAAG,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAE9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { ReadModelStoreSuite } from './read-model-store-suite.js';
2
+ /** Rows that round trip, events applied once and in order, deletions that last, and searching. */
3
+ export declare class RowsSuite extends ReadModelStoreSuite {
4
+ protected tests(): void;
5
+ private keepsRows;
6
+ private appliesInOrder;
7
+ private appliesByVersion;
8
+ private deletes;
9
+ private searches;
10
+ }
11
+ //# sourceMappingURL=rows-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows-suite.d.ts","sourceRoot":"","sources":["../../../src/contracts/read-model/rows-suite.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAMlE,kGAAkG;AAClG,qBAAa,SAAU,SAAQ,mBAAmB;IAChD,SAAS,CAAC,KAAK,IAAI,IAAI,CAOtB;IAED,OAAO,CAAC,SAAS;IAgCjB,OAAO,CAAC,cAAc;IAkCtB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,OAAO;IA2Bf,OAAO,CAAC,QAAQ;CAwCjB"}
@@ -0,0 +1,122 @@
1
+ import { Criteria, cursorPage, scoped } from '@ddd-ts-kit/kernel';
2
+ import { criteriaContractRows } from '../criteria/criteria-contract-rows.js';
3
+ import { everything } from './everything.js';
4
+ import { ReadModelStoreSuite } from './read-model-store-suite.js';
5
+ import { rowOf as row } from './row-of.js';
6
+ import { stampedAt as at } from './stamped-at.js';
7
+ /** Rows that round trip, events applied once and in order, deletions that last, and searching. */
8
+ export class RowsSuite extends ReadModelStoreSuite {
9
+ tests() {
10
+ this.closesAfterEach();
11
+ this.keepsRows();
12
+ this.appliesInOrder();
13
+ this.appliesByVersion();
14
+ this.deletes();
15
+ this.searches();
16
+ }
17
+ keepsRows() {
18
+ this.it('answers nothing for a key it does not hold', async () => {
19
+ this.expect(await this.store.get('a1')).toBe(undefined);
20
+ });
21
+ this.it('gives back every row as it was written: instants, decimals, booleans and nulls', async () => {
22
+ for (const row of criteriaContractRows()) {
23
+ this.expect(await this.put(row, at('evt-1', 1))).toBe('applied');
24
+ }
25
+ for (const row of criteriaContractRows()) {
26
+ this.expect(await this.store.get(row.id)).toEqual(row);
27
+ }
28
+ });
29
+ this.it('hands the current row to the change of a later event', async () => {
30
+ await this.put(row('a1'), at('evt-1', 1));
31
+ const written = await this.store.upsertIfNewer('a1', at('evt-2', 2), (current) => current === undefined ? undefined : { ...current, seats: current.seats + 1 });
32
+ this.expect(written).toBe('applied');
33
+ this.expect(await this.store.get('a1')).toEqual({ ...row('a1'), seats: 3 });
34
+ });
35
+ this.it('writes nothing when the change answers nothing', async () => {
36
+ this.expect(await this.store.upsertIfNewer('a1', at('evt-1', 1), () => undefined)).toBe('ignored');
37
+ this.expect(await this.store.get('a1')).toBe(undefined);
38
+ });
39
+ }
40
+ appliesInOrder() {
41
+ this.it('ignores an event delivered twice', async () => {
42
+ await this.put(row('a1'), at('evt-1', 1));
43
+ this.expect(await this.put({ ...row('a1'), title: 'again' }, at('evt-1', 1))).toBe('stale');
44
+ this.expect(await this.store.get('a1')).toEqual(row('a1'));
45
+ });
46
+ this.it('ignores an event older than what the row holds', async () => {
47
+ await this.put(row('a1'), at('evt-2', 2));
48
+ this.expect(await this.put({ ...row('a1'), title: 'late' }, at('evt-1', 1))).toBe('stale');
49
+ this.expect(await this.store.get('a1')).toEqual(row('a1'));
50
+ });
51
+ this.it('orders two events of the same instant by their id, whichever comes first', async () => {
52
+ await this.put({ ...row('a1'), title: 'b' }, at('evt-b', 1));
53
+ this.expect(await this.put({ ...row('a1'), title: 'a' }, at('evt-a', 1))).toBe('stale');
54
+ this.expect(await this.put({ ...row('a1'), title: 'c' }, at('evt-c', 1))).toBe('applied');
55
+ this.expect((await this.store.get('a1'))?.title).toBe('c');
56
+ });
57
+ this.it('ends on the latest of several events applied at once', async () => {
58
+ const minutes = [3, 1, 4, 2];
59
+ await Promise.all(minutes.map((minute) => this.put({ ...row('a1'), seats: minute }, at(`evt-${String(minute)}`, minute))));
60
+ this.expect((await this.store.get('a1'))?.seats).toBe(4);
61
+ });
62
+ }
63
+ appliesByVersion() {
64
+ this.it('orders by version when both stamps carry one, whatever the clocks say', async () => {
65
+ await this.put({ ...row('a1'), title: 'v2' }, { ...at('evt-2', 5), version: 2 });
66
+ this.expect(await this.put({ ...row('a1'), title: 'v1' }, { ...at('evt-1', 9), version: 1 })).toBe('stale');
67
+ this.expect(await this.put({ ...row('a1'), title: 'v3' }, { ...at('evt-3', 1), version: 3 })).toBe('applied');
68
+ this.expect((await this.store.get('a1'))?.title).toBe('v3');
69
+ });
70
+ this.it('keeps the version with the row', async () => {
71
+ await this.put(row('a1'), { ...at('evt-1', 1), version: 7 });
72
+ this.expect((await this.subject.table.find('a1'))?.stamp).toEqual({ ...at('evt-1', 1), version: 7 });
73
+ });
74
+ }
75
+ deletes() {
76
+ this.it('removes a row, and an older event delivered late does not bring it back', async () => {
77
+ await this.put(row('a1'), at('evt-1', 1));
78
+ this.expect(await this.store.delete('a1', at('evt-3', 3))).toBe('applied');
79
+ this.expect(await this.store.get('a1')).toBe(undefined);
80
+ this.expect(await this.put(row('a1'), at('evt-2', 2))).toBe('stale');
81
+ this.expect(await this.store.get('a1')).toBe(undefined);
82
+ });
83
+ this.it('writes a row again when a later event recreates it', async () => {
84
+ await this.put(row('a1'), at('evt-1', 1));
85
+ await this.store.delete('a1', at('evt-2', 2));
86
+ this.expect(await this.put({ ...row('a1'), title: 'back' }, at('evt-3', 3))).toBe('applied');
87
+ this.expect((await this.store.get('a1'))?.title).toBe('back');
88
+ });
89
+ this.it('ignores a deletion older than the row, or of a row it never held', async () => {
90
+ await this.put(row('a1'), at('evt-2', 2));
91
+ this.expect(await this.store.delete('a1', at('evt-1', 1))).toBe('stale');
92
+ this.expect(await this.store.delete('a2', at('evt-1', 1))).toBe('ignored');
93
+ this.expect(await this.store.get('a1')).toEqual(row('a1'));
94
+ });
95
+ }
96
+ searches() {
97
+ this.it('searches by criteria, without the deleted rows', async () => {
98
+ for (const written of criteriaContractRows()) {
99
+ await this.put(written, at('evt-1', 1));
100
+ }
101
+ await this.store.delete('a8', at('evt-2', 2));
102
+ const booked = Criteria.of().where('status', 'eq', 'booked').orderBy('seats', 'desc');
103
+ const page = await this.store.search(scoped(booked, everything));
104
+ this.expect(page.items.map(({ id }) => id)).toEqual(['a7', 'a1', 'a4']);
105
+ this.expect(page.total).toBe(3);
106
+ });
107
+ this.it('pages by cursor and narrows by the scope of the actor', async () => {
108
+ for (const written of criteriaContractRows()) {
109
+ await this.put(written, at('evt-1', 1));
110
+ }
111
+ const acme = (cursor) => this.store.search(scoped(Criteria.of().page(cursorPage({ limit: 3, ...(cursor === undefined ? {} : { cursor }) })), { kind: 'filter', filter: { tenantId: 'acme' } }, { filter: { tenantId: 'tenantId' } }));
112
+ const first = await acme();
113
+ const second = await acme(first.nextCursor);
114
+ this.expect([first, second].map((page) => page.items.map(({ id }) => id))).toEqual([
115
+ ['a1', 'a2', 'a3'],
116
+ ['a6', 'a7'],
117
+ ]);
118
+ this.expect((await this.store.search(scoped(Criteria.of(), { kind: 'none' }))).items).toEqual([]);
119
+ });
120
+ }
121
+ }
122
+ //# sourceMappingURL=rows-suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows-suite.js","sourceRoot":"","sources":["../../../src/contracts/read-model/rows-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,IAAI,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAIlD,kGAAkG;AAClG,MAAM,OAAO,SAAU,SAAQ,mBAAmB;IACtC,KAAK;QACb,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,gBAAgB,E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,EAAE,UAAU,EAAE,EAAE,CACrC,CACF,CAAC;YAEJ,MAAM,KAAK,GAAG,MAAM,IAAI,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAE5C,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;gBACjF,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;gBAClB,CAAC,IAAI,EAAE,IAAI,CAAC;aACb,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzG,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import { type Page, type ReadModelSource, type StampedRow } from '@ddd-ts-kit/kernel';
2
+ /**
3
+ * The fake of the context a read model is rebuilt from: rows by key, exported two at a time,
4
+ * and counting how it was read. `duringExport` runs between two pages, which is where a test
5
+ * makes an event arrive.
6
+ */
7
+ export declare class SourceOfTruth<Row> implements ReadModelSource<Row> {
8
+ readonly lookups: string[][];
9
+ exportedPages: number;
10
+ duringExport: (page: number) => Promise<void>;
11
+ private readonly rows;
12
+ put(entry: StampedRow<Row>): void;
13
+ remove(key: string): void;
14
+ export(cursor: string | undefined): Promise<Page<StampedRow<Row>>>;
15
+ lookup(keys: readonly string[]): Promise<ReadonlyMap<string, StampedRow<Row>>>;
16
+ }
17
+ //# sourceMappingURL=source-of-truth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-of-truth.d.ts","sourceRoot":"","sources":["../../../src/contracts/read-model/source-of-truth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE9F;;;;GAIG;AACH,qBAAa,aAAa,CAAC,GAAG,CAAE,YAAW,eAAe,CAAC,GAAG,CAAC;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAM;IAElC,aAAa,SAAK;IAElB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAA2B;IAExE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsC;IAE3D,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAEhC;IAED,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAExB;IAEK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAevE;IAEK,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAUnF;CACF"}
@@ -0,0 +1,36 @@
1
+ import { pageOf } from '@ddd-ts-kit/kernel';
2
+ /**
3
+ * The fake of the context a read model is rebuilt from: rows by key, exported two at a time,
4
+ * and counting how it was read. `duringExport` runs between two pages, which is where a test
5
+ * makes an event arrive.
6
+ */
7
+ export class SourceOfTruth {
8
+ lookups = [];
9
+ exportedPages = 0;
10
+ duringExport = () => Promise.resolve();
11
+ rows = new Map();
12
+ put(entry) {
13
+ this.rows.set(entry.key, entry);
14
+ }
15
+ remove(key) {
16
+ this.rows.delete(key);
17
+ }
18
+ async export(cursor) {
19
+ if (cursor !== undefined) {
20
+ await this.duringExport(this.exportedPages);
21
+ }
22
+ const after = [...this.rows.keys()].sort().filter((key) => cursor === undefined || key > cursor);
23
+ const keys = after.slice(0, 2);
24
+ const last = keys.at(-1);
25
+ this.exportedPages += 1;
26
+ return pageOf(keys.flatMap((key) => this.rows.get(key) ?? []), after.length > 2 && last !== undefined ? { nextCursor: last } : {});
27
+ }
28
+ async lookup(keys) {
29
+ this.lookups.push([...keys]);
30
+ return new Map(keys.flatMap((key) => {
31
+ const entry = this.rows.get(key);
32
+ return entry === undefined ? [] : [[key, entry]];
33
+ }));
34
+ }
35
+ }
36
+ //# sourceMappingURL=source-of-truth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-of-truth.js","sourceRoot":"","sources":["../../../src/contracts/read-model/source-of-truth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoD,MAAM,oBAAoB,CAAC;AAE9F;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACf,OAAO,GAAe,EAAE,CAAC;IAElC,aAAa,GAAG,CAAC,CAAC;IAElB,YAAY,GAAoC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAEvD,IAAI,GAAG,IAAI,GAAG,EAA2B,CAAC;IAE3D,GAAG,CAAC,KAAsB;QACxB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAA0B;QACrC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC;QACjG,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzB,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC;QAExB,OAAO,MAAM,CACX,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAC/C,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CACnE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAuB;QAClC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAE7B,OAAO,IAAI,GAAG,CACZ,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAEjC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QACnD,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import type { EventStamp } from '@ddd-ts-kit/kernel';
2
+ /** The stamp of an event that occurred at this minute of the hour the contract plays in. */
3
+ export declare function stampedAt(eventId: string, minute: number): EventStamp;
4
+ //# sourceMappingURL=stamped-at.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stamped-at.d.ts","sourceRoot":"","sources":["../../../src/contracts/read-model/stamped-at.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,4FAA4F;AAC5F,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAErE"}
@@ -0,0 +1,5 @@
1
+ /** The stamp of an event that occurred at this minute of the hour the contract plays in. */
2
+ export function stampedAt(eventId, minute) {
3
+ return { eventId, occurredAt: new Date(Date.UTC(2026, 9, 10, 12, minute)) };
4
+ }
5
+ //# sourceMappingURL=stamped-at.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stamped-at.js","sourceRoot":"","sources":["../../../src/contracts/read-model/stamped-at.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,MAAM,UAAU,SAAS,CAAC,OAAe,EAAE,MAAc;IACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Awaitable } from './awaitable.js';
2
+ import type { ContractRunner } from './contract-runner.js';
3
+ import type { ReadModelStoreUnderContract } from './read-model/read-model-store-under-contract.js';
4
+ export interface ReadModelStoreContractOptions {
5
+ readonly name: string;
6
+ /** Called before each test. */
7
+ createTable(): Awaitable<ReadModelStoreUnderContract>;
8
+ }
9
+ /**
10
+ * What every adapter of `ReadModelTable` guarantees under `TableReadModelStore`, the
11
+ * in-memory one included: rows that round trip, events applied once and in order whatever
12
+ * the order of their delivery, deletions that last, and a rebuild that loses no event.
13
+ */
14
+ export declare function readModelStoreContract(runner: ContractRunner, options: ReadModelStoreContractOptions): void;
15
+ //# sourceMappingURL=read-model-store-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-model-store-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/read-model-store-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC;AAGnG,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,WAAW,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAK3G"}
@@ -0,0 +1,13 @@
1
+ import { RebuildSuite } from './read-model/rebuild-suite.js';
2
+ import { RowsSuite } from './read-model/rows-suite.js';
3
+ /**
4
+ * What every adapter of `ReadModelTable` guarantees under `TableReadModelStore`, the
5
+ * in-memory one included: rows that round trip, events applied once and in order whatever
6
+ * the order of their delivery, deletions that last, and a rebuild that loses no event.
7
+ */
8
+ export function readModelStoreContract(runner, options) {
9
+ const create = () => options.createTable();
10
+ new RowsSuite(runner, create).describe(`${options.name} (read model store contract: rows)`);
11
+ new RebuildSuite(runner, create).describe(`${options.name} (read model store contract: rebuild)`);
12
+ }
13
+ //# sourceMappingURL=read-model-store-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-model-store-contract.js","sourceRoot":"","sources":["../../src/contracts/read-model-store-contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAQvD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAsB,EAAE,OAAsC;IACnG,MAAM,MAAM,GAAG,GAA2C,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAEnF,IAAI,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,oCAAoC,CAAC,CAAC;IAC5F,IAAI,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,uCAAuC,CAAC,CAAC;AACpG,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { AggregateRoot, Repository } from '@ddd-ts-kit/kernel';
2
+ import type { Awaitable } from './awaitable.js';
3
+ import type { ContractRunner } from './contract-runner.js';
4
+ export interface RepositoryContractOptions<A extends AggregateRoot<Id>, Id extends string | number> {
5
+ readonly name: string;
6
+ /** A fresh, empty repository; called before each test. */
7
+ createRepository(): Awaitable<Repository<A, Id>>;
8
+ /** A new valid aggregate with an id of its own at each call. */
9
+ createAggregate(): A;
10
+ /** Any business operation that changes what `stateOf` returns. */
11
+ mutate(aggregate: A): void;
12
+ idOf(aggregate: A): Id;
13
+ /** A plain-data view of the business state (not of `version`), compared with `toEqual`. */
14
+ stateOf(aggregate: A): unknown;
15
+ }
16
+ /** What every adapter of a `Repository` port, fake or real, guarantees to the application layer. */
17
+ export declare function repositoryContract<A extends AggregateRoot<Id>, Id extends string | number = string>(runner: ContractRunner, options: RepositoryContractOptions<A, Id>): void;
18
+ //# sourceMappingURL=repository-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository-contract.d.ts","sourceRoot":"","sources":["../../src/contracts/repository-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAI3D,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,MAAM,GAAG,MAAM;IAChG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,gBAAgB,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACjD,gEAAgE;IAChE,eAAe,IAAI,CAAC,CAAC;IACrB,kEAAkE;IAClE,MAAM,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC;IACvB,2FAA2F;IAC3F,OAAO,CAAC,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC;CAChC;AAED,oGAAoG;AACpG,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EACjG,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,yBAAyB,CAAC,CAAC,EAAE,EAAE,CAAC,GACxC,IAAI,CAEN"}
@@ -0,0 +1,103 @@
1
+ import { CONCURRENCY_CONFLICT } from '@ddd-ts-kit/kernel';
2
+ import { ContractSuite } from './contract-suite.js';
3
+ import { failureOf } from './failure-of.js';
4
+ /** What every adapter of a `Repository` port, fake or real, guarantees to the application layer. */
5
+ export function repositoryContract(runner, options) {
6
+ new RepositorySuite(runner, options).describe(`${options.name} (repository contract)`);
7
+ }
8
+ class RepositorySuite extends ContractSuite {
9
+ options;
10
+ constructor(runner, options) {
11
+ super(runner, () => options.createRepository());
12
+ this.options = options;
13
+ }
14
+ tests() {
15
+ this.findsWhatWasSaved();
16
+ this.keepsAggregatesApart();
17
+ this.storesTheChangesOfLaterSaves();
18
+ this.ignoresWhatWasNotSaved();
19
+ this.refusesToOverwriteAnUnseenChange();
20
+ }
21
+ findsWhatWasSaved() {
22
+ const { options } = this;
23
+ this.it('finds a saved aggregate with the state it was saved in', async () => {
24
+ const aggregate = options.createAggregate();
25
+ await this.subject.save(aggregate);
26
+ const found = await this.reload(aggregate);
27
+ this.expect(options.idOf(found)).toBe(options.idOf(aggregate));
28
+ this.expect(options.stateOf(found)).toEqual(options.stateOf(aggregate));
29
+ });
30
+ this.it('gives undefined for an id that was never saved', async () => {
31
+ await this.subject.save(options.createAggregate());
32
+ const unknownId = options.idOf(options.createAggregate());
33
+ this.expect(await this.subject.findById(unknownId)).toBe(undefined);
34
+ });
35
+ }
36
+ keepsAggregatesApart() {
37
+ const { options } = this;
38
+ this.it('keeps aggregates apart', async () => {
39
+ const first = options.createAggregate();
40
+ const second = options.createAggregate();
41
+ options.mutate(second);
42
+ await this.subject.save(first);
43
+ await this.subject.save(second);
44
+ this.expect(options.stateOf(await this.reload(first))).toEqual(options.stateOf(first));
45
+ this.expect(options.stateOf(await this.reload(second))).toEqual(options.stateOf(second));
46
+ });
47
+ }
48
+ storesTheChangesOfLaterSaves() {
49
+ const { options } = this;
50
+ this.it('stores the changes of a loaded aggregate that is saved again', async () => {
51
+ const aggregate = options.createAggregate();
52
+ await this.subject.save(aggregate);
53
+ const loaded = await this.reload(aggregate);
54
+ options.mutate(loaded);
55
+ await this.subject.save(loaded);
56
+ this.expect(options.stateOf(await this.reload(aggregate))).toEqual(options.stateOf(loaded));
57
+ });
58
+ this.it('accepts several saves of the same instance in a row', async () => {
59
+ const aggregate = options.createAggregate();
60
+ await this.subject.save(aggregate);
61
+ options.mutate(aggregate);
62
+ await this.subject.save(aggregate);
63
+ this.expect(options.stateOf(await this.reload(aggregate))).toEqual(options.stateOf(aggregate));
64
+ });
65
+ }
66
+ ignoresWhatWasNotSaved() {
67
+ const { options } = this;
68
+ this.it('is not affected by a mutation that is not saved', async () => {
69
+ const aggregate = options.createAggregate();
70
+ // Copied: `stateOf` may hand out a live view of the aggregate about to be mutated.
71
+ const saved = structuredClone(options.stateOf(aggregate));
72
+ await this.subject.save(aggregate);
73
+ options.mutate(aggregate);
74
+ options.mutate(await this.reload(aggregate));
75
+ this.expect(options.stateOf(await this.reload(aggregate))).toEqual(saved);
76
+ });
77
+ }
78
+ refusesToOverwriteAnUnseenChange() {
79
+ const { options } = this;
80
+ this.it('refuses to overwrite a change it has not seen', async () => {
81
+ const aggregate = options.createAggregate();
82
+ await this.subject.save(aggregate);
83
+ const mine = await this.reload(aggregate);
84
+ const theirs = await this.reload(aggregate);
85
+ options.mutate(theirs);
86
+ await this.subject.save(theirs);
87
+ const failure = await failureOf(() => this.subject.save(mine));
88
+ this.expect(codeOf(failure)).toBe(CONCURRENCY_CONFLICT);
89
+ this.expect(options.stateOf(await this.reload(aggregate))).toEqual(options.stateOf(theirs));
90
+ });
91
+ }
92
+ async reload(aggregate) {
93
+ const found = await this.subject.findById(this.options.idOf(aggregate));
94
+ if (found === undefined) {
95
+ throw new Error('The saved aggregate was not found');
96
+ }
97
+ return found;
98
+ }
99
+ }
100
+ function codeOf(error) {
101
+ return typeof error === 'object' && error !== null && 'code' in error ? error.code : undefined;
102
+ }
103
+ //# sourceMappingURL=repository-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository-contract.js","sourceRoot":"","sources":["../../src/contracts/repository-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAI1D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAe5C,oGAAoG;AACpG,MAAM,UAAU,kBAAkB,CAChC,MAAsB,EACtB,OAAyC;IAEzC,IAAI,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,wBAAwB,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,eAAyE,SAAQ,aAEtF;IAGoB,OAAO;IAF1B,YACE,MAAsB,EACL,OAAyC;QAE1D,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE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GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAExE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACjG,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ContractSuite } from '../contract-suite.js';
2
+ import type { UnitOfWorkUnderContract } from './unit-of-work-under-contract.js';
3
+ /** The `after-commit` phase: after the commit, never without it, and never in the way of the caller. */
4
+ export declare class AfterCommitSuite extends ContractSuite<UnitOfWorkUnderContract> {
5
+ protected tests(): void;
6
+ private runsOnceCommitted;
7
+ /** What another connection sees where the subject has one; what the unit of work sees otherwise. */
8
+ private seenFromOutside;
9
+ private isolatesFailures;
10
+ private refusesToSave;
11
+ }
12
+ //# sourceMappingURL=after-commit-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"after-commit-suite.d.ts","sourceRoot":"","sources":["../../../src/contracts/unit-of-work/after-commit-suite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAIhF,wGAAwG;AACxG,qBAAa,gBAAiB,SAAQ,aAAa,CAAC,uBAAuB,CAAC;IAC1E,SAAS,CAAC,KAAK,IAAI,IAAI,CAQtB;IAED,OAAO,CAAC,iBAAiB;IA4BzB,oGAAoG;YACtF,eAAe;IAM7B,OAAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,aAAa;CA2BtB"}