@reventlessdev/reventless-aws 3.0.0-alpha.344 → 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 +8 -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 +46 -42
- 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 +15 -3
- 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
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
// sury-encoded with the same shape as the in-memory adapter's
|
|
13
13
|
// encodePluginStructureEntry, so it is wrapped with `pluginId` without decoding.
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
let str = (item: dict<JSON.t>, key: string): option<string> =>
|
|
17
16
|
item->Dict.get(key)->Option.flatMap(JSON.Decode.string)
|
|
18
17
|
|
|
@@ -37,7 +36,14 @@ type healSpec = {lists: array<string>, nested: array<(string, array<string>)>}
|
|
|
37
36
|
let refLists = ["references"]
|
|
38
37
|
|
|
39
38
|
let writeSideHeal = {
|
|
40
|
-
lists: [
|
|
39
|
+
lists: [
|
|
40
|
+
"commands",
|
|
41
|
+
"linkedViews",
|
|
42
|
+
"producedEventTypes",
|
|
43
|
+
"consumedEventTypes",
|
|
44
|
+
"events",
|
|
45
|
+
"errors",
|
|
46
|
+
],
|
|
41
47
|
nested: [("commands", refLists), ("events", refLists), ("errors", refLists)],
|
|
42
48
|
}
|
|
43
49
|
|
|
@@ -52,10 +58,7 @@ let healByCollection: array<(string, healSpec)> = [
|
|
|
52
58
|
("stateChangeSlices", writeSideHeal),
|
|
53
59
|
("aggregates", writeSideHeal),
|
|
54
60
|
("automationSlices", {lists: ["consumedEventTypes", "producedCommandTypes"], nested: []}),
|
|
55
|
-
(
|
|
56
|
-
"outboundTranslationSlices",
|
|
57
|
-
{lists: ["consumedEventTypes", "inboundCommandTypes"], nested: []},
|
|
58
|
-
),
|
|
61
|
+
("outboundTranslationSlices", {lists: ["consumedEventTypes", "inboundCommandTypes"], nested: []}),
|
|
59
62
|
("inboundTranslationSlices", {lists: ["commandTypes"], nested: []}),
|
|
60
63
|
("extensions", {lists: ["delegateNames", "eventTypes", "commandTypes"], nested: []}),
|
|
61
64
|
]
|
|
@@ -116,21 +119,22 @@ let healStructure = (structure: dict<JSON.t>): dict<JSON.t> => {
|
|
|
116
119
|
healByCollection->Array.forEach(((collection, spec)) =>
|
|
117
120
|
out->mapMembers(collection, component => {
|
|
118
121
|
component->fillLists(spec.lists)
|
|
119
|
-
spec.nested->Array.forEach(
|
|
120
|
-
component->mapMembers(key, member => member->fillLists(keys))
|
|
122
|
+
spec.nested->Array.forEach(
|
|
123
|
+
((key, keys)) => component->mapMembers(key, member => member->fillLists(keys)),
|
|
121
124
|
)
|
|
122
125
|
})
|
|
123
126
|
)
|
|
124
|
-
readSideCollections->Array.forEach(collection =>
|
|
125
|
-
out->mapMembers(collection, fillLifecycleField)
|
|
126
|
-
)
|
|
127
|
+
readSideCollections->Array.forEach(collection => out->mapMembers(collection, fillLifecycleField))
|
|
127
128
|
out
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
// Mirror ReventlessCore.Platform_ComponentDefinitionsApi.isPublicQueryable on
|
|
131
132
|
// the read path: a component is public unless its visibility is "Internal".
|
|
132
133
|
let isPublicQueryable = (q: JSON.t): bool =>
|
|
133
|
-
switch q
|
|
134
|
+
switch q
|
|
135
|
+
->JSON.Decode.object
|
|
136
|
+
->Option.flatMap(o => o->Dict.get("visibility"))
|
|
137
|
+
->Option.flatMap(JSON.Decode.string) {
|
|
134
138
|
| Some("Internal") => false
|
|
135
139
|
| _ => true
|
|
136
140
|
}
|
|
@@ -147,8 +151,7 @@ let isPublicQueryable = (q: JSON.t): bool =>
|
|
|
147
151
|
// duplicate list.
|
|
148
152
|
let filterStructure = (structure: dict<JSON.t>): dict<JSON.t> => {
|
|
149
153
|
let out = Dict.fromArray(structure->Dict.toArray)
|
|
150
|
-
let arrAt = key =>
|
|
151
|
-
out->Dict.get(key)->Option.flatMap(JSON.Decode.array)->Option.getOr([])
|
|
154
|
+
let arrAt = key => out->Dict.get(key)->Option.flatMap(JSON.Decode.array)->Option.getOr([])
|
|
152
155
|
let readModels = arrAt("readModels")
|
|
153
156
|
let stateViewSlices = arrAt("stateViewSlices")
|
|
154
157
|
out->Dict.set("readModels", readModels->Array.filter(isPublicQueryable)->JSON.Encode.array)
|
|
@@ -192,7 +195,6 @@ let toEntryWith = (~filter: bool, item: dict<JSON.t>, ~name: string): option<JSO
|
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
197
|
|
|
195
|
-
|
|
196
198
|
// The built-in Platform_Admin entry, written at deploy time as an asset file in
|
|
197
199
|
// the code archive (the admin never Connects to itself, so its structure never
|
|
198
200
|
// enters the Plugin read model). It rides the archive rather than an env var
|
|
@@ -204,27 +206,25 @@ let toEntryWith = (~filter: bool, item: dict<JSON.t>, ~name: string): option<JSO
|
|
|
204
206
|
// extension points, so its filtered and complete encodings carry the same
|
|
205
207
|
// components; the structure-level fields the complete entry adds are absent from
|
|
206
208
|
// this JSON and resolve to null, which is what `extensionPoints: None` means.
|
|
207
|
-
let adminEntry: option<JSON.t> =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
| json => Some(json)
|
|
214
|
-
}
|
|
215
|
-
} catch {
|
|
216
|
-
| _ => None
|
|
209
|
+
let adminEntry: option<JSON.t> = try {
|
|
210
|
+
switch NodePath.join([NodeProcess.cwd(), "adminEntry.json"])
|
|
211
|
+
->NodeFs.readFileSync
|
|
212
|
+
->JSON.parseOrThrow {
|
|
213
|
+
| JSON.Null => None
|
|
214
|
+
| json => Some(json)
|
|
217
215
|
}
|
|
216
|
+
} catch {
|
|
217
|
+
| _ => None
|
|
218
|
+
}
|
|
218
219
|
|
|
219
220
|
// Resolve an offloaded `structure`: a large structure is content-addressed to the
|
|
220
221
|
// offload bucket at deploy time and persisted as an `{$offload: {...}}` reference,
|
|
221
222
|
// so fetch the object's bytes and substitute the real structure JSON before it is
|
|
222
223
|
// filtered. Inline (or absent) structures pass through untouched. The `fetch` is
|
|
223
224
|
// per-hash cached, so an identical structure shared across versions is read once.
|
|
224
|
-
let resolveStructure = (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
): promise<dict<JSON.t>> =>
|
|
225
|
+
let resolveStructure = (fetch: string => promise<string>, item: dict<JSON.t>): promise<
|
|
226
|
+
dict<JSON.t>,
|
|
227
|
+
> =>
|
|
228
228
|
switch item
|
|
229
229
|
->Dict.get("structure")
|
|
230
230
|
->Option.flatMap(JSON.Decode.object)
|
|
@@ -302,8 +302,7 @@ let structureOf = (item: dict<JSON.t>, ~name as _: string): option<(
|
|
|
302
302
|
| exception _ =>
|
|
303
303
|
JsError.throwWithMessage(
|
|
304
304
|
`baked manifest: the structure persisted for "${pluginId}" cannot be decoded — ` ++
|
|
305
|
-
`it was written by a framework version this platform can no longer read. ` ++
|
|
306
|
-
`Redeploy that plugin, or drop it from the include-list.`,
|
|
305
|
+
`it was written by a framework version this platform can no longer read. ` ++ `Redeploy that plugin, or drop it from the include-list.`,
|
|
307
306
|
)
|
|
308
307
|
}
|
|
309
308
|
| _ => None
|
|
@@ -357,8 +356,7 @@ let bakeSelections = (): array<ReventlessCore.Platform_BakedManifest.selection>
|
|
|
357
356
|
| Some(raw) =>
|
|
358
357
|
switch raw->JSON.parseOrThrow {
|
|
359
358
|
| json => json->decodeSelections
|
|
360
|
-
| exception _ =>
|
|
361
|
-
JsError.throwWithMessage("baked manifest: BAKE_SELECTIONS is not a JSON array")
|
|
359
|
+
| exception _ => JsError.throwWithMessage("baked manifest: BAKE_SELECTIONS is not a JSON array")
|
|
362
360
|
}
|
|
363
361
|
}
|
|
364
362
|
|
|
@@ -612,8 +610,7 @@ let runBake = async (
|
|
|
612
610
|
let selections = bakeSelections()
|
|
613
611
|
if selections->Array.length == 0 {
|
|
614
612
|
JsError.throwWithMessage(
|
|
615
|
-
"baked manifest: BAKE_SELECTIONS is empty — this platform declares no bake, " ++
|
|
616
|
-
"so there is nothing to write and a shell pointed at the file would find none.",
|
|
613
|
+
"baked manifest: BAKE_SELECTIONS is empty — this platform declares no bake, " ++ "so there is nothing to write and a shell pointed at the file would find none.",
|
|
617
614
|
)
|
|
618
615
|
}
|
|
619
616
|
// The default journey first and always — the caller supplies its key, because
|
|
@@ -677,8 +674,7 @@ let handler = async (event: JSON.t): array<JSON.t> => {
|
|
|
677
674
|
switch bakeTarget {
|
|
678
675
|
| Some(_) =>
|
|
679
676
|
JsError.throwWithMessage(
|
|
680
|
-
"baked manifest: PLUGIN_RM_TABLE env var not set — the bake would write an " ++
|
|
681
|
-
"empty shop rather than fail.",
|
|
677
|
+
"baked manifest: PLUGIN_RM_TABLE env var not set — the bake would write an " ++ "empty shop rather than fail.",
|
|
682
678
|
)
|
|
683
679
|
| None => admin
|
|
684
680
|
}
|
|
@@ -699,11 +695,7 @@ let handler = async (event: JSON.t): array<JSON.t> => {
|
|
|
699
695
|
| Some(target) =>
|
|
700
696
|
// Checked on the raw rows: the refs are what the deploy can predict, and a
|
|
701
697
|
// row that is behind should not have its structure fetched at all.
|
|
702
|
-
let regs = registrations(
|
|
703
|
-
rawItems,
|
|
704
|
-
~expect=bakeExpectations(event),
|
|
705
|
-
~since=bakeSince(event),
|
|
706
|
-
)
|
|
698
|
+
let regs = registrations(rawItems, ~expect=bakeExpectations(event), ~since=bakeSince(event))
|
|
707
699
|
switch regs->Array.filter(isPending) {
|
|
708
700
|
| [] =>
|
|
709
701
|
// The built-in admin entry is deliberately absent: it never enters the
|
|
@@ -720,8 +712,7 @@ let handler = async (event: JSON.t): array<JSON.t> => {
|
|
|
720
712
|
// file. What the summary adds is orthogonal to the files — it says what
|
|
721
713
|
// the convergence check proved, not what the bake wrote.
|
|
722
714
|
Array.concat(written, [encodeSummary(regs)])
|
|
723
|
-
| pending =>
|
|
724
|
-
// Not an error — the deploy just has not finished arriving. Reported so the
|
|
715
|
+
| pending => // Not an error — the deploy just has not finished arriving. Reported so the
|
|
725
716
|
// caller can invoke again rather than bake the previous deployment, and
|
|
726
717
|
// reported with both keys and the row's date so that when it never does
|
|
727
718
|
// arrive, the job says which of the causes it was.
|
|
@@ -734,12 +725,11 @@ let handler = async (event: JSON.t): array<JSON.t> => {
|
|
|
734
725
|
]
|
|
735
726
|
}
|
|
736
727
|
| None =>
|
|
737
|
-
let userEntries =
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
)
|
|
728
|
+
let userEntries = Platform_AdminScan_Ops.latestByName(
|
|
729
|
+
await resolveAll(),
|
|
730
|
+
~nameVersionOf=item => item->str("name"),
|
|
731
|
+
~toEntry,
|
|
732
|
+
)
|
|
743
733
|
Array.concat(admin, userEntries)
|
|
744
734
|
}
|
|
745
735
|
}
|
|
@@ -44,42 +44,44 @@ let make = (
|
|
|
44
44
|
~opts,
|
|
45
45
|
)
|
|
46
46
|
|
|
47
|
-
let _ =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})
|
|
47
|
+
let _ = uiFragmentRegistryTableName->Pulumi.Output.apply(tableName => {
|
|
48
|
+
open PolicyDocument
|
|
49
|
+
let _rolePolicy = IAM.RolePolicy.make(
|
|
50
|
+
~name=name ++ "LambdaPolicy",
|
|
51
|
+
~args={
|
|
52
|
+
IAM.RolePolicy.policy: PolicyDocument.make(
|
|
53
|
+
~id=name ++ "LambdaPolicy",
|
|
54
|
+
~statements=[
|
|
55
|
+
{
|
|
56
|
+
sid: "AllowLambdaLogging",
|
|
57
|
+
effect: Allow,
|
|
58
|
+
actions: Action("logs:*"),
|
|
59
|
+
resources: Resource("arn:aws:logs:*:*:*"),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
sid: "AllowScanUiFragmentsTable",
|
|
63
|
+
effect: Allow,
|
|
64
|
+
actions: Actions(["dynamodb:Scan"]),
|
|
65
|
+
resources: Resource("arn:aws:dynamodb:*:*:table/" ++ tableName),
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
)
|
|
69
|
+
->PolicyDocument.toJsonString
|
|
70
|
+
->Pulumi.Input.make,
|
|
71
|
+
role: lambdaRole.id->Pulumi.Output.asInput,
|
|
72
|
+
},
|
|
73
|
+
~opts,
|
|
74
|
+
)
|
|
75
|
+
})
|
|
77
76
|
|
|
78
77
|
// Bundle reventless-aws (the compiled `_Ops` handler lives inside it) and
|
|
79
78
|
// re-export its `handler`; buildCodeArchive also ships the ESM resolve-hook so
|
|
80
79
|
// the handler's bare @aws-sdk/* specifiers resolve from the managed runtime.
|
|
81
80
|
let packageDirs = Dict.fromArray([
|
|
82
|
-
(
|
|
81
|
+
(
|
|
82
|
+
"@reventlessdev/reventless-aws",
|
|
83
|
+
Util_Bundle.resolvePackageRoot("@reventlessdev/reventless-aws"),
|
|
84
|
+
),
|
|
83
85
|
])
|
|
84
86
|
let {code, sourceCodeHash} = Util_Bundle.buildCodeArchive(
|
|
85
87
|
~entryPointModule="@reventlessdev/reventless-aws/src/adapter/Api/Platform_UIFragments_Lambda_Ops.res.mjs",
|
|
@@ -118,7 +120,12 @@ let make = (
|
|
|
118
120
|
memorySize: 512->Pulumi.Input.make,
|
|
119
121
|
timeout: 30->Pulumi.Input.make,
|
|
120
122
|
layers,
|
|
121
|
-
tags: AWS.Tags.make(
|
|
123
|
+
tags: AWS.Tags.make(
|
|
124
|
+
~name=name ++ "Lambda",
|
|
125
|
+
~kind=ReventlessCore.ComponentType.Platform,
|
|
126
|
+
~role=Runtime,
|
|
127
|
+
~scope=Platform,
|
|
128
|
+
),
|
|
122
129
|
environment: (
|
|
123
130
|
{
|
|
124
131
|
Lambda.Function.variables: Dict.fromArray([
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
// adapter's Platform_UIFragmentsApi.encodeUIFragmentEntry produces, so rows are
|
|
12
12
|
// returned as-is (bar the name/version collapse).
|
|
13
13
|
|
|
14
|
-
|
|
15
14
|
let str = (item: dict<JSON.t>, key: string): option<string> =>
|
|
16
15
|
item->Dict.get(key)->Option.flatMap(JSON.Decode.string)
|
|
17
16
|
|
|
@@ -43,5 +42,9 @@ let handler = async (_event: JSON.t): array<JSON.t> =>
|
|
|
43
42
|
[]
|
|
44
43
|
| Some(table) =>
|
|
45
44
|
let items = await Platform_AdminScan_Ops.scanAll(~tableName=table)
|
|
46
|
-
Platform_AdminScan_Ops.latestByName(
|
|
45
|
+
Platform_AdminScan_Ops.latestByName(
|
|
46
|
+
items,
|
|
47
|
+
~nameVersionOf=item => item->str("pluginId"),
|
|
48
|
+
~toEntry,
|
|
49
|
+
)
|
|
47
50
|
}
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
[AppSync_SourceApiAssociation_Retrying.res]: Pulumi serialises a dynamic
|
|
38
38
|
provider's whole captured closure into stack state, so the SDK is imported
|
|
39
39
|
lazily and nothing here captures a Pulumi Output. */
|
|
40
|
-
|
|
41
40
|
let log = ReventlessCore.Logger.fromEnv()
|
|
42
41
|
|
|
43
42
|
// ── The merge ────────────────────────────────────────────────────────────────
|
|
@@ -70,8 +70,7 @@ nothing else is consulted.
|
|
|
70
70
|
let chooseStore = (~identityProviderId: option<string>): storeChoice =>
|
|
71
71
|
switch identityProviderId {
|
|
72
72
|
| None => StackScoped
|
|
73
|
-
| Some(id) =>
|
|
74
|
-
ProviderScoped(Auth_ActiveRoleStore_Schema.derivedStoreName(~identityProviderId=id))
|
|
73
|
+
| Some(id) => ProviderScoped(Auth_ActiveRoleStore_Schema.derivedStoreName(~identityProviderId=id))
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
// JS resolver code (APPSYNC_JS runtime): forward the caller's arguments and the
|
|
@@ -78,10 +78,7 @@ operator upgrading meets a sentence instead of a silent misbehaviour.
|
|
|
78
78
|
|
|
79
79
|
Order-insensitive, because `DescribeTable` does not promise one.
|
|
80
80
|
*/
|
|
81
|
-
let keySchemaRefusal = (
|
|
82
|
-
~tableName: string,
|
|
83
|
-
~actual: array<(string, string)>,
|
|
84
|
-
): option<string> => {
|
|
81
|
+
let keySchemaRefusal = (~tableName: string, ~actual: array<(string, string)>): option<string> => {
|
|
85
82
|
let actualKey = describeKeySchema(actual)
|
|
86
83
|
let wantedKey = describeKeySchema(expectedKeySchema)
|
|
87
84
|
actualKey == wantedKey
|
|
@@ -137,7 +137,7 @@ let respond = (~event: event, ~decision: decision): event => {
|
|
|
137
137
|
groupOverrideDetails: {
|
|
138
138
|
groupsToOverride: groups,
|
|
139
139
|
iamRolesToOverride,
|
|
140
|
-
|
|
140
|
+
?preferredRole,
|
|
141
141
|
},
|
|
142
142
|
},
|
|
143
143
|
},
|
|
@@ -204,7 +204,10 @@ let handler = async (event: event): event => {
|
|
|
204
204
|
->Option.getOr([])
|
|
205
205
|
|
|
206
206
|
let sub =
|
|
207
|
-
event.request
|
|
207
|
+
event.request
|
|
208
|
+
->Option.flatMap(r => r.userAttributes)
|
|
209
|
+
->Option.flatMap(u => u.sub)
|
|
210
|
+
->Option.getOr("")
|
|
208
211
|
|
|
209
212
|
let clientId = event.callerContext->Option.flatMap(c => c.clientId)->Option.getOr("")
|
|
210
213
|
|
|
@@ -93,11 +93,8 @@ type authConfig = {
|
|
|
93
93
|
region: string,
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
let authenticate = async (
|
|
97
|
-
ctx
|
|
98
|
-
): Identity.authResult => {
|
|
99
|
-
let token =
|
|
100
|
-
_getHeader(ctx.headers, "Authorization")->Option.flatMap(_bearerToken)
|
|
96
|
+
let authenticate = async (ctx: ReventlessCore.Auth_Adapter.requestContext): Identity.authResult => {
|
|
97
|
+
let token = _getHeader(ctx.headers, "Authorization")->Option.flatMap(_bearerToken)
|
|
101
98
|
switch token {
|
|
102
99
|
| None => Anonymous
|
|
103
100
|
| Some(t) =>
|
|
@@ -154,10 +151,7 @@ let fromAppSyncIdentity = (id: option<appSyncIdentity>): Identity.authResult =>
|
|
|
154
151
|
let claims =
|
|
155
152
|
rawClaims
|
|
156
153
|
->Dict.toArray
|
|
157
|
-
->Array.map(((k, v)) => (
|
|
158
|
-
k,
|
|
159
|
-
v->JSON.Decode.string->Option.getOr(v->JSON.stringify),
|
|
160
|
-
))
|
|
154
|
+
->Array.map(((k, v)) => (k, v->JSON.Decode.string->Option.getOr(v->JSON.stringify)))
|
|
161
155
|
->Dict.fromArray
|
|
162
156
|
Authenticated({
|
|
163
157
|
userId: sub,
|
|
@@ -214,10 +214,7 @@ let makeDcb = (
|
|
|
214
214
|
)
|
|
215
215
|
|
|
216
216
|
let _ =
|
|
217
|
-
(
|
|
218
|
-
lambda->Pulumi.Output.flatMap(lambda => lambda.arn),
|
|
219
|
-
dataSourceRole.id,
|
|
220
|
-
)
|
|
217
|
+
(lambda->Pulumi.Output.flatMap(lambda => lambda.arn), dataSourceRole.id)
|
|
221
218
|
->Pulumi.Output.all2
|
|
222
219
|
->Pulumi.Output.apply(((lambdaArn, dataSourceRoleId)) => {
|
|
223
220
|
let _attachDataSourcePolicy = PulumiAws.IAM.RolePolicy.make(
|
|
@@ -5,7 +5,9 @@ type api = Types.AppSync.api
|
|
|
5
5
|
type runtimeParts = Util.Lambda.runtimeParts
|
|
6
6
|
|
|
7
7
|
let handleResolversEvent = (_generateCommand: ReventlessCore.CommandGenerator.commandGenerator) =>
|
|
8
|
-
Pulumi.Output.make((_event, _context) =>
|
|
8
|
+
Pulumi.Output.make((_event, _context) =>
|
|
9
|
+
Effect.succeed(ReventlessCore.CommandTopic.Pending({msgId: ""}))
|
|
10
|
+
)
|
|
9
11
|
|
|
10
12
|
let make: ReventlessCore.CommandGenerator_Adapter.resolversMaker<api, runtimeParts> = (
|
|
11
13
|
~name as _,
|
|
@@ -31,10 +31,7 @@ let make = (
|
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
let _ =
|
|
34
|
-
(
|
|
35
|
-
lambda->Pulumi.Output.flatMap(lambda => lambda.arn),
|
|
36
|
-
dataSourceRole.id,
|
|
37
|
-
)
|
|
34
|
+
(lambda->Pulumi.Output.flatMap(lambda => lambda.arn), dataSourceRole.id)
|
|
38
35
|
->Pulumi.Output.all2
|
|
39
36
|
->Pulumi.Output.apply(((lambdaArn, dataSourceRoleId)) => {
|
|
40
37
|
let _attachDataSourcePolicy = PulumiAws.IAM.RolePolicy.make(
|
|
@@ -48,7 +48,12 @@ let make: ReventlessCore.CommandTopic_Adapter.channelMaker<
|
|
|
48
48
|
let opts =
|
|
49
49
|
opts->Option.map(ReventlessCore.Util.Pulumi.ComponentResourceOptions.toCustomResourceOptions)
|
|
50
50
|
|
|
51
|
-
let tags = AWS.Tags.make(
|
|
51
|
+
let tags = AWS.Tags.make(
|
|
52
|
+
~name,
|
|
53
|
+
~kind=ReventlessCore.CommandTopic.componentType,
|
|
54
|
+
~role=CommandTopic,
|
|
55
|
+
~owner?,
|
|
56
|
+
)
|
|
52
57
|
let queue = PulumiAws.SQS.Queue.make(
|
|
53
58
|
~name,
|
|
54
59
|
~args={
|
|
@@ -82,9 +87,7 @@ let make: ReventlessCore.CommandTopic_Adapter.channelMaker<
|
|
|
82
87
|
stream =>
|
|
83
88
|
stream
|
|
84
89
|
->Stream.grouped(10)
|
|
85
|
-
->Stream.runForEach(jsons =>
|
|
86
|
-
Effect.promise(() => publishJsons(jsons))
|
|
87
|
-
)
|
|
90
|
+
->Stream.runForEach(jsons => Effect.promise(() => publishJsons(jsons)))
|
|
88
91
|
}),
|
|
89
92
|
publishJsonsAndWait: None->Pulumi.Output.make,
|
|
90
93
|
connect,
|
|
@@ -23,7 +23,12 @@ let make: ReventlessCore.CommandTopic_Adapter.channelMaker<
|
|
|
23
23
|
> = (~name, ~owner, ~opts=?) => {
|
|
24
24
|
let opts =
|
|
25
25
|
opts->Option.map(ReventlessCore.Util.Pulumi.ComponentResourceOptions.toCustomResourceOptions)
|
|
26
|
-
let tags = AWS.Tags.make(
|
|
26
|
+
let tags = AWS.Tags.make(
|
|
27
|
+
~name,
|
|
28
|
+
~kind=ReventlessCore.CommandTopic.componentType,
|
|
29
|
+
~role=CommandTopic,
|
|
30
|
+
~owner?,
|
|
31
|
+
)
|
|
27
32
|
let queue = PulumiAws.SQS.Queue.make(
|
|
28
33
|
~name,
|
|
29
34
|
~args={
|
|
@@ -12,7 +12,12 @@ let make: ReventlessCore.CommandTopic_Adapter.channelMaker<
|
|
|
12
12
|
> = (~name, ~owner, ~opts=?) => {
|
|
13
13
|
let opts =
|
|
14
14
|
opts->Option.map(ReventlessCore.Util.Pulumi.ComponentResourceOptions.toCustomResourceOptions)
|
|
15
|
-
let tags = AWS.Tags.make(
|
|
15
|
+
let tags = AWS.Tags.make(
|
|
16
|
+
~name,
|
|
17
|
+
~kind=ReventlessCore.CommandTopic.componentType,
|
|
18
|
+
~role=CommandTopic,
|
|
19
|
+
~owner?,
|
|
20
|
+
)
|
|
16
21
|
let queue = PulumiAws.SQS.Queue.make(
|
|
17
22
|
~name,
|
|
18
23
|
~args={
|
|
@@ -51,9 +56,7 @@ let make: ReventlessCore.CommandTopic_Adapter.channelMaker<
|
|
|
51
56
|
stream =>
|
|
52
57
|
stream
|
|
53
58
|
->Stream.grouped(10)
|
|
54
|
-
->Stream.runForEach(jsons =>
|
|
55
|
-
Effect.promise(() => publishJsons(jsons))
|
|
56
|
-
)
|
|
59
|
+
->Stream.runForEach(jsons => Effect.promise(() => publishJsons(jsons)))
|
|
57
60
|
}),
|
|
58
61
|
publishJsonsAndWait: None->Pulumi.Output.make,
|
|
59
62
|
connect,
|
|
@@ -25,22 +25,21 @@ let handleQueueEvent = (
|
|
|
25
25
|
->Effect.flatMap(results => {
|
|
26
26
|
let deleteEntries =
|
|
27
27
|
results
|
|
28
|
-
->Array.mapWithIndex(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
28
|
+
->Array.mapWithIndex((result, idx) =>
|
|
29
|
+
switch result {
|
|
30
|
+
| Ok(reference) =>
|
|
31
|
+
let deleteMessageBatchEntry: AwsSdk.SQS.DeleteMessageBatchCommand.deleteMessageBatchEntry = {
|
|
32
|
+
id: idx->Int.toString,
|
|
33
|
+
receiptHandle: reference,
|
|
34
|
+
}
|
|
35
|
+
deleteMessageBatchEntry->Some
|
|
36
|
+
| Error(reference) =>
|
|
37
|
+
ReventlessCore.EffectLogger.logError(
|
|
38
|
+
~comp=__MODULE__,
|
|
39
|
+
"handleQueueEvent: Couldn't handle command with ReceiptHandle: " ++ reference,
|
|
40
|
+
)->Effect.runSync
|
|
41
|
+
None
|
|
42
|
+
}
|
|
44
43
|
)
|
|
45
44
|
->Array.filterMap(x => x)
|
|
46
45
|
|
|
@@ -48,7 +47,12 @@ let handleQueueEvent = (
|
|
|
48
47
|
| [] => Effect.succeed()
|
|
49
48
|
| entries =>
|
|
50
49
|
Util.SQS_Runtime.deleteMessages(entries, queue)
|
|
51
|
-
->Effect.tap(_ =>
|
|
50
|
+
->Effect.tap(_ =>
|
|
51
|
+
ReventlessCore.EffectLogger.logInfo(
|
|
52
|
+
~comp=__MODULE__,
|
|
53
|
+
"handleQueueEvent: Deleted all commands from queue",
|
|
54
|
+
)
|
|
55
|
+
)
|
|
52
56
|
->Effect.catchAll(errorMsg =>
|
|
53
57
|
ReventlessCore.EffectLogger.logError(
|
|
54
58
|
~comp=__MODULE__,
|
|
@@ -63,7 +67,9 @@ let publishJsons = (queue, queueService) =>
|
|
|
63
67
|
async jsons =>
|
|
64
68
|
switch jsons->Array.length {
|
|
65
69
|
| 0 =>
|
|
66
|
-
ReventlessCore.EffectLogger.logInfo(~comp=__MODULE__, "publishJsons: No commands to send")
|
|
70
|
+
ReventlessCore.EffectLogger.logInfo(~comp=__MODULE__, "publishJsons: No commands to send")
|
|
71
|
+
->Effect.runPromise
|
|
72
|
+
->ignore
|
|
67
73
|
| 1 =>
|
|
68
74
|
await queue->Util_SQS_Runtime.send(queueService, jsons->Array.getUnsafe(0))->Effect.runPromise
|
|
69
75
|
| _ =>
|
|
@@ -28,7 +28,12 @@ let make: ReventlessCore.CommandTopic_Adapter.channelMaker<
|
|
|
28
28
|
let opts =
|
|
29
29
|
opts->Option.map(ReventlessCore.Util.Pulumi.ComponentResourceOptions.toCustomResourceOptions)
|
|
30
30
|
|
|
31
|
-
let tags = AWS.Tags.make(
|
|
31
|
+
let tags = AWS.Tags.make(
|
|
32
|
+
~name,
|
|
33
|
+
~kind=ReventlessCore.CommandTopic.componentType,
|
|
34
|
+
~role=CommandTopic,
|
|
35
|
+
~owner?,
|
|
36
|
+
)
|
|
32
37
|
let queue = PulumiAws.SQS.Queue.make(
|
|
33
38
|
~name,
|
|
34
39
|
~args={
|
|
@@ -73,9 +78,9 @@ let make: ReventlessCore.CommandTopic_Adapter.channelMaker<
|
|
|
73
78
|
| None =>
|
|
74
79
|
// Handler not yet registered — fall back to fire-and-forget, return Pending
|
|
75
80
|
let _ = await sendToSqs(jsons)
|
|
76
|
-
jsons->Array.map(cmdJson =>
|
|
77
|
-
|
|
78
|
-
)
|
|
81
|
+
jsons->Array.map(cmdJson => ReventlessCore.CommandTopic.Pending({
|
|
82
|
+
msgId: cmdJson.meta.msgId,
|
|
83
|
+
}))
|
|
79
84
|
| Some(handleCmds) =>
|
|
80
85
|
await ReventlessCore.CommandTopic.runInlineAndCollect(jsons, handleCmds)
|
|
81
86
|
}
|
|
@@ -38,10 +38,7 @@ let register = (
|
|
|
38
38
|
~queueUrl: Pulumi.Output.t<string>,
|
|
39
39
|
~resource: ReventlessInfra.Adapter.resource,
|
|
40
40
|
~isFifo: bool,
|
|
41
|
-
) =>
|
|
42
|
-
owner->Option.forEach(({name}) =>
|
|
43
|
-
byOwner->Dict.set(name, {queueUrl, resource, isFifo})
|
|
44
|
-
)
|
|
41
|
+
) => owner->Option.forEach(({name}) => byOwner->Dict.set(name, {queueUrl, resource, isFifo}))
|
|
45
42
|
|
|
46
43
|
/** The CommandTopic of the component with this name, if one has been created.
|
|
47
44
|
`None` for a target that is not an Aggregate in this plugin — a DCB
|
|
@@ -19,24 +19,24 @@ let make: ReventlessCore.Counter_Adapter.handlerMaker = (
|
|
|
19
19
|
|
|
20
20
|
let countsTableName = (countsDb.resources->Array.getUnsafe(0)).name
|
|
21
21
|
|
|
22
|
-
let targetSpecModule =
|
|
23
|
-
|
|
24
|
-
let mappingsModule =
|
|
25
|
-
mappingsModulePath->JSON.stringifyAny->Option.getOr(`""`)
|
|
22
|
+
let targetSpecModule = specModulePath->JSON.stringifyAny->Option.getOr(`""`)
|
|
23
|
+
let mappingsModule = mappingsModulePath->JSON.stringifyAny->Option.getOr(`""`)
|
|
26
24
|
|
|
27
|
-
let handlerConfigJson =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
let handlerConfigJson = Pulumi.Output.all3((
|
|
26
|
+
countsTableName,
|
|
27
|
+
publishChannelId,
|
|
28
|
+
referencesStream.urn,
|
|
29
|
+
))->Pulumi.Output.apply(((table, queueUrl, refArn)) => {
|
|
30
|
+
let countsArn = "" // Will be set separately
|
|
31
|
+
`{"targetSpecModule":${targetSpecModule},"mappingsModule":${mappingsModule},"countsTableName":"${table}","publishChannelId":"${queueUrl}","referencesStreamArn":"${refArn}","countsStreamArn":"${countsArn}"}`
|
|
32
|
+
})
|
|
33
33
|
|
|
34
34
|
// countsStreamArn is in a separate Output — merge into config
|
|
35
35
|
let fullHandlerConfigJson =
|
|
36
|
-
Pulumi.Output.all2((handlerConfigJson, countsStream.urn))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
36
|
+
Pulumi.Output.all2((handlerConfigJson, countsStream.urn))->Pulumi.Output.apply(((
|
|
37
|
+
config,
|
|
38
|
+
countsArn,
|
|
39
|
+
)) => config->String.replace(`"countsStreamArn":""`, `"countsStreamArn":"${countsArn}"`))
|
|
40
40
|
|
|
41
41
|
envVars->Dict.set("HANDLER_CONFIG", fullHandlerConfigJson->Pulumi.Output.asInput)
|
|
42
42
|
|
|
@@ -73,7 +73,7 @@ let make: ReventlessCore.Counter_Adapter.handlerMaker = (
|
|
|
73
73
|
|
|
74
74
|
let subscribe = (sourceName, source) =>
|
|
75
75
|
Util_EventSourceMapping.subscribe(
|
|
76
|
-
~lambda
|
|
76
|
+
~lambda,
|
|
77
77
|
~targetName=name,
|
|
78
78
|
~sourceName,
|
|
79
79
|
~source,
|