@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,221 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Stream from "effect/Stream";
|
|
8
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
9
|
+
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
10
|
+
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
11
|
+
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
12
|
+
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
13
|
+
import * as CommandTopic$ReventlessCore from "@reventlessdev/reventless-core/src/components/CommandTopic/CommandTopic.res.mjs";
|
|
14
|
+
import * as TestFixtures$ReventlessLocal from "../../TestFixtures.res.mjs";
|
|
15
|
+
import * as DcbEventLog_Builder$ReventlessLocal from "../../../src/components/DcbEventLog_Builder.res.mjs";
|
|
16
|
+
import * as StateChangeSlice_Builder$ReventlessLocal from "../../../src/components/StateChangeSlice_Builder.res.mjs";
|
|
17
|
+
|
|
18
|
+
let eventSchema = S.schema(s => ({
|
|
19
|
+
TAG: "ItemAdded",
|
|
20
|
+
id: s.m(DcbTag$Reventless.string),
|
|
21
|
+
name: s.m(S.string)
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
let ItemEventLog = {
|
|
25
|
+
eventSchema: eventSchema
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
let name = "AddItem";
|
|
29
|
+
|
|
30
|
+
let moduleUrl = import.meta.url;
|
|
31
|
+
|
|
32
|
+
let eventSchema$1 = S.schema(s => ({
|
|
33
|
+
TAG: "ItemAdded",
|
|
34
|
+
id: s.m(DcbTag$Reventless.string),
|
|
35
|
+
name: s.m(S.string)
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
let consumedEventSchema = S.literal("ItemAdded");
|
|
39
|
+
|
|
40
|
+
let commandSchema = S.schema(s => ({
|
|
41
|
+
TAG: "AddItem",
|
|
42
|
+
id: s.m(DcbTag$Reventless.string),
|
|
43
|
+
name: s.m(S.string)
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
let errorSchema = S.literal("ItemAlreadyExists");
|
|
47
|
+
|
|
48
|
+
function commandAuthorization(param) {
|
|
49
|
+
return "AllowAuthenticated";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let AddItemSpec = {
|
|
53
|
+
name: name,
|
|
54
|
+
Id: undefined,
|
|
55
|
+
moduleUrl: moduleUrl,
|
|
56
|
+
eventSchema: eventSchema$1,
|
|
57
|
+
consumedEventSchema: consumedEventSchema,
|
|
58
|
+
errorSchema: errorSchema,
|
|
59
|
+
commandSchema: commandSchema,
|
|
60
|
+
commandAuthorization: commandAuthorization,
|
|
61
|
+
readConsistency: "EscalateOnRetry"
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
let moduleUrl$1 = import.meta.url;
|
|
65
|
+
|
|
66
|
+
function evolve(_state, _event) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function decide(state, command) {
|
|
71
|
+
if (state) {
|
|
72
|
+
return {
|
|
73
|
+
TAG: "Error",
|
|
74
|
+
_0: "ItemAlreadyExists"
|
|
75
|
+
};
|
|
76
|
+
} else {
|
|
77
|
+
return {
|
|
78
|
+
TAG: "Ok",
|
|
79
|
+
_0: [{
|
|
80
|
+
TAG: "ItemAdded",
|
|
81
|
+
id: command.id,
|
|
82
|
+
name: command.name
|
|
83
|
+
}]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let AddItemBehavior = {
|
|
89
|
+
Spec: undefined,
|
|
90
|
+
moduleUrl: moduleUrl$1,
|
|
91
|
+
initialState: false,
|
|
92
|
+
evolve: evolve,
|
|
93
|
+
decide: decide
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
let Bus = LocalBus$ReventlessLocal.Make({});
|
|
97
|
+
|
|
98
|
+
let capturedEventCount = {
|
|
99
|
+
contents: 0
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
Bus.subscribeToEvents("ItemEventLogEventTopic", async (param, param$1, param$2) => {
|
|
103
|
+
capturedEventCount.contents = capturedEventCount.contents + 1 | 0;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
TestRunner$ReventlessLocal.setup();
|
|
107
|
+
|
|
108
|
+
let ItemEventLogMaker = DcbEventLog_Builder$ReventlessLocal.Make(Bus);
|
|
109
|
+
|
|
110
|
+
let eventLog = ItemEventLogMaker.make("ItemEventLog", undefined, {
|
|
111
|
+
TAG: "Simple",
|
|
112
|
+
_0: {
|
|
113
|
+
key: "id"
|
|
114
|
+
}
|
|
115
|
+
}, undefined);
|
|
116
|
+
|
|
117
|
+
let AddItemMaker = StateChangeSlice_Builder$ReventlessLocal.Make({
|
|
118
|
+
name: name,
|
|
119
|
+
moduleUrl: moduleUrl,
|
|
120
|
+
Id: Id$Reventless.$$String,
|
|
121
|
+
consumedEventSchema: consumedEventSchema,
|
|
122
|
+
errorSchema: errorSchema,
|
|
123
|
+
eventSchema: eventSchema$1,
|
|
124
|
+
commandSchema: commandSchema,
|
|
125
|
+
commandAuthorization: commandAuthorization,
|
|
126
|
+
readConsistency: "EscalateOnRetry"
|
|
127
|
+
})({
|
|
128
|
+
initialState: false,
|
|
129
|
+
evolve: evolve,
|
|
130
|
+
decide: decide,
|
|
131
|
+
moduleUrl: moduleUrl$1
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
async function publishJsons(cmdJsons) {
|
|
135
|
+
await Promise.all(cmdJsons.map(async cmdJson => {
|
|
136
|
+
let dict = cmdJson.commandJson;
|
|
137
|
+
let typeName;
|
|
138
|
+
typeName = typeof dict === "object" && dict !== null && !Array.isArray(dict) ? Stdlib_Option.getOr(Stdlib_Option.flatMap(dict["TAG"], j => {
|
|
139
|
+
if (typeof j === "string") {
|
|
140
|
+
return j;
|
|
141
|
+
}
|
|
142
|
+
}), "") : "";
|
|
143
|
+
let fullBody = Object.fromEntries([
|
|
144
|
+
[
|
|
145
|
+
"id",
|
|
146
|
+
cmdJson.id
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
"meta",
|
|
150
|
+
S.reverseConvertToJsonOrThrow(cmdJson.meta, Message$Reventless.metaSchema)
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
"command",
|
|
154
|
+
cmdJson.commandJson
|
|
155
|
+
]
|
|
156
|
+
]);
|
|
157
|
+
let handlers = CommandTopic$ReventlessCore.getHandlers(typeName);
|
|
158
|
+
await Promise.all(handlers.map(async entry => {
|
|
159
|
+
let item_reference = cmdJson.id;
|
|
160
|
+
let item = {
|
|
161
|
+
command: fullBody,
|
|
162
|
+
reference: item_reference
|
|
163
|
+
};
|
|
164
|
+
await Effect.runPromise(entry.handler(Stream.fromIterable([item])));
|
|
165
|
+
}));
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
let publishJsonsOutput = Pulumi.output(publishJsons);
|
|
170
|
+
|
|
171
|
+
let _addItemSlice = AddItemMaker.make(eventLog, publishJsonsOutput, undefined, undefined, undefined);
|
|
172
|
+
|
|
173
|
+
async function dispatch(commandJson, id) {
|
|
174
|
+
return await publishJsons([{
|
|
175
|
+
id: id,
|
|
176
|
+
meta: TestFixtures$ReventlessLocal.testMeta,
|
|
177
|
+
commandJson: commandJson
|
|
178
|
+
}]);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function tagQuery(id) {
|
|
182
|
+
return [{
|
|
183
|
+
tags: [{
|
|
184
|
+
key: "id",
|
|
185
|
+
value: id
|
|
186
|
+
}]
|
|
187
|
+
}];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function typeQuery(eventType) {
|
|
191
|
+
return [{
|
|
192
|
+
eventTypes: [eventType]
|
|
193
|
+
}];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function addItemJson(id, name) {
|
|
197
|
+
return S.reverseConvertToJsonOrThrow({
|
|
198
|
+
TAG: "AddItem",
|
|
199
|
+
id: id,
|
|
200
|
+
name: name
|
|
201
|
+
}, commandSchema);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export {
|
|
205
|
+
ItemEventLog,
|
|
206
|
+
AddItemSpec,
|
|
207
|
+
AddItemBehavior,
|
|
208
|
+
Bus,
|
|
209
|
+
capturedEventCount,
|
|
210
|
+
ItemEventLogMaker,
|
|
211
|
+
eventLog,
|
|
212
|
+
AddItemMaker,
|
|
213
|
+
publishJsons,
|
|
214
|
+
publishJsonsOutput,
|
|
215
|
+
_addItemSlice,
|
|
216
|
+
dispatch,
|
|
217
|
+
tagQuery,
|
|
218
|
+
typeQuery,
|
|
219
|
+
addItemJson,
|
|
220
|
+
}
|
|
221
|
+
/* eventSchema Not a pure module */
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// E2E tests for DcbEventLog and StateChangeSlice builders.
|
|
2
|
+
// Verifies the full command → DcbEventLog → event topic pipeline.
|
|
3
|
+
|
|
4
|
+
open JestGlobals
|
|
5
|
+
open DcbFixtures
|
|
6
|
+
|
|
7
|
+
describe("DcbEventLog E2E", () => {
|
|
8
|
+
// Force Output chain resolution so StateChangeSlice handlers are registered
|
|
9
|
+
// before the first test runs (handlers are wired inside Output.apply).
|
|
10
|
+
let _ = beforeAllAsync(async () => {
|
|
11
|
+
let _ = await eventLog->ItemEventLogMaker.operations->TestRunner.resolve
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
let _ = beforeEach(() => {
|
|
15
|
+
capturedEventCount := 0
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
testPromise("AddItem command publishes 1 event to event topic", async () => {
|
|
19
|
+
let cmd =
|
|
20
|
+
AddItemSpec.AddItem({id: "item-1", name: "Widget"})
|
|
21
|
+
->ReventlessCore.Message.encode(AddItemSpec.commandSchema)
|
|
22
|
+
await dispatch(cmd, "item-1")
|
|
23
|
+
expect(capturedEventCount.contents)->toBe(1)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
testPromise("duplicate AddItem produces 0 events (ItemAlreadyExists)", async () => {
|
|
27
|
+
// item-1 was already created in the previous test — same aggregate state persists
|
|
28
|
+
let cmd =
|
|
29
|
+
AddItemSpec.AddItem({id: "item-1", name: "Widget"})
|
|
30
|
+
->ReventlessCore.Message.encode(AddItemSpec.commandSchema)
|
|
31
|
+
await dispatch(cmd, "item-1")
|
|
32
|
+
expect(capturedEventCount.contents)->toBe(0)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
testPromise("AddItem for new id produces 1 event", async () => {
|
|
36
|
+
let cmd =
|
|
37
|
+
AddItemSpec.AddItem({id: "item-2", name: "Gadget"})
|
|
38
|
+
->ReventlessCore.Message.encode(AddItemSpec.commandSchema)
|
|
39
|
+
await dispatch(cmd, "item-2")
|
|
40
|
+
expect(capturedEventCount.contents)->toBe(1)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
testPromise("direct read of DcbEventLog returns appended events", async () => {
|
|
44
|
+
// Tests 1 and 3 appended 2 events total (item-1 and item-2)
|
|
45
|
+
let ops = await eventLog->ItemEventLogMaker.operations->TestRunner.resolve
|
|
46
|
+
let result = await ops.read(~query=[])
|
|
47
|
+
expect(result.events->Array.length > 0)->toBe(true)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
testPromise("direct read with eventTypes filter returns matching events", async () => {
|
|
51
|
+
let ops = await eventLog->ItemEventLogMaker.operations->TestRunner.resolve
|
|
52
|
+
let result = await ops.read(~query=[{eventTypes: ["ItemAdded"]}])
|
|
53
|
+
expect(result.events->Array.length > 0)->toBe(true)
|
|
54
|
+
})
|
|
55
|
+
})
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Message$ReventlessCore from "@reventlessdev/reventless-core/src/Message.res.mjs";
|
|
4
|
+
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
5
|
+
import * as DcbFixtures$ReventlessLocal from "./DcbFixtures.res.mjs";
|
|
6
|
+
|
|
7
|
+
globalThis.describe("DcbEventLog E2E", () => {
|
|
8
|
+
globalThis.beforeAll(async () => {
|
|
9
|
+
await TestRunner$ReventlessLocal.resolve(DcbFixtures$ReventlessLocal.ItemEventLogMaker.operations(DcbFixtures$ReventlessLocal.eventLog));
|
|
10
|
+
});
|
|
11
|
+
globalThis.beforeEach(() => {
|
|
12
|
+
DcbFixtures$ReventlessLocal.capturedEventCount.contents = 0;
|
|
13
|
+
});
|
|
14
|
+
globalThis.test("AddItem command publishes 1 event to event topic", async () => {
|
|
15
|
+
let cmd = Message$ReventlessCore.encode({
|
|
16
|
+
TAG: "AddItem",
|
|
17
|
+
id: "item-1",
|
|
18
|
+
name: "Widget"
|
|
19
|
+
}, DcbFixtures$ReventlessLocal.AddItemSpec.commandSchema);
|
|
20
|
+
await DcbFixtures$ReventlessLocal.dispatch(cmd, "item-1");
|
|
21
|
+
globalThis.expect(DcbFixtures$ReventlessLocal.capturedEventCount.contents).toBe(1);
|
|
22
|
+
});
|
|
23
|
+
globalThis.test("duplicate AddItem produces 0 events (ItemAlreadyExists)", async () => {
|
|
24
|
+
let cmd = Message$ReventlessCore.encode({
|
|
25
|
+
TAG: "AddItem",
|
|
26
|
+
id: "item-1",
|
|
27
|
+
name: "Widget"
|
|
28
|
+
}, DcbFixtures$ReventlessLocal.AddItemSpec.commandSchema);
|
|
29
|
+
await DcbFixtures$ReventlessLocal.dispatch(cmd, "item-1");
|
|
30
|
+
globalThis.expect(DcbFixtures$ReventlessLocal.capturedEventCount.contents).toBe(0);
|
|
31
|
+
});
|
|
32
|
+
globalThis.test("AddItem for new id produces 1 event", async () => {
|
|
33
|
+
let cmd = Message$ReventlessCore.encode({
|
|
34
|
+
TAG: "AddItem",
|
|
35
|
+
id: "item-2",
|
|
36
|
+
name: "Gadget"
|
|
37
|
+
}, DcbFixtures$ReventlessLocal.AddItemSpec.commandSchema);
|
|
38
|
+
await DcbFixtures$ReventlessLocal.dispatch(cmd, "item-2");
|
|
39
|
+
globalThis.expect(DcbFixtures$ReventlessLocal.capturedEventCount.contents).toBe(1);
|
|
40
|
+
});
|
|
41
|
+
globalThis.test("direct read of DcbEventLog returns appended events", async () => {
|
|
42
|
+
let ops = await TestRunner$ReventlessLocal.resolve(DcbFixtures$ReventlessLocal.ItemEventLogMaker.operations(DcbFixtures$ReventlessLocal.eventLog));
|
|
43
|
+
let result = await ops.read([], undefined);
|
|
44
|
+
globalThis.expect(result.events.length !== 0).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
globalThis.test("direct read with eventTypes filter returns matching events", async () => {
|
|
47
|
+
let ops = await TestRunner$ReventlessLocal.resolve(DcbFixtures$ReventlessLocal.ItemEventLogMaker.operations(DcbFixtures$ReventlessLocal.eventLog));
|
|
48
|
+
let result = await ops.read([{
|
|
49
|
+
eventTypes: ["ItemAdded"]
|
|
50
|
+
}], undefined);
|
|
51
|
+
globalThis.expect(result.events.length !== 0).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Integration test fixtures for EventCollector builder (in-memory).
|
|
2
|
+
|
|
3
|
+
// ─────────────────────────────────────────────────────────────
|
|
4
|
+
// Bus and Pulumi setup
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
module Bus = LocalBus.Make()
|
|
8
|
+
|
|
9
|
+
let _ = TestRunner.setup()
|
|
10
|
+
|
|
11
|
+
// ─────────────────────────────────────────────────────────────
|
|
12
|
+
// Build a minimal EventTopic resource for the EventCollector to subscribe to
|
|
13
|
+
// ─────────────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
let topicName = "TestECEventTopic"
|
|
16
|
+
let topicResource: ReventlessInfra.Adapter.resource = ReventlessInfra.Adapter.make(
|
|
17
|
+
~name=topicName->Pulumi.Output.make,
|
|
18
|
+
~id=topicName->Pulumi.Output.make,
|
|
19
|
+
~urn=topicName->Pulumi.Output.make,
|
|
20
|
+
~service="memory:InMemory"->Pulumi.Output.make,
|
|
21
|
+
)
|
|
22
|
+
let allEventTopics: ReventlessCore.EventTopic.allOutputs = Dict.fromArray([
|
|
23
|
+
(topicName, ({resources: [topicResource]}: ReventlessCore.EventTopic.outputs)),
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
// ─────────────────────────────────────────────────────────────
|
|
27
|
+
// Captured events
|
|
28
|
+
// ─────────────────────────────────────────────────────────────
|
|
29
|
+
|
|
30
|
+
let capturedEvents: ref<array<JSON.t>> = ref([])
|
|
31
|
+
|
|
32
|
+
// ─────────────────────────────────────────────────────────────
|
|
33
|
+
// Build EventCollector
|
|
34
|
+
// ─────────────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
module EventCollectorMaker = ReventlessCore.EventCollector_Builder.Make(
|
|
37
|
+
LocalRuntimeEnvironment,
|
|
38
|
+
LocalEventCollectorChannel.Make(Bus),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
let eventCollector = EventCollectorMaker.make(~name="TestEC", ~eventTopics=allEventTopics, ~opts={})
|
|
42
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
4
|
+
import * as Adapter$ReventlessInfra from "@reventlessdev/reventless-infra/src/adapter/Adapter.res.mjs";
|
|
5
|
+
import * as LocalBus$ReventlessLocal from "../../../src/adapter/LocalBus.res.mjs";
|
|
6
|
+
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
7
|
+
import * as EventCollector_Builder$ReventlessCore from "@reventlessdev/reventless-core/src/components/EventCollector/EventCollector_Builder.res.mjs";
|
|
8
|
+
import * as LocalRuntimeEnvironment$ReventlessLocal from "../../../src/adapter/Runtime/LocalRuntimeEnvironment.res.mjs";
|
|
9
|
+
import * as LocalEventCollectorChannel$ReventlessLocal from "../../../src/adapter/EventCollector/LocalEventCollectorChannel.res.mjs";
|
|
10
|
+
|
|
11
|
+
let Bus = LocalBus$ReventlessLocal.Make({});
|
|
12
|
+
|
|
13
|
+
TestRunner$ReventlessLocal.setup();
|
|
14
|
+
|
|
15
|
+
let topicName = "TestECEventTopic";
|
|
16
|
+
|
|
17
|
+
let topicResource = Adapter$ReventlessInfra.make(Pulumi.output(topicName), Pulumi.output(topicName), Pulumi.output(topicName), Pulumi.output("memory:InMemory"), undefined, undefined, undefined, undefined, undefined, undefined);
|
|
18
|
+
|
|
19
|
+
let allEventTopics = Object.fromEntries([[
|
|
20
|
+
topicName,
|
|
21
|
+
{
|
|
22
|
+
resources: [topicResource]
|
|
23
|
+
}
|
|
24
|
+
]]);
|
|
25
|
+
|
|
26
|
+
let capturedEvents = {
|
|
27
|
+
contents: []
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
let EventCollectorMaker = EventCollector_Builder$ReventlessCore.Make({
|
|
31
|
+
make: LocalRuntimeEnvironment$ReventlessLocal.make,
|
|
32
|
+
groupBySource: LocalRuntimeEnvironment$ReventlessLocal.groupBySource,
|
|
33
|
+
extractCorrelationId: LocalRuntimeEnvironment$ReventlessLocal.extractCorrelationId,
|
|
34
|
+
asEventHandler: prim => prim,
|
|
35
|
+
asEffectHandler: prim => prim
|
|
36
|
+
})(LocalEventCollectorChannel$ReventlessLocal.Make(Bus));
|
|
37
|
+
|
|
38
|
+
let eventCollector = EventCollectorMaker.make("TestEC", allEventTopics, {});
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
Bus,
|
|
42
|
+
topicName,
|
|
43
|
+
topicResource,
|
|
44
|
+
allEventTopics,
|
|
45
|
+
capturedEvents,
|
|
46
|
+
EventCollectorMaker,
|
|
47
|
+
eventCollector,
|
|
48
|
+
}
|
|
49
|
+
/* Bus Not a pure module */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Integration tests for EventCollector_Builder with in-memory channel.
|
|
2
|
+
|
|
3
|
+
open TestFixtures
|
|
4
|
+
open JestGlobals
|
|
5
|
+
open EventCollectorFixtures
|
|
6
|
+
|
|
7
|
+
describe("EventCollector (in-memory)", () => {
|
|
8
|
+
// Two resolves needed (same as ReadModel E2E):
|
|
9
|
+
// 1. eventCollector.operations chain — triggers EventCollectorChannel wiring
|
|
10
|
+
// 2. topicResource.name — triggers inner resource.name.apply to register bus subscription
|
|
11
|
+
let _ = beforeAllAsync(async () => {
|
|
12
|
+
let _ = await eventCollector->ReventlessCore.Component.operations->TestRunner.resolve
|
|
13
|
+
let _ = await topicResource.name->TestRunner.resolve
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
let _ = beforeEach(() => {
|
|
17
|
+
capturedEvents := []
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
testPromise("EventCollector component exists", async () => {
|
|
21
|
+
let ops = await eventCollector->ReventlessCore.Component.operations->TestRunner.resolve
|
|
22
|
+
// Verify the operations object has the expected enqueueEvent function
|
|
23
|
+
expect(ops.enqueueEvent->typeof)->toBe("function")
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
testPromise("bus publishes events to topic subscribers", async () => {
|
|
27
|
+
// The EventCollector itself doesn't expose a direct handler in our test setup —
|
|
28
|
+
// verify the bus subscription mechanism works
|
|
29
|
+
let received: ref<int> = ref(0)
|
|
30
|
+
Bus.subscribeToEvents(topicName, async (_, _, _) => {
|
|
31
|
+
received := received.contents + 1
|
|
32
|
+
})
|
|
33
|
+
let testEvent = JSON.Encode.object(Dict.fromArray([("type", JSON.Encode.string("TestEvent"))]))
|
|
34
|
+
await Bus.publishEvent(topicName, "test", testMeta, testEvent)
|
|
35
|
+
expect(received.contents)->toBe(1)
|
|
36
|
+
})
|
|
37
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Component$ReventlessCore from "@reventlessdev/reventless-core/src/components/Component.res.mjs";
|
|
4
|
+
import * as TestRunner$ReventlessLocal from "../../../src/test/TestRunner.res.mjs";
|
|
5
|
+
import * as TestFixtures$ReventlessLocal from "../../TestFixtures.res.mjs";
|
|
6
|
+
import * as EventCollectorFixtures$ReventlessLocal from "./EventCollectorFixtures.res.mjs";
|
|
7
|
+
|
|
8
|
+
globalThis.describe("EventCollector (in-memory)", () => {
|
|
9
|
+
globalThis.beforeAll(async () => {
|
|
10
|
+
await TestRunner$ReventlessLocal.resolve(Component$ReventlessCore.operations(EventCollectorFixtures$ReventlessLocal.eventCollector));
|
|
11
|
+
await TestRunner$ReventlessLocal.resolve(EventCollectorFixtures$ReventlessLocal.topicResource.name);
|
|
12
|
+
});
|
|
13
|
+
globalThis.beforeEach(() => {
|
|
14
|
+
EventCollectorFixtures$ReventlessLocal.capturedEvents.contents = [];
|
|
15
|
+
});
|
|
16
|
+
globalThis.test("EventCollector component exists", async () => {
|
|
17
|
+
let ops = await TestRunner$ReventlessLocal.resolve(Component$ReventlessCore.operations(EventCollectorFixtures$ReventlessLocal.eventCollector));
|
|
18
|
+
globalThis.expect(typeof ops.enqueueEvent).toBe("function");
|
|
19
|
+
});
|
|
20
|
+
globalThis.test("bus publishes events to topic subscribers", async () => {
|
|
21
|
+
let received = {
|
|
22
|
+
contents: 0
|
|
23
|
+
};
|
|
24
|
+
EventCollectorFixtures$ReventlessLocal.Bus.subscribeToEvents(EventCollectorFixtures$ReventlessLocal.topicName, async (param, param$1, param$2) => {
|
|
25
|
+
received.contents = received.contents + 1 | 0;
|
|
26
|
+
});
|
|
27
|
+
let testEvent = Object.fromEntries([[
|
|
28
|
+
"type",
|
|
29
|
+
"TestEvent"
|
|
30
|
+
]]);
|
|
31
|
+
await EventCollectorFixtures$ReventlessLocal.Bus.publishEvent(EventCollectorFixtures$ReventlessLocal.topicName, "test", TestFixtures$ReventlessLocal.testMeta, testEvent);
|
|
32
|
+
globalThis.expect(received.contents).toBe(1);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Tests for EventLog.appendStream (Phase H of effect-stream-integration plan).
|
|
2
|
+
// Verifies that a Stream<Spec.event> can drive sequential appends, and that
|
|
3
|
+
// the replayStream → appendStream pipeline works without an intermediate mapping step.
|
|
4
|
+
// Each test uses a unique aggregate ID to avoid state sharing with other tests.
|
|
5
|
+
|
|
6
|
+
open JestGlobals
|
|
7
|
+
open EventLogFixtures
|
|
8
|
+
|
|
9
|
+
describe("EventLog.appendStream (in-memory adapter)", () => {
|
|
10
|
+
let _ = beforeAllAsync(async () => {
|
|
11
|
+
let _ = await eventLog->ReventlessCore.Component.operations->TestRunner.resolve
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
let _ = beforeEach(() => reset())
|
|
15
|
+
|
|
16
|
+
describe("basic append", () => {
|
|
17
|
+
testPromise("appendStream writes all events to storage", async () => {
|
|
18
|
+
let ops = await eventLog->ReventlessCore.Component.operations->TestRunner.resolve
|
|
19
|
+
let stream = [
|
|
20
|
+
ItemEventLogSpec.ItemCreated({name: "e1"}),
|
|
21
|
+
ItemEventLogSpec.ItemCreated({name: "e2"}),
|
|
22
|
+
ItemEventLogSpec.ItemCreated({name: "e3"}),
|
|
23
|
+
]->Stream.fromIterable
|
|
24
|
+
let _ = await ops.appendStream(0, "as-basic-1", stream)->Effect.runPromise
|
|
25
|
+
let replayed = await ops.replay("as-basic-1")
|
|
26
|
+
expect(replayed->Array.length)->toBe(3)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
testPromise("appendStream on empty stream writes nothing", async () => {
|
|
30
|
+
let ops = await eventLog->ReventlessCore.Component.operations->TestRunner.resolve
|
|
31
|
+
let _ = await ops.appendStream(0, "as-empty-1", Stream.empty)->Effect.runPromise
|
|
32
|
+
let replayed = await ops.replay("as-empty-1")
|
|
33
|
+
expect(replayed->Array.length)->toBe(0)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
testPromise("appendStream preserves event order", async () => {
|
|
37
|
+
let ops = await eventLog->ReventlessCore.Component.operations->TestRunner.resolve
|
|
38
|
+
let stream = [
|
|
39
|
+
ItemEventLogSpec.ItemCreated({name: "first"}),
|
|
40
|
+
ItemEventLogSpec.ItemDeleted({id: "second"}),
|
|
41
|
+
]->Stream.fromIterable
|
|
42
|
+
let _ = await ops.appendStream(0, "as-order-1", stream)->Effect.runPromise
|
|
43
|
+
let replayed = await ops.replayStream("as-order-1")->Stream.runCollect->Effect.runPromise
|
|
44
|
+
let first = replayed->Array.getUnsafe(0)
|
|
45
|
+
expect(first)->toEqual(ItemEventLogSpec.ItemCreated({name: "first"}))
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
testPromise("appendStream after array append continues from correct sequenceNr", async () => {
|
|
49
|
+
let ops = await eventLog->ReventlessCore.Component.operations->TestRunner.resolve
|
|
50
|
+
let _ = await ops.append(
|
|
51
|
+
0,
|
|
52
|
+
"as-seq-1",
|
|
53
|
+
[makeEvent'("as-seq-1", ItemEventLogSpec.ItemCreated({name: "initial"}))],
|
|
54
|
+
)
|
|
55
|
+
let stream = [ItemEventLogSpec.ItemCreated({name: "streamed"})]->Stream.fromIterable
|
|
56
|
+
let _ = await ops.appendStream(1, "as-seq-1", stream)->Effect.runPromise
|
|
57
|
+
let replayed = await ops.replay("as-seq-1")
|
|
58
|
+
expect(replayed->Array.length)->toBe(2)
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe("replayStream → appendStream pipeline", () => {
|
|
63
|
+
testPromise("can copy events from one aggregate to another via streams", async () => {
|
|
64
|
+
let ops = await eventLog->ReventlessCore.Component.operations->TestRunner.resolve
|
|
65
|
+
let _ = await ops.append(
|
|
66
|
+
0,
|
|
67
|
+
"as-src-1",
|
|
68
|
+
[
|
|
69
|
+
makeEvent'("as-src-1", ItemEventLogSpec.ItemCreated({name: "a"})),
|
|
70
|
+
makeEvent'("as-src-1", ItemEventLogSpec.ItemDeleted({id: "b"})),
|
|
71
|
+
],
|
|
72
|
+
)
|
|
73
|
+
let sourceStream = ops.replayStream("as-src-1")
|
|
74
|
+
let _ = await ops.appendStream(0, "as-dst-1", sourceStream)->Effect.runPromise
|
|
75
|
+
let destEvents = await ops.replay("as-dst-1")
|
|
76
|
+
expect(destEvents->Array.length)->toBe(2)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
testPromise("copied events round-trip through decode correctly", async () => {
|
|
80
|
+
let ops = await eventLog->ReventlessCore.Component.operations->TestRunner.resolve
|
|
81
|
+
let _ = await ops.append(
|
|
82
|
+
0,
|
|
83
|
+
"as-src-2",
|
|
84
|
+
[makeEvent'("as-src-2", ItemEventLogSpec.ItemCreated({name: "copied"}))],
|
|
85
|
+
)
|
|
86
|
+
let sourceStream = ops.replayStream("as-src-2")
|
|
87
|
+
let _ = await ops.appendStream(0, "as-dst-2", sourceStream)->Effect.runPromise
|
|
88
|
+
let destEvents = await ops.replayStream("as-dst-2")->Stream.runCollect->Effect.runPromise
|
|
89
|
+
let first = destEvents->Array.getUnsafe(0)
|
|
90
|
+
expect(first)->toEqual(ItemEventLogSpec.ItemCreated({name: "copied"}))
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
})
|