ddd-ts-kit 0.23.1 → 0.24.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 (239) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.fr.md +42 -7
  3. package/README.md +38 -6
  4. package/dist/check/canonical/stray-entry.d.ts +8 -0
  5. package/dist/check/canonical/stray-entry.d.ts.map +1 -0
  6. package/dist/check/canonical/stray-entry.js +75 -0
  7. package/dist/check/canonical/stray-entry.js.map +1 -0
  8. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  9. package/dist/check/catalogue/architecture-rules.js +2 -0
  10. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  11. package/dist/check/catalogue/default-severities.d.ts.map +1 -1
  12. package/dist/check/catalogue/default-severities.js +1 -0
  13. package/dist/check/catalogue/default-severities.js.map +1 -1
  14. package/dist/check/explain/persistence-docs.js +1 -1
  15. package/dist/check/explain/persistence-docs.js.map +1 -1
  16. package/dist/check/explain/tree-docs.d.ts.map +1 -1
  17. package/dist/check/explain/tree-docs.js +5 -0
  18. package/dist/check/explain/tree-docs.js.map +1 -1
  19. package/dist/check/fixtures/tree-fixtures.d.ts.map +1 -1
  20. package/dist/check/fixtures/tree-fixtures.js +17 -0
  21. package/dist/check/fixtures/tree-fixtures.js.map +1 -1
  22. package/dist/check/migrations/drizzle-history-findings.js +1 -1
  23. package/dist/check/migrations/drizzle-history-findings.js.map +1 -1
  24. package/dist/check/rules/tree-closed.d.ts.map +1 -1
  25. package/dist/check/rules/tree-closed.js +4 -68
  26. package/dist/check/rules/tree-closed.js.map +1 -1
  27. package/dist/check/rules/tree-documented-paths.d.ts +3 -0
  28. package/dist/check/rules/tree-documented-paths.d.ts.map +1 -0
  29. package/dist/check/rules/tree-documented-paths.js +54 -0
  30. package/dist/check/rules/tree-documented-paths.js.map +1 -0
  31. package/dist/commands/drizzle-generate.d.ts +6 -1
  32. package/dist/commands/drizzle-generate.d.ts.map +1 -1
  33. package/dist/commands/drizzle-generate.js +39 -6
  34. package/dist/commands/drizzle-generate.js.map +1 -1
  35. package/dist/commands/plan-waves.d.ts +9 -0
  36. package/dist/commands/plan-waves.d.ts.map +1 -0
  37. package/dist/commands/plan-waves.js +36 -0
  38. package/dist/commands/plan-waves.js.map +1 -0
  39. package/dist/commands/status.d.ts +1 -0
  40. package/dist/commands/status.d.ts.map +1 -1
  41. package/dist/commands/status.js +4 -2
  42. package/dist/commands/status.js.map +1 -1
  43. package/dist/help/notes.d.ts +1 -1
  44. package/dist/help/notes.d.ts.map +1 -1
  45. package/dist/help/notes.js +19 -3
  46. package/dist/help/notes.js.map +1 -1
  47. package/dist/help/usage.d.ts +1 -1
  48. package/dist/help/usage.d.ts.map +1 -1
  49. package/dist/help/usage.js +2 -0
  50. package/dist/help/usage.js.map +1 -1
  51. package/dist/init/files/persistence-files.d.ts.map +1 -1
  52. package/dist/init/files/persistence-files.js +7 -1
  53. package/dist/init/files/persistence-files.js.map +1 -1
  54. package/dist/init/manifest/versions.js +24 -24
  55. package/dist/migration/branch-migration.d.ts +9 -0
  56. package/dist/migration/branch-migration.d.ts.map +1 -0
  57. package/dist/migration/branch-migration.js +2 -0
  58. package/dist/migration/branch-migration.js.map +1 -0
  59. package/dist/migration/branch-migrations.d.ts +16 -0
  60. package/dist/migration/branch-migrations.d.ts.map +1 -0
  61. package/dist/migration/branch-migrations.js +48 -0
  62. package/dist/migration/branch-migrations.js.map +1 -0
  63. package/dist/migration/delete-branch-migrations.d.ts +9 -0
  64. package/dist/migration/delete-branch-migrations.d.ts.map +1 -0
  65. package/dist/migration/delete-branch-migrations.js +23 -0
  66. package/dist/migration/delete-branch-migrations.js.map +1 -0
  67. package/dist/migration/drizzle-run.d.ts +7 -0
  68. package/dist/migration/drizzle-run.d.ts.map +1 -0
  69. package/dist/migration/drizzle-run.js +2 -0
  70. package/dist/migration/drizzle-run.js.map +1 -0
  71. package/dist/migration/drizzle-silent-failures.js +1 -1
  72. package/dist/migration/drizzle-silent-failures.js.map +1 -1
  73. package/dist/migration/find-project-formatter.d.ts +8 -0
  74. package/dist/migration/find-project-formatter.d.ts.map +1 -0
  75. package/dist/migration/find-project-formatter.js +52 -0
  76. package/dist/migration/find-project-formatter.js.map +1 -0
  77. package/dist/migration/format-written-files.d.ts +9 -0
  78. package/dist/migration/format-written-files.d.ts.map +1 -0
  79. package/dist/migration/format-written-files.js +32 -0
  80. package/dist/migration/format-written-files.js.map +1 -0
  81. package/dist/migration/generate-and-read.d.ts +6 -0
  82. package/dist/migration/generate-and-read.d.ts.map +1 -0
  83. package/dist/migration/generate-and-read.js +14 -0
  84. package/dist/migration/generate-and-read.js.map +1 -0
  85. package/dist/migration/index.d.ts +4 -0
  86. package/dist/migration/index.d.ts.map +1 -1
  87. package/dist/migration/index.js +4 -0
  88. package/dist/migration/index.js.map +1 -1
  89. package/dist/migration/known-primary-keys.d.ts +3 -0
  90. package/dist/migration/known-primary-keys.d.ts.map +1 -0
  91. package/dist/migration/known-primary-keys.js +2 -0
  92. package/dist/migration/known-primary-keys.js.map +1 -0
  93. package/dist/migration/migration-files.d.ts +7 -0
  94. package/dist/migration/migration-files.d.ts.map +1 -0
  95. package/dist/migration/migration-files.js +29 -0
  96. package/dist/migration/migration-files.js.map +1 -0
  97. package/dist/migration/plan-replay.d.ts +9 -0
  98. package/dist/migration/plan-replay.d.ts.map +1 -0
  99. package/dist/migration/plan-replay.js +68 -0
  100. package/dist/migration/plan-replay.js.map +1 -0
  101. package/dist/migration/previous-primary-keys.d.ts +9 -0
  102. package/dist/migration/previous-primary-keys.d.ts.map +1 -0
  103. package/dist/migration/previous-primary-keys.js +55 -0
  104. package/dist/migration/previous-primary-keys.js.map +1 -0
  105. package/dist/migration/primary-key-order-finding.d.ts +12 -0
  106. package/dist/migration/primary-key-order-finding.d.ts.map +1 -0
  107. package/dist/migration/primary-key-order-finding.js +2 -0
  108. package/dist/migration/primary-key-order-finding.js.map +1 -0
  109. package/dist/migration/primary-key-order-findings.d.ts +12 -0
  110. package/dist/migration/primary-key-order-findings.d.ts.map +1 -0
  111. package/dist/migration/primary-key-order-findings.js +55 -0
  112. package/dist/migration/primary-key-order-findings.js.map +1 -0
  113. package/dist/migration/project-formatter.d.ts +9 -0
  114. package/dist/migration/project-formatter.d.ts.map +1 -0
  115. package/dist/migration/project-formatter.js +2 -0
  116. package/dist/migration/project-formatter.js.map +1 -0
  117. package/dist/migration/replay-drizzle-migrations.d.ts +15 -0
  118. package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -0
  119. package/dist/migration/replay-drizzle-migrations.js +63 -0
  120. package/dist/migration/replay-drizzle-migrations.js.map +1 -0
  121. package/dist/migration/replay-plan.d.ts +11 -0
  122. package/dist/migration/replay-plan.d.ts.map +1 -0
  123. package/dist/migration/replay-plan.js +2 -0
  124. package/dist/migration/replay-plan.js.map +1 -0
  125. package/dist/migration/replayed-name.d.ts +7 -0
  126. package/dist/migration/replayed-name.d.ts.map +1 -0
  127. package/dist/migration/replayed-name.js +12 -0
  128. package/dist/migration/replayed-name.js.map +1 -0
  129. package/dist/migration/sql-statement.d.ts +6 -0
  130. package/dist/migration/sql-statement.d.ts.map +1 -0
  131. package/dist/migration/sql-statement.js +2 -0
  132. package/dist/migration/sql-statement.js.map +1 -0
  133. package/dist/migration/sql-statements.d.ts +4 -0
  134. package/dist/migration/sql-statements.d.ts.map +1 -0
  135. package/dist/migration/sql-statements.js +36 -0
  136. package/dist/migration/sql-statements.js.map +1 -0
  137. package/dist/migration/table-change.d.ts +12 -0
  138. package/dist/migration/table-change.d.ts.map +1 -0
  139. package/dist/migration/table-change.js +2 -0
  140. package/dist/migration/table-change.js.map +1 -0
  141. package/dist/migration/table-changes.d.ts +9 -0
  142. package/dist/migration/table-changes.d.ts.map +1 -0
  143. package/dist/migration/table-changes.js +55 -0
  144. package/dist/migration/table-changes.js.map +1 -0
  145. package/dist/migration/tidy-written-migration.d.ts +5 -0
  146. package/dist/migration/tidy-written-migration.d.ts.map +1 -0
  147. package/dist/migration/tidy-written-migration.js +8 -0
  148. package/dist/migration/tidy-written-migration.js.map +1 -0
  149. package/dist/migration/wait-for-next-second.d.ts +6 -0
  150. package/dist/migration/wait-for-next-second.d.ts.map +1 -0
  151. package/dist/migration/wait-for-next-second.js +11 -0
  152. package/dist/migration/wait-for-next-second.js.map +1 -0
  153. package/dist/migration/warn-primary-key-order.d.ts +5 -0
  154. package/dist/migration/warn-primary-key-order.d.ts.map +1 -0
  155. package/dist/migration/warn-primary-key-order.js +16 -0
  156. package/dist/migration/warn-primary-key-order.js.map +1 -0
  157. package/dist/migration/written-migration.d.ts +9 -0
  158. package/dist/migration/written-migration.d.ts.map +1 -0
  159. package/dist/migration/written-migration.js +2 -0
  160. package/dist/migration/written-migration.js.map +1 -0
  161. package/dist/migration/written-paths.d.ts +3 -0
  162. package/dist/migration/written-paths.d.ts.map +1 -0
  163. package/dist/migration/written-paths.js +5 -0
  164. package/dist/migration/written-paths.js.map +1 -0
  165. package/dist/plan/aggregates-of.d.ts +6 -0
  166. package/dist/plan/aggregates-of.d.ts.map +1 -0
  167. package/dist/plan/aggregates-of.js +13 -0
  168. package/dist/plan/aggregates-of.js.map +1 -0
  169. package/dist/plan/batched-waves.d.ts +18 -0
  170. package/dist/plan/batched-waves.d.ts.map +1 -0
  171. package/dist/plan/batched-waves.js +73 -0
  172. package/dist/plan/batched-waves.js.map +1 -0
  173. package/dist/plan/cycles-of.d.ts +8 -0
  174. package/dist/plan/cycles-of.d.ts.map +1 -0
  175. package/dist/plan/cycles-of.js +30 -0
  176. package/dist/plan/cycles-of.js.map +1 -0
  177. package/dist/plan/format-plan.d.ts +4 -0
  178. package/dist/plan/format-plan.d.ts.map +1 -0
  179. package/dist/plan/format-plan.js +53 -0
  180. package/dist/plan/format-plan.js.map +1 -0
  181. package/dist/plan/merge-order.d.ts +8 -0
  182. package/dist/plan/merge-order.d.ts.map +1 -0
  183. package/dist/plan/merge-order.js +32 -0
  184. package/dist/plan/merge-order.js.map +1 -0
  185. package/dist/plan/plan-problems.d.ts +8 -0
  186. package/dist/plan/plan-problems.d.ts.map +1 -0
  187. package/dist/plan/plan-problems.js +57 -0
  188. package/dist/plan/plan-problems.js.map +1 -0
  189. package/dist/plan/plan-waves.d.ts +16 -0
  190. package/dist/plan/plan-waves.d.ts.map +1 -0
  191. package/dist/plan/plan-waves.js +23 -0
  192. package/dist/plan/plan-waves.js.map +1 -0
  193. package/dist/plan/rows-to-plan.d.ts +7 -0
  194. package/dist/plan/rows-to-plan.d.ts.map +1 -0
  195. package/dist/plan/rows-to-plan.js +19 -0
  196. package/dist/plan/rows-to-plan.js.map +1 -0
  197. package/dist/plan/wave-numbers.d.ts +8 -0
  198. package/dist/plan/wave-numbers.d.ts.map +1 -0
  199. package/dist/plan/wave-numbers.js +27 -0
  200. package/dist/plan/wave-numbers.js.map +1 -0
  201. package/dist/plan/wave-plan.d.ts +48 -0
  202. package/dist/plan/wave-plan.d.ts.map +1 -0
  203. package/dist/plan/wave-plan.js +2 -0
  204. package/dist/plan/wave-plan.js.map +1 -0
  205. package/dist/progress/format-progress.d.ts.map +1 -1
  206. package/dist/progress/format-progress.js +16 -1
  207. package/dist/progress/format-progress.js.map +1 -1
  208. package/dist/progress/progress.d.ts +11 -1
  209. package/dist/progress/progress.d.ts.map +1 -1
  210. package/dist/progress/read-progress.d.ts +6 -2
  211. package/dist/progress/read-progress.d.ts.map +1 -1
  212. package/dist/progress/read-progress.js +10 -5
  213. package/dist/progress/read-progress.js.map +1 -1
  214. package/dist/progress/status-row-of.d.ts +16 -0
  215. package/dist/progress/status-row-of.d.ts.map +1 -0
  216. package/dist/progress/status-row-of.js +23 -0
  217. package/dist/progress/status-row-of.js.map +1 -0
  218. package/dist/run.d.ts.map +1 -1
  219. package/dist/run.js +2 -0
  220. package/dist/run.js.map +1 -1
  221. package/dist/version.d.ts +1 -1
  222. package/dist/version.js +1 -1
  223. package/dist/worker/rows-on-branches.d.ts +8 -0
  224. package/dist/worker/rows-on-branches.d.ts.map +1 -0
  225. package/dist/worker/rows-on-branches.js +9 -0
  226. package/dist/worker/rows-on-branches.js.map +1 -0
  227. package/package.json +2 -2
  228. package/templates/e2e/e2e.spec.ts.tpl +2 -2
  229. package/templates/init/e2e/start-application.database.ts.tpl +30 -1
  230. package/templates/init/e2e/start-application.memory.ts.tpl +30 -1
  231. package/templates/init/e2e/vitest.e2e.config.ts.tpl +4 -0
  232. package/templates/init/platform/database/open-test-database.drizzle.ts.tpl +18 -1
  233. package/templates/init/platform/database/open-test-database.knex.ts.tpl +18 -1
  234. package/templates/init/platform/database/open-test-database.prisma.ts.tpl +18 -1
  235. package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +18 -1
  236. package/templates/init/platform/database/test-database-template.ts.tpl +23 -0
  237. package/templates/init/rules/tests.md.tpl +1 -1
  238. package/templates/pipeline/package-scripts.json +1 -1
  239. package/templates/pipeline/vitest.config.ts.tpl +6 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave-plan.d.ts","sourceRoot":"","sources":["../../src/plan/wave-plan.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,sGAAsG;IACtG,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,GAAG,UAAU,GAAG,cAAc,CAAC;IAC5E,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,8HAA8H;AAC9H,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;CACpC;AAED,kEAAkE;AAClE,MAAM,WAAW,KAAK;IACpB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAC;IACrC,mHAAmH;IACnH,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,uHAAuH;IACvH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,gHAAgH;IAChH,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,gHAAgH;IAChH,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=wave-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wave-plan.js","sourceRoot":"","sources":["../../src/plan/wave-plan.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"format-progress.d.ts","sourceRoot":"","sources":["../../src/progress/format-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,eAAe,CAAC;AAS9E,8HAA8H;AAC9H,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAWzD"}
