@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,146 @@
|
|
|
1
|
+
module Make = (Spec: ReventlessInfra.CommandTopic.T, Channel: CommandTopic_Adapter.Channel): (
|
|
2
|
+
CommandTopic.T with module Spec = Spec and type callbackEvent = Channel.callbackEvent
|
|
3
|
+
) => {
|
|
4
|
+
module Spec = Spec
|
|
5
|
+
type callbackEvent = Channel.callbackEvent
|
|
6
|
+
|
|
7
|
+
type commandsHandler = CommandTopic.commandsHandler<Message.command'<Spec.Id.t, Spec.command>>
|
|
8
|
+
|
|
9
|
+
type publish = CommandTopic.publish<Spec.Id.t, Spec.command>
|
|
10
|
+
|
|
11
|
+
type operations = {
|
|
12
|
+
publish: publish,
|
|
13
|
+
publishJsons: CommandTopic.publishJsons,
|
|
14
|
+
publishJsonsStream: CommandTopic.publishJsonsStream,
|
|
15
|
+
publishJsonsAndWait: option<CommandTopic.publishJsonsAndWait>,
|
|
16
|
+
}
|
|
17
|
+
type component = Component.t<CommandTopic.t, CommandTopic.outputs, operations>
|
|
18
|
+
|
|
19
|
+
// Helper to extract type name from JSON command using TAG field.
|
|
20
|
+
// Handles both direct command JSON (TAG at top level) and full message
|
|
21
|
+
// body from publishJsons (TAG nested inside "command" field).
|
|
22
|
+
let extractTypeNameFromJson = json => {
|
|
23
|
+
switch json {
|
|
24
|
+
| JSON.Object(dict) =>
|
|
25
|
+
switch dict->Dict.get("TAG") {
|
|
26
|
+
| Some(JSON.String(tag)) => tag
|
|
27
|
+
| _ =>
|
|
28
|
+
// TAG is nested inside "command" when message comes via publishJsons → bus
|
|
29
|
+
switch dict->Dict.get("command") {
|
|
30
|
+
| Some(JSON.Object(cmdDict)) =>
|
|
31
|
+
switch cmdDict->Dict.get("TAG") {
|
|
32
|
+
| Some(JSON.String(tag)) => tag
|
|
33
|
+
| _ => ""
|
|
34
|
+
}
|
|
35
|
+
| _ => ""
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
| _ => ""
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Filtering handler that routes commands to registered handlers via global registry.
|
|
43
|
+
// Defined at module level so it can be referenced by makeFilteringHandler.
|
|
44
|
+
let filteringHandler: CommandTopic.jsonCommandsHandler = stream =>
|
|
45
|
+
stream
|
|
46
|
+
->Stream.mapEffect(item => {
|
|
47
|
+
let {ReventlessInfra.CommandTopic.reference: reference, command: json} = item
|
|
48
|
+
let typeName = extractTypeNameFromJson(json)
|
|
49
|
+
let handlers = CommandTopic.getHandlers(typeName)
|
|
50
|
+
Effect.promise(async () => {
|
|
51
|
+
let allResults: array<result<string, string>> = []
|
|
52
|
+
let _ =
|
|
53
|
+
await handlers
|
|
54
|
+
->Array.map(async handlerEntry => {
|
|
55
|
+
let {CommandTopic.handler: handler} = handlerEntry
|
|
56
|
+
try {
|
|
57
|
+
let results =
|
|
58
|
+
await handler(
|
|
59
|
+
Stream.fromIterable([{ReventlessInfra.CommandTopic.reference, command: json}]),
|
|
60
|
+
)->Effect.runPromise
|
|
61
|
+
allResults->Array.pushMany(results)
|
|
62
|
+
} catch {
|
|
63
|
+
| _ => () // Skip if handler fails
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
->Promise.all
|
|
67
|
+
allResults
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
->Stream.runCollect
|
|
71
|
+
->Effect.map(Array.flat)
|
|
72
|
+
|
|
73
|
+
let construct = (self, name) => {
|
|
74
|
+
let opts = {Pulumi.ComponentResource.parent: self->Component.toPulumiResource}
|
|
75
|
+
let name = name->ComponentType.name(CommandTopic.componentType)
|
|
76
|
+
|
|
77
|
+
let channel = Channel.make(~name, ~opts)
|
|
78
|
+
self->CommandTopic_Adapter.setChannel(channel)
|
|
79
|
+
|
|
80
|
+
self->Component.setOperations(
|
|
81
|
+
(channel.publishJsons, channel.publishJsonsStream, channel.publishJsonsAndWait)
|
|
82
|
+
->Pulumi.Output.all3
|
|
83
|
+
->Pulumi.Output.apply(((publishJsons, publishJsonsStream, publishJsonsAndWait)) => {
|
|
84
|
+
module Ops = {
|
|
85
|
+
let publishJsons = publishJsons
|
|
86
|
+
}
|
|
87
|
+
module Operations = CommandTopic_Operations.Make(Spec, Ops)
|
|
88
|
+
|
|
89
|
+
{
|
|
90
|
+
publish: Operations.publish,
|
|
91
|
+
publishJsons: Operations.publishJsons,
|
|
92
|
+
publishJsonsStream: publishJsonsStream,
|
|
93
|
+
publishJsonsAndWait,
|
|
94
|
+
}
|
|
95
|
+
}),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
let outputs: CommandTopic.outputs = {
|
|
99
|
+
resources: channel.resources,
|
|
100
|
+
}
|
|
101
|
+
self->Component.setOutputs(outputs)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
let connect = (~runtime, ~resources, commandTopic) => {
|
|
105
|
+
let commandTopicResource = commandTopic->Component.toPulumiResource
|
|
106
|
+
let name =
|
|
107
|
+
commandTopicResource.name
|
|
108
|
+
->Option.getOr("Unnamed")
|
|
109
|
+
->ComponentType.name(CommandTopic.componentType)
|
|
110
|
+
let opts = {Pulumi.ComponentResource.parent: commandTopicResource}
|
|
111
|
+
let channel = commandTopic->CommandTopic_Adapter.channel
|
|
112
|
+
|
|
113
|
+
let _connectResources = channel.connect(~name, ~channel, ~runtime, ~resources, ~opts)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let registerHandler = (~commandTopic as _, ~schema, ~handler, ~typeNames) => {
|
|
117
|
+
// Delegate to global registry
|
|
118
|
+
CommandTopic.registerHandler(~schema, ~handler, ~typeNames)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let makeHandler = (~commandTopic, ~commandsHandler: commandsHandler) => {
|
|
122
|
+
let channel = commandTopic->CommandTopic_Adapter.channel
|
|
123
|
+
module CallbackOps = {
|
|
124
|
+
module Spec = Spec
|
|
125
|
+
let commandsHandler = commandsHandler
|
|
126
|
+
}
|
|
127
|
+
module Callback = CommandTopic_Callback.Make(Spec, CallbackOps)
|
|
128
|
+
|
|
129
|
+
channel.handleChannelEvent(Callback.handleJsonCommands)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Returns the filtering handler output for runtime connection.
|
|
133
|
+
// This is the entry point for the shared DCB command topic Lambda.
|
|
134
|
+
let makeFilteringHandler = commandTopic => {
|
|
135
|
+
let channel = commandTopic->CommandTopic_Adapter.channel
|
|
136
|
+
channel.handleChannelEvent(filteringHandler)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let make = (~name, ~opts=?): component =>
|
|
140
|
+
Component.make(
|
|
141
|
+
~componentType=CommandTopic.componentType->ComponentType.toString,
|
|
142
|
+
~name,
|
|
143
|
+
~construct,
|
|
144
|
+
~opts,
|
|
145
|
+
)
|
|
146
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stream from "@reventlessdev/rescript-effect/src/Stream.res.mjs";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Stream$1 from "effect/Stream";
|
|
7
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
8
|
+
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
9
|
+
import * as CommandTopic$ReventlessCore from "./CommandTopic.res.mjs";
|
|
10
|
+
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
11
|
+
import * as CommandTopic_Callback$ReventlessCore from "./CommandTopic_Callback.res.mjs";
|
|
12
|
+
import * as CommandTopic_Operations$ReventlessCore from "./CommandTopic_Operations.res.mjs";
|
|
13
|
+
|
|
14
|
+
function Make(Spec) {
|
|
15
|
+
return Channel => {
|
|
16
|
+
let extractTypeNameFromJson = json => {
|
|
17
|
+
if (typeof json !== "object" || json === null || Array.isArray(json)) {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
let match = json["TAG"];
|
|
21
|
+
if (typeof match === "string") {
|
|
22
|
+
return match;
|
|
23
|
+
}
|
|
24
|
+
let match$1 = json["command"];
|
|
25
|
+
if (match$1 === undefined) {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
if (typeof match$1 !== "object" || match$1 === null || Array.isArray(match$1)) {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
let match$2 = match$1["TAG"];
|
|
32
|
+
if (typeof match$2 === "string") {
|
|
33
|
+
return match$2;
|
|
34
|
+
} else {
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
let filteringHandler = stream => Effect.map(Stream.runCollect(Stream$1.mapEffect(stream, item => {
|
|
39
|
+
let reference = item.reference;
|
|
40
|
+
let json = item.command;
|
|
41
|
+
let typeName = extractTypeNameFromJson(json);
|
|
42
|
+
let handlers = CommandTopic$ReventlessCore.getHandlers(typeName);
|
|
43
|
+
return Effect.promise(async () => {
|
|
44
|
+
let allResults = [];
|
|
45
|
+
await Promise.all(handlers.map(async handlerEntry => {
|
|
46
|
+
try {
|
|
47
|
+
let results = await Effect.runPromise(handlerEntry.handler(Stream$1.fromIterable([{
|
|
48
|
+
command: json,
|
|
49
|
+
reference: reference
|
|
50
|
+
}])));
|
|
51
|
+
allResults.push(...results);
|
|
52
|
+
return;
|
|
53
|
+
} catch (exn) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
return allResults;
|
|
58
|
+
});
|
|
59
|
+
})), prim => prim.flat());
|
|
60
|
+
let construct = (self, name) => {
|
|
61
|
+
let opts_parent = Component$ReventlessCore.toPulumiResource(self);
|
|
62
|
+
let opts = {
|
|
63
|
+
parent: opts_parent
|
|
64
|
+
};
|
|
65
|
+
let name$1 = ComponentType$ReventlessCore.name(name, CommandTopic$ReventlessCore.componentType);
|
|
66
|
+
let channel = Channel.make(name$1, opts);
|
|
67
|
+
self.channel = channel;
|
|
68
|
+
Component$ReventlessCore.setOperations(self, Pulumi.all([
|
|
69
|
+
channel.publishJsons,
|
|
70
|
+
channel.publishJsonsStream,
|
|
71
|
+
channel.publishJsonsAndWait
|
|
72
|
+
]).apply(param => {
|
|
73
|
+
let Ops = {
|
|
74
|
+
publishJsons: param[0]
|
|
75
|
+
};
|
|
76
|
+
let Operations = CommandTopic_Operations$ReventlessCore.Make(Spec)(Ops);
|
|
77
|
+
return {
|
|
78
|
+
publish: Operations.publish,
|
|
79
|
+
publishJsons: Operations.publishJsons,
|
|
80
|
+
publishJsonsStream: param[1],
|
|
81
|
+
publishJsonsAndWait: param[2]
|
|
82
|
+
};
|
|
83
|
+
}));
|
|
84
|
+
let outputs = {
|
|
85
|
+
resources: channel.resources
|
|
86
|
+
};
|
|
87
|
+
return Component$ReventlessCore.setOutputs(self, outputs);
|
|
88
|
+
};
|
|
89
|
+
let connect = (runtime, resources, commandTopic) => {
|
|
90
|
+
let commandTopicResource = Component$ReventlessCore.toPulumiResource(commandTopic);
|
|
91
|
+
let name = ComponentType$ReventlessCore.name(Stdlib_Option.getOr(commandTopicResource.__name, "Unnamed"), CommandTopic$ReventlessCore.componentType);
|
|
92
|
+
let opts_parent = commandTopicResource;
|
|
93
|
+
let opts = {
|
|
94
|
+
parent: opts_parent
|
|
95
|
+
};
|
|
96
|
+
let channel = commandTopic.channel;
|
|
97
|
+
channel.connect(name, channel, runtime, resources, opts);
|
|
98
|
+
};
|
|
99
|
+
let registerHandler = (param, schema, handler, typeNames) => CommandTopic$ReventlessCore.registerHandler(schema, handler, typeNames);
|
|
100
|
+
let makeHandler = (commandTopic, commandsHandler) => {
|
|
101
|
+
let channel = commandTopic.channel;
|
|
102
|
+
let Callback = CommandTopic_Callback$ReventlessCore.Make(Spec)({
|
|
103
|
+
Spec: Spec,
|
|
104
|
+
commandsHandler: commandsHandler
|
|
105
|
+
});
|
|
106
|
+
return channel.handleChannelEvent(Callback.handleJsonCommands);
|
|
107
|
+
};
|
|
108
|
+
let makeFilteringHandler = commandTopic => {
|
|
109
|
+
let channel = commandTopic.channel;
|
|
110
|
+
return channel.handleChannelEvent(filteringHandler);
|
|
111
|
+
};
|
|
112
|
+
let make = (name, opts) => Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(CommandTopic$ReventlessCore.componentType), name, construct, opts);
|
|
113
|
+
return {
|
|
114
|
+
Spec: Spec,
|
|
115
|
+
connect: connect,
|
|
116
|
+
registerHandler: registerHandler,
|
|
117
|
+
makeHandler: makeHandler,
|
|
118
|
+
makeFilteringHandler: makeFilteringHandler,
|
|
119
|
+
make: make
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
Make,
|
|
126
|
+
}
|
|
127
|
+
/* Stream Not a pure module */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module type Ops = {
|
|
2
|
+
module Spec: ReventlessInfra.CommandTopic.T
|
|
3
|
+
let commandsHandler: CommandTopic.commandsHandler<Message.command'<Spec.Id.t, Spec.command>>
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
module type T = {
|
|
7
|
+
let handleJsonCommands: CommandTopic.jsonCommandsHandler
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module Make = (Spec: ReventlessInfra.CommandTopic.T, Ops: Ops with module Spec = Spec): T => {
|
|
11
|
+
let comp = `CommandTopic(${Spec.name})`
|
|
12
|
+
|
|
13
|
+
let handleJsonCommands: CommandTopic.jsonCommandsHandler = stream =>
|
|
14
|
+
stream
|
|
15
|
+
->Stream.mapEffect(({ReventlessInfra.CommandTopic.reference: reference, command: json}) =>
|
|
16
|
+
Effect.sync(() =>
|
|
17
|
+
switch json->Message.decodeCommand'(Spec.Id.schema, Spec.commandSchema) {
|
|
18
|
+
| command' => Some({ReventlessInfra.CommandTopic.reference, command: command'})
|
|
19
|
+
| exception err =>
|
|
20
|
+
let commandStr = json->JSON.stringify
|
|
21
|
+
let errMsg =
|
|
22
|
+
err->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
23
|
+
EffectLogger.logError(
|
|
24
|
+
~comp,
|
|
25
|
+
`decode failed: ${commandStr} err=${errMsg}`,
|
|
26
|
+
)->Effect.runSync
|
|
27
|
+
None
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
->Stream.flatMap(opt =>
|
|
32
|
+
switch opt {
|
|
33
|
+
| Some(v) => Stream.fromIterable([v])
|
|
34
|
+
| None => Stream.empty
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
->Ops.commandsHandler
|
|
38
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Stream from "effect/Stream";
|
|
7
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
8
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
9
|
+
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
10
|
+
|
|
11
|
+
function Make(Spec) {
|
|
12
|
+
return Ops => {
|
|
13
|
+
let comp = `CommandTopic(` + Spec.name + `)`;
|
|
14
|
+
let handleJsonCommands = stream => Ops.commandsHandler(Stream.flatMap(Stream.mapEffect(stream, param => {
|
|
15
|
+
let reference = param.reference;
|
|
16
|
+
let json = param.command;
|
|
17
|
+
return Effect.sync(() => {
|
|
18
|
+
let command$p;
|
|
19
|
+
try {
|
|
20
|
+
command$p = Message$ReventlessCore.decodeCommand$p(json, Spec.Id.schema, Spec.commandSchema);
|
|
21
|
+
} catch (raw_err) {
|
|
22
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
23
|
+
let commandStr = JSON.stringify(json);
|
|
24
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
25
|
+
Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `decode failed: ` + commandStr + ` err=` + errMsg));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
command: command$p,
|
|
30
|
+
reference: reference
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}), opt => {
|
|
34
|
+
if (opt !== undefined) {
|
|
35
|
+
return Stream.fromIterable([opt]);
|
|
36
|
+
} else {
|
|
37
|
+
return Stream.empty;
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
return {
|
|
41
|
+
handleJsonCommands: handleJsonCommands
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
Make,
|
|
48
|
+
}
|
|
49
|
+
/* Stdlib_JsExn Not a pure module */
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Re-export from spec so ReventlessCore.CommandTopic.topicItem === ReventlessInfra.CommandTopic.topicItem
|
|
2
|
+
type topicItem<'command> = ReventlessInfra.CommandTopic.topicItem<'command>
|
|
3
|
+
|
|
4
|
+
type jsonCommandsHandler = ReventlessInfra.CommandTopic.commandsHandler<JSON.t>
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
Carries entity identity and event count from a successful synchronous command dispatch.
|
|
8
|
+
Populated by `StateChangeSlice_Callback.handleSingleCommand` and `Aggregate_Callback.replayProcessAppend`
|
|
9
|
+
during inline `publishJsonsAndWait` execution and read by `runInlineAndCollect` to build
|
|
10
|
+
`CommandTopic.Accepted` outcomes.
|
|
11
|
+
*/
|
|
12
|
+
type acceptedResult = {entityId?: string, eventCount: int}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
Carries an encoded domain rejection from `Behavior.decide` back to a synchronous producer.
|
|
16
|
+
`errorCode` is the variant tag of `Spec.errorSchema` (e.g. `"AlreadyExists"`); `errorDetail`
|
|
17
|
+
is the JSON-stringified error payload (or empty string for payload-less variants).
|
|
18
|
+
*/
|
|
19
|
+
type rejectedResult = {errorCode: string, errorDetail: string}
|
|
20
|
+
|
|
21
|
+
// Side-channel for publishJsonsAndWait result propagation.
|
|
22
|
+
// Set by runInlineAndCollect before invoking the handler; cleared after.
|
|
23
|
+
// Callback implementations call reportAccepted during inline dispatch.
|
|
24
|
+
let acceptedResultChannel: ref<option<(string, acceptedResult) => unit>> = ref(None)
|
|
25
|
+
|
|
26
|
+
// Sibling side-channel for domain rejections — populated by callbacks when
|
|
27
|
+
// `Behavior.decide` returns `Error`. Read by runInlineAndCollect to build
|
|
28
|
+
// `Rejected` outcomes that carry the real error code and detail.
|
|
29
|
+
let rejectedResultChannel: ref<option<(string, rejectedResult) => unit>> = ref(None)
|
|
30
|
+
|
|
31
|
+
let reportAccepted = (reference: string, result: acceptedResult) =>
|
|
32
|
+
acceptedResultChannel.contents->Option.forEach(cb => cb(reference, result))
|
|
33
|
+
|
|
34
|
+
let reportRejected = (reference: string, result: rejectedResult) =>
|
|
35
|
+
rejectedResultChannel.contents->Option.forEach(cb => cb(reference, result))
|
|
36
|
+
|
|
37
|
+
// Placed here (rather than CommandTopic.res) so runInlineAndCollect can use commandOutcome
|
|
38
|
+
// without importing Adapter.res → @pulumi/pulumi. Re-exported by CommandTopic via include.
|
|
39
|
+
type commandOutcome =
|
|
40
|
+
| Accepted({msgId: string, entityId?: string, eventCount: int})
|
|
41
|
+
| Rejected({msgId: string, errorCode: string, errorDetail: option<string>})
|
|
42
|
+
| Pending({msgId: string})
|
|
43
|
+
|
|
44
|
+
// Serialise a commandOutcome to the JSON shape the CommandResult GraphQL union
|
|
45
|
+
// expects — every variant carries an explicit `__typename` so AppSync (and any
|
|
46
|
+
// other spec-compliant GraphQL server) can resolve the abstract type at
|
|
47
|
+
// runtime. Shared between in-memory (graphql-yoga resolvers) and the AWS
|
|
48
|
+
// Lambda direct-invocation entry point so both surfaces stay byte-compatible.
|
|
49
|
+
let commandOutcomeToJson = (outcome: commandOutcome): JSON.t =>
|
|
50
|
+
switch outcome {
|
|
51
|
+
| Accepted({msgId, eventCount} as accepted) =>
|
|
52
|
+
JSON.Object(
|
|
53
|
+
Dict.fromArray([
|
|
54
|
+
("__typename", JSON.String("CommandAccepted")),
|
|
55
|
+
("msgId", JSON.String(msgId)),
|
|
56
|
+
("entityId", accepted.entityId->Option.map(id => JSON.String(id))->Option.getOr(JSON.Null)),
|
|
57
|
+
("eventCount", JSON.Number(eventCount->Int.toFloat)),
|
|
58
|
+
]),
|
|
59
|
+
)
|
|
60
|
+
| Rejected({msgId, errorCode, errorDetail}) =>
|
|
61
|
+
JSON.Object(
|
|
62
|
+
Dict.fromArray([
|
|
63
|
+
("__typename", JSON.String("CommandRejected")),
|
|
64
|
+
("msgId", JSON.String(msgId)),
|
|
65
|
+
("errorCode", JSON.String(errorCode)),
|
|
66
|
+
("errorDetail", errorDetail->Option.map(s => JSON.String(s))->Option.getOr(JSON.Null)),
|
|
67
|
+
]),
|
|
68
|
+
)
|
|
69
|
+
| Pending({msgId}) =>
|
|
70
|
+
JSON.Object(
|
|
71
|
+
Dict.fromArray([
|
|
72
|
+
("__typename", JSON.String("CommandPending")),
|
|
73
|
+
("msgId", JSON.String(msgId)),
|
|
74
|
+
]),
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type publishJsonsAndWait = array<Reventless.Message.commandJson> => promise<array<commandOutcome>>
|
|
79
|
+
|
|
80
|
+
// Encode the full message body expected by CommandTopic_Callback: {id, meta, command}.
|
|
81
|
+
// Shared by LocalCommandTopicChannel and CommandTopicChannel_SQS_Sync.
|
|
82
|
+
let encodeCommandJson = (cmdJson: Reventless.Message.commandJson): JSON.t =>
|
|
83
|
+
JSON.Encode.object(
|
|
84
|
+
Dict.fromArray([
|
|
85
|
+
("id", JSON.Encode.string(cmdJson.id)),
|
|
86
|
+
("meta", cmdJson.meta->S.reverseConvertToJsonOrThrow(Reventless.Message.metaSchema)),
|
|
87
|
+
("command", cmdJson.commandJson),
|
|
88
|
+
]),
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
// Runs handleCmds inline, manages the acceptedResultChannel side-channel, and maps
|
|
92
|
+
// results to commandOutcome. Shared by LocalCommandTopicChannel and CommandTopicChannel_SQS_Sync.
|
|
93
|
+
let runInlineAndCollect = async (
|
|
94
|
+
jsons: array<Reventless.Message.commandJson>,
|
|
95
|
+
handleCmds: jsonCommandsHandler,
|
|
96
|
+
) => {
|
|
97
|
+
let items = jsons->Array.map((cmdJson: Reventless.Message.commandJson) => {
|
|
98
|
+
let reference = cmdJson.meta.msgId
|
|
99
|
+
let item: topicItem<JSON.t> = {command: encodeCommandJson(cmdJson), reference}
|
|
100
|
+
item
|
|
101
|
+
})
|
|
102
|
+
let acceptedResults: dict<acceptedResult> = Dict.make()
|
|
103
|
+
let rejectedResults: dict<rejectedResult> = Dict.make()
|
|
104
|
+
acceptedResultChannel.contents = Some(
|
|
105
|
+
(reference, result) => acceptedResults->Dict.set(reference, result),
|
|
106
|
+
)
|
|
107
|
+
rejectedResultChannel.contents = Some(
|
|
108
|
+
(reference, result) => rejectedResults->Dict.set(reference, result),
|
|
109
|
+
)
|
|
110
|
+
let results = await handleCmds(Stream.fromIterable(items))->Effect.runPromise
|
|
111
|
+
acceptedResultChannel.contents = None
|
|
112
|
+
rejectedResultChannel.contents = None
|
|
113
|
+
jsons->Array.mapWithIndex((cmdJson, i) => {
|
|
114
|
+
let msgId = cmdJson.meta.msgId
|
|
115
|
+
// Domain rejection from Behavior.decide takes precedence over both Accepted
|
|
116
|
+
// and the synthesized "Conflict" — it carries the most informative error.
|
|
117
|
+
switch rejectedResults->Dict.get(msgId) {
|
|
118
|
+
| Some({errorCode, errorDetail}) =>
|
|
119
|
+
let detail = errorDetail == "" ? None : Some(errorDetail)
|
|
120
|
+
Rejected({msgId, errorCode, errorDetail: detail})
|
|
121
|
+
| None =>
|
|
122
|
+
switch results->Array.get(i) {
|
|
123
|
+
| Some(Error(msg)) =>
|
|
124
|
+
Rejected({msgId, errorCode: "Conflict", errorDetail: Some(msg)})
|
|
125
|
+
| _ =>
|
|
126
|
+
let ar = acceptedResults->Dict.get(msgId)->Option.getOr({eventCount: 0})
|
|
127
|
+
switch ar.entityId {
|
|
128
|
+
| Some(entityId) => Accepted({msgId, entityId, eventCount: ar.eventCount})
|
|
129
|
+
| None => Accepted({msgId, eventCount: ar.eventCount})
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Convenience helper for test code that needs to call a stream handler with an array
|
|
137
|
+
// (for use in packages that don't have rescript-effect as a direct dependency)
|
|
138
|
+
let callHandlerWithArray: (
|
|
139
|
+
jsonCommandsHandler,
|
|
140
|
+
array<topicItem<JSON.t>>,
|
|
141
|
+
) => promise<array<result<string, string>>> = (handler, items) =>
|
|
142
|
+
handler(Stream.fromIterable(items))->Effect.runPromise
|
|
143
|
+
|
|
144
|
+
// Helper to extract type names from a schema (for variant types). Used to
|
|
145
|
+
// register every command constructor so the StateChangeSlice command-topic
|
|
146
|
+
// dispatcher can route incoming JSON payloads to the right handler — payload-
|
|
147
|
+
// less variants must be addressable too, so this calls extractAllVariantNames
|
|
148
|
+
// (the inclusive version) rather than extractVariantNames (DCB-event filter).
|
|
149
|
+
let extractTypeNamesFromSchema = (schema: S.t<unknown>): array<string> =>
|
|
150
|
+
Reventless.DcbTag.extractAllVariantNames(schema)
|
|
151
|
+
|
|
152
|
+
// Global registry for schema-based filtering
|
|
153
|
+
// Keyed by command type name (e.g., "CreateItem", "UpdateItem")
|
|
154
|
+
type handlerEntry = {
|
|
155
|
+
schema: S.t<unknown>,
|
|
156
|
+
handler: jsonCommandsHandler,
|
|
157
|
+
}
|
|
158
|
+
type registry = Dict.t<array<handlerEntry>>
|
|
159
|
+
let globalRegistry: registry = Dict.make()
|
|
160
|
+
|
|
161
|
+
// Register a handler with the global registry
|
|
162
|
+
// This is called by StateChangeSlice to register its command handler
|
|
163
|
+
let registerHandler = (
|
|
164
|
+
~schema: S.t<unknown>,
|
|
165
|
+
~handler: jsonCommandsHandler,
|
|
166
|
+
~typeNames: array<string>,
|
|
167
|
+
) => {
|
|
168
|
+
typeNames->Array.forEach(typeName => {
|
|
169
|
+
let existing = globalRegistry->Dict.get(typeName)->Option.getOr([])
|
|
170
|
+
globalRegistry->Dict.set(typeName, existing->Array.concat([{schema, handler}]))
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Get handlers for a specific command type name
|
|
175
|
+
let getHandlers = (typeName: string): array<handlerEntry> =>
|
|
176
|
+
globalRegistry->Dict.get(typeName)->Option.getOr([])
|