@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,98 @@
|
|
|
1
|
+
// InboundTranslationSlice builder — creates the audit log QueryDb and wires
|
|
2
|
+
// the receive function that translates external input into domain commands.
|
|
3
|
+
//
|
|
4
|
+
// Simpler than OutboundTranslationSlice — no EventCollector needed.
|
|
5
|
+
// Triggered externally via operations.receive rather than by event subscription.
|
|
6
|
+
|
|
7
|
+
module Make = (
|
|
8
|
+
QueryDbStorage: QueryDb_Adapter.Storage,
|
|
9
|
+
QueryDbResolvers: QueryDb_Adapter.Resolvers
|
|
10
|
+
with type api = QueryDbStorage.api
|
|
11
|
+
and type role = QueryDbStorage.role,
|
|
12
|
+
Api: {
|
|
13
|
+
let api: unit => QueryDbStorage.api
|
|
14
|
+
let apiRole: unit => QueryDbStorage.role
|
|
15
|
+
},
|
|
16
|
+
) => {
|
|
17
|
+
module Make = (
|
|
18
|
+
Spec: Reventless.InboundTranslationSlice.Spec,
|
|
19
|
+
Translation: Reventless.InboundTranslationSlice.Translation with module Spec := Spec,
|
|
20
|
+
): InboundTranslationSlice.T => {
|
|
21
|
+
module Spec = Spec
|
|
22
|
+
module Translation = Translation
|
|
23
|
+
type component = InboundTranslationSlice.component
|
|
24
|
+
|
|
25
|
+
module Callback = InboundTranslationSlice_Callback.Make(Spec, Translation)
|
|
26
|
+
|
|
27
|
+
let queryDbName = Spec.name ++ "Audit"
|
|
28
|
+
|
|
29
|
+
// QueryDb for audit log — stores auditRow keyed by request ID
|
|
30
|
+
module AuditQueryDbSpec = {
|
|
31
|
+
module Id = Reventless.Id.String
|
|
32
|
+
let name = queryDbName
|
|
33
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
34
|
+
type state = InboundTranslationSlice_Callback.auditRow
|
|
35
|
+
let stateSchema = InboundTranslationSlice_Callback.auditRowSchema
|
|
36
|
+
let config = Reventless.ReadModel.config()
|
|
37
|
+
let subIdConfig: option<Reventless.ReadModel.subIdConfig<state>> = None
|
|
38
|
+
let authorization: Reventless.Authorization.permission = AllowAuthenticated
|
|
39
|
+
let visibility: Reventless.Visibility.t = Public
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module SpecificQueryDb = QueryDb_Builder.Make(AuditQueryDbSpec, QueryDbStorage, QueryDbResolvers)
|
|
43
|
+
|
|
44
|
+
let syncToQueryDb = async (queryDbOps: SpecificQueryDb.operations) => {
|
|
45
|
+
let items = Callback.auditLog->Dict.toArray
|
|
46
|
+
let _ = await items->Array.reduce(Promise.resolve(), async (prev, (id, row)) => {
|
|
47
|
+
let _ = await prev
|
|
48
|
+
let _ = await queryDbOps.save(
|
|
49
|
+
id->Reventless.Id.String.makeFromString,
|
|
50
|
+
row,
|
|
51
|
+
QueryDb.Overwrite,
|
|
52
|
+
None,
|
|
53
|
+
)
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let construct = (~publishJsons, self, _name) => {
|
|
58
|
+
let opts = {Pulumi.ComponentResource.parent: self->Component.toPulumiResource}
|
|
59
|
+
|
|
60
|
+
let queryDb = SpecificQueryDb.make(~api=Api.api(), ~apiRole=Api.apiRole(), ~opts)
|
|
61
|
+
|
|
62
|
+
// Resolve publishJsons so it's available for receive
|
|
63
|
+
let publishJsonsRef: ref<option<ReventlessInfra.CommandTopic.publishJsons>> = ref(None)
|
|
64
|
+
let _ = publishJsons->Pulumi.Output.apply(pj => {
|
|
65
|
+
publishJsonsRef := Some(pj)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
self->Component.setOperations(
|
|
69
|
+
(queryDb->Component.operations, publishJsons)
|
|
70
|
+
->Pulumi.Output.all2
|
|
71
|
+
->Pulumi.Output.apply(((queryDbOps, publishJsonsFn)) => {
|
|
72
|
+
let ops: InboundTranslationSlice.operations = {
|
|
73
|
+
receive: async inputJson => {
|
|
74
|
+
let result = await Callback.receive(publishJsonsFn, inputJson)
|
|
75
|
+
await syncToQueryDb(queryDbOps)
|
|
76
|
+
result
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
ops
|
|
80
|
+
}),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
let outputs: InboundTranslationSlice.outputs = {
|
|
84
|
+
resources: [],
|
|
85
|
+
queryDb: queryDb->Component.outputs,
|
|
86
|
+
}
|
|
87
|
+
self->Component.setOutputs(outputs)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let make = (~publishJsons, ~opts=?): InboundTranslationSlice.component =>
|
|
91
|
+
Component.make(
|
|
92
|
+
~componentType=InboundTranslationSlice.componentType->ComponentType.toString,
|
|
93
|
+
~name=Spec.name,
|
|
94
|
+
~construct=construct(~publishJsons, ...),
|
|
95
|
+
~opts,
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
4
|
+
import * as Id$Reventless from "@reventlessdev/reventless-spec/src/types/Id.res.mjs";
|
|
5
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
6
|
+
import * as ReadModel$Reventless from "@reventlessdev/reventless-spec/src/components/ReadModel.res.mjs";
|
|
7
|
+
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
8
|
+
import * as ComponentType$ReventlessCore from "../../ComponentType.res.mjs";
|
|
9
|
+
import * as QueryDb_Builder$ReventlessCore from "../QueryDb/QueryDb_Builder.res.mjs";
|
|
10
|
+
import * as InboundTranslationSlice$ReventlessCore from "./InboundTranslationSlice.res.mjs";
|
|
11
|
+
import * as InboundTranslationSlice_Callback$ReventlessCore from "./InboundTranslationSlice_Callback.res.mjs";
|
|
12
|
+
|
|
13
|
+
function Make(QueryDbStorage) {
|
|
14
|
+
return QueryDbResolvers => (Api => {
|
|
15
|
+
let Make = Spec => (Translation => {
|
|
16
|
+
let Callback = InboundTranslationSlice_Callback$ReventlessCore.Make(Spec)(Translation);
|
|
17
|
+
let queryDbName = Spec.name + "Audit";
|
|
18
|
+
let moduleUrl = import.meta.url;
|
|
19
|
+
let config = ReadModel$Reventless.config(undefined, undefined, undefined);
|
|
20
|
+
let SpecificQueryDb = QueryDb_Builder$ReventlessCore.Make({
|
|
21
|
+
Id: Id$Reventless.$$String,
|
|
22
|
+
name: queryDbName,
|
|
23
|
+
moduleUrl: moduleUrl,
|
|
24
|
+
stateSchema: InboundTranslationSlice_Callback$ReventlessCore.auditRowSchema,
|
|
25
|
+
config: config,
|
|
26
|
+
subIdConfig: undefined,
|
|
27
|
+
authorization: "AllowAuthenticated",
|
|
28
|
+
visibility: "Public"
|
|
29
|
+
})(QueryDbStorage)(QueryDbResolvers);
|
|
30
|
+
let syncToQueryDb = async queryDbOps => {
|
|
31
|
+
let items = Object.entries(Callback.auditLog);
|
|
32
|
+
await Stdlib_Array.reduce(items, Promise.resolve(), async (prev, param) => {
|
|
33
|
+
await prev;
|
|
34
|
+
await queryDbOps.save(Id$Reventless.$$String.makeFromString(param[0]), param[1], "Overwrite", undefined);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
let make = (publishJsons, opts) => Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(InboundTranslationSlice$ReventlessCore.componentType), Spec.name, (extra, extra$1) => {
|
|
38
|
+
let opts_parent = Component$ReventlessCore.toPulumiResource(extra);
|
|
39
|
+
let opts = {
|
|
40
|
+
parent: opts_parent
|
|
41
|
+
};
|
|
42
|
+
let queryDb = SpecificQueryDb.make(Api.api(), Api.apiRole(), undefined, opts);
|
|
43
|
+
let publishJsonsRef = {
|
|
44
|
+
contents: undefined
|
|
45
|
+
};
|
|
46
|
+
publishJsons.apply(pj => {
|
|
47
|
+
publishJsonsRef.contents = pj;
|
|
48
|
+
});
|
|
49
|
+
Component$ReventlessCore.setOperations(extra, Pulumi.all([
|
|
50
|
+
Component$ReventlessCore.operations(queryDb),
|
|
51
|
+
publishJsons
|
|
52
|
+
]).apply(param => {
|
|
53
|
+
let publishJsonsFn = param[1];
|
|
54
|
+
let queryDbOps = param[0];
|
|
55
|
+
return {
|
|
56
|
+
receive: async inputJson => {
|
|
57
|
+
let result = await Callback.receive(publishJsonsFn, inputJson);
|
|
58
|
+
await syncToQueryDb(queryDbOps);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}));
|
|
63
|
+
let outputs_resources = [];
|
|
64
|
+
let outputs_queryDb = Component$ReventlessCore.outputs(queryDb);
|
|
65
|
+
let outputs = {
|
|
66
|
+
resources: outputs_resources,
|
|
67
|
+
queryDb: outputs_queryDb
|
|
68
|
+
};
|
|
69
|
+
return Component$ReventlessCore.setOutputs(extra, outputs);
|
|
70
|
+
}, opts);
|
|
71
|
+
return {
|
|
72
|
+
Spec: Spec,
|
|
73
|
+
Translation: Translation,
|
|
74
|
+
queryDbName: queryDbName,
|
|
75
|
+
make: make
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
Make: Make
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Make,
|
|
86
|
+
}
|
|
87
|
+
/* Id-Reventless Not a pure module */
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
S.enableJson()
|
|
2
|
+
// InboundTranslationSlice callback — receives external input and translates to commands.
|
|
3
|
+
//
|
|
4
|
+
// Maintains an audit log QueryDb and delegates translation to Translation.translate.
|
|
5
|
+
|
|
6
|
+
@schema
|
|
7
|
+
type auditStatus =
|
|
8
|
+
| Success
|
|
9
|
+
| Failure
|
|
10
|
+
|
|
11
|
+
@schema
|
|
12
|
+
type auditRow = {
|
|
13
|
+
input: string,
|
|
14
|
+
status: auditStatus,
|
|
15
|
+
targetIds?: array<string>,
|
|
16
|
+
commandCount?: int,
|
|
17
|
+
error?: string,
|
|
18
|
+
receivedAt: string,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module type T = {
|
|
22
|
+
module Spec: Reventless.InboundTranslationSlice.Spec
|
|
23
|
+
module Translation: Reventless.InboundTranslationSlice.Translation with module Spec := Spec
|
|
24
|
+
|
|
25
|
+
/** The audit log -- maps request ID to audit row. */
|
|
26
|
+
let auditLog: Dict.t<auditRow>
|
|
27
|
+
|
|
28
|
+
/** Receive external input, translate it, and publish commands. */
|
|
29
|
+
let receive: (
|
|
30
|
+
ReventlessInfra.CommandTopic.publishJsons,
|
|
31
|
+
JSON.t,
|
|
32
|
+
) => promise<result<array<string>, string>>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module Make = (
|
|
36
|
+
Spec: Reventless.InboundTranslationSlice.Spec,
|
|
37
|
+
Translation: Reventless.InboundTranslationSlice.Translation with module Spec := Spec,
|
|
38
|
+
): (T with module Spec = Spec and module Translation := Translation) => {
|
|
39
|
+
module Spec = Spec
|
|
40
|
+
module Translation = Translation
|
|
41
|
+
|
|
42
|
+
let auditLog: Dict.t<auditRow> = Dict.make()
|
|
43
|
+
|
|
44
|
+
let now = () => Date.make()->Date.toISOString
|
|
45
|
+
|
|
46
|
+
// InboundTranslationSlice ingests external (non-Reventless) messages — there's
|
|
47
|
+
// no upstream Reventless meta to derive from, so emitted commands are roots
|
|
48
|
+
// of a fresh correlation chain. `traceparent` populated from an inbound HTTP
|
|
49
|
+
// header would need to be threaded in here by the API/ingress adapter.
|
|
50
|
+
let makeMeta = (): Reventless.Message.meta =>
|
|
51
|
+
Message.generateMeta(~service=`InboundTranslationSlice:${Spec.name}`)
|
|
52
|
+
|
|
53
|
+
let receive = async (
|
|
54
|
+
publishJsons: ReventlessInfra.CommandTopic.publishJsons,
|
|
55
|
+
inputJson: JSON.t,
|
|
56
|
+
) => {
|
|
57
|
+
let requestId = Uuid.v4()
|
|
58
|
+
|
|
59
|
+
// Parse the external input
|
|
60
|
+
let input = try inputJson->S.parseOrThrow(Spec.externalInputSchema)->Ok catch {
|
|
61
|
+
| exn =>
|
|
62
|
+
let msg =
|
|
63
|
+
exn
|
|
64
|
+
->JsExn.fromException
|
|
65
|
+
->Option.flatMap(JsExn.message)
|
|
66
|
+
->Option.getOr("invalid input")
|
|
67
|
+
Error(msg)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
switch input {
|
|
71
|
+
| Error(msg) =>
|
|
72
|
+
auditLog->Dict.set(
|
|
73
|
+
requestId,
|
|
74
|
+
{
|
|
75
|
+
input: inputJson->JSON.stringify,
|
|
76
|
+
status: Failure,
|
|
77
|
+
error: msg,
|
|
78
|
+
receivedAt: now(),
|
|
79
|
+
},
|
|
80
|
+
)
|
|
81
|
+
Error(msg)
|
|
82
|
+
|
|
83
|
+
| Ok(input) =>
|
|
84
|
+
switch Translation.translate(input) {
|
|
85
|
+
| Ok(pairs) =>
|
|
86
|
+
if pairs->Array.length === 0 {
|
|
87
|
+
auditLog->Dict.set(
|
|
88
|
+
requestId,
|
|
89
|
+
{
|
|
90
|
+
input: inputJson->JSON.stringify,
|
|
91
|
+
status: Success,
|
|
92
|
+
targetIds: [],
|
|
93
|
+
commandCount: 0,
|
|
94
|
+
receivedAt: now(),
|
|
95
|
+
},
|
|
96
|
+
)
|
|
97
|
+
Ok([])
|
|
98
|
+
} else {
|
|
99
|
+
// Encode all commands; abort on first encoding failure
|
|
100
|
+
let msgs = ref([])
|
|
101
|
+
let encodeError = ref(None)
|
|
102
|
+
pairs->Array.forEach(pair => {
|
|
103
|
+
let (targetId, cmd) = pair
|
|
104
|
+
if encodeError.contents->Option.isNone {
|
|
105
|
+
try {
|
|
106
|
+
let commandJson = cmd->JSON.stringifyAny->Option.getOrThrow->JSON.parseOrThrow
|
|
107
|
+
let msg: Reventless.Message.commandJson = {
|
|
108
|
+
id: targetId,
|
|
109
|
+
meta: makeMeta(),
|
|
110
|
+
commandJson,
|
|
111
|
+
}
|
|
112
|
+
msgs.contents = msgs.contents->Array.concat([msg])
|
|
113
|
+
} catch {
|
|
114
|
+
| exn =>
|
|
115
|
+
let errMsg =
|
|
116
|
+
exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
117
|
+
EffectLogger.logError(
|
|
118
|
+
~comp=`InboundTranslationSlice(${Spec.name})`,
|
|
119
|
+
`failed to encode command: ${errMsg}`,
|
|
120
|
+
)->Effect.runSync
|
|
121
|
+
encodeError := Some("failed to encode command")
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
switch encodeError.contents {
|
|
127
|
+
| Some(msg) =>
|
|
128
|
+
auditLog->Dict.set(
|
|
129
|
+
requestId,
|
|
130
|
+
{
|
|
131
|
+
input: inputJson->JSON.stringify,
|
|
132
|
+
status: Failure,
|
|
133
|
+
error: msg,
|
|
134
|
+
receivedAt: now(),
|
|
135
|
+
},
|
|
136
|
+
)
|
|
137
|
+
Error(msg)
|
|
138
|
+
| None =>
|
|
139
|
+
try {
|
|
140
|
+
await publishJsons(msgs.contents)
|
|
141
|
+
let targetIds = pairs->Array.map(pair => {
|
|
142
|
+
let (targetId, _) = pair
|
|
143
|
+
targetId
|
|
144
|
+
})
|
|
145
|
+
auditLog->Dict.set(
|
|
146
|
+
requestId,
|
|
147
|
+
{
|
|
148
|
+
input: inputJson->JSON.stringify,
|
|
149
|
+
status: Success,
|
|
150
|
+
targetIds,
|
|
151
|
+
commandCount: pairs->Array.length,
|
|
152
|
+
receivedAt: now(),
|
|
153
|
+
},
|
|
154
|
+
)
|
|
155
|
+
Ok(targetIds)
|
|
156
|
+
} catch {
|
|
157
|
+
| exn =>
|
|
158
|
+
let msg =
|
|
159
|
+
exn
|
|
160
|
+
->JsExn.fromException
|
|
161
|
+
->Option.flatMap(JsExn.message)
|
|
162
|
+
->Option.getOr("publish failed")
|
|
163
|
+
auditLog->Dict.set(
|
|
164
|
+
requestId,
|
|
165
|
+
{
|
|
166
|
+
input: inputJson->JSON.stringify,
|
|
167
|
+
status: Failure,
|
|
168
|
+
error: msg,
|
|
169
|
+
receivedAt: now(),
|
|
170
|
+
},
|
|
171
|
+
)
|
|
172
|
+
Error(msg)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
| Error(msg) =>
|
|
178
|
+
auditLog->Dict.set(
|
|
179
|
+
requestId,
|
|
180
|
+
{
|
|
181
|
+
input: inputJson->JSON.stringify,
|
|
182
|
+
status: Failure,
|
|
183
|
+
error: msg,
|
|
184
|
+
receivedAt: now(),
|
|
185
|
+
},
|
|
186
|
+
)
|
|
187
|
+
Error(msg)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Uuid from "uuid";
|
|
5
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
6
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
9
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
10
|
+
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
11
|
+
|
|
12
|
+
S.enableJson();
|
|
13
|
+
|
|
14
|
+
let auditStatusSchema = S.union([
|
|
15
|
+
S.literal("Success"),
|
|
16
|
+
S.literal("Failure")
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
let auditRowSchema = S.schema(s => ({
|
|
20
|
+
input: s.m(S.string),
|
|
21
|
+
status: s.m(auditStatusSchema),
|
|
22
|
+
targetIds: s.m(S.option(S.array(S.string))),
|
|
23
|
+
commandCount: s.m(S.option(S.int)),
|
|
24
|
+
error: s.m(S.option(S.string)),
|
|
25
|
+
receivedAt: s.m(S.string)
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
function Make(Spec) {
|
|
29
|
+
return Translation => {
|
|
30
|
+
let auditLog = {};
|
|
31
|
+
let makeMeta = () => Message$ReventlessCore.generateMeta(`InboundTranslationSlice:` + Spec.name, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
32
|
+
let receive = async (publishJsons, inputJson) => {
|
|
33
|
+
let requestId = Uuid.v4();
|
|
34
|
+
let input;
|
|
35
|
+
try {
|
|
36
|
+
input = {
|
|
37
|
+
TAG: "Ok",
|
|
38
|
+
_0: S.parseOrThrow(inputJson, Spec.externalInputSchema)
|
|
39
|
+
};
|
|
40
|
+
} catch (raw_exn) {
|
|
41
|
+
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
42
|
+
let msg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "invalid input");
|
|
43
|
+
input = {
|
|
44
|
+
TAG: "Error",
|
|
45
|
+
_0: msg
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (input.TAG === "Ok") {
|
|
49
|
+
let pairs = Translation.translate(input._0);
|
|
50
|
+
if (pairs.TAG === "Ok") {
|
|
51
|
+
let pairs$1 = pairs._0;
|
|
52
|
+
if (pairs$1.length === 0) {
|
|
53
|
+
auditLog[requestId] = {
|
|
54
|
+
input: JSON.stringify(inputJson),
|
|
55
|
+
status: "Success",
|
|
56
|
+
targetIds: [],
|
|
57
|
+
commandCount: 0,
|
|
58
|
+
receivedAt: new Date().toISOString()
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
TAG: "Ok",
|
|
62
|
+
_0: []
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
let msgs = {
|
|
66
|
+
contents: []
|
|
67
|
+
};
|
|
68
|
+
let encodeError = {
|
|
69
|
+
contents: undefined
|
|
70
|
+
};
|
|
71
|
+
pairs$1.forEach(pair => {
|
|
72
|
+
if (!Stdlib_Option.isNone(encodeError.contents)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
let commandJson = JSON.parse(Stdlib_Option.getOrThrow(JSON.stringify(pair[1]), undefined));
|
|
77
|
+
let msg_id = pair[0];
|
|
78
|
+
let msg_meta = makeMeta();
|
|
79
|
+
let msg = {
|
|
80
|
+
id: msg_id,
|
|
81
|
+
meta: msg_meta,
|
|
82
|
+
commandJson: commandJson
|
|
83
|
+
};
|
|
84
|
+
msgs.contents = msgs.contents.concat([msg]);
|
|
85
|
+
return;
|
|
86
|
+
} catch (raw_exn) {
|
|
87
|
+
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
88
|
+
let errMsg = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "unknown");
|
|
89
|
+
Effect.runSync(EffectLogger$ReventlessCore.logError(`InboundTranslationSlice(` + Spec.name + `)`, undefined, `failed to encode command: ` + errMsg));
|
|
90
|
+
encodeError.contents = "failed to encode command";
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
let msg$1 = encodeError.contents;
|
|
95
|
+
if (msg$1 !== undefined) {
|
|
96
|
+
auditLog[requestId] = {
|
|
97
|
+
input: JSON.stringify(inputJson),
|
|
98
|
+
status: "Failure",
|
|
99
|
+
error: msg$1,
|
|
100
|
+
receivedAt: new Date().toISOString()
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
TAG: "Error",
|
|
104
|
+
_0: msg$1
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
await publishJsons(msgs.contents);
|
|
109
|
+
let targetIds = pairs$1.map(pair => pair[0]);
|
|
110
|
+
auditLog[requestId] = {
|
|
111
|
+
input: JSON.stringify(inputJson),
|
|
112
|
+
status: "Success",
|
|
113
|
+
targetIds: targetIds,
|
|
114
|
+
commandCount: pairs$1.length,
|
|
115
|
+
receivedAt: new Date().toISOString()
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
TAG: "Ok",
|
|
119
|
+
_0: targetIds
|
|
120
|
+
};
|
|
121
|
+
} catch (raw_exn$1) {
|
|
122
|
+
let exn$1 = Primitive_exceptions.internalToException(raw_exn$1);
|
|
123
|
+
let msg$2 = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn$1), Stdlib_JsExn.message), "publish failed");
|
|
124
|
+
auditLog[requestId] = {
|
|
125
|
+
input: JSON.stringify(inputJson),
|
|
126
|
+
status: "Failure",
|
|
127
|
+
error: msg$2,
|
|
128
|
+
receivedAt: new Date().toISOString()
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
TAG: "Error",
|
|
132
|
+
_0: msg$2
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
let msg$3 = pairs._0;
|
|
137
|
+
auditLog[requestId] = {
|
|
138
|
+
input: JSON.stringify(inputJson),
|
|
139
|
+
status: "Failure",
|
|
140
|
+
error: msg$3,
|
|
141
|
+
receivedAt: new Date().toISOString()
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
TAG: "Error",
|
|
145
|
+
_0: msg$3
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
let msg$4 = input._0;
|
|
150
|
+
auditLog[requestId] = {
|
|
151
|
+
input: JSON.stringify(inputJson),
|
|
152
|
+
status: "Failure",
|
|
153
|
+
error: msg$4,
|
|
154
|
+
receivedAt: new Date().toISOString()
|
|
155
|
+
};
|
|
156
|
+
return {
|
|
157
|
+
TAG: "Error",
|
|
158
|
+
_0: msg$4
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
Spec: Spec,
|
|
164
|
+
auditLog: auditLog,
|
|
165
|
+
receive: receive
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
auditStatusSchema,
|
|
172
|
+
auditRowSchema,
|
|
173
|
+
Make,
|
|
174
|
+
}
|
|
175
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
let componentType = ComponentType.OutboundTranslationSlice
|
|
2
|
+
|
|
3
|
+
type t = ReventlessInfra.OutboundTranslationSlice.t
|
|
4
|
+
type outputs = ReventlessInfra.OutboundTranslationSlice.outputs
|
|
5
|
+
type operations = ReventlessInfra.OutboundTranslationSlice.operations
|
|
6
|
+
type component = Component.t<t, outputs, operations>
|
|
7
|
+
|
|
8
|
+
let toResolvedOutputs = (
|
|
9
|
+
outputs: outputs,
|
|
10
|
+
): Pulumi.Output.t<ReventlessInterop.OutboundTranslationSlice.resolvedOutputs> =>
|
|
11
|
+
(
|
|
12
|
+
outputs.resources->Adapter.resourcesToInterop,
|
|
13
|
+
outputs.queryDb.resources->Adapter.resourcesToInterop,
|
|
14
|
+
)
|
|
15
|
+
->Pulumi.Output.all2
|
|
16
|
+
->Pulumi.Output.apply(((resources, queryDbResources)) => {
|
|
17
|
+
let resolved: ReventlessInterop.OutboundTranslationSlice.resolvedOutputs = {
|
|
18
|
+
resources: resources,
|
|
19
|
+
queryDb: {resources: queryDbResources},
|
|
20
|
+
}
|
|
21
|
+
resolved
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
module type T = {
|
|
25
|
+
module Spec: Reventless.OutboundTranslationSlice.Spec
|
|
26
|
+
module Translation: Reventless.OutboundTranslationSlice.Translation with module Spec := Spec
|
|
27
|
+
type component = Component.t<t, outputs, operations>
|
|
28
|
+
let queryDbName: string
|
|
29
|
+
|
|
30
|
+
let make: (
|
|
31
|
+
~dcbEventLog: DcbEventLog.component,
|
|
32
|
+
~publishJsons: Pulumi.Output.t<CommandTopic.publishJsons>,
|
|
33
|
+
~opts: Pulumi.ComponentResource.options=?,
|
|
34
|
+
) => component
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
4
|
+
import * as Adapter$ReventlessCore from "../../adapter/Adapter.res.mjs";
|
|
5
|
+
|
|
6
|
+
function toResolvedOutputs(outputs) {
|
|
7
|
+
return Pulumi.all([
|
|
8
|
+
Adapter$ReventlessCore.resourcesToInterop(outputs.resources),
|
|
9
|
+
Adapter$ReventlessCore.resourcesToInterop(outputs.queryDb.resources)
|
|
10
|
+
]).apply(param => ({
|
|
11
|
+
resources: param[0],
|
|
12
|
+
queryDb: {
|
|
13
|
+
resources: param[1]
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let componentType = "OutboundTranslationSlice";
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
componentType,
|
|
22
|
+
toResolvedOutputs,
|
|
23
|
+
}
|
|
24
|
+
/* @pulumi/pulumi Not a pure module */
|