1
+ {"version":3,"file":"format-progress.d.ts","sourceRoot":"","sources":["../../src/progress/format-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA6C,MAAM,eAAe,CAAC;AAQzF,8HAA8H;AAC9H,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAWzD"}
@@ -48,7 +48,22 @@ function counts(byStatus, statuses) {
48
48
  }
49
49
  function rowLine(row) {
50
50
  const waits = row.dependsOn.length > 0 ? `, depends on ${row.dependsOn.join(', ')}` : '';
51
- return ` #${row.id} ${row.context} ${row.kind} "${row.slice}" (owner ${row.owner}${waits})`;
51
+ return ` #${row.id} ${row.context} ${row.kind} "${row.slice}" (owner ${row.owner}${waits})${readyText(row)}`;
52
+ }
53
+ /** Whether the row can start: on the trunk, once the branches holding its dependencies merge, or later. */
54
+ function readyText(row) {
55
+ const waiting = row.waitingFor ?? [];
56
+ const ids = waiting.map((id) => `#${id}`).join(', ');
57
+ switch (row.ready) {
58
+ case 'trunk':
59
+ return ': ready on the trunk';
60
+ case 'branch':
61
+ return `: ready on a branch, once ${ids} ${waiting.length === 1 ? 'merges' : 'merge'}`;
62
+ case 'waiting':
63
+ return `: waits for ${ids}`;
64
+ default:
65
+ return '';
66
+ }
52
67
  }
53
68
  function remainingLine(count) {
54
69
  return ` ${count.context === '' ? 'outside the contexts' : count.context}: ${count.domain} TODO(domain), ${count.platform} TODO(platform), ${count.test} it.todo, ${count.review} TODO(review)`;
@@ -1 +1 @@
1
- {"version":3,"file":"format-progress.js","sourceRoot":"","sources":["../../src/progress/format-progress.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,8EAA8E;A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;YACV,OAAO,sBAAsB,CAAC;QAChC,KAAK,QAAQ;YACX,OAAO,6BAA6B,GAAG,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QACzF,KAAK,SAAS;YACZ,OAAO,eAAe,GAAG,EAAE,CAAC;QAC9B;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAqB;IAC1C,OAAO,KAAK,KAAK,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,MAAM,kBAAkB,KAAK,CAAC,QAAQ,oBAAoB,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,MAAM,eAAe,CAAC;AACnM,CAAC"}
@@ -10,7 +10,7 @@ export interface Progress {
10
10
  }
11
11
  export interface SlicesProgress {
12
12
  readonly file: string;
13
- readonly rows: readonly Slice[];
13
+ readonly rows: readonly StatusRow[];
14
14
  /** The ids of the rows, by status. */
15
15
  readonly byStatus: Readonly<Record<string, readonly string[]>>;
16
16
  /** The ids of the rows, by owner then by status. */
@@ -20,6 +20,16 @@ export interface SlicesProgress {
20
20
  /** The ids that are a bare number, without the code of their story or milestone (`12`, not `US5.12`). */
21
21
  readonly unscoped: readonly string[];
22
22
  }
23
+ /** A row of the slices table; one not done says whether it can start, and what it waits for. */
24
+ export interface StatusRow extends Slice {
25
+ /**
26
+ * Left out on a done row. `trunk`: every dependency is done. `branch`: each one not done is a
27
+ * row briefed to a worker whose branch has commits its base does not have. `waiting` otherwise.
28
+ */
29
+ readonly ready?: 'trunk' | 'branch' | 'waiting';
30
+ /** The dependencies not done, in the order of the row; left out on a done row. */
31
+ readonly waitingFor?: readonly string[];
32
+ }
23
33
  export interface RemainingCount {
24
34
  readonly context: string;
25
35
  /** `TODO(domain)` markers. */
@@ -1 +1 @@
1
- {"version":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AE,MAAM,CAAC;IACzB,8BAA8B;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
@@ -1,6 +1,10 @@
1
1
  import type { Config } from '../config/index.js';
2
2
  import type { Workspace } from '../workspace/index.js';
3
3
  import type { Progress } from './progress.js';
4
- /** What `status` says, read from the plan, the slices table and the markers of the tree; a missing file is not an error. */
5
- export declare function readProgress(ws: Workspace, config: Config): Progress;
4
+ /**
5
+ * What `status` says, read from the plan, the slices table and the markers of the tree; a missing
6
+ * file is not an error. `onBranches` holds the ids of the rows on a worker's branch with commits
7
+ * ahead of its base, which a row not done may wait for.
8
+ */
9
+ export declare function readProgress(ws: Workspace, config: Config, onBranches: ReadonlySet<string>): Progress;
6
10
  //# sourceMappingURL=read-progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read-progress.d.ts","sourceRoot":"","sources":["../../src/progress/read-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,eAAe,CAAC;AAQ9E,4HAA4H;AAC5H,wBAAgB,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAQpE"}
1
+ {"version":3,"file":"read-progress.d.ts","sourceRoot":"","sources":["../../src/progress/read-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,eAAe,CAAC;AAS9E;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,QAAQ,CAQrG"}
@@ -1,20 +1,25 @@
1
1
  import { readRemaining } from './read-remaining.js';
2
2
  import { readSlices, SLICES_FILE } from './read-slices.js';
3
+ import { statusRowOf } from './status-row-of.js';
3
4
  const PLAN_FILE = 'docs/architecture/plan.md';
4
- /** What `status` says, read from the plan, the slices table and the markers of the tree; a missing file is not an error. */
5
- export function readProgress(ws, config) {
5
+ /**
6
+ * What `status` says, read from the plan, the slices table and the markers of the tree; a missing
7
+ * file is not an error. `onBranches` holds the ids of the rows on a worker's branch with commits
8
+ * ahead of its base, which a row not done may wait for.
9
+ */
10
+ export function readProgress(ws, config, onBranches) {
6
11
  const slices = readSlices(ws);
7
12
  return {
8
13
  next: /^Next:[ \t]*(\S.*?)\s*$/m.exec(ws.read(PLAN_FILE) ?? '')?.[1] ?? null,
9
- slices: slices === undefined ? null : slicesProgress(slices),
14
+ slices: slices === undefined ? null : slicesProgress(slices, onBranches),
10
15
  remaining: countsOf(readRemaining(ws, config), Object.keys(config.contexts)),
11
16
  };
12
17
  }
13
- function slicesProgress(rows) {
18
+ function slicesProgress(rows, onBranches) {
14
19
  const owners = [...new Set(rows.map((row) => row.owner))].sort();
15
20
  return {
16
21
  file: SLICES_FILE,
17
- rows,
22
+ rows: rows.map((row) => statusRowOf(row, { rows, onBranches })),
18
23
  byStatus: idsByStatus(rows),
19
24
  byOwner: Object.fromEntries(owners.map((owner) => [owner, idsByStatus(rows.filter((row) => row.owner === owner))])),
20
25
  duplicates: [...new Set(rows.map((row) => row.id).filter((id, index, ids) => ids.indexOf(id) !== index))],
@@ -1 +1 @@
1
- {"version":3,"file":"read-progress.js","sourceRoot":"","sources":["../../src/progress/read-progress.ts"],"names":[],"mappings":"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RowsAround {
5
+ /** Every row of the slices file. */
6
+ readonly rows: readonly Slice[];
7
+ /** The ids of the rows briefed to a worker whose branch has commits its base does not have. */
8
+ readonly onBranches: ReadonlySet<string>;
9
+ }
10
+ /**
11
+ * A row with whether it can start: on the trunk when every dependency is done, on a branch when
12
+ * each one not done is on its way there, else waiting. A dependency is done when the rows that
13
+ * carry its id are all done; an id no row carries is never done. A done row is left as it is.
14
+ */
15
+ export declare function statusRowOf(row: Slice, around: RowsAround): StatusRow;
16
+ //# sourceMappingURL=status-row-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-row-of.d.ts","sourceRoot":"","sources":["../../src/progress/status-row-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,kCAAkC;AAClC,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,KAAK,EAAE,CAAC;IAChC,+FAA+F;IAC/F,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,CAcrE"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A row with whether it can start: on the trunk when every dependency is done, on a branch when
3
+ * each one not done is on its way there, else waiting. A dependency is done when the rows that
4
+ * carry its id are all done; an id no row carries is never done. A done row is left as it is.
5
+ */
6
+ export function statusRowOf(row, around) {
7
+ if (row.status === 'done') {
8
+ return row;
9
+ }
10
+ const isDone = (id) => {
11
+ const carrying = around.rows.filter((other) => other.id === id);
12
+ return carrying.length > 0 && carrying.every((other) => other.status === 'done');
13
+ };
14
+ const waitingFor = row.dependsOn.filter((id) => !isDone(id));
15
+ return { ...row, ready: readyOf(waitingFor, around.onBranches), waitingFor };
16
+ }
17
+ function readyOf(waitingFor, onBranches) {
18
+ if (waitingFor.length === 0) {
19
+ return 'trunk';
20
+ }
21
+ return waitingFor.every((id) => onBranches.has(id)) ? 'branch' : 'waiting';
22
+ }
23
+ //# sourceMappingURL=status-row-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-row-of.js","sourceRoot":"","sources":["../../src/progress/status-row-of.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAU,EAAE,MAAkB;IACxD,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,MAAM,GAAG,CAAC,EAAU,EAAW,EAAE;QACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAEhE,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;IACnF,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAE7D,OAAO,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC;AAC/E,CAAC;AAED,SAAS,OAAO,CAAC,UAA6B,EAAE,UAA+B;IAC7E,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC"}
package/dist/run.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AA0D3C,wBAAgB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,GAAE,EAAc,GAAG,MAAM,CAkCvE"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AA4D3C,wBAAgB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,GAAE,EAAc,GAAG,MAAM,CAkCvE"}
package/dist/run.js CHANGED
@@ -12,6 +12,7 @@ import { errorFactoriesCommand } from './commands/error-factories.js';
12
12
  import { generateCommand } from './commands/generate.js';
13
13
  import { initCommand } from './commands/init.js';
14
14
  import { listCommand } from './commands/list.js';
15
+ import { planWavesCommand } from './commands/plan-waves.js';
15
16
  import { sdkCommand } from './commands/sdk.js';
16
17
  import { statusCommand } from './commands/status.js';
17
18
  import { todoCommand } from './commands/todo.js';
@@ -32,6 +33,7 @@ const COMMANDS = {
32
33
  describe: describeCommand,
33
34
  status: statusCommand,
34
35
  todo: todoCommand,
36
+ 'plan-waves': planWavesCommand,
35
37
  'worker-scope': workerScopeCommand,
36
38
  'verify-slice': verifySliceCommand,
37
39
  docs: docsCommand,
package/dist/run.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MA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/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.23.1";
1
+ export declare const VERSION = "0.24.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.23.1';
1
+ export const VERSION = '0.24.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,8 @@
1
+ import type { WorkersStatus } from './workers-status.js';
2
+ /**
3
+ * The ids of the rows briefed to a worker whose branch has commits its base does not have: they
4
+ * are on their way to the trunk. A worker without commits ahead, or whose base is unknown, has
5
+ * nothing on its way yet.
6
+ */
7
+ export declare function rowsOnBranches(status: WorkersStatus): Set<string>;
8
+ //# sourceMappingURL=rows-on-branches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows-on-branches.d.ts","sourceRoot":"","sources":["../../src/worker/rows-on-branches.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAEjE"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The ids of the rows briefed to a worker whose branch has commits its base does not have: they
3
+ * are on their way to the trunk. A worker without commits ahead, or whose base is unknown, has
4
+ * nothing on its way yet.
5
+ */
6
+ export function rowsOnBranches(status) {
7
+ return new Set(status.workers.filter((worker) => (worker.ahead ?? 0) > 0).flatMap((worker) => worker.rows ?? []));
8
+ }
9
+ //# sourceMappingURL=rows-on-branches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows-on-branches.js","sourceRoot":"","sources":["../../src/worker/rows-on-branches.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAqB;IAClD,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;AACpH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-ts-kit",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "description": "Bootstrap, scaffold and verify Domain-Driven Design (DDD), Clean Architecture and hexagonal TypeScript backends on Node.js: project and code generators, architecture checks, OpenAPI and AsyncAPI documents, for developers and AI coding agents (Claude Code, Codex, GitHub Copilot).",
5
5
  "keywords": [
6
6
  "ddd",
@@ -52,6 +52,6 @@
52
52
  "clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../s3/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
53
53
  },
54
54
  "devDependencies": {
55
- "@ddd-ts-kit/kernel": "^0.23.1"
55
+ "@ddd-ts-kit/kernel": "^0.24.0"
56
56
  }
57
57
  }
@@ -75,7 +75,7 @@ describe('{{name.title}}, end to end', () => {
75
75
  });
76
76
  {{/unless}}
77
77
 
78
- // Exact on names and structure, and kept before the tests whose request leaves work behind (a relay still publishing would add its spans here). Once "{{name.words}}" announces a fact, its spans come after the save, under `unit-of-work before-commit`: `domain-event <name>`, `handler <Class>`, `outbox append <type>`, then, awaited with `eventually`, `publish <type>` and `process <consumer>` with the command it sends.
78
+ // Exact on names and structure, and kept before the tests whose request leaves work behind (a relay still publishing would add its spans here). Once "{{name.words}}" announces a fact, its spans come after the save, under `unit-of-work before-commit`: `domain-event <name>`, `handler <Class>`, `outbox append <type>`, then, once `application.settled()` has resolved inside `traceOf`, `publish <type>` and `process <consumer>` with the command it sends.
79
79
  expectSpanTree(storyOf(trace), [
80
80
  {{e2e.tree}}
81
81
  ]);
@@ -99,7 +99,7 @@ describe('{{name.title}}, end to end', () => {
99
99
  expectStatus(response, {{e2e.status}});
100
100
  });
101
101
 
102
- // TODO(domain): replace each entry below by a test of what a client or another context observes: responses, then the integration events (`collectEvents(application.events, [...])` and `eventually(...)` for what happens after the answer). Never read the database.
102
+ // TODO(domain): replace each entry below by a test of what a client or another context observes: responses, then the integration events (`collectEvents(application.events, [...])`, asserted once `await application.settled()` has resolved, for what happens after the answer; never a fixed delay). Never read the database.
103
103
  it.todo('lets a client observe the outcome of "{{name.words}}" through the API');
104
104
  it.todo('publishes the integration events other contexts rely on');
105
105
  it.todo('answers the documented problem for each business refusal');
@@ -7,7 +7,7 @@ import { InMemoryCachePurger, PurgingPublisher, type IntegrationEventSubscriber
7
7
  {{#unless httpCache.varnish}}
8
8
  import type { IntegrationEventSubscriber } from '@ddd-ts-kit/kernel';
9
9
  {{/unless}}
10
- import { createHttpClient, type HttpClient } from '@ddd-ts-kit/testing/e2e';
10
+ import { createHttpClient, settled, type HttpClient, type SettledOptions } from '@ddd-ts-kit/testing/e2e';
11
11
  {{#if authz.rebac}}
12
12
  import { relationTuples } from '{{alias.platform}}/auth/relation-tuples{{alias.ext}}';
13
13
  {{/if}}
@@ -57,6 +57,25 @@ export interface RunningApplication {
57
57
 
58
58
  /** A client presenting the credential of `actor`; `client` itself presents none. */
59
59
  as(actor: TestActor): Promise<HttpClient>;
60
+
61
+ /**
62
+ {{#if events.outbox}}
63
+ * Resolves once the work the requests so far started has settled: every event stored in the
64
+ * outbox relayed, and the handlers it reached run, with what they stored in turn. Await it
65
+ * before asserting what happens after the answer, instead of waiting a fixed time; it fails
66
+ * after `timeoutMs` (2 seconds by default) naming what is still pending, and how much of it
67
+ * failed and waits for a retry (a handler that throws, an adapter that cannot be reached).
68
+ {{#if broker.provided}}
69
+ * With a broker server (its URL in the environment), relayed means handed to the broker: what
70
+ * its consumers do next is awaited with `collectEvents(application.events, [...]).waitFor(...)`.
71
+ {{/if}}
72
+ {{/if}}
73
+ {{#unless events.outbox}}
74
+ * Resolves once the work the requests so far started has settled. Without an outbox, events go
75
+ * out with the commit and their handlers are awaited before the answer: nothing is left then.
76
+ {{/unless}}
77
+ */
78
+ settled(options?: SettledOptions): Promise<void>;
60
79
  {{#if authz.rebac}}
61
80
 
62
81
  /** Stores a relationship, as the application does when an element is created or shared. */
@@ -91,6 +110,7 @@ export async function startApplication(): Promise<RunningApplication> {
91
110
  {{#if authz.rebac}}
92
111
  relate: (tuple) => relationTuples.write([tuple]),
93
112
  {{/if}}
113
+ settled: (options) => started.settled(options),
94
114
  reset: () => database.reset(),
95
115
  close: () => started.close(),
96
116
  };
@@ -103,6 +123,8 @@ interface Started {
103
123
  readonly purges: InMemoryCachePurger;
104
124
  {{/if}}
105
125
 
126
+ settled(options?: SettledOptions): Promise<void>;
127
+
106
128
  close(): Promise<void>;
107
129
  }
108
130
 
@@ -149,6 +171,13 @@ async function start(database: TestDatabase, config: AppConfig, credentials: Cre
149
171
  {{#if httpCache.varnish}}
150
172
  purges,
151
173
  {{/if}}
174
+ {{#if events.outbox}}
175
+ settled: (options) => settled({ outbox: () => database.persistence.outbox.stats() }, options),
176
+ {{/if}}
177
+ {{#unless events.outbox}}
178
+ // Without an outbox nothing runs after the answer: the events went out with the commit.
179
+ settled: (options) => settled({}, options),
180
+ {{/unless}}
152
181
  close: async () => {
153
182
  await server.close();
154
183
  {{#if events.outbox}}
@@ -7,7 +7,7 @@ import { InMemoryCachePurger, PurgingPublisher, type IntegrationEventSubscriber
7
7
  {{#unless httpCache.varnish}}
8
8
  import type { IntegrationEventSubscriber } from '@ddd-ts-kit/kernel';
9
9
  {{/unless}}
10
- import { createHttpClient, type HttpClient } from '@ddd-ts-kit/testing/e2e';
10
+ import { createHttpClient, settled, type HttpClient, type SettledOptions } from '@ddd-ts-kit/testing/e2e';
11
11
  {{#if authz.rebac}}
12
12
  import { relationTuples } from '{{alias.platform}}/auth/relation-tuples{{alias.ext}}';
13
13
  {{/if}}
@@ -60,6 +60,25 @@ export interface RunningApplication {
60
60
 
61
61
  /** A client presenting the credential of `actor`; `client` itself presents none. */
62
62
  as(actor: TestActor): Promise<HttpClient>;
63
+
64
+ /**
65
+ {{#if events.outbox}}
66
+ * Resolves once the work the requests so far started has settled: every event stored in the
67
+ * outbox relayed, and the handlers it reached run, with what they stored in turn. Await it
68
+ * before asserting what happens after the answer, instead of waiting a fixed time; it fails
69
+ * after `timeoutMs` (2 seconds by default) naming what is still pending, and how much of it
70
+ * failed and waits for a retry (a handler that throws, an adapter that cannot be reached).
71
+ {{#if broker.provided}}
72
+ * With a broker server (its URL in the environment), relayed means handed to the broker: what
73
+ * its consumers do next is awaited with `collectEvents(application.events, [...]).waitFor(...)`.
74
+ {{/if}}
75
+ {{/if}}
76
+ {{#unless events.outbox}}
77
+ * Resolves once the work the requests so far started has settled. Without an outbox, events go
78
+ * out with the commit and their handlers are awaited before the answer: nothing is left then.
79
+ {{/unless}}
80
+ */
81
+ settled(options?: SettledOptions): Promise<void>;
63
82
  {{#if authz.rebac}}
64
83
 
65
84
  /** Stores a relationship, as the application does when an element is created or shared. */
@@ -93,6 +112,7 @@ export async function startApplication(): Promise<RunningApplication> {
93
112
  {{#if authz.rebac}}
94
113
  relate: (tuple) => relationTuples.write([tuple]),
95
114
  {{/if}}
115
+ settled: (options) => current.settled(options),
96
116
  reset: async () => {
97
117
  await current.close();
98
118
  current = await start(credentials);
@@ -108,6 +128,8 @@ interface Started {
108
128
  readonly purges: InMemoryCachePurger;
109
129
  {{/if}}
110
130
 
131
+ settled(options?: SettledOptions): Promise<void>;
132
+
111
133
  close(): Promise<void>;
112
134
  }
113
135
 
@@ -155,6 +177,13 @@ async function start(credentials: Credentials): Promise<Started> {
155
177
  {{#if httpCache.varnish}}
156
178
  purges,
157
179
  {{/if}}
180
+ {{#if events.outbox}}
181
+ settled: (options) => settled({ outbox: () => persistence.outbox.stats() }, options),
182
+ {{/if}}
183
+ {{#unless events.outbox}}
184
+ // Without an outbox nothing runs after the answer: the events went out with the commit.
185
+ settled: (options) => settled({}, options),
186
+ {{/unless}}
158
187
  close: async () => {
159
188
  await server.close();
160
189
  {{#if events.outbox}}
@@ -19,6 +19,10 @@ export default defineConfig({
19
19
  // Each file starts its own application; on a shared server (DATABASE_URL) they would
20
20
  // empty each other's tables, so they run one after the other there.
21
21
  fileParallelism: (process.env['DATABASE_URL'] ?? '') === '',
22
+ {{#if persistence.hasDatabase}}
23
+ // Initialises PostgreSQL in process once: each application starts on a copy of that cluster, and creates its tables there.
24
+ globalSetup: ['test/support/test-database-template.ts'],
25
+ {{/if}}
22
26
  testTimeout: 20_000,
23
27
  hookTimeout: 30_000,
24
28
  },
@@ -1,3 +1,6 @@
1
+ {{#if tests.vitest}}
2
+ import { openAsBlob } from 'node:fs';
3
+ {{/if}}
1
4
  import { PGlite } from '@electric-sql/pglite';
2
5
  import { is, sql, SQL } from 'drizzle-orm';
3
6
  import { getTableConfig, PgDialect, PgTable } from 'drizzle-orm/pg-core';
@@ -30,7 +33,7 @@ export function openTestDatabase(url?: string): Promise<TestDatabase> {
30
33
  }
31
34
 
32
35
  async function openInProcess(): Promise<TestDatabase> {
33
- const client = new PGlite();
36
+ const client = await {{#if tests.vitest}}startedPostgres(){{/if}}{{#if tests.jest}}PGlite.create(){{/if}};
34
37
 
35
38
  {{#if audit.on}}
36
39
  for (const statement of [...tables().flatMap(createStatements), ...auditGuardStatements(schema.AUDIT_SCHEMA)]) {
@@ -52,6 +55,20 @@ async function openInProcess(): Promise<TestDatabase> {
52
55
  };
53
56
  }
54
57
 
58
+ {{#if tests.vitest}}
59
+ /**
60
+ * PostgreSQL in process: a copy of the cluster the global setup of the run initialised once
61
+ * (test/support/test-database-template.ts), which spares each spec the initdb of its own; without
62
+ * one (a run that names no global setup), a cluster initialised here. The tables are created on it
63
+ * by the caller, every time, as the first migration creates them.
64
+ */
65
+ async function startedPostgres(): Promise<PGlite> {
66
+ const template = process.env['TEST_DATABASE_TEMPLATE'];
67
+
68
+ return PGlite.create(template === undefined ? {} : { loadDataDir: await openAsBlob(template) });
69
+ }
70
+
71
+ {{/if}}
55
72
  async function openServer(url: string): Promise<TestDatabase> {
56
73
  const connection = connectToDatabase(url);
57
74
 
@@ -1,3 +1,6 @@
1
+ {{#if tests.vitest}}
2
+ import { openAsBlob } from 'node:fs';
3
+ {{/if}}
1
4
  import { PGlite } from '@electric-sql/pglite';
2
5
  import { PGLiteSocketServer } from '@electric-sql/pglite-socket';
3
6
  import type { Knex } from 'knex';
@@ -30,7 +33,7 @@ export function openTestDatabase(url?: string): Promise<TestDatabase> {
30
33
  }
31
34
 
32
35
  async function openInProcess(): Promise<TestDatabase> {
33
- const engine = await PGlite.create();
36
+ const engine = await {{#if tests.vitest}}startedPostgres(){{/if}}{{#if tests.jest}}PGlite.create(){{/if}};
34
37
  const server = new PGLiteSocketServer({ db: engine, host: '127.0.0.1', port: 0, maxConnections: 10 });
35
38
 
36
39
  await server.start();
@@ -51,6 +54,20 @@ async function openInProcess(): Promise<TestDatabase> {
51
54
  return { persistence: persistenceOver(connection.db, close), reset: () => truncateAll(connection.db), close };
52
55
  }
53
56
 
57
+ {{#if tests.vitest}}
58
+ /**
59
+ * PostgreSQL in process: a copy of the cluster the global setup of the run initialised once
60
+ * (test/support/test-database-template.ts), which spares each spec the initdb of its own; without
61
+ * one (a run that names no global setup), a cluster initialised here. The tables are created on it
62
+ * by the caller, every time, as the first migration creates them.
63
+ */
64
+ async function startedPostgres(): Promise<PGlite> {
65
+ const template = process.env['TEST_DATABASE_TEMPLATE'];
66
+
67
+ return PGlite.create(template === undefined ? {} : { loadDataDir: await openAsBlob(template) });
68
+ }
69
+
70
+ {{/if}}
54
71
  async function openServer(url: string): Promise<TestDatabase> {
55
72
  const connection = connectToDatabase(url);
56
73
 
@@ -1,3 +1,6 @@
1
+ {{#if tests.vitest}}
2
+ import { openAsBlob } from 'node:fs';
3
+ {{/if}}
1
4
  import { readFile } from 'node:fs/promises';
2
5
  import { PGlite } from '@electric-sql/pglite';
3
6
  import { PGLiteSocketServer } from '@electric-sql/pglite-socket';
@@ -27,7 +30,7 @@ export function openTestDatabase(url?: string): Promise<TestDatabase> {
27
30
  }
28
31
 
29
32
  async function openInProcess(): Promise<TestDatabase> {
30
- const engine = await PGlite.create();
33
+ const engine = await {{#if tests.vitest}}startedPostgres(){{/if}}{{#if tests.jest}}PGlite.create(){{/if}};
31
34
  const server = new PGLiteSocketServer({ db: engine, host: '127.0.0.1', port: 0, maxConnections: 10 });
32
35
 
33
36
  await server.start();
@@ -48,6 +51,20 @@ async function openInProcess(): Promise<TestDatabase> {
48
51
  return { persistence: persistenceOver(client), reset: () => truncateAll(client), close };
49
52
  }
50
53
 
54
+ {{#if tests.vitest}}
55
+ /**
56
+ * PostgreSQL in process: a copy of the cluster the global setup of the run initialised once
57
+ * (test/support/test-database-template.ts), which spares each spec the initdb of its own; without
58
+ * one (a run that names no global setup), a cluster initialised here. The tables are created on it
59
+ * by the caller, every time, as the first migration creates them.
60
+ */
61
+ async function startedPostgres(): Promise<PGlite> {
62
+ const template = process.env['TEST_DATABASE_TEMPLATE'];
63
+
64
+ return PGlite.create(template === undefined ? {} : { loadDataDir: await openAsBlob(template) });
65
+ }
66
+
67
+ {{/if}}
51
68
  async function openServer(url: string): Promise<TestDatabase> {
52
69
  const client = createClient(url);
53
70
 
@@ -1,3 +1,6 @@
1
+ {{#if tests.vitest}}
2
+ import { openAsBlob } from 'node:fs';
3
+ {{/if}}
1
4
  import { PGlite } from '@electric-sql/pglite';
2
5
  import { PGLiteSocketServer } from '@electric-sql/pglite-socket';
3
6
  import type { DataSource } from 'typeorm';
@@ -24,7 +27,7 @@ export function openTestDatabase(url?: string): Promise<TestDatabase> {
24
27
  }
25
28
 
26
29
  async function openInProcess(): Promise<TestDatabase> {
27
- const engine = await PGlite.create();
30
+ const engine = await {{#if tests.vitest}}startedPostgres(){{/if}}{{#if tests.jest}}PGlite.create(){{/if}};
28
31
  const server = new PGLiteSocketServer({ db: engine, host: '127.0.0.1', port: 0, maxConnections: 10 });
29
32
 
30
33
  await server.start();
@@ -48,6 +51,20 @@ async function openInProcess(): Promise<TestDatabase> {
48
51
  return { persistence, reset: () => truncateAll(dataSource), close };
49
52
  }
50
53
 
54
+ {{#if tests.vitest}}
55
+ /**
56
+ * PostgreSQL in process: a copy of the cluster the global setup of the run initialised once
57
+ * (test/support/test-database-template.ts), which spares each spec the initdb of its own; without
58
+ * one (a run that names no global setup), a cluster initialised here. The tables are created on it
59
+ * by the caller, every time, as the first migration creates them.
60
+ */
61
+ async function startedPostgres(): Promise<PGlite> {
62
+ const template = process.env['TEST_DATABASE_TEMPLATE'];
63
+
64
+ return PGlite.create(template === undefined ? {} : { loadDataDir: await openAsBlob(template) });
65
+ }
66
+
67
+ {{/if}}
51
68
  async function openServer(url: string): Promise<TestDatabase> {
52
69
  const dataSource = createDataSource(url);
53
70