ddd-ts-kit 0.83.4 → 0.84.1
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 +16 -0
- package/README.fr.md +28 -25
- package/README.md +27 -24
- package/dist/check/authz/is-in-project.d.ts +4 -0
- package/dist/check/authz/is-in-project.d.ts.map +1 -0
- package/dist/check/authz/is-in-project.js +5 -0
- package/dist/check/authz/is-in-project.js.map +1 -0
- package/dist/check/authz/signed-in-grants.d.ts +1 -1
- package/dist/check/authz/signed-in-grants.d.ts.map +1 -1
- package/dist/check/authz/signed-in-grants.js +4 -2
- package/dist/check/authz/signed-in-grants.js.map +1 -1
- package/dist/check/explain/authz-docs.js +5 -5
- package/dist/check/explain/authz-docs.js.map +1 -1
- package/dist/check/explain/events-docs.js +1 -1
- package/dist/check/explain/standard-docs.js +1 -1
- package/dist/check/fixtures/authz-granted-fixtures.js +4 -4
- package/dist/check/fixtures/authz-granted-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-scope-narrows-fixtures.js +2 -2
- package/dist/check/fixtures/authz-scope-narrows-fixtures.js.map +1 -1
- package/dist/check/fixtures/paths.d.ts +1 -1
- package/dist/check/fixtures/paths.d.ts.map +1 -1
- package/dist/check/fixtures/paths.js +1 -1
- package/dist/check/fixtures/paths.js.map +1 -1
- package/dist/check/fixtures/tracing-fixtures.js +3 -3
- package/dist/check/fixtures/tracing-fixtures.js.map +1 -1
- package/dist/check/fixtures/tree-fixtures.js +1 -1
- package/dist/check/fixtures/tree-fixtures.js.map +1 -1
- package/dist/check/fixtures/vocabulary-fixtures.js +2 -2
- package/dist/check/fixtures/vocabulary-fixtures.js.map +1 -1
- package/dist/check/rules/authz-granted.d.ts.map +1 -1
- package/dist/check/rules/authz-granted.js +4 -1
- package/dist/check/rules/authz-granted.js.map +1 -1
- package/dist/check/rules/authz-scope-narrows.d.ts.map +1 -1
- package/dist/check/rules/authz-scope-narrows.js +3 -1
- package/dist/check/rules/authz-scope-narrows.js.map +1 -1
- package/dist/check/rules/events-outbox-required.d.ts.map +1 -1
- package/dist/check/rules/events-outbox-required.js +4 -2
- package/dist/check/rules/events-outbox-required.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +3 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +2 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/platform-folders.d.ts +4 -0
- package/dist/commands/platform-folders.d.ts.map +1 -0
- package/dist/commands/platform-folders.js +43 -0
- package/dist/commands/platform-folders.js.map +1 -0
- package/dist/controllers/finish-migration.d.ts.map +1 -1
- package/dist/controllers/finish-migration.js +7 -3
- package/dist/controllers/finish-migration.js.map +1 -1
- package/dist/depcruise/hygiene-rules.js +1 -1
- package/dist/depcruise/hygiene-rules.js.map +1 -1
- package/dist/doctor/diagnose.d.ts +2 -1
- package/dist/doctor/diagnose.d.ts.map +1 -1
- package/dist/doctor/diagnose.js +10 -2
- package/dist/doctor/diagnose.js.map +1 -1
- package/dist/doctor/doctor-finding.d.ts +3 -3
- package/dist/doctor/doctor-finding.d.ts.map +1 -1
- package/dist/doctor/folder-findings.d.ts +5 -0
- package/dist/doctor/folder-findings.d.ts.map +1 -0
- package/dist/doctor/folder-findings.js +19 -0
- package/dist/doctor/folder-findings.js.map +1 -0
- package/dist/doctor/format-diagnosis.js +9 -1
- package/dist/doctor/format-diagnosis.js.map +1 -1
- package/dist/doctor/script-findings.d.ts +2 -2
- package/dist/doctor/script-findings.d.ts.map +1 -1
- package/dist/doctor/script-findings.js +3 -3
- package/dist/doctor/script-findings.js.map +1 -1
- package/dist/generate/grant-permission.d.ts.map +1 -1
- package/dist/generate/grant-permission.js +3 -2
- package/dist/generate/grant-permission.js.map +1 -1
- package/dist/generate/kinds/gateway-kind.d.ts.map +1 -1
- package/dist/generate/kinds/gateway-kind.js +2 -1
- package/dist/generate/kinds/gateway-kind.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 +5 -6
- 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/plan-vars.d.ts +6 -2
- package/dist/generate/kinds/plan-vars.d.ts.map +1 -1
- package/dist/generate/kinds/plan-vars.js +7 -3
- package/dist/generate/kinds/plan-vars.js.map +1 -1
- package/dist/generate/kinds/policy-kind.d.ts.map +1 -1
- package/dist/generate/kinds/policy-kind.js +2 -1
- package/dist/generate/kinds/policy-kind.js.map +1 -1
- package/dist/generate/kinds/wire-context.d.ts.map +1 -1
- package/dist/generate/kinds/wire-context.js +6 -4
- package/dist/generate/kinds/wire-context.js.map +1 -1
- package/dist/generate/kinds/write-context-files.d.ts.map +1 -1
- package/dist/generate/kinds/write-context-files.js +2 -1
- package/dist/generate/kinds/write-context-files.js.map +1 -1
- package/dist/generate/platform-path.d.ts +5 -0
- package/dist/generate/platform-path.d.ts.map +1 -0
- package/dist/generate/platform-path.js +6 -0
- package/dist/generate/platform-path.js.map +1 -0
- package/dist/generate/shared-writes.js +8 -8
- package/dist/generate/shared-writes.js.map +1 -1
- package/dist/generate/vocabulary/declare-role.d.ts +1 -1
- package/dist/generate/vocabulary/declare-role.d.ts.map +1 -1
- package/dist/generate/vocabulary/declare-role.js +3 -2
- package/dist/generate/vocabulary/declare-role.js.map +1 -1
- package/dist/generate/wirings.d.ts.map +1 -1
- package/dist/generate/wirings.js +4 -3
- package/dist/generate/wirings.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +9 -0
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +1 -0
- package/dist/help/usage.js.map +1 -1
- package/dist/init/files/audit-files.d.ts.map +1 -1
- package/dist/init/files/audit-files.js +9 -2
- package/dist/init/files/audit-files.js.map +1 -1
- package/dist/init/files/auth-files.d.ts.map +1 -1
- package/dist/init/files/auth-files.js +31 -22
- package/dist/init/files/auth-files.js.map +1 -1
- package/dist/init/files/platform-files.js +10 -6
- package/dist/init/files/platform-files.js.map +1 -1
- package/dist/init/manifest/scripts-for.d.ts +2 -2
- package/dist/init/manifest/scripts-for.d.ts.map +1 -1
- package/dist/init/manifest/scripts-for.js +7 -7
- package/dist/init/manifest/scripts-for.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/manifest/write-manifest.d.ts.map +1 -1
- package/dist/init/manifest/write-manifest.js +3 -1
- package/dist/init/manifest/write-manifest.js.map +1 -1
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +13 -4
- package/dist/init/run-init.js.map +1 -1
- package/dist/platform-folders/flat-files.d.ts +3 -0
- package/dist/platform-folders/flat-files.d.ts.map +1 -0
- package/dist/platform-folders/flat-files.js +4 -0
- package/dist/platform-folders/flat-files.js.map +1 -0
- package/dist/platform-folders/flat-relocation.d.ts +10 -0
- package/dist/platform-folders/flat-relocation.d.ts.map +1 -0
- package/dist/platform-folders/flat-relocation.js +18 -0
- package/dist/platform-folders/flat-relocation.js.map +1 -0
- package/dist/platform-folders/folder-move.d.ts +6 -0
- package/dist/platform-folders/folder-move.d.ts.map +1 -0
- package/dist/platform-folders/folder-move.js +2 -0
- package/dist/platform-folders/folder-move.js.map +1 -0
- package/dist/platform-folders/index.d.ts +6 -0
- package/dist/platform-folders/index.d.ts.map +1 -0
- package/dist/platform-folders/index.js +5 -0
- package/dist/platform-folders/index.js.map +1 -0
- package/dist/platform-folders/keep-flat-platform.d.ts +9 -0
- package/dist/platform-folders/keep-flat-platform.d.ts.map +1 -0
- package/dist/platform-folders/keep-flat-platform.js +14 -0
- package/dist/platform-folders/keep-flat-platform.js.map +1 -0
- package/dist/platform-folders/moved-specifier.d.ts +14 -0
- package/dist/platform-folders/moved-specifier.d.ts.map +1 -0
- package/dist/platform-folders/moved-specifier.js +38 -0
- package/dist/platform-folders/moved-specifier.js.map +1 -0
- package/dist/platform-folders/placements.d.ts +8 -0
- package/dist/platform-folders/placements.d.ts.map +1 -0
- package/dist/platform-folders/placements.js +25 -0
- package/dist/platform-folders/placements.js.map +1 -0
- package/dist/platform-folders/platform-folder-names.d.ts +3 -0
- package/dist/platform-folders/platform-folder-names.d.ts.map +1 -0
- package/dist/platform-folders/platform-folder-names.js +7 -0
- package/dist/platform-folders/platform-folder-names.js.map +1 -0
- package/dist/platform-folders/platform-folders.d.ts +27 -0
- package/dist/platform-folders/platform-folders.d.ts.map +1 -0
- package/dist/platform-folders/platform-folders.js +53 -0
- package/dist/platform-folders/platform-folders.js.map +1 -0
- package/dist/platform-folders/platform-moves.d.ts +9 -0
- package/dist/platform-folders/platform-moves.d.ts.map +1 -0
- package/dist/platform-folders/platform-moves.js +16 -0
- package/dist/platform-folders/platform-moves.js.map +1 -0
- package/dist/platform-folders/unknown-flat-files.d.ts +5 -0
- package/dist/platform-folders/unknown-flat-files.d.ts.map +1 -0
- package/dist/platform-folders/unknown-flat-files.js +14 -0
- package/dist/platform-folders/unknown-flat-files.js.map +1 -0
- package/dist/platform-folders/with-moved-imports.d.ts +7 -0
- package/dist/platform-folders/with-moved-imports.d.ts.map +1 -0
- package/dist/platform-folders/with-moved-imports.js +14 -0
- package/dist/platform-folders/with-moved-imports.js.map +1 -0
- package/dist/platform-layout/index.d.ts +5 -0
- package/dist/platform-layout/index.d.ts.map +1 -0
- package/dist/platform-layout/index.js +4 -0
- package/dist/platform-layout/index.js.map +1 -0
- package/dist/platform-layout/platform-file-in.d.ts +9 -0
- package/dist/platform-layout/platform-file-in.d.ts.map +1 -0
- package/dist/platform-layout/platform-file-in.js +18 -0
- package/dist/platform-layout/platform-file-in.js.map +1 -0
- package/dist/platform-layout/platform-file-paths.d.ts +5 -0
- package/dist/platform-layout/platform-file-paths.d.ts.map +1 -0
- package/dist/platform-layout/platform-file-paths.js +9 -0
- package/dist/platform-layout/platform-file-paths.js.map +1 -0
- package/dist/platform-layout/platform-file.d.ts +6 -0
- package/dist/platform-layout/platform-file.d.ts.map +1 -0
- package/dist/platform-layout/platform-file.js +2 -0
- package/dist/platform-layout/platform-file.js.map +1 -0
- package/dist/platform-layout/platform-layout.d.ts +57 -0
- package/dist/platform-layout/platform-layout.d.ts.map +1 -0
- package/dist/platform-layout/platform-layout.js +61 -0
- package/dist/platform-layout/platform-layout.js.map +1 -0
- package/dist/presets/grant-to-signed-in.d.ts.map +1 -1
- package/dist/presets/grant-to-signed-in.js +3 -3
- package/dist/presets/grant-to-signed-in.js.map +1 -1
- package/dist/presets/organisations-as-tenants.d.ts.map +1 -1
- package/dist/presets/organisations-as-tenants.js +2 -1
- package/dist/presets/organisations-as-tenants.js.map +1 -1
- package/dist/refusals/project-sources.d.ts +2 -2
- package/dist/refusals/project-sources.d.ts.map +1 -1
- package/dist/refusals/project-sources.js +3 -3
- package/dist/refusals/project-sources.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/workspace/workspace.d.ts +7 -0
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/dist/workspace/workspace.js +13 -2
- package/dist/workspace/workspace.js.map +1 -1
- package/package.json +2 -2
- package/templates/architecture/extractable.declared.spec.ts.tpl +1 -1
- package/templates/architecture/extractable.manual.spec.ts.tpl +2 -2
- package/templates/architecture/extractable.tsyringe.spec.ts.tpl +1 -1
- package/templates/background-job/background-job.spec.ts.tpl +1 -1
- package/templates/command/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/context/module.manual.ts.tpl +1 -1
- package/templates/init/README.md.tpl +9 -9
- package/templates/init/docker/env.example.tpl +1 -1
- package/templates/init/e2e/create-credentials.none.ts.tpl +2 -2
- package/templates/init/e2e/start-application.database.ts.tpl +2 -2
- package/templates/init/e2e/start-application.memory.ts.tpl +2 -2
- package/templates/init/main.ts.tpl +5 -5
- package/templates/init/platform/audit/audit.module.manual.ts.tpl +6 -6
- package/templates/init/platform/audit/audit.module.tsyringe.ts.tpl +2 -2
- package/templates/init/platform/audit/create-audit.ts.tpl +1 -1
- package/templates/init/platform/audit/{search-audit-entries.controller.ts.tpl → search-audit-entries/search-audit-entries.controller.ts.tpl} +1 -1
- package/templates/init/platform/audit/{search-audit-entries.handler.ts.tpl → search-audit-entries/search-audit-entries.handler.ts.tpl} +1 -1
- package/templates/init/platform/audit/{search-audit-entries.route.ts.tpl → search-audit-entries/search-audit-entries.route.ts.tpl} +1 -1
- package/templates/init/platform/auth/{attribute-policies.ts.tpl → attributes/attribute-policies.ts.tpl} +1 -1
- package/templates/init/platform/auth/{create-authenticator.none.ts.tpl → authentication/create-authenticator.none.ts.tpl} +1 -1
- package/templates/init/platform/auth/{http-boundary.ts.tpl → authentication/http-boundary.ts.tpl} +1 -1
- package/templates/init/platform/auth/{principal-of.none.ts.tpl → authentication/principal-of.none.ts.tpl} +1 -1
- package/templates/init/platform/auth/{security-schemes.none.ts.tpl → authentication/security-schemes.none.ts.tpl} +1 -1
- package/templates/init/platform/auth/{authorization.tsyringe.ts.tpl → authorization/authorization.tsyringe.ts.tpl} +2 -2
- package/templates/init/platform/auth/{create-authorizer.abac.ts.tpl → authorization/create-authorizer.abac.ts.tpl} +1 -1
- package/templates/init/platform/auth/{create-authorizer.custom.ts.tpl → authorization/create-authorizer.custom.ts.tpl} +2 -2
- package/templates/init/platform/auth/{create-authorizer.rbac.ts.tpl → authorization/create-authorizer.rbac.ts.tpl} +2 -2
- package/templates/init/platform/auth/{create-authorizer.rebac.ts.tpl → authorization/create-authorizer.rebac.ts.tpl} +3 -3
- package/templates/init/platform/auth/{custom-authorizer.contract.spec.ts.tpl → custom/custom-authorizer.contract.spec.ts.tpl} +1 -1
- package/templates/init/platform/auth/{create-tuple-store.contract.spec.ts.tpl → relationships/create-tuple-store.contract.spec.ts.tpl} +1 -1
- package/templates/init/platform/auth/{permission-mapping.ts.tpl → relationships/permission-mapping.ts.tpl} +1 -1
- package/templates/init/platform/auth/{relate-system-actors.ts.tpl → relationships/relate-system-actors.ts.tpl} +1 -1
- package/templates/init/platform/auth/{relation-tuples.ts.tpl → relationships/relation-tuples.ts.tpl} +2 -2
- package/templates/init/platform/auth/{roles.ts.tpl → roles/roles.ts.tpl} +1 -1
- package/templates/init/platform/buses/create-command-bus.ts.tpl +1 -1
- package/templates/init/platform/buses/create-query-bus.ts.tpl +1 -1
- package/templates/init/platform/{compose-application.manual.ts.tpl → composition/compose-application.manual.ts.tpl} +4 -4
- package/templates/init/platform/{compose-application.tsyringe.ts.tpl → composition/compose-application.tsyringe.ts.tpl} +8 -8
- package/templates/init/platform/{create-platform.manual.ts.tpl → composition/create-platform.manual.ts.tpl} +5 -5
- package/templates/init/platform/{lay-foundations.tsyringe.ts.tpl → composition/lay-foundations.tsyringe.ts.tpl} +1 -1
- package/templates/init/platform/{platform.manual.ts.tpl → composition/platform.manual.ts.tpl} +1 -1
- package/templates/init/platform/http/create-app-module.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.express.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.fastify.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.hono.ts.tpl +1 -1
- package/templates/init/platform/http/start-http-server.nest.ts.tpl +1 -1
- package/templates/init/platform/http/with-documentation.ts.tpl +1 -1
- package/templates/init/rules/platform.md.tpl +7 -6
- package/templates/init/scripts/openapi.ts.tpl +3 -3
- package/templates/job/job.spec.tsyringe.ts.tpl +1 -1
- package/templates/pipeline/github/workflows/ci.yml.tpl +12 -12
- package/templates/pipeline/github/workflows/codeql.yml +1 -1
- package/templates/pipeline/github/workflows/copilot-setup-steps.yml +1 -1
- package/templates/pipeline/github/workflows/pr-title.yml +1 -1
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/test/worlds/__context__.world.ts.tpl +1 -1
- package/templates/process/timeout-job.spec.ts.tpl +1 -1
- package/templates/query/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/query/search.handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/service/main.ts.tpl +5 -5
- package/templates/test-world/world.tsyringe.ts.tpl +1 -1
- package/templates/worker/main.ts.tpl +5 -5
- /package/templates/init/platform/audit/{search-audit-entries.query.ts.tpl → search-audit-entries/search-audit-entries.query.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{create-authenticator.jwt.ts.tpl → authentication/create-authenticator.jwt.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{create-authenticator.keycloak.ts.tpl → authentication/create-authenticator.keycloak.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{development-actor-header.ts.tpl → authentication/development-actor-header.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{development-header-authenticator.ts.tpl → authentication/development-header-authenticator.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{offline-authenticator.ts.tpl → authentication/offline-authenticator.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{principal-of.tokens.ts.tpl → authentication/principal-of.tokens.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{security-schemes.tokens.ts.tpl → authentication/security-schemes.tokens.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{access-policies.ts.tpl → authorization/access-policies.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{log-decisions.ts.tpl → authorization/log-decisions.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{permissions.ts.tpl → authorization/permissions.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{role.ts.tpl → authorization/role.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{use-case-protection.ts.tpl → authorization/use-case-protection.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{custom-authorizer.ts.tpl → custom/custom-authorizer.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{create-tuple-store.ts.tpl → relationships/create-tuple-store.ts.tpl} +0 -0
- /package/templates/init/platform/auth/{relationship-schema.ts.tpl → relationships/relationship-schema.ts.tpl} +0 -0
- /package/templates/init/platform/{platform-test.module.tsyringe.ts.tpl → composition/platform-test.module.tsyringe.ts.tpl} +0 -0
- /package/templates/init/platform/{platform.module.tsyringe.ts.tpl → composition/platform.module.tsyringe.ts.tpl} +0 -0
- /package/templates/init/platform/{job-settings.ts.tpl → jobs/job-settings.ts.tpl} +0 -0
- /package/templates/init/platform/{errors.ts.tpl → observability/errors.ts.tpl} +0 -0
- /package/templates/init/platform/{tracing.ts.tpl → observability/tracing.ts.tpl} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ What each version changes for someone who uses the kit. The packages of `package
|
|
|
4
4
|
together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
|
|
5
5
|
list the pull requests behind it.
|
|
6
6
|
|
|
7
|
+
## 0.84.1
|
|
8
|
+
|
|
9
|
+
**The GitHub workflows `init` writes run on `ubuntu-26.04`, pinned instead of `ubuntu-latest`.** GitHub moves `ubuntu-latest` from Ubuntu 24.04 to 26.04 between 2026-10-19 and 2026-11-19; the whole pipeline of the kit, generated projects on npm and pnpm included, was run on 26.04 first. With the label pinned, a new image of GitHub reaches a project when its team changes the label, not on a day GitHub chooses. The kit runs its own workflows on the same label.
|
|
10
|
+
|
|
11
|
+
To move: replace `runs-on: ubuntu-latest` by `runs-on: ubuntu-26.04` in `.github/workflows/`. Do not run `init --force` for this: it writes every file of the platform again from the templates, losing what the generators added there (a grant of a role, the settings of a job, a policy), and replaces a workflow the team changed.
|
|
12
|
+
|
|
13
|
+
## 0.84.0
|
|
14
|
+
|
|
15
|
+
**`src/platform/auth/` holds one folder per question, and `ddd-ts-kit platform-folders` moves a project there.** A new project writes its authentication in `auth/authentication/` (the authenticator, the session of a request, the HTTP boundary), what a caller may do whatever the model in `auth/authorization/` (the authorizer behind the port, the guard of the buses, the access policies, `role.ts`, `permissions.ts`, `signed-in-grants.ts`, `log-decisions.ts`), and its model in the one folder `stack.authz` names: `roles/`, `attributes/`, `relationships/` or `custom/`. The names of the files do not change. A project generated before keeps working as it is: the generators, the presets, `init --force` and the rules `authz/granted` and `authz/scope-narrows` read and write its files flat, and `ddd-ts-kit doctor` reports `folder src/platform: flat` without failing `--strict`. `ddd-ts-kit platform-folders` moves the files the kit writes and rewrites every import of them under the source root, `test/` and `scripts/`, by alias or relative path, keeping the extension as written; it names the files of the team it leaves flat, and `--place <file>=<folder>` moves those too; `--dry-run` shows the plan.
|
|
16
|
+
|
|
17
|
+
To move (when the team wants the folders): `npx ddd-ts-kit platform-folders --dry-run`, then `npx ddd-ts-kit platform-folders`, with one `--place <file>=<folder>` per file of yours it lists, then `npm run format` and `npm run verify`.
|
|
18
|
+
|
|
19
|
+
**`src/platform/` keeps no file at its root: `composition/`, `observability/` and `jobs/`, and the read side of the audit trail in `audit/search-audit-entries/`.** A new project writes `compose-application.ts`, `platform.module.ts`, `platform-test.module.ts` and `lay-foundations.ts` (or `platform.ts` and `create-platform.ts` wired by hand) in `composition/`, `tracing.ts` and `errors.ts` in `observability/` next to the logger and the metrics, `job-settings.ts` in `jobs/`, and the query, the handler and the route or controller of `GET /audit/entries` in `audit/search-audit-entries/`. The names of the files do not change; `main.ts` still imports `tracing.ts` first, and `dev` preloads it from its folder. A project generated before keeps working as it is: the generators write imports of its flat files (a handler spec imports `platform-test.module.ts` where the project keeps it), `init --force` rewrites them flat with the `dev` script, the dependency rules accept `tracing.ts` at either place, and `ddd-ts-kit doctor` reports `folder src/platform: flat` (with `auth/`) without failing `--strict`. `ddd-ts-kit platform-folders` now moves the whole platform, rewrites the paths the scripts of `package.json` name, and names the files of the team left at the root of the platform or of `auth/`; `--place` takes both paths from the platform: `--place auth/role-grants.ts=auth/roles`.
|
|
20
|
+
|
|
21
|
+
To move (when the team wants the folders): `npx ddd-ts-kit platform-folders --dry-run`, then `npx ddd-ts-kit platform-folders`, with one `--place <file>=<folder>` per file of yours it lists, then `npm run format`, `npm run regenerate` (the dependency rules) and `npm run verify`.
|
|
22
|
+
|
|
7
23
|
## 0.83.4
|
|
8
24
|
|
|
9
25
|
**`KafkaEventBus` takes the KafkaJS client it builds its clients from: `cluster`.** The bus made a `KafkaJS.Kafka` of `brokers` and `client` and built its producer, consumers and admin from it, so an application could neither instrument that client nor give the bus another one. The new option `cluster?: KafkaJS.Kafka` is that client: when it is given, the bus reads neither `brokers` nor `client`, builds its clients from it, and disconnects the clients it builds, never `cluster` itself. Without it nothing changes. The specs of `@ddd-ts-kit/kafka` use it to run every suite of the bus on a cluster held in memory, and again against a real broker in the integration job.
|
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:d8d11066d69637d5 -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit
|
|
5
5
|
|
|
@@ -343,7 +343,7 @@ injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
|
|
|
343
343
|
```
|
|
344
344
|
|
|
345
345
|
et l'unique ligne de la racine de composition qui ajoute tout le contexte :
|
|
346
|
-
`contextModule('notification', notificationDeclarations)` dans `src/platform/compose-application.ts`.
|
|
346
|
+
`contextModule('notification', notificationDeclarations)` dans `src/platform/composition/compose-application.ts`.
|
|
347
347
|
|
|
348
348
|
**Un refus est une classe à lui.** `init` écrit `"stack.refusals": "named"` : chaque refus d'un
|
|
349
349
|
contexte est une classe nommée d'après ce qui est refusé, qui étend `DomainRefusal` du kernel,
|
|
@@ -453,7 +453,7 @@ et répond : pas de `pullEvents()`, et pas de `DomainEventDispatcher` dans un ge
|
|
|
453
453
|
un adaptateur de *repository*, qui ne fait que persister. Les événements que l'agrégat a
|
|
454
454
|
enregistrés sont distribués une fois la sauvegarde résolue, dans l'unité de travail de la
|
|
455
455
|
commande : par le module du kernel sur tsyringe, par `dispatchingOnSave` autour de chaque
|
|
456
|
-
*repository* dans `platform/create-platform.ts` en câblage manuel
|
|
456
|
+
*repository* dans `platform/composition/create-platform.ts` en câblage manuel
|
|
457
457
|
(`domain-events/dispatched-on-save`).
|
|
458
458
|
|
|
459
459
|
Au lieu de tirer les événements et de les distribuer dans le gestionnaire :
|
|
@@ -528,17 +528,20 @@ choix sont enregistrés sous `stack` dans la configuration, `docsUi`, `ci` et `l
|
|
|
528
528
|
| `package.json` | scripts et dépendances de la *stack* (ci-dessous) ; `build` est le compilateur, puis `ddd-ts-kit build-aliases` |
|
|
529
529
|
| `tsconfig.json`, `tsconfig.build.json` | strict, NodeNext, `rootDir` `.` et `outDir` `dist`, et `paths` : l'unique déclaration de l'alias d'import (`@/*` vers `./src/*`, `$test/*`, `$scripts/*`, et `$generated/*` avec Prisma), dérivée de `importAlias` (`--import-alias '$<name>/'`, `@/` par défaut ; `#<name>/` et `@<name>/` sont refusés avec la raison) ; la configuration de build étend l'autre et ne déclare pas de `paths` ; `experimentalDecorators` (et `emitDecoratorMetadata`) seulement pour nest ou class-validator, dont les décorateurs sont de l'ancienne forme (legacy) : les déclarations et les aspects servent les deux modes |
|
|
530
530
|
| `src/main.ts` | racine de composition : le traçage d'abord (la remontée des erreurs en second avec `--errors sentry`), la configuration, la persistance, l'application (`log`, `traceConsumers: config.tracing.consumers`, `resilience`, `jobs: { start: config.runJobs, settings: jobSettings(process.env) }`), le relais de l'outbox, le serveur HTTP ; sur `SIGTERM` ou `SIGINT`, il ferme le serveur, arrête le relais, arrête l'application, ferme la persistance et éteint le traçage |
|
|
531
|
-
| `src/platform/` | un export par fichier, chacun portant son nom, dans un dossier par préoccupation
|
|
532
|
-
| traçage | câblé une fois, par la plateforme (`tracing/platform-only`) : pas de *hook* `decorate`, pas de `decorate-bindings.ts`. `tracing.ts` démarre `initTracing` de `@ddd-ts-kit/tracing/node` avant tout autre module, sur ce que valide `config/read-tracing.ts` : `OTEL_EXPORTER_OTLP_ENDPOINT` (une URL ; absente, aucun *span* ne sort du processus), `TRACE_SAMPLE_RATIO` (de 0 à 1) et `TRACE_CONSUMERS` (`continue`, par défaut : un événement consommé reste dans la trace de sa publication ; `link` : chaque livraison démarre une trace liée à elle). Avec `--di tsyringe` : `lay-foundations.ts` construit `traceApplication({ consumers })`, `compose-application.ts` la remet à `kernelModule({ instrumentation })` (un *span* par cas d'usage, appel de *repository*, événement du domaine, publication, consommateur et *job*) et donne au relais de l'outbox `tracedPublisher(bus)`. En câblage manuel : `create-platform.ts` applique lui-même les membres de `traceApplication()` (`useCase` sur les deux bus, `domainEvents`, `publisher`, `binding` autour de chaque adaptateur, `job`, `executionScope`, `errorReporter`), avec `tracedSubscriber` et `tracedPublisher` autour du fournisseur. Avec une *stack* HTTP, dans les deux familles, `auth/http-boundary.ts` pose `around: tracedRoutes()` : un *span* `SERVER` par requête HTTP, nommé d'après sa route |
|
|
531
|
+
| `src/platform/` | un export par fichier, chacun portant son nom, dans un dossier par préoccupation, aucun fichier à sa racine (un projet généré avant les dossiers les garde à plat jusqu'à `npx ddd-ts-kit platform-folders`). `composition/` (`compose-application.ts`, puis `platform.module.ts`, `platform-test.module.ts` et `lay-foundations.ts` avec tsyringe, `platform.ts` et `create-platform.ts` câblés à la main) ; `jobs/` (`job-settings.ts`, `jobSettings(environment, context?)` : une ligne par *job*, `JOB_<CONTEXT>_<JOB>_ENABLED=false` en désactive un). `config/` (`app-config.ts`, `load-config.ts`, `config-error.ts`, `read-tracing.ts` : échec immédiat sur `DATABASE_URL`, `LOG_LEVEL`, `LOG_FORMAT`, `LOG_SCRUB_MESSAGES`, la politique `OUTBOUND_*`, `RUN_JOBS` et les variables de traçage ci-dessous) ; `observability/` (`tracing.ts`, premier import de chaque point d'entrée ; `errors.ts` avec `--errors sentry` ; `create-logger.ts`, voir `--logger` ; `create-metrics.ts` : un `NoopMetrics` derrière un `TODO(platform)`) ; `resilience/` (`resilience-settings.ts`, `default-resilience.ts`, `adapter-aspects.ts` : nouvelle tentative avec temporisation croissante et délai d'expiration pour `external` et `gateway`, `own-policy.ts` pour un adaptateur qui énonce la sienne, `self-governed.ts`) ; `events/`, `database/`, `auth/`, `audit/`, `redis/` (ci-dessous) ; `http/` (`start-http-server.ts`, `with-documentation.ts` : `/docs` et `/openapi.json`, ou `/openapi/<name>.json` par document d'un contrat découpé, désactivés en production sauf `API_DOCS=true` ; `openapi-documents.ts`, le découpage qu'écrit `ddd-ts-kit docs` depuis `openapi.documents`). Avec `--di tsyringe` : `compose-application.ts` (`composeApplication(persistence, options, contexts?)` : `kernelModule({...})`, le module de la plateforme, le module d'autorisation, les contextes ; installe le moteur des aspects), `lay-foundations.ts` (une portée d'exécution, l'horloge, le générateur d'identifiants, le *logger*, les métriques, l'instrumentation et l'audit, construits avant tout module), `platform.module.ts` (ce qui remplace les valeurs par défaut du kernel dans le processus : unité de travail, magasin des événements traités, la classe de stockage, `OutboxStore`, `EventSubscribers` derrière un *broker*, `ErrorMapper`, et `builder.around(['external', 'gateway'], ...)`, la résilience de chaque adaptateur qui sort du processus), `platform-test.module.ts` (ce qu'une *spec* de gestionnaire liste à côté de son contexte : la classe de stockage liée à une fabrique qui lève une erreur), `buses/create-command-bus.ts` et `create-query-bus.ts` (du plus extérieur au plus intérieur : `errorReportingMiddleware`, `loggingMiddleware`, `metricsMiddleware`, la permission, le *span* du cas d'usage, l'entrée d'audit, puis l'unité de travail d'une commande). Avec `--di manual` ou `nest` : `compose-application.ts`, `platform.ts` (`interface Platform`, avec `jobs: JobScheduler` et `adapter`, qui enveloppe ce qu'un fichier de module instancie), `create-platform.ts`, `jobs/configured-job-scheduler.ts` (applique `job-settings.ts` à ce qu'un module enregistre) |
|
|
532
|
+
| traçage | câblé une fois, par la plateforme (`tracing/platform-only`) : pas de *hook* `decorate`, pas de `decorate-bindings.ts`. `tracing.ts` démarre `initTracing` de `@ddd-ts-kit/tracing/node` avant tout autre module, sur ce que valide `config/read-tracing.ts` : `OTEL_EXPORTER_OTLP_ENDPOINT` (une URL ; absente, aucun *span* ne sort du processus), `TRACE_SAMPLE_RATIO` (de 0 à 1) et `TRACE_CONSUMERS` (`continue`, par défaut : un événement consommé reste dans la trace de sa publication ; `link` : chaque livraison démarre une trace liée à elle). Avec `--di tsyringe` : `lay-foundations.ts` construit `traceApplication({ consumers })`, `compose-application.ts` la remet à `kernelModule({ instrumentation })` (un *span* par cas d'usage, appel de *repository*, événement du domaine, publication, consommateur et *job*) et donne au relais de l'outbox `tracedPublisher(bus)`. En câblage manuel : `create-platform.ts` applique lui-même les membres de `traceApplication()` (`useCase` sur les deux bus, `domainEvents`, `publisher`, `binding` autour de chaque adaptateur, `job`, `executionScope`, `errorReporter`), avec `tracedSubscriber` et `tracedPublisher` autour du fournisseur. Avec une *stack* HTTP, dans les deux familles, `auth/authentication/http-boundary.ts` pose `around: tracedRoutes()` : un *span* `SERVER` par requête HTTP, nommé d'après sa route |
|
|
533
533
|
| `--logger` | `src/platform/observability/create-logger.ts`, un par choix : `stdout` (par défaut) est le `StdoutLogger` de `@ddd-ts-kit/aspects`, des lignes JSON, identifiants de connexion non masqués ; `pino` est `createPinoLogger` de `@ddd-ts-kit/pino` (dépendances `pino` et `pino-pretty`) ; `winston` est `createWinstonLogger` de `@ddd-ts-kit/winston` ; ces deux-là masquent les clés d'identifiants de connexion du kernel. Chaque entrée porte `traceLogFields(scope)` : l'identifiant de corrélation, l'origine, l'acteur et le *tenant* du travail en cours, et les identifiants de la trace active. `LOG_LEVEL`, `LOG_FORMAT` (`json`, par défaut, ou `pretty` ; avec `stdout`, qui n'a pas de format lisible, `pretty` est refusé au chargement de la configuration) et `LOG_SCRUB_MESSAGES` (`[message removed]` à la place du message d'une erreur journalisée qui n'est pas une `DomainError`) sont validés dans `config/load-config.ts`. L'arrêt de l'application vide le tampon du *reporter* d'erreurs, puis celui du *logger*, en dernier : `container.stop()` le fait sur tsyringe, `compose-application.ts` le fait explicitement en câblage manuel. Les outils et les tests composent l'application sans `log` et n'écrivent rien |
|
|
534
|
-
| `src/platform/auth/` |
|
|
534
|
+
| `src/platform/auth/` | un dossier par question : `authentication/` (qui appelle), `authorization/` (ce qu'il peut faire, quel que soit le modèle) et le dossier du modèle que nomme `stack.authz` (`roles/`, `attributes/`, `relationships/` ou `custom/`). Un projet généré avant les dossiers garde ses fichiers à plat : les générateurs les y lisent, `npx ddd-ts-kit doctor` le signale et `npx ddd-ts-kit platform-folders` les déplace avec chaque import |
|
|
535
|
+
| `src/platform/auth/authentication/` | `create-authenticator.ts` (`--authn jwt` : `JwtAuthenticator` sur `AUTH_ISSUER`, `AUTH_AUDIENCE`, `AUTH_JWKS_URI` ; `--authn keycloak` : `keycloakAuthenticator` sur `KEYCLOAK_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_AUDIENCE` et l'optionnel `KEYCLOAK_CLIENT_ID` ; `--authn none` : `development-header-authenticator.ts` et `development-actor-header.ts`, qui lisent `x-development-actor` et lèvent une erreur en production), `principal-of.ts`, `security-schemes.ts`, `offline-authenticator.ts`, `http-boundary.ts` (`resolvePrincipal` qui répond une `Session`, `executionScope`, `errorMapper` et `onError`, étalés dans les options de montage : chaque requête HTTP s'exécute dans la portée d'exécution, avec son identifiant de corrélation). Sans *stack* HTTP, il n'y a ni authentificateur ni frontière, ni dossier |
|
|
536
|
+
| `src/platform/auth/authorization/` | `create-authorizer.ts`, `authorization.ts` (`authorizationModule` avec tsyringe) ou `use-case-protection.ts` (la garde des bus câblés à la main), `access-policies.ts`, `role.ts` (les rôles que porte un identifiant, avec des rôles ou des attributs, ou dès qu'une garde en nomme un), `permissions.ts` (le registre de toutes les permissions, avec des relations ou un authorizer à vous), `signed-in-grants.ts` dès qu'un *preset* de contexte accorde à toute personne connectée, et avec `--audit off` `log-decisions.ts` (une entrée de journal par décision, identifiants et codes seulement) |
|
|
537
|
+
| `src/platform/auth/<modèle>/` | `roles/roles.ts` (avec le rôle `system` que détient chaque acteur système) ; `attributes/attribute-policies.ts` ; `relationships/` : `relationship-schema.ts`, `create-tuple-store.ts` et sa *spec* de contrat, `relation-tuples.ts`, `relate-system-actors.ts`, `permission-mapping.ts` ; `custom/` : `custom-authorizer.ts` et sa *spec* `authorizerContract` |
|
|
535
538
|
| `--representations negotiated`, `--forms on` | `src/platform/http/presentation-of.ts` (`Representations.standard()` avec `negotiated`, et `fieldDeciderOf` sur l'`Access` de l'application), décomposé dans la frontière HTTP et donné au script du contrat ; avec `--forms on`, `src/platform/http/with-forms.ts` ajoute `formRoutes` aux routes et `scripts/openapi.ts` écrit `openapi/forms/<operationId>.json`. Les deux sont la valeur par défaut avec une *stack* HTTP ; `json` et `off` les laissent de côté ([docs/CONFIG.fr.md](../../docs/CONFIG.fr.md)) |
|
|
536
|
-
| `--audit on` | `src/platform/audit/` : `create-audit.ts` (le journal, le `onDecision` de l'autorisation, les refus des gardes à la frontière remis à la frontière HTTP comme `onGuardRefusal`, le *middleware* avant l'unité de travail, les événements d'intégration abonnés sous le nom de consommateur `audit`), `audited-events.ts` (le registre auquel `generate integration-event` ajoute), `audit.module.ts`, et avec une *stack* HTTP le côté lecture : `audit.permissions.ts` (`audit:trail.read`), `search-audit-entries.query.ts`, son gestionnaire, `search-audit-entries.route.ts` (`GET /audit/entries` : pages par curseur, filtres `actorId`, `action`, `outcome`, `correlationId`). C'est une capacité de la plateforme, pas un contexte délimité : pas de modèle, une requête protégée sur le port `AuditReader`, bornée par le *tenant* de l'acteur (avec `--tenancy shared-table`, par le *tenant* du travail au moyen de `TenantAuditReader` : le personnel de la plateforme ne lit à travers les *tenants* qu'à l'intérieur de `acrossTenants`). Les refus d'un appelant sans identifiant de connexion ne sont pas enregistrés. Un *job* planifié est audité comme une requête HTTP : origine `schedule`, acteur `system:<context>.<job>`. Avec knex, les deux tables et leurs déclencheurs en ajout seul sont créés par la première migration ; avec drizzle, les tables sont dans `schema.ts` et `npm run db:audit-guard` affiche les instructions des déclencheurs pour une migration personnalisée ; avec prisma, typeorm, `custom` ou sans ORM, le journal est un `InMemoryAuditTrail` derrière un `TODO(platform)`. Les bases de test laissent le schéma d'audit hors de `reset()` |
|
|
539
|
+
| `--audit on` | `src/platform/audit/` : `create-audit.ts` (le journal, le `onDecision` de l'autorisation, les refus des gardes à la frontière remis à la frontière HTTP comme `onGuardRefusal`, le *middleware* avant l'unité de travail, les événements d'intégration abonnés sous le nom de consommateur `audit`), `audited-events.ts` (le registre auquel `generate integration-event` ajoute), `audit.module.ts`, et avec une *stack* HTTP le côté lecture : `audit.permissions.ts` (`audit:trail.read`), puis dans `search-audit-entries/` : `search-audit-entries.query.ts`, son gestionnaire, `search-audit-entries.route.ts` (`GET /audit/entries` : pages par curseur, filtres `actorId`, `action`, `outcome`, `correlationId`). C'est une capacité de la plateforme, pas un contexte délimité : pas de modèle, une requête protégée sur le port `AuditReader`, bornée par le *tenant* de l'acteur (avec `--tenancy shared-table`, par le *tenant* du travail au moyen de `TenantAuditReader` : le personnel de la plateforme ne lit à travers les *tenants* qu'à l'intérieur de `acrossTenants`). Les refus d'un appelant sans identifiant de connexion ne sont pas enregistrés. Un *job* planifié est audité comme une requête HTTP : origine `schedule`, acteur `system:<context>.<job>`. Avec knex, les deux tables et leurs déclencheurs en ajout seul sont créés par la première migration ; avec drizzle, les tables sont dans `schema.ts` et `npm run db:audit-guard` affiche les instructions des déclencheurs pour une migration personnalisée ; avec prisma, typeorm, `custom` ou sans ORM, le journal est un `InMemoryAuditTrail` derrière un `TODO(platform)`. Les bases de test laissent le schéma d'audit hors de `reset()` |
|
|
537
540
|
| `--tenancy shared-table` | enregistré comme `stack.tenancy` ; Knex ou Drizzle seulement. Chaque `generate repository` est cloisonné par *tenant* (comme `--tenant-scoped`), au moyen de `tenantTable` et `ownTenantTable` ou de `tenantCondition` et `ownTenantCondition` ; l'outbox garde le *tenant* de chaque événement (`createOutboxTables(knex, { tenant: true })` et le `tenant: true` de `KnexOutboxStore`, ou `tenantOutboxTable`), si bien que les consommateurs s'exécutent dans ce *tenant* ; `tenancy/scoped-statement` juge les adaptateurs. La sécurité au niveau des lignes, un schéma par *tenant* et une base par *tenant* sont refusés, avec ce qu'il faut câbler à la main ([Multitenance](../../docs/concepts/multitenancy.fr.md)) |
|
|
538
541
|
| `--queue database\|redis\|memory` | enregistré comme `stack.queue`. `database` (par défaut sur Knex ou Drizzle avec tsyringe) : `createJobTable` et `createProcessTable`, ou `jobsTable` et `processesTable`, dans le schéma `messaging`, `Persistence` gagne `jobs` et `processes`, et le module de la plateforme relie `JobStore` et `ProcessStore` à eux, si bien qu'un *job* mis en file par une commande est écrit dans sa transaction ; `redis` (avec `--cache redis`) : `RedisJobStore` sur la connexion du cache, les processus dans la base de données ; `memory` (par défaut sinon) : rien n'est écrit, le module du kernel garde les deux dans le processus. Refusé hors de tsyringe, `database` avec un autre ORM, `redis` sans le cache |
|
|
539
542
|
| `--cache redis` | `src/platform/redis/open-redis.ts` (`RedisServices` : le cache lié au `Cache` du kernel, le limiteur à `RateLimiter`, le verrou à `Lock`, qui réserve un *job* planifié à une seule instance, le signal du relais comme `wakeOn` du relais de l'outbox avec `relayWakeUpMiddleware` sur le bus de commandes), `http/refusal-for.ts` (une fenêtre glissante par adresse d'appelant, 429 `application/problem+json` avec `retry-after` ; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS`), `GET /health/ready` sur le serveur HTTP, `REDIS_URL` validée, un service compose `cache` qui exécute Dragonfly avec un contrôle de santé. Sans serveur (outils, tests sans `REDIS_URL`), les mêmes ports restent dans la mémoire du processus |
|
|
540
543
|
| `--http-cache varnish` | un service compose `varnish` (Varnish 9.1.0, qui joint l'API sur `host.docker.internal`) avec son VCL dans `docker/varnish/default.vcl` (seules les réponses dont le `Cache-Control` les autorise par `max-age` ou `s-maxage` sont gardées, rangées sous leurs étiquettes `xkey`, purgées par `PURGE` depuis la machine de Varnish ou avec `VARNISH_PURGE_KEY`, `x-cache: HIT\|MISS`), `VARNISH_URL` et `VARNISH_PURGE_KEY` validées, `cacheTags: { header: CacheTagHeader.xkey }` dans la frontière HTTP, et le relais de l'outbox de `main.ts` et de chaque point d'entrée de `generate service` qui publie au moyen de `PurgingPublisher` avec `VarnishCachePurger` (l'application de bout en bout enregistre les purges dans `purges`) ; sur `--di manual` et `nest`, la plateforme gagne `cacheInvalidation` ; avec `--tenancy`, les étiquettes des réponses et les purges sont rangées sous le *tenant* (`perTenant`) et le *tenant* d'une requête HTTP est lu dans `x-tenant-id`. Demande un framework HTTP et `--events outbox` : une purge est une ligne de l'outbox |
|
|
541
|
-
| `--errors sentry` | les échecs inattendus remontés à Sentry ou à GlitchTip (un seul protocole, seul le DSN diffère) au moyen de l'`ErrorReporter` du kernel, lié à `@ddd-ts-kit/sentry`. `src/platform/errors.ts` (`initSentry` sur la configuration validée, puis `reportProcessFailures`), le deuxième import de `main.ts`, de `apps/<context>/main.ts` et de `apps/worker/main.ts`, juste après `tracing.ts` ; `errors` remis à `composeApplication`, qui le donne au module du kernel sur tsyringe (`errorReporter`, vidé par `container.stop()` avant le *logger*, `errorReportingMiddleware` en premier sur les deux bus, le planificateur par défaut qui observe avec `reportFailedRuns`) ou à `createPlatform` à la main (le même *middleware*, `onRun: reportFailedRuns(errors)`, `platform.errors`, vidé en deux secondes au plus quand l'application s'arrête) ; `reportHttpErrors` dans `auth/http-boundary.ts` pour chaque requête HTTP qui reçoit une réponse 5xx ; `DeadLetterReports` sur le *hook* `onFailure` d'un *broker* fourni (`createEventProvider(config, errors)`, avec `observing` autour de chaque consommateur) et du relais de l'outbox. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (par défaut : `NODE_ENV`), `SENTRY_RELEASE` et `SENTRY_SCRUB_MESSAGES` validées dans `config/load-config.ts` comme `errorReporting` : sans DSN, l'application démarre et ne remonte rien ; un DSN qui n'est pas une URL refuse le démarrage. Dépendances `@ddd-ts-kit/sentry` et `@sentry/node`. Un profil compose `errors` qui exécute GlitchTip 6.2.6 avec son propre PostgreSQL et son propre Valkey (`GLITCHTIP_PORT`, sur la boucle locale seulement, amorçage de développement), et une section du README généré qui dit comment lire son DSN. Les outils et les tests composent l'application sans *reporter*. Il va avec tous les autres choix de la *stack* ; avec `--errors none`, rien de tout cela n'est écrit |
|
|
544
|
+
| `--errors sentry` | les échecs inattendus remontés à Sentry ou à GlitchTip (un seul protocole, seul le DSN diffère) au moyen de l'`ErrorReporter` du kernel, lié à `@ddd-ts-kit/sentry`. `src/platform/observability/errors.ts` (`initSentry` sur la configuration validée, puis `reportProcessFailures`), le deuxième import de `main.ts`, de `apps/<context>/main.ts` et de `apps/worker/main.ts`, juste après `tracing.ts` ; `errors` remis à `composeApplication`, qui le donne au module du kernel sur tsyringe (`errorReporter`, vidé par `container.stop()` avant le *logger*, `errorReportingMiddleware` en premier sur les deux bus, le planificateur par défaut qui observe avec `reportFailedRuns`) ou à `createPlatform` à la main (le même *middleware*, `onRun: reportFailedRuns(errors)`, `platform.errors`, vidé en deux secondes au plus quand l'application s'arrête) ; `reportHttpErrors` dans `auth/authentication/http-boundary.ts` pour chaque requête HTTP qui reçoit une réponse 5xx ; `DeadLetterReports` sur le *hook* `onFailure` d'un *broker* fourni (`createEventProvider(config, errors)`, avec `observing` autour de chaque consommateur) et du relais de l'outbox. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (par défaut : `NODE_ENV`), `SENTRY_RELEASE` et `SENTRY_SCRUB_MESSAGES` validées dans `config/load-config.ts` comme `errorReporting` : sans DSN, l'application démarre et ne remonte rien ; un DSN qui n'est pas une URL refuse le démarrage. Dépendances `@ddd-ts-kit/sentry` et `@sentry/node`. Un profil compose `errors` qui exécute GlitchTip 6.2.6 avec son propre PostgreSQL et son propre Valkey (`GLITCHTIP_PORT`, sur la boucle locale seulement, amorçage de développement), et une section du README généré qui dit comment lire son DSN. Les outils et les tests composent l'application sans *reporter*. Il va avec tous les autres choix de la *stack* ; avec `--errors none`, rien de tout cela n'est écrit |
|
|
542
545
|
| `--authn keycloak` | un service compose `keycloak` (Keycloak 26.8.0, `start-dev --import-realm`, profil `identity`) et `docker/keycloak/<project>-realm.json` : le client de l'API, un client public `<project>-local` avec l'octroi direct, ses *mappers* d'audience et de `tenant_id`, le rôle de realm `admin`, et les utilisateurs de démonstration `demo-admin` et `demo-user`, pour le développement local seulement |
|
|
543
546
|
| `--storage local\|s3` | enregistré comme `stack.storage` : où vit le contenu des fichiers, jamais dans la base de données. `src/platform/config/read-files.ts` et `src/platform/files/open-files.ts`, un par choix : `local`, un répertoire en développement (`FILES_DIRECTORY`, `.data/files`) et les liens signés servis par l'application sous `/files` (`FILES_PUBLIC_URL` et `FILES_SIGNING_SECRET` requises en production) ; `s3`, un bucket de n'importe quel fournisseur du protocole S3 au moyen de `@ddd-ts-kit/s3` (les variables `S3_*`, MinIO dans la stack compose) ; la mémoire du processus dans les tests et les outils, dans les deux cas. Avec `--di tsyringe` : `files/bind-files.ts`, `files/files.module.ts` et `files/staging-uploads.ts` ; en câblage manuel, `files/create-files.ts` ; avec une *stack* HTTP, `files/file-routes.ts`. Ils lient `FileStorage`, `FileKeys`, `FileScanner` et `FileStaging`, enregistrent la purge horaire des fichiers en attente et mettent en attente le fichier que porte une commande avant sa transaction ; `generate file-upload` en a besoin. `--storage none` n'écrit rien de tout cela ([Stockage de fichiers](../../docs/concepts/file-storage.fr.md)) |
|
|
544
547
|
| `src/platform/events/` | `event-provider.ts` (`bus`, `forConsumer(name)`, `start()`, `close()`), `in-process-events.ts`, et pour `--broker` `create-event-provider.ts` : `RabbitMqEventBus` (`AMQP_URL`), `KafkaEventBus` (`KAFKA_BROKERS`, avec `aggregate-key-of.ts` pour l'ordre par agrégat), `NatsEventBus` (`NATS_URL`) ou `RedisStreamsEventBus` de `@ddd-ts-kit/redis/event-bus` (`REDIS_URL` : Redis, Dragonfly ou Valkey), chacun avec un abonné par contexte consommateur (`forConsumer`), `assertTopology` au démarrage, son adresse validée et un service compose avec un contrôle de santé ; ou `custom-event-bus.ts` avec sa *spec* `eventBusContract`. `start-outbox-relay.ts` avec l'outbox. `--broker redis` avec `--cache redis` fait un seul serveur et un seul service compose, `cache` ; seul, le service s'appelle `streams` |
|
|
@@ -573,7 +576,7 @@ règle sur `.env` repose sur la sémantique gitignore des motifs de permission :
|
|
|
573
576
|
est refusé et `Read(!./.env.example)`, une négation placée après lui dans la même liste, en
|
|
574
577
|
ressort le fichier d'exemple.
|
|
575
578
|
|
|
576
|
-
Chaque fichier `.ts` qu'écrivent `init` et `generate` importe par l'alias (`@/platform/errors`),
|
|
579
|
+
Chaque fichier `.ts` qu'écrivent `init` et `generate` importe par l'alias (`@/platform/observability/errors`),
|
|
577
580
|
jamais par un chemin relatif ; le barrel et l'index d'un langage publié réexportent par lui aussi.
|
|
578
581
|
|
|
579
582
|
Scripts : `dev` (`tsx watch`, qui résout un alias depuis les `paths` de `tsconfig.json`, avec
|
|
@@ -612,7 +615,7 @@ comme une recette (prouvé contre un serveur qui répond comme Keycloak, pas con
|
|
|
612
615
|
délégation ; un compte désactivé quitte ses organisations ; une adresse que le fournisseur n'a pas
|
|
613
616
|
vérifiée ne provisionne aucun compte. Sur `init` sans `--context` de son nom, le contexte
|
|
614
617
|
`identity` est déclaré `generic`. Chaque personne connectée détient les permissions du contexte
|
|
615
|
-
quoi que dise `--authz` : l'attribution `'identity:*'` de `platform/auth/signed-in-grants.ts`,
|
|
618
|
+
quoi que dise `--authz` : l'attribution `'identity:*'` de `platform/auth/authorization/signed-in-grants.ts`,
|
|
616
619
|
à laquelle répond `SignedInGrantsAuthorizer` avant le modèle dans `createAuthorizer`. Avec des
|
|
617
620
|
*tenants*, les tables du contexte n'appartiennent à aucun, sous un enregistrement de décision que
|
|
618
621
|
le *preset* écrit, et avec `--authn keycloak` l'authentificateur lit le *claim* `organization`
|
|
@@ -665,7 +668,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
665
668
|
|
|
666
669
|
| Genre | Arguments | Écrit |
|
|
667
670
|
|---|---|---|
|
|
668
|
-
| `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` avec son glossaire, `published-language/index.ts`, l'entrée de configuration, l'enregistrement dans `platform/compose-application.ts` et dans `test/architecture/extractable.spec.ts` ; sur tsyringe, avec HTTP, `presentation/http/<name>.routes.ts` (une fonction des deux bus, dans les deux styles) ; déclaré : le barrel `<name>.declarations.ts` ; explicite et câblage manuel : `<name>.module.ts`. `application/authorization/<name>.permissions.ts` naît avec la première permission, ou tout de suite quand `platform/auth/permissions.ts` liste les ensembles de permissions (rebac, custom). Avec `--preset`, le contexte est ensuite écrit en entier depuis ce *preset*, sa classification et son objet étant ceux du *preset* sauf si les options disent autre chose ([Presets](#presets)) |
|
|
671
|
+
| `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` avec son glossaire, `published-language/index.ts`, l'entrée de configuration, l'enregistrement dans `platform/composition/compose-application.ts` et dans `test/architecture/extractable.spec.ts` ; sur tsyringe, avec HTTP, `presentation/http/<name>.routes.ts` (une fonction des deux bus, dans les deux styles) ; déclaré : le barrel `<name>.declarations.ts` ; explicite et câblage manuel : `<name>.module.ts`. `application/authorization/<name>.permissions.ts` naît avec la première permission, ou tout de suite quand `platform/auth/authorization/permissions.ts` liste les ensembles de permissions (rebac, custom). Avec `--preset`, le contexte est ensuite écrit en entier depuis ce *preset*, sa classification et son objet étant ceux du *preset* sauf si les options disent autre chose ([Presets](#presets)) |
|
|
669
672
|
| `aggregate` | `<context> <Name> [--event-sourced]` | agrégat, *builder*, *spec* sur le modèle étant donné / quand / alors ; avec `--event-sourced`, un agrégat sur `EventSourcedAggregate` dont l'état est le rejeu de ses événements, né avec son événement du domaine `Created`, le codec de ses événements stockés dans `infrastructure/persistence/<name>-events.mapper.ts`, un *builder* qui rejoue un historique et une *spec* à partir d'événements donnés, et une note qui nomme le `EventSourcedRepository` auquel délègue son adaptateur de *repository* |
|
|
670
673
|
| `builder` | `<context> <Aggregate>` | `test/builders/<name>.builder.ts`, une classe qui étend `Builder` |
|
|
671
674
|
| `test-world` | `<context> [Name]` | `test/worlds/<name>.world.ts` (le nom est par défaut celui du contexte) : `a<Name>World({ now, idPrefix, given })`, la mise en place que partagent plusieurs *specs* du contexte. Il lit les *fakes* de `test/fakes/` et le port que chacun implémente, les construit, les passe à `given` pour que la *spec* enregistre ce dont elle part, puis à l'application de test (avec `modules`, l'autorisation de la *spec*) ou, câblé à la main, enveloppe les *repositories* des bus de `createTestBuses` par `dispatching` ; il rend chaque *fake* sous le nom de son port. Un *fake* qui attend des arguments de constructeur, ou, avec un conteneur, celui d'un port que rien ne lie ni n'utilise encore, est laissé de côté avec une note |
|
|
@@ -684,7 +687,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
684
687
|
| `route` | `<context> <UseCaseName> --method <GET\|POST\|PUT\|PATCH\|DELETE> --path <p> [--command\|--query] [--group <Name>] [--mapper] [--serializer] [--cache public\|private\|no-store]` | sous `"stack.routes": "controllers"` : une classe contrôleur dans `presentation/http/<resource>/<use-case>/` (la ressource est le premier segment du chemin), qui dépend de `CommandBus` ou de `QueryBus`, derrière le groupe de routes de sa ressource, écrit avec elle quand il est nouveau (`<resource>.routes.ts` : préfixe, étiquette, `Authenticated`) ; un cas d'usage public ne se tient dans aucun groupe et dit `guards: [Public]` ; avec class-validator, une classe par fichier (`<use-case>.params.ts`, `.body.ts`, `.answer.ts`, `.accepted.ts`, `.line.ts`) ; `--mapper` et `--serializer` ajoutent un *mapper* de requête HTTP et un sérialiseur que reçoit le contrôleur ; une *spec* ; aucun enregistrement dans un projet déclaré, un contrôleur construit à la main dans `<context>.routes.ts` (le fichier de module en câblage manuel) dans un projet explicite. Sous `"functions"` : une fonction `defineRoute`, sa *spec*, son enregistrement dans `<context>.routes.ts`, et des classes `<use-case>-<role>.dto.ts` |
|
|
685
688
|
| `controller` | les mêmes arguments que `route` | la classe contrôleur, quoi que dise `stack.routes` : pour un projet de routes en fonctions qui écrit sa prochaine route comme une classe. `--cache` écrit sa politique de cache : `private` (un `GET` d'un appelant, `max-age=0`, `must-revalidate`, `ETag` fort), `public` (un `GET` d'un cas d'usage public, `max-age` 1m, `s-maxage` 5m, étiqueté avec les ressources de son chemin), `no-store` ; refusé sur une écriture, et `public` derrière un groupe de routes |
|
|
686
689
|
| `file-upload` | `<context> <UseCaseName> --path <p> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--method POST\|PUT] [--group <Name>]` | un téléversement : un contrôleur qui déclare le fichier qu'il reçoit (sa taille et ses types de média dans le contrat, vérifiés au fil du flux), la commande qui le porte comme un `FileUpload`, mis en attente par le bus de commandes avant la transaction, le gestionnaire qui l'enregistre et le promeut avec la validation (commit), et leurs *specs*. Refusé sans `stack.storage` ou sans *stack* HTTP, avec le `init --force --storage local` à lancer |
|
|
687
|
-
| `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts` : une classe vide qui porte `@RouteGroup`, derrière `Authenticated` sauf si `--public` ou `--role` dit autre chose (`HasRole(Role.Admin)`, le rôle lu dans le vocabulaire de la plateforme, `<platformDir>/auth/role.ts`, qui le reçoit s'il ne le contient pas) ; avec `--group`, il affine ce groupe et en hérite |
|
|
690
|
+
| `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts` : une classe vide qui porte `@RouteGroup`, derrière `Authenticated` sauf si `--public` ou `--role` dit autre chose (`HasRole(Role.Admin)`, le rôle lu dans le vocabulaire de la plateforme, `<platformDir>/auth/authorization/role.ts`, qui le reçoit s'il ne le contient pas) ; avec `--group`, il affine ce groupe et en hérite |
|
|
688
691
|
| `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts` : une classe de garde déclarée à remplir, et sa *spec* |
|
|
689
692
|
| `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | ajoute `produces` au `@Controller` du cas d'usage, et `consumes: ['application/xml']` à celui qui reçoit un corps quand XML est demandé ; dit quand CSV a besoin d'une page ou d'une liste en flux, et quand `stack.representations` n'est pas `negotiated` |
|
|
690
693
|
| `form` | `<context> <UseCase>` | ajoute `const form = defineForm<Infer<typeof body>>({ ... })` avant le `@Controller` d'un cas d'usage qui reçoit un corps, et `form` à ses options : les indications de son formulaire à `GET /forms/<operationId>` |
|
|
@@ -693,12 +696,12 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
693
696
|
| `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>` | `application/integration/handlers/<name>.integration-handler.ts`, une classe `<Name>IntegrationHandler` qui dépend de `CommandBus`, sa *spec*, son abonnement idempotent sous le nom de consommateur `<context>.<name>` ; refusé sauf si l'amont est déclaré |
|
|
694
697
|
| `event-handler` | `<context> <Aggregate> <Fact> [--phase before-commit\|after-commit]` | réaction à un événement du domaine du contexte, *spec*, abonnement ; avant la validation (commit) de l'unité de travail par défaut, après elle avec `--phase after-commit` (un effet qu'aucune transaction ne couvre, au plus une fois), et la *spec* exécute la réaction dans cette phase |
|
|
695
698
|
| `projection` (`projector`) | `<context> <Name> <event-type>` | un projecteur dans `application/projections/<name>.projection.ts`, déclaré avec `@Projection('<context>.<name>')` et une méthode `@On(definition)` pour l'événement d'intégration, que publie le contexte lui-même ou un amont déclaré, et sa *spec* ; style déclaré seulement. Il tient un seul modèle de lecture : son port est reçu par le constructeur |
|
|
696
|
-
| `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName>` | `application/scheduling/<name>.job.ts`, une classe `<Name>Job implements ScheduledJob` qui envoie la commande, en tant que `systemActor('<context>.<name>')` quand elle est protégée, avec `execution.scheduledAt` quand la commande le prend ; `test/unit/<name>.job.spec.ts`, qui exécute le *job* (par son nom sur tsyringe, `application.jobs.runNow` ; `job.run(occurrence)` en câblage manuel) et vérifie la commande qu'il a envoyée ; son enregistrement ; son interrupteur dans `platform/job-settings.ts` ; l'autorisation de son acteur système (ci-dessous) |
|
|
699
|
+
| `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName>` | `application/scheduling/<name>.job.ts`, une classe `<Name>Job implements ScheduledJob` qui envoie la commande, en tant que `systemActor('<context>.<name>')` quand elle est protégée, avec `execution.scheduledAt` quand la commande le prend ; `test/unit/<name>.job.spec.ts`, qui exécute le *job* (par son nom sur tsyringe, `application.jobs.runNow` ; `job.run(occurrence)` en câblage manuel) et vérifie la commande qu'il a envoyée ; son enregistrement ; son interrupteur dans `platform/jobs/job-settings.ts` ; l'autorisation de son acteur système (ci-dessous) |
|
|
697
700
|
| `background-job` | `<context> <Name> --command <UseCaseName>` | `application/background/<name>.background-job.ts`, une classe `<Name>BackgroundJob implements BackgroundJob<<Name>Payload>` nommée par son `jobName` statique `<context>.<name>`, qui envoie la commande en tant que `execution.actor` quand elle est protégée, suivi d'un champ de `<Name>Payload` par autre paramètre du constructeur de la commande (chaînes, nombres, booléens, littéraux et listes de ceux-ci tels qu'écrits, une `Date` sous forme de son texte ISO ; tout le reste est refusé) ; `test/unit/<name>.background-job.spec.ts`, qui le met en file avec une charge utile de chaque champ en tant qu'utilisateur détenant la permission et exécute ce qui est dû ; son enregistrement (`@Background()`, ou `builder.backgroundJob(..)` dans le fichier de module). `--di tsyringe` seulement |
|
|
698
701
|
| `process` (`process-manager`) | `<context> <Name>` | `application/processes/<name>.process.ts` (son état, `processName`, `timeoutJob`, `isState`, une première étape qui arme une échéance, une étape qui y met fin à temps, l'étape de l'échéance), `application/background/<name>-timeout.background-job.ts`, qui livre ses expirations au moyen de `ProcessRunner`, et les *specs* des deux (`givenProcess`, la file d'attente de l'application de test). `--di tsyringe` seulement |
|
|
699
702
|
| `acl` | `<context> <upstreamOrSystemName>` | traducteur dans `infrastructure/anti-corruption/`, *spec* |
|
|
700
703
|
| `e2e` | `<context> <UseCaseName>` | `test/e2e/<use-case>.e2e.spec.ts` qui pilote la route du cas d'usage : 401 sans identifiant de connexion, 403 sans la permission, le statut documenté avec elle ; pour une commande, un test de plus vérifie la trace de la requête HTTP, exacte sur les noms et la structure, avec `installTestTracing()` et `expectSpanTree(storyOf(trace), [...])` de `@ddd-ts-kit/tracing/testing` (`POST /invoices`, puis `command IssueInvoiceCommand`, puis `repository InvoiceRepository.save`) ; demande la route |
|
|
701
|
-
| `policy` | `<context> <Name> --permission <aggregate>.<action>` | `application/authorization/<name>.policy.ts`, *spec* ; déclaré : la classe porte `@Policy(permission, { name })` et rien d'autre n'est écrit ; explicite : l'enregistrement dans `platform/auth/access-policies.ts` |
|
|
704
|
+
| `policy` | `<context> <Name> --permission <aggregate>.<action>` | `application/authorization/<name>.policy.ts`, *spec* ; déclaré : la classe porte `@Policy(permission, { name })` et rien d'autre n'est écrit ; explicite : l'enregistrement dans `platform/auth/authorization/access-policies.ts` |
|
|
702
705
|
| `gateway` | `<context> <upstreamContext> <Name>` | le contrat de lecture dans le langage publié de l'amont (`<name>.contract.ts`, une classe abstraite et le jeton de la valeur de l'amont), le port `application/ports/<name>-gateway.port.ts`, un adaptateur dans le processus dans `infrastructure/external/` lié `.as('gateway')`, un *fake*, une suite de contrat ; refusé sauf si l'amont est déclaré |
|
|
703
706
|
| `adapter` | `<context> <Port> [--kind external\|gateway] [--decorators]` | `infrastructure/external/remote-<port>.adapter.ts` pour un port existant, sa *spec*, et sur tsyringe sa liaison `builder.bind(<Port>).toClass(Remote<Port>).as(<kind>).with(ownPolicy(retry(...), timeout(...)))` ; avec `--decorators`, sur toute *stack*, la classe porte `@Retry` et `@Timeout` de `@ddd-ts-kit/aspects/decorators` sur son unique méthode sortante et est liée `.with(ownPolicy())`. Explicite : un port déjà lié, ou le câblage manuel, reçoit une note au lieu d'une liaison. Déclaré : la classe porte `@Adapter(<Port>, { kind, aspects })`, ou `@Gateway(<Port>, { aspects })` dans `remote-<port>.gateway.ts` avec `--kind gateway`, et un port qui a déjà un adaptateur déclaré est refusé |
|
|
704
707
|
| `service` | `<context>` | `src/apps/<context>/main.ts` (kernel, plateforme, ce contexte seul, avec ses *jobs* : `jobSettings(process.env, '<context>')`), le script `start:<context>`, un service compose derrière le profil `services`, l'entrée knip, `deployable: true` dans la configuration. Le Dockerfile prend le point d'entrée comme argument de build `ENTRY` |
|
|
@@ -721,7 +724,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
721
724
|
`@Scheduled('<context>.<name>', schedule)` ; `policy` écrit une classe avec
|
|
722
725
|
`@Policy(permission, { name })` et n'enregistre rien ; `gateway` écrit
|
|
723
726
|
`@Gateway(<Name>Gateway, [<Name>Contract])` et lie la valeur de l'amont dans les régions
|
|
724
|
-
marquées de `platform/platform.module.ts` et de `platform/platform-test.module.ts` : une valeur
|
|
727
|
+
marquées de `platform/composition/platform.module.ts` et de `platform/composition/platform-test.module.ts` : une valeur
|
|
725
728
|
ou une fabrique, c'est ce qu'un décorateur ne peut pas dire ; `route` ajoute sa fonction à
|
|
726
729
|
`presentation/http/<context>.routes.ts`. Une *spec* de gestionnaire construit son application
|
|
727
730
|
de test à partir de `platformTestModule`, de `contextModule('<context>', <context>Declarations)`,
|
|
@@ -750,11 +753,11 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
750
753
|
`system:<context>.<name>`, qui n'a aucun droit tant que le modèle ne lui en donne pas.
|
|
751
754
|
`generate job` écrit l'autorisation là où le modèle en fait une ligne, dans une région marquée
|
|
752
755
|
`system-grants`, et `next` pointe vers cette ligne : `--authz rbac`, l'identifiant de la
|
|
753
|
-
permission sous le rôle `system` de `platform/auth/roles.ts`, le rôle que `createAuthorizer`
|
|
756
|
+
permission sous le rôle `system` de `platform/auth/roles/roles.ts`, le rôle que `createAuthorizer`
|
|
754
757
|
donne à chaque acteur système (`systemRole`) ; `--authz abac`, une règle
|
|
755
758
|
`permit('system-<job>', [permission], ({ actor }) => actor.id === 'system:<job>')` dans
|
|
756
|
-
`platform/auth/attribute-policies.ts` ; `--authz rebac`, le tuple
|
|
757
|
-
`context:<context>#operator@system:system:<job>` dans `platform/auth/relate-system-actors.ts`,
|
|
759
|
+
`platform/auth/attributes/attribute-policies.ts` ; `--authz rebac`, le tuple
|
|
760
|
+
`context:<context>#operator@system:system:<job>` dans `platform/auth/relationships/relate-system-actors.ts`,
|
|
758
761
|
écrit dans le magasin de tuples au démarrage de l'application, tant que le schéma laisse encore
|
|
759
762
|
un sujet `system` opérer un contexte. Avec `--authz custom`, une région supprimée, un schéma de
|
|
760
763
|
relations remodelé ou une permission que le générateur ne sait pas lire, rien n'est écrit et le
|
|
@@ -776,7 +779,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
776
779
|
nouvelle permission rejoint `<context>.permissions.ts` ; ses mots sont vérifiés dans le
|
|
777
780
|
glossaire comme tout autre nom. Avec `--authz rebac`, l'exigence nomme le contexte comme sa
|
|
778
781
|
ressource, un point de départ à remplacer par l'élément sur lequel porte le droit. Avec
|
|
779
|
-
`--authz rbac`, `--grant <role>` accorde la permission au rôle dans `platform/auth/roles.ts`
|
|
782
|
+
`--authz rbac`, `--grant <role>` accorde la permission au rôle dans `platform/auth/roles/roles.ts`
|
|
780
783
|
(le rôle rejoint `role.ts` s'il est nouveau) ; sans lui, une étape `next` dit que
|
|
781
784
|
l'attribution reste à faire (`authz/granted`).
|
|
782
785
|
- `route` remet `actorOf(context.principal)` à un cas d'usage protégé et pose `security` (le
|
|
@@ -1045,11 +1048,11 @@ ddd-ts-kit build-aliases [--project <tsconfig>]
|
|
|
1045
1048
|
```
|
|
1046
1049
|
|
|
1047
1050
|
La seconde étape de `npm run build`, après le compilateur. Le compilateur émet un alias d'import
|
|
1048
|
-
tel qu'il a été écrit (`@/platform/errors`), et Node ne résout aucun alias et ne complète aucune
|
|
1051
|
+
tel qu'il a été écrit (`@/platform/observability/errors`), et Node ne résout aucun alias et ne complète aucune
|
|
1049
1052
|
extension : cette commande réécrit, dans chaque `.js`, `.mjs`, `.cjs`, `.d.ts`, `.d.mts` et
|
|
1050
1053
|
`.d.cts` sous le répertoire de sortie du tsconfig (`tsconfig.build.json` par défaut), chaque
|
|
1051
1054
|
spécificateur d'alias en chemin relatif vers le fichier émis qu'il nomme, avec son extension
|
|
1052
|
-
`.js` (`../../platform/errors.js`), afin que `node dist/src/main.js` s'exécute sans chargeur ni
|
|
1055
|
+
`.js` (`../../platform/observability/errors.js`), afin que `node dist/src/main.js` s'exécute sans chargeur ni
|
|
1053
1056
|
option.
|
|
1054
1057
|
|
|
1055
1058
|
```js
|
|
@@ -1060,8 +1063,8 @@ import { InvoiceError } from '@/contexts/billing/domain/errors/invoice.error';
|
|
|
1060
1063
|
import { InvoiceError } from '../errors/invoice.error.js';
|
|
1061
1064
|
```
|
|
1062
1065
|
|
|
1063
|
-
Elle lit `importAlias` et `importExtension` de la configuration : `@/platform/errors` nomme
|
|
1064
|
-
`platform/errors.js` sous `none`, `@/platform/errors.js` le nomme sous `js`, et aucune autre
|
|
1066
|
+
Elle lit `importAlias` et `importExtension` de la configuration : `@/platform/observability/errors` nomme
|
|
1067
|
+
`platform/observability/errors.js` sous `none`, `@/platform/observability/errors.js` le nomme sous `js`, et aucune autre
|
|
1065
1068
|
écriture n'est devinée.
|
|
1066
1069
|
|
|
1067
1070
|
- Réécrits : le spécificateur de `import ... from`, `export ... from`, un `import` nu,
|
|
@@ -1837,8 +1840,8 @@ règle.
|
|
|
1837
1840
|
| `config/valid` | un amont, une classification, une relation, un identifiant de règle, un mode de `guard` ou un `importExtension` inconnu ; un contexte absent du disque ou de la configuration ; une limite de `commit` qui n'est pas un entier positif |
|
|
1838
1841
|
| `config/suppression-needs-reason` | une désactivation sans identifiant de règle ou sans raison (gardée comme alias à côté de `governance/recorded-deviation`, qui juge la raison) |
|
|
1839
1842
|
| `authz/declared` | dans un fichier de module, `builder.command(X)` ou `builder.query(X)` sans `.requires(` ni `.public(` dans sa chaîne, sauf si la classe du message porte `@Requires` ou `@Public` de `@ddd-ts-kit/kernel/declarations` ; en câblage manuel ou nest, une classe de commande ou de requête absente de tous les `requires(X, ...)` et `publicUseCase(X)` du fichier de module et de `application/authorization/` ; un `defineRoute` sans `security` (le type de la route le refuse déjà, et une liste vide aussi : c'est le filet au niveau du texte pour une définition construite de façon lâche) ; dans le style déclaré, la classe exportée d'un fichier `*.command.ts` ou `*.query.ts` qui ne porte ni `@Requires` ni `@Public` |
|
|
1840
|
-
| `authz/granted` | avec `stack.authz` `rbac`, une permission du `definePermissions` d'un contexte que ni `platform/auth/roles.ts` ni `platform/auth/signed-in-grants.ts` n'accorde par son nom (par l'entrée de son ensemble, son identifiant ou `<contexte>:*`) ; le `*` du super-administrateur ne compte pas (un avertissement) |
|
|
1841
|
-
| `authz/scope-narrows` | dans un contexte, un appel `.scope(` dont la permission (l'entrée d'un ensemble dans l'appel, ou dans une constante ou un champ du fichier) est détenue par toute personne connectée, dans `platform/auth/signed-in-grants.ts` ou dans les `grants` d'un `new SignedInGrantsAuthorizer` : sa portée est toujours `all` ; des droits ou une permission qu'elle ne sait pas lire sont signalés aussi (un avertissement) |
|
|
1843
|
+
| `authz/granted` | avec `stack.authz` `rbac`, une permission du `definePermissions` d'un contexte que ni `platform/auth/roles/roles.ts` ni `platform/auth/authorization/signed-in-grants.ts` n'accorde par son nom (par l'entrée de son ensemble, son identifiant ou `<contexte>:*`) ; le `*` du super-administrateur ne compte pas (un avertissement) |
|
|
1844
|
+
| `authz/scope-narrows` | dans un contexte, un appel `.scope(` dont la permission (l'entrée d'un ensemble dans l'appel, ou dans une constante ou un champ du fichier) est détenue par toute personne connectée, dans `platform/auth/authorization/signed-in-grants.ts` ou dans les `grants` d'un `new SignedInGrantsAuthorizer` : sa portée est toujours `all` ; des droits ou une permission qu'elle ne sait pas lire sont signalés aussi (un avertissement) |
|
|
1842
1845
|
| `authz/in-application` | `presentation/` : un test sur les rôles, `isAdmin`, l'import d'un autorisateur ou de `Access` ; `infrastructure/` : `authorize(` ou `check(` sur un autorisateur ou un accès, `ForbiddenError` ; `domain/` : tout import de `@ddd-ts-kit/auth`, des types d'acteur du kernel (`Actor`, `ActorContext`, `Session`, `ExecutionContext`, les messages autorisés), une lecture de `.roles` ou `.permissions` sur un acteur. La glu de requête HTTP de `@ddd-ts-kit/auth` (`actorOf`, `sessionOf`, `resolveSession`, `SessionAuthenticator`) est libre dans `presentation/`. `presentation/` et `infrastructure/` : l'import de `Requires`, `Public` ou `Policy` depuis `@ddd-ts-kit/kernel/declarations`, ou des ports `Access` et `PolicyAccess` depuis `@ddd-ts-kit/auth` ; ils sont libres dans `application/` |
|
|
1843
1846
|
| `authz/actor-explicit` | dans `domain/` et `application/` : `ActorContext`, `ExecutionScope` (comme type ou comme valeur : la classe est le jeton d'une liste de dépendances), `AsyncLocalStorageExecutionScope`, `ScopedActorContext`, `AsyncLocalStorage` ; `.current()` ou `.require()` sur un contexte d'acteur ou sur quelque chose nommé `scope`, `scopes` ou `...executionScope` ; un import de `stampCreation`, `stampUpdate` ou `tenantScopeOf` |
|
|
1844
1847
|
| `authz/fields-by-schema` | sous `application/queries/` : `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, une comparaison avec un `role`, `isAdmin` |
|
package/README.md
CHANGED
|
@@ -330,7 +330,7 @@ injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
|
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
and the one line of the composition root that adds the whole context:
|
|
333
|
-
`contextModule('notification', notificationDeclarations)` in `src/platform/compose-application.ts`.
|
|
333
|
+
`contextModule('notification', notificationDeclarations)` in `src/platform/composition/compose-application.ts`.
|
|
334
334
|
|
|
335
335
|
**A refusal is a class of its own.** `init` writes `"stack.refusals": "named"`: each refusal of
|
|
336
336
|
a context is a class named after what is refused, extending `DomainRefusal` of the kernel, built
|
|
@@ -437,7 +437,7 @@ calls one intention method, `await repository.save(aggregate)` and returns: no `
|
|
|
437
437
|
no `DomainEventDispatcher` in a handler or in a repository adapter, which only persists. The events
|
|
438
438
|
the aggregate recorded are dispatched once the save resolves, inside the unit of work of the
|
|
439
439
|
command: by the kernel module on tsyringe, by `dispatchingOnSave` around each repository in
|
|
440
|
-
`platform/create-platform.ts` with hand wiring (`domain-events/dispatched-on-save`).
|
|
440
|
+
`platform/composition/create-platform.ts` with hand wiring (`domain-events/dispatched-on-save`).
|
|
441
441
|
|
|
442
442
|
Instead of pulling the events and dispatching them in the handler:
|
|
443
443
|
|
|
@@ -511,17 +511,20 @@ config, `docsUi`, `ci` and `logger` included.
|
|
|
511
511
|
| `package.json` | scripts and dependencies of the stack (below); `build` is the compiler, then `ddd-ts-kit build-aliases` |
|
|
512
512
|
| `tsconfig.json`, `tsconfig.build.json` | strict, NodeNext, `rootDir` `.` and `outDir` `dist`, and `paths`: the one declaration of the import alias (`@/*` to `./src/*`, `$test/*`, `$scripts/*`, and `$generated/*` with Prisma), derived from `importAlias` (`--import-alias '$<name>/'`, `@/` by default; `#<name>/` and `@<name>/` are refused with the reason); the build config extends the other and declares no `paths`; `experimentalDecorators` (and `emitDecoratorMetadata`) only for nest or class-validator, whose decorators are legacy ones: the declarations and the aspects serve both modes |
|
|
513
513
|
| `src/main.ts` | composition root: tracing first (error reporting second with `--errors sentry`), config, persistence, application (`log`, `traceConsumers: config.tracing.consumers`, `resilience`, `jobs: { start: config.runJobs, settings: jobSettings(process.env) }`), outbox relay, HTTP server; on `SIGTERM` or `SIGINT` it closes the server, stops the relay, stops the application, closes the persistence and shuts the tracing down |
|
|
514
|
-
| `src/platform/` | one export per file, each named after it, in one folder per concern
|
|
515
|
-
| tracing | wired once, by the platform (`tracing/platform-only`): no `decorate` hook, no `decorate-bindings.ts`. `tracing.ts` starts `initTracing` of `@ddd-ts-kit/tracing/node` before any other module, on what `config/read-tracing.ts` validates: `OTEL_EXPORTER_OTLP_ENDPOINT` (a URL; left out, no span leaves the process), `TRACE_SAMPLE_RATIO` (0 to 1) and `TRACE_CONSUMERS` (`continue`, the default: a consumed event stays in the trace of its publication; `link`: each delivery starts a trace linked to it). With `--di tsyringe`: `lay-foundations.ts` builds `traceApplication({ consumers })`, `compose-application.ts` hands it to `kernelModule({ instrumentation })` (one span per use case, repository call, domain event, publication, consumer and job) and gives the outbox relay `tracedPublisher(bus)`. With hand wiring: `create-platform.ts` applies the members of `traceApplication()` itself (`useCase` on both buses, `domainEvents`, `publisher`, `binding` around every adapter, `job`, `executionScope`, `errorReporter`), with `tracedSubscriber` and `tracedPublisher` around the provider. With an HTTP stack, in both families, `auth/http-boundary.ts` sets `around: tracedRoutes()`: one `SERVER` span per request, named by its route |
|
|
514
|
+
| `src/platform/` | one export per file, each named after it, in one folder per concern, no file at its root (a project generated before the folders keeps them flat until `npx ddd-ts-kit platform-folders`). `composition/` (`compose-application.ts`, then `platform.module.ts`, `platform-test.module.ts` and `lay-foundations.ts` on tsyringe, `platform.ts` and `create-platform.ts` wired by hand); `jobs/` (`job-settings.ts`, `jobSettings(environment, context?)`: one line per job, `JOB_<CONTEXT>_<JOB>_ENABLED=false` switches one off). `config/` (`app-config.ts`, `load-config.ts`, `config-error.ts`, `read-tracing.ts`: fail-fast on `DATABASE_URL`, `LOG_LEVEL`, `LOG_FORMAT`, `LOG_SCRUB_MESSAGES`, the `OUTBOUND_*` policy, `RUN_JOBS` and the tracing variables below); `observability/` (`tracing.ts`, the first import of every entry point; `errors.ts` with `--errors sentry`; `create-logger.ts`, see `--logger`; `create-metrics.ts`: a `NoopMetrics` behind a `TODO(platform)`); `resilience/` (`resilience-settings.ts`, `default-resilience.ts`, `adapter-aspects.ts`: retry with backoff and a timeout for `external` and `gateway`, `own-policy.ts` for an adapter that states its own, `self-governed.ts`); `events/`, `database/`, `auth/`, `audit/`, `redis/` (below); `http/` (`start-http-server.ts`, `with-documentation.ts`: `/docs` and `/openapi.json`, or `/openapi/<name>.json` per document of a split contract, off in production unless `API_DOCS=true`; `openapi-documents.ts`, the split written by `ddd-ts-kit docs` from `openapi.documents`). With `--di tsyringe`: `compose-application.ts` (`composeApplication(persistence, options, contexts?)`: `kernelModule({...})`, the platform module, the authorization module, the contexts; installs the aspect runtime), `lay-foundations.ts` (one execution scope, clock, id generator, logger, metrics, instrumentation and audit, built before any module), `platform.module.ts` (what replaces the in-process defaults of the kernel: unit of work, processed-event store, the storage class, `OutboxStore`, `EventSubscribers` behind a broker, `ErrorMapper`, and `builder.around(['external', 'gateway'], ...)`, the resilience of every adapter that leaves the process), `platform-test.module.ts` (what a handler spec lists next to its context: the storage class bound to a factory that throws), `buses/create-command-bus.ts` and `create-query-bus.ts` (outermost first: `errorReportingMiddleware`, `loggingMiddleware`, `metricsMiddleware`, the permission, the span of the use case, the audit entry, then the unit of work of a command). With `--di manual` or `nest`: `compose-application.ts`, `platform.ts` (`interface Platform`, with `jobs: JobScheduler` and `adapter`, which wraps what a module file instantiates), `create-platform.ts`, `jobs/configured-job-scheduler.ts` (applies `job-settings.ts` to what a module registers) |
|
|
515
|
+
| tracing | wired once, by the platform (`tracing/platform-only`): no `decorate` hook, no `decorate-bindings.ts`. `tracing.ts` starts `initTracing` of `@ddd-ts-kit/tracing/node` before any other module, on what `config/read-tracing.ts` validates: `OTEL_EXPORTER_OTLP_ENDPOINT` (a URL; left out, no span leaves the process), `TRACE_SAMPLE_RATIO` (0 to 1) and `TRACE_CONSUMERS` (`continue`, the default: a consumed event stays in the trace of its publication; `link`: each delivery starts a trace linked to it). With `--di tsyringe`: `lay-foundations.ts` builds `traceApplication({ consumers })`, `compose-application.ts` hands it to `kernelModule({ instrumentation })` (one span per use case, repository call, domain event, publication, consumer and job) and gives the outbox relay `tracedPublisher(bus)`. With hand wiring: `create-platform.ts` applies the members of `traceApplication()` itself (`useCase` on both buses, `domainEvents`, `publisher`, `binding` around every adapter, `job`, `executionScope`, `errorReporter`), with `tracedSubscriber` and `tracedPublisher` around the provider. With an HTTP stack, in both families, `auth/authentication/http-boundary.ts` sets `around: tracedRoutes()`: one `SERVER` span per request, named by its route |
|
|
516
516
|
| `--logger` | `src/platform/observability/create-logger.ts`, one per choice: `stdout` (the default) is the `StdoutLogger` of `@ddd-ts-kit/aspects`, JSON lines, credentials not redacted; `pino` is `createPinoLogger` of `@ddd-ts-kit/pino` (dependencies `pino` and `pino-pretty`); `winston` is `createWinstonLogger` of `@ddd-ts-kit/winston`; these two redact the credential keys of the kernel. Every entry carries `traceLogFields(scope)`: the correlation id, origin, actor and tenant of the work in progress and the ids of the active trace. `LOG_LEVEL`, `LOG_FORMAT` (`json`, the default, or `pretty`; with `stdout`, which has no pretty format, `pretty` is refused when the configuration is loaded) and `LOG_SCRUB_MESSAGES` (`[message removed]` in place of the message of a logged error that is not a `DomainError`) are validated in `config/load-config.ts`. Stopping the application flushes the error reporter, then the logger, last: `container.stop()` does it on tsyringe, `compose-application.ts` flushes explicitly with hand wiring. The tools and the tests compose the application without `log` and write nothing |
|
|
517
|
-
| `src/platform/auth/` |
|
|
517
|
+
| `src/platform/auth/` | one folder per question: `authentication/` (who is calling), `authorization/` (what they may do, whatever the model) and the folder of the model `stack.authz` names (`roles/`, `attributes/`, `relationships/` or `custom/`). A project generated before the folders keeps its files flat: the generators read them there, `npx ddd-ts-kit doctor` says so and `npx ddd-ts-kit platform-folders` moves them with every import |
|
|
518
|
+
| `src/platform/auth/authentication/` | `create-authenticator.ts` (`--authn jwt`: `JwtAuthenticator` on `AUTH_ISSUER`, `AUTH_AUDIENCE`, `AUTH_JWKS_URI`; `--authn keycloak`: `keycloakAuthenticator` on `KEYCLOAK_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_AUDIENCE` and the optional `KEYCLOAK_CLIENT_ID`; `--authn none`: `development-header-authenticator.ts` and `development-actor-header.ts`, which read `x-development-actor` and throw in production), `principal-of.ts`, `security-schemes.ts`, `offline-authenticator.ts`, `http-boundary.ts` (`resolvePrincipal` answering a `Session`, `executionScope`, `errorMapper` and `onError`, spread into the mount options: every request runs inside the execution scope, with its correlation id). Without an HTTP stack there is no authenticator and no boundary, and no folder |
|
|
519
|
+
| `src/platform/auth/authorization/` | `create-authorizer.ts`, `authorization.ts` (`authorizationModule` with tsyringe) or `use-case-protection.ts` (the guard of the hand-wired buses), `access-policies.ts`, `role.ts` (the roles a credential carries, with roles or attributes, or once a guard names one), `permissions.ts` (the registry of every permission, with relationships or an authorizer of your own), `signed-in-grants.ts` once a context preset grants every signed-in person, and with `--audit off` `log-decisions.ts` (one log entry per decision, ids and codes only) |
|
|
520
|
+
| `src/platform/auth/<model>/` | `roles/roles.ts` (with the role `system` every system actor holds); `attributes/attribute-policies.ts`; `relationships/`: `relationship-schema.ts`, `create-tuple-store.ts` and its contract spec, `relation-tuples.ts`, `relate-system-actors.ts`, `permission-mapping.ts`; `custom/`: `custom-authorizer.ts` and its `authorizerContract` spec |
|
|
518
521
|
| `--representations negotiated`, `--forms on` | `src/platform/http/presentation-of.ts` (`Representations.standard()` with `negotiated`, and `fieldDeciderOf` over the `Access` of the application), spread into the HTTP boundary and given to the contract script; with `--forms on`, `src/platform/http/with-forms.ts` adds `formRoutes` to the routes and `scripts/openapi.ts` writes `openapi/forms/<operationId>.json`. Both are the default with an HTTP stack; `json` and `off` leave them out ([docs/CONFIG.md](../../docs/CONFIG.md)) |
|
|
519
|
-
| `--audit on` | `src/platform/audit/`: `create-audit.ts` (the trail, the `onDecision` of the authorization, the refusals of the guards at the edge given to the HTTP boundary as `onGuardRefusal`, the middleware before the unit of work, the integration events subscribed under the consumer name `audit`), `audited-events.ts` (the registry `generate integration-event` adds to), `audit.module.ts`, and with an HTTP stack the read side: `audit.permissions.ts` (`audit:trail.read`), `search-audit-entries.query.ts`, its handler, `search-audit-entries.route.ts` (`GET /audit/entries`: cursor pages, filters `actorId`, `action`, `outcome`, `correlationId`). It is a capability of the platform, not a bounded context: no model, one protected query over the `AuditReader` port, bounded by the tenant of the actor (with `--tenancy shared-table`, by the tenant of the work through `TenantAuditReader`: platform staff read across tenants only inside `acrossTenants`). The refusals of a caller without a credential are not recorded. A scheduled job is audited like a request: origin `schedule`, actor `system:<context>.<job>`. With knex the two tables and their append-only triggers are created by the first migration; with drizzle the tables are in `schema.ts` and `npm run db:audit-guard` prints the trigger statements for a custom migration; with prisma, typeorm, `custom` or no ORM the trail is an `InMemoryAuditTrail` behind a `TODO(platform)`. The test databases leave the audit schema out of `reset()` |
|
|
522
|
+
| `--audit on` | `src/platform/audit/`: `create-audit.ts` (the trail, the `onDecision` of the authorization, the refusals of the guards at the edge given to the HTTP boundary as `onGuardRefusal`, the middleware before the unit of work, the integration events subscribed under the consumer name `audit`), `audited-events.ts` (the registry `generate integration-event` adds to), `audit.module.ts`, and with an HTTP stack the read side: `audit.permissions.ts` (`audit:trail.read`), then in `search-audit-entries/`: `search-audit-entries.query.ts`, its handler, `search-audit-entries.route.ts` (`GET /audit/entries`: cursor pages, filters `actorId`, `action`, `outcome`, `correlationId`). It is a capability of the platform, not a bounded context: no model, one protected query over the `AuditReader` port, bounded by the tenant of the actor (with `--tenancy shared-table`, by the tenant of the work through `TenantAuditReader`: platform staff read across tenants only inside `acrossTenants`). The refusals of a caller without a credential are not recorded. A scheduled job is audited like a request: origin `schedule`, actor `system:<context>.<job>`. With knex the two tables and their append-only triggers are created by the first migration; with drizzle the tables are in `schema.ts` and `npm run db:audit-guard` prints the trigger statements for a custom migration; with prisma, typeorm, `custom` or no ORM the trail is an `InMemoryAuditTrail` behind a `TODO(platform)`. The test databases leave the audit schema out of `reset()` |
|
|
520
523
|
| `--tenancy shared-table` | recorded as `stack.tenancy`; Knex or Drizzle only. Every `generate repository` is tenant-scoped (as `--tenant-scoped`), through `tenantTable` and `ownTenantTable` or `tenantCondition` and `ownTenantCondition`; the outbox keeps the tenant of each event (`createOutboxTables(knex, { tenant: true })` and `KnexOutboxStore`'s `tenant: true`, or `tenantOutboxTable`), so consumers run in it; `tenancy/scoped-statement` judges the adapters. Row-level security, schema per tenant and database per tenant are refused, with what to wire by hand ([Multitenancy](../../docs/concepts/multitenancy.md)) |
|
|
521
524
|
| `--queue database\|redis\|memory` | recorded as `stack.queue`. `database` (the default on Knex or Drizzle with tsyringe): `createJobTable` and `createProcessTable`, or `jobsTable` and `processesTable`, in the `messaging` schema, `Persistence` gains `jobs` and `processes`, and the platform module rebinds `JobStore` and `ProcessStore` to them, so a job enqueued by a command is written in its transaction; `redis` (with `--cache redis`): `RedisJobStore` on the connection of the cache, the processes in the database; `memory` (the default otherwise): nothing is written, the kernel module keeps both in the process. Refused off tsyringe, `database` with another ORM, `redis` without the cache |
|
|
522
525
|
| `--cache redis` | `src/platform/redis/open-redis.ts` (`RedisServices`: the cache bound to the kernel `Cache`, the limiter to `RateLimiter`, the lock to `Lock`, which keeps a scheduled job to one instance, the relay signal as the `wakeOn` of the outbox relay with `relayWakeUpMiddleware` on the command bus), `http/refusal-for.ts` (one sliding window per caller address, 429 `application/problem+json` with `retry-after`; `RATE_LIMIT_MAX`, `RATE_LIMIT_WINDOW_MS`), `GET /health/ready` on the HTTP server, `REDIS_URL` validated, a compose service `cache` running Dragonfly with a healthcheck. Without a server (tools, tests without `REDIS_URL`) the same ports stay in the memory of the process |
|
|
523
526
|
| `--http-cache varnish` | a compose service `varnish` (Varnish 9.1.0, reaching the API on `host.docker.internal`) with its VCL in `docker/varnish/default.vcl` (only answers whose `Cache-Control` allows them by `max-age` or `s-maxage` are kept, filed under their `xkey` tags, purged by `PURGE` from the machine of Varnish or with `VARNISH_PURGE_KEY`, `x-cache: HIT\|MISS`), `VARNISH_URL` and `VARNISH_PURGE_KEY` validated, `cacheTags: { header: CacheTagHeader.xkey }` in the HTTP boundary, and the outbox relay of `main.ts` and of every `generate service` entry point publishing through `PurgingPublisher` with `VarnishCachePurger` (the end-to-end application records the purges in `purges`); on `--di manual` and `nest` the platform gains `cacheInvalidation`; with `--tenancy`, the tags of the answers and the purges are filed under the tenant (`perTenant`) and the tenant of a request is read from `x-tenant-id`. Needs an HTTP framework and `--events outbox`: a purge is a row of the outbox |
|
|
524
|
-
| `--errors sentry` | unexpected failures reported to Sentry or GlitchTip (one protocol, only the DSN differs) through the kernel `ErrorReporter`, bound to `@ddd-ts-kit/sentry`. `src/platform/errors.ts` (`initSentry` on the validated configuration, then `reportProcessFailures`), the second import of `main.ts`, of `apps/<context>/main.ts` and of `apps/worker/main.ts`, right after `tracing.ts`; `errors` handed to `composeApplication`, which gives it to the kernel module on tsyringe (`errorReporter`, flushed by `container.stop()` before the logger, `errorReportingMiddleware` first on both buses, the default scheduler observing with `reportFailedRuns`) or to `createPlatform` by hand (the same middleware, `onRun: reportFailedRuns(errors)`, `platform.errors`, flushed two seconds at most when the application stops); `reportHttpErrors` in `auth/http-boundary.ts` for every request answered 5xx; `DeadLetterReports` on the `onFailure` hook of a provided broker (`createEventProvider(config, errors)`, with `observing` around each consumer) and of the outbox relay. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (default: `NODE_ENV`), `SENTRY_RELEASE` and `SENTRY_SCRUB_MESSAGES` validated in `config/load-config.ts` as `errorReporting`: without a DSN the application starts and reports nothing; a DSN that is not a URL refuses the start. Dependencies `@ddd-ts-kit/sentry` and `@sentry/node`. A compose profile `errors` running GlitchTip 6.2.6 with its own PostgreSQL and Valkey (`GLITCHTIP_PORT`, loopback only, development bootstrap), and a section of the generated README saying how to read its DSN. The tools and the tests compose the application without a reporter. It goes with every other choice of the stack; with `--errors none` nothing of this is written |
|
|
527
|
+
| `--errors sentry` | unexpected failures reported to Sentry or GlitchTip (one protocol, only the DSN differs) through the kernel `ErrorReporter`, bound to `@ddd-ts-kit/sentry`. `src/platform/observability/errors.ts` (`initSentry` on the validated configuration, then `reportProcessFailures`), the second import of `main.ts`, of `apps/<context>/main.ts` and of `apps/worker/main.ts`, right after `tracing.ts`; `errors` handed to `composeApplication`, which gives it to the kernel module on tsyringe (`errorReporter`, flushed by `container.stop()` before the logger, `errorReportingMiddleware` first on both buses, the default scheduler observing with `reportFailedRuns`) or to `createPlatform` by hand (the same middleware, `onRun: reportFailedRuns(errors)`, `platform.errors`, flushed two seconds at most when the application stops); `reportHttpErrors` in `auth/authentication/http-boundary.ts` for every request answered 5xx; `DeadLetterReports` on the `onFailure` hook of a provided broker (`createEventProvider(config, errors)`, with `observing` around each consumer) and of the outbox relay. `SENTRY_DSN`, `SENTRY_ENVIRONMENT` (default: `NODE_ENV`), `SENTRY_RELEASE` and `SENTRY_SCRUB_MESSAGES` validated in `config/load-config.ts` as `errorReporting`: without a DSN the application starts and reports nothing; a DSN that is not a URL refuses the start. Dependencies `@ddd-ts-kit/sentry` and `@sentry/node`. A compose profile `errors` running GlitchTip 6.2.6 with its own PostgreSQL and Valkey (`GLITCHTIP_PORT`, loopback only, development bootstrap), and a section of the generated README saying how to read its DSN. The tools and the tests compose the application without a reporter. It goes with every other choice of the stack; with `--errors none` nothing of this is written |
|
|
525
528
|
| `--authn keycloak` | a compose service `keycloak` (Keycloak 26.8.0, `start-dev --import-realm`, profile `identity`) and `docker/keycloak/<project>-realm.json`: the API client, a public client `<project>-local` with the direct grant, its audience and `tenant_id` mappers, the realm role `admin`, and the demo users `demo-admin` and `demo-user`, for local development only |
|
|
526
529
|
| `--storage local\|s3` | recorded as `stack.storage`: where the content of files lives, never in the database. `src/platform/config/read-files.ts` and `src/platform/files/open-files.ts`, one per choice: `local`, a directory in development (`FILES_DIRECTORY`, `.data/files`) and the signed links answered by the application under `/files` (`FILES_PUBLIC_URL` and `FILES_SIGNING_SECRET` required in production); `s3`, a bucket of any provider of the S3 protocol through `@ddd-ts-kit/s3` (the `S3_*` variables, MinIO in the compose stack); the memory of the process in the tests and the tools, either way. With `--di tsyringe`: `files/bind-files.ts`, `files/files.module.ts` and `files/staging-uploads.ts`; with hand wiring `files/create-files.ts`; with an HTTP stack `files/file-routes.ts`. They bind `FileStorage`, `FileKeys`, `FileScanner` and `FileStaging`, register the hourly purge of staged files and stage the file a command carries before its transaction; `generate file-upload` needs them. `--storage none` writes none of this ([File storage](../../docs/concepts/file-storage.md)) |
|
|
527
530
|
| `src/platform/events/` | `event-provider.ts` (`bus`, `forConsumer(name)`, `start()`, `close()`), `in-process-events.ts`, and for `--broker` `create-event-provider.ts`: `RabbitMqEventBus` (`AMQP_URL`), `KafkaEventBus` (`KAFKA_BROKERS`, with `aggregate-key-of.ts` for per-aggregate order), `NatsEventBus` (`NATS_URL`) or `RedisStreamsEventBus` of `@ddd-ts-kit/redis/event-bus` (`REDIS_URL`: Redis, Dragonfly or Valkey), each with one subscriber per consuming context (`forConsumer`), `assertTopology` at start, its address validated and a compose service with a healthcheck; or `custom-event-bus.ts` with its `eventBusContract` spec. `start-outbox-relay.ts` with the outbox. `--broker redis` with `--cache redis` is one server and one compose service, `cache`; alone, the service is `streams` |
|
|
@@ -556,7 +559,7 @@ to its lists, everything else is kept, and the notes of the command list what wa
|
|
|
556
559
|
denied and `Read(!./.env.example)`, a negation placed after it in the same list, takes the
|
|
557
560
|
example file back out.
|
|
558
561
|
|
|
559
|
-
Every `.ts` file `init` and `generate` write imports by the alias (`@/platform/errors`),
|
|
562
|
+
Every `.ts` file `init` and `generate` write imports by the alias (`@/platform/observability/errors`),
|
|
560
563
|
never by a relative path; the barrel and a published-language index re-export by it too.
|
|
561
564
|
|
|
562
565
|
Scripts: `dev` (`tsx watch`, which resolves an alias from the `paths` of `tsconfig.json`,
|
|
@@ -592,7 +595,7 @@ against a server that answers as Keycloak does, not against Keycloak in the pipe
|
|
|
592
595
|
changes their own role or acts above it, whatever a delegation lends; a deactivated account
|
|
593
596
|
leaves its organisations; an address the provider did not verify provisions no account. On `init` without a `--context` of its name, the context `identity` is declared
|
|
594
597
|
`generic`. Every signed-in person holds the permissions of the context whatever `--authz` says:
|
|
595
|
-
the grant `'identity:*'` of `platform/auth/signed-in-grants.ts`, answered by
|
|
598
|
+
the grant `'identity:*'` of `platform/auth/authorization/signed-in-grants.ts`, answered by
|
|
596
599
|
`SignedInGrantsAuthorizer` before the model in `createAuthorizer`. With tenants, the tables of
|
|
597
600
|
the context belong to none, under a decision record the preset writes, and with `--authn
|
|
598
601
|
keycloak` the authenticator reads the `organization` claim as the tenants of the person
|
|
@@ -644,7 +647,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
644
647
|
|
|
645
648
|
| Kind | Arguments | Writes |
|
|
646
649
|
|---|---|---|
|
|
647
|
-
| `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`. `application/authorization/<name>.permissions.ts` is born with the first permission, or at once when `platform/auth/permissions.ts` lists the permission sets (rebac, custom). With `--preset`, the context is then written whole from that preset, its classification and purpose those of the preset unless the flags say otherwise ([Presets](#presets)) |
|
|
650
|
+
| `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/composition/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`. `application/authorization/<name>.permissions.ts` is born with the first permission, or at once when `platform/auth/authorization/permissions.ts` lists the permission sets (rebac, custom). With `--preset`, the context is then written whole from that preset, its classification and purpose those of the preset unless the flags say otherwise ([Presets](#presets)) |
|
|
648
651
|
| `aggregate` | `<context> <Name> [--event-sourced]` | aggregate, builder, spec in given / when / then; with `--event-sourced`, an aggregate on `EventSourcedAggregate` whose state is the replay of its events, born with its `Created` domain event, the codec of its stored events in `infrastructure/persistence/<name>-events.mapper.ts`, a builder that replays a history and a spec given events, and a note naming the `EventSourcedRepository` its repository adapter delegates to |
|
|
649
652
|
| `builder` | `<context> <Aggregate>` | `test/builders/<name>.builder.ts`, a class extending `Builder` |
|
|
650
653
|
| `test-world` | `<context> [Name]` | `test/worlds/<name>.world.ts` (the name defaults to the context): `a<Name>World({ now, idPrefix, given })`, the arrangement several specs of the context share. It reads the fakes of `test/fakes/` and the port each one implements, builds them, hands them to `given` so that the spec stores what it starts from, then to the test application (with `modules`, the authorization of the spec) or, wired by hand, wraps the repositories of the buses of `createTestBuses` with `dispatching`; it returns every fake under the name of its port. A fake that needs constructor arguments, or, under a container, stands for a port nothing binds or depends on yet, is left out with a note |
|
|
@@ -663,7 +666,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
663
666
|
| `route` | `<context> <UseCaseName> --method <GET\|POST\|PUT\|PATCH\|DELETE> --path <p> [--command\|--query] [--group <Name>] [--mapper] [--serializer] [--cache public\|private\|no-store]` | under `"stack.routes": "controllers"`: a controller class in `presentation/http/<resource>/<use-case>/` (the resource is the first segment of the path), depending on `CommandBus` or `QueryBus`, behind the route group of its resource, written with it when it is new (`<resource>.routes.ts`: prefix, tag, `Authenticated`); a public use case stands in no group and says `guards: [Public]`; with class-validator one class per file (`<use-case>.params.ts`, `.body.ts`, `.answer.ts`, `.accepted.ts`, `.line.ts`); `--mapper` and `--serializer` add a request mapper and a serializer the controller is given; a spec; no registration in a declared project, a controller built by hand in `<context>.routes.ts` (the module file with hand wiring) in an explicit one. Under `"functions"`: a `defineRoute` function, its spec, its registration in `<context>.routes.ts`, and `<use-case>-<role>.dto.ts` classes |
|
|
664
667
|
| `controller` | the same arguments as `route` | the controller class, whatever `stack.routes` says: for a project of function routes that writes its next route as a class. `--cache` writes its cache policy: `private` (a `GET` of a caller, `max-age=0`, `must-revalidate`, strong `ETag`), `public` (a `GET` of a public use case, `max-age` 1m, `s-maxage` 5m, tagged with the resources of its path), `no-store`; refused on a write, and `public` behind a route group |
|
|
665
668
|
| `file-upload` | `<context> <UseCaseName> --path <p> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--method POST\|PUT] [--group <Name>]` | an upload: a controller that declares the file it receives (its size and media types in the contract, checked as it streams), the command that carries it as a `FileUpload`, staged by the command bus before the transaction, the handler that records it and promotes it with the commit, and their specs. Refused without `stack.storage` or without an HTTP stack, with the `init --force --storage local` to run |
|
|
666
|
-
| `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts`: an empty class carrying `@RouteGroup`, behind `Authenticated` unless `--public` or `--role` says otherwise (`HasRole(Role.Admin)`, the role read from the vocabulary of the platform, `<platformDir>/auth/role.ts`, which gets it when it does not hold it); with `--group` it refines that group and inherits from it |
|
|
669
|
+
| `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts`: an empty class carrying `@RouteGroup`, behind `Authenticated` unless `--public` or `--role` says otherwise (`HasRole(Role.Admin)`, the role read from the vocabulary of the platform, `<platformDir>/auth/authorization/role.ts`, which gets it when it does not hold it); with `--group` it refines that group and inherits from it |
|
|
667
670
|
| `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts`: a declared guard class to fill, and its spec |
|
|
668
671
|
| `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | adds `produces` to the `@Controller` of the use case, and `consumes: ['application/xml']` to one that receives a body when XML is asked; says when CSV needs a page or a streamed list, and when `stack.representations` is not `negotiated` |
|
|
669
672
|
| `form` | `<context> <UseCase>` | adds `const form = defineForm<Infer<typeof body>>({ ... })` before the `@Controller` of a use case that receives a body, and `form` to its options: the hints of its form at `GET /forms/<operationId>` |
|
|
@@ -672,12 +675,12 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
672
675
|
| `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>` | `application/integration/handlers/<name>.integration-handler.ts`, a class `<Name>IntegrationHandler` depending on `CommandBus`, its spec, its idempotent subscription under the consumer name `<context>.<name>`; refused unless the upstream is declared |
|
|
673
676
|
| `event-handler` | `<context> <Aggregate> <Fact> [--phase before-commit\|after-commit]` | reaction to a domain event of the context, spec, subscription; before the commit of the unit of work by default, after it with `--phase after-commit` (an effect no transaction covers, at most once), and the spec runs the reaction in that phase |
|
|
674
677
|
| `projection` (`projector`) | `<context> <Name> <event-type>` | a projector in `application/projections/<name>.projection.ts`, declared with `@Projection('<context>.<name>')` and one `@On(definition)` method for the integration event, which the context itself or a declared upstream publishes, and its spec; declared style only. It keeps one read model: its port is received in the constructor |
|
|
675
|
-
| `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName>` | `application/scheduling/<name>.job.ts`, a class `<Name>Job implements ScheduledJob` that sends the command, as `systemActor('<context>.<name>')` when it is protected, with `execution.scheduledAt` when the command takes it; `test/unit/<name>.job.spec.ts`, which runs the job (by name on tsyringe, `application.jobs.runNow`; `job.run(occurrence)` with hand wiring) and asserts the command it sent; its registration; its switch in `platform/job-settings.ts`; the grant of its system actor (below) |
|
|
678
|
+
| `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName>` | `application/scheduling/<name>.job.ts`, a class `<Name>Job implements ScheduledJob` that sends the command, as `systemActor('<context>.<name>')` when it is protected, with `execution.scheduledAt` when the command takes it; `test/unit/<name>.job.spec.ts`, which runs the job (by name on tsyringe, `application.jobs.runNow`; `job.run(occurrence)` with hand wiring) and asserts the command it sent; its registration; its switch in `platform/jobs/job-settings.ts`; the grant of its system actor (below) |
|
|
676
679
|
| `background-job` | `<context> <Name> --command <UseCaseName>` | `application/background/<name>.background-job.ts`, a class `<Name>BackgroundJob implements BackgroundJob<<Name>Payload>` named by its static `jobName` `<context>.<name>`, that sends the command as `execution.actor` when it is protected, followed by one field of `<Name>Payload` per other parameter of the constructor of the command (strings, numbers, booleans, literals and lists of them as written, a `Date` as its ISO text; anything else is refused); `test/unit/<name>.background-job.spec.ts`, which enqueues it with a payload of every field as a user holding the permission and runs what is due; its registration (`@Background()`, or `builder.backgroundJob(..)` in the module file). `--di tsyringe` only |
|
|
677
680
|
| `process` (`process-manager`) | `<context> <Name>` | `application/processes/<name>.process.ts` (its state, `processName`, `timeoutJob`, `isState`, a first step that arms a deadline, a step that ends it in time, the step of the deadline), `application/background/<name>-timeout.background-job.ts`, which delivers its timeouts through `ProcessRunner`, and the specs of both (`givenProcess`, the queue of the test application). `--di tsyringe` only |
|
|
678
681
|
| `acl` | `<context> <upstreamOrSystemName>` | translator in `infrastructure/anti-corruption/`, spec |
|
|
679
682
|
| `e2e` | `<context> <UseCaseName>` | `test/e2e/<use-case>.e2e.spec.ts` driving the route of the use case: 401 without a credential, 403 without the permission, the documented status with it; for a command, one more test asserts the trace of the request, exact on names and structure, with `installTestTracing()` and `expectSpanTree(storyOf(trace), [...])` of `@ddd-ts-kit/tracing/testing` (`POST /invoices`, then `command IssueInvoiceCommand`, then `repository InvoiceRepository.save`); needs the route |
|
|
680
|
-
| `policy` | `<context> <Name> --permission <aggregate>.<action>` | `application/authorization/<name>.policy.ts`, spec; declared: the class carries `@Policy(permission, { name })` and nothing else is written; explicit: registration in `platform/auth/access-policies.ts` |
|
|
683
|
+
| `policy` | `<context> <Name> --permission <aggregate>.<action>` | `application/authorization/<name>.policy.ts`, spec; declared: the class carries `@Policy(permission, { name })` and nothing else is written; explicit: registration in `platform/auth/authorization/access-policies.ts` |
|
|
681
684
|
| `gateway` | `<context> <upstreamContext> <Name>` | the read contract in the upstream's published language (`<name>.contract.ts`, an abstract class and the token of the upstream value), the port `application/ports/<name>-gateway.port.ts`, an in-process adapter in `infrastructure/external/` bound `.as('gateway')`, a fake, one contract suite; refused unless the upstream is declared |
|
|
682
685
|
| `adapter` | `<context> <Port> [--kind external\|gateway] [--decorators]` | `infrastructure/external/remote-<port>.adapter.ts` for an existing port, its spec, and on tsyringe its binding `builder.bind(<Port>).toClass(Remote<Port>).as(<kind>).with(ownPolicy(retry(...), timeout(...)))`; with `--decorators`, on every stack, the class carries `@Retry` and `@Timeout` of `@ddd-ts-kit/aspects/decorators` on its one outbound method and is bound `.with(ownPolicy())`. Explicit: a port that is already bound, or hand wiring, gets a note instead of a binding. Declared: the class carries `@Adapter(<Port>, { kind, aspects })`, or `@Gateway(<Port>, { aspects })` in `remote-<port>.gateway.ts` with `--kind gateway`, and a port that already has a declared adapter is refused |
|
|
683
686
|
| `service` | `<context>` | `src/apps/<context>/main.ts` (kernel, platform, that context only, with its jobs: `jobSettings(process.env, '<context>')`), script `start:<context>`, a compose service behind the `services` profile, the knip entry, `deployable: true` in the config. The Dockerfile takes the entry as build argument `ENTRY` |
|
|
@@ -699,7 +702,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
699
702
|
composition root lists no publisher; `job` writes `@Scheduled('<context>.<name>', schedule)`;
|
|
700
703
|
`policy` writes a class with `@Policy(permission, { name })` and registers nothing; `gateway`
|
|
701
704
|
writes `@Gateway(<Name>Gateway, [<Name>Contract])` and binds the upstream value in the marker
|
|
702
|
-
regions of `platform/platform.module.ts` and `platform/platform-test.module.ts`: a value or a
|
|
705
|
+
regions of `platform/composition/platform.module.ts` and `platform/composition/platform-test.module.ts`: a value or a
|
|
703
706
|
factory is what a decorator cannot say; `route` adds its function to
|
|
704
707
|
`presentation/http/<context>.routes.ts`. A handler spec builds its test application from
|
|
705
708
|
`platformTestModule`, `contextModule('<context>', <context>Declarations)`, an authorization
|
|
@@ -725,11 +728,11 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
725
728
|
- **The grant of a job.** A job whose command is protected sends it as `system:<context>.<name>`,
|
|
726
729
|
which has no right unless the model gives it one. `generate job` writes the grant where the model
|
|
727
730
|
makes it one line, in a `system-grants` marker region, and `next` points at that line:
|
|
728
|
-
`--authz rbac`, the id of the permission under the role `system` of `platform/auth/roles.ts`,
|
|
731
|
+
`--authz rbac`, the id of the permission under the role `system` of `platform/auth/roles/roles.ts`,
|
|
729
732
|
the role `createAuthorizer` gives every system actor (`systemRole`); `--authz abac`, a
|
|
730
733
|
`permit('system-<job>', [permission], ({ actor }) => actor.id === 'system:<job>')` rule in
|
|
731
|
-
`platform/auth/attribute-policies.ts`; `--authz rebac`, the tuple
|
|
732
|
-
`context:<context>#operator@system:system:<job>` in `platform/auth/relate-system-actors.ts`,
|
|
734
|
+
`platform/auth/attributes/attribute-policies.ts`; `--authz rebac`, the tuple
|
|
735
|
+
`context:<context>#operator@system:system:<job>` in `platform/auth/relationships/relate-system-actors.ts`,
|
|
733
736
|
written to the tuple store when the application starts, as long as the schema still lets a
|
|
734
737
|
`system` subject operate a context. With `--authz custom`, a removed region, a remodelled
|
|
735
738
|
relationship schema or a permission the generator cannot read, nothing is written and the job
|
|
@@ -749,7 +752,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
749
752
|
permission joins `<context>.permissions.ts`; its words are checked against the glossary like any
|
|
750
753
|
other name. With `--authz rebac` the requirement names the context as its resource, a starting
|
|
751
754
|
point to replace by the element the right bears on. With `--authz rbac`, `--grant <role>` gives
|
|
752
|
-
the permission to the role in `platform/auth/roles.ts` (the role joins `role.ts` when it is
|
|
755
|
+
the permission to the role in `platform/auth/roles/roles.ts` (the role joins `role.ts` when it is
|
|
753
756
|
new); without it, a `next` step says the grant is left to do (`authz/granted`).
|
|
754
757
|
- `route` hands `actorOf(context.principal)` to a protected use case and sets `security` (the scheme
|
|
755
758
|
of `--authn`, or `false` for a public one). `integration-handler` carries `systemActor('<context>.<name>')`
|
|
@@ -997,11 +1000,11 @@ ddd-ts-kit build-aliases [--project <tsconfig>]
|
|
|
997
1000
|
```
|
|
998
1001
|
|
|
999
1002
|
The second step of `npm run build`, after the compiler. The compiler emits an import alias as
|
|
1000
|
-
it was written (`@/platform/errors`), and Node resolves no alias and completes no extension:
|
|
1003
|
+
it was written (`@/platform/observability/errors`), and Node resolves no alias and completes no extension:
|
|
1001
1004
|
this command rewrites, in every `.js`, `.mjs`, `.cjs`, `.d.ts`, `.d.mts` and `.d.cts` under the
|
|
1002
1005
|
output directory of the tsconfig (`tsconfig.build.json` by default), each alias specifier into
|
|
1003
1006
|
the relative path of the emitted file it names, with its `.js` extension
|
|
1004
|
-
(`../../platform/errors.js`), so that `node dist/src/main.js` runs with no loader and no flag.
|
|
1007
|
+
(`../../platform/observability/errors.js`), so that `node dist/src/main.js` runs with no loader and no flag.
|
|
1005
1008
|
|
|
1006
1009
|
```js
|
|
1007
1010
|
// dist/src/contexts/billing/domain/aggregates/invoice.aggregate.js, as the compiler emits it
|
|
@@ -1011,8 +1014,8 @@ import { InvoiceError } from '@/contexts/billing/domain/errors/invoice.error';
|
|
|
1011
1014
|
import { InvoiceError } from '../errors/invoice.error.js';
|
|
1012
1015
|
```
|
|
1013
1016
|
|
|
1014
|
-
It reads `importAlias` and `importExtension` of the config: `@/platform/errors` names
|
|
1015
|
-
`platform/errors.js` under `none`, `@/platform/errors.js` names it under `js`, and no other
|
|
1017
|
+
It reads `importAlias` and `importExtension` of the config: `@/platform/observability/errors` names
|
|
1018
|
+
`platform/observability/errors.js` under `none`, `@/platform/observability/errors.js` names it under `js`, and no other
|
|
1016
1019
|
spelling is guessed.
|
|
1017
1020
|
|
|
1018
1021
|
- Rewritten: the specifier of `import ... from`, `export ... from`, a bare `import`,
|
|
@@ -1735,8 +1738,8 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
1735
1738
|
| `config/valid` | unknown upstream, classification, relationship, rule id, `guard` mode or `importExtension`; a context missing on disk or in the config; a `commit` limit that is not a positive integer |
|
|
1736
1739
|
| `config/suppression-needs-reason` | a suppression without a rule id or a reason (kept as an alias next to `governance/recorded-deviation`, which judges the reason) |
|
|
1737
1740
|
| `authz/declared` | in a module file, `builder.command(X)` or `builder.query(X)` without `.requires(` or `.public(` in its chain, unless the message class carries `@Requires` or `@Public` of `@ddd-ts-kit/kernel/declarations`; with manual or nest wiring, a command or query class absent from every `requires(X, ...)` and `publicUseCase(X)` of the module file and of `application/authorization/`; a `defineRoute` without `security` (the route type refuses it already, and an empty list too: this is the text-level net for a definition built loosely); in the declared style, the exported class of a `*.command.ts` or `*.query.ts` file carrying neither `@Requires` nor `@Public` |
|
|
1738
|
-
| `authz/granted` | with `stack.authz` `rbac`, a permission of a context's `definePermissions` that neither `platform/auth/roles.ts` nor `platform/auth/signed-in-grants.ts` grants by name (by the entry of its set, its id or `<context>:*`); the super-admin `*` does not count (a warning) |
|
|
1739
|
-
| `authz/scope-narrows` | in a context, a `.scope(` call whose permission (the entry of a set in the call, or in a constant or a field of the file) every signed-in person holds, in `platform/auth/signed-in-grants.ts` or in the `grants` of a `new SignedInGrantsAuthorizer`: its scope is always `all`; grants or a permission it cannot read are reported too (a warning) |
|
|
1741
|
+
| `authz/granted` | with `stack.authz` `rbac`, a permission of a context's `definePermissions` that neither `platform/auth/roles/roles.ts` nor `platform/auth/authorization/signed-in-grants.ts` grants by name (by the entry of its set, its id or `<context>:*`); the super-admin `*` does not count (a warning) |
|
|
1742
|
+
| `authz/scope-narrows` | in a context, a `.scope(` call whose permission (the entry of a set in the call, or in a constant or a field of the file) every signed-in person holds, in `platform/auth/authorization/signed-in-grants.ts` or in the `grants` of a `new SignedInGrantsAuthorizer`: its scope is always `all`; grants or a permission it cannot read are reported too (a warning) |
|
|
1740
1743
|
| `authz/in-application` | `presentation/`: a test on roles, `isAdmin`, the import of an authorizer or of `Access`; `infrastructure/`: `authorize(` or `check(` on an authorizer or access, `ForbiddenError`; `domain/`: any import of `@ddd-ts-kit/auth`, of the actor types of the kernel (`Actor`, `ActorContext`, `Session`, `ExecutionContext`, the authorized messages), a read of `.roles` or `.permissions` on an actor. The request glue of `@ddd-ts-kit/auth` (`actorOf`, `sessionOf`, `resolveSession`, `SessionAuthenticator`) is free in `presentation/`. `presentation/` and `infrastructure/`: the import of `Requires`, `Public` or `Policy` from `@ddd-ts-kit/kernel/declarations`, or of the ports `Access` and `PolicyAccess` from `@ddd-ts-kit/auth`; they are free in `application/` |
|
|
1741
1744
|
| `authz/actor-explicit` | in `domain/` and `application/`: `ActorContext`, `ExecutionScope` (as a type or as a value: the class is the token of a dependency list), `AsyncLocalStorageExecutionScope`, `ScopedActorContext`, `AsyncLocalStorage`; `.current()` or `.require()` on an actor context or on something named `scope`, `scopes` or `...executionScope`; an import of `stampCreation`, `stampUpdate` or `tenantScopeOf` |
|
|
1742
1745
|
| `authz/fields-by-schema` | under `application/queries/`: `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, a comparison with a `role`, `isAdmin` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-in-project.d.ts","sourceRoot":"","sources":["../../../src/check/authz/is-in-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,4DAA4D;AAC5D,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-in-project.js","sourceRoot":"","sources":["../../../src/check/authz/is-in-project.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,IAAY;IACxD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Project } from '../model/project.js';
|
|
2
2
|
import type { SourceFile } from '../model/source-file.js';
|
|
3
|
-
/** What every signed-in person holds, `<platformDir>/auth/signed-in-grants.ts`, when a context preset or the team wrote it. */
|
|
3
|
+
/** What every signed-in person holds, `<platformDir>/auth/authorization/signed-in-grants.ts`, when a context preset or the team wrote it. */
|
|
4
4
|
export declare function signedInGrants(project: Project): SourceFile | undefined;
|
|
5
5
|
//# sourceMappingURL=signed-in-grants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signed-in-grants.d.ts","sourceRoot":"","sources":["../../../src/check/authz/signed-in-grants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"signed-in-grants.d.ts","sourceRoot":"","sources":["../../../src/check/authz/signed-in-grants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,6IAA6I;AAC7I,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAMvE"}
|