ddd-ts-kit 0.96.0 → 0.97.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 (102) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.fr.md +5 -3
  3. package/README.md +4 -2
  4. package/dist/check/authz/operator-tuples.d.ts +16 -0
  5. package/dist/check/authz/operator-tuples.d.ts.map +1 -0
  6. package/dist/check/authz/operator-tuples.js +29 -0
  7. package/dist/check/authz/operator-tuples.js.map +1 -0
  8. package/dist/check/authz/own-authorizer.d.ts +9 -0
  9. package/dist/check/authz/own-authorizer.d.ts.map +1 -0
  10. package/dist/check/authz/own-authorizer.js +15 -0
  11. package/dist/check/authz/own-authorizer.js.map +1 -0
  12. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  13. package/dist/check/catalogue/architecture-rules.js +4 -0
  14. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  15. package/dist/check/explain/authz-docs.d.ts.map +1 -1
  16. package/dist/check/explain/authz-docs.js +12 -1
  17. package/dist/check/explain/authz-docs.js.map +1 -1
  18. package/dist/check/explain/scheduling-docs.d.ts.map +1 -1
  19. package/dist/check/explain/scheduling-docs.js +22 -0
  20. package/dist/check/explain/scheduling-docs.js.map +1 -1
  21. package/dist/check/fixtures/authz-granted-fixtures.d.ts.map +1 -1
  22. package/dist/check/fixtures/authz-granted-fixtures.js +69 -0
  23. package/dist/check/fixtures/authz-granted-fixtures.js.map +1 -1
  24. package/dist/check/fixtures/authz-resource-modelled-fixtures.d.ts.map +1 -1
  25. package/dist/check/fixtures/authz-resource-modelled-fixtures.js +5 -0
  26. package/dist/check/fixtures/authz-resource-modelled-fixtures.js.map +1 -1
  27. package/dist/check/fixtures/authz-system-actor-granted-fixtures.d.ts +3 -0
  28. package/dist/check/fixtures/authz-system-actor-granted-fixtures.d.ts.map +1 -0
  29. package/dist/check/fixtures/authz-system-actor-granted-fixtures.js +89 -0
  30. package/dist/check/fixtures/authz-system-actor-granted-fixtures.js.map +1 -0
  31. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  32. package/dist/check/fixtures/fixtures.js +2 -0
  33. package/dist/check/fixtures/fixtures.js.map +1 -1
  34. package/dist/check/fixtures/scheduling-fixtures.d.ts.map +1 -1
  35. package/dist/check/fixtures/scheduling-fixtures.js +47 -1
  36. package/dist/check/fixtures/scheduling-fixtures.js.map +1 -1
  37. package/dist/check/rules/authz-granted.d.ts +19 -6
  38. package/dist/check/rules/authz-granted.d.ts.map +1 -1
  39. package/dist/check/rules/authz-granted.js +59 -7
  40. package/dist/check/rules/authz-granted.js.map +1 -1
  41. package/dist/check/rules/authz-system-actor-granted.d.ts +15 -0
  42. package/dist/check/rules/authz-system-actor-granted.d.ts.map +1 -0
  43. package/dist/check/rules/authz-system-actor-granted.js +91 -0
  44. package/dist/check/rules/authz-system-actor-granted.js.map +1 -0
  45. package/dist/check/rules/scheduling-job-registered.d.ts +12 -0
  46. package/dist/check/rules/scheduling-job-registered.d.ts.map +1 -0
  47. package/dist/check/rules/scheduling-job-registered.js +40 -0
  48. package/dist/check/rules/scheduling-job-registered.js.map +1 -0
  49. package/dist/check/scheduling/job-classes.d.ts +13 -0
  50. package/dist/check/scheduling/job-classes.d.ts.map +1 -0
  51. package/dist/check/scheduling/job-classes.js +32 -0
  52. package/dist/check/scheduling/job-classes.js.map +1 -0
  53. package/dist/commands/generate.js +1 -1
  54. package/dist/commands/generate.js.map +1 -1
  55. package/dist/commands/prisma-generate.d.ts.map +1 -1
  56. package/dist/commands/prisma-generate.js +2 -1
  57. package/dist/commands/prisma-generate.js.map +1 -1
  58. package/dist/commands/typeorm-generate.d.ts.map +1 -1
  59. package/dist/commands/typeorm-generate.js +2 -1
  60. package/dist/commands/typeorm-generate.js.map +1 -1
  61. package/dist/generate/kinds/extend-event-sourced-aggregate.js +2 -2
  62. package/dist/generate/kinds/extend-event-sourced-aggregate.js.map +1 -1
  63. package/dist/generate/kinds/integration-handler-kind.d.ts.map +1 -1
  64. package/dist/generate/kinds/integration-handler-kind.js +1 -13
  65. package/dist/generate/kinds/integration-handler-kind.js.map +1 -1
  66. package/dist/generate/kinds/job/grant-system-actor.js +4 -2
  67. package/dist/generate/kinds/job/grant-system-actor.js.map +1 -1
  68. package/dist/generate/kinds/projection-kind.d.ts.map +1 -1
  69. package/dist/generate/kinds/projection-kind.js +15 -10
  70. package/dist/generate/kinds/projection-kind.js.map +1 -1
  71. package/dist/generate/kinds/subscription-vars.d.ts +8 -0
  72. package/dist/generate/kinds/subscription-vars.d.ts.map +1 -0
  73. package/dist/generate/kinds/subscription-vars.js +14 -0
  74. package/dist/generate/kinds/subscription-vars.js.map +1 -0
  75. package/dist/generate/refuse-shared-writes.d.ts +1 -1
  76. package/dist/generate/refuse-shared-writes.d.ts.map +1 -1
  77. package/dist/generate/refuse-shared-writes.js +25 -2
  78. package/dist/generate/refuse-shared-writes.js.map +1 -1
  79. package/dist/init/first-install-note.d.ts.map +1 -1
  80. package/dist/init/first-install-note.js +1 -0
  81. package/dist/init/first-install-note.js.map +1 -1
  82. package/dist/init/manifest/versions.js +24 -24
  83. package/dist/migration/ensure-database-reachable.d.ts +13 -0
  84. package/dist/migration/ensure-database-reachable.d.ts.map +1 -0
  85. package/dist/migration/ensure-database-reachable.js +51 -0
  86. package/dist/migration/ensure-database-reachable.js.map +1 -0
  87. package/dist/migration/index.d.ts +1 -0
  88. package/dist/migration/index.d.ts.map +1 -1
  89. package/dist/migration/index.js +1 -0
  90. package/dist/migration/index.js.map +1 -1
  91. package/dist/version.d.ts +1 -1
  92. package/dist/version.js +1 -1
  93. package/dist/worker/add-worktree.d.ts +5 -1
  94. package/dist/worker/add-worktree.d.ts.map +1 -1
  95. package/dist/worker/add-worktree.js +6 -2
  96. package/dist/worker/add-worktree.js.map +1 -1
  97. package/package.json +4 -4
  98. package/templates/aggregate/event-sourced.events.mapper.ts.tpl +2 -2
  99. package/templates/pipeline/package-scripts.json +1 -1
  100. package/templates/projection/projection.manual.ts.tpl +8 -0
  101. package/templates/projection/wiring.manual.tpl +22 -0
  102. package/templates/projection/wiring.tsyringe.tpl +4 -0
