@cratis/chronicle 3.0.0 → 3.1.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/EventStore.ts +17 -1
- package/IEventStore.ts +16 -0
- package/auditing/CausationType.ts +10 -0
- package/compliance/ComplianceContracts.ts +84 -0
- package/compliance/IPIIManager.ts +17 -0
- package/compliance/PIIManager.ts +31 -0
- package/compliance/index.ts +2 -0
- package/connection/ChronicleConnection.ts +7 -1
- package/connection/ChronicleServices.ts +2 -0
- package/connection/Guid.ts +18 -0
- package/dist/EventStore.d.ts +8 -0
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +13 -1
- package/dist/EventStore.js.map +1 -1
- package/dist/IEventStore.d.ts +12 -0
- package/dist/IEventStore.d.ts.map +1 -1
- package/dist/auditing/CausationType.d.ts +8 -0
- package/dist/auditing/CausationType.d.ts.map +1 -1
- package/dist/auditing/CausationType.js +8 -0
- package/dist/auditing/CausationType.js.map +1 -1
- package/dist/compliance/ComplianceContracts.d.ts +40 -0
- package/dist/compliance/ComplianceContracts.d.ts.map +1 -1
- package/dist/compliance/ComplianceContracts.js +71 -0
- package/dist/compliance/ComplianceContracts.js.map +1 -1
- package/dist/compliance/IPIIManager.d.ts +15 -0
- package/dist/compliance/IPIIManager.d.ts.map +1 -0
- package/dist/compliance/IPIIManager.js +4 -0
- package/dist/compliance/IPIIManager.js.map +1 -0
- package/dist/compliance/PIIManager.d.ts +20 -0
- package/dist/compliance/PIIManager.d.ts.map +1 -0
- package/dist/compliance/PIIManager.js +30 -0
- package/dist/compliance/PIIManager.js.map +1 -0
- package/dist/compliance/index.d.ts +2 -0
- package/dist/compliance/index.d.ts.map +1 -1
- package/dist/compliance/index.js +1 -0
- package/dist/compliance/index.js.map +1 -1
- package/dist/connection/ChronicleConnection.d.ts +1 -0
- package/dist/connection/ChronicleConnection.d.ts.map +1 -1
- package/dist/connection/ChronicleConnection.js +6 -1
- package/dist/connection/ChronicleConnection.js.map +1 -1
- package/dist/connection/ChronicleServices.d.ts +2 -0
- package/dist/connection/ChronicleServices.d.ts.map +1 -1
- package/dist/connection/Guid.d.ts +5 -0
- package/dist/connection/Guid.d.ts.map +1 -1
- package/dist/connection/Guid.js +15 -0
- package/dist/connection/Guid.js.map +1 -1
- package/dist/eventSequences/AppendOperationsBroadcaster.d.ts +16 -0
- package/dist/eventSequences/AppendOperationsBroadcaster.d.ts.map +1 -0
- package/dist/eventSequences/AppendOperationsBroadcaster.js +77 -0
- package/dist/eventSequences/AppendOperationsBroadcaster.js.map +1 -0
- package/dist/eventSequences/AppendOptions.d.ts +7 -0
- package/dist/eventSequences/AppendOptions.d.ts.map +1 -1
- package/dist/eventSequences/AppendResult.d.ts +14 -0
- package/dist/eventSequences/AppendResult.d.ts.map +1 -1
- package/dist/eventSequences/AppendedEventWithResult.d.ts +13 -0
- package/dist/eventSequences/AppendedEventWithResult.d.ts.map +1 -0
- package/dist/eventSequences/AppendedEventWithResult.js +4 -0
- package/dist/eventSequences/AppendedEventWithResult.js.map +1 -0
- package/dist/eventSequences/CompleteStreamError.d.ts +17 -0
- package/dist/eventSequences/CompleteStreamError.d.ts.map +1 -0
- package/dist/eventSequences/CompleteStreamError.js +20 -0
- package/dist/eventSequences/CompleteStreamError.js.map +1 -0
- package/dist/eventSequences/CompleteStreamResult.d.ts +14 -0
- package/dist/eventSequences/CompleteStreamResult.d.ts.map +1 -0
- package/dist/eventSequences/CompleteStreamResult.js +4 -0
- package/dist/eventSequences/CompleteStreamResult.js.map +1 -0
- package/dist/eventSequences/ConcurrencyViolation.d.ts +13 -0
- package/dist/eventSequences/ConcurrencyViolation.d.ts.map +1 -0
- package/dist/eventSequences/ConcurrencyViolation.js +4 -0
- package/dist/eventSequences/ConcurrencyViolation.js.map +1 -0
- package/dist/eventSequences/EventForEventSourceId.d.ts +8 -0
- package/dist/eventSequences/EventForEventSourceId.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.d.ts +35 -1
- package/dist/eventSequences/EventSequence.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.js +350 -19
- package/dist/eventSequences/EventSequence.js.map +1 -1
- package/dist/eventSequences/IEventSequence.d.ts +85 -1
- package/dist/eventSequences/IEventSequence.d.ts.map +1 -1
- package/dist/eventSequences/WaitForCompletionResult.d.ts +11 -0
- package/dist/eventSequences/WaitForCompletionResult.d.ts.map +1 -0
- package/dist/eventSequences/WaitForCompletionResult.js +4 -0
- package/dist/eventSequences/WaitForCompletionResult.js.map +1 -0
- package/dist/eventSequences/index.d.ts +5 -0
- package/dist/eventSequences/index.d.ts.map +1 -1
- package/dist/eventSequences/index.js +1 -0
- package/dist/eventSequences/index.js.map +1 -1
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.d.ts +3 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.d.ts.map +1 -1
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.js +9 -0
- package/dist/eventStoreSubscriptions/EventStoreSubscriptions.js.map +1 -1
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.d.ts +6 -0
- package/dist/eventStoreSubscriptions/IEventStoreSubscriptions.d.ts.map +1 -1
- package/dist/eventStoreSubscriptions/contracts.d.ts +18 -0
- package/dist/eventStoreSubscriptions/contracts.d.ts.map +1 -1
- package/dist/eventStoreSubscriptions/contracts.js +106 -0
- package/dist/eventStoreSubscriptions/contracts.js.map +1 -1
- package/dist/events/constraints/Constraints.js +1 -1
- package/dist/events/constraints/Constraints.js.map +1 -1
- package/dist/externalServices/ExternalServiceBuilder.d.ts +42 -0
- package/dist/externalServices/ExternalServiceBuilder.d.ts.map +1 -0
- package/dist/externalServices/ExternalServiceBuilder.js +110 -0
- package/dist/externalServices/ExternalServiceBuilder.js.map +1 -0
- package/dist/externalServices/ExternalServices.d.ts +19 -0
- package/dist/externalServices/ExternalServices.d.ts.map +1 -0
- package/dist/externalServices/ExternalServices.js +30 -0
- package/dist/externalServices/ExternalServices.js.map +1 -0
- package/dist/externalServices/ExternalServicesContracts.d.ts +137 -0
- package/dist/externalServices/ExternalServicesContracts.d.ts.map +1 -0
- package/dist/externalServices/ExternalServicesContracts.js +654 -0
- package/dist/externalServices/ExternalServicesContracts.js.map +1 -0
- package/dist/externalServices/IExternalServiceBuilder.d.ts +67 -0
- package/dist/externalServices/IExternalServiceBuilder.d.ts.map +1 -0
- package/dist/externalServices/IExternalServiceBuilder.js +4 -0
- package/dist/externalServices/IExternalServiceBuilder.js.map +1 -0
- package/dist/externalServices/IExternalServices.d.ts +13 -0
- package/dist/externalServices/IExternalServices.d.ts.map +1 -0
- package/dist/externalServices/IExternalServices.js +4 -0
- package/dist/externalServices/IExternalServices.js.map +1 -0
- package/dist/externalServices/index.d.ts +5 -0
- package/dist/externalServices/index.d.ts.map +1 -0
- package/dist/externalServices/index.js +5 -0
- package/dist/externalServices/index.js.map +1 -0
- package/dist/identities/IIdentityManager.d.ts +17 -0
- package/dist/identities/IIdentityManager.d.ts.map +1 -0
- package/dist/identities/IIdentityManager.js +4 -0
- package/dist/identities/IIdentityManager.js.map +1 -0
- package/dist/identities/IdentityManager.d.ts +20 -0
- package/dist/identities/IdentityManager.d.ts.map +1 -0
- package/dist/identities/IdentityManager.js +31 -0
- package/dist/identities/IdentityManager.js.map +1 -0
- package/dist/identities/index.d.ts +3 -0
- package/dist/identities/index.d.ts.map +1 -0
- package/dist/identities/index.js +4 -0
- package/dist/identities/index.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/observation/FailedPartition.d.ts +15 -0
- package/dist/observation/FailedPartition.d.ts.map +1 -0
- package/dist/observation/FailedPartition.js +4 -0
- package/dist/observation/FailedPartition.js.map +1 -0
- package/dist/observation/FailedPartitionAttempt.d.ts +15 -0
- package/dist/observation/FailedPartitionAttempt.d.ts.map +1 -0
- package/dist/observation/FailedPartitionAttempt.js +4 -0
- package/dist/observation/FailedPartitionAttempt.js.map +1 -0
- package/dist/observation/FailedPartitions.d.ts +24 -0
- package/dist/observation/FailedPartitions.d.ts.map +1 -0
- package/dist/observation/FailedPartitions.js +39 -0
- package/dist/observation/FailedPartitions.js.map +1 -0
- package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.d.ts +19 -0
- package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.d.ts.map +1 -0
- package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.js +4 -0
- package/dist/observation/ICanBeNotifiedWhenPartitionReplayed.js.map +1 -0
- package/dist/observation/ICanBeNotifiedWhenReplay.d.ts +17 -0
- package/dist/observation/ICanBeNotifiedWhenReplay.d.ts.map +1 -0
- package/dist/observation/ICanBeNotifiedWhenReplay.js +4 -0
- package/dist/observation/ICanBeNotifiedWhenReplay.js.map +1 -0
- package/dist/observation/IFailedPartitions.d.ts +18 -0
- package/dist/observation/IFailedPartitions.d.ts.map +1 -0
- package/dist/observation/IFailedPartitions.js +4 -0
- package/dist/observation/IFailedPartitions.js.map +1 -0
- package/dist/observation/index.d.ts +6 -0
- package/dist/observation/index.d.ts.map +1 -1
- package/dist/observation/index.js +1 -0
- package/dist/observation/index.js.map +1 -1
- package/dist/observation/notifyReplayLifecycle.d.ts +13 -0
- package/dist/observation/notifyReplayLifecycle.d.ts.map +1 -0
- package/dist/observation/notifyReplayLifecycle.js +54 -0
- package/dist/observation/notifyReplayLifecycle.js.map +1 -0
- package/dist/observation/toClientFailedPartition.d.ts +9 -0
- package/dist/observation/toClientFailedPartition.d.ts.map +1 -0
- package/dist/observation/toClientFailedPartition.js +23 -0
- package/dist/observation/toClientFailedPartition.js.map +1 -0
- package/dist/projections/Projections.d.ts +0 -4
- package/dist/projections/Projections.d.ts.map +1 -1
- package/dist/projections/Projections.js +25 -103
- package/dist/projections/Projections.js.map +1 -1
- package/dist/projections/declarative/AddBuilder.d.ts +17 -0
- package/dist/projections/declarative/AddBuilder.d.ts.map +1 -0
- package/dist/projections/declarative/AddBuilder.js +28 -0
- package/dist/projections/declarative/AddBuilder.js.map +1 -0
- package/dist/projections/declarative/AddChildBuilder.d.ts +56 -0
- package/dist/projections/declarative/AddChildBuilder.d.ts.map +1 -0
- package/dist/projections/declarative/AddChildBuilder.js +72 -0
- package/dist/projections/declarative/AddChildBuilder.js.map +1 -0
- package/dist/projections/declarative/ChildrenBuilder.d.ts +28 -0
- package/dist/projections/declarative/ChildrenBuilder.d.ts.map +1 -0
- package/dist/projections/declarative/ChildrenBuilder.js +72 -0
- package/dist/projections/declarative/ChildrenBuilder.js.map +1 -0
- package/dist/projections/declarative/CompositeKeyBuilder.d.ts +16 -0
- package/dist/projections/declarative/CompositeKeyBuilder.d.ts.map +1 -0
- package/dist/projections/declarative/CompositeKeyBuilder.js +29 -0
- package/dist/projections/declarative/CompositeKeyBuilder.js.map +1 -0
- package/dist/projections/declarative/FromBuilder.d.ts +8 -6
- package/dist/projections/declarative/FromBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromBuilder.js +44 -14
- package/dist/projections/declarative/FromBuilder.js.map +1 -1
- package/dist/projections/declarative/ICompositeKeyBuilder.d.ts +5 -0
- package/dist/projections/declarative/ICompositeKeyBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/JoinBuilder.d.ts +7 -5
- package/dist/projections/declarative/JoinBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/JoinBuilder.js +50 -16
- package/dist/projections/declarative/JoinBuilder.js.map +1 -1
- package/dist/projections/declarative/NestedBuilder.d.ts +24 -0
- package/dist/projections/declarative/NestedBuilder.d.ts.map +1 -0
- package/dist/projections/declarative/NestedBuilder.js +60 -0
- package/dist/projections/declarative/NestedBuilder.js.map +1 -0
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts +127 -0
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts.map +1 -0
- package/dist/projections/declarative/ProjectionBuilderCore.js +180 -0
- package/dist/projections/declarative/ProjectionBuilderCore.js.map +1 -0
- package/dist/projections/declarative/ProjectionBuilderFor.d.ts +6 -32
- package/dist/projections/declarative/ProjectionBuilderFor.d.ts.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderFor.js +24 -118
- package/dist/projections/declarative/ProjectionBuilderFor.js.map +1 -1
- package/dist/projections/declarative/SubtractBuilder.d.ts +17 -0
- package/dist/projections/declarative/SubtractBuilder.d.ts.map +1 -0
- package/dist/projections/declarative/SubtractBuilder.js +28 -0
- package/dist/projections/declarative/SubtractBuilder.js.map +1 -0
- package/dist/projections/declarative/index.d.ts +9 -0
- package/dist/projections/declarative/index.d.ts.map +1 -1
- package/dist/projections/declarative/index.js +8 -0
- package/dist/projections/declarative/index.js.map +1 -1
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts +90 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts.map +1 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.js +290 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.js.map +1 -0
- package/dist/reactors/ReactorSideEffects.d.ts +29 -0
- package/dist/reactors/ReactorSideEffects.d.ts.map +1 -0
- package/dist/reactors/ReactorSideEffects.js +70 -0
- package/dist/reactors/ReactorSideEffects.js.map +1 -0
- package/dist/reactors/Reactors.d.ts +4 -1
- package/dist/reactors/Reactors.d.ts.map +1 -1
- package/dist/reactors/Reactors.js +23 -4
- package/dist/reactors/Reactors.js.map +1 -1
- package/dist/reducers/Reducers.d.ts.map +1 -1
- package/dist/reducers/Reducers.js +15 -3
- package/dist/reducers/Reducers.js.map +1 -1
- package/dist/reducers/reducer.d.ts +9 -1
- package/dist/reducers/reducer.d.ts.map +1 -1
- package/dist/reducers/reducer.js +4 -2
- package/dist/reducers/reducer.js.map +1 -1
- package/dist/transactions/IUnitOfWork.d.ts +18 -0
- package/dist/transactions/IUnitOfWork.d.ts.map +1 -1
- package/dist/transactions/UnitOfWork.d.ts +9 -0
- package/dist/transactions/UnitOfWork.d.ts.map +1 -1
- package/dist/transactions/UnitOfWork.js +14 -0
- package/dist/transactions/UnitOfWork.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eventSequences/AppendOperationsBroadcaster.ts +83 -0
- package/eventSequences/AppendOptions.ts +8 -0
- package/eventSequences/AppendResult.ts +16 -0
- package/eventSequences/AppendedEventWithResult.ts +17 -0
- package/eventSequences/CompleteStreamError.ts +20 -0
- package/eventSequences/CompleteStreamResult.ts +13 -0
- package/eventSequences/ConcurrencyViolation.ts +18 -0
- package/eventSequences/EventForEventSourceId.ts +12 -0
- package/eventSequences/EventSequence.spec.ts +588 -0
- package/eventSequences/EventSequence.ts +406 -20
- package/eventSequences/IEventSequence.ts +109 -1
- package/eventSequences/WaitForCompletionResult.ts +15 -0
- package/eventSequences/index.ts +5 -0
- package/eventStoreSubscriptions/EventStoreSubscriptions.spec.ts +52 -0
- package/eventStoreSubscriptions/EventStoreSubscriptions.ts +19 -1
- package/eventStoreSubscriptions/IEventStoreSubscriptions.ts +7 -0
- package/eventStoreSubscriptions/contracts.ts +126 -0
- package/events/constraints/Constraints.ts +1 -1
- package/externalServices/ExternalServiceBuilder.ts +128 -0
- package/externalServices/ExternalServices.ts +34 -0
- package/externalServices/ExternalServicesContracts.ts +709 -0
- package/externalServices/IExternalServiceBuilder.ts +76 -0
- package/externalServices/IExternalServices.ts +16 -0
- package/externalServices/index.ts +7 -0
- package/identities/IIdentityManager.ts +19 -0
- package/identities/IdentityManager.ts +32 -0
- package/identities/index.ts +5 -0
- package/index.ts +6 -0
- package/observation/FailedPartition.ts +21 -0
- package/observation/FailedPartitionAttempt.ts +21 -0
- package/observation/FailedPartitions.spec.ts +75 -0
- package/observation/FailedPartitions.ts +44 -0
- package/observation/ICanBeNotifiedWhenPartitionReplayed.ts +22 -0
- package/observation/ICanBeNotifiedWhenReplay.ts +20 -0
- package/observation/IFailedPartitions.ts +22 -0
- package/observation/index.ts +6 -0
- package/observation/notifyReplayLifecycle.spec.ts +98 -0
- package/observation/notifyReplayLifecycle.ts +61 -0
- package/observation/toClientFailedPartition.ts +26 -0
- package/package.json +12 -2
- package/projections/Projections.childrenAndNested.spec.ts +188 -0
- package/projections/Projections.spec.ts +131 -0
- package/projections/Projections.ts +37 -119
- package/projections/declarative/AddBuilder.ts +28 -0
- package/projections/declarative/AddChildBuilder.ts +97 -0
- package/projections/declarative/ChildrenBuilder.spec.ts +157 -0
- package/projections/declarative/ChildrenBuilder.ts +90 -0
- package/projections/declarative/CompositeKeyBuilder.spec.ts +117 -0
- package/projections/declarative/CompositeKeyBuilder.ts +38 -0
- package/projections/declarative/FromBuilder.ts +60 -15
- package/projections/declarative/ICompositeKeyBuilder.ts +6 -0
- package/projections/declarative/JoinBuilder.ts +66 -17
- package/projections/declarative/NestedBuilder.ts +76 -0
- package/projections/declarative/ProjectionBuilderCore.ts +257 -0
- package/projections/declarative/ProjectionBuilderFor.spec.ts +115 -0
- package/projections/declarative/ProjectionBuilderFor.ts +29 -168
- package/projections/declarative/SubtractBuilder.ts +28 -0
- package/projections/declarative/index.ts +9 -0
- package/projections/modelBound/childrenAndNestedBuilder.ts +354 -0
- package/reactors/ReactorSideEffects.spec.ts +182 -0
- package/reactors/ReactorSideEffects.ts +97 -0
- package/reactors/Reactors.ts +29 -4
- package/reducers/Reducers.spec.ts +87 -0
- package/reducers/Reducers.ts +15 -3
- package/reducers/reducer.spec.ts +40 -0
- package/reducers/reducer.ts +11 -2
- package/transactions/IUnitOfWork.ts +21 -0
- package/transactions/UnitOfWork.spec.ts +82 -0
- package/transactions/UnitOfWork.ts +20 -0
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
// Copyright (c) Cratis. All rights reserved.
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
import { AutoMap } from '@cratis/chronicle.contracts';
|
|
4
|
-
import {
|
|
4
|
+
import { PropertyPathResolverProxyHandler } from '@cratis/fundamentals';
|
|
5
5
|
import { EventSequenceId } from '../../eventSequences/EventSequenceId';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { RemovedWithBuilder } from './RemovedWithBuilder';
|
|
10
|
-
import { RemovedWithJoinBuilder } from './RemovedWithJoinBuilder';
|
|
6
|
+
import { ChildrenBuilder } from './ChildrenBuilder';
|
|
7
|
+
import { NestedBuilder } from './NestedBuilder';
|
|
8
|
+
import { ProjectionBuilderCore } from './ProjectionBuilderCore';
|
|
11
9
|
/**
|
|
12
10
|
* Concrete implementation of {@link IProjectionBuilderFor} that accumulates projection
|
|
13
11
|
* configuration and produces a Chronicle-compatible projection definition payload.
|
|
14
12
|
* @template TReadModel - The read model type this projection produces.
|
|
15
13
|
*/
|
|
16
|
-
export class ProjectionBuilderFor {
|
|
14
|
+
export class ProjectionBuilderFor extends ProjectionBuilderCore {
|
|
17
15
|
_eventSequenceId = EventSequenceId.eventLog.value;
|
|
18
16
|
_containerName;
|
|
19
17
|
_rewindable = true;
|
|
20
18
|
_active = true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_removedWith = [];
|
|
26
|
-
_removedWithJoin = [];
|
|
27
|
-
_all = {
|
|
28
|
-
Properties: {},
|
|
29
|
-
IncludeChildren: false,
|
|
30
|
-
AutoMap: AutoMap.Inherit
|
|
31
|
-
};
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this._autoMap = AutoMap.Enabled;
|
|
22
|
+
}
|
|
32
23
|
/** @inheritdoc */
|
|
33
24
|
fromEventSequence(eventSequenceId) {
|
|
34
25
|
this._eventSequenceId = eventSequenceId;
|
|
@@ -50,99 +41,25 @@ export class ProjectionBuilderFor {
|
|
|
50
41
|
return this;
|
|
51
42
|
}
|
|
52
43
|
/** @inheritdoc */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
noAutoMap() {
|
|
59
|
-
this._autoMap = AutoMap.Disabled;
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
/** @inheritdoc */
|
|
63
|
-
withInitialValues(initialValueProvider) {
|
|
64
|
-
this._initialState = JSON.stringify(initialValueProvider());
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
/** @inheritdoc */
|
|
68
|
-
from(eventType, builderCallback) {
|
|
69
|
-
const contractType = this.toContractEventType(eventType);
|
|
70
|
-
const fromBuilder = new FromBuilder();
|
|
71
|
-
builderCallback?.(fromBuilder);
|
|
72
|
-
this._from.push({
|
|
73
|
-
Key: contractType,
|
|
74
|
-
Value: {
|
|
75
|
-
Properties: fromBuilder.entry.properties,
|
|
76
|
-
Key: fromBuilder.entry.key,
|
|
77
|
-
ParentKey: fromBuilder.entry.parentKey
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
/** @inheritdoc */
|
|
83
|
-
join(eventType, builderCallback) {
|
|
84
|
-
const contractType = this.toContractEventType(eventType);
|
|
85
|
-
const joinBuilder = new JoinBuilder();
|
|
86
|
-
builderCallback?.(joinBuilder);
|
|
87
|
-
this._join.push({
|
|
88
|
-
Key: contractType,
|
|
89
|
-
Value: {
|
|
90
|
-
On: joinBuilder.entry.on,
|
|
91
|
-
Properties: joinBuilder.entry.properties,
|
|
92
|
-
Key: joinBuilder.entry.key
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
/** @inheritdoc */
|
|
98
|
-
fromEvery(builderCallback) {
|
|
99
|
-
const builder = new FromEveryBuilder();
|
|
44
|
+
children(targetPropertyAccessor, builderCallback) {
|
|
45
|
+
const handler = new PropertyPathResolverProxyHandler();
|
|
46
|
+
const proxy = new Proxy({}, handler);
|
|
47
|
+
targetPropertyAccessor(proxy);
|
|
48
|
+
const builder = new ChildrenBuilder();
|
|
100
49
|
builderCallback(builder);
|
|
101
|
-
this.
|
|
102
|
-
Properties: {
|
|
103
|
-
...this._all.Properties,
|
|
104
|
-
...builder.entry.properties
|
|
105
|
-
},
|
|
106
|
-
IncludeChildren: builder.entry.includeChildren,
|
|
107
|
-
AutoMap: AutoMap.Inherit
|
|
108
|
-
};
|
|
50
|
+
this._children[handler.property] = builder.buildDefinition();
|
|
109
51
|
return this;
|
|
110
52
|
}
|
|
111
53
|
/** @inheritdoc */
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
Key: removedWithBuilder.entry.key,
|
|
120
|
-
ParentKey: removedWithBuilder.entry.parentKey
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
/** @inheritdoc */
|
|
126
|
-
removedWithJoin(eventType, builderCallback) {
|
|
127
|
-
const contractType = this.toContractEventType(eventType);
|
|
128
|
-
const removedWithJoinBuilder = new RemovedWithJoinBuilder();
|
|
129
|
-
builderCallback?.(removedWithJoinBuilder);
|
|
130
|
-
this._removedWithJoin.push({
|
|
131
|
-
Key: contractType,
|
|
132
|
-
Value: {
|
|
133
|
-
Key: removedWithJoinBuilder.entry.key
|
|
134
|
-
}
|
|
135
|
-
});
|
|
54
|
+
nested(targetPropertyAccessor, builderCallback) {
|
|
55
|
+
const handler = new PropertyPathResolverProxyHandler();
|
|
56
|
+
const proxy = new Proxy({}, handler);
|
|
57
|
+
targetPropertyAccessor(proxy);
|
|
58
|
+
const builder = new NestedBuilder();
|
|
59
|
+
builderCallback(builder);
|
|
60
|
+
this._nested[handler.property] = builder.buildDefinition();
|
|
136
61
|
return this;
|
|
137
62
|
}
|
|
138
|
-
/** @inheritdoc */
|
|
139
|
-
children(_targetPropertyAccessor, _builderCallback) {
|
|
140
|
-
throw new Error('children is not implemented yet.');
|
|
141
|
-
}
|
|
142
|
-
/** @inheritdoc */
|
|
143
|
-
nested(_targetPropertyAccessor, _builderCallback) {
|
|
144
|
-
throw new Error('nested is not implemented yet.');
|
|
145
|
-
}
|
|
146
63
|
/**
|
|
147
64
|
* Builds the contract-compatible projection definition payload.
|
|
148
65
|
* @param identifier - The projection identifier.
|
|
@@ -159,7 +76,7 @@ export class ProjectionBuilderFor {
|
|
|
159
76
|
InitialModelState: this._initialState,
|
|
160
77
|
From: this._from,
|
|
161
78
|
Join: this._join,
|
|
162
|
-
Children:
|
|
79
|
+
Children: this._children,
|
|
163
80
|
FromEvery: [],
|
|
164
81
|
All: this._all,
|
|
165
82
|
FromEventProperty: undefined,
|
|
@@ -168,7 +85,7 @@ export class ProjectionBuilderFor {
|
|
|
168
85
|
LastUpdated: { Value: '' },
|
|
169
86
|
Tags: [],
|
|
170
87
|
AutoMap: this._autoMap,
|
|
171
|
-
Nested:
|
|
88
|
+
Nested: this._nested
|
|
172
89
|
};
|
|
173
90
|
definition.LastUpdated = { Value: this.computeStableLastUpdated(definition) };
|
|
174
91
|
return definition;
|
|
@@ -194,17 +111,6 @@ export class ProjectionBuilderFor {
|
|
|
194
111
|
}
|
|
195
112
|
return Array.from(mappedProperties.values());
|
|
196
113
|
}
|
|
197
|
-
toContractEventType(eventTypeConstructor) {
|
|
198
|
-
const eventType = getEventTypeFor(eventTypeConstructor);
|
|
199
|
-
if (eventType.id.value === '') {
|
|
200
|
-
throw new Error(`Event type '${eventTypeConstructor.name}' is not decorated with @eventType().`);
|
|
201
|
-
}
|
|
202
|
-
return {
|
|
203
|
-
Id: eventType.id.value,
|
|
204
|
-
Generation: eventType.generation.value,
|
|
205
|
-
Tombstone: false
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
114
|
/**
|
|
209
115
|
* Computes a stable, deterministic ISO timestamp from the projection definition content,
|
|
210
116
|
* excluding the LastUpdated field itself. This ensures the server does not interpret
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectionBuilderFor.js","sourceRoot":"","sources":["../../../projections/declarative/ProjectionBuilderFor.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"ProjectionBuilderFor.js","sourceRoot":"","sources":["../../../projections/declarative/ProjectionBuilderFor.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAoB,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,OAAO,oBAAiC,SAAQ,qBAAmE;IAC7G,gBAAgB,GAAW,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC1D,cAAc,CAAqB;IACnC,WAAW,GAAY,IAAI,CAAC;IAC5B,OAAO,GAAY,IAAI,CAAC;IAEhC;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IACpC,CAAC;IAED,kBAAkB;IAClB,iBAAiB,CAAC,eAAuB;QACrC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,aAAa,CAAC,IAAY;QACtB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,aAAa;QACT,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,OAAO;QACH,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,kBAAkB;IAClB,QAAQ,CACJ,sBAAoD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AC,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACK,wBAAwB,CAAC,UAAmC;QAChE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;QACnD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/D,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/C,CAAC;CACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropertyAccessor } from '@cratis/fundamentals';
|
|
2
|
+
import { ISubtractBuilder } from './ISubtractBuilder';
|
|
3
|
+
/**
|
|
4
|
+
* Concrete implementation of {@link ISubtractBuilder} that records a subtract expression
|
|
5
|
+
* into the owning from/join builder.
|
|
6
|
+
* @template TEvent - The event type.
|
|
7
|
+
* @template TParentBuilder - The parent builder type.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SubtractBuilder<TEvent, TParentBuilder> implements ISubtractBuilder<TEvent, TParentBuilder> {
|
|
10
|
+
private readonly _readModelProperty;
|
|
11
|
+
private readonly _setProperty;
|
|
12
|
+
private readonly _parent;
|
|
13
|
+
constructor(_readModelProperty: string, _setProperty: (readModelProp: string, expression: string) => void, _parent: TParentBuilder);
|
|
14
|
+
/** @inheritdoc */
|
|
15
|
+
with(eventPropertyAccessor: PropertyAccessor<TEvent>): TParentBuilder;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=SubtractBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubtractBuilder.d.ts","sourceRoot":"","sources":["../../../projections/declarative/SubtractBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAoC,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;GAKG;AACH,qBAAa,eAAe,CAAC,MAAM,EAAE,cAAc,CAAE,YAAW,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC;IAEhG,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,kBAAkB,EAAE,MAAM,EAC1B,YAAY,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,EACjE,OAAO,EAAE,cAAc;IAG5C,kBAAkB;IAClB,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,cAAc;CAOxE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { PropertyPathResolverProxyHandler } from '@cratis/fundamentals';
|
|
4
|
+
/**
|
|
5
|
+
* Concrete implementation of {@link ISubtractBuilder} that records a subtract expression
|
|
6
|
+
* into the owning from/join builder.
|
|
7
|
+
* @template TEvent - The event type.
|
|
8
|
+
* @template TParentBuilder - The parent builder type.
|
|
9
|
+
*/
|
|
10
|
+
export class SubtractBuilder {
|
|
11
|
+
_readModelProperty;
|
|
12
|
+
_setProperty;
|
|
13
|
+
_parent;
|
|
14
|
+
constructor(_readModelProperty, _setProperty, _parent) {
|
|
15
|
+
this._readModelProperty = _readModelProperty;
|
|
16
|
+
this._setProperty = _setProperty;
|
|
17
|
+
this._parent = _parent;
|
|
18
|
+
}
|
|
19
|
+
/** @inheritdoc */
|
|
20
|
+
with(eventPropertyAccessor) {
|
|
21
|
+
const handler = new PropertyPathResolverProxyHandler();
|
|
22
|
+
const proxy = new Proxy({}, handler);
|
|
23
|
+
eventPropertyAccessor(proxy);
|
|
24
|
+
this._setProperty(this._readModelProperty, `$subtract(${handler.property})`);
|
|
25
|
+
return this._parent;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=SubtractBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubtractBuilder.js","sourceRoot":"","sources":["../../../projections/declarative/SubtractBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAoB,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAG1F;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAEH;IACA;IACA;IAHrB,YACqB,kBAA0B,EAC1B,YAAiE,EACjE,OAAuB;QAFvB,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,iBAAY,GAAZ,YAAY,CAAqD;QACjE,YAAO,GAAP,OAAO,CAAgB;IACzC,CAAC;IAEJ,kBAAkB;IAClB,IAAI,CAAC,qBAA+C;QAChD,MAAM,OAAO,GAAG,IAAI,gCAAgC,EAAE,CAAC;QACvD,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACrC,qBAAqB,CAAC,KAAe,CAAC,CAAC;QACvC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,aAAa,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;CACJ"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export { projection, getProjectionMetadata, isProjection } from './projection';
|
|
2
2
|
export type { ProjectionMetadata } from './projection';
|
|
3
3
|
export { ProjectionBuilderFor } from './ProjectionBuilderFor';
|
|
4
|
+
export { ProjectionBuilderCore } from './ProjectionBuilderCore';
|
|
5
|
+
export { ChildrenBuilder } from './ChildrenBuilder';
|
|
6
|
+
export { NestedBuilder } from './NestedBuilder';
|
|
7
|
+
export { AddChildBuilder } from './AddChildBuilder';
|
|
8
|
+
export type { ChildAdditionEntry } from './AddChildBuilder';
|
|
9
|
+
export { CompositeKeyBuilder } from './CompositeKeyBuilder';
|
|
4
10
|
export { FromBuilder } from './FromBuilder';
|
|
11
|
+
export { JoinBuilder } from './JoinBuilder';
|
|
5
12
|
export { SetBuilder } from './SetBuilder';
|
|
13
|
+
export { AddBuilder } from './AddBuilder';
|
|
14
|
+
export { SubtractBuilder } from './SubtractBuilder';
|
|
6
15
|
export { RemovedWithBuilder } from './RemovedWithBuilder';
|
|
7
16
|
export type { IProjectionFor } from './IProjectionFor';
|
|
8
17
|
export type { IProjectionBuilderFor } from './IProjectionBuilderFor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../projections/declarative/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/E,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,YAAY,EAAE,kBAAkB,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AACjE,YAAY,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
export { projection, getProjectionMetadata, isProjection } from './projection';
|
|
4
4
|
export { ProjectionBuilderFor } from './ProjectionBuilderFor';
|
|
5
|
+
export { ProjectionBuilderCore } from './ProjectionBuilderCore';
|
|
6
|
+
export { ChildrenBuilder } from './ChildrenBuilder';
|
|
7
|
+
export { NestedBuilder } from './NestedBuilder';
|
|
8
|
+
export { AddChildBuilder } from './AddChildBuilder';
|
|
9
|
+
export { CompositeKeyBuilder } from './CompositeKeyBuilder';
|
|
5
10
|
export { FromBuilder } from './FromBuilder';
|
|
11
|
+
export { JoinBuilder } from './JoinBuilder';
|
|
6
12
|
export { SetBuilder } from './SetBuilder';
|
|
13
|
+
export { AddBuilder } from './AddBuilder';
|
|
14
|
+
export { SubtractBuilder } from './SubtractBuilder';
|
|
7
15
|
export { RemovedWithBuilder } from './RemovedWithBuilder';
|
|
8
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../projections/declarative/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../projections/declarative/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { AutoMap } from '@cratis/chronicle.contracts';
|
|
3
|
+
import { ChildrenFromMetadata } from './childrenFrom';
|
|
4
|
+
/** The contract-level event type identifier shape used across projection definitions. */
|
|
5
|
+
export type ContractEventType = {
|
|
6
|
+
Id: string;
|
|
7
|
+
Generation: number;
|
|
8
|
+
Tombstone: boolean;
|
|
9
|
+
};
|
|
10
|
+
/** Accumulated property mapping for a from clause. */
|
|
11
|
+
export interface FromRecord {
|
|
12
|
+
Key: ContractEventType;
|
|
13
|
+
Value: {
|
|
14
|
+
Properties: Record<string, string>;
|
|
15
|
+
Key: string;
|
|
16
|
+
ParentKey: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Plain object shape matching the wire-level `ChildrenDefinition`. */
|
|
20
|
+
export interface ChildrenDefinitionLike {
|
|
21
|
+
IdentifiedBy: string;
|
|
22
|
+
From: FromRecord[];
|
|
23
|
+
Join: unknown[];
|
|
24
|
+
Children: Record<string, ChildrenDefinitionLike>;
|
|
25
|
+
All: {
|
|
26
|
+
Properties: Record<string, string>;
|
|
27
|
+
IncludeChildren: boolean;
|
|
28
|
+
AutoMap: AutoMap;
|
|
29
|
+
};
|
|
30
|
+
RemovedWith: Array<{
|
|
31
|
+
Key: ContractEventType;
|
|
32
|
+
Value: {
|
|
33
|
+
Key: string;
|
|
34
|
+
ParentKey: string;
|
|
35
|
+
};
|
|
36
|
+
}>;
|
|
37
|
+
RemovedWithJoin: Array<{
|
|
38
|
+
Key: ContractEventType;
|
|
39
|
+
Value: {
|
|
40
|
+
Key: string;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
AutoMap: AutoMap;
|
|
44
|
+
Nested: Record<string, ChildrenDefinitionLike>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolves the contract event type for a decorated event constructor.
|
|
48
|
+
* @param eventTypeConstructor - The event class constructor.
|
|
49
|
+
* @returns The contract-level event type identifier.
|
|
50
|
+
*/
|
|
51
|
+
export declare function toContractEventType(eventTypeConstructor: Function): ContractEventType;
|
|
52
|
+
/**
|
|
53
|
+
* Builds a stable map key for a contract event type.
|
|
54
|
+
* @param eventType - The contract event type.
|
|
55
|
+
* @returns A string key unique to the event type/generation/tombstone combination.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getEventTypeMapKey(eventType: ContractEventType): string;
|
|
58
|
+
/**
|
|
59
|
+
* Gets or creates the `From` entry for an event type within the given map.
|
|
60
|
+
* @param fromByEventType - The map of event type key to accumulated from entry.
|
|
61
|
+
* @param eventTypeConstructor - The event constructor to resolve the entry for.
|
|
62
|
+
* @returns The existing or newly created from entry.
|
|
63
|
+
*/
|
|
64
|
+
export declare function ensureFromEntry(fromByEventType: Map<string, FromRecord>, eventTypeConstructor: Function): FromRecord;
|
|
65
|
+
/**
|
|
66
|
+
* Applies the property-mapping decorators (`@setFrom`, `@setFromContext`, `@setValue`,
|
|
67
|
+
* `@addFrom`, `@subtractFrom`, `@increment`, `@decrement`, `@count`) declared on a single
|
|
68
|
+
* property into the given from-by-event-type map. Shared by the root model-bound processing
|
|
69
|
+
* loop and by child/nested type processing below, so both honor the same decorators.
|
|
70
|
+
* @param prototype - The class prototype the property is declared on.
|
|
71
|
+
* @param property - The property name.
|
|
72
|
+
* @param fromByEventType - The map of event type key to accumulated from entry to populate.
|
|
73
|
+
*/
|
|
74
|
+
export declare function applyPropertyMappings(prototype: object, property: string, fromByEventType: Map<string, FromRecord>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Builds the `ChildrenDefinition` for a `@childrenFrom` collection property.
|
|
77
|
+
* @param type - The class declaring the property.
|
|
78
|
+
* @param property - The property name.
|
|
79
|
+
* @param metadataList - The `@childrenFrom` metadata entries declared on the property (one per creating event type).
|
|
80
|
+
* @returns The wire-shaped children definition.
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildChildrenEntry(type: Function, property: string, metadataList: ChildrenFromMetadata[]): ChildrenDefinitionLike;
|
|
83
|
+
/**
|
|
84
|
+
* Builds the `ChildrenDefinition` for a `@nested` single-object property.
|
|
85
|
+
* @param type - The class declaring the property.
|
|
86
|
+
* @param property - The property name.
|
|
87
|
+
* @returns The wire-shaped nested definition.
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildNestedEntry(type: Function, property: string): ChildrenDefinitionLike;
|
|
90
|
+
//# sourceMappingURL=childrenAndNestedBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"childrenAndNestedBuilder.d.ts","sourceRoot":"","sources":["../../../projections/modelBound/childrenAndNestedBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAKtD,OAAO,EAAE,oBAAoB,EAA2B,MAAM,gBAAgB,CAAC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