@cratis/chronicle 6.63.0 → 6.64.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/artifacts/DefaultClientArtifactsProvider.ts +5 -0
- package/artifacts/IClientArtifactsProvider.ts +3 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts +2 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.d.ts.map +1 -1
- package/dist/artifacts/DefaultClientArtifactsProvider.js +4 -0
- package/dist/artifacts/DefaultClientArtifactsProvider.js.map +1 -1
- package/dist/artifacts/IClientArtifactsProvider.d.ts +2 -0
- package/dist/artifacts/IClientArtifactsProvider.d.ts.map +1 -1
- package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts +2 -1
- package/dist/projections/for_Graphs/given/a_discovered_graph.d.ts.map +1 -1
- package/dist/projections/for_Graphs/given/a_discovered_graph.js +3 -2
- package/dist/projections/for_Graphs/given/a_discovered_graph.js.map +1 -1
- package/dist/projections/for_Graphs/given/a_graph_with_views.d.ts +40 -0
- package/dist/projections/for_Graphs/given/a_graph_with_views.d.ts.map +1 -0
- package/dist/projections/for_Graphs/given/a_graph_with_views.js +80 -0
- package/dist/projections/for_Graphs/given/a_graph_with_views.js.map +1 -0
- package/dist/projections/for_Graphs/given/organization.d.ts +2 -1
- package/dist/projections/for_Graphs/given/organization.d.ts.map +1 -1
- package/dist/projections/for_Graphs/given/organization.js +3 -2
- package/dist/projections/for_Graphs/given/organization.js.map +1 -1
- package/dist/projections/graphs/Graphs.d.ts +5 -0
- package/dist/projections/graphs/Graphs.d.ts.map +1 -1
- package/dist/projections/graphs/Graphs.js +43 -0
- package/dist/projections/graphs/Graphs.js.map +1 -1
- package/dist/projections/graphs/IGraphs.d.ts +9 -2
- package/dist/projections/graphs/IGraphs.d.ts.map +1 -1
- package/dist/projections/graphs/index.d.ts +1 -0
- package/dist/projections/graphs/index.d.ts.map +1 -1
- package/dist/projections/graphs/index.js +1 -0
- package/dist/projections/graphs/index.js.map +1 -1
- package/dist/projections/graphs/views/AmbiguousDirection.d.ts +16 -0
- package/dist/projections/graphs/views/AmbiguousDirection.d.ts.map +1 -0
- package/dist/projections/graphs/views/AmbiguousDirection.js +21 -0
- package/dist/projections/graphs/views/AmbiguousDirection.js.map +1 -0
- package/dist/projections/graphs/views/DuplicateViewName.d.ts +16 -0
- package/dist/projections/graphs/views/DuplicateViewName.d.ts.map +1 -0
- package/dist/projections/graphs/views/DuplicateViewName.js +21 -0
- package/dist/projections/graphs/views/DuplicateViewName.js.map +1 -0
- package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.d.ts +17 -0
- package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.d.ts.map +1 -0
- package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.js +22 -0
- package/dist/projections/graphs/views/EdgeNotIncidentOnRoot.js.map +1 -0
- package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.d.ts +14 -0
- package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.d.ts.map +1 -0
- package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.js +19 -0
- package/dist/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.js.map +1 -0
- package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.d.ts +15 -0
- package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.d.ts.map +1 -0
- package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.js +20 -0
- package/dist/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.js.map +1 -0
- package/dist/projections/graphs/views/FollowsOptions.d.ts +16 -0
- package/dist/projections/graphs/views/FollowsOptions.d.ts.map +1 -0
- package/dist/projections/graphs/views/FollowsOptions.js +4 -0
- package/dist/projections/graphs/views/FollowsOptions.js.map +1 -0
- package/dist/projections/graphs/views/GraphEdgeDirection.d.ts +10 -0
- package/dist/projections/graphs/views/GraphEdgeDirection.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphEdgeDirection.js +13 -0
- package/dist/projections/graphs/views/GraphEdgeDirection.js.map +1 -0
- package/dist/projections/graphs/views/GraphView.d.ts +13 -0
- package/dist/projections/graphs/views/GraphView.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphView.js +4 -0
- package/dist/projections/graphs/views/GraphView.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewBuildResult.d.ts +15 -0
- package/dist/projections/graphs/views/GraphViewBuildResult.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewBuildResult.js +4 -0
- package/dist/projections/graphs/views/GraphViewBuildResult.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewCardinality.d.ts +10 -0
- package/dist/projections/graphs/views/GraphViewCardinality.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewCardinality.js +13 -0
- package/dist/projections/graphs/views/GraphViewCardinality.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewDefinition.d.ts +15 -0
- package/dist/projections/graphs/views/GraphViewDefinition.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewDefinition.js +4 -0
- package/dist/projections/graphs/views/GraphViewDefinition.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewDefinitionBuilder.d.ts +30 -0
- package/dist/projections/graphs/views/GraphViewDefinitionBuilder.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewDefinitionBuilder.js +259 -0
- package/dist/projections/graphs/views/GraphViewDefinitionBuilder.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewDefinitionSerializer.d.ts +21 -0
- package/dist/projections/graphs/views/GraphViewDefinitionSerializer.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewDefinitionSerializer.js +77 -0
- package/dist/projections/graphs/views/GraphViewDefinitionSerializer.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewEdgeReference.d.ts +6 -0
- package/dist/projections/graphs/views/GraphViewEdgeReference.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewEdgeReference.js +4 -0
- package/dist/projections/graphs/views/GraphViewEdgeReference.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewMember.d.ts +8 -0
- package/dist/projections/graphs/views/GraphViewMember.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewMember.js +4 -0
- package/dist/projections/graphs/views/GraphViewMember.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewMemberKind.d.ts +12 -0
- package/dist/projections/graphs/views/GraphViewMemberKind.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewMemberKind.js +15 -0
- package/dist/projections/graphs/views/GraphViewMemberKind.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewMemberMetadata.d.ts +22 -0
- package/dist/projections/graphs/views/GraphViewMemberMetadata.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewMemberMetadata.js +4 -0
- package/dist/projections/graphs/views/GraphViewMemberMetadata.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewPropertyMember.d.ts +13 -0
- package/dist/projections/graphs/views/GraphViewPropertyMember.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewPropertyMember.js +4 -0
- package/dist/projections/graphs/views/GraphViewPropertyMember.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewReason.d.ts +33 -0
- package/dist/projections/graphs/views/GraphViewReason.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewReason.js +36 -0
- package/dist/projections/graphs/views/GraphViewReason.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewRelationMember.d.ts +21 -0
- package/dist/projections/graphs/views/GraphViewRelationMember.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewRelationMember.js +4 -0
- package/dist/projections/graphs/views/GraphViewRelationMember.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewSchema.d.ts +10 -0
- package/dist/projections/graphs/views/GraphViewSchema.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewSchema.js +4 -0
- package/dist/projections/graphs/views/GraphViewSchema.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewSchemaEdge.d.ts +14 -0
- package/dist/projections/graphs/views/GraphViewSchemaEdge.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewSchemaEdge.js +4 -0
- package/dist/projections/graphs/views/GraphViewSchemaEdge.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewSchemaNode.d.ts +10 -0
- package/dist/projections/graphs/views/GraphViewSchemaNode.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewSchemaNode.js +4 -0
- package/dist/projections/graphs/views/GraphViewSchemaNode.js.map +1 -0
- package/dist/projections/graphs/views/GraphViewSerializerOptions.d.ts +9 -0
- package/dist/projections/graphs/views/GraphViewSerializerOptions.d.ts.map +1 -0
- package/dist/projections/graphs/views/GraphViewSerializerOptions.js +4 -0
- package/dist/projections/graphs/views/GraphViewSerializerOptions.js.map +1 -0
- package/dist/projections/graphs/views/RecursiveView.d.ts +15 -0
- package/dist/projections/graphs/views/RecursiveView.d.ts.map +1 -0
- package/dist/projections/graphs/views/RecursiveView.js +20 -0
- package/dist/projections/graphs/views/RecursiveView.js.map +1 -0
- package/dist/projections/graphs/views/RelationTargetNotAView.d.ts +16 -0
- package/dist/projections/graphs/views/RelationTargetNotAView.d.ts.map +1 -0
- package/dist/projections/graphs/views/RelationTargetNotAView.js +21 -0
- package/dist/projections/graphs/views/RelationTargetNotAView.js.map +1 -0
- package/dist/projections/graphs/views/TargetLabelMismatch.d.ts +18 -0
- package/dist/projections/graphs/views/TargetLabelMismatch.d.ts.map +1 -0
- package/dist/projections/graphs/views/TargetLabelMismatch.js +23 -0
- package/dist/projections/graphs/views/TargetLabelMismatch.js.map +1 -0
- package/dist/projections/graphs/views/UnknownEdge.d.ts +16 -0
- package/dist/projections/graphs/views/UnknownEdge.d.ts.map +1 -0
- package/dist/projections/graphs/views/UnknownEdge.js +21 -0
- package/dist/projections/graphs/views/UnknownEdge.js.map +1 -0
- package/dist/projections/graphs/views/UnknownEdgeProperty.d.ts +17 -0
- package/dist/projections/graphs/views/UnknownEdgeProperty.d.ts.map +1 -0
- package/dist/projections/graphs/views/UnknownEdgeProperty.js +22 -0
- package/dist/projections/graphs/views/UnknownEdgeProperty.js.map +1 -0
- package/dist/projections/graphs/views/UnknownNodeProperty.d.ts +17 -0
- package/dist/projections/graphs/views/UnknownNodeProperty.d.ts.map +1 -0
- package/dist/projections/graphs/views/UnknownNodeProperty.js +22 -0
- package/dist/projections/graphs/views/UnknownNodeProperty.js.map +1 -0
- package/dist/projections/graphs/views/ViewIsAlsoSchema.d.ts +14 -0
- package/dist/projections/graphs/views/ViewIsAlsoSchema.d.ts.map +1 -0
- package/dist/projections/graphs/views/ViewIsAlsoSchema.js +19 -0
- package/dist/projections/graphs/views/ViewIsAlsoSchema.js.map +1 -0
- package/dist/projections/graphs/views/ViewOfMetadata.d.ts +8 -0
- package/dist/projections/graphs/views/ViewOfMetadata.d.ts.map +1 -0
- package/dist/projections/graphs/views/ViewOfMetadata.js +4 -0
- package/dist/projections/graphs/views/ViewOfMetadata.js.map +1 -0
- package/dist/projections/graphs/views/ViewOfOptions.d.ts +6 -0
- package/dist/projections/graphs/views/ViewOfOptions.d.ts.map +1 -0
- package/dist/projections/graphs/views/ViewOfOptions.js +4 -0
- package/dist/projections/graphs/views/ViewOfOptions.js.map +1 -0
- package/dist/projections/graphs/views/ViewRootNotANode.d.ts +16 -0
- package/dist/projections/graphs/views/ViewRootNotANode.d.ts.map +1 -0
- package/dist/projections/graphs/views/ViewRootNotANode.js +21 -0
- package/dist/projections/graphs/views/ViewRootNotANode.js.map +1 -0
- package/dist/projections/graphs/views/declareGraphViewMember.d.ts +17 -0
- package/dist/projections/graphs/views/declareGraphViewMember.d.ts.map +1 -0
- package/dist/projections/graphs/views/declareGraphViewMember.js +31 -0
- package/dist/projections/graphs/views/declareGraphViewMember.js.map +1 -0
- package/dist/projections/graphs/views/follows.d.ts +13 -0
- package/dist/projections/graphs/views/follows.d.ts.map +1 -0
- package/dist/projections/graphs/views/follows.js +24 -0
- package/dist/projections/graphs/views/follows.js.map +1 -0
- package/dist/projections/graphs/views/fromEdge.d.ts +10 -0
- package/dist/projections/graphs/views/fromEdge.d.ts.map +1 -0
- package/dist/projections/graphs/views/fromEdge.js +15 -0
- package/dist/projections/graphs/views/fromEdge.js.map +1 -0
- package/dist/projections/graphs/views/index.d.ts +41 -0
- package/dist/projections/graphs/views/index.d.ts.map +1 -0
- package/dist/projections/graphs/views/index.js +28 -0
- package/dist/projections/graphs/views/index.js.map +1 -0
- package/dist/projections/graphs/views/viewKey.d.ts +8 -0
- package/dist/projections/graphs/views/viewKey.d.ts.map +1 -0
- package/dist/projections/graphs/views/viewKey.js +13 -0
- package/dist/projections/graphs/views/viewKey.js.map +1 -0
- package/dist/projections/graphs/views/viewOf.d.ts +22 -0
- package/dist/projections/graphs/views/viewOf.d.ts.map +1 -0
- package/dist/projections/graphs/views/viewOf.js +41 -0
- package/dist/projections/graphs/views/viewOf.js.map +1 -0
- package/dist/projections/graphs/views/viewProperty.d.ts +9 -0
- package/dist/projections/graphs/views/viewProperty.d.ts.map +1 -0
- package/dist/projections/graphs/views/viewProperty.js +14 -0
- package/dist/projections/graphs/views/viewProperty.js.map +1 -0
- package/dist/testing/InProcessAppendMetadata.d.ts +30 -0
- package/dist/testing/InProcessAppendMetadata.d.ts.map +1 -0
- package/dist/testing/InProcessAppendMetadata.js +107 -0
- package/dist/testing/InProcessAppendMetadata.js.map +1 -0
- package/dist/testing/InProcessBatchAppend.d.ts +62 -0
- package/dist/testing/InProcessBatchAppend.d.ts.map +1 -0
- package/dist/testing/InProcessBatchAppend.js +131 -0
- package/dist/testing/InProcessBatchAppend.js.map +1 -0
- package/dist/testing/InProcessEventPayload.d.ts +23 -0
- package/dist/testing/InProcessEventPayload.d.ts.map +1 -0
- package/dist/testing/InProcessEventPayload.js +94 -0
- package/dist/testing/InProcessEventPayload.js.map +1 -0
- package/dist/testing/InProcessEventReadCriteria.d.ts +9 -0
- package/dist/testing/InProcessEventReadCriteria.d.ts.map +1 -0
- package/dist/testing/InProcessEventReadCriteria.js +4 -0
- package/dist/testing/InProcessEventReadCriteria.js.map +1 -0
- package/dist/testing/InProcessEventReadFilter.d.ts +14 -0
- package/dist/testing/InProcessEventReadFilter.d.ts.map +1 -0
- package/dist/testing/InProcessEventReadFilter.js +31 -0
- package/dist/testing/InProcessEventReadFilter.js.map +1 -0
- package/dist/testing/InProcessEventSequence.d.ts +8 -5
- package/dist/testing/InProcessEventSequence.d.ts.map +1 -1
- package/dist/testing/InProcessEventSequence.js +59 -275
- package/dist/testing/InProcessEventSequence.js.map +1 -1
- package/dist/testing/InProcessEventSequenceEnvironment.d.ts +13 -0
- package/dist/testing/InProcessEventSequenceEnvironment.d.ts.map +1 -0
- package/dist/testing/InProcessEventSequenceEnvironment.js +4 -0
- package/dist/testing/InProcessEventSequenceEnvironment.js.map +1 -0
- package/dist/testing/InProcessSingleAppend.d.ts +34 -0
- package/dist/testing/InProcessSingleAppend.d.ts.map +1 -0
- package/dist/testing/InProcessSingleAppend.js +95 -0
- package/dist/testing/InProcessSingleAppend.js.map +1 -0
- package/dist/testing/projections/ProjectionCapabilities.d.ts +0 -8
- package/dist/testing/projections/ProjectionCapabilities.d.ts.map +1 -1
- package/dist/testing/projections/ProjectionCapabilities.js +21 -312
- package/dist/testing/projections/ProjectionCapabilities.js.map +1 -1
- package/dist/testing/projections/ProjectionCapabilityReject.d.ts +3 -0
- package/dist/testing/projections/ProjectionCapabilityReject.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionCapabilityReject.js +4 -0
- package/dist/testing/projections/ProjectionCapabilityReject.js.map +1 -0
- package/dist/testing/projections/ProjectionCapabilityReporter.d.ts +12 -0
- package/dist/testing/projections/ProjectionCapabilityReporter.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionCapabilityReporter.js +33 -0
- package/dist/testing/projections/ProjectionCapabilityReporter.js.map +1 -0
- package/dist/testing/projections/ProjectionDefinitionCapabilities.d.ts +11 -0
- package/dist/testing/projections/ProjectionDefinitionCapabilities.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionDefinitionCapabilities.js +45 -0
- package/dist/testing/projections/ProjectionDefinitionCapabilities.js.map +1 -0
- package/dist/testing/projections/ProjectionEventSchemaResolver.d.ts +13 -0
- package/dist/testing/projections/ProjectionEventSchemaResolver.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionEventSchemaResolver.js +22 -0
- package/dist/testing/projections/ProjectionEventSchemaResolver.js.map +1 -0
- package/dist/testing/projections/ProjectionExpressionCapabilities.d.ts +19 -0
- package/dist/testing/projections/ProjectionExpressionCapabilities.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionExpressionCapabilities.js +103 -0
- package/dist/testing/projections/ProjectionExpressionCapabilities.js.map +1 -0
- package/dist/testing/projections/ProjectionInitialValueCapabilities.d.ts +16 -0
- package/dist/testing/projections/ProjectionInitialValueCapabilities.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionInitialValueCapabilities.js +72 -0
- package/dist/testing/projections/ProjectionInitialValueCapabilities.js.map +1 -0
- package/dist/testing/projections/ProjectionMappingCapabilities.d.ts +21 -0
- package/dist/testing/projections/ProjectionMappingCapabilities.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionMappingCapabilities.js +86 -0
- package/dist/testing/projections/ProjectionMappingCapabilities.js.map +1 -0
- package/dist/testing/projections/ProjectionMappingValidation.d.ts +9 -0
- package/dist/testing/projections/ProjectionMappingValidation.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionMappingValidation.js +4 -0
- package/dist/testing/projections/ProjectionMappingValidation.js.map +1 -0
- package/dist/testing/projections/ProjectionReadModelCapabilities.d.ts +11 -0
- package/dist/testing/projections/ProjectionReadModelCapabilities.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionReadModelCapabilities.js +40 -0
- package/dist/testing/projections/ProjectionReadModelCapabilities.js.map +1 -0
- package/dist/testing/projections/ProjectionRootCapabilities.d.ts +20 -0
- package/dist/testing/projections/ProjectionRootCapabilities.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionRootCapabilities.js +73 -0
- package/dist/testing/projections/ProjectionRootCapabilities.js.map +1 -0
- package/dist/testing/projections/ProjectionScalarConverter.d.ts +21 -0
- package/dist/testing/projections/ProjectionScalarConverter.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionScalarConverter.js +105 -0
- package/dist/testing/projections/ProjectionScalarConverter.js.map +1 -0
- package/dist/testing/projections/ProjectionSchemaCapabilities.d.ts +26 -0
- package/dist/testing/projections/ProjectionSchemaCapabilities.d.ts.map +1 -0
- package/dist/testing/projections/ProjectionSchemaCapabilities.js +109 -0
- package/dist/testing/projections/ProjectionSchemaCapabilities.js.map +1 -0
- package/dist/testing/projections/ProjectionValueConverter.d.ts +5 -0
- package/dist/testing/projections/ProjectionValueConverter.d.ts.map +1 -1
- package/dist/testing/projections/ProjectionValueConverter.js +36 -84
- package/dist/testing/projections/ProjectionValueConverter.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/DecoratorType.d.ts +3 -1
- package/dist/types/DecoratorType.d.ts.map +1 -1
- package/dist/types/DecoratorType.js +2 -0
- package/dist/types/DecoratorType.js.map +1 -1
- package/package.json +2 -2
- package/projections/for_Graphs/given/a_discovered_graph.ts +3 -2
- package/projections/for_Graphs/given/a_graph_with_views.ts +91 -0
- package/projections/for_Graphs/given/organization.ts +3 -2
- package/projections/for_Graphs/given/organization_with_views.fixture.ts +129 -0
- package/projections/for_Graphs/when_building_graph_views.spec.ts +218 -0
- package/projections/for_Graphs/when_declaring_an_invalid_graph_view.spec.ts +229 -0
- package/projections/for_Graphs/when_declaring_graph_views.standard.spec.ts +49 -0
- package/projections/for_Graphs/when_discovering_graph_views.spec.ts +58 -0
- package/projections/graphs/Graphs.ts +44 -0
- package/projections/graphs/IGraphs.ts +10 -2
- package/projections/graphs/index.ts +1 -0
- package/projections/graphs/views/AmbiguousDirection.ts +23 -0
- package/projections/graphs/views/DuplicateViewName.ts +23 -0
- package/projections/graphs/views/EdgeNotIncidentOnRoot.ts +24 -0
- package/projections/graphs/views/EdgePropertyViewNotUsedAsTarget.ts +21 -0
- package/projections/graphs/views/EdgePropertyViewSharedAcrossEdges.ts +22 -0
- package/projections/graphs/views/FollowsOptions.ts +20 -0
- package/projections/graphs/views/GraphEdgeDirection.ts +13 -0
- package/projections/graphs/views/GraphView.ts +18 -0
- package/projections/graphs/views/GraphViewBuildResult.ts +19 -0
- package/projections/graphs/views/GraphViewCardinality.ts +13 -0
- package/projections/graphs/views/GraphViewDefinition.ts +20 -0
- package/projections/graphs/views/GraphViewDefinitionBuilder.ts +322 -0
- package/projections/graphs/views/GraphViewDefinitionSerializer.ts +90 -0
- package/projections/graphs/views/GraphViewEdgeReference.ts +8 -0
- package/projections/graphs/views/GraphViewMember.ts +11 -0
- package/projections/graphs/views/GraphViewMemberKind.ts +16 -0
- package/projections/graphs/views/GraphViewMemberMetadata.ts +31 -0
- package/projections/graphs/views/GraphViewPropertyMember.ts +18 -0
- package/projections/graphs/views/GraphViewReason.ts +47 -0
- package/projections/graphs/views/GraphViewRelationMember.ts +29 -0
- package/projections/graphs/views/GraphViewSchema.ts +14 -0
- package/projections/graphs/views/GraphViewSchemaEdge.ts +20 -0
- package/projections/graphs/views/GraphViewSchemaNode.ts +14 -0
- package/projections/graphs/views/GraphViewSerializerOptions.ts +11 -0
- package/projections/graphs/views/RecursiveView.ts +22 -0
- package/projections/graphs/views/RelationTargetNotAView.ts +23 -0
- package/projections/graphs/views/TargetLabelMismatch.ts +25 -0
- package/projections/graphs/views/UnknownEdge.ts +23 -0
- package/projections/graphs/views/UnknownEdgeProperty.ts +24 -0
- package/projections/graphs/views/UnknownNodeProperty.ts +24 -0
- package/projections/graphs/views/ViewIsAlsoSchema.ts +21 -0
- package/projections/graphs/views/ViewOfMetadata.ts +11 -0
- package/projections/graphs/views/ViewOfOptions.ts +8 -0
- package/projections/graphs/views/ViewRootNotANode.ts +23 -0
- package/projections/graphs/views/declareGraphViewMember.ts +36 -0
- package/projections/graphs/views/follows.ts +28 -0
- package/projections/graphs/views/fromEdge.ts +17 -0
- package/projections/graphs/views/index.ts +43 -0
- package/projections/graphs/views/viewKey.ts +15 -0
- package/projections/graphs/views/viewOf.ts +50 -0
- package/projections/graphs/views/viewProperty.ts +16 -0
- package/testing/InProcessAppendMetadata.ts +119 -0
- package/testing/InProcessBatchAppend.ts +142 -0
- package/testing/InProcessEventPayload.ts +100 -0
- package/testing/InProcessEventReadCriteria.ts +11 -0
- package/testing/InProcessEventReadFilter.ts +37 -0
- package/testing/InProcessEventSequence.ts +63 -257
- package/testing/InProcessEventSequenceEnvironment.ts +16 -0
- package/testing/InProcessSingleAppend.ts +99 -0
- package/testing/for_InProcessEventSequence/when_preserving_validation_and_commit_order.spec.ts +95 -0
- package/testing/projections/ProjectionCapabilities.ts +23 -279
- package/testing/projections/ProjectionCapabilityReject.ts +5 -0
- package/testing/projections/ProjectionCapabilityReporter.ts +31 -0
- package/testing/projections/ProjectionDefinitionCapabilities.ts +45 -0
- package/testing/projections/ProjectionEventSchemaResolver.ts +23 -0
- package/testing/projections/ProjectionExpressionCapabilities.ts +101 -0
- package/testing/projections/ProjectionInitialValueCapabilities.ts +73 -0
- package/testing/projections/ProjectionMappingCapabilities.ts +85 -0
- package/testing/projections/ProjectionMappingValidation.ts +12 -0
- package/testing/projections/ProjectionReadModelCapabilities.ts +42 -0
- package/testing/projections/ProjectionRootCapabilities.ts +75 -0
- package/testing/projections/ProjectionScalarConverter.ts +106 -0
- package/testing/projections/ProjectionSchemaCapabilities.ts +112 -0
- package/testing/projections/ProjectionValueConverter.ts +37 -76
- package/testing/projections/for_ProjectionCapabilities/when_reporting_the_first_unsupported_operation.spec.ts +74 -0
- package/testing/projections/for_ProjectionValueConverter/when_converting_structured_and_scalar_values.spec.ts +64 -0
- package/types/DecoratorType.ts +4 -1
|
@@ -0,0 +1,90 @@
|
|
|
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 { GraphViewMemberKind } from './GraphViewMemberKind.js';
|
|
5
|
+
import type { GraphView } from './GraphView.js';
|
|
6
|
+
import type { GraphViewDefinition } from './GraphViewDefinition.js';
|
|
7
|
+
import type { GraphViewMember } from './GraphViewMember.js';
|
|
8
|
+
import type { GraphViewSchema } from './GraphViewSchema.js';
|
|
9
|
+
import type { GraphViewSerializerOptions } from './GraphViewSerializerOptions.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Serializes a {@link GraphViewDefinition} canonically. The text is the same for every client that declares the same
|
|
13
|
+
* views: LF line endings, two-space indentation, a fixed order of properties, the views sorted by name in ordinal
|
|
14
|
+
* order, the members in declaration order and one trailing newline.
|
|
15
|
+
*/
|
|
16
|
+
export class GraphViewDefinitionSerializer {
|
|
17
|
+
/**
|
|
18
|
+
* Serializes a definition.
|
|
19
|
+
* @param definition - The {@link GraphViewDefinition}.
|
|
20
|
+
* @param options - Whether to include the schema, which is the form of the conformance fixture.
|
|
21
|
+
* @returns The canonical text.
|
|
22
|
+
*/
|
|
23
|
+
serialize(definition: GraphViewDefinition, options: GraphViewSerializerOptions = {}): string {
|
|
24
|
+
const views = [...definition.views].sort((left, right) => this.compareOrdinal(left.name, right.name));
|
|
25
|
+
const lines = ['{', ` "graph": ${JSON.stringify(definition.graph)},`];
|
|
26
|
+
if (options.includeSchema === true && definition.schema !== undefined) lines.push(...this.schema(definition.schema));
|
|
27
|
+
if (views.length === 0) {
|
|
28
|
+
lines.push(' "views": []');
|
|
29
|
+
} else {
|
|
30
|
+
lines.push(' "views": [');
|
|
31
|
+
views.forEach((view, index) => lines.push(...this.view(view, index < views.length - 1)));
|
|
32
|
+
lines.push(' ]');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
lines.push('}');
|
|
36
|
+
return `${lines.join('\n')}\n`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private schema(schema: GraphViewSchema): string[] {
|
|
40
|
+
const list = (names: readonly string[]) => (names.length === 0 ? '[]' : `[ ${names.map(name => JSON.stringify(name)).join(', ')} ]`);
|
|
41
|
+
const nodes = schema.nodes.map(node =>
|
|
42
|
+
`{ "label": ${JSON.stringify(node.label)}, "key": ${JSON.stringify(node.key)}, "properties": ${list(node.properties)} }`);
|
|
43
|
+
const edges = schema.edges.map(edge => {
|
|
44
|
+
const identity = edge.identifiedBy === undefined ? '' : ` "identifiedBy": ${JSON.stringify(edge.identifiedBy)},`;
|
|
45
|
+
return `{ "type": ${JSON.stringify(edge.type)}, "source": ${JSON.stringify(edge.source)}, "target": ${JSON.stringify(edge.target)},${identity} "properties": ${list(edge.properties)} }`;
|
|
46
|
+
});
|
|
47
|
+
const block = (name: string, entries: string[], last: boolean) => [
|
|
48
|
+
entries.length === 0 ? ` "${name}": []${last ? '' : ','}` : ` "${name}": [`,
|
|
49
|
+
...(entries.length === 0 ? [] : [
|
|
50
|
+
...entries.map((entry, index) => ` ${entry}${index < entries.length - 1 ? ',' : ''}`),
|
|
51
|
+
` ]${last ? '' : ','}`
|
|
52
|
+
])
|
|
53
|
+
];
|
|
54
|
+
return [' "schema": {', ...block('nodes', nodes, false), ...block('edges', edges, true), ' },'];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private view(view: GraphView, hasNext: boolean): string[] {
|
|
58
|
+
const lines = [' {', ` "name": ${JSON.stringify(view.name)},`, ` "root": ${JSON.stringify(view.root)},`];
|
|
59
|
+
if (view.members.length === 0) {
|
|
60
|
+
lines.push(' "members": []');
|
|
61
|
+
} else {
|
|
62
|
+
lines.push(' "members": [');
|
|
63
|
+
view.members.forEach((member, index) => lines.push(` ${this.member(member)}${index < view.members.length - 1 ? ',' : ''}`));
|
|
64
|
+
lines.push(' ]');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
lines.push(hasNext ? ' },' : ' }');
|
|
68
|
+
return lines;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private member(member: GraphViewMember): string {
|
|
72
|
+
const parts = [`"name": ${JSON.stringify(member.name)}`, `"kind": ${JSON.stringify(member.kind)}`];
|
|
73
|
+
if (member.kind === GraphViewMemberKind.Relation) {
|
|
74
|
+
parts.push(
|
|
75
|
+
`"edge": ${JSON.stringify(member.edge)}`,
|
|
76
|
+
`"direction": ${JSON.stringify(member.direction)}`,
|
|
77
|
+
`"cardinality": ${JSON.stringify(member.cardinality)}`,
|
|
78
|
+
`"view": ${JSON.stringify(member.view)}`);
|
|
79
|
+
} else {
|
|
80
|
+
parts.push(`"source": ${JSON.stringify(member.source)}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return `{ ${parts.join(', ')} }`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private compareOrdinal(left: string, right: string): number {
|
|
87
|
+
if (left === right) return 0;
|
|
88
|
+
return left < right ? -1 : 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Names the edge a relation follows: a function returning the edge class, which is resolved when the views are
|
|
6
|
+
* validated so the classes can be declared in any order, or the edge type string, for example MEMBER_OF.
|
|
7
|
+
*/
|
|
8
|
+
export type GraphViewEdgeReference = (() => Function) | string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { GraphViewPropertyMember } from './GraphViewPropertyMember.js';
|
|
5
|
+
import type { GraphViewRelationMember } from './GraphViewRelationMember.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents a member of a view: a property of the root node, a relation to a nested view or a property of the edge
|
|
9
|
+
* that was followed.
|
|
10
|
+
*/
|
|
11
|
+
export type GraphViewMember = GraphViewPropertyMember | GraphViewRelationMember;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Represents the kind of a member of a graph view.
|
|
6
|
+
*/
|
|
7
|
+
export enum GraphViewMemberKind {
|
|
8
|
+
/** A property of the root node. */
|
|
9
|
+
Property = 'property',
|
|
10
|
+
|
|
11
|
+
/** A relation that follows one declared edge type in one direction to a nested view. */
|
|
12
|
+
Relation = 'relation',
|
|
13
|
+
|
|
14
|
+
/** A property of the edge that was followed to reach the view. */
|
|
15
|
+
EdgeProperty = 'edgeProperty'
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { GraphEdgeDirection } from './GraphEdgeDirection.js';
|
|
5
|
+
import type { GraphViewCardinality } from './GraphViewCardinality.js';
|
|
6
|
+
import type { GraphViewEdgeReference } from './GraphViewEdgeReference.js';
|
|
7
|
+
import type { GraphViewMemberKind } from './GraphViewMemberKind.js';
|
|
8
|
+
|
|
9
|
+
/** Metadata stored by the member decorators of a graph view. */
|
|
10
|
+
export interface GraphViewMemberMetadata {
|
|
11
|
+
/** The kind of the member. */
|
|
12
|
+
readonly kind: GraphViewMemberKind;
|
|
13
|
+
|
|
14
|
+
/** Whether the member is bound to the key of the root node. */
|
|
15
|
+
readonly isKey: boolean;
|
|
16
|
+
|
|
17
|
+
/** The name of the property of the node or edge the member reads. When missing, the name of the member is used. */
|
|
18
|
+
readonly source?: string;
|
|
19
|
+
|
|
20
|
+
/** The edge a relation follows. */
|
|
21
|
+
readonly edge?: GraphViewEdgeReference;
|
|
22
|
+
|
|
23
|
+
/** A function returning the class of the view a relation yields. */
|
|
24
|
+
readonly view?: () => Function;
|
|
25
|
+
|
|
26
|
+
/** The explicit direction of a relation. When missing, it is derived from the labels of the edge. */
|
|
27
|
+
readonly direction?: GraphEdgeDirection;
|
|
28
|
+
|
|
29
|
+
/** The cardinality of a relation. */
|
|
30
|
+
readonly cardinality?: GraphViewCardinality;
|
|
31
|
+
}
|
|
@@ -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
|
+
import type { GraphViewMemberKind } from './GraphViewMemberKind.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a member of a view that reads a property of the root node, or of the edge that was followed.
|
|
8
|
+
*/
|
|
9
|
+
export interface GraphViewPropertyMember {
|
|
10
|
+
/** The name of the member. */
|
|
11
|
+
readonly name: string;
|
|
12
|
+
|
|
13
|
+
/** The kind of the member: a property of the node, or a property of the edge. */
|
|
14
|
+
readonly kind: GraphViewMemberKind.Property | GraphViewMemberKind.EdgeProperty;
|
|
15
|
+
|
|
16
|
+
/** The name of the property of the node or edge that is read. */
|
|
17
|
+
readonly source: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the stable reason codes of the rules a graph view declaration must follow. Every error raised for an
|
|
6
|
+
* invalid view carries one of them in its reason.
|
|
7
|
+
*/
|
|
8
|
+
export enum GraphViewReason {
|
|
9
|
+
/** The root of the view is not a node declared in the graph. */
|
|
10
|
+
ViewRootNotANode = 'ViewRootNotANode',
|
|
11
|
+
|
|
12
|
+
/** A view type is also a node or an edge. */
|
|
13
|
+
ViewIsAlsoSchema = 'ViewIsAlsoSchema',
|
|
14
|
+
|
|
15
|
+
/** Two views of a graph have the same name. */
|
|
16
|
+
DuplicateViewName = 'DuplicateViewName',
|
|
17
|
+
|
|
18
|
+
/** A property member names a property the root node does not declare. */
|
|
19
|
+
UnknownNodeProperty = 'UnknownNodeProperty',
|
|
20
|
+
|
|
21
|
+
/** A relation names an edge type the graph does not declare. */
|
|
22
|
+
UnknownEdge = 'UnknownEdge',
|
|
23
|
+
|
|
24
|
+
/** An edge property member names a property the edge does not declare. */
|
|
25
|
+
UnknownEdgeProperty = 'UnknownEdgeProperty',
|
|
26
|
+
|
|
27
|
+
/** The source and the target label of the edge are both different from the label of the root of the view. */
|
|
28
|
+
EdgeNotIncidentOnRoot = 'EdgeNotIncidentOnRoot',
|
|
29
|
+
|
|
30
|
+
/** The edge is a self edge and the relation gives no explicit direction. */
|
|
31
|
+
AmbiguousDirection = 'AmbiguousDirection',
|
|
32
|
+
|
|
33
|
+
/** The root of the target view is not the label at the far end of the edge. */
|
|
34
|
+
TargetLabelMismatch = 'TargetLabelMismatch',
|
|
35
|
+
|
|
36
|
+
/** The target of a relation is not a declared view. */
|
|
37
|
+
RelationTargetNotAView = 'RelationTargetNotAView',
|
|
38
|
+
|
|
39
|
+
/** A view contains itself, directly or transitively. */
|
|
40
|
+
RecursiveView = 'RecursiveView',
|
|
41
|
+
|
|
42
|
+
/** A view with edge property members is not the target of any relation. */
|
|
43
|
+
EdgePropertyViewNotUsedAsTarget = 'EdgePropertyViewNotUsedAsTarget',
|
|
44
|
+
|
|
45
|
+
/** A view with edge property members is the target of relations of more than one edge type. */
|
|
46
|
+
EdgePropertyViewSharedAcrossEdges = 'EdgePropertyViewSharedAcrossEdges'
|
|
47
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { GraphEdgeDirection } from './GraphEdgeDirection.js';
|
|
5
|
+
import type { GraphViewCardinality } from './GraphViewCardinality.js';
|
|
6
|
+
import type { GraphViewMemberKind } from './GraphViewMemberKind.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents a member of a view that follows one edge type in one direction to a nested view.
|
|
10
|
+
*/
|
|
11
|
+
export interface GraphViewRelationMember {
|
|
12
|
+
/** The name of the member. */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
|
|
15
|
+
/** The kind of the member. */
|
|
16
|
+
readonly kind: GraphViewMemberKind.Relation;
|
|
17
|
+
|
|
18
|
+
/** The edge type that is followed, for example MEMBER_OF. */
|
|
19
|
+
readonly edge: string;
|
|
20
|
+
|
|
21
|
+
/** The direction in which the edge is followed, seen from the root node of the view. */
|
|
22
|
+
readonly direction: GraphEdgeDirection;
|
|
23
|
+
|
|
24
|
+
/** Whether the relation yields a list or a single item. */
|
|
25
|
+
readonly cardinality: GraphViewCardinality;
|
|
26
|
+
|
|
27
|
+
/** The name of the nested view. */
|
|
28
|
+
readonly view: string;
|
|
29
|
+
}
|
|
@@ -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
|
+
import type { GraphViewSchemaEdge } from './GraphViewSchemaEdge.js';
|
|
5
|
+
import type { GraphViewSchemaNode } from './GraphViewSchemaNode.js';
|
|
6
|
+
|
|
7
|
+
/** Represents the nodes and edges of the graph the views were validated against. */
|
|
8
|
+
export interface GraphViewSchema {
|
|
9
|
+
/** The nodes. */
|
|
10
|
+
readonly nodes: readonly GraphViewSchemaNode[];
|
|
11
|
+
|
|
12
|
+
/** The edges. */
|
|
13
|
+
readonly edges: readonly GraphViewSchemaEdge[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
/** Represents an edge of the graph the views were validated against. */
|
|
5
|
+
export interface GraphViewSchemaEdge {
|
|
6
|
+
/** The edge type, for example MEMBER_OF. */
|
|
7
|
+
readonly type: string;
|
|
8
|
+
|
|
9
|
+
/** The label of the node the edge starts at. */
|
|
10
|
+
readonly source: string;
|
|
11
|
+
|
|
12
|
+
/** The label of the node the edge ends at. */
|
|
13
|
+
readonly target: string;
|
|
14
|
+
|
|
15
|
+
/** The name of the property that identifies the edge, for an identified edge. */
|
|
16
|
+
readonly identifiedBy?: string;
|
|
17
|
+
|
|
18
|
+
/** The names of the properties of the edge. */
|
|
19
|
+
readonly properties: readonly string[];
|
|
20
|
+
}
|
|
@@ -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
|
+
/** Represents a node of the graph the views were validated against. */
|
|
5
|
+
export interface GraphViewSchemaNode {
|
|
6
|
+
/** The node label. */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
|
|
9
|
+
/** The name of the property that holds the key of the node. */
|
|
10
|
+
readonly key: string;
|
|
11
|
+
|
|
12
|
+
/** The names of the properties of the node. */
|
|
13
|
+
readonly properties: readonly string[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
/** Options of the {@link GraphViewDefinitionSerializer}. */
|
|
5
|
+
export interface GraphViewSerializerOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to also write the schema, the nodes and edges the views were validated against, between the graph and
|
|
8
|
+
* the views. It is the form of the shared conformance fixture. Defaults to false.
|
|
9
|
+
*/
|
|
10
|
+
readonly includeSchema?: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when a view contains itself, directly or transitively.
|
|
8
|
+
*/
|
|
9
|
+
export class RecursiveView extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.RecursiveView;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link RecursiveView}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
* @param path - The names of the views that make the cycle, starting and ending with the view.
|
|
17
|
+
*/
|
|
18
|
+
constructor(view: Function, path: readonly string[]) {
|
|
19
|
+
super(`The view '${view.name}' contains itself: ${path.join(' -> ')}. Nesting must be finite.`);
|
|
20
|
+
this.name = 'RecursiveView';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when the target of a relation is not a declared view of the graph.
|
|
8
|
+
*/
|
|
9
|
+
export class RelationTargetNotAView extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.RelationTargetNotAView;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link RelationTargetNotAView}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
* @param member - The name of the member.
|
|
17
|
+
* @param target - The type that is not a view of the graph.
|
|
18
|
+
*/
|
|
19
|
+
constructor(view: Function, member: string, target: Function) {
|
|
20
|
+
super(`The member '${member}' of the view '${view.name}' yields '${target.name}', which is not a view of the graph. Declare it with viewOf and the same graph.`);
|
|
21
|
+
this.name = 'RelationTargetNotAView';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when the root of the target view of a relation is not the label at the far end of the edge.
|
|
8
|
+
*/
|
|
9
|
+
export class TargetLabelMismatch extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.TargetLabelMismatch;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link TargetLabelMismatch}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
* @param member - The name of the member.
|
|
17
|
+
* @param target - The target view type.
|
|
18
|
+
* @param expected - The label at the far end of the edge.
|
|
19
|
+
* @param actual - The label of the root of the target view.
|
|
20
|
+
*/
|
|
21
|
+
constructor(view: Function, member: string, target: Function, expected: string, actual: string) {
|
|
22
|
+
super(`The member '${member}' of the view '${view.name}' reaches '${expected}', but the view '${target.name}' is anchored at '${actual}'.`);
|
|
23
|
+
this.name = 'TargetLabelMismatch';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when a relation of a view names an edge type the graph does not declare.
|
|
8
|
+
*/
|
|
9
|
+
export class UnknownEdge extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.UnknownEdge;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link UnknownEdge}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
* @param member - The name of the member.
|
|
17
|
+
* @param edge - The edge that is not declared.
|
|
18
|
+
*/
|
|
19
|
+
constructor(view: Function, member: string, edge: string) {
|
|
20
|
+
super(`The member '${member}' of the view '${view.name}' follows '${edge}', which is not an edge of the graph.`);
|
|
21
|
+
this.name = 'UnknownEdge';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when an edge property member of a view names a property the edge does not declare.
|
|
8
|
+
*/
|
|
9
|
+
export class UnknownEdgeProperty extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.UnknownEdgeProperty;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link UnknownEdgeProperty}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
* @param member - The name of the member.
|
|
17
|
+
* @param edge - The edge type that is followed to reach the view.
|
|
18
|
+
* @param source - The name of the property that is not declared.
|
|
19
|
+
*/
|
|
20
|
+
constructor(view: Function, member: string, edge: string, source: string) {
|
|
21
|
+
super(`The member '${member}' of the view '${view.name}' reads '${source}', which is not a property of the edge '${edge}'.`);
|
|
22
|
+
this.name = 'UnknownEdgeProperty';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when a property member of a view names a property the root node does not declare.
|
|
8
|
+
*/
|
|
9
|
+
export class UnknownNodeProperty extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.UnknownNodeProperty;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link UnknownNodeProperty}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
* @param member - The name of the member.
|
|
17
|
+
* @param node - The label of the root node.
|
|
18
|
+
* @param source - The name of the property that is not declared.
|
|
19
|
+
*/
|
|
20
|
+
constructor(view: Function, member: string, node: string, source: string) {
|
|
21
|
+
super(`The member '${member}' of the view '${view.name}' reads '${source}', which is not a property of the node '${node}'.`);
|
|
22
|
+
this.name = 'UnknownNodeProperty';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when a view type is also a node or an edge.
|
|
8
|
+
*/
|
|
9
|
+
export class ViewIsAlsoSchema extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.ViewIsAlsoSchema;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link ViewIsAlsoSchema}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
*/
|
|
17
|
+
constructor(view: Function) {
|
|
18
|
+
super(`The view '${view.name}' is also a node or an edge. A view is a read model over the graph and cannot be part of its schema.`);
|
|
19
|
+
this.name = 'ViewIsAlsoSchema';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
/** Metadata stored by the viewOf class decorator. */
|
|
5
|
+
export interface ViewOfMetadata {
|
|
6
|
+
/** A function returning the class of the node the view is anchored at. */
|
|
7
|
+
readonly root: () => Function;
|
|
8
|
+
|
|
9
|
+
/** The name of the view. */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
/** Options of the viewOf decorator. */
|
|
5
|
+
export interface ViewOfOptions {
|
|
6
|
+
/** The name of the view. View names are unique in a graph. Defaults to the name of the class. */
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { GraphViewReason } from './GraphViewReason.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error raised when the root of a view is not a node declared in the graph of the view.
|
|
8
|
+
*/
|
|
9
|
+
export class ViewRootNotANode extends Error {
|
|
10
|
+
/** The stable reason code of the rule that was broken. */
|
|
11
|
+
readonly reason = GraphViewReason.ViewRootNotANode;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link ViewRootNotANode}.
|
|
15
|
+
* @param view - The view type.
|
|
16
|
+
* @param graph - The name of the graph.
|
|
17
|
+
* @param root - The type the view is anchored at.
|
|
18
|
+
*/
|
|
19
|
+
constructor(view: Function, graph: string, root: Function) {
|
|
20
|
+
super(`The view '${view.name}' is anchored at '${root.name}', which is not a node of the graph '${graph}'.`);
|
|
21
|
+
this.name = 'ViewRootNotANode';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import { TypeIntrospector } from '../../../types/index.js';
|
|
6
|
+
import { decorateProperty, getPropertyMetadata, type ChroniclePropertyDecorator } from '../../../types/propertyDecoratorMetadata.js';
|
|
7
|
+
import type { GraphViewMemberMetadata } from './GraphViewMemberMetadata.js';
|
|
8
|
+
|
|
9
|
+
const METADATA_KEY = 'chronicle:graph:view:member';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a property decorator that declares a member of a graph view. Members are read in the order they are declared.
|
|
13
|
+
* @param metadata - What the member is.
|
|
14
|
+
* @returns A property decorator.
|
|
15
|
+
*/
|
|
16
|
+
export function declareGraphViewMember(metadata: GraphViewMemberMetadata): ChroniclePropertyDecorator {
|
|
17
|
+
return decorateProperty((target: object, propertyKey: string | symbol) => {
|
|
18
|
+
const key = propertyKey.toString();
|
|
19
|
+
if (Reflect.getOwnMetadata(METADATA_KEY, target, key) !== undefined) {
|
|
20
|
+
throw new TypeError(`The member '${key}' of a graph view can be declared as one kind of member only.`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
TypeIntrospector.trackProperty((target as { constructor: Function }).constructor, key);
|
|
24
|
+
Reflect.defineMetadata(METADATA_KEY, metadata, target, key);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves the metadata stored by the member decorators of a graph view on a property.
|
|
30
|
+
* @param target - The class prototype.
|
|
31
|
+
* @param propertyKey - The property name.
|
|
32
|
+
* @returns The metadata, or undefined when the property is not a member of a view.
|
|
33
|
+
*/
|
|
34
|
+
export function getGraphViewMemberMetadata(target: object, propertyKey: string): GraphViewMemberMetadata | undefined {
|
|
35
|
+
return getPropertyMetadata<GraphViewMemberMetadata>(METADATA_KEY, target, propertyKey);
|
|
36
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { ChroniclePropertyDecorator } from '../../../types/propertyDecoratorMetadata.js';
|
|
5
|
+
import type { FollowsOptions } from './FollowsOptions.js';
|
|
6
|
+
import { GraphViewCardinality } from './GraphViewCardinality.js';
|
|
7
|
+
import type { GraphViewEdgeReference } from './GraphViewEdgeReference.js';
|
|
8
|
+
import { GraphViewMemberKind } from './GraphViewMemberKind.js';
|
|
9
|
+
import { declareGraphViewMember } from './declareGraphViewMember.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Property decorator that declares a member of a graph view that follows one edge type to a nested view.
|
|
13
|
+
* @param edge - The edge to follow: a function returning the edge class, or the edge type string.
|
|
14
|
+
* @param view - A function returning the class of the nested view.
|
|
15
|
+
* @param options - The cardinality, which is many by default, and the direction, which is derived unless the edge
|
|
16
|
+
* starts and ends at the same label.
|
|
17
|
+
* @returns A property decorator.
|
|
18
|
+
*/
|
|
19
|
+
export function follows(edge: GraphViewEdgeReference, view: () => Function, options: FollowsOptions = {}): ChroniclePropertyDecorator {
|
|
20
|
+
return declareGraphViewMember({
|
|
21
|
+
kind: GraphViewMemberKind.Relation,
|
|
22
|
+
isKey: false,
|
|
23
|
+
edge,
|
|
24
|
+
view,
|
|
25
|
+
direction: options.direction,
|
|
26
|
+
cardinality: options.cardinality ?? GraphViewCardinality.Many
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -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
|
+
import type { ChroniclePropertyDecorator } from '../../../types/propertyDecoratorMetadata.js';
|
|
5
|
+
import { GraphViewMemberKind } from './GraphViewMemberKind.js';
|
|
6
|
+
import { declareGraphViewMember } from './declareGraphViewMember.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Property decorator that declares a member of a graph view that reads a property of the edge that was followed to
|
|
10
|
+
* reach the view. It is valid only in a view that is the target of relations of exactly one edge type.
|
|
11
|
+
* @param source - The name of the property of the edge. It is matched without regard to case. When missing, the
|
|
12
|
+
* name of the member is matched against the properties of the edge.
|
|
13
|
+
* @returns A property decorator.
|
|
14
|
+
*/
|
|
15
|
+
export function fromEdge(source?: string): ChroniclePropertyDecorator {
|
|
16
|
+
return declareGraphViewMember({ kind: GraphViewMemberKind.EdgeProperty, isKey: false, source });
|
|
17
|
+
}
|