ddd-ts-kit 0.23.1 → 0.25.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.
- package/CHANGELOG.md +64 -0
- package/README.fr.md +47 -9
- package/README.md +43 -8
- package/dist/check/canonical/open-directories.d.ts.map +1 -1
- package/dist/check/canonical/open-directories.js +7 -1
- package/dist/check/canonical/open-directories.js.map +1 -1
- package/dist/check/canonical/roles.d.ts.map +1 -1
- package/dist/check/canonical/roles.js +1 -0
- package/dist/check/canonical/roles.js.map +1 -1
- package/dist/check/canonical/stray-entry.d.ts +8 -0
- package/dist/check/canonical/stray-entry.d.ts.map +1 -0
- package/dist/check/canonical/stray-entry.js +75 -0
- package/dist/check/canonical/stray-entry.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +4 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/default-severities.d.ts.map +1 -1
- package/dist/check/catalogue/default-severities.js +2 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/explain/persistence-docs.js +1 -1
- package/dist/check/explain/persistence-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.d.ts.map +1 -1
- package/dist/check/explain/tree-docs.js +11 -0
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/fixtures/test-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/test-fixtures.js +25 -0
- package/dist/check/fixtures/test-fixtures.js.map +1 -1
- package/dist/check/fixtures/tree-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tree-fixtures.js +24 -0
- package/dist/check/fixtures/tree-fixtures.js.map +1 -1
- package/dist/check/migrations/drizzle-history-findings.js +1 -1
- package/dist/check/migrations/drizzle-history-findings.js.map +1 -1
- package/dist/check/rules/test-helper-placed.d.ts +3 -0
- package/dist/check/rules/test-helper-placed.d.ts.map +1 -0
- package/dist/check/rules/test-helper-placed.js +41 -0
- package/dist/check/rules/test-helper-placed.js.map +1 -0
- package/dist/check/rules/tree-closed.d.ts.map +1 -1
- package/dist/check/rules/tree-closed.js +4 -68
- package/dist/check/rules/tree-closed.js.map +1 -1
- package/dist/check/rules/tree-documented-paths.d.ts +3 -0
- package/dist/check/rules/tree-documented-paths.d.ts.map +1 -0
- package/dist/check/rules/tree-documented-paths.js +54 -0
- package/dist/check/rules/tree-documented-paths.js.map +1 -0
- package/dist/commands/drizzle-generate.d.ts +6 -1
- package/dist/commands/drizzle-generate.d.ts.map +1 -1
- package/dist/commands/drizzle-generate.js +39 -6
- package/dist/commands/drizzle-generate.js.map +1 -1
- package/dist/commands/format-context.d.ts.map +1 -1
- package/dist/commands/format-context.js +5 -1
- package/dist/commands/format-context.js.map +1 -1
- package/dist/commands/generate.js +9 -2
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/plan-waves.d.ts +9 -0
- package/dist/commands/plan-waves.d.ts.map +1 -0
- package/dist/commands/plan-waves.js +36 -0
- package/dist/commands/plan-waves.js.map +1 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +4 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/depcruise/hygiene-rules.js +2 -1
- package/dist/depcruise/hygiene-rules.js.map +1 -1
- package/dist/docs/context-facts.d.ts +2 -0
- package/dist/docs/context-facts.d.ts.map +1 -1
- package/dist/docs/read-context.js +1 -0
- package/dist/docs/read-context.js.map +1 -1
- package/dist/generate/context-imports.d.ts +4 -0
- package/dist/generate/context-imports.d.ts.map +1 -0
- package/dist/generate/context-imports.js +15 -0
- package/dist/generate/context-imports.js.map +1 -0
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/test-world-kind.d.ts +3 -0
- package/dist/generate/kinds/test-world-kind.d.ts.map +1 -0
- package/dist/generate/kinds/test-world-kind.js +33 -0
- package/dist/generate/kinds/test-world-kind.js.map +1 -0
- package/dist/generate/kinds/world/context-fakes.d.ts +27 -0
- package/dist/generate/kinds/world/context-fakes.d.ts.map +1 -0
- package/dist/generate/kinds/world/context-fakes.js +61 -0
- package/dist/generate/kinds/world/context-fakes.js.map +1 -0
- package/dist/generate/kinds/world/declared-ports.d.ts +12 -0
- package/dist/generate/kinds/world/declared-ports.d.ts.map +1 -0
- package/dist/generate/kinds/world/declared-ports.js +20 -0
- package/dist/generate/kinds/world/declared-ports.js.map +1 -0
- package/dist/generate/kinds/world/fake-class.d.ts +8 -0
- package/dist/generate/kinds/world/fake-class.d.ts.map +1 -0
- package/dist/generate/kinds/world/fake-class.js +30 -0
- package/dist/generate/kinds/world/fake-class.js.map +1 -0
- package/dist/generate/kinds/world/ports-in-use.d.ts +10 -0
- package/dist/generate/kinds/world/ports-in-use.d.ts.map +1 -0
- package/dist/generate/kinds/world/ports-in-use.js +18 -0
- package/dist/generate/kinds/world/ports-in-use.js.map +1 -0
- package/dist/generate/kinds/world/world-vars.d.ts +10 -0
- package/dist/generate/kinds/world/world-vars.d.ts.map +1 -0
- package/dist/generate/kinds/world/world-vars.js +55 -0
- package/dist/generate/kinds/world/world-vars.js.map +1 -0
- package/dist/generate/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +2 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/spec-vars.d.ts.map +1 -1
- package/dist/generate/spec-vars.js +1 -12
- package/dist/generate/spec-vars.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +19 -3
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +2 -0
- package/dist/help/usage.js.map +1 -1
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +7 -1
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/migration/branch-migration.d.ts +9 -0
- package/dist/migration/branch-migration.d.ts.map +1 -0
- package/dist/migration/branch-migration.js +2 -0
- package/dist/migration/branch-migration.js.map +1 -0
- package/dist/migration/branch-migrations.d.ts +16 -0
- package/dist/migration/branch-migrations.d.ts.map +1 -0
- package/dist/migration/branch-migrations.js +48 -0
- package/dist/migration/branch-migrations.js.map +1 -0
- package/dist/migration/delete-branch-migrations.d.ts +9 -0
- package/dist/migration/delete-branch-migrations.d.ts.map +1 -0
- package/dist/migration/delete-branch-migrations.js +23 -0
- package/dist/migration/delete-branch-migrations.js.map +1 -0
- package/dist/migration/drizzle-run.d.ts +7 -0
- package/dist/migration/drizzle-run.d.ts.map +1 -0
- package/dist/migration/drizzle-run.js +2 -0
- package/dist/migration/drizzle-run.js.map +1 -0
- package/dist/migration/drizzle-silent-failures.js +1 -1
- package/dist/migration/drizzle-silent-failures.js.map +1 -1
- package/dist/migration/find-project-formatter.d.ts +8 -0
- package/dist/migration/find-project-formatter.d.ts.map +1 -0
- package/dist/migration/find-project-formatter.js +52 -0
- package/dist/migration/find-project-formatter.js.map +1 -0
- package/dist/migration/format-written-files.d.ts +9 -0
- package/dist/migration/format-written-files.d.ts.map +1 -0
- package/dist/migration/format-written-files.js +32 -0
- package/dist/migration/format-written-files.js.map +1 -0
- package/dist/migration/generate-and-read.d.ts +6 -0
- package/dist/migration/generate-and-read.d.ts.map +1 -0
- package/dist/migration/generate-and-read.js +14 -0
- package/dist/migration/generate-and-read.js.map +1 -0
- package/dist/migration/index.d.ts +4 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +4 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/known-primary-keys.d.ts +3 -0
- package/dist/migration/known-primary-keys.d.ts.map +1 -0
- package/dist/migration/known-primary-keys.js +2 -0
- package/dist/migration/known-primary-keys.js.map +1 -0
- package/dist/migration/migration-files.d.ts +7 -0
- package/dist/migration/migration-files.d.ts.map +1 -0
- package/dist/migration/migration-files.js +29 -0
- package/dist/migration/migration-files.js.map +1 -0
- package/dist/migration/plan-replay.d.ts +9 -0
- package/dist/migration/plan-replay.d.ts.map +1 -0
- package/dist/migration/plan-replay.js +68 -0
- package/dist/migration/plan-replay.js.map +1 -0
- package/dist/migration/previous-primary-keys.d.ts +9 -0
- package/dist/migration/previous-primary-keys.d.ts.map +1 -0
- package/dist/migration/previous-primary-keys.js +55 -0
- package/dist/migration/previous-primary-keys.js.map +1 -0
- package/dist/migration/primary-key-order-finding.d.ts +12 -0
- package/dist/migration/primary-key-order-finding.d.ts.map +1 -0
- package/dist/migration/primary-key-order-finding.js +2 -0
- package/dist/migration/primary-key-order-finding.js.map +1 -0
- package/dist/migration/primary-key-order-findings.d.ts +12 -0
- package/dist/migration/primary-key-order-findings.d.ts.map +1 -0
- package/dist/migration/primary-key-order-findings.js +55 -0
- package/dist/migration/primary-key-order-findings.js.map +1 -0
- package/dist/migration/project-formatter.d.ts +9 -0
- package/dist/migration/project-formatter.d.ts.map +1 -0
- package/dist/migration/project-formatter.js +2 -0
- package/dist/migration/project-formatter.js.map +1 -0
- package/dist/migration/replay-drizzle-migrations.d.ts +15 -0
- package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -0
- package/dist/migration/replay-drizzle-migrations.js +63 -0
- package/dist/migration/replay-drizzle-migrations.js.map +1 -0
- package/dist/migration/replay-plan.d.ts +11 -0
- package/dist/migration/replay-plan.d.ts.map +1 -0
- package/dist/migration/replay-plan.js +2 -0
- package/dist/migration/replay-plan.js.map +1 -0
- package/dist/migration/replayed-name.d.ts +7 -0
- package/dist/migration/replayed-name.d.ts.map +1 -0
- package/dist/migration/replayed-name.js +12 -0
- package/dist/migration/replayed-name.js.map +1 -0
- package/dist/migration/sql-statement.d.ts +6 -0
- package/dist/migration/sql-statement.d.ts.map +1 -0
- package/dist/migration/sql-statement.js +2 -0
- package/dist/migration/sql-statement.js.map +1 -0
- package/dist/migration/sql-statements.d.ts +4 -0
- package/dist/migration/sql-statements.d.ts.map +1 -0
- package/dist/migration/sql-statements.js +36 -0
- package/dist/migration/sql-statements.js.map +1 -0
- package/dist/migration/table-change.d.ts +12 -0
- package/dist/migration/table-change.d.ts.map +1 -0
- package/dist/migration/table-change.js +2 -0
- package/dist/migration/table-change.js.map +1 -0
- package/dist/migration/table-changes.d.ts +9 -0
- package/dist/migration/table-changes.d.ts.map +1 -0
- package/dist/migration/table-changes.js +55 -0
- package/dist/migration/table-changes.js.map +1 -0
- package/dist/migration/tidy-written-migration.d.ts +5 -0
- package/dist/migration/tidy-written-migration.d.ts.map +1 -0
- package/dist/migration/tidy-written-migration.js +8 -0
- package/dist/migration/tidy-written-migration.js.map +1 -0
- package/dist/migration/wait-for-next-second.d.ts +6 -0
- package/dist/migration/wait-for-next-second.d.ts.map +1 -0
- package/dist/migration/wait-for-next-second.js +11 -0
- package/dist/migration/wait-for-next-second.js.map +1 -0
- package/dist/migration/warn-primary-key-order.d.ts +5 -0
- package/dist/migration/warn-primary-key-order.d.ts.map +1 -0
- package/dist/migration/warn-primary-key-order.js +16 -0
- package/dist/migration/warn-primary-key-order.js.map +1 -0
- package/dist/migration/written-migration.d.ts +9 -0
- package/dist/migration/written-migration.d.ts.map +1 -0
- package/dist/migration/written-migration.js +2 -0
- package/dist/migration/written-migration.js.map +1 -0
- package/dist/migration/written-paths.d.ts +3 -0
- package/dist/migration/written-paths.d.ts.map +1 -0
- package/dist/migration/written-paths.js +5 -0
- package/dist/migration/written-paths.js.map +1 -0
- package/dist/plan/aggregates-of.d.ts +6 -0
- package/dist/plan/aggregates-of.d.ts.map +1 -0
- package/dist/plan/aggregates-of.js +13 -0
- package/dist/plan/aggregates-of.js.map +1 -0
- package/dist/plan/batched-waves.d.ts +18 -0
- package/dist/plan/batched-waves.d.ts.map +1 -0
- package/dist/plan/batched-waves.js +73 -0
- package/dist/plan/batched-waves.js.map +1 -0
- package/dist/plan/cycles-of.d.ts +8 -0
- package/dist/plan/cycles-of.d.ts.map +1 -0
- package/dist/plan/cycles-of.js +30 -0
- package/dist/plan/cycles-of.js.map +1 -0
- package/dist/plan/format-plan.d.ts +4 -0
- package/dist/plan/format-plan.d.ts.map +1 -0
- package/dist/plan/format-plan.js +53 -0
- package/dist/plan/format-plan.js.map +1 -0
- package/dist/plan/merge-order.d.ts +8 -0
- package/dist/plan/merge-order.d.ts.map +1 -0
- package/dist/plan/merge-order.js +32 -0
- package/dist/plan/merge-order.js.map +1 -0
- package/dist/plan/plan-problems.d.ts +8 -0
- package/dist/plan/plan-problems.d.ts.map +1 -0
- package/dist/plan/plan-problems.js +57 -0
- package/dist/plan/plan-problems.js.map +1 -0
- package/dist/plan/plan-waves.d.ts +16 -0
- package/dist/plan/plan-waves.d.ts.map +1 -0
- package/dist/plan/plan-waves.js +23 -0
- package/dist/plan/plan-waves.js.map +1 -0
- package/dist/plan/rows-to-plan.d.ts +7 -0
- package/dist/plan/rows-to-plan.d.ts.map +1 -0
- package/dist/plan/rows-to-plan.js +19 -0
- package/dist/plan/rows-to-plan.js.map +1 -0
- package/dist/plan/wave-numbers.d.ts +8 -0
- package/dist/plan/wave-numbers.d.ts.map +1 -0
- package/dist/plan/wave-numbers.js +27 -0
- package/dist/plan/wave-numbers.js.map +1 -0
- package/dist/plan/wave-plan.d.ts +48 -0
- package/dist/plan/wave-plan.d.ts.map +1 -0
- package/dist/plan/wave-plan.js +2 -0
- package/dist/plan/wave-plan.js.map +1 -0
- package/dist/progress/format-progress.d.ts.map +1 -1
- package/dist/progress/format-progress.js +16 -1
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/progress/progress.d.ts +11 -1
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/progress/read-progress.d.ts +6 -2
- package/dist/progress/read-progress.d.ts.map +1 -1
- package/dist/progress/read-progress.js +10 -5
- package/dist/progress/read-progress.js.map +1 -1
- package/dist/progress/status-row-of.d.ts +16 -0
- package/dist/progress/status-row-of.d.ts.map +1 -0
- package/dist/progress/status-row-of.js +23 -0
- package/dist/progress/status-row-of.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/rows-on-branches.d.ts +8 -0
- package/dist/worker/rows-on-branches.d.ts.map +1 -0
- package/dist/worker/rows-on-branches.js +9 -0
- package/dist/worker/rows-on-branches.js.map +1 -0
- package/package.json +2 -2
- package/templates/e2e/e2e.spec.ts.tpl +2 -2
- package/templates/init/AGENTS.md.tpl +1 -1
- package/templates/init/e2e/start-application.database.ts.tpl +30 -1
- package/templates/init/e2e/start-application.memory.ts.tpl +30 -1
- package/templates/init/e2e/vitest.e2e.config.ts.tpl +4 -0
- package/templates/init/platform/database/open-test-database.drizzle.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.knex.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +18 -1
- package/templates/init/platform/database/test-database-template.ts.tpl +23 -0
- package/templates/init/rules/tests.md.tpl +3 -2
- package/templates/pipeline/knip.json.tpl +2 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/pipeline/vitest.config.ts.tpl +6 -0
- package/templates/presets/identity/context/test/unit/accept-invitation.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/account-deactivated.integration-handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/change-member-role.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/deactivate-account.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/decline-invitation.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/grant-delegation.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/invite-member.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/member-joined.integration-handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/member-removed.integration-handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/open-organisation.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/organisation-opened.integration-handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/provision-account.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/remove-member.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/revoke-delegation.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/revoke-invitation.handler.spec.ts.tpl +1 -1
- package/templates/presets/identity/context/test/unit/search-members.handler.spec.ts.tpl +1 -1
- package/templates/test-world/world.buses.ts.tpl +33 -0
- package/templates/test-world/world.tsyringe.ts.tpl +53 -0
- /package/templates/presets/identity/context/test/{unit/identity-application.ts.tpl → worlds/__context__.world.ts.tpl} +0 -0
|
@@ -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.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@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;
|
|
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,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,aAA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
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.25.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.
|
|
3
|
+
"version": "0.25.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.
|
|
55
|
+
"@ddd-ts-kit/kernel": "^0.25.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,
|
|
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, [...])
|
|
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');
|
|
@@ -18,7 +18,7 @@ A ddd-ts-kit project: one bounded context per directory of `{{config.contextsDir
|
|
|
18
18
|
|
|
19
19
|
## Rules by layer
|
|
20
20
|
|
|
21
|
-
One file per layer in `.claude/rules/`: `domain.md` (`domain/`, the shared kernel), `application.md`, `published-language.md`, `infrastructure.md`, `presentation.md` (and the OpenAPI contract), `platform.md` (`{{config.platformDir}}/`, `main.ts`, `apps/`{{#if style.explicit}}, module files{{/if}}), `tests.md` (specs, fakes, builders, `test/`). The same text is in `.github/instructions/<layer>.instructions.md`. Claude Code and GitHub Copilot load it with the files it applies to; an agent that does not (Codex) reads the file of a layer before it edits a file of that layer.
|
|
21
|
+
One file per layer in `.claude/rules/`: `domain.md` (`domain/`, the shared kernel), `application.md`, `published-language.md`, `infrastructure.md`, `presentation.md` (and the OpenAPI contract), `platform.md` (`{{config.platformDir}}/`, `main.ts`, `apps/`{{#if style.explicit}}, module files{{/if}}), `tests.md` (specs, fakes, builders, worlds, `test/`). The same text is in `.github/instructions/<layer>.instructions.md`. Claude Code and GitHub Copilot load it with the files it applies to; an agent that does not (Codex) reads the file of a layer before it edits a file of that layer.
|
|
22
22
|
|
|
23
23
|
## Generated files
|
|
24
24
|
|
|
@@ -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 =
|
|
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
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { PGlite } from '@electric-sql/pglite';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The global setup of the test runs (vitest.config.ts, vitest.e2e.config.ts): starts PostgreSQL in
|
|
8
|
+
* process once and saves its initialised cluster to a file. Each spec of the run opens a copy of it
|
|
9
|
+
* (open-test-database.ts) instead of running an initdb of its own, the slow part of starting, then
|
|
10
|
+
* creates its tables there, so that what creates them stays run and measured in every spec. What it
|
|
11
|
+
* resolves is the teardown, which deletes the file.
|
|
12
|
+
*/
|
|
13
|
+
export async function setup(): Promise<() => Promise<void>> {
|
|
14
|
+
const directory = await mkdtemp(path.join(tmpdir(), 'test-database-'));
|
|
15
|
+
const file = path.join(directory, 'cluster.tar');
|
|
16
|
+
const engine = await PGlite.create();
|
|
17
|
+
|
|
18
|
+
await writeFile(file, new Uint8Array(await (await engine.dumpDataDir('none')).arrayBuffer()));
|
|
19
|
+
await engine.close();
|
|
20
|
+
process.env['TEST_DATABASE_TEMPLATE'] = file;
|
|
21
|
+
|
|
22
|
+
return () => rm(directory, { recursive: true, force: true });
|
|
23
|
+
}
|
|
@@ -18,10 +18,11 @@ paths:
|
|
|
18
18
|
{{/unless}}
|
|
19
19
|
- `test/integration/`: adapters against the real dependency, and the contract suites every adapter and fake of a port must pass.
|
|
20
20
|
- A fake is a working in-memory implementation, not a mock with expectations: no `vi.mock`, `vi.fn`, `vi.spyOn` (`test/no-mocks`). Test data comes from the builders of `test/builders/`.
|
|
21
|
+
- The arrangement several specs of a context share, the test application or the buses with the fakes, is a world of `test/worlds/` written by `npx ddd-ts-kit generate test-world <context>`: `a<Name>World({ now, idPrefix, given })` returns every fake under the name of its port, `given` storing what the spec starts from. `test/unit/` and `test/integration/` hold specs only (`test/helper-placed`).
|
|
21
22
|
- Name tests after the behaviour, in the words of the business: "refuses to issue an invoice without lines", not "should throw". Arrange, act, assert, separated by a blank line; one behaviour per test.
|
|
22
23
|
- Every aggregate, value object, domain service, handler, event handler and integration event handler has a spec named after its file (`test/spec-required`).
|
|
23
24
|
- Coverage is a floor per context and layer, read from `coverage` in `ddd-ts-kit.config.json` and held by `npm run verify` (`npm run test:coverage`): a layer under its threshold gets the test that is missing. No `exclude` in the runner config, no `v8 ignore` or `istanbul ignore` comment without `-- ADR-NNNN: <reason>` (`test/coverage-governed`); a rate proves that code ran, never that a test asserts anything.
|
|
24
25
|
- An `it.todo` left by the generator names a behaviour still to prove: replace it by a real test, do not delete it. `npx ddd-ts-kit todo <context>` lists what remains.
|
|
25
26
|
- A test never asserts on a private field; it observes results, recorded events and what the fakes received.
|
|
26
|
-
- `test/e2e/` (project root) drives the whole application through HTTP with generated, seeded data, never reads the database, and asserts the trace of a request with `expectSpanTree(storyOf(trace), [...])`.
|
|
27
|
-
- Write tests with `/ddd-ts-kit:testing`; scaffold with `npx ddd-ts-kit generate builder|e2e`.
|
|
27
|
+
- `test/e2e/` (project root) drives the whole application through HTTP with generated, seeded data, never reads the database, and asserts the trace of a request with `expectSpanTree(storyOf(trace), [...])`. What happens after the answer (the outbox relayed, the handlers it reaches) is asserted once `await application.settled()` has resolved, never after a fixed delay.
|
|
28
|
+
- Write tests with `/ddd-ts-kit:testing`; scaffold with `npx ddd-ts-kit generate builder|test-world|e2e`.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"entry": [
|
|
4
4
|
{{#if tests.jest}}
|
|
5
5
|
"{{config.contextsDir}}/*/test/fakes/*.ts",
|
|
6
|
+
"{{config.contextsDir}}/*/test/worlds/*.ts",
|
|
6
7
|
{{/if}}
|
|
7
8
|
{{#if knip.apps}}
|
|
8
9
|
"{{config.sourceRoot}}/apps/*/main.ts",
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
"entry": [
|
|
20
21
|
"{{config.sourceRoot}}/**/*.spec.ts",
|
|
21
22
|
"{{config.contextsDir}}/*/test/fakes/*.ts",
|
|
23
|
+
"{{config.contextsDir}}/*/test/worlds/*.ts",
|
|
22
24
|
"test/architecture/**/*.spec.ts"{{knip.e2eSpecs}}{{knip.testDatabase}}
|
|
23
25
|
]
|
|
24
26
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.5.15",
|
|
24
24
|
"@commitlint/cli": "^21.2.3",
|
|
25
25
|
"@commitlint/config-conventional": "^21.2.3",
|
|
26
|
-
"@ddd-ts-kit/eslint-plugin": "^0.
|
|
26
|
+
"@ddd-ts-kit/eslint-plugin": "^0.25.0",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "5.0.3",
|
|
@@ -45,7 +45,13 @@ export default defineConfig(({ mode }) => ({
|
|
|
45
45
|
name: INTEGRATION_MODE,
|
|
46
46
|
include: [INTEGRATION_SPECS],
|
|
47
47
|
exclude: NOT_AFFECTED,
|
|
48
|
+
{{#if persistence.hasDatabase}}
|
|
49
|
+
globalSetup: ['test/support/test-database-template.ts'],
|
|
50
|
+
// A hook opens a copy of the PostgreSQL cluster the global setup initialised once per run and creates its tables, or reaches a server: under coverage on a busy machine it can outlast the default 10 seconds.
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{#unless persistence.hasDatabase}}
|
|
48
53
|
// A hook opens the test database (PGlite started and its tables created, or a server reached): under coverage on a busy machine it outlasts the default 10 seconds.
|
|
54
|
+
{{/unless}}
|
|
49
55
|
hookTimeout: 60_000,
|
|
50
56
|
},
|
|
51
57
|
},
|
|
@@ -5,7 +5,7 @@ import { AcceptInvitationCommand } from '{{alias.context}}/application/commands/
|
|
|
5
5
|
import { anAccount } from '{{alias.context}}/test/builders/account.builder{{alias.ext}}';
|
|
6
6
|
import { anInvitation } from '{{alias.context}}/test/builders/invitation.builder{{alias.ext}}';
|
|
7
7
|
import { aMember } from '{{alias.context}}/test/builders/member.builder{{alias.ext}}';
|
|
8
|
-
import { arrangeIdentity, startedIdentity } from '{{alias.context}}/test/
|
|
8
|
+
import { arrangeIdentity, startedIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
9
9
|
|
|
10
10
|
describe('Accept invitation', () => {
|
|
11
11
|
it('makes the person it was sent to a member, in its role, and tells the provider and the other contexts', async () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import { accountDeactivatedV1 } from '{{alias.context}}/published-language/account-deactivated.v1.integration-event{{alias.ext}}';
|
|
3
|
-
import { startedIdentity } from '{{alias.context}}/test/
|
|
3
|
+
import { startedIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
4
4
|
|
|
5
5
|
const deactivation = accountDeactivatedV1.create(
|
|
6
6
|
{ accountId: 'subject-ada' },
|
|
@@ -5,7 +5,7 @@ import { ChangeMemberRoleCommand } from '{{alias.context}}/application/commands/
|
|
|
5
5
|
import { aDelegation } from '{{alias.context}}/test/builders/delegation.builder{{alias.ext}}';
|
|
6
6
|
import { aMember } from '{{alias.context}}/test/builders/member.builder{{alias.ext}}';
|
|
7
7
|
import { anOrganisation } from '{{alias.context}}/test/builders/organisation.builder{{alias.ext}}';
|
|
8
|
-
import { arrangeIdentity } from '{{alias.context}}/test/
|
|
8
|
+
import { arrangeIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
9
9
|
|
|
10
10
|
const DAY = 86_400_000;
|
|
11
11
|
|
|
@@ -10,7 +10,7 @@ import { anAccount } from '{{alias.context}}/test/builders/account.builder{{alia
|
|
|
10
10
|
import { aDelegation } from '{{alias.context}}/test/builders/delegation.builder{{alias.ext}}';
|
|
11
11
|
import { aMember } from '{{alias.context}}/test/builders/member.builder{{alias.ext}}';
|
|
12
12
|
import { anOrganisation } from '{{alias.context}}/test/builders/organisation.builder{{alias.ext}}';
|
|
13
|
-
import { arrangeIdentity, startedIdentity } from '{{alias.context}}/test/
|
|
13
|
+
import { arrangeIdentity, startedIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
14
14
|
|
|
15
15
|
const DAY = 86_400_000;
|
|
16
16
|
|
|
@@ -3,7 +3,7 @@ import { InvitationStatus } from '{{alias.context}}/domain/vocabularies/invitati
|
|
|
3
3
|
import { DeclineInvitationCommand } from '{{alias.context}}/application/commands/decline-invitation/decline-invitation.command{{alias.ext}}';
|
|
4
4
|
import { anAccount } from '{{alias.context}}/test/builders/account.builder{{alias.ext}}';
|
|
5
5
|
import { anInvitation } from '{{alias.context}}/test/builders/invitation.builder{{alias.ext}}';
|
|
6
|
-
import { arrangeIdentity } from '{{alias.context}}/test/
|
|
6
|
+
import { arrangeIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
7
7
|
|
|
8
8
|
describe('Decline invitation', () => {
|
|
9
9
|
it('records the answer of the person it was sent to, who joins nothing', async () => {
|
|
@@ -3,7 +3,7 @@ import { MemberRight } from '{{alias.context}}/domain/vocabularies/member-right.
|
|
|
3
3
|
import { MemberRole } from '{{alias.context}}/domain/vocabularies/member-role.vocabulary{{alias.ext}}';
|
|
4
4
|
import { GrantDelegationCommand } from '{{alias.context}}/application/commands/grant-delegation/grant-delegation.command{{alias.ext}}';
|
|
5
5
|
import { aMember } from '{{alias.context}}/test/builders/member.builder{{alias.ext}}';
|
|
6
|
-
import { arrangeIdentity } from '{{alias.context}}/test/
|
|
6
|
+
import { arrangeIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
7
7
|
|
|
8
8
|
const startsAt = new Date('2026-01-01T00:00:00.000Z');
|
|
9
9
|
const endsAt = new Date('2026-01-15T00:00:00.000Z');
|
|
@@ -6,7 +6,7 @@ import { MemberRole } from '{{alias.context}}/domain/vocabularies/member-role.vo
|
|
|
6
6
|
import { InviteMemberCommand } from '{{alias.context}}/application/commands/invite-member/invite-member.command{{alias.ext}}';
|
|
7
7
|
import { aDelegation } from '{{alias.context}}/test/builders/delegation.builder{{alias.ext}}';
|
|
8
8
|
import { aMember } from '{{alias.context}}/test/builders/member.builder{{alias.ext}}';
|
|
9
|
-
import { arrangeIdentity } from '{{alias.context}}/test/
|
|
9
|
+
import { arrangeIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
10
10
|
|
|
11
11
|
const grace = { email: 'grace@example.test', role: MemberRole.Member };
|
|
12
12
|
|
package/templates/presets/identity/context/test/unit/member-joined.integration-handler.spec.ts.tpl
CHANGED
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from '{{tests.module}}';
|
|
|
2
2
|
import { MemberRole } from '{{alias.context}}/domain/vocabularies/member-role.vocabulary{{alias.ext}}';
|
|
3
3
|
import { memberJoinedV1 } from '{{alias.context}}/published-language/member-joined.v1.integration-event{{alias.ext}}';
|
|
4
4
|
import { aMember } from '{{alias.context}}/test/builders/member.builder{{alias.ext}}';
|
|
5
|
-
import { arrangeIdentity } from '{{alias.context}}/test/
|
|
5
|
+
import { arrangeIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
6
6
|
|
|
7
7
|
const joining = memberJoinedV1.create(
|
|
8
8
|
{ memberId: 'member-1', organisationId: 'acme', accountId: 'subject-grace', role: MemberRole.Member },
|
package/templates/presets/identity/context/test/unit/member-removed.integration-handler.spec.ts.tpl
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import { memberRemovedV1 } from '{{alias.context}}/published-language/member-removed.v1.integration-event{{alias.ext}}';
|
|
3
3
|
import { aMember } from '{{alias.context}}/test/builders/member.builder{{alias.ext}}';
|
|
4
|
-
import { arrangeIdentity, startedIdentity } from '{{alias.context}}/test/
|
|
4
|
+
import { arrangeIdentity, startedIdentity } from '{{alias.context}}/test/worlds/{{context.kebab}}.world{{alias.ext}}';
|
|
5
5
|
|
|
6
6
|
const removal = memberRemovedV1.create(
|
|
7
7
|
{ memberId: 'member-1', organisationId: 'acme', accountId: 'subject-alan' },
|