@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,58 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Plugin$Reventless from "@reventlessdev/reventless-spec/src/components/Plugin.res.mjs";
|
|
5
|
+
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
6
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
7
|
+
|
|
8
|
+
let statusSchema = S.union([
|
|
9
|
+
S.literal("Connected"),
|
|
10
|
+
S.literal("Disconnected"),
|
|
11
|
+
S.literal("Inactive"),
|
|
12
|
+
S.literal("Retired")
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
let stateSchema = S.schema(s => ({
|
|
16
|
+
name: s.m(Plugin$Reventless.nameSchema),
|
|
17
|
+
version: s.m(Plugin$Reventless.versionSchema),
|
|
18
|
+
eventCollector: s.m(S.string),
|
|
19
|
+
extensionPoints: s.m(S.array(Plugin$Reventless.extensionPointDefinitionSchema)),
|
|
20
|
+
extensionPointNames: s.m(S.array(S.string)),
|
|
21
|
+
extensionNames: s.m(S.array(S.string)),
|
|
22
|
+
extensions: s.m(S.array(Plugin$Reventless.extensionDefinitionSchema)),
|
|
23
|
+
status: s.m(statusSchema),
|
|
24
|
+
statusChange: s.m(Message$ReventlessCore.statusChangeSchema),
|
|
25
|
+
apiSchemaFragment: s.m(Plugin$Reventless.apiSchemaFragmentOptionSchema),
|
|
26
|
+
apiTarget: s.m(S.option(S.string)),
|
|
27
|
+
uiFragments: s.m(Plugin$Reventless.uiFragmentManifestOptionSchema),
|
|
28
|
+
structure: s.m(Plugin$Reventless.pluginStructureOptionSchema),
|
|
29
|
+
dcbEventLog: s.m(Plugin$Reventless.dcbEventLogOptionSchema),
|
|
30
|
+
otherConnectedVersions: s.m(S.array(Plugin$Reventless.versionSchema))
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
34
|
+
|
|
35
|
+
let name = "Plugins";
|
|
36
|
+
|
|
37
|
+
let Id;
|
|
38
|
+
|
|
39
|
+
let subIdConfig;
|
|
40
|
+
|
|
41
|
+
let moduleUrl = "@reventlessdev/reventless-core/src/plugin/lifecycle/PluginsReadModelSpec.res.mjs";
|
|
42
|
+
|
|
43
|
+
let authorization = "AllowAuthenticated";
|
|
44
|
+
|
|
45
|
+
let visibility = "Public";
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
name,
|
|
49
|
+
Id,
|
|
50
|
+
statusSchema,
|
|
51
|
+
stateSchema,
|
|
52
|
+
config,
|
|
53
|
+
subIdConfig,
|
|
54
|
+
moduleUrl,
|
|
55
|
+
authorization,
|
|
56
|
+
visibility,
|
|
57
|
+
}
|
|
58
|
+
/* statusSchema Not a pure module */
|
package/src/util/AWS.res
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
let invalidNameChars = /[^.\-_a-zA-Z0-9]/g
|
|
2
|
+
|
|
3
|
+
let validateName = String.replaceRegExp(_, invalidNameChars, "_")
|
|
4
|
+
|
|
5
|
+
// Example ARN: arn:aws:sqs:eu-west-1:xxxxxx:MarketplaceServiceExtensionPointCommandTopic-0101023
|
|
6
|
+
let arn2Name: string => string = arn =>
|
|
7
|
+
arn->String.split(":")->Array.get(5)->Option.getOr("unknown")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
+
|
|
5
|
+
let invalidNameChars = /[^.\-_a-zA-Z0-9]/g;
|
|
6
|
+
|
|
7
|
+
function validateName(__x) {
|
|
8
|
+
return __x.replace(invalidNameChars, "_");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function arn2Name(arn) {
|
|
12
|
+
return Stdlib_Option.getOr(arn.split(":")[5], "unknown");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
invalidNameChars,
|
|
17
|
+
validateName,
|
|
18
|
+
arn2Name,
|
|
19
|
+
}
|
|
20
|
+
/* No side effect */
|
package/src/util/CSV.res
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** FastCSV bindings with added helper functions to handle Validation.t as well */
|
|
2
|
+
include FastCSV
|
|
3
|
+
include FastCSV_Helpers
|
|
4
|
+
|
|
5
|
+
/** Add correct callback for validation to Validation.t - to be used in validation function
|
|
6
|
+
TODO: hide behind an interface definition
|
|
7
|
+
*/
|
|
8
|
+
let fromValidation: (Validation.t<unit, string>, callback) => calledBack = (validation, cb) =>
|
|
9
|
+
switch validation {
|
|
10
|
+
| Failure(msg) => cb->toInvalid(msg)
|
|
11
|
+
| Failures(msgs) => cb->toInvalid(msgs->Array.joinUnsafe(", "))
|
|
12
|
+
| Success(_)
|
|
13
|
+
| Successes(_) =>
|
|
14
|
+
cb->toValid
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Register a single validation function based on Validation.t
|
|
18
|
+
example:
|
|
19
|
+
{[
|
|
20
|
+
parseFile(~path=\"x\",())
|
|
21
|
+
-> validateValidation(_row => Validation.Failure(\"Some reason for invalidation\"))
|
|
22
|
+
]}
|
|
23
|
+
*/
|
|
24
|
+
let validateValidation: (row => Validation.t<unit, string>, csvParserStream) => csvParserStream = (
|
|
25
|
+
validation,
|
|
26
|
+
parser,
|
|
27
|
+
) => parser->validate((row, cb) => row->validation->fromValidation(cb))
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as FastCSV from "@reventlessdev/rescript-fast-csv/src/FastCSV.res.mjs";
|
|
4
|
+
import * as FastCSV_Helpers from "@reventlessdev/rescript-fast-csv/src/FastCSV_Helpers.res.mjs";
|
|
5
|
+
|
|
6
|
+
function fromValidation(validation, cb) {
|
|
7
|
+
switch (validation.TAG) {
|
|
8
|
+
case "Success" :
|
|
9
|
+
case "Successes" :
|
|
10
|
+
return FastCSV_Helpers.toValid(cb);
|
|
11
|
+
case "Failure" :
|
|
12
|
+
return FastCSV_Helpers.toInvalid(cb, validation._0);
|
|
13
|
+
case "Failures" :
|
|
14
|
+
return FastCSV_Helpers.toInvalid(cb, validation._0.join(", "));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function validateValidation(validation, parser) {
|
|
19
|
+
return parser.validate((row, cb) => fromValidation(validation(row), cb));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let Options = FastCSV.Options;
|
|
23
|
+
|
|
24
|
+
let toInvalid = FastCSV_Helpers.toInvalid;
|
|
25
|
+
|
|
26
|
+
let toValid = FastCSV_Helpers.toValid;
|
|
27
|
+
|
|
28
|
+
let toError = FastCSV_Helpers.toError;
|
|
29
|
+
|
|
30
|
+
let toValidTransformation = FastCSV_Helpers.toValidTransformation;
|
|
31
|
+
|
|
32
|
+
let toErrorTransformation = FastCSV_Helpers.toErrorTransformation;
|
|
33
|
+
|
|
34
|
+
let fromImporterValidation = FastCSV_Helpers.fromImporterValidation;
|
|
35
|
+
|
|
36
|
+
let validateMultiple = FastCSV_Helpers.validateMultiple;
|
|
37
|
+
|
|
38
|
+
let validateResult = FastCSV_Helpers.validateResult;
|
|
39
|
+
|
|
40
|
+
let validateMultipleResults = FastCSV_Helpers.validateMultipleResults;
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
Options,
|
|
44
|
+
toInvalid,
|
|
45
|
+
toValid,
|
|
46
|
+
toError,
|
|
47
|
+
toValidTransformation,
|
|
48
|
+
toErrorTransformation,
|
|
49
|
+
fromImporterValidation,
|
|
50
|
+
validateMultiple,
|
|
51
|
+
validateResult,
|
|
52
|
+
validateMultipleResults,
|
|
53
|
+
fromValidation,
|
|
54
|
+
validateValidation,
|
|
55
|
+
}
|
|
56
|
+
/* No side effect */
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
module type Spec = {
|
|
2
|
+
@schema
|
|
3
|
+
let name: string
|
|
4
|
+
@schema
|
|
5
|
+
type command
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type mode = SendChunks(int) | SendAllInOneChunk
|
|
9
|
+
|
|
10
|
+
module type Config = {
|
|
11
|
+
let user: string
|
|
12
|
+
let publishCommands: Task.publishCommands
|
|
13
|
+
let mode: mode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module Make = (Spec: Spec, Config: Config) => {
|
|
17
|
+
let buffer = []
|
|
18
|
+
let running = ref(None)
|
|
19
|
+
let flush = ref(false)
|
|
20
|
+
let chunkCount = ref(0)
|
|
21
|
+
|
|
22
|
+
let finishRunning = async () =>
|
|
23
|
+
switch running.contents {
|
|
24
|
+
| None => ()
|
|
25
|
+
| Some(promise) =>
|
|
26
|
+
try await promise catch {
|
|
27
|
+
| JsExn(e) =>
|
|
28
|
+
let errMsg = e->JsExn.message->Option.getOr("unknown")
|
|
29
|
+
EffectLogger.logError(~comp="CommandPublisher", `Couldn't publish commands: ${errMsg}`)->Effect.runSync
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let toJsons = commandsToSend => {
|
|
34
|
+
EffectLogger.logDebug(
|
|
35
|
+
~comp="CommandPublisher",
|
|
36
|
+
`toJsons: commandsToSend: ${commandsToSend->Array.length->Int.toString} rest: ${buffer
|
|
37
|
+
->Array.length
|
|
38
|
+
->Int.toString}`,
|
|
39
|
+
)->Effect.runSync
|
|
40
|
+
commandsToSend->Array.map(((id, command)) => {
|
|
41
|
+
let commandJson = command->Message.encode(Spec.commandSchema)
|
|
42
|
+
{
|
|
43
|
+
Reventless.Message.id,
|
|
44
|
+
meta: Message.generateMeta(~service=Spec.name, ~user=Config.user),
|
|
45
|
+
commandJson,
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Sends buffered commands. The underlying publishCommands (SQS) already retries
|
|
51
|
+
// transient failures — no retry at this layer.
|
|
52
|
+
let rec send = async () => {
|
|
53
|
+
await finishRunning()
|
|
54
|
+
switch Config.mode {
|
|
55
|
+
| SendChunks(chunkSize) =>
|
|
56
|
+
let size = Math.Int.min(chunkSize, buffer->Array.length)
|
|
57
|
+
if size >= chunkSize || (size > 0 && flush.contents) {
|
|
58
|
+
chunkCount := chunkCount.contents + 1
|
|
59
|
+
let sizeStr = size->Int.toString
|
|
60
|
+
let bufferSizeStr = buffer->Array.length->Int.toString
|
|
61
|
+
let chunkCountStr = chunkCount.contents->Int.toString
|
|
62
|
+
EffectLogger.logDebug(
|
|
63
|
+
~comp="CommandPublisher",
|
|
64
|
+
`send: bufferSize: ${bufferSizeStr}, chunk: ${chunkCountStr}, size: ${sizeStr}`,
|
|
65
|
+
)->Effect.runSync
|
|
66
|
+
let commandsToSend = buffer->Array.toSpliced(~start=0, ~remove=size, ~insert=[])
|
|
67
|
+
let promise = Config.publishCommands(Spec.name, commandsToSend->toJsons)
|
|
68
|
+
running := Some(promise)
|
|
69
|
+
switch await promise {
|
|
70
|
+
| () => EffectLogger.logDebug(~comp="CommandPublisher", `send: finished chunk ${chunkCountStr}: ${sizeStr}`)->Effect.runSync
|
|
71
|
+
| exception JsExn(e) =>
|
|
72
|
+
let errorMessage = e->JsExn.message->Option.getOr("unknown Error")
|
|
73
|
+
EffectLogger.logError(
|
|
74
|
+
~comp="CommandPublisher",
|
|
75
|
+
`send error: couldn't publish chunk ${chunkCountStr} (${sizeStr} commands): ${errorMessage}`,
|
|
76
|
+
)->Effect.runSync
|
|
77
|
+
}
|
|
78
|
+
await send()
|
|
79
|
+
} else {
|
|
80
|
+
running := None
|
|
81
|
+
}
|
|
82
|
+
| SendAllInOneChunk =>
|
|
83
|
+
let size = buffer->Array.length
|
|
84
|
+
if size > 0 {
|
|
85
|
+
let commandsToSend = buffer->Array.toSpliced(~start=0, ~remove=size, ~insert=[])
|
|
86
|
+
let promise = Config.publishCommands(Spec.name, commandsToSend->toJsons)
|
|
87
|
+
running := Some(promise)
|
|
88
|
+
switch await promise {
|
|
89
|
+
| () =>
|
|
90
|
+
EffectLogger.logDebug(
|
|
91
|
+
~comp="CommandPublisher",
|
|
92
|
+
`send: finished SendAllInOneChunk: ${size->Int.toString}`,
|
|
93
|
+
)->Effect.runSync
|
|
94
|
+
| exception JsExn(e) =>
|
|
95
|
+
let errMsg = e->JsExn.message->Option.getOr("unknown")
|
|
96
|
+
EffectLogger.logError(
|
|
97
|
+
~comp="CommandPublisher",
|
|
98
|
+
`send error: couldn't publish ${size->Int.toString} commands: ${errMsg}`,
|
|
99
|
+
)->Effect.runSync
|
|
100
|
+
}
|
|
101
|
+
running := None
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let publish = (id: string, command: Spec.command) => {
|
|
107
|
+
let _ = buffer->Array.push((id, command))
|
|
108
|
+
switch (running.contents, Config.mode) {
|
|
109
|
+
| (None, SendChunks(chunkSize)) if buffer->Array.length >= chunkSize =>
|
|
110
|
+
running := Some(Promise.resolve())
|
|
111
|
+
let _ = send()
|
|
112
|
+
| _ => ()
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let clear = () => {
|
|
117
|
+
EffectLogger.logDebug(~comp="CommandPublisher", "clear")->Effect.runSync
|
|
118
|
+
let _ = buffer->Array.removeInPlace(0)
|
|
119
|
+
flush := false
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let flush = async () => {
|
|
123
|
+
EffectLogger.logDebug(~comp="CommandPublisher", "flush")->Effect.runSync
|
|
124
|
+
flush := true
|
|
125
|
+
switch running.contents {
|
|
126
|
+
| None => await send()
|
|
127
|
+
| _ =>
|
|
128
|
+
while running.contents->Option.isNone {
|
|
129
|
+
await finishRunning()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
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 Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
7
|
+
import * as Message$ReventlessCore from "../Message.res.mjs";
|
|
8
|
+
import * as EffectLogger$ReventlessCore from "./EffectLogger.res.mjs";
|
|
9
|
+
|
|
10
|
+
function Make(Spec) {
|
|
11
|
+
return Config => {
|
|
12
|
+
let buffer = [];
|
|
13
|
+
let running = {
|
|
14
|
+
contents: undefined
|
|
15
|
+
};
|
|
16
|
+
let flush = {
|
|
17
|
+
contents: false
|
|
18
|
+
};
|
|
19
|
+
let chunkCount = {
|
|
20
|
+
contents: 0
|
|
21
|
+
};
|
|
22
|
+
let finishRunning = async () => {
|
|
23
|
+
let promise = running.contents;
|
|
24
|
+
if (promise === undefined) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return await promise;
|
|
29
|
+
} catch (raw_e) {
|
|
30
|
+
let e = Primitive_exceptions.internalToException(raw_e);
|
|
31
|
+
if (e.RE_EXN_ID === "JsExn") {
|
|
32
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_JsExn.message(e._1), "unknown");
|
|
33
|
+
return Effect.runSync(EffectLogger$ReventlessCore.logError("CommandPublisher", undefined, `Couldn't publish commands: ` + errMsg));
|
|
34
|
+
}
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
let toJsons = commandsToSend => {
|
|
39
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug("CommandPublisher", undefined, `toJsons: commandsToSend: ` + commandsToSend.length.toString() + ` rest: ` + buffer.length.toString()));
|
|
40
|
+
return commandsToSend.map(param => {
|
|
41
|
+
let commandJson = Message$ReventlessCore.encode(param[1], Spec.commandSchema);
|
|
42
|
+
return {
|
|
43
|
+
id: param[0],
|
|
44
|
+
meta: Message$ReventlessCore.generateMeta(Spec.name, undefined, Config.user, undefined, undefined, undefined, undefined, undefined),
|
|
45
|
+
commandJson: commandJson
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
let send = async () => {
|
|
50
|
+
await finishRunning();
|
|
51
|
+
let chunkSize = Config.mode;
|
|
52
|
+
if (typeof chunkSize !== "object") {
|
|
53
|
+
let size = buffer.length;
|
|
54
|
+
if (size <= 0) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let commandsToSend = buffer.toSpliced(0, size);
|
|
58
|
+
let promise = Config.publishCommands(Spec.name, toJsons(commandsToSend));
|
|
59
|
+
running.contents = promise;
|
|
60
|
+
let exit = 0;
|
|
61
|
+
let val;
|
|
62
|
+
try {
|
|
63
|
+
val = await promise;
|
|
64
|
+
exit = 1;
|
|
65
|
+
} catch (raw_e) {
|
|
66
|
+
let e = Primitive_exceptions.internalToException(raw_e);
|
|
67
|
+
if (e.RE_EXN_ID === "JsExn") {
|
|
68
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_JsExn.message(e._1), "unknown");
|
|
69
|
+
Effect.runSync(EffectLogger$ReventlessCore.logError("CommandPublisher", undefined, `send error: couldn't publish ` + size.toString() + ` commands: ` + errMsg));
|
|
70
|
+
} else {
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (exit === 1) {
|
|
75
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug("CommandPublisher", undefined, `send: finished SendAllInOneChunk: ` + size.toString()));
|
|
76
|
+
}
|
|
77
|
+
running.contents = undefined;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
let chunkSize$1 = chunkSize._0;
|
|
81
|
+
let size$1 = Math.min(chunkSize$1, buffer.length);
|
|
82
|
+
if (!(size$1 >= chunkSize$1 || size$1 > 0 && flush.contents)) {
|
|
83
|
+
running.contents = undefined;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
chunkCount.contents = chunkCount.contents + 1 | 0;
|
|
87
|
+
let sizeStr = size$1.toString();
|
|
88
|
+
let bufferSizeStr = buffer.length.toString();
|
|
89
|
+
let chunkCountStr = chunkCount.contents.toString();
|
|
90
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug("CommandPublisher", undefined, `send: bufferSize: ` + bufferSizeStr + `, chunk: ` + chunkCountStr + `, size: ` + sizeStr));
|
|
91
|
+
let commandsToSend$1 = buffer.toSpliced(0, size$1);
|
|
92
|
+
let promise$1 = Config.publishCommands(Spec.name, toJsons(commandsToSend$1));
|
|
93
|
+
running.contents = promise$1;
|
|
94
|
+
let exit$1 = 0;
|
|
95
|
+
let val$1;
|
|
96
|
+
try {
|
|
97
|
+
val$1 = await promise$1;
|
|
98
|
+
exit$1 = 1;
|
|
99
|
+
} catch (raw_e$1) {
|
|
100
|
+
let e$1 = Primitive_exceptions.internalToException(raw_e$1);
|
|
101
|
+
if (e$1.RE_EXN_ID === "JsExn") {
|
|
102
|
+
let errorMessage = Stdlib_Option.getOr(Stdlib_JsExn.message(e$1._1), "unknown Error");
|
|
103
|
+
Effect.runSync(EffectLogger$ReventlessCore.logError("CommandPublisher", undefined, `send error: couldn't publish chunk ` + chunkCountStr + ` (` + sizeStr + ` commands): ` + errorMessage));
|
|
104
|
+
} else {
|
|
105
|
+
throw e$1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (exit$1 === 1) {
|
|
109
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug("CommandPublisher", undefined, `send: finished chunk ` + chunkCountStr + `: ` + sizeStr));
|
|
110
|
+
}
|
|
111
|
+
return await send();
|
|
112
|
+
};
|
|
113
|
+
let publish = (id, command) => {
|
|
114
|
+
buffer.push([
|
|
115
|
+
id,
|
|
116
|
+
command
|
|
117
|
+
]);
|
|
118
|
+
let match = running.contents;
|
|
119
|
+
let match$1 = Config.mode;
|
|
120
|
+
if (match !== undefined || typeof match$1 !== "object" || buffer.length < match$1._0) {
|
|
121
|
+
return;
|
|
122
|
+
} else {
|
|
123
|
+
running.contents = Promise.resolve();
|
|
124
|
+
send();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
let clear = () => {
|
|
129
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug("CommandPublisher", undefined, "clear"));
|
|
130
|
+
buffer.splice(0, 1);
|
|
131
|
+
flush.contents = false;
|
|
132
|
+
};
|
|
133
|
+
let flush$1 = async () => {
|
|
134
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug("CommandPublisher", undefined, "flush"));
|
|
135
|
+
flush.contents = true;
|
|
136
|
+
let match = running.contents;
|
|
137
|
+
if (match === undefined) {
|
|
138
|
+
return await send();
|
|
139
|
+
}
|
|
140
|
+
while (Stdlib_Option.isNone(running.contents)) {
|
|
141
|
+
await finishRunning();
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
buffer: buffer,
|
|
146
|
+
running: running,
|
|
147
|
+
chunkCount: chunkCount,
|
|
148
|
+
finishRunning: finishRunning,
|
|
149
|
+
toJsons: toJsons,
|
|
150
|
+
send: send,
|
|
151
|
+
publish: publish,
|
|
152
|
+
clear: clear,
|
|
153
|
+
flush: flush$1
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
Make,
|
|
160
|
+
}
|
|
161
|
+
/* Stdlib_JsExn Not a pure module */
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// CsvStream.res
|
|
2
|
+
// Bridges FastCSV's callback-based API to an Effect Stream.
|
|
3
|
+
// Rows are emitted as CSV.row (= dict<string>) using the header row as keys.
|
|
4
|
+
//
|
|
5
|
+
// Implementation: each onData callback offers its row into an unbounded Queue;
|
|
6
|
+
// Stream.fromQueue drains the queue lazily. This lets callers start processing
|
|
7
|
+
// rows as they arrive rather than waiting for the entire file to be loaded.
|
|
8
|
+
//
|
|
9
|
+
// Note: Stream.take(n) short-circuits queue consumption, but the underlying
|
|
10
|
+
// CSV parser runs at full speed and continues reading in the background.
|
|
11
|
+
// Effect.runSyncExit is used inside the onData/onEnd/onError callbacks so that
|
|
12
|
+
// a shut-down queue (e.g. after stream interruption) never throws.
|
|
13
|
+
|
|
14
|
+
// Parse a CSV file, emitting one row per stream item.
|
|
15
|
+
// The first row is treated as column headers (not emitted as data).
|
|
16
|
+
// CSV parse errors are propagated through the stream's error channel.
|
|
17
|
+
let parseRows = (~path: string): Stream.t<CSV.row, string, unit> =>
|
|
18
|
+
Queue.unbounded()
|
|
19
|
+
->Effect.flatMap(queue => {
|
|
20
|
+
let _ = CSV.parseFile(~path, ~options={headers: CSV.Options.Bool(true)})
|
|
21
|
+
->CSV.onData(row => Queue.offer(queue, Ok(row))->Effect.runSyncExit->ignore)
|
|
22
|
+
->CSV.onEnd(_ => Queue.shutdown(queue)->Effect.runSyncExit->ignore)
|
|
23
|
+
->CSV.onError(err => {
|
|
24
|
+
let msg = err->JsExn.message->Option.getOr("CSV parse error")
|
|
25
|
+
Queue.offer(queue, Error(msg))->Effect.runSyncExit->ignore
|
|
26
|
+
Queue.shutdown(queue)->Effect.runSyncExit->ignore
|
|
27
|
+
})
|
|
28
|
+
Effect.succeed(queue)
|
|
29
|
+
})
|
|
30
|
+
->Stream.fromEffect
|
|
31
|
+
->Stream.flatMap(queue =>
|
|
32
|
+
Stream.fromQueue(queue)
|
|
33
|
+
->Stream.mapEffect(item =>
|
|
34
|
+
switch item {
|
|
35
|
+
| Ok(row) => Effect.succeed(row)
|
|
36
|
+
| Error(msg) => Effect.fail(msg)
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as FastCsv from "fast-csv";
|
|
4
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
5
|
+
import * as Queue from "effect/Queue";
|
|
6
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Stream from "effect/Stream";
|
|
9
|
+
|
|
10
|
+
function parseRows(path) {
|
|
11
|
+
return Stream.flatMap(Stream.fromEffect(Effect.flatMap(Queue.unbounded(), queue => {
|
|
12
|
+
FastCsv.parseFile(path, {
|
|
13
|
+
headers: true
|
|
14
|
+
}).on("data", row => {
|
|
15
|
+
Effect.runSyncExit(Queue.offer(queue, {
|
|
16
|
+
TAG: "Ok",
|
|
17
|
+
_0: row
|
|
18
|
+
}));
|
|
19
|
+
}).on("end", param => {
|
|
20
|
+
Effect.runSyncExit(Queue.shutdown(queue));
|
|
21
|
+
}).on("error", err => {
|
|
22
|
+
let msg = Stdlib_Option.getOr(Stdlib_JsExn.message(err), "CSV parse error");
|
|
23
|
+
Effect.runSyncExit(Queue.offer(queue, {
|
|
24
|
+
TAG: "Error",
|
|
25
|
+
_0: msg
|
|
26
|
+
}));
|
|
27
|
+
Effect.runSyncExit(Queue.shutdown(queue));
|
|
28
|
+
});
|
|
29
|
+
return Effect.succeed(queue);
|
|
30
|
+
})), queue => Stream.mapEffect(Stream.fromQueue(queue), item => {
|
|
31
|
+
if (item.TAG === "Ok") {
|
|
32
|
+
return Effect.succeed(item._0);
|
|
33
|
+
} else {
|
|
34
|
+
return Effect.fail(item._0);
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
parseRows,
|
|
41
|
+
}
|
|
42
|
+
/* fast-csv Not a pure module */
|