ddd-ts-kit 0.106.0 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.fr.md +42 -34
  3. package/README.md +41 -33
  4. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  5. package/dist/check/catalogue/architecture-rules.js +2 -0
  6. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  7. package/dist/check/catalogue/default-severities.d.ts.map +1 -1
  8. package/dist/check/catalogue/default-severities.js +1 -0
  9. package/dist/check/catalogue/default-severities.js.map +1 -1
  10. package/dist/check/explain/privacy-docs.d.ts.map +1 -1
  11. package/dist/check/explain/privacy-docs.js +13 -0
  12. package/dist/check/explain/privacy-docs.js.map +1 -1
  13. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  14. package/dist/check/fixtures/fixtures.js +2 -0
  15. package/dist/check/fixtures/fixtures.js.map +1 -1
  16. package/dist/check/fixtures/privacy-snapshot-fixtures.d.ts +3 -0
  17. package/dist/check/fixtures/privacy-snapshot-fixtures.d.ts.map +1 -0
  18. package/dist/check/fixtures/privacy-snapshot-fixtures.js +86 -0
  19. package/dist/check/fixtures/privacy-snapshot-fixtures.js.map +1 -0
  20. package/dist/check/privacy/clear-snapshot-values-in.d.ts +13 -0
  21. package/dist/check/privacy/clear-snapshot-values-in.d.ts.map +1 -0
  22. package/dist/check/privacy/clear-snapshot-values-in.js +36 -0
  23. package/dist/check/privacy/clear-snapshot-values-in.js.map +1 -0
  24. package/dist/check/privacy/is-snapshot-mapper.d.ts +4 -0
  25. package/dist/check/privacy/is-snapshot-mapper.d.ts.map +1 -0
  26. package/dist/check/privacy/is-snapshot-mapper.js +11 -0
  27. package/dist/check/privacy/is-snapshot-mapper.js.map +1 -0
  28. package/dist/check/rules/privacy-declared-field.d.ts +2 -1
  29. package/dist/check/rules/privacy-declared-field.d.ts.map +1 -1
  30. package/dist/check/rules/privacy-declared-field.js +4 -1
  31. package/dist/check/rules/privacy-declared-field.js.map +1 -1
  32. package/dist/check/rules/privacy-snapshot-sealed.d.ts +9 -0
  33. package/dist/check/rules/privacy-snapshot-sealed.d.ts.map +1 -0
  34. package/dist/check/rules/privacy-snapshot-sealed.js +34 -0
  35. package/dist/check/rules/privacy-snapshot-sealed.js.map +1 -0
  36. package/dist/doctor/format-diagnosis.d.ts.map +1 -1
  37. package/dist/doctor/format-diagnosis.js +7 -2
  38. package/dist/doctor/format-diagnosis.js.map +1 -1
  39. package/dist/doctor/hook-findings.d.ts.map +1 -1
  40. package/dist/doctor/hook-findings.js +17 -1
  41. package/dist/doctor/hook-findings.js.map +1 -1
  42. package/dist/generate/concept-role.d.ts +2 -0
  43. package/dist/generate/concept-role.d.ts.map +1 -1
  44. package/dist/generate/concept.d.ts.map +1 -1
  45. package/dist/generate/concept.js +4 -1
  46. package/dist/generate/concept.js.map +1 -1
  47. package/dist/generate/kinds/birth-names.js +1 -1
  48. package/dist/generate/kinds/birth-names.js.map +1 -1
  49. package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
  50. package/dist/generate/kinds/domain-error-kind.js +1 -0
  51. package/dist/generate/kinds/domain-error-kind.js.map +1 -1
  52. package/dist/generate/kinds/existing-aggregate.d.ts.map +1 -1
  53. package/dist/generate/kinds/existing-aggregate.js +1 -0
  54. package/dist/generate/kinds/existing-aggregate.js.map +1 -1
  55. package/dist/generate/kinds/query-kind.js +1 -1
  56. package/dist/generate/kinds/query-kind.js.map +1 -1
  57. package/dist/generate/label.js +1 -1
  58. package/dist/generate/label.js.map +1 -1
  59. package/dist/init/manifest/versions.js +24 -24
  60. package/dist/init/run-init.d.ts.map +1 -1
  61. package/dist/init/run-init.js +12 -0
  62. package/dist/init/run-init.js.map +1 -1
  63. package/dist/init/subfolder-of.d.ts +3 -0
  64. package/dist/init/subfolder-of.d.ts.map +1 -0
  65. package/dist/init/subfolder-of.js +7 -0
  66. package/dist/init/subfolder-of.js.map +1 -0
  67. package/dist/init/subfolder-sentence.d.ts +6 -0
  68. package/dist/init/subfolder-sentence.d.ts.map +1 -0
  69. package/dist/init/subfolder-sentence.js +13 -0
  70. package/dist/init/subfolder-sentence.js.map +1 -0
  71. package/dist/naming/parse-concept-name.d.ts +2 -0
  72. package/dist/naming/parse-concept-name.d.ts.map +1 -1
  73. package/dist/naming/parse-concept-name.js +4 -1
  74. package/dist/naming/parse-concept-name.js.map +1 -1
  75. package/dist/naming/parse-context-name.d.ts.map +1 -1
  76. package/dist/naming/parse-context-name.js +2 -0
  77. package/dist/naming/parse-context-name.js.map +1 -1
  78. package/dist/naming/refuse-windows-reserved.d.ts +7 -0
  79. package/dist/naming/refuse-windows-reserved.d.ts.map +1 -0
  80. package/dist/naming/refuse-windows-reserved.js +14 -0
  81. package/dist/naming/refuse-windows-reserved.js.map +1 -0
  82. package/dist/version.d.ts +1 -1
  83. package/dist/version.js +1 -1
  84. package/package.json +5 -5
  85. package/templates/docs/privacy-register.md.tpl +1 -1
  86. package/templates/init/e2e/create-credentials.keycloak.ts.tpl +1 -0
  87. package/templates/init/platform/auth/relationships/create-tuple-store.contract.spec.ts.tpl +11 -1
  88. package/templates/init/platform/auth/relationships/create-tuple-store.ts.tpl +16 -1
  89. package/templates/init/platform/composition/compose-application.container.ts.tpl +1 -2
  90. package/templates/init/platform/composition/compose-application.manual.ts.tpl +2 -2
  91. package/templates/pipeline/github/workflows/ci.yml.tpl +4 -0
  92. package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +4 -0
  93. package/templates/pipeline/package-scripts.json +1 -1
  94. package/templates/repository/event-sourced/repository.ts.tpl +1 -1
  95. package/templates/repository/typeorm/table.tpl +2 -2
  96. package/templates/sdk/runtime.ts.tpl +10 -1
package/README.md CHANGED
@@ -666,7 +666,9 @@ under pnpm), a bump of one of them asking the same again, and the block of manag
666
666
  cannot set (`allowManagedHooksOnly`, `allowManagedPermissionRulesOnly`,
667
667
  `permissions.disableBypassPermissionsMode`, `strictKnownMarketplaces` with the marketplace of
668
668
  the kit, `requiredMinimumVersion`), for the platform team to paste, and writes the two hooks of
