@reventlessdev/reventless-core 3.0.0-alpha.134
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 +1355 -0
- package/LICENSE +202 -0
- package/README.md +173 -0
- package/__mocks__/emptyModule.js +2 -0
- package/jest.setup.cjs +5 -0
- package/package.json +73 -0
- package/rescript.json +41 -0
- package/scripts/deploy.sh +6 -0
- package/scripts/post-deploy.sh +5 -0
- package/scripts/pre-deploy.sh +18 -0
- package/scripts/pulumi-up.sh +30 -0
- package/src/Behavior.res +18 -0
- package/src/Behavior.res.mjs +2 -0
- package/src/ComponentType.res +125 -0
- package/src/ComponentType.res.mjs +199 -0
- package/src/Env.res +5 -0
- package/src/Env.res.mjs +2 -0
- package/src/Mapper.res +36 -0
- package/src/Mapper.res.mjs +18 -0
- package/src/Mapper1toN.res +107 -0
- package/src/Mapper1toN.res.mjs +2 -0
- package/src/MapperNto1.res +78 -0
- package/src/MapperNto1.res.mjs +35 -0
- package/src/Message.res +353 -0
- package/src/Message.res.mjs +418 -0
- package/src/PluginRuntimeOperations.res +15 -0
- package/src/PluginRuntimeOperations.res.mjs +2 -0
- package/src/Projection.res +447 -0
- package/src/Projection.res.mjs +712 -0
- package/src/ProjectionMapper.res +44 -0
- package/src/ProjectionMapper.res.mjs +51 -0
- package/src/RequestContext.res +42 -0
- package/src/RequestContext.res.mjs +39 -0
- package/src/adapter/Adapter.res +178 -0
- package/src/adapter/Adapter.res.mjs +201 -0
- package/src/adapter/AdapterDeploytime.res +56 -0
- package/src/adapter/AdapterDeploytime.res.mjs +42 -0
- package/src/adapter/Auth/Auth_Adapter.res +42 -0
- package/src/adapter/Auth/Auth_Adapter.res.mjs +2 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder.res +22 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder.res.mjs +2 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Common.res +259 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Common.res.mjs +190 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro.res +92 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro.res.mjs +59 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate.res +52 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate.res.mjs +49 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res +64 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res.mjs +59 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder.res +11 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder.res.mjs +2 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_PerEventCollector.res +46 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_PerEventCollector.res.mjs +40 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res +204 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res.mjs +150 -0
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder.res +18 -0
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder.res.mjs +2 -0
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder_PerExtensionPoint.res +36 -0
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder_PerExtensionPoint.res.mjs +28 -0
- package/src/adapter/Runtime/PluginRuntime_Builder.res +23 -0
- package/src/adapter/Runtime/PluginRuntime_Builder.res.mjs +2 -0
- package/src/adapter/Runtime/PluginRuntime_Builder_Micro.res +97 -0
- package/src/adapter/Runtime/PluginRuntime_Builder_Micro.res.mjs +62 -0
- package/src/adapter/Runtime/PluginRuntime_Builder_Single.res +89 -0
- package/src/adapter/Runtime/PluginRuntime_Builder_Single.res.mjs +62 -0
- package/src/adapter/Runtime/Runtime.res +106 -0
- package/src/adapter/Runtime/Runtime.res.mjs +22 -0
- package/src/adapter/Runtime/TaskRuntime_Builder.res +32 -0
- package/src/adapter/Runtime/TaskRuntime_Builder.res.mjs +2 -0
- package/src/adapter/Runtime/TaskRuntime_Builder_PerBucket.res +42 -0
- package/src/adapter/Runtime/TaskRuntime_Builder_PerBucket.res.mjs +29 -0
- package/src/admin/AdminApi.res +88 -0
- package/src/admin/AdminApi.res.mjs +89 -0
- package/src/admin/Admin_Callback.res +27 -0
- package/src/admin/Admin_Callback.res.mjs +20 -0
- package/src/admin/Platform_Admin.res +402 -0
- package/src/admin/Platform_Admin.res.mjs +250 -0
- package/src/admin/Platform_Admin_Structure.res +125 -0
- package/src/admin/Platform_Admin_Structure.res.mjs +182 -0
- package/src/admin/Platform_ComponentDefinitionsApi.res +160 -0
- package/src/admin/Platform_ComponentDefinitionsApi.res.mjs +299 -0
- package/src/admin/Platform_UIFragmentsApi.res +55 -0
- package/src/admin/Platform_UIFragmentsApi.res.mjs +124 -0
- package/src/admin/UIFragmentRegistryProjection.res +43 -0
- package/src/admin/UIFragmentRegistryProjection.res.mjs +81 -0
- package/src/admin/UIFragmentRegistryReadModelSpec.res +13 -0
- package/src/admin/UIFragmentRegistryReadModelSpec.res.mjs +40 -0
- package/src/components/Aggregate/Aggregate.res +96 -0
- package/src/components/Aggregate/Aggregate.res.mjs +82 -0
- package/src/components/Aggregate/Aggregate_Builder.res +175 -0
- package/src/components/Aggregate/Aggregate_Builder.res.mjs +119 -0
- package/src/components/Aggregate/Aggregate_Callback.res +273 -0
- package/src/components/Aggregate/Aggregate_Callback.res.mjs +208 -0
- package/src/components/Api/ApiAllowedStatesHelpers.res +19 -0
- package/src/components/Api/ApiAllowedStatesHelpers.res.mjs +16 -0
- package/src/components/Api/ApiNoApiHelpers.res +13 -0
- package/src/components/Api/ApiNoApiHelpers.res.mjs +29 -0
- package/src/components/Api/Api_Builder.res +40 -0
- package/src/components/Api/Api_Builder.res.mjs +33 -0
- package/src/components/Api/Api_Naming.res +92 -0
- package/src/components/Api/Api_Naming.res.mjs +103 -0
- package/src/components/Api/Api_Operations.res +13 -0
- package/src/components/Api/Api_Operations.res.mjs +12 -0
- package/src/components/Api/GraphQL_FragmentGenerator.res +612 -0
- package/src/components/Api/GraphQL_FragmentGenerator.res.mjs +503 -0
- package/src/components/Api/GraphQL_SchemaInspector.res +156 -0
- package/src/components/Api/GraphQL_SchemaInspector.res.mjs +123 -0
- package/src/components/Api/GraphQL_Stitcher.res +271 -0
- package/src/components/Api/GraphQL_Stitcher.res.mjs +229 -0
- package/src/components/Api/MCP_SchemaGenerator.res +185 -0
- package/src/components/Api/MCP_SchemaGenerator.res.mjs +146 -0
- package/src/components/Api/SchemaType.res +126 -0
- package/src/components/Api/SchemaType.res.mjs +143 -0
- package/src/components/Api/SuryToJsonSchema.res +142 -0
- package/src/components/Api/SuryToJsonSchema.res.mjs +210 -0
- package/src/components/AutomationSlice/AutomationSlice.res +39 -0
- package/src/components/AutomationSlice/AutomationSlice.res.mjs +24 -0
- package/src/components/AutomationSlice/AutomationSlice_Builder.res +207 -0
- package/src/components/AutomationSlice/AutomationSlice_Builder.res.mjs +123 -0
- package/src/components/AutomationSlice/AutomationSlice_Callback.res +212 -0
- package/src/components/AutomationSlice/AutomationSlice_Callback.res.mjs +189 -0
- package/src/components/Builder_Helpers.res +196 -0
- package/src/components/Builder_Helpers.res.mjs +142 -0
- package/src/components/Cloner.res +84 -0
- package/src/components/Cloner.res.mjs +88 -0
- package/src/components/CommandGenerator/CommandGenerator.res +54 -0
- package/src/components/CommandGenerator/CommandGenerator.res.mjs +15 -0
- package/src/components/CommandGenerator/CommandGenerator_Adapter.res +22 -0
- package/src/components/CommandGenerator/CommandGenerator_Adapter.res.mjs +2 -0
- package/src/components/CommandGenerator/CommandGenerator_Builder.res +70 -0
- package/src/components/CommandGenerator/CommandGenerator_Builder.res.mjs +68 -0
- package/src/components/CommandGenerator/CommandGenerator_Callback.res +191 -0
- package/src/components/CommandGenerator/CommandGenerator_Callback.res.mjs +161 -0
- package/src/components/CommandTopic/CommandTopic.res +79 -0
- package/src/components/CommandTopic/CommandTopic.res.mjs +68 -0
- package/src/components/CommandTopic/CommandTopic_Adapter.res +53 -0
- package/src/components/CommandTopic/CommandTopic_Adapter.res.mjs +2 -0
- package/src/components/CommandTopic/CommandTopic_Builder.res +146 -0
- package/src/components/CommandTopic/CommandTopic_Builder.res.mjs +127 -0
- package/src/components/CommandTopic/CommandTopic_Callback.res +38 -0
- package/src/components/CommandTopic/CommandTopic_Callback.res.mjs +49 -0
- package/src/components/CommandTopic/CommandTopic_Helpers.res +176 -0
- package/src/components/CommandTopic/CommandTopic_Helpers.res.mjs +195 -0
- package/src/components/CommandTopic/CommandTopic_Operations.res +40 -0
- package/src/components/CommandTopic/CommandTopic_Operations.res.mjs +49 -0
- package/src/components/Component.res +1 -0
- package/src/components/Component.res.mjs +34 -0
- package/src/components/Component.resi +1 -0
- package/src/components/Counter/Counter.res +47 -0
- package/src/components/Counter/Counter.res.mjs +55 -0
- package/src/components/Counter/Counter_Adapter.res +18 -0
- package/src/components/Counter/Counter_Adapter.res.mjs +2 -0
- package/src/components/Counter/Counter_Builder.res +142 -0
- package/src/components/Counter/Counter_Builder.res.mjs +112 -0
- package/src/components/Counter/Counter_Callback.res +94 -0
- package/src/components/Counter/Counter_Callback.res.mjs +70 -0
- package/src/components/Counter/Counter_Operations.res +70 -0
- package/src/components/Counter/Counter_Operations.res.mjs +91 -0
- package/src/components/Dcb/Dcb_Builder.res +971 -0
- package/src/components/Dcb/Dcb_Builder.res.mjs +572 -0
- package/src/components/DcbEventLog/DcbEventLog.res +43 -0
- package/src/components/DcbEventLog/DcbEventLog.res.mjs +24 -0
- package/src/components/DcbEventLog/DcbEventLog_Adapter.res +57 -0
- package/src/components/DcbEventLog/DcbEventLog_Adapter.res.mjs +2 -0
- package/src/components/DcbEventLog/DcbEventLog_Builder.res +72 -0
- package/src/components/DcbEventLog/DcbEventLog_Builder.res.mjs +67 -0
- package/src/components/DcbEventLog/DcbEventLog_Operations.res +160 -0
- package/src/components/DcbEventLog/DcbEventLog_Operations.res.mjs +121 -0
- package/src/components/EventCollector/EventCollector.res +34 -0
- package/src/components/EventCollector/EventCollector.res.mjs +9 -0
- package/src/components/EventCollector/EventCollector_Adapter.res +45 -0
- package/src/components/EventCollector/EventCollector_Adapter.res.mjs +2 -0
- package/src/components/EventCollector/EventCollector_Builder.res +91 -0
- package/src/components/EventCollector/EventCollector_Builder.res.mjs +64 -0
- package/src/components/EventLog/EventLog.res +27 -0
- package/src/components/EventLog/EventLog.res.mjs +13 -0
- package/src/components/EventLog/EventLog_Adapter.res +15 -0
- package/src/components/EventLog/EventLog_Adapter.res.mjs +2 -0
- package/src/components/EventLog/EventLog_Builder.res +65 -0
- package/src/components/EventLog/EventLog_Builder.res.mjs +57 -0
- package/src/components/EventLog/EventLog_Operations.res +209 -0
- package/src/components/EventLog/EventLog_Operations.res.mjs +202 -0
- package/src/components/EventLog/EventPublish_Callback.res +29 -0
- package/src/components/EventLog/EventPublish_Callback.res.mjs +32 -0
- package/src/components/EventMapper/EventMapper.res +72 -0
- package/src/components/EventMapper/EventMapper.res.mjs +54 -0
- package/src/components/EventMapper/EventMapper_Builder.res +128 -0
- package/src/components/EventMapper/EventMapper_Builder.res.mjs +81 -0
- package/src/components/EventMapper/EventMapper_Callback.res +323 -0
- package/src/components/EventMapper/EventMapper_Callback.res.mjs +231 -0
- package/src/components/EventTopic/EventTopic.res +69 -0
- package/src/components/EventTopic/EventTopic.res.mjs +50 -0
- package/src/components/EventTopic/EventTopic_Adapter.res +15 -0
- package/src/components/EventTopic/EventTopic_Adapter.res.mjs +2 -0
- package/src/components/EventTopic/EventTopic_Builder.res +53 -0
- package/src/components/EventTopic/EventTopic_Builder.res.mjs +46 -0
- package/src/components/EventTopic/EventTopic_Operations.res +37 -0
- package/src/components/EventTopic/EventTopic_Operations.res.mjs +39 -0
- package/src/components/Extension/Extension.res +32 -0
- package/src/components/Extension/Extension.res.mjs +9 -0
- package/src/components/Extension/Extension_Builder.res +82 -0
- package/src/components/Extension/Extension_Builder.res.mjs +57 -0
- package/src/components/Extension/Extension_Operations.res +203 -0
- package/src/components/Extension/Extension_Operations.res.mjs +154 -0
- package/src/components/ExtensionPoint/ExtensionPoint.res +49 -0
- package/src/components/ExtensionPoint/ExtensionPoint.res.mjs +25 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +163 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res.mjs +113 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Callback.res +110 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Callback.res.mjs +76 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Operations.res +146 -0
- package/src/components/ExtensionPoint/ExtensionPoint_Operations.res.mjs +122 -0
- package/src/components/Heartbeat/Heartbeat.res +25 -0
- package/src/components/Heartbeat/Heartbeat.res.mjs +9 -0
- package/src/components/Heartbeat/Heartbeat_Adapter.res +14 -0
- package/src/components/Heartbeat/Heartbeat_Adapter.res.mjs +2 -0
- package/src/components/Heartbeat/Heartbeat_Builder.res +43 -0
- package/src/components/Heartbeat/Heartbeat_Builder.res.mjs +47 -0
- package/src/components/Heartbeat/Heartbeat_Callback.res +32 -0
- package/src/components/Heartbeat/Heartbeat_Callback.res.mjs +40 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice.res +34 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice.res.mjs +24 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res +98 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Builder.res.mjs +87 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res +191 -0
- package/src/components/InboundTranslationSlice/InboundTranslationSlice_Callback.res.mjs +175 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice.res +35 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice.res.mjs +24 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res +181 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Builder.res.mjs +137 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res +173 -0
- package/src/components/OutboundTranslationSlice/OutboundTranslationSlice_Callback.res.mjs +173 -0
- package/src/components/QueryDb/QueryDb.res +74 -0
- package/src/components/QueryDb/QueryDb.res.mjs +37 -0
- package/src/components/QueryDb/QueryDb_Adapter.res +78 -0
- package/src/components/QueryDb/QueryDb_Adapter.res.mjs +17 -0
- package/src/components/QueryDb/QueryDb_Builder.res +76 -0
- package/src/components/QueryDb/QueryDb_Builder.res.mjs +53 -0
- package/src/components/QueryDb/QueryDb_Callback.res +18 -0
- package/src/components/QueryDb/QueryDb_Callback.res.mjs +21 -0
- package/src/components/QueryDb/QueryDb_Operations.res +116 -0
- package/src/components/QueryDb/QueryDb_Operations.res.mjs +165 -0
- package/src/components/ReadModel/ReadModel.res +42 -0
- package/src/components/ReadModel/ReadModel.res.mjs +27 -0
- package/src/components/ReadModel/ReadModel_Builder.res +155 -0
- package/src/components/ReadModel/ReadModel_Builder.res.mjs +101 -0
- package/src/components/ReadModel/ReadModel_Callback.res +48 -0
- package/src/components/ReadModel/ReadModel_Callback.res.mjs +48 -0
- package/src/components/Scheduler/Scheduler.res +13 -0
- package/src/components/Scheduler/Scheduler.res.mjs +9 -0
- package/src/components/Scheduler/Scheduler_Adapter.res +13 -0
- package/src/components/Scheduler/Scheduler_Adapter.res.mjs +2 -0
- package/src/components/Scheduler/Scheduler_Builder.res +19 -0
- package/src/components/Scheduler/Scheduler_Builder.res.mjs +29 -0
- package/src/components/SideEffectHandler/SideEffectHandler.res +30 -0
- package/src/components/SideEffectHandler/SideEffectHandler.res.mjs +12 -0
- package/src/components/SideEffectHandler/SideEffectHandler_Builder.res +117 -0
- package/src/components/SideEffectHandler/SideEffectHandler_Builder.res.mjs +64 -0
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res +116 -0
- package/src/components/SideEffectHandler/SideEffectHandler_Callback.res.mjs +95 -0
- package/src/components/StateChangeSlice/StateChangeSlice.res +38 -0
- package/src/components/StateChangeSlice/StateChangeSlice.res.mjs +17 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res +91 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Builder.res.mjs +81 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res +412 -0
- package/src/components/StateChangeSlice/StateChangeSlice_Callback.res.mjs +299 -0
- package/src/components/StateTopic.res +91 -0
- package/src/components/StateTopic.res.mjs +41 -0
- package/src/components/StateViewSlice/StateViewSlice.res +33 -0
- package/src/components/StateViewSlice/StateViewSlice.res.mjs +24 -0
- package/src/components/StateViewSlice/StateViewSlice_Builder.res +176 -0
- package/src/components/StateViewSlice/StateViewSlice_Builder.res.mjs +134 -0
- package/src/components/StateViewSlice/StateViewSlice_Callback.res +64 -0
- package/src/components/StateViewSlice/StateViewSlice_Callback.res.mjs +56 -0
- package/src/components/Task/Task.res +81 -0
- package/src/components/Task/Task.res.mjs +51 -0
- package/src/components/Task/Task_Adapter.res +31 -0
- package/src/components/Task/Task_Adapter.res.mjs +2 -0
- package/src/components/Task/Task_Builder.res +223 -0
- package/src/components/Task/Task_Builder.res.mjs +115 -0
- package/src/plugin/api/PluginBaseFragment.res +104 -0
- package/src/plugin/api/PluginBaseFragment.res.mjs +64 -0
- package/src/plugin/component/Plugin.res +100 -0
- package/src/plugin/component/Plugin.res.mjs +61 -0
- package/src/plugin/component/Plugin_Builder.res +1017 -0
- package/src/plugin/component/Plugin_Builder.res.mjs +608 -0
- package/src/plugin/component/Plugin_BuiltHook.res +141 -0
- package/src/plugin/component/Plugin_BuiltHook.res.mjs +39 -0
- package/src/plugin/component/Plugin_Callback.res +98 -0
- package/src/plugin/component/Plugin_Callback.res.mjs +55 -0
- package/src/plugin/component/Plugin_Helpers.res +1730 -0
- package/src/plugin/component/Plugin_Helpers.res.mjs +1010 -0
- package/src/plugin/component/Plugin_ResolverError.res +27 -0
- package/src/plugin/component/Plugin_ResolverError.res.mjs +21 -0
- package/src/plugin/component/Plugin_Structure.res +570 -0
- package/src/plugin/component/Plugin_Structure.res.mjs +458 -0
- package/src/plugin/component/Plugin_SubscriptionSchema.res +103 -0
- package/src/plugin/component/Plugin_SubscriptionSchema.res.mjs +71 -0
- package/src/plugin/component/SchemaWalker.res +164 -0
- package/src/plugin/component/SchemaWalker.res.mjs +183 -0
- package/src/plugin/connect/PluginConnectExtension_Builder.res +14 -0
- package/src/plugin/connect/PluginConnectExtension_Builder.res.mjs +36 -0
- package/src/plugin/connect/PluginConnectExtension_Mapping.res +76 -0
- package/src/plugin/connect/PluginConnectExtension_Mapping.res.mjs +89 -0
- package/src/plugin/connect/PluginExtensionPoint_Builder.res +39 -0
- package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +33 -0
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res +231 -0
- package/src/plugin/connect/PluginExtensionPoint_Plugin.res.mjs +353 -0
- package/src/plugin/lifecycle/PluginBehavior.res +250 -0
- package/src/plugin/lifecycle/PluginBehavior.res.mjs +391 -0
- package/src/plugin/lifecycle/PluginSpec.res +84 -0
- package/src/plugin/lifecycle/PluginSpec.res.mjs +148 -0
- package/src/plugin/lifecycle/PluginsProjection.res +154 -0
- package/src/plugin/lifecycle/PluginsProjection.res.mjs +230 -0
- package/src/plugin/lifecycle/PluginsReadModelSpec.res +66 -0
- package/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs +58 -0
- package/src/util/AWS.res +7 -0
- package/src/util/AWS.res.mjs +20 -0
- package/src/util/CSV.res +27 -0
- package/src/util/CSV.res.mjs +56 -0
- package/src/util/CommandPublisher.res +133 -0
- package/src/util/CommandPublisher.res.mjs +161 -0
- package/src/util/CsvStream.res +39 -0
- package/src/util/CsvStream.res.mjs +42 -0
- package/src/util/EffectLogger.res +178 -0
- package/src/util/EffectLogger.res.mjs +171 -0
- package/src/util/FTP.res +69 -0
- package/src/util/FTP.res.mjs +101 -0
- package/src/util/FTPHandler.res +142 -0
- package/src/util/FTPHandler.res.mjs +136 -0
- package/src/util/Hash.res +1 -0
- package/src/util/Hash.res.mjs +10 -0
- package/src/util/Interstack.res +74 -0
- package/src/util/Interstack.res.mjs +126 -0
- package/src/util/Interstack.resi +25 -0
- package/src/util/LogFormat.res +222 -0
- package/src/util/LogFormat.res.mjs +257 -0
- package/src/util/Logger.res +196 -0
- package/src/util/Logger.res.mjs +238 -0
- package/src/util/Lru.res +51 -0
- package/src/util/Lru.res.mjs +59 -0
- package/src/util/Lru.resi +32 -0
- package/src/util/Metrics.res +32 -0
- package/src/util/Metrics.res.mjs +42 -0
- package/src/util/OutputFailsafeDeploytime.res +16 -0
- package/src/util/OutputFailsafeDeploytime.res.mjs +20 -0
- package/src/util/OutputFailsafeRuntime.res +6 -0
- package/src/util/OutputFailsafeRuntime.res.mjs +15 -0
- package/src/util/OutputLogger.res +9 -0
- package/src/util/OutputLogger.res.mjs +19 -0
- package/src/util/ResourceQuery.res +14 -0
- package/src/util/ResourceQuery.res.mjs +17 -0
- package/src/util/ResourceQueryRuntime.res +17 -0
- package/src/util/ResourceQueryRuntime.res.mjs +18 -0
- package/src/util/ScheduleOps.res +124 -0
- package/src/util/ScheduleOps.res.mjs +132 -0
- package/src/util/Util.res +12 -0
- package/src/util/Util.res.mjs +42 -0
- package/src/util/Util_Adapter.res +97 -0
- package/src/util/Util_Adapter.res.mjs +82 -0
- package/src/util/Util_AdapterRuntime.res +39 -0
- package/src/util/Util_AdapterRuntime.res.mjs +42 -0
- package/src/util/Util_Array.res +2 -0
- package/src/util/Util_Array.res.mjs +12 -0
- package/src/util/Util_Error.res +16 -0
- package/src/util/Util_Error.res.mjs +19 -0
- package/src/util/Util_Promise.res +67 -0
- package/src/util/Util_Promise.res.mjs +105 -0
- package/src/util/Util_Pulumi.res +35 -0
- package/src/util/Util_Pulumi.res.mjs +55 -0
- package/src/util/Util_Pulumi.resi +21 -0
- package/src/util/Util_QueryDb.res +14 -0
- package/src/util/Util_QueryDb.res.mjs +21 -0
- package/src/util/Util_QueryDbRuntime.res +11 -0
- package/src/util/Util_QueryDbRuntime.res.mjs +19 -0
- package/src/util/Util_ReadModel.res +2 -0
- package/src/util/Util_ReadModel.res.mjs +10 -0
- package/src/util/Util_StackRefs.res +24 -0
- package/src/util/Util_StackRefs.res.mjs +39 -0
- package/src/util/Validation.res +75 -0
- package/src/util/Validation.res.mjs +181 -0
- package/tests/.gitkeep +0 -0
- package/tests/IdentityTest.res +155 -0
- package/tests/IdentityTest.res.mjs +174 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res +237 -0
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +298 -0
- package/tests/admin/Platform_UIFragmentsApiTest.res +96 -0
- package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +101 -0
- package/tests/aggregate/AggregateCallbackTest.res +81 -0
- package/tests/aggregate/AggregateCallbackTest.res.mjs +140 -0
- package/tests/aggregate/AggregateCausationTest.res +49 -0
- package/tests/aggregate/AggregateCausationTest.res.mjs +44 -0
- package/tests/aggregate/AggregateConflictTest.res +212 -0
- package/tests/aggregate/AggregateConflictTest.res.mjs +363 -0
- package/tests/aggregate/AggregateFixtures.res +177 -0
- package/tests/aggregate/AggregateFixtures.res.mjs +285 -0
- package/tests/aggregate/AggregateRejectionTest.res +139 -0
- package/tests/aggregate/AggregateRejectionTest.res.mjs +163 -0
- package/tests/api/ApiNoApiTest.res +62 -0
- package/tests/api/ApiNoApiTest.res.mjs +90 -0
- package/tests/api/GraphQL_StitcherTest.res +107 -0
- package/tests/api/GraphQL_StitcherTest.res.mjs +99 -0
- package/tests/api/SimpleTest.res +7 -0
- package/tests/api/SimpleTest.res.mjs +10 -0
- package/tests/api/SuryToJsonSchemaTest.res +405 -0
- package/tests/api/SuryToJsonSchemaTest.res.mjs +623 -0
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res +128 -0
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +160 -0
- package/tests/commandgenerator/CommandGeneratorFixtures.res +139 -0
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +197 -0
- package/tests/commandtopic/CommandTopicCallbackFixtures.res +87 -0
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +152 -0
- package/tests/commandtopic/CommandTopicCallbackTest.res +66 -0
- package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +106 -0
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res +83 -0
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +109 -0
- package/tests/counter/CounterCallbackTest.res +83 -0
- package/tests/counter/CounterCallbackTest.res.mjs +140 -0
- package/tests/counter/CounterFixtures.res +57 -0
- package/tests/counter/CounterFixtures.res.mjs +67 -0
- package/tests/dcb/DcbDecodeTest.res +122 -0
- package/tests/dcb/DcbDecodeTest.res.mjs +194 -0
- package/tests/dcb/DcbEventLogOperationsTest.res +195 -0
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +268 -0
- package/tests/dcb/DcbFixtures.res +422 -0
- package/tests/dcb/DcbFixtures.res.mjs +534 -0
- package/tests/dcb/DcbScopeInferenceTest.res +242 -0
- package/tests/dcb/DcbScopeInferenceTest.res.mjs +480 -0
- package/tests/dcb/DcbStateChangeSliceTest.res +362 -0
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +546 -0
- package/tests/dcb/DcbTagTest.res +978 -0
- package/tests/dcb/DcbTagTest.res.mjs +867 -0
- package/tests/dcb/DcbValidationTest.res +349 -0
- package/tests/dcb/DcbValidationTest.res.mjs +476 -0
- package/tests/eventlog/EventLogFixtures.res +113 -0
- package/tests/eventlog/EventLogFixtures.res.mjs +166 -0
- package/tests/eventlog/EventLogOperationsTest.res +96 -0
- package/tests/eventlog/EventLogOperationsTest.res.mjs +192 -0
- package/tests/eventlog/EventLogRetryTest.res +121 -0
- package/tests/eventlog/EventLogRetryTest.res.mjs +171 -0
- package/tests/eventmapper/EventMapperCallbackTest.res +134 -0
- package/tests/eventmapper/EventMapperCallbackTest.res.mjs +141 -0
- package/tests/eventmapper/EventMapperFixtures.res +255 -0
- package/tests/eventmapper/EventMapperFixtures.res.mjs +440 -0
- package/tests/eventmapper/EventMapperTest.res +53 -0
- package/tests/eventmapper/EventMapperTest.res.mjs +83 -0
- package/tests/eventtopic/EventTopicFixtures.res +36 -0
- package/tests/eventtopic/EventTopicFixtures.res.mjs +65 -0
- package/tests/eventtopic/EventTopicOperationsTest.res +48 -0
- package/tests/eventtopic/EventTopicOperationsTest.res.mjs +71 -0
- package/tests/extensionpoint/ExtensionPointCallbackTest.res +84 -0
- package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +94 -0
- package/tests/extensionpoint/ExtensionPointFixtures.res +173 -0
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +205 -0
- package/tests/extensionpoint/ExtensionPointOperationsTest.res +261 -0
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +304 -0
- package/tests/ftp/FTPTest.res +64 -0
- package/tests/ftp/FTPTest.res.mjs +88 -0
- package/tests/logger/LogFormatTest.res +348 -0
- package/tests/logger/LogFormatTest.res.mjs +309 -0
- package/tests/message/MessageTest.res +95 -0
- package/tests/message/MessageTest.res.mjs +93 -0
- package/tests/message/MetaEnvelopeTest.res +200 -0
- package/tests/message/MetaEnvelopeTest.res.mjs +188 -0
- package/tests/plugin/ManifestVisibilityTest.res +137 -0
- package/tests/plugin/ManifestVisibilityTest.res.mjs +205 -0
- package/tests/plugin/PluginSpecExperiment.res +13 -0
- package/tests/plugin/PluginSpecExperiment.res.mjs +31 -0
- package/tests/plugin/PluginStructureTest.res +298 -0
- package/tests/plugin/PluginStructureTest.res.mjs +388 -0
- package/tests/plugin/PluginVersionTest.res +34 -0
- package/tests/plugin/PluginVersionTest.res.mjs +30 -0
- package/tests/plugin/SchemaWalkerTest.res +115 -0
- package/tests/plugin/SchemaWalkerTest.res.mjs +160 -0
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res +24 -0
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +62 -0
- package/tests/plugin/StateChangeSlice/PsShipOrder.res +29 -0
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +69 -0
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res +24 -0
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +94 -0
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res +18 -0
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +69 -0
- package/tests/plugin/StateViewSlice/PsCustomersView.res +22 -0
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +69 -0
- package/tests/plugin/StateViewSlice/PsOrdersView.res +20 -0
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +81 -0
- package/tests/poc/StructuralSubtypingPoc.res +211 -0
- package/tests/poc/StructuralSubtypingPoc.res.mjs +61 -0
- package/tests/querydb/QueryDbFixtures.res +65 -0
- package/tests/querydb/QueryDbFixtures.res.mjs +135 -0
- package/tests/querydb/QueryDbOperationsTest.res +94 -0
- package/tests/querydb/QueryDbOperationsTest.res.mjs +168 -0
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res +56 -0
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +77 -0
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res +96 -0
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +139 -0
- package/tests/util/CsvStreamTest.res +54 -0
- package/tests/util/CsvStreamTest.res.mjs +51 -0
- package/tests/util/LruTest.res +73 -0
- package/tests/util/LruTest.res.mjs +105 -0
- package/tests/util/MetricsTest.res +36 -0
- package/tests/util/MetricsTest.res.mjs +53 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
5
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
6
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
9
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
10
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
11
|
+
import * as LogFormat$ReventlessCore from "../../util/LogFormat.res.mjs";
|
|
12
|
+
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
13
|
+
import * as Util_Promise$ReventlessCore from "../../util/Util_Promise.res.mjs";
|
|
14
|
+
import * as PluginExtensionPointSpec$ReventlessInfra from "@reventlessdev/reventless-infra/src/types/PluginExtensionPointSpec.res.mjs";
|
|
15
|
+
|
|
16
|
+
function Make(MappingSpec) {
|
|
17
|
+
return Mappings => (Ops => {
|
|
18
|
+
let comp = `Extension(` + MappingSpec.name + `.` + Mappings.name + `)`;
|
|
19
|
+
let findOutgoingMapping = (delegateNameOpt, mappings) => Stdlib_Option.flatMap(delegateNameOpt, delegateName => mappings.find(Mapping => Mapping.delegateName === delegateName));
|
|
20
|
+
let mapIncomingEvent = (event$p, pluginDef, queryEngine) => Mappings.mappings.map(Mapping => Mapping.mapIncomingEvent(event$p, pluginDef, queryEngine)).flat();
|
|
21
|
+
let mapOutgoingEvent = (eventJson$p, pluginDef) => {
|
|
22
|
+
let Mapping = findOutgoingMapping(Message$ReventlessCore.serviceNameOfMsg(eventJson$p), Mappings.mappings);
|
|
23
|
+
if (Mapping === undefined) {
|
|
24
|
+
return Stdlib_JsError.throwWithMessage("ExtensionPoint.Mapping: Missing mapping for " + JSON.stringify(eventJson$p));
|
|
25
|
+
}
|
|
26
|
+
let mapOutgoingEvent$1 = Mapping.mapOutgoingEvent;
|
|
27
|
+
if (mapOutgoingEvent$1 !== undefined) {
|
|
28
|
+
return mapOutgoingEvent$1(eventJson$p, pluginDef);
|
|
29
|
+
} else {
|
|
30
|
+
Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, "mapOutgoingEvent: shouldn't be called, because Plugin EventCollector shouldn't subscribe to EventLog stream not having mapOutgoingEvent() !"));
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
let publishAggregateCommand = async (aggregateName, cmdJson) => {
|
|
35
|
+
Effect.runSync(EffectLogger$ReventlessCore.logInfo(comp, undefined, `EP→` + aggregateName + `: ` + LogFormat$ReventlessCore.bold(Message$ReventlessCore.variantNameOfJson(cmdJson.commandJson)) + `(` + cmdJson.id + `)`));
|
|
36
|
+
let pub = Stdlib_Option.getOrThrow(Ops.publishToAggregates[aggregateName], undefined);
|
|
37
|
+
try {
|
|
38
|
+
return await pub([cmdJson]);
|
|
39
|
+
} catch (raw_err) {
|
|
40
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
41
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
42
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `Error on publish command to aggregate ` + aggregateName + `: ` + errMsg));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
let publishPluginExtensionPointCommand = async cmdJson => {
|
|
46
|
+
try {
|
|
47
|
+
return await Ops.publishToPluginExtensionPoint([cmdJson]);
|
|
48
|
+
} catch (raw_err) {
|
|
49
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
50
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
51
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `Error on publish command to Plugin ExtensionPoint: ` + errMsg));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
let forwardCommand = (extensionPointName, commandJson) => {
|
|
55
|
+
let command = {
|
|
56
|
+
TAG: "ForwardCommand",
|
|
57
|
+
_0: {
|
|
58
|
+
extensionPointName: extensionPointName,
|
|
59
|
+
id: commandJson.id,
|
|
60
|
+
command: Message$ReventlessCore.toMessageBody(commandJson)
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return publishPluginExtensionPointCommand({
|
|
64
|
+
id: "",
|
|
65
|
+
meta: Message$ReventlessCore.deriveMeta(commandJson.meta, undefined),
|
|
66
|
+
commandJson: Message$ReventlessCore.encode(command, PluginExtensionPointSpec$ReventlessInfra.commandSchema)
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
let handleDirective = async handler => {
|
|
70
|
+
try {
|
|
71
|
+
return await handler();
|
|
72
|
+
} catch (raw_err) {
|
|
73
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
74
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
75
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `Error on handling directive: ` + errMsg));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
let applyIncomingCommandAction = async action => {
|
|
79
|
+
let tmp;
|
|
80
|
+
switch (action.TAG) {
|
|
81
|
+
case "AbstractPublishAggregateCommand" :
|
|
82
|
+
tmp = publishAggregateCommand(action._0, action._1);
|
|
83
|
+
break;
|
|
84
|
+
case "AbstractPublishAggregateCommandAsync" :
|
|
85
|
+
let match = await action._0;
|
|
86
|
+
tmp = publishAggregateCommand(match[0], match[1]);
|
|
87
|
+
break;
|
|
88
|
+
case "AbstractPublishAggregateCommandsAsync" :
|
|
89
|
+
let publish = async promise => await Util_Promise$ReventlessCore.toUnit(Util_Promise$ReventlessCore.mapOk(promise, arr => Promise.all(arr.map(param => publishAggregateCommand(param[0], param[1])))));
|
|
90
|
+
tmp = publish(action._0);
|
|
91
|
+
break;
|
|
92
|
+
case "AbstractPublishPluginExtensionPointCommand" :
|
|
93
|
+
tmp = publishPluginExtensionPointCommand(action._0);
|
|
94
|
+
break;
|
|
95
|
+
case "AbstractPublishExtensionPointCommand" :
|
|
96
|
+
tmp = forwardCommand(action._0, action._1);
|
|
97
|
+
break;
|
|
98
|
+
case "AbstractHandleDirective" :
|
|
99
|
+
tmp = handleDirective(action._0);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return await tmp;
|
|
103
|
+
};
|
|
104
|
+
let applyOutgoingCommandAction = async action => {
|
|
105
|
+
switch (action.TAG) {
|
|
106
|
+
case "AbstractPublishPluginExtensionPointCommand" :
|
|
107
|
+
return publishPluginExtensionPointCommand(action._0);
|
|
108
|
+
case "AbstractPublishExtensionPointCommand" :
|
|
109
|
+
return forwardCommand(action._0, action._1);
|
|
110
|
+
case "AbstractHandleDirective" :
|
|
111
|
+
return handleDirective(action._0);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
let incomingJsonEventsHandler = async (eventJson$p, pluginDef) => {
|
|
115
|
+
Effect.runSync(EffectLogger$ReventlessCore.logInfo(comp, undefined, `incoming EP event: ` + LogFormat$ReventlessCore.eventSummary(eventJson$p)));
|
|
116
|
+
let event$p;
|
|
117
|
+
try {
|
|
118
|
+
event$p = Message$ReventlessCore.decodeEvent$p(eventJson$p, Id$Reventless.StringPure.schema, MappingSpec.eventSchema);
|
|
119
|
+
} catch (raw_err) {
|
|
120
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
121
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
122
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `Could not decode event': ` + JSON.stringify(eventJson$p) + ` ` + errMsg));
|
|
123
|
+
}
|
|
124
|
+
let commandActions = mapIncomingEvent(event$p, pluginDef, Ops.queryEngine);
|
|
125
|
+
let apply = async commandActions => await Util_Promise$ReventlessCore.toUnit(Promise.all(commandActions.map(applyIncomingCommandAction)));
|
|
126
|
+
await apply(commandActions);
|
|
127
|
+
let p = Stdlib_Option.map(Ops.readModelNamesForSourceName[event$p.meta.service], readModelNames => Promise.all(Stdlib_Array.filterMap(readModelNames, readModelName => Stdlib_Option.map(Ops.publishToReadModels[readModelName], enqueueEvent => enqueueEvent(0, event$p.id, JSON.stringify(eventJson$p))))));
|
|
128
|
+
if (p !== undefined) {
|
|
129
|
+
await p;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
let outgoingJsonEventsHandler = (eventJson$p, pluginDef) => {
|
|
134
|
+
Effect.runSync(EffectLogger$ReventlessCore.logInfo(comp, undefined, `outgoing delegate event: ` + LogFormat$ReventlessCore.eventSummary(eventJson$p)));
|
|
135
|
+
let commandActions = mapOutgoingEvent(eventJson$p, pluginDef);
|
|
136
|
+
return Util_Promise$ReventlessCore.toUnit(Promise.all(commandActions.map(applyOutgoingCommandAction)));
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
incomingJsonEventsHandler: incomingJsonEventsHandler,
|
|
140
|
+
outgoingJsonEventsHandler: outgoingJsonEventsHandler
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let PluginExtensionPointSpec;
|
|
146
|
+
|
|
147
|
+
let ExtensionMapping;
|
|
148
|
+
|
|
149
|
+
export {
|
|
150
|
+
PluginExtensionPointSpec,
|
|
151
|
+
ExtensionMapping,
|
|
152
|
+
Make,
|
|
153
|
+
}
|
|
154
|
+
/* Stdlib_JsExn Not a pure module */
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
let componentType = ComponentType.ExtensionPoint
|
|
2
|
+
|
|
3
|
+
type outputs = ReventlessInfra.ExtensionPoint.outputs
|
|
4
|
+
type t
|
|
5
|
+
type component<'operations> = Component.t<t, outputs, 'operations>
|
|
6
|
+
|
|
7
|
+
type jsonEventsHandler = (JSON.t, Reventless.Plugin.pluginDefinition) => promise<unit>
|
|
8
|
+
type operations = {outgoingJsonEventsHandler: jsonEventsHandler}
|
|
9
|
+
|
|
10
|
+
module type T = {
|
|
11
|
+
type operations = operations
|
|
12
|
+
type component = component<operations>
|
|
13
|
+
|
|
14
|
+
let make: (
|
|
15
|
+
~aggregateResources: dict<array<ReventlessInfra.Adapter.resource>>,
|
|
16
|
+
~publishToAggregates: dict<CommandTopic.publishJsons>,
|
|
17
|
+
~scheduler: Scheduler.operations,
|
|
18
|
+
~queryEngine: Reventless.QueryEngine.operations,
|
|
19
|
+
~resourceNaming: ReventlessInfra.ResourceNaming.operations,
|
|
20
|
+
~opts: option<Pulumi.ComponentResource.options>,
|
|
21
|
+
) => component
|
|
22
|
+
let outputs: component => outputs
|
|
23
|
+
let operations: component => Pulumi.Output.t<operations>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module type Mappings = {
|
|
27
|
+
module Spec: ReventlessInfra.ExtensionPointMapping.Spec
|
|
28
|
+
module type Mapping = ReventlessInfra.ExtensionPointMapping.T with module ExtensionPoint := Spec
|
|
29
|
+
let name: string
|
|
30
|
+
let moduleUrl: string
|
|
31
|
+
let mappings: array<module(Mapping)>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let toResolvedOutputs = (
|
|
35
|
+
outputs: outputs,
|
|
36
|
+
): Pulumi.Output.t<ReventlessInterop.ExtensionPoint.resolvedOutputs> =>
|
|
37
|
+
(
|
|
38
|
+
outputs.commandTopic->Pulumi.Output.flatMap(CommandTopic.toResolvedOutputs),
|
|
39
|
+
outputs.eventTopic->Pulumi.Output.flatMap(EventTopic.toResolvedOutputs),
|
|
40
|
+
)
|
|
41
|
+
->Pulumi.Output.all2
|
|
42
|
+
->Pulumi.Output.apply(((commandTopic, eventTopic)) => {
|
|
43
|
+
let resolved: ReventlessInterop.ExtensionPoint.resolvedOutputs = {
|
|
44
|
+
name: outputs.name,
|
|
45
|
+
commandTopic,
|
|
46
|
+
eventTopic,
|
|
47
|
+
}
|
|
48
|
+
resolved
|
|
49
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
4
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
5
|
+
import * as EventTopic$ReventlessCore from "../EventTopic/EventTopic.res.mjs";
|
|
6
|
+
import * as CommandTopic$ReventlessCore from "../CommandTopic/CommandTopic.res.mjs";
|
|
7
|
+
|
|
8
|
+
function toResolvedOutputs(outputs) {
|
|
9
|
+
return Pulumi.all([
|
|
10
|
+
Output$Pulumi.flatMap(outputs.commandTopic, CommandTopic$ReventlessCore.toResolvedOutputs),
|
|
11
|
+
Output$Pulumi.flatMap(outputs.eventTopic, EventTopic$ReventlessCore.toResolvedOutputs)
|
|
12
|
+
]).apply(param => ({
|
|
13
|
+
name: outputs.name,
|
|
14
|
+
commandTopic: param[0],
|
|
15
|
+
eventTopic: param[1]
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let componentType = "ExtensionPoint";
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
componentType,
|
|
23
|
+
toResolvedOutputs,
|
|
24
|
+
}
|
|
25
|
+
/* Output-Pulumi Not a pure module */
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
module Make = (
|
|
2
|
+
Spec: ReventlessInfra.ExtensionPointMapping.Spec,
|
|
3
|
+
Mappings: ExtensionPoint.Mappings with module Spec := Spec,
|
|
4
|
+
RuntimeEnvironment: Runtime.Environment,
|
|
5
|
+
CommandTopicChannel: CommandTopic_Adapter.Channel
|
|
6
|
+
with type runtimeParts = RuntimeEnvironment.parts,
|
|
7
|
+
EventTopicAdapter: EventTopic_Adapter.Publisher,
|
|
8
|
+
ExtensionPointRuntimeBuilder: ExtensionPointRuntime_Builder.T
|
|
9
|
+
with module CommandTopicChannel := CommandTopicChannel,
|
|
10
|
+
): ExtensionPoint.T => {
|
|
11
|
+
module Spec = Spec
|
|
12
|
+
|
|
13
|
+
type operations = ExtensionPoint.operations
|
|
14
|
+
type component = ExtensionPoint.component<operations>
|
|
15
|
+
|
|
16
|
+
module SpecWithId: Reventless.ExtensionPoint.Spec
|
|
17
|
+
with type command = Spec.command
|
|
18
|
+
and type event = Spec.event
|
|
19
|
+
and type directive = Spec.directive = {
|
|
20
|
+
include Spec
|
|
21
|
+
module Id = Reventless.Id.String
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let filterAggregateResources = (aggregateResources, aggregateNames) =>
|
|
25
|
+
aggregateResources
|
|
26
|
+
->Dict.toArray
|
|
27
|
+
->Array.filter(((name, _)) =>
|
|
28
|
+
aggregateNames->Array.some(aggregateName => aggregateName == name)
|
|
29
|
+
)
|
|
30
|
+
->Array.map(((_, resources)) => resources)
|
|
31
|
+
->Array.flat
|
|
32
|
+
|
|
33
|
+
let construct = (
|
|
34
|
+
~aggregateResources,
|
|
35
|
+
~publishToAggregates,
|
|
36
|
+
~scheduler: Scheduler.operations,
|
|
37
|
+
~queryEngine: Reventless.QueryEngine.operations,
|
|
38
|
+
~resourceNaming: ReventlessInfra.ResourceNaming.operations,
|
|
39
|
+
self,
|
|
40
|
+
name,
|
|
41
|
+
) => {
|
|
42
|
+
let opts = {Pulumi.ComponentResource.parent: self->Component.toPulumiResource}
|
|
43
|
+
let childName = name->String.replace(".", "")->ComponentType.name(ExtensionPoint.componentType)
|
|
44
|
+
|
|
45
|
+
module SpecificCommandTopic = CommandTopic_Builder.Make(SpecWithId, CommandTopicChannel)
|
|
46
|
+
let commandTopic = SpecificCommandTopic.make(~name=childName, ~opts)
|
|
47
|
+
|
|
48
|
+
let aggregateNames =
|
|
49
|
+
Mappings.mappings->Array.filterMap((module(Mapping)) =>
|
|
50
|
+
Mapping.mapOutgoingEvent->Option.map(_ => Mapping.delegateName)
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
let commandTopicResources =
|
|
54
|
+
(commandTopic->CommandTopic_Adapter.channel).resources->Adapter.resourcesToResolvedOutput
|
|
55
|
+
|
|
56
|
+
let (commandTopic, eventTopic, outgoingJsonEventsHandler) =
|
|
57
|
+
commandTopicResources
|
|
58
|
+
->Pulumi.Output.flatMap(commandTopicResources => {
|
|
59
|
+
module ExtensionPointCallback = ExtensionPoint_Callback.Make(
|
|
60
|
+
{
|
|
61
|
+
let publishToAggregates = publishToAggregates
|
|
62
|
+
let commandTopicResources = commandTopicResources
|
|
63
|
+
let scheduler = scheduler
|
|
64
|
+
let queryEngine = queryEngine
|
|
65
|
+
let resourceNaming = resourceNaming
|
|
66
|
+
},
|
|
67
|
+
Spec,
|
|
68
|
+
Mappings,
|
|
69
|
+
)
|
|
70
|
+
let handler = SpecificCommandTopic.makeHandler(
|
|
71
|
+
~commandTopic,
|
|
72
|
+
~commandsHandler=ExtensionPointCallback.handleIncomingCommands,
|
|
73
|
+
)
|
|
74
|
+
let resources = aggregateResources->filterAggregateResources(aggregateNames)
|
|
75
|
+
|
|
76
|
+
// Each adapter chooses what string the EP runtime should treat as the
|
|
77
|
+
// publish address for a target aggregate; by convention we expose the
|
|
78
|
+
// first command-topic resource's `id`. The in-memory ExtensionPoint
|
|
79
|
+
// runtime builder ignores this dict, so including every aggregate
|
|
80
|
+
// (not just mapping targets) and the empty fallback are both harmless.
|
|
81
|
+
let publishToAggregatesQueueUrls =
|
|
82
|
+
aggregateResources->Dict.mapValues(resources =>
|
|
83
|
+
switch resources->Array.get(0) {
|
|
84
|
+
| Some(r: ReventlessInfra.Adapter.resource) => r.id
|
|
85
|
+
| None => Pulumi.Output.make("")
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
commandTopic->ExtensionPointRuntimeBuilder.forCommandTopic(
|
|
90
|
+
~handler,
|
|
91
|
+
~connect=SpecificCommandTopic.connect(commandTopic, ~resources, ...),
|
|
92
|
+
~specModulePath=Spec.moduleUrl,
|
|
93
|
+
~mappingsModulePath=Mappings.moduleUrl,
|
|
94
|
+
~publishToAggregatesQueueUrls,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
module SpecificEventTopic = EventTopic_Builder.Make(SpecWithId, EventTopicAdapter)
|
|
98
|
+
let eventTopic = SpecificEventTopic.make(~name=childName, ~storageResources=[], ~opts)
|
|
99
|
+
|
|
100
|
+
eventTopic
|
|
101
|
+
->Component.operations
|
|
102
|
+
->Pulumi.Output.apply(({publishJson: publishToEventTopic}) => {
|
|
103
|
+
module Ops = ExtensionPoint_Operations.Make(
|
|
104
|
+
Spec,
|
|
105
|
+
Mappings,
|
|
106
|
+
{
|
|
107
|
+
let publishToEventTopic = publishToEventTopic
|
|
108
|
+
let commandTopicResources = commandTopicResources
|
|
109
|
+
let scheduler = scheduler
|
|
110
|
+
let queryEngine = queryEngine
|
|
111
|
+
let resourceNaming = resourceNaming
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
(commandTopic, eventTopic, Ops.outgoingJsonEventsHandler)
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
->Pulumi.Output.unzip3
|
|
119
|
+
|
|
120
|
+
self->Component.setOperations(
|
|
121
|
+
outgoingJsonEventsHandler->Pulumi.Output.apply(outgoingJsonEventsHandler =>
|
|
122
|
+
({outgoingJsonEventsHandler: outgoingJsonEventsHandler}: ExtensionPoint.operations)
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
let epOutputs: ExtensionPoint.outputs = {
|
|
127
|
+
name,
|
|
128
|
+
aggregateNames,
|
|
129
|
+
commandTopic: commandTopic->Pulumi.Output.apply(commandTopic =>
|
|
130
|
+
commandTopic->Component.outputs
|
|
131
|
+
),
|
|
132
|
+
eventTopic: eventTopic->Pulumi.Output.apply(eventTopic => eventTopic->Component.outputs),
|
|
133
|
+
specModule: Spec.moduleUrl,
|
|
134
|
+
mappingsModule: Mappings.moduleUrl,
|
|
135
|
+
}
|
|
136
|
+
self->Component.setOutputs(epOutputs)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let make = (
|
|
140
|
+
~aggregateResources,
|
|
141
|
+
~publishToAggregates,
|
|
142
|
+
~scheduler,
|
|
143
|
+
~queryEngine,
|
|
144
|
+
~resourceNaming,
|
|
145
|
+
~opts,
|
|
146
|
+
) =>
|
|
147
|
+
Component.make(
|
|
148
|
+
~componentType=ExtensionPoint.componentType->ComponentType.toString,
|
|
149
|
+
~name=Spec.name,
|
|
150
|
+
~construct=construct(
|
|
151
|
+
~aggregateResources,
|
|
152
|
+
~publishToAggregates,
|
|
153
|
+
~scheduler,
|
|
154
|
+
~queryEngine,
|
|
155
|
+
~resourceNaming,
|
|
156
|
+
...
|
|
157
|
+
),
|
|
158
|
+
~opts,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
let outputs = Component.outputs
|
|
162
|
+
let operations = Component.operations
|
|
163
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
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_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
6
|
+
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
7
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
8
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
9
|
+
import * as Adapter$ReventlessCore from "../../adapter/Adapter.res.mjs";
|
|
10
|
+
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
11
|
+
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
12
|
+
import * as ExtensionPoint$ReventlessCore from "./ExtensionPoint.res.mjs";
|
|
13
|
+
import * as EventTopic_Builder$ReventlessCore from "../EventTopic/EventTopic_Builder.res.mjs";
|
|
14
|
+
import * as CommandTopic_Builder$ReventlessCore from "../CommandTopic/CommandTopic_Builder.res.mjs";
|
|
15
|
+
import * as ExtensionPoint_Callback$ReventlessCore from "./ExtensionPoint_Callback.res.mjs";
|
|
16
|
+
import * as ExtensionPoint_Operations$ReventlessCore from "./ExtensionPoint_Operations.res.mjs";
|
|
17
|
+
|
|
18
|
+
function Make(Spec) {
|
|
19
|
+
return Mappings => (RuntimeEnvironment => (CommandTopicChannel => (EventTopicAdapter => (ExtensionPointRuntimeBuilder => {
|
|
20
|
+
let name = Spec.name;
|
|
21
|
+
let commandSchema = Spec.commandSchema;
|
|
22
|
+
let eventSchema = Spec.eventSchema;
|
|
23
|
+
let filterAggregateResources = (aggregateResources, aggregateNames) => Object.entries(aggregateResources).filter(param => {
|
|
24
|
+
let name = param[0];
|
|
25
|
+
return aggregateNames.some(aggregateName => aggregateName === name);
|
|
26
|
+
}).map(param => param[1]).flat();
|
|
27
|
+
let make = (aggregateResources, publishToAggregates, scheduler, queryEngine, resourceNaming, opts) => Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(ExtensionPoint$ReventlessCore.componentType), Spec.name, (extra, extra$1) => {
|
|
28
|
+
let opts_parent = Component$ReventlessCore.toPulumiResource(extra);
|
|
29
|
+
let opts = {
|
|
30
|
+
parent: opts_parent
|
|
31
|
+
};
|
|
32
|
+
let childName = ComponentType$ReventlessCore.name(extra$1.replace(".", ""), ExtensionPoint$ReventlessCore.componentType);
|
|
33
|
+
let SpecificCommandTopic = CommandTopic_Builder$ReventlessCore.Make({
|
|
34
|
+
Id: Id$Reventless.$$String,
|
|
35
|
+
name: name,
|
|
36
|
+
commandSchema: commandSchema
|
|
37
|
+
})(CommandTopicChannel);
|
|
38
|
+
let commandTopic = SpecificCommandTopic.make(childName, opts);
|
|
39
|
+
let aggregateNames = Stdlib_Array.filterMap(Mappings.mappings, Mapping => Stdlib_Option.map(Mapping.mapOutgoingEvent, param => Mapping.delegateName));
|
|
40
|
+
let commandTopicResources = Adapter$ReventlessCore.resourcesToResolvedOutput(commandTopic.channel.resources);
|
|
41
|
+
let match = Output$Pulumi.unzip3(Output$Pulumi.flatMap(commandTopicResources, commandTopicResources => {
|
|
42
|
+
let ExtensionPointCallback = ExtensionPoint_Callback$ReventlessCore.Make({
|
|
43
|
+
publishToAggregates: publishToAggregates,
|
|
44
|
+
commandTopicResources: commandTopicResources,
|
|
45
|
+
scheduler: scheduler,
|
|
46
|
+
queryEngine: queryEngine,
|
|
47
|
+
resourceNaming: resourceNaming
|
|
48
|
+
})(Spec)({
|
|
49
|
+
mappings: Mappings.mappings
|
|
50
|
+
});
|
|
51
|
+
let handler = SpecificCommandTopic.makeHandler(commandTopic, ExtensionPointCallback.handleIncomingCommands);
|
|
52
|
+
let resources = filterAggregateResources(aggregateResources, aggregateNames);
|
|
53
|
+
let publishToAggregatesQueueUrls = Stdlib_Dict.mapValues(aggregateResources, resources => {
|
|
54
|
+
let r = resources[0];
|
|
55
|
+
if (r !== undefined) {
|
|
56
|
+
return r.id;
|
|
57
|
+
} else {
|
|
58
|
+
return Pulumi.output("");
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
ExtensionPointRuntimeBuilder.forCommandTopic(handler, none => SpecificCommandTopic.connect(none, resources, commandTopic), undefined, undefined, Spec.moduleUrl, Mappings.moduleUrl, publishToAggregatesQueueUrls, commandTopic);
|
|
62
|
+
let SpecificEventTopic = EventTopic_Builder$ReventlessCore.Make({
|
|
63
|
+
Id: Id$Reventless.$$String,
|
|
64
|
+
name: name,
|
|
65
|
+
eventSchema: eventSchema
|
|
66
|
+
})(EventTopicAdapter);
|
|
67
|
+
let eventTopic = SpecificEventTopic.make(childName, [], opts);
|
|
68
|
+
return Component$ReventlessCore.operations(eventTopic).apply(param => {
|
|
69
|
+
let Ops = ExtensionPoint_Operations$ReventlessCore.Make(Spec)({
|
|
70
|
+
mappings: Mappings.mappings
|
|
71
|
+
})({
|
|
72
|
+
publishToEventTopic: param.publishJson,
|
|
73
|
+
commandTopicResources: commandTopicResources,
|
|
74
|
+
scheduler: scheduler,
|
|
75
|
+
queryEngine: queryEngine,
|
|
76
|
+
resourceNaming: resourceNaming
|
|
77
|
+
});
|
|
78
|
+
return [
|
|
79
|
+
commandTopic,
|
|
80
|
+
eventTopic,
|
|
81
|
+
Ops.outgoingJsonEventsHandler
|
|
82
|
+
];
|
|
83
|
+
});
|
|
84
|
+
}));
|
|
85
|
+
Component$ReventlessCore.setOperations(extra, match[2].apply(outgoingJsonEventsHandler => ({
|
|
86
|
+
outgoingJsonEventsHandler: outgoingJsonEventsHandler
|
|
87
|
+
})));
|
|
88
|
+
let epOutputs_commandTopic = match[0].apply(Component$ReventlessCore.outputs);
|
|
89
|
+
let epOutputs_eventTopic = match[1].apply(Component$ReventlessCore.outputs);
|
|
90
|
+
let epOutputs_specModule = Spec.moduleUrl;
|
|
91
|
+
let epOutputs_mappingsModule = Mappings.moduleUrl;
|
|
92
|
+
let epOutputs = {
|
|
93
|
+
name: extra$1,
|
|
94
|
+
aggregateNames: aggregateNames,
|
|
95
|
+
commandTopic: epOutputs_commandTopic,
|
|
96
|
+
eventTopic: epOutputs_eventTopic,
|
|
97
|
+
specModule: epOutputs_specModule,
|
|
98
|
+
mappingsModule: epOutputs_mappingsModule
|
|
99
|
+
};
|
|
100
|
+
return Component$ReventlessCore.setOutputs(extra, epOutputs);
|
|
101
|
+
}, opts);
|
|
102
|
+
return {
|
|
103
|
+
make: make,
|
|
104
|
+
outputs: Component$ReventlessCore.outputs,
|
|
105
|
+
operations: Component$ReventlessCore.operations
|
|
106
|
+
};
|
|
107
|
+
}))));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
Make,
|
|
112
|
+
}
|
|
113
|
+
/* Id-Reventless Not a pure module */
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
module type Mappings = {
|
|
2
|
+
module Spec: ReventlessInfra.ExtensionPointMapping.Spec
|
|
3
|
+
module type Mapping = ReventlessInfra.ExtensionPointMapping.T with module ExtensionPoint := Spec
|
|
4
|
+
let mappings: array<module(Mapping)>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module type Spec = {
|
|
8
|
+
let publishToAggregates: dict<CommandTopic.publishJsons>
|
|
9
|
+
let commandTopicResources: array<Adapter.resolvedResource>
|
|
10
|
+
let scheduler: Scheduler.operations
|
|
11
|
+
let queryEngine: Reventless.QueryEngine.operations
|
|
12
|
+
let resourceNaming: ReventlessInfra.ResourceNaming.operations
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module type T = {
|
|
16
|
+
module MappingSpec: ReventlessInfra.ExtensionPointMapping.Spec
|
|
17
|
+
let handleIncomingCommands: CommandTopic.commandsHandler<
|
|
18
|
+
Message.command'<Reventless.Id.String.t, MappingSpec.command>,
|
|
19
|
+
>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module Make = (
|
|
23
|
+
Spec: Spec,
|
|
24
|
+
MappingSpec: ReventlessInfra.ExtensionPointMapping.Spec,
|
|
25
|
+
Mappings: Mappings with module Spec := MappingSpec,
|
|
26
|
+
): (T with module MappingSpec = MappingSpec) => {
|
|
27
|
+
module MappingSpec = MappingSpec
|
|
28
|
+
|
|
29
|
+
// Runs all registered Mapping modules against the incoming commands, collecting
|
|
30
|
+
// the resulting command actions (publish-to-aggregate or async call).
|
|
31
|
+
let mapIncomingCommands = (topicItems, mappings, scheduler, queryEngine, resourceNaming, queue) =>
|
|
32
|
+
mappings
|
|
33
|
+
->Array.map((module(Mapping: Mappings.Mapping)) =>
|
|
34
|
+
Mapping.mapIncomingCommands(
|
|
35
|
+
topicItems,
|
|
36
|
+
ScheduleOps.create(~scheduler, ~channelResources=queue, ~resourceNaming),
|
|
37
|
+
ScheduleOps.delete(~scheduler, ~channelResources=queue, ~resourceNaming),
|
|
38
|
+
queryEngine,
|
|
39
|
+
)
|
|
40
|
+
)
|
|
41
|
+
->Array.flat
|
|
42
|
+
|
|
43
|
+
// Executes a single command action: either publishes a command JSON to the target
|
|
44
|
+
// aggregate's CommandTopic, or calls an async handler. Errors are logged and returned
|
|
45
|
+
// as Error(reference) without failing the overall batch.
|
|
46
|
+
let applyCommandAction = action =>
|
|
47
|
+
switch action {
|
|
48
|
+
| ReventlessInfra.ExtensionPointMapping.AbstractPublishCommand(
|
|
49
|
+
aggregateName,
|
|
50
|
+
reference,
|
|
51
|
+
cmdJson,
|
|
52
|
+
) =>
|
|
53
|
+
Effect.trySync(
|
|
54
|
+
~catch=err => {
|
|
55
|
+
let errMsg = Util.Error.messageFromUnknown(err, "unknown")
|
|
56
|
+
(Error(reference), `ExtensionPoint: Error on publish command: ${errMsg}`)
|
|
57
|
+
},
|
|
58
|
+
() => {
|
|
59
|
+
let result =
|
|
60
|
+
Spec.publishToAggregates
|
|
61
|
+
->Dict.get(aggregateName)
|
|
62
|
+
->Option.map((publishJsons: CommandTopic.publishJsons) => publishJsons([cmdJson]))
|
|
63
|
+
->Option.mapOr(
|
|
64
|
+
() =>
|
|
65
|
+
JsError.throwWithMessage(
|
|
66
|
+
`ExtensionPoint.applyCommandAction: Aggregate ${aggregateName} doesn't exist`,
|
|
67
|
+
),
|
|
68
|
+
x => {() => x},
|
|
69
|
+
)
|
|
70
|
+
let _ = result()
|
|
71
|
+
Ok(reference)
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
->Effect.catchAll(((errorResult, errMsg)) =>
|
|
75
|
+
EffectLogger.logError(~comp="ExtensionPoint", errMsg)->Effect.map(_ => errorResult)
|
|
76
|
+
)
|
|
77
|
+
| AbstractHandleDirective(reference, handler) =>
|
|
78
|
+
Effect.tryPromise(
|
|
79
|
+
~catch=err => {
|
|
80
|
+
let errMsg = Util.Error.messageFromUnknown(err, "unknown")
|
|
81
|
+
(Error(reference), `ExtensionPoint: Error on handling directive: ${errMsg}`)
|
|
82
|
+
},
|
|
83
|
+
() => handler(),
|
|
84
|
+
)
|
|
85
|
+
->Effect.map(_ => Ok(reference))
|
|
86
|
+
->Effect.catchAll(((errorResult, errMsg)) =>
|
|
87
|
+
EffectLogger.logError(~comp="ExtensionPoint", errMsg)->Effect.map(_ => errorResult)
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// CommandTopic handler — collects all incoming commands, maps them through the
|
|
92
|
+
// extension point mappings, then applies each resulting action concurrently.
|
|
93
|
+
let handleIncomingCommands = stream =>
|
|
94
|
+
stream
|
|
95
|
+
->Stream.runCollect
|
|
96
|
+
->Effect.flatMap(topicItems => {
|
|
97
|
+
let commandActions =
|
|
98
|
+
topicItems->mapIncomingCommands(
|
|
99
|
+
Mappings.mappings,
|
|
100
|
+
Spec.scheduler,
|
|
101
|
+
Spec.queryEngine,
|
|
102
|
+
Spec.resourceNaming,
|
|
103
|
+
Spec.commandTopicResources,
|
|
104
|
+
)
|
|
105
|
+
Effect.all(
|
|
106
|
+
commandActions->Array.map(applyCommandAction),
|
|
107
|
+
{"concurrency": "unbounded"},
|
|
108
|
+
)
|
|
109
|
+
})
|
|
110
|
+
}
|