@cratis/chronicle 6.59.0 → 6.60.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/Projections.d.ts.map +1 -1
- package/dist/projections/Projections.js +3 -30
- package/dist/projections/Projections.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 +145 -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 +8 -0
- package/dist/projections/graphs/GraphMemberMappings.d.ts.map +1 -0
- package/dist/projections/graphs/GraphMemberMappings.js +54 -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/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 +48 -0
- package/dist/projections/graphs/index.d.ts.map +1 -0
- package/dist/projections/graphs/index.js +27 -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 +1 -0
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/index.js +1 -0
- package/dist/projections/index.js.map +1 -1
- 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/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/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/Projections.ts +4 -29
- 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 +91 -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 +199 -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/graphs/EdgeCanHaveOnlyOneIdentifyingKey.ts +16 -0
- package/projections/graphs/EdgeMustHaveOneSourceAndOneTarget.ts +16 -0
- package/projections/graphs/GraphDeclaredMoreThanOnce.ts +16 -0
- package/projections/graphs/GraphDefinitionBuilder.ts +166 -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 +57 -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/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 +50 -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 +1 -0
- package/projections/registerProjectionWithRetry.ts +53 -0
- package/readModels/rootReadModelTypes.ts +3 -1
- package/sinks/WellKnownSinks.ts +7 -1
- package/types/DecoratorType.ts +7 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphNodeBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/IGraphNodeBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEtF;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK;IACpC;;;;OAIG;IACH,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE7E;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE5I;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACtJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphNodeBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/IGraphNodeBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PropertyAccessor } from '@cratis/fundamentals';
|
|
2
|
+
import type { IGraphMappingBuilder } from './IGraphMappingBuilder.js';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the builder for how an event creates or updates a node.
|
|
5
|
+
* @template TNode - The type of node.
|
|
6
|
+
* @template TEvent - The type of event.
|
|
7
|
+
*/
|
|
8
|
+
export interface IGraphNodeFromBuilder<TNode, TEvent> extends IGraphMappingBuilder<TNode, TEvent, IGraphNodeFromBuilder<TNode, TEvent>> {
|
|
9
|
+
/**
|
|
10
|
+
* Takes the key of the node from a property on the event. By default it is the event source id.
|
|
11
|
+
* @param keyAccessor - Accessor for the event property.
|
|
12
|
+
* @returns The builder for continuation.
|
|
13
|
+
*/
|
|
14
|
+
usingKey(keyAccessor: PropertyAccessor<TEvent>): IGraphNodeFromBuilder<TNode, TEvent>;
|
|
15
|
+
/**
|
|
16
|
+
* Only sets properties on a node that already exists, instead of creating it.
|
|
17
|
+
* @returns The builder for continuation.
|
|
18
|
+
*/
|
|
19
|
+
onlyWhenExisting(): IGraphNodeFromBuilder<TNode, TEvent>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=IGraphNodeFromBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphNodeFromBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/IGraphNodeFromBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAE,SAAQ,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACnI;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAEtF;;;OAGG;IACH,gBAAgB,IAAI,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphNodeFromBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/IGraphNodeFromBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PropertyAccessor } from '@cratis/fundamentals';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the builder for how an event deletes a node.
|
|
4
|
+
* @template TEvent - The type of event.
|
|
5
|
+
*/
|
|
6
|
+
export interface IGraphNodeRemovedWithBuilder<TEvent> {
|
|
7
|
+
/**
|
|
8
|
+
* Takes the key of the node from a property on the event. By default it is the event source id.
|
|
9
|
+
* @param keyAccessor - Accessor for the event property.
|
|
10
|
+
* @returns The builder for continuation.
|
|
11
|
+
*/
|
|
12
|
+
usingKey(keyAccessor: PropertyAccessor<TEvent>): IGraphNodeRemovedWithBuilder<TEvent>;
|
|
13
|
+
/**
|
|
14
|
+
* Deletes the edges attached to the node with it. Without it a node that still has edges cannot be deleted.
|
|
15
|
+
* @returns The builder for continuation.
|
|
16
|
+
*/
|
|
17
|
+
detach(): IGraphNodeRemovedWithBuilder<TEvent>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=IGraphNodeRemovedWithBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphNodeRemovedWithBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/IGraphNodeRemovedWithBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,4BAA4B,CAAC,MAAM;IAChD;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAAG,4BAA4B,CAAC,MAAM,CAAC,CAAC;IAEtF;;;OAGG;IACH,MAAM,IAAI,4BAA4B,CAAC,MAAM,CAAC,CAAC;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphNodeRemovedWithBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/IGraphNodeRemovedWithBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IGraphProjectionBuilder } from './IGraphProjectionBuilder.js';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a projection of events onto a property graph, declared with a fluent builder.
|
|
4
|
+
* Implement it on a class decorated with graphProjection.
|
|
5
|
+
*/
|
|
6
|
+
export interface IGraphProjection {
|
|
7
|
+
/**
|
|
8
|
+
* Defines the nodes and edges of the graph and the events they are projected from.
|
|
9
|
+
* @param builder - The builder to define with.
|
|
10
|
+
*/
|
|
11
|
+
define(builder: IGraphProjectionBuilder): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=IGraphProjection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphProjection.d.ts","sourceRoot":"","sources":["../../../projections/graphs/IGraphProjection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphProjection.js","sourceRoot":"","sources":["../../../projections/graphs/IGraphProjection.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { IGraphEdgeBuilder } from './IGraphEdgeBuilder.js';
|
|
3
|
+
import type { IGraphNodeBuilder } from './IGraphNodeBuilder.js';
|
|
4
|
+
/**
|
|
5
|
+
* Defines a builder for the nodes and edges of a graph projection.
|
|
6
|
+
*/
|
|
7
|
+
export interface IGraphProjectionBuilder {
|
|
8
|
+
/**
|
|
9
|
+
* Defines a node.
|
|
10
|
+
* @param nodeType - The class of the node. Its name is the label of the node, unless the class has the node decorator.
|
|
11
|
+
* @param configure - Callback that configures the node.
|
|
12
|
+
* @returns The builder for continuation.
|
|
13
|
+
*/
|
|
14
|
+
node<TNode>(nodeType: Constructor<TNode>, configure: (builder: IGraphNodeBuilder<TNode>) => void): IGraphProjectionBuilder;
|
|
15
|
+
/**
|
|
16
|
+
* Defines an edge.
|
|
17
|
+
* @param edgeType - The class of the edge. Its properties, apart from the ones holding the keys of the end nodes, are
|
|
18
|
+
* the properties of the edge.
|
|
19
|
+
* @param sourceType - The class of the node the edge starts at.
|
|
20
|
+
* @param targetType - The class of the node the edge ends at.
|
|
21
|
+
* @param configure - Callback that configures the edge.
|
|
22
|
+
* @returns The builder for continuation.
|
|
23
|
+
*/
|
|
24
|
+
edge<TEdge>(edgeType: Constructor<TEdge>, sourceType: Function, targetType: Function, configure: (builder: IGraphEdgeBuilder<TEdge>) => void): IGraphProjectionBuilder;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=IGraphProjectionBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphProjectionBuilder.d.ts","sourceRoot":"","sources":["../../../projections/graphs/IGraphProjectionBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,uBAAuB,CAAC;IAE3H;;;;;;;;OAQG;IACH,IAAI,CAAC,KAAK,EACN,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,EAC5B,UAAU,EAAE,QAAQ,EACpB,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,uBAAuB,CAAC;CACxF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphProjectionBuilder.js","sourceRoot":"","sources":["../../../projections/graphs/IGraphProjectionBuilder.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Constructor } from '@cratis/fundamentals';
|
|
2
|
+
import type { GraphRegistration } from './GraphRegistration.js';
|
|
3
|
+
/**
|
|
4
|
+
* Defines a system for the property graphs an application declares, with the decorators and with the fluent builder,
|
|
5
|
+
* including discovery and registration with the Chronicle Kernel.
|
|
6
|
+
*/
|
|
7
|
+
export interface IGraphs {
|
|
8
|
+
/** Gets the registrations found by the last call to {@link IGraphs.discover}. */
|
|
9
|
+
readonly registrations: readonly GraphRegistration[];
|
|
10
|
+
/**
|
|
11
|
+
* Gets the declarations that could not be turned into a registration, and why. One invalid graph does not
|
|
12
|
+
* take the rest of the graphs down with it.
|
|
13
|
+
*/
|
|
14
|
+
readonly failures: ReadonlyMap<Constructor, Error>;
|
|
15
|
+
/**
|
|
16
|
+
* Discovers the graphs from the registered client artifacts.
|
|
17
|
+
* @returns A promise that resolves when discovery is complete.
|
|
18
|
+
*/
|
|
19
|
+
discover(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Registers all discovered graphs with the Chronicle Kernel: the read model that describes each graph and the
|
|
22
|
+
* projection that fills it.
|
|
23
|
+
* @returns A promise that resolves when registration is complete.
|
|
24
|
+
*/
|
|
25
|
+
register(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=IGraphs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphs.d.ts","sourceRoot":"","sources":["../../../projections/graphs/IGraphs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;GAGG;AACH,MAAM,WAAW,OAAO;IACpB,iFAAiF;IACjF,QAAQ,CAAC,aAAa,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAErD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAEnD;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGraphs.js","sourceRoot":"","sources":["../../../projections/graphs/IGraphs.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GraphEdgeModel } from './GraphEdgeModel.js';
|
|
2
|
+
import type { GraphNodeModel } from './GraphNodeModel.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reads nodes and edges from the decorators on their types.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ModelBoundGraphReader {
|
|
7
|
+
/**
|
|
8
|
+
* Gets the name of the graph a node or an edge belongs to.
|
|
9
|
+
* @param type - The node or edge type.
|
|
10
|
+
* @returns The name of the graph.
|
|
11
|
+
* @throws {GraphNameRequired} When the type does not name its graph.
|
|
12
|
+
*/
|
|
13
|
+
static graphNameOf(type: Function): string;
|
|
14
|
+
/**
|
|
15
|
+
* Read a node.
|
|
16
|
+
* @param type - The node type.
|
|
17
|
+
* @returns The {@link GraphNodeModel}.
|
|
18
|
+
* @throws {NodeMustHaveExactlyOneKey} When the type does not have exactly one member with the graphKey decorator.
|
|
19
|
+
*/
|
|
20
|
+
readNode(type: Function): GraphNodeModel;
|
|
21
|
+
/**
|
|
22
|
+
* Read an edge.
|
|
23
|
+
* @param type - The edge type.
|
|
24
|
+
* @returns The {@link GraphEdgeModel}.
|
|
25
|
+
* @throws {EdgeMustHaveOneSourceAndOneTarget} When the type does not name exactly one source and one target.
|
|
26
|
+
* @throws {EdgeCanHaveOnlyOneIdentifyingKey} When the type has more than one member with the graphKey decorator.
|
|
27
|
+
*/
|
|
28
|
+
readEdge(type: Function): GraphEdgeModel;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ModelBoundGraphReader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelBoundGraphReader.d.ts","sourceRoot":"","sources":["../../../projections/graphs/ModelBoundGraphReader.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAO1D;;GAEG;AACH,qBAAa,qBAAqB;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAIzC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,cAAc,CA+BvC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,cAAc,CA+BvC;CACJ"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 { TypeIntrospector } from '../../types/index.js';
|
|
4
|
+
import { constantValueExpression } from '../constantValueExpression.js';
|
|
5
|
+
import { EdgeCanHaveOnlyOneIdentifyingKey } from './EdgeCanHaveOnlyOneIdentifyingKey.js';
|
|
6
|
+
import { EdgeMustHaveOneSourceAndOneTarget } from './EdgeMustHaveOneSourceAndOneTarget.js';
|
|
7
|
+
import { getEdgeMetadata } from './edge.js';
|
|
8
|
+
import { getEdgeFromMetadata } from './edgeFrom.js';
|
|
9
|
+
import { getEdgeRemovedWithMetadata } from './edgeRemovedWith.js';
|
|
10
|
+
import { getEdgeSourceMetadata } from './edgeSource.js';
|
|
11
|
+
import { getEdgeTargetMetadata } from './edgeTarget.js';
|
|
12
|
+
import { getGraphName } from './graph.js';
|
|
13
|
+
import { isGraphKey } from './graphKey.js';
|
|
14
|
+
import { GraphNameRequired } from './GraphNameRequired.js';
|
|
15
|
+
import { readGraphMemberMappings } from './GraphMemberMappings.js';
|
|
16
|
+
import { getNodeMetadata } from './node.js';
|
|
17
|
+
import { getNodeFromMetadata } from './nodeFrom.js';
|
|
18
|
+
import { getNodeRemovedWithMetadata } from './nodeRemovedWith.js';
|
|
19
|
+
import { NodeMustHaveExactlyOneKey } from './NodeMustHaveExactlyOneKey.js';
|
|
20
|
+
/**
|
|
21
|
+
* Reads nodes and edges from the decorators on their types.
|
|
22
|
+
*/
|
|
23
|
+
export class ModelBoundGraphReader {
|
|
24
|
+
/**
|
|
25
|
+
* Gets the name of the graph a node or an edge belongs to.
|
|
26
|
+
* @param type - The node or edge type.
|
|
27
|
+
* @returns The name of the graph.
|
|
28
|
+
* @throws {GraphNameRequired} When the type does not name its graph.
|
|
29
|
+
*/
|
|
30
|
+
static graphNameOf(type) {
|
|
31
|
+
const name = getGraphName(type);
|
|
32
|
+
if (name === undefined || name === '')
|
|
33
|
+
throw new GraphNameRequired(type);
|
|
34
|
+
return name;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Read a node.
|
|
38
|
+
* @param type - The node type.
|
|
39
|
+
* @returns The {@link GraphNodeModel}.
|
|
40
|
+
* @throws {NodeMustHaveExactlyOneKey} When the type does not have exactly one member with the graphKey decorator.
|
|
41
|
+
*/
|
|
42
|
+
readNode(type) {
|
|
43
|
+
const members = TypeIntrospector.getTrackedProperties(type);
|
|
44
|
+
const keys = members.filter(member => isGraphKey(type.prototype, member));
|
|
45
|
+
if (keys.length !== 1)
|
|
46
|
+
throw new NodeMustHaveExactlyOneKey(type, keys.length);
|
|
47
|
+
const byEvent = readGraphMemberMappings(type.prototype, members);
|
|
48
|
+
const from = getNodeFromMetadata(type).map(attribute => ({
|
|
49
|
+
eventType: attribute.eventType,
|
|
50
|
+
key: attribute.constantKey !== undefined ? constantValueExpression(attribute.constantKey) : attribute.key,
|
|
51
|
+
properties: byEvent.get(attribute.eventType) ?? {},
|
|
52
|
+
updateOnly: attribute.updateOnly === true
|
|
53
|
+
}));
|
|
54
|
+
// An event that only a property refers to still projects the node, keyed by the event source id.
|
|
55
|
+
for (const [eventType, properties] of byEvent) {
|
|
56
|
+
if (from.every(declared => declared.eventType !== eventType)) {
|
|
57
|
+
from.push({ eventType, properties, updateOnly: false });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
type,
|
|
62
|
+
label: getNodeMetadata(type)?.label ?? type.name,
|
|
63
|
+
keyProperty: keys[0],
|
|
64
|
+
from,
|
|
65
|
+
removedWith: getNodeRemovedWithMetadata(type).map(attribute => ({
|
|
66
|
+
eventType: attribute.eventType,
|
|
67
|
+
key: attribute.key,
|
|
68
|
+
detach: attribute.detach === true
|
|
69
|
+
}))
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Read an edge.
|
|
74
|
+
* @param type - The edge type.
|
|
75
|
+
* @returns The {@link GraphEdgeModel}.
|
|
76
|
+
* @throws {EdgeMustHaveOneSourceAndOneTarget} When the type does not name exactly one source and one target.
|
|
77
|
+
* @throws {EdgeCanHaveOnlyOneIdentifyingKey} When the type has more than one member with the graphKey decorator.
|
|
78
|
+
*/
|
|
79
|
+
readEdge(type) {
|
|
80
|
+
const members = TypeIntrospector.getTrackedProperties(type);
|
|
81
|
+
const sources = members.filter(member => getEdgeSourceMetadata(type.prototype, member) !== undefined);
|
|
82
|
+
const targets = members.filter(member => getEdgeTargetMetadata(type.prototype, member) !== undefined);
|
|
83
|
+
if (sources.length !== 1 || targets.length !== 1)
|
|
84
|
+
throw new EdgeMustHaveOneSourceAndOneTarget(type);
|
|
85
|
+
const keys = members.filter(member => isGraphKey(type.prototype, member));
|
|
86
|
+
if (keys.length > 1)
|
|
87
|
+
throw new EdgeCanHaveOnlyOneIdentifyingKey(type);
|
|
88
|
+
const byEvent = readGraphMemberMappings(type.prototype, members.filter(member => member !== sources[0] && member !== targets[0]));
|
|
89
|
+
return {
|
|
90
|
+
type,
|
|
91
|
+
edgeType: getEdgeMetadata(type)?.type ?? type.name,
|
|
92
|
+
sourceNode: getEdgeSourceMetadata(type.prototype, sources[0]).nodeType,
|
|
93
|
+
targetNode: getEdgeTargetMetadata(type.prototype, targets[0]).nodeType,
|
|
94
|
+
identifyingProperty: keys.length === 1 ? keys[0] : undefined,
|
|
95
|
+
excludedProperties: [sources[0], targets[0]],
|
|
96
|
+
from: getEdgeFromMetadata(type).map(attribute => ({
|
|
97
|
+
eventType: attribute.eventType,
|
|
98
|
+
sourceKey: attribute.sourceKey,
|
|
99
|
+
targetKey: attribute.targetKey,
|
|
100
|
+
identity: attribute.identity,
|
|
101
|
+
properties: byEvent.get(attribute.eventType) ?? {}
|
|
102
|
+
})),
|
|
103
|
+
removedWith: getEdgeRemovedWithMetadata(type).map(attribute => ({
|
|
104
|
+
eventType: attribute.eventType,
|
|
105
|
+
sourceKey: attribute.sourceKey,
|
|
106
|
+
targetKey: attribute.targetKey,
|
|
107
|
+
identity: attribute.identity
|
|
108
|
+
}))
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=ModelBoundGraphReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelBoundGraphReader.js","sourceRoot":"","sources":["../../../projections/graphs/ModelBoundGraphReader.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,IAAc;QAC7B,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE;YAAE,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,IAAc;QACnB,MAAM,OAAO,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,yBAAyB,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9E,MAAM,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,IAAI,GAAyB,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAC3E,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,GAAG,EAAE,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG;YACzG,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE;YAClD,UAAU,EAAE,SAAS,CAAC,UAAU,KAAK,IAAI;SAC5C,CAAC,CAAC,CAAC;QAEJ,iGAAiG;QACjG,KAAK,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,OAAO,EAAE,CAAC;YAC5C,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,EAAE,CAAC;gBAC3D,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;QAED,OAAO;YACH,IAAI;YACJ,KAAK,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC,IAAI;YAChD,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;YACpB,IAAI;YACJ,WAAW,EAAE,0BAA0B,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBAC5D,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,GAAG,EAAE,SAAS,CAAC,GAAG;gBAClB,MAAM,EAAE,SAAS,CAAC,MAAM,KAAK,IAAI;aACpC,CAAC,CAAC;SACN,CAAC;IACN,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,IAAc;QACnB,MAAM,OAAO,GAAG,gBAAgB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC;QACtG,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC;QACtG,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,iCAAiC,CAAC,IAAI,CAAC,CAAC;QAEpG,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,gCAAgC,CAAC,IAAI,CAAC,CAAC;QAEtE,MAAM,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClI,OAAO;YACH,IAAI;YACJ,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI;YAClD,UAAU,EAAE,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAE,CAAC,QAAQ;YACvE,UAAU,EAAE,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAE,CAAC,QAAQ;YACvE,mBAAmB,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;YAC5D,kBAAkB,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5C,IAAI,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBAC9C,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ;gBAC5B,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE;aACrD,CAAC,CAAC;YACH,WAAW,EAAE,0BAA0B,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;gBAC5D,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ;aAC/B,CAAC,CAAC;SACN,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a node or an edge has an object property.
|
|
3
|
+
*/
|
|
4
|
+
export declare class NestedObjectInGraph extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link NestedObjectInGraph}.
|
|
7
|
+
* @param type - The node or edge type.
|
|
8
|
+
* @param property - The name of the property.
|
|
9
|
+
*/
|
|
10
|
+
constructor(type: Function, property: string);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=NestedObjectInGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NestedObjectInGraph.d.ts","sourceRoot":"","sources":["../../../projections/graphs/NestedObjectInGraph.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC1C;;;;OAIG;IACH,YAAY,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAG3C;CACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
* Error thrown when a node or an edge has an object property.
|
|
5
|
+
*/
|
|
6
|
+
export class NestedObjectInGraph extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new {@link NestedObjectInGraph}.
|
|
9
|
+
* @param type - The node or edge type.
|
|
10
|
+
* @param property - The name of the property.
|
|
11
|
+
*/
|
|
12
|
+
constructor(type, property) {
|
|
13
|
+
super(`The property '${property}' of '${type.name}' is an object. Nodes and edges can only have primitive properties and arrays of primitives.`);
|
|
14
|
+
this.name = 'NestedObjectInGraph';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=NestedObjectInGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NestedObjectInGraph.js","sourceRoot":"","sources":["../../../projections/graphs/NestedObjectInGraph.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC1C;;;;OAIG;IACH,YAAY,IAAc,EAAE,QAAgB;QACxC,KAAK,CAAC,iBAAiB,QAAQ,SAAS,IAAI,CAAC,IAAI,8FAA8F,CAAC,CAAC;QACjJ,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACtC,CAAC;CACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a node type does not have exactly one member marked with the graphKey decorator.
|
|
3
|
+
*/
|
|
4
|
+
export declare class NodeMustHaveExactlyOneKey extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link NodeMustHaveExactlyOneKey}.
|
|
7
|
+
* @param type - The node type.
|
|
8
|
+
* @param keys - The number of members with the graphKey decorator.
|
|
9
|
+
*/
|
|
10
|
+
constructor(type: Function, keys: number);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=NodeMustHaveExactlyOneKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeMustHaveExactlyOneKey.d.ts","sourceRoot":"","sources":["../../../projections/graphs/NodeMustHaveExactlyOneKey.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAChD;;;;OAIG;IACH,YAAY,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAGvC;CACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
* Error thrown when a node type does not have exactly one member marked with the graphKey decorator.
|
|
5
|
+
*/
|
|
6
|
+
export class NodeMustHaveExactlyOneKey extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new {@link NodeMustHaveExactlyOneKey}.
|
|
9
|
+
* @param type - The node type.
|
|
10
|
+
* @param keys - The number of members with the graphKey decorator.
|
|
11
|
+
*/
|
|
12
|
+
constructor(type, keys) {
|
|
13
|
+
super(`The node type '${type.name}' must have exactly one member with the graphKey decorator, but it has ${keys}.`);
|
|
14
|
+
this.name = 'NodeMustHaveExactlyOneKey';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=NodeMustHaveExactlyOneKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeMustHaveExactlyOneKey.js","sourceRoot":"","sources":["../../../projections/graphs/NodeMustHaveExactlyOneKey.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAChD;;;;OAIG;IACH,YAAY,IAAc,EAAE,IAAY;QACpC,KAAK,CAAC,kBAAkB,IAAI,CAAC,IAAI,0EAA0E,IAAI,GAAG,CAAC,CAAC;QACpH,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC5C,CAAC;CACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when a graph mapping needs an event property that the event type does not have.
|
|
3
|
+
*/
|
|
4
|
+
export declare class UnknownGraphEventProperty extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link UnknownGraphEventProperty}.
|
|
7
|
+
* @param type - The node or edge type.
|
|
8
|
+
* @param eventType - The event type.
|
|
9
|
+
* @param property - The name of the property.
|
|
10
|
+
*/
|
|
11
|
+
constructor(type: Function, eventType: Function, property: string);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=UnknownGraphEventProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownGraphEventProperty.d.ts","sourceRoot":"","sources":["../../../projections/graphs/UnknownGraphEventProperty.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAChD;;;;;OAKG;IACH,YAAY,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAGhE;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
* Error thrown when a graph mapping needs an event property that the event type does not have.
|
|
5
|
+
*/
|
|
6
|
+
export class UnknownGraphEventProperty extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new {@link UnknownGraphEventProperty}.
|
|
9
|
+
* @param type - The node or edge type.
|
|
10
|
+
* @param eventType - The event type.
|
|
11
|
+
* @param property - The name of the property.
|
|
12
|
+
*/
|
|
13
|
+
constructor(type, eventType, property) {
|
|
14
|
+
super(`The mapping of '${type.name}' refers to the property '${property}', which '${eventType.name}' does not have.`);
|
|
15
|
+
this.name = 'UnknownGraphEventProperty';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=UnknownGraphEventProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownGraphEventProperty.js","sourceRoot":"","sources":["../../../projections/graphs/UnknownGraphEventProperty.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAChD;;;;;OAKG;IACH,YAAY,IAAc,EAAE,SAAmB,EAAE,QAAgB;QAC7D,KAAK,CAAC,mBAAmB,IAAI,CAAC,IAAI,6BAA6B,QAAQ,aAAa,SAAS,CAAC,IAAI,kBAAkB,CAAC,CAAC;QACtH,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC5C,CAAC;CACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when an edge connects a type that is not a node of its graph.
|
|
3
|
+
*/
|
|
4
|
+
export declare class UnknownGraphNode extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link UnknownGraphNode}.
|
|
7
|
+
* @param edgeType - The edge type.
|
|
8
|
+
* @param node - The type that is not a node of the graph.
|
|
9
|
+
*/
|
|
10
|
+
constructor(edgeType: string, node: Function);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=UnknownGraphNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownGraphNode.d.ts","sourceRoot":"","sources":["../../../projections/graphs/UnknownGraphNode.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACvC;;;;OAIG;IACH,YAAY,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAG3C;CACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
* Error thrown when an edge connects a type that is not a node of its graph.
|
|
5
|
+
*/
|
|
6
|
+
export class UnknownGraphNode extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new {@link UnknownGraphNode}.
|
|
9
|
+
* @param edgeType - The edge type.
|
|
10
|
+
* @param node - The type that is not a node of the graph.
|
|
11
|
+
*/
|
|
12
|
+
constructor(edgeType, node) {
|
|
13
|
+
super(`The edge '${edgeType}' connects '${node.name}', which is not a node of the graph.`);
|
|
14
|
+
this.name = 'UnknownGraphNode';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=UnknownGraphNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownGraphNode.js","sourceRoot":"","sources":["../../../projections/graphs/UnknownGraphNode.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACvC;;;;OAIG;IACH,YAAY,QAAgB,EAAE,IAAc;QACxC,KAAK,CAAC,aAAa,QAAQ,eAAe,IAAI,CAAC,IAAI,sCAAsC,CAAC,CAAC;QAC3F,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACnC,CAAC;CACJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { ChronicleClassDecorator } from '../../types/standardDecoratorMetadata.js';
|
|
3
|
+
/** Metadata stored by the edge class decorator. */
|
|
4
|
+
export interface EdgeMetadata {
|
|
5
|
+
/** The edge type, for example MEMBER_OF. */
|
|
6
|
+
readonly type: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Class decorator that marks a class as an edge in a property graph. The members marked with edgeSource and
|
|
10
|
+
* edgeTarget hold the keys of the nodes at both ends and are not properties of the edge. An edge is identified by its
|
|
11
|
+
* type, source and target. Give a member the graphKey decorator to identify it by that property as well, which allows
|
|
12
|
+
* more than one edge of the type between the same two nodes.
|
|
13
|
+
* @param type - The edge type, for example MEMBER_OF.
|
|
14
|
+
* @returns A class decorator.
|
|
15
|
+
*/
|
|
16
|
+
export declare function edge(type: string): ChronicleClassDecorator;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the metadata stored by the edge decorator.
|
|
19
|
+
* @param target - The class constructor.
|
|
20
|
+
* @returns The metadata, or undefined when the class is not an edge.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getEdgeMetadata(target: Function): EdgeMetadata | undefined;
|
|
23
|
+
//# sourceMappingURL=edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../../projections/graphs/edge.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExF,mDAAmD;AACnD,MAAM,WAAW,YAAY;IACzB,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAID;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,CAM1D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAE1E"}
|
|
@@ -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
|
+
import 'reflect-metadata';
|
|
4
|
+
import { DecoratorType, TypeDiscoverer } from '../../types/index.js';
|
|
5
|
+
const METADATA_KEY = 'chronicle:graph:edge';
|
|
6
|
+
/**
|
|
7
|
+
* Class decorator that marks a class as an edge in a property graph. The members marked with edgeSource and
|
|
8
|
+
* edgeTarget hold the keys of the nodes at both ends and are not properties of the edge. An edge is identified by its
|
|
9
|
+
* type, source and target. Give a member the graphKey decorator to identify it by that property as well, which allows
|
|
10
|
+
* more than one edge of the type between the same two nodes.
|
|
11
|
+
* @param type - The edge type, for example MEMBER_OF.
|
|
12
|
+
* @returns A class decorator.
|
|
13
|
+
*/
|
|
14
|
+
export function edge(type) {
|
|
15
|
+
return (target) => {
|
|
16
|
+
const metadata = { type };
|
|
17
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target);
|
|
18
|
+
TypeDiscoverer.default.register(DecoratorType.GraphElement, target);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves the metadata stored by the edge decorator.
|
|
23
|
+
* @param target - The class constructor.
|
|
24
|
+
* @returns The metadata, or undefined when the class is not an edge.
|
|
25
|
+
*/
|
|
26
|
+
export function getEdgeMetadata(target) {
|
|
27
|
+
return Reflect.getMetadata(METADATA_KEY, target);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=edge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.js","sourceRoot":"","sources":["../../../projections/graphs/edge.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AASrE,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY;IAC7B,OAAO,CAAC,MAAc,EAAE,EAAE;QACtB,MAAM,QAAQ,GAAiB,EAAE,IAAI,EAAE,CAAC;QACxC,OAAO,CAAC,cAAc,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvD,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE,MAAqB,CAAC,CAAC;IACvF,CAAC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAgB;IAC5C,OAAO,OAAO,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAA6B,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { ChronicleClassDecorator } from '../../types/standardDecoratorMetadata.js';
|
|
3
|
+
/** Options for the edgeFrom class decorator. */
|
|
4
|
+
export interface EdgeFromOptions {
|
|
5
|
+
/** The name of the event property that holds the key of the source node. */
|
|
6
|
+
readonly sourceKey: string;
|
|
7
|
+
/** The name of the event property that holds the key of the target node. */
|
|
8
|
+
readonly targetKey: string;
|
|
9
|
+
/** The name of the event property that holds the identity of the edge, for an edge type with an identifying property. */
|
|
10
|
+
readonly identity?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Metadata stored by the edgeFrom class decorator. */
|
|
13
|
+
export interface EdgeFromMetadata extends EdgeFromOptions {
|
|
14
|
+
/** The event constructor. */
|
|
15
|
+
readonly eventType: Function;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Class decorator that creates or updates an edge when an event is observed. Both end nodes are created without
|
|
19
|
+
* properties when they do not exist.
|
|
20
|
+
* @param eventType - The event constructor.
|
|
21
|
+
* @param options - The event properties that hold the keys of the end nodes and, optionally, the identity of the edge.
|
|
22
|
+
* @returns A class decorator.
|
|
23
|
+
*/
|
|
24
|
+
export declare function edgeFrom(eventType: Function, options: EdgeFromOptions): ChronicleClassDecorator;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves all edgeFrom metadata stored on the given class constructor.
|
|
27
|
+
* @param target - The class constructor.
|
|
28
|
+
* @returns An array of edgeFrom metadata entries.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getEdgeFromMetadata(target: Function): EdgeFromMetadata[];
|
|
31
|
+
//# sourceMappingURL=edgeFrom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edgeFrom.d.ts","sourceRoot":"","sources":["../../../projections/graphs/edgeFrom.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAExF,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,yHAAyH;IACzH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACrD,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;CAChC;AAID;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,uBAAuB,CAK/F;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,EAAE,CAExE"}
|