@reventlessdev/reventless-aws 3.0.0-alpha.167
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 +1564 -0
- package/README.md +62 -0
- package/__mocks__/emptyModule.js +1 -0
- package/all-licenses.csv +565 -0
- package/docker-compose.dynamodb-local.yml +12 -0
- package/jest.setup.cjs +5 -0
- package/licenses-analysis.ods +0 -0
- package/package.json +73 -0
- package/rescript.json +39 -0
- package/reventless-licenses-analysis.xls +0 -0
- package/scripts/run-integration-tests.sh +43 -0
- package/src/Platform.res +1940 -0
- package/src/Platform.res.mjs +2281 -0
- package/src/Platform_Casts.res +106 -0
- package/src/Platform_Casts.res.mjs +13 -0
- package/src/Platform_Stack.res +153 -0
- package/src/Platform_Stack.res.mjs +121 -0
- package/src/Types.res +39 -0
- package/src/Types.res.mjs +21 -0
- package/src/adapter/AWS.res +96 -0
- package/src/adapter/AWS.res.mjs +186 -0
- package/src/adapter/AWS_Tags.res +16 -0
- package/src/adapter/AWS_Tags.res.mjs +48 -0
- package/src/adapter/Adapter_Helpers.res +19 -0
- package/src/adapter/Adapter_Helpers.res.mjs +37 -0
- package/src/adapter/Api/AppSync_EventsApi.res +172 -0
- package/src/adapter/Api/AppSync_EventsApi.res.mjs +96 -0
- package/src/adapter/Api/AppSync_Resolver_Native.res +93 -0
- package/src/adapter/Api/AppSync_Resolver_Native.res.mjs +67 -0
- package/src/adapter/Api/AppSync_Resolver_Retrying.res +653 -0
- package/src/adapter/Api/AppSync_Resolver_Retrying.res.mjs +462 -0
- package/src/adapter/Api/CommandSubscriptionResolvers_AppSync.res +29 -0
- package/src/adapter/Api/CommandSubscriptionResolvers_AppSync.res.mjs +15 -0
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda.res +238 -0
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda.res.mjs +179 -0
- package/src/adapter/Api/Platform_UIFragments_Lambda.res +229 -0
- package/src/adapter/Api/Platform_UIFragments_Lambda.res.mjs +245 -0
- package/src/adapter/Auth/Auth_Cognito.res +209 -0
- package/src/adapter/Auth/Auth_Cognito.res.mjs +135 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers.res +2 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers.res.mjs +12 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync.res +251 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync.res.mjs +126 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync_NoOp.res +20 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync_NoOp.res.mjs +23 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync_Runtime.res +1 -0
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync_Runtime.res.mjs +11 -0
- package/src/adapter/CommandGenerator/InboundTranslationResolvers_AppSync.res +95 -0
- package/src/adapter/CommandGenerator/InboundTranslationResolvers_AppSync.res.mjs +50 -0
- package/src/adapter/CommandTopic/CommandTopicChannel.res +6 -0
- package/src/adapter/CommandTopic/CommandTopicChannel.res.mjs +21 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_Helpers.res +196 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_Helpers.res.mjs +145 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS.res +91 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS.res.mjs +74 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Async.res +69 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Async.res.mjs +62 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_FIFO.res +60 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_FIFO.res.mjs +56 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Runtime.res +73 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Runtime.res.mjs +65 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Sync.res +88 -0
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Sync.res.mjs +76 -0
- package/src/adapter/CommandTopic/CommandTopicRemoteChannel.res +1 -0
- package/src/adapter/CommandTopic/CommandTopicRemoteChannel.res.mjs +9 -0
- package/src/adapter/CommandTopic/CommandTopicRemoteChannel_SQS.res +7 -0
- package/src/adapter/CommandTopic/CommandTopicRemoteChannel_SQS.res.mjs +17 -0
- package/src/adapter/Counter/CounterHandler_DynamoDbStream.res +103 -0
- package/src/adapter/Counter/CounterHandler_DynamoDbStream.res.mjs +68 -0
- package/src/adapter/Counter/CounterHandler_DynamoDbStream_Runtime.res +107 -0
- package/src/adapter/Counter/CounterHandler_DynamoDbStream_Runtime.res.mjs +145 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage.res +1 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage.res.mjs +9 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb.res +84 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb.res.mjs +52 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb_Runtime.res +1436 -0
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb_Runtime.res.mjs +1143 -0
- package/src/adapter/EventCollector/EventCollectorChannel.res +6 -0
- package/src/adapter/EventCollector/EventCollectorChannel.res.mjs +21 -0
- package/src/adapter/EventCollector/EventCollectorChannel_DynamoDbStream.res +63 -0
- package/src/adapter/EventCollector/EventCollectorChannel_DynamoDbStream.res.mjs +56 -0
- package/src/adapter/EventCollector/EventCollectorChannel_DynamoDbStream_Runtime.res +20 -0
- package/src/adapter/EventCollector/EventCollectorChannel_DynamoDbStream_Runtime.res.mjs +32 -0
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res +266 -0
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res.mjs +166 -0
- package/src/adapter/EventCollector/EventCollectorChannel_SQS.res +81 -0
- package/src/adapter/EventCollector/EventCollectorChannel_SQS.res.mjs +54 -0
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_FIFO.res +59 -0
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_FIFO.res.mjs +45 -0
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_Runtime.res +91 -0
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_Runtime.res.mjs +89 -0
- package/src/adapter/EventLog/EventLogStorage.res +3 -0
- package/src/adapter/EventLog/EventLogStorage.res.mjs +15 -0
- package/src/adapter/EventLog/EventLogStorage_DynamoDb.res +25 -0
- package/src/adapter/EventLog/EventLogStorage_DynamoDb.res.mjs +34 -0
- package/src/adapter/EventLog/EventLogStorage_DynamoDbStream.res +26 -0
- package/src/adapter/EventLog/EventLogStorage_DynamoDbStream.res.mjs +35 -0
- package/src/adapter/EventLog/EventLogStorage_DynamoDb_Runtime.res +121 -0
- package/src/adapter/EventLog/EventLogStorage_DynamoDb_Runtime.res.mjs +137 -0
- package/src/adapter/EventLogSubscription/EventLogSubscription_AppSync.res +265 -0
- package/src/adapter/EventLogSubscription/EventLogSubscription_AppSync.res.mjs +185 -0
- package/src/adapter/EventTopic/EventTopicPublisher.res +6 -0
- package/src/adapter/EventTopic/EventTopicPublisher.res.mjs +21 -0
- package/src/adapter/EventTopic/EventTopicPublisher_DynamoDbStream.res +25 -0
- package/src/adapter/EventTopic/EventTopicPublisher_DynamoDbStream.res.mjs +28 -0
- package/src/adapter/EventTopic/EventTopicPublisher_SNS.res +40 -0
- package/src/adapter/EventTopic/EventTopicPublisher_SNS.res.mjs +39 -0
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_FIFO.res +39 -0
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_FIFO.res.mjs +38 -0
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_Runtime.res +5 -0
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_Runtime.res.mjs +18 -0
- package/src/adapter/Mcp/MCP_Lambda.res +502 -0
- package/src/adapter/Mcp/MCP_Lambda.res.mjs +289 -0
- package/src/adapter/QueryDb/NodeResolver_AppSync.res +71 -0
- package/src/adapter/QueryDb/NodeResolver_AppSync.res.mjs +44 -0
- package/src/adapter/QueryDb/QueryDbResolvers.res +2 -0
- package/src/adapter/QueryDb/QueryDbResolvers.res.mjs +12 -0
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res +434 -0
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res.mjs +243 -0
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync_NoOp.res +21 -0
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync_NoOp.res.mjs +14 -0
- package/src/adapter/QueryDb/QueryDbResolvers_NoOp.res +21 -0
- package/src/adapter/QueryDb/QueryDbResolvers_NoOp.res.mjs +14 -0
- package/src/adapter/QueryDb/QueryDbStorage.res +5 -0
- package/src/adapter/QueryDb/QueryDbStorage.res.mjs +18 -0
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb.res +115 -0
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb.res.mjs +100 -0
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDbStream.res +52 -0
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDbStream.res.mjs +38 -0
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb_Runtime.res +271 -0
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb_Runtime.res.mjs +306 -0
- package/src/adapter/QueryDb/QueryInterceptor_Lambda.res +20 -0
- package/src/adapter/QueryDb/QueryInterceptor_Lambda.res.mjs +22 -0
- package/src/adapter/QueryEngine/QueryEngine.res +3 -0
- package/src/adapter/QueryEngine/QueryEngine.res.mjs +12 -0
- package/src/adapter/QueryEngine/QueryEngine_DynamoDb.res +184 -0
- package/src/adapter/QueryEngine/QueryEngine_DynamoDb.res.mjs +221 -0
- package/src/adapter/Runtime/AdminEventCollectorEntryPoint.mjs +879 -0
- package/src/adapter/Runtime/AggregateEntryPoint.mjs +313 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro.res +327 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro.res.mjs +239 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro_Async.res +331 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro_Async.res.mjs +240 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate.res +247 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate.res.mjs +185 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate_Async.res +244 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate_Async.res.mjs +185 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res +347 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res.mjs +244 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single_Async.res +285 -0
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single_Async.res.mjs +212 -0
- package/src/adapter/Runtime/AutomationSliceEntryPoint.mjs +124 -0
- package/src/adapter/Runtime/AutomationSliceRuntime_Builder_Single.res +187 -0
- package/src/adapter/Runtime/AutomationSliceRuntime_Builder_Single.res.mjs +147 -0
- package/src/adapter/Runtime/CounterEntryPoint.mjs +91 -0
- package/src/adapter/Runtime/DcbCommandTopicEntryPoint.mjs +265 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_PerEventCollector.res +122 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_PerEventCollector.res.mjs +89 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res +193 -0
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res.mjs +137 -0
- package/src/adapter/Runtime/EventMapperEntryPoint.mjs +97 -0
- package/src/adapter/Runtime/ExtensionPointEntryPoint.mjs +101 -0
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder_PerExtensionPoint.res +83 -0
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder_PerExtensionPoint.res.mjs +59 -0
- package/src/adapter/Runtime/HandlerFactoryHelpers.mjs +142 -0
- package/src/adapter/Runtime/HeartbeatEntryPoint.mjs +38 -0
- package/src/adapter/Runtime/PluginExtensionPointEntryPoint.mjs +137 -0
- package/src/adapter/Runtime/ReadModelEntryPoint.mjs +143 -0
- package/src/adapter/Runtime/RuntimeEnvironment.res +1 -0
- package/src/adapter/Runtime/RuntimeEnvironment.res.mjs +9 -0
- package/src/adapter/Runtime/RuntimeEnvironment_Lambda.res +254 -0
- package/src/adapter/Runtime/RuntimeEnvironment_Lambda.res.mjs +169 -0
- package/src/adapter/Runtime/SideEffectEntryPoint.mjs +81 -0
- package/src/adapter/Runtime/SideEffectHandlerRuntime_Builder_Single.res +178 -0
- package/src/adapter/Runtime/SideEffectHandlerRuntime_Builder_Single.res.mjs +129 -0
- package/src/adapter/Runtime/StateChangeSliceRuntime_Builder_Single.res +166 -0
- package/src/adapter/Runtime/StateChangeSliceRuntime_Builder_Single.res.mjs +87 -0
- package/src/adapter/Runtime/StateViewSliceEntryPoint.mjs +136 -0
- package/src/adapter/Runtime/StateViewSliceRuntime_Builder_Single.res +344 -0
- package/src/adapter/Runtime/StateViewSliceRuntime_Builder_Single.res.mjs +242 -0
- package/src/adapter/Runtime/TaskBucketEntryPoint.mjs +150 -0
- package/src/adapter/Runtime/TaskRuntime_Builder_PerBucket.res +123 -0
- package/src/adapter/Runtime/TaskRuntime_Builder_PerBucket.res.mjs +74 -0
- package/src/adapter/ScheduledPublisher/ScheduledPublisher.res +2 -0
- package/src/adapter/ScheduledPublisher/ScheduledPublisher.res.mjs +12 -0
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents.res +54 -0
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents.res.mjs +41 -0
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents_Runtime.res +97 -0
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents_Runtime.res.mjs +85 -0
- package/src/adapter/StateTopic/StateTopic_AppSync.res +418 -0
- package/src/adapter/StateTopic/StateTopic_AppSync.res.mjs +295 -0
- package/src/adapter/Task/TaskBucket.res +1 -0
- package/src/adapter/Task/TaskBucket.res.mjs +9 -0
- package/src/adapter/Task/TaskBucket_S3.res +157 -0
- package/src/adapter/Task/TaskBucket_S3.res.mjs +108 -0
- package/src/adapter/Task/TaskBucket_S3_Runtime.res +11 -0
- package/src/adapter/Task/TaskBucket_S3_Runtime.res.mjs +15 -0
- package/src/components/Aggregate_Builder.res +1 -0
- package/src/components/Aggregate_Builder.res.mjs +25 -0
- package/src/components/Aggregate_Builder_Micro.res +63 -0
- package/src/components/Aggregate_Builder_Micro.res.mjs +80 -0
- package/src/components/Aggregate_Builder_NoResolver.res +61 -0
- package/src/components/Aggregate_Builder_NoResolver.res.mjs +80 -0
- package/src/components/Aggregate_Builder_PerAggregate.res +57 -0
- package/src/components/Aggregate_Builder_PerAggregate.res.mjs +80 -0
- package/src/components/Aggregate_Builder_Single.res +59 -0
- package/src/components/Aggregate_Builder_Single.res.mjs +80 -0
- package/src/components/Aggregate_Builder_Single_Async.res +59 -0
- package/src/components/Aggregate_Builder_Single_Async.res.mjs +80 -0
- package/src/components/Api/AppSync_Adapter.res +500 -0
- package/src/components/Api/AppSync_Adapter.res.mjs +396 -0
- package/src/components/AutomationSlice_Builder.res +52 -0
- package/src/components/AutomationSlice_Builder.res.mjs +72 -0
- package/src/components/AutomationSlice_Builder_Bundled.res.mjs +70 -0
- package/src/components/Counter_Builder.res +10 -0
- package/src/components/Counter_Builder.res.mjs +16 -0
- package/src/components/DataCleaner.res +170 -0
- package/src/components/DataCleaner.res.mjs +2 -0
- package/src/components/DcbEventLog_Builder.res +8 -0
- package/src/components/DcbEventLog_Builder.res.mjs +14 -0
- package/src/components/ExtensionPoint_Builder.res +16 -0
- package/src/components/ExtensionPoint_Builder.res.mjs +37 -0
- package/src/components/ForeignReadModel_Builder.res +19 -0
- package/src/components/ForeignReadModel_Builder.res.mjs +48 -0
- package/src/components/InboundTranslationSlice_Builder.res +25 -0
- package/src/components/InboundTranslationSlice_Builder.res.mjs +31 -0
- package/src/components/OutboundTranslationSlice_Builder.res +60 -0
- package/src/components/OutboundTranslationSlice_Builder.res.mjs +76 -0
- package/src/components/OutboundTranslationSlice_Builder_Bundled.res.mjs +75 -0
- package/src/components/Plugin.res +29 -0
- package/src/components/Plugin.res.mjs +63 -0
- package/src/components/ReadModel_Builder.res +1 -0
- package/src/components/ReadModel_Builder.res.mjs +19 -0
- package/src/components/ReadModel_Builder_NoResolver.res +55 -0
- package/src/components/ReadModel_Builder_NoResolver.res.mjs +64 -0
- package/src/components/ReadModel_Builder_NoResolver_Stream.res +60 -0
- package/src/components/ReadModel_Builder_NoResolver_Stream.res.mjs +64 -0
- package/src/components/ReadModel_Builder_PerReadModel.res +53 -0
- package/src/components/ReadModel_Builder_PerReadModel.res.mjs +66 -0
- package/src/components/ReadModel_Builder_Single.res +52 -0
- package/src/components/ReadModel_Builder_Single.res.mjs +66 -0
- package/src/components/ReadModel_Builder_Single_Stream.res +60 -0
- package/src/components/ReadModel_Builder_Single_Stream.res.mjs +66 -0
- package/src/components/Scheduler.res +1 -0
- package/src/components/Scheduler.res.mjs +13 -0
- package/src/components/SideEffectHandler.res +1 -0
- package/src/components/SideEffectHandler.res.mjs +19 -0
- package/src/components/SideEffectHandler_PerSideEffectHandler.res +13 -0
- package/src/components/SideEffectHandler_PerSideEffectHandler.res.mjs +52 -0
- package/src/components/SideEffectHandler_Single.res +54 -0
- package/src/components/SideEffectHandler_Single.res.mjs +60 -0
- package/src/components/StateChangeSlice_Builder.res +17 -0
- package/src/components/StateChangeSlice_Builder.res.mjs +23 -0
- package/src/components/StateViewSlice_Builder.res +46 -0
- package/src/components/StateViewSlice_Builder.res.mjs +68 -0
- package/src/components/StateViewSlice_Builder_Bundled.res.mjs +69 -0
- package/src/components/StateViewSlice_Builder_Stream.res +50 -0
- package/src/components/StateViewSlice_Builder_Stream.res.mjs +68 -0
- package/src/components/Task_Builder.res +1 -0
- package/src/components/Task_Builder.res.mjs +28 -0
- package/src/components/Task_Builder_PerBucket.res +22 -0
- package/src/components/Task_Builder_PerBucket.res.mjs +63 -0
- package/src/components/Vpc.res +214 -0
- package/src/components/Vpc.res.mjs +117 -0
- package/src/components/Vpc.resi +22 -0
- package/src/errors/AppSync_Error.res +36 -0
- package/src/errors/AppSync_Error.res.mjs +38 -0
- package/src/errors/Cognito_Error.res +36 -0
- package/src/errors/Cognito_Error.res.mjs +38 -0
- package/src/errors/DynamoDb_Error.res +75 -0
- package/src/errors/DynamoDb_Error.res.mjs +86 -0
- package/src/errors/Kinesis_Error.res +36 -0
- package/src/errors/Kinesis_Error.res.mjs +38 -0
- package/src/errors/SNS_Error.res +34 -0
- package/src/errors/SNS_Error.res.mjs +38 -0
- package/src/errors/SQS_Error.res +40 -0
- package/src/errors/SQS_Error.res.mjs +41 -0
- package/src/plugin/cloner/ClonerRunner.res +1 -0
- package/src/plugin/cloner/ClonerRunner.res.mjs +9 -0
- package/src/plugin/cloner/ClonerRunner_Fargate.res +362 -0
- package/src/plugin/cloner/ClonerRunner_Fargate.res.mjs +246 -0
- package/src/plugin/cloner/ClonerRunner_Fargate_Runtime.res +42 -0
- package/src/plugin/cloner/ClonerRunner_Fargate_Runtime.res.mjs +45 -0
- package/src/plugin/heartbeat/HeartbeatRunner.res +1 -0
- package/src/plugin/heartbeat/HeartbeatRunner.res.mjs +9 -0
- package/src/plugin/heartbeat/HeartbeatRunner_CloudWatchEvents.res +96 -0
- package/src/plugin/heartbeat/HeartbeatRunner_CloudWatchEvents.res.mjs +69 -0
- package/src/plugin/runtime/PluginExtensionPointRuntime_Builder.res +115 -0
- package/src/plugin/runtime/PluginExtensionPointRuntime_Builder.res.mjs +88 -0
- package/src/plugin/runtime/PluginRuntimeOperations.res +5 -0
- package/src/plugin/runtime/PluginRuntimeOperations.res.mjs +14 -0
- package/src/plugin/runtime/PluginRuntime_Builder.res +769 -0
- package/src/plugin/runtime/PluginRuntime_Builder.res.mjs +464 -0
- package/src/plugin/runtime/Util_PluginMessage_Runtime.res +13 -0
- package/src/plugin/runtime/Util_PluginMessage_Runtime.res.mjs +19 -0
- package/src/plugin/stack/Plugin_ExtensionPoint_Builder.res +28 -0
- package/src/plugin/stack/Plugin_ExtensionPoint_Builder.res.mjs +67 -0
- package/src/plugin/stack/Plugin_Stack.res +439 -0
- package/src/plugin/stack/Plugin_Stack.res.mjs +263 -0
- package/src/util/Util.res +29 -0
- package/src/util/Util.res.mjs +93 -0
- package/src/util/Util_AppSync.res +36 -0
- package/src/util/Util_AppSync.res.mjs +35 -0
- package/src/util/Util_AppSync_Caller.res +213 -0
- package/src/util/Util_AppSync_Caller.res.mjs +170 -0
- package/src/util/Util_Bundle.res +255 -0
- package/src/util/Util_Bundle.res.mjs +179 -0
- package/src/util/Util_Cloudwatch.res +14 -0
- package/src/util/Util_Cloudwatch.res.mjs +19 -0
- package/src/util/Util_CognitoGroupUser.res +39 -0
- package/src/util/Util_CognitoGroupUser.res.mjs +32 -0
- package/src/util/Util_CognitoGroupUser_Runtime.res +65 -0
- package/src/util/Util_CognitoGroupUser_Runtime.res.mjs +50 -0
- package/src/util/Util_Cognito_Runtime.res +52 -0
- package/src/util/Util_Cognito_Runtime.res.mjs +35 -0
- package/src/util/Util_DeadLetterQueue.res +154 -0
- package/src/util/Util_DeadLetterQueue.res.mjs +158 -0
- package/src/util/Util_DynamoDb.res +210 -0
- package/src/util/Util_DynamoDb.res.mjs +218 -0
- package/src/util/Util_DynamoDbStream.res +138 -0
- package/src/util/Util_DynamoDbStream.res.mjs +134 -0
- package/src/util/Util_DynamoDbStream_Runtime.res +94 -0
- package/src/util/Util_DynamoDbStream_Runtime.res.mjs +131 -0
- package/src/util/Util_DynamoDb_Runtime.res +216 -0
- package/src/util/Util_DynamoDb_Runtime.res.mjs +257 -0
- package/src/util/Util_DynamoDb_TableManager.res +23 -0
- package/src/util/Util_DynamoDb_TableManager.res.mjs +35 -0
- package/src/util/Util_DynamoDb_TableManager.resi +3 -0
- package/src/util/Util_Env.res +5 -0
- package/src/util/Util_Env.res.mjs +2 -0
- package/src/util/Util_EventSourceMapping.res +49 -0
- package/src/util/Util_EventSourceMapping.res.mjs +32 -0
- package/src/util/Util_HostUiDomain.res +28 -0
- package/src/util/Util_HostUiDomain.res.mjs +26 -0
- package/src/util/Util_IAM_Role.res +14 -0
- package/src/util/Util_IAM_Role.res.mjs +28 -0
- package/src/util/Util_Kinesis_Runtime.res +20 -0
- package/src/util/Util_Kinesis_Runtime.res.mjs +24 -0
- package/src/util/Util_Lambda.res +39 -0
- package/src/util/Util_Lambda.res.mjs +45 -0
- package/src/util/Util_LocalConfig.res +119 -0
- package/src/util/Util_LocalConfig.res.mjs +112 -0
- package/src/util/Util_ResourceNaming.res +15 -0
- package/src/util/Util_ResourceNaming.res.mjs +26 -0
- package/src/util/Util_S3.res +17 -0
- package/src/util/Util_S3.res.mjs +30 -0
- package/src/util/Util_S3_Runtime.res +11 -0
- package/src/util/Util_S3_Runtime.res.mjs +15 -0
- package/src/util/Util_SNS.res +33 -0
- package/src/util/Util_SNS.res.mjs +50 -0
- package/src/util/Util_SNS_FIFO.res +21 -0
- package/src/util/Util_SNS_FIFO.res.mjs +27 -0
- package/src/util/Util_SNS_Runtime.res +33 -0
- package/src/util/Util_SNS_Runtime.res.mjs +27 -0
- package/src/util/Util_SQS.res +70 -0
- package/src/util/Util_SQS.res.mjs +83 -0
- package/src/util/Util_SQS_FIFO.res +16 -0
- package/src/util/Util_SQS_FIFO.res.mjs +28 -0
- package/src/util/Util_SQS_Runtime.res +169 -0
- package/src/util/Util_SQS_Runtime.res.mjs +150 -0
- package/src/util/Util_SesPolicy_Runtime.res +54 -0
- package/src/util/Util_SesPolicy_Runtime.res.mjs +55 -0
- package/src/util/Util_StaticBundle.res +124 -0
- package/src/util/Util_StaticBundle.res.mjs +132 -0
- package/src/util/Util_Vpc.res +22 -0
- package/src/util/Util_Vpc.res.mjs +27 -0
- package/tests/AppSync_AdapterTest.res +396 -0
- package/tests/AppSync_AdapterTest.res.mjs +326 -0
- package/tests/AppSync_Resolver_RetryingTest.res +59 -0
- package/tests/AppSync_Resolver_RetryingTest.res.mjs +66 -0
- package/tests/Auth_CognitoTest.res +203 -0
- package/tests/Auth_CognitoTest.res.mjs +248 -0
- package/tests/DcbEventLogStorage_DynamoDb_RuntimeTest.res +602 -0
- package/tests/DcbEventLogStorage_DynamoDb_RuntimeTest.res.mjs +742 -0
- package/tests/EventLogStorage_DynamoDb_RuntimeTest.res +57 -0
- package/tests/EventLogStorage_DynamoDb_RuntimeTest.res.mjs +68 -0
- package/tests/MCP_LambdaTest.res +101 -0
- package/tests/MCP_LambdaTest.res.mjs +56 -0
- package/tests/Util_HostUiDomainTest.res +90 -0
- package/tests/Util_HostUiDomainTest.res.mjs +50 -0
- package/tests/Util_SQS_RuntimeTest.res +46 -0
- package/tests/Util_SQS_RuntimeTest.res.mjs +45 -0
- package/tests/Util_StaticBundleTest.res +136 -0
- package/tests/Util_StaticBundleTest.res.mjs +149 -0
- package/tests/integration/DcbCommandTopicEntryPoint_IntegrationTest.res +101 -0
- package/tests/integration/DcbCommandTopicEntryPoint_IntegrationTest.res.mjs +91 -0
- package/tests/integration/DcbEventLogStorage_DynamoDb_IntegrationTest.res +315 -0
- package/tests/integration/DcbEventLogStorage_DynamoDb_IntegrationTest.res.mjs +435 -0
- package/tests/integration/DcbIntegrationHarness.res +102 -0
- package/tests/integration/DcbIntegrationHarness.res.mjs +163 -0
- package/tests/integration/EpTestSlice.res +28 -0
- package/tests/integration/EpTestSlice.res.mjs +43 -0
- package/tests/integration/EpTestSliceBehavior.res +18 -0
- package/tests/integration/EpTestSliceBehavior.res.mjs +35 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// AWS resolver for the `Platform_ComponentDefinitions` admin GraphQL query.
|
|
2
|
+
//
|
|
3
|
+
// Backed by a Lambda DataSource that scans the Plugin read model and emits
|
|
4
|
+
// one entry per Connected plugin whose persisted state carries a `structure`
|
|
5
|
+
// field. The persisted structure is sury-encoded with the exact same shape
|
|
6
|
+
// the in-memory adapter's `Platform_ComponentDefinitionsApi.encodePluginStructureEntry`
|
|
7
|
+
// produces (literal-string `commandLevel`, `null`-encoded options), so the
|
|
8
|
+
// handler simply wraps each persisted structure with `pluginId` — no decoding
|
|
9
|
+
// or re-encoding needed.
|
|
10
|
+
|
|
11
|
+
open PulumiAws
|
|
12
|
+
|
|
13
|
+
// `adminEntryJson` is the JSON-stringified entry for the built-in Platform_Admin
|
|
14
|
+
// plugin (Plugin aggregate with Activate/Deactivate, Plugin read model).
|
|
15
|
+
// The admin never `Connect`s to itself, so its structure never
|
|
16
|
+
// enters the Plugin read model — we inject it at deploy time so the host shell
|
|
17
|
+
// renders Auto UI for it alongside user plugins.
|
|
18
|
+
let makeHandlerCode = (~tableName as _: string, ~adminEntryJson: string): string =>
|
|
19
|
+
`
|
|
20
|
+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
21
|
+
import { DynamoDBDocumentClient, ScanCommand } from "@aws-sdk/lib-dynamodb";
|
|
22
|
+
|
|
23
|
+
const client = DynamoDBDocumentClient.from(new DynamoDBClient({}));
|
|
24
|
+
const TABLE = process.env.PLUGIN_RM_TABLE;
|
|
25
|
+
const ADMIN_ENTRY = ${adminEntryJson};
|
|
26
|
+
|
|
27
|
+
export async function handler() {
|
|
28
|
+
if (!TABLE) {
|
|
29
|
+
console.error("Platform_ComponentDefinitions: PLUGIN_RM_TABLE env var not set");
|
|
30
|
+
return [ADMIN_ENTRY];
|
|
31
|
+
}
|
|
32
|
+
const items = [];
|
|
33
|
+
let exclusiveStartKey;
|
|
34
|
+
do {
|
|
35
|
+
const out = await client.send(new ScanCommand({
|
|
36
|
+
TableName: TABLE,
|
|
37
|
+
FilterExpression: "contains(#status, :connected)",
|
|
38
|
+
ExpressionAttributeNames: { "#status": "status" },
|
|
39
|
+
ExpressionAttributeValues: { ":connected": "Connected" },
|
|
40
|
+
Limit: 1000,
|
|
41
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
42
|
+
}));
|
|
43
|
+
if (out.Items) items.push(...out.Items);
|
|
44
|
+
exclusiveStartKey = out.LastEvaluatedKey;
|
|
45
|
+
} while (exclusiveStartKey);
|
|
46
|
+
|
|
47
|
+
// Platform invariant: one version per plugin at a time, so the UI sees just
|
|
48
|
+
// the bare plugin name (mirrors ReventlessCore.Plugin.name). The Connected
|
|
49
|
+
// filter above does not enforce single-version: during a rolling deploy or a
|
|
50
|
+
// missed retire, several versions of the same plugin sit in Connected at once
|
|
51
|
+
// and each would otherwise emit a full duplicate set of AutoUI menu entries.
|
|
52
|
+
// Collapse to the highest version per plugin name (mirrors
|
|
53
|
+
// ReventlessCore.Plugin.compareVersions).
|
|
54
|
+
const cmpVer = (a, b) => {
|
|
55
|
+
const pa = String(a).replace(/[-+]/g, ".").split(".");
|
|
56
|
+
const pb = String(b).replace(/[-+]/g, ".").split(".");
|
|
57
|
+
const len = Math.max(pa.length, pb.length);
|
|
58
|
+
for (let i = 0; i < len; i++) {
|
|
59
|
+
const sa = pa[i] ?? "", sb = pb[i] ?? "";
|
|
60
|
+
const na = Number(sa), nb = Number(sb);
|
|
61
|
+
const bothNum = sa !== "" && sb !== "" && !Number.isNaN(na) && !Number.isNaN(nb);
|
|
62
|
+
if (bothNum) { if (na !== nb) return na > nb ? 1 : -1; }
|
|
63
|
+
else if (sa !== sb) return sa > sb ? 1 : -1;
|
|
64
|
+
}
|
|
65
|
+
return 0;
|
|
66
|
+
};
|
|
67
|
+
const latestByName = new Map();
|
|
68
|
+
for (const item of items) {
|
|
69
|
+
if (!item || !item.structure) continue;
|
|
70
|
+
const name = String(item.name).split("@")[0];
|
|
71
|
+
const version = String(item.name).split("@")[1] ?? "";
|
|
72
|
+
const prev = latestByName.get(name);
|
|
73
|
+
if (!prev || cmpVer(version, prev.version) > 0) {
|
|
74
|
+
latestByName.set(name, { version, entry: { pluginId: name, ...item.structure } });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const userEntries = [...latestByName.values()].map(v => v.entry);
|
|
78
|
+
return [ADMIN_ENTRY, ...userEntries];
|
|
79
|
+
}
|
|
80
|
+
`
|
|
81
|
+
|
|
82
|
+
let resolverCode = `
|
|
83
|
+
import { util } from '@aws-appsync/utils';
|
|
84
|
+
export function request(ctx) {
|
|
85
|
+
return { operation: 'Invoke', payload: {} };
|
|
86
|
+
}
|
|
87
|
+
export function response(ctx) {
|
|
88
|
+
if (ctx.error) util.error(ctx.error.message, ctx.error.type);
|
|
89
|
+
return ctx.result;
|
|
90
|
+
}
|
|
91
|
+
`->Pulumi.Input.make
|
|
92
|
+
|
|
93
|
+
let make = (
|
|
94
|
+
~api: Pulumi.Output.t<AppSync.GraphQLApi.t>,
|
|
95
|
+
~pluginReadModelTableName: Pulumi.Output.t<string>,
|
|
96
|
+
~opts: Pulumi.ComponentResource.options,
|
|
97
|
+
) => {
|
|
98
|
+
let opts = opts->ReventlessCore.Util.Pulumi.ComponentResourceOptions.toCustomResourceOptions
|
|
99
|
+
let name = "PlatformUIDefinitions"
|
|
100
|
+
|
|
101
|
+
let lambdaRole = IAM.Role.makeWithDefaultPolicy(
|
|
102
|
+
~name=name ++ "Lambda",
|
|
103
|
+
~servicePrincipal=AWS.Lambda.principal->Pulumi.Output.make,
|
|
104
|
+
~opts,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
let _ =
|
|
108
|
+
pluginReadModelTableName->Pulumi.Output.apply(tableName => {
|
|
109
|
+
open PolicyDocument
|
|
110
|
+
let _rolePolicy = IAM.RolePolicy.make(
|
|
111
|
+
~name=name ++ "LambdaPolicy",
|
|
112
|
+
~args={
|
|
113
|
+
IAM.RolePolicy.policy: PolicyDocument.make(
|
|
114
|
+
~id=name ++ "LambdaPolicy",
|
|
115
|
+
~statements=[
|
|
116
|
+
{
|
|
117
|
+
sid: "AllowLambdaLogging",
|
|
118
|
+
effect: Allow,
|
|
119
|
+
actions: Action("logs:*"),
|
|
120
|
+
resources: Resource("arn:aws:logs:*:*:*"),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
sid: "AllowScanPluginRm",
|
|
124
|
+
effect: Allow,
|
|
125
|
+
actions: Actions(["dynamodb:Scan"]),
|
|
126
|
+
resources: Resource("arn:aws:dynamodb:*:*:table/" ++ tableName),
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
)
|
|
130
|
+
->PolicyDocument.toJsonString
|
|
131
|
+
->Pulumi.Input.make,
|
|
132
|
+
role: lambdaRole.id->Pulumi.Output.asInput,
|
|
133
|
+
},
|
|
134
|
+
~opts,
|
|
135
|
+
)
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
let adminEntryJson =
|
|
139
|
+
ReventlessCore.Platform_ComponentDefinitionsApi.encodePluginStructureEntry(
|
|
140
|
+
~pluginId=ReventlessCore.Platform_Admin_Structure.pluginId,
|
|
141
|
+
ReventlessCore.Platform_Admin_Structure.structure,
|
|
142
|
+
)->JSON.stringify
|
|
143
|
+
|
|
144
|
+
let archiveContents: dict<Pulumi.Archive.assetOrArchive> = Dict.make()
|
|
145
|
+
let handlerCodeStub = makeHandlerCode(~tableName="", ~adminEntryJson)
|
|
146
|
+
archiveContents->Dict.set(
|
|
147
|
+
"index.mjs",
|
|
148
|
+
Pulumi.Asset.stringAsset(handlerCodeStub)->Pulumi.Archive.assetToAssetOrArchive,
|
|
149
|
+
)
|
|
150
|
+
let code = Pulumi.Archive.assetArchive(archiveContents)
|
|
151
|
+
let sourceCodeHash = Util_Bundle.hashString(handlerCodeStub)
|
|
152
|
+
|
|
153
|
+
let layers =
|
|
154
|
+
Lambda.reventlessLayerArn
|
|
155
|
+
->Option.map(arn => [arn->Pulumi.Input.make])
|
|
156
|
+
->Option.getOr([])
|
|
157
|
+
->Pulumi.Input.make
|
|
158
|
+
|
|
159
|
+
let lambda = Lambda.Function.make(
|
|
160
|
+
~name=name ++ "Lambda",
|
|
161
|
+
~args={
|
|
162
|
+
handler: "index.handler"->Pulumi.Input.make,
|
|
163
|
+
runtime: "nodejs22.x"->Pulumi.Input.make,
|
|
164
|
+
code: code->Pulumi.Input.make,
|
|
165
|
+
sourceCodeHash: sourceCodeHash->Pulumi.Input.make,
|
|
166
|
+
role: lambdaRole.arn->Pulumi.Output.asInput,
|
|
167
|
+
memorySize: 512->Pulumi.Input.make,
|
|
168
|
+
timeout: 30->Pulumi.Input.make,
|
|
169
|
+
layers,
|
|
170
|
+
tags: AWS.Tags.make(~name=name ++ "Lambda", ReventlessCore.ReadModel.componentType),
|
|
171
|
+
environment: (
|
|
172
|
+
{
|
|
173
|
+
Lambda.Function.variables: Dict.fromArray([
|
|
174
|
+
("Environment", Pulumi.Pulumi.getStackName()->Pulumi.Input.make),
|
|
175
|
+
("PLUGIN_RM_TABLE", pluginReadModelTableName->Pulumi.Output.asInput),
|
|
176
|
+
]),
|
|
177
|
+
}: Lambda.Function.functionEnvironment
|
|
178
|
+
)->Pulumi.Input.make,
|
|
179
|
+
},
|
|
180
|
+
~opts,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
let dataSourceRole = IAM.Role.makeWithDefaultPolicy(
|
|
184
|
+
~name=name ++ "DataSource",
|
|
185
|
+
~servicePrincipal=AWS.AppSync.principal->Pulumi.Output.make,
|
|
186
|
+
~opts,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
let _ =
|
|
190
|
+
(lambda.arn, dataSourceRole.id)
|
|
191
|
+
->Pulumi.Output.all2
|
|
192
|
+
->Pulumi.Output.apply(((lambdaArn, dataSourceRoleId)) => {
|
|
193
|
+
open PolicyDocument
|
|
194
|
+
let _attach = IAM.RolePolicy.make(
|
|
195
|
+
~name=name ++ "DataSource",
|
|
196
|
+
~args={
|
|
197
|
+
IAM.RolePolicy.policy: PolicyDocument.make(
|
|
198
|
+
~id=name ++ "DataSourcePolicy",
|
|
199
|
+
~statements=[
|
|
200
|
+
{
|
|
201
|
+
sid: "AllowDataSourceInvokeLambda",
|
|
202
|
+
effect: Allow,
|
|
203
|
+
actions: Action("lambda:InvokeFunction"),
|
|
204
|
+
resources: Resource(lambdaArn),
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
)
|
|
208
|
+
->PolicyDocument.toJsonString
|
|
209
|
+
->Pulumi.Input.make,
|
|
210
|
+
role: dataSourceRoleId->Pulumi.Input.make,
|
|
211
|
+
},
|
|
212
|
+
~opts,
|
|
213
|
+
)
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
let dataSource = AppSync.DataSource.make(
|
|
217
|
+
~name=name ++ "DataSource",
|
|
218
|
+
~args={
|
|
219
|
+
type_: AWS_LAMBDA,
|
|
220
|
+
apiId: api->Pulumi.Output.flatMap(api => api.id)->Pulumi.Output.asInput,
|
|
221
|
+
lambdaConfig: {
|
|
222
|
+
AppSync.DataSource.functionArn: lambda.arn->Pulumi.Output.asInput,
|
|
223
|
+
}->Pulumi.Input.make,
|
|
224
|
+
serviceRoleArn: dataSourceRole.arn->Pulumi.Output.asInput,
|
|
225
|
+
},
|
|
226
|
+
~opts=Some(opts),
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
let _resolver = AppSync_Resolver_Native.makeUnitJsResolver(
|
|
230
|
+
~name=name ++ "Resolver",
|
|
231
|
+
~api,
|
|
232
|
+
~dataSourceName=dataSource.name->Pulumi.Output.asInput,
|
|
233
|
+
~type_="Query"->Pulumi.Input.make,
|
|
234
|
+
~field="Platform_ComponentDefinitions"->Pulumi.Input.make,
|
|
235
|
+
~code=resolverCode,
|
|
236
|
+
~opts,
|
|
237
|
+
)
|
|
238
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Aws from "@pulumi/aws";
|
|
4
|
+
import * as IAM$PulumiAws from "@reventlessdev/rescript-pulumi-aws/src/IAM/IAM.res.mjs";
|
|
5
|
+
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
6
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
8
|
+
import * as Lambda$PulumiAws from "@reventlessdev/rescript-pulumi-aws/src/Lambda/Lambda.res.mjs";
|
|
9
|
+
import * as AWS$ReventlessAws from "../AWS.res.mjs";
|
|
10
|
+
import * as AWS_Tags$ReventlessAws from "../AWS_Tags.res.mjs";
|
|
11
|
+
import * as PolicyDocument$PulumiAws from "@reventlessdev/rescript-pulumi-aws/src/IAM/PolicyDocument.res.mjs";
|
|
12
|
+
import * as ReadModel$ReventlessCore from "@reventlessdev/reventless-core/src/components/ReadModel/ReadModel.res.mjs";
|
|
13
|
+
import * as Util_Bundle$ReventlessAws from "../../util/Util_Bundle.res.mjs";
|
|
14
|
+
import * as Util_Pulumi$ReventlessCore from "@reventlessdev/reventless-core/src/util/Util_Pulumi.res.mjs";
|
|
15
|
+
import * as AppSync_Resolver_Native$ReventlessAws from "./AppSync_Resolver_Native.res.mjs";
|
|
16
|
+
import * as Platform_Admin_Structure$ReventlessCore from "@reventlessdev/reventless-core/src/admin/Platform_Admin_Structure.res.mjs";
|
|
17
|
+
import * as Platform_ComponentDefinitionsApi$ReventlessCore from "@reventlessdev/reventless-core/src/admin/Platform_ComponentDefinitionsApi.res.mjs";
|
|
18
|
+
|
|
19
|
+
function makeHandlerCode(param, adminEntryJson) {
|
|
20
|
+
return `
|
|
21
|
+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
22
|
+
import { DynamoDBDocumentClient, ScanCommand } from "@aws-sdk/lib-dynamodb";
|
|
23
|
+
|
|
24
|
+
const client = DynamoDBDocumentClient.from(new DynamoDBClient({}));
|
|
25
|
+
const TABLE = process.env.PLUGIN_RM_TABLE;
|
|
26
|
+
const ADMIN_ENTRY = ` + adminEntryJson + `;
|
|
27
|
+
|
|
28
|
+
export async function handler() {
|
|
29
|
+
if (!TABLE) {
|
|
30
|
+
console.error("Platform_ComponentDefinitions: PLUGIN_RM_TABLE env var not set");
|
|
31
|
+
return [ADMIN_ENTRY];
|
|
32
|
+
}
|
|
33
|
+
const items = [];
|
|
34
|
+
let exclusiveStartKey;
|
|
35
|
+
do {
|
|
36
|
+
const out = await client.send(new ScanCommand({
|
|
37
|
+
TableName: TABLE,
|
|
38
|
+
FilterExpression: "contains(#status, :connected)",
|
|
39
|
+
ExpressionAttributeNames: { "#status": "status" },
|
|
40
|
+
ExpressionAttributeValues: { ":connected": "Connected" },
|
|
41
|
+
Limit: 1000,
|
|
42
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
43
|
+
}));
|
|
44
|
+
if (out.Items) items.push(...out.Items);
|
|
45
|
+
exclusiveStartKey = out.LastEvaluatedKey;
|
|
46
|
+
} while (exclusiveStartKey);
|
|
47
|
+
|
|
48
|
+
// Platform invariant: one version per plugin at a time, so the UI sees just
|
|
49
|
+
// the bare plugin name (mirrors ReventlessCore.Plugin.name). The Connected
|
|
50
|
+
// filter above does not enforce single-version: during a rolling deploy or a
|
|
51
|
+
// missed retire, several versions of the same plugin sit in Connected at once
|
|
52
|
+
// and each would otherwise emit a full duplicate set of AutoUI menu entries.
|
|
53
|
+
// Collapse to the highest version per plugin name (mirrors
|
|
54
|
+
// ReventlessCore.Plugin.compareVersions).
|
|
55
|
+
const cmpVer = (a, b) => {
|
|
56
|
+
const pa = String(a).replace(/[-+]/g, ".").split(".");
|
|
57
|
+
const pb = String(b).replace(/[-+]/g, ".").split(".");
|
|
58
|
+
const len = Math.max(pa.length, pb.length);
|
|
59
|
+
for (let i = 0; i < len; i++) {
|
|
60
|
+
const sa = pa[i] ?? "", sb = pb[i] ?? "";
|
|
61
|
+
const na = Number(sa), nb = Number(sb);
|
|
62
|
+
const bothNum = sa !== "" && sb !== "" && !Number.isNaN(na) && !Number.isNaN(nb);
|
|
63
|
+
if (bothNum) { if (na !== nb) return na > nb ? 1 : -1; }
|
|
64
|
+
else if (sa !== sb) return sa > sb ? 1 : -1;
|
|
65
|
+
}
|
|
66
|
+
return 0;
|
|
67
|
+
};
|
|
68
|
+
const latestByName = new Map();
|
|
69
|
+
for (const item of items) {
|
|
70
|
+
if (!item || !item.structure) continue;
|
|
71
|
+
const name = String(item.name).split("@")[0];
|
|
72
|
+
const version = String(item.name).split("@")[1] ?? "";
|
|
73
|
+
const prev = latestByName.get(name);
|
|
74
|
+
if (!prev || cmpVer(version, prev.version) > 0) {
|
|
75
|
+
latestByName.set(name, { version, entry: { pluginId: name, ...item.structure } });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const userEntries = [...latestByName.values()].map(v => v.entry);
|
|
79
|
+
return [ADMIN_ENTRY, ...userEntries];
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
let resolverCode = `
|
|
85
|
+
import { util } from '@aws-appsync/utils';
|
|
86
|
+
export function request(ctx) {
|
|
87
|
+
return { operation: 'Invoke', payload: {} };
|
|
88
|
+
}
|
|
89
|
+
export function response(ctx) {
|
|
90
|
+
if (ctx.error) util.error(ctx.error.message, ctx.error.type);
|
|
91
|
+
return ctx.result;
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
|
|
95
|
+
function make(api, pluginReadModelTableName, opts) {
|
|
96
|
+
let opts$1 = Util_Pulumi$ReventlessCore.ComponentResourceOptions.toCustomResourceOptions(opts);
|
|
97
|
+
let name = "PlatformUIDefinitions";
|
|
98
|
+
let lambdaRole = IAM$PulumiAws.Role.makeWithDefaultPolicy(name + "Lambda", Pulumi.output(AWS$ReventlessAws.Lambda.principal), opts$1);
|
|
99
|
+
pluginReadModelTableName.apply(tableName => {
|
|
100
|
+
new (Aws.iam.RolePolicy)(name + "LambdaPolicy", {
|
|
101
|
+
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, name + "LambdaPolicy", [
|
|
102
|
+
{
|
|
103
|
+
Sid: "AllowLambdaLogging",
|
|
104
|
+
Effect: "Allow",
|
|
105
|
+
Action: "logs:*",
|
|
106
|
+
Resource: "arn:aws:logs:*:*:*"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
Sid: "AllowScanPluginRm",
|
|
110
|
+
Effect: "Allow",
|
|
111
|
+
Action: ["dynamodb:Scan"],
|
|
112
|
+
Resource: "arn:aws:dynamodb:*:*:table/" + tableName
|
|
113
|
+
}
|
|
114
|
+
])),
|
|
115
|
+
role: lambdaRole.id
|
|
116
|
+
}, opts$1);
|
|
117
|
+
});
|
|
118
|
+
let adminEntryJson = JSON.stringify(Platform_ComponentDefinitionsApi$ReventlessCore.encodePluginStructureEntry(Platform_Admin_Structure$ReventlessCore.pluginId, Platform_Admin_Structure$ReventlessCore.structure));
|
|
119
|
+
let archiveContents = {};
|
|
120
|
+
let handlerCodeStub = makeHandlerCode("", adminEntryJson);
|
|
121
|
+
archiveContents["index.mjs"] = new (Pulumi.asset.StringAsset)(handlerCodeStub);
|
|
122
|
+
let code = new (Pulumi.asset.AssetArchive)(archiveContents);
|
|
123
|
+
let sourceCodeHash = Util_Bundle$ReventlessAws.hashString(handlerCodeStub);
|
|
124
|
+
let layers = Stdlib_Option.getOr(Stdlib_Option.map(Lambda$PulumiAws.reventlessLayerArn, arn => [arn]), []);
|
|
125
|
+
let lambda = new (Aws.lambda.Function)(name + "Lambda", {
|
|
126
|
+
handler: "index.handler",
|
|
127
|
+
runtime: "nodejs22.x",
|
|
128
|
+
code: code,
|
|
129
|
+
role: lambdaRole.arn,
|
|
130
|
+
memorySize: 512,
|
|
131
|
+
timeout: 30,
|
|
132
|
+
layers: layers,
|
|
133
|
+
tags: AWS_Tags$ReventlessAws.make(name + "Lambda", ReadModel$ReventlessCore.componentType),
|
|
134
|
+
environment: {
|
|
135
|
+
variables: Object.fromEntries([
|
|
136
|
+
[
|
|
137
|
+
"Environment",
|
|
138
|
+
Pulumi.getStack()
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
"PLUGIN_RM_TABLE",
|
|
142
|
+
pluginReadModelTableName
|
|
143
|
+
]
|
|
144
|
+
])
|
|
145
|
+
},
|
|
146
|
+
sourceCodeHash: sourceCodeHash
|
|
147
|
+
}, opts$1);
|
|
148
|
+
let dataSourceRole = IAM$PulumiAws.Role.makeWithDefaultPolicy(name + "DataSource", Pulumi.output(AWS$ReventlessAws.AppSync.principal), opts$1);
|
|
149
|
+
Pulumi.all([
|
|
150
|
+
lambda.arn,
|
|
151
|
+
dataSourceRole.id
|
|
152
|
+
]).apply(param => {
|
|
153
|
+
new (Aws.iam.RolePolicy)(name + "DataSource", {
|
|
154
|
+
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, name + "DataSourcePolicy", [{
|
|
155
|
+
Sid: "AllowDataSourceInvokeLambda",
|
|
156
|
+
Effect: "Allow",
|
|
157
|
+
Action: "lambda:InvokeFunction",
|
|
158
|
+
Resource: param[0]
|
|
159
|
+
}])),
|
|
160
|
+
role: param[1]
|
|
161
|
+
}, opts$1);
|
|
162
|
+
});
|
|
163
|
+
let dataSource = new (Aws.appsync.DataSource)(name + "DataSource", {
|
|
164
|
+
type: "AWS_LAMBDA",
|
|
165
|
+
apiId: Output$Pulumi.flatMap(api, api => api.id),
|
|
166
|
+
lambdaConfig: {
|
|
167
|
+
functionArn: lambda.arn
|
|
168
|
+
},
|
|
169
|
+
serviceRoleArn: dataSourceRole.arn
|
|
170
|
+
}, opts$1);
|
|
171
|
+
AppSync_Resolver_Native$ReventlessAws.makeUnitJsResolver(name + "Resolver", api, dataSource.name, "Query", "Platform_ComponentDefinitions", resolverCode, opts$1);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
makeHandlerCode,
|
|
176
|
+
resolverCode,
|
|
177
|
+
make,
|
|
178
|
+
}
|
|
179
|
+
/* @pulumi/aws Not a pure module */
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// AWS resolver for the `Platform_UIFragments` admin GraphQL query.
|
|
2
|
+
//
|
|
3
|
+
// Backed by a Lambda DataSource that scans the UIFragmentRegistry read model
|
|
4
|
+
// (one item per plugin whose pluginDefinition carries a uiFragments manifest).
|
|
5
|
+
// The persisted state is sury-encoded with the same shape the in-memory adapter's
|
|
6
|
+
// `Platform_UIFragmentsApi.encodeUIFragmentEntry` produces (null-encoded options,
|
|
7
|
+
// nested panel/page objects), so the handler simply returns the rows as-is.
|
|
8
|
+
|
|
9
|
+
open PulumiAws
|
|
10
|
+
|
|
11
|
+
let makeHandlerCode = (~tableName as _: string): string =>
|
|
12
|
+
`
|
|
13
|
+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
14
|
+
import { DynamoDBDocumentClient, ScanCommand } from "@aws-sdk/lib-dynamodb";
|
|
15
|
+
|
|
16
|
+
const client = DynamoDBDocumentClient.from(new DynamoDBClient({}));
|
|
17
|
+
const TABLE = process.env.UI_FRAGMENT_RM_TABLE;
|
|
18
|
+
|
|
19
|
+
export async function handler() {
|
|
20
|
+
if (!TABLE) {
|
|
21
|
+
console.error("Platform_UIFragments: UI_FRAGMENT_RM_TABLE env var not set");
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
const items = [];
|
|
25
|
+
let exclusiveStartKey;
|
|
26
|
+
do {
|
|
27
|
+
const out = await client.send(new ScanCommand({
|
|
28
|
+
TableName: TABLE,
|
|
29
|
+
Limit: 1000,
|
|
30
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
31
|
+
}));
|
|
32
|
+
if (out.Items) items.push(...out.Items);
|
|
33
|
+
exclusiveStartKey = out.LastEvaluatedKey;
|
|
34
|
+
} while (exclusiveStartKey);
|
|
35
|
+
|
|
36
|
+
// Platform invariant: one version per plugin at a time, so the UI sees just
|
|
37
|
+
// the bare plugin name (mirrors ReventlessCore.Plugin.name). UIFragmentRegistry
|
|
38
|
+
// accumulates one row per deployed plugin version and carries no lifecycle
|
|
39
|
+
// status of its own, so without deduping a redeployed federation plugin would
|
|
40
|
+
// surface duplicate fragments. Collapse to the highest version per plugin name
|
|
41
|
+
// (mirrors ReventlessCore.Plugin.compareVersions).
|
|
42
|
+
const cmpVer = (a, b) => {
|
|
43
|
+
const pa = String(a).replace(/[-+]/g, ".").split(".");
|
|
44
|
+
const pb = String(b).replace(/[-+]/g, ".").split(".");
|
|
45
|
+
const len = Math.max(pa.length, pb.length);
|
|
46
|
+
for (let i = 0; i < len; i++) {
|
|
47
|
+
const sa = pa[i] ?? "", sb = pb[i] ?? "";
|
|
48
|
+
const na = Number(sa), nb = Number(sb);
|
|
49
|
+
const bothNum = sa !== "" && sb !== "" && !Number.isNaN(na) && !Number.isNaN(nb);
|
|
50
|
+
if (bothNum) { if (na !== nb) return na > nb ? 1 : -1; }
|
|
51
|
+
else if (sa !== sb) return sa > sb ? 1 : -1;
|
|
52
|
+
}
|
|
53
|
+
return 0;
|
|
54
|
+
};
|
|
55
|
+
const latestByName = new Map();
|
|
56
|
+
for (const item of items) {
|
|
57
|
+
if (!item || !item.pluginId || !item.remoteEntryUrl) continue;
|
|
58
|
+
const name = String(item.pluginId).split("@")[0];
|
|
59
|
+
const version = String(item.pluginId).split("@")[1] ?? "";
|
|
60
|
+
const prev = latestByName.get(name);
|
|
61
|
+
if (!prev || cmpVer(version, prev.version) > 0) {
|
|
62
|
+
latestByName.set(name, {
|
|
63
|
+
version,
|
|
64
|
+
entry: {
|
|
65
|
+
pluginId: name,
|
|
66
|
+
remoteEntryUrl: item.remoteEntryUrl,
|
|
67
|
+
panels: item.panels || [],
|
|
68
|
+
pages: item.pages || [],
|
|
69
|
+
registeredAt: item.registeredAt || "",
|
|
70
|
+
updatedAt: item.updatedAt || "",
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return [...latestByName.values()].map(v => v.entry);
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
|
|
79
|
+
let resolverCode = `
|
|
80
|
+
import { util } from '@aws-appsync/utils';
|
|
81
|
+
export function request(ctx) {
|
|
82
|
+
return { operation: 'Invoke', payload: {} };
|
|
83
|
+
}
|
|
84
|
+
export function response(ctx) {
|
|
85
|
+
if (ctx.error) util.error(ctx.error.message, ctx.error.type);
|
|
86
|
+
return ctx.result;
|
|
87
|
+
}
|
|
88
|
+
`->Pulumi.Input.make
|
|
89
|
+
|
|
90
|
+
let make = (
|
|
91
|
+
~api: Pulumi.Output.t<AppSync.GraphQLApi.t>,
|
|
92
|
+
~uiFragmentRegistryTableName: Pulumi.Output.t<string>,
|
|
93
|
+
~opts: Pulumi.ComponentResource.options,
|
|
94
|
+
) => {
|
|
95
|
+
let opts = opts->ReventlessCore.Util.Pulumi.ComponentResourceOptions.toCustomResourceOptions
|
|
96
|
+
let name = "PlatformUIFragments"
|
|
97
|
+
|
|
98
|
+
let lambdaRole = IAM.Role.makeWithDefaultPolicy(
|
|
99
|
+
~name=name ++ "Lambda",
|
|
100
|
+
~servicePrincipal=AWS.Lambda.principal->Pulumi.Output.make,
|
|
101
|
+
~opts,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
let _ =
|
|
105
|
+
uiFragmentRegistryTableName->Pulumi.Output.apply(tableName => {
|
|
106
|
+
open PolicyDocument
|
|
107
|
+
let _rolePolicy = IAM.RolePolicy.make(
|
|
108
|
+
~name=name ++ "LambdaPolicy",
|
|
109
|
+
~args={
|
|
110
|
+
IAM.RolePolicy.policy: PolicyDocument.make(
|
|
111
|
+
~id=name ++ "LambdaPolicy",
|
|
112
|
+
~statements=[
|
|
113
|
+
{
|
|
114
|
+
sid: "AllowLambdaLogging",
|
|
115
|
+
effect: Allow,
|
|
116
|
+
actions: Action("logs:*"),
|
|
117
|
+
resources: Resource("arn:aws:logs:*:*:*"),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
sid: "AllowScanUIFragmentRegistryRm",
|
|
121
|
+
effect: Allow,
|
|
122
|
+
actions: Actions(["dynamodb:Scan"]),
|
|
123
|
+
resources: Resource("arn:aws:dynamodb:*:*:table/" ++ tableName),
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
)
|
|
127
|
+
->PolicyDocument.toJsonString
|
|
128
|
+
->Pulumi.Input.make,
|
|
129
|
+
role: lambdaRole.id->Pulumi.Output.asInput,
|
|
130
|
+
},
|
|
131
|
+
~opts,
|
|
132
|
+
)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
let archiveContents: dict<Pulumi.Archive.assetOrArchive> = Dict.make()
|
|
136
|
+
let handlerCodeStub = makeHandlerCode(~tableName="")
|
|
137
|
+
archiveContents->Dict.set(
|
|
138
|
+
"index.mjs",
|
|
139
|
+
Pulumi.Asset.stringAsset(handlerCodeStub)->Pulumi.Archive.assetToAssetOrArchive,
|
|
140
|
+
)
|
|
141
|
+
let code = Pulumi.Archive.assetArchive(archiveContents)
|
|
142
|
+
let sourceCodeHash = Util_Bundle.hashString(handlerCodeStub)
|
|
143
|
+
|
|
144
|
+
let layers =
|
|
145
|
+
Lambda.reventlessLayerArn
|
|
146
|
+
->Option.map(arn => [arn->Pulumi.Input.make])
|
|
147
|
+
->Option.getOr([])
|
|
148
|
+
->Pulumi.Input.make
|
|
149
|
+
|
|
150
|
+
let lambda = Lambda.Function.make(
|
|
151
|
+
~name=name ++ "Lambda",
|
|
152
|
+
~args={
|
|
153
|
+
handler: "index.handler"->Pulumi.Input.make,
|
|
154
|
+
runtime: "nodejs22.x"->Pulumi.Input.make,
|
|
155
|
+
code: code->Pulumi.Input.make,
|
|
156
|
+
sourceCodeHash: sourceCodeHash->Pulumi.Input.make,
|
|
157
|
+
role: lambdaRole.arn->Pulumi.Output.asInput,
|
|
158
|
+
memorySize: 512->Pulumi.Input.make,
|
|
159
|
+
timeout: 30->Pulumi.Input.make,
|
|
160
|
+
layers,
|
|
161
|
+
tags: AWS.Tags.make(~name=name ++ "Lambda", ReventlessCore.ReadModel.componentType),
|
|
162
|
+
environment: (
|
|
163
|
+
{
|
|
164
|
+
Lambda.Function.variables: Dict.fromArray([
|
|
165
|
+
("Environment", Pulumi.Pulumi.getStackName()->Pulumi.Input.make),
|
|
166
|
+
("UI_FRAGMENT_RM_TABLE", uiFragmentRegistryTableName->Pulumi.Output.asInput),
|
|
167
|
+
]),
|
|
168
|
+
}: Lambda.Function.functionEnvironment
|
|
169
|
+
)->Pulumi.Input.make,
|
|
170
|
+
},
|
|
171
|
+
~opts,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
let dataSourceRole = IAM.Role.makeWithDefaultPolicy(
|
|
175
|
+
~name=name ++ "DataSource",
|
|
176
|
+
~servicePrincipal=AWS.AppSync.principal->Pulumi.Output.make,
|
|
177
|
+
~opts,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
let _ =
|
|
181
|
+
(lambda.arn, dataSourceRole.id)
|
|
182
|
+
->Pulumi.Output.all2
|
|
183
|
+
->Pulumi.Output.apply(((lambdaArn, dataSourceRoleId)) => {
|
|
184
|
+
open PolicyDocument
|
|
185
|
+
let _attach = IAM.RolePolicy.make(
|
|
186
|
+
~name=name ++ "DataSource",
|
|
187
|
+
~args={
|
|
188
|
+
IAM.RolePolicy.policy: PolicyDocument.make(
|
|
189
|
+
~id=name ++ "DataSourcePolicy",
|
|
190
|
+
~statements=[
|
|
191
|
+
{
|
|
192
|
+
sid: "AllowDataSourceInvokeLambda",
|
|
193
|
+
effect: Allow,
|
|
194
|
+
actions: Action("lambda:InvokeFunction"),
|
|
195
|
+
resources: Resource(lambdaArn),
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
)
|
|
199
|
+
->PolicyDocument.toJsonString
|
|
200
|
+
->Pulumi.Input.make,
|
|
201
|
+
role: dataSourceRoleId->Pulumi.Input.make,
|
|
202
|
+
},
|
|
203
|
+
~opts,
|
|
204
|
+
)
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
let dataSource = AppSync.DataSource.make(
|
|
208
|
+
~name=name ++ "DataSource",
|
|
209
|
+
~args={
|
|
210
|
+
type_: AWS_LAMBDA,
|
|
211
|
+
apiId: api->Pulumi.Output.flatMap(api => api.id)->Pulumi.Output.asInput,
|
|
212
|
+
lambdaConfig: {
|
|
213
|
+
AppSync.DataSource.functionArn: lambda.arn->Pulumi.Output.asInput,
|
|
214
|
+
}->Pulumi.Input.make,
|
|
215
|
+
serviceRoleArn: dataSourceRole.arn->Pulumi.Output.asInput,
|
|
216
|
+
},
|
|
217
|
+
~opts=Some(opts),
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
let _resolver = AppSync_Resolver_Native.makeUnitJsResolver(
|
|
221
|
+
~name=name ++ "Resolver",
|
|
222
|
+
~api,
|
|
223
|
+
~dataSourceName=dataSource.name->Pulumi.Output.asInput,
|
|
224
|
+
~type_="Query"->Pulumi.Input.make,
|
|
225
|
+
~field="Platform_UIFragments"->Pulumi.Input.make,
|
|
226
|
+
~code=resolverCode,
|
|
227
|
+
~opts,
|
|
228
|
+
)
|
|
229
|
+
}
|