@reventlessdev/reventless-aws 3.0.0-alpha.343 → 3.0.0-alpha.345
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 +15 -0
- package/package.json +11 -11
- package/scripts/ProvisionIdentity.res +8 -3
- package/src/Platform.res +327 -328
- package/src/Platform.res.mjs +4 -2
- package/src/Platform_Casts.res +13 -4
- package/src/adapter/Api/AppSyncEventsSigner_Ops.res +8 -4
- package/src/adapter/Api/AppSync_EventsApi.res +12 -14
- package/src/adapter/Api/AppSync_Resolver_Native.res +3 -4
- package/src/adapter/Api/AppSync_Resolver_Retrying.res +78 -70
- package/src/adapter/Api/AppSync_SourceApiAssociation_Retrying.res +11 -8
- package/src/adapter/Api/Platform_AdminScan_Ops.res +15 -14
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda.res +10 -2
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda_Ops.res +40 -50
- package/src/adapter/Api/Platform_UIFragments_Lambda.res +39 -32
- package/src/adapter/Api/Platform_UIFragments_Lambda_Ops.res +5 -2
- package/src/adapter/Auth/Auth_ActiveRolePoolAttachment.res +0 -1
- package/src/adapter/Auth/Auth_ActiveRoleStore.res +1 -2
- package/src/adapter/Auth/Auth_ActiveRoleStore_Schema.res +1 -4
- package/src/adapter/Auth/Auth_ActiveRoleTrigger_Ops.res +5 -2
- package/src/adapter/Auth/Auth_Cognito.res +3 -9
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync.res +1 -4
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync_NoOp.res +3 -1
- package/src/adapter/CommandGenerator/InboundTranslationResolvers_AppSync.res +1 -4
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS.res +7 -4
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Async.res +6 -1
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_FIFO.res +7 -4
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Runtime.res +24 -18
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Sync.res +9 -4
- package/src/adapter/CommandTopic/CommandTopicRegistry.res +1 -4
- package/src/adapter/Counter/CounterHandler_DynamoDbStream.res +15 -15
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb.res +9 -5
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb_Runtime.res +179 -213
- package/src/adapter/EventCollector/EventCollectorChannel_DynamoDbStream.res +5 -5
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res +6 -2
- package/src/adapter/EventCollector/EventCollectorChannel_SQS.res +14 -7
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_FIFO.res +14 -7
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_Runtime.res +6 -3
- package/src/adapter/EventLog/EventLogStorage_DynamoDbStream.res +6 -1
- package/src/adapter/EventLog/EventLogStorage_DynamoDb_Runtime.res +13 -17
- package/src/adapter/EventLog/EventLogStorage_Postgres.res +7 -4
- package/src/adapter/EventLogSubscription/EventLogSubscription_AppSync.res +12 -7
- package/src/adapter/EventLogSubscription/EventLogSubscription_AppSync_Ops.res +4 -2
- package/src/adapter/EventTopic/EventTopicPublisher_DynamoDbStream.res +3 -2
- package/src/adapter/EventTopic/EventTopicPublisher_SNS.res +20 -12
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_FIFO.res +21 -9
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_Runtime.res +5 -3
- package/src/adapter/Geocoder/Geocoder_AwsLocation_Resolver.res +6 -3
- package/src/adapter/Mcp/MCP_Lambda.res +31 -46
- package/src/adapter/Messaging/Messaging_Ses_Backend.res +11 -7
- package/src/adapter/Messaging/Messaging_Ses_Backend.res.mjs +2 -4
- package/src/adapter/Monitoring/Monitoring_CloudWatch.res +16 -16
- package/src/adapter/Postgres/PgChangeFeedRelay_Builder.res +5 -10
- package/src/adapter/Postgres/PgChangeFeedRelay_Runtime.res +4 -2
- package/src/adapter/Postgres/PgConnection.res +6 -5
- package/src/adapter/Postgres/PgMigration_Builder.res +4 -8
- package/src/adapter/Postgres/PgRuntime.res +4 -7
- package/src/adapter/QueryDb/PgQueryResolver_Builder.res +9 -11
- package/src/adapter/QueryDb/PgQueryResolver_Lambda.res +22 -21
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res +114 -111
- package/src/adapter/QueryDb/QueryDbResolvers_Lambda.res +1 -7
- package/src/adapter/QueryDb/QueryDbStorage.res +4 -2
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb.res +23 -24
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDbStream.res +8 -2
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb_Runtime.res +71 -73
- package/src/adapter/QueryDb/QueryDbStorage_Postgres.res +5 -2
- package/src/adapter/QueryDb/QueryInterceptor_Provisioning.res +1 -4
- package/src/adapter/QueryEngine/QueryEngine_DynamoDb.res +8 -2
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro.res +73 -81
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro_Async.res +72 -78
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate.res +44 -67
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate_Async.res +44 -67
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res +53 -82
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single_Async.res +47 -77
- package/src/adapter/Runtime/AutomationSliceEntryPoint_Ops.res +18 -11
- package/src/adapter/Runtime/AutomationSliceRuntime_Builder_Single.res +80 -97
- package/src/adapter/Runtime/CounterEntryPoint_Ops.res +2 -7
- package/src/adapter/Runtime/DcbCommandTopicEntryPoint_Ops.res +16 -10
- package/src/adapter/Runtime/EventCollectorEntryPoint_Ops.res +24 -15
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_PerEventCollector.res +17 -37
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res +31 -57
- package/src/adapter/Runtime/EventMapperEntryPoint_Ops.res +18 -24
- package/src/adapter/Runtime/ExtensionPointEntryPoint_Ops.res +1 -5
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder_PerExtensionPoint.res +4 -3
- package/src/adapter/Runtime/HeartbeatEntryPoint.res +0 -1
- package/src/adapter/Runtime/PgChangeFeedRelayEntryPoint.res +4 -2
- package/src/adapter/Runtime/PgMigrationEntryPoint.res +0 -1
- package/src/adapter/Runtime/PgQueryResolverEntryPoint_Ops.res +3 -2
- package/src/adapter/Runtime/PluginExtensionPointEntryPoint.res +1 -2
- package/src/adapter/Runtime/ProjectionEntryPoint_Ops.res +4 -5
- package/src/adapter/Runtime/RuntimeEnvironment_Lambda.res +22 -10
- package/src/adapter/Runtime/RuntimeExtensionEntryPoint_Ops.res +8 -2
- package/src/adapter/Runtime/SideEffectHandlerRuntime_Builder_Single.res +14 -31
- package/src/adapter/Runtime/StateChangeSliceRuntime_Builder_Single.res +16 -17
- package/src/adapter/Runtime/StateViewSliceEntryPoint_Ops.res +10 -9
- package/src/adapter/Runtime/StateViewSliceRuntime_Builder_Single.res +46 -52
- package/src/adapter/Runtime/StreamRoutedEntryPoint_Ops.res +36 -41
- package/src/adapter/Runtime/TaskBucketEntryPoint_Ops.res +31 -37
- package/src/adapter/Runtime/TaskRuntime_Builder_PerBucket.res +6 -7
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents.res +4 -6
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents_Runtime.res +2 -6
- package/src/adapter/StateTopic/StateTopic_AppSync.res +21 -16
- package/src/adapter/StateTopic/StateTopic_AppSync_Ops.res +36 -32
- package/src/adapter/Task/TaskBucket_S3.res +6 -1
- package/src/adapter/Upload/Upload_Claim_S3.res +17 -20
- package/src/adapter/Upload/Upload_Claim_S3_Ops.res +5 -2
- package/src/adapter/Upload/Upload_Presign_S3.res +51 -49
- package/src/capability/Capability_Geocoding_AwsLocation.res +4 -1
- package/src/capability/Capability_Messaging.res +4 -5
- package/src/capability/Capability_Messaging_Ses.res +3 -1
- package/src/capability/Capability_ObjectStore_S3.res +1 -7
- package/src/components/Api/AppSync_Adapter.res +28 -41
- package/src/components/Api/AppSync_SdlDecorate.res +38 -30
- package/src/components/AutomationSlice_Builder.res +6 -4
- package/src/components/ExtensionPoint_Builder.res +9 -10
- package/src/components/InboundTranslationSlice_Builder.res +7 -8
- package/src/components/OutboundTranslationSlice_Builder.res +14 -8
- package/src/components/OutboundTranslationSlice_Builder.res.mjs +1 -1
- package/src/components/SideEffectHandler_Single.res +4 -4
- package/src/components/StateViewSlice_Builder.res +6 -4
- package/src/components/StateViewSlice_Builder_Stream.res +6 -4
- package/src/components/Task_Builder_PerBucket.res +10 -11
- package/src/plugin/cloner/ClonerRunner_Fargate.res +3 -10
- package/src/plugin/cloner/ClonerRunner_Fargate_Runtime.res +1 -4
- package/src/plugin/heartbeat/HeartbeatRunner_CloudWatchEvents.res +5 -5
- package/src/plugin/runtime/PluginExtensionPointRuntime_Builder.res +19 -21
- package/src/plugin/runtime/PluginRuntime_Builder.res +167 -188
- package/src/plugin/runtime/Util_PluginMessage_Runtime.res +6 -5
- package/src/plugin/stack/Plugin_Stack.res +104 -103
- package/src/util/Util_AlarmSpec.res +2 -1
- package/src/util/Util_AppSync.res +8 -2
- package/src/util/Util_AppSync_Caller.res +15 -14
- package/src/util/Util_Bundle.res +144 -67
- package/src/util/Util_Bundle.res.mjs +64 -13
- package/src/util/Util_CognitoGroupUser_Runtime.res +32 -34
- package/src/util/Util_Cognito_Runtime.res +11 -7
- package/src/util/Util_DeadLetterQueue.res +12 -2
- package/src/util/Util_DynamoDb.res +5 -3
- package/src/util/Util_DynamoDbStream.res +7 -3
- package/src/util/Util_DynamoDbStream_Runtime.res +1 -2
- package/src/util/Util_DynamoDb_Runtime.res +23 -41
- package/src/util/Util_HostUiDomain.res +6 -1
- package/src/util/Util_Kinesis_Runtime.res +10 -11
- package/src/util/Util_Lambda.res +12 -5
- package/src/util/Util_LambdaEnvBudget.res +5 -5
- package/src/util/Util_LambdaLogging.res +1 -2
- package/src/util/Util_LogGroup_Adopting.res +1 -4
- package/src/util/Util_ResourceNaming.res +1 -2
- package/src/util/Util_SNS.res +8 -3
- package/src/util/Util_SNS_FIFO.res +1 -1
- package/src/util/Util_SNS_Runtime.res +11 -10
- package/src/util/Util_SQS.res +4 -2
- package/src/util/Util_SQS_FIFO.res +5 -2
- package/src/util/Util_SQS_Runtime.res +37 -36
- package/src/util/Util_ShellConfig.res +3 -2
- package/src/util/Util_StaticBundle.res +1 -3
- package/src/util/Util_StoreLayout.res +4 -1
- package/tests/AWS_TagsTest.res +16 -5
- package/tests/AppSyncEventsSigner_OpsTest.res +11 -2
- package/tests/AppSync_AdapterTest.res +203 -224
- package/tests/AppSync_Resolver_RetryingTest.res +64 -44
- package/tests/AppSync_RetirementNarrowingTest.res +59 -46
- package/tests/AppSync_SdlDecorateTest.res +22 -20
- package/tests/AppSync_SourceApiAssociation_RetryingTest.res +40 -22
- package/tests/Auth_ActiveRolePoolAttachmentTest.res +114 -107
- package/tests/Auth_ActiveRoleStoreTest.res +12 -9
- package/tests/Auth_ActiveRoleStore_SchemaTest.res +2 -1
- package/tests/Auth_ActiveRoleTrigger_OpsTest.res +20 -16
- package/tests/Auth_CognitoTest.res +31 -46
- package/tests/AutomationSliceEntryPoint_OpsTest.res +69 -67
- package/tests/BakeConvergenceTest.res +22 -25
- package/tests/Capability_MessagingTest.res +28 -12
- package/tests/CommandTopicQueuePolicyTest.res +1 -2
- package/tests/CounterEntryPoint_OpsTest.res +3 -7
- package/tests/DcbEventLogStorage_DynamoDb_RuntimeTest.res +306 -210
- package/tests/EventCollectorConnectLambdaPreviewTest.res +14 -7
- package/tests/EventCollectorEntryPoint_OpsTest.res +12 -4
- package/tests/EventCollectorPluginDefinitionAssetTest.res +18 -11
- package/tests/EventCollectorReadyGateTest.res +5 -4
- package/tests/EventLogStorage_DynamoDb_RuntimeTest.res +1 -2
- package/tests/EventMapperEntryPoint_OpsTest.res +1 -3
- package/tests/ExtensionPointEntryPoint_OpsTest.res +1 -4
- package/tests/HandlerFactoryDispatchTest.res +97 -70
- package/tests/MCP_LambdaTest.res +16 -27
- package/tests/PgChangeFeedRelay_IntegrationTest.res +123 -93
- package/tests/PgChangeFeedRelay_RuntimeTest.res +13 -10
- package/tests/PgMigrationEntryPoint_IntegrationTest.res +0 -1
- package/tests/PgPipeline_IntegrationTest.res +80 -66
- package/tests/PgQueryDbUnion_IntegrationTest.res +1 -2
- package/tests/PgQueryResolverEntryPoint_OpsTest.res +2 -6
- package/tests/PgQueryResolver_LambdaTest.res +41 -24
- package/tests/Platform_AdminScan_OpsTest.res +4 -1
- package/tests/Platform_ComponentDefinitions_Lambda_OpsTest.res +137 -129
- package/tests/ProjectionEntryPoint_DisplayNameTest.res +7 -3
- package/tests/ProjectionEntryPoint_UnionStampTest.res +3 -2
- package/tests/ProvisionIdentityTest.res +2 -6
- package/tests/QueryDbOwnerIndexTableTest.res +6 -4
- package/tests/QueryDbResolvers_AppSyncTest.res +23 -16
- package/tests/QueryInterceptor_LambdaTest.res +11 -13
- package/tests/ReadModelEntryPoint_OpsTest.res +43 -41
- package/tests/RuntimeExtensionEntryPoint_OpsTest.res +4 -3
- package/tests/SideEffectEntryPoint_OpsTest.res +23 -18
- package/tests/StateChangeDescriptorParityTest.res +28 -26
- package/tests/StateTopicKeySchemaTest.res +18 -15
- package/tests/StateViewSliceEntryPoint_OpsTest.res +55 -44
- package/tests/TaskBucketEntryPoint_OpsTest.res +13 -13
- package/tests/Upload_ClaimTest.res +3 -3
- package/tests/Util_AwsErrorTest.res +4 -7
- package/tests/Util_BundleDependencyClosureTest.res +41 -3
- package/tests/Util_BundleDependencyClosureTest.res.mjs +11 -0
- package/tests/Util_BundleEsmLoaderTest.res +3 -3
- package/tests/Util_BundleResolveTest.res +4 -6
- package/tests/Util_BundleRuntimeExtensionTest.res +17 -18
- package/tests/Util_DcbMetricsTest.res +6 -6
- package/tests/Util_DynamoDbStreamTest.res +4 -5
- package/tests/Util_DynamoDbTest.res +3 -2
- package/tests/Util_LambdaEnvBudgetTest.res +22 -18
- package/tests/Util_LambdaLoggingTest.res +9 -8
- package/tests/Util_LogGroup_AdoptingTest.res +10 -5
- package/tests/Util_LogRetentionTest.res +6 -2
- package/tests/Util_OwnerScopeEnvTest.res +10 -8
- package/tests/Util_SQS_RuntimeTest.res +5 -7
- package/tests/Util_ShellConfigTest.res +7 -17
- package/tests/Util_StaticBundleTest.res +3 -8
- package/tests/Util_StoreLayoutTest.res +17 -12
- package/tests/integration/AggregateEntryPoint_IntegrationTest.res +1 -4
- package/tests/integration/DcbCommandTopicEntryPoint_IntegrationTest.res +15 -15
- package/tests/integration/DcbEventLogStorage_DynamoDb_IntegrationTest.res +296 -232
- package/tests/integration/DcbIntegrationHarness.res +8 -8
- package/tests/integration/EpCompositeSlice.res +16 -8
- package/tests/integration/QueryDbUnion_DynamoDb_IntegrationTest.res +8 -10
- package/tests/integration/StateViewSliceEntryPoint_IntegrationTest.res +10 -10
- package/tests/integration/SvsTestSlice_Projection.res +1 -3
- package/tests/util/Util_AlarmSpecTest.res +62 -49
|
@@ -66,32 +66,30 @@ let forCommandTopic = (
|
|
|
66
66
|
publishToAggregatesEnvVars
|
|
67
67
|
->Dict.toArray
|
|
68
68
|
->Array.map(((aggName, envVar)) =>
|
|
69
|
-
`${aggName->JSON.stringifyAny->Option.getOr(`""`)}: ${envVar
|
|
69
|
+
`${aggName->JSON.stringifyAny->Option.getOr(`""`)}: ${envVar
|
|
70
|
+
->JSON.stringifyAny
|
|
71
|
+
->Option.getOr(`""`)}`
|
|
70
72
|
)
|
|
71
73
|
->Array.join(",")
|
|
72
74
|
|
|
73
75
|
// Build HANDLER_CONFIG JSON
|
|
74
76
|
let queueName =
|
|
75
|
-
queue.id->Pulumi.Output.apply(id =>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
->
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
let schedQueueArn = values->Array.getUnsafe(3)
|
|
92
|
-
let schedQueueName = values->Array.getUnsafe(4)
|
|
93
|
-
`{"queueUrl":"${queueUrl}","pluginReadModelTableName":"${rmTable}","schedulerRoleArn":"${schedRoleArn}","schedulerQueueArn":"${schedQueueArn}","schedulerQueueName":"${schedQueueName}","publishToAggregates":{${publishToAggregatesJson}}}`
|
|
94
|
-
})
|
|
77
|
+
queue.id->Pulumi.Output.apply(id => id->String.split("/")->Array.at(-1)->Option.getOr(id))
|
|
78
|
+
|
|
79
|
+
let handlerConfigJson = Pulumi.Output.all([
|
|
80
|
+
queue.id,
|
|
81
|
+
extras.pluginReadModelTableName->outputOrPlaceholder->Obj.magic,
|
|
82
|
+
extras.schedulerRoleArn->outputOrPlaceholder->Obj.magic,
|
|
83
|
+
queue.arn,
|
|
84
|
+
queueName,
|
|
85
|
+
])->Pulumi.Output.apply(values => {
|
|
86
|
+
let queueUrl = values->Array.getUnsafe(0)
|
|
87
|
+
let rmTable = values->Array.getUnsafe(1)
|
|
88
|
+
let schedRoleArn = values->Array.getUnsafe(2)
|
|
89
|
+
let schedQueueArn = values->Array.getUnsafe(3)
|
|
90
|
+
let schedQueueName = values->Array.getUnsafe(4)
|
|
91
|
+
`{"queueUrl":"${queueUrl}","pluginReadModelTableName":"${rmTable}","schedulerRoleArn":"${schedRoleArn}","schedulerQueueArn":"${schedQueueArn}","schedulerQueueName":"${schedQueueName}","publishToAggregates":{${publishToAggregatesJson}}}`
|
|
92
|
+
})
|
|
95
93
|
envVars->Dict.set("HANDLER_CONFIG", handlerConfigJson->Pulumi.Output.asInput)
|
|
96
94
|
|
|
97
95
|
// No user packages — all framework imports are in the Layer
|
|
@@ -239,14 +239,14 @@ let registerConfig = (
|
|
|
239
239
|
(),
|
|
240
240
|
) =>
|
|
241
241
|
configRef := {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
242
|
+
eventTopicArn,
|
|
243
|
+
pluginReadModelTableName,
|
|
244
|
+
schedulerRoleArn,
|
|
245
|
+
schedulerQueueArn,
|
|
246
|
+
schedulerQueueName,
|
|
247
|
+
appSyncApiId,
|
|
248
|
+
clonerEnabled,
|
|
249
|
+
}
|
|
250
250
|
|
|
251
251
|
// PluginRuntime_Builder is a functor so that the caller can inject the EventCollectorChannel
|
|
252
252
|
// implementation. All other runtime builders hardcode EventCollectorChannel.DynamoDbStream, but
|
|
@@ -322,18 +322,12 @@ module Make = (
|
|
|
322
322
|
string,
|
|
323
323
|
>,
|
|
324
324
|
ReventlessCore.EventCollector.component,
|
|
325
|
-
> = (
|
|
326
|
-
~handler as _,
|
|
327
|
-
~eventTopics,
|
|
328
|
-
~resources,
|
|
329
|
-
~memorySize=1024,
|
|
330
|
-
~timeout=30,
|
|
331
|
-
eventCollector,
|
|
332
|
-
) => {
|
|
325
|
+
> = (~handler as _, ~eventTopics, ~resources, ~memorySize=1024, ~timeout=30, eventCollector) => {
|
|
333
326
|
let resource = eventCollector->ReventlessCore.Component.toPulumiResource
|
|
334
|
-
let name =
|
|
335
|
-
ReventlessCore.
|
|
336
|
-
|
|
327
|
+
let name =
|
|
328
|
+
resource.name->ReventlessCore.ComponentType.nameOpt(
|
|
329
|
+
ReventlessCore.EventCollector.componentType,
|
|
330
|
+
)
|
|
337
331
|
let opts = {Pulumi.ComponentResource.parent: resource}
|
|
338
332
|
let config = configRef.contents
|
|
339
333
|
|
|
@@ -376,11 +370,12 @@ module Make = (
|
|
|
376
370
|
|
|
377
371
|
// Pull the per-EventCollector context registered by Plugin_Helpers.connect
|
|
378
372
|
// (plugins) or synthesise an admin one if none registered.
|
|
379
|
-
let context: ReventlessCore.Plugin_Helpers.eventCollectorContext =
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
373
|
+
let context: ReventlessCore.Plugin_Helpers.eventCollectorContext = switch ReventlessCore.Plugin_Helpers.eventCollectorContextRef.contents->Dict.get(
|
|
374
|
+
name,
|
|
375
|
+
) {
|
|
376
|
+
| Some(ctx) => ctx
|
|
377
|
+
| None => synthesizeAdminContext()
|
|
378
|
+
}
|
|
384
379
|
|
|
385
380
|
let envVars: dict<Pulumi.Input.t<string>> = Dict.make()
|
|
386
381
|
|
|
@@ -420,140 +415,138 @@ module Make = (
|
|
|
420
415
|
// separate `pluginDefinition.json` asset bundled alongside index.mjs (see
|
|
421
416
|
// the buildCodeArchive call below); the entry point reads it from disk at
|
|
422
417
|
// cold start. Slim HANDLER_CONFIG keeps just the orchestration fields.
|
|
423
|
-
let handlerConfigJson =
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
->
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
->
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
"aggregateNames",
|
|
476
|
-
ep.aggregateNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
477
|
-
)
|
|
478
|
-
JSON.Encode.object(entryDict)
|
|
479
|
-
})
|
|
480
|
-
dict->Dict.set("extensionPoints", JSON.Encode.array(extensionPointsArr))
|
|
481
|
-
|
|
482
|
-
let connectExtensionValue = switch context.connectExtension {
|
|
483
|
-
| Some(ce) =>
|
|
484
|
-
let ceDict = Dict.make()
|
|
485
|
-
ceDict->Dict.set("specModule", JSON.Encode.string(ce.specModule))
|
|
486
|
-
ceDict->Dict.set("mappingsModule", JSON.Encode.string(ce.mappingsModule))
|
|
487
|
-
ceDict->Dict.set("extensionPointName", JSON.Encode.string(ce.extensionPointName))
|
|
488
|
-
JSON.Encode.object(ceDict)
|
|
489
|
-
| None => JSON.Encode.null
|
|
490
|
-
}
|
|
491
|
-
dict->Dict.set("connectExtension", connectExtensionValue)
|
|
492
|
-
|
|
493
|
-
// User-declared extensions — one entry per merged extension group.
|
|
494
|
-
// Each entry carries enough metadata for the bundled handler to
|
|
495
|
-
// dynamic-import the spec / mapping modules and filter the top-level
|
|
496
|
-
// publishToAggregates + readModelQueueUrls maps down to the subset
|
|
497
|
-
// this extension actually uses.
|
|
498
|
-
// Sort by extension name so the serialized JSON is stable across deploys.
|
|
499
|
-
let extensionsArr =
|
|
500
|
-
context.extensions
|
|
501
|
-
->Array.toSorted((a, b) => String.compare(a.name, b.name))
|
|
502
|
-
->Array.map(ext => {
|
|
503
|
-
let entryDict = Dict.make()
|
|
504
|
-
entryDict->Dict.set("name", JSON.Encode.string(ext.name))
|
|
505
|
-
entryDict->Dict.set("specModule", JSON.Encode.string(ext.specModule))
|
|
506
|
-
entryDict->Dict.set("mappingsModule", JSON.Encode.string(ext.mappingsModule))
|
|
507
|
-
entryDict->Dict.set("delegateModule", JSON.Encode.string(ext.delegateModule))
|
|
508
|
-
entryDict->Dict.set("extensionPointName", JSON.Encode.string(ext.extensionPointName))
|
|
509
|
-
entryDict->Dict.set(
|
|
510
|
-
"aggregateNames",
|
|
511
|
-
ext.aggregateNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
512
|
-
)
|
|
513
|
-
entryDict->Dict.set(
|
|
514
|
-
"readModelNames",
|
|
515
|
-
ext.readModelNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
516
|
-
)
|
|
517
|
-
JSON.Encode.object(entryDict)
|
|
518
|
-
})
|
|
519
|
-
dict->Dict.set("extensions", JSON.Encode.array(extensionsArr))
|
|
520
|
-
|
|
521
|
-
// publishToAggregates / readModelQueueUrls live in queueUrls.json (see the
|
|
522
|
-
// asset bundle below). Both are one entry per target, so they grow with the
|
|
523
|
-
// plugin, and together with the PTA_/PRM_ vars they name they carried the
|
|
524
|
-
// catalog EventCollector past Lambda's 4KB environment ceiling. Only the
|
|
525
|
-
// maps move: they are built from Dict.keysToArray, so they hold no Pulumi
|
|
526
|
-
// Output and can be serialized here. The URLs themselves cannot follow —
|
|
527
|
-
// see the note on the aggregate walk further down.
|
|
528
|
-
|
|
529
|
-
let rmNamesForSourceDict = Dict.make()
|
|
530
|
-
context.readModelNamesForSourceName
|
|
531
|
-
->Dict.toArray
|
|
532
|
-
->Array.forEach(((sourceName, rmNames)) =>
|
|
533
|
-
rmNamesForSourceDict->Dict.set(
|
|
534
|
-
sourceName,
|
|
535
|
-
rmNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
418
|
+
let handlerConfigJson = Pulumi.Output.all([
|
|
419
|
+
queue.id,
|
|
420
|
+
context.pluginExtensionPointCmdTopicUrl->Pulumi.Output.asInput->Obj.magic,
|
|
421
|
+
config.eventTopicArn->outputOrPlaceholder->Obj.magic,
|
|
422
|
+
config.pluginReadModelTableName->outputOrPlaceholder->Obj.magic,
|
|
423
|
+
config.schedulerRoleArn->outputOrPlaceholder->Obj.magic,
|
|
424
|
+
config.schedulerQueueArn->outputOrPlaceholder->Obj.magic,
|
|
425
|
+
config.schedulerQueueName->outputOrPlaceholder->Obj.magic,
|
|
426
|
+
config.appSyncApiId->outputOrPlaceholder->Obj.magic,
|
|
427
|
+
epEventTopicArnsOutput->Pulumi.Output.asInput->Obj.magic,
|
|
428
|
+
])->Pulumi.Output.apply(values => {
|
|
429
|
+
let queueUrl = values->Array.getUnsafe(0)
|
|
430
|
+
let pluginEpCmdTopicUrl = values->Array.getUnsafe(1)
|
|
431
|
+
let topLevelEventTopicArn = values->Array.getUnsafe(2)
|
|
432
|
+
let rmTable = values->Array.getUnsafe(3)
|
|
433
|
+
let schedRoleArn = values->Array.getUnsafe(4)
|
|
434
|
+
let schedQueueArn = values->Array.getUnsafe(5)
|
|
435
|
+
let schedQueueName = values->Array.getUnsafe(6)
|
|
436
|
+
let appSyncApiId = values->Array.getUnsafe(7)
|
|
437
|
+
let epEventTopicArns: array<string> = Obj.magic(values->Array.getUnsafe(8))
|
|
438
|
+
|
|
439
|
+
let dict = Dict.make()
|
|
440
|
+
dict->Dict.set("queueUrl", JSON.Encode.string(queueUrl))
|
|
441
|
+
dict->Dict.set("pluginExtensionPointCmdTopicUrl", JSON.Encode.string(pluginEpCmdTopicUrl))
|
|
442
|
+
dict->Dict.set("eventTopicArn", JSON.Encode.string(topLevelEventTopicArn))
|
|
443
|
+
dict->Dict.set("pluginReadModelTableName", JSON.Encode.string(rmTable))
|
|
444
|
+
dict->Dict.set("appSyncApiId", JSON.Encode.string(appSyncApiId))
|
|
445
|
+
dict->Dict.set("clonerEnabled", JSON.Encode.bool(config.clonerEnabled))
|
|
446
|
+
dict->Dict.set("schedulerRoleArn", JSON.Encode.string(schedRoleArn))
|
|
447
|
+
dict->Dict.set("schedulerQueueArn", JSON.Encode.string(schedQueueArn))
|
|
448
|
+
dict->Dict.set("schedulerQueueName", JSON.Encode.string(schedQueueName))
|
|
449
|
+
|
|
450
|
+
// pluginDefinition lives in pluginDefinition.json (see asset bundle
|
|
451
|
+
// below). The entry point reads it via fs.readFileSync at cold start.
|
|
452
|
+
|
|
453
|
+
// Pair each EP with its already-resolved eventTopicArn (parallel arrays)
|
|
454
|
+
// BEFORE sorting, so the (ep, arn) pairing survives the reorder. Then
|
|
455
|
+
// sort by ep.specModule for stable JSON output across deploys — without
|
|
456
|
+
// this, push-order drift in upstream Dict iteration produces pointless
|
|
457
|
+
// Lambda env-var "updates" on every `pulumi up`.
|
|
458
|
+
let extensionPointsArr =
|
|
459
|
+
context.extensionPoints
|
|
460
|
+
->Array.mapWithIndex((ep, i) => (ep, epEventTopicArns->Array.getUnsafe(i)))
|
|
461
|
+
->Array.toSorted(((a, _), (b, _)) => String.compare(a.specModule, b.specModule))
|
|
462
|
+
->Array.map(((ep, eventTopicArn)) => {
|
|
463
|
+
let entryDict = Dict.make()
|
|
464
|
+
entryDict->Dict.set("specModule", JSON.Encode.string(ep.specModule))
|
|
465
|
+
entryDict->Dict.set("mappingsModule", JSON.Encode.string(ep.mappingsModule))
|
|
466
|
+
entryDict->Dict.set("eventTopicArn", JSON.Encode.string(eventTopicArn))
|
|
467
|
+
entryDict->Dict.set(
|
|
468
|
+
"aggregateNames",
|
|
469
|
+
ep.aggregateNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
536
470
|
)
|
|
471
|
+
JSON.Encode.object(entryDict)
|
|
472
|
+
})
|
|
473
|
+
dict->Dict.set("extensionPoints", JSON.Encode.array(extensionPointsArr))
|
|
474
|
+
|
|
475
|
+
let connectExtensionValue = switch context.connectExtension {
|
|
476
|
+
| Some(ce) =>
|
|
477
|
+
let ceDict = Dict.make()
|
|
478
|
+
ceDict->Dict.set("specModule", JSON.Encode.string(ce.specModule))
|
|
479
|
+
ceDict->Dict.set("mappingsModule", JSON.Encode.string(ce.mappingsModule))
|
|
480
|
+
ceDict->Dict.set("extensionPointName", JSON.Encode.string(ce.extensionPointName))
|
|
481
|
+
JSON.Encode.object(ceDict)
|
|
482
|
+
| None => JSON.Encode.null
|
|
483
|
+
}
|
|
484
|
+
dict->Dict.set("connectExtension", connectExtensionValue)
|
|
485
|
+
|
|
486
|
+
// User-declared extensions — one entry per merged extension group.
|
|
487
|
+
// Each entry carries enough metadata for the bundled handler to
|
|
488
|
+
// dynamic-import the spec / mapping modules and filter the top-level
|
|
489
|
+
// publishToAggregates + readModelQueueUrls maps down to the subset
|
|
490
|
+
// this extension actually uses.
|
|
491
|
+
// Sort by extension name so the serialized JSON is stable across deploys.
|
|
492
|
+
let extensionsArr =
|
|
493
|
+
context.extensions
|
|
494
|
+
->Array.toSorted((a, b) => String.compare(a.name, b.name))
|
|
495
|
+
->Array.map(ext => {
|
|
496
|
+
let entryDict = Dict.make()
|
|
497
|
+
entryDict->Dict.set("name", JSON.Encode.string(ext.name))
|
|
498
|
+
entryDict->Dict.set("specModule", JSON.Encode.string(ext.specModule))
|
|
499
|
+
entryDict->Dict.set("mappingsModule", JSON.Encode.string(ext.mappingsModule))
|
|
500
|
+
entryDict->Dict.set("delegateModule", JSON.Encode.string(ext.delegateModule))
|
|
501
|
+
entryDict->Dict.set("extensionPointName", JSON.Encode.string(ext.extensionPointName))
|
|
502
|
+
entryDict->Dict.set(
|
|
503
|
+
"aggregateNames",
|
|
504
|
+
ext.aggregateNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
505
|
+
)
|
|
506
|
+
entryDict->Dict.set(
|
|
507
|
+
"readModelNames",
|
|
508
|
+
ext.readModelNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
509
|
+
)
|
|
510
|
+
JSON.Encode.object(entryDict)
|
|
511
|
+
})
|
|
512
|
+
dict->Dict.set("extensions", JSON.Encode.array(extensionsArr))
|
|
513
|
+
|
|
514
|
+
// publishToAggregates / readModelQueueUrls live in queueUrls.json (see the
|
|
515
|
+
// asset bundle below). Both are one entry per target, so they grow with the
|
|
516
|
+
// plugin, and together with the PTA_/PRM_ vars they name they carried the
|
|
517
|
+
// catalog EventCollector past Lambda's 4KB environment ceiling. Only the
|
|
518
|
+
// maps move: they are built from Dict.keysToArray, so they hold no Pulumi
|
|
519
|
+
// Output and can be serialized here. The URLs themselves cannot follow —
|
|
520
|
+
// see the note on the aggregate walk further down.
|
|
521
|
+
|
|
522
|
+
let rmNamesForSourceDict = Dict.make()
|
|
523
|
+
context.readModelNamesForSourceName
|
|
524
|
+
->Dict.toArray
|
|
525
|
+
->Array.forEach(((sourceName, rmNames)) =>
|
|
526
|
+
rmNamesForSourceDict->Dict.set(
|
|
527
|
+
sourceName,
|
|
528
|
+
rmNames->Array.map(JSON.Encode.string)->JSON.Encode.array,
|
|
537
529
|
)
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
)
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
530
|
+
)
|
|
531
|
+
dict->Dict.set("readModelNamesForSourceName", JSON.Encode.object(rmNamesForSourceDict))
|
|
532
|
+
|
|
533
|
+
let json = JSON.Encode.object(dict)->JSON.stringify
|
|
534
|
+
// The PTA_/PRM_ vars are the rest of this Lambda's environment and the
|
|
535
|
+
// half that grows with the plugin. Their names are known here; their
|
|
536
|
+
// values are still Outputs, so the budget check estimates those.
|
|
537
|
+
let queueUrlKeys = Array.concat(
|
|
538
|
+
context.publishToAggregates
|
|
539
|
+
->Dict.keysToArray
|
|
540
|
+
->Array.map(n => `PTA_${n}_QUEUE_URL`),
|
|
541
|
+
context.readModelQueueUrls->Dict.keysToArray->Array.map(n => `PRM_${n}_QUEUE_URL`),
|
|
542
|
+
)
|
|
543
|
+
Util_LambdaEnvBudget.check(
|
|
544
|
+
~lambdaName=name,
|
|
545
|
+
~handlerConfigJson=json,
|
|
546
|
+
~outputValuedKeys=queueUrlKeys,
|
|
547
|
+
)
|
|
548
|
+
json
|
|
549
|
+
})
|
|
557
550
|
envVars->Dict.set("HANDLER_CONFIG", handlerConfigJson->Pulumi.Output.asInput)
|
|
558
551
|
|
|
559
552
|
// User-extension packages: each merged extension entry contributes three
|
|
@@ -748,20 +741,19 @@ module Make = (
|
|
|
748
741
|
// happen on the dedicated RM Lambda.
|
|
749
742
|
switch config.pluginReadModelTableName {
|
|
750
743
|
| Some(rmTableOutput) =>
|
|
751
|
-
let policyJson =
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
)
|
|
744
|
+
let policyJson = rmTableOutput->Pulumi.Output.apply(tableName =>
|
|
745
|
+
PulumiAws.PolicyDocument.make(
|
|
746
|
+
~id=`${name}PluginRmScanPolicy`,
|
|
747
|
+
~statements=[
|
|
748
|
+
{
|
|
749
|
+
sid: "AllowAdminScanPluginRm",
|
|
750
|
+
effect: Allow,
|
|
751
|
+
actions: Actions(["dynamodb:Scan"]),
|
|
752
|
+
resources: Resource("arn:aws:dynamodb:*:*:table/" ++ tableName),
|
|
753
|
+
},
|
|
754
|
+
],
|
|
755
|
+
)->PulumiAws.PolicyDocument.toJsonString
|
|
756
|
+
)
|
|
765
757
|
let _ = PulumiAws.IAM.RolePolicy.make(
|
|
766
758
|
~name=`${name}-pluginRmScan`,
|
|
767
759
|
~args={
|
|
@@ -771,7 +763,6 @@ module Make = (
|
|
|
771
763
|
)
|
|
772
764
|
| None => ()
|
|
773
765
|
}
|
|
774
|
-
|
|
775
766
|
}
|
|
776
767
|
|
|
777
768
|
// Plugin EC sqs:SendMessage grants on the aggregate / StateChangeSlice
|
|
@@ -792,9 +783,7 @@ module Make = (
|
|
|
792
783
|
// dict (mergedAggregateUrls / aggregateQueueUrls — Plugin_Builder.res:629).
|
|
793
784
|
let aggregateNameSet = Dict.make()
|
|
794
785
|
context.extensions->Array.forEach(ext =>
|
|
795
|
-
ext.aggregateNames->Array.forEach(aggName =>
|
|
796
|
-
aggregateNameSet->Dict.set(aggName, ())
|
|
797
|
-
)
|
|
786
|
+
ext.aggregateNames->Array.forEach(aggName => aggregateNameSet->Dict.set(aggName, ()))
|
|
798
787
|
)
|
|
799
788
|
// One RolePolicy per extension target, each derived through a SINGLE
|
|
800
789
|
// `.apply` on that target's queue-URL Output. `Pulumi.Output.all` is
|
|
@@ -864,30 +853,20 @@ module Make = (
|
|
|
864
853
|
ReventlessCore.Runtime.eventHandler<unit, context, unit>,
|
|
865
854
|
runtimeParts,
|
|
866
855
|
ReventlessCore.Heartbeat.component,
|
|
867
|
-
> = (
|
|
868
|
-
~handler as _,
|
|
869
|
-
~connect,
|
|
870
|
-
~memorySize=1024,
|
|
871
|
-
~timeout=30,
|
|
872
|
-
heartbeat,
|
|
873
|
-
) => {
|
|
856
|
+
> = (~handler as _, ~connect, ~memorySize=1024, ~timeout=30, heartbeat) => {
|
|
874
857
|
let hbConfig = heartbeatConfigRef.contents
|
|
875
858
|
switch hbConfig.epQueueUrl {
|
|
876
859
|
| None =>
|
|
877
860
|
log.warn(~comp="PluginRuntime_Builder", "forPluginHeartbeat skipped (no EP queue URL)")
|
|
878
861
|
| Some(epQueueUrl) =>
|
|
879
862
|
let resource = heartbeat->ReventlessCore.Component.toPulumiResource
|
|
880
|
-
let name =
|
|
881
|
-
ReventlessCore.Heartbeat.componentType
|
|
882
|
-
)
|
|
863
|
+
let name =
|
|
864
|
+
resource.name->ReventlessCore.ComponentType.nameOpt(ReventlessCore.Heartbeat.componentType)
|
|
883
865
|
let opts = {Pulumi.ComponentResource.parent: resource}
|
|
884
866
|
|
|
885
867
|
let envVars: dict<Pulumi.Input.t<string>> = Dict.make()
|
|
886
868
|
envVars->Dict.set("EP_QUEUE_URL", epQueueUrl->Pulumi.Output.asInput)
|
|
887
|
-
envVars->Dict.set(
|
|
888
|
-
"PLUGIN_ID",
|
|
889
|
-
hbConfig.pluginId->Pulumi.Output.make->Pulumi.Output.asInput,
|
|
890
|
-
)
|
|
869
|
+
envVars->Dict.set("PLUGIN_ID", hbConfig.pluginId->Pulumi.Output.make->Pulumi.Output.asInput)
|
|
891
870
|
envVars->Dict.set(
|
|
892
871
|
"HEARTBEAT_TIMEOUT",
|
|
893
872
|
hbConfig.heartbeatTimeout->Int.toString->Pulumi.Output.make->Pulumi.Output.asInput,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
let sendMessage = (~channelId, ~messageBody) =>
|
|
2
|
-
Effect.tryPromise(
|
|
3
|
-
~
|
|
4
|
-
() => AwsSdk.SQS_Helpers.sendMessage(~queueId=channelId, ~messageBody),
|
|
2
|
+
Effect.tryPromise(~catch=SQS_Error.classify, () =>
|
|
3
|
+
AwsSdk.SQS_Helpers.sendMessage(~queueId=channelId, ~messageBody)
|
|
5
4
|
)
|
|
6
5
|
->Effect.map(_ => ())
|
|
7
6
|
->Effect.retry(SQS_Error.retrySchedule)
|
|
8
7
|
->Effect.catchAll(err => {
|
|
9
8
|
let msg = SQS_Error.message(err)
|
|
10
|
-
ReventlessCore.EffectLogger.logError(
|
|
11
|
-
|
|
9
|
+
ReventlessCore.EffectLogger.logError(
|
|
10
|
+
~comp=__MODULE__,
|
|
11
|
+
"Failed to send message to channel: " ++ msg,
|
|
12
|
+
)->Effect.flatMap(_ => Effect.fail(err))
|
|
12
13
|
})
|
|
13
14
|
->Effect.runPromise
|