@ddd-ts-kit/kernel 0.114.1 → 0.116.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 +74 -60
- package/README.md +68 -55
- 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 +10 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -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 +14 -0
- package/dist/infrastructure/domain-events/index.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/index.js +14 -0
- package/dist/infrastructure/domain-events/index.js.map +1 -0
- package/dist/infrastructure/domain-events/on-rollback.d.ts +10 -0
- package/dist/infrastructure/domain-events/on-rollback.d.ts.map +1 -0
- package/dist/infrastructure/domain-events/on-rollback.js +17 -0
- package/dist/infrastructure/domain-events/on-rollback.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 +37 -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 +146 -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 +11 -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-checkpoint-store.d.ts +1 -1
- package/dist/infrastructure/in-memory/in-memory-checkpoint-store.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-checkpoint-store.js +3 -2
- package/dist/infrastructure/in-memory/in-memory-checkpoint-store.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 +8 -2
- package/dist/infrastructure/in-memory/in-memory-event-store.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-event-store.js +29 -14
- package/dist/infrastructure/in-memory/in-memory-event-store.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-process-store.d.ts +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 +7 -8
- 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 +1 -0
- 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 +6 -6
- package/dist/infrastructure/in-memory/in-memory-processed-event-store.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-read-model-table.d.ts +2 -1
- package/dist/infrastructure/in-memory/in-memory-read-model-table.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-read-model-table.js +5 -3
- package/dist/infrastructure/in-memory/in-memory-read-model-table.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.d.ts +1 -1
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.d.ts.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.js +3 -2
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.js.map +1 -1
- package/dist/infrastructure/in-memory/in-memory-unit-of-work.d.ts +5 -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 +7 -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/rollback-map.d.ts +15 -0
- package/dist/infrastructure/in-memory/rollback-map.d.ts.map +1 -0
- package/dist/infrastructure/in-memory/rollback-map.js +52 -0
- package/dist/infrastructure/in-memory/rollback-map.js.map +1 -0
- 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 +1 -1
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-actor-context.js","sourceRoot":"","sources":["../../../src/infrastructure/context/scoped-actor-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"scoped-actor-context.js","sourceRoot":"","sources":["../../../src/infrastructure/context/scoped-actor-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAEV,KAAK;IACL,cAAc;IAFjC,YACmB,KAAqB,EACrB,cAA2B;qBAD3B,KAAK;8BACL,cAAc;IAC9B,CAAC;IAEJ,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC;IACrC,CAAC;IAED,OAAO;QACL,OAAO,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,GAAG,CAAI,KAAY,EAAE,IAAa;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAErC,MAAM,OAAO,GACX,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,gBAAgB,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;YAC5F,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEhC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -5,7 +5,7 @@ import type { DomainEvent } from '../../domain/domain-event.js';
|
|
|
5
5
|
* Hands over the events a save pulled from its aggregates.
|
|
6
6
|
*
|
|
7
7
|
* Inside a unit of work they only join its queue, behind what earlier saves recorded: the unit
|
|
8
|
-
* of work dispatches them at its end, before the commit (`
|
|
8
|
+
* of work dispatches them at its end, before the commit (`unitOfWorkOver`), and the promise
|
|
9
9
|
* resolves at once.
|
|
10
10
|
*
|
|
11
11
|
* Outside of any, the save is all there is to wait for: they are dispatched now, `before-commit`
|
|
@@ -9,7 +9,7 @@ import { unitOfWorkScope } from './unit-of-work-scope.js';
|
|
|
9
9
|
* Hands over the events a save pulled from its aggregates.
|
|
10
10
|
*
|
|
11
11
|
* Inside a unit of work they only join its queue, behind what earlier saves recorded: the unit
|
|
12
|
-
* of work dispatches them at its end, before the commit (`
|
|
12
|
+
* of work dispatches them at its end, before the commit (`unitOfWorkOver`), and the promise
|
|
13
13
|
* resolves at once.
|
|
14
14
|
*
|
|
15
15
|
* Outside of any, the save is all there is to wait for: they are dispatched now, `before-commit`
|
|
@@ -16,7 +16,7 @@ type Scoping = () => ExecutionScope | undefined;
|
|
|
16
16
|
* The repository is wrapped in place, as tracing and the aspects do, so the same object is
|
|
17
17
|
* answered and wrapping twice is a no-op; a sealed or frozen one is fronted by a proxy. The
|
|
18
18
|
* dispatcher is asked for at each dispatch. An adapter contains no dispatch code: one that
|
|
19
|
-
*
|
|
19
|
+
* takes the events itself leaves nothing to dispatch here.
|
|
20
20
|
*
|
|
21
21
|
* Given the execution scope, the handlers run in the execution context of the save (its tenant, its
|
|
22
22
|
* actor, its correlation id), also when the unit of work that dispatches them was opened in another:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatching-on-save.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/dispatching-on-save.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatching-on-save.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/dispatching-on-save.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAS9E,KAAK,WAAW,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;AAEjE,6GAA6G;AAC7G,KAAK,OAAO,GAAG,MAAM,cAAc,GAAG,SAAS,CAAC;AAIhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,CAAC,CAgB9G"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { takeRecordedEvents } from '../aggregates/take-recorded-events.js';
|
|
1
2
|
import { announceDomainEvents } from './announce-domain-events.js';
|
|
2
3
|
import { recordedAggregates } from './recorded-aggregates.js';
|
|
3
4
|
import { SaveAfterCommitError } from './save-after-commit-error.js';
|
|
@@ -16,7 +17,7 @@ const wrapped = new WeakSet();
|
|
|
16
17
|
* The repository is wrapped in place, as tracing and the aspects do, so the same object is
|
|
17
18
|
* answered and wrapping twice is a no-op; a sealed or frozen one is fronted by a proxy. The
|
|
18
19
|
* dispatcher is asked for at each dispatch. An adapter contains no dispatch code: one that
|
|
19
|
-
*
|
|
20
|
+
* takes the events itself leaves nothing to dispatch here.
|
|
20
21
|
*
|
|
21
22
|
* Given the execution scope, the handlers run in the execution context of the save (its tenant, its
|
|
22
23
|
* actor, its correlation id), also when the unit of work that dispatches them was opened in another:
|
|
@@ -58,7 +59,7 @@ function isMethod(value) {
|
|
|
58
59
|
function announcing(original, dispatcher, scope) {
|
|
59
60
|
const announced = async (args, result) => {
|
|
60
61
|
const value = await result;
|
|
61
|
-
await announceDomainEvents(recordedAggregates(args).flatMap(
|
|
62
|
+
await announceDomainEvents(recordedAggregates(args).flatMap(takeRecordedEvents), dispatcher(), scope?.());
|
|
62
63
|
return value;
|
|
63
64
|
};
|
|
64
65
|
const wrapper = original.constructor.name === 'AsyncFunction'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatching-on-save.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/dispatching-on-save.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AASvD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAU,CAAC;AAEtC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,iBAAiB,CAAmB,UAAa,EAAE,UAAuB,EAAE,KAAe;IACzG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE3C,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QACnD,QAAQ,CAAC,GAAG,CAAC,I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C5D,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './after-commit.js';
|
|
2
|
+
export * from './announce-domain-events.js';
|
|
3
|
+
export * from './at-commit.js';
|
|
4
|
+
export * from './commit-step.js';
|
|
5
|
+
export * from './dispatching-on-save.js';
|
|
6
|
+
export * from './on-rollback.js';
|
|
7
|
+
export * from './report-after-commit-failures.js';
|
|
8
|
+
export * from './save-after-commit-error.js';
|
|
9
|
+
export * from './unit-of-work-aborted-error.js';
|
|
10
|
+
export * from './unit-of-work-over.js';
|
|
11
|
+
export * from './unit-of-work-stage.js';
|
|
12
|
+
export * from './unscoped-unit-of-work-error.js';
|
|
13
|
+
export * from './when-committed.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './after-commit.js';
|
|
2
|
+
export * from './announce-domain-events.js';
|
|
3
|
+
export * from './at-commit.js';
|
|
4
|
+
export * from './commit-step.js';
|
|
5
|
+
export * from './dispatching-on-save.js';
|
|
6
|
+
export * from './on-rollback.js';
|
|
7
|
+
export * from './report-after-commit-failures.js';
|
|
8
|
+
export * from './save-after-commit-error.js';
|
|
9
|
+
export * from './unit-of-work-aborted-error.js';
|
|
10
|
+
export * from './unit-of-work-over.js';
|
|
11
|
+
export * from './unit-of-work-stage.js';
|
|
12
|
+
export * from './unscoped-unit-of-work-error.js';
|
|
13
|
+
export * from './when-committed.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* For a store in memory, which no transaction covers: called inside a unit of work, `undo` runs
|
|
3
|
+
* when it rolls back, newest first, once the aggregates are given back and the commit steps
|
|
4
|
+
* undone, before the caller gets the failure; never when it commits. Outside of any unit of
|
|
5
|
+
* work, nothing is kept: a write made alone has nothing to roll back. `undo` puts back what the
|
|
6
|
+
* write found, and leaves what a later write changed: a command running alongside may have
|
|
7
|
+
* committed over it. A `RollbackMap` is the store that does so for each of its keys.
|
|
8
|
+
*/
|
|
9
|
+
export declare function onRollback(undo: () => void): void;
|
|
10
|
+
//# sourceMappingURL=on-rollback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-rollback.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/on-rollback.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI,CAOjD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { unitOfWorkScope } from './unit-of-work-scope.js';
|
|
2
|
+
/**
|
|
3
|
+
* For a store in memory, which no transaction covers: called inside a unit of work, `undo` runs
|
|
4
|
+
* when it rolls back, newest first, once the aggregates are given back and the commit steps
|
|
5
|
+
* undone, before the caller gets the failure; never when it commits. Outside of any unit of
|
|
6
|
+
* work, nothing is kept: a write made alone has nothing to roll back. `undo` puts back what the
|
|
7
|
+
* write found, and leaves what a later write changed: a command running alongside may have
|
|
8
|
+
* committed over it. A `RollbackMap` is the store that does so for each of its keys.
|
|
9
|
+
*/
|
|
10
|
+
export function onRollback(undo) {
|
|
11
|
+
const scope = unitOfWorkScope.getStore();
|
|
12
|
+
const open = scope?.kind === 'unit-of-work' && (scope.stage === 'open' || scope.stage === 'before-commit');
|
|
13
|
+
if (open) {
|
|
14
|
+
scope.rolledBack?.push(undo);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=on-rollback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-rollback.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/on-rollback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,KAAK,cAAc,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,eAAe,CAAC,CAAC;IAE3G,IAAI,IAAI,EAAE,CAAC;QACT,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { AggregateRoot } from '../../domain/aggregate-root.js';
|
|
2
|
-
type EventSource = Pick<AggregateRoot<string | number>, 'pullEvents'>;
|
|
3
1
|
/**
|
|
4
2
|
* The aggregates among the arguments of a call, given as such or in arrays, in the order
|
|
5
|
-
* written. Recognised by what they
|
|
3
|
+
* written. Recognised by what they carry, not by their class: a context compiled apart extends
|
|
6
4
|
* its own copy of `AggregateRoot`.
|
|
7
5
|
*/
|
|
8
|
-
export declare function recordedAggregates(args: readonly unknown[]):
|
|
9
|
-
export {};
|
|
6
|
+
export declare function recordedAggregates(args: readonly unknown[]): object[];
|
|
10
7
|
//# sourceMappingURL=recorded-aggregates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorded-aggregates.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/recorded-aggregates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recorded-aggregates.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/recorded-aggregates.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,EAAE,CAErE"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
import { AggregateTracking } from '../../domain/aggregate-tracking.js';
|
|
1
2
|
/**
|
|
2
3
|
* The aggregates among the arguments of a call, given as such or in arrays, in the order
|
|
3
|
-
* written. Recognised by what they
|
|
4
|
+
* written. Recognised by what they carry, not by their class: a context compiled apart extends
|
|
4
5
|
* its own copy of `AggregateRoot`.
|
|
5
6
|
*/
|
|
6
7
|
export function recordedAggregates(args) {
|
|
7
|
-
return args.flatMap(listOf).filter(
|
|
8
|
+
return args.flatMap(listOf).filter((argument) => AggregateTracking.follows(argument));
|
|
8
9
|
}
|
|
9
10
|
function listOf(argument) {
|
|
10
11
|
return Array.isArray(argument) ? argument : [argument];
|
|
11
12
|
}
|
|
12
|
-
function isEventSource(value) {
|
|
13
|
-
return typeof value === 'object' && value !== null && 'pullEvents' in value && typeof value.pullEvents === 'function';
|
|
14
|
-
}
|
|
15
13
|
//# sourceMappingURL=recorded-aggregates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorded-aggregates.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/recorded-aggregates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recorded-aggregates.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/recorded-aggregates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAwB;IACzD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,SAAS,MAAM,CAAC,QAAiB;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `run` that joined the unit of work failed, and its failure did not reach the outermost one:
|
|
3
|
+
* the work caught it and went on. What that run wrote before it failed is in the transaction, so
|
|
4
|
+
* committing would keep a part of it: the unit of work rolls back as a whole instead. The
|
|
5
|
+
* failure of the joined run is the `cause`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UnitOfWorkAbortedError extends Error {
|
|
8
|
+
constructor(cause: unknown);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=unit-of-work-aborted-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-of-work-aborted-error.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-aborted-error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,KAAK,EAAE,OAAO,EAOzB;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `run` that joined the unit of work failed, and its failure did not reach the outermost one:
|
|
3
|
+
* the work caught it and went on. What that run wrote before it failed is in the transaction, so
|
|
4
|
+
* committing would keep a part of it: the unit of work rolls back as a whole instead. The
|
|
5
|
+
* failure of the joined run is the `cause`.
|
|
6
|
+
*/
|
|
7
|
+
export class UnitOfWorkAbortedError extends Error {
|
|
8
|
+
constructor(cause) {
|
|
9
|
+
super('A run that joined this unit of work failed and its failure was caught: nothing of the unit of work is committed. Let the failure reach the outermost run, or decide before the write instead of catching after it.', { cause });
|
|
10
|
+
this.name = 'UnitOfWorkAbortedError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=unit-of-work-aborted-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-of-work-aborted-error.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-aborted-error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,KAAc;QACxB,KAAK,CACH,oNAAoN,EACpN,EAAE,KAAK,EAAE,CACV,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { UnitOfWork } from '../../application/ports/unit-of-work.js';
|
|
2
|
+
/** Runs what it is given atomically: it begins, calls it, and commits when it resolved or rolls back when it rejected. */
|
|
3
|
+
type Transaction = <T>(work: () => Promise<T>) => Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* What every `UnitOfWork` is made of: the unit of work over the transactions of one database.
|
|
6
|
+
*
|
|
7
|
+
* The domain events of the aggregates saved by the work of a `run` wait in the scope of this
|
|
8
|
+
* unit of work, in recording order across the saves. Once the work has returned they are
|
|
9
|
+
* dispatched, still inside `transaction`: the handlers see every save, and what they save or
|
|
10
|
+
* append to the outbox commits with the rest. A handler that fails, like the work that fails,
|
|
11
|
+
* rejects the whole: the transaction rolls back, the waiting events reach no handler, and the
|
|
12
|
+
* aggregates the work saved are put back as it found them, at the version they were loaded at and
|
|
13
|
+
* with the events they had recorded, so the same instances can be saved again. The steps handed to
|
|
14
|
+
* `atCommit` are applied last, still inside `transaction`; when it rejects, those applied are
|
|
15
|
+
* undone, then what was handed to `onRollback`, newest first: what the stores in memory wrote.
|
|
16
|
+
* Once `transaction` has resolved, and only then, the `after-commit` handlers run, then the work
|
|
17
|
+
* handed to `afterCommit`.
|
|
18
|
+
*
|
|
19
|
+
* A deadlock or a serialization failure the database raised anywhere in the transaction, on the
|
|
20
|
+
* statement it chose, rejects the outermost `run` as a `TransactionConflictError`, a
|
|
21
|
+
* `ConcurrencyError` whose `cause` is the error of the driver: the caller runs it again. A
|
|
22
|
+
* transaction its ORM could not start in time, the pool being busy, or ended for running too
|
|
23
|
+
* long rejects it as a `TransactionTimeoutError` (`SERVICE_UNAVAILABLE`), the same way.
|
|
24
|
+
*
|
|
25
|
+
* `transaction` is called to open one, never to join: a `run` called while a transaction of
|
|
26
|
+
* this unit of work is open on the asynchronous call chain joins it, its work and nothing else,
|
|
27
|
+
* so one dispatch, at the end of the outermost. A unit of work over another database is another
|
|
28
|
+
* one, wherever it is called from: its own transaction, and its own events dispatched before its
|
|
29
|
+
* own commit. Two concurrent calls never share a scope.
|
|
30
|
+
*
|
|
31
|
+
* It commits or rolls back as a whole: once a `run` that joined has failed, the outermost one
|
|
32
|
+
* rejects, with that failure when it travelled up, with a `UnitOfWorkAbortedError` whose
|
|
33
|
+
* `cause` it is when the work caught it, a retry that then succeeded included.
|
|
34
|
+
*/
|
|
35
|
+
export declare function unitOfWorkOver(transaction: Transaction): UnitOfWork;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=unit-of-work-over.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-of-work-over.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-over.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAYvE,0HAA0H;AAC1H,KAAK,WAAW,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,CAmBnE"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { TransactionConflictError } from '../../domain/errors/transaction-conflict-error.js';
|
|
3
|
+
import { isTransactionConflict } from '../persistence/is-transaction-conflict.js';
|
|
4
|
+
import { isTransactionTimeout } from '../persistence/is-transaction-timeout.js';
|
|
5
|
+
import { TransactionTimeoutError } from '../persistence/transaction-timeout-error.js';
|
|
6
|
+
import { giveBack } from '../aggregates/give-back.js';
|
|
7
|
+
import { dispatchAfterCommit } from './dispatch-after-commit.js';
|
|
8
|
+
import { dispatchBeforeCommit } from './dispatch-before-commit.js';
|
|
9
|
+
import { UnitOfWorkAbortedError } from './unit-of-work-aborted-error.js';
|
|
10
|
+
import { unitOfWorkScope } from './unit-of-work-scope.js';
|
|
11
|
+
/**
|
|
12
|
+
* What every `UnitOfWork` is made of: the unit of work over the transactions of one database.
|
|
13
|
+
*
|
|
14
|
+
* The domain events of the aggregates saved by the work of a `run` wait in the scope of this
|
|
15
|
+
* unit of work, in recording order across the saves. Once the work has returned they are
|
|
16
|
+
* dispatched, still inside `transaction`: the handlers see every save, and what they save or
|
|
17
|
+
* append to the outbox commits with the rest. A handler that fails, like the work that fails,
|
|
18
|
+
* rejects the whole: the transaction rolls back, the waiting events reach no handler, and the
|
|
19
|
+
* aggregates the work saved are put back as it found them, at the version they were loaded at and
|
|
20
|
+
* with the events they had recorded, so the same instances can be saved again. The steps handed to
|
|
21
|
+
* `atCommit` are applied last, still inside `transaction`; when it rejects, those applied are
|
|
22
|
+
* undone, then what was handed to `onRollback`, newest first: what the stores in memory wrote.
|
|
23
|
+
* Once `transaction` has resolved, and only then, the `after-commit` handlers run, then the work
|
|
24
|
+
* handed to `afterCommit`.
|
|
25
|
+
*
|
|
26
|
+
* A deadlock or a serialization failure the database raised anywhere in the transaction, on the
|
|
27
|
+
* statement it chose, rejects the outermost `run` as a `TransactionConflictError`, a
|
|
28
|
+
* `ConcurrencyError` whose `cause` is the error of the driver: the caller runs it again. A
|
|
29
|
+
* transaction its ORM could not start in time, the pool being busy, or ended for running too
|
|
30
|
+
* long rejects it as a `TransactionTimeoutError` (`SERVICE_UNAVAILABLE`), the same way.
|
|
31
|
+
*
|
|
32
|
+
* `transaction` is called to open one, never to join: a `run` called while a transaction of
|
|
33
|
+
* this unit of work is open on the asynchronous call chain joins it, its work and nothing else,
|
|
34
|
+
* so one dispatch, at the end of the outermost. A unit of work over another database is another
|
|
35
|
+
* one, wherever it is called from: its own transaction, and its own events dispatched before its
|
|
36
|
+
* own commit. Two concurrent calls never share a scope.
|
|
37
|
+
*
|
|
38
|
+
* It commits or rolls back as a whole: once a `run` that joined has failed, the outermost one
|
|
39
|
+
* rejects, with that failure when it travelled up, with a `UnitOfWorkAbortedError` whose
|
|
40
|
+
* `cause` it is when the work caught it, a retry that then succeeded included.
|
|
41
|
+
*/
|
|
42
|
+
export function unitOfWorkOver(transaction) {
|
|
43
|
+
// The scope of the transaction of this unit of work open on the asynchronous call chain.
|
|
44
|
+
const open = new AsyncLocalStorage();
|
|
45
|
+
return {
|
|
46
|
+
run(work) {
|
|
47
|
+
const joined = open.getStore();
|
|
48
|
+
if (isRunning(joined)) {
|
|
49
|
+
return joining(joined, work);
|
|
50
|
+
}
|
|
51
|
+
const scope = openScope();
|
|
52
|
+
return opened(work, scope, (scoped) => open.run(scope, () => unitOfWorkScope.run(scope, () => transaction(scoped))));
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** The work of a run that joined: its failure aborts the unit of work, whatever the caller does with it. */
|
|
57
|
+
async function joining(scope, work) {
|
|
58
|
+
try {
|
|
59
|
+
return await unitOfWorkScope.run(scope, work);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
scope.abortedBy ??= { failure: error };
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The outermost run: the work, the dispatch and the commit steps inside `transaction`, the rest once it resolved. */
|
|
67
|
+
async function opened(work, scope, transaction) {
|
|
68
|
+
const applied = [];
|
|
69
|
+
const result = await transaction(() => thenDispatched(work, scope, applied))
|
|
70
|
+
.catch(async (error) => {
|
|
71
|
+
giveBack(scope.found);
|
|
72
|
+
await undone(applied);
|
|
73
|
+
rolledBack(scope);
|
|
74
|
+
throw translated(error);
|
|
75
|
+
})
|
|
76
|
+
.finally(() => {
|
|
77
|
+
scope.stage = 'closed';
|
|
78
|
+
scope.queue.length = 0;
|
|
79
|
+
});
|
|
80
|
+
await afterTheCommit(scope);
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
/** What the database said of the transaction, in the words of the kernel; any other failure as it is. */
|
|
84
|
+
function translated(error) {
|
|
85
|
+
if (isTransactionConflict(error)) {
|
|
86
|
+
return new TransactionConflictError(error);
|
|
87
|
+
}
|
|
88
|
+
return isTransactionTimeout(error) ? new TransactionTimeoutError(error) : error;
|
|
89
|
+
}
|
|
90
|
+
function isRunning(scope) {
|
|
91
|
+
return scope?.kind === 'unit-of-work' && (scope.stage === 'open' || scope.stage === 'before-commit');
|
|
92
|
+
}
|
|
93
|
+
function openScope() {
|
|
94
|
+
return {
|
|
95
|
+
kind: 'unit-of-work',
|
|
96
|
+
stage: 'open',
|
|
97
|
+
queue: [],
|
|
98
|
+
dispatched: [],
|
|
99
|
+
committed: [],
|
|
100
|
+
atCommit: [],
|
|
101
|
+
rolledBack: [],
|
|
102
|
+
found: new Map(),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async function thenDispatched(work, scope, applied) {
|
|
106
|
+
const result = await work();
|
|
107
|
+
refuseAborted(scope);
|
|
108
|
+
await dispatchBeforeCommit(scope);
|
|
109
|
+
refuseAborted(scope);
|
|
110
|
+
for (const step of scope.atCommit ?? []) {
|
|
111
|
+
await step.apply();
|
|
112
|
+
applied.push(step);
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
/** Asked before the events leave and again before the commit: a handler may have caught such a failure too. */
|
|
117
|
+
function refuseAborted({ abortedBy }) {
|
|
118
|
+
if (abortedBy !== undefined) {
|
|
119
|
+
throw new UnitOfWorkAbortedError(abortedBy.failure);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** Newest first; an undo that fails reported itself, and the others still run. */
|
|
123
|
+
async function undone(applied) {
|
|
124
|
+
for (const step of [...applied].reverse()) {
|
|
125
|
+
await step.undo().catch(() => undefined);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** Newest first, what the stores in memory wrote; an undo that throws is dropped, and the others still run. */
|
|
129
|
+
function rolledBack({ rolledBack: undos = [] }) {
|
|
130
|
+
for (const undo of [...undos].reverse()) {
|
|
131
|
+
try {
|
|
132
|
+
undo();
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// The failure the caller gets is the one that rolled the unit of work back.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/** The `after-commit` handlers, then the work handed to `afterCommit`; a rejection is dropped, the work reported its own. */
|
|
140
|
+
async function afterTheCommit(scope) {
|
|
141
|
+
await dispatchAfterCommit(scope);
|
|
142
|
+
for (const work of scope.committed ?? []) {
|
|
143
|
+
await work().catch(() => undefined);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=unit-of-work-over.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit-of-work-over.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-over.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAwB,MAAM,sBAAsB,CAAC;AAK7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,cAAc,CAAC,WAAwB;IACrD,yFAAyF;IACzF,MAAM,IAAI,GAAG,IAAI,iBAAiB,EAAmB,CAAC;IAEtD,OAAO;QACL,GAAG,CAAI,IAAsB;YAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAE/B,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;gBACtB,OAAO,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC/B,CAAC;YAED,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;YAE1B,OAAO,MAA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,EAAmB;IACnD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,sBAAsB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,KAAK,UAAU,MAAM,CAAC,OAA8B;IAClD,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1C,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,+GAA+G;AAC/G,SAAS,UAAU,CAAC,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,EAAmB;IAC7D,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,IAAI,EAAE,CAAC;QACT,CAAC;QAAC,MAAM,CAAC;YACP,4EAA4E;QAC9E,CAAC;IACH,CAAC;AACH,CAAC;AAED,6HAA6H;AAC7H,KAAK,UAAU,cAAc,CAAC,KAAsB;IAClD,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import type { DomainEventDispatcher } from '../../application/ports/domain-event-dispatcher.js';
|
|
3
|
+
import type { AggregateTracking } from '../../domain/aggregate-tracking.js';
|
|
3
4
|
import type { DomainEvent } from '../../domain/domain-event.js';
|
|
5
|
+
import type { AsFound } from '../aggregates/as-found.js';
|
|
4
6
|
import type { CommitStep } from './commit-step.js';
|
|
5
7
|
/** Runs the work somewhere: in an asynchronous context, in an execution context. */
|
|
6
8
|
export type Within = <T>(work: () => T) => T;
|
|
@@ -15,7 +17,7 @@ export interface QueuedDomainEvent {
|
|
|
15
17
|
readonly inContext: Within;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
|
-
* What one unit of work has to dispatch. `unit-of-work` is opened by `
|
|
20
|
+
* What one unit of work has to dispatch. `unit-of-work` is opened by a unit of work (`unitOfWorkOver`); `save`
|
|
19
21
|
* is the scope of a save made outside of any, which dispatches as soon as it resolved.
|
|
20
22
|
*/
|
|
21
23
|
export interface UnitOfWorkScope {
|
|
@@ -25,10 +27,18 @@ export interface UnitOfWorkScope {
|
|
|
25
27
|
readonly queue: QueuedDomainEvent[];
|
|
26
28
|
/** Dispatched before the commit, in that order: what the `after-commit` phase is given. */
|
|
27
29
|
readonly dispatched: QueuedDomainEvent[];
|
|
30
|
+
/** The first failure of a run that joined this unit of work: it no longer commits. */
|
|
31
|
+
abortedBy?: {
|
|
32
|
+
readonly failure: unknown;
|
|
33
|
+
};
|
|
28
34
|
/** What `afterCommit` was handed in a unit of work: run after the `after-commit` handlers, never on a rollback. */
|
|
29
35
|
readonly committed?: (() => Promise<void>)[];
|
|
30
36
|
/** What `atCommit` was handed in a unit of work: applied last, inside the transaction. */
|
|
31
37
|
readonly atCommit?: CommitStep[];
|
|
38
|
+
/** What `onRollback` was handed in a unit of work: run newest first when it rolls back, never on a commit. */
|
|
39
|
+
readonly rolledBack?: (() => void)[];
|
|
40
|
+
/** The aggregates saved in a unit of work, as it found them: what a rollback gives back. */
|
|
41
|
+
readonly found?: Map<AggregateTracking, AsFound>;
|
|
32
42
|
}
|
|
33
43
|
export declare const unitOfWorkScope: AsyncLocalStorage<UnitOfWorkScope>;
|
|
34
44
|
//# sourceMappingURL=unit-of-work-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit-of-work-scope.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,oFAAoF;AACpF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;IAC7D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC;IACvC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,cAAc,GAAG,QAAQ,CAAC;IAC5D,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,iBAAiB,EAAE,CAAC;IACpC,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC;IACzC,mHAAmH;IACnH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;IAC7C,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"unit-of-work-scope.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAE,UAAU,EAAE,CAAC;IACjC,8GAA8G;IAC9G,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IACrC,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;CAClD;AAGD,eAAO,MAAM,eAAe,oCAA2C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit-of-work-scope.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"unit-of-work-scope.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unit-of-work-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA4CrD,kGAAkG;AAClG,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A command ran in a unit of work that opened no scope for the domain events: nothing would hold
|
|
3
|
+
* them until the end of the work, and their `after-commit` handlers would run before the commit.
|
|
4
|
+
*/
|
|
5
|
+
export declare class UnscopedUnitOfWorkError extends Error {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=unscoped-unit-of-work-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unscoped-unit-of-work-error.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unscoped-unit-of-work-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,cAMC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A command ran in a unit of work that opened no scope for the domain events: nothing would hold
|
|
3
|
+
* them until the end of the work, and their `after-commit` handlers would run before the commit.
|
|
4
|
+
*/
|
|
5
|
+
export class UnscopedUnitOfWorkError extends Error {
|
|
6
|
+
constructor() {
|
|
7
|
+
super('The unit of work given to unitOfWorkMiddleware opened no scope for the domain events. Build it on unitOfWorkOver of @ddd-ts-kit/kernel, around what begins and commits its transaction, or give InMemoryUnitOfWork where there is none.');
|
|
8
|
+
this.name = 'UnscopedUnitOfWorkError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=unscoped-unit-of-work-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unscoped-unit-of-work-error.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/unscoped-unit-of-work-error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD;QACE,KAAK,CACH,yOAAyO,CAC1O,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"when-committed.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/when-committed.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"when-committed.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/when-committed.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC1B,MAAM,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAc,GACzC,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { safely } from '../../application/observation/safely.js';
|
|
1
2
|
import { afterCommit } from './after-commit.js';
|
|
2
3
|
import { unitOfWorkScope } from './unit-of-work-scope.js';
|
|
3
4
|
/**
|
|
@@ -14,15 +15,7 @@ export async function whenCommitted(write, failed = ignored) {
|
|
|
14
15
|
await write();
|
|
15
16
|
return;
|
|
16
17
|
}
|
|
17
|
-
await afterCommit(() => write().catch((error) =>
|
|
18
|
-
}
|
|
19
|
-
function tell(failed, error) {
|
|
20
|
-
try {
|
|
21
|
-
failed(error);
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
18
|
+
await afterCommit(() => write().catch((error) => safely(() => failed(error))));
|
|
26
19
|
}
|
|
27
20
|
function ignored() {
|
|
28
21
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"when-committed.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/when-committed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAA0B,EAC1B,MAAM,GAA6B,OAAO;IAE1C,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;IAEzC,IAAI,KAAK,EAAE,IAAI,KAAK,cAAc,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,eAAe,CAAC,EAAE,CAAC;QAClG,MAAM,KAAK,EAAE,CAAC;QAEd,OAAO;IACT,CAAC;IAED,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"when-committed.js","sourceRoot":"","sources":["../../../src/infrastructure/domain-events/when-committed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAA0B,EAC1B,MAAM,GAA6B,OAAO;IAE1C,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;IAEzC,IAAI,KAAK,EAAE,IAAI,KAAK,cAAc,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,eAAe,CAAC,EAAE,CAAC;QAClG,MAAM,KAAK,EAAE,CAAC;QAEd,OAAO;IACT,CAAC;IAED,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,OAAO;IACd,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StoredEvent } from '../../application/event-sourcing/stored-event.js';
|
|
2
|
+
/** The aggregate a stored event belongs to: the one its metadata names, else its stream. */
|
|
3
|
+
export declare function aggregateIdOf(stored: StoredEvent): string;
|
|
4
|
+
//# sourceMappingURL=aggregate-id-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-id-of.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/aggregate-id-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEjF,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAIzD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The aggregate a stored event belongs to: the one its metadata names, else its stream. */
|
|
2
|
+
export function aggregateIdOf(stored) {
|
|
3
|
+
const declared = stored.metadata['aggregateId'];
|
|
4
|
+
return typeof declared === 'string' ? declared : stored.stream;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=aggregate-id-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-id-of.js","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/aggregate-id-of.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,MAAM,UAAU,aAAa,CAAC,MAAmB;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEhD,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;AACjE,CAAC"}
|