ddd-ts-kit 0.106.0 → 0.107.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 +72 -0
- package/README.fr.md +42 -34
- package/README.md +41 -33
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -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 +1 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/explain/privacy-docs.d.ts.map +1 -1
- package/dist/check/explain/privacy-docs.js +13 -0
- package/dist/check/explain/privacy-docs.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/privacy-snapshot-fixtures.d.ts +3 -0
- package/dist/check/fixtures/privacy-snapshot-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/privacy-snapshot-fixtures.js +86 -0
- package/dist/check/fixtures/privacy-snapshot-fixtures.js.map +1 -0
- package/dist/check/privacy/clear-snapshot-values-in.d.ts +13 -0
- package/dist/check/privacy/clear-snapshot-values-in.d.ts.map +1 -0
- package/dist/check/privacy/clear-snapshot-values-in.js +36 -0
- package/dist/check/privacy/clear-snapshot-values-in.js.map +1 -0
- package/dist/check/privacy/is-snapshot-mapper.d.ts +4 -0
- package/dist/check/privacy/is-snapshot-mapper.d.ts.map +1 -0
- package/dist/check/privacy/is-snapshot-mapper.js +11 -0
- package/dist/check/privacy/is-snapshot-mapper.js.map +1 -0
- package/dist/check/rules/privacy-declared-field.d.ts +2 -1
- package/dist/check/rules/privacy-declared-field.d.ts.map +1 -1
- package/dist/check/rules/privacy-declared-field.js +4 -1
- package/dist/check/rules/privacy-declared-field.js.map +1 -1
- package/dist/check/rules/privacy-snapshot-sealed.d.ts +9 -0
- package/dist/check/rules/privacy-snapshot-sealed.d.ts.map +1 -0
- package/dist/check/rules/privacy-snapshot-sealed.js +34 -0
- package/dist/check/rules/privacy-snapshot-sealed.js.map +1 -0
- package/dist/doctor/format-diagnosis.d.ts.map +1 -1
- package/dist/doctor/format-diagnosis.js +7 -2
- package/dist/doctor/format-diagnosis.js.map +1 -1
- package/dist/doctor/hook-findings.d.ts.map +1 -1
- package/dist/doctor/hook-findings.js +17 -1
- package/dist/doctor/hook-findings.js.map +1 -1
- package/dist/generate/concept-role.d.ts +2 -0
- package/dist/generate/concept-role.d.ts.map +1 -1
- package/dist/generate/concept.d.ts.map +1 -1
- package/dist/generate/concept.js +4 -1
- package/dist/generate/concept.js.map +1 -1
- package/dist/generate/kinds/birth-names.js +1 -1
- package/dist/generate/kinds/birth-names.js.map +1 -1
- package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-error-kind.js +1 -0
- package/dist/generate/kinds/domain-error-kind.js.map +1 -1
- package/dist/generate/kinds/existing-aggregate.d.ts.map +1 -1
- package/dist/generate/kinds/existing-aggregate.js +1 -0
- package/dist/generate/kinds/existing-aggregate.js.map +1 -1
- package/dist/generate/kinds/query-kind.js +1 -1
- package/dist/generate/kinds/query-kind.js.map +1 -1
- package/dist/generate/label.js +1 -1
- package/dist/generate/label.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +12 -0
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/subfolder-of.d.ts +3 -0
- package/dist/init/subfolder-of.d.ts.map +1 -0
- package/dist/init/subfolder-of.js +7 -0
- package/dist/init/subfolder-of.js.map +1 -0
- package/dist/init/subfolder-sentence.d.ts +6 -0
- package/dist/init/subfolder-sentence.d.ts.map +1 -0
- package/dist/init/subfolder-sentence.js +13 -0
- package/dist/init/subfolder-sentence.js.map +1 -0
- package/dist/naming/parse-concept-name.d.ts +2 -0
- package/dist/naming/parse-concept-name.d.ts.map +1 -1
- package/dist/naming/parse-concept-name.js +4 -1
- package/dist/naming/parse-concept-name.js.map +1 -1
- package/dist/naming/parse-context-name.d.ts.map +1 -1
- package/dist/naming/parse-context-name.js +2 -0
- package/dist/naming/parse-context-name.js.map +1 -1
- package/dist/naming/refuse-windows-reserved.d.ts +7 -0
- package/dist/naming/refuse-windows-reserved.d.ts.map +1 -0
- package/dist/naming/refuse-windows-reserved.js +14 -0
- package/dist/naming/refuse-windows-reserved.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/templates/docs/privacy-register.md.tpl +1 -1
- package/templates/init/e2e/create-credentials.keycloak.ts.tpl +1 -0
- package/templates/init/platform/auth/relationships/create-tuple-store.contract.spec.ts.tpl +11 -1
- package/templates/init/platform/auth/relationships/create-tuple-store.ts.tpl +16 -1
- package/templates/init/platform/composition/compose-application.container.ts.tpl +1 -2
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +2 -2
- package/templates/pipeline/github/workflows/ci.yml.tpl +4 -0
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +4 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/repository/event-sourced/repository.ts.tpl +1 -1
- package/templates/repository/typeorm/table.tpl +2 -2
- package/templates/sdk/runtime.ts.tpl +10 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files GitHub, GitLab and lefthook read at the top of the repository only, and where the install
|
|
3
|
+
* permissions belong, for a project that lives in a folder of a larger repository (a monorepo).
|
|
4
|
+
*/
|
|
5
|
+
export declare function subfolderSentence(folder: string, manager: string): string;
|
|
6
|
+
//# sourceMappingURL=subfolder-sentence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subfolder-sentence.d.ts","sourceRoot":"","sources":["../../src/init/subfolder-sentence.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOzE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** What the project writes that a tool reads at the top of the git repository only. */
|
|
2
|
+
const ROOT_ONLY_FILES = '.github/ (the workflows and dependabot.yml), .gitlab-ci.yml and lefthook.yml';
|
|
3
|
+
/**
|
|
4
|
+
* The files GitHub, GitLab and lefthook read at the top of the repository only, and where the install
|
|
5
|
+
* permissions belong, for a project that lives in a folder of a larger repository (a monorepo).
|
|
6
|
+
*/
|
|
7
|
+
export function subfolderSentence(folder, manager) {
|
|
8
|
+
const workspace = manager === 'pnpm'
|
|
9
|
+
? ' pnpm reads allowBuilds and strictDepBuilds in the pnpm-workspace.yaml of the workspace root: put them there, the one in this folder is not read from the root.'
|
|
10
|
+
: '';
|
|
11
|
+
return `${ROOT_ONLY_FILES} are read at the top of the git repository only, so the copies in ${folder} never run there: move them to the top (GitHub jobs then need working-directory: ${folder}), or run the checks and hooks from this folder yourself.${workspace}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=subfolder-sentence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subfolder-sentence.js","sourceRoot":"","sources":["../../src/init/subfolder-sentence.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,eAAe,GAAG,8EAA8E,CAAC;AAEvG;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,OAAe;IAC/D,MAAM,SAAS,GACb,OAAO,KAAK,MAAM;QAChB,CAAC,CAAC,iKAAiK;QACnK,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,GAAG,eAAe,qEAAqE,MAAM,oFAAoF,MAAM,4DAA4D,SAAS,EAAE,CAAC;AACxQ,CAAC"}
|
|
@@ -2,6 +2,8 @@ import type { Name } from './name.js';
|
|
|
2
2
|
export interface NameOptions {
|
|
3
3
|
/** Role suffixes the generator adds itself, removed when the caller typed them. */
|
|
4
4
|
readonly strip?: readonly string[];
|
|
5
|
+
/** `--allow-name`: a name Windows reserves for a device is let through. */
|
|
6
|
+
readonly allowReserved?: boolean;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* The name of a concept as the caller typed it: well formed and without the role suffix. Whether
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-concept-name.d.ts","sourceRoot":"","sources":["../../src/naming/parse-concept-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-concept-name.d.ts","sourceRoot":"","sources":["../../src/naming/parse-concept-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAKnC,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,2EAA2E;IAC3E,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,IAAI,CAa7F"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliError } from '../cli-error.js';
|
|
2
|
+
import { refuseWindowsReserved } from './refuse-windows-reserved.js';
|
|
2
3
|
import { splitWords } from './split-words.js';
|
|
3
4
|
import { toName } from './to-name.js';
|
|
4
5
|
/**
|
|
@@ -9,7 +10,9 @@ export function parseConceptName(input, what, options = {}) {
|
|
|
9
10
|
if (!/^[A-Za-z][A-Za-z0-9_\- ]*$/.test(input)) {
|
|
10
11
|
throw new CliError(`"${input}" is not a valid ${what} name.`, 'Use letters and digits only, starting with a letter, for example InvoiceLine or invoice-line.');
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
const name = toName(withoutRole(splitWords(input), options.strip ?? []).join(' '));
|
|
14
|
+
refuseWindowsReserved(name, what, options.allowReserved);
|
|
15
|
+
return name;
|
|
13
16
|
}
|
|
14
17
|
function withoutRole(words, roles) {
|
|
15
18
|
const last = words.at(-1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-concept-name.js","sourceRoot":"","sources":["../../src/naming/parse-concept-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-concept-name.js","sourceRoot":"","sources":["../../src/naming/parse-concept-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AASnC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,IAAY,EAAE,OAAO,GAAgB,EAAE;IACrF,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,QAAQ,CAChB,IAAI,KAAK,oBAAoB,IAAI,QAAQ,EACzC,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEnF,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,WAAW,CAAC,KAAwB,EAAE,KAAwB;IACrE,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1B,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACrG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-context-name.d.ts","sourceRoot":"","sources":["../../src/naming/parse-context-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-context-name.d.ts","sourceRoot":"","sources":["../../src/naming/parse-context-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAOnC,4HAA4H;AAC5H,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAUpD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliError } from '../cli-error.js';
|
|
2
|
+
import { refuseWindowsReserved } from './refuse-windows-reserved.js';
|
|
2
3
|
import { readName } from './read-name.js';
|
|
3
4
|
const FIX = 'Name the bounded context in kebab-case after the business capability, for example billing or order-fulfilment.';
|
|
4
5
|
/** The name of a context as the caller typed it, in kebab-case once read: nothing of it dropped, starting with a letter. */
|
|
@@ -7,6 +8,7 @@ export function parseContextName(input) {
|
|
|
7
8
|
if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(name.kebab)) {
|
|
8
9
|
throw new CliError(`"${input}" is not a valid context name.`, FIX);
|
|
9
10
|
}
|
|
11
|
+
refuseWindowsReserved(name, 'context');
|
|
10
12
|
return name;
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=parse-context-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-context-name.js","sourceRoot":"","sources":["../../src/naming/parse-context-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,GAAG,GACP,gHAAgH,CAAC;AAEnH,4HAA4H;AAC5H,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAE7C,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,gCAAgC,EAAE,GAAG,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"parse-context-name.js","sourceRoot":"","sources":["../../src/naming/parse-context-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,GAAG,GACP,gHAAgH,CAAC;AAEnH,4HAA4H;AAC5H,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAE7C,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,gCAAgC,EAAE,GAAG,CAAC,CAAC;IACrE,CAAC;IAED,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAEvC,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Name } from './name.js';
|
|
2
|
+
/**
|
|
3
|
+
* Refuses a name that is a file name Windows reserves, since the kit writes files and folders named after it.
|
|
4
|
+
* `allowName` is the `--allow-name` of the command; undefined where the command has no such flag.
|
|
5
|
+
*/
|
|
6
|
+
export declare function refuseWindowsReserved(name: Name, what: string, allowName?: boolean): void;
|
|
7
|
+
//# sourceMappingURL=refuse-windows-reserved.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refuse-windows-reserved.d.ts","sourceRoot":"","sources":["../../src/naming/refuse-windows-reserved.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAKnC;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CASzF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CliError } from '../cli-error.js';
|
|
2
|
+
/** The names Windows reserves for devices, whatever the case and the extension: `con.aggregate.ts` cannot be checked out on NTFS. */
|
|
3
|
+
const WINDOWS_RESERVED = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/;
|
|
4
|
+
/**
|
|
5
|
+
* Refuses a name that is a file name Windows reserves, since the kit writes files and folders named after it.
|
|
6
|
+
* `allowName` is the `--allow-name` of the command; undefined where the command has no such flag.
|
|
7
|
+
*/
|
|
8
|
+
export function refuseWindowsReserved(name, what, allowName) {
|
|
9
|
+
if (allowName === true || !WINDOWS_RESERVED.test(name.kebab)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
throw new CliError(`"${name.pascal}" is a name Windows reserves for a device (CON, PRN, AUX, NUL, COM1 to COM9, LPT1 to LPT9): the files of this ${what} cannot be checked out there.`, `Rename the ${what}${allowName === undefined ? '' : ', or pass --allow-name if no one works on Windows'}.`);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=refuse-windows-reserved.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refuse-windows-reserved.js","sourceRoot":"","sources":["../../src/naming/refuse-windows-reserved.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,qIAAqI;AACrI,MAAM,gBAAgB,GAAG,yCAAyC,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAU,EAAE,IAAY,EAAE,SAAmB;IACjF,IAAI,SAAS,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAChB,IAAI,IAAI,CAAC,MAAM,iHAAiH,IAAI,+BAA+B,EACnK,cAAc,IAAI,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mDAAmD,GAAG,CAC3G,CAAC;AACJ,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.107.0";
|
|
2
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.107.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddd-ts-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.107.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",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"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"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@ddd-ts-kit/audit": "^0.
|
|
59
|
-
"@ddd-ts-kit/auth": "^0.
|
|
60
|
-
"@ddd-ts-kit/events": "^0.
|
|
61
|
-
"@ddd-ts-kit/kernel": "^0.
|
|
58
|
+
"@ddd-ts-kit/audit": "^0.107.0",
|
|
59
|
+
"@ddd-ts-kit/auth": "^0.107.0",
|
|
60
|
+
"@ddd-ts-kit/events": "^0.107.0",
|
|
61
|
+
"@ddd-ts-kit/kernel": "^0.107.0",
|
|
62
62
|
"@types/pg": "^8.23.1",
|
|
63
63
|
"pg": "^8.23.1"
|
|
64
64
|
}
|
|
@@ -22,6 +22,6 @@ TODO(domain): the processors and the third parties that receive personal data (m
|
|
|
22
22
|
|
|
23
23
|
## What the code does not purge
|
|
24
24
|
|
|
25
|
-
`npm run privacy:erase` reaches the declared copies, the records of the outbox of the events listed above and the jobs enqueued with the person as `subject`. It does not reach what the code cannot name: a message already delivered to a broker or a consumer, a field of a payload that no `personal` option lists, a job that holds a person in its payload and names no `subject
|
|
25
|
+
`npm run privacy:erase` reaches the declared copies, the records of the outbox of the events listed above and the jobs enqueued with the person as `subject`. It does not reach what the code cannot name: a message already delivered to a broker or a consumer, a field of a payload that no `personal` option lists, a job that holds a person in its payload and names no `subject`, a value a `cached` read keeps of a person, until its time to live. The jobs `events.purge-published` and `jobs.purge-finished` drop what the platform is done with past `OUTBOX_RETENTION_DAYS` and `BACKGROUND_JOBS_RETENTION_DAYS`; dead events and dead jobs wait for an operator.
|
|
26
26
|
|
|
27
27
|
TODO(domain): how long the backups, the logs, the files and the archives of the audit trail keep personal data, and who deletes them.
|
|
@@ -4,5 +4,15 @@ import { createTupleStore } from '{{alias.platform}}/auth/relationships/create-t
|
|
|
4
4
|
|
|
5
5
|
relationTupleStoreContract(
|
|
6
6
|
{ describe, it, expect, beforeEach },
|
|
7
|
-
{ name: 'The relation tuple store of the platform', create: createTupleStore },
|
|
7
|
+
{ name: 'The relation tuple store of the platform', create: () => createTupleStore('test') },
|
|
8
8
|
);
|
|
9
|
+
|
|
10
|
+
describe('The relation tuple store of the platform, by environment', () => {
|
|
11
|
+
it.each(['development', 'test'])('starts in memory in %s', (environment) => {
|
|
12
|
+
expect(() => createTupleStore(environment)).not.toThrow();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('refuses production until a store that persists is bound', () => {
|
|
16
|
+
expect(() => createTupleStore('production')).toThrow(/never in production: bind a RelationTupleStore that persists/);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { InMemoryRelationTupleStore, type RelationTupleStore } from '@ddd-ts-kit/auth/rebac';
|
|
2
2
|
|
|
3
|
+
/** Where the tuples may live in memory: nowhere else, production included. */
|
|
4
|
+
const IN_MEMORY_IN = ['development', 'test'];
|
|
5
|
+
|
|
3
6
|
// TODO(platform): answer a persistent store (a table written in the transaction of the change it describes) and hold it to relationTupleStoreContract, as create-tuple-store.contract.spec.ts does for this one.
|
|
4
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Development and test only: the tuples live in this process, so a revocation reaches this
|
|
9
|
+
* instance alone and a restart forgets every grant. It refuses production: bind a
|
|
10
|
+
* RelationTupleStore that persists, an OpenFGA server (`OpenFgaRelationTupleStore` of
|
|
11
|
+
* `@ddd-ts-kit/openfga`) or a table of your database held to `relationTupleStoreContract`.
|
|
12
|
+
*/
|
|
13
|
+
export function createTupleStore(environment: string = process.env['NODE_ENV'] ?? 'development'): RelationTupleStore {
|
|
14
|
+
if (!IN_MEMORY_IN.includes(environment)) {
|
|
15
|
+
throw new Error(
|
|
16
|
+
'The in-memory relation tuple store runs in development and test only, never in production: bind a RelationTupleStore that persists in createTupleStore (OpenFgaRelationTupleStore of @ddd-ts-kit/openfga, or a table of your database held to relationTupleStoreContract)',
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
5
20
|
return new InMemoryRelationTupleStore();
|
|
6
21
|
}
|
|
@@ -24,9 +24,7 @@ import {
|
|
|
24
24
|
{{/if}}
|
|
25
25
|
{{/if}}
|
|
26
26
|
EventBus,
|
|
27
|
-
{{#if http.any}}
|
|
28
27
|
ExecutionScope,
|
|
29
|
-
{{/if}}
|
|
30
28
|
{{#if files.http}}
|
|
31
29
|
FileStorage,
|
|
32
30
|
{{/if}}
|
|
@@ -239,6 +237,7 @@ export function composeApplication(
|
|
|
239
237
|
metrics: container.resolve(Metrics),
|
|
240
238
|
cache: container.resolve(Cache),
|
|
241
239
|
clock: container.resolve(Clock),
|
|
240
|
+
scope: container.resolve(ExecutionScope),
|
|
242
241
|
});
|
|
243
242
|
|
|
244
243
|
{{#if audit.route}}
|
|
@@ -173,9 +173,9 @@ export function composeApplication(
|
|
|
173
173
|
selection: readonly ContextModule[] = everyContext,
|
|
174
174
|
): Application {
|
|
175
175
|
const platform = createPlatform(persistence, options);
|
|
176
|
-
const { logger, metrics, cache, clock } = platform;
|
|
176
|
+
const { logger, metrics, cache, clock, scope } = platform;
|
|
177
177
|
|
|
178
|
-
installAspectRuntime({ logger, metrics, cache, clock });
|
|
178
|
+
installAspectRuntime({ logger, metrics, cache, clock, scope });
|
|
179
179
|
{{#if platformJobs.any}}
|
|
180
180
|
registerPlatformJobs(platform, options);
|
|
181
181
|
{{/if}}
|
|
@@ -262,6 +262,10 @@ jobs:
|
|
|
262
262
|
mutation-changed:
|
|
263
263
|
name: Mutation score of the change
|
|
264
264
|
needs: install
|
|
265
|
+
# gh run list and gh run download read the runs of the workflow: contents alone is refused on a private repository.
|
|
266
|
+
permissions:
|
|
267
|
+
contents: read
|
|
268
|
+
actions: read
|
|
265
269
|
# A pull request: the report of the last night is reused for what the change leaves alone, and the survivors of the files it touched are listed. A reading, not a gate: the floor is held by the night.
|
|
266
270
|
if: ${{ github.event_name == 'pull_request' }}
|
|
267
271
|
runs-on: ubuntu-26.04
|
|
@@ -253,6 +253,10 @@ mutation_changed:
|
|
|
253
253
|
extends: .node
|
|
254
254
|
stage: test
|
|
255
255
|
needs: [install]
|
|
256
|
+
# The image with git, as install: the files of the change are read from the difference with the target branch.
|
|
257
|
+
image: node:24-bookworm
|
|
258
|
+
# A reading, not a gate: a night without a report or a runner that fails leaves the merge request open.
|
|
259
|
+
allow_failure: true
|
|
256
260
|
# A merge request: the report of the last night is reused for what the change leaves alone, and the survivors of the files it touched are listed. A reading, not a gate: the floor is held by the night.
|
|
257
261
|
rules:
|
|
258
262
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.6.3",
|
|
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.107.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",
|
|
@@ -24,7 +24,7 @@ export class EventStore{{aggregate.pascal}}Repository implements {{aggregate.pas
|
|
|
24
24
|
category: '{{context.kebab}}.{{aggregate.kebab}}',
|
|
25
25
|
serializer: new EventSerializer<{{aggregate.pascal}}Event>({{aggregate.camel}}Events, { cipher }),
|
|
26
26
|
rehydrate: (id, history) => {{aggregate.pascal}}.rehydrate(id, history),
|
|
27
|
-
// TODO(domain): when a stream grows long enough to slow a load, add `snapshots: { ...{{aggregate.camel}}Snapshots, store: snapshots, every: <n> }` (a SnapshotStore injected here, a snapshot mapper with its own shape version): see docs/concepts/event-sourcing.md of ddd-ts-kit.
|
|
27
|
+
// TODO(domain): when a stream grows long enough to slow a load, add `snapshots: { ...{{aggregate.camel}}Snapshots, store: snapshots, every: <n> }` (a SnapshotStore injected here, a snapshot mapper with its own shape version, which seals a personal value with personalData as the events do): see docs/concepts/event-sourcing.md of ddd-ts-kit.
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -14,7 +14,7 @@ export const {{aggregate.tableCamel}} = new EntitySchema<{{aggregate.pascal}}Row
|
|
|
14
14
|
{{#if personal.any}}
|
|
15
15
|
{{personal.typeormTable}}
|
|
16
16
|
{{/if}}
|
|
17
|
-
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`.
|
|
17
|
+
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`. A jsonb field is typed `JsonDocument` of `@ddd-ts-kit/typeorm` or a named interface, never `Record<string, unknown>`, which the insert and the update of TypeORM refuse to compile.
|
|
18
18
|
version: { type: 'int' },
|
|
19
19
|
...tenantColumn(),
|
|
20
20
|
...auditColumns(),
|
|
@@ -32,7 +32,7 @@ export const {{aggregate.tableCamel}} = new EntitySchema<{{aggregate.pascal}}Row
|
|
|
32
32
|
{{#if personal.any}}
|
|
33
33
|
{{personal.typeormTable}}
|
|
34
34
|
{{/if}}
|
|
35
|
-
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`.
|
|
35
|
+
// TODO(domain): add one column per field of {{aggregate.pascal}}State (and to {{aggregate.pascal}}Columns of {{aggregate.kebab}}-row.schema.ts), with the type and the constraints the storage must enforce; then run `npm run build && npm run db:generate migrations/<what-it-does>`. A jsonb field is typed `JsonDocument` of `@ddd-ts-kit/typeorm` or a named interface, never `Record<string, unknown>`, which the insert and the update of TypeORM refuse to compile.
|
|
36
36
|
version: { type: 'int' },
|
|
37
37
|
...auditColumns(),
|
|
38
38
|
},
|
|
@@ -246,7 +246,16 @@ function texts(values: CallRequest['header']): Record<string, string> {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
function pathOf(template: string, values: CallRequest['path']): string {
|
|
249
|
-
return template.replace(/\{([^}]+)\}/g, (_match, name: string) =>
|
|
249
|
+
return template.replace(/\{([^}]+)\}/g, (_match, name: string) => segmentOf(name, String(values?.[name] ?? '')));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** One segment of the path: empty or a dot segment, a URL would drop it and the call would reach another route. */
|
|
253
|
+
function segmentOf(name: string, value: string): string {
|
|
254
|
+
if (value === '' || value === '.' || value === '..') {
|
|
255
|
+
throw new TypeError(`The path parameter "${name}" is empty or a dot segment: it names no segment of the path.`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return encodeURIComponent(value);
|
|
250
259
|
}
|
|
251
260
|
|
|
252
261
|
/** A list is sent as the parameter repeated, the form OpenAPI calls `explode`. */
|