@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,435 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
+
import * as Message$ReventlessCore from "@reventlessdev/reventless-core/src/Message.res.mjs";
|
|
5
|
+
import * as DcbIntegrationHarness$ReventlessAws from "./DcbIntegrationHarness.res.mjs";
|
|
6
|
+
import * as DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws from "../../src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb_Runtime.res.mjs";
|
|
7
|
+
|
|
8
|
+
function tag(key, value) {
|
|
9
|
+
return {
|
|
10
|
+
key: key,
|
|
11
|
+
value: value
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function meta() {
|
|
16
|
+
return Message$ReventlessCore.generateMeta("dcb-it", undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function event(eventType, tags) {
|
|
20
|
+
return {
|
|
21
|
+
eventType: eventType,
|
|
22
|
+
data: {},
|
|
23
|
+
tags: tags,
|
|
24
|
+
meta: meta()
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function simple(key) {
|
|
29
|
+
return {
|
|
30
|
+
TAG: "Simple",
|
|
31
|
+
_0: {
|
|
32
|
+
key: key
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function isOk(r) {
|
|
38
|
+
return r.TAG === "Ok";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function isConflict(r) {
|
|
42
|
+
if (r.TAG === "Ok") {
|
|
43
|
+
return false;
|
|
44
|
+
} else {
|
|
45
|
+
return r._0.includes("Conflict");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function readAfter(table, query) {
|
|
50
|
+
return (await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.read(table, undefined)(query, undefined)).headPosition;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function seed(table, ev, partitionTag) {
|
|
54
|
+
return DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendUnconditional(table, [ev], partitionTag);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
globalThis.describe("DCB DynamoDb integration — fence-scope = read-scope (Issue 1 regression)", () => {
|
|
58
|
+
let productTag = {
|
|
59
|
+
key: "productId",
|
|
60
|
+
value: "P5"
|
|
61
|
+
};
|
|
62
|
+
let placeOrder = async (table, orderId, customerId) => {
|
|
63
|
+
let query = [
|
|
64
|
+
{
|
|
65
|
+
tags: [{
|
|
66
|
+
key: "orderId",
|
|
67
|
+
value: orderId
|
|
68
|
+
}]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
tags: [productTag]
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
let after = await readAfter(table, query);
|
|
75
|
+
return await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("OrderPlaced", [
|
|
76
|
+
{
|
|
77
|
+
key: "orderId",
|
|
78
|
+
value: orderId
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: "customerId",
|
|
82
|
+
value: customerId
|
|
83
|
+
},
|
|
84
|
+
productTag
|
|
85
|
+
])], {
|
|
86
|
+
query: query,
|
|
87
|
+
after: after
|
|
88
|
+
}, {
|
|
89
|
+
TAG: "Simple",
|
|
90
|
+
_0: {
|
|
91
|
+
key: "orderId"
|
|
92
|
+
}
|
|
93
|
+
}, undefined);
|
|
94
|
+
};
|
|
95
|
+
globalThis.test("a second order of the same product (different order + customer) succeeds", async () => {
|
|
96
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
97
|
+
await seed(table, event("CatalogProductSynced", [productTag]), {
|
|
98
|
+
TAG: "Simple",
|
|
99
|
+
_0: {
|
|
100
|
+
key: "productId"
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
let r1 = await placeOrder(table, "O1", "C1");
|
|
104
|
+
let r2 = await placeOrder(table, "O2", "C2");
|
|
105
|
+
globalThis.expect(isOk(r1)).toBe(true);
|
|
106
|
+
globalThis.expect(isOk(r2)).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
globalThis.test("two concurrent orders of the same product both succeed (no productId contention)", async () => {
|
|
109
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
110
|
+
await seed(table, event("CatalogProductSynced", [productTag]), {
|
|
111
|
+
TAG: "Simple",
|
|
112
|
+
_0: {
|
|
113
|
+
key: "productId"
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
let results = await Promise.all([
|
|
117
|
+
placeOrder(table, "OA", "CA"),
|
|
118
|
+
placeOrder(table, "OB", "CB")
|
|
119
|
+
]);
|
|
120
|
+
globalThis.expect(results.every(isOk)).toBe(true);
|
|
121
|
+
});
|
|
122
|
+
globalThis.test("a concurrent product re-sync after the order's read still conflicts (OCC preserved)", async () => {
|
|
123
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
124
|
+
await seed(table, event("CatalogProductSynced", [productTag]), {
|
|
125
|
+
TAG: "Simple",
|
|
126
|
+
_0: {
|
|
127
|
+
key: "productId"
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
let query = [
|
|
131
|
+
{
|
|
132
|
+
tags: [{
|
|
133
|
+
key: "orderId",
|
|
134
|
+
value: "O1"
|
|
135
|
+
}]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
tags: [productTag]
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
let after = Stdlib_Option.getOr(await readAfter(table, query), "");
|
|
142
|
+
globalThis.expect(after === "").toBe(false);
|
|
143
|
+
await DcbIntegrationHarness$ReventlessAws.setFence(table, productTag, after + "z");
|
|
144
|
+
let r = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("OrderPlaced", [
|
|
145
|
+
{
|
|
146
|
+
key: "orderId",
|
|
147
|
+
value: "O1"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
key: "customerId",
|
|
151
|
+
value: "C1"
|
|
152
|
+
},
|
|
153
|
+
productTag
|
|
154
|
+
])], {
|
|
155
|
+
query: query,
|
|
156
|
+
after: after
|
|
157
|
+
}, {
|
|
158
|
+
TAG: "Simple",
|
|
159
|
+
_0: {
|
|
160
|
+
key: "orderId"
|
|
161
|
+
}
|
|
162
|
+
}, undefined);
|
|
163
|
+
globalThis.expect(isConflict(r)).toBe(true);
|
|
164
|
+
});
|
|
165
|
+
globalThis.test("placing an order does not poison the customer slice (secondary customerId not fenced)", async () => {
|
|
166
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
167
|
+
let customerTag = {
|
|
168
|
+
key: "customerId",
|
|
169
|
+
value: "C1"
|
|
170
|
+
};
|
|
171
|
+
await seed(table, event("CustomerRegistered", [customerTag]), {
|
|
172
|
+
TAG: "Simple",
|
|
173
|
+
_0: {
|
|
174
|
+
key: "customerId"
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
let orderQuery = [{
|
|
178
|
+
tags: [{
|
|
179
|
+
key: "orderId",
|
|
180
|
+
value: "O1"
|
|
181
|
+
}]
|
|
182
|
+
}];
|
|
183
|
+
let orderAfter = await readAfter(table, orderQuery);
|
|
184
|
+
await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("OrderPlaced", [
|
|
185
|
+
{
|
|
186
|
+
key: "orderId",
|
|
187
|
+
value: "O1"
|
|
188
|
+
},
|
|
189
|
+
customerTag,
|
|
190
|
+
productTag
|
|
191
|
+
])], {
|
|
192
|
+
query: orderQuery,
|
|
193
|
+
after: orderAfter
|
|
194
|
+
}, {
|
|
195
|
+
TAG: "Simple",
|
|
196
|
+
_0: {
|
|
197
|
+
key: "orderId"
|
|
198
|
+
}
|
|
199
|
+
}, undefined);
|
|
200
|
+
let customerQuery = [{
|
|
201
|
+
tags: [customerTag]
|
|
202
|
+
}];
|
|
203
|
+
let customerAfter = await readAfter(table, customerQuery);
|
|
204
|
+
let r = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("EmailChanged", [customerTag])], {
|
|
205
|
+
query: customerQuery,
|
|
206
|
+
after: customerAfter
|
|
207
|
+
}, {
|
|
208
|
+
TAG: "Simple",
|
|
209
|
+
_0: {
|
|
210
|
+
key: "customerId"
|
|
211
|
+
}
|
|
212
|
+
}, undefined);
|
|
213
|
+
globalThis.expect(isOk(r)).toBe(true);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
globalThis.describe("DCB DynamoDb integration — optimistic concurrency primitives", () => {
|
|
218
|
+
globalThis.test("fresh first-writer (after=None) succeeds and seeds the fence", async () => {
|
|
219
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
220
|
+
let query = [{
|
|
221
|
+
tags: [{
|
|
222
|
+
key: "counterId",
|
|
223
|
+
value: "K0"
|
|
224
|
+
}]
|
|
225
|
+
}];
|
|
226
|
+
let r = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("CounterStarted", [{
|
|
227
|
+
key: "counterId",
|
|
228
|
+
value: "K0"
|
|
229
|
+
}])], {
|
|
230
|
+
query: query
|
|
231
|
+
}, {
|
|
232
|
+
TAG: "Simple",
|
|
233
|
+
_0: {
|
|
234
|
+
key: "counterId"
|
|
235
|
+
}
|
|
236
|
+
}, undefined);
|
|
237
|
+
globalThis.expect(isOk(r)).toBe(true);
|
|
238
|
+
let after = await readAfter(table, query);
|
|
239
|
+
globalThis.expect(Stdlib_Option.isSome(after)).toBe(true);
|
|
240
|
+
});
|
|
241
|
+
globalThis.test("two concurrent commits at the same after never both win (no duplicate)", async () => {
|
|
242
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
243
|
+
let counterTag = {
|
|
244
|
+
key: "counterId",
|
|
245
|
+
value: "K1"
|
|
246
|
+
};
|
|
247
|
+
await seed(table, event("CounterStarted", [counterTag]), {
|
|
248
|
+
TAG: "Simple",
|
|
249
|
+
_0: {
|
|
250
|
+
key: "counterId"
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
let query = [{
|
|
254
|
+
tags: [counterTag]
|
|
255
|
+
}];
|
|
256
|
+
let after = await readAfter(table, query);
|
|
257
|
+
let increment = () => DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("CounterIncremented", [counterTag])], {
|
|
258
|
+
query: query,
|
|
259
|
+
after: after
|
|
260
|
+
}, {
|
|
261
|
+
TAG: "Simple",
|
|
262
|
+
_0: {
|
|
263
|
+
key: "counterId"
|
|
264
|
+
}
|
|
265
|
+
}, undefined);
|
|
266
|
+
let results = await Promise.all([
|
|
267
|
+
increment(),
|
|
268
|
+
increment()
|
|
269
|
+
]);
|
|
270
|
+
let oks = results.filter(isOk).length;
|
|
271
|
+
let conflicts = results.filter(isConflict).length;
|
|
272
|
+
globalThis.expect(oks <= 1).toBe(true);
|
|
273
|
+
globalThis.expect(oks + conflicts | 0).toBe(2);
|
|
274
|
+
globalThis.expect(conflicts >= 1).toBe(true);
|
|
275
|
+
});
|
|
276
|
+
globalThis.test("two concurrent first-writers to the same entity — exactly one creates it (Issue 2)", async () => {
|
|
277
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
278
|
+
let create = () => DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("OrderCreated", [{
|
|
279
|
+
key: "orderId",
|
|
280
|
+
value: "O1"
|
|
281
|
+
}])], {
|
|
282
|
+
query: [{
|
|
283
|
+
tags: [{
|
|
284
|
+
key: "orderId",
|
|
285
|
+
value: "O1"
|
|
286
|
+
}]
|
|
287
|
+
}]
|
|
288
|
+
}, {
|
|
289
|
+
TAG: "Simple",
|
|
290
|
+
_0: {
|
|
291
|
+
key: "orderId"
|
|
292
|
+
}
|
|
293
|
+
}, undefined);
|
|
294
|
+
let results = await Promise.all([
|
|
295
|
+
create(),
|
|
296
|
+
create()
|
|
297
|
+
]);
|
|
298
|
+
let oks = results.filter(isOk).length;
|
|
299
|
+
globalThis.expect(oks <= 1).toBe(true);
|
|
300
|
+
globalThis.expect(oks + results.filter(isConflict).length | 0).toBe(2);
|
|
301
|
+
let readResult = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.read(table, undefined)([{
|
|
302
|
+
tags: [{
|
|
303
|
+
key: "orderId",
|
|
304
|
+
value: "O1"
|
|
305
|
+
}]
|
|
306
|
+
}], undefined);
|
|
307
|
+
globalThis.expect(readResult.events.length).toBe(oks);
|
|
308
|
+
});
|
|
309
|
+
globalThis.test("the create guard does not false-conflict a subset-event-type writer (Issue 4)", async () => {
|
|
310
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
311
|
+
let productTag = {
|
|
312
|
+
key: "productId",
|
|
313
|
+
value: "P"
|
|
314
|
+
};
|
|
315
|
+
let r1 = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("ProductAdded", [productTag])], {
|
|
316
|
+
query: [{
|
|
317
|
+
tags: [productTag]
|
|
318
|
+
}]
|
|
319
|
+
}, {
|
|
320
|
+
TAG: "Simple",
|
|
321
|
+
_0: {
|
|
322
|
+
key: "productId"
|
|
323
|
+
}
|
|
324
|
+
}, undefined);
|
|
325
|
+
globalThis.expect(isOk(r1)).toBe(true);
|
|
326
|
+
let r2 = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("NameChanged", [productTag])], {
|
|
327
|
+
query: [{
|
|
328
|
+
tags: [productTag]
|
|
329
|
+
}]
|
|
330
|
+
}, {
|
|
331
|
+
TAG: "Simple",
|
|
332
|
+
_0: {
|
|
333
|
+
key: "productId"
|
|
334
|
+
}
|
|
335
|
+
}, undefined);
|
|
336
|
+
globalThis.expect(isOk(r2)).toBe(true);
|
|
337
|
+
});
|
|
338
|
+
globalThis.test("a chain of compatible commits all succeed", async () => {
|
|
339
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
340
|
+
let counterTag = {
|
|
341
|
+
key: "counterId",
|
|
342
|
+
value: "K2"
|
|
343
|
+
};
|
|
344
|
+
await seed(table, event("CounterStarted", [counterTag]), {
|
|
345
|
+
TAG: "Simple",
|
|
346
|
+
_0: {
|
|
347
|
+
key: "counterId"
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
let query = [{
|
|
351
|
+
tags: [counterTag]
|
|
352
|
+
}];
|
|
353
|
+
let step = async () => {
|
|
354
|
+
let after = await readAfter(table, query);
|
|
355
|
+
return await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("CounterIncremented", [counterTag])], {
|
|
356
|
+
query: query,
|
|
357
|
+
after: after
|
|
358
|
+
}, {
|
|
359
|
+
TAG: "Simple",
|
|
360
|
+
_0: {
|
|
361
|
+
key: "counterId"
|
|
362
|
+
}
|
|
363
|
+
}, undefined);
|
|
364
|
+
};
|
|
365
|
+
let r1 = await step();
|
|
366
|
+
let r2 = await step();
|
|
367
|
+
let r3 = await step();
|
|
368
|
+
globalThis.expect([
|
|
369
|
+
r1,
|
|
370
|
+
r2,
|
|
371
|
+
r3
|
|
372
|
+
].every(isOk)).toBe(true);
|
|
373
|
+
});
|
|
374
|
+
globalThis.test("a failed fence condition aborts the whole transaction (multi-tag atomicity)", async () => {
|
|
375
|
+
let table = await DcbIntegrationHarness$ReventlessAws.freshTable();
|
|
376
|
+
let tags = [
|
|
377
|
+
{
|
|
378
|
+
key: "productId",
|
|
379
|
+
value: "p1"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
key: "orderId",
|
|
383
|
+
value: "o1"
|
|
384
|
+
}
|
|
385
|
+
];
|
|
386
|
+
let query = [{
|
|
387
|
+
tags: tags
|
|
388
|
+
}];
|
|
389
|
+
let seedRes = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("ProductDemandRecorded", tags)], {
|
|
390
|
+
query: query
|
|
391
|
+
}, {
|
|
392
|
+
TAG: "Simple",
|
|
393
|
+
_0: {
|
|
394
|
+
key: "productId"
|
|
395
|
+
}
|
|
396
|
+
}, undefined);
|
|
397
|
+
globalThis.expect(isOk(seedRes)).toBe(true);
|
|
398
|
+
let after = Stdlib_Option.getOr(await readAfter(table, query), "");
|
|
399
|
+
globalThis.expect(after === "").toBe(false);
|
|
400
|
+
await DcbIntegrationHarness$ReventlessAws.setFence(table, {
|
|
401
|
+
key: "productId",
|
|
402
|
+
value: "p1"
|
|
403
|
+
}, after + "z");
|
|
404
|
+
let r = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.appendConditional(table, [event("ProductDemandRecorded", tags)], {
|
|
405
|
+
query: query,
|
|
406
|
+
after: after
|
|
407
|
+
}, {
|
|
408
|
+
TAG: "Simple",
|
|
409
|
+
_0: {
|
|
410
|
+
key: "productId"
|
|
411
|
+
}
|
|
412
|
+
}, undefined);
|
|
413
|
+
globalThis.expect(isConflict(r)).toBe(true);
|
|
414
|
+
let readResult = await DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.read(table, undefined)(query, undefined);
|
|
415
|
+
globalThis.expect(readResult.events.length).toBe(1);
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
let H;
|
|
420
|
+
|
|
421
|
+
let Runtime;
|
|
422
|
+
|
|
423
|
+
export {
|
|
424
|
+
H,
|
|
425
|
+
Runtime,
|
|
426
|
+
tag,
|
|
427
|
+
meta,
|
|
428
|
+
event,
|
|
429
|
+
simple,
|
|
430
|
+
isOk,
|
|
431
|
+
isConflict,
|
|
432
|
+
readAfter,
|
|
433
|
+
seed,
|
|
434
|
+
}
|
|
435
|
+
/* Not a pure module */
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Test-only harness for the DCB DynamoDB integration suite.
|
|
2
|
+
//
|
|
3
|
+
// Boots against a DynamoDB Local instance (see
|
|
4
|
+
// `scripts/run-integration-tests.sh` + `docker-compose.dynamodb-local.yml`).
|
|
5
|
+
// The production adapter's singleton DynamoDB client (`AwsSdk.DynamoDb.*`)
|
|
6
|
+
// resolves its endpoint from `AWS_ENDPOINT_URL_DYNAMODB`, set by
|
|
7
|
+
// `jest.integration.setup.cjs`, so no binding changes are needed — the runtime
|
|
8
|
+
// under test talks to the local engine exactly as it would to AWS.
|
|
9
|
+
//
|
|
10
|
+
// This module only adds the table-lifecycle commands (`CreateTable`,
|
|
11
|
+
// `DeleteTable`) that the shared SDK package does not bind, since they are only
|
|
12
|
+
// ever needed for tests.
|
|
13
|
+
|
|
14
|
+
type command
|
|
15
|
+
|
|
16
|
+
@new @module("@aws-sdk/client-dynamodb")
|
|
17
|
+
external createTableCommand: JSON.t => command = "CreateTableCommand"
|
|
18
|
+
|
|
19
|
+
@new @module("@aws-sdk/client-dynamodb")
|
|
20
|
+
external deleteTableCommand: JSON.t => command = "DeleteTableCommand"
|
|
21
|
+
|
|
22
|
+
@send
|
|
23
|
+
external sendRaw: (AwsSdk.DynamoDb.DynamoDb.client, command) => promise<JSON.t> = "send"
|
|
24
|
+
|
|
25
|
+
let send = cmd => sendRaw(AwsSdk.DynamoDb.DynamoDb.client(), cmd)
|
|
26
|
+
|
|
27
|
+
let s = JSON.Encode.string
|
|
28
|
+
|
|
29
|
+
let attrDef = name =>
|
|
30
|
+
Dict.fromArray([("AttributeName", s(name)), ("AttributeType", s("S"))])->JSON.Encode.object
|
|
31
|
+
|
|
32
|
+
let keyEl = (name, keyType) =>
|
|
33
|
+
Dict.fromArray([("AttributeName", s(name)), ("KeyType", s(keyType))])->JSON.Encode.object
|
|
34
|
+
|
|
35
|
+
// Mirror the production projection policy (Phase 3): `tag_composite` keeps a
|
|
36
|
+
// full (ALL) projection; per-tag `tag_<key>` GSIs are KEYS_ONLY. Uses the same
|
|
37
|
+
// predicate as the deploy-time `make` so the two never drift.
|
|
38
|
+
let gsi = indexName => {
|
|
39
|
+
let projection =
|
|
40
|
+
DcbEventLogStorage_DynamoDb_Runtime.indexKeepsFullProjection(indexName) ? "ALL" : "KEYS_ONLY"
|
|
41
|
+
Dict.fromArray([
|
|
42
|
+
("IndexName", s(indexName)),
|
|
43
|
+
("KeySchema", [keyEl(indexName, "HASH"), keyEl("position", "RANGE")]->JSON.Encode.array),
|
|
44
|
+
("Projection", Dict.fromArray([("ProjectionType", s(projection))])->JSON.Encode.object),
|
|
45
|
+
])->JSON.Encode.object
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Superset of tag GSIs used across the scenarios. GSIs are sparse, so an event
|
|
49
|
+
// missing a given tag attribute is simply absent from that index — matching the
|
|
50
|
+
// production `Dcb_Builder` schema (one `tag_<key>` GSI per tagged field +
|
|
51
|
+
// `tag_composite`).
|
|
52
|
+
let gsiNames = ["tag_productId", "tag_orderId", "tag_customerId", "tag_counterId", "tag_composite"]
|
|
53
|
+
|
|
54
|
+
let createDcbTable = async (tableName): Util_DynamoDb_Runtime.resolvedTable => {
|
|
55
|
+
let attributeDefinitions = Array.concat(
|
|
56
|
+
[attrDef("id"), attrDef("position")],
|
|
57
|
+
gsiNames->Array.map(attrDef),
|
|
58
|
+
)
|
|
59
|
+
let input =
|
|
60
|
+
Dict.fromArray([
|
|
61
|
+
("TableName", s(tableName)),
|
|
62
|
+
("AttributeDefinitions", attributeDefinitions->JSON.Encode.array),
|
|
63
|
+
("KeySchema", [keyEl("id", "HASH"), keyEl("position", "RANGE")]->JSON.Encode.array),
|
|
64
|
+
("GlobalSecondaryIndexes", gsiNames->Array.map(gsi)->JSON.Encode.array),
|
|
65
|
+
("BillingMode", s("PAY_PER_REQUEST")),
|
|
66
|
+
])->JSON.Encode.object
|
|
67
|
+
let _ = await send(createTableCommand(input))
|
|
68
|
+
{
|
|
69
|
+
Util_DynamoDb_Runtime.id: tableName,
|
|
70
|
+
name: tableName,
|
|
71
|
+
arn: `arn:aws:dynamodb:local:000000000000:table/${tableName}`,
|
|
72
|
+
hashKey: "id",
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let deleteTable = async (table: Util_DynamoDb_Runtime.resolvedTable) => {
|
|
77
|
+
let input = Dict.fromArray([("TableName", s(table.name))])->JSON.Encode.object
|
|
78
|
+
let _ = await send(deleteTableCommand(input))
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Unique table per test so persisted fence sentinels never leak across scenarios.
|
|
82
|
+
let counter = ref(0)
|
|
83
|
+
let freshTable = async () => {
|
|
84
|
+
counter := counter.contents + 1
|
|
85
|
+
await createDcbTable(`DcbItTest_${counter.contents->Int.toString}`)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Directly overwrite a fence sentinel's `lastPosition` — used to simulate a
|
|
89
|
+
// concurrent writer having advanced a fence between a slice's read and append.
|
|
90
|
+
let setFence = async (
|
|
91
|
+
table: Util_DynamoDb_Runtime.resolvedTable,
|
|
92
|
+
tag: Reventless.DcbTag.tag,
|
|
93
|
+
~lastPosition: string,
|
|
94
|
+
) => {
|
|
95
|
+
let item =
|
|
96
|
+
Dict.fromArray([
|
|
97
|
+
("id", s(DcbEventLogStorage_DynamoDb_Runtime.fencePartitionKey(tag))),
|
|
98
|
+
("position", s("FENCE")),
|
|
99
|
+
("lastPosition", s(lastPosition)),
|
|
100
|
+
])->JSON.Encode.object
|
|
101
|
+
await Util_DynamoDb_Runtime.put(table, item)
|
|
102
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as ClientDynamodb from "@aws-sdk/client-dynamodb";
|
|
4
|
+
import * as DynamoDb_DynamoDb$AwsSdk from "@reventlessdev/rescript-aws-sdk/src/DynamoDb_DynamoDb.res.mjs";
|
|
5
|
+
import * as Util_DynamoDb_Runtime$ReventlessAws from "../../src/util/Util_DynamoDb_Runtime.res.mjs";
|
|
6
|
+
import * as DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws from "../../src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb_Runtime.res.mjs";
|
|
7
|
+
|
|
8
|
+
function send(cmd) {
|
|
9
|
+
return DynamoDb_DynamoDb$AwsSdk.client().send(cmd);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function s(prim) {
|
|
13
|
+
return prim;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function attrDef(name) {
|
|
17
|
+
return Object.fromEntries([
|
|
18
|
+
[
|
|
19
|
+
"AttributeName",
|
|
20
|
+
name
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
"AttributeType",
|
|
24
|
+
"S"
|
|
25
|
+
]
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function keyEl(name, keyType) {
|
|
30
|
+
return Object.fromEntries([
|
|
31
|
+
[
|
|
32
|
+
"AttributeName",
|
|
33
|
+
name
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"KeyType",
|
|
37
|
+
keyType
|
|
38
|
+
]
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function gsi(indexName) {
|
|
43
|
+
let projection = DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.indexKeepsFullProjection(indexName) ? "ALL" : "KEYS_ONLY";
|
|
44
|
+
return Object.fromEntries([
|
|
45
|
+
[
|
|
46
|
+
"IndexName",
|
|
47
|
+
indexName
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"KeySchema",
|
|
51
|
+
[
|
|
52
|
+
keyEl(indexName, "HASH"),
|
|
53
|
+
keyEl("position", "RANGE")
|
|
54
|
+
]
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"Projection",
|
|
58
|
+
Object.fromEntries([[
|
|
59
|
+
"ProjectionType",
|
|
60
|
+
projection
|
|
61
|
+
]])
|
|
62
|
+
]
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let gsiNames = [
|
|
67
|
+
"tag_productId",
|
|
68
|
+
"tag_orderId",
|
|
69
|
+
"tag_customerId",
|
|
70
|
+
"tag_counterId",
|
|
71
|
+
"tag_composite"
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
async function createDcbTable(tableName) {
|
|
75
|
+
let attributeDefinitions = [
|
|
76
|
+
attrDef("id"),
|
|
77
|
+
attrDef("position")
|
|
78
|
+
].concat(gsiNames.map(attrDef));
|
|
79
|
+
let input = Object.fromEntries([
|
|
80
|
+
[
|
|
81
|
+
"TableName",
|
|
82
|
+
tableName
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
"AttributeDefinitions",
|
|
86
|
+
attributeDefinitions
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
"KeySchema",
|
|
90
|
+
[
|
|
91
|
+
keyEl("id", "HASH"),
|
|
92
|
+
keyEl("position", "RANGE")
|
|
93
|
+
]
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"GlobalSecondaryIndexes",
|
|
97
|
+
gsiNames.map(gsi)
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"BillingMode",
|
|
101
|
+
"PAY_PER_REQUEST"
|
|
102
|
+
]
|
|
103
|
+
]);
|
|
104
|
+
let cmd = new ClientDynamodb.CreateTableCommand(input);
|
|
105
|
+
await DynamoDb_DynamoDb$AwsSdk.client().send(cmd);
|
|
106
|
+
return {
|
|
107
|
+
id: tableName,
|
|
108
|
+
name: tableName,
|
|
109
|
+
arn: `arn:aws:dynamodb:local:000000000000:table/` + tableName,
|
|
110
|
+
hashKey: "id"
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function deleteTable(table) {
|
|
115
|
+
let input = Object.fromEntries([[
|
|
116
|
+
"TableName",
|
|
117
|
+
table.name
|
|
118
|
+
]]);
|
|
119
|
+
let cmd = new ClientDynamodb.DeleteTableCommand(input);
|
|
120
|
+
await DynamoDb_DynamoDb$AwsSdk.client().send(cmd);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let counter = {
|
|
124
|
+
contents: 0
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
async function freshTable() {
|
|
128
|
+
counter.contents = counter.contents + 1 | 0;
|
|
129
|
+
return await createDcbTable(`DcbItTest_` + counter.contents.toString());
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function setFence(table, tag, lastPosition) {
|
|
133
|
+
let item = Object.fromEntries([
|
|
134
|
+
[
|
|
135
|
+
"id",
|
|
136
|
+
DcbEventLogStorage_DynamoDb_Runtime$ReventlessAws.fencePartitionKey(tag)
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
"position",
|
|
140
|
+
"FENCE"
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
"lastPosition",
|
|
144
|
+
lastPosition
|
|
145
|
+
]
|
|
146
|
+
]);
|
|
147
|
+
return await Util_DynamoDb_Runtime$ReventlessAws.put(table, item);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export {
|
|
151
|
+
send,
|
|
152
|
+
s,
|
|
153
|
+
attrDef,
|
|
154
|
+
keyEl,
|
|
155
|
+
gsi,
|
|
156
|
+
gsiNames,
|
|
157
|
+
createDcbTable,
|
|
158
|
+
deleteTable,
|
|
159
|
+
counter,
|
|
160
|
+
freshTable,
|
|
161
|
+
setFence,
|
|
162
|
+
}
|
|
163
|
+
/* @aws-sdk/client-dynamodb Not a pure module */
|