@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,245 @@
|
|
|
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
|
+
|
|
17
|
+
function makeHandlerCode(param) {
|
|
18
|
+
return `
|
|
19
|
+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
20
|
+
import { DynamoDBDocumentClient, ScanCommand } from "@aws-sdk/lib-dynamodb";
|
|
21
|
+
|
|
22
|
+
const client = DynamoDBDocumentClient.from(new DynamoDBClient({}));
|
|
23
|
+
const TABLE = process.env.UI_FRAGMENT_RM_TABLE;
|
|
24
|
+
|
|
25
|
+
export async function handler() {
|
|
26
|
+
if (!TABLE) {
|
|
27
|
+
console.error("Platform_UIFragments: UI_FRAGMENT_RM_TABLE env var not set");
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const items = [];
|
|
31
|
+
let exclusiveStartKey;
|
|
32
|
+
do {
|
|
33
|
+
const out = await client.send(new ScanCommand({
|
|
34
|
+
TableName: TABLE,
|
|
35
|
+
Limit: 1000,
|
|
36
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
37
|
+
}));
|
|
38
|
+
if (out.Items) items.push(...out.Items);
|
|
39
|
+
exclusiveStartKey = out.LastEvaluatedKey;
|
|
40
|
+
} while (exclusiveStartKey);
|
|
41
|
+
|
|
42
|
+
// Platform invariant: one version per plugin at a time, so the UI sees just
|
|
43
|
+
// the bare plugin name (mirrors ReventlessCore.Plugin.name). UIFragmentRegistry
|
|
44
|
+
// accumulates one row per deployed plugin version and carries no lifecycle
|
|
45
|
+
// status of its own, so without deduping a redeployed federation plugin would
|
|
46
|
+
// surface duplicate fragments. Collapse to the highest version per plugin name
|
|
47
|
+
// (mirrors ReventlessCore.Plugin.compareVersions).
|
|
48
|
+
const cmpVer = (a, b) => {
|
|
49
|
+
const pa = String(a).replace(/[-+]/g, ".").split(".");
|
|
50
|
+
const pb = String(b).replace(/[-+]/g, ".").split(".");
|
|
51
|
+
const len = Math.max(pa.length, pb.length);
|
|
52
|
+
for (let i = 0; i < len; i++) {
|
|
53
|
+
const sa = pa[i] ?? "", sb = pb[i] ?? "";
|
|
54
|
+
const na = Number(sa), nb = Number(sb);
|
|
55
|
+
const bothNum = sa !== "" && sb !== "" && !Number.isNaN(na) && !Number.isNaN(nb);
|
|
56
|
+
if (bothNum) { if (na !== nb) return na > nb ? 1 : -1; }
|
|
57
|
+
else if (sa !== sb) return sa > sb ? 1 : -1;
|
|
58
|
+
}
|
|
59
|
+
return 0;
|
|
60
|
+
};
|
|
61
|
+
const latestByName = new Map();
|
|
62
|
+
for (const item of items) {
|
|
63
|
+
if (!item || !item.pluginId || !item.remoteEntryUrl) continue;
|
|
64
|
+
const name = String(item.pluginId).split("@")[0];
|
|
65
|
+
const version = String(item.pluginId).split("@")[1] ?? "";
|
|
66
|
+
const prev = latestByName.get(name);
|
|
67
|
+
if (!prev || cmpVer(version, prev.version) > 0) {
|
|
68
|
+
latestByName.set(name, {
|
|
69
|
+
version,
|
|
70
|
+
entry: {
|
|
71
|
+
pluginId: name,
|
|
72
|
+
remoteEntryUrl: item.remoteEntryUrl,
|
|
73
|
+
panels: item.panels || [],
|
|
74
|
+
pages: item.pages || [],
|
|
75
|
+
registeredAt: item.registeredAt || "",
|
|
76
|
+
updatedAt: item.updatedAt || "",
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return [...latestByName.values()].map(v => v.entry);
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let resolverCode = `
|
|
87
|
+
import { util } from '@aws-appsync/utils';
|
|
88
|
+
export function request(ctx) {
|
|
89
|
+
return { operation: 'Invoke', payload: {} };
|
|
90
|
+
}
|
|
91
|
+
export function response(ctx) {
|
|
92
|
+
if (ctx.error) util.error(ctx.error.message, ctx.error.type);
|
|
93
|
+
return ctx.result;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
function make(api, uiFragmentRegistryTableName, opts) {
|
|
98
|
+
let opts$1 = Util_Pulumi$ReventlessCore.ComponentResourceOptions.toCustomResourceOptions(opts);
|
|
99
|
+
let name = "PlatformUIFragments";
|
|
100
|
+
let lambdaRole = IAM$PulumiAws.Role.makeWithDefaultPolicy(name + "Lambda", Pulumi.output(AWS$ReventlessAws.Lambda.principal), opts$1);
|
|
101
|
+
uiFragmentRegistryTableName.apply(tableName => {
|
|
102
|
+
new (Aws.iam.RolePolicy)(name + "LambdaPolicy", {
|
|
103
|
+
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, name + "LambdaPolicy", [
|
|
104
|
+
{
|
|
105
|
+
Sid: "AllowLambdaLogging",
|
|
106
|
+
Effect: "Allow",
|
|
107
|
+
Action: "logs:*",
|
|
108
|
+
Resource: "arn:aws:logs:*:*:*"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
Sid: "AllowScanUIFragmentRegistryRm",
|
|
112
|
+
Effect: "Allow",
|
|
113
|
+
Action: ["dynamodb:Scan"],
|
|
114
|
+
Resource: "arn:aws:dynamodb:*:*:table/" + tableName
|
|
115
|
+
}
|
|
116
|
+
])),
|
|
117
|
+
role: lambdaRole.id
|
|
118
|
+
}, opts$1);
|
|
119
|
+
});
|
|
120
|
+
let archiveContents = {};
|
|
121
|
+
let handlerCodeStub = `
|
|
122
|
+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
123
|
+
import { DynamoDBDocumentClient, ScanCommand } from "@aws-sdk/lib-dynamodb";
|
|
124
|
+
|
|
125
|
+
const client = DynamoDBDocumentClient.from(new DynamoDBClient({}));
|
|
126
|
+
const TABLE = process.env.UI_FRAGMENT_RM_TABLE;
|
|
127
|
+
|
|
128
|
+
export async function handler() {
|
|
129
|
+
if (!TABLE) {
|
|
130
|
+
console.error("Platform_UIFragments: UI_FRAGMENT_RM_TABLE env var not set");
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
const items = [];
|
|
134
|
+
let exclusiveStartKey;
|
|
135
|
+
do {
|
|
136
|
+
const out = await client.send(new ScanCommand({
|
|
137
|
+
TableName: TABLE,
|
|
138
|
+
Limit: 1000,
|
|
139
|
+
ExclusiveStartKey: exclusiveStartKey,
|
|
140
|
+
}));
|
|
141
|
+
if (out.Items) items.push(...out.Items);
|
|
142
|
+
exclusiveStartKey = out.LastEvaluatedKey;
|
|
143
|
+
} while (exclusiveStartKey);
|
|
144
|
+
|
|
145
|
+
// Platform invariant: one version per plugin at a time, so the UI sees just
|
|
146
|
+
// the bare plugin name (mirrors ReventlessCore.Plugin.name). UIFragmentRegistry
|
|
147
|
+
// accumulates one row per deployed plugin version and carries no lifecycle
|
|
148
|
+
// status of its own, so without deduping a redeployed federation plugin would
|
|
149
|
+
// surface duplicate fragments. Collapse to the highest version per plugin name
|
|
150
|
+
// (mirrors ReventlessCore.Plugin.compareVersions).
|
|
151
|
+
const cmpVer = (a, b) => {
|
|
152
|
+
const pa = String(a).replace(/[-+]/g, ".").split(".");
|
|
153
|
+
const pb = String(b).replace(/[-+]/g, ".").split(".");
|
|
154
|
+
const len = Math.max(pa.length, pb.length);
|
|
155
|
+
for (let i = 0; i < len; i++) {
|
|
156
|
+
const sa = pa[i] ?? "", sb = pb[i] ?? "";
|
|
157
|
+
const na = Number(sa), nb = Number(sb);
|
|
158
|
+
const bothNum = sa !== "" && sb !== "" && !Number.isNaN(na) && !Number.isNaN(nb);
|
|
159
|
+
if (bothNum) { if (na !== nb) return na > nb ? 1 : -1; }
|
|
160
|
+
else if (sa !== sb) return sa > sb ? 1 : -1;
|
|
161
|
+
}
|
|
162
|
+
return 0;
|
|
163
|
+
};
|
|
164
|
+
const latestByName = new Map();
|
|
165
|
+
for (const item of items) {
|
|
166
|
+
if (!item || !item.pluginId || !item.remoteEntryUrl) continue;
|
|
167
|
+
const name = String(item.pluginId).split("@")[0];
|
|
168
|
+
const version = String(item.pluginId).split("@")[1] ?? "";
|
|
169
|
+
const prev = latestByName.get(name);
|
|
170
|
+
if (!prev || cmpVer(version, prev.version) > 0) {
|
|
171
|
+
latestByName.set(name, {
|
|
172
|
+
version,
|
|
173
|
+
entry: {
|
|
174
|
+
pluginId: name,
|
|
175
|
+
remoteEntryUrl: item.remoteEntryUrl,
|
|
176
|
+
panels: item.panels || [],
|
|
177
|
+
pages: item.pages || [],
|
|
178
|
+
registeredAt: item.registeredAt || "",
|
|
179
|
+
updatedAt: item.updatedAt || "",
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return [...latestByName.values()].map(v => v.entry);
|
|
185
|
+
}
|
|
186
|
+
`;
|
|
187
|
+
archiveContents["index.mjs"] = new (Pulumi.asset.StringAsset)(handlerCodeStub);
|
|
188
|
+
let code = new (Pulumi.asset.AssetArchive)(archiveContents);
|
|
189
|
+
let sourceCodeHash = Util_Bundle$ReventlessAws.hashString(handlerCodeStub);
|
|
190
|
+
let layers = Stdlib_Option.getOr(Stdlib_Option.map(Lambda$PulumiAws.reventlessLayerArn, arn => [arn]), []);
|
|
191
|
+
let lambda = new (Aws.lambda.Function)(name + "Lambda", {
|
|
192
|
+
handler: "index.handler",
|
|
193
|
+
runtime: "nodejs22.x",
|
|
194
|
+
code: code,
|
|
195
|
+
role: lambdaRole.arn,
|
|
196
|
+
memorySize: 512,
|
|
197
|
+
timeout: 30,
|
|
198
|
+
layers: layers,
|
|
199
|
+
tags: AWS_Tags$ReventlessAws.make(name + "Lambda", ReadModel$ReventlessCore.componentType),
|
|
200
|
+
environment: {
|
|
201
|
+
variables: Object.fromEntries([
|
|
202
|
+
[
|
|
203
|
+
"Environment",
|
|
204
|
+
Pulumi.getStack()
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
"UI_FRAGMENT_RM_TABLE",
|
|
208
|
+
uiFragmentRegistryTableName
|
|
209
|
+
]
|
|
210
|
+
])
|
|
211
|
+
},
|
|
212
|
+
sourceCodeHash: sourceCodeHash
|
|
213
|
+
}, opts$1);
|
|
214
|
+
let dataSourceRole = IAM$PulumiAws.Role.makeWithDefaultPolicy(name + "DataSource", Pulumi.output(AWS$ReventlessAws.AppSync.principal), opts$1);
|
|
215
|
+
Pulumi.all([
|
|
216
|
+
lambda.arn,
|
|
217
|
+
dataSourceRole.id
|
|
218
|
+
]).apply(param => {
|
|
219
|
+
new (Aws.iam.RolePolicy)(name + "DataSource", {
|
|
220
|
+
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, name + "DataSourcePolicy", [{
|
|
221
|
+
Sid: "AllowDataSourceInvokeLambda",
|
|
222
|
+
Effect: "Allow",
|
|
223
|
+
Action: "lambda:InvokeFunction",
|
|
224
|
+
Resource: param[0]
|
|
225
|
+
}])),
|
|
226
|
+
role: param[1]
|
|
227
|
+
}, opts$1);
|
|
228
|
+
});
|
|
229
|
+
let dataSource = new (Aws.appsync.DataSource)(name + "DataSource", {
|
|
230
|
+
type: "AWS_LAMBDA",
|
|
231
|
+
apiId: Output$Pulumi.flatMap(api, api => api.id),
|
|
232
|
+
lambdaConfig: {
|
|
233
|
+
functionArn: lambda.arn
|
|
234
|
+
},
|
|
235
|
+
serviceRoleArn: dataSourceRole.arn
|
|
236
|
+
}, opts$1);
|
|
237
|
+
AppSync_Resolver_Native$ReventlessAws.makeUnitJsResolver(name + "Resolver", api, dataSource.name, "Query", "Platform_UIFragments", resolverCode, opts$1);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export {
|
|
241
|
+
makeHandlerCode,
|
|
242
|
+
resolverCode,
|
|
243
|
+
make,
|
|
244
|
+
}
|
|
245
|
+
/* @pulumi/aws Not a pure module */
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// AWS Cognito `Auth_Adapter.Provider` implementation.
|
|
2
|
+
//
|
|
3
|
+
// Two runtime entry points:
|
|
4
|
+
//
|
|
5
|
+
// * `authenticate` — pure header-driven path (HTTP Lambda Function URL,
|
|
6
|
+
// API Gateway, MCP). Decodes the JWT claims from the
|
|
7
|
+
// `Authorization: Bearer <token>` header WITHOUT signature verification.
|
|
8
|
+
// The Cognito-authenticated AppSync API verifies the JWT before the
|
|
9
|
+
// resolver Lambda runs, so this path trusts the caller's transport
|
|
10
|
+
// guarantees.
|
|
11
|
+
//
|
|
12
|
+
// * `fromAppSyncIdentity` — AppSync-resolver path. Reads the
|
|
13
|
+
// already-validated identity context attached by AppSync to the
|
|
14
|
+
// resolver event (`event.identity`). Recognises both the Cognito
|
|
15
|
+
// UserPool shape (`sub`, `username`, `claims['cognito:groups']`) and
|
|
16
|
+
// the AWS_IAM additional-provider shape (`userArn`, `accountId`) used
|
|
17
|
+
// by server-to-server lambdas signed via the existing IAM role.
|
|
18
|
+
//
|
|
19
|
+
// Deploy-time `make` delegates to `Platform_Stack.resolveCognitoUserPool`
|
|
20
|
+
// (cached internally so multiple callers — e.g. a future direct invocation
|
|
21
|
+
// from `Platform.MakeWithConfig` plus the existing call from app
|
|
22
|
+
// `Main.res` — converge on the same resource set).
|
|
23
|
+
|
|
24
|
+
open Reventless
|
|
25
|
+
|
|
26
|
+
// ── Shared JWT claims decode ──────────────────────────────────────────────
|
|
27
|
+
//
|
|
28
|
+
// AppSync's userPoolConfig verifies the JWT signature on every request
|
|
29
|
+
// before invoking the resolver Lambda, so the runtime path only needs to
|
|
30
|
+
// read the claims. MCP_Lambda's `extractIdentity` follows the same
|
|
31
|
+
// pattern; this implementation is kept compatible.
|
|
32
|
+
|
|
33
|
+
let _decodeJwtClaims: string => option<'a> = %raw(`
|
|
34
|
+
function(token) {
|
|
35
|
+
try {
|
|
36
|
+
var parts = token.split(".");
|
|
37
|
+
if (parts.length < 2) return undefined;
|
|
38
|
+
var base64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
39
|
+
var json = Buffer.from(base64, "base64").toString("utf8");
|
|
40
|
+
return JSON.parse(json);
|
|
41
|
+
} catch(_) { return undefined; }
|
|
42
|
+
}
|
|
43
|
+
`)
|
|
44
|
+
|
|
45
|
+
let _bearerToken = (header: string): option<string> =>
|
|
46
|
+
if header->String.startsWith("Bearer ") {
|
|
47
|
+
Some(header->String.slice(~start=7, ~end=header->String.length)->String.trim)
|
|
48
|
+
} else {
|
|
49
|
+
None
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let _getHeader = (headers: dict<string>, name: string): option<string> =>
|
|
53
|
+
// Headers are normalised to lowercase by transport adapters before reaching
|
|
54
|
+
// the provider (graphql-yoga and AppSync Lambda integration both do this).
|
|
55
|
+
// We tolerate either case here.
|
|
56
|
+
switch headers->Dict.get(name->String.toLowerCase) {
|
|
57
|
+
| Some(v) => Some(v)
|
|
58
|
+
| None => headers->Dict.get(name)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let _identityFromClaims = (claims: 'a): Identity.t => {
|
|
62
|
+
let claimsDict: dict<JSON.t> = claims->Obj.magic
|
|
63
|
+
let userId =
|
|
64
|
+
claimsDict
|
|
65
|
+
->Dict.get("sub")
|
|
66
|
+
->Option.flatMap(JSON.Decode.string)
|
|
67
|
+
->Option.getOr("anonymous")
|
|
68
|
+
let username =
|
|
69
|
+
claimsDict
|
|
70
|
+
->Dict.get("cognito:username")
|
|
71
|
+
->Option.orElse(claimsDict->Dict.get("username"))
|
|
72
|
+
->Option.flatMap(JSON.Decode.string)
|
|
73
|
+
->Option.getOr(userId)
|
|
74
|
+
let groups: array<string> =
|
|
75
|
+
claimsDict
|
|
76
|
+
->Dict.get("cognito:groups")
|
|
77
|
+
->Option.map(g => g->Obj.magic)
|
|
78
|
+
->Option.getOr([])
|
|
79
|
+
{
|
|
80
|
+
Identity.userId,
|
|
81
|
+
username,
|
|
82
|
+
groups,
|
|
83
|
+
provider: Cognito,
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ── Provider implementation ───────────────────────────────────────────────
|
|
88
|
+
|
|
89
|
+
type authConfig = {
|
|
90
|
+
userPoolId: string,
|
|
91
|
+
userPoolArn: string,
|
|
92
|
+
clientId: string,
|
|
93
|
+
region: string,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let authenticate = async (
|
|
97
|
+
ctx: ReventlessCore.Auth_Adapter.requestContext,
|
|
98
|
+
): Identity.authResult => {
|
|
99
|
+
let token =
|
|
100
|
+
_getHeader(ctx.headers, "Authorization")->Option.flatMap(_bearerToken)
|
|
101
|
+
switch token {
|
|
102
|
+
| None => Anonymous
|
|
103
|
+
| Some(t) =>
|
|
104
|
+
switch _decodeJwtClaims(t) {
|
|
105
|
+
| None => AuthError("malformed bearer token")
|
|
106
|
+
| Some(claims) => Authenticated(_identityFromClaims(claims))
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ── AppSync resolver-event path ───────────────────────────────────────────
|
|
112
|
+
//
|
|
113
|
+
// AppSync resolver Lambdas receive `event.identity` already populated with
|
|
114
|
+
// validated identity data. For the Cognito User Pools auth path the shape is
|
|
115
|
+
// `{sub, username, claims, issuer, sourceIp, defaultAuthStrategy, groups?}`.
|
|
116
|
+
// For the AWS_IAM additional-provider path the shape is
|
|
117
|
+
// `{userArn, accountId, cognitoIdentityPoolId?, cognitoIdentityId?, sourceIp,
|
|
118
|
+
// username, userArn}`. The two are disambiguated by the presence of `sub`.
|
|
119
|
+
|
|
120
|
+
type appSyncIdentity = {
|
|
121
|
+
sub?: string,
|
|
122
|
+
username?: string,
|
|
123
|
+
claims?: dict<JSON.t>,
|
|
124
|
+
issuer?: string,
|
|
125
|
+
userArn?: string,
|
|
126
|
+
accountId?: string,
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Build an `Identity.authResult` from the AppSync resolver event identity
|
|
130
|
+
block. Pass `event.identity` directly (or `None` if absent). */
|
|
131
|
+
let fromAppSyncIdentity = (id: option<appSyncIdentity>): Identity.authResult =>
|
|
132
|
+
switch id {
|
|
133
|
+
| None => Anonymous
|
|
134
|
+
| Some(identity) =>
|
|
135
|
+
switch identity.sub {
|
|
136
|
+
| Some(sub) =>
|
|
137
|
+
// Cognito User Pools — read claims, fall back to top-level fields when
|
|
138
|
+
// the gateway omitted `claims` (e.g. APPSYNC_JS pipelined invocations).
|
|
139
|
+
let rawClaims = identity.claims->Option.getOr(Dict.make())
|
|
140
|
+
let username =
|
|
141
|
+
rawClaims
|
|
142
|
+
->Dict.get("cognito:username")
|
|
143
|
+
->Option.orElse(rawClaims->Dict.get("username"))
|
|
144
|
+
->Option.flatMap(JSON.Decode.string)
|
|
145
|
+
->Option.orElse(identity.username)
|
|
146
|
+
->Option.getOr(sub)
|
|
147
|
+
let groups: array<string> =
|
|
148
|
+
rawClaims
|
|
149
|
+
->Dict.get("cognito:groups")
|
|
150
|
+
->Option.map(g => g->Obj.magic)
|
|
151
|
+
->Option.getOr([])
|
|
152
|
+
// Identity.claims is `dict<string>` — stringify any non-string JSON
|
|
153
|
+
// value so the shape downstream consumers see is uniform.
|
|
154
|
+
let claims =
|
|
155
|
+
rawClaims
|
|
156
|
+
->Dict.toArray
|
|
157
|
+
->Array.map(((k, v)) => (
|
|
158
|
+
k,
|
|
159
|
+
v->JSON.Decode.string->Option.getOr(v->JSON.stringify),
|
|
160
|
+
))
|
|
161
|
+
->Dict.fromArray
|
|
162
|
+
Authenticated({
|
|
163
|
+
userId: sub,
|
|
164
|
+
username,
|
|
165
|
+
groups,
|
|
166
|
+
claims,
|
|
167
|
+
provider: Cognito,
|
|
168
|
+
})
|
|
169
|
+
| None =>
|
|
170
|
+
switch identity.userArn {
|
|
171
|
+
| Some(arn) =>
|
|
172
|
+
// AWS_IAM additional-provider — server-to-server. Encode the role
|
|
173
|
+
// ARN as userId and tag with a `Custom("aws-iam")` provider so
|
|
174
|
+
// downstream authorization can distinguish from human Cognito users.
|
|
175
|
+
Authenticated({
|
|
176
|
+
userId: arn,
|
|
177
|
+
username: identity.username->Option.getOr(arn),
|
|
178
|
+
groups: [],
|
|
179
|
+
provider: Custom("aws-iam"),
|
|
180
|
+
})
|
|
181
|
+
| None => Anonymous
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// ── Deploy-time wiring ────────────────────────────────────────────────────
|
|
187
|
+
//
|
|
188
|
+
// `Platform_Stack.resolveCognitoUserPool` performs the actual UserPool +
|
|
189
|
+
// UserPoolClient provisioning and exports the resulting ids/arn/region as
|
|
190
|
+
// stack outputs. It caches its result internally so this can be called from
|
|
191
|
+
// both `Main.res` and `Auth_Cognito.make` (e.g. Stage D2 AppSync wiring)
|
|
192
|
+
// without re-running resource registration or duplicating exports.
|
|
193
|
+
|
|
194
|
+
let make = (
|
|
195
|
+
~name as _: string,
|
|
196
|
+
~opts as _: option<Pulumi.ComponentResource.options>=?,
|
|
197
|
+
): Pulumi.Output.t<authConfig> => {
|
|
198
|
+
let pool = Platform_Stack.resolveCognitoUserPool()
|
|
199
|
+
let regionStr =
|
|
200
|
+
Pulumi.Config.make(Some("aws"))->Pulumi.Config.get("region")->Option.getOr("unknown")
|
|
201
|
+
(pool.poolId, pool.poolArn, pool.clientId)
|
|
202
|
+
->Pulumi.Output.all3
|
|
203
|
+
->Pulumi.Output.apply(((userPoolId, userPoolArn, clientId)) => {
|
|
204
|
+
userPoolId,
|
|
205
|
+
userPoolArn,
|
|
206
|
+
clientId,
|
|
207
|
+
region: regionStr,
|
|
208
|
+
})
|
|
209
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
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 Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Pulumi from "@pulumi/pulumi";
|
|
6
|
+
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
|
|
7
|
+
import * as Platform_Stack$ReventlessAws from "../../Platform_Stack.res.mjs";
|
|
8
|
+
|
|
9
|
+
let _decodeJwtClaims = (function(token) {
|
|
10
|
+
try {
|
|
11
|
+
var parts = token.split(".");
|
|
12
|
+
if (parts.length < 2) return undefined;
|
|
13
|
+
var base64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
14
|
+
var json = Buffer.from(base64, "base64").toString("utf8");
|
|
15
|
+
return JSON.parse(json);
|
|
16
|
+
} catch(_) { return undefined; }
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function _bearerToken(header) {
|
|
20
|
+
if (header.startsWith("Bearer ")) {
|
|
21
|
+
return header.slice(7, header.length).trim();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _getHeader(headers, name) {
|
|
26
|
+
let v = headers[name.toLowerCase()];
|
|
27
|
+
if (v !== undefined) {
|
|
28
|
+
return v;
|
|
29
|
+
} else {
|
|
30
|
+
return headers[name];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _identityFromClaims(claims) {
|
|
35
|
+
let userId = Stdlib_Option.getOr(Stdlib_Option.flatMap(claims["sub"], Stdlib_JSON.Decode.string), "anonymous");
|
|
36
|
+
let username = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_Option.orElse(claims["cognito:username"], claims["username"]), Stdlib_JSON.Decode.string), userId);
|
|
37
|
+
let groups = Stdlib_Option.getOr(Stdlib_Option.map(claims["cognito:groups"], g => g), []);
|
|
38
|
+
return {
|
|
39
|
+
userId: userId,
|
|
40
|
+
username: username,
|
|
41
|
+
groups: groups,
|
|
42
|
+
provider: "Cognito"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function authenticate(ctx) {
|
|
47
|
+
let token = Stdlib_Option.flatMap(_getHeader(ctx.headers, "Authorization"), _bearerToken);
|
|
48
|
+
if (token === undefined) {
|
|
49
|
+
return "Anonymous";
|
|
50
|
+
}
|
|
51
|
+
let claims = _decodeJwtClaims(token);
|
|
52
|
+
if (claims !== undefined) {
|
|
53
|
+
return {
|
|
54
|
+
TAG: "Authenticated",
|
|
55
|
+
_0: _identityFromClaims(Primitive_option.valFromOption(claims))
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
return {
|
|
59
|
+
TAG: "AuthError",
|
|
60
|
+
_0: "malformed bearer token"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function fromAppSyncIdentity(id) {
|
|
66
|
+
if (id === undefined) {
|
|
67
|
+
return "Anonymous";
|
|
68
|
+
}
|
|
69
|
+
let sub = id.sub;
|
|
70
|
+
if (sub !== undefined) {
|
|
71
|
+
let rawClaims = Stdlib_Option.getOr(id.claims, {});
|
|
72
|
+
let username = Stdlib_Option.getOr(Stdlib_Option.orElse(Stdlib_Option.flatMap(Stdlib_Option.orElse(rawClaims["cognito:username"], rawClaims["username"]), Stdlib_JSON.Decode.string), id.username), sub);
|
|
73
|
+
let groups = Stdlib_Option.getOr(Stdlib_Option.map(rawClaims["cognito:groups"], g => g), []);
|
|
74
|
+
let claims = Object.fromEntries(Object.entries(rawClaims).map(param => {
|
|
75
|
+
let v = param[1];
|
|
76
|
+
return [
|
|
77
|
+
param[0],
|
|
78
|
+
Stdlib_Option.getOr(Stdlib_JSON.Decode.string(v), JSON.stringify(v))
|
|
79
|
+
];
|
|
80
|
+
}));
|
|
81
|
+
return {
|
|
82
|
+
TAG: "Authenticated",
|
|
83
|
+
_0: {
|
|
84
|
+
userId: sub,
|
|
85
|
+
username: username,
|
|
86
|
+
groups: groups,
|
|
87
|
+
claims: claims,
|
|
88
|
+
provider: "Cognito"
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
let arn = id.userArn;
|
|
93
|
+
if (arn !== undefined) {
|
|
94
|
+
return {
|
|
95
|
+
TAG: "Authenticated",
|
|
96
|
+
_0: {
|
|
97
|
+
userId: arn,
|
|
98
|
+
username: Stdlib_Option.getOr(id.username, arn),
|
|
99
|
+
groups: [],
|
|
100
|
+
provider: {
|
|
101
|
+
TAG: "Custom",
|
|
102
|
+
_0: "aws-iam"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
} else {
|
|
107
|
+
return "Anonymous";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function make(param, param$1) {
|
|
112
|
+
let pool = Platform_Stack$ReventlessAws.resolveCognitoUserPool();
|
|
113
|
+
let regionStr = Stdlib_Option.getOr(new Pulumi.Config("aws").get("region"), "unknown");
|
|
114
|
+
return Pulumi.all([
|
|
115
|
+
pool.poolId,
|
|
116
|
+
pool.poolArn,
|
|
117
|
+
pool.clientId
|
|
118
|
+
]).apply(param => ({
|
|
119
|
+
userPoolId: param[0],
|
|
120
|
+
userPoolArn: param[1],
|
|
121
|
+
clientId: param[2],
|
|
122
|
+
region: regionStr
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
_decodeJwtClaims,
|
|
128
|
+
_bearerToken,
|
|
129
|
+
_getHeader,
|
|
130
|
+
_identityFromClaims,
|
|
131
|
+
authenticate,
|
|
132
|
+
fromAppSyncIdentity,
|
|
133
|
+
make,
|
|
134
|
+
}
|
|
135
|
+
/* @pulumi/pulumi Not a pure module */
|