@cratis/chronicle 6.60.0 → 6.62.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/connection/ChronicleConnection.ts +7 -1
- package/connection/ChronicleServices.ts +2 -0
- package/dist/connection/ChronicleConnection.d.ts +1 -0
- package/dist/connection/ChronicleConnection.d.ts.map +1 -1
- package/dist/connection/ChronicleConnection.js +6 -2
- package/dist/connection/ChronicleConnection.js.map +1 -1
- package/dist/connection/ChronicleServices.d.ts +2 -1
- package/dist/connection/ChronicleServices.d.ts.map +1 -1
- package/dist/eventSequences/EventForEventSourceId.d.ts +21 -1
- package/dist/eventSequences/EventForEventSourceId.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.d.ts +9 -0
- package/dist/eventSequences/EventSequence.d.ts.map +1 -1
- package/dist/eventSequences/EventSequence.js +18 -0
- package/dist/eventSequences/EventSequence.js.map +1 -1
- package/dist/eventSequences/IEventSequence.d.ts +30 -0
- package/dist/eventSequences/IEventSequence.d.ts.map +1 -1
- package/dist/imports/EventImport.d.ts +29 -0
- package/dist/imports/EventImport.d.ts.map +1 -0
- package/dist/imports/EventImport.js +248 -0
- package/dist/imports/EventImport.js.map +1 -0
- package/dist/imports/EventImportSettings.d.ts +32 -0
- package/dist/imports/EventImportSettings.d.ts.map +1 -0
- package/dist/imports/EventImportSettings.js +4 -0
- package/dist/imports/EventImportSettings.js.map +1 -0
- package/dist/imports/IEventImport.d.ts +50 -0
- package/dist/imports/IEventImport.d.ts.map +1 -0
- package/dist/imports/IEventImport.js +4 -0
- package/dist/imports/IEventImport.js.map +1 -0
- package/dist/imports/ImportChunkRefused.d.ts +12 -0
- package/dist/imports/ImportChunkRefused.d.ts.map +1 -0
- package/dist/imports/ImportChunkRefused.js +19 -0
- package/dist/imports/ImportChunkRefused.js.map +1 -0
- package/dist/imports/ImportCouldNotBegin.d.ts +10 -0
- package/dist/imports/ImportCouldNotBegin.d.ts.map +1 -0
- package/dist/imports/ImportCouldNotBegin.js +16 -0
- package/dist/imports/ImportCouldNotBegin.js.map +1 -0
- package/dist/imports/ImportOptions.d.ts +26 -0
- package/dist/imports/ImportOptions.d.ts.map +1 -0
- package/dist/imports/ImportOptions.js +4 -0
- package/dist/imports/ImportOptions.js.map +1 -0
- package/dist/imports/ImportProgress.d.ts +20 -0
- package/dist/imports/ImportProgress.d.ts.map +1 -0
- package/dist/imports/ImportProgress.js +4 -0
- package/dist/imports/ImportProgress.js.map +1 -0
- package/dist/imports/ImportRejection.d.ts +10 -0
- package/dist/imports/ImportRejection.d.ts.map +1 -0
- package/dist/imports/ImportRejection.js +4 -0
- package/dist/imports/ImportRejection.js.map +1 -0
- package/dist/imports/ImportResult.d.ts +30 -0
- package/dist/imports/ImportResult.d.ts.map +1 -0
- package/dist/imports/ImportResult.js +4 -0
- package/dist/imports/ImportResult.js.map +1 -0
- package/dist/imports/ImportState.d.ts +18 -0
- package/dist/imports/ImportState.d.ts.map +1 -0
- package/dist/imports/ImportState.js +21 -0
- package/dist/imports/ImportState.js.map +1 -0
- package/dist/imports/ImportTarget.d.ts +16 -0
- package/dist/imports/ImportTarget.d.ts.map +1 -0
- package/dist/imports/ImportTarget.js +4 -0
- package/dist/imports/ImportTarget.js.map +1 -0
- package/dist/imports/ImportWasAbandoned.d.ts +11 -0
- package/dist/imports/ImportWasAbandoned.d.ts.map +1 -0
- package/dist/imports/ImportWasAbandoned.js +16 -0
- package/dist/imports/ImportWasAbandoned.js.map +1 -0
- package/dist/imports/ImportsNotSupported.d.ts +5 -0
- package/dist/imports/ImportsNotSupported.d.ts.map +1 -0
- package/dist/imports/ImportsNotSupported.js +10 -0
- package/dist/imports/ImportsNotSupported.js.map +1 -0
- package/dist/imports/OnInvalidEvent.d.ts +8 -0
- package/dist/imports/OnInvalidEvent.d.ts.map +1 -0
- package/dist/imports/OnInvalidEvent.js +11 -0
- package/dist/imports/OnInvalidEvent.js.map +1 -0
- package/dist/imports/abortable.d.ts +23 -0
- package/dist/imports/abortable.d.ts.map +1 -0
- package/dist/imports/abortable.js +60 -0
- package/dist/imports/abortable.js.map +1 -0
- package/dist/imports/beginEventImport.d.ts +16 -0
- package/dist/imports/beginEventImport.d.ts.map +1 -0
- package/dist/imports/beginEventImport.js +74 -0
- package/dist/imports/beginEventImport.js.map +1 -0
- package/dist/imports/for_EventImport/given/a_kernel_import_session.d.ts +144 -0
- package/dist/imports/for_EventImport/given/a_kernel_import_session.d.ts.map +1 -0
- package/dist/imports/for_EventImport/given/a_kernel_import_session.js +132 -0
- package/dist/imports/for_EventImport/given/a_kernel_import_session.js.map +1 -0
- package/dist/imports/importEvents.d.ts +13 -0
- package/dist/imports/importEvents.d.ts.map +1 -0
- package/dist/imports/importEvents.js +35 -0
- package/dist/imports/importEvents.js.map +1 -0
- package/dist/imports/index.d.ts +12 -0
- package/dist/imports/index.d.ts.map +1 -0
- package/dist/imports/index.js +9 -0
- package/dist/imports/index.js.map +1 -0
- package/dist/imports/isTransientImportFailure.d.ts +7 -0
- package/dist/imports/isTransientImportFailure.d.ts.map +1 -0
- package/dist/imports/isTransientImportFailure.js +13 -0
- package/dist/imports/isTransientImportFailure.js.map +1 -0
- package/dist/imports/sizeOfImportEvent.d.ts +9 -0
- package/dist/imports/sizeOfImportEvent.d.ts.map +1 -0
- package/dist/imports/sizeOfImportEvent.js +25 -0
- package/dist/imports/sizeOfImportEvent.js.map +1 -0
- package/dist/imports/toImportEvent.d.ts +14 -0
- package/dist/imports/toImportEvent.d.ts.map +1 -0
- package/dist/imports/toImportEvent.js +54 -0
- package/dist/imports/toImportEvent.js.map +1 -0
- package/dist/imports/toImportProgress.d.ts +9 -0
- package/dist/imports/toImportProgress.d.ts.map +1 -0
- package/dist/imports/toImportProgress.js +20 -0
- package/dist/imports/toImportProgress.js.map +1 -0
- package/dist/imports/toImportResult.d.ts +9 -0
- package/dist/imports/toImportResult.d.ts.map +1 -0
- package/dist/imports/toImportResult.js +33 -0
- package/dist/imports/toImportResult.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/observation/index.d.ts +2 -0
- package/dist/observation/index.d.ts.map +1 -1
- package/dist/observation/index.js +1 -0
- package/dist/observation/index.js.map +1 -1
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.d.ts +15 -0
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.d.ts.map +1 -0
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.js +22 -0
- package/dist/projections/ChildrenOrderingNotSupportedByContracts.js.map +1 -0
- package/dist/projections/InvalidCausedByProperty.d.ts +10 -0
- package/dist/projections/InvalidCausedByProperty.d.ts.map +1 -0
- package/dist/projections/InvalidCausedByProperty.js +16 -0
- package/dist/projections/InvalidCausedByProperty.js.map +1 -0
- package/dist/projections/Projections.d.ts.map +1 -1
- package/dist/projections/Projections.js +4 -0
- package/dist/projections/Projections.js.map +1 -1
- package/dist/projections/causedBy.d.ts +15 -0
- package/dist/projections/causedBy.d.ts.map +1 -0
- package/dist/projections/causedBy.js +24 -0
- package/dist/projections/causedBy.js.map +1 -0
- package/dist/projections/childrenOrdering.d.ts +38 -0
- package/dist/projections/childrenOrdering.d.ts.map +1 -0
- package/dist/projections/childrenOrdering.js +37 -0
- package/dist/projections/childrenOrdering.js.map +1 -0
- package/dist/projections/childrenOrderingSupport.d.ts +14 -0
- package/dist/projections/childrenOrderingSupport.d.ts.map +1 -0
- package/dist/projections/childrenOrderingSupport.js +37 -0
- package/dist/projections/childrenOrderingSupport.js.map +1 -0
- package/dist/projections/declarative/AllSetBuilder.d.ts +3 -0
- package/dist/projections/declarative/AllSetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/AllSetBuilder.js +6 -0
- package/dist/projections/declarative/AllSetBuilder.js.map +1 -1
- package/dist/projections/declarative/ChildrenBuilder.d.ts +9 -0
- package/dist/projections/declarative/ChildrenBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/ChildrenBuilder.js +29 -1
- package/dist/projections/declarative/ChildrenBuilder.js.map +1 -1
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.d.ts +6 -0
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.d.ts.map +1 -0
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.js +11 -0
- package/dist/projections/declarative/ChildrenOrderingAlreadyDefined.js.map +1 -0
- package/dist/projections/declarative/DictionaryKey.d.ts +48 -0
- package/dist/projections/declarative/DictionaryKey.d.ts.map +1 -0
- package/dist/projections/declarative/DictionaryKey.js +82 -0
- package/dist/projections/declarative/DictionaryKey.js.map +1 -0
- package/dist/projections/declarative/FromAllBuilder.d.ts +2 -0
- package/dist/projections/declarative/FromAllBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromAllBuilder.js +5 -0
- package/dist/projections/declarative/FromAllBuilder.js.map +1 -1
- package/dist/projections/declarative/FromBuilder.d.ts +18 -6
- package/dist/projections/declarative/FromBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromBuilder.js +34 -31
- package/dist/projections/declarative/FromBuilder.js.map +1 -1
- package/dist/projections/declarative/FromEveryBuilder.d.ts +2 -0
- package/dist/projections/declarative/FromEveryBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/FromEveryBuilder.js +7 -0
- package/dist/projections/declarative/FromEveryBuilder.js.map +1 -1
- package/dist/projections/declarative/IAllSetBuilder.d.ts +7 -0
- package/dist/projections/declarative/IAllSetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IChildrenBuilder.d.ts +19 -0
- package/dist/projections/declarative/IChildrenBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IFromAllBuilder.d.ts +6 -0
- package/dist/projections/declarative/IFromAllBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IFromEveryBuilder.d.ts +6 -0
- package/dist/projections/declarative/IFromEveryBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/IReadModelPropertiesBuilder.d.ts +37 -6
- package/dist/projections/declarative/IReadModelPropertiesBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/ISetBuilder.d.ts +7 -0
- package/dist/projections/declarative/ISetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/InvalidDictionaryKey.d.ts +10 -0
- package/dist/projections/declarative/InvalidDictionaryKey.d.ts.map +1 -0
- package/dist/projections/declarative/InvalidDictionaryKey.js +16 -0
- package/dist/projections/declarative/InvalidDictionaryKey.js.map +1 -0
- package/dist/projections/declarative/JoinBuilder.d.ts +18 -6
- package/dist/projections/declarative/JoinBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/JoinBuilder.js +34 -31
- package/dist/projections/declarative/JoinBuilder.js.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts +2 -0
- package/dist/projections/declarative/ProjectionBuilderCore.d.ts.map +1 -1
- package/dist/projections/declarative/ProjectionBuilderCore.js.map +1 -1
- package/dist/projections/declarative/SetBuilder.d.ts +3 -0
- package/dist/projections/declarative/SetBuilder.d.ts.map +1 -1
- package/dist/projections/declarative/SetBuilder.js +6 -0
- package/dist/projections/declarative/SetBuilder.js.map +1 -1
- package/dist/projections/declarative/index.d.ts +4 -0
- package/dist/projections/declarative/index.d.ts.map +1 -1
- package/dist/projections/declarative/index.js +3 -0
- package/dist/projections/declarative/index.js.map +1 -1
- package/dist/projections/graphs/GraphDefinitionBuilder.d.ts.map +1 -1
- package/dist/projections/graphs/GraphDefinitionBuilder.js +7 -4
- package/dist/projections/graphs/GraphDefinitionBuilder.js.map +1 -1
- package/dist/projections/graphs/GraphMemberMappings.d.ts +1 -0
- package/dist/projections/graphs/GraphMemberMappings.d.ts.map +1 -1
- package/dist/projections/graphs/GraphMemberMappings.js +10 -5
- package/dist/projections/graphs/GraphMemberMappings.js.map +1 -1
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.d.ts +13 -0
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.d.ts.map +1 -0
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.js +18 -0
- package/dist/projections/graphs/SetOnceNotSupportedInGraph.js.map +1 -0
- package/dist/projections/graphs/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/index.d.ts +5 -0
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/index.js +3 -0
- package/dist/projections/index.js.map +1 -1
- package/dist/projections/modelBound/ConflictingChildrenOrdering.d.ts +10 -0
- package/dist/projections/modelBound/ConflictingChildrenOrdering.d.ts.map +1 -0
- package/dist/projections/modelBound/ConflictingChildrenOrdering.js +16 -0
- package/dist/projections/modelBound/ConflictingChildrenOrdering.js.map +1 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts +2 -0
- package/dist/projections/modelBound/childrenAndNestedBuilder.d.ts.map +1 -1
- package/dist/projections/modelBound/childrenAndNestedBuilder.js +9 -5
- package/dist/projections/modelBound/childrenAndNestedBuilder.js.map +1 -1
- package/dist/projections/modelBound/childrenFrom.d.ts +39 -1
- package/dist/projections/modelBound/childrenFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/childrenFrom.js +30 -1
- package/dist/projections/modelBound/childrenFrom.js.map +1 -1
- package/dist/projections/modelBound/index.d.ts +3 -2
- package/dist/projections/modelBound/index.d.ts.map +1 -1
- package/dist/projections/modelBound/index.js +1 -0
- package/dist/projections/modelBound/index.js.map +1 -1
- package/dist/projections/modelBound/setFrom.d.ts +26 -0
- package/dist/projections/modelBound/setFrom.d.ts.map +1 -1
- package/dist/projections/modelBound/setFrom.js +15 -8
- package/dist/projections/modelBound/setFrom.js.map +1 -1
- package/dist/projections/modelBound/setFromContext.d.ts +23 -1
- package/dist/projections/modelBound/setFromContext.d.ts.map +1 -1
- package/dist/projections/modelBound/setFromContext.js +20 -2
- package/dist/projections/modelBound/setFromContext.js.map +1 -1
- package/dist/projections/propertyExpressions.d.ts +9 -0
- package/dist/projections/propertyExpressions.d.ts.map +1 -0
- package/dist/projections/propertyExpressions.js +13 -0
- package/dist/projections/propertyExpressions.js.map +1 -0
- package/dist/reducers/Reducers.d.ts.map +1 -1
- package/dist/reducers/Reducers.js +2 -1
- package/dist/reducers/Reducers.js.map +1 -1
- package/dist/testing/BatchPartitionOutcome.d.ts +7 -0
- package/dist/testing/BatchPartitionOutcome.d.ts.map +1 -0
- package/dist/testing/BatchPartitionOutcome.js +4 -0
- package/dist/testing/BatchPartitionOutcome.js.map +1 -0
- package/dist/testing/InProcessEventSequence.d.ts +4 -0
- package/dist/testing/InProcessEventSequence.d.ts.map +1 -1
- package/dist/testing/InProcessEventSequence.js +2 -0
- package/dist/testing/InProcessEventSequence.js.map +1 -1
- package/dist/testing/ReactorDeliveryResult.d.ts +2 -0
- package/dist/testing/ReactorDeliveryResult.d.ts.map +1 -1
- package/dist/testing/ReactorScenario.d.ts +46 -10
- package/dist/testing/ReactorScenario.d.ts.map +1 -1
- package/dist/testing/ReactorScenario.js +120 -29
- package/dist/testing/ReactorScenario.js.map +1 -1
- package/dist/testing/deliverToBatchMethods.d.ts +35 -0
- package/dist/testing/deliverToBatchMethods.d.ts.map +1 -0
- package/dist/testing/deliverToBatchMethods.js +55 -0
- package/dist/testing/deliverToBatchMethods.js.map +1 -0
- package/dist/testing/projections/ProjectionCapabilities.d.ts.map +1 -1
- package/dist/testing/projections/ProjectionCapabilities.js +2 -0
- package/dist/testing/projections/ProjectionCapabilities.js.map +1 -1
- package/dist/testing/projections/ProjectionChildrenCapabilities.d.ts.map +1 -1
- package/dist/testing/projections/ProjectionChildrenCapabilities.js +2 -0
- package/dist/testing/projections/ProjectionChildrenCapabilities.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eventSequences/EventForEventSourceId.ts +25 -1
- package/eventSequences/EventSequence.ts +28 -0
- package/eventSequences/IEventSequence.ts +33 -0
- package/imports/EventImport.ts +263 -0
- package/imports/EventImportSettings.ts +46 -0
- package/imports/IEventImport.ts +58 -0
- package/imports/ImportChunkRefused.ts +15 -0
- package/imports/ImportCouldNotBegin.ts +14 -0
- package/imports/ImportOptions.ts +36 -0
- package/imports/ImportProgress.ts +29 -0
- package/imports/ImportRejection.ts +14 -0
- package/imports/ImportResult.ts +43 -0
- package/imports/ImportState.ts +26 -0
- package/imports/ImportTarget.ts +23 -0
- package/imports/ImportWasAbandoned.ts +16 -0
- package/imports/ImportsNotSupported.ts +10 -0
- package/imports/OnInvalidEvent.ts +11 -0
- package/imports/abortable.ts +57 -0
- package/imports/beginEventImport.ts +85 -0
- package/imports/for_EventImport/given/a_kernel_import_session.ts +160 -0
- package/imports/for_EventImport/when_a_chunk_fails.spec.ts +65 -0
- package/imports/for_EventImport/when_abandoning.spec.ts +52 -0
- package/imports/for_EventImport/when_cancelling_with_an_abort_signal.spec.ts +59 -0
- package/imports/for_EventImport/when_completing.spec.ts +71 -0
- package/imports/for_EventImport/when_cutting_events_into_chunks.spec.ts +70 -0
- package/imports/for_EventImport/when_keeping_chunks_in_flight.spec.ts +49 -0
- package/imports/for_beginEventImport/when_reattaching.spec.ts +82 -0
- package/imports/for_beginEventImport/when_the_kernel_does_not_serve_imports.spec.ts +55 -0
- package/imports/for_importEvents/when_importing_in_one_call.spec.ts +99 -0
- package/imports/for_toImportEvent/when_converting_an_event.spec.ts +74 -0
- package/imports/importEvents.ts +44 -0
- package/imports/index.ts +14 -0
- package/imports/isTransientImportFailure.ts +15 -0
- package/imports/sizeOfImportEvent.ts +25 -0
- package/imports/toImportEvent.ts +60 -0
- package/imports/toImportProgress.ts +24 -0
- package/imports/toImportResult.ts +36 -0
- package/index.ts +3 -0
- package/observation/index.ts +2 -0
- package/package.json +7 -2
- package/projections/ChildrenOrderingNotSupportedByContracts.ts +18 -0
- package/projections/InvalidCausedByProperty.ts +14 -0
- package/projections/Projections.ts +4 -0
- package/projections/causedBy.ts +30 -0
- package/projections/childrenOrdering.ts +53 -0
- package/projections/childrenOrderingSupport.ts +40 -0
- package/projections/declarative/AllSetBuilder.ts +7 -0
- package/projections/declarative/ChildrenBuilder.ts +34 -1
- package/projections/declarative/ChildrenOrderingAlreadyDefined.ts +11 -0
- package/projections/declarative/DictionaryKey.ts +88 -0
- package/projections/declarative/FromAllBuilder.ts +10 -0
- package/projections/declarative/FromBuilder.ts +42 -32
- package/projections/declarative/FromEveryBuilder.ts +12 -0
- package/projections/declarative/IAllSetBuilder.ts +8 -0
- package/projections/declarative/IChildrenBuilder.ts +22 -0
- package/projections/declarative/IFromAllBuilder.ts +7 -0
- package/projections/declarative/IFromEveryBuilder.ts +7 -0
- package/projections/declarative/IReadModelPropertiesBuilder.ts +39 -6
- package/projections/declarative/ISetBuilder.ts +8 -0
- package/projections/declarative/InvalidDictionaryKey.ts +14 -0
- package/projections/declarative/JoinBuilder.ts +41 -32
- package/projections/declarative/ProjectionBuilderCore.ts +2 -0
- package/projections/declarative/SetBuilder.ts +7 -0
- package/projections/declarative/for_ChildrenBuilder/when_ordering_children.spec.ts +52 -0
- package/projections/declarative/for_FromAllBuilder/when_setting_once.spec.ts +29 -0
- package/projections/declarative/for_FromBuilder/when_setting_once.spec.ts +39 -0
- package/projections/declarative/for_FromBuilder/when_targeting_dictionary_entries.spec.ts +99 -0
- package/projections/declarative/for_JoinBuilder/when_setting_once_and_targeting_dictionary_entries.spec.ts +36 -0
- package/projections/declarative/for_SetBuilder/when_setting_to_the_causing_identity.spec.ts +37 -0
- package/projections/declarative/index.ts +4 -0
- package/projections/for_Graphs/when_building_a_fluent_graph.spec.ts +1 -1
- package/projections/for_Graphs/when_building_a_model_bound_graph.spec.ts +5 -4
- package/projections/for_Graphs/when_declaring_an_invalid_graph.spec.ts +28 -0
- package/projections/for_Graphs/when_declaring_with_standard_decorators.standard.spec.ts +4 -4
- package/projections/for_Graphs/when_mapping_properties.spec.ts +1 -1
- package/projections/for_Projections/when_registering_ordered_children.spec.ts +66 -0
- package/projections/for_childrenOrderingSupport/when_detecting_support_in_the_pinned_contracts.spec.ts +22 -0
- package/projections/for_childrenOrderingSupport/when_ensuring_children_ordering_is_supported.spec.ts +35 -0
- package/projections/graphs/GraphDefinitionBuilder.ts +7 -4
- package/projections/graphs/GraphMemberMappings.ts +8 -5
- package/projections/graphs/SetOnceNotSupportedInGraph.ts +18 -0
- package/projections/graphs/index.ts +1 -0
- package/projections/index.ts +5 -0
- package/projections/modelBound/ConflictingChildrenOrdering.ts +14 -0
- package/projections/modelBound/childrenAndNestedBuilder.ts +11 -5
- package/projections/modelBound/childrenFrom.ts +62 -2
- package/projections/modelBound/for_childrenFrom/when_ordering_children.spec.ts +91 -0
- package/projections/modelBound/for_setFrom/when_setting_once.spec.ts +52 -0
- package/projections/modelBound/index.ts +3 -2
- package/projections/modelBound/setFrom.ts +37 -2
- package/projections/modelBound/setFromContext.ts +38 -3
- package/projections/propertyExpressions.ts +14 -0
- package/reducers/Reducers.ts +2 -1
- package/testing/BatchPartitionOutcome.ts +10 -0
- package/testing/InProcessEventSequence.ts +4 -0
- package/testing/ReactorDeliveryResult.ts +2 -0
- package/testing/ReactorScenario.ts +147 -39
- package/testing/deliverToBatchMethods.ts +90 -0
- package/testing/for_ReactorScenario/when_the_reactor_has_a_batch_method.spec.ts +143 -9
- package/testing/projections/ProjectionCapabilities.ts +1 -0
- package/testing/projections/ProjectionChildrenCapabilities.ts +1 -0
- package/testing/projections/for_ProjectionCapabilities/when_rejecting_set_once_dictionary_entries_and_ordered_children.spec.ts +52 -0
|
@@ -2,25 +2,159 @@
|
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
4
|
import { field } from '@cratis/fundamentals';
|
|
5
|
-
import { chai, describe, it } from 'vitest';
|
|
6
|
-
import { eventType, observes, reactor } from '../../index.js';
|
|
7
|
-
import { ReactorScenario
|
|
5
|
+
import { beforeEach, chai, describe, it } from 'vitest';
|
|
6
|
+
import { BatchContext, BatchMethodReturnedAValue, BatchOutcomeKind, EventBatch, eventType, ObservationOrigin, observes, reactor } from '../../index.js';
|
|
7
|
+
import { ReactorScenario } from '../index.js';
|
|
8
8
|
|
|
9
9
|
chai.should();
|
|
10
10
|
|
|
11
11
|
@eventType('scenario-batch-shipment-sent')
|
|
12
12
|
class ShipmentSent {
|
|
13
|
-
@field(String) trackingNumber
|
|
13
|
+
@field(String) trackingNumber: string;
|
|
14
|
+
constructor(trackingNumber = '') { this.trackingNumber = trackingNumber; }
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
@eventType('scenario-batch-shipment-lost')
|
|
18
|
+
class ShipmentLost {
|
|
19
|
+
@field(String) reason: string;
|
|
20
|
+
constructor(reason = '') { this.reason = reason; }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@eventType('scenario-batch-shipment-delivered')
|
|
24
|
+
class ShipmentDelivered {
|
|
25
|
+
@field(String) signedBy: string;
|
|
26
|
+
constructor(signedBy = '') { this.signedBy = signedBy; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let batches: { batch: EventBatch; context: BatchContext }[] = [];
|
|
30
|
+
let delivered: string[] = [];
|
|
31
|
+
let failing = '';
|
|
32
|
+
let deferring = '';
|
|
33
|
+
let throwing = false;
|
|
34
|
+
|
|
16
35
|
@reactor('scenario-batch-shipments')
|
|
17
36
|
class Shipments {
|
|
18
37
|
@observes(ShipmentSent)
|
|
19
|
-
|
|
38
|
+
@observes(ShipmentLost)
|
|
39
|
+
track(batch: EventBatch, context: BatchContext) {
|
|
40
|
+
batches.push({ batch, context });
|
|
41
|
+
if (throwing) throw new Error('tracking service is down');
|
|
42
|
+
if (failing) batch.fail(failing, new Error('unknown carrier'));
|
|
43
|
+
if (deferring) batch.defer(deferring, 1000);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
shipmentDelivered(event: ShipmentDelivered) {
|
|
47
|
+
delivered.push(event.signedBy);
|
|
48
|
+
}
|
|
20
49
|
}
|
|
21
50
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
51
|
+
const options = { artifacts: { eventTypes: [ShipmentSent, ShipmentLost, ShipmentDelivered] }, constraints: 'disabled' as const };
|
|
52
|
+
|
|
53
|
+
function reset() {
|
|
54
|
+
batches = [];
|
|
55
|
+
delivered = [];
|
|
56
|
+
failing = '';
|
|
57
|
+
deferring = '';
|
|
58
|
+
throwing = false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
describe('when the events of one events call reach a batch method', () => {
|
|
62
|
+
let scenario: ReactorScenario;
|
|
63
|
+
beforeEach(async () => {
|
|
64
|
+
reset();
|
|
65
|
+
scenario = new ReactorScenario(Shipments, options);
|
|
66
|
+
await scenario.when.forEventSource('order-1').events(new ShipmentSent('T-1'), new ShipmentDelivered('Jane'), new ShipmentLost('weather'));
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should call the batch method once', () => batches.length.should.equal(1));
|
|
70
|
+
it('should give it the events it observes, in sequence order', () =>
|
|
71
|
+
batches[0].batch.events.map(event => event.eventType).should.deep.equal([ShipmentSent, ShipmentLost]));
|
|
72
|
+
it('should give it the content of the events', () =>
|
|
73
|
+
(batches[0].batch.ofType(ShipmentSent)[0].event as unknown as ShipmentSent).trackingNumber.should.equal('T-1'));
|
|
74
|
+
it('should describe the page as live', () => batches[0].context.origin.should.equal(ObservationOrigin.Live));
|
|
75
|
+
it('should describe every event of the page', () => batches[0].context.eventCount.should.equal(3));
|
|
76
|
+
it('should allow deferring', () => batches[0].context.canDefer.should.be.true);
|
|
77
|
+
it('should give each event its delivery identity', () => batches[0].batch.events.every(event => event.delivery !== undefined).should.be.true);
|
|
78
|
+
it('should still call the per-event method for the other events', () => delivered.should.deep.equal(['Jane']));
|
|
79
|
+
it('should report every event as handled', () => scenario.results[0].handled.length.should.equal(3));
|
|
80
|
+
it('should report no partition outcomes', () => scenario.partitionOutcomes.should.be.empty);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('when a page of several event sources reaches a batch method', () => {
|
|
84
|
+
let scenario: ReactorScenario;
|
|
85
|
+
beforeEach(async () => {
|
|
86
|
+
reset();
|
|
87
|
+
scenario = new ReactorScenario(Shipments, options);
|
|
88
|
+
await scenario.given.page(
|
|
89
|
+
{ eventSourceId: 'order-1', event: new ShipmentSent('T-1') },
|
|
90
|
+
{ eventSourceId: 'order-2', event: new ShipmentSent('T-2') });
|
|
91
|
+
await scenario.when.page(
|
|
92
|
+
{ eventSourceId: 'order-3', event: new ShipmentSent('T-3') },
|
|
93
|
+
{ eventSourceId: 'order-4', event: new ShipmentLost('customs') },
|
|
94
|
+
{ eventSourceId: 'order-3', event: new ShipmentLost('weather') });
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should call the batch method once per page', () => batches.length.should.equal(2));
|
|
98
|
+
it('should give the given page as one batch', () => batches[0].batch.partitions.should.deep.equal(['order-1', 'order-2']));
|
|
99
|
+
it('should give the action page as one batch', () => batches[1].batch.length.should.equal(3));
|
|
100
|
+
it('should list the partitions of the page in order', () => batches[1].context.partitions.should.deep.equal(['order-3', 'order-4']));
|
|
101
|
+
it('should report the partitions of the delivery', () => scenario.results[1].partitions.should.deep.equal(['order-3', 'order-4']));
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('when a batch method fails and defers partitions', () => {
|
|
105
|
+
let scenario: ReactorScenario;
|
|
106
|
+
beforeEach(async () => {
|
|
107
|
+
reset();
|
|
108
|
+
failing = 'order-1';
|
|
109
|
+
deferring = 'order-2';
|
|
110
|
+
scenario = new ReactorScenario(Shipments, options);
|
|
111
|
+
await scenario.when.page(
|
|
112
|
+
{ eventSourceId: 'order-1', event: new ShipmentSent('T-1') },
|
|
113
|
+
{ eventSourceId: 'order-2', event: new ShipmentSent('T-2') },
|
|
114
|
+
{ eventSourceId: 'order-3', event: new ShipmentSent('T-3') });
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should assert the failed partition', () => scenario.shouldHaveFailed('order-1'));
|
|
118
|
+
it('should assert the deferred partition', () => scenario.shouldHaveDeferred('order-2'));
|
|
119
|
+
it('should refuse to assert a partition that succeeded as failed', () =>
|
|
120
|
+
(() => scenario.shouldHaveFailed('order-3')).should.throw(/order-3.*failed 'order-1', deferred 'order-2'/));
|
|
121
|
+
it('should refuse to assert a failed partition as deferred', () => (() => scenario.shouldHaveDeferred('order-1')).should.throw());
|
|
122
|
+
it('should keep the outcomes in the order they were reported', () =>
|
|
123
|
+
scenario.partitionOutcomes.map(outcome => [outcome.partition, outcome.kind, outcome.methodName]).should.deep.equal([
|
|
124
|
+
['order-1', BatchOutcomeKind.Failed, 'track'], ['order-2', BatchOutcomeKind.Deferred, 'track']]));
|
|
125
|
+
it('should keep the delay of the deferral', () => scenario.partitionOutcomes[1].retryAfterMilliseconds.should.equal(1000));
|
|
126
|
+
it('should keep the error of the failure', () => (scenario.partitionOutcomes[0].error as Error).message.should.equal('unknown carrier'));
|
|
127
|
+
it('should report only the other partition as handled', () =>
|
|
128
|
+
scenario.results[0].handled.map(context => context.eventSourceId).should.deep.equal(['order-3']));
|
|
129
|
+
it('should complete the delivery', () => scenario.results[0].completed.should.be.true);
|
|
130
|
+
it('should offer the outcomes on the assertion view', () => scenario.then.partitionOutcomes.length.should.equal(2));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('when a batch method throws', () => {
|
|
134
|
+
let scenario: ReactorScenario;
|
|
135
|
+
let error: unknown;
|
|
136
|
+
beforeEach(async () => {
|
|
137
|
+
reset();
|
|
138
|
+
throwing = true;
|
|
139
|
+
scenario = new ReactorScenario(Shipments, options);
|
|
140
|
+
error = await scenario.when.forEventSource('order-1').events(new ShipmentSent('T-1')).catch(caught => caught);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should reject the call that delivered the events', () => (error as Error).message.should.equal('tracking service is down'));
|
|
144
|
+
it('should report the delivery as not completed', () => scenario.results[0].completed.should.be.false);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe('when a batch method returns a value', () => {
|
|
148
|
+
let error: unknown;
|
|
149
|
+
beforeEach(async () => {
|
|
150
|
+
@reactor('scenario-batch-returning')
|
|
151
|
+
class Returning {
|
|
152
|
+
@observes(ShipmentSent)
|
|
153
|
+
track() { return 'done'; }
|
|
154
|
+
}
|
|
155
|
+
const scenario = new ReactorScenario(Returning, options);
|
|
156
|
+
error = await scenario.when.forEventSource('order-1').events(new ShipmentSent('T-1')).catch(caught => caught);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should reject the delivery', () => error!.should.be.instanceOf(BatchMethodReturnedAValue));
|
|
26
160
|
});
|
|
@@ -175,6 +175,7 @@ export class ProjectionCapabilities {
|
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
if (expression === '$null') return;
|
|
178
|
+
if (expression.startsWith('$setOnce(')) fail('set once requires a kernel-backed test');
|
|
178
179
|
if (expression.startsWith('$eventContext(')) {
|
|
179
180
|
if (expression === '$eventContext(Occurred)') fail('raw Occurred is converted inconsistently by the kernel; only its Year, Month and Day paths are supported');
|
|
180
181
|
if (/^\$eventContext\(.+\(\)\)$/.test(expression)) fail('derived event-context functions require a kernel-backed test');
|
|
@@ -54,6 +54,7 @@ export class ProjectionChildrenCapabilities {
|
|
|
54
54
|
if (Object.keys(child.Nested ?? {}).length) reject(`${base}.Nested`, `nested projections inside children ${kernelBacked}`);
|
|
55
55
|
if ((child.RemovedWithJoin ?? []).length) reject(`${base}.RemovedWithJoin`, `removedWithJoin inside children ${kernelBacked}`);
|
|
56
56
|
if (wire.FromEventProperty) reject(`${base}.FromEventProperty`, `value children from an event property ${kernelBacked}`);
|
|
57
|
+
if (wire.Ordering !== undefined) reject(`${base}.Ordering`, `prepended or sorted children ${kernelBacked}`);
|
|
57
58
|
if (Object.keys(child.All?.Properties ?? {}).length || child.All?.IncludeChildren || (child.All?.AutoMap ?? AutoMap.Inherit) !== AutoMap.Inherit) {
|
|
58
59
|
reject(`${base}.All`, `fromEvery/all inside children ${kernelBacked}`);
|
|
59
60
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import 'reflect-metadata';
|
|
5
|
+
import { field } from '@cratis/fundamentals';
|
|
6
|
+
import { chai, describe, it } from 'vitest';
|
|
7
|
+
import { eventType } from '../../../events/eventTypeDecorator.js';
|
|
8
|
+
import { DictionaryKey } from '../../../projections/declarative/DictionaryKey.js';
|
|
9
|
+
import { ProjectionCapabilities } from '../ProjectionCapabilities.js';
|
|
10
|
+
import { UnsupportedProjectionOperation } from '../UnsupportedProjectionOperation.js';
|
|
11
|
+
import { Changed } from './given/Changed.js';
|
|
12
|
+
import { compileDeclarative } from './given/compile.js';
|
|
13
|
+
|
|
14
|
+
chai.should();
|
|
15
|
+
|
|
16
|
+
class OrderedChildAdded { itemId!: string; }
|
|
17
|
+
field(String)(OrderedChildAdded.prototype, 'itemId');
|
|
18
|
+
eventType('capability-ordered-child-added')(OrderedChildAdded);
|
|
19
|
+
|
|
20
|
+
describe('when a read-model scenario sets a property once', () => {
|
|
21
|
+
it('should require a kernel-backed test', () => {
|
|
22
|
+
const { compiled, definition } = compileDeclarative(builder => builder.from(Changed, _ => _.setOnce(m => m.name).to(e => e.name)));
|
|
23
|
+
(() => ProjectionCapabilities.validate(compiled, definition)).should.throw(UnsupportedProjectionOperation)
|
|
24
|
+
.with.property('message').that.includes("'$setOnce(name)'").and.includes('set once requires a kernel-backed test');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('when a read-model scenario targets dictionary entries', () => {
|
|
29
|
+
for (const [name, define] of [
|
|
30
|
+
['set', (builder: Parameters<Parameters<typeof compileDeclarative>[0]>[0]) => builder.from(Changed, _ => _.set(m => m.details, e => e.name).to(e => e.quantity))],
|
|
31
|
+
['remove', (builder: Parameters<Parameters<typeof compileDeclarative>[0]>[0]) => builder.from(Changed, _ => _.removeKey(m => m.details, DictionaryKey.causedBy('subject')))]
|
|
32
|
+
] as const) {
|
|
33
|
+
it(`should require a kernel-backed test to ${name} an entry`, () => {
|
|
34
|
+
const { compiled, definition } = compileDeclarative(define);
|
|
35
|
+
(() => ProjectionCapabilities.validate(compiled, definition)).should.throw(UnsupportedProjectionOperation)
|
|
36
|
+
.with.property('message').that.includes('dynamic or unknown destination paths require a kernel-backed test');
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('when a read-model scenario orders children', () => {
|
|
42
|
+
it('should require a kernel-backed test', () => {
|
|
43
|
+
const { compiled, definition } = compileDeclarative(builder => {
|
|
44
|
+
builder.from(Changed).children<{ lineId: string }>(model => model.labels as never, child => child
|
|
45
|
+
.identifiedBy(line => line.lineId)
|
|
46
|
+
.prepend()
|
|
47
|
+
.from(OrderedChildAdded, from => from.usingKey(event => event.itemId)));
|
|
48
|
+
}, [OrderedChildAdded]);
|
|
49
|
+
(() => ProjectionCapabilities.validate(compiled, definition)).should.throw(UnsupportedProjectionOperation)
|
|
50
|
+
.with.property('message').that.includes('Children.labels.Ordering').and.includes('prepended or sorted children');
|
|
51
|
+
});
|
|
52
|
+
});
|