669
- the profile under `.claude/hooks/` ([Sandboxing coding agents](../../docs/guides/agent-sandbox.md#the-regulated-profile)).
669
+ the profile under `.claude/hooks/`. Under the profile the guard of the plugin runs no program of
670
+ the project, so no check at the write nor at the stop: the pipeline and the commit gate hold them
671
+ ([Sandboxing coding agents](../../docs/guides/agent-sandbox.md#the-regulated-profile)).
670
672
 
671
673
  An existing `.claude/settings.json` is never overwritten: the missing permissions are appended
672
674
  to its lists, everything else is kept, and the notes of the command list what was added. The
@@ -781,46 +783,49 @@ Next, in this order: the language of the context first, then the business decisi
781
783
 
782
784
  | Kind | Arguments | Writes |
783
785
  |---|---|---|
784
- | `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`. `<name>.permissions.ts`, at the root of the context, 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)) |
785
- | `aggregate` | `<context> <Name> [--birth "<Fact>"] [--event-sourced]` | aggregate, builder, spec in given / when / then. `--birth` names the fact it is born with in business words (`"Invoice Issued"`, `InvoiceIssued` or `Issued`), judged by the glossary and refused when it does not read as something that happened: it writes that domain event as `generate domain-event` does, `create` records it at the instant it is given, the builder takes that instant named after the fact (`issuedAt(instant)`) and the spec proves the birth; without it, the state holds no instant of its own (the audit columns of the row date its creation) and a `TODO(domain)` in `create` says how to record the birth later without rewriting the aggregate (`generate domain-event`, the `record` line, then `generate builder`); with `--event-sourced`, an aggregate on `EventSourcedAggregate` whose state is the replay of its events, born with its `Created` domain event (or the fact `--birth` names), its state holding the instant of that fact (`createdAt`), 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; refused while `stack.eventSourcing` is `off`, with the `init --force --event-sourcing on` to run |
786
+ | `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity] [--reason "<why>"]` | `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`. `<name>.permissions.ts`, at the root of the context, 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)) |
787
+ | `module` | `<context> <module> [--purpose "<what it holds>"] [--classification <c>] [--term ...]...` | a module of the model of a context (Evans, Modules): declared in `contexts.<name>.modules` of the config, its row in the `## Modules` table of `CONTEXT.md`, its terms added to the glossary and, in the explicit style, its module file `<module>/<module>.module.ts` composed by `<context>.module.ts`; run again, it adds what is missing. The other kinds write into it with `--module <module>`, `move-to-module` moves files into it |
788
+ | `aggregate` | `<context> <Name> [--birth "<Fact>"] [--event-sourced] [--module <module>]` | aggregate, builder, spec in given / when / then. `--birth` names the fact it is born with in business words (`"Invoice Issued"`, `InvoiceIssued` or `Issued`), judged by the glossary and refused when it does not read as something that happened: it writes that domain event as `generate domain-event` does, `create` records it at the instant it is given, the builder takes that instant named after the fact (`issuedAt(instant)`) and the spec proves the birth; without it, the state holds no instant of its own (the audit columns of the row date its creation) and a `TODO(domain)` in `create` says how to record the birth later without rewriting the aggregate (`generate domain-event`, the `record` line, then `generate builder`); with `--event-sourced`, an aggregate on `EventSourcedAggregate` whose state is the replay of its events, born with its `Created` domain event (or the fact `--birth` names), its state holding the instant of that fact (`createdAt`), 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; refused while `stack.eventSourcing` is `off`, with the `init --force --event-sourcing on` to run |
786
789
  | `builder` | `<context> <Aggregate>` | `test/builders/<name>.builder.ts`, a class extending `Builder`; the instant of the birth `create` records is an ingredient named after its fact, the builder of an event-sourced aggregate replays its birth event, and a note names the parameters of `create` it cannot guess; when `create` is missing or records an event not named `<Aggregate><Fact>`, no builder is written and a note says why |
