@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
|
@@ -5,6 +5,8 @@ import 'reflect-metadata';
|
|
|
5
5
|
import { PropertyAccessor, PropertyPathResolverProxyHandler } from '@cratis/fundamentals';
|
|
6
6
|
import type { EventContext } from '../../events/index.js';
|
|
7
7
|
import { TypeIntrospector } from '../../types/index.js';
|
|
8
|
+
import { eventContextPropertyExpression } from '../eventContextPropertyExpression.js';
|
|
9
|
+
import { setOnceExpression } from '../propertyExpressions.js';
|
|
8
10
|
import { decorateModelBoundProperty } from '../../types/modelBoundProperty.js';
|
|
9
11
|
import { ChroniclePropertyDecorator, getPropertyMetadata } from '../../types/propertyDecoratorMetadata.js';
|
|
10
12
|
|
|
@@ -14,6 +16,20 @@ export interface SetFromContextMetadata {
|
|
|
14
16
|
readonly eventType: Function;
|
|
15
17
|
/** The event context property name to read the value from. Defaults to the decorated property name. */
|
|
16
18
|
readonly contextPropertyName?: string;
|
|
19
|
+
/** Whether the property is only assigned while it has no value yet. */
|
|
20
|
+
readonly setOnce?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Options for the setFromContext property decorator. */
|
|
24
|
+
export interface SetFromContextOptions {
|
|
25
|
+
/** The event context property name or accessor to read the value from. Defaults to the decorated property name. */
|
|
26
|
+
readonly contextProperty?: string | PropertyAccessor<EventContext>;
|
|
27
|
+
/**
|
|
28
|
+
* Only assign the property while it has no value yet. Use it to capture a first occurrence - for instance
|
|
29
|
+
* `@setFromContext(ItemAdded, { contextProperty: 'occurred', setOnce: true })` for when something was created -
|
|
30
|
+
* without a dedicated creation event.
|
|
31
|
+
*/
|
|
32
|
+
readonly setOnce?: boolean;
|
|
17
33
|
}
|
|
18
34
|
|
|
19
35
|
const METADATA_KEY = 'chronicle:projection:setFromContext';
|
|
@@ -21,15 +37,23 @@ const METADATA_KEY = 'chronicle:projection:setFromContext';
|
|
|
21
37
|
/**
|
|
22
38
|
* Property decorator that maps a value from an event context property onto the decorated read model property.
|
|
23
39
|
* @param eventType - The event constructor.
|
|
24
|
-
* @param
|
|
40
|
+
* @param contextPropertyOrAccessorOrOptions - Optional event context property name, property accessor, or options naming the
|
|
41
|
+
* context property and whether the property is only set once. Defaults to the property name.
|
|
25
42
|
* @returns A property decorator.
|
|
26
43
|
*/
|
|
27
44
|
export function setFromContext(eventType: Function, contextPropertyName?: string): ChroniclePropertyDecorator;
|
|
28
45
|
export function setFromContext(eventType: Function, contextPropertyAccessor?: PropertyAccessor<EventContext>): ChroniclePropertyDecorator;
|
|
46
|
+
export function setFromContext(eventType: Function, options: SetFromContextOptions): ChroniclePropertyDecorator;
|
|
29
47
|
export function setFromContext(
|
|
30
48
|
eventType: Function,
|
|
31
|
-
|
|
49
|
+
contextPropertyOrAccessorOrOptions?: string | PropertyAccessor<EventContext> | SetFromContextOptions
|
|
32
50
|
): ChroniclePropertyDecorator {
|
|
51
|
+
const options = typeof contextPropertyOrAccessorOrOptions === 'object' && contextPropertyOrAccessorOrOptions !== null
|
|
52
|
+
? contextPropertyOrAccessorOrOptions
|
|
53
|
+
: undefined;
|
|
54
|
+
const contextPropertyOrAccessor = options === undefined
|
|
55
|
+
? contextPropertyOrAccessorOrOptions as string | PropertyAccessor<EventContext> | undefined
|
|
56
|
+
: options.contextProperty;
|
|
33
57
|
return decorateModelBoundProperty((target: object, propertyKey: string | symbol) => {
|
|
34
58
|
const key = propertyKey.toString();
|
|
35
59
|
TypeIntrospector.trackProperty((target as { constructor: Function }).constructor, key);
|
|
@@ -45,7 +69,7 @@ export function setFromContext(
|
|
|
45
69
|
contextPropertyName = handler.property;
|
|
46
70
|
}
|
|
47
71
|
|
|
48
|
-
const metadata: SetFromContextMetadata = { eventType, contextPropertyName };
|
|
72
|
+
const metadata: SetFromContextMetadata = { eventType, contextPropertyName, ...(options?.setOnce === true ? { setOnce: true } : {}) };
|
|
49
73
|
Reflect.defineMetadata(METADATA_KEY, [...existing, metadata], target, key);
|
|
50
74
|
});
|
|
51
75
|
}
|
|
@@ -59,3 +83,14 @@ export function setFromContext(
|
|
|
59
83
|
export function getSetFromContextMetadata(target: object, propertyKey: string): SetFromContextMetadata[] {
|
|
60
84
|
return getPropertyMetadata<SetFromContextMetadata[]>(METADATA_KEY, target, propertyKey) ?? [];
|
|
61
85
|
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Builds the property expression for a setFromContext mapping.
|
|
89
|
+
* @param mapping - The setFromContext metadata.
|
|
90
|
+
* @param property - The decorated read model property.
|
|
91
|
+
* @returns The `$eventContext(...)` expression, wrapped in `$setOnce(...)` when the mapping only sets once.
|
|
92
|
+
*/
|
|
93
|
+
export function setFromContextExpression(mapping: SetFromContextMetadata, property: string): string {
|
|
94
|
+
const expression = eventContextPropertyExpression(mapping.contextPropertyName ?? property);
|
|
95
|
+
return mapping.setOnce === true ? setOnceExpression(expression) : expression;
|
|
96
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
/** The read model property expression that removes a dictionary entry; its target has to be a dynamic dictionary key. */
|
|
5
|
+
export const removeExpression = '$remove';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Wraps an event value expression so the kernel only assigns it while the target property has no value yet.
|
|
9
|
+
* @param expression - The event value expression, for example `name` or `$eventContext(Occurred)`.
|
|
10
|
+
* @returns The `$setOnce(<expression>)` expression.
|
|
11
|
+
*/
|
|
12
|
+
export function setOnceExpression(expression: string): string {
|
|
13
|
+
return `$setOnce(${expression})`;
|
|
14
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { ProjectionOwner, type ProjectionDefinition } from '@cratis/chronicle.contracts';
|
|
5
|
+
import type { ChronicleConnection } from '../connection/index.js';
|
|
6
|
+
import type { createLogger } from '../logging/createLogger.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Registers a projection with the kernel, retrying with a growing delay while the kernel reports a transient failure.
|
|
10
|
+
* @param connection - The Chronicle connection.
|
|
11
|
+
* @param eventStore - The event store name.
|
|
12
|
+
* @param logger - The logger to report with.
|
|
13
|
+
* @param projection - The projection definition to register.
|
|
14
|
+
* @param identifier - The identifier of the projection, for reporting.
|
|
15
|
+
* @param maxAttempts - The number of attempts before giving up.
|
|
16
|
+
* @returns A promise that resolves when the projection is registered.
|
|
17
|
+
*/
|
|
18
|
+
export async function registerProjectionWithRetry(
|
|
19
|
+
connection: ChronicleConnection,
|
|
20
|
+
eventStore: string,
|
|
21
|
+
logger: ReturnType<typeof createLogger>,
|
|
22
|
+
projection: ProjectionDefinition,
|
|
23
|
+
identifier: string,
|
|
24
|
+
maxAttempts = 5
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
let delay = 2000;
|
|
27
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
28
|
+
try {
|
|
29
|
+
logger.info('Registering projection', { identifier, readModel: projection.ReadModel, attempt });
|
|
30
|
+
await connection.projections.register({
|
|
31
|
+
EventStore: eventStore,
|
|
32
|
+
Owner: ProjectionOwner.PROJECTION_OWNER_Client,
|
|
33
|
+
Projections: [projection]
|
|
34
|
+
});
|
|
35
|
+
logger.info('Projection registered successfully', { identifier });
|
|
36
|
+
return;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
const msg = String(error);
|
|
39
|
+
const isTransient = msg.includes('UNKNOWN') || msg.includes('UNAVAILABLE') || msg.includes('INTERNAL');
|
|
40
|
+
if (!isTransient || attempt === maxAttempts) {
|
|
41
|
+
throw new Error(`Failed to register projection '${identifier}' after ${attempt} attempt(s): ${msg}`);
|
|
42
|
+
}
|
|
43
|
+
logger.warn('Projection registration failed with transient error, retrying', {
|
|
44
|
+
identifier,
|
|
45
|
+
attempt,
|
|
46
|
+
nextAttemptInMs: delay,
|
|
47
|
+
error
|
|
48
|
+
});
|
|
49
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
50
|
+
delay = Math.min(delay * 2, 15000);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -13,11 +13,13 @@ import type { IProjectionFor } from '../projections/declarative/IProjectionFor.j
|
|
|
13
13
|
import { getChildrenFromMetadata } from '../projections/modelBound/childrenFrom.js';
|
|
14
14
|
import { resolveChildElementType, resolveNestedType } from '../projections/modelBound/childrenAndNestedBuilder.js';
|
|
15
15
|
import { isNested } from '../projections/modelBound/nested.js';
|
|
16
|
+
import { isGraphElement } from '../projections/graphs/isGraphElement.js';
|
|
16
17
|
import { getReducerMetadata } from '../reducers/reducer.js';
|
|
17
18
|
import { TypeIntrospector } from '../types/TypeIntrospector.js';
|
|
18
19
|
|
|
19
20
|
function inspectReadModelTypes(artifacts: IClientArtifactsProvider): { models: Constructor[]; usedAsChildren: Set<Function>; visited: Set<Function> } {
|
|
20
|
-
|
|
21
|
+
// Nodes and edges map properties like a read model does but are projected into a graph, never into a read model.
|
|
22
|
+
const models = artifacts.readModels.filter(type => !isGraphElement(type));
|
|
21
23
|
const usedAsChildren = new Set<Function>();
|
|
22
24
|
const visited = new Set<Function>();
|
|
23
25
|
const inspect = (type: Function): void => {
|
package/reducers/Reducers.ts
CHANGED
|
@@ -390,7 +390,8 @@ export class Reducers implements IReducers {
|
|
|
390
390
|
EventStreamType: getEventStreamTypeFor(reducerType)
|
|
391
391
|
}
|
|
392
392
|
},
|
|
393
|
-
PageDelivery: toPageDelivery(reducerType)
|
|
393
|
+
PageDelivery: toPageDelivery(reducerType),
|
|
394
|
+
StateCaching: undefined
|
|
394
395
|
},
|
|
395
396
|
Value1: undefined
|
|
396
397
|
}
|
package/sinks/WellKnownSinks.ts
CHANGED
|
@@ -15,5 +15,11 @@ export const WellKnownSinks = {
|
|
|
15
15
|
MongoDB: 'MongoDB',
|
|
16
16
|
|
|
17
17
|
/** SQL sink. */
|
|
18
|
-
SQL: 'SQL'
|
|
18
|
+
SQL: 'SQL',
|
|
19
|
+
|
|
20
|
+
/** Neo4j graph sink, the default sink of property graphs. */
|
|
21
|
+
Neo4j: 'Neo4j',
|
|
22
|
+
|
|
23
|
+
/** In-memory graph sink, which keeps a property graph in the kernel's memory. */
|
|
24
|
+
InMemoryGraph: 'InMemoryGraph'
|
|
19
25
|
} as const;
|
|
@@ -175,6 +175,7 @@ export class ProjectionCapabilities {
|
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
if (expression === '$null') return;
|
|
178
|
+
if (expression.startsWith('$setOnce(')) fail('set once requires a kernel-backed test');
|
|
178
179
|
if (expression.startsWith('$eventContext(')) {
|
|
179
180
|
if (expression === '$eventContext(Occurred)') fail('raw Occurred is converted inconsistently by the kernel; only its Year, Month and Day paths are supported');
|
|
180
181
|
if (/^\$eventContext\(.+\(\)\)$/.test(expression)) fail('derived event-context functions require a kernel-backed test');
|
|
@@ -54,6 +54,7 @@ export class ProjectionChildrenCapabilities {
|
|
|
54
54
|
if (Object.keys(child.Nested ?? {}).length) reject(`${base}.Nested`, `nested projections inside children ${kernelBacked}`);
|
|
55
55
|
if ((child.RemovedWithJoin ?? []).length) reject(`${base}.RemovedWithJoin`, `removedWithJoin inside children ${kernelBacked}`);
|
|
56
56
|
if (wire.FromEventProperty) reject(`${base}.FromEventProperty`, `value children from an event property ${kernelBacked}`);
|
|
57
|
+
if (wire.Ordering !== undefined) reject(`${base}.Ordering`, `prepended or sorted children ${kernelBacked}`);
|
|
57
58
|
if (Object.keys(child.All?.Properties ?? {}).length || child.All?.IncludeChildren || (child.All?.AutoMap ?? AutoMap.Inherit) !== AutoMap.Inherit) {
|
|
58
59
|
reject(`${base}.All`, `fromEvery/all inside children ${kernelBacked}`);
|
|
59
60
|
}
|
|
@@ -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 'reflect-metadata';
|
|
5
|
+
import { field } from '@cratis/fundamentals';
|
|
6
|
+
import { chai, describe, it } from 'vitest';
|
|
7
|
+
import { eventType } from '../../../events/eventTypeDecorator.js';
|
|
8
|
+
import { DictionaryKey } from '../../../projections/declarative/DictionaryKey.js';
|
|
9
|
+
import { ProjectionCapabilities } from '../ProjectionCapabilities.js';
|
|
10
|
+
import { UnsupportedProjectionOperation } from '../UnsupportedProjectionOperation.js';
|
|
11
|
+
import { Changed } from './given/Changed.js';
|
|
12
|
+
import { compileDeclarative } from './given/compile.js';
|
|
13
|
+
|
|
14
|
+
chai.should();
|
|
15
|
+
|
|
16
|
+
class OrderedChildAdded { itemId!: string; }
|
|
17
|
+
field(String)(OrderedChildAdded.prototype, 'itemId');
|
|
18
|
+
eventType('capability-ordered-child-added')(OrderedChildAdded);
|
|
19
|
+
|
|
20
|
+
describe('when a read-model scenario sets a property once', () => {
|
|
21
|
+
it('should require a kernel-backed test', () => {
|
|
22
|
+
const { compiled, definition } = compileDeclarative(builder => builder.from(Changed, _ => _.setOnce(m => m.name).to(e => e.name)));
|
|
23
|
+
(() => ProjectionCapabilities.validate(compiled, definition)).should.throw(UnsupportedProjectionOperation)
|
|
24
|
+
.with.property('message').that.includes("'$setOnce(name)'").and.includes('set once requires a kernel-backed test');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('when a read-model scenario targets dictionary entries', () => {
|
|
29
|
+
for (const [name, define] of [
|
|
30
|
+
['set', (builder: Parameters<Parameters<typeof compileDeclarative>[0]>[0]) => builder.from(Changed, _ => _.set(m => m.details, e => e.name).to(e => e.quantity))],
|
|
31
|
+
['remove', (builder: Parameters<Parameters<typeof compileDeclarative>[0]>[0]) => builder.from(Changed, _ => _.removeKey(m => m.details, DictionaryKey.causedBy('subject')))]
|
|
32
|
+
] as const) {
|
|
33
|
+
it(`should require a kernel-backed test to ${name} an entry`, () => {
|
|
34
|
+
const { compiled, definition } = compileDeclarative(define);
|
|
35
|
+
(() => ProjectionCapabilities.validate(compiled, definition)).should.throw(UnsupportedProjectionOperation)
|
|
36
|
+
.with.property('message').that.includes('dynamic or unknown destination paths require a kernel-backed test');
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('when a read-model scenario orders children', () => {
|
|
42
|
+
it('should require a kernel-backed test', () => {
|
|
43
|
+
const { compiled, definition } = compileDeclarative(builder => {
|
|
44
|
+
builder.from(Changed).children<{ lineId: string }>(model => model.labels as never, child => child
|
|
45
|
+
.identifiedBy(line => line.lineId)
|
|
46
|
+
.prepend()
|
|
47
|
+
.from(OrderedChildAdded, from => from.usingKey(event => event.itemId)));
|
|
48
|
+
}, [OrderedChildAdded]);
|
|
49
|
+
(() => ProjectionCapabilities.validate(compiled, definition)).should.throw(UnsupportedProjectionOperation)
|
|
50
|
+
.with.property('message').that.includes('Children.labels.Ordering').and.includes('prepended or sorted children');
|
|
51
|
+
});
|
|
52
|
+
});
|
package/types/DecoratorType.ts
CHANGED
|
@@ -36,5 +36,11 @@ export enum DecoratorType {
|
|
|
36
36
|
GlobalForHandler = 'globalForHandler',
|
|
37
37
|
|
|
38
38
|
/** Event source definition artifacts discovered through the eventSource decorator. */
|
|
39
|
-
EventSource = 'eventSource'
|
|
39
|
+
EventSource = 'eventSource',
|
|
40
|
+
|
|
41
|
+
/** Node and edge artifacts of a property graph discovered through the node and edge decorators. */
|
|
42
|
+
GraphElement = 'graphElement',
|
|
43
|
+
|
|
44
|
+
/** Fluent graph projection artifacts discovered through the graphProjection decorator. */
|
|
45
|
+
GraphProjection = 'graphProjection'
|
|
40
46
|
}
|