@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,57 @@
|
|
|
1
|
+
type rawStoredEvent = {
|
|
2
|
+
eventType: string,
|
|
3
|
+
data: JSON.t,
|
|
4
|
+
tags: array<Reventless.DcbTag.tag>,
|
|
5
|
+
meta: Reventless.Message.meta,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type rawSequencedEvent = {
|
|
9
|
+
position: Reventless.DcbTag.sequencePosition,
|
|
10
|
+
eventType: string,
|
|
11
|
+
data: JSON.t,
|
|
12
|
+
tags: array<Reventless.DcbTag.tag>,
|
|
13
|
+
meta: Reventless.Message.meta,
|
|
14
|
+
recordedAt: string,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type rawReadResult = {
|
|
18
|
+
events: array<rawSequencedEvent>,
|
|
19
|
+
headPosition?: Reventless.DcbTag.sequencePosition,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type operations = {
|
|
23
|
+
read: (
|
|
24
|
+
~query: Reventless.DcbTag.query,
|
|
25
|
+
~after: Reventless.DcbTag.sequencePosition=?,
|
|
26
|
+
) => promise<rawReadResult>,
|
|
27
|
+
append: (
|
|
28
|
+
array<rawStoredEvent>,
|
|
29
|
+
~condition: Reventless.DcbTag.appendCondition=?,
|
|
30
|
+
) => promise<result<Reventless.DcbTag.sequencePosition, string>>,
|
|
31
|
+
readStream: (
|
|
32
|
+
~query: Reventless.DcbTag.query,
|
|
33
|
+
~after: Reventless.DcbTag.sequencePosition=?,
|
|
34
|
+
~strongConsistency: bool=?,
|
|
35
|
+
) => Stream.t<rawSequencedEvent, string, unit>,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type storage = {
|
|
39
|
+
resources: array<ReventlessInfra.Adapter.resource>,
|
|
40
|
+
operations: Pulumi.Output.t<operations>,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type storageMaker = (
|
|
44
|
+
~name: string,
|
|
45
|
+
~indexes: array<string>,
|
|
46
|
+
~partitionTag: Reventless.DcbTag.derivedPartitionTag,
|
|
47
|
+
/** Tag keys declared `@crossPartition` across the produced event schemas.
|
|
48
|
+
A single-tag decision read of such a key reads every partition carrying it
|
|
49
|
+
(per-tag GSI) and its consistency fence is bumped by every carrier. Derived
|
|
50
|
+
once at build time so read-scope = fence-scope per tag. */
|
|
51
|
+
~crossPartitionTagKeys: array<string>=?,
|
|
52
|
+
~opts: Pulumi.CustomResourceOptions.t,
|
|
53
|
+
) => storage
|
|
54
|
+
|
|
55
|
+
module type Storage = {
|
|
56
|
+
let make: storageMaker
|
|
57
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
module Make = (
|
|
2
|
+
Storage: DcbEventLog_Adapter.Storage,
|
|
3
|
+
EventTopicPublisher: EventTopic_Adapter.Publisher,
|
|
4
|
+
): DcbEventLog.T => {
|
|
5
|
+
|
|
6
|
+
// DcbEventLog uses a generic JSON event topic (no typed event schema needed)
|
|
7
|
+
module EventTopicSpec = {
|
|
8
|
+
module Id = Reventless.Id.String
|
|
9
|
+
let name = "DcbEventLog"
|
|
10
|
+
@schema
|
|
11
|
+
type event = JSON.t
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type component = ReventlessInfra.DcbEventLog.component
|
|
15
|
+
|
|
16
|
+
let construct = (indexes, partitionTag, crossPartitionTagKeys, self, name) => {
|
|
17
|
+
let opts = {Pulumi.CustomResourceOptions.parent: self->Component.toPulumiResource}
|
|
18
|
+
|
|
19
|
+
let storage = Storage.make(
|
|
20
|
+
~name=name->ComponentType.name(DcbEventLog.componentType),
|
|
21
|
+
~indexes,
|
|
22
|
+
~partitionTag,
|
|
23
|
+
~crossPartitionTagKeys,
|
|
24
|
+
~opts,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
module SpecificEventTopic = EventTopic_Builder.Make(EventTopicSpec, EventTopicPublisher)
|
|
28
|
+
let eventTopic = SpecificEventTopic.make(
|
|
29
|
+
~name,
|
|
30
|
+
~storageResources=storage.resources,
|
|
31
|
+
~opts=opts->Util.Pulumi.ComponentResourceOptions.ofCustomResourceOptions,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
self->Component.setOperations(
|
|
35
|
+
(storage.operations, eventTopic->Component.operations)
|
|
36
|
+
->Pulumi.Output.all2
|
|
37
|
+
->Pulumi.Output.apply(((storageOps, eventTopicOps)) => {
|
|
38
|
+
module Ops = DcbEventLog_Operations.Make({
|
|
39
|
+
let name = name
|
|
40
|
+
// Must match the key Plugin_Builder uses to register this DcbEventLog's
|
|
41
|
+
// EventTopic in `allEventTopics` (`name ++ "DcbEventLog"`), so that
|
|
42
|
+
// ReadModel `Mapping.sourceName` matches `meta.service` at dispatch.
|
|
43
|
+
let serviceName = name ++ "DcbEventLog"
|
|
44
|
+
let storage = storageOps
|
|
45
|
+
let publishJson = eventTopicOps.publishJson
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
let ops: DcbEventLog.operations = {
|
|
49
|
+
read: Ops.read,
|
|
50
|
+
append: Ops.append,
|
|
51
|
+
readStream: Ops.readStream,
|
|
52
|
+
appendStream: Ops.appendStream,
|
|
53
|
+
}
|
|
54
|
+
ops
|
|
55
|
+
}),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
let outputs: DcbEventLog.outputs = {
|
|
59
|
+
resources: storage.resources,
|
|
60
|
+
eventTopic: eventTopic->Component.outputs,
|
|
61
|
+
}
|
|
62
|
+
self->Component.setOutputs(outputs)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let make = (~name, ~indexes=[], ~partitionTag, ~crossPartitionTagKeys=[], ~opts=?): component =>
|
|
66
|
+
Component.make(
|
|
67
|
+
~componentType=DcbEventLog.componentType->ComponentType.toString,
|
|
68
|
+
~name,
|
|
69
|
+
~construct=construct(indexes, partitionTag, crossPartitionTagKeys, ...),
|
|
70
|
+
~opts,
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
6
|
+
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
7
|
+
import * as DcbEventLog$ReventlessCore from "./DcbEventLog.res.mjs";
|
|
8
|
+
import * as Util_Pulumi$ReventlessCore from "../../util/Util_Pulumi.res.mjs";
|
|
9
|
+
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
10
|
+
import * as EventTopic_Builder$ReventlessCore from "../EventTopic/EventTopic_Builder.res.mjs";
|
|
11
|
+
import * as DcbEventLog_Operations$ReventlessCore from "./DcbEventLog_Operations.res.mjs";
|
|
12
|
+
|
|
13
|
+
function Make(Storage) {
|
|
14
|
+
return EventTopicPublisher => {
|
|
15
|
+
let make = (name, indexesOpt, partitionTag, crossPartitionTagKeysOpt, opts) => {
|
|
16
|
+
let indexes = indexesOpt !== undefined ? indexesOpt : [];
|
|
17
|
+
let crossPartitionTagKeys = crossPartitionTagKeysOpt !== undefined ? crossPartitionTagKeysOpt : [];
|
|
18
|
+
return Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(DcbEventLog$ReventlessCore.componentType), name, (extra, extra$1) => {
|
|
19
|
+
let opts_parent = Component$ReventlessCore.toPulumiResource(extra);
|
|
20
|
+
let opts = {
|
|
21
|
+
parent: opts_parent
|
|
22
|
+
};
|
|
23
|
+
let storage = Storage.make(ComponentType$ReventlessCore.name(extra$1, DcbEventLog$ReventlessCore.componentType), indexes, partitionTag, crossPartitionTagKeys, opts);
|
|
24
|
+
let SpecificEventTopic = EventTopic_Builder$ReventlessCore.Make({
|
|
25
|
+
Id: Id$Reventless.$$String,
|
|
26
|
+
name: "DcbEventLog",
|
|
27
|
+
eventSchema: S.json
|
|
28
|
+
})(EventTopicPublisher);
|
|
29
|
+
let eventTopic = SpecificEventTopic.make(extra$1, storage.resources, Util_Pulumi$ReventlessCore.ComponentResourceOptions.ofCustomResourceOptions(opts));
|
|
30
|
+
Component$ReventlessCore.setOperations(extra, Pulumi.all([
|
|
31
|
+
storage.operations,
|
|
32
|
+
Component$ReventlessCore.operations(eventTopic)
|
|
33
|
+
]).apply(param => {
|
|
34
|
+
let serviceName = extra$1 + "DcbEventLog";
|
|
35
|
+
let publishJson = param[1].publishJson;
|
|
36
|
+
let Ops = DcbEventLog_Operations$ReventlessCore.Make({
|
|
37
|
+
name: extra$1,
|
|
38
|
+
serviceName: serviceName,
|
|
39
|
+
storage: param[0],
|
|
40
|
+
publishJson: publishJson
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
read: Ops.read,
|
|
44
|
+
append: Ops.append,
|
|
45
|
+
readStream: Ops.readStream,
|
|
46
|
+
appendStream: Ops.appendStream
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
let outputs_resources = storage.resources;
|
|
50
|
+
let outputs_eventTopic = Component$ReventlessCore.outputs(eventTopic);
|
|
51
|
+
let outputs = {
|
|
52
|
+
resources: outputs_resources,
|
|
53
|
+
eventTopic: outputs_eventTopic
|
|
54
|
+
};
|
|
55
|
+
return Component$ReventlessCore.setOutputs(extra, outputs);
|
|
56
|
+
}, opts);
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
make: make
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
Make,
|
|
66
|
+
}
|
|
67
|
+
/* S Not a pure module */
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
module type Ops = {
|
|
2
|
+
let name: string
|
|
3
|
+
// The `service` value stamped on every published event's meta — and used as the
|
|
4
|
+
// first arg to publishJson. Must equal the key under which Plugin_Builder
|
|
5
|
+
// registers this DcbEventLog's EventTopic in `allEventTopics` so that
|
|
6
|
+
// `Mapping.sourceName` matches at dispatch time. See Plan 03 / Phase 1.5.
|
|
7
|
+
let serviceName: string
|
|
8
|
+
let storage: DcbEventLog_Adapter.operations
|
|
9
|
+
let publishJson: EventTopic.publishJson
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module type T = {
|
|
13
|
+
let read: DcbEventLog.read
|
|
14
|
+
let append: DcbEventLog.append
|
|
15
|
+
let readStream: DcbEventLog.readStream
|
|
16
|
+
let appendStream: DcbEventLog.appendStream
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module Make = (Ops: Ops): T => {
|
|
20
|
+
let name = Ops.name
|
|
21
|
+
let serviceName = Ops.serviceName
|
|
22
|
+
|
|
23
|
+
let publishToEventTopic = async (rawEvents: array<DcbEventLog.rawEvent>) => {
|
|
24
|
+
// Meta is now carried per-event by `rawEvent.meta` (set by the slice callback
|
|
25
|
+
// via `Message.deriveMeta(~parent=command.meta, …)` so causationId / correlationId
|
|
26
|
+
// propagate correctly). The publish-time `generateMeta(~service=serviceName)` is
|
|
27
|
+
// gone — each event publishes under its own envelope.
|
|
28
|
+
//
|
|
29
|
+
// The publishedEvent hook contract still carries a single `meta` per batch
|
|
30
|
+
// (its callers expect that shape); we use the first event's meta as the
|
|
31
|
+
// representative envelope for the batch. Hook authors who need per-event
|
|
32
|
+
// meta should read it off the eventsJson dicts.
|
|
33
|
+
let representativeMeta = switch rawEvents->Array.get(0) {
|
|
34
|
+
| Some(re) => re.meta
|
|
35
|
+
| None => Message.generateMeta(~service=serviceName)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let rawEventsJson = rawEvents->Array.map(rawEvent =>
|
|
39
|
+
Message.combineMessage(
|
|
40
|
+
rawEvent.eventType,
|
|
41
|
+
rawEvent.data->JSON.Decode.object->Option.getOr(Dict.make()),
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
// Run beforePublish hook — if it throws, log the error and publish original events.
|
|
46
|
+
let finalRawEventsJson = switch EventPublish_Callback.beforePublishHook.contents {
|
|
47
|
+
| None => rawEventsJson
|
|
48
|
+
| Some(hook) =>
|
|
49
|
+
let published: EventPublish_Callback.publishedEvent = {
|
|
50
|
+
componentName: name,
|
|
51
|
+
entityId: name,
|
|
52
|
+
eventCount: rawEventsJson->Array.length,
|
|
53
|
+
eventsJson: rawEventsJson,
|
|
54
|
+
meta: representativeMeta,
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
let result = await hook(published)
|
|
58
|
+
result.eventsJson
|
|
59
|
+
} catch {
|
|
60
|
+
| err =>
|
|
61
|
+
let errMsg =
|
|
62
|
+
err->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
63
|
+
EffectLogger.logError(
|
|
64
|
+
~comp=`DcbEventLog(${name})`,
|
|
65
|
+
`beforePublishHook error: ${errMsg}`,
|
|
66
|
+
)->Effect.runSync
|
|
67
|
+
rawEventsJson
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let _ = await Array.zip(rawEvents, finalRawEventsJson)
|
|
72
|
+
->Array.map(async ((rawEvent, eventJson)) => {
|
|
73
|
+
let entityId =
|
|
74
|
+
rawEvent.tags->Array.get(0)->Option.map(t => t.value)->Option.getOr(name)
|
|
75
|
+
let eventJson' = Message.composeEventJson'(entityId, rawEvent.meta, eventJson)
|
|
76
|
+
try await Ops.publishJson(serviceName, rawEvent.meta, eventJson') catch {
|
|
77
|
+
| JsExn(err) =>
|
|
78
|
+
let errMsg = err->JsExn.message->Option.getOr("unknown")
|
|
79
|
+
EffectLogger.logError(~comp=`DcbEventLog(${name})`, `EventTopic.publish Error: ${errMsg}`)->Effect.runSync
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
->Promise.all
|
|
83
|
+
|
|
84
|
+
// Run afterPublish hook — fire-and-forget, errors are caught and logged.
|
|
85
|
+
switch EventPublish_Callback.afterPublishHook.contents {
|
|
86
|
+
| None => ()
|
|
87
|
+
| Some(hook) =>
|
|
88
|
+
try {
|
|
89
|
+
let published: EventPublish_Callback.publishedEvent = {
|
|
90
|
+
componentName: name,
|
|
91
|
+
entityId: name,
|
|
92
|
+
eventCount: finalRawEventsJson->Array.length,
|
|
93
|
+
eventsJson: finalRawEventsJson,
|
|
94
|
+
meta: representativeMeta,
|
|
95
|
+
}
|
|
96
|
+
let _ = await hook(published)
|
|
97
|
+
} catch {
|
|
98
|
+
| err =>
|
|
99
|
+
let errMsg =
|
|
100
|
+
err->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
101
|
+
EffectLogger.logError(
|
|
102
|
+
~comp=`DcbEventLog(${name})`,
|
|
103
|
+
`afterPublishHook error: ${errMsg}`,
|
|
104
|
+
)->Effect.runSync
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let append: DcbEventLog.append = async (
|
|
110
|
+
rawEvents,
|
|
111
|
+
~condition=?,
|
|
112
|
+
) => {
|
|
113
|
+
// Normalise `meta.service` to the DcbEventLog's serviceName on every event
|
|
114
|
+
// before BOTH storage append and SNS publish. EventCollector dispatch (via
|
|
115
|
+
// Plugin_Callback.handleJsonEvents) keys on `meta.service`, and the catalog
|
|
116
|
+
// plugin's own EC consumes its own DcbEventLog's DDB stream for outgoing EP
|
|
117
|
+
// routing — so the stored row's service must match the same identity SNS
|
|
118
|
+
// consumers see (`<plugin>DcbEventLog`), not the original caller's plugin
|
|
119
|
+
// name. Causation / correlation / tracing / headers carry through unchanged.
|
|
120
|
+
let normalisedEvents = rawEvents->Array.map(re => {
|
|
121
|
+
...re,
|
|
122
|
+
meta: {...re.meta, service: serviceName},
|
|
123
|
+
})
|
|
124
|
+
// Adapter rawStoredEvent is structurally identical to infra rawEvent
|
|
125
|
+
let adapterEvents: array<DcbEventLog_Adapter.rawStoredEvent> = normalisedEvents->Obj.magic
|
|
126
|
+
let result = await Ops.storage.append(adapterEvents, ~condition?)
|
|
127
|
+
switch result {
|
|
128
|
+
| Ok(position) =>
|
|
129
|
+
await publishToEventTopic(normalisedEvents)
|
|
130
|
+
Ok(position)
|
|
131
|
+
| Error(_) as err => err
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let read: DcbEventLog.read = async (
|
|
136
|
+
~query,
|
|
137
|
+
~after=?,
|
|
138
|
+
) => {
|
|
139
|
+
let rawResult = await Ops.storage.read(~query, ~after?)
|
|
140
|
+
// Adapter rawSequencedEvent is structurally identical to infra rawSequencedEvent
|
|
141
|
+
let events: array<DcbEventLog.rawSequencedEvent> = rawResult.events->Obj.magic
|
|
142
|
+
let result: DcbEventLog.readResult = {
|
|
143
|
+
events,
|
|
144
|
+
headPosition: ?rawResult.headPosition,
|
|
145
|
+
}
|
|
146
|
+
result
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let readStream: DcbEventLog.readStream = (~query, ~after=?, ~strongConsistency=?) =>
|
|
150
|
+
Ops.storage.readStream(~query, ~after?, ~strongConsistency?)->Stream.map(raw => (raw->Obj.magic: DcbEventLog.rawSequencedEvent))
|
|
151
|
+
|
|
152
|
+
// Streaming append — collects the stream into an array, then makes a single
|
|
153
|
+
// storage.append call to preserve atomicity of the condition check.
|
|
154
|
+
// Does not publish to EventTopic (use case: migration / bulk seeding).
|
|
155
|
+
let appendStream: DcbEventLog.appendStream = (stream, ~condition=?) =>
|
|
156
|
+
stream
|
|
157
|
+
->Stream.map(rawEvent => (rawEvent->Obj.magic: DcbEventLog_Adapter.rawStoredEvent))
|
|
158
|
+
->Stream.runCollect
|
|
159
|
+
->Effect.flatMap(rawEvents => Effect.promise(() => Ops.storage.append(rawEvents, ~condition?)))
|
|
160
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
5
|
+
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
6
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
7
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Stream$1 from "effect/Stream";
|
|
10
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
11
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
12
|
+
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
13
|
+
import * as EventPublish_Callback$ReventlessCore from "../EventLog/EventPublish_Callback.res.mjs";
|
|
14
|
+
|
|
15
|
+
function Make(Ops) {
|
|
16
|
+
let name = Ops.name;
|
|
17
|
+
let serviceName = Ops.serviceName;
|
|
18
|
+
let publishToEventTopic = async rawEvents => {
|
|
19
|
+
let re = rawEvents[0];
|
|
20
|
+
let representativeMeta = re !== undefined ? re.meta : Message$ReventlessCore.generateMeta(serviceName, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
21
|
+
let rawEventsJson = rawEvents.map(rawEvent => Message$ReventlessCore.combineMessage(rawEvent.eventType, Stdlib_Option.getOr(Stdlib_JSON.Decode.object(rawEvent.data), {})));
|
|
22
|
+
let hook = EventPublish_Callback$ReventlessCore.beforePublishHook.contents;
|
|
23
|
+
let finalRawEventsJson;
|
|
24
|
+
if (hook !== undefined) {
|
|
25
|
+
let published_eventCount = rawEventsJson.length;
|
|
26
|
+
let published = {
|
|
27
|
+
componentName: name,
|
|
28
|
+
entityId: name,
|
|
29
|
+
eventCount: published_eventCount,
|
|
30
|
+
eventsJson: rawEventsJson,
|
|
31
|
+
meta: representativeMeta
|
|
32
|
+
};
|
|
33
|
+
try {
|
|
34
|
+
finalRawEventsJson = (await hook(published)).eventsJson;
|
|
35
|
+
} catch (raw_err) {
|
|
36
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
37
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
38
|
+
Effect.runSync(EffectLogger$ReventlessCore.logError(`DcbEventLog(` + name + `)`, undefined, `beforePublishHook error: ` + errMsg));
|
|
39
|
+
finalRawEventsJson = rawEventsJson;
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
finalRawEventsJson = rawEventsJson;
|
|
43
|
+
}
|
|
44
|
+
await Promise.all(Stdlib_Array.zip(rawEvents, finalRawEventsJson).map(async param => {
|
|
45
|
+
let rawEvent = param[0];
|
|
46
|
+
let entityId = Stdlib_Option.getOr(Stdlib_Option.map(rawEvent.tags[0], t => t.value), name);
|
|
47
|
+
let eventJson$p = Message$ReventlessCore.composeEventJson$p(entityId, rawEvent.meta, param[1]);
|
|
48
|
+
try {
|
|
49
|
+
return await Ops.publishJson(serviceName, rawEvent.meta, eventJson$p);
|
|
50
|
+
} catch (raw_err) {
|
|
51
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
52
|
+
if (err.RE_EXN_ID === "JsExn") {
|
|
53
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_JsExn.message(err._1), "unknown");
|
|
54
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logError(`DcbEventLog(` + name + `)`, undefined, `EventTopic.publish Error: ` + errMsg));
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
let hook$1 = EventPublish_Callback$ReventlessCore.afterPublishHook.contents;
|
|
60
|
+
if (hook$1 === undefined) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
let published_eventCount$1 = finalRawEventsJson.length;
|
|
65
|
+
let published$1 = {
|
|
66
|
+
componentName: name,
|
|
67
|
+
entityId: name,
|
|
68
|
+
eventCount: published_eventCount$1,
|
|
69
|
+
eventsJson: finalRawEventsJson,
|
|
70
|
+
meta: representativeMeta
|
|
71
|
+
};
|
|
72
|
+
await hook$1(published$1);
|
|
73
|
+
return;
|
|
74
|
+
} catch (raw_err$1) {
|
|
75
|
+
let err$1 = Primitive_exceptions.internalToException(raw_err$1);
|
|
76
|
+
let errMsg$1 = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err$1), Stdlib_JsExn.message), "unknown");
|
|
77
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logError(`DcbEventLog(` + name + `)`, undefined, `afterPublishHook error: ` + errMsg$1));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
let append = async (rawEvents, condition) => {
|
|
81
|
+
let normalisedEvents = rawEvents.map(re => {
|
|
82
|
+
let newrecord = {...re.meta};
|
|
83
|
+
return {
|
|
84
|
+
eventType: re.eventType,
|
|
85
|
+
data: re.data,
|
|
86
|
+
tags: re.tags,
|
|
87
|
+
meta: (newrecord.service = serviceName, newrecord)
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
let result = await Ops.storage.append(normalisedEvents, condition);
|
|
91
|
+
if (result.TAG !== "Ok") {
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
await publishToEventTopic(normalisedEvents);
|
|
95
|
+
return {
|
|
96
|
+
TAG: "Ok",
|
|
97
|
+
_0: result._0
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
let read = async (query, after) => {
|
|
101
|
+
let rawResult = await Ops.storage.read(query, after);
|
|
102
|
+
let events = rawResult.events;
|
|
103
|
+
return {
|
|
104
|
+
events: events,
|
|
105
|
+
headPosition: rawResult.headPosition
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
let readStream = (query, after, strongConsistency) => Stream$1.map(Ops.storage.readStream(query, after, strongConsistency), raw => raw);
|
|
109
|
+
let appendStream = (stream, condition) => Effect.flatMap(Stream.runCollect(Stream$1.map(stream, rawEvent => rawEvent)), rawEvents => Effect.promise(() => Ops.storage.append(rawEvents, condition)));
|
|
110
|
+
return {
|
|
111
|
+
read: read,
|
|
112
|
+
append: append,
|
|
113
|
+
readStream: readStream,
|
|
114
|
+
appendStream: appendStream
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
Make,
|
|
120
|
+
}
|
|
121
|
+
/* Stream Not a pure module */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
let componentType = ComponentType.EventCollector
|
|
2
|
+
|
|
3
|
+
type enqueueEvent = ReventlessInfra.EventCollector.enqueueEvent
|
|
4
|
+
|
|
5
|
+
type t
|
|
6
|
+
type outputs = ReventlessInfra.EventCollector.outputs
|
|
7
|
+
type operations = {enqueueEvent: enqueueEvent}
|
|
8
|
+
type component = Component.t<t, outputs, operations>
|
|
9
|
+
|
|
10
|
+
/** Stream-based internal handler type. All events in a batch arrive as a single Stream. */
|
|
11
|
+
type jsonEventsHandler = Stream.t<JSON.t, string, unit> => Effect.t<unit, string, unit>
|
|
12
|
+
|
|
13
|
+
module type T = {
|
|
14
|
+
type callbackEvent
|
|
15
|
+
type runtimeParts
|
|
16
|
+
|
|
17
|
+
let connect: (
|
|
18
|
+
~eventTopics: EventTopic.allOutputs,
|
|
19
|
+
~resources: array<ReventlessInfra.Adapter.resource>,
|
|
20
|
+
~runtime: Runtime.environment<runtimeParts>,
|
|
21
|
+
component,
|
|
22
|
+
) => unit
|
|
23
|
+
|
|
24
|
+
let makeHandler: (
|
|
25
|
+
~eventCollector: component,
|
|
26
|
+
~jsonEventsHandler: jsonEventsHandler,
|
|
27
|
+
) => Pulumi.Output.t<Runtime.effectHandler<callbackEvent, 'context, unit, string>>
|
|
28
|
+
|
|
29
|
+
let make: (
|
|
30
|
+
~name: string,
|
|
31
|
+
~eventTopics: EventTopic.allOutputs,
|
|
32
|
+
~opts: Pulumi.ComponentResource.options,
|
|
33
|
+
) => component
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type channel<'callbackEvent, 'context, 'channelParts> = {
|
|
2
|
+
parts: 'channelParts,
|
|
3
|
+
resources: array<ReventlessInfra.Adapter.resource>,
|
|
4
|
+
enqueueEvent: Pulumi.Output.t<EventCollector.enqueueEvent>,
|
|
5
|
+
handleChannelEvent: EventCollector.jsonEventsHandler => Pulumi.Output.t<
|
|
6
|
+
Runtime.effectHandler<'callbackEvent, 'context, unit, string>,
|
|
7
|
+
>,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type channelSpec<'callbackEvent, 'context, 'channelParts> = {
|
|
11
|
+
channel: channel<'callbackEvent, 'context, 'channelParts>,
|
|
12
|
+
eventTopics: EventTopic.allOutputs,
|
|
13
|
+
resources: array<ReventlessInfra.Adapter.resource>,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type connect<'callbackEvent, 'context, 'channelParts, 'runtimeParts> = (
|
|
17
|
+
~name: string,
|
|
18
|
+
~channelSpecs: array<channelSpec<'callbackEvent, 'context, 'channelParts>>,
|
|
19
|
+
~runtime: Runtime.environment<'runtimeParts>,
|
|
20
|
+
~opts: Pulumi.ComponentResource.options,
|
|
21
|
+
) => array<ReventlessInfra.Adapter.resource>
|
|
22
|
+
|
|
23
|
+
type channelMaker<'callbackEvent, 'context, 'channelParts> = (
|
|
24
|
+
~name: string,
|
|
25
|
+
~eventTopics: EventTopic.allOutputs,
|
|
26
|
+
~opts: Pulumi.ComponentResource.options,
|
|
27
|
+
) => channel<'callbackEvent, 'context, 'channelParts>
|
|
28
|
+
|
|
29
|
+
@set
|
|
30
|
+
external setChannel: (
|
|
31
|
+
EventCollector.component,
|
|
32
|
+
channel<'callbackEvent, 'context, 'channelParts>,
|
|
33
|
+
) => unit = "channel"
|
|
34
|
+
@get
|
|
35
|
+
external channel: EventCollector.component => channel<'callbackEvent, 'context, 'channelParts> =
|
|
36
|
+
"channel"
|
|
37
|
+
|
|
38
|
+
module type Channel = {
|
|
39
|
+
type callbackEvent
|
|
40
|
+
type channelParts
|
|
41
|
+
type runtimeParts
|
|
42
|
+
|
|
43
|
+
let make: channelMaker<callbackEvent, 'context, channelParts>
|
|
44
|
+
let connect: connect<callbackEvent, 'context, channelParts, runtimeParts>
|
|
45
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a handler from a stream-aware, schema-decoded handler.
|
|
3
|
+
* Each incoming JSON event is decoded via `schema`; decode errors become Effect failures.
|
|
4
|
+
* Use this when writing handlers that want to consume a typed `Stream.t<'event>` directly.
|
|
5
|
+
*/
|
|
6
|
+
let makeStreamHandler = (
|
|
7
|
+
~eventCollector: EventCollector.component,
|
|
8
|
+
~schema: S.t<'event>,
|
|
9
|
+
~jsonEventsHandler: Stream.t<'event, string, unit> => Effect.t<unit, string, unit>,
|
|
10
|
+
) => {
|
|
11
|
+
let jsonHandler: EventCollector.jsonEventsHandler = stream =>
|
|
12
|
+
stream
|
|
13
|
+
->Stream.mapEffect(json =>
|
|
14
|
+
Effect.trySync(~catch=_exn => "decode error", () => json->S.parseOrThrow(schema))
|
|
15
|
+
)
|
|
16
|
+
->jsonEventsHandler
|
|
17
|
+
|
|
18
|
+
let channel: EventCollector_Adapter.channel<_, _, _> = eventCollector->EventCollector_Adapter.channel
|
|
19
|
+
channel.handleChannelEvent(jsonHandler)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module Make = (
|
|
23
|
+
RuntimeEnvironment: Runtime.Environment,
|
|
24
|
+
Channel: EventCollector_Adapter.Channel with type runtimeParts = RuntimeEnvironment.parts,
|
|
25
|
+
): (
|
|
26
|
+
EventCollector.T
|
|
27
|
+
with type callbackEvent = Channel.callbackEvent
|
|
28
|
+
and type runtimeParts = RuntimeEnvironment.parts
|
|
29
|
+
) => {
|
|
30
|
+
type callbackEvent = Channel.callbackEvent
|
|
31
|
+
type runtimeParts = RuntimeEnvironment.parts
|
|
32
|
+
|
|
33
|
+
let construct = (~eventTopics, self, name) => {
|
|
34
|
+
let opts = {Pulumi.ComponentResource.parent: self->Component.toPulumiResource}
|
|
35
|
+
let name = name->ComponentType.name(EventCollector.componentType)
|
|
36
|
+
|
|
37
|
+
let channel = Channel.make(~name, ~eventTopics, ~opts)
|
|
38
|
+
self->EventCollector_Adapter.setChannel(channel)
|
|
39
|
+
|
|
40
|
+
self->Component.setOperations(
|
|
41
|
+
channel.enqueueEvent->Pulumi.Output.apply(enqueueEvent => {
|
|
42
|
+
let ops: EventCollector.operations = {enqueueEvent: enqueueEvent}
|
|
43
|
+
ops
|
|
44
|
+
}),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
let outputs: EventCollector.outputs = {
|
|
48
|
+
name,
|
|
49
|
+
resources: channel.resources,
|
|
50
|
+
}
|
|
51
|
+
self->Component.setOutputs(outputs)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let connect = (~eventTopics, ~resources, ~runtime, eventCollector) => {
|
|
55
|
+
let eventCollectorResource = eventCollector->Component.toPulumiResource
|
|
56
|
+
let name =
|
|
57
|
+
eventCollectorResource.name
|
|
58
|
+
->Option.getOr("Unnamed")
|
|
59
|
+
->ComponentType.name(EventCollector.componentType)
|
|
60
|
+
|
|
61
|
+
let _connectResources = Channel.connect(
|
|
62
|
+
~name,
|
|
63
|
+
~channelSpecs=[
|
|
64
|
+
{channel: eventCollector->EventCollector_Adapter.channel, eventTopics, resources},
|
|
65
|
+
],
|
|
66
|
+
~runtime,
|
|
67
|
+
~opts={Pulumi.ComponentResource.parent: eventCollectorResource},
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
// let _ = eventCollector->Component.setOutputs({
|
|
71
|
+
// EventCollector.name,
|
|
72
|
+
// resources: channel.resources->Array.concat(connectResources),
|
|
73
|
+
// })
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let makeHandler = (
|
|
77
|
+
~eventCollector: EventCollector.component,
|
|
78
|
+
~jsonEventsHandler: EventCollector.jsonEventsHandler,
|
|
79
|
+
) => {
|
|
80
|
+
let channel = eventCollector->EventCollector_Adapter.channel
|
|
81
|
+
channel.handleChannelEvent(jsonEventsHandler)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let make = (~name, ~eventTopics, ~opts): EventCollector.component =>
|
|
85
|
+
Component.make(
|
|
86
|
+
~componentType=EventCollector.componentType->ComponentType.toString,
|
|
87
|
+
~name,
|
|
88
|
+
~construct=construct(~eventTopics, ...),
|
|
89
|
+
~opts=Some(opts),
|
|
90
|
+
)
|
|
91
|
+
}
|