787
790
  | `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. Under a container it also takes `fakes`, the fake of a port it cannot build (a reader that answers what the spec gives it), and, under tenancy, `tenants`. The world named after the context is the one the specs of `command`, `query` and `job` generated after it arrange through |
788
- | `entity` | `<context> <Name>` | entity, spec |
789
- | `value-object` (`vo`) | `<context> <Name>` | value object, spec |
790
- | `vocabulary` | `<context> <Name> --value <value> [--value <value>]...` | `domain/vocabularies/<name>.vocabulary.ts`: an object `as const` of the values, keyed by each value in PascalCase, and the union type of the same name; run again, adds the values the file does not hold |
791
- | `domain-event` | `<context> <Aggregate> <Fact>` | event named `<context>.<aggregate>.<fact>`, spec |
792
- | `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]...` | under `"stack.refusals": "named"`: the class `<Refusal>` in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal` and reading its code from the list, its entry in `<context>.codes.ts` (the list `<Context>Codes` and its type `<Context>Code`, created when absent; the entry is added at the end), the static factory `<factory>` and its case in `test/unit/<refusal>.error.spec.ts`. Each is written when absent: run again, the command changes nothing; given another factory, it adds it to the class. `<Refusal>` is in PascalCase (a trailing `Error` is dropped), named with terms of the glossary and the qualifiers of a refusal, `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` (`BookingTooLate`): a word the glossary does not define is refused, with the `--term` that adds it; `<factory>` starts with `for`, `with`, `because`, `on` or `at` (`forAccountId`), else the command refuses and proposes `for<Factory>`. The code is the refusal in constant case (`InsufficientFunds` sets `INSUFFICIENT_FUNDS`), `--code` gives another; refused: a code already set in the context. Under `factories` and `classes`, `<context> <Concept> <refusal>`: a static factory `<refusal>` on `domain/errors/<concept>.error.ts`, the class of the errors of that concept (created when absent, extending `ConceptError`), and its case in `test/unit/<concept>.error.spec.ts`. The factory is added after the last one; run again, the command changes nothing. `<Concept>` is a term of the glossary (`--term` adds it). The code is the name of the refusal in constant case, with the concept before it when the name is one word or a code of the kit (`Appointment notFound` sets `APPOINTMENT_NOT_FOUND`); `--code` takes one of the forms `errors/factory-name` accepts. Refused: a name such as `create` or `error1`, and a code already set in the context |
793
- | `domain-error` | `<context> <Name> [--code CODE]` | one class per error with a stable code, spec: the form of a project whose config says `"stack.refusals": "classes"` or nothing. Refused under `named` and `factories`, with the `generate error` command to run instead |
794
- | `domain-service` | `<context> <Name>` | service, spec |
795
- | `state-machine` | `<context> <Aggregate> [--value <state>]... [--transition "<intention>:<from>[,<from>]...[><to>]"]...` | the vocabulary `<Aggregate>Status` (created from `--value`, two states at least, or given the values it misses), `domain/state-machines/<aggregate>.state-machine.ts` (`<aggregate>Lifecycle`: every value a state, the first one initial, the transitions asked, a `TODO(domain)` for the refusal of the concept error) and `test/unit/<aggregate>.state-machine.spec.ts` (each transition where it leads, a refusal from a state it does not leave); the aggregate is left to use it |
796
- | `repository` | `<context> <Aggregate> [--tenant-scoped] [--personal <column>,... [--subject <column>] [--erasure pseudonymise\|row] [--retention <column>:<n><d\|m\|y>]]` | the port `domain/repositories/<name>.repository.ts` (`abstract class <Name>Repository extends Repository<<Name>>`), the adapter of the project's ORM (`implements` the port) with its mapper and table (or model), a fake, one `repositoryContract` spec run on both, registration. On an event-sourced aggregate (its class extends `EventSourcedAggregate`) there is no table nor mapper: `event-store-<name>.repository.ts` delegates to `EventSourcedRepository` of the kernel over the `EventStore` and the `PersonalDataCipher` the platform binds, with the codec of `<name>-events.mapper.ts` (the snapshot policy left as a `TODO(domain)`), the fake is that adapter over the in-memory stores, and the contract suite runs on both (its stale-save case pending until a `mutate` that records an event is added); `--personal` is refused there, the personal values being sealed in the events. With `--personal`, the columns of the table that hold personal data: added to the storage and to the row type as nullable text (the mapper writes them empty until the aggregate carries them), declared next to the mapper in `<name>.personal-fields.ts` (`personalFields` of the kernel: the subject column, `id` unless `--subject` names the column that holds the id of the person, the fields, `pseudonymise` unless `--erasure row`), spelled as the erasure of the ORM reads them (SQL names on Knex and Prisma, properties on Drizzle and TypeORM); and, once per context, its erasure: the port `application/ports/<context>-personal-data-erasure.port.ts` (`extends PersonalDataErasure`), the adapter `<orm>-<context>-personal-data-erasure.repository.ts` over `<Orm>PersonalDataErasure` of the ORM package (confined to the tenant of the work with `--tenant-scoped`), its fake, bound where the context binds its adapters and listed in `src/platform/privacy/data-subject-copies.ts`, so that `npm run privacy:erase` reaches it; and its export: the port `<context>-personal-data-export.port.ts` (`extends PersonalDataExport`), the adapter `<orm>-<context>-personal-data-export.repository.ts` over `<Orm>PersonalDataExport`, its fake, bound the same way and listed in `data-subject-exports.ts`, so that `npm run privacy:export` hands it over; one spec, `test/integration/<context>-personal-data.spec.ts`, proves both on the test database. With `--retention <column>:<n><d|m|y>`, the declaration gains `retention`, counted from a column that dates the end of the relation and joins the storage as a nullable timestamp, empty while it lasts (a column the table keeps for itself, `created_at` first, or the `registered_at` of a table generated before 0.100, is refused: counted from the creation, the purge would erase people who are still customers) and the spec proves the purge of what outlived it. A second table of the context joins the declarations of both adapters. Refused without `stack.privacy` on (`init --force --privacy on`), with `--orm none` or `custom`, and before anything is written for a column that is not one, a column the table keeps for itself, a subject listed as personal or a mode that does not exist |
797
- | `command` | `<context> <UseCaseName> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--aggregate <Name> [--creates]]` | `<use-case>.command.ts` on `AuthorizedCommand` (plain `Command` when public), `<use-case>.handler.ts` (with `--aggregate` it receives the repository and writes nothing until its `TODO(domain)` is answered: a command changes an aggregate that exists; with `--creates` it builds the aggregate, saves it and answers its identifier: the events leave with the save), spec through the bus with the refusal of an actor who lacks the permission, registration with `.requires(...)` or `.public()` (and the repository when missing). A generated command answers `void` or the identifier of its aggregate, so no `<use-case>.result.ts` is written |
798
- | `query` | `<context> <UseCaseName> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--search]` | `<use-case>.query.ts` on `AuthorizedQuery` (plain `Query` when public), `<use-case>.result.ts`, `<use-case>.handler.ts`, the read port `application/ports/<use-case>-reader.port.ts` (an abstract class), its in-memory adapter, fake, spec, registration on the query bus. With `--search` (needs `--permission`): a kernel `PageRequest` in the query, the item, the sort and `Page<Item>` in the result file, a handler that asks `Access.scope` and hands the scope to the read port, an in-memory reader paging by offset or cursor |
799
- | `port` | `<context> <Name>` | `application/ports/<name>.port.ts`, one abstract class, and its fake |
800
- | `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 |
791
+ | `entity` | `<context> <Name> [--module <module>]` | entity, spec |
792
+ | `value-object` (`vo`) | `<context> <Name> [--module <module>]` | value object, spec |
793
+ | `property` | `<context> <ValueObject> [--module <module>]` | `test/unit/<name>.vo.properties.spec.ts`: the laws of an existing value object checked on generated values (fast-check, added to the development dependencies when missing) |
794
+ | `vocabulary` | `<context> <Name> --value <value> [--value <value>]... [--module <module>]` | `domain/vocabularies/<name>.vocabulary.ts`: an object `as const` of the values, keyed by each value in PascalCase, and the union type of the same name; run again, adds the values the file does not hold |
795
+ | `domain-event` | `<context> <Aggregate> <Fact> [--module <module>]` | event named `<context>.<aggregate>.<fact>`, spec |
796
+ | `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]... [--module <module>]` | under `"stack.refusals": "named"`: the class `<Refusal>` in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal` and reading its code from the list, its entry in `<context>.codes.ts` (the list `<Context>Codes` and its type `<Context>Code`, created when absent; the entry is added at the end), the static factory `<factory>` and its case in `test/unit/<refusal>.error.spec.ts`. Each is written when absent: run again, the command changes nothing; given another factory, it adds it to the class. `<Refusal>` is in PascalCase (a trailing `Error` is dropped), named with terms of the glossary and the qualifiers of a refusal, `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` (`BookingTooLate`): a word the glossary does not define is refused, with the `--term` that adds it; `<factory>` starts with `for`, `with`, `because`, `on` or `at` (`forAccountId`), else the command refuses and proposes `for<Factory>`. The code is the refusal in constant case (`InsufficientFunds` sets `INSUFFICIENT_FUNDS`), `--code` gives another; refused: a code already set in the context. Under `factories` and `classes`, `<context> <Concept> <refusal>`: a static factory `<refusal>` on `domain/errors/<concept>.error.ts`, the class of the errors of that concept (created when absent, extending `ConceptError`), and its case in `test/unit/<concept>.error.spec.ts`. The factory is added after the last one; run again, the command changes nothing. `<Concept>` is a term of the glossary (`--term` adds it). The code is the name of the refusal in constant case, with the concept before it when the name is one word or a code of the kit (`Appointment notFound` sets `APPOINTMENT_NOT_FOUND`); `--code` takes one of the forms `errors/factory-name` accepts. Refused: a name such as `create` or `error1`, and a code already set in the context |
797
+ | `domain-error` | `<context> <Name> [--code CODE] [--module <module>]` | one class per error with a stable code, spec: the form of a project whose config says `"stack.refusals": "classes"` or nothing. Refused under `named` and `factories`, with the `generate error` command to run instead |
798
+ | `domain-service` | `<context> <Name> [--module <module>]` | service, spec |
799
+ | `state-machine` | `<context> <Aggregate> [--value <state>]... [--transition "<intention>:<from>[,<from>]...[><to>]"]... [--module <module>]` | the vocabulary `<Aggregate>Status` (created from `--value`, two states at least, or given the values it misses), `domain/state-machines/<aggregate>.state-machine.ts` (`<aggregate>Lifecycle`: every value a state, the first one initial, the transitions asked, a `TODO(domain)` for the refusal of the concept error) and `test/unit/<aggregate>.state-machine.spec.ts` (each transition where it leads, a refusal from a state it does not leave); the aggregate is left to use it |
800
+ | `repository` | `<context> <Aggregate> [--tenant-scoped] [--personal <column>,... [--subject <column>] [--erasure pseudonymise\|row] [--retention <column>:<n><d\|m\|y>]] [--module <module>]` | the port `domain/repositories/<name>.repository.ts` (`abstract class <Name>Repository extends Repository<<Name>>`), the adapter of the project's ORM (`implements` the port) with its mapper and table (or model), a fake, one `repositoryContract` spec run on both, registration. On an event-sourced aggregate (its class extends `EventSourcedAggregate`) there is no table nor mapper: `event-store-<name>.repository.ts` delegates to `EventSourcedRepository` of the kernel over the `EventStore` and the `PersonalDataCipher` the platform binds, with the codec of `<name>-events.mapper.ts` (the snapshot policy left as a `TODO(domain)`), the fake is that adapter over the in-memory stores, and the contract suite runs on both (its stale-save case pending until a `mutate` that records an event is added); `--personal` is refused there, the personal values being sealed in the events. With `--personal`, the columns of the table that hold personal data: added to the storage and to the row type as nullable text (the mapper writes them empty until the aggregate carries them), declared next to the mapper in `<name>.personal-fields.ts` (`personalFields` of the kernel: the subject column, `id` unless `--subject` names the column that holds the id of the person, the fields, `pseudonymise` unless `--erasure row`), spelled as the erasure of the ORM reads them (SQL names on Knex and Prisma, properties on Drizzle and TypeORM); and, once per context, its erasure: the port `application/ports/<context>-personal-data-erasure.port.ts` (`extends PersonalDataErasure`), the adapter `<orm>-<context>-personal-data-erasure.repository.ts` over `<Orm>PersonalDataErasure` of the ORM package (confined to the tenant of the work with `--tenant-scoped`), its fake, bound where the context binds its adapters and listed in `src/platform/privacy/data-subject-copies.ts`, so that `npm run privacy:erase` reaches it; and its export: the port `<context>-personal-data-export.port.ts` (`extends PersonalDataExport`), the adapter `<orm>-<context>-personal-data-export.repository.ts` over `<Orm>PersonalDataExport`, its fake, bound the same way and listed in `data-subject-exports.ts`, so that `npm run privacy:export` hands it over; one spec, `test/integration/<context>-personal-data.spec.ts`, proves both on the test database. With `--retention <column>:<n><d|m|y>`, the declaration gains `retention`, counted from a column that dates the end of the relation and joins the storage as a nullable timestamp, empty while it lasts (a column the table keeps for itself, `created_at` first, or the `registered_at` of a table generated before 0.100, is refused: counted from the creation, the purge would erase people who are still customers) and the spec proves the purge of what outlived it. A second table of the context joins the declarations of both adapters. Refused without `stack.privacy` on (`init --force --privacy on`), with `--orm none` or `custom`, and before anything is written for a column that is not one, a column the table keeps for itself, a subject listed as personal or a mode that does not exist |
801
+ | `command` | `<context> <UseCaseName> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--aggregate <Name> [--creates]] [--module <module>]` | `<use-case>.command.ts` on `AuthorizedCommand` (plain `Command` when public), `<use-case>.handler.ts` (with `--aggregate` it receives the repository and writes nothing until its `TODO(domain)` is answered: a command changes an aggregate that exists; with `--creates` it builds the aggregate, saves it and answers its identifier: the events leave with the save), spec through the bus with the refusal of an actor who lacks the permission, registration with `.requires(...)` or `.public()` (and the repository when missing). A generated command answers `void` or the identifier of its aggregate, so no `<use-case>.result.ts` is written |
802
+ | `query` | `<context> <UseCaseName> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--search] [--module <module>]` | `<use-case>.query.ts` on `AuthorizedQuery` (plain `Query` when public), `<use-case>.result.ts`, `<use-case>.handler.ts`, the read port `application/ports/<use-case>-reader.port.ts` (an abstract class), its in-memory adapter, fake, spec, registration on the query bus. With `--search` (needs `--permission`): a kernel `PageRequest` in the query, the item, the sort and `Page<Item>` in the result file, a handler that asks `Access.scope` and hands the scope to the read port, an in-memory reader paging by offset or cursor |
803
+ | `port` | `<context> <Name> [--module <module>]` | `application/ports/<name>.port.ts`, one abstract class, and its fake |
804
+ | `route` | `<context> <UseCaseName> --method <GET\|POST\|PUT\|PATCH\|DELETE> --path <p> [--command\|--query] [--group <Name>] [--mapper] [--serializer] [--cache public\|private\|no-store] [--module <module>]` | 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 |
801
805
  | `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 |
802
- | `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 |
806
+ | `file-upload` | `<context> <UseCaseName> --path <p> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--method POST\|PUT] [--group <Name>] [--module <module>]` | 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 |
803
807
  | `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 |
804
808
  | `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts`: a declared guard class to fill, and its spec |
805
- | `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...]` | after `generate route` of the use case (a controller under `"stack.routes": "controllers"` or `"nest"`) or `generate controller`: 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` |
806
- | `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>` |
809
+ | `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...] [--module <module>]` | after `generate route` of the use case (a controller under `"stack.routes": "controllers"` or `"nest"`) or `generate controller`: 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` |
810
+ | `form` | `<context> <UseCase> [--module <module>]` | 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>` |
807
811
  | `schema` | `<context\|shared-kernel> <Name>` | `presentation/http/shared/<name>.schema.ts` of the context, or `presentation/<name>.schema.ts` of the shared kernel: one shape of the contract declared once (a zod schema with `.meta({ id })`, a class-validator class, or a schema wrapped by `sharedSchema`), to fill; the routes use it whole, nested or in part |