@@ -0,0 +1,51 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { CliError } from '../cli-error.js';
3
+ import { UNWRITTEN_EXIT_CODE } from '../workspace/exit-code-of.js';
4
+ /** The default port of each server the kit can generate migrations for. */
5
+ const DEFAULT_PORTS = { 'postgres:': 5432, 'postgresql:': 5432, 'mysql:': 3306 };
6
+ /** How long a server has to accept a connection before it is taken as out of reach. */
7
+ const PROBE_TIMEOUT_MS = 3000;
8
+ /** Opens a TCP connection and exits 0 once it is open; the sandbox of a session refuses it, a stopped server too. */
9
+ const PROBE = `const s = require('node:net').connect({ host: process.argv[1], port: Number(process.argv[2]) });
10
+ s.setTimeout(${PROBE_TIMEOUT_MS});
11
+ s.on('connect', () => process.exit(0));
12
+ s.on('timeout', () => process.exit(1));
13
+ s.on('error', () => process.exit(1));`;
14
+ /**
15
+ * Stops with exit 3, the code of what this session cannot do here, before an ORM tool that needs a
16
+ * live database (`prisma migrate dev`, `typeorm migration:generate`) fails with a raw connection
17
+ * error. Under the sandbox of the regulated profile a command cannot open a TCP connection to the
18
+ * database of the project, whatever `sandbox.network` allows (the probe of the issue, Claude Code
19
+ * 2.1.311 on Linux): the migration is the owner's, or the pipeline's. Nothing is checked when
20
+ * `DATABASE_URL` is not set in the environment: the tool then says what it lacks.
21
+ */
22
+ export function ensureDatabaseReachable(environment = process.env, probe = canConnect) {
23
+ const endpoint = databaseEndpointOf(environment['DATABASE_URL']);
24
+ if (endpoint === undefined || probe(endpoint)) {
25
+ return;
26
+ }
27
+ throw new CliError(`The database at ${endpoint.host}:${endpoint.port} cannot be reached from this session.`, 'Migrations and database tests run outside the sandbox of the agent: the owner of the project (or the CI) runs this command from a terminal, with the database up. If the database is simply stopped, start it (`npm run infra:up`) and run the command again.', UNWRITTEN_EXIT_CODE);
28
+ }
29
+ /** Where the `DATABASE_URL` of the process points, or `undefined` when it is not set, not a TCP server of the kit, or a socket. */
30
+ function databaseEndpointOf(url) {
31
+ if (url === undefined || url.trim() === '') {
32
+ return undefined;
33
+ }
34
+ try {
35
+ const parsed = new URL(url);
36
+ const port = parsed.port === '' ? DEFAULT_PORTS[parsed.protocol] : Number(parsed.port);
37
+ const host = parsed.hostname.replace(/^\[|\]$/g, '');
38
+ return port === undefined || host === '' ? undefined : { host, port };
39
+ }
40
+ catch {
41
+ return undefined;
42
+ }
43
+ }
44
+ function canConnect({ host, port }) {
45
+ const result = spawnSync(process.execPath, ['-e', PROBE, host, String(port)], {
46
+ timeout: PROBE_TIMEOUT_MS + 2000,
47
+ stdio: 'ignore',
48
+ });
49
+ return result.status === 0;
50
+ }
51
+ //# sourceMappingURL=ensure-database-reachable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-database-reachable.js","sourceRoot":"","sources":["../../src/migration/ensure-database-reachable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,2EAA2E;AAC3E,MAAM,aAAa,GAAqC,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAEnH,uFAAuF;AACvF,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,qHAAqH;AACrH,MAAM,KAAK,GAAG;eACC,gBAAgB;;;sCAGO,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAW,GAAsB,OAAO,CAAC,GAAG,EAC5C,KAAK,GAA0D,UAAU;IAEzE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IAEjE,IAAI,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,mBAAmB,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,uCAAuC,EACxF,+PAA+P,EAC/P,mBAAmB,CACpB,CAAC;AACJ,CAAC;AAED,mIAAmI;AACnI,SAAS,kBAAkB,CAAC,GAAuB;IACjD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAErD,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAkC;IAChE,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;QAC5E,OAAO,EAAE,gBAAgB,GAAG,IAAI;QAChC,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7B,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { ensureDatabaseReachable } from './ensure-database-reachable.js';
1
2
  export { generateAndRead } from './generate-and-read.js';
