@cratis/chronicle 6.63.0 → 6.65.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/README.md +1 -1
- package/artifacts/DefaultClientArtifactsProvider.ts +5 -0
- package/artifacts/IClientArtifactsProvider.ts +3 -0
- package/connection/ChronicleConnection.ts +17 -7
- package/connection/ChronicleConnectionString.spec.ts +85 -0
- package/connection/ChronicleConnectionString.ts +186 -12
- package/connection/ChronicleTlsMaterial.spec.ts +160 -0
- package/connection/ChronicleTlsMaterial.ts +121 -0
- package/connection/CompatibilityPreflight.ts +9 -1
- package/connection/LeastConnectionsLoadBalancerStrategy.ts +4 -2
- package/connection/LoadBalancerStrategyFactory.ts +7 -2
- package/connection/TokenProvider.ts +4 -1
- package/connection/fetchOAuthAccessToken.ts +4 -2
- package/connection/for_CompatibilityPreflight/when_verifying/with_the_check_skipped.spec.ts +23 -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/connection/ChronicleConnection.d.ts +1 -0
- package/dist/connection/ChronicleConnection.d.ts.map +1 -1
- package/dist/connection/ChronicleConnection.js +15 -7
- package/dist/connection/ChronicleConnection.js.map +1 -1
- package/dist/connection/ChronicleConnectionString.d.ts +50 -1
- package/dist/connection/ChronicleConnectionString.d.ts.map +1 -1
- package/dist/connection/ChronicleConnectionString.js +154 -12
- package/dist/connection/ChronicleConnectionString.js.map +1 -1
- package/dist/connection/ChronicleTlsMaterial.d.ts +54 -0
- package/dist/connection/ChronicleTlsMaterial.d.ts.map +1 -0
- package/dist/connection/ChronicleTlsMaterial.js +88 -0
- package/dist/connection/ChronicleTlsMaterial.js.map +1 -0
- package/dist/connection/CompatibilityPreflight.d.ts +2 -1
- package/dist/connection/CompatibilityPreflight.d.ts.map +1 -1
- package/dist/connection/CompatibilityPreflight.js +6 -1
- package/dist/connection/CompatibilityPreflight.js.map +1 -1
- package/dist/connection/LeastConnectionsLoadBalancerStrategy.d.ts +2 -1
- package/dist/connection/LeastConnectionsLoadBalancerStrategy.d.ts.map +1 -1
- package/dist/connection/LeastConnectionsLoadBalancerStrategy.js +3 -2
- package/dist/connection/LeastConnectionsLoadBalancerStrategy.js.map +1 -1
- package/dist/connection/LoadBalancerStrategyFactory.d.ts +2 -1
- package/dist/connection/LoadBalancerStrategyFactory.d.ts.map +1 -1
- package/dist/connection/LoadBalancerStrategyFactory.js +3 -2
- package/dist/connection/LoadBalancerStrategyFactory.js.map +1 -1
- package/dist/connection/TokenProvider.d.ts +4 -1
- package/dist/connection/TokenProvider.d.ts.map +1 -1
- package/dist/connection/TokenProvider.js +5 -1
- package/dist/connection/TokenProvider.js.map +1 -1
- package/dist/connection/fetchOAuthAccessToken.d.ts +2 -1
- package/dist/connection/fetchOAuthAccessToken.d.ts.map +1 -1
- package/dist/connection/fetchOAuthAccessToken.js +3 -2
- package/dist/connection/fetchOAuthAccessToken.js.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/for_ChronicleOptions/when_configuring_keep_alive/with_skip_keep_alive.spec.ts +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,11 @@
|
|
|
1
|
+
import type { ProjectionCapabilityProvenance } from '../../projections/ProjectionCapabilityProvenance.js';
|
|
2
|
+
import type { ProjectionCapabilityReject } from './ProjectionCapabilityReject.js';
|
|
3
|
+
/** Subscription shapes that must be rejected before inspecting any model schema. */
|
|
4
|
+
export declare class ProjectionDefinitionCapabilities {
|
|
5
|
+
static validate(wire: Record<string, unknown>, provenance: readonly ProjectionCapabilityProvenance[], reject: ProjectionCapabilityReject): void;
|
|
6
|
+
private static subscription;
|
|
7
|
+
private static unsupportedSection;
|
|
8
|
+
private static all;
|
|
9
|
+
private static hasAllMappings;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ProjectionDefinitionCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionDefinitionCapabilities.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionDefinitionCapabilities.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qDAAqD,CAAC;AAC1G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,oFAAoF;AACpF,qBAAa,gCAAgC;IACzC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,SAAS,8BAA8B,EAAE,EAAE,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAO9I;IAED,OAAO,CAAC,MAAM,CAAC,YAAY;IAM3B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAOjC,OAAO,CAAC,MAAM,CAAC,GAAG;IAOlB,OAAO,CAAC,MAAM,CAAC,cAAc;CAGhC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { AutoMap } from '@cratis/chronicle.contracts';
|
|
4
|
+
import { EventSequenceId } from '../../eventSequences/EventSequenceId.js';
|
|
5
|
+
import { eventContractPath } from '../../projections/eventContractPath.js';
|
|
6
|
+
/** Subscription shapes that must be rejected before inspecting any model schema. */
|
|
7
|
+
export class ProjectionDefinitionCapabilities {
|
|
8
|
+
static validate(wire, provenance, reject) {
|
|
9
|
+
if (provenance.find(entry => entry.contractPath === 'Variant'))
|
|
10
|
+
reject('Variant', 'variants require a kernel-backed test');
|
|
11
|
+
this.subscription(wire, reject);
|
|
12
|
+
for (const section of ['Nested', 'RemovedWithJoin'])
|
|
13
|
+
this.unsupportedSection(wire, section, reject);
|
|
14
|
+
if (wire.FromEvery?.length)
|
|
15
|
+
reject('FromEvery', 'derivative projections require a kernel-backed test');
|
|
16
|
+
if (wire.FromEventProperty)
|
|
17
|
+
reject('FromEventProperty', 'event-property subscriptions require a kernel-backed test');
|
|
18
|
+
this.all(wire, provenance, reject);
|
|
19
|
+
}
|
|
20
|
+
static subscription(wire, reject) {
|
|
21
|
+
if (wire.IsActive === false)
|
|
22
|
+
reject('IsActive', 'passive projections require a kernel-backed test');
|
|
23
|
+
if (wire.SubscribesToAllEvents === true)
|
|
24
|
+
reject('SubscribesToAllEvents', 'subscribe-to-all projections require a kernel-backed test');
|
|
25
|
+
if (wire.EventSequenceId !== EventSequenceId.eventLog.value)
|
|
26
|
+
reject('EventSequenceId', 'non-default event sequences require a kernel-backed test');
|
|
27
|
+
}
|
|
28
|
+
static unsupportedSection(wire, section, reject) {
|
|
29
|
+
const value = wire[section];
|
|
30
|
+
const paths = Array.isArray(value) ? value.map((entry) => eventContractPath(section, entry.Key))
|
|
31
|
+
: Object.keys(value ?? {}).map(property => `${section}.${property}`);
|
|
32
|
+
if (paths.length)
|
|
33
|
+
reject(paths[0], `${section === 'Nested' ? 'nested projections' : 'removedWithJoin'} require a kernel-backed test`);
|
|
34
|
+
}
|
|
35
|
+
static all(wire, provenance, reject) {
|
|
36
|
+
const all = wire.All;
|
|
37
|
+
if (provenance.some(entry => entry.contractPath === 'All') || this.hasAllMappings(all)) {
|
|
38
|
+
reject('All', 'fromEvery/all subscriptions require a kernel-backed test');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
static hasAllMappings(all) {
|
|
42
|
+
return !!(all?.IncludeChildren || Object.keys(all?.Properties ?? {}).length || all?.AutoMap === AutoMap.Enabled);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ProjectionDefinitionCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionDefinitionCapabilities.js","sourceRoot":"","sources":["../../../testing/projections/ProjectionDefinitionCapabilities.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAErG,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAI3E,oFAAoF;AACpF,MAAM,OAAO,gCAAgC;IACzC,MAAM,CAAC,QAAQ,CAAC,IAA6B,EAAE,UAAqD,EAAE,MAAkC;QACpI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC;YAAE,MAAM,CAAC,SAAS,EAAE,uCAAuC,CAAC,CAAC;QAC3H,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,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I,QAAQ,EAAE,CAAC,CAAC;QACpG,IAAI,KAAK,CAAC,MAAM;YAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,iBAAiB,+BAA+B,CAAC,CAAC;IAC1I,CAAC;IAEO,MAAM,CAAC,GAAG,CAAC,IAA6B,EAAE,UAAqD,EAAE,MAAkC;QACvI,MAAM,GAAG,GAAG,IAAI,CAAC,GAAwG,CAAC;QAC1H,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACrF,MAAM,CAAC,KAAK,EAAE,0DAA0D,CAAC,CAAC;QAC9E,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,GAAsG;QAChI,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,eAAe,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,MAAM,IAAI,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrH,CAAC;CACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ContractEventType } from '../../projections/declarative/ProjectionBuilderCore.js';
|
|
2
|
+
import type { ProjectionEventSchema } from '../../projections/ProjectionEventSchema.js';
|
|
3
|
+
import type { JsonSchema } from '../../schemas/JsonSchema.js';
|
|
4
|
+
import type { ProjectionCapabilityReject } from './ProjectionCapabilityReject.js';
|
|
5
|
+
/** Tracks generations across joins, roots, removals, and children in validation order. */
|
|
6
|
+
export declare class ProjectionEventSchemaResolver {
|
|
7
|
+
private readonly catalog;
|
|
8
|
+
private readonly reject;
|
|
9
|
+
private readonly generations;
|
|
10
|
+
constructor(catalog: ReadonlyMap<string, ProjectionEventSchema>, reject: ProjectionCapabilityReject);
|
|
11
|
+
readonly require: (eventType: ContractEventType, path: string) => JsonSchema;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ProjectionEventSchemaResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionEventSchemaResolver.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionEventSchemaResolver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAEhG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAElF,0FAA0F;AAC1F,qBAAa,6BAA6B;IAG1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAA8C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IAEzD,YAA6B,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAmB,MAAM,EAAE,0BAA0B,EAAI;IAEzI,QAAQ,CAAC,OAAO,cAAe,iBAAiB,QAAQ,MAAM,KAAG,UAAU,CAMzE;CACL"}
|
|
@@ -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
|
+
import { getEventTypeMapKey } from '../../projections/modelBound/childrenAndNestedBuilder.js';
|
|
4
|
+
/** Tracks generations across joins, roots, removals, and children in validation order. */
|
|
5
|
+
export class ProjectionEventSchemaResolver {
|
|
6
|
+
catalog;
|
|
7
|
+
reject;
|
|
8
|
+
generations = new Map();
|
|
9
|
+
constructor(catalog, reject) {
|
|
10
|
+
this.catalog = catalog;
|
|
11
|
+
this.reject = reject;
|
|
12
|
+
}
|
|
13
|
+
require = (eventType, path) => {
|
|
14
|
+
const previous = this.generations.get(eventType.Id);
|
|
15
|
+
if (previous !== undefined && previous !== eventType.Generation)
|
|
16
|
+
this.reject(path, 'multiple generations of the same event-type id require a kernel-backed test');
|
|
17
|
+
this.generations.set(eventType.Id, eventType.Generation);
|
|
18
|
+
const event = this.catalog.get(getEventTypeMapKey(eventType)) ?? this.reject(path, 'participating event schema is unavailable');
|
|
19
|
+
return event.schema;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ProjectionEventSchemaResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionEventSchemaResolver.js","sourceRoot":"","sources":["../../../testing/projections/ProjectionEventSchemaResolver.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAK9F,0FAA0F;AAC1F,MAAM,OAAO,6BAA6B;IAGT,OAAO;IAA+D,MAAM;IAFxF,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEzD,YAA6B,OAAmD,EAAmB,MAAkC;uBAAxG,OAAO;sBAA+D,MAAM;IAA+B,CAAC;IAEhI,OAAO,GAAG,CAAC,SAA4B,EAAE,IAAY,EAAc,EAAE;QAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACpD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,CAAC,UAAU;YAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,6EAA6E,CAAC,CAAC;QAClK,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,2CAA2C,CAAC,CAAC;QAChI,OAAO,KAAK,CAAC,MAAM,CAAC;IACxB,CAAC,CAAC;CACL"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JsonSchema } from '../../schemas/JsonSchema.js';
|
|
2
|
+
/** Fixture-backed expression families, in kernel validation order. */
|
|
3
|
+
export declare class ProjectionExpressionCapabilities {
|
|
4
|
+
static check(expression: string, target: JsonSchema, eventSchema: JsonSchema, fail: (reason: string) => never): boolean;
|
|
5
|
+
private static context;
|
|
6
|
+
private static eventSourceId;
|
|
7
|
+
private static identifierFormat;
|
|
8
|
+
private static eventContext;
|
|
9
|
+
private static contextTarget;
|
|
10
|
+
private static plainString;
|
|
11
|
+
private static int32;
|
|
12
|
+
private static literal;
|
|
13
|
+
private static numericLiteral;
|
|
14
|
+
private static inRange;
|
|
15
|
+
private static scalarLiteral;
|
|
16
|
+
private static booleanLiteral;
|
|
17
|
+
private static guidLiteral;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ProjectionExpressionCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionExpressionCapabilities.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionExpressionCapabilities.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAI9D,sEAAsE;AACtE,qBAAa,gCAAgC;IACzC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,KAAK,GAAG,OAAO,CAWtH;IAED,OAAO,CAAC,MAAM,CAAC,OAAO;IAYtB,OAAO,CAAC,MAAM,CAAC,aAAa;IAM5B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAI/B,OAAO,CAAC,MAAM,CAAC,YAAY;IAQ3B,OAAO,CAAC,MAAM,CAAC,aAAa;IAS5B,OAAO,CAAC,MAAM,CAAC,WAAW;IAI1B,OAAO,CAAC,MAAM,CAAC,KAAK;IAIpB,OAAO,CAAC,MAAM,CAAC,OAAO;IAMtB,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B,OAAO,CAAC,MAAM,CAAC,OAAO;IAKtB,OAAO,CAAC,MAAM,CAAC,aAAa;IAM5B,OAAO,CAAC,MAAM,CAAC,cAAc;IAI7B,OAAO,CAAC,MAAM,CAAC,WAAW;CAG7B"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { ProjectionArithmetic } from './ProjectionArithmetic.js';
|
|
4
|
+
import { ProjectionSchemaCapabilities } from './ProjectionSchemaCapabilities.js';
|
|
5
|
+
/** Fixture-backed expression families, in kernel validation order. */
|
|
6
|
+
export class ProjectionExpressionCapabilities {
|
|
7
|
+
static check(expression, target, eventSchema, fail) {
|
|
8
|
+
if (this.context(expression, target, fail))
|
|
9
|
+
return true;
|
|
10
|
+
if (/^\$value\([\p{L}\p{Mn}\p{Nd}\p{Pc} ._/:*+-]*\)$/u.test(expression)) {
|
|
11
|
+
this.literal(expression.slice(7, -1), target, fail);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (ProjectionArithmetic.isArithmetic(expression)) {
|
|
15
|
+
ProjectionArithmetic.validate(expression, target, eventSchema, fail);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
static context(expression, target, fail) {
|
|
21
|
+
if (expression === '$eventSourceId') {
|
|
22
|
+
this.eventSourceId(target, fail);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (expression === '$null')
|
|
26
|
+
return true;
|
|
27
|
+
if (expression.startsWith('$setOnce('))
|
|
28
|
+
fail('set once requires a kernel-backed test');
|
|
29
|
+
if (!expression.startsWith('$eventContext('))
|
|
30
|
+
return false;
|
|
31
|
+
this.eventContext(expression, target, fail);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
static eventSourceId(target, fail) {
|
|
35
|
+
if (target.type !== 'string' || !this.identifierFormat(target)) {
|
|
36
|
+
fail('$eventSourceId requires a string or GUID target; other targets require a kernel-backed test (ChronicleKernelScenario / live kernel)');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
static identifierFormat(target) {
|
|
40
|
+
return !target.format || target.format === 'guid';
|
|
41
|
+
}
|
|
42
|
+
static eventContext(expression, target, fail) {
|
|
43
|
+
if (expression === '$eventContext(Occurred)')
|
|
44
|
+
fail('raw Occurred is converted inconsistently by the kernel; only its Year, Month and Day paths are supported');
|
|
45
|
+
if (/^\$eventContext\(.+\(\)\)$/.test(expression))
|
|
46
|
+
fail('derived event-context functions require a kernel-backed test');
|
|
47
|
+
const path = /^\$eventContext\(([^()]*)\)$/.exec(expression)?.[1];
|
|
48
|
+
if (path && this.contextTarget(path, target))
|
|
49
|
+
return;
|
|
50
|
+
fail('event-context path and target schema require a kernel-backed test');
|
|
51
|
+
}
|
|
52
|
+
static contextTarget(path, target) {
|
|
53
|
+
const strings = ['EventSourceId', 'EventStore', 'Namespace', 'EventSourceType', 'EventStreamType',
|
|
54
|
+
'EventStreamId', 'Subject', 'Subject.Value', 'Hash', 'CorrelationId', 'CorrelationId.Value',
|
|
55
|
+
'CausedBy.Subject', 'CausedBy.Name', 'CausedBy.UserName', 'EventType.Id.Value', 'SequenceNumber', 'SequenceNumber.Value'];
|
|
56
|
+
const integers = ['Occurred.Year', 'Occurred.Month', 'Occurred.Day', 'EventType.Generation.Value'];
|
|
57
|
+
if (strings.includes(path))
|
|
58
|
+
return this.plainString(target);
|
|
59
|
+
return integers.includes(path) && this.int32(target);
|
|
60
|
+
}
|
|
61
|
+
static plainString(target) {
|
|
62
|
+
return target.type === 'string' && !target.format;
|
|
63
|
+
}
|
|
64
|
+
static int32(target) {
|
|
65
|
+
return target.type === 'integer' && target.format === 'int32';
|
|
66
|
+
}
|
|
67
|
+
static literal(text, target, fail) {
|
|
68
|
+
if (target.format === 'date-time')
|
|
69
|
+
fail('$value date-time literals require a kernel-backed test');
|
|
70
|
+
if (ProjectionSchemaCapabilities.numeric(target))
|
|
71
|
+
this.numericLiteral(text, target, fail);
|
|
72
|
+
else
|
|
73
|
+
this.scalarLiteral(text, target, fail);
|
|
74
|
+
}
|
|
75
|
+
static numericLiteral(text, target, fail) {
|
|
76
|
+
const spelling = target.type === 'integer' ? /^[+-]?\d+$/ : /^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/;
|
|
77
|
+
if (!spelling.test(text) || !this.inRange(Number(text), target)) {
|
|
78
|
+
fail('$value numeric literal is outside the supported finite/integer range');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
static inRange(number, target) {
|
|
82
|
+
if (!Number.isFinite(number))
|
|
83
|
+
return false;
|
|
84
|
+
return target.type !== 'integer' || !ProjectionSchemaCapabilities.outsideIntegerRange(number, target);
|
|
85
|
+
}
|
|
86
|
+
static scalarLiteral(text, target, fail) {
|
|
87
|
+
if (target.type === 'boolean')
|
|
88
|
+
this.booleanLiteral(text, fail);
|
|
89
|
+
else if (target.format === 'guid')
|
|
90
|
+
this.guidLiteral(text, fail);
|
|
91
|
+
else if (target.type === 'object' || target.type === 'array')
|
|
92
|
+
fail('$value object/array literals require a kernel-backed test');
|
|
93
|
+
}
|
|
94
|
+
static booleanLiteral(text, fail) {
|
|
95
|
+
if (!/^(?:true|false)$/i.test(text))
|
|
96
|
+
fail('$value boolean literal must be true or false');
|
|
97
|
+
}
|
|
98
|
+
static guidLiteral(text, fail) {
|
|
99
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(text))
|
|
100
|
+
fail('$value GUID literal is not canonical');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=ProjectionExpressionCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionExpressionCapabilities.js","sourceRoot":"","sources":["../../../testing/projections/ProjectionExpressionCapabilities.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAGrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,sEAAsE;AACtE,MAAM,OAAO,gCAAgC;IACzC,MAAM,CAAC,KAAK,CAAC,UAAkB,EAAE,MAAkB,EAAE,WAAuB,EAAE,IAA+B;QACzG,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACxD,IAAI,kDAAkD,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACtE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,oBAAoB,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAChD,oBAAoB,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;YACrE,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,MAAM,CAAC,OAAO,CAAC,UAAkB,EAAE,MAAkB,EAAE,IAA+B;QAC1F,IAAI,UAAU,KAAK,gBAAgB,EAAE,CAAC;YAClC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IA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AAC,CAAC;IACpI,CAAC;CACJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JsonSchema } from '../../schemas/JsonSchema.js';
|
|
2
|
+
import type { ProjectionCapabilityReject } from './ProjectionCapabilityReject.js';
|
|
3
|
+
/** Validates initial state without changing its JSON order or defaulting semantics. */
|
|
4
|
+
export declare class ProjectionInitialValueCapabilities {
|
|
5
|
+
static validate(initialState: string, schema: JsonSchema, reject: ProjectionCapabilityReject): Record<string, unknown>;
|
|
6
|
+
private static object;
|
|
7
|
+
private static check;
|
|
8
|
+
private static scalar;
|
|
9
|
+
private static nullable;
|
|
10
|
+
private static structured;
|
|
11
|
+
private static number;
|
|
12
|
+
private static invalidInteger;
|
|
13
|
+
private static boolean;
|
|
14
|
+
private static string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ProjectionInitialValueCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionInitialValueCapabilities.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionInitialValueCapabilities.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAGlF,uFAAuF;AACvF,qBAAa,kCAAkC;IAC3C,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAarH;IAED,OAAO,CAAC,MAAM,CAAC,MAAM;IAIrB,OAAO,CAAC,MAAM,CAAC,KAAK;IAQpB,OAAO,CAAC,MAAM,CAAC,MAAM;IAOrB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB,OAAO,CAAC,MAAM,CAAC,UAAU;IAIzB,OAAO,CAAC,MAAM,CAAC,MAAM;IAOrB,OAAO,CAAC,MAAM,CAAC,cAAc;IAI7B,OAAO,CAAC,MAAM,CAAC,OAAO;IAItB,OAAO,CAAC,MAAM,CAAC,MAAM;CAMxB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { ProjectionSchemaCapabilities } from './ProjectionSchemaCapabilities.js';
|
|
4
|
+
/** Validates initial state without changing its JSON order or defaulting semantics. */
|
|
5
|
+
export class ProjectionInitialValueCapabilities {
|
|
6
|
+
static validate(initialState, schema, reject) {
|
|
7
|
+
let initial;
|
|
8
|
+
try {
|
|
9
|
+
initial = JSON.parse(initialState);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
reject('InitialModelState', 'initial values must be a JSON object');
|
|
13
|
+
}
|
|
14
|
+
if (!this.object(initial)) {
|
|
15
|
+
reject('InitialModelState', 'initial values must be a JSON object');
|
|
16
|
+
}
|
|
17
|
+
for (const [property, value] of Object.entries(initial)) {
|
|
18
|
+
const target = schema.properties?.[property] ?? reject(`InitialModelState.${property}`, 'initial value has no read-model schema');
|
|
19
|
+
ProjectionSchemaCapabilities.check(target, `InitialModelState.${property}`, reject);
|
|
20
|
+
this.check(value, target, `InitialModelState.${property}`, reject);
|
|
21
|
+
}
|
|
22
|
+
return initial;
|
|
23
|
+
}
|
|
24
|
+
static object(value) {
|
|
25
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
static check(value, target, path, reject) {
|
|
28
|
+
if (value === null && this.nullable(target))
|
|
29
|
+
return;
|
|
30
|
+
if (this.structured(target) || target.format === 'date-time') {
|
|
31
|
+
reject(path, 'initial object, array, or date-time values require a kernel-backed test');
|
|
32
|
+
}
|
|
33
|
+
this.scalar(value, target, path, reject);
|
|
34
|
+
}
|
|
35
|
+
static scalar(value, target, path, reject) {
|
|
36
|
+
if (target.type === 'integer' || target.type === 'number')
|
|
37
|
+
return this.number(value, target, path, reject);
|
|
38
|
+
if (target.type === 'boolean')
|
|
39
|
+
return this.boolean(value, path, reject);
|
|
40
|
+
if (target.type === 'string' || Array.isArray(target.type))
|
|
41
|
+
return this.string(value, target, path, reject);
|
|
42
|
+
reject(path, 'initial value requires a kernel-backed test');
|
|
43
|
+
}
|
|
44
|
+
static nullable(schema) {
|
|
45
|
+
return Array.isArray(schema.type) && schema.type.includes('null');
|
|
46
|
+
}
|
|
47
|
+
static structured(schema) {
|
|
48
|
+
return schema.type === 'object' || schema.type === 'array';
|
|
49
|
+
}
|
|
50
|
+
static number(value, target, path, reject) {
|
|
51
|
+
if (typeof value !== 'number')
|
|
52
|
+
reject(path, 'initial numeric value must be a JSON number');
|
|
53
|
+
if (!Number.isFinite(value) || this.invalidInteger(value, target)) {
|
|
54
|
+
reject(path, 'initial numeric value is outside the supported finite/integer range');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
static invalidInteger(value, target) {
|
|
58
|
+
return target.type === 'integer' && ProjectionSchemaCapabilities.outsideIntegerRange(value, target);
|
|
59
|
+
}
|
|
60
|
+
static boolean(value, path, reject) {
|
|
61
|
+
if (typeof value !== 'boolean')
|
|
62
|
+
reject(path, 'initial boolean value must be a JSON boolean');
|
|
63
|
+
}
|
|
64
|
+
static string(value, target, path, reject) {
|
|
65
|
+
if (typeof value !== 'string')
|
|
66
|
+
reject(path, 'initial string value must be a JSON string');
|
|
67
|
+
if (target.format === 'guid' && !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(value)) {
|
|
68
|
+
reject(path, 'initial GUID value must be canonical lowercase text');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=ProjectionInitialValueCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionInitialValueCapabilities.js","sourceRoot":"","sources":["../../../testing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ProjectionCapabilityReject.js';
|
|
3
|
+
import type { ProjectionMappingValidation } from './ProjectionMappingValidation.js';
|
|
4
|
+
/** Checks explicit mappings and inferred AutoMap through the same schema boundary. */
|
|
5
|
+
export declare class ProjectionMappingCapabilities {
|
|
6
|
+
private readonly schema;
|
|
7
|
+
private readonly reject;
|
|
8
|
+
private readonly accumulators;
|
|
9
|
+
constructor(schema: JsonSchema, reject: ProjectionCapabilityReject, accumulators?: Set<string>);
|
|
10
|
+
check(mapping: ProjectionMappingValidation): void;
|
|
11
|
+
autoMap(eventSchema: JsonSchema, explicit: Record<string, string>, exclusions: string[], path: string): void;
|
|
12
|
+
private checkTarget;
|
|
13
|
+
private autoMapProperty;
|
|
14
|
+
private includes;
|
|
15
|
+
private checkDestination;
|
|
16
|
+
private property;
|
|
17
|
+
private checkSourcePath;
|
|
18
|
+
private compatibility;
|
|
19
|
+
private checkAccumulator;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ProjectionMappingCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionMappingCapabilities.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionMappingCapabilities.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAGlF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,sFAAsF;AACtF,qBAAa,6BAA6B;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAc,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA8B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAnI,YAA6B,MAAM,EAAE,UAAU,EAAmB,MAAM,EAAE,0BAA0B,EAAmB,YAAY,cAAoB,EAAI;IAE3J,KAAK,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAYhD;IAED,OAAO,CAAC,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAK3G;IAED,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,gBAAgB;CAM3B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { ProjectionExpressionCapabilities } from './ProjectionExpressionCapabilities.js';
|
|
4
|
+
import { ProjectionSchemaCapabilities } from './ProjectionSchemaCapabilities.js';
|
|
5
|
+
/** Checks explicit mappings and inferred AutoMap through the same schema boundary. */
|
|
6
|
+
export class ProjectionMappingCapabilities {
|
|
7
|
+
schema;
|
|
8
|
+
reject;
|
|
9
|
+
accumulators;
|
|
10
|
+
constructor(schema, reject, accumulators = new Set()) {
|
|
11
|
+
this.schema = schema;
|
|
12
|
+
this.reject = reject;
|
|
13
|
+
this.accumulators = accumulators;
|
|
14
|
+
}
|
|
15
|
+
check(mapping) {
|
|
16
|
+
const { eventSchema, destination, expression, path } = mapping;
|
|
17
|
+
const fail = (reason) => this.reject(path, `expression '${expression}': ${reason}`);
|
|
18
|
+
const target = this.schema.properties?.[destination] ?? fail('dynamic or unknown destination paths require a kernel-backed test');
|
|
19
|
+
this.checkDestination(mapping, fail);
|
|
20
|
+
this.checkTarget(target, mapping, fail);
|
|
21
|
+
if (ProjectionExpressionCapabilities.check(expression, target, eventSchema, fail))
|
|
22
|
+
return;
|
|
23
|
+
if (/^[A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*$/.test(expression)) {
|
|
24
|
+
return this.property(mapping, fail);
|
|
25
|
+
}
|
|
26
|
+
if (expression.startsWith('$context.'))
|
|
27
|
+
fail('is a legacy expression the kernel does not resolve; event-context mappings use $eventContext(...)');
|
|
28
|
+
fail('requires a kernel-backed test');
|
|
29
|
+
}
|
|
30
|
+
autoMap(eventSchema, explicit, exclusions, path) {
|
|
31
|
+
for (const property of Object.keys(this.schema.properties ?? {})) {
|
|
32
|
+
if (this.includes(Object.keys(explicit), property) || this.includes(exclusions, property))
|
|
33
|
+
continue;
|
|
34
|
+
this.autoMapProperty(eventSchema, property, path);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
checkTarget(target, { path }, fail) {
|
|
38
|
+
if (target.type === 'object' || target.type === 'array')
|
|
39
|
+
fail('object/array target mappings require a kernel-backed test (ChronicleKernelScenario / live kernel)');
|
|
40
|
+
ProjectionSchemaCapabilities.check(target, path, (_path, reason) => fail(reason));
|
|
41
|
+
}
|
|
42
|
+
autoMapProperty(eventSchema, destination, path) {
|
|
43
|
+
const matches = Object.keys(eventSchema.properties ?? {}).filter(name => name.toLowerCase() === destination.toLowerCase());
|
|
44
|
+
if (matches.length > 1)
|
|
45
|
+
this.reject(`${path}.AutoMap.${destination}`, `inferred AutoMap source is ambiguous: ${matches.join(', ')}`);
|
|
46
|
+
if (matches.length)
|
|
47
|
+
this.check({ eventSchema, destination, expression: matches[0], path: `${path}.AutoMap.${destination}` });
|
|
48
|
+
}
|
|
49
|
+
includes(names, property) {
|
|
50
|
+
return names.some(name => name.toLowerCase() === property.toLowerCase());
|
|
51
|
+
}
|
|
52
|
+
checkDestination({ destination }, fail) {
|
|
53
|
+
if (destination.includes('.') || destination.includes('$'))
|
|
54
|
+
fail('dynamic or unknown destination paths require a kernel-backed test');
|
|
55
|
+
const collision = Object.keys(this.schema.properties ?? {}).some(name => name !== destination && name.toLowerCase() === destination.toLowerCase());
|
|
56
|
+
if (destination.toLowerCase() === 'id' || collision) {
|
|
57
|
+
fail('identifier or case-insensitively colliding target mappings require a kernel-backed test (ChronicleKernelScenario / live kernel)');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
property(mapping, fail) {
|
|
61
|
+
const { eventSchema, destination, expression, path } = mapping;
|
|
62
|
+
this.checkSourcePath(mapping, fail);
|
|
63
|
+
const source = eventSchema.properties?.[expression] ?? fail(`event property '${expression}' is absent from the participating event schema`);
|
|
64
|
+
ProjectionSchemaCapabilities.check(source, path, (_path, reason) => fail(reason));
|
|
65
|
+
this.checkAccumulator(source, destination, fail);
|
|
66
|
+
this.compatibility(source, mapping, fail);
|
|
67
|
+
}
|
|
68
|
+
checkSourcePath({ expression }, fail) {
|
|
69
|
+
if (['true', 'True', 'false', 'False'].includes(expression))
|
|
70
|
+
fail('kernel resolves this expression as a boolean literal before event content');
|
|
71
|
+
if (expression.includes('.'))
|
|
72
|
+
fail('nested event property paths require a kernel-backed test');
|
|
73
|
+
}
|
|
74
|
+
compatibility(source, { destination, expression }, fail) {
|
|
75
|
+
const target = this.schema.properties[destination];
|
|
76
|
+
if (!ProjectionSchemaCapabilities.compatible(source, target)) {
|
|
77
|
+
fail(`source '${expression}' (${source.type}${source.format ? `/${source.format}` : ''}) to target '${destination}' (${target.type}${target.format ? `/${target.format}` : ''}) requires a kernel-backed test`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
checkAccumulator(source, destination, fail) {
|
|
81
|
+
if (this.accumulators.has(destination) && !ProjectionSchemaCapabilities.numeric(source)) {
|
|
82
|
+
fail('assigning non-numeric event properties to an arithmetic accumulator requires a kernel-backed test; missing values can clear it');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=ProjectionMappingCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionMappingCapabilities.js","sourceRoot":"","sources":["../../../testing/projections/ProjectionMappingCapabilities.ts"],"names":[],"mappings":"AAAA,6CAA6C;AA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AAC,MAAM,CAAC,EAAE,CAAC;YACtF,IAAI,CAAC,gIAAgI,CAAC,CAAC;QAC3I,CAAC;IACL,CAAC;CAEJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JsonSchema } from '../../schemas/JsonSchema.js';
|
|
2
|
+
/** One compiled mapping and the event schema it reads. */
|
|
3
|
+
export interface ProjectionMappingValidation {
|
|
4
|
+
readonly eventSchema: JsonSchema;
|
|
5
|
+
readonly destination: string;
|
|
6
|
+
readonly expression: string;
|
|
7
|
+
readonly path: string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ProjectionMappingValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionMappingValidation.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionMappingValidation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,0DAA0D;AAC1D,MAAM,WAAW,2BAA2B;IACxC,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionMappingValidation.js","sourceRoot":"","sources":["../../../testing/projections/ProjectionMappingValidation.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CompiledProjectionDefinitions } from '../../projections/CompiledProjectionDefinitions.js';
|
|
2
|
+
import type { JsonSchema } from '../../schemas/JsonSchema.js';
|
|
3
|
+
import type { ProjectionCapabilityReject } from './ProjectionCapabilityReject.js';
|
|
4
|
+
/** Registered read-model evidence and sink-managed identifier requirements. */
|
|
5
|
+
export declare class ProjectionReadModelCapabilities {
|
|
6
|
+
static schema(compiled: CompiledProjectionDefinitions, model: string, reject: ProjectionCapabilityReject): JsonSchema;
|
|
7
|
+
private static identifier;
|
|
8
|
+
private static supportedIdentifier;
|
|
9
|
+
private static collisions;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ProjectionReadModelCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionReadModelCapabilities.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionReadModelCapabilities.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAGlF,+EAA+E;AAC/E,qBAAa,+BAA+B;IACxC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,6BAA6B,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,0BAA0B,GAAG,UAAU,CAUpH;IAED,OAAO,CAAC,MAAM,CAAC,UAAU;IAMzB,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAKlC,OAAO,CAAC,MAAM,CAAC,UAAU;CAQ5B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
import { ProjectionSchemaCapabilities } from './ProjectionSchemaCapabilities.js';
|
|
4
|
+
/** Registered read-model evidence and sink-managed identifier requirements. */
|
|
5
|
+
export class ProjectionReadModelCapabilities {
|
|
6
|
+
static schema(compiled, model, reject) {
|
|
7
|
+
const readModel = compiled.readModels.find(candidate => candidate.Type.Identifier === model)
|
|
8
|
+
?? reject('ReadModel', 'a single registered read-model schema is required');
|
|
9
|
+
let schema;
|
|
10
|
+
try {
|
|
11
|
+
schema = JSON.parse(readModel.Schema);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
reject('ReadModel.Schema', 'read-model schema is not valid JSON');
|
|
15
|
+
}
|
|
16
|
+
ProjectionSchemaCapabilities.checkProtection(schema, 'ReadModel.Schema', reject);
|
|
17
|
+
this.identifier(schema.properties?.id, reject);
|
|
18
|
+
this.collisions(schema, reject);
|
|
19
|
+
return schema;
|
|
20
|
+
}
|
|
21
|
+
static identifier(identifier, reject) {
|
|
22
|
+
if (!identifier || !this.supportedIdentifier(identifier)) {
|
|
23
|
+
reject('ReadModel.Schema.id', 'only a lowercase id with a fixture-backed string, GUID, or number/double schema is supported; other identifiers require a kernel-backed test (ChronicleKernelScenario / live kernel)');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
static supportedIdentifier(identifier) {
|
|
27
|
+
if (identifier.type === 'string')
|
|
28
|
+
return !identifier.format || identifier.format === 'guid';
|
|
29
|
+
return identifier.type === 'number' && identifier.format === 'double';
|
|
30
|
+
}
|
|
31
|
+
static collisions(schema, reject) {
|
|
32
|
+
const names = Object.keys(schema.properties ?? {});
|
|
33
|
+
for (const [index, name] of names.entries()) {
|
|
34
|
+
if (names.slice(index + 1).some(other => other.toLowerCase() === name.toLowerCase())) {
|
|
35
|
+
reject(`ReadModel.Schema.${name}`, 'case-insensitively colliding read-model properties require a kernel-backed test (ChronicleKernelScenario / live kernel)');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ProjectionReadModelCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionReadModelCapabilities.js","sourceRoot":"","sources":["../../../testing/projections/ProjectionReadModelCapabilities.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG;AAKrG,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF,+EAA+E;AAC/E,MAAM,OAAO,+BAA+B;IACxC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,MAAkC;QAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;QACnD,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1C,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;gBACnF,MAAM,CAAC,oBAAoB,IAAI,EAAE,EAAE,yHAAyH,CAAC,CAAC;YAClK,CAAC;QACL,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FromRecord, RemovedWithRecord } from '../../projections/declarative/ProjectionBuilderCore.js';
|
|
2
|
+
import type { JsonSchema } from '../../schemas/JsonSchema.js';
|
|
3
|
+
import type { ProjectionCapabilityReject } from './ProjectionCapabilityReject.js';
|
|
4
|
+
import type { ProjectionEventSchemaResolver } from './ProjectionEventSchemaResolver.js';
|
|
5
|
+
/** Validates root subscriptions and accumulator interactions before child traversal. */
|
|
6
|
+
export declare class ProjectionRootCapabilities {
|
|
7
|
+
private readonly schema;
|
|
8
|
+
private readonly wire;
|
|
9
|
+
private readonly reject;
|
|
10
|
+
readonly from: FromRecord[];
|
|
11
|
+
readonly removedWith: RemovedWithRecord[];
|
|
12
|
+
constructor(schema: JsonSchema, wire: Record<string, unknown>, reject: ProjectionCapabilityReject);
|
|
13
|
+
validate(resolver: ProjectionEventSchemaResolver): void;
|
|
14
|
+
private checkOverlaps;
|
|
15
|
+
private checkAccumulatorChildren;
|
|
16
|
+
private checkClearedAccumulators;
|
|
17
|
+
private subscription;
|
|
18
|
+
private properties;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ProjectionRootCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectionRootCapabilities.d.ts","sourceRoot":"","sources":["../../../testing/projections/ProjectionRootCapabilities.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAE5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAGxF,wFAAwF;AACxF,qBAAa,0BAA0B;IAIvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAc,OAAO,CAAC,QAAQ,CAAC,IAAI;IAA2B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHxH,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAE1C,YAA6B,MAAM,EAAE,UAAU,EAAmB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAmB,MAAM,EAAE,0BAA0B,EAGnJ;IAED,QAAQ,CAAC,QAAQ,EAAE,6BAA6B,GAAG,IAAI,CAQtD;IAED,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,UAAU;CASrB"}
|