808
- | `integration-event` | `<context> <Aggregate> <Fact> [--version n]` | `defineIntegrationEvent` declaration in the published language (its payload in `<event>.v<n>.payload.ts` with class-validator or a schema of your own), index export, the publisher `application/integration/publishers/<event>.publisher.ts`, spec, registration, a line of `platform/audit/audited-events.ts` |
809
- | `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>[@v<n>]` | `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>`; the type is taken as `list` prints it, with or without `@v<n>` (the newest version without, `--version <n>` saying the same as the suffix); refused unless the upstream is declared and publishes that version (a version that is not found is refused, never replaced by another) |
810
- | `erasure-handler` | `<context>` | `application/integration/handlers/data-subject-erased.integration-handler.ts`, a class `DataSubjectErasedIntegrationHandler` that erases what the context keeps of a person through its `<Context>PersonalDataErasure` when the platform announces `privacy.data-subject.erased` (`dataSubjectErasedV1` of the kernel), its spec on the fake, its idempotent subscription under the consumer name `<context>.data-subject-erased` (in a transaction behind a broker); for a context that runs as a service of its own or copies personal data from events. Refused until the context has its erasure (`generate repository --personal`), and refused on an event-sourced context, whose personal values are erased by destroying the key of the subject (`eraseDataSubject`) |
811
- | `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 |
812
- | `projection` (`projector`) | `<context> <Name> <event-type>[@v<n>]` | 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; the type is taken as `list` prints it, `@v<n>` pinning the version (the newest without). In the explicit style on tsyringe the module file of the context includes it with `builder.include(<Name>Projection)`; on a hand-wired platform the class is plain and the module subscribes it under its consumer name. It keeps one read model: its port is received in the constructor |
813
- | `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) |
814
- | `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), and its static `payload`, the schema of that payload in the validation library of the stack (a `z.object` under zod, a class of decorated fields without initial value under class-validator, a `Type.Object` under TypeBox, one refusal per field written by hand under Standard Schema and, with `--validation none`, in the `BackgroundJobPayloadSchema` of the kernel; a type it writes no check for is typed `unknown` with a `TODO(domain)`), which the worker reads the stored payload with before each run; `test/unit/<name>.background-job.spec.ts`, which enqueues it with a payload of every field as a user and runs what is due, then enqueues it as an earlier version declared it (`earlierVersionOf` of `@ddd-ts-kit/testing`) and shows the job dead with `INVALID_JOB_PAYLOAD` (through the test application on tsyringe, through a queue and a worker in memory on the test buses otherwise); its registration (`@Background()`, `builder.backgroundJob(..)` in the module file on tsyringe, `platform.backgroundJobs.register(..)` in the module file of a platform wired by hand) |
815
- | `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 on tsyringe, a queue and a runner in memory on the test buses otherwise) |
816
- | `acl` | `<context> <upstreamOrSystemName>` | translator in `infrastructure/anti-corruption/`, spec |
812
+ | `integration-event` | `<context> <Aggregate> <Fact> [--version n] [--module <module>]` | `defineIntegrationEvent` declaration in the published language (its payload in `<event>.v<n>.payload.ts` with class-validator or a schema of your own), index export, the publisher `application/integration/publishers/<event>.publisher.ts`, spec, registration, a line of `platform/audit/audited-events.ts` |
813
+ | `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>[@v<n>] [--version <n>] [--name <Name>] [--module <module>]` | `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>`; the type is taken as `list` prints it, with or without `@v<n>` (the newest version without, `--version <n>` saying the same as the suffix); refused unless the upstream is declared and publishes that version (a version that is not found is refused, never replaced by another) |
814
+ | `erasure-handler` | `<context> [--module <module>]` | `application/integration/handlers/data-subject-erased.integration-handler.ts`, a class `DataSubjectErasedIntegrationHandler` that erases what the context keeps of a person through its `<Context>PersonalDataErasure` when the platform announces `privacy.data-subject.erased` (`dataSubjectErasedV1` of the kernel), its spec on the fake, its idempotent subscription under the consumer name `<context>.data-subject-erased` (in a transaction behind a broker); for a context that runs as a service of its own or copies personal data from events. Refused until the context has its erasure (`generate repository --personal`), and refused on an event-sourced context, whose personal values are erased by destroying the key of the subject (`eraseDataSubject`) |
815
+ | `event-handler` | `<context> <Aggregate> <Fact> [--phase before-commit\|after-commit] [--name <Name>] [--module <module>]` | 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 |
816
+ | `projection` (`projector`) | `<context> <Name> <event-type>[@v<n>] [--module <module>]` | 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; the type is taken as `list` prints it, `@v<n>` pinning the version (the newest without). In the explicit style on tsyringe the module file of the context includes it with `builder.include(<Name>Projection)`; on a hand-wired platform the class is plain and the module subscribes it under its consumer name. It keeps one read model: its port is received in the constructor |
817
+ | `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName> [--global] [--module <module>]` | `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) |
818
+ | `background-job` | `<context> <Name> --command <UseCaseName> [--module <module>]` | `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), and its static `payload`, the schema of that payload in the validation library of the stack (a `z.object` under zod, a class of decorated fields without initial value under class-validator, a `Type.Object` under TypeBox, one refusal per field written by hand under Standard Schema and, with `--validation none`, in the `BackgroundJobPayloadSchema` of the kernel; a type it writes no check for is typed `unknown` with a `TODO(domain)`), which the worker reads the stored payload with before each run; `test/unit/<name>.background-job.spec.ts`, which enqueues it with a payload of every field as a user and runs what is due, then enqueues it as an earlier version declared it (`earlierVersionOf` of `@ddd-ts-kit/testing`) and shows the job dead with `INVALID_JOB_PAYLOAD` (through the test application on tsyringe, through a queue and a worker in memory on the test buses otherwise); its registration (`@Background()`, `builder.backgroundJob(..)` in the module file on tsyringe, `platform.backgroundJobs.register(..)` in the module file of a platform wired by hand) |
819
+ | `process` (`process-manager`) | `<context> <Name> [--module <module>]` | `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 on tsyringe, a queue and a runner in memory on the test buses otherwise) |
820
+ | `acl` | `<context> <upstreamOrSystemName> [--module <module>]` | translator in `infrastructure/anti-corruption/`, spec |
817
821
  | `e2e` | `<context> <UseCaseName> [--event <eventType>]` | `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`, and after it, for a command that gives birth to an aggregate born with `--birth`, `unit-of-work before-commit` and `domain-event <name>` of its birth event, a note naming what already reacts to it). A use case no route reaches, started by an integration event handler of the context, gets a spec that publishes the upstream event, built from its declaration, with `application.publish([event])`, awaits `application.settled()` and leaves `it.todo` for what a client observes (the `GET` routes of the context, or the events it publishes with `collectEvents`); the handler that sends `<UseCase>Command` is found in `application/integration/handlers/`, and `--event billing.invoice.issued` names the event when handlers of several send it, or when the handler does not send it yet. Needs the route, or that handler |
818
- | `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` |
819
- | `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 |
820
- | `adapter` | `<context> <Port> [--kind external\|gateway\|simulated] [--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. With `--kind simulated`: `infrastructure/external/simulated-<port>.adapter.ts` and its spec, a class of production code that answers in the memory of the process the way the outside system would, for an environment whose provider is simulated; it carries no policy (`--decorators` is refused), is declared `@Adapter(<Port>, { kind: 'external' })` or bound `.toClass(Simulated<Port>).as('external')`, and takes turns with the remote adapter, one per port |
822
+ | `acceptance` | `<story> ["<title>"]` | `test/acceptance/<story>.acceptance.spec.ts`, written before the code: an `it.todo` per acceptance criterion of `docs/architecture/stories/<story>.md`, or per slice row of the story in `docs/architecture/slices.md` when it states none |
823
+ | `policy` | `<context> <Name> --permission <aggregate>.<action> [--module <module>]` | `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` |
824
+ | `gateway` | `<context> <upstreamContext> <Name> [--module <module>]` | 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 |
825
+ | `adapter` | `<context> <Port> [--kind external\|gateway\|simulated] [--decorators] [--module <module>]` | `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. With `--kind simulated`: `infrastructure/external/simulated-<port>.adapter.ts` and its spec, a class of production code that answers in the memory of the process the way the outside system would, for an environment whose provider is simulated; it carries no policy (`--decorators` is refused), is declared `@Adapter(<Port>, { kind: 'external' })` or bound `.toClass(Simulated<Port>).as('external')`, and takes turns with the remote adapter, one per port |
821
826
  | `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` |
