@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,64 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
5
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
6
|
+
import * as Stream from "effect/Stream";
|
|
7
|
+
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
8
|
+
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
9
|
+
import * as EventCollector$ReventlessCore from "./EventCollector.res.mjs";
|
|
10
|
+
|
|
11
|
+
function makeStreamHandler(eventCollector, schema, jsonEventsHandler) {
|
|
12
|
+
let jsonHandler = stream => jsonEventsHandler(Stream.mapEffect(stream, json => Effect.trySync(_exn => "decode error", () => S.parseOrThrow(json, schema))));
|
|
13
|
+
let channel = eventCollector.channel;
|
|
14
|
+
return channel.handleChannelEvent(jsonHandler);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function Make(RuntimeEnvironment) {
|
|
18
|
+
return Channel => {
|
|
19
|
+
let connect = (eventTopics, resources, runtime, eventCollector) => {
|
|
20
|
+
let eventCollectorResource = Component$ReventlessCore.toPulumiResource(eventCollector);
|
|
21
|
+
let name = ComponentType$ReventlessCore.name(Stdlib_Option.getOr(eventCollectorResource.__name, "Unnamed"), EventCollector$ReventlessCore.componentType);
|
|
22
|
+
Channel.connect(name, [{
|
|
23
|
+
channel: eventCollector.channel,
|
|
24
|
+
eventTopics: eventTopics,
|
|
25
|
+
resources: resources
|
|
26
|
+
}], runtime, {
|
|
27
|
+
parent: eventCollectorResource
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
let makeHandler = (eventCollector, jsonEventsHandler) => {
|
|
31
|
+
let channel = eventCollector.channel;
|
|
32
|
+
return channel.handleChannelEvent(jsonEventsHandler);
|
|
33
|
+
};
|
|
34
|
+
let make = (name, eventTopics, opts) => Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(EventCollector$ReventlessCore.componentType), name, (extra, extra$1) => {
|
|
35
|
+
let opts_parent = Component$ReventlessCore.toPulumiResource(extra);
|
|
36
|
+
let opts = {
|
|
37
|
+
parent: opts_parent
|
|
38
|
+
};
|
|
39
|
+
let name = ComponentType$ReventlessCore.name(extra$1, EventCollector$ReventlessCore.componentType);
|
|
40
|
+
let channel = Channel.make(name, eventTopics, opts);
|
|
41
|
+
extra.channel = channel;
|
|
42
|
+
Component$ReventlessCore.setOperations(extra, channel.enqueueEvent.apply(enqueueEvent => ({
|
|
43
|
+
enqueueEvent: enqueueEvent
|
|
44
|
+
})));
|
|
45
|
+
let outputs_resources = channel.resources;
|
|
46
|
+
let outputs = {
|
|
47
|
+
name: name,
|
|
48
|
+
resources: outputs_resources
|
|
49
|
+
};
|
|
50
|
+
return Component$ReventlessCore.setOutputs(extra, outputs);
|
|
51
|
+
}, opts);
|
|
52
|
+
return {
|
|
53
|
+
connect: connect,
|
|
54
|
+
makeHandler: makeHandler,
|
|
55
|
+
make: make
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
makeStreamHandler,
|
|
62
|
+
Make,
|
|
63
|
+
}
|
|
64
|
+
/* S Not a pure module */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
let componentType = ComponentType.EventLog
|
|
2
|
+
|
|
3
|
+
type outputs = ReventlessInfra.EventLog.outputs
|
|
4
|
+
|
|
5
|
+
type t
|
|
6
|
+
type component<'operations> = Component.t<t, outputs, 'operations>
|
|
7
|
+
|
|
8
|
+
exception ReplayError(string)
|
|
9
|
+
|
|
10
|
+
type append<'id, 'event> = (int, 'id, array<'event>) => promise<result<unit, string>>
|
|
11
|
+
type replay<'id, 'event> = 'id => promise<array<'event>>
|
|
12
|
+
type replayStream<'id, 'event> = 'id => Stream.t<'event, string, unit>
|
|
13
|
+
type appendStream<'id, 'event> = (int, 'id, Stream.t<'event, string, unit>) => Effect.t<unit, string, unit>
|
|
14
|
+
|
|
15
|
+
module type T = {
|
|
16
|
+
module Spec: ReventlessInfra.EventLog.T
|
|
17
|
+
|
|
18
|
+
type operations = {
|
|
19
|
+
append: append<Spec.Id.t, Message.event'<Spec.Id.t, Spec.event>>,
|
|
20
|
+
replay: replay<Spec.Id.t, Spec.event>,
|
|
21
|
+
replayStream: replayStream<Spec.Id.t, Spec.event>,
|
|
22
|
+
appendStream: appendStream<Spec.Id.t, Spec.event>,
|
|
23
|
+
}
|
|
24
|
+
type component = component<operations>
|
|
25
|
+
|
|
26
|
+
let make: (~name: string, ~opts: Pulumi.ComponentResource.options=?) => component
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
4
|
+
|
|
5
|
+
let ReplayError = /* @__PURE__ */Primitive_exceptions.create("EventLog-ReventlessCore.ReplayError");
|
|
6
|
+
|
|
7
|
+
let componentType = "EventLog";
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
componentType,
|
|
11
|
+
ReplayError,
|
|
12
|
+
}
|
|
13
|
+
/* No side effect */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type operations = {
|
|
2
|
+
append: EventLog.append<string, JSON.t>,
|
|
3
|
+
replay: EventLog.replay<string, JSON.t>,
|
|
4
|
+
replayStream: string => Stream.t<JSON.t, string, unit>,
|
|
5
|
+
appendStream: EventLog.appendStream<string, JSON.t>,
|
|
6
|
+
}
|
|
7
|
+
type storage = {
|
|
8
|
+
resources: array<ReventlessInfra.Adapter.resource>,
|
|
9
|
+
operations: Pulumi.Output.t<operations>,
|
|
10
|
+
}
|
|
11
|
+
type storageMaker = (~name: string, ~opts: Pulumi.CustomResourceOptions.t) => storage
|
|
12
|
+
|
|
13
|
+
module type Storage = {
|
|
14
|
+
let make: storageMaker
|
|
15
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module Make = (
|
|
2
|
+
Spec: ReventlessInfra.EventLog.T,
|
|
3
|
+
Storage: EventLog_Adapter.Storage,
|
|
4
|
+
EventTopicPublisher: EventTopic_Adapter.Publisher,
|
|
5
|
+
): (EventLog.T with module Spec = Spec) => {
|
|
6
|
+
module Spec = Spec
|
|
7
|
+
|
|
8
|
+
type operations = {
|
|
9
|
+
append: EventLog.append<Spec.Id.t, Message.event'<Spec.Id.t, Spec.event>>,
|
|
10
|
+
replay: EventLog.replay<Spec.Id.t, Spec.event>,
|
|
11
|
+
replayStream: EventLog.replayStream<Spec.Id.t, Spec.event>,
|
|
12
|
+
appendStream: EventLog.appendStream<Spec.Id.t, Spec.event>,
|
|
13
|
+
}
|
|
14
|
+
type component = Component.t<EventLog.t, EventLog.outputs, operations>
|
|
15
|
+
|
|
16
|
+
let construct = (self, name) => {
|
|
17
|
+
let opts = {Pulumi.CustomResourceOptions.parent: self->Component.toPulumiResource}
|
|
18
|
+
|
|
19
|
+
let storage = Storage.make(~name=name->ComponentType.name(EventLog.componentType), ~opts)
|
|
20
|
+
|
|
21
|
+
module SpecificEventTopic = EventTopic_Builder.Make(Spec, EventTopicPublisher)
|
|
22
|
+
let eventTopic = SpecificEventTopic.make(
|
|
23
|
+
~name,
|
|
24
|
+
~storageResources=storage.resources,
|
|
25
|
+
~opts=opts->Util.Pulumi.ComponentResourceOptions.ofCustomResourceOptions,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
self->Component.setOperations(
|
|
29
|
+
(storage.operations, eventTopic->Component.operations)
|
|
30
|
+
->Pulumi.Output.all2
|
|
31
|
+
->Pulumi.Output.apply(((storageOps, eventTopicOps)) => {
|
|
32
|
+
module Ops = EventLog_Operations.Make(
|
|
33
|
+
Spec,
|
|
34
|
+
{
|
|
35
|
+
module Spec = Spec
|
|
36
|
+
module EventTopic = SpecificEventTopic
|
|
37
|
+
let eventTopic = eventTopicOps
|
|
38
|
+
let storage = storageOps
|
|
39
|
+
},
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
{
|
|
43
|
+
append: Ops.append,
|
|
44
|
+
replay: Ops.replay,
|
|
45
|
+
replayStream: Ops.replayStream,
|
|
46
|
+
appendStream: Ops.appendStream,
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
let outputs: EventLog.outputs = {
|
|
52
|
+
resources: storage.resources,
|
|
53
|
+
eventTopic: eventTopic->Component.outputs,
|
|
54
|
+
}
|
|
55
|
+
self->Component.setOutputs(outputs)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let make = (~name, ~opts=?): component =>
|
|
59
|
+
Component.make(
|
|
60
|
+
~componentType=EventLog.componentType->ComponentType.toString,
|
|
61
|
+
~name,
|
|
62
|
+
~construct,
|
|
63
|
+
~opts,
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
4
|
+
import * as EventLog$ReventlessCore from "./EventLog.res.mjs";
|
|
5
|
+
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
6
|
+
import * as Util_Pulumi$ReventlessCore from "../../util/Util_Pulumi.res.mjs";
|
|
7
|
+
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
8
|
+
import * as EventTopic_Builder$ReventlessCore from "../EventTopic/EventTopic_Builder.res.mjs";
|
|
9
|
+
import * as EventLog_Operations$ReventlessCore from "./EventLog_Operations.res.mjs";
|
|
10
|
+
|
|
11
|
+
function Make(Spec) {
|
|
12
|
+
return Storage => (EventTopicPublisher => {
|
|
13
|
+
let construct = (self, name) => {
|
|
14
|
+
let opts_parent = Component$ReventlessCore.toPulumiResource(self);
|
|
15
|
+
let opts = {
|
|
16
|
+
parent: opts_parent
|
|
17
|
+
};
|
|
18
|
+
let storage = Storage.make(ComponentType$ReventlessCore.name(name, EventLog$ReventlessCore.componentType), opts);
|
|
19
|
+
let SpecificEventTopic = EventTopic_Builder$ReventlessCore.Make(Spec)(EventTopicPublisher);
|
|
20
|
+
let eventTopic = SpecificEventTopic.make(name, storage.resources, Util_Pulumi$ReventlessCore.ComponentResourceOptions.ofCustomResourceOptions(opts));
|
|
21
|
+
Component$ReventlessCore.setOperations(self, Pulumi.all([
|
|
22
|
+
storage.operations,
|
|
23
|
+
Component$ReventlessCore.operations(eventTopic)
|
|
24
|
+
]).apply(param => {
|
|
25
|
+
let Ops = EventLog_Operations$ReventlessCore.Make(Spec)({
|
|
26
|
+
Spec: Spec,
|
|
27
|
+
EventTopic: SpecificEventTopic,
|
|
28
|
+
eventTopic: param[1],
|
|
29
|
+
storage: param[0]
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
append: Ops.append,
|
|
33
|
+
replay: Ops.replay,
|
|
34
|
+
replayStream: Ops.replayStream,
|
|
35
|
+
appendStream: Ops.appendStream
|
|
36
|
+
};
|
|
37
|
+
}));
|
|
38
|
+
let outputs_resources = storage.resources;
|
|
39
|
+
let outputs_eventTopic = Component$ReventlessCore.outputs(eventTopic);
|
|
40
|
+
let outputs = {
|
|
41
|
+
resources: outputs_resources,
|
|
42
|
+
eventTopic: outputs_eventTopic
|
|
43
|
+
};
|
|
44
|
+
return Component$ReventlessCore.setOutputs(self, outputs);
|
|
45
|
+
};
|
|
46
|
+
let make = (name, opts) => Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(EventLog$ReventlessCore.componentType), name, construct, opts);
|
|
47
|
+
return {
|
|
48
|
+
Spec: Spec,
|
|
49
|
+
make: make
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
Make,
|
|
56
|
+
}
|
|
57
|
+
/* @pulumi/pulumi Not a pure module */
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
module type Ops = {
|
|
2
|
+
module Spec: ReventlessInfra.EventLog.T
|
|
3
|
+
module EventTopic: EventTopic.T with module Spec.Id = Spec.Id and type Spec.event = Spec.event
|
|
4
|
+
let eventTopic: EventTopic.operations
|
|
5
|
+
let storage: EventLog_Adapter.operations
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
module type T = {
|
|
9
|
+
module Spec: ReventlessInfra.EventLog.T
|
|
10
|
+
let append: EventLog.append<Spec.Id.t, Message.event'<Spec.Id.t, Spec.event>>
|
|
11
|
+
let replay: EventLog.replay<Spec.Id.t, Spec.event>
|
|
12
|
+
let replayStream: EventLog.replayStream<Spec.Id.t, Spec.event>
|
|
13
|
+
let appendStream: EventLog.appendStream<Spec.Id.t, Spec.event>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Retry schedule for transient storage errors.
|
|
17
|
+
// Exponential backoff: 100ms, ~200ms, ~400ms, ~800ms, ~1600ms — max 5 retries.
|
|
18
|
+
// Only retries on recognised transient error messages; permanent errors propagate immediately.
|
|
19
|
+
let isTransient = (msg: string) =>
|
|
20
|
+
msg->String.includes("ThrottlingException") ||
|
|
21
|
+
msg->String.includes("ProvisionedThroughputExceededException") ||
|
|
22
|
+
msg->String.includes("ServiceUnavailable") ||
|
|
23
|
+
msg->String.includes("RequestLimitExceeded") ||
|
|
24
|
+
msg->String.includes("InternalServerError")
|
|
25
|
+
|
|
26
|
+
let storageRetrySchedule: Schedule.t<(Duration.t, int), string, unit> =
|
|
27
|
+
Schedule.exponential(Duration.millis(100))
|
|
28
|
+
->Schedule.jittered
|
|
29
|
+
->Schedule.intersect(Schedule.recurs(5))
|
|
30
|
+
->Schedule.whileInput(isTransient)
|
|
31
|
+
|
|
32
|
+
module Make = (Spec: ReventlessInfra.EventLog.T, Ops: Ops with module Spec = Spec): (
|
|
33
|
+
T with module Spec = Spec
|
|
34
|
+
) => {
|
|
35
|
+
module Spec = Spec
|
|
36
|
+
|
|
37
|
+
let encodeEvent' = (id, sequenceNr, event') => {
|
|
38
|
+
let json = event'.Reventless.Message.event->Message.encode(Spec.eventSchema)
|
|
39
|
+
let (eventType, data) = json->Message.splitMessage
|
|
40
|
+
let stored: Reventless.StoredEvent.storedEvent<Spec.Id.t> = {
|
|
41
|
+
id,
|
|
42
|
+
position: sequenceNr->Int.toString->String.padStart(9, "0"),
|
|
43
|
+
event: eventType,
|
|
44
|
+
data: JSON.Object(data),
|
|
45
|
+
meta: event'.meta,
|
|
46
|
+
recordedAt: Message.nowAsISOString(),
|
|
47
|
+
}
|
|
48
|
+
stored->Message.storedEventToFlatJson(Spec.Id.schema)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let encodeEvents' = (events', id, startingSeqNr) =>
|
|
52
|
+
events'->Array.mapWithIndex((event, i) => encodeEvent'(id, startingSeqNr + i, event))
|
|
53
|
+
|
|
54
|
+
let makePublishedEvent = (idStr, eventsJson, meta): EventPublish_Callback.publishedEvent => {
|
|
55
|
+
componentName: Spec.name,
|
|
56
|
+
entityId: idStr,
|
|
57
|
+
eventCount: eventsJson->Array.length,
|
|
58
|
+
eventsJson,
|
|
59
|
+
meta,
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let runBeforePublishHook = async (idStr, eventsJson, meta) =>
|
|
63
|
+
switch EventPublish_Callback.beforePublishHook.contents {
|
|
64
|
+
| None => ()
|
|
65
|
+
| Some(hook) =>
|
|
66
|
+
try {
|
|
67
|
+
let _ = await hook(makePublishedEvent(idStr, eventsJson, meta))
|
|
68
|
+
} catch {
|
|
69
|
+
| err =>
|
|
70
|
+
let errMsg =
|
|
71
|
+
err->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
72
|
+
EffectLogger.logError(
|
|
73
|
+
~comp=`EventLog(${Spec.name})`,
|
|
74
|
+
`beforePublishHook error: ${errMsg}`,
|
|
75
|
+
)->Effect.runSync
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let runAfterPublishHook = async (idStr, eventsJson, meta) =>
|
|
80
|
+
switch EventPublish_Callback.afterPublishHook.contents {
|
|
81
|
+
| None => ()
|
|
82
|
+
| Some(hook) =>
|
|
83
|
+
try {
|
|
84
|
+
let _ = await hook(makePublishedEvent(idStr, eventsJson, meta))
|
|
85
|
+
} catch {
|
|
86
|
+
| err =>
|
|
87
|
+
let errMsg =
|
|
88
|
+
err->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
89
|
+
EffectLogger.logError(
|
|
90
|
+
~comp=`EventLog(${Spec.name})`,
|
|
91
|
+
`afterPublishHook error: ${errMsg}`,
|
|
92
|
+
)->Effect.runSync
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Returns result<unit, string> — never throws. Publish failures are surfaced as Error.
|
|
97
|
+
let publishToEventTopic = async (id, events': array<Message.event'<_, _>>, eventsJson) => {
|
|
98
|
+
let idStr = id->Spec.Id.toString
|
|
99
|
+
let firstEvent = events'->Array.getUnsafe(0)
|
|
100
|
+
let meta = firstEvent.meta
|
|
101
|
+
await runBeforePublishHook(idStr, eventsJson, meta)
|
|
102
|
+
try {
|
|
103
|
+
let _ = await Ops.eventTopic.publish(events')
|
|
104
|
+
await runAfterPublishHook(idStr, eventsJson, meta)
|
|
105
|
+
Ok()
|
|
106
|
+
} catch {
|
|
107
|
+
| JsExn(err) =>
|
|
108
|
+
let msg =
|
|
109
|
+
`EventLog.append(${idStr}): EventTopic.publish Error: ` ++
|
|
110
|
+
err->JsExn.message->Option.getOr("no error message given")
|
|
111
|
+
Error(msg)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// append returns result<unit, string> — never throws.
|
|
116
|
+
// Storage errors are retried with exponential backoff (up to 5 times for transient errors).
|
|
117
|
+
// After exhausting retries, or on permanent errors, returns Error.
|
|
118
|
+
let isConflict = (msg: string) => msg->String.includes("conflict")
|
|
119
|
+
|
|
120
|
+
let append = async (sequenceNr, id, events') => {
|
|
121
|
+
let eventsJson = events'->encodeEvents'(id, sequenceNr)
|
|
122
|
+
let idStr = id->Spec.Id.toString
|
|
123
|
+
// Build an Effect that fails with a string on storage error (enabling retry)
|
|
124
|
+
let storageEffect =
|
|
125
|
+
Effect.tryPromise(
|
|
126
|
+
~catch=(err: unknown) => Util.Error.messageFromUnknown(err, "storage error"),
|
|
127
|
+
() => Ops.storage.append(sequenceNr, idStr, eventsJson),
|
|
128
|
+
)
|
|
129
|
+
->Effect.flatMap(result =>
|
|
130
|
+
switch result {
|
|
131
|
+
| Ok(_) => Effect.succeed(())
|
|
132
|
+
| Error(msg) => Effect.fail(msg)
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
->Effect.retry(storageRetrySchedule)
|
|
136
|
+
let exit = await storageEffect->Effect.runPromiseExit
|
|
137
|
+
if exit->Exit.isSuccess {
|
|
138
|
+
await publishToEventTopic(id, events', eventsJson)
|
|
139
|
+
} else {
|
|
140
|
+
// Retry exhausted — extract the final error message from the Cause.
|
|
141
|
+
// Use Cause.pretty so defects (uncaught throws) are surfaced too, not
|
|
142
|
+
// just typed failures from Cause.failures.
|
|
143
|
+
let failMsg = exit->Exit.match(
|
|
144
|
+
~onFailure=cause => cause->Cause.pretty,
|
|
145
|
+
~onSuccess=_ => "storage error", // unreachable: we are in the isFailure branch
|
|
146
|
+
)
|
|
147
|
+
// Propagate conflict errors without wrapping so callers can detect them
|
|
148
|
+
if isConflict(failMsg) {
|
|
149
|
+
Error("conflict")
|
|
150
|
+
} else {
|
|
151
|
+
Error(`EventLog: Error: Couldn't append for ${Spec.name}(${idStr}): ${failMsg}`)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let decodeEvent = (id, json) =>
|
|
157
|
+
try {
|
|
158
|
+
JSON.Decode.object(json)
|
|
159
|
+
->Option.map(dict =>
|
|
160
|
+
switch (dict->Dict.get("event"), dict->Dict.get("data")) {
|
|
161
|
+
| (Some(JSON.String(eventType)), Some(JSON.Object(data))) =>
|
|
162
|
+
Message.combineMessage(eventType, data)
|
|
163
|
+
| (Some(JSON.String(eventType)), None) => Message.combineMessage(eventType, Dict.make())
|
|
164
|
+
| _ => JsError.throwWithMessage("event type or data incorrect")
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
->Option.getOrThrow
|
|
168
|
+
->Message.decode(Spec.eventSchema)
|
|
169
|
+
} catch {
|
|
170
|
+
| JsExn(e) =>
|
|
171
|
+
let eventStr = json->JSON.stringify
|
|
172
|
+
let message = e->Util.Error.message
|
|
173
|
+
JsError.throwWithMessage(
|
|
174
|
+
`EventLog.replay: Error: id:${id}: Couldn't decode ${eventStr}: ${message}`,
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
let decodeEvents = (jsons, id) => jsons->Array.map(json => decodeEvent(id, json))
|
|
179
|
+
|
|
180
|
+
let replay = async id => {
|
|
181
|
+
let eventsJson = await Ops.storage.replay(id->Spec.Id.toString)
|
|
182
|
+
eventsJson->decodeEvents(id->Spec.Id.toString)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Lazy streaming replay — wraps decodeEvent in Effect.sync so thrown exceptions
|
|
186
|
+
// surface through the stream's error channel rather than as unhandled exceptions.
|
|
187
|
+
let replayStream = id =>
|
|
188
|
+
Ops.storage.replayStream(id->Spec.Id.toString)
|
|
189
|
+
->Stream.mapEffect(json =>
|
|
190
|
+
Effect.sync(() => decodeEvent(id->Spec.Id.toString, json))
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
// Streaming append — encodes each Spec.event to the {type, data} storage format
|
|
194
|
+
// and writes sequentially via the storage adapter.
|
|
195
|
+
// Accepts Spec.event items (symmetric with replayStream) to enable direct
|
|
196
|
+
// replayStream → appendStream pipelines without an intermediate mapping step.
|
|
197
|
+
let appendStream = (startingSeqNr, id, stream) =>
|
|
198
|
+
Ops.storage.appendStream(
|
|
199
|
+
startingSeqNr,
|
|
200
|
+
id->Spec.Id.toString,
|
|
201
|
+
stream->Stream.map(event => {
|
|
202
|
+
let json = event->Message.encode(Spec.eventSchema)
|
|
203
|
+
let (eventType, data) = json->Message.splitMessage
|
|
204
|
+
[("event", JSON.String(eventType)), ("data", JSON.Object(data))]
|
|
205
|
+
->Dict.fromArray
|
|
206
|
+
->JSON.Encode.object
|
|
207
|
+
}),
|
|
208
|
+
)
|
|
209
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Exit from "@reventlessdev/rescript-effect/src/Exit.res.mjs";
|
|
4
|
+
import * as Effect from "@reventlessdev/rescript-effect/src/Effect.res.mjs";
|
|
5
|
+
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
6
|
+
import * as Exit$1 from "effect/Exit";
|
|
7
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
8
|
+
import * as Cause from "effect/Cause";
|
|
9
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
10
|
+
import * as Effect$1 from "effect/Effect";
|
|
11
|
+
import * as Stream from "effect/Stream";
|
|
12
|
+
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
13
|
+
import * as Duration from "effect/Duration";
|
|
14
|
+
import * as Schedule from "effect/Schedule";
|
|
15
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
16
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
17
|
+
import * as Util_Error$ReventlessCore from "../../util/Util_Error.res.mjs";
|
|
18
|
+
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
19
|
+
import * as EventPublish_Callback$ReventlessCore from "./EventPublish_Callback.res.mjs";
|
|
20
|
+
|
|
21
|
+
function isTransient(msg) {
|
|
22
|
+
if (msg.includes("ThrottlingException") || msg.includes("ProvisionedThroughputExceededException") || msg.includes("ServiceUnavailable") || msg.includes("RequestLimitExceeded")) {
|
|
23
|
+
return true;
|
|
24
|
+
} else {
|
|
25
|
+
return msg.includes("InternalServerError");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let storageRetrySchedule = Schedule.whileInput(Schedule.intersect(Schedule.jittered(Schedule.exponential(Duration.millis(100))), Schedule.recurs(5)), isTransient);
|
|
30
|
+
|
|
31
|
+
function Make(Spec) {
|
|
32
|
+
return Ops => {
|
|
33
|
+
let encodeEvents$p = (events$p, id, startingSeqNr) => events$p.map((event, i) => {
|
|
34
|
+
let sequenceNr = startingSeqNr + i | 0;
|
|
35
|
+
let json = Message$ReventlessCore.encode(event.event, Spec.eventSchema);
|
|
36
|
+
let match = Message$ReventlessCore.splitMessage(json);
|
|
37
|
+
let stored_position = sequenceNr.toString().padStart(9, "0");
|
|
38
|
+
let stored_event = match[0];
|
|
39
|
+
let stored_data = match[1];
|
|
40
|
+
let stored_meta = event.meta;
|
|
41
|
+
let stored_recordedAt = Message$ReventlessCore.nowAsISOString();
|
|
42
|
+
let stored = {
|
|
43
|
+
id: id,
|
|
44
|
+
position: stored_position,
|
|
45
|
+
event: stored_event,
|
|
46
|
+
data: stored_data,
|
|
47
|
+
meta: stored_meta,
|
|
48
|
+
recordedAt: stored_recordedAt
|
|
49
|
+
};
|
|
50
|
+
return Message$ReventlessCore.storedEventToFlatJson(stored, Spec.Id.schema);
|
|
51
|
+
});
|
|
52
|
+
let makePublishedEvent = (idStr, eventsJson, meta) => ({
|
|
53
|
+
componentName: Spec.name,
|
|
54
|
+
entityId: idStr,
|
|
55
|
+
eventCount: eventsJson.length,
|
|
56
|
+
eventsJson: eventsJson,
|
|
57
|
+
meta: meta
|
|
58
|
+
});
|
|
59
|
+
let runBeforePublishHook = async (idStr, eventsJson, meta) => {
|
|
60
|
+
let hook = EventPublish_Callback$ReventlessCore.beforePublishHook.contents;
|
|
61
|
+
if (hook === undefined) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
await hook(makePublishedEvent(idStr, eventsJson, meta));
|
|
66
|
+
return;
|
|
67
|
+
} catch (raw_err) {
|
|
68
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
69
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
70
|
+
return Effect$1.runSync(EffectLogger$ReventlessCore.logError(`EventLog(` + Spec.name + `)`, undefined, `beforePublishHook error: ` + errMsg));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
let runAfterPublishHook = async (idStr, eventsJson, meta) => {
|
|
74
|
+
let hook = EventPublish_Callback$ReventlessCore.afterPublishHook.contents;
|
|
75
|
+
if (hook === undefined) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
await hook(makePublishedEvent(idStr, eventsJson, meta));
|
|
80
|
+
return;
|
|
81
|
+
} catch (raw_err) {
|
|
82
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
83
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(err), Stdlib_JsExn.message), "unknown");
|
|
84
|
+
return Effect$1.runSync(EffectLogger$ReventlessCore.logError(`EventLog(` + Spec.name + `)`, undefined, `afterPublishHook error: ` + errMsg));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
let publishToEventTopic = async (id, events$p, eventsJson) => {
|
|
88
|
+
let idStr = Spec.Id.toString(id);
|
|
89
|
+
let firstEvent = events$p[0];
|
|
90
|
+
let meta = firstEvent.meta;
|
|
91
|
+
await runBeforePublishHook(idStr, eventsJson, meta);
|
|
92
|
+
try {
|
|
93
|
+
await Ops.eventTopic.publish(events$p);
|
|
94
|
+
await runAfterPublishHook(idStr, eventsJson, meta);
|
|
95
|
+
return {
|
|
96
|
+
TAG: "Ok",
|
|
97
|
+
_0: undefined
|
|
98
|
+
};
|
|
99
|
+
} catch (raw_err) {
|
|
100
|
+
let err = Primitive_exceptions.internalToException(raw_err);
|
|
101
|
+
if (err.RE_EXN_ID === "JsExn") {
|
|
102
|
+
let msg = `EventLog.append(` + idStr + `): EventTopic.publish Error: ` + Stdlib_Option.getOr(Stdlib_JsExn.message(err._1), "no error message given");
|
|
103
|
+
return {
|
|
104
|
+
TAG: "Error",
|
|
105
|
+
_0: msg
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
throw err;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
let append = async (sequenceNr, id, events$p) => {
|
|
112
|
+
let eventsJson = encodeEvents$p(events$p, id, sequenceNr);
|
|
113
|
+
let idStr = Spec.Id.toString(id);
|
|
114
|
+
let storageEffect = Effect$1.retry(Effect$1.flatMap(Effect.tryPromise(err => Util_Error$ReventlessCore.messageFromUnknown(err, "storage error"), () => Ops.storage.append(sequenceNr, idStr, eventsJson)), result => {
|
|
115
|
+
if (result.TAG === "Ok") {
|
|
116
|
+
return Effect$1.succeed();
|
|
117
|
+
} else {
|
|
118
|
+
return Effect$1.fail(result._0);
|
|
119
|
+
}
|
|
120
|
+
}), storageRetrySchedule);
|
|
121
|
+
let exit = await Effect$1.runPromiseExit(storageEffect);
|
|
122
|
+
if (Exit$1.isSuccess(exit)) {
|
|
123
|
+
return await publishToEventTopic(id, events$p, eventsJson);
|
|
124
|
+
}
|
|
125
|
+
let failMsg = Exit.match(exit, cause => Cause.pretty(cause), () => "storage error");
|
|
126
|
+
if (failMsg.includes("conflict")) {
|
|
127
|
+
return {
|
|
128
|
+
TAG: "Error",
|
|
129
|
+
_0: "conflict"
|
|
130
|
+
};
|
|
131
|
+
} else {
|
|
132
|
+
return {
|
|
133
|
+
TAG: "Error",
|
|
134
|
+
_0: `EventLog: Error: Couldn't append for ` + Spec.name + `(` + idStr + `): ` + failMsg
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
let decodeEvent = (id, json) => {
|
|
139
|
+
try {
|
|
140
|
+
return Message$ReventlessCore.decode(Stdlib_Option.getOrThrow(Stdlib_Option.map(Stdlib_JSON.Decode.object(json), dict => {
|
|
141
|
+
let match = dict["event"];
|
|
142
|
+
let match$1 = dict["data"];
|
|
143
|
+
if (typeof match === "string") {
|
|
144
|
+
if (match$1 !== undefined) {
|
|
145
|
+
if (typeof match$1 === "object" && match$1 !== null && !Array.isArray(match$1)) {
|
|
146
|
+
return Message$ReventlessCore.combineMessage(match, match$1);
|
|
147
|
+
} else {
|
|
148
|
+
return Stdlib_JsError.throwWithMessage("event type or data incorrect");
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
return Message$ReventlessCore.combineMessage(match, {});
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
return Stdlib_JsError.throwWithMessage("event type or data incorrect");
|
|
155
|
+
}
|
|
156
|
+
}), undefined), Spec.eventSchema);
|
|
157
|
+
} catch (raw_e) {
|
|
158
|
+
let e = Primitive_exceptions.internalToException(raw_e);
|
|
159
|
+
if (e.RE_EXN_ID === "JsExn") {
|
|
160
|
+
let eventStr = JSON.stringify(json);
|
|
161
|
+
let message = Util_Error$ReventlessCore.message(undefined, e._1);
|
|
162
|
+
return Stdlib_JsError.throwWithMessage(`EventLog.replay: Error: id:` + id + `: Couldn't decode ` + eventStr + `: ` + message);
|
|
163
|
+
}
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
let replay = async id => {
|
|
168
|
+
let eventsJson = await Ops.storage.replay(Spec.Id.toString(id));
|
|
169
|
+
let id$1 = Spec.Id.toString(id);
|
|
170
|
+
return eventsJson.map(json => decodeEvent(id$1, json));
|
|
171
|
+
};
|
|
172
|
+
let replayStream = id => Stream.mapEffect(Ops.storage.replayStream(Spec.Id.toString(id)), json => Effect$1.sync(() => decodeEvent(Spec.Id.toString(id), json)));
|
|
173
|
+
let appendStream = (startingSeqNr, id, stream) => Ops.storage.appendStream(startingSeqNr, Spec.Id.toString(id), Stream.map(stream, event => {
|
|
174
|
+
let json = Message$ReventlessCore.encode(event, Spec.eventSchema);
|
|
175
|
+
let match = Message$ReventlessCore.splitMessage(json);
|
|
176
|
+
return Object.fromEntries([
|
|
177
|
+
[
|
|
178
|
+
"event",
|
|
179
|
+
match[0]
|
|
180
|
+
],
|
|
181
|
+
[
|
|
182
|
+
"data",
|
|
183
|
+
match[1]
|
|
184
|
+
]
|
|
185
|
+
]);
|
|
186
|
+
}));
|
|
187
|
+
return {
|
|
188
|
+
Spec: Spec,
|
|
189
|
+
append: append,
|
|
190
|
+
replay: replay,
|
|
191
|
+
replayStream: replayStream,
|
|
192
|
+
appendStream: appendStream
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
isTransient,
|
|
199
|
+
storageRetrySchedule,
|
|
200
|
+
Make,
|
|
201
|
+
}
|
|
202
|
+
/* storageRetrySchedule Not a pure module */
|