2
3
  export { generateDrizzleMigration } from './generate-drizzle-migration.js';
3
4
  export { primaryKeyOrderFindings } from './primary-key-order-findings.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { ensureDatabaseReachable } from './ensure-database-reachable.js';
1
2
  export { generateAndRead } from './generate-and-read.js';
2
3
  export { generateDrizzleMigration } from './generate-drizzle-migration.js';
3
4
  export { primaryKeyOrderFindings } from './primary-key-order-findings.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.96.0";
1
+ export declare const VERSION = "0.97.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.96.0';
1
+ export const VERSION = '0.97.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,8 @@
1
- /** Adds the worktree on its branch: an existing branch is checked out, a new one is cut from the base. */
1
+ /**
2
+ * Adds the worktree on its branch: an existing branch is checked out, a new one is cut from the base
3
+ * with `--no-track`: a worker's branch needs no upstream, and recording one writes `.git/config`,
4
+ * which the Claude Code sandbox keeps read-only.
5
+ */
2
6
  export declare function addWorktree(root: string, place: {
3
7
  worktree: string;
4
8
  branch: string;
@@ -1 +1 @@
1
- {"version":3,"file":"add-worktree.d.ts","sourceRoot":"","sources":["../../src/worker/add-worktree.ts"],"names":[],"mappings":"AAIA,0GAA0G;AAC1G,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAWzG"}
1
+ {"version":3,"file":"add-worktree.d.ts","sourceRoot":"","sources":["../../src/worker/add-worktree.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAWzG"}
@@ -1,10 +1,14 @@
1
1
  import { CliError } from '../cli-error.js';
2
2
  import { runGit } from '../commit/run-git.js';
3
3
  import { branchExists } from './branch-exists.js';
4
- /** Adds the worktree on its branch: an existing branch is checked out, a new one is cut from the base. */
4
+ /**
5
+ * Adds the worktree on its branch: an existing branch is checked out, a new one is cut from the base
6
+ * with `--no-track`: a worker's branch needs no upstream, and recording one writes `.git/config`,
7
+ * which the Claude Code sandbox keeps read-only.
8
+ */
5
9
  export function addWorktree(root, place) {
6
10
  const { worktree, branch, base } = place;
7
- const target = branchExists(root, branch) ? [branch] : ['-b', branch, base];
11
+ const target = branchExists(root, branch) ? [branch] : ['--no-track', '-b', branch, base];
8
12
  const added = runGit(root, ['worktree', 'add', worktree, ...target]);
9
13
  if (added === undefined) {
10
14
  throw new CliError(`git could not add the worktree ${worktree} on the branch ${branch}.`, `Run \`git worktree add ${worktree} ${target.join(' ')}\` to read its reason; a branch checked out elsewhere takes --branch <name>.`);
@@ -1 +1 @@
1
- {"version":3,"file":"add-worktree.js","sourceRoot":"","sources":["../../src/worker/add-worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,0GAA0G;AAC1G,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAyD;IACjG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAErE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,QAAQ,CAChB,kCAAkC,QAAQ,kBAAkB,MAAM,GAAG,EACrE,0BAA0B,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,8EAA8E,CACrI,CAAC;IACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"add-worktree.js","sourceRoot":"","sources":["../../src/worker/add-worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAyD;IACjG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1F,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAErE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,QAAQ,CAChB,kCAAkC,QAAQ,kBAAkB,MAAM,GAAG,EACrE,0BAA0B,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,8EAA8E,CACrI,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-ts-kit",
3
- "version": "0.96.0",
3
+ "version": "0.97.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,9 +52,9 @@
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/audit": "^0.96.0",
56
- "@ddd-ts-kit/events": "^0.96.0",
57
- "@ddd-ts-kit/kernel": "^0.96.0",
55
+ "@ddd-ts-kit/audit": "^0.97.0",
56
+ "@ddd-ts-kit/events": "^0.97.0",
57
+ "@ddd-ts-kit/kernel": "^0.97.0",
58
58
  "@types/pg": "^8.23.1",
59
59
  "pg": "^8.23.1"
60
60
  }
@@ -2,8 +2,8 @@ import { defineStoredEvent, type StoredEventTypes } from '@ddd-ts-kit/kernel';
2
2
  import type { {{name.pascal}}Event } from '{{alias.context}}/domain/aggregates/{{name.kebab}}.aggregate{{alias.ext}}';
3
3
  import { {{event.pascal}} } from '{{alias.context}}/domain/events/{{event.kebab}}.event{{alias.ext}}';
4
4
 
5
- // TODO(domain): give each data type the fields its event carries beyond its id and instant, in plain data (texts, numbers, ISO dates); personal data is written `personalData(subjectId, value)`. A type stored once never changes: a change is a new version with its upcaster (event-sourcing/upcaster-required).
6
- interface {{event.pascal}}Data {}
5
+ // TODO(domain): an event that carries nothing keeps `Record<string, never>`; for one that carries fields beyond its id and instant, write the type as an `interface` with them, in plain data (texts, numbers, ISO dates); personal data is written `personalData(subjectId, value)`. A type stored once never changes: a change is a new version with its upcaster (event-sourcing/upcaster-required).
6
+ type {{event.pascal}}Data = Record<string, never>;
7
7
 
8
8
  /** How the events of {{name.pascal}} are kept in its stream: one entry per event, read back by `decode`. */
9
9
  export const {{name.camel}}Events: StoredEventTypes<{{name.pascal}}Event> = {
@@ -23,7 +23,7 @@
23
23
  "@biomejs/biome": "2.6.2",
24
24
  "@commitlint/cli": "^21.2.3",
25
25
  "@commitlint/config-conventional": "^21.2.3",
26
- "@ddd-ts-kit/eslint-plugin": "^0.96.0",
26
+ "@ddd-ts-kit/eslint-plugin": "^0.97.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",
@@ -0,0 +1,8 @@
1
+ import { type {{event.typeName}} } from '{{alias.contexts}}/{{publisher.kebab}}/published-language{{alias.index}}';
2
+
3
+ // TODO(domain): receive the port of the read model "{{name.words}}" keeps in the constructor, typed by that port (an abstract class of application/ports that extends `ReadModelStore<Row>` of the kernel: `ddd-ts-kit generate port {{context.kebab}} <Name>`), and pass the adapter (or its fake) where the module file of the context builds the projection.
4
+ export class {{name.pascal}}Projection {
5
+ async {{event.method}}(event: {{event.typeName}}): Promise<void> {
6
+ // TODO(domain): write what {{event.type}} says into the read model through its port and answer what the store answers, `return this.<port>.upsertIfNewer(<id>, stampOf(event), () => ({ ... }))` with `stampOf` of the kernel: the stamp keeps a replay or a late delivery from undoing a newer line, and the answer is how the application counts what was applied.
7
+ }
8
+ }
@@ -0,0 +1,22 @@
1
+ @@imports
2
+ {{#if consumer.declarative}}
3
+ import { on, subscribeAll } from '@ddd-ts-kit/events';
4
+ {{/if}}
5
+ {{#if consumer.transactional}}
6
+ import { consume, subscribeAll } from '@ddd-ts-kit/events';
7
+ {{/if}}
8
+ import { {{event.definition}} as {{name.camel}}Definition } from '{{alias.contexts}}/{{publisher.kebab}}/published-language{{alias.index}}';
9
+ import { {{name.pascal}}Projection } from '{{alias.context}}/application/projections/{{name.kebab}}.projection{{alias.ext}}';
10
+ @@reactions
11
+ const {{name.camel}}Projection = new {{name.pascal}}Projection();
12
+
13
+ {{#if consumer.declarative}}
14
+ subscribeAll({{consumer.subscriber}}, [
15
+ on({{name.camel}}Definition, (event) => {{name.camel}}Projection.{{event.method}}(event), { consumer: '{{context.kebab}}.{{name.kebab}}', processed: platform.persistence.processedEvents, scope: platform.scope }),
16
+ ]);
17
+ {{/if}}
18
+ {{#if consumer.transactional}}
19
+ subscribeAll({{consumer.subscriber}}, [
20
+ consume({{name.camel}}Definition, { consumer: '{{context.kebab}}.{{name.kebab}}', processed: platform.persistence.processedEvents, unitOfWork: platform.persistence.unitOfWork, scope: platform.scope }, (event) => {{name.camel}}Projection.{{event.method}}(event)),
21
+ ]);
22
+ {{/if}}
@@ -0,0 +1,4 @@
1
+ @@imports
2
+ import { {{name.pascal}}Projection } from '{{alias.context}}/application/projections/{{name.kebab}}.projection{{alias.ext}}';
3
+ @@registrations
4
+ builder.include({{name.pascal}}Projection);