@ddd-ts-kit/kernel 0.113.2 → 0.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.fr.md +70 -62
- package/README.md +65 -57
- package/dist/application/audit/restamped.d.ts +9 -0
- package/dist/application/audit/restamped.d.ts.map +1 -0
- package/dist/application/audit/restamped.js +9 -0
- package/dist/application/audit/restamped.js.map +1 -0
- package/dist/application/audit/stamp-update.d.ts +1 -6
- package/dist/application/audit/stamp-update.d.ts.map +1 -1
- package/dist/application/audit/stamp-update.js +2 -8
- package/dist/application/audit/stamp-update.js.map +1 -1
- package/dist/application/background/enqueued-job.d.ts +1 -1
- package/dist/application/background/enqueued-job.d.ts.map +1 -1
- package/dist/application/error-reporting/report-once.d.ts.map +1 -1
- package/dist/application/error-reporting/report-once.js +2 -6
- package/dist/application/error-reporting/report-once.js.map +1 -1
- package/dist/application/event-sourcing/event-envelope.d.ts +2 -1
- package/dist/application/event-sourcing/event-envelope.d.ts.map +1 -1
- package/dist/application/event-sourcing/event-to-append.d.ts +1 -1
- package/dist/application/event-sourcing/event-to-append.d.ts.map +1 -1
- package/dist/application/execution/with-actor.d.ts +2 -2
- package/dist/application/execution/with-actor.js +3 -3
- package/dist/application/execution/with-actor.js.map +1 -1
- package/dist/application/files/stored-file.d.ts +3 -3
- package/dist/application/files/stored-file.d.ts.map +1 -1
- package/dist/application/hydration/hydration.d.ts.map +1 -1
- package/dist/application/hydration/hydration.js +3 -2
- package/dist/application/hydration/hydration.js.map +1 -1
- package/dist/application/logging/hidden-keys.d.ts +8 -0
- package/dist/application/logging/hidden-keys.d.ts.map +1 -0
- package/dist/application/logging/hidden-keys.js +10 -0
- package/dist/application/logging/hidden-keys.js.map +1 -0
- package/dist/application/logging/index.d.ts +1 -0
- package/dist/application/logging/index.d.ts.map +1 -1
- package/dist/application/logging/index.js +1 -0
- package/dist/application/logging/index.js.map +1 -1
- package/dist/application/observation/safely.d.ts +6 -0
- package/dist/application/observation/safely.d.ts.map +1 -0
- package/dist/application/observation/safely.js +13 -0
- package/dist/application/observation/safely.js.map +1 -0
- package/dist/application/persistence/append-changes.d.ts +1 -0
- package/dist/application/persistence/append-changes.d.ts.map +1 -1
- package/dist/application/persistence/append-changes.js +7 -6
- package/dist/application/persistence/append-changes.js.map +1 -1
- package/dist/application/persistence/optimistic-update.d.ts +6 -2
- package/dist/application/persistence/optimistic-update.d.ts.map +1 -1
- package/dist/application/persistence/optimistic-update.js +11 -3
- package/dist/application/persistence/optimistic-update.js.map +1 -1
- package/dist/application/ports/domain-event-dispatcher.d.ts +1 -1
- package/dist/application/ports/domain-event-dispatcher.js +1 -1
- package/dist/application/ports/logger.d.ts +3 -3
- package/dist/application/ports/unit-of-work.d.ts +1 -1
- package/dist/application/ports/unit-of-work.js +1 -1
- package/dist/application/read-model/stamp-of.d.ts +11 -4
- package/dist/application/read-model/stamp-of.d.ts.map +1 -1
- package/dist/application/read-model/stamp-of.js +10 -8
- package/dist/application/read-model/stamp-of.js.map +1 -1
- package/dist/application/session/anonymous-session.d.ts.map +1 -1
- package/dist/application/session/anonymous-session.js +4 -2
- package/dist/application/session/anonymous-session.js.map +1 -1
- package/dist/application/session/never-issued.d.ts +2 -1
- package/dist/application/session/never-issued.d.ts.map +1 -1
- package/dist/application/session/never-issued.js +4 -1
- package/dist/application/session/never-issued.js.map +1 -1
- package/dist/application/session/system-session.d.ts.map +1 -1
- package/dist/application/session/system-session.js +2 -2
- package/dist/application/session/system-session.js.map +1 -1
- package/dist/application/undecided/index.d.ts +3 -0
- package/dist/application/undecided/index.d.ts.map +1 -0
- package/dist/application/undecided/index.js +3 -0
- package/dist/application/undecided/index.js.map +1 -0
- package/dist/application/undecided/undecided-error.d.ts +12 -0
- package/dist/application/undecided/undecided-error.d.ts.map +1 -0
- package/dist/application/undecided/undecided-error.js +15 -0
- package/dist/application/undecided/undecided-error.js.map +1 -0
- package/dist/application/undecided/undecided.d.ts +7 -0
- package/dist/application/undecided/undecided.d.ts.map +1 -0
- package/dist/application/undecided/undecided.js +9 -0
- package/dist/application/undecided/undecided.js.map +1 -0
- package/dist/domain/aggregate-root.d.ts +6 -13
- package/dist/domain/aggregate-root.d.ts.map +1 -1
- package/dist/domain/aggregate-root.js +10 -16
- package/dist/domain/aggregate-root.js.map +1 -1
- package/dist/domain/aggregate-tracking.d.ts +30 -0
- package/dist/domain/aggregate-tracking.d.ts.map +1 -0
- package/dist/domain/aggregate-tracking.js +48 -0
- package/dist/domain/aggregate-tracking.js.map +1 -0
- package/dist/domain/domain-event.d.ts +4 -0
- package/dist/domain/domain-event.d.ts.map +1 -1
- package/dist/domain/domain-event.js.map +1 -1
- package/dist/domain/errors/domain-error.d.ts.map +1 -1
- package/dist/domain/errors/domain-error.js +2 -1
- package/dist/domain/errors/domain-error.js.map +1 -1
- package/dist/domain/errors/factual-refusal.d.ts.map +1 -1
- package/dist/domain/errors/factual-refusal.js +3 -0
- package/dist/domain/errors/factual-refusal.js.map +1 -1
- package/dist/domain/errors/kit-codes.d.ts +2 -0
- package/dist/domain/errors/kit-codes.d.ts.map +1 -1
- package/dist/domain/errors/kit-codes.js +2 -0
- package/dist/domain/errors/kit-codes.js.map +1 -1
- package/dist/domain/event-id-of.d.ts +8 -0
- package/dist/domain/event-id-of.d.ts.map +1 -0
- package/dist/domain/event-id-of.js +10 -0
- package/dist/domain/event-id-of.js.map +1 -0
- package/dist/domain/event-rank.d.ts +8 -0
- package/dist/domain/event-rank.d.ts.map +1 -0
- package/dist/domain/event-rank.js +8 -0
- package/dist/domain/event-rank.js.map +1 -0
- package/dist/domain/event-sourcing/event-sourced-aggregate.d.ts +0 -1
- package/dist/domain/event-sourcing/event-sourced-aggregate.d.ts.map +1 -1
- package/dist/domain/event-sourcing/event-sourced-aggregate.js +4 -8
- package/dist/domain/event-sourcing/event-sourced-aggregate.js.map +1 -1
- package/dist/domain/named-domain-event.d.ts +11 -4
- package/dist/domain/named-domain-event.d.ts.map +1 -1
- package/dist/domain/named-domain-event.js +14 -3
- package/dist/domain/named-domain-event.js.map +1 -1
- package/dist/domain/rank-of.d.ts +8 -0
- package/dist/domain/rank-of.d.ts.map +1 -0
- package/dist/domain/rank-of.js +14 -0
- package/dist/domain/rank-of.js.map +1 -0
- package/dist/domain/ranked.d.ts +10 -0
- package/dist/domain/ranked.d.ts.map +1 -0
- package/dist/domain/ranked.js +19 -0
- package/dist/domain/ranked.js.map +1 -0
- package/dist/domain/result/unwrap.d.ts +1 -0
- package/dist/domain/result/unwrap.d.ts.map +1 -1
- package/dist/domain/result/unwrap.js +4 -1
- package/dist/domain/result/unwrap.js.map +1 -1
- package/dist/domain/state-machine/state-machine.d.ts +4 -0
- package/dist/domain/state-machine/state-machine.d.ts.map +1 -1
- package/dist/domain/state-machine/state-machine.js +14 -4
- package/dist/domain/state-machine/state-machine.js.map +1 -1
- package/dist/domain/value-object/frozen-copy.d.ts +8 -0
- package/dist/domain/value-object/frozen-copy.d.ts.map +1 -0
- package/dist/domain/value-object/frozen-copy.js +34 -0
- package/dist/domain/value-object/frozen-copy.js.map +1 -0
- package/dist/domain/value-object/index.d.ts +2 -0
- package/dist/domain/value-object/index.d.ts.map +1 -0
- package/dist/domain/value-object/index.js +2 -0
- package/dist/domain/value-object/index.js.map +1 -0
- package/dist/domain/value-object/is-plain-record.d.ts +3 -0
- package/dist/domain/value-object/is-plain-record.d.ts.map +1 -0
- package/dist/domain/value-object/is-plain-record.js +9 -0
- package/dist/domain/value-object/is-plain-record.js.map +1 -0
- package/dist/domain/value-object/same-value.d.ts +8 -0
- package/dist/domain/value-object/same-value.d.ts.map +1 -0
- package/dist/domain/value-object/same-value.js +43 -0
- package/dist/domain/value-object/same-value.js.map +1 -0
- package/dist/domain/value-object/value-object.d.ts +28 -0
- package/dist/domain/value-object/value-object.d.ts.map +1 -0
- package/dist/domain/value-object/value-object.js +24 -0
- package/dist/domain/value-object/value-object.js.map +1 -0
- package/dist/index.d.ts +9 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -12
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/aggregates/aggregate-mapper.d.ts +21 -0
- package/dist/infrastructure/aggregates/aggregate-mapper.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/aggregate-mapper.js +18 -0
- package/dist/infrastructure/aggregates/aggregate-mapper.js.map +1 -0
- package/dist/infrastructure/aggregates/aggregate-save.d.ts +22 -0
- package/dist/infrastructure/aggregates/aggregate-save.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/aggregate-save.js +2 -0
- package/dist/infrastructure/aggregates/aggregate-save.js.map +1 -0
- package/dist/infrastructure/aggregates/as-found.d.ts +8 -0
- package/dist/infrastructure/aggregates/as-found.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/as-found.js +2 -0
- package/dist/infrastructure/aggregates/as-found.js.map +1 -0
- package/dist/infrastructure/aggregates/give-back.d.ts +9 -0
- package/dist/infrastructure/aggregates/give-back.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/give-back.js +13 -0
- package/dist/infrastructure/aggregates/give-back.js.map +1 -0
- package/dist/infrastructure/aggregates/index.d.ts +7 -0
- package/dist/infrastructure/aggregates/index.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/index.js +7 -0
- package/dist/infrastructure/aggregates/index.js.map +1 -0
- package/dist/infrastructure/aggregates/loaded-at.d.ts +8 -0
- package/dist/infrastructure/aggregates/loaded-at.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/loaded-at.js +12 -0
- package/dist/infrastructure/aggregates/loaded-at.js.map +1 -0
- package/dist/infrastructure/aggregates/noted-as-found.d.ts +8 -0
- package/dist/infrastructure/aggregates/noted-as-found.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/noted-as-found.js +15 -0
- package/dist/infrastructure/aggregates/noted-as-found.js.map +1 -0
- package/dist/infrastructure/aggregates/recorded-events-of.d.ts +4 -0
- package/dist/infrastructure/aggregates/recorded-events-of.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/recorded-events-of.js +6 -0
- package/dist/infrastructure/aggregates/recorded-events-of.js.map +1 -0
- package/dist/infrastructure/aggregates/save-aggregate-row.d.ts +23 -0
- package/dist/infrastructure/aggregates/save-aggregate-row.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/save-aggregate-row.js +17 -0
- package/dist/infrastructure/aggregates/save-aggregate-row.js.map +1 -0
- package/dist/infrastructure/aggregates/stored-at.d.ts +7 -0
- package/dist/infrastructure/aggregates/stored-at.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/stored-at.js +14 -0
- package/dist/infrastructure/aggregates/stored-at.js.map +1 -0
- package/dist/infrastructure/aggregates/take-recorded-events.d.ts +9 -0
- package/dist/infrastructure/aggregates/take-recorded-events.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/take-recorded-events.js +17 -0
- package/dist/infrastructure/aggregates/take-recorded-events.js.map +1 -0
- package/dist/infrastructure/aggregates/unstored-events-of.d.ts +4 -0
- package/dist/infrastructure/aggregates/unstored-events-of.d.ts.map +1 -0
- package/dist/infrastructure/aggregates/unstored-events-of.js +7 -0
- package/dist/infrastructure/aggregates/unstored-events-of.js.map +1 -0
- package/dist/infrastructure/clock/fixed-clock.d.ts +2 -1
- package/dist/infrastructure/clock/fixed-clock.d.ts.map +1 -1
- package/dist/infrastructure/clock/fixed-clock.js +5 -4
- package/dist/infrastructure/clock/fixed-clock.js.map +1 -1
- package/dist/infrastructure/context/scoped-actor-context.d.ts.map +1 -1
- package/dist/infrastructure/context/scoped-actor-context.js +2 -6
- package/dist/infrastructure/context/scoped-actor-context.js.map +1 -1
- package/dist/infrastructure/domain-events/announce-domain-events.d.ts +1 -1
- package/dist/infrastructure/domain-events/announce-domain-events.js +1 -1
- package/dist/infrastructure/domain-events/dispatching-on-save.d.ts +1 -1
- package/dist/infrastructure/domain-events/dispatching-on-save.d.ts.map +1 -1
- package/dist/infrastructure/domain-events/dispatching-on-save.js +3 -2
- package/dist/infrastructure/domain-events/dispatching-on-save.js.map +1 -1
- package/dist/infrastructure/domain-events/index.d.ts +13 -0
- package/dist/infrastructure/domain-events/index.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/index.js +13 -0
- package/dist/infrastructure/domain-events/index.js.map +1 -0
- package/dist/infrastructure/domain-events/recorded-aggregates.d.ts +2 -5
- package/dist/infrastructure/domain-events/recorded-aggregates.d.ts.map +1 -1
- package/dist/infrastructure/domain-events/recorded-aggregates.js +3 -5
- package/dist/infrastructure/domain-events/recorded-aggregates.js.map +1 -1
- package/dist/infrastructure/domain-events/unit-of-work-aborted-error.d.ts +10 -0
- package/dist/infrastructure/domain-events/unit-of-work-aborted-error.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/unit-of-work-aborted-error.js +13 -0
- package/dist/infrastructure/domain-events/unit-of-work-aborted-error.js.map +1 -0
- package/dist/infrastructure/domain-events/unit-of-work-over.d.ts +43 -0
- package/dist/infrastructure/domain-events/unit-of-work-over.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/unit-of-work-over.js +132 -0
- package/dist/infrastructure/domain-events/unit-of-work-over.js.map +1 -0
- package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts +9 -1
- package/dist/infrastructure/domain-events/unit-of-work-scope.d.ts.map +1 -1
- package/dist/infrastructure/domain-events/unit-of-work-scope.js.map +1 -1
- package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.d.ts +8 -0
- package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.js +11 -0
- package/dist/infrastructure/domain-events/unscoped-unit-of-work-error.js.map +1 -0
- package/dist/infrastructure/domain-events/when-committed.d.ts.map +1 -1
- package/dist/infrastructure/domain-events/when-committed.js +2 -9
- package/dist/infrastructure/domain-events/when-committed.js.map +1 -1
- package/dist/infrastructure/event-sourcing/aggregate-id-of.d.ts +4 -0
- package/dist/infrastructure/event-sourcing/aggregate-id-of.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/aggregate-id-of.js +6 -0
- package/dist/infrastructure/event-sourcing/aggregate-id-of.js.map +1 -0
- package/dist/infrastructure/event-sourcing/event-serializer.d.ts +3 -4
- package/dist/infrastructure/event-sourcing/event-serializer.d.ts.map +1 -1
- package/dist/infrastructure/event-sourcing/event-serializer.js +10 -12
- package/dist/infrastructure/event-sourcing/event-serializer.js.map +1 -1
- package/dist/infrastructure/event-sourcing/event-store-personal-data-export.d.ts.map +1 -1
- package/dist/infrastructure/event-sourcing/event-store-personal-data-export.js +1 -5
- package/dist/infrastructure/event-sourcing/event-store-personal-data-export.js.map +1 -1
- package/dist/infrastructure/events/idempotent.d.ts.map +1 -1
- package/dist/infrastructure/events/idempotent.js +9 -3
- package/dist/infrastructure/events/idempotent.js.map +1 -1
- package/dist/infrastructure/in-memory/as-json-carries.d.ts +9 -0
- package/dist/infrastructure/in-memory/as-json-carries.d.ts.map +1 -0
- package/dist/infrastructure/in-memory/as-json-carries.js +12 -0
- package/dist/infrastructure/in-memory/as-json-carries.js.map +1 -0
- package/dist/infrastructure/in-memory/composite-key.d.ts +6 -0
- package/dist/infrastructure/in-memory/composite-key.d.ts.map +1 -0
- package/dist/infrastructure/in-memory/composite-key.js +8 -0
- package/dist/infrastructure/in-memory/composite-key.js.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-cache.d.ts +3 -1
- package/dist/infrastructure/in-memory/in-memory-cache.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-cache.js +7 -3
- package/dist/infrastructure/in-memory/in-memory-cache.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.d.ts +0 -1
- package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.js +2 -9
- package/dist/infrastructure/in-memory/in-memory-domain-event-dispatcher.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-event-bus.d.ts +7 -14
- package/dist/infrastructure/in-memory/in-memory-event-bus.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-event-bus.js +17 -9
- package/dist/infrastructure/in-memory/in-memory-event-bus.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-event-store.d.ts +1 -0
- package/dist/infrastructure/in-memory/in-memory-event-store.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-event-store.js +11 -10
- package/dist/infrastructure/in-memory/in-memory-event-store.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-process-store.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-process-store.js +4 -6
- package/dist/infrastructure/in-memory/in-memory-process-store.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-processed-event-store.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-processed-event-store.js +3 -6
- package/dist/infrastructure/in-memory/in-memory-processed-event-store.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-unit-of-work.d.ts +4 -2
- package/dist/infrastructure/in-memory/in-memory-unit-of-work.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-unit-of-work.js +6 -4
- package/dist/infrastructure/in-memory/in-memory-unit-of-work.js.map +1 -1
- package/dist/infrastructure/in-memory/in-process-bus.d.ts +1 -0
- package/dist/infrastructure/in-memory/in-process-bus.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-process-bus.js +4 -3
- package/dist/infrastructure/in-memory/in-process-bus.js.map +1 -1
- package/dist/infrastructure/in-memory/unit-of-work-middleware.d.ts +5 -5
- package/dist/infrastructure/in-memory/unit-of-work-middleware.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/unit-of-work-middleware.js +13 -4
- package/dist/infrastructure/in-memory/unit-of-work-middleware.js.map +1 -1
- package/package.json +4 -4
- package/dist/domain/event-sourcing/unstored-events.d.ts +0 -8
- package/dist/domain/event-sourcing/unstored-events.d.ts.map +0 -1
- package/dist/domain/event-sourcing/unstored-events.js +0 -7
- package/dist/domain/event-sourcing/unstored-events.js.map +0 -1
- package/dist/domain/value-object.d.ts +0 -12
- package/dist/domain/value-object.d.ts.map +0 -1
- package/dist/domain/value-object.js +0 -40
- package/dist/domain/value-object.js.map +0 -1
- package/dist/infrastructure/domain-events/within-unit-of-work.d.ts +0 -25
- package/dist/infrastructure/domain-events/within-unit-of-work.d.ts.map +0 -1
- package/dist/infrastructure/domain-events/within-unit-of-work.js +0 -85
- package/dist/infrastructure/domain-events/within-unit-of-work.js.map +0 -1
- package/dist/infrastructure/event-sourcing/stored-origins.d.ts +0 -5
- package/dist/infrastructure/event-sourcing/stored-origins.d.ts.map +0 -1
- package/dist/infrastructure/event-sourcing/stored-origins.js +0 -3
- package/dist/infrastructure/event-sourcing/stored-origins.js.map +0 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts +0 -11
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts.map +0 -1
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js +0 -15
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js.map +0 -1
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:a779e3dbc5a865ff -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/kernel
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ standard et leurs doubles), `@ddd-ts-kit/kernel/declarations` (les décorateurs
|
|
|
17
17
|
classe dit ce qu'elle est, voir « Déclarations ») et `@ddd-ts-kit/kernel/testing` (les bus
|
|
18
18
|
enregistreurs d'une *spec*, voir « La *spec* d'une réaction »).
|
|
19
19
|
|
|
20
|
-