822
827
  | `worker` | none | `src/apps/worker/main.ts`: the modules of `main.ts`, no HTTP server, no outbox relay, the jobs started whatever `RUN_JOBS` says, a graceful stop; script `start:worker`, a compose service `worker` behind the `services` profile, the knip entry, `"worker": true` in the config, and `RUN_JOBS` defaulting to `false` from then on, so the API stops running the jobs the worker runs. With several instances the lock has to be a real one: `--cache redis` binds the Redis lock, without it the generated README says the limit. A context named `worker` is refused |
823
- | `adr` | `"<title>" [--deviation <what>] [--reason "<why>"]` | `docs/adr/NNNN-<slug>.md`; with `--deviation`, the `deviations` entry of the config that points to it |
828
+ | `adr` | `"<title>" [--deviation <what>] [--reason "<why>"] [--number <n>]` | `docs/adr/NNNN-<slug>.md`; with `--deviation`, the `deviations` entry of the config that points to it |
824
829
 
825
830
  - **The declared style, kind by kind.** No token anywhere: a list names port classes. `command`
826
831
  and `query` put `@Requires(<permissions>[...])` or `@Public()` on the message and
@@ -939,7 +944,9 @@ Next, in this order: the language of the context first, then the business decisi
939
944
  not read as past tense are refused too; a technical word passes when a term of the glossary
940
945
  holds it (`--term "Scoring model=<meaning>"` lets `ScoringModel` through), because the language
941
946
  of the business wins. `--allow-name` overrides the three checks; `check`
942
- will still report what the glossary does not define. Only the kinds whose usage shows `--term`
947
+ will still report what the glossary does not define. A name Windows reserves for a device (`CON`,
948
+ `PRN`, `AUX`, `NUL`, `COM1` to `COM9`, `LPT1` to `LPT9`, whatever the case) is refused for a context and
949
+ for a concept, since its files cannot be checked out there; `--allow-name` lets a concept through. Only the kinds whose usage shows `--term`
943
950
  take it (`heldToGlossary` in `generate --help --json`, a line of `generate <kind> --help`); the
944
951
  others (`port`, `adapter`, `repository`, `route`, `representation`...) name what an earlier
945
952
  command named or what the concept they serve is called, and refuse `--term`, naming the kinds
@@ -2342,6 +2349,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
2342
2349
  | `privacy/erasure-reaches-copies` | with `stack.privacy` `on`: a context whose application layer names an integration event declaring personal data, of another context, and that declares no `PersonalDataErasure` and handles no `privacy.data-subject.erased` |
2343
2350
  | `privacy/subject-is-opaque` | with `stack.privacy` `on`: the subject of a `personalFields` declaration or of the `personal` option of an event that is a word of the personal vocabulary or one of its personal fields |
2344
2351
  | `privacy/no-personal-data-in-logs` | with `stack.privacy` `on`: a call to the logger or to the metrics, in a context or the platform, whose arguments name a declared personal field |
2352
+ | `privacy/snapshot-sealed` | with `stack.privacy` `on`: a value of `<aggregate>-snapshots.mapper.ts` named like personal data that no `personalData` seals |
2345
2353
  | `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/` |
2346
2354
  | `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` |
