@reventlessdev/reventless-aws 3.0.0-alpha.344 → 3.0.0-alpha.346
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 +36 -0
- package/package.json +15 -12
- package/run-provision-accounts.mjs +3 -0
- package/run-provision-admin.mjs +3 -0
- package/scripts/ProvisionAccounts.res +325 -0
- package/scripts/ProvisionAccounts.res.mjs +337 -0
- package/scripts/ProvisionAdmin.res +275 -0
- package/scripts/ProvisionAdmin.res.mjs +289 -0
- package/scripts/ProvisionCognito.res +149 -0
- package/scripts/ProvisionCognito.res.mjs +98 -0
- package/scripts/ProvisionIdentity.res +84 -14
- package/scripts/ProvisionIdentity.res.mjs +72 -7
- package/scripts/ProvisionProvider.res +104 -0
- package/scripts/ProvisionProvider.res.mjs +123 -0
- package/src/Platform.res +358 -329
- package/src/Platform.res.mjs +24 -12
- package/src/Platform_Casts.res +13 -4
- package/src/Platform_Stack.res +119 -9
- package/src/Platform_Stack.res.mjs +42 -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/Auth/Auth_LoginIdentifier.res +66 -0
- package/src/adapter/Auth/Auth_LoginIdentifier.res.mjs +70 -0
- package/src/adapter/Auth/Auth_SignUpMode.res +78 -0
- package/src/adapter/Auth/Auth_SignUpMode.res.mjs +56 -0
- 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 +23 -11
- package/src/adapter/Runtime/AutomationSliceEntryPoint_Ops.res.mjs +5 -1
- 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 +80 -109
- package/src/components/Api/AppSync_Adapter.res.mjs +26 -60
- package/src/components/Api/AppSync_SdlDecorate.res +118 -31
- package/src/components/Api/AppSync_SdlDecorate.res.mjs +45 -0
- 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 +286 -224
- package/tests/AppSync_AdapterTest.res.mjs +69 -0
- 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/Auth_LoginIdentifierTest.res +51 -0
- package/tests/Auth_LoginIdentifierTest.res.mjs +51 -0
- package/tests/Auth_SignUpModeTest.res +56 -0
- package/tests/Auth_SignUpModeTest.res.mjs +53 -0
- 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/ProvisionAccountsTest.res +142 -0
- package/tests/ProvisionAccountsTest.res.mjs +153 -0
- package/tests/ProvisionAdminTest.res +55 -0
- package/tests/ProvisionAdminTest.res.mjs +66 -0
- package/tests/ProvisionIdentityTest.res +91 -9
- package/tests/ProvisionIdentityTest.res.mjs +66 -1
- 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 +35 -8
- package/tests/Util_OwnerScopeEnvTest.res.mjs +13 -0
- 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
|
@@ -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,
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// The attribute a person signs in with. One definition, two consumers: the auto
|
|
2
|
+
// pool the platform stack declares, and the provisioning script that makes a
|
|
3
|
+
// pool no stack owns. Free of Pulumi and of the AWS SDK so both can import it.
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
Which attribute identifies a person at sign-in.
|
|
7
|
+
|
|
8
|
+
🚨 **Fixed at pool creation, and no later deploy can change it.** `CreateUserPool`
|
|
9
|
+
accepts `UsernameAttributes`; `UpdateUserPool` has no such member, so nothing can
|
|
10
|
+
change it in place and every provider replaces the pool instead. A replaced pool
|
|
11
|
+
is an empty one — Cognito exports no password material, so every account
|
|
12
|
+
re-registers. A deployment that will ever want phone sign-in has to say so on its
|
|
13
|
+
first deploy.
|
|
14
|
+
*/
|
|
15
|
+
type t =
|
|
16
|
+
| Email
|
|
17
|
+
| Phone
|
|
18
|
+
| EmailOrPhone
|
|
19
|
+
|
|
20
|
+
/** What every pool has been created with so far, so an existing stack redeploys
|
|
21
|
+
unchanged. */
|
|
22
|
+
let default = Email
|
|
23
|
+
|
|
24
|
+
let all: array<t> = [Email, Phone, EmailOrPhone]
|
|
25
|
+
|
|
26
|
+
/** The config spelling, and the stack output. */
|
|
27
|
+
let toString = (identifier: t): string =>
|
|
28
|
+
switch identifier {
|
|
29
|
+
| Email => "email"
|
|
30
|
+
| Phone => "phone"
|
|
31
|
+
| EmailOrPhone => "emailOrPhone"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let fromString = (value: string): option<t> => all->Array.find(i => toString(i) == value)
|
|
35
|
+
|
|
36
|
+
/** Cognito's `usernameAttributes`. */
|
|
37
|
+
let usernameAttributes = (identifier: t): array<string> =>
|
|
38
|
+
switch identifier {
|
|
39
|
+
| Email => ["email"]
|
|
40
|
+
| Phone => ["phone_number"]
|
|
41
|
+
| EmailOrPhone => ["email", "phone_number"]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
The deploy-time choice, or why the deploy cannot proceed.
|
|
46
|
+
|
|
47
|
+
An unrecognised spelling refuses rather than falling back to the default: a typo
|
|
48
|
+
that defaulted would create a pool signing in on the wrong attribute, which is
|
|
49
|
+
the one property no later deploy can correct.
|
|
50
|
+
*/
|
|
51
|
+
let parse = (value: option<string>): result<t, string> =>
|
|
52
|
+
switch value {
|
|
53
|
+
| None => Ok(default)
|
|
54
|
+
| Some(raw) =>
|
|
55
|
+
switch fromString(raw) {
|
|
56
|
+
| Some(identifier) => Ok(identifier)
|
|
57
|
+
| None =>
|
|
58
|
+
Error(
|
|
59
|
+
`loginIdentifier "${raw}" is not one of ${all
|
|
60
|
+
->Array.map(toString)
|
|
61
|
+
->Array.join(
|
|
62
|
+
", ",
|
|
63
|
+
)}. It fixes the sign-in attribute at pool creation and no later deploy can change it, so an unrecognised spelling refuses rather than defaulting.`,
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
let all = [
|
|
5
|
+
"Email",
|
|
6
|
+
"Phone",
|
|
7
|
+
"EmailOrPhone"
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
function toString(identifier) {
|
|
11
|
+
switch (identifier) {
|
|
12
|
+
case "Email" :
|
|
13
|
+
return "email";
|
|
14
|
+
case "Phone" :
|
|
15
|
+
return "phone";
|
|
16
|
+
case "EmailOrPhone" :
|
|
17
|
+
return "emailOrPhone";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function fromString(value) {
|
|
22
|
+
return all.find(i => toString(i) === value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function usernameAttributes(identifier) {
|
|
26
|
+
switch (identifier) {
|
|
27
|
+
case "Email" :
|
|
28
|
+
return ["email"];
|
|
29
|
+
case "Phone" :
|
|
30
|
+
return ["phone_number"];
|
|
31
|
+
case "EmailOrPhone" :
|
|
32
|
+
return [
|
|
33
|
+
"email",
|
|
34
|
+
"phone_number"
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function parse(value) {
|
|
40
|
+
if (value === undefined) {
|
|
41
|
+
return {
|
|
42
|
+
TAG: "Ok",
|
|
43
|
+
_0: "Email"
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
let identifier = fromString(value);
|
|
47
|
+
if (identifier !== undefined) {
|
|
48
|
+
return {
|
|
49
|
+
TAG: "Ok",
|
|
50
|
+
_0: identifier
|
|
51
|
+
};
|
|
52
|
+
} else {
|
|
53
|
+
return {
|
|
54
|
+
TAG: "Error",
|
|
55
|
+
_0: `loginIdentifier "` + value + `" is not one of ` + all.map(toString).join(", ") + `. It fixes the sign-in attribute at pool creation and no later deploy can change it, so an unrecognised spelling refuses rather than defaulting.`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let $$default = "Email";
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
$$default as default,
|
|
64
|
+
all,
|
|
65
|
+
toString,
|
|
66
|
+
fromString,
|
|
67
|
+
usernameAttributes,
|
|
68
|
+
parse,
|
|
69
|
+
}
|
|
70
|
+
/* No side effect */
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Whether a stranger can create their own account. One definition, two consumers:
|
|
2
|
+
// the auto pool the platform stack declares, and the provisioning script that
|
|
3
|
+
// makes a pool no stack owns. Free of Pulumi and of the AWS SDK so both can
|
|
4
|
+
// import it — the same shape, and the same drift it prevents, as
|
|
5
|
+
// [Auth_LoginIdentifier].
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
Who may create a principal in this pool.
|
|
9
|
+
|
|
10
|
+
Unlike the sign-in attribute, this **is** updatable in place: `AdminCreateUserConfig`
|
|
11
|
+
is a member of `UpdateUserPoolRequest`, so a pool full of accounts can be flipped
|
|
12
|
+
either way at any time, for free and reversibly. It is a setting, not a
|
|
13
|
+
first-deploy-or-never decision.
|
|
14
|
+
|
|
15
|
+
🚨 **On a shared pool the flip is pool-wide, not stack-wide.** The setting belongs
|
|
16
|
+
to the pool and the pool has one of it, so every stack pointed at that pool gets
|
|
17
|
+
self-service the moment one deployment turns it on. A deployment that must never
|
|
18
|
+
self-register cannot rely on its own config to prevent it, and should not share a
|
|
19
|
+
pool with one that does.
|
|
20
|
+
*/
|
|
21
|
+
type t =
|
|
22
|
+
/** Only an administrator creates principals — what every pool so far was
|
|
23
|
+
created with, and what a deployment with no registration flow wants. */
|
|
24
|
+
| AdminOnly
|
|
25
|
+
/** A stranger can register themselves. */
|
|
26
|
+
| SelfService
|
|
27
|
+
|
|
28
|
+
/** What every pool has been created with so far, so an existing stack redeploys
|
|
29
|
+
unchanged. Closed is also the right default on its own terms: a deployment that
|
|
30
|
+
has not asked for self-registration should not acquire it by upgrading. */
|
|
31
|
+
let default = AdminOnly
|
|
32
|
+
|
|
33
|
+
let all: array<t> = [AdminOnly, SelfService]
|
|
34
|
+
|
|
35
|
+
/** The config spelling. */
|
|
36
|
+
let toString = (mode: t): string =>
|
|
37
|
+
switch mode {
|
|
38
|
+
| AdminOnly => "adminOnly"
|
|
39
|
+
| SelfService => "selfService"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let fromString = (value: string): option<t> => all->Array.find(m => toString(m) == value)
|
|
43
|
+
|
|
44
|
+
/** Cognito's `allowAdminCreateUserOnly`, which asks the negative of what this
|
|
45
|
+
type asks. Converting in one place is the point: a bool named for the negative
|
|
46
|
+
is easy to read backwards at a call site. */
|
|
47
|
+
let allowAdminCreateUserOnly = (mode: t): bool =>
|
|
48
|
+
switch mode {
|
|
49
|
+
| AdminOnly => true
|
|
50
|
+
| SelfService => false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
The deploy-time choice, or why the deploy cannot proceed.
|
|
55
|
+
|
|
56
|
+
An unrecognised spelling refuses rather than falling back to the default, and the
|
|
57
|
+
reason is *not* [Auth_LoginIdentifier]'s — this setting is correctable at any
|
|
58
|
+
time. It is that the mistake would be silent. The default is closed, so a typo
|
|
59
|
+
fails safe, but it fails safe *invisibly*: the deploy is green, the config says
|
|
60
|
+
what the operator meant, and the symptom is every registration being refused,
|
|
61
|
+
which surfaces far from the misspelling that caused it.
|
|
62
|
+
*/
|
|
63
|
+
let parse = (value: option<string>): result<t, string> =>
|
|
64
|
+
switch value {
|
|
65
|
+
| None => Ok(default)
|
|
66
|
+
| Some(raw) =>
|
|
67
|
+
switch fromString(raw) {
|
|
68
|
+
| Some(mode) => Ok(mode)
|
|
69
|
+
| None =>
|
|
70
|
+
Error(
|
|
71
|
+
`signUpMode "${raw}" is not one of ${all
|
|
72
|
+
->Array.map(toString)
|
|
73
|
+
->Array.join(
|
|
74
|
+
", ",
|
|
75
|
+
)}. It decides whether a stranger can create an account. An unrecognised spelling refuses rather than defaulting, because defaulting would deploy green and refuse every registration, with nothing pointing back at the spelling.`,
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
let all = [
|
|
5
|
+
"AdminOnly",
|
|
6
|
+
"SelfService"
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
function toString(mode) {
|
|
10
|
+
if (mode === "AdminOnly") {
|
|
11
|
+
return "adminOnly";
|
|
12
|
+
} else {
|
|
13
|
+
return "selfService";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function fromString(value) {
|
|
18
|
+
return all.find(m => toString(m) === value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function allowAdminCreateUserOnly(mode) {
|
|
22
|
+
return mode === "AdminOnly";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function parse(value) {
|
|
26
|
+
if (value === undefined) {
|
|
27
|
+
return {
|
|
28
|
+
TAG: "Ok",
|
|
29
|
+
_0: "AdminOnly"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
let mode = fromString(value);
|
|
33
|
+
if (mode !== undefined) {
|
|
34
|
+
return {
|
|
35
|
+
TAG: "Ok",
|
|
36
|
+
_0: mode
|
|
37
|
+
};
|
|
38
|
+
} else {
|
|
39
|
+
return {
|
|
40
|
+
TAG: "Error",
|
|
41
|
+
_0: `signUpMode "` + value + `" is not one of ` + all.map(toString).join(", ") + `. It decides whether a stranger can create an account. An unrecognised spelling refuses rather than defaulting, because defaulting would deploy green and refuse every registration, with nothing pointing back at the spelling.`
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let $$default = "AdminOnly";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
$$default as default,
|
|
50
|
+
all,
|
|
51
|
+
toString,
|
|
52
|
+
fromString,
|
|
53
|
+
allowAdminCreateUserOnly,
|
|
54
|
+
parse,
|
|
55
|
+
}
|
|
56
|
+
/* No side effect */
|
|
@@ -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,
|
|
@@ -34,10 +34,9 @@ let make: ReventlessCore.DcbEventLog_Adapter.storageMaker = (
|
|
|
34
34
|
let globalSecondaryIndexes =
|
|
35
35
|
indexes
|
|
36
36
|
->Array.map(indexName => {
|
|
37
|
-
let projectionType =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
: PulumiAws.DynamoDb.Table.KEYS_ONLY
|
|
37
|
+
let projectionType = DcbEventLogStorage_DynamoDb_Runtime.indexKeepsFullProjection(indexName)
|
|
38
|
+
? PulumiAws.DynamoDb.Table.ALL
|
|
39
|
+
: PulumiAws.DynamoDb.Table.KEYS_ONLY
|
|
41
40
|
{
|
|
42
41
|
PulumiAws.DynamoDb.Table.name: indexName,
|
|
43
42
|
hashKey: indexName,
|
|
@@ -50,7 +49,12 @@ let make: ReventlessCore.DcbEventLog_Adapter.storageMaker = (
|
|
|
50
49
|
|
|
51
50
|
// Create DynamoDB table with stream enabled — EventTopicPublisher_DynamoDbStream
|
|
52
51
|
// needs a DynamoDbStream resource to connect the EventTopic.
|
|
53
|
-
let tags = AWS.Tags.make(
|
|
52
|
+
let tags = AWS.Tags.make(
|
|
53
|
+
~name,
|
|
54
|
+
~kind=ReventlessCore.ComponentType.Plugin,
|
|
55
|
+
~role=DcbEventLog,
|
|
56
|
+
~scope=Plugin,
|
|
57
|
+
)
|
|
54
58
|
let table = Util_DynamoDbStream.makeTable(
|
|
55
59
|
name,
|
|
56
60
|
~attributes,
|