@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.md
CHANGED
|
@@ -15,7 +15,7 @@ their doubles), `@ddd-ts-kit/kernel/declarations` (the decorators with which a c
|
|
|
15
15
|
what it is, see "Declarations") and `@ddd-ts-kit/kernel/testing` (the recording buses of a
|
|
16
16
|
spec, see "The spec of a reaction").
|
|
17
17
|
|
|
18
|
-

|
|
19
19
|
|
|
20
20
|
The kernel says **what** a context needs (a `Clock`, a `UnitOfWork`, a `Logger`) and never
|
|
21
21
|
**how**: every port is an abstract class with abstract members only. Its implementations live
|
|
@@ -32,11 +32,11 @@ starts, so a business rule never changes with a library.
|
|
|
32
32
|
| Domain | `Entity`, `AggregateRoot` (version, recorded events), `ValueObject`, `DomainEvent`, `DomainError` with a stable `code`, `ConceptError` (the errors of one concept, each built by a static factory: see "Domain errors"), `DomainRefusal` (one class per refusal, built by static factories), `FactualRefusal`, `isRefusal`, `CodeOf`, `RefusalOf`, `Refusal`, `RefusalFacts`, the generic `InvariantViolation`, `NotFoundError`, `ConflictError` (and `UniqueViolationError`, a value a unique constraint keeps already held), `ConcurrencyError`, `PreconditionFailedError`, `Result` with `ok`, `err`, `unwrap` |
|
|
33
33
|
| Ports | `Clock`, `IdGenerator`, `UnitOfWork`, `Repository` (abstract classes: each one is its own injection token), `UseCase`, `DependencyKind` (the roles a binding declares, read by di, tracing and aspects: `repository`, `gateway`, `external`, `use-case`, `publisher`, `consumer`, `domain-event-handler`, `job`) |
|
|
34
34
|
| Buses | `Command`, `Query`, `CommandBus`, `QueryBus`, `BusMiddleware`, the in-process `InMemoryCommandBus` and `InMemoryQueryBus` (`register(type, handler, { context })` names the bounded context in `MessageInfo`), `unitOfWorkMiddleware` |
|
|
35
|
-
| Events | `IntegrationEvent`, `IntegrationEventPublisher`, `IntegrationEventSubscriber`, `EventBus` (both at once), `EventSubscribers` (the subscriber of each bounded context), `ProcessedEventStore`, `idempotent`, `InMemoryEventBus` (runs every handler of an event, then rejects with an `AggregateError` of
|
|
36
|
-
| Domain events and the unit of work | `dispatchingOnSave` (the wrapper that makes a repository hand over what the aggregates it is given recorded), `announceDomainEvents`, `
|
|
35
|
+
| Events | `IntegrationEvent`, `IntegrationEventPublisher`, `IntegrationEventSubscriber`, `EventBus` (both at once), `EventSubscribers` (the subscriber of each bounded context), `ProcessedEventStore`, `idempotent`, `InMemoryEventBus` (runs every handler of an event, then rejects with the failure of a single handler as it is, with its `code`, and with an `AggregateError` of several; an event is delivered and logged in `published` as a broker carries it, as JSON: a copy, a `Date` as its text, an event JSON cannot carry refused), `DomainEventDispatcher`, `IntegrationEventCallback` and `DomainEventCallback` (the functions a subscriber and a dispatcher are given), `executionContextOfEvent`, `inEventScope`, `scopedPublisher`, `EventDelivery` (what a provider says of one delivery: attempt, last attempt, transport, source, consumer), `messagingSystemOf` |
|
|
36
|
+
| Domain events and the unit of work | `dispatchingOnSave` (the wrapper that makes a repository hand over what the aggregates it is given recorded), `announceDomainEvents`, `unitOfWorkOver` (what every `UnitOfWork` is built on: queue, dispatch before the commit, `after-commit` phase), `UnscopedUnitOfWorkError`, `UnitOfWorkAbortedError`, `unitOfWorkStage` and `UnitOfWorkStage`, `DomainEventPhase`, `DomainEventSubscription`, `SaveAfterCommitError`, `AfterCommitFailure`, `reportAfterCommitFailures`, `InMemoryDomainEventDispatcher` |
|
|
37
37
|
| State machines | `defineStateMachine`, `StateMachine`, `TransitionError`, `InvalidStateMachineError`, `mermaidOfStateMachine` (see "State machines") |
|
|
38
38
|
| Actor | `Actor`, `AuthorizedCommand`, `AuthorizedQuery`, `ActorContext`, `systemActor` |
|
|
39
|
-
| Standard interfaces | `Session`, `ExecutionContext` and `ExecutionScope`, `Logger`, `Metrics`, `ErrorReporter`, `Cache`, `CacheInvalidation` and `CachePurger` (with `cacheTag`, `tenantCacheTags`, `CachePurgeRequest`, `PublishedCacheInvalidation`, `PurgingPublisher`, `RepeatedCachePurger`: see "Purging the HTTP caches"), `Lock`, `RateLimiter`, `Page` and `PageRequest`, `AuditStamp`, `TenantScoped`, `AuditTrail`, `AuditReader` and `AuditEntry` |
|
|
39
|
+
| Standard interfaces | `Session`, `ExecutionContext` and `ExecutionScope`, `Logger`, `Metrics`, `ErrorReporter`, `Cache`, `CacheInvalidation` and `CachePurger` (with `cacheTag`, `tenantCacheTags`, `CachePurgeRequest`, `PublishedCacheInvalidation`, `PurgingPublisher`, `RepeatedCachePurger`: see "Purging the HTTP caches"), `Lock`, `RateLimiter`, `Page` and `PageRequest`, `AuditStamp`, `TenantScoped`, `AuditTrail`, `AuditReader` and `AuditEntry`, `safely` (runs a hook, a logger or a meter and drops what it throws: observation never breaks what it observes) |
|
|
40
40
|
| Scheduled jobs | `JobScheduler`, `ScheduledJob`, `JobExecution`, `JobSchedule`, `JobOptions`, `JobDefinition`, `JobRun`, `JobDescription`, `parseJobSchedule`, `describeJobSchedule`, `jobPolicy`, `executionContextOfJob` |
|
|
41
41
|
| Background jobs | `JobQueue`, `BackgroundJob`, `BackgroundJobExecution`, `BackgroundJobPayloadSchema`, `processTimeoutDuePayload`, `EnqueueOptions`, `QueuedJob`, `QueuedJobStatus`, `backgroundJobPolicy`, `retryDelayMs`, `executionContextOfBackgroundJob`, `whenCommitted` (see "JobQueue") |
|
|
42
42
|
| Process managers | `ProcessManager`, `ProcessDecision`, `ProcessRunner`, `ProcessStore`, `InMemoryProcessStore`, `UnreadableProcessStateError` (see "ProcessRunner and ProcessStore") |
|
|
@@ -45,7 +45,7 @@ starts, so a business rule never changes with a library.
|
|
|
45
45
|
| Event sourcing | `EventSourcedAggregate`, `EventStore`, `defineStoredEvent`, `EventSerializer`, `EventSourcedRepository`, `SnapshotPolicy`, `personalData`, `PersonalDataCipher`, `CatchUpSubscription`, `EventStoreProjectionRebuild`, `InMemoryEventStore`, `PostgresEventStore` (see "Event sourcing") |
|
|
46
46
|
| Personal data | `personalFields`, `PersonalDataErasure`, `PersonalDataExport`, `eraseDataSubject`, `exportDataSubject`, `PersonalDataExportDocument`, `inEachTenant`, `recordsInEachTenant`, `isDataSubjectId`, `PersonalDataRecord`, `InMemoryPersonalData` (see "Personal data") |
|
|
47
47
|
| Read side | `Criteria`, `defineCriteria`, `validateCriteria`, `scoped`, `planCriteria`, `evaluateCriteria`, `pageOfPlan`, `hydrate`, `ReadModelStore`, `stampOf`, `TableReadModelStore`, `ProjectionRebuild`, `InMemoryReadModelStore` (see "Criteria", "Hydration" and "Projections") |
|
|
48
|
-
| Persistence helpers | `optimisticUpdate`, `expectVersion` (the version a caller read, `If-Match` over HTTP, still the current one, else `PreconditionFailedError`: 412), `schemaNameOf`, `stampCreation`, `stampUpdate`, `tenantScopeOf`, `encodeCursor`, `decodeCursor` |
|
|
48
|
+
| Persistence helpers | `aggregateMapper` (a mapper that declares the state and never the version), `loadedAt`, `optimisticUpdate`, `expectVersion` (the version a caller read, `If-Match` over HTTP, still the current one, else `PreconditionFailedError`: 412), `schemaNameOf`, `stampCreation`, `stampUpdate`, `restamped`, `tenantScopeOf`, `encodeCursor`, `decodeCursor` |
|
|
49
49
|
| Error reporting | `ErrorReporter`, `ErrorReport`, `errorReportOf`, `reportOnce`, `isUnexpectedError`, `errorReportingMiddleware`, `DeadLetterReports`, `reportProcessFailures`, `NoopErrorReporter` |
|
|
50
50
|
| Doubles | `FixedClock`, `SequentialIdGenerator`, `InMemoryUnitOfWork`, `FixedActorContext`, `FixedExecutionScope`, `InMemoryLogger`, `InMemoryMetrics`, `InMemoryErrorReporter`, `InMemoryCache`, `InMemoryCacheInvalidation`, `InMemoryCachePurger`, `InMemoryLock`, `InMemoryRateLimiter` |
|
|
51
51
|
| Testing (`@ddd-ts-kit/kernel/testing`) | `RecordingCommandBus`, `RecordingQueryBus`: buses that keep every message they are handed, in order (`executed`), and answer what the spec told them (`answering(type, answer)`), nothing otherwise (see "The spec of a reaction") |
|
|
@@ -60,7 +60,7 @@ file, and `ddd-ts-kit generate` writes them):
|
|
|
60
60
|
|
|
61
61
|
<!-- checked sample -->
|
|
62
62
|
```ts
|
|
63
|
-
import { AggregateRoot, DomainRefusal, Entity, ValueObject, NamedDomainEvent } from '@ddd-ts-kit/kernel';
|
|
63
|
+
import { AggregateRoot, DomainRefusal, Entity, ValueObject, NamedDomainEvent, recordedEventsOf } from '@ddd-ts-kit/kernel';
|
|
64
64
|
|
|
65
65
|
// The codes of the context, in <context>.codes.ts, and its refusals, one class each (see "Domain errors").
|
|
66
66
|
export const OrderingCodes = {
|
|
@@ -125,11 +125,11 @@ export class OrderLine extends Entity {
|
|
|
125
125
|
// A domain event: a fact of the past, named <context>.<aggregate>.<fact>.
|
|
126
126
|
export class OrderPlaced extends NamedDomainEvent('ordering.order.placed') {
|
|
127
127
|
constructor(
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
aggregateId: string,
|
|
129
|
+
occurredAt: Date,
|
|
130
130
|
readonly lineCount: number,
|
|
131
131
|
) {
|
|
132
|
-
super();
|
|
132
|
+
super(aggregateId, occurredAt);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -173,7 +173,7 @@ const order = Order.open('o-1');
|
|
|
173
173
|
order.add('p-7', Quantity.create(2));
|
|
174
174
|
order.place(new Date('2026-01-05T09:00:00Z'));
|
|
175
175
|
|
|
176
|
-
order
|
|
176
|
+
recordedEventsOf(order); // [OrderPlaced { aggregateId: 'o-1', lineCount: 1, ... }]
|
|
177
177
|
Quantity.create(2).equals(Quantity.create(2)); // true: same value
|
|
178
178
|
new OrderLine('p-7', Quantity.create(1)).equals(new OrderLine('p-7', Quantity.create(5))); // true: same identity
|
|
179
179
|
```
|
|
@@ -181,9 +181,9 @@ new OrderLine('p-7', Quantity.create(1)).equals(new OrderLine('p-7', Quantity.cr
|
|
|
181
181
|
| Block | What the kernel gives it |
|
|
182
182
|
|---|---|
|
|
183
183
|
| `Entity<Id>` | `id` and `equals`: two entities are equal when their class and their id are |
|
|
184
|
-
| `ValueObject<Props>` |
|
|
185
|
-
| `AggregateRoot<Id>` | an entity with `version`, the optimistic concurrency token its repository adapter
|
|
186
|
-
| `DomainEvent` | an interface: `name`, `occurredAt`, `aggregateId` |
|
|
184
|
+
| `ValueObject<Props>` | a copy of its `props` frozen in depth (`ValueObjectProps`: primitives, dates, value objects, lists and plain records of those), `equals` by value (dates by their time, lists and records deeply, a value object it holds by its own `equals`), `toJSON` |
|
|
185
|
+
| `AggregateRoot<Id>` | an entity with a read-only `version`, the optimistic concurrency token its repository adapter moves (`loadedAt`, `optimisticUpdate`), and `record(event)` for its methods. A save moves the version to the rank of the last event the aggregate recorded, and by one when it recorded none. The version and the recorded events are not enumerable: spreading, comparing or serialising an aggregate never sees them |
|
|
186
|
+
| `DomainEvent` | an interface: `name`, `occurredAt`, `aggregateId`. `NamedDomainEvent('<name>')` is its base class: it writes the name once and carries the other two, the id of the aggregate as text whatever its type, so an event with no fact of its own is `class OrderPlaced extends NamedDomainEvent('ordering.order.placed') {}`. The aggregate that records an event gives it its rank in its history, from 1 (`rankOf(event)`), and its identity follows from both: `eventIdOf(event)` is `<name>:<aggregateId>:<rank>`, the same for the event a save dispatches and for the one read back from a stream. A test that builds an event by hand says where it stands: `ranked(event, rank)` |
|
|
187
187
|
|
|
188
188
|
Instead of changing the state from outside, where every caller has to remember the rule:
|
|
189
189
|
|
|
@@ -283,7 +283,7 @@ The codes the packages of the kit raise are a list too, `KitCodes`, with its typ
|
|
|
283
283
|
`NotFound`, `Conflict`, `InvariantViolation`, `Unauthorized`, `NotAcceptable`, `ConcurrencyConflict`,
|
|
284
284
|
`InvalidCriteria`, `InvalidPageRequest`, `Timeout`, `CircuitOpen`, `BulkheadFull`, `AttemptsExhausted`,
|
|
285
285
|
`ServiceUnavailable`, `PreconditionFailed`, `PreconditionRequired`, `FileTooLarge`, `UnsupportedMediaType`,
|
|
286
|
-
`FileNotFound`, `FileRejected` and `
|
|
286
|
+
`FileNotFound`, `FileRejected`, `InvalidFileKey`, `InvalidFileUrlExpiry` and `ForbiddenTransition`. A route names them in `errors` and a test expects them
|
|
287
287
|
(`rejects.toMatchObject({ code: KitCodes.Forbidden })`) without writing the string: the editor completes
|
|
288
288
|
the key, and a misspelled one does not compile.
|
|
289
289
|
|
|
@@ -465,7 +465,7 @@ loads. Why, and the rule that holds the aggregate to it:
|
|
|
465
465
|
|
|
466
466
|
An effect of a domain event exists only if the state change that recorded it is committed.
|
|
467
467
|
|
|
468
|
-

|
|
469
469
|
|
|
470
470
|
An aggregate records its events; nothing in a use case hands them over. A repository wrapped
|
|
471
471
|
by `dispatchingOnSave(repository, () => dispatcher)` pulls them itself, once a method that was
|
|
@@ -491,7 +491,8 @@ failures, wrapper order) is in the README of that package. In short:
|
|
|
491
491
|
without recursion. Then the transaction commits.
|
|
492
492
|
- The events are pulled only when the call succeeded. The first `before-commit` handler that
|
|
493
493
|
fails rejects the unit of work; so does the work, a later save or the commit. The queued
|
|
494
|
-
events
|
|
494
|
+
events then reach no handler, and the aggregates the work saved are put back as it found them,
|
|
495
|
+
at the version they were loaded at and with their events: the same instances can be saved again.
|
|
495
496
|
- Outside any unit of work the save dispatches before it resolves, `before-commit` handlers
|
|
496
497
|
then `after-commit` ones.
|
|
497
498
|
|
|
@@ -507,14 +508,7 @@ import { NamedDomainEvent,
|
|
|
507
508
|
type DomainEvent,
|
|
508
509
|
} from '@ddd-ts-kit/kernel';
|
|
509
510
|
|
|
510
|
-
class CartOpened extends NamedDomainEvent('shop.cart.opened') {
|
|
511
|
-
constructor(
|
|
512
|
-
readonly aggregateId: string,
|
|
513
|
-
readonly occurredAt: Date,
|
|
514
|
-
) {
|
|
515
|
-
super();
|
|
516
|
-
}
|
|
517
|
-
}
|
|
511
|
+
class CartOpened extends NamedDomainEvent('shop.cart.opened') {}
|
|
518
512
|
|
|
519
513
|
class Cart extends AggregateRoot {
|
|
520
514
|
static open(id: string, now: Date): Cart {
|
|
@@ -560,9 +554,11 @@ await unitOfWork.run(async () => {
|
|
|
560
554
|
// after-commit c1, after-commit c2
|
|
561
555
|
```
|
|
562
556
|
|
|
563
|
-
|
|
564
|
-
a
|
|
565
|
-
|
|
557
|
+
An aggregate has no method that hands its events over. The wrapper takes them with
|
|
558
|
+
`takeRecordedEvents(aggregate)`, a function of the infrastructure that a use case and a repository
|
|
559
|
+
adapter never call; a spec reads them with `recordedBy(aggregate)` of `@ddd-ts-kit/testing`. What
|
|
560
|
+
the infrastructure keeps of an aggregate (its version, its recorded events) is keyed process-wide,
|
|
561
|
+
so a context compiled against another copy of the kernel is followed too.
|
|
566
562
|
|
|
567
563
|
### Two phases
|
|
568
564
|
|
|
@@ -635,26 +631,34 @@ export const sent = commands.executed; // [new ScheduleReminderCommand('invoice-
|
|
|
635
631
|
|
|
636
632
|
### A unit of work of your own
|
|
637
633
|
|
|
638
|
-
The queue lives in an `AsyncLocalStorage` scope opened by
|
|
639
|
-
`InMemoryUnitOfWork` and the units of work of the ORM
|
|
640
|
-
called directly (a consumer, a script) has the timing of a
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
of the
|
|
644
|
-
commands never share a scope
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
634
|
+
The queue lives in an `AsyncLocalStorage` scope opened by the unit of work that
|
|
635
|
+
`unitOfWorkOver(transaction)` answers. `InMemoryUnitOfWork` and the units of work of the ORM
|
|
636
|
+
packages are built on it, so a `run` called directly (a consumer, a script) has the timing of a
|
|
637
|
+
command. `unitOfWorkMiddleware` only calls `run`: a `UnitOfWork` that opens no scope is refused
|
|
638
|
+
before the handler (`UnscopedUnitOfWorkError`). A nested `run`, or a command sent from inside a
|
|
639
|
+
unit of work, joins the scope in progress: one dispatch, at the end of the outermost, and the
|
|
640
|
+
`after-commit` phase after the outermost commit. Two concurrent commands never share a scope,
|
|
641
|
+
and neither do two databases: a unit of work run inside the one of another database opens its
|
|
642
|
+
own transaction and dispatches its events before its own commit.
|
|
643
|
+
|
|
644
|
+
A unit of work commits or rolls back as a whole. A nested `run` that fails aborts it: when the
|
|
645
|
+
failure travels up, the outermost `run` rejects with it; when the work caught it and went on
|
|
646
|
+
(`await unitOfWork.run(step).catch(fallback)`, a retry around a command sent from a handler),
|
|
647
|
+
the outermost `run` rejects with a `UnitOfWorkAbortedError` whose `cause` is that failure,
|
|
648
|
+
before any event is dispatched. What the failed step wrote is never committed apart from the
|
|
649
|
+
rest: decide before the write, or let the failure through.
|
|
650
|
+
|
|
651
|
+
A `UnitOfWork` written in a project is built on it. `transaction` begins, calls what it is
|
|
652
|
+
given, commits when it resolved and rolls back when it rejected; it is called to open a
|
|
653
|
+
transaction, never by a `run` that joins one:
|
|
648
654
|
|
|
649
655
|
```ts
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
return scoped();
|
|
654
|
-
}
|
|
656
|
+
private readonly unitOfWork = unitOfWorkOver((work) =>
|
|
657
|
+
this.database.transaction((transaction) => this.current.run(transaction, work)),
|
|
658
|
+
);
|
|
655
659
|
|
|
656
|
-
|
|
657
|
-
|
|
660
|
+
run<T>(work: () => Promise<T>): Promise<T> {
|
|
661
|
+
return this.unitOfWork.run(work);
|
|
658
662
|
}
|
|
659
663
|
```
|
|
660
664
|
|
|
@@ -1138,7 +1142,8 @@ What every unit of work carries, whatever started it: `correlationId`, `causatio
|
|
|
1138
1142
|
`locale?`, `deadline?`, `scheduledAt?` (for a scheduled job, the instant it was due), `origin`
|
|
1139
1143
|
(`http`, `event`, `schedule`, `queue` for a background job, `cli`, or a string of the project)
|
|
1140
1144
|
and `extensions`. `executionContext(init)` builds one and takes the tenant of the actor;
|
|
1141
|
-
`withActor(context, actor)` is the same work seen as another actor
|
|
1145
|
+
`withActor(context, actor)` is the same work seen as another actor, without the session and
|
|
1146
|
+
the elevation of the previous one.
|
|
1142
1147
|
|
|
1143
1148
|
`ExecutionScope` (`current()`, `require()`, `run(context, work)`) gives the context of the work
|
|
1144
1149
|
in progress to code that is not handed it. The boundary sets it once:
|
|
@@ -1263,17 +1268,18 @@ logger and its children. Ask it before building fields that cost; the kit does,
|
|
|
1263
1268
|
`loggingMiddleware` and the scheduler. `NoopLogger` answers `false`.
|
|
1264
1269
|
|
|
1265
1270
|
**`flush()`** resolves once every entry logged so far, through the logger or a child, was
|
|
1266
|
-
handed to its destination, and never rejects. It
|
|
1267
|
-
the
|
|
1268
|
-
|
|
1269
|
-
|
|
1271
|
+
handed to its destination, and never rejects. It ends nothing: an entry logged afterwards is
|
|
1272
|
+
written like the others, by every logger of the kit, and a later call flushes it in turn. The
|
|
1273
|
+
application of `@ddd-ts-kit/di` calls it at the end of `stop()`, after the last entry of its
|
|
1274
|
+
modules.
|
|
1270
1275
|
|
|
1271
1276
|
`InMemoryLogger` takes `{ level?, fields?, base?, scrubMessages? }` like a real adapter: a
|
|
1272
1277
|
threshold (default `debug`, every entry), fields read at each entry, fields added to every
|
|
1273
1278
|
entry. Its `entries` hold what a logger writes: an error passed as a field is recorded as its
|
|
1274
1279
|
description. `CREDENTIAL_KEYS` and `REDACTED` are the field names and the marker `StdoutLogger`
|
|
1275
|
-
and the pino and winston adapters redact with
|
|
1276
|
-
|
|
1280
|
+
and the pino and winston adapters redact with. `hiddenKeys(added)` is the one question they
|
|
1281
|
+
ask of a field name: whether it is one of `CREDENTIAL_KEYS` (`isCredentialKey(name)`) or of the
|
|
1282
|
+
names a project adds through `redact`, without case. `InMemoryLogger` redacts nothing.
|
|
1277
1283
|
|
|
1278
1284
|
### Metrics
|
|
1279
1285
|
|
|
@@ -1335,7 +1341,9 @@ await cache.get(quoteKey('EUR-USD')); // undefined: expired, by the clock
|
|
|
1335
1341
|
```
|
|
1336
1342
|
|
|
1337
1343
|
The key carries the type of its value. `InMemoryCache(clock, { maxEntries? })` expires by the
|
|
1338
|
-
`Clock` and is bounded
|
|
1344
|
+
`Clock` and is bounded; it keeps and hands a value as a shared cache does, as JSON carries it: a
|
|
1345
|
+
copy at each write and each read, a `Date` as its text, a value JSON cannot carry (a bigint, a
|
|
1346
|
+
cycle) refused at the write. `tenantCacheKey<Quote>(scope, 'quote', pair)` is the same key confined to
|
|
1339
1347
|
the tenant of the work in progress: what one tenant cached is never served to another.
|
|
1340
1348
|
|
|
1341
1349
|
### Purging the HTTP caches
|
|
@@ -1664,7 +1672,7 @@ const row = { ...toRow(order), ...tenantScopeOf(scope), ...stampCreation(scope,
|
|
|
1664
1672
|
await update({ ...toRow(order), ...stampUpdate(scope, clock) }, { id: order.id, ...tenantScopeOf(scope) });
|
|
1665
1673
|
```
|
|
1666
1674
|
|
|
1667
|
-
`
|
|
1675
|
+
`restamped(stamp, scope, clock)` is for an adapter that holds the stored stamp (a
|
|
1668
1676
|
document store rewriting the whole record): it answers it whole, creation untouched.
|
|
1669
1677
|
`tenantScopeOf` raises `NoCurrentTenantError` for work that names no tenant, so a statement can
|
|
1670
1678
|
never run unscoped by omission. Every adapter package names the columns the same way:
|
|
@@ -1753,7 +1761,7 @@ return this.appointments.search(scoped(criteria, scope, { ids: 'id', filter: { t
|
|
|
1753
1761
|
From the handler to the store, a criteria is checked twice, and the scope of the actor travels
|
|
1754
1762
|
with it:
|
|
1755
1763
|
|
|
1756
|
-

|
|
1757
1765
|
|
|
1758
1766
|
**Checked by the compiler.** `where` takes a field of the row, an operator that applies to
|
|
1759
1767
|
what the field holds, and a value of its type: `where('seats', 'contains', '2')`, an order on
|
|
@@ -1992,7 +2000,7 @@ write happens only if its event is newer:
|
|
|
1992
2000
|
|
|
1993
2001
|
| Rule | |
|
|
1994
2002
|
|---|---|
|
|
1995
|
-
| Stamp | `stampOf(event)`: the id and the instant of an integration event
|
|
2003
|
+
| Stamp | `stampOf(event)`: the id and the instant of an integration event, plus `stampOf(event, version)` when its payload carries a per-key version; the identity and the instant of a domain event, with its rank in its aggregate as the version, so the events one command records are applied in the order of the aggregate even at the same instant. A key the events of several aggregates write has no single history: stamp it `{ eventId: eventIdOf(event), occurredAt: event.occurredAt }` |
|
|
1996
2004
|
| Newer | a greater `version` when both stamps carry one; else a later instant; at the same instant, the greater event id. The same event is never newer than itself. The order is total among stamps that all carry a version, and among stamps that carry none; between one of each the instants decide, which is not an order, so a key should see one kind ([one kind of stamp per key](../../docs/concepts/cqrs.md#which-write-for-which-event)) |
|
|
1997
2005
|
| `upsertIfNewer(key, stamp, next)` | for an event that says the whole row, or may create it: writes `next(current)`, `current` being `undefined` when the key holds no row; `stale` when the row holds this event or a later one; `ignored` when `next` answers `undefined`, which is a filter (the event does not concern this read model) and never the way to wait for a row |
|
|
1998
2006
|
| `updateIfNewer(key, stamp, change)` | for an event that changes part of a row another event created: writes `change(current)`; `stale` when the row, or the trace of its deletion, holds this event or a later one; `missing` when the key holds no row, the trace of a deletion older than the event, or a row of another tenant: nothing is written, the store never throws for it, and the projection decides. Right only when the events of the key are applied in order ([which write for which event](../../docs/concepts/cqrs.md#which-write-for-which-event)) |
|
|
@@ -2115,7 +2123,7 @@ await new EventStoreProjectionRebuild({
|
|
|
2115
2123
|
|---|---|
|
|
2116
2124
|
| `CatchUpSubscription` | Reads the store after the checkpoint of its subscriber (`CheckpointStore`), applies a batch and moves the checkpoint in one unit of work. A failure applies none of the batch; two runs of one subscriber never both move it (`ConcurrencyError`). A new projection starts at zero, so it catches up on the whole history |
|
|
2117
2125
|
| `applyingProjection(projection, serializer)` | (`@ddd-ts-kit/kernel/declarations`) hands each stored event an `@On` method applies, read back by the serializer of its aggregate, to that method; passes over the rest of the store |
|
|
2118
|
-
| `
|
|
2126
|
+
| `stampOf(event)` | The stamp of an event read back from the store is the one of the same event dispatched by its save: its identity, its instant and, as the version, its rank in its stream, so the rows of one stream are ordered by the stream, not by clocks, and an event applied twice changes nothing |
|
|
2119
2127
|
| `EventStoreProjectionRebuild` | Fills an empty copy of the table by replaying the store from position zero through the projection built over the copy (`ShadowReadModelStore`); then, in one transaction, holds the writers, replays what was appended meanwhile and puts the copy in place of the table. The subscription goes on from its checkpoint; what it applies again is stale against the copy. A failed rebuild leaves the table as it was |
|
|
2120
2128
|
|
|
2121
2129
|
A projection fed by the store applies the domain events of its context only: an integration
|
|
@@ -2195,7 +2203,7 @@ export class AttendanceRecord extends EventSourcedAggregate<AttendanceEvent, Att
|
|
|
2195
2203
|
| `appendChanges(aggregate, append)` | What a repository adapter calls: the events recorded since the load and the version the stream must still have; on success the aggregate is at the new version |
|
|
2196
2204
|
| `EventStore` | The port: `append(stream, expectedVersion, events)` (a `ConcurrencyError` when somebody appended first, nothing kept of it), `readStream(stream, after?)`, `readAll(after, limit)` in the order the appends committed, `head()`. `InMemoryEventStore` here; PostgreSQL through every ORM adapter. Held to `eventStoreContract` |
|
|
2197
2205
|
| `defineStoredEvent(Event, spec)` | How one event is stored: `version` of its shape, `encode(event): NamedData` (plain data, dates kept as ISO text), `decode(data, envelope)` reading each field by type (`data.text('x')`, `data.instant('at')`, `data.record('amount')`), and `upcasters` from each older version |
|
|
2198
|
-
| `EventSerializer<E>` | Every stored event of one aggregate (`StoredEventTypes<E>`: one entry per event, or it does not compile). A stored event is never rewritten: it is upcast when read. An event of a later shape than the release knows, or a version without upcaster, is an `UnreadableEventError` |
|
|
2206
|
+
| `EventSerializer<E>` | Every stored event of one aggregate (`StoredEventTypes<E>`: one entry per event, or it does not compile). A stored event is never rewritten: it is upcast when read. An event is stored under its own identity (`eventIdOf`), which no generator draws. An event of a later shape than the release knows, or a version without upcaster, is an `UnreadableEventError` |
|
|
2199
2207
|
| `EventSourcedRepository` | What the repository adapter delegates to: `findById` replays the stream `<category>-<id>` (from the last snapshot), `save` appends in the transaction of the unit of work; the events then leave with the save like any other |
|
|
2200
2208
|
| `SnapshotPolicy` | Per aggregate: `every` so many events, a `version` of the shape (another one is ignored, the stream replayed), `encode`, which seals a personal value with `personalData` as in an event, and `decode`. `expectSnapshotEquivalence` of `@ddd-ts-kit/testing` proves a snapshot rebuilds the state a full replay does |
|
|
2201
2209
|
| `personalData(subject, value)` | Marks a personal value in `encode`. `PersonalDataCipher` over a `SubjectKeyStore` seals it with the key of its data subject (AES-256-GCM); `SubjectKeyStore.erase(subject)` destroys the key, and a replay then reads `ERASED_PERSONAL_DATA`. `decode` reads a personal value with `data.personalText('x')`, `data.personalInstant('at')` or `data.personal('email', Email.of)`, which answer `undefined` once the subject is erased, so a value that is not free text never makes the aggregate unreadable; `data.isErased('x')` says whether it was. The cipher opens an erased value as an `ErasedValue`, `{ $erased: { key } }`, never as a text: `data.text` reads it `ERASED_PERSONAL_DATA`, a text that reads `[erased]` is not taken for one, and an upcaster sees that shape |
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Clock } from '../ports/clock.js';
|
|
2
|
+
import type { ExecutionScope } from '../ports/execution-scope.js';
|
|
3
|
+
import type { AuditStamp } from './audit-stamp.js';
|
|
4
|
+
/**
|
|
5
|
+
* For an adapter that holds the stored stamp, a document store rewriting the whole record: the
|
|
6
|
+
* stamp whole, updated by the current actor at the current instant, its creation kept as it is.
|
|
7
|
+
*/
|
|
8
|
+
export declare function restamped(stamp: AuditStamp, scope: ExecutionScope, clock: Clock): AuditStamp;
|
|
9
|
+
//# sourceMappingURL=restamped.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restamped.d.ts","sourceRoot":"","sources":["../../../src/application/audit/restamped.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,CAE5F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { stampUpdate } from './stamp-update.js';
|
|
2
|
+
/**
|
|
3
|
+
* For an adapter that holds the stored stamp, a document store rewriting the whole record: the
|
|
4
|
+
* stamp whole, updated by the current actor at the current instant, its creation kept as it is.
|
|
5
|
+
*/
|
|
6
|
+
export function restamped(stamp, scope, clock) {
|
|
7
|
+
return { ...stamp, ...stampUpdate(scope, clock) };
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=restamped.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restamped.js","sourceRoot":"","sources":["../../../src/application/audit/restamped.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,KAAqB,EAAE,KAAY;IAC9E,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { Clock } from '../ports/clock.js';
|
|
2
2
|
import type { ExecutionScope } from '../ports/execution-scope.js';
|
|
3
|
-
import type { AuditStamp } from './audit-stamp.js';
|
|
4
3
|
import type { UpdateStamp } from './update-stamp.js';
|
|
5
|
-
/**
|
|
6
|
-
* For a repository adapter updating a row. Given the stored stamp, answers it whole with the
|
|
7
|
-
* creation part kept as it is; given none, answers the two columns to set.
|
|
8
|
-
*/
|
|
4
|
+
/** For a repository adapter updating a row: the two columns to set, the current actor and instant. The creation is left alone. */
|
|
9
5
|
export declare function stampUpdate(scope: ExecutionScope, clock: Clock): UpdateStamp;
|
|
10
|
-
export declare function stampUpdate(stamp: AuditStamp, scope: ExecutionScope, clock: Clock): AuditStamp;
|
|
11
6
|
//# sourceMappingURL=stamp-update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stamp-update.d.ts","sourceRoot":"","sources":["../../../src/application/audit/stamp-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"stamp-update.d.ts","sourceRoot":"","sources":["../../../src/application/audit/stamp-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,kIAAkI;AAClI,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,WAAW,CAE5E"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return updateStamp(...args);
|
|
4
|
-
}
|
|
5
|
-
const [stamp, scope, clock] = args;
|
|
6
|
-
return { ...stamp, ...updateStamp(scope, clock) };
|
|
7
|
-
}
|
|
8
|
-
function updateStamp(scope, clock) {
|
|
1
|
+
/** For a repository adapter updating a row: the two columns to set, the current actor and instant. The creation is left alone. */
|
|
2
|
+
export function stampUpdate(scope, clock) {
|
|
9
3
|
return { updatedAt: clock.now(), updatedBy: scope.require().actor.id };
|
|
10
4
|
}
|
|
11
5
|
//# sourceMappingURL=stamp-update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stamp-update.js","sourceRoot":"","sources":["../../../src/application/audit/stamp-update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stamp-update.js","sourceRoot":"","sources":["../../../src/application/audit/stamp-update.ts"],"names":[],"mappings":"AAIA,kIAAkI;AAClI,MAAM,UAAU,WAAW,CAAC,KAAqB,EAAE,KAAY;IAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** What `enqueue` answers. */
|
|
2
2
|
export interface EnqueuedJob {
|
|
3
3
|
readonly id: string;
|
|
4
|
-
/** True when a job of the same name and idempotency key was already there: its id is answered and nothing is added. */
|
|
4
|
+
/** True when a job of the same name and idempotency key, or of the same id, was already there: its id is answered and nothing is added. */
|
|
5
5
|
readonly duplicate: boolean;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=enqueued-job.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enqueued-job.d.ts","sourceRoot":"","sources":["../../../src/application/background/enqueued-job.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"enqueued-job.d.ts","sourceRoot":"","sources":["../../../src/application/background/enqueued-job.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,2IAA2I;IAC3I,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report-once.d.ts","sourceRoot":"","sources":["../../../src/application/error-reporting/report-once.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"report-once.d.ts","sourceRoot":"","sources":["../../../src/application/error-reporting/report-once.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAU7F"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { safely } from '../observation/safely.js';
|
|
1
2
|
const REPORTED = new WeakSet();
|
|
2
3
|
const DEEPEST_CAUSE = 8;
|
|
3
4
|
/**
|
|
@@ -14,12 +15,7 @@ export function reportOnce(reporter, error, report) {
|
|
|
14
15
|
if (typeof error === 'object' && error !== null) {
|
|
15
16
|
REPORTED.add(error);
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
reporter.report(error, report);
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
18
|
+
safely(() => reporter.report(error, report));
|
|
23
19
|
}
|
|
24
20
|
function wasReported(error, depth) {
|
|
25
21
|
if (typeof error !== 'object' || error === null || depth === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report-once.js","sourceRoot":"","sources":["../../../src/application/error-reporting/report-once.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"report-once.js","sourceRoot":"","sources":["../../../src/application/error-reporting/report-once.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI/C,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAU,CAAC;AACvC,MAAM,aAAa,GAAG,CAAC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a stored event says besides its data, handed to `decode` to build the domain event back. */
|
|
2
2
|
export interface EventEnvelope {
|
|
3
|
+
/** The id the store holds the event under. */
|
|
3
4
|
readonly id: string;
|
|
4
5
|
readonly aggregateId: string;
|
|
5
6
|
readonly occurredAt: Date;
|
|
6
|
-
/** Its rank in its stream
|
|
7
|
+
/** Its rank in its stream, which the event built back is given: `rankOf(event)`. */
|
|
7
8
|
readonly version: number;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=event-envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../../../src/application/event-sourcing/event-envelope.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"event-envelope.d.ts","sourceRoot":"","sources":["../../../src/application/event-sourcing/event-envelope.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,oFAAoF;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StoredData } from './stored-data.js';
|
|
2
2
|
/** An event as the store is handed it: serialized, not yet placed in its stream. */
|
|
3
3
|
export interface EventToAppend {
|
|
4
|
-
/** Unique in the store
|
|
4
|
+
/** Unique in the store: the identity of the domain event, `eventIdOf(event)`. */
|
|
5
5
|
readonly id: string;
|
|
6
6
|
/** The name the domain event carries, `<context>.<aggregate>.<fact>`. */
|
|
7
7
|
readonly type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-to-append.d.ts","sourceRoot":"","sources":["../../../src/application/event-sourcing/event-to-append.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,
|
|
1
|
+
{"version":3,"file":"event-to-append.d.ts","sourceRoot":"","sources":["../../../src/application/event-sourcing/event-to-append.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;CAC3B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Actor } from '../actor/actor.js';
|
|
2
2
|
import type { ExecutionContext } from './execution-context.js';
|
|
3
3
|
/**
|
|
4
|
-
* The same unit of work seen as another actor. The session
|
|
5
|
-
* The tenant follows the new actor when it has one.
|
|
4
|
+
* The same unit of work seen as another actor. The session and the elevation go: they were the
|
|
5
|
+
* previous actor's. The tenant follows the new actor when it has one.
|
|
6
6
|
*/
|
|
7
7
|
export declare function withActor(context: ExecutionContext, actor: Actor): ExecutionContext;
|
|
8
8
|
//# sourceMappingURL=with-actor.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The same unit of work seen as another actor. The session
|
|
3
|
-
* The tenant follows the new actor when it has one.
|
|
2
|
+
* The same unit of work seen as another actor. The session and the elevation go: they were the
|
|
3
|
+
* previous actor's. The tenant follows the new actor when it has one.
|
|
4
4
|
*/
|
|
5
5
|
export function withActor(context, actor) {
|
|
6
6
|
if (context.actor === actor) {
|
|
7
7
|
return context;
|
|
8
8
|
}
|
|
9
|
-
const { session: _session, tenantId: _tenantId, ...rest } = context;
|
|
9
|
+
const { session: _session, elevation: _elevation, tenantId: _tenantId, ...rest } = context;
|
|
10
10
|
const tenantId = actor.tenantId ?? context.tenantId;
|
|
11
11
|
return Object.freeze({ ...rest, actor, ...(tenantId === undefined ? {} : { tenantId }) });
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-actor.js","sourceRoot":"","sources":["../../../src/application/execution/with-actor.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,OAAyB,EAAE,KAAY;IAC/D,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"with-actor.js","sourceRoot":"","sources":["../../../src/application/execution/with-actor.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,OAAyB,EAAE,KAAY;IAC/D,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAC3F,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IAEpD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AAC5F,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The reference to a file that an aggregate keeps, and all it keeps: the content lives in a
|
|
3
3
|
* `FileStorage`, never in the database. It names no provider, no bucket and no URL, so the
|
|
4
|
-
* connector can change without touching a row.
|
|
4
|
+
* connector can change without touching a row. A `type`, so that a value object can hold it.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type StoredFile = {
|
|
7
7
|
/** Generated by the server (`FileKeys`), never taken from the user. */
|
|
8
8
|
readonly key: string;
|
|
9
9
|
/** In bytes. */
|
|
@@ -12,5 +12,5 @@ export interface StoredFile {
|
|
|
12
12
|
readonly mediaType: string;
|
|
13
13
|
/** `sha256:<hex>` of the content, computed while it streamed. */
|
|
14
14
|
readonly checksum: string;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
//# sourceMappingURL=stored-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stored-file.d.ts","sourceRoot":"","sources":["../../../src/application/files/stored-file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,
|
|
1
|
+
{"version":3,"file":"stored-file.d.ts","sourceRoot":"","sources":["../../../src/application/files/stored-file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iEAAiE;IACjE,QAAQ,C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nings: [] };
|
|
63
63
|
const extras = await this.parts.complete(items, run);
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const [firstFailure] = run.failures.values();
|
|
65
|
+
if (run.failures.size > 0) {
|
|
66
|
+
throw firstFailure;
|
|
66
67
|
}
|
|
67
68
|
const hydrated = extras.flatMap((extra, index) => {
|
|
68
69
|
const row = items[index];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.js","sourceRoot":"","sources":["../../../src/application/hydration/hydration.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAOiB,KAAK;IAJ1C,MAAM,CAAC,EAAE,CAAqB,IAAe;QAC3C,OAAO,IAAI,SAAS,CAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;IACtH,CAAC;IAED,YAAqC,KAAwB;qBAAxB,KAAK;IAAsB,CAAC;IAEjE;;;OAGG;IACH,IAAI,CACF,IAAU,EACV,KAA8C,EAC9C,MAAyE;QAEzE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEhD,OAAO,IAAI,SAAS,CAAC;YACnB,IAAI;YACJ,QAAQ;YACR,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;gBAC5B,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;oBAC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EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;IAChE,CAAC;CACF;AAED,SAAS,OAAO,CAAC,GAAiB,EAAE,QAAgB;IAClD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,qBAAqB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,eAAe,CAAC;IAEhH,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC9B,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Whether a field of that name is written as `REDACTED` instead of its value. */
|
|
2
|
+
export type IsHiddenKey = (name: string) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* The one question a redacting logger asks of a field name, wherever the field comes from: is it
|
|
5
|
+
* one of `CREDENTIAL_KEYS` or of the names a project adds to them, whatever its case.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hiddenKeys(added?: readonly string[]): IsHiddenKey;
|
|
8
|
+
//# sourceMappingURL=hidden-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-keys.d.ts","sourceRoot":"","sources":["../../../src/application/logging/hidden-keys.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,WAAW,CAIrE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isCredentialKey } from './is-credential-key.js';
|
|
2
|
+
/**
|
|
3
|
+
* The one question a redacting logger asks of a field name, wherever the field comes from: is it
|
|
4
|
+
* one of `CREDENTIAL_KEYS` or of the names a project adds to them, whatever its case.
|
|
5
|
+
*/
|
|
6
|
+
export function hiddenKeys(added = []) {
|
|
7
|
+
const names = new Set(added.map((name) => name.toLowerCase()));
|
|
8
|
+
return (name) => isCredentialKey(name) || names.has(name.toLowerCase());
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=hidden-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hidden-keys.js","sourceRoot":"","sources":["../../../src/application/logging/hidden-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAKtD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAK,GAAsB,EAAE;IACtD,MAAM,KAAK,GAAwB,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAEpF,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|