|
|
21
21
|
|
|
22
22
|
Le noyau dit **ce dont** un contexte a besoin (un `Clock`, un `UnitOfWork`, un `Logger`) et
|
|
23
23
|
jamais **comment** : chaque port est une classe abstraite aux seuls membres abstraits. Ses
|
|
@@ -35,11 +35,11 @@ avec une bibliothèque.
|
|
|
35
35
|
| Domaine | `Entity`, `AggregateRoot` (version, événements enregistrés), `ValueObject`, `DomainEvent`, `DomainError` avec un `code` stable, `ConceptError` (les erreurs d'un concept, chacune construite par une fabrique statique : voir « Erreurs du domaine »), `DomainRefusal` (une classe par refus, construite par des fabriques statiques), `FactualRefusal`, `isRefusal`, `CodeOf`, `RefusalOf`, `Refusal`, `RefusalFacts`, le générique `InvariantViolation`, `NotFoundError`, `ConflictError` (et `UniqueViolationError`, une valeur qu'une contrainte d'unicité garde déjà détenue), `ConcurrencyError`, `PreconditionFailedError`, `Result` avec `ok`, `err`, `unwrap` |
|
|
36
36
|
| Ports | `Clock`, `IdGenerator`, `UnitOfWork`, `Repository` (classes abstraites : chacune est son propre jeton d'injection), `UseCase`, `DependencyKind` (les rôles que déclare une liaison, lus par di, le traçage et les aspects : `repository`, `gateway`, `external`, `use-case`, `publisher`, `consumer`, `domain-event-handler`, `job`) |
|
|
37
37
|
| Bus | `Command`, `Query`, `CommandBus`, `QueryBus`, `BusMiddleware`, les `InMemoryCommandBus` et `InMemoryQueryBus` en processus (`register(type, handler, { context })` nomme le contexte délimité dans `MessageInfo`), `unitOfWorkMiddleware` |
|
|
38
|
-
| Événements | `IntegrationEvent`, `IntegrationEventPublisher`, `IntegrationEventSubscriber`, `EventBus` (les deux à la fois), `EventSubscribers` (l'abonné de chaque contexte délimité), `ProcessedEventStore`, `idempotent`, `InMemoryEventBus` (exécute chaque gestionnaire d'un événement, puis rejette avec une `AggregateError`
|
|
39
|
-
| Événements du domaine et unité de travail | `dispatchingOnSave` (l'enveloppe qui fait remettre par un *repository* ce qu'ont enregistré les agrégats qu'on lui confie), `announceDomainEvents`, `
|
|
38
|
+
| Événements | `IntegrationEvent`, `IntegrationEventPublisher`, `IntegrationEventSubscriber`, `EventBus` (les deux à la fois), `EventSubscribers` (l'abonné de chaque contexte délimité), `ProcessedEventStore`, `idempotent`, `InMemoryEventBus` (exécute chaque gestionnaire d'un événement, puis rejette avec l'échec d'un seul gestionnaire tel quel, avec son `code`, et avec une `AggregateError` de plusieurs ; un événement est livré et consigné dans `published` tel qu'un *broker* le porte, en JSON : une copie, une `Date` sous forme de texte, un événement que JSON ne peut pas porter refusé), `DomainEventDispatcher`, `IntegrationEventCallback` et `DomainEventCallback` (les fonctions que reçoivent un abonné et un distributeur), `executionContextOfEvent`, `inEventScope`, `scopedPublisher`, `EventDelivery` (ce qu'un fournisseur dit d'une livraison : tentative, dernière tentative, transport, source, consommateur), `messagingSystemOf` |
|
|
39
|
+
| Événements du domaine et unité de travail | `dispatchingOnSave` (l'enveloppe qui fait remettre par un *repository* ce qu'ont enregistré les agrégats qu'on lui confie), `announceDomainEvents`, `unitOfWorkOver` (ce sur quoi repose chaque `UnitOfWork` : file, distribution avant la validation, phase `after-commit`), `UnscopedUnitOfWorkError`, `UnitOfWorkAbortedError`, `unitOfWorkStage` et `UnitOfWorkStage`, `DomainEventPhase`, `DomainEventSubscription`, `SaveAfterCommitError`, `AfterCommitFailure`, `reportAfterCommitFailures`, `InMemoryDomainEventDispatcher` |
|
|
40
40
|
| Machines à états | `defineStateMachine`, `StateMachine`, `TransitionError`, `InvalidStateMachineError`, `mermaidOfStateMachine` (voir « Machines à états ») |
|
|
41
41
|
| Acteur | `Actor`, `AuthorizedCommand`, `AuthorizedQuery`, `ActorContext`, `systemActor` |
|
|
42
|
-
| Interfaces standard | `Session`, `ExecutionContext` et `ExecutionScope`, `Logger`, `Metrics`, `ErrorReporter`, `Cache`, `CacheInvalidation` et `CachePurger` (avec `cacheTag`, `tenantCacheTags`, `CachePurgeRequest`, `PublishedCacheInvalidation`, `PurgingPublisher`, `RepeatedCachePurger` : voir « Purger les caches HTTP »), `Lock`, `RateLimiter`, `Page` et `PageRequest`, `AuditStamp`, `TenantScoped`, `AuditTrail`, `AuditReader` et `AuditEntry` |
|
|
42
|
+
| Interfaces standard | `Session`, `ExecutionContext` et `ExecutionScope`, `Logger`, `Metrics`, `ErrorReporter`, `Cache`, `CacheInvalidation` et `CachePurger` (avec `cacheTag`, `tenantCacheTags`, `CachePurgeRequest`, `PublishedCacheInvalidation`, `PurgingPublisher`, `RepeatedCachePurger` : voir « Purger les caches HTTP »), `Lock`, `RateLimiter`, `Page` et `PageRequest`, `AuditStamp`, `TenantScoped`, `AuditTrail`, `AuditReader` et `AuditEntry`, `safely` (exécute un hook, un logger ou une mesure et abandonne ce qu'il lève : observer ne casse jamais ce qui est observé) |
|
|
43
43
|
| *Jobs* planifiés | `JobScheduler`, `ScheduledJob`, `JobExecution`, `JobSchedule`, `JobOptions`, `JobDefinition`, `JobRun`, `JobDescription`, `parseJobSchedule`, `describeJobSchedule`, `jobPolicy`, `executionContextOfJob` |
|
|
44
44
|
| *Jobs* en arrière-plan | `JobQueue`, `BackgroundJob`, `BackgroundJobExecution`, `BackgroundJobPayloadSchema`, `processTimeoutDuePayload`, `EnqueueOptions`, `QueuedJob`, `QueuedJobStatus`, `backgroundJobPolicy`, `retryDelayMs`, `executionContextOfBackgroundJob`, `whenCommitted` (voir « JobQueue ») |
|
|
45
45
|
| Gestionnaires de processus | `ProcessManager`, `ProcessDecision`, `ProcessRunner`, `ProcessStore`, `InMemoryProcessStore`, `UnreadableProcessStateError` (voir « ProcessRunner et ProcessStore ») |
|
|
@@ -48,7 +48,7 @@ avec une bibliothèque.
|
|
|
48
48
|
| *Event sourcing* | `EventSourcedAggregate`, `EventStore`, `defineStoredEvent`, `EventSerializer`, `EventSourcedRepository`, `SnapshotPolicy`, `personalData`, `PersonalDataCipher`, `CatchUpSubscription`, `EventStoreProjectionRebuild`, `InMemoryEventStore`, `PostgresEventStore` (voir « Event sourcing ») |
|
|
49
49
|
| Données personnelles | `personalFields`, `PersonalDataErasure`, `PersonalDataExport`, `eraseDataSubject`, `exportDataSubject`, `PersonalDataExportDocument`, `inEachTenant`, `recordsInEachTenant`, `isDataSubjectId`, `PersonalDataRecord`, `InMemoryPersonalData` (voir « Données personnelles ») |
|
|
50
50
|
| Côté lecture | `Criteria`, `defineCriteria`, `validateCriteria`, `scoped`, `planCriteria`, `evaluateCriteria`, `pageOfPlan`, `hydrate`, `ReadModelStore`, `stampOf`, `TableReadModelStore`, `ProjectionRebuild`, `InMemoryReadModelStore` (voir « Critères », « Hydratation » et « Projections ») |
|
|
51
|
-
| Aides à la persistance | `optimisticUpdate`, `expectVersion` (la version qu'un appelant a lue, `If-Match` en HTTP, est toujours la version courante, sinon `PreconditionFailedError` : 412), `schemaNameOf`, `stampCreation`, `stampUpdate`, `tenantScopeOf`, `encodeCursor`, `decodeCursor` |
|
|
51
|
+
| Aides à la persistance | `aggregateMapper` (un *mapper* qui déclare l'état et jamais la version), `loadedAt`, `optimisticUpdate`, `expectVersion` (la version qu'un appelant a lue, `If-Match` en HTTP, est toujours la version courante, sinon `PreconditionFailedError` : 412), `schemaNameOf`, `stampCreation`, `stampUpdate`, `restamped`, `tenantScopeOf`, `encodeCursor`, `decodeCursor` |
|
|
52
52
|
| Remontée des erreurs | `ErrorReporter`, `ErrorReport`, `errorReportOf`, `reportOnce`, `isUnexpectedError`, `errorReportingMiddleware`, `DeadLetterReports`, `reportProcessFailures`, `NoopErrorReporter` |
|
|
53
53
|
| Doubles | `FixedClock`, `SequentialIdGenerator`, `InMemoryUnitOfWork`, `FixedActorContext`, `FixedExecutionScope`, `InMemoryLogger`, `InMemoryMetrics`, `InMemoryErrorReporter`, `InMemoryCache`, `InMemoryCacheInvalidation`, `InMemoryCachePurger`, `InMemoryLock`, `InMemoryRateLimiter` |
|
|
54
54
|
| Tests (`@ddd-ts-kit/kernel/testing`) | `RecordingCommandBus`, `RecordingQueryBus` : des bus qui gardent chaque message qu'on leur confie, dans l'ordre (`executed`), et répondent ce que la *spec* leur a dit (`answering(type, answer)`), rien sinon (voir « La *spec* d'une réaction ») |
|
|
@@ -63,7 +63,7 @@ chacun son propre fichier, et `ddd-ts-kit generate` les écrit) :
|
|
|
63
63
|
|
|
64
64
|
<!-- checked sample -->
|
|
65
65
|
```ts
|
|
66
|
-
import { AggregateRoot, DomainRefusal, Entity, ValueObject, NamedDomainEvent } from '@ddd-ts-kit/kernel';
|
|
66
|
+
import { AggregateRoot, DomainRefusal, Entity, ValueObject, NamedDomainEvent, recordedEventsOf } from '@ddd-ts-kit/kernel';
|
|
67
67
|
|
|
68
68
|
// Les codes du contexte, dans <context>.codes.ts, et ses refus, une classe chacun (voir « Erreurs du domaine »).
|
|
69
69
|
export const OrderingCodes = {
|
|
@@ -128,11 +128,11 @@ export class OrderLine extends Entity {
|
|
|
128
128
|
// Un événement du domaine : un fait passé, nommé <contexte>.<agrégat>.<fait>.
|
|
129
129
|
export class OrderPlaced extends NamedDomainEvent('ordering.order.placed') {
|
|
130
130
|
constructor(
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
aggregateId: string,
|
|
132
|
+
occurredAt: Date,
|
|
133
133
|
readonly lineCount: number,
|
|
134
134
|
) {
|
|
135
|
-
super();
|
|
135
|
+
super(aggregateId, occurredAt);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -176,7 +176,7 @@ const order = Order.open('o-1');
|
|
|
176
176
|
order.add('p-7', Quantity.create(2));
|
|
177
177
|
order.place(new Date('2026-01-05T09:00:00Z'));
|
|
178
178
|
|
|
179
|
-
order
|
|
179
|
+
recordedEventsOf(order); // [OrderPlaced { aggregateId: 'o-1', lineCount: 1, ... }]
|
|
180
180
|
Quantity.create(2).equals(Quantity.create(2)); // true : même valeur
|
|
181
181
|
new OrderLine('p-7', Quantity.create(1)).equals(new OrderLine('p-7', Quantity.create(5))); // true : même identité
|
|
182
182
|
```
|
|
@@ -184,9 +184,9 @@ new OrderLine('p-7', Quantity.create(1)).equals(new OrderLine('p-7', Quantity.cr
|
|
|
184
184
|
| Bloc | Ce que le noyau lui donne |
|
|
185
185
|
|---|---|
|
|
186
186
|
| `Entity<Id>` | `id` et `equals` : deux entités sont égales quand leur classe et leur id le sont |
|
|
187
|
-
| `ValueObject<Props>` |
|
|
188
|
-
| `AggregateRoot<Id>` | une entité avec `version
|
|
189
|
-
| `DomainEvent` | une interface : `name`, `occurredAt`, `aggregateId` |
|
|
187
|
+
| `ValueObject<Props>` | une copie de ses `props` gelée en profondeur (`ValueObjectProps` : primitives, dates, objets-valeurs, listes et enregistrements simples de ceux-ci), `equals` par valeur (les dates par leur instant, les listes et les enregistrements en profondeur, un objet-valeur qu'il tient par son propre `equals`), `toJSON` |
|
|
188
|
+
| `AggregateRoot<Id>` | une entité avec une `version` en lecture seule, le jeton de concurrence optimiste que déplace l'adaptateur de son *repository* (`loadedAt`, `optimisticUpdate`), et `record(event)` pour ses méthodes. Une sauvegarde porte la version au rang du dernier événement que l'agrégat a enregistré, et l'avance de un quand il n'en a enregistré aucun. La version et les événements enregistrés ne sont pas énumérables : décomposer, comparer ou sérialiser un agrégat ne les voit jamais |
|
|
189
|
+
| `DomainEvent` | une interface : `name`, `occurredAt`, `aggregateId`. `NamedDomainEvent('<name>')` est sa classe de base : elle écrit le nom une seule fois et porte les deux autres, l'id de l'agrégat en texte quel que soit son type, si bien qu'un événement sans fait propre s'écrit `class OrderPlaced extends NamedDomainEvent('ordering.order.placed') {}`. L'agrégat qui enregistre un événement lui donne son rang dans son histoire, à partir de 1 (`rankOf(event)`), et son identité découle des deux : `eventIdOf(event)` vaut `<name>:<aggregateId>:<rang>`, la même pour l'événement qu'une sauvegarde distribue et pour celui relu depuis un flux. Un test qui construit un événement à la main dit où il se place : `ranked(event, rang)` |
|
|
190
190
|
|
|
191
191
|
Plutôt que de changer l'état depuis l'extérieur, où chaque appelant doit se souvenir de la
|
|
192
192
|
règle :
|
|
@@ -288,7 +288,7 @@ Les codes que lèvent les paquets du kit forment eux aussi une liste, `KitCodes`
|
|
|
288
288
|
`NotFound`, `Conflict`, `InvariantViolation`, `Unauthorized`, `NotAcceptable`, `ConcurrencyConflict`,
|
|
289
289
|
`InvalidCriteria`, `InvalidPageRequest`, `Timeout`, `CircuitOpen`, `BulkheadFull`, `AttemptsExhausted`,
|
|
290
290
|
`ServiceUnavailable`, `PreconditionFailed`, `PreconditionRequired`, `FileTooLarge`, `UnsupportedMediaType`,
|
|
291
|
-
`FileNotFound`, `FileRejected` et `
|
|
291
|
+
`FileNotFound`, `FileRejected`, `InvalidFileKey`, `InvalidFileUrlExpiry` et `ForbiddenTransition`. Une route les nomme dans `errors` et un test les attend
|
|
292
292
|
(`rejects.toMatchObject({ code: KitCodes.Forbidden })`) sans écrire la chaîne : l'éditeur complète la clé,
|
|
293
293
|
et une clé mal orthographiée ne compile pas.
|
|
294
294
|
|
|
@@ -473,7 +473,7 @@ au chargement du fichier. Pourquoi, et la règle qui y tient l'agrégat :
|
|
|
473
473
|
Un effet d'un événement du domaine n'existe que si le changement d'état qui l'a enregistré est
|
|
474
474
|
validé.
|
|
475
475
|
|
|
476
|
-

|
|
477
477
|
|
|
478
478
|
Un agrégat enregistre ses événements ; rien dans un cas d'usage ne les remet. Un *repository*
|
|
479
479
|
enveloppé par `dispatchingOnSave(repository, () => dispatcher)` les tire lui-même, une fois
|
|
@@ -500,8 +500,9 @@ réentrance, échecs, ordre des enveloppes) est dans le README de ce *package*.
|
|
|
500
500
|
récursion. Puis la transaction est validée.
|
|
501
501
|
- Les événements ne sont tirés que si l'appel a réussi. Le premier gestionnaire `before-commit`
|
|
502
502
|
qui échoue rejette l'unité de travail ; le travail, un save ultérieur ou la validation aussi.
|
|
503
|
-
Les événements en file
|
|
504
|
-
|
|
503
|
+
Les événements en file n'atteignent alors aucun gestionnaire, et les agrégats que le travail a
|
|
504
|
+
sauvegardés sont remis comme il les a trouvés, à la version où ils ont été chargés et avec leurs
|
|
505
|
+
événements : les mêmes instances peuvent être sauvegardées à nouveau.
|
|
505
506
|
- Hors de toute unité de travail, le save distribue avant de se résoudre, les gestionnaires
|
|
506
507
|
`before-commit` puis les `after-commit`.
|
|
507
508
|
|
|
@@ -518,14 +519,7 @@ import { NamedDomainEvent,
|
|
|
518
519
|
type DomainEvent,
|
|
519
520
|
} from '@ddd-ts-kit/kernel';
|
|
520
521
|
|
|
521
|
-
class CartOpened extends NamedDomainEvent('shop.cart.opened') {
|
|
522
|
-
constructor(
|
|
523
|
-
readonly aggregateId: string,
|
|
524
|
-
readonly occurredAt: Date,
|
|
525
|
-
) {
|
|
526
|
-
super();
|
|
527
|
-
}
|
|
528
|
-
}
|
|
522
|
+
class CartOpened extends NamedDomainEvent('shop.cart.opened') {}
|
|
529
523
|
|
|
530
524
|
class Cart extends AggregateRoot {
|
|
531
525
|
static open(id: string, now: Date): Cart {
|
|
@@ -571,10 +565,12 @@ await unitOfWork.run(async () => {
|
|
|
571
565
|
// after-commit c1, after-commit c2
|
|
572
566
|
```
|
|
573
567
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
568
|
+
Un agrégat n'a aucune méthode qui remet ses événements. L'enveloppe les prend avec
|
|
569
|
+
`takeRecordedEvents(aggregate)`, une fonction de l'infrastructure qu'un cas d'usage et un adaptateur
|
|
570
|
+
de *repository* n'appellent jamais ; une spec les lit avec `recordedBy(aggregate)` de
|
|
571
|
+
`@ddd-ts-kit/testing`. Ce que l'infrastructure garde d'un agrégat (sa version, ses événements
|
|
572
|
+
enregistrés) est indexé pour tout le processus, si bien qu'un contexte compilé contre une autre copie
|
|
573
|
+
du noyau est suivi lui aussi.
|
|
578
574
|
|
|
579
575
|
### Deux phases
|
|
580
576
|
|
|
@@ -650,27 +646,36 @@ export const sent = commands.executed; // [new ScheduleReminderCommand('invoice-
|
|
|
650
646
|
|
|
651
647
|
### Une unité de travail à vous
|
|
652
648
|
|
|
653
|
-
La file vit dans une portée `AsyncLocalStorage` ouverte par
|
|
654
|
-
`InMemoryUnitOfWork` et les unités de travail des *packages* ORM
|
|
655
|
-
`run` appelé directement (un consommateur, un script) a le
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
jamais une portée
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
649
|
+
La file vit dans une portée `AsyncLocalStorage` ouverte par l'unité de travail que rend
|
|
650
|
+
`unitOfWorkOver(transaction)`. `InMemoryUnitOfWork` et les unités de travail des *packages* ORM
|
|
651
|
+
reposent dessus, si bien qu'un `run` appelé directement (un consommateur, un script) a le
|
|
652
|
+
déroulement d'une commande. `unitOfWorkMiddleware` ne fait qu'appeler `run` : un `UnitOfWork`
|
|
653
|
+
qui n'ouvre aucune portée est refusé avant le gestionnaire (`UnscopedUnitOfWorkError`). Un `run`
|
|
654
|
+
imbriqué, ou une commande envoyée depuis une unité de travail, rejoint la portée en cours : une
|
|
655
|
+
seule distribution, à la fin de la plus externe, et la phase `after-commit` après la validation
|
|
656
|
+
la plus externe. Deux commandes concurrentes ne partagent jamais une portée, et deux bases de
|
|
657
|
+
données non plus : une unité de travail exécutée dans celle d'une autre base de données ouvre sa
|
|
658
|
+
propre transaction et distribue ses événements avant sa propre validation.
|
|
659
|
+
|
|
660
|
+
Une unité de travail est validée ou annulée en entier. Un `run` imbriqué qui échoue l'interrompt :
|
|
661
|
+
quand l'échec remonte, le `run` le plus externe est rejeté avec lui ; quand le travail l'a
|
|
662
|
+
intercepté et a continué (`await unitOfWork.run(step).catch(fallback)`, une nouvelle tentative
|
|
663
|
+
autour d'une commande envoyée depuis un gestionnaire), le `run` le plus externe est rejeté avec
|
|
664
|
+
une `UnitOfWorkAbortedError` dont la `cause` est cet échec, avant toute distribution
|
|
665
|
+
d'événement. Ce que l'étape en échec a écrit n'est jamais validé à part du reste : décidez avant
|
|
666
|
+
l'écriture, ou laissez passer l'échec.
|
|
667
|
+
|
|
668
|
+
Un `UnitOfWork` écrit dans un projet repose dessus. `transaction` commence, appelle ce qu'on lui
|
|
669
|
+
donne, valide quand cela s'est résolu et annule quand cela a été rejeté ; elle est appelée pour
|
|
670
|
+
ouvrir une transaction, jamais par un `run` qui en rejoint une :
|
|
664
671
|
|
|
665
672
|
```ts
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
return scoped();
|
|
670
|
-
}
|
|
673
|
+
private readonly unitOfWork = unitOfWorkOver((work) =>
|
|
674
|
+
this.database.transaction((transaction) => this.current.run(transaction, work)),
|
|
675
|
+
);
|
|
671
676
|
|
|
672
|
-
|
|
673
|
-
|
|
677
|
+
run<T>(work: () => Promise<T>): Promise<T> {
|
|
678
|
+
return this.unitOfWork.run(work);
|
|
674
679
|
}
|
|
675
680
|
```
|
|
676
681
|
|
|
@@ -1178,7 +1183,8 @@ lit par-dessus les *tenants*, voir « Multitenance »), `locale?`, `deadline?`,
|
|
|
1178
1183
|
(pour un *job* planifié, l'instant où il était dû), `origin` (`http`, `event`, `schedule`,
|
|
1179
1184
|
`queue` pour un *job* en arrière-plan, `cli`, ou une chaîne du projet) et `extensions`.
|
|
1180
1185
|
`executionContext(init)` en construit un et prend le *tenant* de l'acteur ;
|
|
1181
|
-
`withActor(context, actor)` est le même travail vu par un autre acteur
|
|
1186
|
+
`withActor(context, actor)` est le même travail vu par un autre acteur, sans la session ni
|
|
1187
|
+
l'élévation du précédent.
|
|
1182
1188
|
|
|
1183
1189
|
`ExecutionScope` (`current()`, `require()`, `run(context, work)`) donne le contexte du travail en
|
|
1184
1190
|
cours au code à qui on ne le passe pas. La frontière le pose une fois :
|
|
@@ -1308,19 +1314,19 @@ enfants. Interrogez-le avant de construire des champs coûteux ; le kit le fait,
|
|
|
1308
1314
|
`loggingMiddleware` et le planificateur. `NoopLogger` répond `false`.
|
|
1309
1315
|
|
|
1310
1316
|
**`flush()`** se résout une fois que chaque entrée journalisée jusque-là, par le *logger* ou un
|
|
1311
|
-
enfant, a été remise à sa destination, et ne rejette jamais.
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
second appel se résout aussi.
|
|
1317
|
+
enfant, a été remise à sa destination, et ne rejette jamais. Il ne clôt rien : une entrée
|
|
1318
|
+
journalisée ensuite est écrite comme les autres, par chaque *logger* du kit, et un appel
|
|
1319
|
+
ultérieur la vide à son tour. L'application de `@ddd-ts-kit/di` l'appelle à la fin de `stop()`,
|
|
1320
|
+
après la dernière entrée de ses modules.
|
|
1316
1321
|
|
|
1317
1322
|
`InMemoryLogger` prend `{ level?, fields?, base?, scrubMessages? }` comme un vrai adaptateur : un
|
|
1318
1323
|
seuil (par défaut `debug`, chaque entrée), des champs lus à chaque entrée, des champs ajoutés à
|
|
1319
1324
|
chaque entrée. Ses `entries` contiennent ce qu'écrit un *logger* : une erreur passée en champ est
|
|
1320
1325
|
enregistrée sous forme de sa description. `CREDENTIAL_KEYS` et `REDACTED` sont les noms de champs
|
|
1321
1326
|
et le marqueur avec lesquels `StdoutLogger` et les adaptateurs pino et winston masquent, et
|
|
1322
|
-
`
|
|
1323
|
-
`
|
|
1327
|
+
`hiddenKeys(added)` la seule question qu'ils posent à un nom de champ : est-il l'une des
|
|
1328
|
+
`CREDENTIAL_KEYS` (`isCredentialKey(name)`) ou l'un des noms qu'un projet ajoute par `redact`,
|
|
1329
|
+
sans tenir compte de la casse. `InMemoryLogger` ne masque rien.
|
|
1324
1330
|
|
|
1325
1331
|
### Metrics
|
|
1326
1332
|
|
|
@@ -1384,7 +1390,9 @@ await cache.get(quoteKey('EUR-USD')); // undefined : expirée, selon l'horloge
|
|
|
1384
1390
|
```
|
|
1385
1391
|
|
|
1386
1392
|
La clé porte le type de sa valeur. `InMemoryCache(clock, { maxEntries? })` expire selon le
|
|
1387
|
-
`Clock` et est
|
|
1393
|
+
`Clock` et est borné ; il garde et rend une valeur comme le fait un cache partagé, telle que JSON la
|
|
1394
|
+
porte : une copie à chaque écriture et à chaque lecture, une `Date` sous forme de texte, une valeur que
|
|
1395
|
+
JSON ne peut pas porter (un bigint, un cycle) refusée à l'écriture. `tenantCacheKey<Quote>(scope, 'quote', pair)` est la même clé confinée au
|
|
1388
1396
|
*tenant* du travail en cours : ce qu'un *tenant* a mis en cache n'est jamais servi à un autre.
|
|
1389
1397
|
|
|
1390
1398
|
### Purger les caches HTTP
|
|
@@ -1737,7 +1745,7 @@ const row = { ...toRow(order), ...tenantScopeOf(scope), ...stampCreation(scope,
|
|
|
1737
1745
|
await update({ ...toRow(order), ...stampUpdate(scope, clock) }, { id: order.id, ...tenantScopeOf(scope) });
|
|
1738
1746
|
```
|
|
1739
1747
|
|
|
1740
|
-
`
|
|
1748
|
+
`restamped(stamp, scope, clock)` sert à un adaptateur qui détient le tampon stocké
|
|
1741
1749
|
(un store de documents qui réécrit l'enregistrement entier) : il le renvoie entier, création
|
|
1742
1750
|
intacte. `tenantScopeOf` lève `NoCurrentTenantError` pour un travail qui ne nomme aucun *tenant*,
|
|
1743
1751
|
si bien qu'une instruction ne peut jamais s'exécuter sans restriction par oubli. Chaque *package*
|
|
@@ -1829,7 +1837,7 @@ return this.appointments.search(scoped(criteria, scope, { ids: 'id', filter: { t
|
|
|
1829
1837
|
Du gestionnaire jusqu'au store, des critères sont vérifiés deux fois, et le périmètre de l'acteur
|
|
1830
1838
|
voyage avec eux :
|
|
1831
1839
|
|
|
1832
|
-

|
|
1833
1841
|
|
|
1834
1842
|
**Vérifiés par le compilateur.** `where` prend un champ de la ligne, un opérateur qui s'applique
|
|
1835
1843
|
à ce que contient le champ, et une valeur de son type : `where('seats', 'contains', '2')`, un tri
|
|
@@ -2076,7 +2084,7 @@ et une écriture n'a lieu que si son événement est plus récent :
|
|
|
2076
2084
|
|
|
2077
2085
|
| Règle | |
|
|
2078
2086
|
|---|---|
|
|
2079
|
-
| Tampon | `stampOf(event)` : l'id et l'instant d'un événement d'intégration
|
|
2087
|
+
| Tampon | `stampOf(event)` : l'id et l'instant d'un événement d'intégration, plus `stampOf(event, version)` quand sa charge utile porte une version par clé ; l'identité et l'instant d'un événement du domaine, avec son rang dans son agrégat pour version, si bien que les événements qu'une commande enregistre sont appliqués dans l'ordre de l'agrégat, même au même instant. Une clé qu'écrivent les événements de plusieurs agrégats n'a pas d'histoire unique : tamponnez-la `{ eventId: eventIdOf(event), occurredAt: event.occurredAt }` |
|
|
2080
2088
|
| Plus récent | une `version` plus grande quand les deux tampons en portent une ; sinon un instant plus tardif ; au même instant, le plus grand id d'événement. Un même événement n'est jamais plus récent que lui-même. L'ordre est total parmi des tampons qui portent tous une version, et parmi des tampons qui n'en portent aucune ; entre un de chaque les instants décident, ce qui n'est pas un ordre, si bien qu'une clé devrait n'en voir qu'une sorte ([une seule sorte de tampon par clé](../../docs/concepts/cqrs.fr.md#quelle-écriture-pour-quel-événement)) |
|
|
2081
2089
|
| `upsertIfNewer(key, stamp, next)` | pour un événement qui dit toute la ligne, ou peut la créer : écrit `next(current)`, `current` valant `undefined` quand la clé ne tient aucune ligne ; `stale` quand la ligne contient cet événement ou un plus tardif ; `ignored` quand `next` renvoie `undefined`, ce qui est un filtre (l'événement ne concerne pas ce modèle de lecture) et jamais la façon d'attendre une ligne |
|
|
2082
2090
|
| `updateIfNewer(key, stamp, change)` | pour un événement qui change une partie d'une ligne qu'un autre événement a créée : écrit `change(current)` ; `stale` quand la ligne, ou la trace de sa suppression, contient cet événement ou un plus tardif ; `missing` quand la clé ne tient aucune ligne, la trace d'une suppression plus ancienne que l'événement, ou une ligne d'un autre locataire : rien n'est écrit, le store ne lève jamais pour cela, et la projection décide. Juste seulement quand les événements de la clé sont appliqués dans l'ordre ([quelle écriture pour quel événement](../../docs/concepts/cqrs.fr.md#quelle-écriture-pour-quel-événement)) |
|
|
@@ -2205,7 +2213,7 @@ await new EventStoreProjectionRebuild({
|
|
|
2205
2213
|
|---|---|
|
|
2206
2214
|
| `CatchUpSubscription` | Lit le store après le point de reprise de son abonné (`CheckpointStore`), applique un lot et déplace le point de reprise en une unité de travail. Un échec n'applique rien du lot ; deux exécutions d'un même abonné ne le déplacent jamais toutes les deux (`ConcurrencyError`). Une nouvelle projection commence à zéro, si bien qu'elle rattrape tout l'historique |
|
|
2207
2215
|
| `applyingProjection(projection, serializer)` | (`@ddd-ts-kit/kernel/declarations`) remet à la méthode `@On` qui l'applique chaque événement stocké, relu par le sérialiseur de son agrégat ; passe sur le reste du store |
|
|
2208
|
-
| `
|
|
2216
|
+
| `stampOf(event)` | Le tampon d'un événement relu depuis le store est celui du même événement distribué par sa sauvegarde : son identité, son instant et, pour version, son rang dans son flux, si bien que les lignes d'un même flux sont ordonnées par le flux, pas par les horloges, et qu'un événement appliqué deux fois ne change rien |
|
|
2209
2217
|
| `EventStoreProjectionRebuild` | Remplit une copie vide de la table en rejouant le store depuis la position zéro à travers la projection construite sur la copie (`ShadowReadModelStore`) ; puis, en une transaction, retient les écrivains, rejoue ce qui a été ajouté entre-temps et met la copie à la place de la table. L'abonnement continue depuis son point de reprise ; ce qu'il applique à nouveau est périmé face à la copie. Une reconstruction échouée laisse la table telle qu'elle était |
|
|
2210
2218
|
|
|
2211
2219
|
Une projection alimentée par le store n'applique que les événements du domaine de son contexte :
|
|
@@ -2285,7 +2293,7 @@ export class AttendanceRecord extends EventSourcedAggregate<AttendanceEvent, Att
|
|
|
2285
2293
|
| `appendChanges(aggregate, append)` | Ce qu'appelle un adaptateur de *repository* : les événements enregistrés depuis le chargement et la version que le flux doit encore avoir ; en cas de succès l'agrégat est à la nouvelle version |
|
|
2286
2294
|
| `EventStore` | Le port : `append(stream, expectedVersion, events)` (une `ConcurrencyError` quand quelqu'un a ajouté d'abord, rien n'en est gardé), `readStream(stream, after?)`, `readAll(after, limit)` dans l'ordre où les ajouts ont été validés, `head()`. `InMemoryEventStore` ici ; PostgreSQL par chaque adaptateur ORM. Tenu à `eventStoreContract` |
|
|
2287
2295
|
| `defineStoredEvent(Event, spec)` | Comment un événement est stocké : `version` de sa forme, `encode(event): NamedData` (données simples, dates gardées en texte ISO), `decode(data, envelope)` qui lit chaque champ par type (`data.text('x')`, `data.instant('at')`, `data.record('amount')`), et des `upcasters` depuis chaque version antérieure |
|
|
2288
|
-
| `EventSerializer<E>` | Chaque événement stocké d'un agrégat (`StoredEventTypes<E>` : une entrée par événement, sinon cela ne compile pas). Un événement stocké n'est jamais réécrit : il passe par un *upcaster* à la lecture. Un événement d'une forme plus récente que ce que connaît la version publiée, ou une version sans *upcaster*, est une `UnreadableEventError` |
|
|
2296
|
+
| `EventSerializer<E>` | Chaque événement stocké d'un agrégat (`StoredEventTypes<E>` : une entrée par événement, sinon cela ne compile pas). Un événement stocké n'est jamais réécrit : il passe par un *upcaster* à la lecture. Un événement est stocké sous sa propre identité (`eventIdOf`), qu'aucun générateur ne tire. Un événement d'une forme plus récente que ce que connaît la version publiée, ou une version sans *upcaster*, est une `UnreadableEventError` |
|
|
2289
2297
|
| `EventSourcedRepository` | Ce à quoi délègue l'adaptateur de *repository* : `findById` rejoue le flux `<category>-<id>` (depuis le dernier *snapshot*), `save` ajoute dans la transaction de l'unité de travail ; les événements partent ensuite avec l'enregistrement comme n'importe quels autres |
|
|
2290
2298
|
| `SnapshotPolicy` | Par agrégat : `every` tant d'événements, une `version` de la forme (une autre est ignorée, le flux rejoué), `encode`, qui scelle une valeur personnelle avec `personalData` comme dans un événement, et `decode`. `expectSnapshotEquivalence` de `@ddd-ts-kit/testing` prouve qu'un *snapshot* reconstruit l'état que donne un rejeu complet |
|
|
2291
2299
|
| `personalData(subject, value)` | Marque une valeur personnelle dans `encode`. `PersonalDataCipher` sur un `SubjectKeyStore` la scelle avec la clé de sa personne concernée (AES-256-GCM) ; `SubjectKeyStore.erase(subject)` détruit la clé, et un rejeu lit alors `ERASED_PERSONAL_DATA`. `decode` lit une valeur personnelle avec `data.personalText('x')`, `data.personalInstant('at')` ou `data.personal('email', Email.of)`, qui répondent `undefined` une fois la personne effacée : une valeur qui n'est pas un texte libre ne rend jamais l'agrégat illisible ; `data.isErased('x')` dit si elle l'a été. Le chiffreur ouvre une valeur effacée en `ErasedValue`, `{ $erased: { key } }`, jamais en texte : `data.text` la lit `ERASED_PERSONAL_DATA`, un texte qui se lit `[erased]` n'est pas pris pour elle, et un upcaster voit cette forme |
|