@cratis/chronicle 6.59.0 → 6.61.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/ChronicleClient.ts +1 -1
- package/ChronicleOptions.ts +11 -0
- package/EventStore.ts +9 -1
- package/IEventStore.ts +7 -0
- package/README.md +1 -1
- package/artifacts/DefaultClientArtifactsProvider.ts +13 -1
- package/artifacts/IClientArtifactsProvider.ts +6 -0
- package/dist/ChronicleClient.js +1 -1
- package/dist/ChronicleClient.js.map +1 -1
- package/dist/ChronicleOptions.d.ts +7 -0
- package/dist/ChronicleOptions.d.ts.map +1 -1
- package/dist/ChronicleOptions.js +8 -0
- package/dist/ChronicleOptions.js.map +1 -1
- package/dist/EventStore.d.ts +3 -1
- package/dist/EventStore.d.ts.map +1 -1
- package/dist/EventStore.js +7 -1
- package/dist/EventStore.js.map +1 -1
- package/dist/IEventStore.d.ts +6 -0
- package/dist/IEventStore.d.ts.map +1 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +4 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.js +11 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
- package/dist/artifacts/IClientArtifactsProvider.d.ts +4 -0
- package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -1
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.d.ts +15 -0
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.d.ts.map +1 -0
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.js +22 -0
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.js.map +1 -0
- package/dist/projections/InvalidCausedByProperty.d.ts +10 -0
- package/dist/projections/InvalidCausedByProperty.d.ts.map +1 -0
- package/dist/projections/InvalidCausedByProperty.js +16 -0
- package/dist/projections/InvalidCausedByProperty.js.map +1 -0
- package/dist/projections/Projections.d.ts.map +1 -1
- package/dist/projections/Projections.js +7 -30
- package/dist/projections/Projections.js.map +1 -1
- package/dist/projections/causedBy.d.ts +15 -0
- package/dist/projections/causedBy.d.ts.map +1 -0
- package/dist/projections/causedBy.js +24 -0
- package/dist/projections/causedBy.js.map +1 -0
- package/dist/projections/childrenOrdering.d.ts +38 -0
- package/dist/projections/childrenOrdering.d.ts.map +1 -0
- package/dist/projections/childrenOrdering.js +37 -0
- package/dist/projections/childrenOrdering.js.map +1 -0
- package/dist/projections/childrenOrderingSupport.d.ts +14 -0
- package/dist/projections/childrenOrderingSupport.d.ts.map +1 -0
- package/dist/projections/childrenOrderingSupport.js +37 -0
- package/dist/projections/childrenOrderingSupport.js.map +1 -0
- package/dist/projections/declarative/AllSetBuilder.d.ts +3 -0
- package/dist/projections/declarative/AllSetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/AllSetBuilder.js +6 -0
- package/dist/projections/declarative/AllSetBuilder.js.map +1 -1
- package/dist/projections/declarative/ChildrenBuilder.d.ts +9 -0
- package/dist/projections/declarative/ChildrenBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/ChildrenBuilder.js +29 -1
- package/dist/projections/declarative/ChildrenBuilder.js.map +1 -1
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.d.ts +6 -0
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.d.ts.map +1 -0
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.js +11 -0
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.js.map +1 -0
- package/dist/projections/declarative/DictionaryKey.d.ts +48 -0
- package/dist/projections/declarative/DictionaryKey.d.ts.map +1 -0
- package/dist/projections/declarative/DictionaryKey.js +82 -0
- package/dist/projections/declarative/DictionaryKey.js.map +1 -0
- package/dist/projections/declarative/FromAllBuilder.d.ts +2 -0
- package/dist/projections/declarative/FromAllBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromAllBuilder.js +5 -0
- package/dist/projections/declarative/FromAllBuilder.js.map +1 -1
- package/dist/projections/declarative/FromBuilder.d.ts +18 -6
- package/dist/projections/declarative/FromBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromBuilder.js +34 -31
- package/dist/projections/declarative/FromBuilder.js.map +1 -1
- package/dist/projections/declarative/FromEveryBuilder.d.ts +2 -0
- package/dist/projections/declarative/FromEveryBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromEveryBuilder.js +7 -0
- package/dist/projections/declarative/FromEveryBuilder.js.map +1 -1
- package/dist/projections/declarative/IAllSetBuilder.d.ts +7 -0
- package/dist/projections/declarative/IAllSetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IChildrenBuilder.d.ts +19 -0
- package/dist/projections/declarative/IChildrenBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IFromAllBuilder.d.ts +6 -0
- package/dist/projections/declarative/IFromAllBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IFromEveryBuilder.d.ts +6 -0
- package/dist/projections/declarative/IFromEveryBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IReadModelPropertiesBuilder.d.ts +37 -6
- package/dist/projections/declarative/IReadModelPropertiesBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/ISetBuilder.d.ts +7 -0
- package/dist/projections/declarative/ISetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/InvalidDictionaryKey.d.ts +10 -0
- package/dist/projections/declarative/InvalidDictionaryKey.d.ts.map +1 -0
- package/dist/projections/declarative/InvalidDictionaryKey.js +16 -0
- package/dist/projections/declarative/InvalidDictionaryKey.js.map +1 -0
- package/dist/projections/declarative/JoinBuilder.d.ts +18 -6
- package/dist/projections/declarative/JoinBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/JoinBuilder.js +34 -31
- package/dist/projections/declarative/JoinBuilder.js.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts +2 -0
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderCore.js.map +1 -1
- package/dist/projections/declarative/SetBuilder.d.ts +3 -0
- package/dist/projections/declarative/SetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/SetBuilder.js +6 -0
- package/dist/projections/declarative/SetBuilder.js.map +1 -1
- package/dist/projections/declarative/index.d.ts +4 -0
- package/dist/projections/declarative/index.d.ts.map +1 -1
- package/dist/projections/declarative/index.js +3 -0
- package/dist/projections/declarative/index.js.map +1 -1
- package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts +29 -0
- package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts.map +1 -0
- package/dist/projections/for_Graphs/given/a_discovered_graph.js +19 -0
- package/dist/projections/for_Graphs/given/a_discovered_graph.js.map +1 -0
- package/dist/projections/for_Graphs/given/a_fake_connection.d.ts +24 -0
- package/dist/projections/for_Graphs/given/a_fake_connection.d.ts.map +1 -0
- package/dist/projections/for_Graphs/given/a_fake_connection.js +17 -0
- package/dist/projections/for_Graphs/given/a_fake_connection.js.map +1 -0
- package/dist/projections/for_Graphs/given/organization.d.ts +43 -0
- package/dist/projections/for_Graphs/given/organization.d.ts.map +1 -0
- package/dist/projections/for_Graphs/given/organization.js +84 -0
- package/dist/projections/for_Graphs/given/organization.js.map +1 -0
- package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.d.ts +11 -0
- package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.d.ts.map +1 -0
- package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.js +16 -0
- package/dist/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.js.map +1 -0
- package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.d.ts +11 -0
- package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.d.ts.map +1 -0
- package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.js +16 -0
- package/dist/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.js.map +1 -0
- package/dist/projections/graphs/GraphDeclaredMoreThanOnce.d.ts +11 -0
- package/dist/projections/graphs/GraphDeclaredMoreThanOnce.d.ts.map +1 -0
- package/dist/projections/graphs/GraphDeclaredMoreThanOnce.js +16 -0
- package/dist/projections/graphs/GraphDeclaredMoreThanOnce.js.map +1 -0
- package/dist/projections/graphs/GraphDefinitionBuilder.d.ts +24 -0
- package/dist/projections/graphs/GraphDefinitionBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphDefinitionBuilder.js +148 -0
- package/dist/projections/graphs/GraphDefinitionBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphEdgeBuilder.d.ts +41 -0
- package/dist/projections/graphs/GraphEdgeBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphEdgeBuilder.js +94 -0
- package/dist/projections/graphs/GraphEdgeBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphEdgeFromBuilder.d.ts +25 -0
- package/dist/projections/graphs/GraphEdgeFromBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphEdgeFromBuilder.js +37 -0
- package/dist/projections/graphs/GraphEdgeFromBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphEdgeFromModel.d.ts +16 -0
- package/dist/projections/graphs/GraphEdgeFromModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphEdgeFromModel.js +4 -0
- package/dist/projections/graphs/GraphEdgeFromModel.js.map +1 -0
- package/dist/projections/graphs/GraphEdgeModel.d.ts +24 -0
- package/dist/projections/graphs/GraphEdgeModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphEdgeModel.js +4 -0
- package/dist/projections/graphs/GraphEdgeModel.js.map +1 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.d.ts +21 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.js +31 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithModel.d.ts +14 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithModel.js +4 -0
- package/dist/projections/graphs/GraphEdgeRemovedWithModel.js.map +1 -0
- package/dist/projections/graphs/GraphElementCannotBeReadModel.d.ts +11 -0
- package/dist/projections/graphs/GraphElementCannotBeReadModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphElementCannotBeReadModel.js +16 -0
- package/dist/projections/graphs/GraphElementCannotBeReadModel.js.map +1 -0
- package/dist/projections/graphs/GraphHasDuplicateElement.d.ts +13 -0
- package/dist/projections/graphs/GraphHasDuplicateElement.d.ts.map +1 -0
- package/dist/projections/graphs/GraphHasDuplicateElement.js +18 -0
- package/dist/projections/graphs/GraphHasDuplicateElement.js.map +1 -0
- package/dist/projections/graphs/GraphKeyPropertyNotFound.d.ts +12 -0
- package/dist/projections/graphs/GraphKeyPropertyNotFound.d.ts.map +1 -0
- package/dist/projections/graphs/GraphKeyPropertyNotFound.js +17 -0
- package/dist/projections/graphs/GraphKeyPropertyNotFound.js.map +1 -0
- package/dist/projections/graphs/GraphMappingBuilder.d.ts +32 -0
- package/dist/projections/graphs/GraphMappingBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphMappingBuilder.js +48 -0
- package/dist/projections/graphs/GraphMappingBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphMemberMappings.d.ts +9 -0
- package/dist/projections/graphs/GraphMemberMappings.d.ts.map +1 -0
- package/dist/projections/graphs/GraphMemberMappings.js +59 -0
- package/dist/projections/graphs/GraphMemberMappings.js.map +1 -0
- package/dist/projections/graphs/GraphModel.d.ts +15 -0
- package/dist/projections/graphs/GraphModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphModel.js +4 -0
- package/dist/projections/graphs/GraphModel.js.map +1 -0
- package/dist/projections/graphs/GraphNameRequired.d.ts +11 -0
- package/dist/projections/graphs/GraphNameRequired.d.ts.map +1 -0
- package/dist/projections/graphs/GraphNameRequired.js +16 -0
- package/dist/projections/graphs/GraphNameRequired.js.map +1 -0
- package/dist/projections/graphs/GraphNodeBuilder.d.ts +34 -0
- package/dist/projections/graphs/GraphNodeBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphNodeBuilder.js +66 -0
- package/dist/projections/graphs/GraphNodeBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphNodeFromBuilder.d.ts +21 -0
- package/dist/projections/graphs/GraphNodeFromBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphNodeFromBuilder.js +30 -0
- package/dist/projections/graphs/GraphNodeFromBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphNodeFromModel.d.ts +14 -0
- package/dist/projections/graphs/GraphNodeFromModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphNodeFromModel.js +4 -0
- package/dist/projections/graphs/GraphNodeFromModel.js.map +1 -0
- package/dist/projections/graphs/GraphNodeModel.d.ts +18 -0
- package/dist/projections/graphs/GraphNodeModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphNodeModel.js +4 -0
- package/dist/projections/graphs/GraphNodeModel.js.map +1 -0
- package/dist/projections/graphs/GraphNodeRemovedWithBuilder.d.ts +17 -0
- package/dist/projections/graphs/GraphNodeRemovedWithBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphNodeRemovedWithBuilder.js +24 -0
- package/dist/projections/graphs/GraphNodeRemovedWithBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphNodeRemovedWithModel.d.ts +12 -0
- package/dist/projections/graphs/GraphNodeRemovedWithModel.d.ts.map +1 -0
- package/dist/projections/graphs/GraphNodeRemovedWithModel.js +4 -0
- package/dist/projections/graphs/GraphNodeRemovedWithModel.js.map +1 -0
- package/dist/projections/graphs/GraphProjectionBuilder.d.ts +25 -0
- package/dist/projections/graphs/GraphProjectionBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/GraphProjectionBuilder.js +36 -0
- package/dist/projections/graphs/GraphProjectionBuilder.js.map +1 -0
- package/dist/projections/graphs/GraphRegistration.d.ts +14 -0
- package/dist/projections/graphs/GraphRegistration.d.ts.map +1 -0
- package/dist/projections/graphs/GraphRegistration.js +4 -0
- package/dist/projections/graphs/GraphRegistration.js.map +1 -0
- package/dist/projections/graphs/GraphSchemaWriter.d.ts +28 -0
- package/dist/projections/graphs/GraphSchemaWriter.d.ts.map +1 -0
- package/dist/projections/graphs/GraphSchemaWriter.js +76 -0
- package/dist/projections/graphs/GraphSchemaWriter.js.map +1 -0
- package/dist/projections/graphs/Graphs.d.ts +39 -0
- package/dist/projections/graphs/Graphs.d.ts.map +1 -0
- package/dist/projections/graphs/Graphs.js +144 -0
- package/dist/projections/graphs/Graphs.js.map +1 -0
- package/dist/projections/graphs/IGraphEdgeBuilder.d.ts +37 -0
- package/dist/projections/graphs/IGraphEdgeBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphEdgeBuilder.js +4 -0
- package/dist/projections/graphs/IGraphEdgeBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphEdgeFromBuilder.d.ts +29 -0
- package/dist/projections/graphs/IGraphEdgeFromBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphEdgeFromBuilder.js +4 -0
- package/dist/projections/graphs/IGraphEdgeFromBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.d.ts +27 -0
- package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.js +4 -0
- package/dist/projections/graphs/IGraphEdgeRemovedWithBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphMappingBuilder.d.ts +49 -0
- package/dist/projections/graphs/IGraphMappingBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphMappingBuilder.js +4 -0
- package/dist/projections/graphs/IGraphMappingBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphNodeBuilder.d.ts +32 -0
- package/dist/projections/graphs/IGraphNodeBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphNodeBuilder.js +4 -0
- package/dist/projections/graphs/IGraphNodeBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphNodeFromBuilder.d.ts +21 -0
- package/dist/projections/graphs/IGraphNodeFromBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphNodeFromBuilder.js +4 -0
- package/dist/projections/graphs/IGraphNodeFromBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.d.ts +19 -0
- package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.js +4 -0
- package/dist/projections/graphs/IGraphNodeRemovedWithBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphProjection.d.ts +13 -0
- package/dist/projections/graphs/IGraphProjection.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphProjection.js +4 -0
- package/dist/projections/graphs/IGraphProjection.js.map +1 -0
- package/dist/projections/graphs/IGraphProjectionBuilder.d.ts +26 -0
- package/dist/projections/graphs/IGraphProjectionBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphProjectionBuilder.js +4 -0
- package/dist/projections/graphs/IGraphProjectionBuilder.js.map +1 -0
- package/dist/projections/graphs/IGraphs.d.ts +27 -0
- package/dist/projections/graphs/IGraphs.d.ts.map +1 -0
- package/dist/projections/graphs/IGraphs.js +4 -0
- package/dist/projections/graphs/IGraphs.js.map +1 -0
- package/dist/projections/graphs/ModelBoundGraphReader.d.ts +30 -0
- package/dist/projections/graphs/ModelBoundGraphReader.d.ts.map +1 -0
- package/dist/projections/graphs/ModelBoundGraphReader.js +112 -0
- package/dist/projections/graphs/ModelBoundGraphReader.js.map +1 -0
- package/dist/projections/graphs/NestedObjectInGraph.d.ts +12 -0
- package/dist/projections/graphs/NestedObjectInGraph.d.ts.map +1 -0
- package/dist/projections/graphs/NestedObjectInGraph.js +17 -0
- package/dist/projections/graphs/NestedObjectInGraph.js.map +1 -0
- package/dist/projections/graphs/NodeMustHaveExactlyOneKey.d.ts +12 -0
- package/dist/projections/graphs/NodeMustHaveExactlyOneKey.d.ts.map +1 -0
- package/dist/projections/graphs/NodeMustHaveExactlyOneKey.js +17 -0
- package/dist/projections/graphs/NodeMustHaveExactlyOneKey.js.map +1 -0
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.d.ts +13 -0
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.d.ts.map +1 -0
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.js +18 -0
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.js.map +1 -0
- package/dist/projections/graphs/UnknownGraphEventProperty.d.ts +13 -0
- package/dist/projections/graphs/UnknownGraphEventProperty.d.ts.map +1 -0
- package/dist/projections/graphs/UnknownGraphEventProperty.js +18 -0
- package/dist/projections/graphs/UnknownGraphEventProperty.js.map +1 -0
- package/dist/projections/graphs/UnknownGraphNode.d.ts +12 -0
- package/dist/projections/graphs/UnknownGraphNode.d.ts.map +1 -0
- package/dist/projections/graphs/UnknownGraphNode.js +17 -0
- package/dist/projections/graphs/UnknownGraphNode.js.map +1 -0
- package/dist/projections/graphs/edge.d.ts +23 -0
- package/dist/projections/graphs/edge.d.ts.map +1 -0
- package/dist/projections/graphs/edge.js +29 -0
- package/dist/projections/graphs/edge.js.map +1 -0
- package/dist/projections/graphs/edgeFrom.d.ts +31 -0
- package/dist/projections/graphs/edgeFrom.d.ts.map +1 -0
- package/dist/projections/graphs/edgeFrom.js +26 -0
- package/dist/projections/graphs/edgeFrom.js.map +1 -0
- package/dist/projections/graphs/edgeRemovedWith.d.ts +22 -0
- package/dist/projections/graphs/edgeRemovedWith.d.ts.map +1 -0
- package/dist/projections/graphs/edgeRemovedWith.js +25 -0
- package/dist/projections/graphs/edgeRemovedWith.js.map +1 -0
- package/dist/projections/graphs/edgeSource.d.ts +22 -0
- package/dist/projections/graphs/edgeSource.d.ts.map +1 -0
- package/dist/projections/graphs/edgeSource.js +30 -0
- package/dist/projections/graphs/edgeSource.js.map +1 -0
- package/dist/projections/graphs/edgeTarget.d.ts +22 -0
- package/dist/projections/graphs/edgeTarget.d.ts.map +1 -0
- package/dist/projections/graphs/edgeTarget.js +30 -0
- package/dist/projections/graphs/edgeTarget.js.map +1 -0
- package/dist/projections/graphs/graph.d.ts +16 -0
- package/dist/projections/graphs/graph.d.ts.map +1 -0
- package/dist/projections/graphs/graph.js +24 -0
- package/dist/projections/graphs/graph.js.map +1 -0
- package/dist/projections/graphs/graphKey.d.ts +16 -0
- package/dist/projections/graphs/graphKey.d.ts.map +1 -0
- package/dist/projections/graphs/graphKey.js +28 -0
- package/dist/projections/graphs/graphKey.js.map +1 -0
- package/dist/projections/graphs/graphProjection.d.ts +21 -0
- package/dist/projections/graphs/graphProjection.d.ts.map +1 -0
- package/dist/projections/graphs/graphProjection.js +28 -0
- package/dist/projections/graphs/graphProjection.js.map +1 -0
- package/dist/projections/graphs/index.d.ts +49 -0
- package/dist/projections/graphs/index.d.ts.map +1 -0
- package/dist/projections/graphs/index.js +28 -0
- package/dist/projections/graphs/index.js.map +1 -0
- package/dist/projections/graphs/isGraphElement.d.ts +7 -0
- package/dist/projections/graphs/isGraphElement.d.ts.map +1 -0
- package/dist/projections/graphs/isGraphElement.js +13 -0
- package/dist/projections/graphs/isGraphElement.js.map +1 -0
- package/dist/projections/graphs/node.d.ts +22 -0
- package/dist/projections/graphs/node.d.ts.map +1 -0
- package/dist/projections/graphs/node.js +29 -0
- package/dist/projections/graphs/node.js.map +1 -0
- package/dist/projections/graphs/nodeFrom.d.ts +31 -0
- package/dist/projections/graphs/nodeFrom.d.ts.map +1 -0
- package/dist/projections/graphs/nodeFrom.js +26 -0
- package/dist/projections/graphs/nodeFrom.js.map +1 -0
- package/dist/projections/graphs/nodeRemovedWith.d.ts +28 -0
- package/dist/projections/graphs/nodeRemovedWith.d.ts.map +1 -0
- package/dist/projections/graphs/nodeRemovedWith.js +25 -0
- package/dist/projections/graphs/nodeRemovedWith.js.map +1 -0
- package/dist/projections/graphs/propertyPathOf.d.ts +8 -0
- package/dist/projections/graphs/propertyPathOf.d.ts.map +1 -0
- package/dist/projections/graphs/propertyPathOf.js +14 -0
- package/dist/projections/graphs/propertyPathOf.js.map +1 -0
- package/dist/projections/index.d.ts +6 -0
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/index.js +4 -0
- package/dist/projections/index.js.map +1 -1
- package/dist/projections/modelBound/ConflictingChildrenOrdering.d.ts +10 -0
- package/dist/projections/modelBound/ConflictingChildrenOrdering.d.ts.map +1 -0
- package/dist/projections/modelBound/ConflictingChildrenOrdering.js +16 -0
- package/dist/projections/modelBound/ConflictingChildrenOrdering.js.map +1 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts +2 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts.map +1 -1
- package/dist/projections/modelBound/childrenAndNestedBuilder.js +9 -5
- package/dist/projections/modelBound/childrenAndNestedBuilder.js.map +1 -1
- package/dist/projections/modelBound/childrenFrom.d.ts +39 -1
- package/dist/projections/modelBound/childrenFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/childrenFrom.js +30 -1
- package/dist/projections/modelBound/childrenFrom.js.map +1 -1
- package/dist/projections/modelBound/index.d.ts +3 -2
- package/dist/projections/modelBound/index.d.ts.map +1 -1
- package/dist/projections/modelBound/index.js +1 -0
- package/dist/projections/modelBound/index.js.map +1 -1
- package/dist/projections/modelBound/setFrom.d.ts +26 -0
- package/dist/projections/modelBound/setFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/setFrom.js +15 -8
- package/dist/projections/modelBound/setFrom.js.map +1 -1
- package/dist/projections/modelBound/setFromContext.d.ts +23 -1
- package/dist/projections/modelBound/setFromContext.d.ts.map +1 -1
- package/dist/projections/modelBound/setFromContext.js +20 -2
- package/dist/projections/modelBound/setFromContext.js.map +1 -1
- package/dist/projections/propertyExpressions.d.ts +9 -0
- package/dist/projections/propertyExpressions.d.ts.map +1 -0
- package/dist/projections/propertyExpressions.js +13 -0
- package/dist/projections/propertyExpressions.js.map +1 -0
- package/dist/projections/registerProjectionWithRetry.d.ts +15 -0
- package/dist/projections/registerProjectionWithRetry.d.ts.map +1 -0
- package/dist/projections/registerProjectionWithRetry.js +44 -0
- package/dist/projections/registerProjectionWithRetry.js.map +1 -0
- package/dist/readModels/rootReadModelTypes.d.ts.map +1 -1
- package/dist/readModels/rootReadModelTypes.js +3 -1
- package/dist/readModels/rootReadModelTypes.js.map +1 -1
- package/dist/reducers/Reducers.d.ts.map +1 -1
- package/dist/reducers/Reducers.js +2 -1
- package/dist/reducers/Reducers.js.map +1 -1
- package/dist/sinks/WellKnownSinks.d.ts +4 -0
- package/dist/sinks/WellKnownSinks.d.ts.map +1 -1
- package/dist/sinks/WellKnownSinks.js +5 -1
- package/dist/sinks/WellKnownSinks.js.map +1 -1
- package/dist/testing/projections/ProjectionCapabilities.d.ts.map +1 -1
- package/dist/testing/projections/ProjectionCapabilities.js +2 -0
- package/dist/testing/projections/ProjectionCapabilities.js.map +1 -1
- package/dist/testing/projections/ProjectionChildrenCapabilities.d.ts.map +1 -1
- package/dist/testing/projections/ProjectionChildrenCapabilities.js +2 -0
- package/dist/testing/projections/ProjectionChildrenCapabilities.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/DecoratorType.d.ts +5 -1
- package/dist/types/DecoratorType.d.ts.map +1 -1
- package/dist/types/DecoratorType.js +4 -0
- package/dist/types/DecoratorType.js.map +1 -1
- package/for_ChronicleOptions/when_configuring_the_graph_sink/with_graph_sink_type.spec.ts +22 -0
- package/package.json +3 -3
- package/projections/ChildrenOrderingNotSupportedByContracts.ts +18 -0
- package/projections/InvalidCausedByProperty.ts +14 -0
- package/projections/Projections.ts +8 -29
- package/projections/causedBy.ts +30 -0
- package/projections/childrenOrdering.ts +53 -0
- package/projections/childrenOrderingSupport.ts +40 -0
- package/projections/declarative/AllSetBuilder.ts +7 -0
- package/projections/declarative/ChildrenBuilder.ts +34 -1
- package/projections/declarative/ChildrenOrderingAlreadyDefined.ts +11 -0
- package/projections/declarative/DictionaryKey.ts +88 -0
- package/projections/declarative/FromAllBuilder.ts +10 -0
- package/projections/declarative/FromBuilder.ts +42 -32
- package/projections/declarative/FromEveryBuilder.ts +12 -0
- package/projections/declarative/IAllSetBuilder.ts +8 -0
- package/projections/declarative/IChildrenBuilder.ts +22 -0
- package/projections/declarative/IFromAllBuilder.ts +7 -0
- package/projections/declarative/IFromEveryBuilder.ts +7 -0
- package/projections/declarative/IReadModelPropertiesBuilder.ts +39 -6
- package/projections/declarative/ISetBuilder.ts +8 -0
- package/projections/declarative/InvalidDictionaryKey.ts +14 -0
- package/projections/declarative/JoinBuilder.ts +41 -32
- package/projections/declarative/ProjectionBuilderCore.ts +2 -0
- package/projections/declarative/SetBuilder.ts +7 -0
- package/projections/declarative/for_ChildrenBuilder/when_ordering_children.spec.ts +52 -0
- package/projections/declarative/for_FromAllBuilder/when_setting_once.spec.ts +29 -0
- package/projections/declarative/for_FromBuilder/when_setting_once.spec.ts +39 -0
- package/projections/declarative/for_FromBuilder/when_targeting_dictionary_entries.spec.ts +99 -0
- package/projections/declarative/for_JoinBuilder/when_setting_once_and_targeting_dictionary_entries.spec.ts +36 -0
- package/projections/declarative/for_SetBuilder/when_setting_to_the_causing_identity.spec.ts +37 -0
- package/projections/declarative/index.ts +4 -0
- package/projections/for_Graphs/given/a_discovered_graph.ts +21 -0
- package/projections/for_Graphs/given/a_fake_connection.ts +19 -0
- package/projections/for_Graphs/given/organization.ts +96 -0
- package/projections/for_Graphs/when_building_a_fluent_graph.spec.ts +112 -0
- package/projections/for_Graphs/when_building_a_model_bound_graph.spec.ts +92 -0
- package/projections/for_Graphs/when_declaring_an_edge_with_an_identity.spec.ts +137 -0
- package/projections/for_Graphs/when_declaring_an_invalid_graph.spec.ts +227 -0
- package/projections/for_Graphs/when_declaring_with_standard_decorators.standard.spec.ts +92 -0
- package/projections/for_Graphs/when_discovering_graph_elements.spec.ts +32 -0
- package/projections/for_Graphs/when_mapping_properties.spec.ts +159 -0
- package/projections/for_Graphs/when_registering_graphs.spec.ts +56 -0
- package/projections/for_Projections/when_registering_ordered_children.spec.ts +66 -0
- package/projections/for_childrenOrderingSupport/when_detecting_support_in_the_pinned_contracts.spec.ts +22 -0
- package/projections/for_childrenOrderingSupport/when_ensuring_children_ordering_is_supported.spec.ts +35 -0
- package/projections/graphs/EdgeCanHaveOnlyOneIdentifyingKey.ts +16 -0
- package/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.ts +16 -0
- package/projections/graphs/GraphDeclaredMoreThanOnce.ts +16 -0
- package/projections/graphs/GraphDefinitionBuilder.ts +169 -0
- package/projections/graphs/GraphEdgeBuilder.ts +107 -0
- package/projections/graphs/GraphEdgeFromBuilder.ts +47 -0
- package/projections/graphs/GraphEdgeFromModel.ts +22 -0
- package/projections/graphs/GraphEdgeModel.ts +34 -0
- package/projections/graphs/GraphEdgeRemovedWithBuilder.ts +39 -0
- package/projections/graphs/GraphEdgeRemovedWithModel.ts +19 -0
- package/projections/graphs/GraphElementCannotBeReadModel.ts +16 -0
- package/projections/graphs/GraphHasDuplicateElement.ts +18 -0
- package/projections/graphs/GraphKeyPropertyNotFound.ts +17 -0
- package/projections/graphs/GraphMappingBuilder.ts +65 -0
- package/projections/graphs/GraphMemberMappings.ts +60 -0
- package/projections/graphs/GraphModel.ts +20 -0
- package/projections/graphs/GraphNameRequired.ts +16 -0
- package/projections/graphs/GraphNodeBuilder.ts +76 -0
- package/projections/graphs/GraphNodeFromBuilder.ts +38 -0
- package/projections/graphs/GraphNodeFromModel.ts +19 -0
- package/projections/graphs/GraphNodeModel.ts +25 -0
- package/projections/graphs/GraphNodeRemovedWithBuilder.ts +30 -0
- package/projections/graphs/GraphNodeRemovedWithModel.ts +16 -0
- package/projections/graphs/GraphProjectionBuilder.ts +52 -0
- package/projections/graphs/GraphRegistration.ts +19 -0
- package/projections/graphs/GraphSchemaWriter.ts +80 -0
- package/projections/graphs/Graphs.ts +165 -0
- package/projections/graphs/IGraphEdgeBuilder.ts +43 -0
- package/projections/graphs/IGraphEdgeFromBuilder.ts +34 -0
- package/projections/graphs/IGraphEdgeRemovedWithBuilder.ts +32 -0
- package/projections/graphs/IGraphMappingBuilder.ts +57 -0
- package/projections/graphs/IGraphNodeBuilder.ts +37 -0
- package/projections/graphs/IGraphNodeFromBuilder.ts +25 -0
- package/projections/graphs/IGraphNodeRemovedWithBuilder.ts +23 -0
- package/projections/graphs/IGraphProjection.ts +16 -0
- package/projections/graphs/IGraphProjectionBuilder.ts +34 -0
- package/projections/graphs/IGraphs.ts +33 -0
- package/projections/graphs/ModelBoundGraphReader.ts +119 -0
- package/projections/graphs/NestedObjectInGraph.ts +17 -0
- package/projections/graphs/NodeMustHaveExactlyOneKey.ts +17 -0
- package/projections/graphs/SetOnceNotSupportedInGraph.ts +18 -0
- package/projections/graphs/UnknownGraphEventProperty.ts +18 -0
- package/projections/graphs/UnknownGraphNode.ts +17 -0
- package/projections/graphs/edge.ts +40 -0
- package/projections/graphs/edgeFrom.ts +48 -0
- package/projections/graphs/edgeRemovedWith.ts +36 -0
- package/projections/graphs/edgeSource.ts +39 -0
- package/projections/graphs/edgeTarget.ts +39 -0
- package/projections/graphs/graph.ts +28 -0
- package/projections/graphs/graphKey.ts +31 -0
- package/projections/graphs/graphProjection.ts +39 -0
- package/projections/graphs/index.ts +51 -0
- package/projections/graphs/isGraphElement.ts +14 -0
- package/projections/graphs/node.ts +40 -0
- package/projections/graphs/nodeFrom.ts +48 -0
- package/projections/graphs/nodeRemovedWith.ts +44 -0
- package/projections/graphs/propertyPathOf.ts +15 -0
- package/projections/index.ts +6 -0
- package/projections/modelBound/ConflictingChildrenOrdering.ts +14 -0
- package/projections/modelBound/childrenAndNestedBuilder.ts +11 -5
- package/projections/modelBound/childrenFrom.ts +62 -2
- package/projections/modelBound/for_childrenFrom/when_ordering_children.spec.ts +91 -0
- package/projections/modelBound/for_setFrom/when_setting_once.spec.ts +52 -0
- package/projections/modelBound/index.ts +3 -2
- package/projections/modelBound/setFrom.ts +37 -2
- package/projections/modelBound/setFromContext.ts +38 -3
- package/projections/propertyExpressions.ts +14 -0
- package/projections/registerProjectionWithRetry.ts +53 -0
- package/readModels/rootReadModelTypes.ts +3 -1
- package/reducers/Reducers.ts +2 -1
- package/sinks/WellKnownSinks.ts +7 -1
- package/testing/projections/ProjectionCapabilities.ts +1 -0
- package/testing/projections/ProjectionChildrenCapabilities.ts +1 -0
- package/testing/projections/for_ProjectionCapabilities/when_rejecting_set_once_dictionary_entries_and_ordered_children.spec.ts +52 -0
- package/types/DecoratorType.ts +7 -1
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
import { PropertyAccessor, PropertyPathResolverProxyHandler } from '@cratis/fundamentals';
|
|
5
5
|
import { constantValueExpression } from '../constantValueExpression.js';
|
|
6
6
|
import { eventContextPropertyExpression } from '../eventContextPropertyExpression.js';
|
|
7
|
+
import { removeExpression, setOnceExpression } from '../propertyExpressions.js';
|
|
7
8
|
import { AddBuilder } from './AddBuilder.js';
|
|
8
9
|
import { AddChildBuilder, ChildAdditionEntry } from './AddChildBuilder.js';
|
|
9
10
|
import { CompositeKeyBuilder } from './CompositeKeyBuilder.js';
|
|
11
|
+
import { DictionaryKeySource, dictionaryEntryPath } from './DictionaryKey.js';
|
|
10
12
|
import { IAddBuilder } from './IAddBuilder.js';
|
|
11
13
|
import { IAddChildBuilder } from './IAddChildBuilder.js';
|
|
12
14
|
import { ICompositeKeyBuilder } from './ICompositeKeyBuilder.js';
|
|
@@ -49,19 +51,29 @@ export class JoinBuilder<TReadModel, TEvent> implements IJoinBuilder<TReadModel,
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/** @inheritdoc */
|
|
52
|
-
set(readModelPropertyAccessor: PropertyAccessor<TReadModel>): ISetBuilder<TEvent, IJoinBuilder<TReadModel, TEvent>> {
|
|
53
|
-
const handler = new PropertyPathResolverProxyHandler();
|
|
54
|
-
const proxy = new Proxy({}, handler);
|
|
55
|
-
readModelPropertyAccessor(proxy as TReadModel);
|
|
56
|
-
const readModelProperty = handler.property;
|
|
57
|
-
|
|
54
|
+
set(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): ISetBuilder<TEvent, IJoinBuilder<TReadModel, TEvent>> {
|
|
58
55
|
return new SetBuilder<TEvent, IJoinBuilder<TReadModel, TEvent>>(
|
|
59
|
-
|
|
56
|
+
this.targetOf(readModelPropertyAccessor, key),
|
|
60
57
|
(property, expression) => { this.entry.properties[property] = expression; },
|
|
61
58
|
this
|
|
62
59
|
);
|
|
63
60
|
}
|
|
64
61
|
|
|
62
|
+
/** @inheritdoc */
|
|
63
|
+
setOnce(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): ISetBuilder<TEvent, IJoinBuilder<TReadModel, TEvent>> {
|
|
64
|
+
return new SetBuilder<TEvent, IJoinBuilder<TReadModel, TEvent>>(
|
|
65
|
+
this.targetOf(readModelPropertyAccessor, key),
|
|
66
|
+
(property, expression) => { this.entry.properties[property] = setOnceExpression(expression); },
|
|
67
|
+
this
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @inheritdoc */
|
|
72
|
+
removeKey(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key: DictionaryKeySource<TEvent>): this {
|
|
73
|
+
this.entry.properties[this.targetOf(readModelPropertyAccessor, key)] = removeExpression;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
/** @inheritdoc */
|
|
66
78
|
usingKey(keyAccessor: PropertyAccessor<TEvent>): this {
|
|
67
79
|
const handler = new PropertyPathResolverProxyHandler();
|
|
@@ -119,53 +131,38 @@ export class JoinBuilder<TReadModel, TEvent> implements IJoinBuilder<TReadModel,
|
|
|
119
131
|
}
|
|
120
132
|
|
|
121
133
|
/** @inheritdoc */
|
|
122
|
-
increment(readModelPropertyAccessor: PropertyAccessor<TReadModel>): this {
|
|
123
|
-
|
|
124
|
-
const proxy = new Proxy({}, handler);
|
|
125
|
-
readModelPropertyAccessor(proxy as TReadModel);
|
|
126
|
-
this.entry.properties[handler.property] = '$increment';
|
|
134
|
+
increment(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): this {
|
|
135
|
+
this.entry.properties[this.targetOf(readModelPropertyAccessor, key)] = '$increment';
|
|
127
136
|
return this;
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
/** @inheritdoc */
|
|
131
|
-
decrement(readModelPropertyAccessor: PropertyAccessor<TReadModel>): this {
|
|
132
|
-
|
|
133
|
-
const proxy = new Proxy({}, handler);
|
|
134
|
-
readModelPropertyAccessor(proxy as TReadModel);
|
|
135
|
-
this.entry.properties[handler.property] = '$decrement';
|
|
140
|
+
decrement(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): this {
|
|
141
|
+
this.entry.properties[this.targetOf(readModelPropertyAccessor, key)] = '$decrement';
|
|
136
142
|
return this;
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
/** @inheritdoc */
|
|
140
|
-
add(readModelPropertyAccessor: PropertyAccessor<TReadModel>): IAddBuilder<TEvent, this> {
|
|
141
|
-
const handler = new PropertyPathResolverProxyHandler();
|
|
142
|
-
const proxy = new Proxy({}, handler);
|
|
143
|
-
readModelPropertyAccessor(proxy as TReadModel);
|
|
146
|
+
add(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): IAddBuilder<TEvent, this> {
|
|
144
147
|
return new AddBuilder<TEvent, this>(
|
|
145
|
-
|
|
148
|
+
this.targetOf(readModelPropertyAccessor, key),
|
|
146
149
|
(property, expression) => { this.entry.properties[property] = expression; },
|
|
147
150
|
this
|
|
148
151
|
);
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
/** @inheritdoc */
|
|
152
|
-
subtract(readModelPropertyAccessor: PropertyAccessor<TReadModel>): ISubtractBuilder<TEvent, this> {
|
|
153
|
-
const handler = new PropertyPathResolverProxyHandler();
|
|
154
|
-
const proxy = new Proxy({}, handler);
|
|
155
|
-
readModelPropertyAccessor(proxy as TReadModel);
|
|
155
|
+
subtract(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): ISubtractBuilder<TEvent, this> {
|
|
156
156
|
return new SubtractBuilder<TEvent, this>(
|
|
157
|
-
|
|
157
|
+
this.targetOf(readModelPropertyAccessor, key),
|
|
158
158
|
(property, expression) => { this.entry.properties[property] = expression; },
|
|
159
159
|
this
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/** @inheritdoc */
|
|
164
|
-
count(readModelPropertyAccessor: PropertyAccessor<TReadModel>): this {
|
|
165
|
-
|
|
166
|
-
const proxy = new Proxy({}, handler);
|
|
167
|
-
readModelPropertyAccessor(proxy as TReadModel);
|
|
168
|
-
this.entry.properties[handler.property] = '$count';
|
|
164
|
+
count(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): this {
|
|
165
|
+
this.entry.properties[this.targetOf(readModelPropertyAccessor, key)] = '$count';
|
|
169
166
|
return this;
|
|
170
167
|
}
|
|
171
168
|
|
|
@@ -204,4 +201,16 @@ export class JoinBuilder<TReadModel, TEvent> implements IJoinBuilder<TReadModel,
|
|
|
204
201
|
this
|
|
205
202
|
);
|
|
206
203
|
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Resolves the target property path: the property itself, or the entry of a dictionary-typed property.
|
|
207
|
+
* @param readModelPropertyAccessor - Accessor for the read model property.
|
|
208
|
+
* @param key - Optional dictionary key.
|
|
209
|
+
* @returns The target property path.
|
|
210
|
+
*/
|
|
211
|
+
private targetOf(readModelPropertyAccessor: PropertyAccessor<TReadModel>, key?: DictionaryKeySource<TEvent>): string {
|
|
212
|
+
const handler = new PropertyPathResolverProxyHandler();
|
|
213
|
+
readModelPropertyAccessor(new Proxy({}, handler) as TReadModel);
|
|
214
|
+
return key === undefined ? handler.property : dictionaryEntryPath(handler.property, key);
|
|
215
|
+
}
|
|
207
216
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { AutoMap } from '@cratis/chronicle.contracts';
|
|
5
5
|
import { getEventTypeFor } from '../../events/eventTypeDecorator.js';
|
|
6
|
+
import type { ChildrenOrderingDefinitionLike } from '../childrenOrdering.js';
|
|
6
7
|
import { FromBuilder } from './FromBuilder.js';
|
|
7
8
|
import { IFromBuilder } from './IFromBuilder.js';
|
|
8
9
|
import { IFromEveryBuilder } from './IFromEveryBuilder.js';
|
|
@@ -59,6 +60,7 @@ export interface ChildrenDefinitionLike {
|
|
|
59
60
|
RemovedWithJoin: RemovedWithJoinRecord[];
|
|
60
61
|
AutoMap: AutoMap;
|
|
61
62
|
Nested: Record<string, ChildrenDefinitionLike>;
|
|
63
|
+
Ordering?: ChildrenOrderingDefinitionLike;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
/**
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { PropertyAccessor, PropertyPathResolverProxyHandler } from '@cratis/fundamentals';
|
|
5
5
|
import { ISetBuilder } from './ISetBuilder.js';
|
|
6
6
|
import { constantValueExpression } from '../constantValueExpression.js';
|
|
7
|
+
import { CausedByProperty, causedByExpression } from '../causedBy.js';
|
|
7
8
|
import { eventContextPropertyExpression } from '../eventContextPropertyExpression.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -45,4 +46,10 @@ export class SetBuilder<TEvent, TParentBuilder> implements ISetBuilder<TEvent, T
|
|
|
45
46
|
this._setProperty(this._readModelProperty, '$eventSourceId');
|
|
46
47
|
return this._parent;
|
|
47
48
|
}
|
|
49
|
+
|
|
50
|
+
/** @inheritdoc */
|
|
51
|
+
toCausedBy(property?: CausedByProperty): TParentBuilder {
|
|
52
|
+
this._setProperty(this._readModelProperty, causedByExpression(property));
|
|
53
|
+
return this._parent;
|
|
54
|
+
}
|
|
48
55
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
|
|
4
|
+
import { chai, describe, it } from 'vitest';
|
|
5
|
+
import { ChildrenPlacement, SortDirection } from '../../childrenOrdering.js';
|
|
6
|
+
import { ChildrenBuilder } from '../ChildrenBuilder.js';
|
|
7
|
+
import { ChildrenOrderingAlreadyDefined } from '../ChildrenOrderingAlreadyDefined.js';
|
|
8
|
+
|
|
9
|
+
chai.should();
|
|
10
|
+
|
|
11
|
+
class Order {
|
|
12
|
+
lines!: Line[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
class Line {
|
|
16
|
+
lineId!: string;
|
|
17
|
+
position!: number;
|
|
18
|
+
product!: { name: string };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const build = (configure: (builder: ChildrenBuilder<Order, Line>) => void) => {
|
|
22
|
+
const builder = new ChildrenBuilder<Order, Line>();
|
|
23
|
+
configure(builder);
|
|
24
|
+
return builder.buildDefinition();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
describe('when building children without an ordering', () => {
|
|
28
|
+
it('should leave the ordering out of the definition', () => build(_ => _.identifiedBy(m => m.lineId)).should.not.have.property('Ordering'));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe('when prepending children', () => {
|
|
32
|
+
it('should place new children first', () => build(_ => _.prepend()).Ordering!.should.deep.equal({
|
|
33
|
+
Placement: ChildrenPlacement.Prepend, SortBy: '', Direction: SortDirection.Ascending
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('when ordering children by a property', () => {
|
|
38
|
+
it('should sort new children ascending by the property', () => build(_ => _.orderBy(m => m.position)).Ordering!.should.deep.equal({
|
|
39
|
+
Placement: ChildrenPlacement.Sorted, SortBy: 'position', Direction: SortDirection.Ascending
|
|
40
|
+
}));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('when ordering children descending by a nested property', () => {
|
|
44
|
+
it('should sort new children descending by the property path', () => build(_ => _.orderByDescending(m => m.product.name)).Ordering!.should.deep.equal({
|
|
45
|
+
Placement: ChildrenPlacement.Sorted, SortBy: 'product.name', Direction: SortDirection.Descending
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('when ordering children twice', () => {
|
|
50
|
+
it('should reject the second ordering', () =>
|
|
51
|
+
(() => build(_ => _.prepend().orderBy(m => m.position))).should.throw(ChildrenOrderingAlreadyDefined));
|
|
52
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
4
|
+
import { chai, describe, it } from 'vitest';
|
|
5
|
+
import { FromAllBuilder } from '../FromAllBuilder.js';
|
|
6
|
+
import { FromEveryBuilder } from '../FromEveryBuilder.js';
|
|
7
|
+
|
|
8
|
+
chai.should();
|
|
9
|
+
|
|
10
|
+
class Document {
|
|
11
|
+
firstSeen!: Date;
|
|
12
|
+
createdBy!: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe('when setting once from all events', () => {
|
|
16
|
+
it('should wrap the event context value in set once', () => {
|
|
17
|
+
const builder = new FromAllBuilder<Document>();
|
|
18
|
+
builder.setOnce(m => m.firstSeen).toEventContextProperty('occurred');
|
|
19
|
+
builder.properties.firstSeen.should.equal('$setOnce($eventContext(Occurred))');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('when setting once from every event', () => {
|
|
24
|
+
it('should wrap the causing identity in set once', () => {
|
|
25
|
+
const builder = new FromEveryBuilder<Document>();
|
|
26
|
+
builder.setOnce(m => m.createdBy).toCausedBy('subject');
|
|
27
|
+
builder.entry.properties.createdBy.should.equal('$setOnce($causedBy(subject))');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -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
|
+
|
|
4
|
+
import { beforeEach, chai, describe, it } from 'vitest';
|
|
5
|
+
import { FromBuilder } from '../FromBuilder.js';
|
|
6
|
+
|
|
7
|
+
chai.should();
|
|
8
|
+
|
|
9
|
+
class Account {
|
|
10
|
+
name!: string;
|
|
11
|
+
openedAt!: Date;
|
|
12
|
+
openedBy!: string;
|
|
13
|
+
accountId!: string;
|
|
14
|
+
tier!: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
class AccountChanged {
|
|
18
|
+
name!: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('when setting read model properties once', () => {
|
|
22
|
+
let builder: FromBuilder<Account, AccountChanged>;
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
builder = new FromBuilder<Account, AccountChanged>();
|
|
26
|
+
builder
|
|
27
|
+
.setOnce(m => m.name).to(e => e.name)
|
|
28
|
+
.setOnce(m => m.openedAt).toEventContextProperty('occurred')
|
|
29
|
+
.setOnce(m => m.openedBy).toCausedBy('subject')
|
|
30
|
+
.setOnce(m => m.accountId).toEventSourceId()
|
|
31
|
+
.setOnce(m => m.tier).toValue('basic');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should wrap an event property in set once', () => builder.entry.properties.name.should.equal('$setOnce(name)'));
|
|
35
|
+
it('should wrap an event context property in set once', () => builder.entry.properties.openedAt.should.equal('$setOnce($eventContext(Occurred))'));
|
|
36
|
+
it('should wrap the causing identity in set once', () => builder.entry.properties.openedBy.should.equal('$setOnce($causedBy(subject))'));
|
|
37
|
+
it('should wrap the event source id in set once', () => builder.entry.properties.accountId.should.equal('$setOnce($eventSourceId)'));
|
|
38
|
+
it('should wrap a constant in set once', () => builder.entry.properties.tier.should.equal('$setOnce($value(basic))'));
|
|
39
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
|
|
4
|
+
import { beforeEach, chai, describe, it } from 'vitest';
|
|
5
|
+
import type { EventContext } from '../../../events/EventContext.js';
|
|
6
|
+
import { DictionaryKey } from '../DictionaryKey.js';
|
|
7
|
+
import { FromBuilder } from '../FromBuilder.js';
|
|
8
|
+
|
|
9
|
+
chai.should();
|
|
10
|
+
|
|
11
|
+
class Sales {
|
|
12
|
+
unitsByCategory!: Record<string, number>;
|
|
13
|
+
salesByCategory!: Record<string, number>;
|
|
14
|
+
salesByUser!: Record<string, number>;
|
|
15
|
+
returnsByCategory!: Record<string, number>;
|
|
16
|
+
firstSaleByCategory!: Record<string, Date>;
|
|
17
|
+
seriesBySlot!: Record<string, string>;
|
|
18
|
+
lastSeller!: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
class ItemSold {
|
|
22
|
+
category!: string;
|
|
23
|
+
quantity!: number;
|
|
24
|
+
seriesId!: string;
|
|
25
|
+
slot!: { name: string };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('when targeting dictionary entries with keys from the event content', () => {
|
|
29
|
+
let builder: FromBuilder<Sales, ItemSold>;
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
builder = new FromBuilder<Sales, ItemSold>();
|
|
33
|
+
builder
|
|
34
|
+
.set(m => m.seriesBySlot, e => e.slot.name).to(e => e.seriesId)
|
|
35
|
+
.add(m => m.unitsByCategory, e => e.category).with(e => e.quantity)
|
|
36
|
+
.subtract(m => m.returnsByCategory, e => e.category).with(e => e.quantity)
|
|
37
|
+
.increment(m => m.salesByCategory, e => e.category)
|
|
38
|
+
.count(m => m.salesByUser, e => e.category)
|
|
39
|
+
.decrement(m => m.lastSeller, DictionaryKey.fromEventContent<ItemSold>(e => e.category));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should key a set entry by the nested event property', () => builder.entry.properties['seriesBySlot.$eventContent.slot.name'].should.equal('seriesId'));
|
|
43
|
+
it('should key an add entry by the event property', () => builder.entry.properties['unitsByCategory.$eventContent.category'].should.equal('$add(quantity)'));
|
|
44
|
+
it('should key a subtract entry by the event property', () => builder.entry.properties['returnsByCategory.$eventContent.category'].should.equal('$subtract(quantity)'));
|
|
45
|
+
it('should key an increment entry by the event property', () => builder.entry.properties['salesByCategory.$eventContent.category'].should.equal('$increment'));
|
|
46
|
+
it('should key a count entry by the event property', () => builder.entry.properties['salesByUser.$eventContent.category'].should.equal('$count'));
|
|
47
|
+
it('should accept an explicit event content key', () => builder.entry.properties['lastSeller.$eventContent.category'].should.equal('$decrement'));
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('when targeting dictionary entries with keys from the event context', () => {
|
|
51
|
+
let builder: FromBuilder<Sales, ItemSold>;
|
|
52
|
+
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
builder = new FromBuilder<Sales, ItemSold>();
|
|
55
|
+
builder
|
|
56
|
+
.count(m => m.salesByUser, DictionaryKey.fromEventContext((c: EventContext) => c.causedBy!.subject))
|
|
57
|
+
.increment(m => m.salesByCategory, DictionaryKey.fromEventContext('EventSourceId'));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should key the entry by the event context path from an accessor', () => builder.entry.properties['salesByUser.$eventContext.causedBy.subject'].should.equal('$count'));
|
|
61
|
+
it('should key the entry by a camel-cased event context property name', () => builder.entry.properties['salesByCategory.$eventContext.eventSourceId'].should.equal('$increment'));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('when targeting dictionary entries with keys from the identity that caused the event', () => {
|
|
65
|
+
let builder: FromBuilder<Sales, ItemSold>;
|
|
66
|
+
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
builder = new FromBuilder<Sales, ItemSold>();
|
|
69
|
+
builder
|
|
70
|
+
.count(m => m.salesByUser, DictionaryKey.causedBy('userName'))
|
|
71
|
+
.set(m => m.lastSeller, DictionaryKey.causedBy('subject')).toCausedBy('name');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should key the entry by the causing user name', () => builder.entry.properties['salesByUser.$causedBy.userName'].should.equal('$count'));
|
|
75
|
+
it('should key the entry by the causing subject', () => builder.entry.properties['lastSeller.$causedBy.subject'].should.equal('$causedBy(name)'));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('when removing and setting dictionary entries once', () => {
|
|
79
|
+
let builder: FromBuilder<Sales, ItemSold>;
|
|
80
|
+
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
builder = new FromBuilder<Sales, ItemSold>();
|
|
83
|
+
builder
|
|
84
|
+
.removeKey(m => m.seriesBySlot, e => e.slot.name)
|
|
85
|
+
.removeKey(m => m.salesByUser, DictionaryKey.causedBy('subject'))
|
|
86
|
+
.setOnce(m => m.firstSaleByCategory, e => e.category).toEventContextProperty('occurred');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should remove the entry keyed by the event property', () => builder.entry.properties['seriesBySlot.$eventContent.slot.name'].should.equal('$remove'));
|
|
90
|
+
it('should remove the entry keyed by the causing subject', () => builder.entry.properties['salesByUser.$causedBy.subject'].should.equal('$remove'));
|
|
91
|
+
it('should wrap the entry value in set once', () => builder.entry.properties['firstSaleByCategory.$eventContent.category'].should.equal('$setOnce($eventContext(Occurred))'));
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('when using invalid dictionary keys', () => {
|
|
95
|
+
it('should reject a key that selects no event property', () => (() => DictionaryKey.fromEventContent(e => e)).should.throw('Invalid dictionary key'));
|
|
96
|
+
it('should reject an unknown event context property', () => (() => DictionaryKey.fromEventContext('notAProperty')).should.throw("Invalid event context property 'notAProperty'"));
|
|
97
|
+
it('should reject a derived event context function', () => (() => DictionaryKey.fromEventContext('occurred.week()')).should.throw("Invalid event context property 'occurred.week()'"));
|
|
98
|
+
it('should reject an unknown causing identity member', () => (() => DictionaryKey.causedBy('email' as 'subject')).should.throw("Invalid caused by property 'email'"));
|
|
99
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
|
|
4
|
+
import { beforeEach, chai, describe, it } from 'vitest';
|
|
5
|
+
import { DictionaryKey } from '../DictionaryKey.js';
|
|
6
|
+
import { JoinBuilder } from '../JoinBuilder.js';
|
|
7
|
+
|
|
8
|
+
chai.should();
|
|
9
|
+
|
|
10
|
+
class Order {
|
|
11
|
+
customerName!: string;
|
|
12
|
+
ratingsByReviewer!: Record<string, number>;
|
|
13
|
+
reviewers!: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class CustomerRated {
|
|
17
|
+
name!: string;
|
|
18
|
+
reviewer!: string;
|
|
19
|
+
rating!: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe('when a join sets once and targets dictionary entries', () => {
|
|
23
|
+
let builder: JoinBuilder<Order, CustomerRated>;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
builder = new JoinBuilder<Order, CustomerRated>();
|
|
27
|
+
builder
|
|
28
|
+
.setOnce(m => m.customerName).to(e => e.name)
|
|
29
|
+
.set(m => m.ratingsByReviewer, e => e.reviewer).to(e => e.rating)
|
|
30
|
+
.removeKey(m => m.reviewers, DictionaryKey.causedBy('subject'));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should wrap the value in set once', () => builder.entry.properties.customerName.should.equal('$setOnce(name)'));
|
|
34
|
+
it('should key the entry by the event property', () => builder.entry.properties['ratingsByReviewer.$eventContent.reviewer'].should.equal('rating'));
|
|
35
|
+
it('should remove the entry keyed by the causing subject', () => builder.entry.properties['reviewers.$causedBy.subject'].should.equal('$remove'));
|
|
36
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
|
|
4
|
+
import { beforeEach, chai, describe, it } from 'vitest';
|
|
5
|
+
import { AllSetBuilder } from '../AllSetBuilder.js';
|
|
6
|
+
import { SetBuilder } from '../SetBuilder.js';
|
|
7
|
+
|
|
8
|
+
chai.should();
|
|
9
|
+
|
|
10
|
+
describe('when setting a property to the identity that caused the event', () => {
|
|
11
|
+
let properties: Record<string, string>;
|
|
12
|
+
let builder: (property: string) => SetBuilder<object, object>;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
properties = {};
|
|
16
|
+
builder = property => new SetBuilder<object, object>(property, (target, expression) => { properties[target] = expression; }, {});
|
|
17
|
+
builder('causedBy').toCausedBy();
|
|
18
|
+
builder('subject').toCausedBy('subject');
|
|
19
|
+
builder('name').toCausedBy('name');
|
|
20
|
+
builder('userName').toCausedBy('userName');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should map the whole identity', () => properties.causedBy.should.equal('$causedBy'));
|
|
24
|
+
it('should map the subject', () => properties.subject.should.equal('$causedBy(subject)'));
|
|
25
|
+
it('should map the name', () => properties.name.should.equal('$causedBy(name)'));
|
|
26
|
+
it('should map the user name', () => properties.userName.should.equal('$causedBy(userName)'));
|
|
27
|
+
it('should reject an unknown member', () =>
|
|
28
|
+
(() => builder('other').toCausedBy('Subject' as 'subject')).should.throw("Invalid caused by property 'Subject'"));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe('when setting an all-events property to the identity that caused the event', () => {
|
|
32
|
+
it('should map the member', () => {
|
|
33
|
+
const properties: Record<string, string> = {};
|
|
34
|
+
new AllSetBuilder<object, object>('lastChangedBy', (target, expression) => { properties[target] = expression; }, {}).toCausedBy('userName');
|
|
35
|
+
properties.lastChangedBy.should.equal('$causedBy(userName)');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -6,6 +6,10 @@ export type { ProjectionMetadata } from './projection.js';
|
|
|
6
6
|
export { ProjectionBuilderFor } from './ProjectionBuilderFor.js';
|
|
7
7
|
export { ProjectionBuilderCore } from './ProjectionBuilderCore.js';
|
|
8
8
|
export { ChildrenBuilder } from './ChildrenBuilder.js';
|
|
9
|
+
export { ChildrenOrderingAlreadyDefined } from './ChildrenOrderingAlreadyDefined.js';
|
|
10
|
+
export { DictionaryKey } from './DictionaryKey.js';
|
|
11
|
+
export type { DictionaryKeySource } from './DictionaryKey.js';
|
|
12
|
+
export { InvalidDictionaryKey } from './InvalidDictionaryKey.js';
|
|
9
13
|
export { NestedBuilder } from './NestedBuilder.js';
|
|
10
14
|
export { AddChildBuilder } from './AddChildBuilder.js';
|
|
11
15
|
export type { ChildAdditionEntry } from './AddChildBuilder.js';
|
|
@@ -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
|
+
|
|
4
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
5
|
+
import { Graphs } from '../../graphs/Graphs.js';
|
|
6
|
+
import { aFakeConnection } from './a_fake_connection.js';
|
|
7
|
+
import { artifactsWith } from './organization.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Discovers the graphs of the given nodes, edges and fluent graph projections.
|
|
11
|
+
* @param graphElements - The nodes and edges.
|
|
12
|
+
* @param graphProjections - The fluent graph projections.
|
|
13
|
+
* @param sinkTypeId - The sink type of the graphs.
|
|
14
|
+
* @returns The graphs, once discovered, and what is needed to look at what they registered.
|
|
15
|
+
*/
|
|
16
|
+
export async function discoverGraphs(graphElements: Constructor[], graphProjections: Constructor[] = [], sinkTypeId = 'Neo4j') {
|
|
17
|
+
const fake = aFakeConnection();
|
|
18
|
+
const graphs = new Graphs('the-store', fake.connection, artifactsWith(graphElements, graphProjections), sinkTypeId);
|
|
19
|
+
await graphs.discover();
|
|
20
|
+
return { graphs, ...fake };
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
|
|
4
|
+
import type { ChronicleConnection } from '../../../connection/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a connection that records what is registered.
|
|
8
|
+
* @returns The connection and what was registered with it.
|
|
9
|
+
*/
|
|
10
|
+
export function aFakeConnection() {
|
|
11
|
+
const readModelRequests: Array<{ EventStore: string; Owner: number; ReadModels: Array<{ Type: { Identifier: string } }>; Source: number }> = [];
|
|
12
|
+
const projectionRequests: Array<{ EventStore: string; Owner: number; Projections: any[] }> = [];
|
|
13
|
+
const connection = {
|
|
14
|
+
logger: undefined,
|
|
15
|
+
readModels: { registerMany: async (request: (typeof readModelRequests)[number]) => { readModelRequests.push(request); return {}; } },
|
|
16
|
+
projections: { register: async (request: (typeof projectionRequests)[number]) => { projectionRequests.push(request); return {}; } }
|
|
17
|
+
} as unknown as ChronicleConnection;
|
|
18
|
+
return { connection, readModelRequests, projectionRequests };
|
|
19
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import { field } from '@cratis/fundamentals';
|
|
6
|
+
import type { IClientArtifactsProvider } from '../../../artifacts/IClientArtifactsProvider.js';
|
|
7
|
+
import { eventType } from '../../../events/eventTypeDecorator.js';
|
|
8
|
+
import { edge } from '../../graphs/edge.js';
|
|
9
|
+
import { edgeFrom } from '../../graphs/edgeFrom.js';
|
|
10
|
+
import { edgeRemovedWith } from '../../graphs/edgeRemovedWith.js';
|
|
11
|
+
import { edgeSource } from '../../graphs/edgeSource.js';
|
|
12
|
+
import { edgeTarget } from '../../graphs/edgeTarget.js';
|
|
13
|
+
import { graph } from '../../graphs/graph.js';
|
|
14
|
+
import { graphKey } from '../../graphs/graphKey.js';
|
|
15
|
+
import { node } from '../../graphs/node.js';
|
|
16
|
+
import { nodeFrom } from '../../graphs/nodeFrom.js';
|
|
17
|
+
import { nodeRemovedWith } from '../../graphs/nodeRemovedWith.js';
|
|
18
|
+
import { setFromContext } from '../../modelBound/setFromContext.js';
|
|
19
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
20
|
+
|
|
21
|
+
// Decorators are applied as plain function calls so the fixtures do not depend on decorator-syntax support.
|
|
22
|
+
|
|
23
|
+
export class PersonRegistered {
|
|
24
|
+
personId = '';
|
|
25
|
+
name = '';
|
|
26
|
+
}
|
|
27
|
+
eventType()(PersonRegistered);
|
|
28
|
+
|
|
29
|
+
export class PersonRemoved {
|
|
30
|
+
personId = '';
|
|
31
|
+
}
|
|
32
|
+
eventType()(PersonRemoved);
|
|
33
|
+
|
|
34
|
+
export class GroupCreated {
|
|
35
|
+
groupId = '';
|
|
36
|
+
name = '';
|
|
37
|
+
}
|
|
38
|
+
eventType()(GroupCreated);
|
|
39
|
+
|
|
40
|
+
export class MemberAdded {
|
|
41
|
+
personId = '';
|
|
42
|
+
groupId = '';
|
|
43
|
+
}
|
|
44
|
+
eventType()(MemberAdded);
|
|
45
|
+
|
|
46
|
+
export class MemberRemoved {
|
|
47
|
+
personId = '';
|
|
48
|
+
groupId = '';
|
|
49
|
+
}
|
|
50
|
+
eventType()(MemberRemoved);
|
|
51
|
+
|
|
52
|
+
export class Person {
|
|
53
|
+
personId = '';
|
|
54
|
+
name = '';
|
|
55
|
+
}
|
|
56
|
+
graph('Organization')(Person);
|
|
57
|
+
node()(Person);
|
|
58
|
+
graphKey()(Person.prototype, 'personId');
|
|
59
|
+
nodeFrom(PersonRegistered, { key: 'personId' })(Person);
|
|
60
|
+
nodeRemovedWith(PersonRemoved, { key: 'personId', detach: true })(Person);
|
|
61
|
+
|
|
62
|
+
export class Group {
|
|
63
|
+
groupId = '';
|
|
64
|
+
name = '';
|
|
65
|
+
}
|
|
66
|
+
graph('Organization')(Group);
|
|
67
|
+
node()(Group);
|
|
68
|
+
graphKey()(Group.prototype, 'groupId');
|
|
69
|
+
nodeFrom(GroupCreated, { key: 'groupId' })(Group);
|
|
70
|
+
|
|
71
|
+
export class MemberOf {
|
|
72
|
+
personId = '';
|
|
73
|
+
groupId = '';
|
|
74
|
+
since = new Date();
|
|
75
|
+
}
|
|
76
|
+
field(Date)(MemberOf.prototype, 'since');
|
|
77
|
+
graph('Organization')(MemberOf);
|
|
78
|
+
edge('MEMBER_OF')(MemberOf);
|
|
79
|
+
edgeSource(Person)(MemberOf.prototype, 'personId');
|
|
80
|
+
edgeTarget(Group)(MemberOf.prototype, 'groupId');
|
|
81
|
+
setFromContext(MemberAdded, 'occurred')(MemberOf.prototype, 'since');
|
|
82
|
+
edgeFrom(MemberAdded, { sourceKey: 'personId', targetKey: 'groupId' })(MemberOf);
|
|
83
|
+
edgeRemovedWith(MemberRemoved, { sourceKey: 'personId', targetKey: 'groupId' })(MemberOf);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Creates a provider that finds only the given graph artifacts.
|
|
87
|
+
* @param graphElements - The nodes and edges.
|
|
88
|
+
* @param graphProjections - The fluent graph projections.
|
|
89
|
+
* @returns The provider.
|
|
90
|
+
*/
|
|
91
|
+
export function artifactsWith(graphElements: Constructor[], graphProjections: Constructor[] = []): IClientArtifactsProvider {
|
|
92
|
+
return {
|
|
93
|
+
eventTypes: [], readModels: [], reactors: [], reducers: [], seeders: [], constraints: [], projections: [],
|
|
94
|
+
webhooks: [], eventTypeMigrations: [], globalForHandlers: [], graphElements, graphProjections
|
|
95
|
+
};
|
|
96
|
+
}
|