@ddd-ts-kit/kernel 0.9.0 → 0.10.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.md +138 -2
- package/dist/application/criteria/index.d.ts +33 -0
- package/dist/application/criteria/index.d.ts.map +1 -0
- package/dist/application/criteria/index.js +33 -0
- package/dist/application/criteria/index.js.map +1 -0
- package/dist/application/event-sourcing/appended.d.ts +8 -0
- package/dist/application/event-sourcing/appended.d.ts.map +1 -0
- package/dist/application/event-sourcing/appended.js +2 -0
- package/dist/application/event-sourcing/appended.js.map +1 -0
- package/dist/application/event-sourcing/define-stored-event.d.ts +10 -0
- package/dist/application/event-sourcing/define-stored-event.d.ts.map +1 -0
- package/dist/application/event-sourcing/define-stored-event.js +22 -0
- package/dist/application/event-sourcing/define-stored-event.js.map +1 -0
- package/dist/application/event-sourcing/erased-personal-data.d.ts +3 -0
- package/dist/application/event-sourcing/erased-personal-data.d.ts.map +1 -0
- package/dist/application/event-sourcing/erased-personal-data.js +3 -0
- package/dist/application/event-sourcing/erased-personal-data.js.map +1 -0
- package/dist/application/event-sourcing/event-envelope.d.ts +9 -0
- package/dist/application/event-sourcing/event-envelope.d.ts.map +1 -0
- package/dist/application/event-sourcing/event-envelope.js +2 -0
- package/dist/application/event-sourcing/event-envelope.js.map +1 -0
- package/dist/application/event-sourcing/event-to-append.d.ts +15 -0
- package/dist/application/event-sourcing/event-to-append.d.ts.map +1 -0
- package/dist/application/event-sourcing/event-to-append.js +2 -0
- package/dist/application/event-sourcing/event-to-append.js.map +1 -0
- package/dist/application/event-sourcing/index.d.ts +21 -0
- package/dist/application/event-sourcing/index.d.ts.map +1 -0
- package/dist/application/event-sourcing/index.js +21 -0
- package/dist/application/event-sourcing/index.js.map +1 -0
- package/dist/application/event-sourcing/is-stored-data.d.ts +5 -0
- package/dist/application/event-sourcing/is-stored-data.d.ts.map +1 -0
- package/dist/application/event-sourcing/is-stored-data.js +5 -0
- package/dist/application/event-sourcing/is-stored-data.js.map +1 -0
- package/dist/application/event-sourcing/is-stored-list.d.ts +4 -0
- package/dist/application/event-sourcing/is-stored-list.d.ts.map +1 -0
- package/dist/application/event-sourcing/is-stored-list.js +5 -0
- package/dist/application/event-sourcing/is-stored-list.js.map +1 -0
- package/dist/application/event-sourcing/personal-data.d.ts +14 -0
- package/dist/application/event-sourcing/personal-data.d.ts.map +1 -0
- package/dist/application/event-sourcing/personal-data.js +9 -0
- package/dist/application/event-sourcing/personal-data.js.map +1 -0
- package/dist/application/event-sourcing/stored-data-of.d.ts +9 -0
- package/dist/application/event-sourcing/stored-data-of.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-data-of.js +40 -0
- package/dist/application/event-sourcing/stored-data-of.js.map +1 -0
- package/dist/application/event-sourcing/stored-data.d.ts +6 -0
- package/dist/application/event-sourcing/stored-data.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-data.js +2 -0
- package/dist/application/event-sourcing/stored-data.js.map +1 -0
- package/dist/application/event-sourcing/stored-event-data.d.ts +25 -0
- package/dist/application/event-sourcing/stored-event-data.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-event-data.js +82 -0
- package/dist/application/event-sourcing/stored-event-data.js.map +1 -0
- package/dist/application/event-sourcing/stored-event-spec.d.ts +20 -0
- package/dist/application/event-sourcing/stored-event-spec.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-event-spec.js +2 -0
- package/dist/application/event-sourcing/stored-event-spec.js.map +1 -0
- package/dist/application/event-sourcing/stored-event-type.d.ts +14 -0
- package/dist/application/event-sourcing/stored-event-type.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-event-type.js +2 -0
- package/dist/application/event-sourcing/stored-event-type.js.map +1 -0
- package/dist/application/event-sourcing/stored-event-types.d.ts +9 -0
- package/dist/application/event-sourcing/stored-event-types.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-event-types.js +2 -0
- package/dist/application/event-sourcing/stored-event-types.js.map +1 -0
- package/dist/application/event-sourcing/stored-event.d.ts +12 -0
- package/dist/application/event-sourcing/stored-event.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-event.js +2 -0
- package/dist/application/event-sourcing/stored-event.js.map +1 -0
- package/dist/application/event-sourcing/stored-json.d.ts +5 -0
- package/dist/application/event-sourcing/stored-json.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-json.js +2 -0
- package/dist/application/event-sourcing/stored-json.js.map +1 -0
- package/dist/application/event-sourcing/stored-snapshot.d.ts +11 -0
- package/dist/application/event-sourcing/stored-snapshot.d.ts.map +1 -0
- package/dist/application/event-sourcing/stored-snapshot.js +2 -0
- package/dist/application/event-sourcing/stored-snapshot.js.map +1 -0
- package/dist/application/event-sourcing/subject-key.d.ts +10 -0
- package/dist/application/event-sourcing/subject-key.d.ts.map +1 -0
- package/dist/application/event-sourcing/subject-key.js +2 -0
- package/dist/application/event-sourcing/subject-key.js.map +1 -0
- package/dist/application/event-sourcing/unreadable-event-error.d.ts +5 -0
- package/dist/application/event-sourcing/unreadable-event-error.d.ts.map +1 -0
- package/dist/application/event-sourcing/unreadable-event-error.js +8 -0
- package/dist/application/event-sourcing/unreadable-event-error.js.map +1 -0
- package/dist/application/event-sourcing/upcaster.d.ts +4 -0
- package/dist/application/event-sourcing/upcaster.d.ts.map +1 -0
- package/dist/application/event-sourcing/upcaster.js +2 -0
- package/dist/application/event-sourcing/upcaster.js.map +1 -0
- package/dist/application/persistence/append-changes.d.ts +18 -0
- package/dist/application/persistence/append-changes.d.ts.map +1 -0
- package/dist/application/persistence/append-changes.js +17 -0
- package/dist/application/persistence/append-changes.js.map +1 -0
- package/dist/application/ports/checkpoint-store.d.ts +14 -0
- package/dist/application/ports/checkpoint-store.d.ts.map +1 -0
- package/dist/application/ports/checkpoint-store.js +10 -0
- package/dist/application/ports/checkpoint-store.js.map +1 -0
- package/dist/application/ports/event-store.d.ts +24 -0
- package/dist/application/ports/event-store.d.ts.map +1 -0
- package/dist/application/ports/event-store.js +12 -0
- package/dist/application/ports/event-store.js.map +1 -0
- package/dist/application/ports/snapshot-store.d.ts +8 -0
- package/dist/application/ports/snapshot-store.d.ts.map +1 -0
- package/dist/application/ports/snapshot-store.js +7 -0
- package/dist/application/ports/snapshot-store.js.map +1 -0
- package/dist/application/ports/subject-key-store.d.ts +17 -0
- package/dist/application/ports/subject-key-store.d.ts.map +1 -0
- package/dist/application/ports/subject-key-store.js +13 -0
- package/dist/application/ports/subject-key-store.js.map +1 -0
- package/dist/declarations/decorators/projection-options.d.ts +5 -0
- package/dist/declarations/decorators/projection-options.d.ts.map +1 -0
- package/dist/declarations/decorators/projection-options.js +2 -0
- package/dist/declarations/decorators/projection-options.js.map +1 -0
- package/dist/declarations/decorators/projection.d.ts +4 -0
- package/dist/declarations/decorators/projection.d.ts.map +1 -1
- package/dist/declarations/decorators/projection.js +16 -8
- package/dist/declarations/decorators/projection.js.map +1 -1
- package/dist/declarations/model/projection-declaration.d.ts +3 -0
- package/dist/declarations/model/projection-declaration.d.ts.map +1 -1
- package/dist/declarations/model/projection-feed.d.ts +8 -0
- package/dist/declarations/model/projection-feed.d.ts.map +1 -0
- package/dist/declarations/model/projection-feed.js +2 -0
- package/dist/declarations/model/projection-feed.js.map +1 -0
- package/dist/declarations/projection/applying-projection.d.ts +14 -0
- package/dist/declarations/projection/applying-projection.d.ts.map +1 -0
- package/dist/declarations/projection/applying-projection.js +32 -0
- package/dist/declarations/projection/applying-projection.js.map +1 -0
- package/dist/declarations.d.ts +3 -0
- package/dist/declarations.d.ts.map +1 -1
- package/dist/declarations.js +1 -0
- package/dist/declarations.js.map +1 -1
- package/dist/domain/event-sourcing/aggregate-history.d.ts +10 -0
- package/dist/domain/event-sourcing/aggregate-history.d.ts.map +1 -0
- package/dist/domain/event-sourcing/aggregate-history.js +2 -0
- package/dist/domain/event-sourcing/aggregate-history.js.map +1 -0
- package/dist/domain/event-sourcing/aggregate-snapshot.d.ts +6 -0
- package/dist/domain/event-sourcing/aggregate-snapshot.d.ts.map +1 -0
- package/dist/domain/event-sourcing/aggregate-snapshot.js +2 -0
- package/dist/domain/event-sourcing/aggregate-snapshot.js.map +1 -0
- package/dist/domain/event-sourcing/appliers.d.ts +12 -0
- package/dist/domain/event-sourcing/appliers.d.ts.map +1 -0
- package/dist/domain/event-sourcing/appliers.js +2 -0
- package/dist/domain/event-sourcing/appliers.js.map +1 -0
- package/dist/domain/event-sourcing/event-sourced-aggregate.d.ts +28 -0
- package/dist/domain/event-sourcing/event-sourced-aggregate.d.ts.map +1 -0
- package/dist/domain/event-sourcing/event-sourced-aggregate.js +51 -0
- package/dist/domain/event-sourcing/event-sourced-aggregate.js.map +1 -0
- package/dist/domain/event-sourcing/unstored-events.d.ts +8 -0
- package/dist/domain/event-sourcing/unstored-events.d.ts.map +1 -0
- package/dist/domain/event-sourcing/unstored-events.js +7 -0
- package/dist/domain/event-sourcing/unstored-events.js.map +1 -0
- package/dist/index.d.ts +32 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -32
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/event-sourcing/catch-up-subscription.d.ts +33 -0
- package/dist/infrastructure/event-sourcing/catch-up-subscription.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/catch-up-subscription.js +39 -0
- package/dist/infrastructure/event-sourcing/catch-up-subscription.js.map +1 -0
- package/dist/infrastructure/event-sourcing/event-serializer.d.ts +35 -0
- package/dist/infrastructure/event-sourcing/event-serializer.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/event-serializer.js +104 -0
- package/dist/infrastructure/event-sourcing/event-serializer.js.map +1 -0
- package/dist/infrastructure/event-sourcing/event-sourced-repository.d.ts +32 -0
- package/dist/infrastructure/event-sourcing/event-sourced-repository.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/event-sourced-repository.js +68 -0
- package/dist/infrastructure/event-sourcing/event-sourced-repository.js.map +1 -0
- package/dist/infrastructure/event-sourcing/event-sourcing-stores.d.ts +12 -0
- package/dist/infrastructure/event-sourcing/event-sourcing-stores.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/event-sourcing-stores.js +2 -0
- package/dist/infrastructure/event-sourcing/event-sourcing-stores.js.map +1 -0
- package/dist/infrastructure/event-sourcing/event-store-projection-rebuild.d.ts +34 -0
- package/dist/infrastructure/event-sourcing/event-store-projection-rebuild.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/event-store-projection-rebuild.js +48 -0
- package/dist/infrastructure/event-sourcing/event-store-projection-rebuild.js.map +1 -0
- package/dist/infrastructure/event-sourcing/personal-data-cipher.d.ts +19 -0
- package/dist/infrastructure/event-sourcing/personal-data-cipher.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/personal-data-cipher.js +84 -0
- package/dist/infrastructure/event-sourcing/personal-data-cipher.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-options.d.ts +6 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-options.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-options.js +2 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-options.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-sql.d.ts +9 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-sql.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-sql.js +32 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables-sql.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables.d.ts +9 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables.js +9 -0
- package/dist/infrastructure/event-sourcing/postgres/event-store-tables.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/is-append-conflict.d.ts +3 -0
- package/dist/infrastructure/event-sourcing/postgres/is-append-conflict.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/is-append-conflict.js +22 -0
- package/dist/infrastructure/event-sourcing/postgres/is-append-conflict.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-checkpoint-store.d.ts +12 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-checkpoint-store.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-checkpoint-store.js +26 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-checkpoint-store.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-sourcing.d.ts +6 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-sourcing.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-sourcing.js +14 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-sourcing.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-store.d.ts +31 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-store.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-store.js +120 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-event-store.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-snapshot-store.d.ts +13 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-snapshot-store.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-snapshot-store.js +28 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-snapshot-store.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-subject-key-store.d.ts +21 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-subject-key-store.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-subject-key-store.js +48 -0
- package/dist/infrastructure/event-sourcing/postgres/postgres-subject-key-store.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/qualified-table.d.ts +4 -0
- package/dist/infrastructure/event-sourcing/postgres/qualified-table.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/qualified-table.js +10 -0
- package/dist/infrastructure/event-sourcing/postgres/qualified-table.js.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/stored-data-from.d.ts +4 -0
- package/dist/infrastructure/event-sourcing/postgres/stored-data-from.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/postgres/stored-data-from.js +23 -0
- package/dist/infrastructure/event-sourcing/postgres/stored-data-from.js.map +1 -0
- package/dist/infrastructure/event-sourcing/rewrite-objects.d.ts +8 -0
- package/dist/infrastructure/event-sourcing/rewrite-objects.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/rewrite-objects.js +16 -0
- package/dist/infrastructure/event-sourcing/rewrite-objects.js.map +1 -0
- package/dist/infrastructure/event-sourcing/snapshot-policy.d.ts +14 -0
- package/dist/infrastructure/event-sourcing/snapshot-policy.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/snapshot-policy.js +2 -0
- package/dist/infrastructure/event-sourcing/snapshot-policy.js.map +1 -0
- package/dist/infrastructure/event-sourcing/stored-origins.d.ts +5 -0
- package/dist/infrastructure/event-sourcing/stored-origins.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/stored-origins.js +3 -0
- package/dist/infrastructure/event-sourcing/stored-origins.js.map +1 -0
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts +10 -0
- package/dist/infrastructure/event-sourcing/stored-stamp-of.d.ts.map +1 -0
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js +14 -0
- package/dist/infrastructure/event-sourcing/stored-stamp-of.js.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-checkpoint-store.d.ts +8 -0
- package/dist/infrastructure/in-memory/in-memory-checkpoint-store.d.ts.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-checkpoint-store.js +15 -0
- package/dist/infrastructure/in-memory/in-memory-checkpoint-store.js.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-event-store.d.ts +14 -0
- package/dist/infrastructure/in-memory/in-memory-event-store.d.ts.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-event-store.js +37 -0
- package/dist/infrastructure/in-memory/in-memory-event-store.js.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.d.ts +9 -0
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.d.ts.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.js +15 -0
- package/dist/infrastructure/in-memory/in-memory-snapshot-store.js.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-subject-key-store.d.ts +10 -0
- package/dist/infrastructure/in-memory/in-memory-subject-key-store.d.ts.map +1 -0
- package/dist/infrastructure/in-memory/in-memory-subject-key-store.js +21 -0
- package/dist/infrastructure/in-memory/in-memory-subject-key-store.js.map +1 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.d.ts +20 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.d.ts.map +1 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.js +25 -0
- package/dist/infrastructure/read-model/shadow-read-model-store.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from './domain/aggregate-root.js';
|
|
2
2
|
export * from './domain/domain-event.js';
|
|
3
3
|
export * from './domain/entity.js';
|
|
4
|
+
export * from './domain/event-sourcing/aggregate-history.js';
|
|
5
|
+
export * from './domain/event-sourcing/aggregate-snapshot.js';
|
|
6
|
+
export * from './domain/event-sourcing/appliers.js';
|
|
7
|
+
export * from './domain/event-sourcing/event-sourced-aggregate.js';
|
|
4
8
|
export * from './domain/errors/code-of.js';
|
|
5
9
|
export * from './domain/errors/concept-error.js';
|
|
6
10
|
export * from './domain/errors/concurrency-error.js';
|
|
@@ -67,6 +71,7 @@ export * from './application/error-reporting/error-report.js';
|
|
|
67
71
|
export * from './application/error-reporting/error-severity.js';
|
|
68
72
|
export * from './application/error-reporting/is-unexpected-error.js';
|
|
69
73
|
export * from './application/error-reporting/report-once.js';
|
|
74
|
+
export * from './application/event-sourcing/index.js';
|
|
70
75
|
export * from './application/events/after-commit-failure.js';
|
|
71
76
|
export * from './application/events/domain-event-callback.js';
|
|
72
77
|
export * from './application/events/domain-event-phase.js';
|
|
@@ -118,38 +123,7 @@ export * from './application/metrics/counter.js';
|
|
|
118
123
|
export * from './application/metrics/gauge.js';
|
|
119
124
|
export * from './application/metrics/histogram.js';
|
|
120
125
|
export * from './application/metrics/metric-labels.js';
|
|
121
|
-
export * from './application/criteria/
|
|
122
|
-
export * from './application/criteria/field-value.js';
|
|
123
|
-
export * from './application/criteria/field-of.js';
|
|
124
|
-
export * from './application/criteria/operator-of.js';
|
|
125
|
-
export * from './application/criteria/operand-of.js';
|
|
126
|
-
export * from './application/criteria/filter-node.js';
|
|
127
|
-
export * from './application/criteria/filters.js';
|
|
128
|
-
export * from './application/criteria/criteria.js';
|
|
129
|
-
export * from './application/criteria/field-type.js';
|
|
130
|
-
export * from './application/criteria/field-type-of.js';
|
|
131
|
-
export * from './application/criteria/field-rule.js';
|
|
132
|
-
export * from './application/criteria/field-declaration.js';
|
|
133
|
-
export * from './application/criteria/criteria-limits.js';
|
|
134
|
-
export * from './application/criteria/criteria-declaration.js';
|
|
135
|
-
export * from './application/criteria/criteria-definition.js';
|
|
136
|
-
export * from './application/criteria/criteria-definition-error.js';
|
|
137
|
-
export * from './application/criteria/define-criteria.js';
|
|
138
|
-
export * from './application/criteria/criteria-violation.js';
|
|
139
|
-
export * from './application/criteria/validate-criteria.js';
|
|
140
|
-
export * from './application/criteria/invalid-criteria-error.js';
|
|
141
|
-
export * from './application/criteria/read-scope.js';
|
|
142
|
-
export * from './application/criteria/read-scope-mapping.js';
|
|
143
|
-
export * from './application/criteria/unmapped-read-scope-error.js';
|
|
144
|
-
export * from './application/criteria/scoped-criteria.js';
|
|
145
|
-
export * from './application/criteria/scoped.js';
|
|
146
|
-
export * from './application/criteria/predicate.js';
|
|
147
|
-
export * from './application/criteria/criteria-plan.js';
|
|
148
|
-
export * from './application/criteria/plan-criteria.js';
|
|
149
|
-
export * from './application/criteria/page-of-plan.js';
|
|
150
|
-
export * from './application/criteria/select-rows.js';
|
|
151
|
-
export * from './application/criteria/evaluate-plan.js';
|
|
152
|
-
export * from './application/criteria/evaluate-criteria.js';
|
|
126
|
+
export * from './application/criteria/index.js';
|
|
153
127
|
export * from './application/files/index.js';
|
|
154
128
|
export * from './application/hydration/hydrate.js';
|
|
155
129
|
export * from './application/hydration/hydration.js';
|
|
@@ -179,17 +153,20 @@ export * from './application/pagination/page-request.js';
|
|
|
179
153
|
export * from './application/pagination/page.js';
|
|
180
154
|
export * from './application/pagination/sort-direction.js';
|
|
181
155
|
export * from './application/pagination/sort.js';
|
|
156
|
+
export * from './application/persistence/append-changes.js';
|
|
182
157
|
export * from './application/persistence/optimistic-update.js';
|
|
183
158
|
export * from './application/persistence/schema-name-of.js';
|
|
184
159
|
export * from './application/ports/actor-context.js';
|
|
185
160
|
export * from './application/ports/audit-reader.js';
|
|
186
161
|
export * from './application/ports/audit-trail.js';
|
|
187
162
|
export * from './application/ports/cache.js';
|
|
163
|
+
export * from './application/ports/checkpoint-store.js';
|
|
188
164
|
export * from './application/ports/clock.js';
|
|
189
165
|
export * from './application/ports/command-bus.js';
|
|
190
166
|
export * from './application/ports/domain-event-dispatcher.js';
|
|
191
167
|
export * from './application/ports/error-reporter.js';
|
|
192
168
|
export * from './application/ports/event-bus.js';
|
|
169
|
+
export * from './application/ports/event-store.js';
|
|
193
170
|
export * from './application/ports/event-subscribers.js';
|
|
194
171
|
export * from './application/ports/execution-scope.js';
|
|
195
172
|
export * from './application/ports/file-keys.js';
|
|
@@ -210,6 +187,8 @@ export * from './application/ports/read-model-store.js';
|
|
|
210
187
|
export * from './application/ports/read-model-table.js';
|
|
211
188
|
export * from './application/ports/repository.js';
|
|
212
189
|
export * from './application/ports/served-file-storage.js';
|
|
190
|
+
export * from './application/ports/snapshot-store.js';
|
|
191
|
+
export * from './application/ports/subject-key-store.js';
|
|
213
192
|
export * from './application/ports/unit-of-work.js';
|
|
214
193
|
export * from './application/ports/tenant-directory.js';
|
|
215
194
|
export * from './application/rate-limit/rate-limit-decision-of.js';
|
|
@@ -282,6 +261,22 @@ export * from './infrastructure/domain-events/report-after-commit-failures.js';
|
|
|
282
261
|
export * from './infrastructure/domain-events/save-after-commit-error.js';
|
|
283
262
|
export * from './infrastructure/domain-events/unit-of-work-stage.js';
|
|
284
263
|
export * from './infrastructure/domain-events/within-unit-of-work.js';
|
|
264
|
+
export * from './infrastructure/event-sourcing/catch-up-subscription.js';
|
|
265
|
+
export * from './infrastructure/event-sourcing/event-serializer.js';
|
|
266
|
+
export * from './infrastructure/event-sourcing/event-sourcing-stores.js';
|
|
267
|
+
export * from './infrastructure/event-sourcing/event-sourced-repository.js';
|
|
268
|
+
export * from './infrastructure/event-sourcing/event-store-projection-rebuild.js';
|
|
269
|
+
export * from './infrastructure/event-sourcing/personal-data-cipher.js';
|
|
270
|
+
export * from './infrastructure/event-sourcing/postgres/event-store-tables-sql.js';
|
|
271
|
+
export * from './infrastructure/event-sourcing/postgres/event-store-tables-options.js';
|
|
272
|
+
export * from './infrastructure/event-sourcing/postgres/event-store-tables.js';
|
|
273
|
+
export * from './infrastructure/event-sourcing/postgres/postgres-checkpoint-store.js';
|
|
274
|
+
export * from './infrastructure/event-sourcing/postgres/postgres-event-sourcing.js';
|
|
275
|
+
export * from './infrastructure/event-sourcing/postgres/postgres-event-store.js';
|
|
276
|
+
export * from './infrastructure/event-sourcing/postgres/postgres-snapshot-store.js';
|
|
277
|
+
export * from './infrastructure/event-sourcing/postgres/postgres-subject-key-store.js';
|
|
278
|
+
export * from './infrastructure/event-sourcing/snapshot-policy.js';
|
|
279
|
+
export * from './infrastructure/event-sourcing/stored-stamp-of.js';
|
|
285
280
|
export * from './infrastructure/events/idempotent.js';
|
|
286
281
|
export * from './infrastructure/files/accept-every-file-scanner.js';
|
|
287
282
|
export * from './infrastructure/files/file-inspection.js';
|
|
@@ -299,10 +294,12 @@ export * from './infrastructure/id/sequential-id-generator.js';
|
|
|
299
294
|
export * from './infrastructure/id/uuid-generator.js';
|
|
300
295
|
export * from './infrastructure/in-memory/error-reporting-middleware.js';
|
|
301
296
|
export * from './infrastructure/in-memory/in-memory-cache.js';
|
|
297
|
+
export * from './infrastructure/in-memory/in-memory-checkpoint-store.js';
|
|
302
298
|
export * from './infrastructure/in-memory/in-memory-command-bus.js';
|
|
303
299
|
export * from './infrastructure/in-memory/in-memory-domain-event-dispatcher.js';
|
|
304
300
|
export * from './infrastructure/in-memory/in-memory-error-reporter.js';
|
|
305
301
|
export * from './infrastructure/in-memory/in-memory-event-bus.js';
|
|
302
|
+
export * from './infrastructure/in-memory/in-memory-event-store.js';
|
|
306
303
|
export * from './infrastructure/in-memory/in-memory-lock.js';
|
|
307
304
|
export * from './infrastructure/in-memory/in-memory-logger.js';
|
|
308
305
|
export * from './infrastructure/in-memory/in-memory-metrics.js';
|
|
@@ -310,6 +307,8 @@ export * from './infrastructure/in-memory/in-memory-processed-event-store.js';
|
|
|
310
307
|
export * from './infrastructure/in-memory/in-memory-query-bus.js';
|
|
311
308
|
export * from './infrastructure/in-memory/in-memory-read-model-store.js';
|
|
312
309
|
export * from './infrastructure/in-memory/in-memory-read-model-table.js';
|
|
310
|
+
export * from './infrastructure/in-memory/in-memory-snapshot-store.js';
|
|
311
|
+
export * from './infrastructure/in-memory/in-memory-subject-key-store.js';
|
|
313
312
|
export * from './infrastructure/in-memory/in-memory-rate-limiter.js';
|
|
314
313
|
export * from './infrastructure/in-memory/in-memory-unit-of-work.js';
|
|
315
314
|
export * from './infrastructure/in-memory/metric-sample.js';
|
|
@@ -317,6 +316,7 @@ export * from './infrastructure/in-memory/unit-of-work-middleware.js';
|
|
|
317
316
|
export * from './infrastructure/in-memory/in-memory-tenant-directory.js';
|
|
318
317
|
export * from './infrastructure/read-model/postgres-read-model-rebuild.js';
|
|
319
318
|
export * from './infrastructure/read-model/projection-rebuild.js';
|
|
319
|
+
export * from './infrastructure/read-model/shadow-read-model-store.js';
|
|
320
320
|
export * from './infrastructure/read-model/sql-run.js';
|
|
321
321
|
export * from './infrastructure/read-model/table-read-model-store.js';
|
|
322
322
|
export * from './infrastructure/read-model/write-if-newer.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AACvD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wCAAwC,CAAC;AACvD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AACxD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,C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E,cAAc,uDAAuD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { StoredEvent } from '../../application/event-sourcing/stored-event.js';
|
|
2
|
+
import type { CheckpointStore } from '../../application/ports/checkpoint-store.js';
|
|
3
|
+
import type { EventStore } from '../../application/ports/event-store.js';
|
|
4
|
+
import type { UnitOfWork } from '../../application/ports/unit-of-work.js';
|
|
5
|
+
export interface CatchUpSubscriptionParts {
|
|
6
|
+
/** The subscriber, `<context>.<name>`: the name of the projection it feeds, and of its checkpoint. */
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly store: EventStore;
|
|
9
|
+
readonly checkpoints: CheckpointStore;
|
|
10
|
+
/** The unit of work of the database the subscriber writes to: the checkpoint commits with what was applied. */
|
|
11
|
+
readonly unitOfWork: UnitOfWork;
|
|
12
|
+
/** Applies one event of the store; passes over the events it does not apply. */
|
|
13
|
+
apply(event: StoredEvent): Promise<void>;
|
|
14
|
+
/** Events applied per unit of work. Default 100. */
|
|
15
|
+
readonly batchSize?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Feeds a subscriber from the event store, in the order of the store, from where its checkpoint
|
|
19
|
+
* stands. Each batch is applied and the checkpoint moved in one unit of work: a failure applies
|
|
20
|
+
* none of the batch, which is read again at the next poll. Two runs of the same subscriber
|
|
21
|
+
* never both move the checkpoint: the second one is refused (`ConcurrencyError`) and rolled
|
|
22
|
+
* back. A subscriber started on a store that already holds events catches up from position
|
|
23
|
+
* zero, which is also how a new projection is filled.
|
|
24
|
+
*/
|
|
25
|
+
export declare class CatchUpSubscription {
|
|
26
|
+
private readonly parts;
|
|
27
|
+
constructor(parts: CatchUpSubscriptionParts);
|
|
28
|
+
/** Applies the next batch, if any. Answers how many events were read. */
|
|
29
|
+
poll(): Promise<number>;
|
|
30
|
+
/** Polls until the subscriber has applied the whole store. Answers how many events were read. */
|
|
31
|
+
catchUp(): Promise<number>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=catch-up-subscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catch-up-subscription.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/catch-up-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAE1E,MAAM,WAAW,wBAAwB;IACvC,sGAAsG;IACtG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,+GAA+G;IAC/G,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,gFAAgF;IAChF,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,oDAAoD;IACpD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAE,wBAAwB,EAAI;IAEhE,yEAAyE;IACzE,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAkBtB;IAED,iGAAiG;IAC3F,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAQ/B;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feeds a subscriber from the event store, in the order of the store, from where its checkpoint
|
|
3
|
+
* stands. Each batch is applied and the checkpoint moved in one unit of work: a failure applies
|
|
4
|
+
* none of the batch, which is read again at the next poll. Two runs of the same subscriber
|
|
5
|
+
* never both move the checkpoint: the second one is refused (`ConcurrencyError`) and rolled
|
|
6
|
+
* back. A subscriber started on a store that already holds events catches up from position
|
|
7
|
+
* zero, which is also how a new projection is filled.
|
|
8
|
+
*/
|
|
9
|
+
export class CatchUpSubscription {
|
|
10
|
+
parts;
|
|
11
|
+
constructor(parts) {
|
|
12
|
+
this.parts = parts;
|
|
13
|
+
}
|
|
14
|
+
/** Applies the next batch, if any. Answers how many events were read. */
|
|
15
|
+
poll() {
|
|
16
|
+
const { name, store, checkpoints, unitOfWork, batchSize = 100 } = this.parts;
|
|
17
|
+
return unitOfWork.run(async () => {
|
|
18
|
+
const from = await checkpoints.position(name);
|
|
19
|
+
const events = await store.readAll(from, batchSize);
|
|
20
|
+
const last = events.at(-1);
|
|
21
|
+
for (const event of events) {
|
|
22
|
+
await this.parts.apply(event);
|
|
23
|
+
}
|
|
24
|
+
if (last !== undefined) {
|
|
25
|
+
await checkpoints.advance(name, from, last.position);
|
|
26
|
+
}
|
|
27
|
+
return events.length;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** Polls until the subscriber has applied the whole store. Answers how many events were read. */
|
|
31
|
+
async catchUp() {
|
|
32
|
+
let read = 0;
|
|
33
|
+
for (let batch = await this.poll(); batch > 0; batch = await this.poll()) {
|
|
34
|
+
read += batch;
|
|
35
|
+
}
|
|
36
|
+
return read;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=catch-up-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catch-up-subscription.js","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/catch-up-subscription.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IACD,KAAK;IAAlC,YAA6B,KAA+B;qBAA/B,KAAK;IAA6B,CAAC;IAEhE,yEAAyE;IACzE,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE7E,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;YAC/B,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC9C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACpD,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAE3B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;YAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvD,CAAC;YAED,OAAO,MAAM,CAAC,MAAM,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,iGAAiG;IACjG,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,GAAG,CAAC,CAAC;QAEb,KAAK,IAAI,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACzE,IAAI,IAAI,KAAK,CAAC;QAChB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EventToAppend } from '../../application/event-sourcing/event-to-append.js';
|
|
2
|
+
import type { StoredData } from '../../application/event-sourcing/stored-data.js';
|
|
3
|
+
import type { StoredEventTypes } from '../../application/event-sourcing/stored-event-types.js';
|
|
4
|
+
import type { StoredEvent } from '../../application/event-sourcing/stored-event.js';
|
|
5
|
+
import type { IdGenerator } from '../../application/ports/id-generator.js';
|
|
6
|
+
import type { DomainEvent } from '../../domain/domain-event.js';
|
|
7
|
+
import { PersonalDataCipher } from './personal-data-cipher.js';
|
|
8
|
+
export interface EventSerializerOptions {
|
|
9
|
+
/** Seals and opens the personal values; without one, data holding a personal value is refused. */
|
|
10
|
+
readonly cipher?: PersonalDataCipher;
|
|
11
|
+
/** Gives each stored event its id. Default: a UUID. */
|
|
12
|
+
readonly ids?: IdGenerator;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Turns the domain events of one aggregate into stored events and back, as `defineStoredEvent`
|
|
16
|
+
* declared them: the current version of their shape on the way in, and on the way out the
|
|
17
|
+
* upcasters from the version they were stored with, then `decode`. Stored events are never
|
|
18
|
+
* rewritten. Personal values are sealed on the way in and opened on the way out.
|
|
19
|
+
*/
|
|
20
|
+
export declare class EventSerializer<E extends DomainEvent> {
|
|
21
|
+
private readonly options;
|
|
22
|
+
private readonly types;
|
|
23
|
+
private readonly ids;
|
|
24
|
+
constructor(types: StoredEventTypes<E>, options?: EventSerializerOptions);
|
|
25
|
+
/** Whether events of this name are declared here: what a subscription skips otherwise. */
|
|
26
|
+
declares(type: string): boolean;
|
|
27
|
+
serialize(event: DomainEvent): Promise<EventToAppend>;
|
|
28
|
+
deserialize(stored: StoredEvent): Promise<E>;
|
|
29
|
+
/** Seals the personal values of the data, for an event or a snapshot. */
|
|
30
|
+
seal(data: StoredData): Promise<StoredData>;
|
|
31
|
+
/** Opens the sealed values of the data; an erased one reads `ERASED_PERSONAL_DATA`. */
|
|
32
|
+
open(data: StoredData): Promise<StoredData>;
|
|
33
|
+
private typeOf;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=event-serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-serializer.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/event-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,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 -0,0 +1,104 @@
|
|
|
1
|
+
import { StoredEventData } from '../../application/event-sourcing/stored-event-data.js';
|
|
2
|
+
import { UnreadableEventError } from '../../application/event-sourcing/unreadable-event-error.js';
|
|
3
|
+
import { UuidGenerator } from '../id/uuid-generator.js';
|
|
4
|
+
import { PersonalDataCipher } from './personal-data-cipher.js';
|
|
5
|
+
import { storedOrigins } from './stored-origins.js';
|
|
6
|
+
/**
|
|
7
|
+
* Turns the domain events of one aggregate into stored events and back, as `defineStoredEvent`
|
|
8
|
+
* declared them: the current version of their shape on the way in, and on the way out the
|
|
9
|
+
* upcasters from the version they were stored with, then `decode`. Stored events are never
|
|
10
|
+
* rewritten. Personal values are sealed on the way in and opened on the way out.
|
|
11
|
+
*/
|
|
12
|
+
export class EventSerializer {
|
|
13
|
+
options;
|
|
14
|
+
types = new Map();
|
|
15
|
+
ids;
|
|
16
|
+
constructor(types, options = {}) {
|
|
17
|
+
this.options = options;
|
|
18
|
+
for (const name of Object.keys(types)) {
|
|
19
|
+
const declared = Reflect.get(types, name);
|
|
20
|
+
if (isStoredEventType(declared)) {
|
|
21
|
+
this.types.set(name, declared);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
this.ids = options.ids ?? new UuidGenerator();
|
|
25
|
+
}
|
|
26
|
+
/** Whether events of this name are declared here: what a subscription skips otherwise. */
|
|
27
|
+
declares(type) {
|
|
28
|
+
return this.types.has(type);
|
|
29
|
+
}
|
|
30
|
+
async serialize(event) {
|
|
31
|
+
const declared = this.typeOf(event.name);
|
|
32
|
+
return {
|
|
33
|
+
id: this.ids.next(),
|
|
34
|
+
type: event.name,
|
|
35
|
+
schemaVersion: declared.version,
|
|
36
|
+
data: await this.seal(declared.encode(event)),
|
|
37
|
+
metadata: { aggregateId: event.aggregateId },
|
|
38
|
+
occurredAt: event.occurredAt,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async deserialize(stored) {
|
|
42
|
+
const declared = this.typeOf(stored.type);
|
|
43
|
+
const where = `${stored.type} ${stored.id}`;
|
|
44
|
+
const data = upcast(declared, await this.open(stored.data), stored);
|
|
45
|
+
const event = declared.decode(new StoredEventData(data, where), {
|
|
46
|
+
id: stored.id,
|
|
47
|
+
aggregateId: aggregateIdOf(stored),
|
|
48
|
+
occurredAt: stored.occurredAt,
|
|
49
|
+
version: stored.version,
|
|
50
|
+
});
|
|
51
|
+
storedOrigins.set(event, stored);
|
|
52
|
+
return event;
|
|
53
|
+
}
|
|
54
|
+
/** Seals the personal values of the data, for an event or a snapshot. */
|
|
55
|
+
async seal(data) {
|
|
56
|
+
if (!PersonalDataCipher.holdsPersonalData(data)) {
|
|
57
|
+
return data;
|
|
58
|
+
}
|
|
59
|
+
if (this.options.cipher === undefined) {
|
|
60
|
+
throw new TypeError('Personal data is stored sealed: give the serializer a PersonalDataCipher');
|
|
61
|
+
}
|
|
62
|
+
return this.options.cipher.seal(data);
|
|
63
|
+
}
|
|
64
|
+
/** Opens the sealed values of the data; an erased one reads `ERASED_PERSONAL_DATA`. */
|
|
65
|
+
async open(data) {
|
|
66
|
+
if (!PersonalDataCipher.holdsPersonalData(data)) {
|
|
67
|
+
return data;
|
|
68
|
+
}
|
|
69
|
+
if (this.options.cipher === undefined) {
|
|
70
|
+
throw new UnreadableEventError('Stored data holds sealed values: give the serializer a PersonalDataCipher');
|
|
71
|
+
}
|
|
72
|
+
return this.options.cipher.open(data);
|
|
73
|
+
}
|
|
74
|
+
typeOf(type) {
|
|
75
|
+
const declared = this.types.get(type);
|
|
76
|
+
if (declared === undefined) {
|
|
77
|
+
throw new UnreadableEventError(`"${type}" is not a stored event of this serializer: declare it with defineStoredEvent`);
|
|
78
|
+
}
|
|
79
|
+
return declared;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** What `defineStoredEvent` answers, told apart from anything else a record of declarations could hold. */
|
|
83
|
+
function isStoredEventType(value) {
|
|
84
|
+
return typeof value === 'object' && value !== null && 'decode' in value && 'encode' in value && 'version' in value;
|
|
85
|
+
}
|
|
86
|
+
function upcast(declared, data, stored) {
|
|
87
|
+
if (stored.schemaVersion > declared.version) {
|
|
88
|
+
throw new UnreadableEventError(`${stored.type} ${stored.id} is stored in version ${stored.schemaVersion}, and this release reads up to ${declared.version}`);
|
|
89
|
+
}
|
|
90
|
+
let current = data;
|
|
91
|
+
for (let version = stored.schemaVersion; version < declared.version; version += 1) {
|
|
92
|
+
const upcaster = declared.upcasters[version];
|
|
93
|
+
if (upcaster === undefined) {
|
|
94
|
+
throw new UnreadableEventError(`${stored.type} has no upcaster from version ${version}`);
|
|
95
|
+
}
|
|
96
|
+
current = upcaster(current);
|
|
97
|
+
}
|
|
98
|
+
return current;
|
|
99
|
+
}
|
|
100
|
+
function aggregateIdOf(stored) {
|
|
101
|
+
const declared = stored.metadata['aggregateId'];
|
|
102
|
+
return typeof declared === 'string' ? declared : stored.stream;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=event-serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-serializer.js","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/event-serializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAC;AAIxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAGlG,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASpD;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAOP,OAAO;IANT,KAAK,GAAG,IAAI,GAAG,EAA8B,CAAC;IAE9C,GAAG,CAAc;IAElC,YACE,KAA0B,EACT,OAAO,GAA2B,EAAE;uBAApC,OAAO;QAExB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,MAA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O,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EventStore } from '../../application/ports/event-store.js';
|
|
2
|
+
import type { DomainEvent } from '../../domain/domain-event.js';
|
|
3
|
+
import type { AggregateHistory } from '../../domain/event-sourcing/aggregate-history.js';
|
|
4
|
+
import type { EventSourcedAggregate } from '../../domain/event-sourcing/event-sourced-aggregate.js';
|
|
5
|
+
import type { EventSerializer } from './event-serializer.js';
|
|
6
|
+
import type { SnapshotPolicy } from './snapshot-policy.js';
|
|
7
|
+
export interface EventSourcedRepositoryParts<A extends EventSourcedAggregate<E, S>, E extends DomainEvent, S> {
|
|
8
|
+
readonly store: EventStore;
|
|
9
|
+
readonly serializer: EventSerializer<E>;
|
|
10
|
+
/** `<context>.<aggregate>`: the stream of an aggregate is `<category>-<id>`. */
|
|
11
|
+
readonly category: string;
|
|
12
|
+
/** The static `rehydrate` of the aggregate: `(id, history) => AttendanceRecord.rehydrate(id, history)`. */
|
|
13
|
+
rehydrate(id: string, history: AggregateHistory<E, S>): A;
|
|
14
|
+
readonly snapshots?: SnapshotPolicy<A, S>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* What the repository adapter of an event-sourced aggregate delegates to: `findById` replays the
|
|
18
|
+
* stream, from the last snapshot when the aggregate takes them; `save` appends what the aggregate
|
|
19
|
+
* recorded, at the version it was loaded at, in the transaction of the unit of work, and takes a
|
|
20
|
+
* snapshot when one is due. The events then leave with the save like any other (`dispatchingOnSave`).
|
|
21
|
+
*/
|
|
22
|
+
export declare class EventSourcedRepository<A extends EventSourcedAggregate<E, S>, E extends DomainEvent, S = never> {
|
|
23
|
+
private readonly parts;
|
|
24
|
+
constructor(parts: EventSourcedRepositoryParts<A, E, S>);
|
|
25
|
+
static streamOf(category: string, id: string): string;
|
|
26
|
+
findById(id: string): Promise<A | undefined>;
|
|
27
|
+
save(aggregate: A): Promise<void>;
|
|
28
|
+
private serialized;
|
|
29
|
+
private snapshotIfDue;
|
|
30
|
+
private snapshotOf;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=event-sourced-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-sourced-repository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/event-sourced-repository.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,WAAW,2BAA2B,CAAC,CAAC,SAAS,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,EAAE,CAAC;IAC1G,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IACxC,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2GAA2G;IAC3G,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,EAAE,CAAC,GAAG,KAAK;IAC7F,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAE,2BAA2B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAI;IAE5E,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEpD;IAEK,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAgBjD;IAEK,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAStC;YAEa,UAAU;YAUV,aAAa;YAeb,UAAU;CAYzB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { storedDataOf } from '../../application/event-sourcing/stored-data-of.js';
|
|
2
|
+
import { StoredEventData } from '../../application/event-sourcing/stored-event-data.js';
|
|
3
|
+
import { appendChanges } from '../../application/persistence/append-changes.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the repository adapter of an event-sourced aggregate delegates to: `findById` replays the
|
|
6
|
+
* stream, from the last snapshot when the aggregate takes them; `save` appends what the aggregate
|
|
7
|
+
* recorded, at the version it was loaded at, in the transaction of the unit of work, and takes a
|
|
8
|
+
* snapshot when one is due. The events then leave with the save like any other (`dispatchingOnSave`).
|
|
9
|
+
*/
|
|
10
|
+
export class EventSourcedRepository {
|
|
11
|
+
parts;
|
|
12
|
+
constructor(parts) {
|
|
13
|
+
this.parts = parts;
|
|
14
|
+
}
|
|
15
|
+
static streamOf(category, id) {
|
|
16
|
+
return `${category}-${id}`;
|
|
17
|
+
}
|
|
18
|
+
async findById(id) {
|
|
19
|
+
const stream = EventSourcedRepository.streamOf(this.parts.category, id);
|
|
20
|
+
const snapshot = await this.snapshotOf(stream);
|
|
21
|
+
const stored = await this.parts.store.readStream(stream, snapshot?.version ?? 0);
|
|
22
|
+
if (snapshot === undefined && stored.length === 0) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const events = [];
|
|
26
|
+
for (const event of stored) {
|
|
27
|
+
events.push(await this.parts.serializer.deserialize(event));
|
|
28
|
+
}
|
|
29
|
+
return this.parts.rehydrate(id, snapshot === undefined ? { events } : { snapshot, events });
|
|
30
|
+
}
|
|
31
|
+
async save(aggregate) {
|
|
32
|
+
const before = aggregate.version;
|
|
33
|
+
const stream = EventSourcedRepository.streamOf(this.parts.category, aggregate.id);
|
|
34
|
+
await appendChanges(aggregate, async ({ expected, events }) => {
|
|
35
|
+
await this.parts.store.append(stream, expected, await this.serialized(events));
|
|
36
|
+
});
|
|
37
|
+
await this.snapshotIfDue(aggregate, stream, before);
|
|
38
|
+
}
|
|
39
|
+
async serialized(events) {
|
|
40
|
+
const serialized = [];
|
|
41
|
+
for (const event of events) {
|
|
42
|
+
serialized.push(await this.parts.serializer.serialize(event));
|
|
43
|
+
}
|
|
44
|
+
return serialized;
|
|
45
|
+
}
|
|
46
|
+
async snapshotIfDue(aggregate, stream, before) {
|
|
47
|
+
const policy = this.parts.snapshots;
|
|
48
|
+
if (policy === undefined || Math.floor(aggregate.version / policy.every) === Math.floor(before / policy.every)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
await policy.store.save({
|
|
52
|
+
stream,
|
|
53
|
+
version: aggregate.version,
|
|
54
|
+
schemaVersion: policy.version,
|
|
55
|
+
data: await this.parts.serializer.seal(storedDataOf(policy.encode(aggregate))),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async snapshotOf(stream) {
|
|
59
|
+
const policy = this.parts.snapshots;
|
|
60
|
+
const found = await policy?.store.find(stream);
|
|
61
|
+
if (policy === undefined || found === undefined || found.schemaVersion !== policy.version) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const data = await this.parts.serializer.open(found.data);
|
|
65
|
+
return { version: found.version, state: policy.decode(new StoredEventData(data, `the snapshot of ${stream}`)) };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=event-sourced-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-sourced-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/event-sourced-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAmBhF;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IACJ,KAAK;IAAlC,YAA6B,KAA2C;qBAA3C,KAAK;IAAyC,CAAC;IAE5E,MAAM,CAAC,QAAQ,CAAC,QAAgB,EAAE,EAAU;QAC1C,OAAO,GAAG,QAAQ,IAAI,EAAE,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QACvB,MAAM,MAAM,GAAG,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;QAEjF,IAAI,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,MAAM,GAAQ,EAAE,CAAC;QAEvB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,C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AC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/G,OAAO;QACT,CAAC;QAED,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACtB,MAAM;YACN,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,aAAa,EAAE,MAAM,CAAC,OAAO;YAC7B,IAAI,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;SAC/E,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,MAAc;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QACpC,MAAM,KAAK,GAAG,MAAM,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE/C,IAAI,MAAM,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,aAAa,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;YAC1F,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE1D,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,eAAe,CAAC,IAAI,EAAE,mBAAmB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IAClH,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CheckpointStore } from '../../application/ports/checkpoint-store.js';
|
|
2
|
+
import type { EventStore } from '../../application/ports/event-store.js';
|
|
3
|
+
import type { SnapshotStore } from '../../application/ports/snapshot-store.js';
|
|
4
|
+
import type { SubjectKeyStore } from '../../application/ports/subject-key-store.js';
|
|
5
|
+
/** The stores event sourcing needs in one database, to bind to their ports in the composition root. */
|
|
6
|
+
export interface EventSourcingStores {
|
|
7
|
+
readonly events: EventStore;
|
|
8
|
+
readonly snapshots: SnapshotStore;
|
|
9
|
+
readonly checkpoints: CheckpointStore;
|
|
10
|
+
readonly subjectKeys: SubjectKeyStore;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=event-sourcing-stores.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-sourcing-stores.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/event-sourcing-stores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAEpF,uGAAuG;AACvG,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-sourcing-stores.js","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/event-sourcing-stores.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { StoredEvent } from '../../application/event-sourcing/stored-event.js';
|
|
2
|
+
import type { EventStore } from '../../application/ports/event-store.js';
|
|
3
|
+
import type { ReadModelStore } from '../../application/ports/read-model-store.js';
|
|
4
|
+
import type { ReadModelTable } from '../../application/ports/read-model-table.js';
|
|
5
|
+
import type { UnitOfWork } from '../../application/ports/unit-of-work.js';
|
|
6
|
+
export interface EventStoreProjectionRebuildParts<Row> {
|
|
7
|
+
readonly table: ReadModelTable<Row>;
|
|
8
|
+
readonly store: EventStore;
|
|
9
|
+
/** The unit of work of the table's database: the end of the replay and the swap are one transaction. */
|
|
10
|
+
readonly unitOfWork: UnitOfWork;
|
|
11
|
+
/** How the projection applies an event to the store it is given: the same projection, built over the copy. */
|
|
12
|
+
applierOn(copy: ReadModelStore<Row>): (event: StoredEvent) => Promise<void>;
|
|
13
|
+
/** Events read per round. Default 500. */
|
|
14
|
+
readonly batchSize?: number;
|
|
15
|
+
}
|
|
16
|
+
/** What a rebuild from the event store did. */
|
|
17
|
+
export interface EventStoreRebuildReport {
|
|
18
|
+
/** Events read from the store, from position zero to its head at the swap. */
|
|
19
|
+
readonly replayed: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Rebuilds a read model fed by the event store from position zero, without stopping its catch-up
|
|
23
|
+
* subscription. An empty copy of the table is filled by replaying the whole store through the
|
|
24
|
+
* projection; then, in one transaction, the writers are held, the events appended meanwhile are
|
|
25
|
+
* replayed, and the copy takes the place of the table. The subscription goes on from its
|
|
26
|
+
* checkpoint: what it applies again is stale against the stamps of the copy.
|
|
27
|
+
*/
|
|
28
|
+
export declare class EventStoreProjectionRebuild<Row> {
|
|
29
|
+
private readonly parts;
|
|
30
|
+
constructor(parts: EventStoreProjectionRebuildParts<Row>);
|
|
31
|
+
run(): Promise<EventStoreRebuildReport>;
|
|
32
|
+
private replay;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=event-store-projection-rebuild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-store-projection-rebuild.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/event-sourcing/event-store-projection-rebuild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAG1E,MAAM,WAAW,gCAAgC,CAAC,GAAG;IACnD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,wGAAwG;IACxG,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,8GAA8G;IAC9G,SAAS,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACtC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,qBAAa,2BAA2B,CAAC,GAAG;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAE,gCAAgC,CAAC,GAAG,CAAC,EAAI;IAEvE,GAAG,IAAI,OAAO,CAAC,uBAAuB,CAAC,CA0B5C;YAEa,MAAM;CAuBrB"}
|