@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,273 @@
|
|
|
1
|
+
module type Ops = {
|
|
2
|
+
module Spec: Reventless.Aggregate.Spec
|
|
3
|
+
module EventLog: EventLog.T with module Spec.Id = Spec.Id and type Spec.event = Spec.event
|
|
4
|
+
let eventLog: EventLog.operations
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module type T = {
|
|
8
|
+
module Spec: Reventless.Aggregate.Spec
|
|
9
|
+
let handleCommands: CommandTopic.commandsHandler<Message.command'<Spec.Id.t, Spec.command>>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module Make = (
|
|
13
|
+
Spec: Reventless.Aggregate.Spec,
|
|
14
|
+
Behavior: Behavior.T with module Spec := Spec,
|
|
15
|
+
Ops: Ops with module Spec = Spec,
|
|
16
|
+
): (T with module Spec = Spec) => {
|
|
17
|
+
module Spec = Spec
|
|
18
|
+
|
|
19
|
+
let comp = `Aggregate(${Spec.name})`
|
|
20
|
+
|
|
21
|
+
let eventJson = (event': Message.event'<Spec.Id.t, Spec.event>): JSON.t =>
|
|
22
|
+
event'.event->Message.encode(Spec.eventSchema)
|
|
23
|
+
|
|
24
|
+
let eventDetail = (event': Message.event'<Spec.Id.t, Spec.event>): string => {
|
|
25
|
+
let json = event'->eventJson
|
|
26
|
+
let name = json->Message.variantNameOfJson->LogFormat.bold
|
|
27
|
+
let id = event'.id->Spec.Id.toString
|
|
28
|
+
`${name}(${id}${LogFormat.variantFields(json)})`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Collects the incoming command stream into groups keyed by aggregate ID.
|
|
32
|
+
// Returns Effect.t<array<(Id.t, array<topicItem>)>>.
|
|
33
|
+
let groupTopicItemsByIdStream = stream =>
|
|
34
|
+
stream
|
|
35
|
+
->Stream.runFold(Dict.make(), (
|
|
36
|
+
dict,
|
|
37
|
+
item: CommandTopic.topicItem<Message.command'<Spec.Id.t, Spec.command>>,
|
|
38
|
+
) => {
|
|
39
|
+
let id = item.command.id->Spec.Id.toString
|
|
40
|
+
let existing = dict->Dict.get(id)->Option.getOr([])
|
|
41
|
+
dict->Dict.set(id, Array.concat(existing, [item]))
|
|
42
|
+
dict
|
|
43
|
+
})
|
|
44
|
+
->Effect.map(dict =>
|
|
45
|
+
dict->Dict.toArray->Array.map(((id, items)) => (id->Spec.Id.makeFromString, items))
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
// Derive meta for an event emitted from a command:
|
|
49
|
+
// - fresh msgId + time
|
|
50
|
+
// - correlationId, ip, user, traceparent, schemaVersion, headers inherited from the command
|
|
51
|
+
// - causationId = the command's msgId (the *direct* parent of this event)
|
|
52
|
+
let updateMeta = (command': Message.command'<'id, 'command>) =>
|
|
53
|
+
Message.deriveMeta(~parent=command'.meta)
|
|
54
|
+
|
|
55
|
+
// Per-command outcome carried through the fold, paired with the originating reference and meta.
|
|
56
|
+
type cmdOutcome =
|
|
57
|
+
| CmdOk(array<Spec.event>)
|
|
58
|
+
| CmdRejected({errorCode: string, errorDetail: string})
|
|
59
|
+
|
|
60
|
+
// Folds a single command into the running accumulator: (currentState, perCommandOutcomes).
|
|
61
|
+
// A domain rejection from Behavior.decide is recorded as `CmdRejected` (no state change,
|
|
62
|
+
// surviving commands in the batch continue); a successful decide records `CmdOk(events)`
|
|
63
|
+
// and advances state via `Behavior.evolve`.
|
|
64
|
+
let processCommand = (
|
|
65
|
+
(state, outcomes): (Behavior.state, array<(string, cmdOutcome, Message.meta)>),
|
|
66
|
+
topicItem: CommandTopic.topicItem<Message.command'<Spec.Id.t, Spec.command>>,
|
|
67
|
+
) => {
|
|
68
|
+
let {reference, command: command'} = topicItem
|
|
69
|
+
let meta = command'->updateMeta
|
|
70
|
+
EffectLogger.logDebug(
|
|
71
|
+
~comp,
|
|
72
|
+
`deciding on state: ${state->JSON.stringifyAny->Option.getOr("<unserializable>")}`,
|
|
73
|
+
)->Effect.runSync
|
|
74
|
+
switch Behavior.decide(state, command'.command) {
|
|
75
|
+
| Ok(generatedEvents) =>
|
|
76
|
+
let newState = generatedEvents->Array.reduce(state, Behavior.evolve)
|
|
77
|
+
(newState, Array.concat(outcomes, [(reference, CmdOk(generatedEvents), meta)]))
|
|
78
|
+
| Error(error) =>
|
|
79
|
+
let errorJson = error->Message.encode(Spec.errorSchema)
|
|
80
|
+
let errorCode = errorJson->Message.variantNameOfJson
|
|
81
|
+
// Strip the TAG so detail carries only the rejection payload (empty for unit errors).
|
|
82
|
+
let (_, payloadDict) = errorJson->Message.splitMessage
|
|
83
|
+
let errorDetail =
|
|
84
|
+
payloadDict->Dict.toArray->Array.length == 0
|
|
85
|
+
? ""
|
|
86
|
+
: payloadDict->JSON.Encode.object->JSON.stringify
|
|
87
|
+
let id = command'.id->Spec.Id.toString
|
|
88
|
+
EffectLogger.logError(
|
|
89
|
+
~comp,
|
|
90
|
+
`decide rejected: ${errorCode} ${errorDetail} id=${id}`,
|
|
91
|
+
)->Effect.runSync
|
|
92
|
+
(state, Array.concat(outcomes, [(reference, CmdRejected({errorCode, errorDetail}), meta)]))
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let maxConflictRetries = 3
|
|
97
|
+
|
|
98
|
+
// Reports per-command outcomes on the inline side-channels and produces the
|
|
99
|
+
// per-reference Ok/Error array consumed by SQS-style consumers. Domain rejections
|
|
100
|
+
// are always Ok(reference) — SQS deletes the message because retry would not help —
|
|
101
|
+
// and the rich error code/detail flows to producers via reportRejected.
|
|
102
|
+
let reportFinalOutcomes = (
|
|
103
|
+
outcomes: array<(string, cmdOutcome, Message.meta)>,
|
|
104
|
+
~entityId: string,
|
|
105
|
+
~appendSucceeded: bool,
|
|
106
|
+
~appendedEventCount: int,
|
|
107
|
+
~appendErrorDetail: string="",
|
|
108
|
+
): array<result<string, string>> =>
|
|
109
|
+
outcomes->Array.map(((reference, outcome, _meta)) =>
|
|
110
|
+
switch outcome {
|
|
111
|
+
| CmdRejected({errorCode, errorDetail}) =>
|
|
112
|
+
CommandTopic_Helpers.reportRejected(reference, {errorCode, errorDetail})
|
|
113
|
+
Ok(reference)
|
|
114
|
+
| CmdOk(_) if appendSucceeded =>
|
|
115
|
+
CommandTopic_Helpers.reportAccepted(reference, {entityId, eventCount: appendedEventCount})
|
|
116
|
+
Ok(reference)
|
|
117
|
+
| CmdOk(_) =>
|
|
118
|
+
CommandTopic_Helpers.reportRejected(
|
|
119
|
+
reference,
|
|
120
|
+
{errorCode: "AppendFailed", errorDetail: appendErrorDetail},
|
|
121
|
+
)
|
|
122
|
+
Error(reference)
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
// Replays the event log, processes commands, and attempts to append.
|
|
127
|
+
// Returns Ok(references) on success or non-conflict failure (per-reference Ok/Error
|
|
128
|
+
// reflects per-command success), Error("conflict") on optimistic-locking failure
|
|
129
|
+
// (caller retries the whole replay+process+append cycle).
|
|
130
|
+
let replayProcessAppend = (
|
|
131
|
+
id,
|
|
132
|
+
topicItemsForId: array<CommandTopic.topicItem<Message.command'<Spec.Id.t, Spec.command>>>,
|
|
133
|
+
) => {
|
|
134
|
+
let idStr = id->Spec.Id.toString
|
|
135
|
+
|
|
136
|
+
Ops.eventLog.replayStream(id)
|
|
137
|
+
->Stream.runFold((Behavior.initialState, 0), ((st, n), ev) => (Behavior.evolve(st, ev), n + 1))
|
|
138
|
+
->Effect.tap(((_, n)) =>
|
|
139
|
+
EffectLogger.logInfo(~comp, `replay: id=${idStr}, ${n->Int.toString} event(s)`)
|
|
140
|
+
)
|
|
141
|
+
->Effect.flatMap(((initialState, sequenceNr)) => {
|
|
142
|
+
let (_finalState, outcomes) =
|
|
143
|
+
topicItemsForId->Array.reduce((initialState, []), processCommand)
|
|
144
|
+
|
|
145
|
+
let eventsToAppend =
|
|
146
|
+
outcomes
|
|
147
|
+
->Array.map(((_reference, outcome, meta)) =>
|
|
148
|
+
switch outcome {
|
|
149
|
+
| CmdOk(events) => events->Array.map(event => {Message.id, meta, event})
|
|
150
|
+
| CmdRejected(_) => []
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
->Array.flat
|
|
154
|
+
|
|
155
|
+
switch eventsToAppend {
|
|
156
|
+
| [] =>
|
|
157
|
+
let perRef = reportFinalOutcomes(
|
|
158
|
+
outcomes,
|
|
159
|
+
~entityId=idStr,
|
|
160
|
+
~appendSucceeded=true,
|
|
161
|
+
~appendedEventCount=0,
|
|
162
|
+
)
|
|
163
|
+
EffectLogger.logInfo(~comp, `no events produced: id=${idStr}`)->Effect.map(_ => Ok(perRef))
|
|
164
|
+
| generatedEvents' =>
|
|
165
|
+
let eventCount = generatedEvents'->Array.length->Int.toString
|
|
166
|
+
let eventDetails =
|
|
167
|
+
generatedEvents'->Array.map(event' => event'->eventDetail)->Array.join(", ")
|
|
168
|
+
let eventJsons = generatedEvents'->Array.map(event' => event'->eventJson)->JSON.Encode.array
|
|
169
|
+
EffectLogger.logInfo(
|
|
170
|
+
~comp,
|
|
171
|
+
~detail=eventJsons,
|
|
172
|
+
`produced ${eventCount} event(s): [${eventDetails}]`,
|
|
173
|
+
)
|
|
174
|
+
->Effect.flatMap(
|
|
175
|
+
_ => Effect.promise(() => Ops.eventLog.append(sequenceNr, id, generatedEvents')),
|
|
176
|
+
)
|
|
177
|
+
->Effect.flatMap(
|
|
178
|
+
appendResult =>
|
|
179
|
+
switch appendResult {
|
|
180
|
+
| Ok(_) =>
|
|
181
|
+
let perRef = reportFinalOutcomes(
|
|
182
|
+
outcomes,
|
|
183
|
+
~entityId=idStr,
|
|
184
|
+
~appendSucceeded=true,
|
|
185
|
+
~appendedEventCount=generatedEvents'->Array.length,
|
|
186
|
+
)
|
|
187
|
+
EffectLogger.logInfo(~comp, `append: id=${idStr}`)->Effect.map(_ => Ok(perRef))
|
|
188
|
+
| Error(msg) if msg->String.includes("conflict") =>
|
|
189
|
+
EffectLogger.logWarn(~comp, `conflict: id=${idStr}, will retry`)->Effect.map(
|
|
190
|
+
_ => Error(msg),
|
|
191
|
+
)
|
|
192
|
+
| Error(msg) =>
|
|
193
|
+
let perRef = reportFinalOutcomes(
|
|
194
|
+
outcomes,
|
|
195
|
+
~entityId=idStr,
|
|
196
|
+
~appendSucceeded=false,
|
|
197
|
+
~appendedEventCount=0,
|
|
198
|
+
~appendErrorDetail=msg,
|
|
199
|
+
)
|
|
200
|
+
EffectLogger.logError(~comp, `append failed: id=${idStr}: ${msg}`)->Effect.map(_ => Ok(perRef))
|
|
201
|
+
},
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// CommandTopic handler — processes a stream of incoming commands:
|
|
208
|
+
// 1. Groups commands by aggregate ID
|
|
209
|
+
// 2. For each aggregate (concurrently):
|
|
210
|
+
// a. Replays the event log to rebuild current state + sequence number
|
|
211
|
+
// b. Sequentially folds each command through processCommand
|
|
212
|
+
// c. Appends generated events to the event log (optimistic concurrency via sequenceNr)
|
|
213
|
+
// d. On conflict: retries the full replay+process+append cycle (up to 3 times)
|
|
214
|
+
// 3. Returns Ok(reference) for successful commands, Error(reference) for failures
|
|
215
|
+
let handleCommands: CommandTopic.commandsHandler<
|
|
216
|
+
Message.command'<Spec.Id.t, Spec.command>,
|
|
217
|
+
> = stream =>
|
|
218
|
+
stream
|
|
219
|
+
->groupTopicItemsByIdStream
|
|
220
|
+
->Effect.flatMap(groups =>
|
|
221
|
+
Effect.all(
|
|
222
|
+
groups->Array.map(((id, topicItemsForId)) => {
|
|
223
|
+
let idStr = id->Spec.Id.toString
|
|
224
|
+
// Log commands once (outside retry loop)
|
|
225
|
+
let cmdJsons =
|
|
226
|
+
topicItemsForId->Array.map(
|
|
227
|
+
({command}) =>
|
|
228
|
+
command->Message.commandJsonOfCommand'(
|
|
229
|
+
~idToString=Spec.Id.toString,
|
|
230
|
+
~commandSchema=Spec.commandSchema,
|
|
231
|
+
),
|
|
232
|
+
)
|
|
233
|
+
let count = cmdJsons->Array.length->Int.toString
|
|
234
|
+
cmdJsons->Array.forEachWithIndex(
|
|
235
|
+
(cmdJson, idx) => {
|
|
236
|
+
let idxStr = (idx + 1)->Int.toString
|
|
237
|
+
EffectLogger.logInfo(
|
|
238
|
+
~comp,
|
|
239
|
+
~detail=cmdJson.commandJson,
|
|
240
|
+
`handling command ${idxStr}/${count}: ${LogFormat.cmdDetail(cmdJson)}`,
|
|
241
|
+
)->Effect.runSync
|
|
242
|
+
},
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
// Extract references once for the exhaustion branch
|
|
246
|
+
let references = topicItemsForId->Array.map(item => item.reference)
|
|
247
|
+
|
|
248
|
+
// Retry loop for conflict resolution
|
|
249
|
+
let rec attempt = retryCount =>
|
|
250
|
+
replayProcessAppend(id, topicItemsForId)->Effect.flatMap(
|
|
251
|
+
result =>
|
|
252
|
+
switch result {
|
|
253
|
+
| Ok(refs) => Effect.succeed(refs)
|
|
254
|
+
| Error(_) if retryCount < maxConflictRetries =>
|
|
255
|
+
EffectLogger.logWarn(
|
|
256
|
+
~comp,
|
|
257
|
+
`conflict retry id=${idStr} ${(retryCount + 1)
|
|
258
|
+
->Int.toString}/${maxConflictRetries->Int.toString}`,
|
|
259
|
+
)->Effect.flatMap(_ => attempt(retryCount + 1))
|
|
260
|
+
| Error(msg) =>
|
|
261
|
+
let detail = `concurrent modification (${maxConflictRetries->Int.toString} retries exhausted): ${msg}`
|
|
262
|
+
EffectLogger.logError(
|
|
263
|
+
~comp,
|
|
264
|
+
`max conflict retries exhausted id=${idStr}: ${msg}`,
|
|
265
|
+
)->Effect.map(_ => references->Array.map(_ => Error(detail)))
|
|
266
|
+
},
|
|
267
|
+
)
|
|
268
|
+
attempt(0)
|
|
269
|
+
}),
|
|
270
|
+
{"concurrency": "unbounded"},
|
|
271
|
+
)->Effect.map(Array.flat)
|
|
272
|
+
)
|
|
273
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
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 Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Stream from "effect/Stream";
|
|
7
|
+
import * as Message$ReventlessCore from "../../Message.res.mjs";
|
|
8
|
+
import * as LogFormat$ReventlessCore from "../../util/LogFormat.res.mjs";
|
|
9
|
+
import * as EffectLogger$ReventlessCore from "../../util/EffectLogger.res.mjs";
|
|
10
|
+
import * as CommandTopic_Helpers$ReventlessCore from "../CommandTopic/CommandTopic_Helpers.res.mjs";
|
|
11
|
+
|
|
12
|
+
function Make(Spec) {
|
|
13
|
+
return Behavior => (Ops => {
|
|
14
|
+
let comp = `Aggregate(` + Spec.name + `)`;
|
|
15
|
+
let groupTopicItemsByIdStream = stream => Effect.map(Stream.runFold(stream, {}, (dict, item) => {
|
|
16
|
+
let id = Spec.Id.toString(item.command.id);
|
|
17
|
+
let existing = Stdlib_Option.getOr(dict[id], []);
|
|
18
|
+
dict[id] = existing.concat([item]);
|
|
19
|
+
return dict;
|
|
20
|
+
}), dict => Object.entries(dict).map(param => [
|
|
21
|
+
Spec.Id.makeFromString(param[0]),
|
|
22
|
+
param[1]
|
|
23
|
+
]));
|
|
24
|
+
let processCommand = (param, topicItem) => {
|
|
25
|
+
let reference = topicItem.reference;
|
|
26
|
+
let command$p = topicItem.command;
|
|
27
|
+
let outcomes = param[1];
|
|
28
|
+
let state = param[0];
|
|
29
|
+
let meta = Message$ReventlessCore.deriveMeta(command$p.meta, undefined);
|
|
30
|
+
Effect.runSync(EffectLogger$ReventlessCore.logDebug(comp, undefined, `deciding on state: ` + Stdlib_Option.getOr(JSON.stringify(state), "<unserializable>")));
|
|
31
|
+
let generatedEvents = Behavior.decide(state, command$p.command);
|
|
32
|
+
if (generatedEvents.TAG === "Ok") {
|
|
33
|
+
let generatedEvents$1 = generatedEvents._0;
|
|
34
|
+
let newState = Stdlib_Array.reduce(generatedEvents$1, state, Behavior.evolve);
|
|
35
|
+
return [
|
|
36
|
+
newState,
|
|
37
|
+
outcomes.concat([[
|
|
38
|
+
reference,
|
|
39
|
+
{
|
|
40
|
+
TAG: "CmdOk",
|
|
41
|
+
_0: generatedEvents$1
|
|
42
|
+
},
|
|
43
|
+
meta
|
|
44
|
+
]])
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
let errorJson = Message$ReventlessCore.encode(generatedEvents._0, Spec.errorSchema);
|
|
48
|
+
let errorCode = Message$ReventlessCore.variantNameOfJson(errorJson);
|
|
49
|
+
let match = Message$ReventlessCore.splitMessage(errorJson);
|
|
50
|
+
let payloadDict = match[1];
|
|
51
|
+
let errorDetail = Object.entries(payloadDict).length === 0 ? "" : JSON.stringify(payloadDict);
|
|
52
|
+
let id = Spec.Id.toString(command$p.id);
|
|
53
|
+
Effect.runSync(EffectLogger$ReventlessCore.logError(comp, undefined, `decide rejected: ` + errorCode + ` ` + errorDetail + ` id=` + id));
|
|
54
|
+
return [
|
|
55
|
+
state,
|
|
56
|
+
outcomes.concat([[
|
|
57
|
+
reference,
|
|
58
|
+
{
|
|
59
|
+
TAG: "CmdRejected",
|
|
60
|
+
errorCode: errorCode,
|
|
61
|
+
errorDetail: errorDetail
|
|
62
|
+
},
|
|
63
|
+
meta
|
|
64
|
+
]])
|
|
65
|
+
];
|
|
66
|
+
};
|
|
67
|
+
let reportFinalOutcomes = (outcomes, entityId, appendSucceeded, appendedEventCount, appendErrorDetailOpt) => {
|
|
68
|
+
let appendErrorDetail = appendErrorDetailOpt !== undefined ? appendErrorDetailOpt : "";
|
|
69
|
+
return outcomes.map(param => {
|
|
70
|
+
let outcome = param[1];
|
|
71
|
+
let reference = param[0];
|
|
72
|
+
if (outcome.TAG === "CmdOk") {
|
|
73
|
+
if (appendSucceeded) {
|
|
74
|
+
CommandTopic_Helpers$ReventlessCore.reportAccepted(reference, {
|
|
75
|
+
entityId: entityId,
|
|
76
|
+
eventCount: appendedEventCount
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
TAG: "Ok",
|
|
80
|
+
_0: reference
|
|
81
|
+
};
|
|
82
|
+
} else {
|
|
83
|
+
CommandTopic_Helpers$ReventlessCore.reportRejected(reference, {
|
|
84
|
+
errorCode: "AppendFailed",
|
|
85
|
+
errorDetail: appendErrorDetail
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
TAG: "Error",
|
|
89
|
+
_0: reference
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
CommandTopic_Helpers$ReventlessCore.reportRejected(reference, {
|
|
94
|
+
errorCode: outcome.errorCode,
|
|
95
|
+
errorDetail: outcome.errorDetail
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
TAG: "Ok",
|
|
99
|
+
_0: reference
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
let replayProcessAppend = (id, topicItemsForId) => {
|
|
104
|
+
let idStr = Spec.Id.toString(id);
|
|
105
|
+
return Effect.flatMap(Effect.tap(Stream.runFold(Ops.eventLog.replayStream(id), [
|
|
106
|
+
Behavior.initialState,
|
|
107
|
+
0
|
|
108
|
+
], (param, ev) => [
|
|
109
|
+
Behavior.evolve(param[0], ev),
|
|
110
|
+
param[1] + 1 | 0
|
|
111
|
+
]), param => EffectLogger$ReventlessCore.logInfo(comp, undefined, `replay: id=` + idStr + `, ` + param[1].toString() + ` event(s)`)), param => {
|
|
112
|
+
let sequenceNr = param[1];
|
|
113
|
+
let match = Stdlib_Array.reduce(topicItemsForId, [
|
|
114
|
+
param[0],
|
|
115
|
+
[]
|
|
116
|
+
], processCommand);
|
|
117
|
+
let outcomes = match[1];
|
|
118
|
+
let eventsToAppend = outcomes.map(param => {
|
|
119
|
+
let meta = param[2];
|
|
120
|
+
let outcome = param[1];
|
|
121
|
+
if (outcome.TAG === "CmdOk") {
|
|
122
|
+
return outcome._0.map(event => ({
|
|
123
|
+
id: id,
|
|
124
|
+
meta: meta,
|
|
125
|
+
event: event
|
|
126
|
+
}));
|
|
127
|
+
} else {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
}).flat();
|
|
131
|
+
if (eventsToAppend.length !== 0) {
|
|
132
|
+
let eventCount = eventsToAppend.length.toString();
|
|
133
|
+
let eventDetails = eventsToAppend.map(event$p => {
|
|
134
|
+
let json = Message$ReventlessCore.encode(event$p.event, Spec.eventSchema);
|
|
135
|
+
let name = LogFormat$ReventlessCore.bold(Message$ReventlessCore.variantNameOfJson(json));
|
|
136
|
+
let id = Spec.Id.toString(event$p.id);
|
|
137
|
+
return name + `(` + id + LogFormat$ReventlessCore.variantFields(json) + `)`;
|
|
138
|
+
}).join(", ");
|
|
139
|
+
let eventJsons = eventsToAppend.map(event$p => Message$ReventlessCore.encode(event$p.event, Spec.eventSchema));
|
|
140
|
+
return Effect.flatMap(Effect.flatMap(EffectLogger$ReventlessCore.logInfo(comp, eventJsons, `produced ` + eventCount + ` event(s): [` + eventDetails + `]`), () => Effect.promise(() => Ops.eventLog.append(sequenceNr, id, eventsToAppend))), appendResult => {
|
|
141
|
+
if (appendResult.TAG === "Ok") {
|
|
142
|
+
let perRef = reportFinalOutcomes(outcomes, idStr, true, eventsToAppend.length, undefined);
|
|
143
|
+
return Effect.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, `append: id=` + idStr), () => ({
|
|
144
|
+
TAG: "Ok",
|
|
145
|
+
_0: perRef
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
let msg = appendResult._0;
|
|
149
|
+
if (msg.includes("conflict")) {
|
|
150
|
+
return Effect.map(EffectLogger$ReventlessCore.logWarn(comp, undefined, `conflict: id=` + idStr + `, will retry`), () => ({
|
|
151
|
+
TAG: "Error",
|
|
152
|
+
_0: msg
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
let perRef$1 = reportFinalOutcomes(outcomes, idStr, false, 0, msg);
|
|
156
|
+
return Effect.map(EffectLogger$ReventlessCore.logError(comp, undefined, `append failed: id=` + idStr + `: ` + msg), () => ({
|
|
157
|
+
TAG: "Ok",
|
|
158
|
+
_0: perRef$1
|
|
159
|
+
}));
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
let perRef = reportFinalOutcomes(outcomes, idStr, true, 0, undefined);
|
|
163
|
+
return Effect.map(EffectLogger$ReventlessCore.logInfo(comp, undefined, `no events produced: id=` + idStr), () => ({
|
|
164
|
+
TAG: "Ok",
|
|
165
|
+
_0: perRef
|
|
166
|
+
}));
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
let handleCommands = stream => Effect.flatMap(groupTopicItemsByIdStream(stream), groups => Effect.map(Effect.all(groups.map(param => {
|
|
170
|
+
let topicItemsForId = param[1];
|
|
171
|
+
let id = param[0];
|
|
172
|
+
let idStr = Spec.Id.toString(id);
|
|
173
|
+
let cmdJsons = topicItemsForId.map(param => Message$ReventlessCore.commandJsonOfCommand$p(Spec.Id.toString, Spec.commandSchema, param.command));
|
|
174
|
+
let count = cmdJsons.length.toString();
|
|
175
|
+
cmdJsons.forEach((cmdJson, idx) => {
|
|
176
|
+
let idxStr = (idx + 1 | 0).toString();
|
|
177
|
+
Effect.runSync(EffectLogger$ReventlessCore.logInfo(comp, cmdJson.commandJson, `handling command ` + idxStr + `/` + count + `: ` + LogFormat$ReventlessCore.cmdDetail(cmdJson)));
|
|
178
|
+
});
|
|
179
|
+
let references = topicItemsForId.map(item => item.reference);
|
|
180
|
+
let attempt = retryCount => Effect.flatMap(replayProcessAppend(id, topicItemsForId), result => {
|
|
181
|
+
if (result.TAG === "Ok") {
|
|
182
|
+
return Effect.succeed(result._0);
|
|
183
|
+
}
|
|
184
|
+
let msg = result._0;
|
|
185
|
+
if (retryCount < 3) {
|
|
186
|
+
return Effect.flatMap(EffectLogger$ReventlessCore.logWarn(comp, undefined, `conflict retry id=` + idStr + ` ` + (retryCount + 1 | 0).toString() + `/` + (3).toString()), () => attempt(retryCount + 1 | 0));
|
|
187
|
+
}
|
|
188
|
+
let detail = `concurrent modification (` + (3).toString() + ` retries exhausted): ` + msg;
|
|
189
|
+
return Effect.map(EffectLogger$ReventlessCore.logError(comp, undefined, `max conflict retries exhausted id=` + idStr + `: ` + msg), () => references.map(param => ({
|
|
190
|
+
TAG: "Error",
|
|
191
|
+
_0: detail
|
|
192
|
+
})));
|
|
193
|
+
});
|
|
194
|
+
return attempt(0);
|
|
195
|
+
}), {
|
|
196
|
+
concurrency: "unbounded"
|
|
197
|
+
}), prim => prim.flat()));
|
|
198
|
+
return {
|
|
199
|
+
Spec: Spec,
|
|
200
|
+
handleCommands: handleCommands
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export {
|
|
206
|
+
Make,
|
|
207
|
+
}
|
|
208
|
+
/* effect/Effect Not a pure module */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Read per-variant `allowedStates` metadata that the reventless-ppx
|
|
2
|
+
// `@allowedStates([…])` attribute attaches to a command schema. Consumed by
|
|
3
|
+
// `Plugin_Structure.toCommandDef` when building the `commandDef` records that
|
|
4
|
+
// land in `Platform_ComponentDefinitions` so AutoUI can filter the per-row command
|
|
5
|
+
// menu by the row's status.
|
|
6
|
+
|
|
7
|
+
open ReventlessInfra.Api
|
|
8
|
+
|
|
9
|
+
/** Returns the allowed-state list for a given command-variant name, or None
|
|
10
|
+
when the variant has no `@allowedStates` annotation (back-compat default
|
|
11
|
+
— the command shows on every row). */
|
|
12
|
+
let getAllowedStates = (
|
|
13
|
+
commandSchema: S.t<unknown>,
|
|
14
|
+
~variantName: string,
|
|
15
|
+
): option<array<string>> =>
|
|
16
|
+
switch commandSchema->S.Metadata.get(~id=allowedStatesId) {
|
|
17
|
+
| None => None
|
|
18
|
+
| Some(entries) => entries->Dict.get(variantName)
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
|
|
5
|
+
|
|
6
|
+
function getAllowedStates(commandSchema, variantName) {
|
|
7
|
+
let entries = S.Metadata.get(commandSchema, Api$ReventlessInfra.allowedStatesId);
|
|
8
|
+
if (entries !== undefined) {
|
|
9
|
+
return entries[variantName];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
getAllowedStates,
|
|
15
|
+
}
|
|
16
|
+
/* S Not a pure module */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
open ReventlessInfra.Api
|
|
2
|
+
|
|
3
|
+
let isNoApi = (commandSchema: S.t<unknown>): bool =>
|
|
4
|
+
commandSchema->S.Metadata.get(~id=noApiId)->Option.getOr(false)
|
|
5
|
+
|
|
6
|
+
let getExcludedVariants = (commandSchema: S.t<unknown>): option<Set.t<string>> =>
|
|
7
|
+
commandSchema->S.Metadata.get(~id=noApiVariantsId)
|
|
8
|
+
|
|
9
|
+
let filterNoApiVariants = (fieldNames: array<string>, commandSchema: S.t<unknown>): array<string> =>
|
|
10
|
+
switch commandSchema->S.Metadata.get(~id=noApiVariantsId) {
|
|
11
|
+
| None => fieldNames
|
|
12
|
+
| Some(excluded) => fieldNames->Array.filter(name => !(excluded->Set.has(name)))
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
|
|
6
|
+
|
|
7
|
+
function isNoApi(commandSchema) {
|
|
8
|
+
return Stdlib_Option.getOr(S.Metadata.get(commandSchema, Api$ReventlessInfra.noApiId), false);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getExcludedVariants(commandSchema) {
|
|
12
|
+
return S.Metadata.get(commandSchema, Api$ReventlessInfra.noApiVariantsId);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function filterNoApiVariants(fieldNames, commandSchema) {
|
|
16
|
+
let excluded = S.Metadata.get(commandSchema, Api$ReventlessInfra.noApiVariantsId);
|
|
17
|
+
if (excluded !== undefined) {
|
|
18
|
+
return fieldNames.filter(name => !excluded.has(name));
|
|
19
|
+
} else {
|
|
20
|
+
return fieldNames;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
isNoApi,
|
|
26
|
+
getExcludedVariants,
|
|
27
|
+
filterNoApiVariants,
|
|
28
|
+
}
|
|
29
|
+
/* S Not a pure module */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Api_Builder — creates the Api component backed by a Provider (AppSync / in-memory yoga).
|
|
2
|
+
//
|
|
3
|
+
// Usage:
|
|
4
|
+
// module AwsApi = Api_Builder.Make(AppSync_Adapter)
|
|
5
|
+
// let api = AwsApi.make(~name="MyApi", ~baseFragment, ~opts)
|
|
6
|
+
|
|
7
|
+
module Make = (Provider: ReventlessInfra.Api_Adapter.Provider) => {
|
|
8
|
+
let construct = (~name, ~baseFragment: Reventless.Plugin.apiSchemaFragment, self) => {
|
|
9
|
+
let opts = {Pulumi.ComponentResource.parent: self->Component.toPulumiResource}
|
|
10
|
+
let (api, _role) = Provider.makeApiResource(~name, ~opts)
|
|
11
|
+
|
|
12
|
+
// Outputs — the cloud API ID
|
|
13
|
+
let apiId = api->Pulumi.Output.apply(a => (a->Obj.magic)["id"]->Option.getOr(name))
|
|
14
|
+
let _ = self->Component.setOutputs({ReventlessInfra.Api.apiId: apiId})
|
|
15
|
+
|
|
16
|
+
// Operations — updateSchema rebuilds the stitched SDL and publishes it
|
|
17
|
+
self->Component.setOperations(
|
|
18
|
+
api->Pulumi.Output.apply(apiValue => {
|
|
19
|
+
ReventlessInfra.Api.updateSchema: pluginFragments =>
|
|
20
|
+
Provider.updateSchema(
|
|
21
|
+
~api=Pulumi.Output.make(apiValue),
|
|
22
|
+
~baseFragment,
|
|
23
|
+
~pluginFragments,
|
|
24
|
+
),
|
|
25
|
+
}),
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let make = (
|
|
30
|
+
~name: string,
|
|
31
|
+
~baseFragment: Reventless.Plugin.apiSchemaFragment,
|
|
32
|
+
~opts: option<Pulumi.ComponentResource.options>=?,
|
|
33
|
+
): ReventlessInfra.Api.component =>
|
|
34
|
+
Component.make(
|
|
35
|
+
~componentType="reventless:index:Api",
|
|
36
|
+
~name,
|
|
37
|
+
~construct=construct(~name, ~baseFragment, ...),
|
|
38
|
+
~opts,
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
5
|
+
import * as Component$ReventlessCore from "../Component.res.mjs";
|
|
6
|
+
|
|
7
|
+
function Make(Provider) {
|
|
8
|
+
let construct = (name, baseFragment, self) => {
|
|
9
|
+
let opts_parent = Component$ReventlessCore.toPulumiResource(self);
|
|
10
|
+
let opts = {
|
|
11
|
+
parent: opts_parent
|
|
12
|
+
};
|
|
13
|
+
let match = Provider.makeApiResource(name, opts);
|
|
14
|
+
let api = match[0];
|
|
15
|
+
let apiId = api.apply(a => Stdlib_Option.getOr(a.id, name));
|
|
16
|
+
Component$ReventlessCore.setOutputs(self, {
|
|
17
|
+
apiId: apiId
|
|
18
|
+
});
|
|
19
|
+
Component$ReventlessCore.setOperations(self, api.apply(apiValue => ({
|
|
20
|
+
updateSchema: pluginFragments => Provider.updateSchema(Pulumi.output(apiValue), baseFragment, pluginFragments)
|
|
21
|
+
})));
|
|
22
|
+
};
|
|
23
|
+
let make = (name, baseFragment, opts) => Component$ReventlessCore.make("reventless:index:Api", name, extra => construct(name, baseFragment, extra), opts);
|
|
24
|
+
return {
|
|
25
|
+
construct: construct,
|
|
26
|
+
make: make
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
Make,
|
|
32
|
+
}
|
|
33
|
+
/* @pulumi/pulumi Not a pure module */
|