ddd-ts-kit 0.105.0 → 0.106.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 +60 -0
- package/README.fr.md +22 -13
- package/README.md +20 -12
- package/dist/check/baseline/renamed-files.d.ts.map +1 -1
- package/dist/check/baseline/renamed-files.js +2 -1
- package/dist/check/baseline/renamed-files.js.map +1 -1
- package/dist/check/commands/changed-files.d.ts.map +1 -1
- package/dist/check/commands/changed-files.js +2 -1
- package/dist/check/commands/changed-files.js.map +1 -1
- package/dist/check/project/git-ignored.d.ts.map +1 -1
- package/dist/check/project/git-ignored.js +2 -1
- package/dist/check/project/git-ignored.js.map +1 -1
- package/dist/check/rules/authz-declared.d.ts.map +1 -1
- package/dist/check/rules/authz-declared.js +2 -1
- package/dist/check/rules/authz-declared.js.map +1 -1
- package/dist/commit/git-arguments.d.ts +9 -0
- package/dist/commit/git-arguments.d.ts.map +1 -0
- package/dist/commit/git-arguments.js +46 -0
- package/dist/commit/git-arguments.js.map +1 -0
- package/dist/commit/run-git.d.ts.map +1 -1
- package/dist/commit/run-git.js +2 -1
- package/dist/commit/run-git.js.map +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/kit-container.d.ts +6 -0
- package/dist/config/kit-container.d.ts.map +1 -0
- package/dist/config/kit-container.js +10 -0
- package/dist/config/kit-container.js.map +1 -0
- package/dist/config/stack.d.ts +1 -1
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/doctor/format-diagnosis.js +3 -0
- package/dist/doctor/format-diagnosis.js.map +1 -1
- package/dist/doctor/hook-findings.d.ts +2 -1
- package/dist/doctor/hook-findings.d.ts.map +1 -1
- package/dist/doctor/hook-findings.js +10 -2
- package/dist/doctor/hook-findings.js.map +1 -1
- package/dist/doctor/permission-findings.js +1 -0
- package/dist/doctor/permission-findings.js.map +1 -1
- package/dist/generate/di-entry.d.ts +4 -0
- package/dist/generate/di-entry.d.ts.map +1 -0
- package/dist/generate/di-entry.js +5 -0
- package/dist/generate/di-entry.js.map +1 -0
- package/dist/generate/di-imports.d.ts +4 -0
- package/dist/generate/di-imports.d.ts.map +1 -0
- package/dist/generate/di-imports.js +12 -0
- package/dist/generate/di-imports.js.map +1 -0
- package/dist/generate/kinds/adapter-kind.d.ts.map +1 -1
- package/dist/generate/kinds/adapter-kind.js +3 -2
- package/dist/generate/kinds/adapter-kind.js.map +1 -1
- package/dist/generate/kinds/background/spec-family.d.ts +1 -1
- package/dist/generate/kinds/background/spec-family.d.ts.map +1 -1
- package/dist/generate/kinds/background/spec-family.js +2 -1
- package/dist/generate/kinds/background/spec-family.js.map +1 -1
- package/dist/generate/kinds/command-outputs.d.ts.map +1 -1
- package/dist/generate/kinds/command-outputs.js +2 -1
- package/dist/generate/kinds/command-outputs.js.map +1 -1
- package/dist/generate/kinds/extraction/service-selection.d.ts.map +1 -1
- package/dist/generate/kinds/extraction/service-selection.js +2 -1
- package/dist/generate/kinds/extraction/service-selection.js.map +1 -1
- package/dist/generate/kinds/gateway-kind.js +1 -1
- package/dist/generate/kinds/gateway-kind.js.map +1 -1
- package/dist/generate/kinds/import-assembler.d.ts.map +1 -1
- package/dist/generate/kinds/import-assembler.js +11 -2
- package/dist/generate/kinds/import-assembler.js.map +1 -1
- package/dist/generate/kinds/job/grant-system-actor.d.ts.map +1 -1
- package/dist/generate/kinds/job/grant-system-actor.js +8 -4
- package/dist/generate/kinds/job/grant-system-actor.js.map +1 -1
- package/dist/generate/kinds/job-kind.d.ts.map +1 -1
- package/dist/generate/kinds/job-kind.js +2 -1
- package/dist/generate/kinds/job-kind.js.map +1 -1
- package/dist/generate/kinds/personal-data/declare-personal-data.js +1 -1
- package/dist/generate/kinds/personal-data/declare-personal-data.js.map +1 -1
- package/dist/generate/kinds/query-outputs.d.ts.map +1 -1
- package/dist/generate/kinds/query-outputs.js +2 -1
- package/dist/generate/kinds/query-outputs.js.map +1 -1
- package/dist/generate/kinds/test-world-kind.d.ts.map +1 -1
- package/dist/generate/kinds/test-world-kind.js +3 -2
- package/dist/generate/kinds/test-world-kind.js.map +1 -1
- package/dist/generate/kinds/world/context-fakes.d.ts.map +1 -1
- package/dist/generate/kinds/world/context-fakes.js +2 -1
- package/dist/generate/kinds/world/context-fakes.js.map +1 -1
- package/dist/generate/kinds/world/world-arrangement.d.ts.map +1 -1
- package/dist/generate/kinds/world/world-arrangement.js +2 -1
- package/dist/generate/kinds/world/world-arrangement.js.map +1 -1
- package/dist/generate/kinds/world/world-vars.d.ts.map +1 -1
- package/dist/generate/kinds/world/world-vars.js +2 -1
- package/dist/generate/kinds/world/world-vars.js.map +1 -1
- package/dist/generate/spec-vars.d.ts.map +1 -1
- package/dist/generate/spec-vars.js +2 -1
- package/dist/generate/spec-vars.js.map +1 -1
- package/dist/generate/wiring-family.d.ts +1 -1
- package/dist/generate/wiring-family.d.ts.map +1 -1
- package/dist/generate/wiring-family.js +2 -1
- package/dist/generate/wiring-family.js.map +1 -1
- package/dist/generate/wirings.js +2 -2
- package/dist/generate/wirings.js.map +1 -1
- package/dist/help/usage.js +1 -1
- package/dist/init/add-presets.d.ts +8 -0
- package/dist/init/add-presets.d.ts.map +1 -0
- package/dist/init/add-presets.js +17 -0
- package/dist/init/add-presets.js.map +1 -0
- package/dist/init/agent-permissions.js +2 -0
- package/dist/init/agent-permissions.js.map +1 -1
- package/dist/init/files/audit-files.js +1 -1
- package/dist/init/files/audit-files.js.map +1 -1
- package/dist/init/files/auth-files.js +2 -2
- package/dist/init/files/auth-files.js.map +1 -1
- package/dist/init/files/event-sourcing-files.js +1 -1
- package/dist/init/files/event-sourcing-files.js.map +1 -1
- package/dist/init/files/family-of.d.ts +1 -1
- package/dist/init/files/family-of.d.ts.map +1 -1
- package/dist/init/files/family-of.js +2 -1
- package/dist/init/files/family-of.js.map +1 -1
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +2 -1
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/files/platform-files.js +2 -2
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/files/privacy-files.js +1 -1
- package/dist/init/files/privacy-files.js.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-against-stack.js +5 -1
- package/dist/init/manifest/dependencies-against-stack.js.map +1 -1
- package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +4 -0
- package/dist/init/manifest/dependencies-for.js.map +1 -1
- package/dist/init/manifest/versions.d.ts.map +1 -1
- package/dist/init/manifest/versions.js +28 -24
- package/dist/init/manifest/versions.js.map +1 -1
- package/dist/init/manifest/write-manifest.js +1 -1
- package/dist/init/manifest/write-manifest.js.map +1 -1
- package/dist/init/regulated-sandbox.d.ts +5 -3
- package/dist/init/regulated-sandbox.d.ts.map +1 -1
- package/dist/init/regulated-sandbox.js +6 -3
- package/dist/init/regulated-sandbox.js.map +1 -1
- package/dist/init/rewire-personal-data.js +1 -1
- package/dist/init/rewire-personal-data.js.map +1 -1
- package/dist/init/rewire-preset.d.ts +1 -1
- package/dist/init/rewire-preset.d.ts.map +1 -1
- package/dist/init/rewire-preset.js +5 -2
- package/dist/init/rewire-preset.js.map +1 -1
- package/dist/init/run-init.js +1 -5
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-stack.js +1 -1
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/resolve-style.d.ts +1 -1
- package/dist/init/stack/resolve-style.js +4 -4
- package/dist/init/stack/resolve-style.js.map +1 -1
- package/dist/init/validation-dependencies.d.ts.map +1 -1
- package/dist/init/validation-dependencies.js +3 -1
- package/dist/init/validation-dependencies.js.map +1 -1
- package/dist/layout/fit-statement.js +16 -2
- package/dist/layout/fit-statement.js.map +1 -1
- package/dist/merge/git-process.d.ts.map +1 -1
- package/dist/merge/git-process.js +2 -1
- package/dist/merge/git-process.js.map +1 -1
- package/dist/merge/lost/revision-files.d.ts.map +1 -1
- package/dist/merge/lost/revision-files.js +6 -1
- package/dist/merge/lost/revision-files.js.map +1 -1
- package/dist/merge/lost/side-hunks.d.ts.map +1 -1
- package/dist/merge/lost/side-hunks.js +2 -1
- package/dist/merge/lost/side-hunks.js.map +1 -1
- package/dist/merge/object-bytes.d.ts.map +1 -1
- package/dist/merge/object-bytes.js +2 -1
- package/dist/merge/object-bytes.js.map +1 -1
- package/dist/package-manager/package-manager-vars.d.ts +1 -1
- package/dist/package-manager/package-manager-vars.js +2 -2
- package/dist/package-manager/package-manager-vars.js.map +1 -1
- package/dist/package-manager/pinned-package-managers.d.ts +2 -2
- package/dist/package-manager/pinned-package-managers.js +2 -2
- package/dist/plan/copy-of-project.d.ts.map +1 -1
- package/dist/plan/copy-of-project.js +2 -1
- package/dist/plan/copy-of-project.js.map +1 -1
- package/dist/presets/apply-preset.d.ts.map +1 -1
- package/dist/presets/apply-preset.js +2 -0
- package/dist/presets/apply-preset.js.map +1 -1
- package/dist/presets/identity-refusal.d.ts.map +1 -1
- package/dist/presets/identity-refusal.js +4 -3
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/organisations-as-audit-chains.d.ts +10 -0
- package/dist/presets/organisations-as-audit-chains.d.ts.map +1 -0
- package/dist/presets/organisations-as-audit-chains.js +30 -0
- package/dist/presets/organisations-as-audit-chains.js.map +1 -0
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +7 -2
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -5
- package/templates/architecture/{extractable.tsyringe.spec.ts.tpl → extractable.container.spec.ts.tpl} +2 -1
- package/templates/architecture/extractable.declared.spec.ts.tpl +2 -1
- package/templates/controller/guard.spec.ts.tpl +20 -15
- package/templates/controller/guard.ts.tpl +3 -5
- package/templates/init/README.md.tpl +8 -6
- package/templates/init/docker/Dockerfile.tpl +7 -7
- package/templates/init/docker/env.example.tpl +2 -0
- package/templates/init/e2e/start-application.database.ts.tpl +5 -5
- package/templates/init/e2e/start-application.memory.ts.tpl +5 -5
- package/templates/init/main.ts.tpl +1 -0
- package/templates/init/platform/composition/{compose-application.tsyringe.ts.tpl → compose-application.container.ts.tpl} +4 -7
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +2 -0
- package/templates/init/platform/events/start-outbox-relay.ts.tpl +5 -1
- package/templates/init/platform/observability/create-logger.stdout.ts.tpl +2 -2
- package/templates/init/platform/observability/create-metrics.ts.tpl +6 -3
- package/templates/init/platform/resilience/adapters-with-own-policy.ts.tpl +1 -1
- package/templates/init/platform/resilience/default-policy.ts.tpl +1 -1
- package/templates/init/rules/platform.md.tpl +3 -3
- package/templates/init/rules/tests.md.tpl +2 -2
- package/templates/pipeline/biome.json.tpl +1 -1
- package/templates/pipeline/github/actions/setup/action.yml.tpl +3 -2
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +2 -2
- package/templates/pipeline/package-scripts.json +2 -2
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +6 -4
- package/templates/presets/identity/context/test/integration/organisation-tenant-directory.spec.ts.tpl +7 -6
- package/templates/presets/identity/context/test/worlds/__context__.world.declared.ts.tpl +2 -1
- package/templates/presets/identity/design.md.tpl +4 -2
- package/templates/presets/identity/e2e/support.wiring.tpl +4 -4
- package/templates/presets/identity/platform/organisation-of-command.ts.tpl +36 -0
- package/templates/repository/knex/mapper.ts.tpl +1 -1
- package/templates/service/main.ts.tpl +1 -0
- /package/templates/adapter/{simulated.wiring.tsyringe.tpl → simulated.wiring.container.tpl} +0 -0
- /package/templates/adapter/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/architecture/{hosting.tsyringe.spec.ts.tpl → hosting.container.spec.ts.tpl} +0 -0
- /package/templates/architecture/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/background-job/{background-job.spec.tsyringe.ts.tpl → background-job.spec.container.ts.tpl} +0 -0
- /package/templates/background-job/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/command/{handler.spec.tsyringe.ts.tpl → handler.spec.container.ts.tpl} +0 -0
- /package/templates/command/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/context/{module.tsyringe.ts.tpl → module.container.ts.tpl} +0 -0
- /package/templates/context/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/controller/{routes.tsyringe.tpl → routes.container.tpl} +0 -0
- /package/templates/erasure-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/event-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/file-upload/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/gateway/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/init/platform/audit/{audit.module.tsyringe.ts.tpl → audit.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/auth/authorization/{authorization.tsyringe.ts.tpl → authorization.container.ts.tpl} +0 -0
- /package/templates/init/platform/buses/{create-command-bus.tsyringe.ts.tpl → create-command-bus.container.ts.tpl} +0 -0
- /package/templates/init/platform/buses/{create-query-bus.tsyringe.ts.tpl → create-query-bus.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{context-selection.tsyringe.ts.tpl → context-selection.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{lay-foundations.tsyringe.ts.tpl → lay-foundations.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{platform-test.module.tsyringe.ts.tpl → platform-test.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{platform.module.tsyringe.ts.tpl → platform.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/composition/{routes-of.tsyringe.ts.tpl → routes-of.container.ts.tpl} +0 -0
- /package/templates/init/platform/files/{bind-files.tsyringe.ts.tpl → bind-files.container.ts.tpl} +0 -0
- /package/templates/init/platform/files/{files.module.tsyringe.ts.tpl → files.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/files/{staging-uploads.tsyringe.ts.tpl → staging-uploads.container.ts.tpl} +0 -0
- /package/templates/init/platform/jobs/{housekeeping.module.tsyringe.ts.tpl → housekeeping.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{data-subject-copies.tsyringe.ts.tpl → data-subject-copies.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{data-subject-exports.tsyringe.ts.tpl → data-subject-exports.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{privacy.module.tsyringe.ts.tpl → privacy.module.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{run-erasure.tsyringe.ts.tpl → run-erasure.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{run-export.tsyringe.ts.tpl → run-export.container.ts.tpl} +0 -0
- /package/templates/init/platform/privacy/{run-purge.tsyringe.ts.tpl → run-purge.container.ts.tpl} +0 -0
- /package/templates/init/scripts/{privacy-erase.tsyringe.ts.tpl → privacy-erase.container.ts.tpl} +0 -0
- /package/templates/init/scripts/{privacy-export.tsyringe.ts.tpl → privacy-export.container.ts.tpl} +0 -0
- /package/templates/init/scripts/{privacy-purge.tsyringe.ts.tpl → privacy-purge.container.ts.tpl} +0 -0
- /package/templates/integration-event/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/integration-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/job/{job.spec.tsyringe.ts.tpl → job.spec.container.ts.tpl} +0 -0
- /package/templates/job/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/module/{module-file.tsyringe.ts.tpl → module-file.container.ts.tpl} +0 -0
- /package/templates/module/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/personal-data/{copies.tsyringe.tpl → copies.container.tpl} +0 -0
- /package/templates/personal-data/{exports.tsyringe.tpl → exports.container.tpl} +0 -0
- /package/templates/personal-data/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/process/{timeout-job.spec.tsyringe.ts.tpl → timeout-job.spec.container.ts.tpl} +0 -0
- /package/templates/process/{timeout-job.wiring.tsyringe.tpl → timeout-job.wiring.container.tpl} +0 -0
- /package/templates/projection/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/query/{handler.spec.tsyringe.ts.tpl → handler.spec.container.ts.tpl} +0 -0
- /package/templates/query/{search.handler.spec.tsyringe.ts.tpl → search.handler.spec.container.ts.tpl} +0 -0
- /package/templates/query/{search.wiring.tsyringe.tpl → search.wiring.container.tpl} +0 -0
- /package/templates/query/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/repository/{event-sourced.wiring.tsyringe.tpl → event-sourced.wiring.container.tpl} +0 -0
- /package/templates/repository/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
- /package/templates/route/{routes.on-tsyringe.tpl → routes.on-container.tpl} +0 -0
- /package/templates/service/{extracted.tsyringe.tpl → extracted.container.tpl} +0 -0
- /package/templates/test-world/{world.tsyringe.ts.tpl → world.container.ts.tpl} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organisations-as-audit-chains.d.ts","sourceRoot":"","sources":["../../src/presets/organisations-as-audit-chains.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAOnE;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI,CA0BvF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { specifierOf } from '../alias/index.js';
|
|
2
|
+
import { withImport } from '../generate/with-import.js';
|
|
3
|
+
import { renderTemplate } from '../templating/index.js';
|
|
4
|
+
const COMMANDS = 'commands: auditMiddleware(trail, { ...source, unitOfWork, onLostRecord })';
|
|
5
|
+
const COMMANDS_IN_THE_ORGANISATION = 'commands: auditMiddleware(trail, { ...source, unitOfWork, onLostRecord, tenantOf: organisationOfCommand })';
|
|
6
|
+
/**
|
|
7
|
+
* With tenants and an audit trail, the entry of a command that succeeded on an organisation is
|
|
8
|
+
* written in the chain of that organisation: `organisationOfCommand`, next to `create-audit.ts`,
|
|
9
|
+
* names it, and the audit middleware of the commands is given it as `tenantOf`. A `create-audit.ts`
|
|
10
|
+
* the team rewrote is left as it is, with what to add.
|
|
11
|
+
*/
|
|
12
|
+
export function organisationsAsAuditChains(scope, rendering) {
|
|
13
|
+
const createAudit = `${scope.config.platformDir}/audit/create-audit.ts`;
|
|
14
|
+
const current = scope.ws.read(createAudit);
|
|
15
|
+
if (scope.config.stack.tenancy === 'none' || current === undefined) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const file = `${scope.config.platformDir}/audit/organisation-of-command.ts`;
|
|
19
|
+
// Written once: `init --force` rewires `create-audit.ts` and keeps what the team made of this file.
|
|
20
|
+
if (!scope.ws.exists(file)) {
|
|
21
|
+
scope.ws.create(file, renderTemplate('presets/identity/platform/organisation-of-command.ts.tpl', rendering));
|
|
22
|
+
}
|
|
23
|
+
if (!current.includes(COMMANDS)) {
|
|
24
|
+
scope.ws.note(`${createAudit} no longer builds the audit of the commands as init wrote it: give \`auditMiddleware\` \`tenantOf: organisationOfCommand\` (${file}), so that a command on an organisation is audited in its chain.`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const importLine = `import { organisationOfCommand } from '${specifierOf(scope.config, file)}';`;
|
|
28
|
+
scope.ws.update(createAudit, withImport(current.replaceAll(COMMANDS, COMMANDS_IN_THE_ORGANISATION), importLine));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=organisations-as-audit-chains.js.map
|
|
@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I,CAAC,IAAI,CAAC;IAEjG,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,4BAA4B,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;AACnH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-vars.d.ts","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"stack-vars.d.ts","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAiBnD,6GAA6G;AAC7G,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAoCvD"}
|
package/dist/stack/stack-vars.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { QUEUE_ORMS } from '../config/index.js';
|
|
1
|
+
import { onKitContainer, QUEUE_ORMS } from '../config/index.js';
|
|
2
|
+
import { diEntry } from '../generate/di-entry.js';
|
|
2
3
|
import { aliasVars } from './alias-vars.js';
|
|
3
4
|
import { auditVars } from './audit-vars.js';
|
|
4
5
|
import { authenticationVars } from './authentication-vars.js';
|
|
@@ -23,7 +24,11 @@ export function stackVars(config) {
|
|
|
23
24
|
decorators: { legacy, standard: !legacy },
|
|
24
25
|
...edgeVars(config),
|
|
25
26
|
validation: one(validation, ['zod', 'class-validator', 'typebox', 'standard-schema', 'none']),
|
|
26
|
-
di:
|
|
27
|
+
di: {
|
|
28
|
+
...one(di, ['tsyringe', 'inversify', 'awilix', 'nest', 'manual']),
|
|
29
|
+
container: onKitContainer(config),
|
|
30
|
+
entry: diEntry(config),
|
|
31
|
+
},
|
|
27
32
|
orm: { ...one(orm, ['drizzle', 'knex', 'prisma', 'typeorm', 'custom', 'none']), any: orm !== 'none' },
|
|
28
33
|
events: eventVars(config),
|
|
29
34
|
authn: authenticationVars(config),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAe,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,0FAA0F;AAC1F,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,6GAA6G;AAC7G,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,E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AAI,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5D,GAAG,EAAE,IAAI,KAAK,MAAM;QACpB,KAAK,EAAE,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,MAAM;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,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.106.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.106.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.106.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",
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
"provenance": true
|
|
37
37
|
},
|
|
38
38
|
"type": "module",
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=22.12.0"
|
|
41
|
+
},
|
|
39
42
|
"bin": {
|
|
40
43
|
"ddd-ts-kit": "./dist/bin.js",
|
|
41
44
|
"ddd-ts-kit-refresh-declarations": "./dist/refresh-declarations.js"
|
|
@@ -52,10 +55,10 @@
|
|
|
52
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"
|
|
53
56
|
},
|
|
54
57
|
"devDependencies": {
|
|
55
|
-
"@ddd-ts-kit/audit": "^0.
|
|
56
|
-
"@ddd-ts-kit/auth": "^0.
|
|
57
|
-
"@ddd-ts-kit/events": "^0.
|
|
58
|
-
"@ddd-ts-kit/kernel": "^0.
|
|
58
|
+
"@ddd-ts-kit/audit": "^0.106.0",
|
|
59
|
+
"@ddd-ts-kit/auth": "^0.106.0",
|
|
60
|
+
"@ddd-ts-kit/events": "^0.106.0",
|
|
61
|
+
"@ddd-ts-kit/kernel": "^0.106.0",
|
|
59
62
|
"@types/pg": "^8.23.1",
|
|
60
63
|
"pg": "^8.23.1"
|
|
61
64
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import { authorizationModule } from '@ddd-ts-kit/auth/di';
|
|
3
3
|
import { AllowAll } from '@ddd-ts-kit/auth/testing';
|
|
4
|
-
import {
|
|
4
|
+
import { type ContextModule } from '@ddd-ts-kit/di';
|
|
5
|
+
import { createTestApplication } from '{{di.entry}}';
|
|
5
6
|
import { platformTestModule } from '{{alias.platform}}/composition/platform-test.module{{alias.ext}}';
|
|
6
7
|
// ddd-ts-kit:imports
|
|
7
8
|
// /ddd-ts-kit:imports
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import { authorizationModule } from '@ddd-ts-kit/auth/di';
|
|
3
3
|
import { AllowAll } from '@ddd-ts-kit/auth/testing';
|
|
4
|
-
import {
|
|
4
|
+
import { type ContextModule } from '@ddd-ts-kit/di';
|
|
5
|
+
import { createTestApplication } from '{{di.entry}}';
|
|
5
6
|
import { platformTestModule } from '{{alias.platform}}/composition/platform-test.module{{alias.ext}}';
|
|
6
7
|
// ddd-ts-kit:imports
|
|
7
8
|
// /ddd-ts-kit:imports
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import { anActor } from '@ddd-ts-kit/auth/testing';
|
|
3
3
|
import type { GuardRequest } from '@ddd-ts-kit/http';
|
|
4
|
-
import { executionContext } from '@ddd-ts-kit/kernel';
|
|
4
|
+
import { type Actor, executionContext } from '@ddd-ts-kit/kernel';
|
|
5
5
|
import { {{name.pascal}}Guard } from '{{alias.context}}/presentation/http/guards/{{name.kebab}}.guard{{alias.ext}}';
|
|
6
6
|
|
|
7
|
-
const actor = anActor().build();
|
|
8
|
-
const execution = executionContext({ correlationId: 'correlation-1', actor, origin: 'http' });
|
|
9
|
-
|
|
10
|
-
const request: GuardRequest = {
|
|
11
|
-
method: 'GET',
|
|
12
|
-
path: '/',
|
|
13
|
-
operationId: 'anOperation',
|
|
14
|
-
params: {},
|
|
15
|
-
headers: {},
|
|
16
|
-
actor,
|
|
17
|
-
context: { requestId: 'request-1', execution, raw: undefined },
|
|
18
|
-
};
|
|
19
|
-
|
|
20
7
|
describe('Who may pass the {{name.words}} guard', () => {
|
|
8
|
+
// TODO(domain): the stub refuses everybody. Once the control is written, hold one test per decision of the guard: who it lets through, who it refuses with 403.
|
|
21
9
|
it('refuses a caller with 403', () => {
|
|
10
|
+
const request = requestOf(anActor().build());
|
|
11
|
+
|
|
22
12
|
expect(() => new {{name.pascal}}Guard().check(request)).toThrow(expect.objectContaining({ code: 'FORBIDDEN' }));
|
|
23
13
|
});
|
|
24
14
|
|
|
25
|
-
// TODO(domain): replace the test above by one per decision of the guard.
|
|
26
15
|
it.todo('lets through the caller it is written for');
|
|
27
16
|
});
|
|
17
|
+
|
|
18
|
+
function requestOf(actor: Actor): GuardRequest {
|
|
19
|
+
return {
|
|
20
|
+
method: 'GET',
|
|
21
|
+
path: '/',
|
|
22
|
+
operationId: 'anOperation',
|
|
23
|
+
params: {},
|
|
24
|
+
headers: {},
|
|
25
|
+
actor,
|
|
26
|
+
context: {
|
|
27
|
+
requestId: 'request-1',
|
|
28
|
+
execution: executionContext({ correlationId: 'correlation-1', actor, origin: 'http' }),
|
|
29
|
+
raw: undefined,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -5,10 +5,8 @@ import { ForbiddenError, Guard, type GuardRequest } from '@ddd-ts-kit/http';
|
|
|
5
5
|
export class {{name.pascal}}Guard implements Guard {
|
|
6
6
|
readonly documents = { errors: ['FORBIDDEN'] };
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw new ForbiddenError('The caller may not use these routes');
|
|
12
|
-
}
|
|
8
|
+
// TODO(domain): a guard refuses everybody until it is written. Replace this refusal by the control, read from `actor` and `params` of the request: a role of the caller, a membership read from the path, a key of the request.
|
|
9
|
+
check(_request: GuardRequest): void {
|
|
10
|
+
throw new ForbiddenError('The caller may not use these routes');
|
|
13
11
|
}
|
|
14
12
|
}
|
|
@@ -100,7 +100,7 @@ configuration, the storage, and `composeApplication` of `{{config.platformDir}}/
|
|
|
100
100
|
parameter typed by a port class names what is injected (`private readonly clock: Clock`), the
|
|
101
101
|
ports of the kernel included (`Clock`, `IdGenerator`, `CommandBus`, `UnitOfWork`... of
|
|
102
102
|
`@ddd-ts-kit/kernel`).
|
|
103
|
-
{{#if di.
|
|
103
|
+
{{#if di.container}}
|
|
104
104
|
- **Three modules, then the contexts.** `kernelModule({...})` binds the ports of the kernel to what
|
|
105
105
|
this platform chose (one execution scope, one clock, the two buses with their middlewares);
|
|
106
106
|
`platformModule` (`{{config.platformDir}}/composition/platform.module.ts`) rebinds what needs the storage{{#if broker.external}}, the broker{{/if}}{{#if cache.redis}} or the Redis protocol server{{/if}}
|
|
@@ -108,7 +108,7 @@ configuration, the storage, and `composeApplication` of `{{config.platformDir}}/
|
|
|
108
108
|
module binds the guard both buses ask first. Replacing a provider happens in the platform module
|
|
109
109
|
and nowhere else.
|
|
110
110
|
{{/if}}
|
|
111
|
-
{{#unless di.
|
|
111
|
+
{{#unless di.container}}
|
|
112
112
|
- **One `Platform`, handed to each context.** `createPlatform` (`{{config.platformDir}}/composition/create-platform.ts`)
|
|
113
113
|
builds the buses, the clock, the storage and the event ports once; the module file of a context
|
|
114
114
|
receives it and registers its handlers, adapters and jobs on it. Replacing a provider happens
|
|
@@ -151,7 +151,8 @@ configuration, the storage, and `composeApplication` of `{{config.platformDir}}/
|
|
|
151
151
|
| `LOG_FORMAT` | `json` (the default, everywhere) or `pretty` (a developer's terminal) |
|
|
152
152
|
{{/unless}}
|
|
153
153
|
| `LOG_SCRUB_MESSAGES` | `true` writes `[message removed]` for the message of every logged error that is not a `DomainError` |
|
|
154
|
-
| `OTEL_EXPORTER_OTLP_ENDPOINT` | where spans go; left out, none leaves the process. `docker compose --profile observability up -d jaeger`, then `http://127.0.0.1:4318`, and the traces are on `http://127.0.0.1:16686` |
|
|
154
|
+
| `OTEL_EXPORTER_OTLP_ENDPOINT` | where spans and metrics go; left out, none leaves the process. `docker compose --profile observability up -d jaeger`, then `http://127.0.0.1:4318`, and the traces are on `http://127.0.0.1:16686` (Jaeger keeps no metrics) |
|
|
155
|
+
| `OTEL_METRICS_EXPORTER` | `none` keeps the metrics in the process, the spans still leave; left out or `otlp`, they leave with the spans, every `OTEL_METRIC_EXPORT_INTERVAL` milliseconds (60000 by default) |
|
|
155
156
|
| `TRACE_SAMPLE_RATIO` | the share of traces kept, 0 to 1; left out, every trace |
|
|
156
157
|
| `TRACE_CONSUMERS` | `continue` (the default): a consumed event stays in the trace of the request that published it; `link`: each delivery starts a trace linked to it |
|
|
157
158
|
|
|
@@ -246,7 +247,7 @@ Unexpected failures go to an error tracker through the kernel `ErrorReporter`, b
|
|
|
246
247
|
| `SENTRY_DSN` | where the events go. Empty or absent: the application starts and reports nothing. Anything else than a URL refuses the start |
|
|
247
248
|
| `SENTRY_ENVIRONMENT` | the environment issues are filed under; `NODE_ENV` when left out |
|
|
248
249
|
| `SENTRY_RELEASE` | the release issues are attached to; none when left out |
|
|
249
|
-
| `SENTRY_SCRUB_MESSAGES` | `true` removes the message of every reported error that is not a `DomainError`: for a tracker hosted by a third party |
|
|
250
|
+
| `SENTRY_SCRUB_MESSAGES` | `true` removes the message of every reported error that is not a `DomainError`: for a tracker hosted by a third party. Left out, the message is sent with the values a failed statement quotes redacted |
|
|
250
251
|
|
|
251
252
|
| Reported | Not reported |
|
|
252
253
|
|---|---|
|
|
@@ -268,8 +269,9 @@ Unexpected failures go to an error tracker through the kernel `ErrorReporter`, b
|
|
|
268
269
|
One failure is one report: the first boundary that sees an error reports it, the others recognise
|
|
269
270
|
it. Each report carries the trace id of the active span, which opens the trace in the tracing
|
|
270
271
|
backend. What leaves the process is scrubbed first: no request body, header, cookie or query
|
|
271
|
-
string, no local variable, no breadcrumb, no email or name (the actor id only), no tenant
|
|
272
|
-
message of the error is sent
|
|
272
|
+
string, no local variable, no breadcrumb, no email or name (the actor id only), no tenant, no
|
|
273
|
+
value a failed statement quotes. The message of the error is sent, the statement it quotes with
|
|
274
|
+
its values redacted: `scrubMessages: true` in `{{config.platformDir}}/observability/errors.ts` removes
|
|
273
275
|
it for everything that is not a `DomainError`, which is the setting for a tracker hosted by a
|
|
274
276
|
third party. The README of `@ddd-ts-kit/sentry` has the full table and the other options
|
|
275
277
|
(`sampleRate`, `tagTenant`, `beforeSend`).
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
FROM node:24-slim AS build
|
|
4
4
|
WORKDIR /app
|
|
5
|
-
{{#if pm.corepack}}
|
|
6
|
-
# corepack provides the release of the package manager that package.json pins.
|
|
7
|
-
RUN corepack enable
|
|
8
|
-
{{/if}}
|
|
9
5
|
COPY package.json package-lock.json{{#if pm.pnpm}} pnpm-workspace.yaml{{/if}} ./
|
|
6
|
+
{{#if pm.pinned}}
|
|
7
|
+
# npm installs the release of pnpm that package.json pins: Node 25 and later ship no corepack.
|
|
8
|
+
RUN npm install --global "$(node -p "require('./package.json').packageManager")"
|
|
9
|
+
{{/if}}
|
|
10
10
|
RUN npm ci
|
|
11
11
|
COPY . .
|
|
12
12
|
RUN npm run build
|
|
13
13
|
|
|
14
14
|
FROM node:24-slim AS dependencies
|
|
15
15
|
WORKDIR /app
|
|
16
|
-
{{#if pm.corepack}}
|
|
17
|
-
RUN corepack enable
|
|
18
|
-
{{/if}}
|
|
19
16
|
COPY package.json package-lock.json{{#if pm.pnpm}} pnpm-workspace.yaml{{/if}} ./
|
|
17
|
+
{{#if pm.pinned}}
|
|
18
|
+
RUN npm install --global "$(node -p "require('./package.json').packageManager")"
|
|
19
|
+
{{/if}}
|
|
20
20
|
RUN npm ci --omit=dev
|
|
21
21
|
|
|
22
22
|
FROM node:24-slim
|
|
@@ -191,6 +191,8 @@ MINIO_PORT=9000
|
|
|
191
191
|
# Traces: start Jaeger with `docker compose --profile observability up -d jaeger`, then open http://127.0.0.1:16686
|
|
192
192
|
# Without an endpoint no span leaves the process.
|
|
193
193
|
# OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
|
|
194
|
+
# The metrics leave with the spans, every OTEL_METRIC_EXPORT_INTERVAL milliseconds (60000 by default). This keeps the metrics in the process, the spans still leave:
|
|
195
|
+
# OTEL_METRICS_EXPORTER=none
|
|
194
196
|
# Share of the traces kept, 0 to 1, decided where a trace starts; left out, every trace is kept.
|
|
195
197
|
# TRACE_SAMPLE_RATIO=1
|
|
196
198
|
# continue: a consumed event stays in the trace of the request that published it. link: each delivery starts its own trace, linked to it.
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
{{#unless httpCache.varnish}}
|
|
14
14
|
import type { IntegrationEvent, IntegrationEventSubscriber, JobScheduler } from '@ddd-ts-kit/kernel';
|
|
15
15
|
{{/unless}}
|
|
16
|
-
{{#if di.
|
|
16
|
+
{{#if di.container}}
|
|
17
17
|
import { defineContextModule } from '@ddd-ts-kit/di';
|
|
18
18
|
{{/if}}
|
|
19
19
|
import { createHttpClient, settled, type HttpClient, type SettledOptions } from '@ddd-ts-kit/testing/e2e';
|
|
@@ -21,11 +21,11 @@ import { createHttpClient, settled, type HttpClient, type SettledOptions } from
|
|
|
21
21
|
import { relateSystemActors } from '{{alias.platform}}/auth/relationships/relate-system-actors{{alias.ext}}';
|
|
22
22
|
import { relationTuples } from '{{alias.platform}}/auth/relationships/relation-tuples{{alias.ext}}';
|
|
23
23
|
{{/if}}
|
|
24
|
-
{{#if di.
|
|
24
|
+
{{#if di.container}}
|
|
25
25
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
26
26
|
import type { ContextSelection } from '{{alias.platform}}/composition/context-selection{{alias.ext}}';
|
|
27
27
|
{{/if}}
|
|
28
|
-
{{#unless di.
|
|
28
|
+
{{#unless di.container}}
|
|
29
29
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
30
30
|
{{/unless}}
|
|
31
31
|
import type { AppConfig } from '{{alias.platform}}/config/app-config{{alias.ext}}';
|
|
@@ -270,7 +270,7 @@ function eventsOf(config: AppConfig): EventProvider {
|
|
|
270
270
|
* (an identity provider, a payment service) is answered by its fake of `test/fakes/` here, where
|
|
271
271
|
* the preset or the person who adds it binds it, so that its handlers settle instead of retrying.
|
|
272
272
|
*/
|
|
273
|
-
{{#if di.
|
|
273
|
+
{{#if di.container}}
|
|
274
274
|
function contextsOfTheRun(): ContextSelection {
|
|
275
275
|
const fakes = defineContextModule({
|
|
276
276
|
name: 'end-to-end-fakes',
|
|
@@ -283,7 +283,7 @@ function contextsOfTheRun(): ContextSelection {
|
|
|
283
283
|
return { ...everyContext, modules: [...everyContext.modules, fakes] };
|
|
284
284
|
}
|
|
285
285
|
{{/if}}
|
|
286
|
-
{{#unless di.
|
|
286
|
+
{{#unless di.container}}
|
|
287
287
|
function contextsOfTheRun(): typeof everyContext {
|
|
288
288
|
return everyContext.map((module): (typeof everyContext)[number] => {
|
|
289
289
|
// ddd-ts-kit:e2e-fakes
|
|
@@ -13,18 +13,18 @@ import {
|
|
|
13
13
|
{{#unless httpCache.varnish}}
|
|
14
14
|
import type { IntegrationEvent, IntegrationEventSubscriber, JobScheduler } from '@ddd-ts-kit/kernel';
|
|
15
15
|
{{/unless}}
|
|
16
|
-
{{#if di.
|
|
16
|
+
{{#if di.container}}
|
|
17
17
|
import { defineContextModule } from '@ddd-ts-kit/di';
|
|
18
18
|
{{/if}}
|
|
19
19
|
import { createHttpClient, settled, type HttpClient, type SettledOptions } from '@ddd-ts-kit/testing/e2e';
|
|
20
20
|
{{#if authz.rebac}}
|
|
21
21
|
import { relationTuples } from '{{alias.platform}}/auth/relationships/relation-tuples{{alias.ext}}';
|
|
22
22
|
{{/if}}
|
|
23
|
-
{{#if di.
|
|
23
|
+
{{#if di.container}}
|
|
24
24
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
25
25
|
import type { ContextSelection } from '{{alias.platform}}/composition/context-selection{{alias.ext}}';
|
|
26
26
|
{{/if}}
|
|
27
|
-
{{#unless di.
|
|
27
|
+
{{#unless di.container}}
|
|
28
28
|
import { composeApplication, everyContext } from '{{alias.platform}}/composition/compose-application{{alias.ext}}';
|
|
29
29
|
{{/unless}}
|
|
30
30
|
{{#if broker.provided}}
|
|
@@ -258,7 +258,7 @@ function eventsOf(config: AppConfig): EventProvider {
|
|
|
258
258
|
* (an identity provider, a payment service) is answered by its fake of `test/fakes/` here, where
|
|
259
259
|
* the preset or the person who adds it binds it, so that its handlers settle instead of retrying.
|
|
260
260
|
*/
|
|
261
|
-
{{#if di.
|
|
261
|
+
{{#if di.container}}
|
|
262
262
|
function contextsOfTheRun(): ContextSelection {
|
|
263
263
|
const fakes = defineContextModule({
|
|
264
264
|
name: 'end-to-end-fakes',
|
|
@@ -271,7 +271,7 @@ function contextsOfTheRun(): ContextSelection {
|
|
|
271
271
|
return { ...everyContext, modules: [...everyContext.modules, fakes] };
|
|
272
272
|
}
|
|
273
273
|
{{/if}}
|
|
274
|
-
{{#unless di.
|
|
274
|
+
{{#unless di.container}}
|
|
275
275
|
function contextsOfTheRun(): typeof everyContext {
|
|
276
276
|
return everyContext.map((module): (typeof everyContext)[number] => {
|
|
277
277
|
// ddd-ts-kit:e2e-fakes
|
|
@@ -7,13 +7,8 @@ import { Access, Authenticator } from '@ddd-ts-kit/auth';
|
|
|
7
7
|
import { Authenticator } from '@ddd-ts-kit/auth';
|
|
8
8
|
{{/unless}}
|
|
9
9
|
{{/if}}
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
kernelModule,
|
|
13
|
-
type Application as Container,
|
|
14
|
-
type ContextModule,
|
|
15
|
-
type JobsOptions,
|
|
16
|
-
} from '@ddd-ts-kit/di';
|
|
10
|
+
import { kernelModule, type Application as Container, type ContextModule, type JobsOptions } from '@ddd-ts-kit/di';
|
|
11
|
+
import { createApplication } from '{{di.entry}}';
|
|
17
12
|
{{#if events.outbox}}
|
|
18
13
|
import { OutboxPublisher } from '@ddd-ts-kit/events';
|
|
19
14
|
{{/if}}
|
|
@@ -142,6 +137,7 @@ export interface Application {
|
|
|
142
137
|
/** Where another context, or a test, listens to what this application publishes. */
|
|
143
138
|
readonly eventSubscriber: IntegrationEventSubscriber;
|
|
144
139
|
readonly logger: Logger;
|
|
140
|
+
readonly metrics: Metrics;
|
|
145
141
|
/** Runs a job at once, for a test: `jobs.runNow('<context>.<job>')`. */
|
|
146
142
|
readonly jobs: JobScheduler;
|
|
147
143
|
{{#if cache.rateLimit}}
|
|
@@ -372,6 +368,7 @@ function running({ container, options, contexts }: Composed): Application {
|
|
|
372
368
|
eventSubscriber: container.resolve(IntegrationEventSubscriber),
|
|
373
369
|
{{/unless}}
|
|
374
370
|
logger,
|
|
371
|
+
metrics: container.resolve(Metrics),
|
|
375
372
|
jobs: container.resolve(JobScheduler),
|
|
376
373
|
{{#if cache.rateLimit}}
|
|
377
374
|
rateLimiter: container.resolve(RateLimiter),
|
|
@@ -146,6 +146,7 @@ export interface Application {
|
|
|
146
146
|
/** Where another context, or a test, listens to what this application publishes. */
|
|
147
147
|
readonly eventSubscriber: IntegrationEventSubscriber;
|
|
148
148
|
readonly logger: Logger;
|
|
149
|
+
readonly metrics: Platform['metrics'];
|
|
149
150
|
/** Runs a job at once, for a test: `jobs.runNow('<context>.<job>')`. */
|
|
150
151
|
readonly jobs: JobScheduler;
|
|
151
152
|
{{#if cache.rateLimit}}
|
|
@@ -234,6 +235,7 @@ export function composeApplication(
|
|
|
234
235
|
eventSubscriber: platform.subscriber,
|
|
235
236
|
{{/unless}}
|
|
236
237
|
logger,
|
|
238
|
+
metrics,
|
|
237
239
|
jobs: platform.jobs,
|
|
238
240
|
{{#if cache.rateLimit}}
|
|
239
241
|
rateLimiter: platform.rateLimiter,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OutboxRelay, type OutboxStore{{#if events.wakeable}}, type RelaySignal{{/if}} } from '@ddd-ts-kit/events';
|
|
2
2
|
{{#if errors.none}}
|
|
3
|
-
import { SystemClock, type IntegrationEventPublisher, type Logger } from '@ddd-ts-kit/kernel';
|
|
3
|
+
import { SystemClock, type IntegrationEventPublisher, type Logger, type Metrics } from '@ddd-ts-kit/kernel';
|
|
4
4
|
{{/if}}
|
|
5
5
|
{{#if errors.sentry}}
|
|
6
6
|
import {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type ErrorReporter,
|
|
11
11
|
type IntegrationEventPublisher,
|
|
12
12
|
type Logger,
|
|
13
|
+
type Metrics,
|
|
13
14
|
} from '@ddd-ts-kit/kernel';
|
|
14
15
|
{{/if}}
|
|
15
16
|
{{#if broker.kafka}}
|
|
@@ -24,6 +25,8 @@ export interface OutboxRelayOptions {
|
|
|
24
25
|
/** How many times a publication is tried before its record is declared dead; left out, the default of the relay. */
|
|
25
26
|
readonly maxAttempts?: number;
|
|
26
27
|
readonly logger: Logger;
|
|
28
|
+
/** Where the depth of the outbox goes after each tick (`outbox_pending`, `outbox_failed`, `outbox_dead`); left out (the tests), nowhere. */
|
|
29
|
+
readonly metrics?: Metrics;
|
|
27
30
|
{{#if errors.sentry}}
|
|
28
31
|
/** Where an event whose publication the relay declares dead is reported; left out (the tests), nowhere. */
|
|
29
32
|
readonly errors?: ErrorReporter;
|
|
@@ -48,6 +51,7 @@ export function startOutboxRelay(options: OutboxRelayOptions): RunningRelay {
|
|
|
48
51
|
publisher: options.publisher,
|
|
49
52
|
clock: new SystemClock(),
|
|
50
53
|
...(options.maxAttempts === undefined ? {} : { maxAttempts: options.maxAttempts }),
|
|
54
|
+
...(options.metrics === undefined ? {} : { metrics: options.metrics }),
|
|
51
55
|
{{#if broker.kafka}}
|
|
52
56
|
// The events of one aggregate leave in the order they were stored, under the key Kafka orders them by: it takes a single running relay.
|
|
53
57
|
ordering: 'per-key',
|
|
@@ -14,8 +14,8 @@ export interface LogSettings {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* JSON lines on the standard output,
|
|
18
|
-
*
|
|
17
|
+
* JSON lines on the standard output, the credential keys of the kernel redacted whatever
|
|
18
|
+
* their case (`init --logger pino` or `--logger winston` has a pretty format). Every entry carries
|
|
19
19
|
* what the execution scope knows of the work in progress (correlation id, origin, actor,
|
|
20
20
|
* tenant) and the ids of the active trace, so a request is followed from its log lines to its
|
|
21
21
|
* spans and to its audit entries. `stop()` of the application flushes it, last.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Metrics } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { openTelemetryMetrics } from '@ddd-ts-kit/tracing';
|
|
2
3
|
|
|
3
|
-
//
|
|
4
|
+
// On the meter provider `initTracing` registered (`tracing.ts`, imported first by main.ts): the
|
|
5
|
+
// series leave by OTLP with the spans when `OTEL_EXPORTER_OTLP_ENDPOINT` is set, and are measured
|
|
6
|
+
// by nothing when it is not, nor in the tests.
|
|
4
7
|
export function createMetrics(): Metrics {
|
|
5
|
-
return
|
|
8
|
+
return openTelemetryMetrics({ meterName: '{{project.name}}' });
|
|
6
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The adapters that state their own policy: filled by `ownPolicy` (`own-policy.ts`, which
|
|
3
|
-
* `generate adapter` writes on
|
|
3
|
+
* `generate adapter` writes on a container of the kit), read by `defaultPolicy`, which leaves them alone. The
|
|
4
4
|
* default policy wraps outside the own one, so it finds here the very instance `ownPolicy` returned.
|
|
5
5
|
*/
|
|
6
6
|
export const adaptersWithOwnPolicy = new WeakSet<object>();
|
|
@@ -5,7 +5,7 @@ import type { ResilienceSettings } from '{{alias.platform}}/resilience/resilienc
|
|
|
5
5
|
/**
|
|
6
6
|
* What goes around every adapter that leaves the process (`external`, `gateway`) and states no
|
|
7
7
|
* policy of its own: retries with backoff, and a time limit for each attempt. `forKinds` is the
|
|
8
|
-
* filter: a platform wired by hand gives every adapter to it, the
|
|
8
|
+
* filter: a platform wired by hand gives every adapter to it, the module of the platform only those two kinds.
|
|
9
9
|
*/
|
|
10
10
|
export function defaultPolicy(settings: ResilienceSettings): Aspect {
|
|
11
11
|
const policy = when(
|
|
@@ -13,16 +13,16 @@ paths:
|
|
|
13
13
|
- One folder per concern, no file at the root: `composition/` turns the platform and the contexts into an application, `auth/` holds `authentication/` (who is calling), `authorization/` (what they may do, whatever the model) and the folder of the model, `observability/` the traces, logs, measures{{#if errors.sentry}} and error reports{{/if}}, `jobs/` the settings of the scheduled jobs{{#if audit.route}}, `audit/search-audit-entries/` the read side of the trail{{/if}}. A new file joins the folder of what it answers.
|
|
14
14
|
- `main.ts`, and each `apps/*/main.ts`, imports `platform/observability/tracing.ts` first{{#if errors.sentry}}, `platform/observability/errors.ts` second{{/if}}, then composes the application: nothing else belongs in an entry point.
|
|
15
15
|
- Contexts, routes and registries are added by the generator between `// ddd-ts-kit:` markers: never edit between them, never remove one.
|
|
16
|
-
{{#if di.
|
|
16
|
+
{{#if di.container}}
|
|
17
17
|
- Ports and values are bound by class: `bind(Port).toClass(...)`, `toValue(...)`, or `rebind(Port)` over a default of the kernel module. No token helper, no injection constant; one exported class, interface or function per file.
|
|
18
18
|
- Cross-cutting behaviour lives here: spans through `kernelModule({ instrumentation })` (`composition/lay-foundations.ts`), `around: tracedRoutes()` at the HTTP boundary and `tracedPublisher` for the outbox relay; logs, measures, permissions and audit as bus middlewares (`buses/`); the policy of outbound adapters in `resilience/`.
|
|
19
19
|
{{/if}}
|
|
20
|
-
{{#unless di.
|
|
20
|
+
{{#unless di.container}}
|
|
21
21
|
- One `Platform` is built in `composition/create-platform.ts` and handed to each context; a port or a value is typed by an abstract class. No token helper, no injection constant; one exported class, interface or function per file.
|
|
22
22
|
- Cross-cutting behaviour lives here: spans through the members of `traceApplication()` (`composition/lay-foundations.ts`, handed to the buses and to every adapter by `composition/create-platform.ts`), `around: tracedRoutes()` at the HTTP boundary and `tracedPublisher` for the outbox relay; logs, measures, permissions and audit as bus middlewares (`buses/`); the policy of outbound adapters in `resilience/`.
|
|
23
23
|
{{/unless}}
|
|
24
24
|
{{#if files.any}}
|
|
25
|
-
- Files: `files/open-files.ts` opens the connector of `stack.storage` from `config/read-files.ts`{{#if di.
|
|
25
|
+
- Files: `files/open-files.ts` opens the connector of `stack.storage` from `config/read-files.ts`{{#if di.container}}, `files/files.module.ts` binds the ports and the hourly purge of staged files, `files/staging-uploads.ts` stages the file a command carries on the command bus, before the transaction{{/if}}{{#unless di.container}}, `files/create-files.ts` builds them, `composition/compose-application.ts` registers the hourly purge of staged files and `buses/create-command-bus.ts` stages the file a command carries on the command bus, before the transaction{{/unless}}; the tools and the tests keep files in memory. A scanner of your own (an antivirus) is bound here, never called from a use case.
|
|
26
26
|
{{/if}}
|
|
27
27
|
- `@ddd-ts-kit/tracing` and `@opentelemetry/*` are imported here and nowhere else (`tracing/platform-only`).
|
|
28
28
|
- Logs, spans and error reports carry identifiers and codes only: never arguments, payloads, error messages, nor anything personal beyond the id of the actor.
|
|
@@ -8,11 +8,11 @@ paths:
|
|
|
8
8
|
# Tests
|
|
9
9
|
|
|
10
10
|
- `test/unit/`: aggregates, value objects and domain services without any double, given / when / then on the recorded facts; handlers with the fakes of `test/fakes/`.
|
|
11
|
-
{{#if di.
|
|
11
|
+
{{#if di.container}}
|
|
12
12
|
- A handler spec goes through the test application, `createTestApplication({ modules, fakes: [fake(Port, aFake)] })`: it asserts the stored state, the facts announced with the save and heard at the end of the command (`application.domainEvents`), `application.eventBus.published`, and the refusal (`FORBIDDEN`) of an actor without the permission.
|
|
13
13
|
- A job spec runs the job by its name, `await application.jobs.runNow('<context>.<job>')`, and asserts the command it sent as its system actor.
|
|
14
14
|
{{/if}}
|
|
15
|
-
{{#unless di.
|
|
15
|
+
{{#unless di.container}}
|
|
16
16
|
- A handler spec goes through the buses of `createTestBuses()`, the fake repository wrapped by `dispatching(...)`: it asserts the stored state, the facts announced with the save and heard at the end of the command (`domainEvents`), `publishedEvents()`, and the refusal (`FORBIDDEN`) of an actor without the permission.
|
|
17
17
|
- A job spec runs the job with an occurrence, `await job.run(occurrence)`, and asserts the command it sent as its system actor.
|
|
18
18
|
{{/unless}}
|
|
@@ -15,10 +15,11 @@ runs:
|
|
|
15
15
|
# The newest patch of the release line, not the one the image of the runner holds: a security
|
|
16
16
|
# release of Node reaches the next run.
|
|
17
17
|
check-latest: true
|
|
18
|
-
{{#if pm.
|
|
18
|
+
{{#if pm.pinned}}
|
|
19
19
|
- name: The package manager package.json pins
|
|
20
20
|
shell: bash
|
|
21
|
-
run:
|
|
21
|
+
run: |
|
|
22
|
+
npm install --global "$(node -p "require('./package.json').packageManager")"
|
|
22
23
|
{{/if}}
|
|
23
24
|
# One install per lockfile, shared by every job and every run. The key holds the lockfile and
|
|
24
25
|
# package.json: a hit is what a fresh install of that lockfile gives, and a manifest that left
|
|
@@ -75,8 +75,8 @@ default:
|
|
|
75
75
|
- node_modules/
|
|
76
76
|
policy: pull
|
|
77
77
|
before_script:
|
|
78
|
-
{{#if pm.
|
|
79
|
-
-
|
|
78
|
+
{{#if pm.pinned}}
|
|
79
|
+
- npm install --global "$(node -p "require('./package.json').packageManager")"
|
|
80
80
|
{{/if}}
|
|
81
81
|
- test -d node_modules || npm ci
|
|
82
82
|
{{#if orm.prisma}}
|