@reventlessdev/reventless-local 3.0.0-alpha.113
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/CHANGELOG.md +1197 -0
- package/LICENSE +202 -0
- package/__mocks__/emptyModule.js +2 -0
- package/__mocks__/nodeSqlite.mjs +6 -0
- package/package.json +67 -0
- package/rescript.json +39 -0
- package/src/Platform.res +2162 -0
- package/src/Platform.res.mjs +3389 -0
- package/src/adapter/Api/LocalGraphQL_Adapter.res +29 -0
- package/src/adapter/Api/LocalGraphQL_Adapter.res.mjs +26 -0
- package/src/adapter/Api/LocalGraphQL_SubscriptionResolvers.res +146 -0
- package/src/adapter/Api/LocalGraphQL_SubscriptionResolvers.res.mjs +88 -0
- package/src/adapter/Auth/Auth_GraphqlContext.res +83 -0
- package/src/adapter/Auth/Auth_GraphqlContext.res.mjs +76 -0
- package/src/adapter/Auth/LocalAuth.res +239 -0
- package/src/adapter/Auth/LocalAuth.res.mjs +247 -0
- package/src/adapter/Auth/UserStore.res +134 -0
- package/src/adapter/Auth/UserStore.res.mjs +146 -0
- package/src/adapter/Backend.res +46 -0
- package/src/adapter/Backend.res.mjs +66 -0
- package/src/adapter/BackendState.res +34 -0
- package/src/adapter/BackendState.res.mjs +42 -0
- package/src/adapter/Cloner/LocalClonerRunner.res +13 -0
- package/src/adapter/Cloner/LocalClonerRunner.res.mjs +12 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_GraphQL.res +329 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_GraphQL.res.mjs +301 -0
- package/src/adapter/CommandGenerator/InboundTranslationResolvers_GraphQL.res +76 -0
- package/src/adapter/CommandGenerator/InboundTranslationResolvers_GraphQL.res.mjs +57 -0
- package/src/adapter/CommandGenerator/LocalCommandGeneratorResolvers.res +19 -0
- package/src/adapter/CommandGenerator/LocalCommandGeneratorResolvers.res.mjs +19 -0
- package/src/adapter/CommandTopic/LocalCommandTopicChannel.res +104 -0
- package/src/adapter/CommandTopic/LocalCommandTopicChannel.res.mjs +82 -0
- package/src/adapter/CommandTopic/LocalCommandTopicRemoteChannel.res +32 -0
- package/src/adapter/CommandTopic/LocalCommandTopicRemoteChannel.res.mjs +38 -0
- package/src/adapter/Counter/LocalCounterHandler.res +42 -0
- package/src/adapter/Counter/LocalCounterHandler.res.mjs +45 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_InMemory.res +131 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_InMemory.res.mjs +140 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_Sqlite.res +334 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_Sqlite.res.mjs +299 -0
- package/src/adapter/DomainGraphQL_Server.res +565 -0
- package/src/adapter/DomainGraphQL_Server.res.mjs +576 -0
- package/src/adapter/DomainMCP_Server.res +369 -0
- package/src/adapter/DomainMCP_Server.res.mjs +358 -0
- package/src/adapter/EventCollector/LocalEventCollectorChannel.res +87 -0
- package/src/adapter/EventCollector/LocalEventCollectorChannel.res.mjs +45 -0
- package/src/adapter/EventLog/EventLogStorage_InMemory.res +105 -0
- package/src/adapter/EventLog/EventLogStorage_InMemory.res.mjs +117 -0
- package/src/adapter/EventLog/EventLogStorage_Sqlite.res +145 -0
- package/src/adapter/EventLog/EventLogStorage_Sqlite.res.mjs +155 -0
- package/src/adapter/EventTopic/LocalEventTopicPublisher.res +36 -0
- package/src/adapter/EventTopic/LocalEventTopicPublisher.res.mjs +31 -0
- package/src/adapter/GraphQL_Server.res +6 -0
- package/src/adapter/GraphQL_Server.res.mjs +154 -0
- package/src/adapter/GraphQL_ServerInstance.res +310 -0
- package/src/adapter/GraphQL_ServerInstance.res.mjs +257 -0
- package/src/adapter/Heartbeat/LocalHeartbeatRunner.res +57 -0
- package/src/adapter/Heartbeat/LocalHeartbeatRunner.res.mjs +34 -0
- package/src/adapter/LocalBus.res +498 -0
- package/src/adapter/LocalBus.res.mjs +1011 -0
- package/src/adapter/LocalPluginSpec.res +16 -0
- package/src/adapter/LocalPluginSpec.res.mjs +33 -0
- package/src/adapter/LocalSideEffectHandler.res +44 -0
- package/src/adapter/LocalSideEffectHandler.res.mjs +34 -0
- package/src/adapter/MCP_Server.res +4 -0
- package/src/adapter/MCP_Server.res.mjs +67 -0
- package/src/adapter/MCP_ServerInstance.res +362 -0
- package/src/adapter/MCP_ServerInstance.res.mjs +313 -0
- package/src/adapter/PlatformGraphQL_Server.res +75 -0
- package/src/adapter/PlatformGraphQL_Server.res.mjs +84 -0
- package/src/adapter/PlatformMCP_Server.res +23 -0
- package/src/adapter/PlatformMCP_Server.res.mjs +46 -0
- package/src/adapter/QueryDb/QueryDbResolvers_GraphQL.res +793 -0
- package/src/adapter/QueryDb/QueryDbResolvers_GraphQL.res.mjs +569 -0
- package/src/adapter/QueryDb/QueryDbStorage_InMemory.res +242 -0
- package/src/adapter/QueryDb/QueryDbStorage_InMemory.res.mjs +241 -0
- package/src/adapter/QueryDb/QueryDbStorage_Sqlite.res +339 -0
- package/src/adapter/QueryDb/QueryDbStorage_Sqlite.res.mjs +318 -0
- package/src/adapter/QueryDb/SortKey_Filter.res +48 -0
- package/src/adapter/QueryDb/SortKey_Filter.res.mjs +46 -0
- package/src/adapter/QueryEngine/LocalQueryEngine.res +57 -0
- package/src/adapter/QueryEngine/LocalQueryEngine.res.mjs +56 -0
- package/src/adapter/Runtime/LocalAggregateRuntime_Builder.res +91 -0
- package/src/adapter/Runtime/LocalAggregateRuntime_Builder.res.mjs +50 -0
- package/src/adapter/Runtime/LocalEventCollectorRuntime_Builder.res +47 -0
- package/src/adapter/Runtime/LocalEventCollectorRuntime_Builder.res.mjs +37 -0
- package/src/adapter/Runtime/LocalPluginRuntime_Builder.res +11 -0
- package/src/adapter/Runtime/LocalPluginRuntime_Builder.res.mjs +30 -0
- package/src/adapter/Runtime/LocalRuntimeEnvironment.res +54 -0
- package/src/adapter/Runtime/LocalRuntimeEnvironment.res.mjs +40 -0
- package/src/adapter/Scheduler/LocalScheduledPublisher.res +102 -0
- package/src/adapter/Scheduler/LocalScheduledPublisher.res.mjs +84 -0
- package/src/adapter/SqliteDriver.res +52 -0
- package/src/adapter/SqliteDriver.res.mjs +76 -0
- package/src/adapter/SqliteDriver.resi +31 -0
- package/src/adapter/Task/LocalTaskBucket.res +75 -0
- package/src/adapter/Task/LocalTaskBucket.res.mjs +48 -0
- package/src/adapter/Task/TaskBucket_Sqlite.res +47 -0
- package/src/adapter/Task/TaskBucket_Sqlite.res.mjs +40 -0
- package/src/components/Aggregate_Builder.res +55 -0
- package/src/components/Aggregate_Builder.res.mjs +140 -0
- package/src/components/AutomationSlice_Builder.res +41 -0
- package/src/components/AutomationSlice_Builder.res.mjs +57 -0
- package/src/components/Counter_Builder.res +14 -0
- package/src/components/Counter_Builder.res.mjs +32 -0
- package/src/components/DcbEventLog_Builder.res +18 -0
- package/src/components/DcbEventLog_Builder.res.mjs +24 -0
- package/src/components/ExtensionPoint_Builder.res +25 -0
- package/src/components/ExtensionPoint_Builder.res.mjs +44 -0
- package/src/components/InboundTranslationSlice_Builder.res +34 -0
- package/src/components/InboundTranslationSlice_Builder.res.mjs +45 -0
- package/src/components/OutboundTranslationSlice_Builder.res +43 -0
- package/src/components/OutboundTranslationSlice_Builder.res.mjs +59 -0
- package/src/components/Plugin_Builder.res +37 -0
- package/src/components/Plugin_Builder.res.mjs +67 -0
- package/src/components/ReadModel_Builder.res +47 -0
- package/src/components/ReadModel_Builder.res.mjs +54 -0
- package/src/components/StateChangeSlice_Builder.res +19 -0
- package/src/components/StateChangeSlice_Builder.res.mjs +21 -0
- package/src/components/StateViewSlice_Builder.res +42 -0
- package/src/components/StateViewSlice_Builder.res.mjs +58 -0
- package/src/components/Task_Builder.res +28 -0
- package/src/components/Task_Builder.res.mjs +41 -0
- package/src/reexport/CommandTopic.res +3 -0
- package/src/reexport/CommandTopic.res.mjs +55 -0
- package/src/test/Mocks/MockDcbEventLogStorage.res +136 -0
- package/src/test/Mocks/MockDcbEventLogStorage.res.mjs +146 -0
- package/src/test/Mocks/MockEventLogStorage.res +57 -0
- package/src/test/Mocks/MockEventLogStorage.res.mjs +65 -0
- package/src/test/Mocks/MockPublisher.res +29 -0
- package/src/test/Mocks/MockPublisher.res.mjs +28 -0
- package/src/test/Mocks/MockQueryDbStorage.res +104 -0
- package/src/test/Mocks/MockQueryDbStorage.res.mjs +136 -0
- package/src/test/TestRunner.res +96 -0
- package/src/test/TestRunner.res.mjs +71 -0
- package/tests/SplitApiFixtures.res +84 -0
- package/tests/SplitApiFixtures.res.mjs +88 -0
- package/tests/SplitApiTest.res +102 -0
- package/tests/SplitApiTest.res.mjs +82 -0
- package/tests/TestFixtures.res +54 -0
- package/tests/TestFixtures.res.mjs +65 -0
- package/tests/adapter/BackendParityTest.res +94 -0
- package/tests/adapter/BackendParityTest.res.mjs +96 -0
- package/tests/adapter/CollectNEventsTest.res +82 -0
- package/tests/adapter/CollectNEventsTest.res.mjs +83 -0
- package/tests/adapter/CommandAuthorizationTest.res +200 -0
- package/tests/adapter/CommandAuthorizationTest.res.mjs +190 -0
- package/tests/adapter/CommandTopicChannelTest.res +174 -0
- package/tests/adapter/CommandTopicChannelTest.res.mjs +170 -0
- package/tests/adapter/CounterHandlerTest.res +113 -0
- package/tests/adapter/CounterHandlerTest.res.mjs +96 -0
- package/tests/adapter/DcbEventLogStorageSqliteTest.res +157 -0
- package/tests/adapter/DcbEventLogStorageSqliteTest.res.mjs +165 -0
- package/tests/adapter/DcbEventLogStorageTest.res +187 -0
- package/tests/adapter/DcbEventLogStorageTest.res.mjs +195 -0
- package/tests/adapter/EventCollectorChannelTest.res +166 -0
- package/tests/adapter/EventCollectorChannelTest.res.mjs +178 -0
- package/tests/adapter/EventLogStorageSqliteTest.res +105 -0
- package/tests/adapter/EventLogStorageSqliteTest.res.mjs +116 -0
- package/tests/adapter/EventTapTest.res +102 -0
- package/tests/adapter/EventTapTest.res.mjs +94 -0
- package/tests/adapter/EventTopicPublisherTest.res +76 -0
- package/tests/adapter/EventTopicPublisherTest.res.mjs +86 -0
- package/tests/adapter/GraphQL_SchemaInspectorTest.res +763 -0
- package/tests/adapter/GraphQL_SchemaInspectorTest.res.mjs +578 -0
- package/tests/adapter/GraphQL_SubscriptionResolversTest.res +161 -0
- package/tests/adapter/GraphQL_SubscriptionResolversTest.res.mjs +134 -0
- package/tests/adapter/HeartbeatRunnerTest.res +136 -0
- package/tests/adapter/HeartbeatRunnerTest.res.mjs +96 -0
- package/tests/adapter/LocalAuthHttpTest.res +224 -0
- package/tests/adapter/LocalAuthHttpTest.res.mjs +237 -0
- package/tests/adapter/LocalAuthLoginTest.res +180 -0
- package/tests/adapter/LocalAuthLoginTest.res.mjs +207 -0
- package/tests/adapter/LocalAuthTest.res +106 -0
- package/tests/adapter/LocalAuthTest.res.mjs +145 -0
- package/tests/adapter/LocalAuthUserStoreTest.res +172 -0
- package/tests/adapter/LocalAuthUserStoreTest.res.mjs +208 -0
- package/tests/adapter/LocalBusBoundedTest.res +157 -0
- package/tests/adapter/LocalBusBoundedTest.res.mjs +168 -0
- package/tests/adapter/LocalBusPubSubTest.res +81 -0
- package/tests/adapter/LocalBusPubSubTest.res.mjs +81 -0
- package/tests/adapter/QueryDbGsiTtlTest.res +268 -0
- package/tests/adapter/QueryDbGsiTtlTest.res.mjs +209 -0
- package/tests/adapter/QueryDbListResolverTest.res +361 -0
- package/tests/adapter/QueryDbListResolverTest.res.mjs +426 -0
- package/tests/adapter/QueryDbStorageSqliteTest.res +159 -0
- package/tests/adapter/QueryDbStorageSqliteTest.res.mjs +126 -0
- package/tests/adapter/QueryDbStorageTest.res +171 -0
- package/tests/adapter/QueryDbStorageTest.res.mjs +170 -0
- package/tests/adapter/QueryEngineTest.res +152 -0
- package/tests/adapter/QueryEngineTest.res.mjs +148 -0
- package/tests/adapter/ScheduledPublisherTest.res +199 -0
- package/tests/adapter/ScheduledPublisherTest.res.mjs +203 -0
- package/tests/adapter/SortKey_FilterTest.res +103 -0
- package/tests/adapter/SortKey_FilterTest.res.mjs +135 -0
- package/tests/adapter/SqliteDriverTest.res +86 -0
- package/tests/adapter/SqliteDriverTest.res.mjs +101 -0
- package/tests/adapter/TaskBucketSqliteTest.res +44 -0
- package/tests/adapter/TaskBucketSqliteTest.res.mjs +40 -0
- package/tests/adapter/TaskBucketTest.res +106 -0
- package/tests/adapter/TaskBucketTest.res.mjs +118 -0
- package/tests/components/aggregate/AggregateFixtures.res +78 -0
- package/tests/components/aggregate/AggregateFixtures.res.mjs +109 -0
- package/tests/components/aggregate/AggregateTest.res +129 -0
- package/tests/components/aggregate/AggregateTest.res.mjs +129 -0
- package/tests/components/automationslice/AutomationSliceCallbackTest.res +212 -0
- package/tests/components/automationslice/AutomationSliceCallbackTest.res.mjs +233 -0
- package/tests/components/automationslice/AutomationSliceFixtures.res +189 -0
- package/tests/components/automationslice/AutomationSliceFixtures.res.mjs +276 -0
- package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res +289 -0
- package/tests/components/automationslice/AutomationSliceSelfDeadlockFixtures.res.mjs +453 -0
- package/tests/components/automationslice/AutomationSliceSelfDeadlockTest.res +47 -0
- package/tests/components/automationslice/AutomationSliceSelfDeadlockTest.res.mjs +31 -0
- package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res +213 -0
- package/tests/components/automationslice/MixedSourceAutomationSliceFixtures.res.mjs +268 -0
- package/tests/components/automationslice/MixedSourceAutomationSliceTest.res +118 -0
- package/tests/components/automationslice/MixedSourceAutomationSliceTest.res.mjs +99 -0
- package/tests/components/commandgenerator/CommandGeneratorFixtures.res +73 -0
- package/tests/components/commandgenerator/CommandGeneratorFixtures.res.mjs +109 -0
- package/tests/components/commandgenerator/CommandGeneratorTest.res +43 -0
- package/tests/components/commandgenerator/CommandGeneratorTest.res.mjs +46 -0
- package/tests/components/commandtopic/CommandTopicFixtures.res +37 -0
- package/tests/components/commandtopic/CommandTopicFixtures.res.mjs +68 -0
- package/tests/components/commandtopic/CommandTopicStreamFixtures.res +43 -0
- package/tests/components/commandtopic/CommandTopicStreamFixtures.res.mjs +91 -0
- package/tests/components/commandtopic/CommandTopicStreamTest.res +30 -0
- package/tests/components/commandtopic/CommandTopicStreamTest.res.mjs +35 -0
- package/tests/components/commandtopic/CommandTopicTest.res +55 -0
- package/tests/components/commandtopic/CommandTopicTest.res.mjs +62 -0
- package/tests/components/counter/CounterFixtures.res +42 -0
- package/tests/components/counter/CounterFixtures.res.mjs +34 -0
- package/tests/components/counter/CounterTest.res +46 -0
- package/tests/components/counter/CounterTest.res.mjs +61 -0
- package/tests/components/dcb/DcbCrossPartitionFixtures.res +170 -0
- package/tests/components/dcb/DcbCrossPartitionFixtures.res.mjs +276 -0
- package/tests/components/dcb/DcbCrossPartitionReadTest.res +68 -0
- package/tests/components/dcb/DcbCrossPartitionReadTest.res.mjs +78 -0
- package/tests/components/dcb/DcbEventLogAppendStreamTest.res +72 -0
- package/tests/components/dcb/DcbEventLogAppendStreamTest.res.mjs +82 -0
- package/tests/components/dcb/DcbEventLogStreamTest.res +103 -0
- package/tests/components/dcb/DcbEventLogStreamTest.res.mjs +91 -0
- package/tests/components/dcb/DcbFixtures.res +145 -0
- package/tests/components/dcb/DcbFixtures.res.mjs +221 -0
- package/tests/components/dcb/DcbTest.res +55 -0
- package/tests/components/dcb/DcbTest.res.mjs +55 -0
- package/tests/components/eventcollector/EventCollectorFixtures.res +42 -0
- package/tests/components/eventcollector/EventCollectorFixtures.res.mjs +49 -0
- package/tests/components/eventcollector/EventCollectorTest.res +37 -0
- package/tests/components/eventcollector/EventCollectorTest.res.mjs +36 -0
- package/tests/components/eventlog/EventLogAppendStreamTest.res +93 -0
- package/tests/components/eventlog/EventLogAppendStreamTest.res.mjs +113 -0
- package/tests/components/eventlog/EventLogConflictTest.res +86 -0
- package/tests/components/eventlog/EventLogConflictTest.res.mjs +81 -0
- package/tests/components/eventlog/EventLogFixtures.res +52 -0
- package/tests/components/eventlog/EventLogFixtures.res.mjs +80 -0
- package/tests/components/eventlog/EventLogStreamTest.res +98 -0
- package/tests/components/eventlog/EventLogStreamTest.res.mjs +142 -0
- package/tests/components/eventlog/EventLogTest.res +53 -0
- package/tests/components/eventlog/EventLogTest.res.mjs +74 -0
- package/tests/components/eventtopic/EventTopicFixtures.res +47 -0
- package/tests/components/eventtopic/EventTopicFixtures.res.mjs +77 -0
- package/tests/components/eventtopic/EventTopicStreamFixtures.res +27 -0
- package/tests/components/eventtopic/EventTopicStreamFixtures.res.mjs +62 -0
- package/tests/components/eventtopic/EventTopicStreamTest.res +35 -0
- package/tests/components/eventtopic/EventTopicStreamTest.res.mjs +44 -0
- package/tests/components/eventtopic/EventTopicTest.res +35 -0
- package/tests/components/eventtopic/EventTopicTest.res.mjs +43 -0
- package/tests/components/extensionpoint/ExtensionPointFixtures.res +145 -0
- package/tests/components/extensionpoint/ExtensionPointFixtures.res.mjs +188 -0
- package/tests/components/extensionpoint/ExtensionPointTest.res +62 -0
- package/tests/components/extensionpoint/ExtensionPointTest.res.mjs +55 -0
- package/tests/components/heartbeat/HeartbeatFixtures.res +48 -0
- package/tests/components/heartbeat/HeartbeatFixtures.res.mjs +46 -0
- package/tests/components/heartbeat/HeartbeatTest.res +67 -0
- package/tests/components/heartbeat/HeartbeatTest.res.mjs +65 -0
- package/tests/components/inboundtranslationslice/InboundTranslationSliceCallbackTest.res +241 -0
- package/tests/components/inboundtranslationslice/InboundTranslationSliceCallbackTest.res.mjs +239 -0
- package/tests/components/inboundtranslationslice/InboundTranslationSliceFixtures.res +36 -0
- package/tests/components/inboundtranslationslice/InboundTranslationSliceFixtures.res.mjs +73 -0
- package/tests/components/outboundtranslationslice/OutboundTranslationSliceCallbackTest.res +191 -0
- package/tests/components/outboundtranslationslice/OutboundTranslationSliceCallbackTest.res.mjs +297 -0
- package/tests/components/outboundtranslationslice/OutboundTranslationSliceFixtures.res +78 -0
- package/tests/components/outboundtranslationslice/OutboundTranslationSliceFixtures.res.mjs +137 -0
- package/tests/components/querydb/QueryDbFixtures.res +39 -0
- package/tests/components/querydb/QueryDbFixtures.res.mjs +73 -0
- package/tests/components/querydb/QueryDbSubIdFixtures.res +44 -0
- package/tests/components/querydb/QueryDbSubIdFixtures.res.mjs +80 -0
- package/tests/components/querydb/QueryDbSubIdTest.res +104 -0
- package/tests/components/querydb/QueryDbSubIdTest.res.mjs +104 -0
- package/tests/components/querydb/QueryDbTest.res +81 -0
- package/tests/components/querydb/QueryDbTest.res.mjs +126 -0
- package/tests/components/readmodel/DcbReadModelE2EFixtures.res +215 -0
- package/tests/components/readmodel/DcbReadModelE2EFixtures.res.mjs +308 -0
- package/tests/components/readmodel/DcbReadModelE2ETest.res +45 -0
- package/tests/components/readmodel/DcbReadModelE2ETest.res.mjs +37 -0
- package/tests/components/readmodel/DcbReadModelTypoFailFastTest.res +88 -0
- package/tests/components/readmodel/DcbReadModelTypoFailFastTest.res.mjs +152 -0
- package/tests/components/readmodel/MixedSourceReadModelFixtures.res +181 -0
- package/tests/components/readmodel/MixedSourceReadModelFixtures.res.mjs +277 -0
- package/tests/components/readmodel/MixedSourceReadModelTest.res +61 -0
- package/tests/components/readmodel/MixedSourceReadModelTest.res.mjs +68 -0
- package/tests/components/readmodel/ReadModelFixtures.res +138 -0
- package/tests/components/readmodel/ReadModelFixtures.res.mjs +169 -0
- package/tests/components/readmodel/ReadModelTest.res +46 -0
- package/tests/components/readmodel/ReadModelTest.res.mjs +36 -0
- package/tests/components/scheduler/SchedulerFixtures.res +59 -0
- package/tests/components/scheduler/SchedulerFixtures.res.mjs +63 -0
- package/tests/components/scheduler/SchedulerTest.res +76 -0
- package/tests/components/scheduler/SchedulerTest.res.mjs +86 -0
- package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res +133 -0
- package/tests/components/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +149 -0
- package/tests/components/sideeffecthandler/SideEffectHandlerTest.res +39 -0
- package/tests/components/sideeffecthandler/SideEffectHandlerTest.res.mjs +28 -0
- package/tests/components/stateviewslice/StateViewSliceFixtures.res +117 -0
- package/tests/components/stateviewslice/StateViewSliceFixtures.res.mjs +188 -0
- package/tests/components/stateviewslice/StateViewSliceSubIdFixtures.res +117 -0
- package/tests/components/stateviewslice/StateViewSliceSubIdFixtures.res.mjs +183 -0
- package/tests/components/stateviewslice/StateViewSliceSubIdTest.res +78 -0
- package/tests/components/stateviewslice/StateViewSliceSubIdTest.res.mjs +107 -0
- package/tests/components/stateviewslice/StateViewSliceTest.res +59 -0
- package/tests/components/stateviewslice/StateViewSliceTest.res.mjs +72 -0
- package/tests/components/task/TaskFixtures.res +87 -0
- package/tests/components/task/TaskFixtures.res.mjs +82 -0
- package/tests/components/task/TaskTest.res +98 -0
- package/tests/components/task/TaskTest.res.mjs +46 -0
- package/tests/plugin/PluginBehavior_GWT.res +146 -0
- package/tests/plugin/PluginBehavior_GWT.res.mjs +281 -0
- package/tests/plugin/Plugin_Fixtures.res +61 -0
- package/tests/plugin/Plugin_Fixtures.res.mjs +105 -0
- package/tests/plugin/PluginsProjection_GWT.res +95 -0
- package/tests/plugin/PluginsProjection_GWT.res.mjs +120 -0
- package/tests/plugin/UIFragmentRegistryProjection_GWT.res +72 -0
- package/tests/plugin/UIFragmentRegistryProjection_GWT.res.mjs +117 -0
- package/tests/setup/sqliteGlobal.cjs +12 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
4
|
+
import * as DcbReadModelE2EFixtures$ReventlessLocal from "./DcbReadModelE2EFixtures.res.mjs";
|
|
5
|
+
|
|
6
|
+
globalThis.describe("DCB → ReadModel E2E:", () => {
|
|
7
|
+
globalThis.beforeAll(async () => {
|
|
8
|
+
await TestRunner$ReventlessLocal.resolve(DcbReadModelE2EFixtures$ReventlessLocal.DcbLogMaker.operations(DcbReadModelE2EFixtures$ReventlessLocal.dcbEventLog));
|
|
9
|
+
await TestRunner$ReventlessLocal.resolve(DcbReadModelE2EFixtures$ReventlessLocal.ProductsReadModel.operations(DcbReadModelE2EFixtures$ReventlessLocal.rm));
|
|
10
|
+
let resource = DcbReadModelE2EFixtures$ReventlessLocal.dcbTopicOutputs.resources[0];
|
|
11
|
+
await TestRunner$ReventlessLocal.resolve(resource.name);
|
|
12
|
+
});
|
|
13
|
+
globalThis.test("AddProduct command updates the ReadModel state", async () => {
|
|
14
|
+
await DcbReadModelE2EFixtures$ReventlessLocal.dispatch(DcbReadModelE2EFixtures$ReventlessLocal.addProductCmd("prod-1", "Laptop"), "prod-1");
|
|
15
|
+
let states = await DcbReadModelE2EFixtures$ReventlessLocal.loadState("prod-1");
|
|
16
|
+
globalThis.expect(states.length).toBe(1);
|
|
17
|
+
let state = states[0];
|
|
18
|
+
globalThis.expect(state.productId).toBe("prod-1");
|
|
19
|
+
globalThis.expect(state.name).toBe("Laptop");
|
|
20
|
+
});
|
|
21
|
+
globalThis.test("second AddProduct for the same id is a no-op (decide returns Error)", async () => {
|
|
22
|
+
await DcbReadModelE2EFixtures$ReventlessLocal.dispatch(DcbReadModelE2EFixtures$ReventlessLocal.addProductCmd("prod-1", "Different name"), "prod-1");
|
|
23
|
+
let states = await DcbReadModelE2EFixtures$ReventlessLocal.loadState("prod-1");
|
|
24
|
+
globalThis.expect(states.length).toBe(1);
|
|
25
|
+
let state = states[0];
|
|
26
|
+
globalThis.expect(state.name).toBe("Laptop");
|
|
27
|
+
});
|
|
28
|
+
globalThis.test("a different product id gets its own entry", async () => {
|
|
29
|
+
await DcbReadModelE2EFixtures$ReventlessLocal.dispatch(DcbReadModelE2EFixtures$ReventlessLocal.addProductCmd("prod-2", "Headphones"), "prod-2");
|
|
30
|
+
let states = await DcbReadModelE2EFixtures$ReventlessLocal.loadState("prod-2");
|
|
31
|
+
globalThis.expect(states.length).toBe(1);
|
|
32
|
+
let state = states[0];
|
|
33
|
+
globalThis.expect(state.name).toBe("Headphones");
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Verifies Phase 2 of Plan 03: a ReadModel whose `Mapping.sourceName` doesn't
|
|
2
|
+
// match any key in `allEventTopics` fails plugin assembly (here: ReadModel
|
|
3
|
+
// construction) with a clear error, instead of silently producing zero events.
|
|
4
|
+
|
|
5
|
+
open JestGlobals
|
|
6
|
+
open Reventless
|
|
7
|
+
open Reventless.Projection
|
|
8
|
+
|
|
9
|
+
// ─────────────────────────────────────────────────────────────
|
|
10
|
+
// Bus setup (isolated from the happy-path E2E test)
|
|
11
|
+
// ─────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
module Bus = LocalBus.Make()
|
|
14
|
+
let _ = TestRunner.setup()
|
|
15
|
+
|
|
16
|
+
// ─────────────────────────────────────────────────────────────
|
|
17
|
+
// Source whose name DOES NOT match any key in allEventTopics
|
|
18
|
+
// (intentional typo: "MissingDcb" vs the real "ProductCatalogDcbEventLog")
|
|
19
|
+
// ─────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
module TypoSource = {
|
|
22
|
+
module Id = Reventless.Id.String
|
|
23
|
+
let name = "MissingDcb"
|
|
24
|
+
|
|
25
|
+
@schema
|
|
26
|
+
type event = ProductAdded({productId: string, name: string})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module RmSpec = {
|
|
30
|
+
module Id = Reventless.Id.String
|
|
31
|
+
let name = "TypoCheckReadModel"
|
|
32
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
33
|
+
|
|
34
|
+
@schema
|
|
35
|
+
type state = {productId: string, name: string}
|
|
36
|
+
|
|
37
|
+
let config = ReadModel.config()
|
|
38
|
+
let subIdConfig = None
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module TypoMapping = Mapping.Make(
|
|
42
|
+
TypoSource,
|
|
43
|
+
RmSpec,
|
|
44
|
+
{
|
|
45
|
+
let project = (msg: Message.event'<string, TypoSource.event>) =>
|
|
46
|
+
switch msg.event {
|
|
47
|
+
| ProductAdded({productId, name}) => Set(productId, ({productId, name}: RmSpec.state))
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
module TypoMappings: Mappings with module Target := RmSpec = {
|
|
53
|
+
module Mappings = Mappings.Make(RmSpec)
|
|
54
|
+
module type Mapping = Mappings.Mapping
|
|
55
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
56
|
+
let mappings: array<module(Mapping)> = [module(TypoMapping)]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// allEventTopics has ONE entry — but with a different key than the Mapping uses.
|
|
60
|
+
let topicResource: ReventlessInfra.Adapter.resource = ReventlessInfra.Adapter.make(
|
|
61
|
+
~name="ProductCatalogDcbEventLog"->Pulumi.Output.make,
|
|
62
|
+
~id="ProductCatalogDcbEventLog"->Pulumi.Output.make,
|
|
63
|
+
~urn="ProductCatalogDcbEventLog"->Pulumi.Output.make,
|
|
64
|
+
~service="memory:InMemory"->Pulumi.Output.make,
|
|
65
|
+
)
|
|
66
|
+
let allEventTopics: ReventlessInfra.EventTopic.allOutputs = Dict.fromArray([
|
|
67
|
+
("ProductCatalogDcbEventLog", {ReventlessInfra.EventTopic.resources: [topicResource]}),
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
module ReadModelMaker = ReadModel_Builder.Make(Bus)
|
|
71
|
+
module RmMaker = ReadModelMaker.Make(RmSpec, TypoMappings)
|
|
72
|
+
|
|
73
|
+
describe("ReadModel source-name fail-fast:", () => {
|
|
74
|
+
testSync("constructing a ReadModel whose Mapping.sourceName is missing throws", () => {
|
|
75
|
+
let threw = ref(false)
|
|
76
|
+
let msg = ref("")
|
|
77
|
+
try {
|
|
78
|
+
let _ = RmMaker.make(~api=(), ~apiRole=(), ~allEventTopics)
|
|
79
|
+
} catch {
|
|
80
|
+
| JsExn(err) =>
|
|
81
|
+
threw := true
|
|
82
|
+
msg := err->JsExn.message->Option.getOr("")
|
|
83
|
+
}
|
|
84
|
+
expect(threw.contents)->toBe(true)->ignore
|
|
85
|
+
expect(msg.contents->String.includes("MissingDcb"))->toBe(true)->ignore
|
|
86
|
+
expect(msg.contents->String.includes("ProductCatalogDcbEventLog"))->toBe(true)
|
|
87
|
+
})
|
|
88
|
+
})
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
5
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
6
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
8
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
9
|
+
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
10
|
+
import * as Projection$Reventless from "@reventlessdev/reventless-spec/src/types/Projection.res.mjs";
|
|
11
|
+
import * as Adapter$ReventlessInfra from "@reventlessdev/reventless-infra/src/adapter/Adapter.res.mjs";
|
|
12
|
+
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
13
|
+
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
14
|
+
import * as ReadModel_Builder$ReventlessLocal from "../../../src/components/ReadModel_Builder.res.mjs";
|
|
15
|
+
|
|
16
|
+
let Bus = LocalBus$ReventlessLocal.Make({});
|
|
17
|
+
|
|
18
|
+
TestRunner$ReventlessLocal.setup();
|
|
19
|
+
|
|
20
|
+
let name = "MissingDcb";
|
|
21
|
+
|
|
22
|
+
let eventSchema = S.schema(s => ({
|
|
23
|
+
TAG: "ProductAdded",
|
|
24
|
+
productId: s.m(S.string),
|
|
25
|
+
name: s.m(S.string)
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
let TypoSource = {
|
|
29
|
+
Id: undefined,
|
|
30
|
+
name: name,
|
|
31
|
+
eventSchema: eventSchema
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
let name$1 = "TypoCheckReadModel";
|
|
35
|
+
|
|
36
|
+
let moduleUrl = import.meta.url;
|
|
37
|
+
|
|
38
|
+
let stateSchema = S.schema(s => ({
|
|
39
|
+
productId: s.m(S.string),
|
|
40
|
+
name: s.m(S.string)
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
44
|
+
|
|
45
|
+
let RmSpec = {
|
|
46
|
+
Id: undefined,
|
|
47
|
+
name: name$1,
|
|
48
|
+
moduleUrl: moduleUrl,
|
|
49
|
+
stateSchema: stateSchema,
|
|
50
|
+
config: config,
|
|
51
|
+
subIdConfig: undefined,
|
|
52
|
+
authorization: "AllowAuthenticated",
|
|
53
|
+
visibility: "Public"
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function project(msg) {
|
|
57
|
+
let match = msg.event;
|
|
58
|
+
let productId = match.productId;
|
|
59
|
+
return {
|
|
60
|
+
TAG: "Set",
|
|
61
|
+
_0: productId,
|
|
62
|
+
_1: {
|
|
63
|
+
productId: productId,
|
|
64
|
+
name: match.name
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let TypoMapping = Projection$Reventless.Mapping.Make({
|
|
70
|
+
Id: Id$Reventless.$$String,
|
|
71
|
+
name: name,
|
|
72
|
+
eventSchema: eventSchema
|
|
73
|
+
})({
|
|
74
|
+
Id: Id$Reventless.$$String,
|
|
75
|
+
name: name$1,
|
|
76
|
+
stateSchema: stateSchema,
|
|
77
|
+
subIdConfig: undefined
|
|
78
|
+
})({
|
|
79
|
+
project: project
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
Projection$Reventless.Mappings.Make({
|
|
83
|
+
Id: Id$Reventless.$$String,
|
|
84
|
+
name: name$1,
|
|
85
|
+
stateSchema: stateSchema,
|
|
86
|
+
subIdConfig: undefined
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
let moduleUrl$1 = import.meta.url;
|
|
90
|
+
|
|
91
|
+
let mappings = [TypoMapping];
|
|
92
|
+
|
|
93
|
+
let TypoMappings = {
|
|
94
|
+
moduleUrl: moduleUrl$1,
|
|
95
|
+
mappings: mappings
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
let topicResource = Adapter$ReventlessInfra.make(Pulumi.output("ProductCatalogDcbEventLog"), Pulumi.output("ProductCatalogDcbEventLog"), Pulumi.output("ProductCatalogDcbEventLog"), Pulumi.output("memory:InMemory"), undefined, undefined, undefined, undefined, undefined, undefined);
|
|
99
|
+
|
|
100
|
+
let allEventTopics = Object.fromEntries([[
|
|
101
|
+
"ProductCatalogDcbEventLog",
|
|
102
|
+
{
|
|
103
|
+
resources: [topicResource]
|
|
104
|
+
}
|
|
105
|
+
]]);
|
|
106
|
+
|
|
107
|
+
let ReadModelMaker = ReadModel_Builder$ReventlessLocal.Make(Bus);
|
|
108
|
+
|
|
109
|
+
let RmMaker = ReadModelMaker.Make({
|
|
110
|
+
Id: Id$Reventless.$$String,
|
|
111
|
+
name: name$1,
|
|
112
|
+
moduleUrl: moduleUrl,
|
|
113
|
+
stateSchema: stateSchema,
|
|
114
|
+
config: config,
|
|
115
|
+
subIdConfig: undefined,
|
|
116
|
+
authorization: "AllowAuthenticated",
|
|
117
|
+
visibility: "Public"
|
|
118
|
+
})(TypoMappings);
|
|
119
|
+
|
|
120
|
+
globalThis.describe("ReadModel source-name fail-fast:", () => {
|
|
121
|
+
globalThis.test("constructing a ReadModel whose Mapping.sourceName is missing throws", () => {
|
|
122
|
+
let threw = false;
|
|
123
|
+
let msg = "";
|
|
124
|
+
try {
|
|
125
|
+
RmMaker.make(undefined, undefined, allEventTopics, undefined);
|
|
126
|
+
} catch (raw_err) {
|
|
127
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
128
|
+
if (err.RE_EXN_ID === "JsExn") {
|
|
129
|
+
threw = true;
|
|
130
|
+
msg = Stdlib_Option.getOr(Stdlib_JsExn.message(err._1), "");
|
|
131
|
+
} else {
|
|
132
|
+
throw err;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
globalThis.expect(threw).toBe(true);
|
|
136
|
+
globalThis.expect(msg.includes("MissingDcb")).toBe(true);
|
|
137
|
+
globalThis.expect(msg.includes("ProductCatalogDcbEventLog")).toBe(true);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
Bus,
|
|
143
|
+
TypoSource,
|
|
144
|
+
RmSpec,
|
|
145
|
+
TypoMapping,
|
|
146
|
+
TypoMappings,
|
|
147
|
+
topicResource,
|
|
148
|
+
allEventTopics,
|
|
149
|
+
ReadModelMaker,
|
|
150
|
+
RmMaker,
|
|
151
|
+
}
|
|
152
|
+
/* Bus Not a pure module */
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Fixtures for testing a ReadModel that subscribes to two independent event sources.
|
|
2
|
+
// Verifies the mixed-source capability where Plugin_Builder merges both aggregate
|
|
3
|
+
// and DCB EventTopics into allEventTopics (Step 1.1 of hybrid improvements).
|
|
4
|
+
|
|
5
|
+
open TestFixtures
|
|
6
|
+
open Reventless
|
|
7
|
+
open Reventless.Projection
|
|
8
|
+
|
|
9
|
+
// ─────────────────────────────────────────────────────────────
|
|
10
|
+
// ReadModel spec — unified view combining events from two sources
|
|
11
|
+
// ─────────────────────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
module MixedReadModelSpec = {
|
|
14
|
+
module Id = Reventless.Id.String
|
|
15
|
+
let name = "TestMixedReadModel"
|
|
16
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
17
|
+
|
|
18
|
+
@schema
|
|
19
|
+
type state = {
|
|
20
|
+
name: string,
|
|
21
|
+
source: string,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let config = ReadModel.config()
|
|
25
|
+
let subIdConfig = None
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ─────────────────────────────────────────────────────────────
|
|
29
|
+
// Source 1: simulates an aggregate EventTopic
|
|
30
|
+
// ─────────────────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
module AggregateSource = {
|
|
33
|
+
module Id = Reventless.Id.String
|
|
34
|
+
let name = "TestAggregateEventTopic"
|
|
35
|
+
|
|
36
|
+
@schema
|
|
37
|
+
type event =
|
|
38
|
+
| AggregateItemCreated({name: string})
|
|
39
|
+
| AggregateItemRenamed({name: string})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ─────────────────────────────────────────────────────────────
|
|
43
|
+
// Source 2: simulates a DCB EventTopic
|
|
44
|
+
// ─────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
module DcbSource = {
|
|
47
|
+
module Id = Reventless.Id.String
|
|
48
|
+
let name = "TestDcbEventTopic"
|
|
49
|
+
|
|
50
|
+
@schema
|
|
51
|
+
type event =
|
|
52
|
+
| DcbItemAdded({name: string})
|
|
53
|
+
| DcbItemNameChanged({name: string})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ─────────────────────────────────────────────────────────────
|
|
57
|
+
// Mapping 1: Aggregate events → ReadModel state
|
|
58
|
+
// ─────────────────────────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
module AggregateMapping = Mapping.Make(
|
|
61
|
+
AggregateSource,
|
|
62
|
+
MixedReadModelSpec,
|
|
63
|
+
{
|
|
64
|
+
let project = (msg: Message.event'<string, AggregateSource.event>) =>
|
|
65
|
+
switch msg.event {
|
|
66
|
+
| AggregateItemCreated({name}) =>
|
|
67
|
+
Create(msg.id, ({name, source: "aggregate"}: MixedReadModelSpec.state))
|
|
68
|
+
| AggregateItemRenamed({name}) => Update(msg.id, state => {...state, name})
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
// ─────────────────────────────────────────────────────────────
|
|
74
|
+
// Mapping 2: DCB events → ReadModel state
|
|
75
|
+
// ─────────────────────────────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
module DcbMapping = Mapping.Make(
|
|
78
|
+
DcbSource,
|
|
79
|
+
MixedReadModelSpec,
|
|
80
|
+
{
|
|
81
|
+
let project = (msg: Message.event'<string, DcbSource.event>) =>
|
|
82
|
+
switch msg.event {
|
|
83
|
+
| DcbItemAdded({name}) =>
|
|
84
|
+
Create(msg.id, ({name, source: "dcb"}: MixedReadModelSpec.state))
|
|
85
|
+
| DcbItemNameChanged({name}) => Update(msg.id, state => {...state, name})
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
// ─────────────────────────────────────────────────────────────
|
|
91
|
+
// Mappings module with both sources
|
|
92
|
+
// ─────────────────────────────────────────────────────────────
|
|
93
|
+
|
|
94
|
+
module MixedMappings: Mappings with module Target := MixedReadModelSpec = {
|
|
95
|
+
module Mappings = Mappings.Make(MixedReadModelSpec)
|
|
96
|
+
module type Mapping = Mappings.Mapping
|
|
97
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
98
|
+
let mappings: array<module(Mapping)> = [module(AggregateMapping), module(DcbMapping)]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ─────────────────────────────────────────────────────────────
|
|
102
|
+
// allEventTopics — two entries, one per source
|
|
103
|
+
// ─────────────────────────────────────────────────────────────
|
|
104
|
+
|
|
105
|
+
let aggregateTopicName = "TestAggregateEventTopic"
|
|
106
|
+
let dcbTopicName = "TestDcbEventTopic"
|
|
107
|
+
|
|
108
|
+
let aggregateResource: ReventlessInfra.Adapter.resource = ReventlessInfra.Adapter.make(
|
|
109
|
+
~name=aggregateTopicName->Pulumi.Output.make,
|
|
110
|
+
~id=aggregateTopicName->Pulumi.Output.make,
|
|
111
|
+
~urn=aggregateTopicName->Pulumi.Output.make,
|
|
112
|
+
~service="memory:InMemory"->Pulumi.Output.make,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
let dcbResource: ReventlessInfra.Adapter.resource = ReventlessInfra.Adapter.make(
|
|
116
|
+
~name=dcbTopicName->Pulumi.Output.make,
|
|
117
|
+
~id=dcbTopicName->Pulumi.Output.make,
|
|
118
|
+
~urn=dcbTopicName->Pulumi.Output.make,
|
|
119
|
+
~service="memory:InMemory"->Pulumi.Output.make,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
let allEventTopics: ReventlessCore.EventTopic.allOutputs = Dict.fromArray([
|
|
123
|
+
(aggregateTopicName, {ReventlessInfra.EventTopic.resources: [aggregateResource]}),
|
|
124
|
+
(dcbTopicName, {ReventlessInfra.EventTopic.resources: [dcbResource]}),
|
|
125
|
+
])
|
|
126
|
+
|
|
127
|
+
// ─────────────────────────────────────────────────────────────
|
|
128
|
+
// Isolated bus + Pulumi mock mode
|
|
129
|
+
// ─────────────────────────────────────────────────────────────
|
|
130
|
+
|
|
131
|
+
module Bus = LocalBus.Make()
|
|
132
|
+
let _ = TestRunner.setup()
|
|
133
|
+
|
|
134
|
+
// ─────────────────────────────────────────────────────────────
|
|
135
|
+
// Build ReadModel
|
|
136
|
+
// ─────────────────────────────────────────────────────────────
|
|
137
|
+
|
|
138
|
+
module ReadModelMaker = ReadModel_Builder.Make(Bus)
|
|
139
|
+
module MixedRM = ReadModelMaker.Make(MixedReadModelSpec, MixedMappings)
|
|
140
|
+
let rm = MixedRM.make(~api=(), ~apiRole=(), ~allEventTopics)
|
|
141
|
+
|
|
142
|
+
// ─────────────────────────────────────────────────────────────
|
|
143
|
+
// Test helpers
|
|
144
|
+
// ─────────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
let publishAggregateEvent = async (id, event: AggregateSource.event) => {
|
|
147
|
+
let meta = makeTestMeta(~service="TestAggregateEventTopic")
|
|
148
|
+
let eventJson = JSON.Encode.object(
|
|
149
|
+
Dict.fromArray([
|
|
150
|
+
("id", id->JSON.Encode.string),
|
|
151
|
+
("meta", meta->S.reverseConvertToJsonOrThrow(Message.metaSchema)),
|
|
152
|
+
("event", event->S.reverseConvertToJsonOrThrow(AggregateSource.eventSchema)),
|
|
153
|
+
]),
|
|
154
|
+
)
|
|
155
|
+
await Bus.publishEvent(aggregateTopicName, "test", meta, eventJson)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
let publishDcbEvent = async (id, event: DcbSource.event) => {
|
|
159
|
+
let meta = makeTestMeta(~service="TestDcbEventTopic")
|
|
160
|
+
let eventJson = JSON.Encode.object(
|
|
161
|
+
Dict.fromArray([
|
|
162
|
+
("id", id->JSON.Encode.string),
|
|
163
|
+
("meta", meta->S.reverseConvertToJsonOrThrow(Message.metaSchema)),
|
|
164
|
+
("event", event->S.reverseConvertToJsonOrThrow(DcbSource.eventSchema)),
|
|
165
|
+
]),
|
|
166
|
+
)
|
|
167
|
+
await Bus.publishEvent(dcbTopicName, "test", meta, eventJson)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let loadState = async id => {
|
|
171
|
+
switch Bus.getQueryDb("TestMixedReadModel") {
|
|
172
|
+
| None => []
|
|
173
|
+
| Some(ops) =>
|
|
174
|
+
let states =
|
|
175
|
+
await ops.loadStream(id)
|
|
176
|
+
->Stream.runCollect
|
|
177
|
+
->Effect.catchAll(_ => Effect.succeed([]))
|
|
178
|
+
->Effect.runPromise
|
|
179
|
+
states->Array.map(json => json->S.parseJsonOrThrow(MixedReadModelSpec.stateSchema))
|
|
180
|
+
}
|
|
181
|
+
}
|