2347
2355
  | `authz/fields-by-schema` | under `application/queries/`: `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, a comparison with a `role`, `isAdmin` |
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AA4G1C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA2G7C,CAAC"}
1
+ {"version":3,"file":"architecture-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AA6G1C,gHAAgH;AAChH,eAAO,MAAM,kBAAkB,EAAE,SAAS,IAAI,EA4G7C,CAAC"}
@@ -10,6 +10,7 @@ import { privacyDeclaredField } from '../rules/privacy-declared-field.js';
10
10
  import { privacyErasureReachesCopies } from '../rules/privacy-erasure-reaches-copies.js';
11
11
  import { privacyEventPayloadDeclared } from '../rules/privacy-event-payload-declared.js';
12
12
  import { privacyNoPersonalDataInLogs } from '../rules/privacy-no-personal-data-in-logs.js';
13
+ import { privacySnapshotSealed } from '../rules/privacy-snapshot-sealed.js';
13
14
  import { privacySubjectIsOpaque } from '../rules/privacy-subject-is-opaque.js';
14
15
  import { authzInApplication } from '../rules/authz-in-application.js';
15
16
  import { authzPolicyAsked } from '../rules/authz-policy-asked.js';
@@ -178,6 +179,7 @@ export const ARCHITECTURE_RULES = [
178
179
  privacyErasureReachesCopies,
179
180
  privacySubjectIsOpaque,
180
181
  privacyNoPersonalDataInLogs,
182
+ privacySnapshotSealed,
181
183
  aspectsOutsideIn,
182
184
  tracingPlatformOnly,
183
185
  tenancyScopedStatement,
@@ -1 +1 @@
1
- {"version":3,"file":"architecture-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/architecture-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,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ourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,0GAA0G;AAC1G,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAuBjE,CAAC"}
1
+ {"version":3,"file":"default-severities.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,0GAA0G;AAC1G,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAwBjE,CAAC"}
@@ -7,6 +7,7 @@ export const DEFAULT_SEVERITIES = {
7
7
  'privacy/erasure-reaches-copies': 'warn',
8
8
  'privacy/subject-is-opaque': 'warn',
9
9
  'privacy/no-personal-data-in-logs': 'warn',
10
+ 'privacy/snapshot-sealed': 'warn',
10
11
  'test/no-mocks': 'warn',
11
12
  'test/builder-required': 'warn',
12
13
  'clean/function-size': 'warn',
@@ -1 +1 @@
1
- {"version":3,"file":"default-severities.js","sourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAEA,0GAA0G;AAC1G,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,eAAe,EAAE,MAAM;IACvB,qBAAqB,EAAE,MAAM;IAC7B,wBAAwB,EAAE,MAAM;IAChC,gCAAgC,EAAE,MAAM;IACxC,gCAAgC,EAAE,MAAM;IACxC,2BAA2B,EAAE,MAAM;IACnC,kCAAkC,EAAE,MAAM;IAC1C,eAAe,EAAE,MAAM;IACvB,uBAAuB,EAAE,MAAM;IAC/B,qBAAqB,EAAE,MAAM;IAC7B,wBAAwB,EAAE,MAAM;IAChC,wBAAwB,EAAE,MAAM;IAChC,sCAAsC,EAAE,MAAM;IAC9C,gCAAgC,EAAE,MAAM;IACxC,4BAA4B,EAAE,MAAM;IACpC,uBAAuB,EAAE,MAAM;IAC/B,oBAAoB,EAAE,MAAM;IAC5B,2BAA2B,EAAE,MAAM;IACnC,+BAA+B,EAAE,MAAM;IACvC,iCAAiC,EAAE,MAAM;IACzC,iBAAiB,EAAE,MAAM;IACzB,iBAAiB,EAAE,MAAM;CAC1B,CAAC"}
1
+ {"version":3,"file":"default-severities.js","sourceRoot":"","sources":["../../../src/check/catalogue/default-severities.ts"],"names":[],"mappings":"AAEA,0GAA0G;AAC1G,MAAM,CAAC,MAAM,kBAAkB,GAAuC;IACpE,eAAe,EAAE,MAAM;IACvB,qBAAqB,EAAE,MAAM;IAC7B,wBAAwB,EAAE,MAAM;IAChC,gCAAgC,EAAE,MAAM;IACxC,gCAAgC,EAAE,MAAM;IACxC,2BAA2B,EAAE,MAAM;IACnC,kCAAkC,EAAE,MAAM;IAC1C,yBAAyB,EAAE,MAAM;IACjC,eAAe,EAAE,MAAM;IACvB,uBAAuB,EAAE,MAAM;IAC/B,qBAAqB,EAAE,MAAM;IAC7B,wBAAwB,EAAE,MAAM;IAChC,wBAAwB,EAAE,MAAM;IAChC,sCAAsC,EAAE,MAAM;IAC9C,gCAAgC,EAAE,MAAM;IACxC,4BAA4B,EAAE,MAAM;IACpC,uBAAuB,EAAE,MAAM;IAC/B,oBAAoB,EAAE,MAAM;IAC5B,2BAA2B,EAAE,MAAM;IACnC,+BAA+B,EAAE,MAAM;IACvC,iCAAiC,EAAE,MAAM;IACzC,iBAAiB,EAAE,MAAM;IACzB,iBAAiB,EAAE,MAAM;CAC1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"privacy-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/privacy-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKjD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiD1D,CAAC"}
1
+ {"version":3,"file":"privacy-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/privacy-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKjD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8D1D,CAAC"}
@@ -43,6 +43,19 @@ on(customerRegisteredV1, (event) => contacts.upsert(event.payload.customerId, ev
43
43
  bad: `personalFields(TABLE, { subject: 'email', fields: ['display_name'], erasure: 'row' });`,
44
44
  good: `personalFields(TABLE, { subject: 'person_id', fields: ['email', 'display_name'], erasure: 'row' });`,
45
45
  },
46
+ 'privacy/snapshot-sealed': {
47
+ why: `An erasure destroys the key of the person: what \`personalData\` sealed reads as erased everywhere at once, in the events and in the snapshots. A snapshot keeps what its \`encode\` writes, and \`encode\` over the state writes the values in clear: the erasure says the person is gone, the value stays in the store of snapshots, and the next load of the aggregate reads it back. Judged: \`<aggregate>-snapshots.mapper.ts\` in \`infrastructure/persistence/\`, the properties of the file and the names \`decode\` reads, so that a mapper whose \`encode\` answers the whole state is seen. A name of the personal vocabulary (\`privacy.vocabulary\` added, \`privacy.allow\` taken away) is reported unless a \`personalData\`, a \`PersonalValue\` type or a personal reader of the file seals it. A rule reads names: a value under a name the vocabulary does not hold is not seen. ${SILENT}`,
48
+ bad: `export const dossierSnapshots = {
49
+ version: 1,
50
+ encode: (dossier: Dossier): object => ({ email: dossier.email }),
51
+ decode: (data: StoredEventData) => ({ email: data.text('email') }),
52
+ };`,
53
+ good: `export const dossierSnapshots = {
54
+ version: 2,
55
+ encode: (dossier: Dossier): object => ({ email: personalData(dossier.patientId, dossier.email) }),
56
+ decode: (data: StoredEventData) => ({ email: data.personalText('email') }),
57
+ };`,
58
+ },
46
59
  'privacy/no-personal-data-in-logs': {
47
60
  why: `A log line is copied, shipped, indexed and kept for months by systems the erasure never reaches, and read by people the person never dealt with; a metric with a label per person does the same. The opaque id of the person is enough to follow a request. An approximation at the level of the text: a name among the arguments of a call to the logger or to the metrics (logger.info(...), this.log.warn(...), metrics.increment(...)), an identifier, a property or a key, compared with the personal fields of the personalFields declarations and of the personal option of the integration events, in the files of the contexts and of the platform. A declared field of one word outside the vocabulary (name, label) is left out, too common to judge; a value reached through a variable of another name is not seen. Silent without a declaration. ${SILENT}`,
48
61
  bad: `this.logger.info('invoice sent', { invoiceId: invoice.id, customerEmail: invoice.customerEmail });`,
@@ -1 +1 @@
1
- {"version":3,"file":"privacy-docs.js","sourceRoot":"","sources":["../../../src/check/explain/privacy-docs.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GACV,kPAAkP,CAAC;AAErP,MAAM,CAAC,MAAM,YAAY,GAAsC;IAC7D,wBAAwB,EAAE;QACxB,GAAG,EAAE,kvCAAkvC,MAAM,EAAE;QAC/vC,GAAG,EAAE;;2EAEkE;QACvE,IAAI,EAAE;;;;;;;;8GAQoG;KAC3G;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,0zBAA0zB,MAAM,EAAE;QACv0B,GAAG,EAAE;;;;IAIL;QACA,IAAI,EAAE;;;;;IAKN;KACD;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,k0BAAk0B,MAAM,EAAE;QAC/0B,GAAG,EAAE;;oDAE2C;QAChD,IAAI,EAAE;;iFAEuE;KAC9E;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,gmBAAgmB,MAAM,EAAE;QAC7mB,GAAG,EAAE,wFAAwF;QAC7F,IAAI,EAAE,qGAAqG;KAC5G;IACD,kCAAkC,EAAE;QAClC,GAAG,EAAE,k0BAAk0B,MAAM,EAAE;QAC/0B,GAAG,EAAE,oGAAoG;QACzG,IAAI,EAAE,8FAA8F;KACrG;CACF,CAAC"}
1
+ {"version":3,"file":"privacy-docs.js","sourceRoot":"","sources":["../../../src/check/explain/privacy-docs.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GACV,kPAAkP,CAAC;AAErP,MAAM,CAAC,MAAM,YAAY,GAAsC;IAC7D,wBAAwB,EAAE;QACxB,GAAG,EAAE,kvCAAkvC,MAAM,EAAE;QAC/vC,GAAG,EAAE;;2EAEkE;QACvE,IAAI,EAAE;;;;;;;;8GAQoG;KAC3G;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,0zBAA0zB,MAAM,EAAE;QACv0B,GAAG,EAAE;;;;IAIL;QACA,IAAI,EAAE;;;;;IAKN;KACD;IACD,gCAAgC,EAAE;QAChC,GAAG,EAAE,k0BAAk0B,MAAM,EAAE;QAC/0B,GAAG,EAAE;;oDAE2C;QAChD,IAAI,EAAE;;iFAEuE;KAC9E;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,gmBAAgmB,MAAM,EAAE;QAC7mB,GAAG,EAAE,wFAAwF;QAC7F,IAAI,EAAE,qGAAqG;KAC5G;IACD,yBAAyB,EAAE;QACzB,GAAG,EAAE,u2BAAu2B,MAAM,EAAE;QACp3B,GAAG,EAAE;;;;GAIN;QACC,IAAI,EAAE;;;;GAIP;KACA;IACD,kCAAkC,EAAE;QAClC,GAAG,EAAE,k0BAAk0B,MAAM,EAAE;QAC/0B,GAAG,EAAE,oGAAoG;QACzG,IAAI,EAAE,8FAA8F;KACrG;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EA2DtC,CAAC"}
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AA2DA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EA4DtC,CAAC"}
@@ -50,6 +50,7 @@ import { SHARED_KERNEL_FIXTURES } from './shared-kernel-fixtures.js';
50
50
  import { SCHEMA_FIXTURES } from './schema-fixtures.js';
51
51
  import { STANDARD_FIXTURES } from './standard-fixtures.js';
52
52
  import { PRIVACY_FIXTURES } from './privacy-fixtures.js';
53
+ import { PRIVACY_SNAPSHOT_FIXTURES } from './privacy-snapshot-fixtures.js';
53
54
  import { TENANCY_FIXTURES } from './tenancy-fixtures.js';
54
55
  import { TEST_FIXTURES } from './test-fixtures.js';
55
56
  import { TRACING_FIXTURES } from './tracing-fixtures.js';
@@ -114,6 +115,7 @@ export const FIXTURES = [
114
115
  ...NEST_CONTROLLERS_FIXTURES,
115
116
  ...TENANCY_FIXTURES,
116
117
  ...PRIVACY_FIXTURES,
118
+ ...PRIVACY_SNAPSHOT_FIXTURES,
117
119
  ...TEST_FIXTURES,
118
120
  ...TRACING_FIXTURES,
119
121
  ...TREE_FIXTURES,
@@ -1 +1 @@
1
- {"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;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zB,GAAG,eAAe;IAClB,GAAG,sBAAsB;IACzB,GAAG,eAAe;IAClB,GAAG,sBAAsB;IACzB,GAAG,uBAAuB;IAC1B,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,mBAAmB;IACtB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;IACpB,GAAG,mBAAmB;IACtB,GAAG,uBAAuB;IAC1B,GAAG,cAAc;IACjB,GAAG,oBAAoB;IACvB,GAAG,eAAe;IAClB,GAAG,kBAAkB;IACrB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,sBAAsB;IACzB,GAAG,eAAe;IAClB,GAAG,oBAAoB;IACvB,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,GAAG,aAAa;IAChB,GAAG,yBAAyB;IAC5B,GAAG,gBAAgB;IACnB,GAAG,gBAAgB;IACnB,GAAG,yBAAyB;IAC5B,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,aAAa;IAChB,GAAG,oBAAoB;IACvB,GAAG,0BAA0B;IAC7B,GAAG,uBAAuB;CAC3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Fixture } from './fixture.js';
2
+ export declare const PRIVACY_SNAPSHOT_FIXTURES: readonly Fixture[];
3
+ //# sourceMappingURL=privacy-snapshot-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-snapshot-fixtures.d.ts","sourceRoot":"","sources":["../../../src/check/fixtures/privacy-snapshot-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,eAAO,MAAM,yBAAyB,EAAE,SAAS,OAAO,EA0FvD,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { CONFIG_FILE } from '../../config/index.js';
2
+ import { config } from './config.js';
3
+ import { PATHS } from './paths.js';
4
+ import { project } from './project.js';
5
+ import { source } from './source.js';
6
+ const MAPPER = `${PATHS.BILLING}/infrastructure/persistence/dossier-snapshots.mapper.ts`;
7
+ const EVENTS = `${PATHS.BILLING}/infrastructure/persistence/dossier-events.mapper.ts`;
8
+ export const PRIVACY_SNAPSHOT_FIXTURES = [
9
+ {
10
+ ruleId: 'privacy/snapshot-sealed',
11
+ name: 'a snapshot that seals what is named like personal data, on the write and the read side',
12
+ expect: 'pass',
13
+ files: privacyOn({
14
+ [MAPPER]: source('export const dossierSnapshots = {', ' version: 1,', ' encode: (dossier: Dossier): object => ({', ' email: dossier.email === undefined ? null : personalData(dossier.patientId, dossier.email),', ' birthDate: personalData(dossier.patientId, dossier.bornOn),', ' }),', ' decode: (data: StoredEventData): DossierState => ({', " email: data.personalText('email'),", " bornOn: data.text('birthDate'),", ' }),', '};'),
15
+ }),
16
+ },
17
+ {
18
+ ruleId: 'privacy/snapshot-sealed',
19
+ name: 'a snapshot that keeps nothing named like personal data, its key to the person included',
20
+ expect: 'pass',
21
+ files: privacyOn({ [MAPPER]: mapper('patientId: dossier.patientId,') }),
22
+ },
23
+ {
24
+ ruleId: 'privacy/snapshot-sealed',
25
+ name: 'a snapshot in clear, in a project whose privacy is off',
26
+ expect: 'pass',
27
+ files: project({ [MAPPER]: mapper('email: dossier.email,') }),
28
+ },
29
+ {
30
+ ruleId: 'privacy/snapshot-sealed',
31
+ name: 'a word the config allows, and one named in a comment only',
32
+ expect: 'pass',
33
+ files: privacyOn({ [MAPPER]: mapper('street: dossier.street, // email: stays in the event') }, { privacy: { allow: ['street'] } }),
34
+ },
35
+ {
36
+ ruleId: 'privacy/snapshot-sealed',
37
+ name: 'an event mapper, which another rule reads',
38
+ expect: 'pass',
39
+ files: privacyOn({ [EVENTS]: source('export const data = { surname: event.surname };') }),
40
+ },
41
+ {
42
+ ruleId: 'privacy/snapshot-sealed',
43
+ name: 'a snapshot whose encode writes an email in clear',
44
+ expect: { file: MAPPER },
45
+ files: privacyOn({ [MAPPER]: mapper('email: dossier.email ?? null,') }),
46
+ },
47
+ {
48
+ ruleId: 'privacy/snapshot-sealed',
49
+ name: 'a snapshot that writes the whole state, whose decode reads an email in clear',
50
+ expect: { file: MAPPER },
51
+ files: privacyOn({ [MAPPER]: mapperOfTheState("email: data.optionalText('email'),") }),
52
+ },
53
+ {
54
+ ruleId: 'privacy/snapshot-sealed',
55
+ name: 'a snapshot with a word of privacy.vocabulary in clear',
56
+ expect: { file: MAPPER },
57
+ files: privacyOn({ [MAPPER]: mapper('diagnosis: dossier.diagnosis,') }, { privacy: { vocabulary: ['diagnosis'] } }),
58
+ },
59
+ {
60
+ ruleId: 'privacy/snapshot-sealed',
61
+ name: 'a value sealed beside one written in clear',
62
+ expect: { file: MAPPER },
63
+ files: privacyOn({
64
+ [MAPPER]: mapper('email: personalData(dossier.patientId, dossier.email),', 'phone: dossier.phone,'),
65
+ }),
66
+ },
67
+ {
68
+ ruleId: 'privacy/declared-field',
69
+ name: 'a key of a snapshot mapper read like a column, which is no column',
70
+ expect: 'pass',
71
+ files: privacyOn({
72
+ [MAPPER]: source('export const dossierSnapshots = {', ' version: 1,', ' encode: (dossier: Dossier): object => ({', ' phone: dossier.phone === undefined ? null : personalData(dossier.patientId, dossier.phone),', ' }),', " decode: (data: StoredEventData): DossierState => ({ phone: data.text('phone') }),", '};'),
73
+ }),
74
+ },
75
+ ];
76
+ function privacyOn(files, written = {}) {
77
+ return project(files, { [CONFIG_FILE]: config({ stack: { privacy: 'on', orm: 'knex' }, ...written }) });
78
+ }
79
+ function mapper(...encoded) {
80
+ return source('export const dossierSnapshots = {', ' version: 1,', ' encode: (dossier: Dossier): object => ({', ' openedAt: dossier.openedAt.toISOString(),', ...encoded.map((line) => ` ${line}`), ' }),', ' decode: (data: StoredEventData): DossierState => ({', " openedAt: data.instant('openedAt'),", ' }),', '};');
81
+ }
82
+ /** The state written whole, so that only `decode` names what the snapshot keeps. */
83
+ function mapperOfTheState(read) {
84
+ return source('export const dossierSnapshots = {', ' version: 1,', ' encode: (dossier: Dossier): object => dossier.toState(),', ' decode: (data: StoredEventData): DossierState => ({', ` ${read}`, ' }),', '};');
85
+ }
86
+ //# sourceMappingURL=privacy-snapshot-fixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy-snapshot-fixtures.js","sourceRoot":"","sources":["../../../src/check/fixtures/privacy-snapshot-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,yDAAyD,CAAC;AACzF,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,sDAAsD,CAAC;AAEtF,MAAM,CAAC,MAAM,yBAAyB,GAAuB;IAC3D;QACE,MAAM,EAAE,yBAAyB;QACjC,IAAI,EAAE,wFAAwF;QAC9F,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,SAAS,CAAC;YACf,CAAC,MAAM,CAAC,EAAE,MAAM,CACd,mCAAmC,EACnC,eAAe,EACf,4CAA4C,EAC5C,iGAAiG,EACjG,iEAAiE,EACjE,OAAO,EACP,uDAAuD,EACvD,wCAAwC,EACxC,qCAAqC,EACrC,OAAO,EACP,IAAI,CACL;SACF,CAAC;KACH;IACD;QACE,MAAM,EAAE,yBAAyB;QACjC,IAAI,EAAE,wFAAwF;QAC9F,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,+BAA+B,CAAC,EAAE,CAAC;KACxE;IACD;QACE,MAAM,EAAE,yBAAyB;QACjC,IAAI,EAAE,wDAAwD;QAC9D,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,EACP,IAAI,CACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { SourceFile } from '../model/source-file.js';
2
+ /** A value a snapshot mapper keeps in clear, by the name it is written or read under. */
3
+ export interface ClearSnapshotValue {
4
+ readonly name: string;
5
+ readonly line: number;
6
+ }
7
+ /**
8
+ * The values a snapshot mapper writes in `encode`, reads in `decode` or types, that no
9
+ * `personalData`, `PersonalValue` or personal reader of the same file seals, each name once. Reading
10
+ * the two sides is what sees a mapper whose `encode` answers the whole state.
11
+ */
12
+ export declare function clearSnapshotValuesIn(file: SourceFile): ClearSnapshotValue[];
13
+ //# sourceMappingURL=clear-snapshot-values-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-snapshot-values-in.d.ts","sourceRoot":"","sources":["../../../src/check/privacy/clear-snapshot-values-in.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,yFAAyF;AACzF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AASD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,kBAAkB,EAAE,CAY5E"}
@@ -0,0 +1,36 @@
1
+ import { endAtDepthZero } from '../text/end-at-depth-zero.js';
2
+ /** A property of an object or of a type, at the start of its line or after `{` or `,`. */
3
+ const PROPERTY = /(?:^|[{,]\s*|\n\s*)([A-Za-z_$][\w$]*)\??\s*:/g;
4
+ /** `data.optionalText('email')`, any reader but the personal ones. */
5
+ const CLEAR_READ = /\b[\w$]+\.(?!personal)[A-Za-z]+\(\s*'([A-Za-z_$][\w$]*)'/g;
6
+ /** What says a value is sealed: `personalData(...)` on the way in, its type, a personal reader on the way out. */
7
+ const SEALED = /\bpersonalData\(|\bPersonalValue\b|\.personal(?:Text|Instant)?\(/;
8
+ /**
9
+ * The values a snapshot mapper writes in `encode`, reads in `decode` or types, that no
10
+ * `personalData`, `PersonalValue` or personal reader of the same file seals, each name once. Reading
11
+ * the two sides is what sees a mapper whose `encode` answers the whole state.
12
+ */
13
+ export function clearSnapshotValuesIn(file) {
14
+ const properties = propertiesIn(file);
15
+ const sealed = new Set(properties.filter(({ value }) => SEALED.test(value)).map(({ name }) => name));
16
+ const named = [
17
+ ...properties.filter(({ value }) => !SEALED.test(value)).map(({ name, line }) => ({ name, line })),
18
+ ...clearReadsIn(file),
19
+ ];
20
+ const kept = named.filter(({ name }) => !sealed.has(name));
21
+ return kept.filter(({ name }, index) => kept.findIndex((value) => value.name === name) === index);
22
+ }
23
+ function propertiesIn({ scan }) {
24
+ const { code } = scan;
25
+ return [...code.matchAll(PROPERTY)].map((match) => {
26
+ const start = match.index + match[0].length;
27
+ const value = code.slice(start, endAtDepthZero(code, start, ','));
28
+ return { name: match[1] ?? '', line: scan.lineAt(start), value: value.split(';')[0] ?? '' };
29
+ });
30
+ }
31
+ function clearReadsIn({ text, scan }) {
32
+ return [...text.matchAll(CLEAR_READ)]
33
+ .filter((match) => scan.code.charAt(match.index) === text.charAt(match.index))
34
+ .map((match) => ({ name: match[1] ?? '', line: scan.lineAt(match.index) }));
35
+ }
36
+ //# sourceMappingURL=clear-snapshot-values-in.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-snapshot-values-in.js","sourceRoot":"","sources":["../../../src/check/privacy/clear-snapshot-values-in.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,0FAA0F;AAC1F,MAAM,QAAQ,GAAG,+CAA+C,CAAC;AACjE,sEAAsE;AACtE,MAAM,UAAU,GAAG,2DAA2D,CAAC;AAC/E,kHAAkH;AAClH,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAElF;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAgB;IACpD,MAAM,UAAU,GAAG,YAAY,C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AC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QAElE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAC9F,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,EAAc;IAC9C,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;SAClC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC7E,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { SourceFile } from '../model/source-file.js';
2
+ /** The mapper of the snapshots of an aggregate, `infrastructure/persistence/<aggregate>-snapshots.mapper.ts`. */
3
+ export declare function isSnapshotMapper(file: SourceFile): boolean;
4
+ //# sourceMappingURL=is-snapshot-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-snapshot-mapper.d.ts","sourceRoot":"","sources":["../../../src/check/privacy/is-snapshot-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIvD,iHAAiH;AACjH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAU1D"}
@@ -0,0 +1,11 @@
1
+ const NAME = /-snapshots?\.mapper\.ts$/;
2
+ /** The mapper of the snapshots of an aggregate, `infrastructure/persistence/<aggregate>-snapshots.mapper.ts`. */
3
+ export function isSnapshotMapper(file) {
4
+ const { location } = file;
5
+ return (!file.isTest &&
6
+ location.area === 'context' &&
7
+ location.layer === 'infrastructure' &&
8
+ location.inside[0] === 'persistence' &&
9
+ NAME.test(file.path));
10
+ }
11
+ //# sourceMappingURL=is-snapshot-mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-snapshot-mapper.js","sourceRoot":"","sources":["../../../src/check/privacy/is-snapshot-mapper.ts"],"names":[],"mappings":"AAEA,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAExC,iHAAiH;AACjH,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,MAAM;QACZ,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC3B,QAAQ,CAAC,KAAK,KAAK,gBAAgB;QACnC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,aAAa;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CACrB,CAAC;AACJ,CAAC"}