@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,142 @@
|
|
|
1
|
+
// Shared utility: convert sury S.t<'a> schemas to JSON Schema objects.
|
|
2
|
+
// Uses SchemaType as the shared intermediate representation.
|
|
3
|
+
|
|
4
|
+
// ── Helpers ──────────────────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
let str = JSON.Encode.string
|
|
7
|
+
|
|
8
|
+
let jsonObject = (entries: array<(string, JSON.t)>): JSON.t =>
|
|
9
|
+
JSON.Encode.object(Dict.fromArray(entries))
|
|
10
|
+
|
|
11
|
+
// Merge x-reventless-* extension properties from a Reventless.StateAnnotations.stateAnnotationSpec
|
|
12
|
+
// into a property schema (a JSON Schema object). Returns the schema unchanged when the field
|
|
13
|
+
// has no annotations or when the schema is not a JSON object.
|
|
14
|
+
let mergeAnnotations = (
|
|
15
|
+
fieldSchema: JSON.t,
|
|
16
|
+
fieldName: string,
|
|
17
|
+
spec: Reventless.StateAnnotations.stateAnnotationSpec,
|
|
18
|
+
): JSON.t =>
|
|
19
|
+
switch fieldSchema->JSON.Decode.object {
|
|
20
|
+
| None => fieldSchema
|
|
21
|
+
| Some(obj) =>
|
|
22
|
+
if spec.ids->Array.includes(fieldName) {
|
|
23
|
+
obj->Dict.set("x-reventless-id", JSON.Encode.bool(true))
|
|
24
|
+
}
|
|
25
|
+
if spec.compositeIds->Array.includes(fieldName) {
|
|
26
|
+
obj->Dict.set("x-reventless-compositeId", JSON.Encode.bool(true))
|
|
27
|
+
}
|
|
28
|
+
if spec.subIds->Array.includes(fieldName) {
|
|
29
|
+
obj->Dict.set("x-reventless-subId", JSON.Encode.bool(true))
|
|
30
|
+
}
|
|
31
|
+
if spec.compositeSubIds->Array.includes(fieldName) {
|
|
32
|
+
obj->Dict.set("x-reventless-compositeSubId", JSON.Encode.bool(true))
|
|
33
|
+
}
|
|
34
|
+
switch spec.indexes->Array.find(((field, _)) => field === fieldName) {
|
|
35
|
+
| Some((_, indexName)) =>
|
|
36
|
+
let value =
|
|
37
|
+
indexName === "" ? JSON.Encode.bool(true) : JSON.Encode.string(indexName)
|
|
38
|
+
obj->Dict.set("x-reventless-index", value)
|
|
39
|
+
| None => ()
|
|
40
|
+
}
|
|
41
|
+
if spec.hidden->Array.includes(fieldName) {
|
|
42
|
+
obj->Dict.set("x-reventless-hidden", JSON.Encode.bool(true))
|
|
43
|
+
}
|
|
44
|
+
if spec.summary->Array.includes(fieldName) {
|
|
45
|
+
obj->Dict.set("x-reventless-summary", JSON.Encode.bool(true))
|
|
46
|
+
}
|
|
47
|
+
switch spec.drillTargets->Array.find(((field, _)) => field === fieldName) {
|
|
48
|
+
| Some((_, sliceName)) =>
|
|
49
|
+
obj->Dict.set("x-reventless-drillTarget", JSON.Encode.string(sliceName))
|
|
50
|
+
| None => ()
|
|
51
|
+
}
|
|
52
|
+
switch spec.drillTargetKeys->Array.find(((field, _)) => field === fieldName) {
|
|
53
|
+
| Some((_, keyPath)) =>
|
|
54
|
+
obj->Dict.set("x-reventless-drillTargetKey", JSON.Encode.string(keyPath))
|
|
55
|
+
| None => ()
|
|
56
|
+
}
|
|
57
|
+
if spec.collapsed->Array.includes(fieldName) {
|
|
58
|
+
obj->Dict.set("x-reventless-collapsed", JSON.Encode.bool(true))
|
|
59
|
+
}
|
|
60
|
+
if spec.scan->Array.includes(fieldName) {
|
|
61
|
+
obj->Dict.set("x-reventless-scan", JSON.Encode.bool(true))
|
|
62
|
+
}
|
|
63
|
+
if spec.scanSort->Array.includes(fieldName) {
|
|
64
|
+
obj->Dict.set("x-reventless-scanSort", JSON.Encode.bool(true))
|
|
65
|
+
}
|
|
66
|
+
JSON.Encode.object(obj)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ── SchemaType → JSON Schema ─────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
let rec fromSchemaType = (st: SchemaType.schemaType): JSON.t =>
|
|
72
|
+
switch st {
|
|
73
|
+
| ScalarString => jsonObject([("type", str("string"))])
|
|
74
|
+
| ScalarNumber => jsonObject([("type", str("number"))])
|
|
75
|
+
| ScalarBoolean => jsonObject([("type", str("boolean"))])
|
|
76
|
+
| ScalarBigInt => jsonObject([("type", str("integer"))])
|
|
77
|
+
| EntityId => jsonObject([("type", str("string")), ("format", str("uuid"))])
|
|
78
|
+
| Nullable(inner) =>
|
|
79
|
+
let innerSchema = fromSchemaType(inner)
|
|
80
|
+
jsonObject([("oneOf", JSON.Encode.array([innerSchema, jsonObject([("type", str("null"))])]))])
|
|
81
|
+
| ArrayOf(item) =>
|
|
82
|
+
jsonObject([("type", str("array")), ("items", fromSchemaType(item))])
|
|
83
|
+
| ObjectRef(_, fields) => objectRefToJsonSchema(fields)
|
|
84
|
+
| Enum(_, values) =>
|
|
85
|
+
jsonObject([
|
|
86
|
+
("type", str("string")),
|
|
87
|
+
("enum", JSON.Encode.array(values->Array.map(JSON.Encode.string))),
|
|
88
|
+
])
|
|
89
|
+
| Unknown => jsonObject([("type", str("string"))])
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
and objectRefToJsonSchema = (
|
|
93
|
+
~annotations: option<Reventless.StateAnnotations.stateAnnotationSpec>=?,
|
|
94
|
+
fields: dict<SchemaType.schemaType>,
|
|
95
|
+
): JSON.t => {
|
|
96
|
+
let props = Dict.make()
|
|
97
|
+
let required: array<string> = []
|
|
98
|
+
fields
|
|
99
|
+
->Dict.toArray
|
|
100
|
+
->Array.forEach(((fieldName, fieldType)) => {
|
|
101
|
+
let baseSchema = fromSchemaType(fieldType)
|
|
102
|
+
let withAnnotations = switch annotations {
|
|
103
|
+
| Some(spec) => mergeAnnotations(baseSchema, fieldName, spec)
|
|
104
|
+
| None => baseSchema
|
|
105
|
+
}
|
|
106
|
+
props->Dict.set(fieldName, withAnnotations)
|
|
107
|
+
required->Array.push(fieldName)
|
|
108
|
+
})
|
|
109
|
+
let entries: array<(string, JSON.t)> = [
|
|
110
|
+
("type", str("object")),
|
|
111
|
+
("properties", JSON.Encode.object(props)),
|
|
112
|
+
]
|
|
113
|
+
if required->Array.length > 0 {
|
|
114
|
+
entries->Array.push(("required", JSON.Encode.array(required->Array.map(JSON.Encode.string))))
|
|
115
|
+
}
|
|
116
|
+
jsonObject(entries)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ── Public API (sury → JSON Schema via SchemaType) ───────────────────────
|
|
120
|
+
|
|
121
|
+
let deriveObjectSchema = (schema: S.t<unknown>): JSON.t =>
|
|
122
|
+
switch SchemaType.fromSuryObject(~typeName="", schema) {
|
|
123
|
+
| Some(fields) =>
|
|
124
|
+
let annotations = Reventless.StateAnnotations.getSpec(schema)
|
|
125
|
+
let objSchema = objectRefToJsonSchema(~annotations?, fields)
|
|
126
|
+
// Surface component-level visibility on the top-level object schema.
|
|
127
|
+
// Omitted entirely for the default `Public` (None) so schemas stay compact.
|
|
128
|
+
switch annotations {
|
|
129
|
+
| Some({visibility: Some(name)}) =>
|
|
130
|
+
switch objSchema->JSON.Decode.object {
|
|
131
|
+
| Some(obj) =>
|
|
132
|
+
obj->Dict.set("x-reventless-visibility", JSON.Encode.string(name))
|
|
133
|
+
JSON.Encode.object(obj)
|
|
134
|
+
| None => objSchema
|
|
135
|
+
}
|
|
136
|
+
| _ => objSchema
|
|
137
|
+
}
|
|
138
|
+
| None => jsonObject([("type", str("object"))])
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let toJsonSchema = (schema: S.t<unknown>): JSON.t =>
|
|
142
|
+
fromSchemaType(SchemaType.fromSury(~parentName="", ~fieldName="", schema))
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_JSON from "@rescript/runtime/lib/es6/Stdlib_JSON.js";
|
|
4
|
+
import * as SchemaType$ReventlessCore from "./SchemaType.res.mjs";
|
|
5
|
+
import * as StateAnnotations$Reventless from "@reventlessdev/reventless-spec/src/components/StateAnnotations.res.mjs";
|
|
6
|
+
|
|
7
|
+
function str(prim) {
|
|
8
|
+
return prim;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function jsonObject(entries) {
|
|
12
|
+
return Object.fromEntries(entries);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function mergeAnnotations(fieldSchema, fieldName, spec) {
|
|
16
|
+
let obj = Stdlib_JSON.Decode.object(fieldSchema);
|
|
17
|
+
if (obj === undefined) {
|
|
18
|
+
return fieldSchema;
|
|
19
|
+
}
|
|
20
|
+
if (spec.ids.includes(fieldName)) {
|
|
21
|
+
obj["x-reventless-id"] = true;
|
|
22
|
+
}
|
|
23
|
+
if (spec.compositeIds.includes(fieldName)) {
|
|
24
|
+
obj["x-reventless-compositeId"] = true;
|
|
25
|
+
}
|
|
26
|
+
if (spec.subIds.includes(fieldName)) {
|
|
27
|
+
obj["x-reventless-subId"] = true;
|
|
28
|
+
}
|
|
29
|
+
if (spec.compositeSubIds.includes(fieldName)) {
|
|
30
|
+
obj["x-reventless-compositeSubId"] = true;
|
|
31
|
+
}
|
|
32
|
+
let match = spec.indexes.find(param => param[0] === fieldName);
|
|
33
|
+
if (match !== undefined) {
|
|
34
|
+
let indexName = match[1];
|
|
35
|
+
let value = indexName === "" ? true : indexName;
|
|
36
|
+
obj["x-reventless-index"] = value;
|
|
37
|
+
}
|
|
38
|
+
if (spec.hidden.includes(fieldName)) {
|
|
39
|
+
obj["x-reventless-hidden"] = true;
|
|
40
|
+
}
|
|
41
|
+
if (spec.summary.includes(fieldName)) {
|
|
42
|
+
obj["x-reventless-summary"] = true;
|
|
43
|
+
}
|
|
44
|
+
let match$1 = spec.drillTargets.find(param => param[0] === fieldName);
|
|
45
|
+
if (match$1 !== undefined) {
|
|
46
|
+
obj["x-reventless-drillTarget"] = match$1[1];
|
|
47
|
+
}
|
|
48
|
+
let match$2 = spec.drillTargetKeys.find(param => param[0] === fieldName);
|
|
49
|
+
if (match$2 !== undefined) {
|
|
50
|
+
obj["x-reventless-drillTargetKey"] = match$2[1];
|
|
51
|
+
}
|
|
52
|
+
if (spec.collapsed.includes(fieldName)) {
|
|
53
|
+
obj["x-reventless-collapsed"] = true;
|
|
54
|
+
}
|
|
55
|
+
if (spec.scan.includes(fieldName)) {
|
|
56
|
+
obj["x-reventless-scan"] = true;
|
|
57
|
+
}
|
|
58
|
+
if (spec.scanSort.includes(fieldName)) {
|
|
59
|
+
obj["x-reventless-scanSort"] = true;
|
|
60
|
+
}
|
|
61
|
+
return obj;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function fromSchemaType(st) {
|
|
65
|
+
if (typeof st !== "object") {
|
|
66
|
+
switch (st) {
|
|
67
|
+
case "ScalarNumber" :
|
|
68
|
+
return Object.fromEntries([[
|
|
69
|
+
"type",
|
|
70
|
+
"number"
|
|
71
|
+
]]);
|
|
72
|
+
case "ScalarBoolean" :
|
|
73
|
+
return Object.fromEntries([[
|
|
74
|
+
"type",
|
|
75
|
+
"boolean"
|
|
76
|
+
]]);
|
|
77
|
+
case "ScalarBigInt" :
|
|
78
|
+
return Object.fromEntries([[
|
|
79
|
+
"type",
|
|
80
|
+
"integer"
|
|
81
|
+
]]);
|
|
82
|
+
case "EntityId" :
|
|
83
|
+
return Object.fromEntries([
|
|
84
|
+
[
|
|
85
|
+
"type",
|
|
86
|
+
"string"
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
"format",
|
|
90
|
+
"uuid"
|
|
91
|
+
]
|
|
92
|
+
]);
|
|
93
|
+
case "ScalarString" :
|
|
94
|
+
case "Unknown" :
|
|
95
|
+
return Object.fromEntries([[
|
|
96
|
+
"type",
|
|
97
|
+
"string"
|
|
98
|
+
]]);
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
switch (st.TAG) {
|
|
102
|
+
case "Nullable" :
|
|
103
|
+
let innerSchema = fromSchemaType(st._0);
|
|
104
|
+
return Object.fromEntries([[
|
|
105
|
+
"oneOf",
|
|
106
|
+
[
|
|
107
|
+
innerSchema,
|
|
108
|
+
Object.fromEntries([[
|
|
109
|
+
"type",
|
|
110
|
+
"null"
|
|
111
|
+
]])
|
|
112
|
+
]
|
|
113
|
+
]]);
|
|
114
|
+
case "ArrayOf" :
|
|
115
|
+
return Object.fromEntries([
|
|
116
|
+
[
|
|
117
|
+
"type",
|
|
118
|
+
"array"
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
"items",
|
|
122
|
+
fromSchemaType(st._0)
|
|
123
|
+
]
|
|
124
|
+
]);
|
|
125
|
+
case "ObjectRef" :
|
|
126
|
+
return objectRefToJsonSchema(undefined, st._1);
|
|
127
|
+
case "Enum" :
|
|
128
|
+
return Object.fromEntries([
|
|
129
|
+
[
|
|
130
|
+
"type",
|
|
131
|
+
"string"
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"enum",
|
|
135
|
+
st._1.map(prim => prim)
|
|
136
|
+
]
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function objectRefToJsonSchema(annotations, fields) {
|
|
143
|
+
let props = {};
|
|
144
|
+
let required = [];
|
|
145
|
+
Object.entries(fields).forEach(param => {
|
|
146
|
+
let fieldName = param[0];
|
|
147
|
+
let baseSchema = fromSchemaType(param[1]);
|
|
148
|
+
let withAnnotations = annotations !== undefined ? mergeAnnotations(baseSchema, fieldName, annotations) : baseSchema;
|
|
149
|
+
props[fieldName] = withAnnotations;
|
|
150
|
+
required.push(fieldName);
|
|
151
|
+
});
|
|
152
|
+
let entries = [
|
|
153
|
+
[
|
|
154
|
+
"type",
|
|
155
|
+
"object"
|
|
156
|
+
],
|
|
157
|
+
[
|
|
158
|
+
"properties",
|
|
159
|
+
props
|
|
160
|
+
]
|
|
161
|
+
];
|
|
162
|
+
if (required.length !== 0) {
|
|
163
|
+
entries.push([
|
|
164
|
+
"required",
|
|
165
|
+
required.map(prim => prim)
|
|
166
|
+
]);
|
|
167
|
+
}
|
|
168
|
+
return Object.fromEntries(entries);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function deriveObjectSchema(schema) {
|
|
172
|
+
let fields = SchemaType$ReventlessCore.fromSuryObject("", schema);
|
|
173
|
+
if (fields === undefined) {
|
|
174
|
+
return Object.fromEntries([[
|
|
175
|
+
"type",
|
|
176
|
+
"object"
|
|
177
|
+
]]);
|
|
178
|
+
}
|
|
179
|
+
let annotations = StateAnnotations$Reventless.getSpec(schema);
|
|
180
|
+
let objSchema = objectRefToJsonSchema(annotations, fields);
|
|
181
|
+
if (annotations === undefined) {
|
|
182
|
+
return objSchema;
|
|
183
|
+
}
|
|
184
|
+
let name = annotations.visibility;
|
|
185
|
+
if (name === undefined) {
|
|
186
|
+
return objSchema;
|
|
187
|
+
}
|
|
188
|
+
let obj = Stdlib_JSON.Decode.object(objSchema);
|
|
189
|
+
if (obj !== undefined) {
|
|
190
|
+
obj["x-reventless-visibility"] = name;
|
|
191
|
+
return obj;
|
|
192
|
+
} else {
|
|
193
|
+
return objSchema;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function toJsonSchema(schema) {
|
|
198
|
+
return fromSchemaType(SchemaType$ReventlessCore.fromSury("", "", schema));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export {
|
|
202
|
+
str,
|
|
203
|
+
jsonObject,
|
|
204
|
+
mergeAnnotations,
|
|
205
|
+
fromSchemaType,
|
|
206
|
+
objectRefToJsonSchema,
|
|
207
|
+
deriveObjectSchema,
|
|
208
|
+
toJsonSchema,
|
|
209
|
+
}
|
|
210
|
+
/* SchemaType-ReventlessCore Not a pure module */
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
let componentType = ComponentType.AutomationSlice
|
|
2
|
+
|
|
3
|
+
type t = ReventlessInfra.AutomationSlice.t
|
|
4
|
+
type outputs = ReventlessInfra.AutomationSlice.outputs
|
|
5
|
+
type operations = ReventlessInfra.AutomationSlice.operations
|
|
6
|
+
type component = Component.t<t, outputs, operations>
|
|
7
|
+
|
|
8
|
+
let toResolvedOutputs = (
|
|
9
|
+
outputs: outputs,
|
|
10
|
+
): Pulumi.Output.t<ReventlessInterop.AutomationSlice.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.AutomationSlice.resolvedOutputs = {
|
|
18
|
+
resources: resources,
|
|
19
|
+
queryDb: {resources: queryDbResources},
|
|
20
|
+
}
|
|
21
|
+
resolved
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
module type T = {
|
|
25
|
+
module Spec: Reventless.AutomationSlice.Spec
|
|
26
|
+
module Automation: Reventless.AutomationSlice.Automation with module Spec := Spec
|
|
27
|
+
type component = Component.t<t, outputs, operations>
|
|
28
|
+
let queryDbName: string
|
|
29
|
+
/** Names of all sources this slice consumes (deduplicated). Used by
|
|
30
|
+
`Plugin_Builder` for the source-name fail-fast assembly check. */
|
|
31
|
+
let sourceNames: array<string>
|
|
32
|
+
|
|
33
|
+
let make: (
|
|
34
|
+
~allEventTopics: EventTopic.allOutputs,
|
|
35
|
+
~publishJsons: Pulumi.Output.t<CommandTopic.publishJsons>,
|
|
36
|
+
~context: Reventless.AutomationSlice.context,
|
|
37
|
+
~opts: Pulumi.ComponentResource.options=?,
|
|
38
|
+
) => component
|
|
39
|
+
}
|
|
@@ -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 = "AutomationSlice";
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
componentType,
|
|
22
|
+
toResolvedOutputs,
|
|
23
|
+
}
|
|
24
|
+
/* @pulumi/pulumi Not a pure module */
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// AutomationSlice builder — creates the TODO list QueryDb, EventCollector,
|
|
2
|
+
// and wires the event handler (Phase 1 + Phase 2) plus exposes processPending.
|
|
3
|
+
//
|
|
4
|
+
// Plan 04: subscribes to events from any combination of Aggregate EventTopics
|
|
5
|
+
// and DCB EventLog topics declared by the slice's `Mappings.mappings`. The
|
|
6
|
+
// caller passes `~allEventTopics` (the plugin-wide topic dict) — the slice
|
|
7
|
+
// filters down to topics matching its mappings' source names.
|
|
8
|
+
//
|
|
9
|
+
// Follows the StateViewSlice_Builder pattern for adapter injection.
|
|
10
|
+
|
|
11
|
+
module Make = (
|
|
12
|
+
RuntimeEnvironment: Runtime.Environment,
|
|
13
|
+
QueryDbStorage: QueryDb_Adapter.Storage,
|
|
14
|
+
QueryDbResolvers: QueryDb_Adapter.Resolvers
|
|
15
|
+
with type api = QueryDbStorage.api
|
|
16
|
+
and type role = QueryDbStorage.role,
|
|
17
|
+
EventCollectorChannel: EventCollector_Adapter.Channel
|
|
18
|
+
with type runtimeParts = RuntimeEnvironment.parts,
|
|
19
|
+
EventCollectorRuntimeBuilder: EventCollectorRuntime_Builder.T
|
|
20
|
+
with module EventCollectorChannel = EventCollectorChannel,
|
|
21
|
+
Api: {
|
|
22
|
+
let api: unit => QueryDbStorage.api
|
|
23
|
+
let apiRole: unit => QueryDbStorage.role
|
|
24
|
+
},
|
|
25
|
+
) => {
|
|
26
|
+
let finish = EventCollectorRuntimeBuilder.finish
|
|
27
|
+
module Make = (
|
|
28
|
+
Spec: Reventless.AutomationSlice.Spec,
|
|
29
|
+
Automation: Reventless.AutomationSlice.Automation with module Spec := Spec,
|
|
30
|
+
): (AutomationSlice.T with module Spec = Spec) => {
|
|
31
|
+
module Spec = Spec
|
|
32
|
+
module Automation = Automation
|
|
33
|
+
type component = AutomationSlice.component
|
|
34
|
+
|
|
35
|
+
module Callback = AutomationSlice_Callback.Make(Spec, Automation)
|
|
36
|
+
|
|
37
|
+
let queryDbName = Spec.name ++ "Todo"
|
|
38
|
+
|
|
39
|
+
// Names of all sources this slice subscribes to (deduplicated). Multiple
|
|
40
|
+
// mappings can share a source name (e.g., two mappings reading the same
|
|
41
|
+
// Aggregate's events for different reasons).
|
|
42
|
+
let sourceNames =
|
|
43
|
+
Automation.mappings
|
|
44
|
+
->Array.map((module(M: Automation.Mapping)) => M.sourceName)
|
|
45
|
+
->Belt.Set.String.fromArray
|
|
46
|
+
->Belt.Set.String.toArray
|
|
47
|
+
|
|
48
|
+
// QueryDb for TODO list — stores todoRow keyed by string ID
|
|
49
|
+
module TodoQueryDbSpec = {
|
|
50
|
+
module Id = Reventless.Id.String
|
|
51
|
+
let name = queryDbName
|
|
52
|
+
let moduleUrl: string = %raw(`import.meta.url`)
|
|
53
|
+
type state = AutomationSlice_Callback.todoRow
|
|
54
|
+
let stateSchema = AutomationSlice_Callback.todoRowSchema
|
|
55
|
+
let config = Reventless.ReadModel.config()
|
|
56
|
+
let subIdConfig: option<Reventless.ReadModel.subIdConfig<state>> = None
|
|
57
|
+
let authorization: Reventless.Authorization.permission = AllowAuthenticated
|
|
58
|
+
let visibility: Reventless.Visibility.t = Public
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module SpecificQueryDb = QueryDb_Builder.Make(TodoQueryDbSpec, QueryDbStorage, QueryDbResolvers)
|
|
62
|
+
module SpecificEventCollector = EventCollector_Builder.Make(
|
|
63
|
+
RuntimeEnvironment,
|
|
64
|
+
EventCollectorChannel,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
let syncToQueryDb = async (queryDbOps: SpecificQueryDb.operations) => {
|
|
68
|
+
let items = Callback.todoItems->Dict.toArray
|
|
69
|
+
let _ = await items->Array.reduce(Promise.resolve(), async (prev, (id, row)) => {
|
|
70
|
+
let _ = await prev
|
|
71
|
+
let _ = await queryDbOps.save(
|
|
72
|
+
id->Reventless.Id.String.makeFromString,
|
|
73
|
+
row,
|
|
74
|
+
QueryDb.Overwrite,
|
|
75
|
+
None,
|
|
76
|
+
)
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let construct = (
|
|
81
|
+
~allEventTopics: EventTopic.allOutputs,
|
|
82
|
+
~publishJsons,
|
|
83
|
+
~context: Reventless.AutomationSlice.context,
|
|
84
|
+
self,
|
|
85
|
+
_name,
|
|
86
|
+
) => {
|
|
87
|
+
let opts = {Pulumi.ComponentResource.parent: self->Component.toPulumiResource}
|
|
88
|
+
|
|
89
|
+
let queryDb = SpecificQueryDb.make(~api=Api.api(), ~apiRole=Api.apiRole(), ~opts)
|
|
90
|
+
|
|
91
|
+
// Fail-fast: every Mapping.sourceName must resolve to a topic in
|
|
92
|
+
// `allEventTopics`. Catches Aggregate-name typos and DCB-source-name
|
|
93
|
+
// typos (e.g. "FooDcb" instead of "FooDcbEventLog"). Without this check
|
|
94
|
+
// `EventTopic.filter` silently drops the unknown source, the
|
|
95
|
+
// EventCollector subscribes to nothing, and the slice runs on no events
|
|
96
|
+
// — which surfaces as "TODO list never populates" much later.
|
|
97
|
+
sourceNames->Array.forEach(sourceName =>
|
|
98
|
+
if !(allEventTopics->Dict.has(sourceName)) {
|
|
99
|
+
let availableNames =
|
|
100
|
+
allEventTopics->Dict.keysToArray->Array.toSorted(String.compare)->Array.join(", ")
|
|
101
|
+
JsError.throwWithMessage(
|
|
102
|
+
`AutomationSlice "${Spec.name}" has a Mapping with sourceName "${sourceName}", ` ++
|
|
103
|
+
`but no EventTopic with that key exists in allEventTopics. ` ++
|
|
104
|
+
`Available source names: [${availableNames}]. ` ++
|
|
105
|
+
`Check Mapping.Make's first arg matches an Aggregate Spec.name or a DCB ` ++
|
|
106
|
+
`source name (typically "<pluginName>DcbEventLog").`,
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
// Filter to only the topics this slice consumes from.
|
|
112
|
+
let sourceSet = sourceNames->Belt.Set.String.fromArray
|
|
113
|
+
let eventTopics = allEventTopics->EventTopic.filter(sourceSet)
|
|
114
|
+
|
|
115
|
+
// Build the EventCollector inside an Output.all2 so both `queryDbOps`
|
|
116
|
+
// and `publishJsonsFn` are captured in the same closure. The
|
|
117
|
+
// jsonEventsHandler then has direct access to `publishJsonsFn` —
|
|
118
|
+
// avoids racing a side-effect-only `publishJsons.apply` against the
|
|
119
|
+
// first event arrival (which silently dropped Phase 2 in the previous
|
|
120
|
+
// shape).
|
|
121
|
+
let eventCollector =
|
|
122
|
+
(queryDb->Component.operations, publishJsons)
|
|
123
|
+
->Pulumi.Output.all2
|
|
124
|
+
->Pulumi.Output.apply(((queryDbOps, publishJsonsFn)) => {
|
|
125
|
+
let ec = SpecificEventCollector.make(~name=Spec.name, ~eventTopics, ~opts)
|
|
126
|
+
|
|
127
|
+
let jsonEventsHandler: EventCollector.jsonEventsHandler = stream =>
|
|
128
|
+
stream
|
|
129
|
+
->Stream.runCollect
|
|
130
|
+
->Effect.flatMap(jsons =>
|
|
131
|
+
Effect.promise(
|
|
132
|
+
async () => {
|
|
133
|
+
// Phase 1: per-source decode + collect/resolve, threaded with context
|
|
134
|
+
Callback.phase1(jsons, context)
|
|
135
|
+
// Sync the post-phase-1 TODO state so consumers awaiting the
|
|
136
|
+
// originating publishEvent observe Pending rows immediately.
|
|
137
|
+
await syncToQueryDb(queryDbOps)
|
|
138
|
+
// Phase 2 must NOT be awaited here. Phase 2 publishes commands
|
|
139
|
+
// whose downstream events get fanned out by the bus to all
|
|
140
|
+
// subscribers of this same topic — including this very fiber.
|
|
141
|
+
// Awaiting would self-deadlock: the bus's allDone for the
|
|
142
|
+
// inner event needs this fiber to dequeue it, but the fiber
|
|
143
|
+
// is still inside this handler. Detaching mirrors the
|
|
144
|
+
// fire-and-forget shape LocalBus already uses for
|
|
145
|
+
// cross-plugin EP→Extension routing.
|
|
146
|
+
let _ =
|
|
147
|
+
Callback.phase2(publishJsonsFn)
|
|
148
|
+
->Promise.then(() => syncToQueryDb(queryDbOps))
|
|
149
|
+
->Promise.catch(exn => {
|
|
150
|
+
let errMsg =
|
|
151
|
+
exn
|
|
152
|
+
->JsExn.fromException
|
|
153
|
+
->Option.flatMap(JsExn.message)
|
|
154
|
+
->Option.getOr("unknown")
|
|
155
|
+
EffectLogger.logError(
|
|
156
|
+
~comp=`AutomationSlice(${Spec.name})`,
|
|
157
|
+
`detached phase 2 error: ${errMsg}`,
|
|
158
|
+
)->Effect.runSync
|
|
159
|
+
Promise.resolve()
|
|
160
|
+
})
|
|
161
|
+
},
|
|
162
|
+
)
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
let handler = SpecificEventCollector.makeHandler(~eventCollector=ec, ~jsonEventsHandler)
|
|
166
|
+
let resources = (queryDb->Component.outputs).resources
|
|
167
|
+
ec->EventCollectorRuntimeBuilder.forEventCollector(
|
|
168
|
+
~handler,
|
|
169
|
+
~eventTopics,
|
|
170
|
+
~resources,
|
|
171
|
+
)
|
|
172
|
+
ec
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
self->Component.setOperations(
|
|
176
|
+
(eventCollector->Pulumi.Output.flatMap(ec => ec->Component.operations), publishJsons)
|
|
177
|
+
->Pulumi.Output.all2
|
|
178
|
+
->Pulumi.Output.apply(((ecOps, publishJsonsFn)) => {
|
|
179
|
+
let ops: AutomationSlice.operations = {
|
|
180
|
+
enqueueEvent: ecOps.enqueueEvent,
|
|
181
|
+
processPending: async () => await Callback.phase2(publishJsonsFn),
|
|
182
|
+
}
|
|
183
|
+
ops
|
|
184
|
+
}),
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
// Outputs.resources are aggregated from all subscribed event topics.
|
|
188
|
+
let aggregatedResources =
|
|
189
|
+
eventTopics
|
|
190
|
+
->Dict.valuesToArray
|
|
191
|
+
->Array.flatMap((t: EventTopic.outputs) => t.resources)
|
|
192
|
+
let outputs: AutomationSlice.outputs = {
|
|
193
|
+
resources: aggregatedResources,
|
|
194
|
+
queryDb: queryDb->Component.outputs,
|
|
195
|
+
}
|
|
196
|
+
self->Component.setOutputs(outputs)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let make = (~allEventTopics, ~publishJsons, ~context, ~opts=?): AutomationSlice.component =>
|
|
200
|
+
Component.make(
|
|
201
|
+
~componentType=AutomationSlice.componentType->ComponentType.toString,
|
|
202
|
+
~name=Spec.name,
|
|
203
|
+
~construct=construct(~allEventTopics, ~publishJsons, ~context, ...),
|
|
204
|
+
~opts,
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
}
|