@cratis/chronicle 0.0.1
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/ChronicleClient.ts +453 -0
- package/ChronicleOptions.ts +104 -0
- package/EventSequences/AppendError.ts +10 -0
- package/EventSequences/AppendOptions.ts +15 -0
- package/EventSequences/AppendResult.ts +23 -0
- package/EventSequences/ConstraintViolation.ts +16 -0
- package/EventSequences/EventLog.ts +21 -0
- package/EventSequences/EventSequence.ts +372 -0
- package/EventSequences/EventSequenceId.ts +17 -0
- package/EventSequences/EventSequenceNumber.ts +38 -0
- package/EventSequences/IEventLog.ts +10 -0
- package/EventSequences/IEventSequence.ts +47 -0
- package/EventSequences/index.ts +13 -0
- package/EventStore.ts +132 -0
- package/EventStoreName.ts +14 -0
- package/EventStoreNamespaceName.ts +17 -0
- package/Events/AppendedEvent.ts +19 -0
- package/Events/CausationEntry.ts +13 -0
- package/Events/Constraints/ConstraintBuilder.ts +86 -0
- package/Events/Constraints/ConstraintId.ts +14 -0
- package/Events/Constraints/Constraints.ts +117 -0
- package/Events/Constraints/IConstraint.ts +18 -0
- package/Events/Constraints/IConstraintBuilder.ts +44 -0
- package/Events/Constraints/IConstraints.ts +28 -0
- package/Events/Constraints/IUniqueConstraintBuilder.ts +52 -0
- package/Events/Constraints/UniqueConstraintBuilder.ts +97 -0
- package/Events/Constraints/constraint.ts +56 -0
- package/Events/Constraints/index.ts +15 -0
- package/Events/EventContext.ts +28 -0
- package/Events/EventType.ts +41 -0
- package/Events/EventTypeGeneration.ts +20 -0
- package/Events/EventTypeId.ts +19 -0
- package/Events/EventTypes.ts +95 -0
- package/Events/IEventTypes.ts +39 -0
- package/Events/eventTypeDecorator.ts +147 -0
- package/Events/index.ts +14 -0
- package/IChronicleClient.ts +39 -0
- package/IEventStore.ts +56 -0
- package/Metrics.ts +109 -0
- package/Observation/ObserverId.ts +14 -0
- package/Observation/ObserverRunningState.ts +34 -0
- package/Observation/index.ts +5 -0
- package/Projections/IProjections.ts +19 -0
- package/Projections/ProjectionId.ts +14 -0
- package/Projections/Projections.ts +463 -0
- package/Projections/declarative/AllSetBuilder.ts +39 -0
- package/Projections/declarative/FromBuilder.ts +144 -0
- package/Projections/declarative/FromEveryBuilder.ts +46 -0
- package/Projections/declarative/IAddBuilder.ts +18 -0
- package/Projections/declarative/IAddChildBuilder.ts +25 -0
- package/Projections/declarative/IAllSetBuilder.ts +31 -0
- package/Projections/declarative/IChildrenBuilder.ts +31 -0
- package/Projections/declarative/ICompositeKeyBuilder.ts +22 -0
- package/Projections/declarative/IFromBuilder.ts +12 -0
- package/Projections/declarative/IFromEveryBuilder.ts +24 -0
- package/Projections/declarative/IJoinBuilder.ts +20 -0
- package/Projections/declarative/INestedBuilder.ts +19 -0
- package/Projections/declarative/IProjectionBuilder.ts +98 -0
- package/Projections/declarative/IProjectionBuilderFor.ts +38 -0
- package/Projections/declarative/IProjectionFor.ts +18 -0
- package/Projections/declarative/IReadModelPropertiesBuilder.ts +132 -0
- package/Projections/declarative/IRemovedWithBuilder.ts +25 -0
- package/Projections/declarative/IRemovedWithJoinBuilder.ts +25 -0
- package/Projections/declarative/ISetBuilder.ts +38 -0
- package/Projections/declarative/ISubtractBuilder.ts +18 -0
- package/Projections/declarative/JoinBuilder.ts +148 -0
- package/Projections/declarative/ProjectionBuilderFor.ts +277 -0
- package/Projections/declarative/RemovedWithBuilder.ts +40 -0
- package/Projections/declarative/RemovedWithJoinBuilder.ts +43 -0
- package/Projections/declarative/SetBuilder.ts +46 -0
- package/Projections/declarative/index.ts +26 -0
- package/Projections/declarative/projection.ts +59 -0
- package/Projections/index.ts +8 -0
- package/Projections/modelBound/FromEventMetadata.ts +10 -0
- package/Projections/modelBound/FromEventOptions.ts +12 -0
- package/Projections/modelBound/addFrom.ts +41 -0
- package/Projections/modelBound/childrenFrom.ts +52 -0
- package/Projections/modelBound/clearWith.ts +54 -0
- package/Projections/modelBound/count.ts +41 -0
- package/Projections/modelBound/decrement.ts +41 -0
- package/Projections/modelBound/fromEvent.ts +40 -0
- package/Projections/modelBound/fromEvery.ts +39 -0
- package/Projections/modelBound/increment.ts +41 -0
- package/Projections/modelBound/index.ts +38 -0
- package/Projections/modelBound/join.ts +44 -0
- package/Projections/modelBound/modelBound.ts +59 -0
- package/Projections/modelBound/nested.ts +29 -0
- package/Projections/modelBound/notRewindable.ts +24 -0
- package/Projections/modelBound/removedWith.ts +60 -0
- package/Projections/modelBound/removedWithJoin.ts +55 -0
- package/Projections/modelBound/setFrom.ts +41 -0
- package/Projections/modelBound/setFromContext.ts +41 -0
- package/Projections/modelBound/setValue.ts +41 -0
- package/Projections/modelBound/subtractFrom.ts +41 -0
- package/README.md +69 -0
- package/Reactors/IReactors.ts +19 -0
- package/Reactors/ReactorId.ts +14 -0
- package/Reactors/Reactors.ts +320 -0
- package/Reactors/index.ts +8 -0
- package/Reactors/reactor.ts +75 -0
- package/ReadModels/ReadModelId.ts +14 -0
- package/ReadModels/index.ts +6 -0
- package/ReadModels/readModel.ts +89 -0
- package/Reducers/IReducers.ts +19 -0
- package/Reducers/ReducerId.ts +14 -0
- package/Reducers/Reducers.ts +322 -0
- package/Reducers/index.ts +8 -0
- package/Reducers/reducer.ts +87 -0
- package/Schemas/JsonSchema.ts +18 -0
- package/Schemas/JsonSchemaGenerator.ts +107 -0
- package/Schemas/index.ts +6 -0
- package/Schemas/jsonSchemaProperty.ts +24 -0
- package/Tracing.ts +21 -0
- package/artifacts/DefaultClientArtifactsProvider.ts +56 -0
- package/artifacts/IClientArtifactsProvider.ts +30 -0
- package/artifacts/index.ts +5 -0
- package/connection/ChronicleConnection.ts +226 -0
- package/connection/ChronicleConnectionString.ts +4 -0
- package/connection/ChronicleServices.ts +4 -0
- package/connection/ConnectionLifecycle.ts +77 -0
- package/connection/DateTimeOffset.ts +4 -0
- package/connection/Guid.ts +4 -0
- package/connection/TokenProvider.ts +13 -0
- package/connection/index.ts +9 -0
- package/dist/ChronicleClient.d.ts +55 -0
- package/dist/ChronicleClient.d.ts.map +1 -0
- package/dist/ChronicleClient.js +396 -0
- package/dist/ChronicleClient.js.map +1 -0
- package/dist/ChronicleOptions.d.ts +54 -0
- package/dist/ChronicleOptions.d.ts.map +1 -0
- package/dist/ChronicleOptions.js +75 -0
- package/dist/ChronicleOptions.js.map +1 -0
- package/dist/EventSequences/AppendError.d.ts +8 -0
- package/dist/EventSequences/AppendError.d.ts.map +1 -0
- package/dist/EventSequences/AppendError.js +4 -0
- package/dist/EventSequences/AppendError.js.map +1 -0
- package/dist/EventSequences/AppendOptions.d.ts +11 -0
- package/dist/EventSequences/AppendOptions.d.ts.map +1 -0
- package/dist/EventSequences/AppendOptions.js +4 -0
- package/dist/EventSequences/AppendOptions.js.map +1 -0
- package/dist/EventSequences/AppendResult.d.ts +17 -0
- package/dist/EventSequences/AppendResult.d.ts.map +1 -0
- package/dist/EventSequences/AppendResult.js +4 -0
- package/dist/EventSequences/AppendResult.js.map +1 -0
- package/dist/EventSequences/ConstraintViolation.d.ts +12 -0
- package/dist/EventSequences/ConstraintViolation.d.ts.map +1 -0
- package/dist/EventSequences/ConstraintViolation.js +4 -0
- package/dist/EventSequences/ConstraintViolation.js.map +1 -0
- package/dist/EventSequences/EventLog.d.ts +11 -0
- package/dist/EventSequences/EventLog.d.ts.map +1 -0
- package/dist/EventSequences/EventLog.js +14 -0
- package/dist/EventSequences/EventLog.js.map +1 -0
- package/dist/EventSequences/EventSequence.d.ts +27 -0
- package/dist/EventSequences/EventSequence.d.ts.map +1 -0
- package/dist/EventSequences/EventSequence.js +337 -0
- package/dist/EventSequences/EventSequence.js.map +1 -0
- package/dist/EventSequences/EventSequenceId.d.ts +12 -0
- package/dist/EventSequences/EventSequenceId.d.ts.map +1 -0
- package/dist/EventSequences/EventSequenceId.js +18 -0
- package/dist/EventSequences/EventSequenceId.js.map +1 -0
- package/dist/EventSequences/EventSequenceNumber.d.ts +26 -0
- package/dist/EventSequences/EventSequenceNumber.d.ts.map +1 -0
- package/dist/EventSequences/EventSequenceNumber.js +36 -0
- package/dist/EventSequences/EventSequenceNumber.js.map +1 -0
- package/dist/EventSequences/IEventLog.d.ts +8 -0
- package/dist/EventSequences/IEventLog.d.ts.map +1 -0
- package/dist/EventSequences/IEventLog.js +4 -0
- package/dist/EventSequences/IEventLog.js.map +1 -0
- package/dist/EventSequences/IEventSequence.d.ts +40 -0
- package/dist/EventSequences/IEventSequence.d.ts.map +1 -0
- package/dist/EventSequences/IEventSequence.js +4 -0
- package/dist/EventSequences/IEventSequence.js.map +1 -0
- package/dist/EventSequences/index.d.ts +11 -0
- package/dist/EventSequences/index.d.ts.map +1 -0
- package/dist/EventSequences/index.js +7 -0
- package/dist/EventSequences/index.js.map +1 -0
- package/dist/EventStore.d.ts +42 -0
- package/dist/EventStore.d.ts.map +1 -0
- package/dist/EventStore.js +111 -0
- package/dist/EventStore.js.map +1 -0
- package/dist/EventStoreName.d.ts +10 -0
- package/dist/EventStoreName.d.ts.map +1 -0
- package/dist/EventStoreName.js +16 -0
- package/dist/EventStoreName.js.map +1 -0
- package/dist/EventStoreNamespaceName.d.ts +12 -0
- package/dist/EventStoreNamespaceName.d.ts.map +1 -0
- package/dist/EventStoreNamespaceName.js +18 -0
- package/dist/EventStoreNamespaceName.js.map +1 -0
- package/dist/Events/AppendedEvent.d.ts +14 -0
- package/dist/Events/AppendedEvent.d.ts.map +1 -0
- package/dist/Events/AppendedEvent.js +4 -0
- package/dist/Events/AppendedEvent.js.map +1 -0
- package/dist/Events/CausationEntry.d.ts +10 -0
- package/dist/Events/CausationEntry.d.ts.map +1 -0
- package/dist/Events/CausationEntry.js +4 -0
- package/dist/Events/CausationEntry.js.map +1 -0
- package/dist/Events/Constraints/ConstraintBuilder.d.ts +42 -0
- package/dist/Events/Constraints/ConstraintBuilder.d.ts.map +1 -0
- package/dist/Events/Constraints/ConstraintBuilder.js +55 -0
- package/dist/Events/Constraints/ConstraintBuilder.js.map +1 -0
- package/dist/Events/Constraints/ConstraintId.d.ts +10 -0
- package/dist/Events/Constraints/ConstraintId.d.ts.map +1 -0
- package/dist/Events/Constraints/ConstraintId.js +16 -0
- package/dist/Events/Constraints/ConstraintId.js.map +1 -0
- package/dist/Events/Constraints/Constraints.d.ts +27 -0
- package/dist/Events/Constraints/Constraints.d.ts.map +1 -0
- package/dist/Events/Constraints/Constraints.js +104 -0
- package/dist/Events/Constraints/Constraints.js.map +1 -0
- package/dist/Events/Constraints/IConstraint.d.ts +15 -0
- package/dist/Events/Constraints/IConstraint.d.ts.map +1 -0
- package/dist/Events/Constraints/IConstraint.js +4 -0
- package/dist/Events/Constraints/IConstraint.js.map +1 -0
- package/dist/Events/Constraints/IConstraintBuilder.d.ts +37 -0
- package/dist/Events/Constraints/IConstraintBuilder.d.ts.map +1 -0
- package/dist/Events/Constraints/IConstraintBuilder.js +4 -0
- package/dist/Events/Constraints/IConstraintBuilder.js.map +1 -0
- package/dist/Events/Constraints/IConstraints.d.ts +23 -0
- package/dist/Events/Constraints/IConstraints.d.ts.map +1 -0
- package/dist/Events/Constraints/IConstraints.js +4 -0
- package/dist/Events/Constraints/IConstraints.js.map +1 -0
- package/dist/Events/Constraints/IUniqueConstraintBuilder.d.ts +44 -0
- package/dist/Events/Constraints/IUniqueConstraintBuilder.d.ts.map +1 -0
- package/dist/Events/Constraints/IUniqueConstraintBuilder.js +4 -0
- package/dist/Events/Constraints/IUniqueConstraintBuilder.js.map +1 -0
- package/dist/Events/Constraints/UniqueConstraintBuilder.d.ts +42 -0
- package/dist/Events/Constraints/UniqueConstraintBuilder.d.ts.map +1 -0
- package/dist/Events/Constraints/UniqueConstraintBuilder.js +72 -0
- package/dist/Events/Constraints/UniqueConstraintBuilder.js.map +1 -0
- package/dist/Events/Constraints/constraint.d.ts +29 -0
- package/dist/Events/Constraints/constraint.d.ts.map +1 -0
- package/dist/Events/Constraints/constraint.js +39 -0
- package/dist/Events/Constraints/constraint.js.map +1 -0
- package/dist/Events/Constraints/index.d.ts +13 -0
- package/dist/Events/Constraints/index.d.ts.map +1 -0
- package/dist/Events/Constraints/index.js +8 -0
- package/dist/Events/Constraints/index.js.map +1 -0
- package/dist/Events/EventContext.d.ts +20 -0
- package/dist/Events/EventContext.d.ts.map +1 -0
- package/dist/Events/EventContext.js +4 -0
- package/dist/Events/EventContext.js.map +1 -0
- package/dist/Events/EventType.d.ts +23 -0
- package/dist/Events/EventType.d.ts.map +1 -0
- package/dist/Events/EventType.js +40 -0
- package/dist/Events/EventType.js.map +1 -0
- package/dist/Events/EventTypeGeneration.d.ts +14 -0
- package/dist/Events/EventTypeGeneration.d.ts.map +1 -0
- package/dist/Events/EventTypeGeneration.js +20 -0
- package/dist/Events/EventTypeGeneration.js.map +1 -0
- package/dist/Events/EventTypeId.d.ts +14 -0
- package/dist/Events/EventTypeId.d.ts.map +1 -0
- package/dist/Events/EventTypeId.js +20 -0
- package/dist/Events/EventTypeId.js.map +1 -0
- package/dist/Events/EventTypes.d.ts +33 -0
- package/dist/Events/EventTypes.d.ts.map +1 -0
- package/dist/Events/EventTypes.js +83 -0
- package/dist/Events/EventTypes.js.map +1 -0
- package/dist/Events/IEventTypes.d.ts +32 -0
- package/dist/Events/IEventTypes.d.ts.map +1 -0
- package/dist/Events/IEventTypes.js +4 -0
- package/dist/Events/IEventTypes.js.map +1 -0
- package/dist/Events/eventTypeDecorator.d.ts +71 -0
- package/dist/Events/eventTypeDecorator.d.ts.map +1 -0
- package/dist/Events/eventTypeDecorator.js +86 -0
- package/dist/Events/eventTypeDecorator.js.map +1 -0
- package/dist/Events/index.d.ts +12 -0
- package/dist/Events/index.d.ts.map +1 -0
- package/dist/Events/index.js +9 -0
- package/dist/Events/index.js.map +1 -0
- package/dist/Grpc.d.ts +19 -0
- package/dist/Grpc.d.ts.map +1 -0
- package/dist/Grpc.js +33 -0
- package/dist/Grpc.js.map +1 -0
- package/dist/IChronicleClient.d.ts +33 -0
- package/dist/IChronicleClient.d.ts.map +1 -0
- package/dist/IChronicleClient.js +4 -0
- package/dist/IChronicleClient.js.map +1 -0
- package/dist/IEventStore.d.ts +44 -0
- package/dist/IEventStore.d.ts.map +1 -0
- package/dist/IEventStore.js +4 -0
- package/dist/IEventStore.js.map +1 -0
- package/dist/Metrics.d.ts +70 -0
- package/dist/Metrics.d.ts.map +1 -0
- package/dist/Metrics.js +100 -0
- package/dist/Metrics.js.map +1 -0
- package/dist/Observation/ObserverId.d.ts +10 -0
- package/dist/Observation/ObserverId.d.ts.map +1 -0
- package/dist/Observation/ObserverId.js +16 -0
- package/dist/Observation/ObserverId.js.map +1 -0
- package/dist/Observation/ObserverRunningState.d.ts +24 -0
- package/dist/Observation/ObserverRunningState.d.ts.map +1 -0
- package/dist/Observation/ObserverRunningState.js +27 -0
- package/dist/Observation/ObserverRunningState.js.map +1 -0
- package/dist/Observation/index.d.ts +3 -0
- package/dist/Observation/index.d.ts.map +1 -0
- package/dist/Observation/index.js +5 -0
- package/dist/Observation/index.js.map +1 -0
- package/dist/Projections/IProjections.d.ts +16 -0
- package/dist/Projections/IProjections.d.ts.map +1 -0
- package/dist/Projections/IProjections.js +4 -0
- package/dist/Projections/IProjections.js.map +1 -0
- package/dist/Projections/ProjectionId.d.ts +10 -0
- package/dist/Projections/ProjectionId.d.ts.map +1 -0
- package/dist/Projections/ProjectionId.js +16 -0
- package/dist/Projections/ProjectionId.js.map +1 -0
- package/dist/Projections/Projections.d.ts +36 -0
- package/dist/Projections/Projections.d.ts.map +1 -0
- package/dist/Projections/Projections.js +390 -0
- package/dist/Projections/Projections.js.map +1 -0
- package/dist/Projections/declarative/AllSetBuilder.d.ts +20 -0
- package/dist/Projections/declarative/AllSetBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/AllSetBuilder.js +37 -0
- package/dist/Projections/declarative/AllSetBuilder.js.map +1 -0
- package/dist/Projections/declarative/FromBuilder.d.ts +56 -0
- package/dist/Projections/declarative/FromBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/FromBuilder.js +105 -0
- package/dist/Projections/declarative/FromBuilder.js.map +1 -0
- package/dist/Projections/declarative/FromEveryBuilder.d.ts +22 -0
- package/dist/Projections/declarative/FromEveryBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/FromEveryBuilder.js +28 -0
- package/dist/Projections/declarative/FromEveryBuilder.js.map +1 -0
- package/dist/Projections/declarative/IAddBuilder.d.ts +15 -0
- package/dist/Projections/declarative/IAddBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IAddBuilder.js +4 -0
- package/dist/Projections/declarative/IAddBuilder.js.map +1 -0
- package/dist/Projections/declarative/IAddChildBuilder.d.ts +21 -0
- package/dist/Projections/declarative/IAddChildBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IAddChildBuilder.js +4 -0
- package/dist/Projections/declarative/IAddChildBuilder.js.map +1 -0
- package/dist/Projections/declarative/IAllSetBuilder.d.ts +26 -0
- package/dist/Projections/declarative/IAllSetBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IAllSetBuilder.js +4 -0
- package/dist/Projections/declarative/IAllSetBuilder.js.map +1 -0
- package/dist/Projections/declarative/IChildrenBuilder.d.ts +22 -0
- package/dist/Projections/declarative/IChildrenBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IChildrenBuilder.js +4 -0
- package/dist/Projections/declarative/IChildrenBuilder.js.map +1 -0
- package/dist/Projections/declarative/ICompositeKeyBuilder.d.ts +16 -0
- package/dist/Projections/declarative/ICompositeKeyBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/ICompositeKeyBuilder.js +4 -0
- package/dist/Projections/declarative/ICompositeKeyBuilder.js.map +1 -0
- package/dist/Projections/declarative/IFromBuilder.d.ts +9 -0
- package/dist/Projections/declarative/IFromBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IFromBuilder.js +4 -0
- package/dist/Projections/declarative/IFromBuilder.js.map +1 -0
- package/dist/Projections/declarative/IFromEveryBuilder.d.ts +20 -0
- package/dist/Projections/declarative/IFromEveryBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IFromEveryBuilder.js +4 -0
- package/dist/Projections/declarative/IFromEveryBuilder.js.map +1 -0
- package/dist/Projections/declarative/IJoinBuilder.d.ts +16 -0
- package/dist/Projections/declarative/IJoinBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IJoinBuilder.js +4 -0
- package/dist/Projections/declarative/IJoinBuilder.js.map +1 -0
- package/dist/Projections/declarative/INestedBuilder.d.ts +15 -0
- package/dist/Projections/declarative/INestedBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/INestedBuilder.js +4 -0
- package/dist/Projections/declarative/INestedBuilder.js.map +1 -0
- package/dist/Projections/declarative/IProjectionBuilder.d.ts +80 -0
- package/dist/Projections/declarative/IProjectionBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IProjectionBuilder.js +4 -0
- package/dist/Projections/declarative/IProjectionBuilder.js.map +1 -0
- package/dist/Projections/declarative/IProjectionBuilderFor.d.ts +31 -0
- package/dist/Projections/declarative/IProjectionBuilderFor.d.ts.map +1 -0
- package/dist/Projections/declarative/IProjectionBuilderFor.js +4 -0
- package/dist/Projections/declarative/IProjectionBuilderFor.js.map +1 -0
- package/dist/Projections/declarative/IProjectionFor.d.ts +15 -0
- package/dist/Projections/declarative/IProjectionFor.d.ts.map +1 -0
- package/dist/Projections/declarative/IProjectionFor.js +4 -0
- package/dist/Projections/declarative/IProjectionFor.js.map +1 -0
- package/dist/Projections/declarative/IReadModelPropertiesBuilder.d.ts +111 -0
- package/dist/Projections/declarative/IReadModelPropertiesBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IReadModelPropertiesBuilder.js +4 -0
- package/dist/Projections/declarative/IReadModelPropertiesBuilder.js.map +1 -0
- package/dist/Projections/declarative/IRemovedWithBuilder.d.ts +21 -0
- package/dist/Projections/declarative/IRemovedWithBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IRemovedWithBuilder.js +4 -0
- package/dist/Projections/declarative/IRemovedWithBuilder.js.map +1 -0
- package/dist/Projections/declarative/IRemovedWithJoinBuilder.d.ts +21 -0
- package/dist/Projections/declarative/IRemovedWithJoinBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/IRemovedWithJoinBuilder.js +4 -0
- package/dist/Projections/declarative/IRemovedWithJoinBuilder.js.map +1 -0
- package/dist/Projections/declarative/ISetBuilder.d.ts +32 -0
- package/dist/Projections/declarative/ISetBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/ISetBuilder.js +4 -0
- package/dist/Projections/declarative/ISetBuilder.js.map +1 -0
- package/dist/Projections/declarative/ISubtractBuilder.d.ts +15 -0
- package/dist/Projections/declarative/ISubtractBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/ISubtractBuilder.js +4 -0
- package/dist/Projections/declarative/ISubtractBuilder.js.map +1 -0
- package/dist/Projections/declarative/JoinBuilder.d.ts +58 -0
- package/dist/Projections/declarative/JoinBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/JoinBuilder.js +107 -0
- package/dist/Projections/declarative/JoinBuilder.js.map +1 -0
- package/dist/Projections/declarative/ProjectionBuilderFor.d.ts +68 -0
- package/dist/Projections/declarative/ProjectionBuilderFor.d.ts.map +1 -0
- package/dist/Projections/declarative/ProjectionBuilderFor.js +207 -0
- package/dist/Projections/declarative/ProjectionBuilderFor.js.map +1 -0
- package/dist/Projections/declarative/RemovedWithBuilder.d.ts +22 -0
- package/dist/Projections/declarative/RemovedWithBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/RemovedWithBuilder.js +28 -0
- package/dist/Projections/declarative/RemovedWithBuilder.js.map +1 -0
- package/dist/Projections/declarative/RemovedWithJoinBuilder.d.ts +22 -0
- package/dist/Projections/declarative/RemovedWithJoinBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/RemovedWithJoinBuilder.js +31 -0
- package/dist/Projections/declarative/RemovedWithJoinBuilder.js.map +1 -0
- package/dist/Projections/declarative/SetBuilder.d.ts +23 -0
- package/dist/Projections/declarative/SetBuilder.d.ts.map +1 -0
- package/dist/Projections/declarative/SetBuilder.js +43 -0
- package/dist/Projections/declarative/SetBuilder.js.map +1 -0
- package/dist/Projections/declarative/index.d.ts +24 -0
- package/dist/Projections/declarative/index.d.ts.map +1 -0
- package/dist/Projections/declarative/index.js +8 -0
- package/dist/Projections/declarative/index.js.map +1 -0
- package/dist/Projections/declarative/projection.d.ts +31 -0
- package/dist/Projections/declarative/projection.d.ts.map +1 -0
- package/dist/Projections/declarative/projection.js +39 -0
- package/dist/Projections/declarative/projection.js.map +1 -0
- package/dist/Projections/index.d.ts +6 -0
- package/dist/Projections/index.d.ts.map +1 -0
- package/dist/Projections/index.js +7 -0
- package/dist/Projections/index.js.map +1 -0
- package/dist/Projections/modelBound/FromEventMetadata.d.ts +7 -0
- package/dist/Projections/modelBound/FromEventMetadata.d.ts.map +1 -0
- package/dist/Projections/modelBound/FromEventMetadata.js +4 -0
- package/dist/Projections/modelBound/FromEventMetadata.js.map +1 -0
- package/dist/Projections/modelBound/FromEventOptions.d.ts +10 -0
- package/dist/Projections/modelBound/FromEventOptions.d.ts.map +1 -0
- package/dist/Projections/modelBound/FromEventOptions.js +4 -0
- package/dist/Projections/modelBound/FromEventOptions.js.map +1 -0
- package/dist/Projections/modelBound/addFrom.d.ts +23 -0
- package/dist/Projections/modelBound/addFrom.d.ts.map +1 -0
- package/dist/Projections/modelBound/addFrom.js +30 -0
- package/dist/Projections/modelBound/addFrom.js.map +1 -0
- package/dist/Projections/modelBound/childrenFrom.d.ts +29 -0
- package/dist/Projections/modelBound/childrenFrom.d.ts.map +1 -0
- package/dist/Projections/modelBound/childrenFrom.js +32 -0
- package/dist/Projections/modelBound/childrenFrom.js.map +1 -0
- package/dist/Projections/modelBound/clearWith.d.ts +28 -0
- package/dist/Projections/modelBound/clearWith.d.ts.map +1 -0
- package/dist/Projections/modelBound/clearWith.js +45 -0
- package/dist/Projections/modelBound/clearWith.js.map +1 -0
- package/dist/Projections/modelBound/count.d.ts +23 -0
- package/dist/Projections/modelBound/count.d.ts.map +1 -0
- package/dist/Projections/modelBound/count.js +30 -0
- package/dist/Projections/modelBound/count.js.map +1 -0
- package/dist/Projections/modelBound/decrement.d.ts +23 -0
- package/dist/Projections/modelBound/decrement.d.ts.map +1 -0
- package/dist/Projections/modelBound/decrement.js +30 -0
- package/dist/Projections/modelBound/decrement.js.map +1 -0
- package/dist/Projections/modelBound/fromEvent.d.ts +23 -0
- package/dist/Projections/modelBound/fromEvent.d.ts.map +1 -0
- package/dist/Projections/modelBound/fromEvent.js +34 -0
- package/dist/Projections/modelBound/fromEvent.js.map +1 -0
- package/dist/Projections/modelBound/fromEvery.d.ts +23 -0
- package/dist/Projections/modelBound/fromEvery.d.ts.map +1 -0
- package/dist/Projections/modelBound/fromEvery.js +28 -0
- package/dist/Projections/modelBound/fromEvery.js.map +1 -0
- package/dist/Projections/modelBound/increment.d.ts +23 -0
- package/dist/Projections/modelBound/increment.d.ts.map +1 -0
- package/dist/Projections/modelBound/increment.js +30 -0
- package/dist/Projections/modelBound/increment.js.map +1 -0
- package/dist/Projections/modelBound/index.d.ts +36 -0
- package/dist/Projections/modelBound/index.d.ts.map +1 -0
- package/dist/Projections/modelBound/index.js +21 -0
- package/dist/Projections/modelBound/index.js.map +1 -0
- package/dist/Projections/modelBound/join.d.ts +26 -0
- package/dist/Projections/modelBound/join.d.ts.map +1 -0
- package/dist/Projections/modelBound/join.js +31 -0
- package/dist/Projections/modelBound/join.js.map +1 -0
- package/dist/Projections/modelBound/modelBound.d.ts +31 -0
- package/dist/Projections/modelBound/modelBound.d.ts.map +1 -0
- package/dist/Projections/modelBound/modelBound.js +39 -0
- package/dist/Projections/modelBound/modelBound.js.map +1 -0
- package/dist/Projections/modelBound/nested.d.ts +16 -0
- package/dist/Projections/modelBound/nested.d.ts.map +1 -0
- package/dist/Projections/modelBound/nested.js +26 -0
- package/dist/Projections/modelBound/nested.js.map +1 -0
- package/dist/Projections/modelBound/notRewindable.d.ts +14 -0
- package/dist/Projections/modelBound/notRewindable.d.ts.map +1 -0
- package/dist/Projections/modelBound/notRewindable.js +21 -0
- package/dist/Projections/modelBound/notRewindable.js.map +1 -0
- package/dist/Projections/modelBound/removedWith.d.ts +34 -0
- package/dist/Projections/modelBound/removedWith.d.ts.map +1 -0
- package/dist/Projections/modelBound/removedWith.js +47 -0
- package/dist/Projections/modelBound/removedWith.js.map +1 -0
- package/dist/Projections/modelBound/removedWithJoin.d.ts +29 -0
- package/dist/Projections/modelBound/removedWithJoin.d.ts.map +1 -0
- package/dist/Projections/modelBound/removedWithJoin.js +44 -0
- package/dist/Projections/modelBound/removedWithJoin.js.map +1 -0
- package/dist/Projections/modelBound/setFrom.d.ts +23 -0
- package/dist/Projections/modelBound/setFrom.d.ts.map +1 -0
- package/dist/Projections/modelBound/setFrom.js +30 -0
- package/dist/Projections/modelBound/setFrom.js.map +1 -0
- package/dist/Projections/modelBound/setFromContext.d.ts +23 -0
- package/dist/Projections/modelBound/setFromContext.d.ts.map +1 -0
- package/dist/Projections/modelBound/setFromContext.js +30 -0
- package/dist/Projections/modelBound/setFromContext.js.map +1 -0
- package/dist/Projections/modelBound/setValue.d.ts +23 -0
- package/dist/Projections/modelBound/setValue.d.ts.map +1 -0
- package/dist/Projections/modelBound/setValue.js +30 -0
- package/dist/Projections/modelBound/setValue.js.map +1 -0
- package/dist/Projections/modelBound/subtractFrom.d.ts +23 -0
- package/dist/Projections/modelBound/subtractFrom.d.ts.map +1 -0
- package/dist/Projections/modelBound/subtractFrom.js +30 -0
- package/dist/Projections/modelBound/subtractFrom.js.map +1 -0
- package/dist/Reactors/IReactors.d.ts +16 -0
- package/dist/Reactors/IReactors.d.ts.map +1 -0
- package/dist/Reactors/IReactors.js +4 -0
- package/dist/Reactors/IReactors.js.map +1 -0
- package/dist/Reactors/ReactorId.d.ts +10 -0
- package/dist/Reactors/ReactorId.d.ts.map +1 -0
- package/dist/Reactors/ReactorId.js +16 -0
- package/dist/Reactors/ReactorId.js.map +1 -0
- package/dist/Reactors/Reactors.d.ts +38 -0
- package/dist/Reactors/Reactors.d.ts.map +1 -0
- package/dist/Reactors/Reactors.js +279 -0
- package/dist/Reactors/Reactors.js.map +1 -0
- package/dist/Reactors/index.d.ts +6 -0
- package/dist/Reactors/index.d.ts.map +1 -0
- package/dist/Reactors/index.js +6 -0
- package/dist/Reactors/index.js.map +1 -0
- package/dist/Reactors/reactor.d.ts +47 -0
- package/dist/Reactors/reactor.d.ts.map +1 -0
- package/dist/Reactors/reactor.js +55 -0
- package/dist/Reactors/reactor.js.map +1 -0
- package/dist/ReadModels/ReadModelId.d.ts +10 -0
- package/dist/ReadModels/ReadModelId.d.ts.map +1 -0
- package/dist/ReadModels/ReadModelId.js +16 -0
- package/dist/ReadModels/ReadModelId.js.map +1 -0
- package/dist/ReadModels/index.d.ts +4 -0
- package/dist/ReadModels/index.d.ts.map +1 -0
- package/dist/ReadModels/index.js +5 -0
- package/dist/ReadModels/index.js.map +1 -0
- package/dist/ReadModels/readModel.d.ts +33 -0
- package/dist/ReadModels/readModel.d.ts.map +1 -0
- package/dist/ReadModels/readModel.js +64 -0
- package/dist/ReadModels/readModel.js.map +1 -0
- package/dist/Reducers/IReducers.d.ts +16 -0
- package/dist/Reducers/IReducers.d.ts.map +1 -0
- package/dist/Reducers/IReducers.js +4 -0
- package/dist/Reducers/IReducers.js.map +1 -0
- package/dist/Reducers/ReducerId.d.ts +10 -0
- package/dist/Reducers/ReducerId.d.ts.map +1 -0
- package/dist/Reducers/ReducerId.js +16 -0
- package/dist/Reducers/ReducerId.js.map +1 -0
- package/dist/Reducers/Reducers.d.ts +38 -0
- package/dist/Reducers/Reducers.d.ts.map +1 -0
- package/dist/Reducers/Reducers.js +279 -0
- package/dist/Reducers/Reducers.js.map +1 -0
- package/dist/Reducers/index.d.ts +6 -0
- package/dist/Reducers/index.d.ts.map +1 -0
- package/dist/Reducers/index.js +6 -0
- package/dist/Reducers/index.js.map +1 -0
- package/dist/Reducers/reducer.d.ts +51 -0
- package/dist/Reducers/reducer.d.ts.map +1 -0
- package/dist/Reducers/reducer.js +59 -0
- package/dist/Reducers/reducer.js.map +1 -0
- package/dist/Schemas/JsonSchema.d.ts +16 -0
- package/dist/Schemas/JsonSchema.d.ts.map +1 -0
- package/dist/Schemas/JsonSchema.js +4 -0
- package/dist/Schemas/JsonSchema.js.map +1 -0
- package/dist/Schemas/JsonSchemaGenerator.d.ts +26 -0
- package/dist/Schemas/JsonSchemaGenerator.d.ts.map +1 -0
- package/dist/Schemas/JsonSchemaGenerator.js +90 -0
- package/dist/Schemas/JsonSchemaGenerator.js.map +1 -0
- package/dist/Schemas/index.d.ts +4 -0
- package/dist/Schemas/index.d.ts.map +1 -0
- package/dist/Schemas/index.js +5 -0
- package/dist/Schemas/index.js.map +1 -0
- package/dist/Schemas/jsonSchemaProperty.d.ts +13 -0
- package/dist/Schemas/jsonSchemaProperty.d.ts.map +1 -0
- package/dist/Schemas/jsonSchemaProperty.js +22 -0
- package/dist/Schemas/jsonSchemaProperty.js.map +1 -0
- package/dist/Tracing.d.ts +16 -0
- package/dist/Tracing.d.ts.map +1 -0
- package/dist/Tracing.js +19 -0
- package/dist/Tracing.js.map +1 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +31 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.js +48 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -0
- package/dist/artifacts/IClientArtifactsProvider.d.ts +21 -0
- package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -0
- package/dist/artifacts/IClientArtifactsProvider.js +4 -0
- package/dist/artifacts/IClientArtifactsProvider.js.map +1 -0
- package/dist/artifacts/index.d.ts +3 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +4 -0
- package/dist/artifacts/index.js.map +1 -0
- package/dist/connection/ChronicleConnection.d.ts +117 -0
- package/dist/connection/ChronicleConnection.d.ts.map +1 -0
- package/dist/connection/ChronicleConnection.js +194 -0
- package/dist/connection/ChronicleConnection.js.map +1 -0
- package/dist/connection/ChronicleConnectionString.d.ts +2 -0
- package/dist/connection/ChronicleConnectionString.d.ts.map +1 -0
- package/dist/connection/ChronicleConnectionString.js +4 -0
- package/dist/connection/ChronicleConnectionString.js.map +1 -0
- package/dist/connection/ChronicleServices.d.ts +2 -0
- package/dist/connection/ChronicleServices.d.ts.map +1 -0
- package/dist/connection/ChronicleServices.js +4 -0
- package/dist/connection/ChronicleServices.js.map +1 -0
- package/dist/connection/ConnectionLifecycle.d.ts +41 -0
- package/dist/connection/ConnectionLifecycle.d.ts.map +1 -0
- package/dist/connection/ConnectionLifecycle.js +66 -0
- package/dist/connection/ConnectionLifecycle.js.map +1 -0
- package/dist/connection/DateTimeOffset.d.ts +2 -0
- package/dist/connection/DateTimeOffset.d.ts.map +1 -0
- package/dist/connection/DateTimeOffset.js +4 -0
- package/dist/connection/DateTimeOffset.js.map +1 -0
- package/dist/connection/Guid.d.ts +2 -0
- package/dist/connection/Guid.d.ts.map +1 -0
- package/dist/connection/Guid.js +4 -0
- package/dist/connection/Guid.js.map +1 -0
- package/dist/connection/TokenProvider.d.ts +5 -0
- package/dist/connection/TokenProvider.d.ts.map +1 -0
- package/dist/connection/TokenProvider.js +4 -0
- package/dist/connection/TokenProvider.js.map +1 -0
- package/dist/connection/index.d.ts +7 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +7 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/DecoratorType.d.ts +20 -0
- package/dist/types/DecoratorType.d.ts.map +1 -0
- package/dist/types/DecoratorType.js +23 -0
- package/dist/types/DecoratorType.js.map +1 -0
- package/dist/types/TypeDiscoverer.d.ts +54 -0
- package/dist/types/TypeDiscoverer.d.ts.map +1 -0
- package/dist/types/TypeDiscoverer.js +91 -0
- package/dist/types/TypeDiscoverer.js.map +1 -0
- package/dist/types/TypeIntrospector.d.ts +30 -0
- package/dist/types/TypeIntrospector.d.ts.map +1 -0
- package/dist/types/TypeIntrospector.js +154 -0
- package/dist/types/TypeIntrospector.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/index.ts +24 -0
- package/package.json +38 -0
- package/types/DecoratorType.ts +28 -0
- package/types/TypeDiscoverer.ts +109 -0
- package/types/TypeIntrospector.ts +176 -0
- package/types/index.ts +6 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/** Metadata stored by the join property decorator. */
|
|
3
|
+
export interface JoinMetadata {
|
|
4
|
+
/** The event constructor associated with this annotation. */
|
|
5
|
+
readonly eventType: Function;
|
|
6
|
+
/** The read model property name used to form the join relationship. */
|
|
7
|
+
readonly on?: string;
|
|
8
|
+
/** The event property name to read the joined value from. Defaults to the decorated property name. */
|
|
9
|
+
readonly eventPropertyName?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Property decorator that configures a join relationship with an event type.
|
|
13
|
+
* @param eventType - The event constructor.
|
|
14
|
+
* @param on - Optional property name on the read model to join on.
|
|
15
|
+
* @param eventPropertyName - Optional event property name. Defaults to the property name.
|
|
16
|
+
* @returns A property decorator.
|
|
17
|
+
*/
|
|
18
|
+
export declare function join(eventType: Function, on?: string, eventPropertyName?: string): PropertyDecorator;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves all join metadata stored on the given property.
|
|
21
|
+
* @param target - The class prototype.
|
|
22
|
+
* @param propertyKey - The property name.
|
|
23
|
+
* @returns An array of join metadata entries.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getJoinMetadata(target: object, propertyKey: string): JoinMetadata[];
|
|
26
|
+
//# sourceMappingURL=join.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/join.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,sDAAsD;AACtD,MAAM,WAAW,YAAY;IACzB,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,sGAAsG;IACtG,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACvC;AAID;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAQpG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,YAAY,EAAE,CAEnF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { TypeIntrospector } from '../../types';
|
|
5
|
+
const METADATA_KEY = 'chronicle:projection:join';
|
|
6
|
+
/**
|
|
7
|
+
* Property decorator that configures a join relationship with an event type.
|
|
8
|
+
* @param eventType - The event constructor.
|
|
9
|
+
* @param on - Optional property name on the read model to join on.
|
|
10
|
+
* @param eventPropertyName - Optional event property name. Defaults to the property name.
|
|
11
|
+
* @returns A property decorator.
|
|
12
|
+
*/
|
|
13
|
+
export function join(eventType, on, eventPropertyName) {
|
|
14
|
+
return (target, propertyKey) => {
|
|
15
|
+
const key = propertyKey.toString();
|
|
16
|
+
TypeIntrospector.trackProperty(target.constructor, key);
|
|
17
|
+
const existing = Reflect.getMetadata(METADATA_KEY, target, key) ?? [];
|
|
18
|
+
const metadata = { eventType, on, eventPropertyName };
|
|
19
|
+
Reflect.defineMetadata(METADATA_KEY, [...existing, metadata], target, key);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves all join metadata stored on the given property.
|
|
24
|
+
* @param target - The class prototype.
|
|
25
|
+
* @param propertyKey - The property name.
|
|
26
|
+
* @returns An array of join metadata entries.
|
|
27
|
+
*/
|
|
28
|
+
export function getJoinMetadata(target, propertyKey) {
|
|
29
|
+
return Reflect.getMetadata(METADATA_KEY, target, propertyKey) ?? [];
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=join.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join.js","sourceRoot":"","sources":["../../../Projections/modelBound/join.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,SAAmB,EAAE,EAAW,EAAE,iBAA0B;IAC7E,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACpD,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAmB,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QACtF,MAAM,QAAQ,GAAiB,EAAE,SAAS,EAAE,EAAE,EAAE,iBAAiB,EAAE,CAAC;QACpE,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/E,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,WAAmB;IAC/D,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { ProjectionId } from '../ProjectionId';
|
|
3
|
+
/**
|
|
4
|
+
* Metadata stored on a model-bound projection class.
|
|
5
|
+
*/
|
|
6
|
+
export interface ModelBoundMetadata {
|
|
7
|
+
/** The unique identifier for the projection. */
|
|
8
|
+
readonly id: ProjectionId;
|
|
9
|
+
/** The optional explicit event sequence identifier. */
|
|
10
|
+
readonly eventSequenceId: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* TypeScript decorator that marks a class as a model-bound projection.
|
|
14
|
+
* @param id - The unique identifier for the projection. Defaults to the class name if omitted.
|
|
15
|
+
* @param eventSequenceId - Optional explicit event sequence identifier.
|
|
16
|
+
* @returns A class decorator.
|
|
17
|
+
*/
|
|
18
|
+
export declare function modelBound(id?: string, eventSequenceId?: string): ClassDecorator;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the {@link ModelBoundMetadata} associated with a class decorated with {@link modelBound}.
|
|
21
|
+
* @param target - The class constructor to retrieve metadata for.
|
|
22
|
+
* @returns The associated metadata, or undefined if not decorated.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getModelBoundMetadata(target: Function): ModelBoundMetadata | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Checks whether a class has been decorated with {@link modelBound}.
|
|
27
|
+
* @param target - The class constructor to check.
|
|
28
|
+
* @returns True if the class has a model-bound decorator; false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isModelBound(target: Function): boolean;
|
|
31
|
+
//# sourceMappingURL=modelBound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelBound.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/modelBound.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAM/C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAE1B,uDAAuD;IACvD,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,GAAE,MAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,CAYpF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,GAAG,SAAS,CAEtF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAEtD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { ProjectionId } from '../ProjectionId';
|
|
5
|
+
import { DecoratorType, TypeDiscoverer } from '../../types';
|
|
6
|
+
/** Metadata key used to store model-bound projection information on a class. */
|
|
7
|
+
const MODEL_BOUND_METADATA_KEY = 'chronicle:modelBound';
|
|
8
|
+
/**
|
|
9
|
+
* TypeScript decorator that marks a class as a model-bound projection.
|
|
10
|
+
* @param id - The unique identifier for the projection. Defaults to the class name if omitted.
|
|
11
|
+
* @param eventSequenceId - Optional explicit event sequence identifier.
|
|
12
|
+
* @returns A class decorator.
|
|
13
|
+
*/
|
|
14
|
+
export function modelBound(id = '', eventSequenceId) {
|
|
15
|
+
return (target) => {
|
|
16
|
+
const constructor = target;
|
|
17
|
+
const projectionId = new ProjectionId(id || constructor.name);
|
|
18
|
+
const metadata = { id: projectionId, eventSequenceId };
|
|
19
|
+
Reflect.defineMetadata(MODEL_BOUND_METADATA_KEY, metadata, target);
|
|
20
|
+
TypeDiscoverer.default.register(DecoratorType.ModelBoundProjection, constructor, projectionId.value);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Gets the {@link ModelBoundMetadata} associated with a class decorated with {@link modelBound}.
|
|
25
|
+
* @param target - The class constructor to retrieve metadata for.
|
|
26
|
+
* @returns The associated metadata, or undefined if not decorated.
|
|
27
|
+
*/
|
|
28
|
+
export function getModelBoundMetadata(target) {
|
|
29
|
+
return Reflect.getMetadata(MODEL_BOUND_METADATA_KEY, target);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks whether a class has been decorated with {@link modelBound}.
|
|
33
|
+
* @param target - The class constructor to check.
|
|
34
|
+
* @returns True if the class has a model-bound decorator; false otherwise.
|
|
35
|
+
*/
|
|
36
|
+
export function isModelBound(target) {
|
|
37
|
+
return Reflect.hasMetadata(MODEL_BOUND_METADATA_KEY, target);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=modelBound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelBound.js","sourceRoot":"","sources":["../../../Projections/modelBound/modelBound.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,gFAAgF;AAChF,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAaxD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,EAAE,eAAwB;IAChE,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,WAAW,GAAG,MAAkB,CAAC;QACvC,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,EAAE,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAuB,EAAE,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;QAC3E,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnE,cAAc,CAAC,OAAO,CAAC,QAAQ,CAC3B,aAAa,CAAC,oBAAoB,EAClC,WAA0B,EAC1B,YAAY,CAAC,KAAK,CACrB,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAgB;IAClD,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAgB;IACzC,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/**
|
|
3
|
+
* Property decorator that marks a single nullable property as a nested sub-projection object.
|
|
4
|
+
* The nested type should carry its own fromEvent and optionally clearWith decorators.
|
|
5
|
+
* @param target - The class prototype.
|
|
6
|
+
* @param propertyKey - The property name.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nested(target: object, propertyKey: string | symbol): void;
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether the given property is marked as a nested sub-projection.
|
|
11
|
+
* @param target - The class prototype.
|
|
12
|
+
* @param propertyKey - The property name.
|
|
13
|
+
* @returns True if the property is marked as nested; false otherwise.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isNested(target: object, propertyKey: string): boolean;
|
|
16
|
+
//# sourceMappingURL=nested.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/nested.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAK1B;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIzE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAErE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { TypeIntrospector } from '../../types';
|
|
5
|
+
const METADATA_KEY = 'chronicle:projection:nested';
|
|
6
|
+
/**
|
|
7
|
+
* Property decorator that marks a single nullable property as a nested sub-projection object.
|
|
8
|
+
* The nested type should carry its own fromEvent and optionally clearWith decorators.
|
|
9
|
+
* @param target - The class prototype.
|
|
10
|
+
* @param propertyKey - The property name.
|
|
11
|
+
*/
|
|
12
|
+
export function nested(target, propertyKey) {
|
|
13
|
+
const key = propertyKey.toString();
|
|
14
|
+
TypeIntrospector.trackProperty(target.constructor, key);
|
|
15
|
+
Reflect.defineMetadata(METADATA_KEY, true, target, key);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Checks whether the given property is marked as a nested sub-projection.
|
|
19
|
+
* @param target - The class prototype.
|
|
20
|
+
* @param propertyKey - The property name.
|
|
21
|
+
* @returns True if the property is marked as nested; false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export function isNested(target, propertyKey) {
|
|
24
|
+
return Reflect.hasMetadata(METADATA_KEY, target, propertyKey);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=nested.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested.js","sourceRoot":"","sources":["../../../Projections/modelBound/nested.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,MAAc,EAAE,WAA4B;IAC/D,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACvF,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,WAAmB;IACxD,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/**
|
|
3
|
+
* Class decorator that marks a model-bound projection as not rewindable.
|
|
4
|
+
* A not-rewindable projection only processes new events; it cannot replay history.
|
|
5
|
+
* @param target - The class constructor.
|
|
6
|
+
*/
|
|
7
|
+
export declare function notRewindable(target: Function): void;
|
|
8
|
+
/**
|
|
9
|
+
* Checks whether the given class is marked as not rewindable.
|
|
10
|
+
* @param target - The class constructor.
|
|
11
|
+
* @returns True if the class is marked as not rewindable; false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isNotRewindable(target: Function): boolean;
|
|
14
|
+
//# sourceMappingURL=notRewindable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notRewindable.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/notRewindable.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAI1B;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAEzD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
const METADATA_KEY = 'chronicle:projection:notRewindable';
|
|
5
|
+
/**
|
|
6
|
+
* Class decorator that marks a model-bound projection as not rewindable.
|
|
7
|
+
* A not-rewindable projection only processes new events; it cannot replay history.
|
|
8
|
+
* @param target - The class constructor.
|
|
9
|
+
*/
|
|
10
|
+
export function notRewindable(target) {
|
|
11
|
+
Reflect.defineMetadata(METADATA_KEY, true, target);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether the given class is marked as not rewindable.
|
|
15
|
+
* @param target - The class constructor.
|
|
16
|
+
* @returns True if the class is marked as not rewindable; false otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export function isNotRewindable(target) {
|
|
19
|
+
return Reflect.hasMetadata(METADATA_KEY, target);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=notRewindable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notRewindable.js","sourceRoot":"","sources":["../../../Projections/modelBound/notRewindable.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAE1B,MAAM,YAAY,GAAG,oCAAoC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAgB;IAC1C,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/** Metadata stored by the removedWith class or property decorator. */
|
|
3
|
+
export interface RemovedWithMetadata {
|
|
4
|
+
/** The event constructor that triggers removal. */
|
|
5
|
+
readonly eventType: Function;
|
|
6
|
+
/** The event property name that identifies the instance to remove. Defaults to the event source identifier. */
|
|
7
|
+
readonly key?: string;
|
|
8
|
+
/** The event property name that identifies the parent instance (for children). Defaults to the event source identifier. */
|
|
9
|
+
readonly parentKey?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Class or property decorator that specifies the event type that removes a read model instance or child.
|
|
13
|
+
* When used on a class, it removes the read model instance.
|
|
14
|
+
* When used on a property, it removes a child from the collection.
|
|
15
|
+
* @param eventType - The event constructor.
|
|
16
|
+
* @param key - Optional event property name used as the key to identify the instance to remove.
|
|
17
|
+
* @param parentKey - Optional event property name used as the parent key (for children only).
|
|
18
|
+
* @returns A class and property decorator.
|
|
19
|
+
*/
|
|
20
|
+
export declare function removedWith(eventType: Function, key?: string, parentKey?: string): ClassDecorator & PropertyDecorator;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves removedWith metadata stored on the given class constructor.
|
|
23
|
+
* @param target - The class constructor.
|
|
24
|
+
* @returns An array of removedWith metadata entries.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getRemovedWithClassMetadata(target: Function): RemovedWithMetadata[];
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves removedWith metadata stored on the given property.
|
|
29
|
+
* @param target - The class prototype.
|
|
30
|
+
* @param propertyKey - The property name.
|
|
31
|
+
* @returns An array of removedWith metadata entries.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getRemovedWithPropertyMetadata(target: object, propertyKey: string): RemovedWithMetadata[];
|
|
34
|
+
//# sourceMappingURL=removedWith.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removedWith.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/removedWith.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAChC,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,+GAA+G;IAC/G,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,2HAA2H;IAC3H,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B;AAKD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,iBAAiB,CAYrH;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,QAAQ,GAAG,mBAAmB,EAAE,CAEnF;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAEzG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { TypeIntrospector } from '../../types';
|
|
5
|
+
const CLASS_METADATA_KEY = 'chronicle:projection:removedWith:class';
|
|
6
|
+
const PROPERTY_METADATA_KEY = 'chronicle:projection:removedWith:property';
|
|
7
|
+
/**
|
|
8
|
+
* Class or property decorator that specifies the event type that removes a read model instance or child.
|
|
9
|
+
* When used on a class, it removes the read model instance.
|
|
10
|
+
* When used on a property, it removes a child from the collection.
|
|
11
|
+
* @param eventType - The event constructor.
|
|
12
|
+
* @param key - Optional event property name used as the key to identify the instance to remove.
|
|
13
|
+
* @param parentKey - Optional event property name used as the parent key (for children only).
|
|
14
|
+
* @returns A class and property decorator.
|
|
15
|
+
*/
|
|
16
|
+
export function removedWith(eventType, key, parentKey) {
|
|
17
|
+
return (target, propertyKey) => {
|
|
18
|
+
if (propertyKey !== undefined) {
|
|
19
|
+
const propKey = propertyKey.toString();
|
|
20
|
+
TypeIntrospector.trackProperty(target.constructor, propKey);
|
|
21
|
+
const existing = Reflect.getMetadata(PROPERTY_METADATA_KEY, target, propKey) ?? [];
|
|
22
|
+
Reflect.defineMetadata(PROPERTY_METADATA_KEY, [...existing, { eventType, key, parentKey }], target, propKey);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const existing = Reflect.getMetadata(CLASS_METADATA_KEY, target) ?? [];
|
|
26
|
+
Reflect.defineMetadata(CLASS_METADATA_KEY, [...existing, { eventType, key, parentKey }], target);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves removedWith metadata stored on the given class constructor.
|
|
32
|
+
* @param target - The class constructor.
|
|
33
|
+
* @returns An array of removedWith metadata entries.
|
|
34
|
+
*/
|
|
35
|
+
export function getRemovedWithClassMetadata(target) {
|
|
36
|
+
return Reflect.getMetadata(CLASS_METADATA_KEY, target) ?? [];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves removedWith metadata stored on the given property.
|
|
40
|
+
* @param target - The class prototype.
|
|
41
|
+
* @param propertyKey - The property name.
|
|
42
|
+
* @returns An array of removedWith metadata entries.
|
|
43
|
+
*/
|
|
44
|
+
export function getRemovedWithPropertyMetadata(target, propertyKey) {
|
|
45
|
+
return Reflect.getMetadata(PROPERTY_METADATA_KEY, target, propertyKey) ?? [];
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=removedWith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removedWith.js","sourceRoot":"","sources":["../../../Projections/modelBound/removedWith.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C,MAAM,kBAAkB,GAAG,wCAAwC,CAAC;AACpE,MAAM,qBAAqB,GAAG,2CAA2C,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,SAAmB,EAAE,GAAY,EAAE,SAAkB;IAC7E,OAAO,CAAC,MAAc,EAAE,WAA6B,EAAE,EAAE;QACrD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;YACvC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC3F,MAAM,QAAQ,GAA0B,OAAO,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;YAC1G,OAAO,CAAC,cAAc,CAAC,qBAAqB,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACjH,CAAC;aAAM,CAAC;YACJ,MAAM,QAAQ,GAA0B,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;YAC9F,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACrG,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAgB;IACxD,OAAO,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAc,EAAE,WAAmB;IAC9E,OAAO,OAAO,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/** Metadata stored by the removedWithJoin class or property decorator. */
|
|
3
|
+
export interface RemovedWithJoinMetadata {
|
|
4
|
+
/** The event constructor that triggers removal via a join. */
|
|
5
|
+
readonly eventType: Function;
|
|
6
|
+
/** The event property name that identifies the instance to remove. Defaults to the event source identifier. */
|
|
7
|
+
readonly key?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Class or property decorator that specifies the event type that removes a read model instance or child via a join.
|
|
11
|
+
* @param eventType - The event constructor.
|
|
12
|
+
* @param key - Optional event property name used as the key to identify the instance to remove.
|
|
13
|
+
* @returns A class and property decorator.
|
|
14
|
+
*/
|
|
15
|
+
export declare function removedWithJoin(eventType: Function, key?: string): ClassDecorator & PropertyDecorator;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves removedWithJoin metadata stored on the given class constructor.
|
|
18
|
+
* @param target - The class constructor.
|
|
19
|
+
* @returns An array of removedWithJoin metadata entries.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRemovedWithJoinClassMetadata(target: Function): RemovedWithJoinMetadata[];
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves removedWithJoin metadata stored on the given property.
|
|
24
|
+
* @param target - The class prototype.
|
|
25
|
+
* @param propertyKey - The property name.
|
|
26
|
+
* @returns An array of removedWithJoin metadata entries.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getRemovedWithJoinPropertyMetadata(target: object, propertyKey: string): RemovedWithJoinMetadata[];
|
|
29
|
+
//# sourceMappingURL=removedWithJoin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removedWithJoin.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/removedWithJoin.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,0EAA0E;AAC1E,MAAM,WAAW,uBAAuB;IACpC,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,+GAA+G;IAC/G,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACzB;AAKD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,iBAAiB,CAYrG;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,QAAQ,GAAG,uBAAuB,EAAE,CAE3F;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAEjH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { TypeIntrospector } from '../../types';
|
|
5
|
+
const CLASS_METADATA_KEY = 'chronicle:projection:removedWithJoin:class';
|
|
6
|
+
const PROPERTY_METADATA_KEY = 'chronicle:projection:removedWithJoin:property';
|
|
7
|
+
/**
|
|
8
|
+
* Class or property decorator that specifies the event type that removes a read model instance or child via a join.
|
|
9
|
+
* @param eventType - The event constructor.
|
|
10
|
+
* @param key - Optional event property name used as the key to identify the instance to remove.
|
|
11
|
+
* @returns A class and property decorator.
|
|
12
|
+
*/
|
|
13
|
+
export function removedWithJoin(eventType, key) {
|
|
14
|
+
return (target, propertyKey) => {
|
|
15
|
+
if (propertyKey !== undefined) {
|
|
16
|
+
const propKey = propertyKey.toString();
|
|
17
|
+
TypeIntrospector.trackProperty(target.constructor, propKey);
|
|
18
|
+
const existing = Reflect.getMetadata(PROPERTY_METADATA_KEY, target, propKey) ?? [];
|
|
19
|
+
Reflect.defineMetadata(PROPERTY_METADATA_KEY, [...existing, { eventType, key }], target, propKey);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const existing = Reflect.getMetadata(CLASS_METADATA_KEY, target) ?? [];
|
|
23
|
+
Reflect.defineMetadata(CLASS_METADATA_KEY, [...existing, { eventType, key }], target);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves removedWithJoin metadata stored on the given class constructor.
|
|
29
|
+
* @param target - The class constructor.
|
|
30
|
+
* @returns An array of removedWithJoin metadata entries.
|
|
31
|
+
*/
|
|
32
|
+
export function getRemovedWithJoinClassMetadata(target) {
|
|
33
|
+
return Reflect.getMetadata(CLASS_METADATA_KEY, target) ?? [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves removedWithJoin metadata stored on the given property.
|
|
37
|
+
* @param target - The class prototype.
|
|
38
|
+
* @param propertyKey - The property name.
|
|
39
|
+
* @returns An array of removedWithJoin metadata entries.
|
|
40
|
+
*/
|
|
41
|
+
export function getRemovedWithJoinPropertyMetadata(target, propertyKey) {
|
|
42
|
+
return Reflect.getMetadata(PROPERTY_METADATA_KEY, target, propertyKey) ?? [];
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=removedWithJoin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removedWithJoin.js","sourceRoot":"","sources":["../../../Projections/modelBound/removedWithJoin.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAU/C,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;AACxE,MAAM,qBAAqB,GAAG,+CAA+C,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,SAAmB,EAAE,GAAY;IAC7D,OAAO,CAAC,MAAc,EAAE,WAA6B,EAAE,EAAE;QACrD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;YACvC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAC3F,MAAM,QAAQ,GAA8B,OAAO,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;YAC9G,OAAO,CAAC,cAAc,CAAC,qBAAqB,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACtG,CAAC;aAAM,CAAC;YACJ,MAAM,QAAQ,GAA8B,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;YAClG,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAC1F,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAgB;IAC5D,OAAO,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAAc,EAAE,WAAmB;IAClF,OAAO,OAAO,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/** Metadata stored by the setFrom property decorator. */
|
|
3
|
+
export interface SetFromMetadata {
|
|
4
|
+
/** The event constructor associated with this annotation. */
|
|
5
|
+
readonly eventType: Function;
|
|
6
|
+
/** The event property name to read the value from. Defaults to the decorated property name. */
|
|
7
|
+
readonly eventPropertyName?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Property decorator that maps an event property value onto the decorated read model property.
|
|
11
|
+
* @param eventType - The event constructor.
|
|
12
|
+
* @param eventPropertyName - Optional event property name. Defaults to the property name.
|
|
13
|
+
* @returns A property decorator.
|
|
14
|
+
*/
|
|
15
|
+
export declare function setFrom(eventType: Function, eventPropertyName?: string): PropertyDecorator;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves all setFrom metadata stored on the given property.
|
|
18
|
+
* @param target - The class prototype.
|
|
19
|
+
* @param propertyKey - The property name.
|
|
20
|
+
* @returns An array of setFrom metadata entries.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSetFromMetadata(target: object, propertyKey: string): SetFromMetadata[];
|
|
23
|
+
//# sourceMappingURL=setFrom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setFrom.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/setFrom.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,+FAA+F;IAC/F,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACvC;AAID;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAQ1F;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,eAAe,EAAE,CAEzF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { TypeIntrospector } from '../../types';
|
|
5
|
+
const METADATA_KEY = 'chronicle:projection:setFrom';
|
|
6
|
+
/**
|
|
7
|
+
* Property decorator that maps an event property value onto the decorated read model property.
|
|
8
|
+
* @param eventType - The event constructor.
|
|
9
|
+
* @param eventPropertyName - Optional event property name. Defaults to the property name.
|
|
10
|
+
* @returns A property decorator.
|
|
11
|
+
*/
|
|
12
|
+
export function setFrom(eventType, eventPropertyName) {
|
|
13
|
+
return (target, propertyKey) => {
|
|
14
|
+
const key = propertyKey.toString();
|
|
15
|
+
TypeIntrospector.trackProperty(target.constructor, key);
|
|
16
|
+
const existing = Reflect.getMetadata(METADATA_KEY, target, key) ?? [];
|
|
17
|
+
const metadata = { eventType, eventPropertyName };
|
|
18
|
+
Reflect.defineMetadata(METADATA_KEY, [...existing, metadata], target, key);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves all setFrom metadata stored on the given property.
|
|
23
|
+
* @param target - The class prototype.
|
|
24
|
+
* @param propertyKey - The property name.
|
|
25
|
+
* @returns An array of setFrom metadata entries.
|
|
26
|
+
*/
|
|
27
|
+
export function getSetFromMetadata(target, propertyKey) {
|
|
28
|
+
return Reflect.getMetadata(METADATA_KEY, target, propertyKey) ?? [];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=setFrom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setFrom.js","sourceRoot":"","sources":["../../../Projections/modelBound/setFrom.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAU/C,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,SAAmB,EAAE,iBAA0B;IACnE,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACpD,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAsB,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QACzF,MAAM,QAAQ,GAAoB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;QACnE,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/E,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,WAAmB;IAClE,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/** Metadata stored by the setFromContext property decorator. */
|
|
3
|
+
export interface SetFromContextMetadata {
|
|
4
|
+
/** The event constructor associated with this annotation. */
|
|
5
|
+
readonly eventType: Function;
|
|
6
|
+
/** The event context property name to read the value from. Defaults to the decorated property name. */
|
|
7
|
+
readonly contextPropertyName?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Property decorator that maps a value from an event context property onto the decorated read model property.
|
|
11
|
+
* @param eventType - The event constructor.
|
|
12
|
+
* @param contextPropertyName - Optional event context property name. Defaults to the property name.
|
|
13
|
+
* @returns A property decorator.
|
|
14
|
+
*/
|
|
15
|
+
export declare function setFromContext(eventType: Function, contextPropertyName?: string): PropertyDecorator;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves all setFromContext metadata stored on the given property.
|
|
18
|
+
* @param target - The class prototype.
|
|
19
|
+
* @param propertyKey - The property name.
|
|
20
|
+
* @returns An array of setFromContext metadata entries.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSetFromContextMetadata(target: object, propertyKey: string): SetFromContextMetadata[];
|
|
23
|
+
//# sourceMappingURL=setFromContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setFromContext.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/setFromContext.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,gEAAgE;AAChE,MAAM,WAAW,sBAAsB;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,uGAAuG;IACvG,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CACzC;AAID;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAQnG;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAEvG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { TypeIntrospector } from '../../types';
|
|
5
|
+
const METADATA_KEY = 'chronicle:projection:setFromContext';
|
|
6
|
+
/**
|
|
7
|
+
* Property decorator that maps a value from an event context property onto the decorated read model property.
|
|
8
|
+
* @param eventType - The event constructor.
|
|
9
|
+
* @param contextPropertyName - Optional event context property name. Defaults to the property name.
|
|
10
|
+
* @returns A property decorator.
|
|
11
|
+
*/
|
|
12
|
+
export function setFromContext(eventType, contextPropertyName) {
|
|
13
|
+
return (target, propertyKey) => {
|
|
14
|
+
const key = propertyKey.toString();
|
|
15
|
+
TypeIntrospector.trackProperty(target.constructor, key);
|
|
16
|
+
const existing = Reflect.getMetadata(METADATA_KEY, target, key) ?? [];
|
|
17
|
+
const metadata = { eventType, contextPropertyName };
|
|
18
|
+
Reflect.defineMetadata(METADATA_KEY, [...existing, metadata], target, key);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves all setFromContext metadata stored on the given property.
|
|
23
|
+
* @param target - The class prototype.
|
|
24
|
+
* @param propertyKey - The property name.
|
|
25
|
+
* @returns An array of setFromContext metadata entries.
|
|
26
|
+
*/
|
|
27
|
+
export function getSetFromContextMetadata(target, propertyKey) {
|
|
28
|
+
return Reflect.getMetadata(METADATA_KEY, target, propertyKey) ?? [];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=setFromContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setFromContext.js","sourceRoot":"","sources":["../../../Projections/modelBound/setFromContext.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAU/C,MAAM,YAAY,GAAG,qCAAqC,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,SAAmB,EAAE,mBAA4B;IAC5E,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACpD,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvF,MAAM,QAAQ,GAA6B,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QAChG,MAAM,QAAQ,GAA2B,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;QAC5E,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/E,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAc,EAAE,WAAmB;IACzE,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/** Metadata stored by the setValue property decorator. */
|
|
3
|
+
export interface SetValueMetadata {
|
|
4
|
+
/** The event constructor that triggers the value assignment. */
|
|
5
|
+
readonly eventType: Function;
|
|
6
|
+
/** The constant value to assign to the property when the event occurs. */
|
|
7
|
+
readonly value: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Property decorator that sets the decorated read model property to a constant value when the specified event occurs.
|
|
11
|
+
* @param eventType - The event constructor.
|
|
12
|
+
* @param value - The constant value to assign.
|
|
13
|
+
* @returns A property decorator.
|
|
14
|
+
*/
|
|
15
|
+
export declare function setValue(eventType: Function, value: unknown): PropertyDecorator;
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves all setValue metadata stored on the given property.
|
|
18
|
+
* @param target - The class prototype.
|
|
19
|
+
* @param propertyKey - The property name.
|
|
20
|
+
* @returns An array of setValue metadata entries.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSetValueMetadata(target: object, propertyKey: string): SetValueMetadata[];
|
|
23
|
+
//# sourceMappingURL=setValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setValue.d.ts","sourceRoot":"","sources":["../../../Projections/modelBound/setValue.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CAC3B;AAID;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAQ/E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAE3F"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 'reflect-metadata';
|
|
4
|
+
import { TypeIntrospector } from '../../types';
|
|
5
|
+
const METADATA_KEY = 'chronicle:projection:setValue';
|
|
6
|
+
/**
|
|
7
|
+
* Property decorator that sets the decorated read model property to a constant value when the specified event occurs.
|
|
8
|
+
* @param eventType - The event constructor.
|
|
9
|
+
* @param value - The constant value to assign.
|
|
10
|
+
* @returns A property decorator.
|
|
11
|
+
*/
|
|
12
|
+
export function setValue(eventType, value) {
|
|
13
|
+
return (target, propertyKey) => {
|
|
14
|
+
const key = propertyKey.toString();
|
|
15
|
+
TypeIntrospector.trackProperty(target.constructor, key);
|
|
16
|
+
const existing = Reflect.getMetadata(METADATA_KEY, target, key) ?? [];
|
|
17
|
+
const metadata = { eventType, value };
|
|
18
|
+
Reflect.defineMetadata(METADATA_KEY, [...existing, metadata], target, key);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves all setValue metadata stored on the given property.
|
|
23
|
+
* @param target - The class prototype.
|
|
24
|
+
* @param propertyKey - The property name.
|
|
25
|
+
* @returns An array of setValue metadata entries.
|
|
26
|
+
*/
|
|
27
|
+
export function getSetValueMetadata(target, propertyKey) {
|
|
28
|
+
return Reflect.getMetadata(METADATA_KEY, target, propertyKey) ?? [];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=setValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setValue.js","sourceRoot":"","sources":["../../../Projections/modelBound/setValue.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAU/C,MAAM,YAAY,GAAG,+BAA+B,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAmB,EAAE,KAAc;IACxD,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAE,EAAE;QACpD,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QACnC,gBAAgB,CAAC,aAAa,CAAE,MAAoC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAuB,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QAC1F,MAAM,QAAQ,GAAqB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACxD,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAG,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/E,CAAC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,WAAmB;IACnE,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC"}
|