@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,233 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
6
|
+
import * as AutomationSliceFixtures$ReventlessLocal from "./AutomationSliceFixtures.res.mjs";
|
|
7
|
+
import * as AutomationSlice_Callback$ReventlessCore from "@reventlessdev/reventless-core/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs";
|
|
8
|
+
|
|
9
|
+
let Callback = AutomationSlice_Callback$ReventlessCore.Make(AutomationSliceFixtures$ReventlessLocal.ShipOrderSpec)(AutomationSliceFixtures$ReventlessLocal.ShipOrderAutomation);
|
|
10
|
+
|
|
11
|
+
let SkipCallback = AutomationSlice_Callback$ReventlessCore.Make(AutomationSliceFixtures$ReventlessLocal.SkipProcessSpec)(AutomationSliceFixtures$ReventlessLocal.SkipProcessAutomation);
|
|
12
|
+
|
|
13
|
+
globalThis.describe("AutomationSlice Callback (mixed-source)", () => {
|
|
14
|
+
globalThis.beforeEach(() => {
|
|
15
|
+
Object.keys(Callback.todoItems).forEach(k => Stdlib_Dict.$$delete(Callback.todoItems, k));
|
|
16
|
+
Object.keys(SkipCallback.todoItems).forEach(k => Stdlib_Dict.$$delete(SkipCallback.todoItems, k));
|
|
17
|
+
});
|
|
18
|
+
globalThis.describe("Phase 1 — collect", () => {
|
|
19
|
+
globalThis.test("OrderPlaced JSON creates a pending TODO item", async () => {
|
|
20
|
+
let json = AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
21
|
+
TAG: "OrderPlaced",
|
|
22
|
+
orderId: "ord-1",
|
|
23
|
+
address: "123 Main St"
|
|
24
|
+
});
|
|
25
|
+
Callback.phase1([json], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
26
|
+
let items = Callback.todoItems;
|
|
27
|
+
globalThis.expect(Object.entries(items).length).toBe(1);
|
|
28
|
+
let row = Stdlib_Option.getOrThrow(items["ord-1"], undefined);
|
|
29
|
+
globalThis.expect(row.status).toBe("Pending");
|
|
30
|
+
globalThis.expect(row.retryCount).toBe(0);
|
|
31
|
+
});
|
|
32
|
+
globalThis.test("duplicate OrderPlaced is idempotent", async () => {
|
|
33
|
+
let j1 = AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
34
|
+
TAG: "OrderPlaced",
|
|
35
|
+
orderId: "ord-1",
|
|
36
|
+
address: "123 Main St"
|
|
37
|
+
});
|
|
38
|
+
let j2 = AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
39
|
+
TAG: "OrderPlaced",
|
|
40
|
+
orderId: "ord-1",
|
|
41
|
+
address: "456 Oak Ave"
|
|
42
|
+
});
|
|
43
|
+
Callback.phase1([j1], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
44
|
+
Callback.phase1([j2], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
45
|
+
globalThis.expect(Object.entries(Callback.todoItems).length).toBe(1);
|
|
46
|
+
});
|
|
47
|
+
globalThis.test("multiple OrderPlaced events create multiple TODO items", async () => {
|
|
48
|
+
let j1 = AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
49
|
+
TAG: "OrderPlaced",
|
|
50
|
+
orderId: "ord-1",
|
|
51
|
+
address: "123 Main St"
|
|
52
|
+
});
|
|
53
|
+
let j2 = AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
54
|
+
TAG: "OrderPlaced",
|
|
55
|
+
orderId: "ord-2",
|
|
56
|
+
address: "456 Oak Ave"
|
|
57
|
+
});
|
|
58
|
+
Callback.phase1([
|
|
59
|
+
j1,
|
|
60
|
+
j2
|
|
61
|
+
], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
62
|
+
globalThis.expect(Object.entries(Callback.todoItems).length).toBe(2);
|
|
63
|
+
});
|
|
64
|
+
globalThis.test("ShipmentCreated does not create a TODO item", async () => {
|
|
65
|
+
let json = AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
66
|
+
TAG: "ShipmentCreated",
|
|
67
|
+
orderId: "ord-1"
|
|
68
|
+
});
|
|
69
|
+
Callback.phase1([json], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
70
|
+
globalThis.expect(Object.entries(Callback.todoItems).length).toBe(0);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
globalThis.describe("Phase 1 — resolve", () => {
|
|
74
|
+
globalThis.test("ShipmentCreated marks pending TODO item as completed", async () => {
|
|
75
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
76
|
+
TAG: "OrderPlaced",
|
|
77
|
+
orderId: "ord-1",
|
|
78
|
+
address: "123 Main St"
|
|
79
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
80
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
81
|
+
TAG: "ShipmentCreated",
|
|
82
|
+
orderId: "ord-1"
|
|
83
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
84
|
+
let row = Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined);
|
|
85
|
+
globalThis.expect(row.status).toBe("Completed");
|
|
86
|
+
});
|
|
87
|
+
globalThis.test("ShipmentCreated for unknown id is a no-op", async () => {
|
|
88
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
89
|
+
TAG: "ShipmentCreated",
|
|
90
|
+
orderId: "unknown"
|
|
91
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
92
|
+
globalThis.expect(Object.entries(Callback.todoItems).length).toBe(0);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
globalThis.describe("Phase 2 — process", () => {
|
|
96
|
+
globalThis.test("pending items produce commands via publishJsons", async () => {
|
|
97
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
98
|
+
TAG: "OrderPlaced",
|
|
99
|
+
orderId: "ord-1",
|
|
100
|
+
address: "123 Main St"
|
|
101
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
102
|
+
let publishedCommands = {
|
|
103
|
+
contents: []
|
|
104
|
+
};
|
|
105
|
+
let mockPublish = async cmds => {
|
|
106
|
+
publishedCommands.contents = cmds;
|
|
107
|
+
};
|
|
108
|
+
await Callback.phase2(mockPublish);
|
|
109
|
+
globalThis.expect(publishedCommands.contents.length).toBe(1);
|
|
110
|
+
let cmd = publishedCommands.contents[0];
|
|
111
|
+
globalThis.expect(cmd.id).toBe("ord-1");
|
|
112
|
+
let row = Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined);
|
|
113
|
+
globalThis.expect(row.status).toBe("Processing");
|
|
114
|
+
});
|
|
115
|
+
globalThis.test("completed items are not processed", async () => {
|
|
116
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
117
|
+
TAG: "OrderPlaced",
|
|
118
|
+
orderId: "ord-1",
|
|
119
|
+
address: "123 Main St"
|
|
120
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
121
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
122
|
+
TAG: "ShipmentCreated",
|
|
123
|
+
orderId: "ord-1"
|
|
124
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
125
|
+
let publishedCommands = {
|
|
126
|
+
contents: []
|
|
127
|
+
};
|
|
128
|
+
let mockPublish = async cmds => {
|
|
129
|
+
publishedCommands.contents = cmds;
|
|
130
|
+
};
|
|
131
|
+
await Callback.phase2(mockPublish);
|
|
132
|
+
globalThis.expect(publishedCommands.contents.length).toBe(0);
|
|
133
|
+
});
|
|
134
|
+
globalThis.test("items where process returns None are skipped", async () => {
|
|
135
|
+
let json = AutomationSliceFixtures$ReventlessLocal.encodeSkipProcessEvent({
|
|
136
|
+
TAG: "OrderPlaced",
|
|
137
|
+
orderId: "ord-1"
|
|
138
|
+
});
|
|
139
|
+
SkipCallback.phase1([json], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
140
|
+
let publishedCommands = {
|
|
141
|
+
contents: []
|
|
142
|
+
};
|
|
143
|
+
let mockPublish = async cmds => {
|
|
144
|
+
publishedCommands.contents = cmds;
|
|
145
|
+
};
|
|
146
|
+
await SkipCallback.phase2(mockPublish);
|
|
147
|
+
globalThis.expect(publishedCommands.contents.length).toBe(0);
|
|
148
|
+
let row = Stdlib_Option.getOrThrow(SkipCallback.todoItems["ord-1"], undefined);
|
|
149
|
+
globalThis.expect(row.status).toBe("Pending");
|
|
150
|
+
});
|
|
151
|
+
globalThis.test("empty TODO list produces no commands", async () => {
|
|
152
|
+
let publishedCommands = {
|
|
153
|
+
contents: []
|
|
154
|
+
};
|
|
155
|
+
let mockPublish = async cmds => {
|
|
156
|
+
publishedCommands.contents = cmds;
|
|
157
|
+
};
|
|
158
|
+
await Callback.phase2(mockPublish);
|
|
159
|
+
globalThis.expect(publishedCommands.contents.length).toBe(0);
|
|
160
|
+
});
|
|
161
|
+
globalThis.test("publishJsons failure marks items as Failed", async () => {
|
|
162
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
163
|
+
TAG: "OrderPlaced",
|
|
164
|
+
orderId: "ord-1",
|
|
165
|
+
address: "123 Main St"
|
|
166
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
167
|
+
let failingPublish = async _cmds => Stdlib_JsError.throwWithMessage("publish failed");
|
|
168
|
+
await Callback.phase2(failingPublish);
|
|
169
|
+
let row = Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined);
|
|
170
|
+
globalThis.expect(row.status).toBe("Failed");
|
|
171
|
+
globalThis.expect(row.retryCount).toBe(1);
|
|
172
|
+
});
|
|
173
|
+
globalThis.test("failed items with retryCount < maxRetries are retried", async () => {
|
|
174
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
175
|
+
TAG: "OrderPlaced",
|
|
176
|
+
orderId: "ord-1",
|
|
177
|
+
address: "123 Main St"
|
|
178
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
179
|
+
let failingPublish = async _cmds => Stdlib_JsError.throwWithMessage("publish failed");
|
|
180
|
+
await Callback.phase2(failingPublish);
|
|
181
|
+
let row1 = Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined);
|
|
182
|
+
globalThis.expect(row1.retryCount).toBe(1);
|
|
183
|
+
let publishedCommands = {
|
|
184
|
+
contents: []
|
|
185
|
+
};
|
|
186
|
+
let successPublish = async cmds => {
|
|
187
|
+
publishedCommands.contents = cmds;
|
|
188
|
+
};
|
|
189
|
+
await Callback.phase2(successPublish);
|
|
190
|
+
globalThis.expect(publishedCommands.contents.length).toBe(1);
|
|
191
|
+
let row2 = Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined);
|
|
192
|
+
globalThis.expect(row2.status).toBe("Processing");
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
globalThis.describe("full lifecycle", () => {
|
|
196
|
+
globalThis.test("collect → process → resolve completes the TODO item", async () => {
|
|
197
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
198
|
+
TAG: "OrderPlaced",
|
|
199
|
+
orderId: "ord-1",
|
|
200
|
+
address: "123 Main St"
|
|
201
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
202
|
+
globalThis.expect(Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined).status).toBe("Pending");
|
|
203
|
+
let publishedCommands = {
|
|
204
|
+
contents: []
|
|
205
|
+
};
|
|
206
|
+
let mockPublish = async cmds => {
|
|
207
|
+
publishedCommands.contents = cmds;
|
|
208
|
+
};
|
|
209
|
+
await Callback.phase2(mockPublish);
|
|
210
|
+
globalThis.expect(publishedCommands.contents.length).toBe(1);
|
|
211
|
+
globalThis.expect(Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined).status).toBe("Processing");
|
|
212
|
+
Callback.phase1([AutomationSliceFixtures$ReventlessLocal.encodeShipOrderEvent({
|
|
213
|
+
TAG: "ShipmentCreated",
|
|
214
|
+
orderId: "ord-1"
|
|
215
|
+
})], AutomationSliceFixtures$ReventlessLocal.testContext);
|
|
216
|
+
globalThis.expect(Stdlib_Option.getOrThrow(Callback.todoItems["ord-1"], undefined).status).toBe("Completed");
|
|
217
|
+
let publishedCommands2 = {
|
|
218
|
+
contents: []
|
|
219
|
+
};
|
|
220
|
+
let mockPublish2 = async cmds => {
|
|
221
|
+
publishedCommands2.contents = cmds;
|
|
222
|
+
};
|
|
223
|
+
await Callback.phase2(mockPublish2);
|
|
224
|
+
globalThis.expect(publishedCommands2.contents.length).toBe(0);
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
Callback,
|
|
231
|
+
SkipCallback,
|
|
232
|
+
}
|
|
233
|
+
/* Callback Not a pure module */
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// Test fixtures for AutomationSlice — Plan 04 mixed-source shape.
|
|
2
|
+
// Single-source mapping wired up so Callback unit tests exercise the per-source
|
|
3
|
+
// dispatch and context plumbing introduced by Plan 04.
|
|
4
|
+
|
|
5
|
+
// ─────────────────────────────────────────────────────────────
|
|
6
|
+
// Source — slice's own DcbEventLog (hand-rolled DcbSource shape)
|
|
7
|
+
// ─────────────────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
module ShipOrderSource = {
|
|
10
|
+
module Id = Reventless.Id.String
|
|
11
|
+
let name = "ShipOrderDcbEventLog"
|
|
12
|
+
@schema
|
|
13
|
+
type event =
|
|
14
|
+
| OrderPlaced({orderId: @s.matches(Reventless.DcbTag.string) string, address: string})
|
|
15
|
+
| ShipmentCreated({orderId: @s.matches(Reventless.DcbTag.string) string})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module SkipProcessSource = {
|
|
19
|
+
module Id = Reventless.Id.String
|
|
20
|
+
let name = "SkipProcessDcbEventLog"
|
|
21
|
+
@schema
|
|
22
|
+
type event =
|
|
23
|
+
| OrderPlaced({orderId: @s.matches(Reventless.DcbTag.string) string})
|
|
24
|
+
| ShipmentCreated({orderId: @s.matches(Reventless.DcbTag.string) string})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// ─────────────────────────────────────────────────────────────
|
|
28
|
+
// AutomationSlice specs (target of mappings)
|
|
29
|
+
// ─────────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
module ShipOrderSpec = {
|
|
32
|
+
let name = "ShipOrder"
|
|
33
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
34
|
+
|
|
35
|
+
@schema
|
|
36
|
+
type todoItem = {orderId: string, address: string}
|
|
37
|
+
|
|
38
|
+
@schema
|
|
39
|
+
type command = CreateShipment({orderId: @s.matches(Reventless.DcbTag.string) string})
|
|
40
|
+
|
|
41
|
+
let maxRetries = 3
|
|
42
|
+
let heartbeatInterval = 60
|
|
43
|
+
let targetName = "CreateShipment"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module SkipProcessSpec = {
|
|
47
|
+
let name = "SkipProcess"
|
|
48
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
49
|
+
|
|
50
|
+
@schema
|
|
51
|
+
type todoItem = {orderId: string}
|
|
52
|
+
|
|
53
|
+
@schema
|
|
54
|
+
type command = Noop
|
|
55
|
+
|
|
56
|
+
let maxRetries = 0
|
|
57
|
+
let heartbeatInterval = 60
|
|
58
|
+
let targetName = "Noop"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ─────────────────────────────────────────────────────────────
|
|
62
|
+
// Automation impls — `process` plus per-source `mappings` (the merged
|
|
63
|
+
// shape the Automation module type now requires after the 2-arg Make
|
|
64
|
+
// rework; collect/resolve still live on each per-source Mapping module).
|
|
65
|
+
// Forward-declared below the per-source Mapping modules to keep the
|
|
66
|
+
// declaration order self-contained.
|
|
67
|
+
// ─────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
// ─────────────────────────────────────────────────────────────
|
|
70
|
+
// Mappings — collect/resolve over each source's event type
|
|
71
|
+
// ─────────────────────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
module ShipOrderMapping = Reventless.AutomationSlice.Mapping.Make(
|
|
74
|
+
ShipOrderSource,
|
|
75
|
+
ShipOrderSpec,
|
|
76
|
+
{
|
|
77
|
+
let collect = (event: ShipOrderSource.event, _ctx) =>
|
|
78
|
+
switch event {
|
|
79
|
+
| OrderPlaced({orderId, address}) => [(orderId, ({orderId, address}: ShipOrderSpec.todoItem))]
|
|
80
|
+
| ShipmentCreated(_) => []
|
|
81
|
+
}
|
|
82
|
+
let resolve = (event: ShipOrderSource.event) =>
|
|
83
|
+
switch event {
|
|
84
|
+
| ShipmentCreated({orderId}) => Some(orderId)
|
|
85
|
+
| OrderPlaced(_) => None
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
module SkipProcessMapping = Reventless.AutomationSlice.Mapping.Make(
|
|
91
|
+
SkipProcessSource,
|
|
92
|
+
SkipProcessSpec,
|
|
93
|
+
{
|
|
94
|
+
let collect = (event: SkipProcessSource.event, _ctx) =>
|
|
95
|
+
switch event {
|
|
96
|
+
| OrderPlaced({orderId}) => [(orderId, ({orderId: orderId}: SkipProcessSpec.todoItem))]
|
|
97
|
+
| ShipmentCreated(_) => []
|
|
98
|
+
}
|
|
99
|
+
let resolve = (event: SkipProcessSource.event) =>
|
|
100
|
+
switch event {
|
|
101
|
+
| ShipmentCreated({orderId}) => Some(orderId)
|
|
102
|
+
| OrderPlaced(_) => None
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
module ShipOrderAutomation: Reventless.AutomationSlice.Automation
|
|
108
|
+
with module Spec := ShipOrderSpec = {
|
|
109
|
+
let process = (id, _item: ShipOrderSpec.todoItem) =>
|
|
110
|
+
Some((id, ShipOrderSpec.CreateShipment({orderId: id})))
|
|
111
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
112
|
+
module M = Reventless.AutomationSlice.Mappings.Make(ShipOrderSpec)
|
|
113
|
+
module type Mapping = M.Mapping
|
|
114
|
+
let mappings: array<module(Mapping)> = [module(ShipOrderMapping)]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
module SkipProcessAutomation: Reventless.AutomationSlice.Automation
|
|
118
|
+
with module Spec := SkipProcessSpec = {
|
|
119
|
+
let process = (_id, _item: SkipProcessSpec.todoItem) => None
|
|
120
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
121
|
+
module M = Reventless.AutomationSlice.Mappings.Make(SkipProcessSpec)
|
|
122
|
+
module type Mapping = M.Mapping
|
|
123
|
+
let mappings: array<module(Mapping)> = [module(SkipProcessMapping)]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ─────────────────────────────────────────────────────────────
|
|
127
|
+
// Test helpers
|
|
128
|
+
// ─────────────────────────────────────────────────────────────
|
|
129
|
+
|
|
130
|
+
let testContext: Reventless.AutomationSlice.context = {
|
|
131
|
+
environment: "test",
|
|
132
|
+
platformName: "local",
|
|
133
|
+
pluginName: "TestPlugin",
|
|
134
|
+
sliceName: "ShipOrder",
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Encode a ShipOrderSource.event into the JSON shape phase1 receives — wraps
|
|
138
|
+
// the event payload with a `meta.service` matching the source name so the
|
|
139
|
+
// callback's per-source dispatch picks the right mapping.
|
|
140
|
+
let encodeShipOrderEvent = (event: ShipOrderSource.event): JSON.t => {
|
|
141
|
+
let payloadJson = event->S.reverseConvertToJsonOrThrow(ShipOrderSource.eventSchema)
|
|
142
|
+
let dict = switch payloadJson->JSON.Decode.object {
|
|
143
|
+
| Some(d) => d->Dict.copy
|
|
144
|
+
| None =>
|
|
145
|
+
// Payload-less variants serialise to bare strings — wrap into object form.
|
|
146
|
+
let d = Dict.make()
|
|
147
|
+
switch payloadJson->JSON.Decode.string {
|
|
148
|
+
| Some(name) => d->Dict.set("TAG", JSON.Encode.string(name))
|
|
149
|
+
| None => ()
|
|
150
|
+
}
|
|
151
|
+
d
|
|
152
|
+
}
|
|
153
|
+
let meta: Reventless.Message.meta = {
|
|
154
|
+
service: ShipOrderSource.name,
|
|
155
|
+
time: "2026-01-01T00:00:00Z",
|
|
156
|
+
ip: "",
|
|
157
|
+
user: "",
|
|
158
|
+
msgId: "msg-1",
|
|
159
|
+
correlationId: "",
|
|
160
|
+
}
|
|
161
|
+
dict->Dict.set("meta", meta->S.reverseConvertToJsonOrThrow(Reventless.Message.metaSchema))
|
|
162
|
+
dict->Dict.set("id", JSON.Encode.string("env-id"))
|
|
163
|
+
JSON.Encode.object(dict)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
let encodeSkipProcessEvent = (event: SkipProcessSource.event): JSON.t => {
|
|
167
|
+
let payloadJson = event->S.reverseConvertToJsonOrThrow(SkipProcessSource.eventSchema)
|
|
168
|
+
let dict = switch payloadJson->JSON.Decode.object {
|
|
169
|
+
| Some(d) => d->Dict.copy
|
|
170
|
+
| None =>
|
|
171
|
+
let d = Dict.make()
|
|
172
|
+
switch payloadJson->JSON.Decode.string {
|
|
173
|
+
| Some(name) => d->Dict.set("TAG", JSON.Encode.string(name))
|
|
174
|
+
| None => ()
|
|
175
|
+
}
|
|
176
|
+
d
|
|
177
|
+
}
|
|
178
|
+
let meta: Reventless.Message.meta = {
|
|
179
|
+
service: SkipProcessSource.name,
|
|
180
|
+
time: "2026-01-01T00:00:00Z",
|
|
181
|
+
ip: "",
|
|
182
|
+
user: "",
|
|
183
|
+
msgId: "msg-1",
|
|
184
|
+
correlationId: "",
|
|
185
|
+
}
|
|
186
|
+
dict->Dict.set("meta", meta->S.reverseConvertToJsonOrThrow(Reventless.Message.metaSchema))
|
|
187
|
+
dict->Dict.set("id", JSON.Encode.string("env-id"))
|
|
188
|
+
JSON.Encode.object(dict)
|
|
189
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
6
|
+
import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
|
|
7
|
+
import * as Message$Reventless from "@reventlessdev/reventless-spec/src/types/Message.res.mjs";
|
|
8
|
+
import * as AutomationSlice$Reventless from "@reventlessdev/reventless-spec/src/components/AutomationSlice.res.mjs";
|
|
9
|
+
|
|
10
|
+
let name = "ShipOrderDcbEventLog";
|
|
11
|
+
|
|
12
|
+
let eventSchema = S.union([
|
|
13
|
+
S.schema(s => ({
|
|
14
|
+
TAG: "OrderPlaced",
|
|
15
|
+
orderId: s.m(DcbTag$Reventless.string),
|
|
16
|
+
address: s.m(S.string)
|
|
17
|
+
})),
|
|
18
|
+
S.schema(s => ({
|
|
19
|
+
TAG: "ShipmentCreated",
|
|
20
|
+
orderId: s.m(DcbTag$Reventless.string)
|
|
21
|
+
}))
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
let ShipOrderSource = {
|
|
25
|
+
Id: undefined,
|
|
26
|
+
name: name,
|
|
27
|
+
eventSchema: eventSchema
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
let name$1 = "SkipProcessDcbEventLog";
|
|
31
|
+
|
|
32
|
+
let eventSchema$1 = S.union([
|
|
33
|
+
S.schema(s => ({
|
|
34
|
+
TAG: "OrderPlaced",
|
|
35
|
+
orderId: s.m(DcbTag$Reventless.string)
|
|
36
|
+
})),
|
|
37
|
+
S.schema(s => ({
|
|
38
|
+
TAG: "ShipmentCreated",
|
|
39
|
+
orderId: s.m(DcbTag$Reventless.string)
|
|
40
|
+
}))
|
|
41
|
+
]);
|
|
42
|
+
|
|
43
|
+
let SkipProcessSource = {
|
|
44
|
+
Id: undefined,
|
|
45
|
+
name: name$1,
|
|
46
|
+
eventSchema: eventSchema$1
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
let moduleUrl = import.meta.url;
|
|
50
|
+
|
|
51
|
+
let todoItemSchema = S.schema(s => ({
|
|
52
|
+
orderId: s.m(S.string),
|
|
53
|
+
address: s.m(S.string)
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
let commandSchema = S.schema(s => ({
|
|
57
|
+
TAG: "CreateShipment",
|
|
58
|
+
orderId: s.m(DcbTag$Reventless.string)
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
function commandAuthorization(param) {
|
|
62
|
+
return "AllowAuthenticated";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let ShipOrderSpec = {
|
|
66
|
+
name: "ShipOrder",
|
|
67
|
+
moduleUrl: moduleUrl,
|
|
68
|
+
todoItemSchema: todoItemSchema,
|
|
69
|
+
commandSchema: commandSchema,
|
|
70
|
+
maxRetries: 3,
|
|
71
|
+
heartbeatInterval: 60,
|
|
72
|
+
targetName: "CreateShipment",
|
|
73
|
+
commandAuthorization: commandAuthorization
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
let moduleUrl$1 = import.meta.url;
|
|
77
|
+
|
|
78
|
+
let todoItemSchema$1 = S.schema(s => ({
|
|
79
|
+
orderId: s.m(S.string)
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
let commandSchema$1 = S.literal("Noop");
|
|
83
|
+
|
|
84
|
+
function commandAuthorization$1(param) {
|
|
85
|
+
return "AllowAuthenticated";
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let SkipProcessSpec = {
|
|
89
|
+
name: "SkipProcess",
|
|
90
|
+
moduleUrl: moduleUrl$1,
|
|
91
|
+
todoItemSchema: todoItemSchema$1,
|
|
92
|
+
commandSchema: commandSchema$1,
|
|
93
|
+
maxRetries: 0,
|
|
94
|
+
heartbeatInterval: 60,
|
|
95
|
+
targetName: "Noop",
|
|
96
|
+
commandAuthorization: commandAuthorization$1
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
function collect(event, _ctx) {
|
|
100
|
+
if (event.TAG !== "OrderPlaced") {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
let orderId = event.orderId;
|
|
104
|
+
return [[
|
|
105
|
+
orderId,
|
|
106
|
+
{
|
|
107
|
+
orderId: orderId,
|
|
108
|
+
address: event.address
|
|
109
|
+
}
|
|
110
|
+
]];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function resolve(event) {
|
|
114
|
+
if (event.TAG === "OrderPlaced") {
|
|
115
|
+
return;
|
|
116
|
+
} else {
|
|
117
|
+
return event.orderId;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let ShipOrderMapping = AutomationSlice$Reventless.Mapping.Make({
|
|
122
|
+
Id: Id$Reventless.$$String,
|
|
123
|
+
name: name,
|
|
124
|
+
eventSchema: eventSchema
|
|
125
|
+
})(ShipOrderSpec)({
|
|
126
|
+
collect: collect,
|
|
127
|
+
resolve: resolve
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
function collect$1(event, _ctx) {
|
|
131
|
+
if (event.TAG !== "OrderPlaced") {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
let orderId = event.orderId;
|
|
135
|
+
return [[
|
|
136
|
+
orderId,
|
|
137
|
+
{
|
|
138
|
+
orderId: orderId
|
|
139
|
+
}
|
|
140
|
+
]];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function resolve$1(event) {
|
|
144
|
+
if (event.TAG === "OrderPlaced") {
|
|
145
|
+
return;
|
|
146
|
+
} else {
|
|
147
|
+
return event.orderId;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
let SkipProcessMapping = AutomationSlice$Reventless.Mapping.Make({
|
|
152
|
+
Id: Id$Reventless.$$String,
|
|
153
|
+
name: name$1,
|
|
154
|
+
eventSchema: eventSchema$1
|
|
155
|
+
})(SkipProcessSpec)({
|
|
156
|
+
collect: collect$1,
|
|
157
|
+
resolve: resolve$1
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
function process(id, _item) {
|
|
161
|
+
return [
|
|
162
|
+
id,
|
|
163
|
+
{
|
|
164
|
+
TAG: "CreateShipment",
|
|
165
|
+
orderId: id
|
|
166
|
+
}
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let moduleUrl$2 = import.meta.url;
|
|
171
|
+
|
|
172
|
+
AutomationSlice$Reventless.Mappings.Make(ShipOrderSpec);
|
|
173
|
+
|
|
174
|
+
let mappings = [ShipOrderMapping];
|
|
175
|
+
|
|
176
|
+
let ShipOrderAutomation = {
|
|
177
|
+
process: process,
|
|
178
|
+
moduleUrl: moduleUrl$2,
|
|
179
|
+
mappings: mappings
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
function process$1(_id, _item) {
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
let moduleUrl$3 = import.meta.url;
|
|
187
|
+
|
|
188
|
+
AutomationSlice$Reventless.Mappings.Make(SkipProcessSpec);
|
|
189
|
+
|
|
190
|
+
let mappings$1 = [SkipProcessMapping];
|
|
191
|
+
|
|
192
|
+
let SkipProcessAutomation = {
|
|
193
|
+
process: process$1,
|
|
194
|
+
moduleUrl: moduleUrl$3,
|
|
195
|
+
mappings: mappings$1
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
function encodeShipOrderEvent(event) {
|
|
199
|
+
let payloadJson = S.reverseConvertToJsonOrThrow(event, eventSchema);
|
|
200
|
+
let d = Stdlib_JSON.Decode.object(payloadJson);
|
|
201
|
+
let dict;
|
|
202
|
+
if (d !== undefined) {
|
|
203
|
+
dict = Object.assign({}, d);
|
|
204
|
+
} else {
|
|
205
|
+
let d$1 = {};
|
|
206
|
+
let name$2 = Stdlib_JSON.Decode.string(payloadJson);
|
|
207
|
+
if (name$2 !== undefined) {
|
|
208
|
+
d$1["TAG"] = name$2;
|
|
209
|
+
}
|
|
210
|
+
dict = d$1;
|
|
211
|
+
}
|
|
212
|
+
let meta_ip = "";
|
|
213
|
+
let meta_user = "";
|
|
214
|
+
let meta = {
|
|
215
|
+
service: name,
|
|
216
|
+
time: "2026-01-01T00:00:00Z",
|
|
217
|
+
ip: meta_ip,
|
|
218
|
+
user: meta_user,
|
|
219
|
+
msgId: "msg-1",
|
|
220
|
+
correlationId: ""
|
|
221
|
+
};
|
|
222
|
+
dict["meta"] = S.reverseConvertToJsonOrThrow(meta, Message$Reventless.metaSchema);
|
|
223
|
+
dict["id"] = "env-id";
|
|
224
|
+
return dict;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function encodeSkipProcessEvent(event) {
|
|
228
|
+
let payloadJson = S.reverseConvertToJsonOrThrow(event, eventSchema$1);
|
|
229
|
+
let d = Stdlib_JSON.Decode.object(payloadJson);
|
|
230
|
+
let dict;
|
|
231
|
+
if (d !== undefined) {
|
|
232
|
+
dict = Object.assign({}, d);
|
|
233
|
+
} else {
|
|
234
|
+
let d$1 = {};
|
|
235
|
+
let name$2 = Stdlib_JSON.Decode.string(payloadJson);
|
|
236
|
+
if (name$2 !== undefined) {
|
|
237
|
+
d$1["TAG"] = name$2;
|
|
238
|
+
}
|
|
239
|
+
dict = d$1;
|
|
240
|
+
}
|
|
241
|
+
let meta_ip = "";
|
|
242
|
+
let meta_user = "";
|
|
243
|
+
let meta = {
|
|
244
|
+
service: name$1,
|
|
245
|
+
time: "2026-01-01T00:00:00Z",
|
|
246
|
+
ip: meta_ip,
|
|
247
|
+
user: meta_user,
|
|
248
|
+
msgId: "msg-1",
|
|
249
|
+
correlationId: ""
|
|
250
|
+
};
|
|
251
|
+
dict["meta"] = S.reverseConvertToJsonOrThrow(meta, Message$Reventless.metaSchema);
|
|
252
|
+
dict["id"] = "env-id";
|
|
253
|
+
return dict;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let testContext = {
|
|
257
|
+
environment: "test",
|
|
258
|
+
platformName: "local",
|
|
259
|
+
pluginName: "TestPlugin",
|
|
260
|
+
sliceName: "ShipOrder"
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export {
|
|
264
|
+
ShipOrderSource,
|
|
265
|
+
SkipProcessSource,
|
|
266
|
+
ShipOrderSpec,
|
|
267
|
+
SkipProcessSpec,
|
|
268
|
+
ShipOrderMapping,
|
|
269
|
+
SkipProcessMapping,
|
|
270
|
+
ShipOrderAutomation,
|
|
271
|
+
SkipProcessAutomation,
|
|
272
|
+
testContext,
|
|
273
|
+
encodeShipOrderEvent,
|
|
274
|
+
encodeSkipProcessEvent,
|
|
275
|
+
}
|
|
276
|
+
/* eventSchema Not a pure module */
|