@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
|
@@ -59,9 +59,7 @@ let _getUsEast1Provider = (): PulumiAws.Aws.Provider.t =>
|
|
|
59
59
|
// `no-cache` here a redeploy uploads the new entry file to S3 while CloudFront
|
|
60
60
|
// (and browsers) keep serving the previous build: the "deployed but stale" trap.
|
|
61
61
|
let cacheControlFor = (relativePath: string): string =>
|
|
62
|
-
relativePath->String.startsWith("assets/")
|
|
63
|
-
? "public, max-age=31536000, immutable"
|
|
64
|
-
: "no-cache"
|
|
62
|
+
relativePath->String.startsWith("assets/") ? "public, max-age=31536000, immutable" : "no-cache"
|
|
65
63
|
|
|
66
64
|
// ── Inline CloudFront SDK binding (deploy-time cache invalidation) ───────────
|
|
67
65
|
// Mirrors AppSync_Adapter's inline `@aws-sdk` binding pattern. Runs in the
|
|
@@ -103,7 +101,10 @@ let invalidateDistribution = async (~distributionId: string, ~paths: array<strin
|
|
|
103
101
|
},
|
|
104
102
|
}
|
|
105
103
|
let _ = await client->cfSend(input->makeCreateInvalidationCommand)
|
|
106
|
-
log.info(
|
|
104
|
+
log.info(
|
|
105
|
+
~comp="makeUiBundleDistribution",
|
|
106
|
+
`CloudFront invalidation submitted for ${distributionId}`,
|
|
107
|
+
)
|
|
107
108
|
} catch {
|
|
108
109
|
| exn =>
|
|
109
110
|
let msg = exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("unknown")
|
|
@@ -212,7 +213,9 @@ let makeUiBundleDistribution = (
|
|
|
212
213
|
// policy. Always cover `remoteEntry.js` (federation manifest) and, for SPA
|
|
213
214
|
// shells, `index.html` + `config.json`. Hashed assets fall through to the
|
|
214
215
|
// CachingOptimized default behavior since their URL changes on every build.
|
|
215
|
-
let noCacheBehavior = (
|
|
216
|
+
let noCacheBehavior = (
|
|
217
|
+
pattern: string,
|
|
218
|
+
): PulumiAws.CloudFront.Distribution.orderedCacheBehavior => {
|
|
216
219
|
pathPattern: Pulumi.Input.make(pattern),
|
|
217
220
|
targetOriginId: Pulumi.Input.make(originId),
|
|
218
221
|
viewerProtocolPolicy: Pulumi.Input.make("redirect-to-https"),
|
|
@@ -330,27 +333,27 @@ let makeUiBundleDistribution = (
|
|
|
330
333
|
| Some({fqdn}) => Some(Pulumi.Input.make([fqdn]))
|
|
331
334
|
},
|
|
332
335
|
origins: (bucket.bucketRegionalDomainName, oac.id)
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
originAccessControlId: Pulumi.Input.make(oacId),
|
|
341
|
-
},
|
|
342
|
-
],
|
|
343
|
-
// One S3 origin per served bucket, sharing the same OAC as the bundle
|
|
344
|
-
// origin (the OAC only authorizes CloudFront→S3 sigv4 signing; the
|
|
345
|
-
// per-bucket read grant is the served bucket's own BucketPolicy below).
|
|
346
|
-
servedBuckets->Array.map(sb => {
|
|
347
|
-
PulumiAws.CloudFront.Distribution.domainName: sb.bucketRegionalDomainName,
|
|
348
|
-
originId: Pulumi.Input.make(servedOriginId(sb.id)),
|
|
336
|
+
->Pulumi.Output.all2
|
|
337
|
+
->Pulumi.Output.apply(((domainName, oacId)) =>
|
|
338
|
+
Array.concat(
|
|
339
|
+
[
|
|
340
|
+
{
|
|
341
|
+
PulumiAws.CloudFront.Distribution.domainName: Pulumi.Input.make(domainName),
|
|
342
|
+
originId: Pulumi.Input.make(originId),
|
|
349
343
|
originAccessControlId: Pulumi.Input.make(oacId),
|
|
350
|
-
}
|
|
351
|
-
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
// One S3 origin per served bucket, sharing the same OAC as the bundle
|
|
347
|
+
// origin (the OAC only authorizes CloudFront→S3 sigv4 signing; the
|
|
348
|
+
// per-bucket read grant is the served bucket's own BucketPolicy below).
|
|
349
|
+
servedBuckets->Array.map(sb => {
|
|
350
|
+
PulumiAws.CloudFront.Distribution.domainName: sb.bucketRegionalDomainName,
|
|
351
|
+
originId: Pulumi.Input.make(servedOriginId(sb.id)),
|
|
352
|
+
originAccessControlId: Pulumi.Input.make(oacId),
|
|
353
|
+
}),
|
|
352
354
|
)
|
|
353
|
-
|
|
355
|
+
)
|
|
356
|
+
->Pulumi.Output.asInput,
|
|
354
357
|
defaultCacheBehavior: Pulumi.Input.make(
|
|
355
358
|
(
|
|
356
359
|
{
|
|
@@ -413,27 +416,27 @@ let makeUiBundleDistribution = (
|
|
|
413
416
|
~args={
|
|
414
417
|
bucket: bucket.id->Pulumi.Output.asInput,
|
|
415
418
|
policy: (bucket.arn, distribution.arn)
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
},
|
|
419
|
+
->Pulumi.Output.all2
|
|
420
|
+
->Pulumi.Output.apply(((bucketArn, distributionArn)) =>
|
|
421
|
+
{
|
|
422
|
+
"Version": "2012-10-17",
|
|
423
|
+
"Statement": [
|
|
424
|
+
{
|
|
425
|
+
"Sid": "AllowCloudFrontServicePrincipal",
|
|
426
|
+
"Effect": "Allow",
|
|
427
|
+
"Principal": {"Service": "cloudfront.amazonaws.com"},
|
|
428
|
+
"Action": "s3:GetObject",
|
|
429
|
+
"Resource": bucketArn ++ "/*",
|
|
430
|
+
"Condition": {
|
|
431
|
+
"StringEquals": {"AWS:SourceArn": distributionArn},
|
|
430
432
|
},
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
433
|
+
},
|
|
434
|
+
],
|
|
435
|
+
}
|
|
436
|
+
->JSON.stringifyAny
|
|
437
|
+
->Option.getUnsafe
|
|
438
|
+
)
|
|
439
|
+
->Pulumi.Output.asInput,
|
|
437
440
|
},
|
|
438
441
|
)
|
|
439
442
|
|
|
@@ -461,27 +464,27 @@ let makeUiBundleDistribution = (
|
|
|
461
464
|
~args={
|
|
462
465
|
bucket: sb.bucketId,
|
|
463
466
|
policy: (sb.bucketArn->Pulumi.Output.fromInput, distribution.arn)
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
},
|
|
467
|
+
->Pulumi.Output.all2
|
|
468
|
+
->Pulumi.Output.apply(((bucketArn, distributionArn)) =>
|
|
469
|
+
{
|
|
470
|
+
"Version": "2012-10-17",
|
|
471
|
+
"Statement": [
|
|
472
|
+
{
|
|
473
|
+
"Sid": "AllowCloudFrontServicePrincipal",
|
|
474
|
+
"Effect": "Allow",
|
|
475
|
+
"Principal": {"Service": "cloudfront.amazonaws.com"},
|
|
476
|
+
"Action": "s3:GetObject",
|
|
477
|
+
"Resource": bucketArn ++ "/*",
|
|
478
|
+
"Condition": {
|
|
479
|
+
"StringEquals": {"AWS:SourceArn": distributionArn},
|
|
478
480
|
},
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
}
|
|
484
|
+
->JSON.stringifyAny
|
|
485
|
+
->Option.getUnsafe
|
|
486
|
+
)
|
|
487
|
+
->Pulumi.Output.asInput,
|
|
485
488
|
},
|
|
486
489
|
)
|
|
487
490
|
})
|
|
@@ -491,9 +494,7 @@ let makeUiBundleDistribution = (
|
|
|
491
494
|
| Some(dir) =>
|
|
492
495
|
let allEntries = Util.StaticBundle.walk(dir)
|
|
493
496
|
if allEntries->Array.length == 0 {
|
|
494
|
-
JsError.throwWithMessage(
|
|
495
|
-
`Plugin_Stack.makeUiBundleDistribution: assetsDir is empty: ${dir}`,
|
|
496
|
-
)
|
|
497
|
+
JsError.throwWithMessage(`Plugin_Stack.makeUiBundleDistribution: assetsDir is empty: ${dir}`)
|
|
497
498
|
}
|
|
498
499
|
// Drop excluded relative paths before BucketObject creation. Used so the
|
|
499
500
|
// host-shell deploy can skip the dev-mode `public/config.json` it ships
|
|
@@ -502,21 +503,20 @@ let makeUiBundleDistribution = (
|
|
|
502
503
|
// upload (whichever Pulumi applies last wins).
|
|
503
504
|
let entries =
|
|
504
505
|
allEntries->Array.filter(entry => !(excludeFiles->Array.includes(entry.relativePath)))
|
|
505
|
-
let objectEtags =
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
})
|
|
506
|
+
let objectEtags = entries->Array.map(entry => {
|
|
507
|
+
let obj = PulumiAws.S3.BucketObject.make(
|
|
508
|
+
~name=name ++ "-asset-" ++ Util.StaticBundle.sanitizeName(entry.relativePath),
|
|
509
|
+
~args={
|
|
510
|
+
bucket: bucket.id->Pulumi.Output.asInput,
|
|
511
|
+
key: Pulumi.Input.make(entry.relativePath),
|
|
512
|
+
source: Pulumi.Input.make(entry.fileAsset),
|
|
513
|
+
contentType: Pulumi.Input.make(Util.StaticBundle.contentTypeFor(entry.relativePath)),
|
|
514
|
+
cacheControl: Pulumi.Input.make(cacheControlFor(entry.relativePath)),
|
|
515
|
+
etag: Pulumi.Input.make(entry.contentHash),
|
|
516
|
+
},
|
|
517
|
+
)
|
|
518
|
+
obj.etag
|
|
519
|
+
})
|
|
520
520
|
|
|
521
521
|
// Auto-invalidate CloudFront once every object is (re)uploaded. Stable-named
|
|
522
522
|
// entry files (index.html, the module-federation mf-entry-bootstrap-*.js)
|
|
@@ -629,7 +629,8 @@ let makeServedBucketDistribution = (
|
|
|
629
629
|
| None => None
|
|
630
630
|
| Some({fqdn}) => Some(Pulumi.Input.make([fqdn]))
|
|
631
631
|
},
|
|
632
|
-
origins: oac.id
|
|
632
|
+
origins: oac.id
|
|
633
|
+
->Pulumi.Output.apply(oacId =>
|
|
633
634
|
servedBuckets->Array.map(sb => {
|
|
634
635
|
PulumiAws.CloudFront.Distribution.domainName: sb.bucketRegionalDomainName,
|
|
635
636
|
originId: Pulumi.Input.make(originIdFor(sb.id)),
|
|
@@ -710,27 +711,27 @@ let makeServedBucketDistribution = (
|
|
|
710
711
|
~args={
|
|
711
712
|
bucket: sb.bucketId,
|
|
712
713
|
policy: (sb.bucketArn->Pulumi.Output.fromInput, distribution.arn)
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
},
|
|
714
|
+
->Pulumi.Output.all2
|
|
715
|
+
->Pulumi.Output.apply(((bucketArn, distributionArn)) =>
|
|
716
|
+
{
|
|
717
|
+
"Version": "2012-10-17",
|
|
718
|
+
"Statement": [
|
|
719
|
+
{
|
|
720
|
+
"Sid": "AllowCloudFrontServicePrincipal",
|
|
721
|
+
"Effect": "Allow",
|
|
722
|
+
"Principal": {"Service": "cloudfront.amazonaws.com"},
|
|
723
|
+
"Action": "s3:GetObject",
|
|
724
|
+
"Resource": bucketArn ++ "/*",
|
|
725
|
+
"Condition": {
|
|
726
|
+
"StringEquals": {"AWS:SourceArn": distributionArn},
|
|
727
727
|
},
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
728
|
+
},
|
|
729
|
+
],
|
|
730
|
+
}
|
|
731
|
+
->JSON.stringifyAny
|
|
732
|
+
->Option.getUnsafe
|
|
733
|
+
)
|
|
734
|
+
->Pulumi.Output.asInput,
|
|
734
735
|
},
|
|
735
736
|
)
|
|
736
737
|
})
|
|
@@ -30,7 +30,8 @@ type t = {
|
|
|
30
30
|
a slow deploy or a throttle cannot trip it, close enough that a stopped
|
|
31
31
|
scheduler is caught within the hour rather than by its consequences days
|
|
32
32
|
later. Deployments that set a long `heartbeatInterval` should raise it. */
|
|
33
|
-
let defaultSilenceWindowSeconds =
|
|
33
|
+
let defaultSilenceWindowSeconds =
|
|
34
|
+
60 * 60
|
|
34
35
|
|
|
35
36
|
let errorsAlarm = {
|
|
36
37
|
metricName: "Errors",
|
|
@@ -11,7 +11,10 @@ let toResource: Types.AppSync.resolver => ReventlessInfra.Adapter.resource = ({
|
|
|
11
11
|
~service=id->Pulumi.Output.apply(_ => AWS.AppSync.service),
|
|
12
12
|
~resourceInfo=(type_, field)
|
|
13
13
|
->Pulumi.Output.all2
|
|
14
|
-
->Pulumi.Output.apply(((type_, field)) => ReventlessInfra.Adapter.ApiResolver({
|
|
14
|
+
->Pulumi.Output.apply(((type_, field)) => ReventlessInfra.Adapter.ApiResolver({
|
|
15
|
+
typeName: type_,
|
|
16
|
+
fieldName: field,
|
|
17
|
+
})),
|
|
15
18
|
~resourceType="aws:appsync:Resolver"->Pulumi.Output.make,
|
|
16
19
|
)
|
|
17
20
|
|
|
@@ -31,6 +34,9 @@ let toResourceNative: PulumiAws.AwsNative.AppSync.Resolver.t => ReventlessInfra.
|
|
|
31
34
|
~service=id->Pulumi.Output.apply(_ => AWS.AppSync.service),
|
|
32
35
|
~resourceInfo=(typeName, fieldName)
|
|
33
36
|
->Pulumi.Output.all2
|
|
34
|
-
->Pulumi.Output.apply(((t, f)) => ReventlessInfra.Adapter.ApiResolver({
|
|
37
|
+
->Pulumi.Output.apply(((t, f)) => ReventlessInfra.Adapter.ApiResolver({
|
|
38
|
+
typeName: t,
|
|
39
|
+
fieldName: f,
|
|
40
|
+
})),
|
|
35
41
|
~resourceType="aws-native:appsync:Resolver"->Pulumi.Output.make,
|
|
36
42
|
)
|
|
@@ -21,7 +21,7 @@ type awsCredentials = {
|
|
|
21
21
|
// defaultProvider() returns a credential-provider function.
|
|
22
22
|
// It resolves credentials from env vars → SSO → ini files → IMDSv2.
|
|
23
23
|
@module("@aws-sdk/credential-provider-node")
|
|
24
|
-
external defaultProvider: unit =>
|
|
24
|
+
external defaultProvider: unit => unit => promise<awsCredentials> = "defaultProvider"
|
|
25
25
|
|
|
26
26
|
// ── SigV4 signer ──────────────────────────────────────────────────────────────
|
|
27
27
|
|
|
@@ -139,10 +139,12 @@ let buildQuery = (
|
|
|
139
139
|
|
|
140
140
|
// Signs and sends a GraphQL query; returns the `data` object or None on error.
|
|
141
141
|
// ~queryString must be a complete "query { field(...) { ... } }" string.
|
|
142
|
-
let sendQuery = async (~endpoint: string, ~region: string, ~queryString: string): option<
|
|
142
|
+
let sendQuery = async (~endpoint: string, ~region: string, ~queryString: string): option<
|
|
143
|
+
JSON.t,
|
|
144
|
+
> => {
|
|
143
145
|
let url = parseUrl(endpoint)
|
|
144
|
-
let hostname: string =
|
|
145
|
-
let path: string =
|
|
146
|
+
let hostname: string = url["hostname"]
|
|
147
|
+
let path: string = url["pathname"]
|
|
146
148
|
|
|
147
149
|
let body =
|
|
148
150
|
Dict.fromArray([("query", queryString->JSON.Encode.string)])
|
|
@@ -186,19 +188,18 @@ let sendMutation = async (
|
|
|
186
188
|
~variables: 'a,
|
|
187
189
|
) => {
|
|
188
190
|
let url = parseUrl(endpoint)
|
|
189
|
-
let hostname: string =
|
|
190
|
-
let path: string =
|
|
191
|
+
let hostname: string = url["hostname"]
|
|
192
|
+
let path: string = url["pathname"]
|
|
191
193
|
|
|
192
194
|
// Normalise variables to a JSON.t dict (strips undefined optional fields)
|
|
193
|
-
let variablesDict: dict<JSON.t> =
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
| _ => Dict.make()
|
|
199
|
-
}
|
|
200
|
-
| None => Dict.make()
|
|
195
|
+
let variablesDict: dict<JSON.t> = switch variables->JSON.stringifyAny {
|
|
196
|
+
| Some(str) =>
|
|
197
|
+
switch str->JSON.parseOrThrow {
|
|
198
|
+
| Object(d) => d
|
|
199
|
+
| _ => Dict.make()
|
|
201
200
|
}
|
|
201
|
+
| None => Dict.make()
|
|
202
|
+
}
|
|
202
203
|
|
|
203
204
|
let query = buildQuery(~mutation, ~selection, ~variablesDict)
|
|
204
205
|
let body =
|
package/src/util/Util_Bundle.res
CHANGED
|
@@ -92,8 +92,9 @@ let resolvePackageRoot = (~fromPulumiProject: bool=false, packageName: string):
|
|
|
92
92
|
let viaFramework = () => NodePath.dirname(localRequire->NodeModule.requireResolve(request))
|
|
93
93
|
let viaPulumiProject = () =>
|
|
94
94
|
NodePath.dirname(
|
|
95
|
-
NodeModule.createRequire(NodeProcess.cwd() ++ "/index.js")
|
|
96
|
-
|
|
95
|
+
NodeModule.createRequire(NodeProcess.cwd() ++ "/index.js")->NodeModule.requireResolve(
|
|
96
|
+
request,
|
|
97
|
+
),
|
|
97
98
|
)
|
|
98
99
|
let (preferred, fallback) = fromPulumiProject
|
|
99
100
|
? (viaPulumiProject, viaFramework)
|
|
@@ -204,7 +205,11 @@ let rec walkDir = (
|
|
|
204
205
|
let newPrefix = prefix == "" ? entryName : prefix ++ "/" ++ entryName
|
|
205
206
|
walkDir(~dir=NodePath.join([dir, entryName]), ~prefix=newPrefix, ~assets, ~paths)
|
|
206
207
|
}
|
|
207
|
-
} else if
|
|
208
|
+
} else if (
|
|
209
|
+
entryName == "package.json" ||
|
|
210
|
+
entryName->String.endsWith(".mjs") ||
|
|
211
|
+
entryName->String.endsWith(".js")
|
|
212
|
+
) {
|
|
208
213
|
let relPath = prefix == "" ? entryName : prefix ++ "/" ++ entryName
|
|
209
214
|
let absPath = NodePath.join([dir, entryName])
|
|
210
215
|
assets->Dict.set(
|
|
@@ -339,15 +344,12 @@ let isRuntimeProvided = (specifier: string, ~pkgName: string): bool =>
|
|
|
339
344
|
nodeBuiltins->Set.has(specifier) ||
|
|
340
345
|
nodeBuiltins->Set.has(pkgName) ||
|
|
341
346
|
pkgName->String.startsWith("@aws-sdk/") ||
|
|
342
|
-
pkgName->String.startsWith("@smithy/") ||
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
| _ => false
|
|
349
|
-
}
|
|
350
|
-
)
|
|
347
|
+
pkgName->String.startsWith("@smithy/") || try {
|
|
348
|
+
let _ = resolvePackageRoot(pkgName)
|
|
349
|
+
true
|
|
350
|
+
} catch {
|
|
351
|
+
| _ => false
|
|
352
|
+
}
|
|
351
353
|
|
|
352
354
|
/** The framework's own package root: this module ships inside reventless-aws, so
|
|
353
355
|
the nearest package.json walking up from it is reventless-aws's own. */
|
|
@@ -422,8 +424,9 @@ let resolvePackageRootFrom = (~fromRoot: string, pkgName: string): option<string
|
|
|
422
424
|
try {
|
|
423
425
|
Some(
|
|
424
426
|
NodePath.dirname(
|
|
425
|
-
NodeModule.createRequire(NodePath.join([fromRoot, "index.js"]))
|
|
426
|
-
|
|
427
|
+
NodeModule.createRequire(NodePath.join([fromRoot, "index.js"]))->NodeModule.requireResolve(
|
|
428
|
+
pkgName ++ "/package.json",
|
|
429
|
+
),
|
|
427
430
|
),
|
|
428
431
|
)
|
|
429
432
|
} catch {
|
|
@@ -569,15 +572,16 @@ let assertRuntimeExtensionImportsResolvable = (
|
|
|
569
572
|
if relPath->String.endsWith(".mjs") || relPath->String.endsWith(".js") {
|
|
570
573
|
NodeFs.readFileSync(absPath)
|
|
571
574
|
->staticImportSpecifiers
|
|
572
|
-
->Array.forEach(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
575
|
+
->Array.forEach(
|
|
576
|
+
specifier =>
|
|
577
|
+
if isBareSpecifier(specifier) {
|
|
578
|
+
let dep = extractPackageName(specifier)
|
|
579
|
+
if !(bundledPackages->Dict.has(dep)) && !isRuntimeProvided(specifier, ~pkgName=dep) {
|
|
580
|
+
JsError.throwWithMessage(
|
|
581
|
+
`runtime extension package "${pkgName}" imports "${specifier}" (${relPath}), which is neither bundled into the code archive nor provided in the deployed runtime. The extension would be skipped at every cold start with "could not be loaded". Declare the package in the extension's companionModuleUrls — the import.meta.url of one of its modules — so it rides into the archive alongside the extension.`,
|
|
582
|
+
)
|
|
583
|
+
}
|
|
584
|
+
},
|
|
581
585
|
)
|
|
582
586
|
}
|
|
583
587
|
)
|
|
@@ -627,15 +631,16 @@ let buildCodeArchive = (
|
|
|
627
631
|
)
|
|
628
632
|
})
|
|
629
633
|
// Co-bundle effect whenever reventless-aws is bundled (see comment above).
|
|
630
|
-
let allPackageDirs =
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
634
|
+
let allPackageDirs = if (
|
|
635
|
+
packageDirs->Dict.has("@reventlessdev/reventless-aws") && !(packageDirs->Dict.has("effect"))
|
|
636
|
+
) {
|
|
637
|
+
let dirs = packageDirs->Dict.copy
|
|
638
|
+
dirs->Dict.set("effect", resolvePackageRoot("effect"))
|
|
639
|
+
dirs
|
|
640
|
+
} else {
|
|
641
|
+
packageDirs
|
|
642
|
+
}
|
|
643
|
+
|
|
639
644
|
// Registered runtime extensions ride along (with their declared companion
|
|
640
645
|
// packages), so the entry shell can import them at cold start. No-op when
|
|
641
646
|
// nothing is registered — the archive, and therefore `sourceCodeHash`, is
|
|
@@ -671,15 +676,14 @@ let buildCodeArchive = (
|
|
|
671
676
|
})
|
|
672
677
|
let code = Pulumi.Archive.assetArchive(archiveContents)
|
|
673
678
|
packageContentHashes.contents->Array.sort(String.compare)
|
|
674
|
-
let sourceCodeHash =
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
)
|
|
679
|
+
let sourceCodeHash = hashString(
|
|
680
|
+
reExportCode ++
|
|
681
|
+
"\n---\n" ++
|
|
682
|
+
packageContentHashes.contents->Array.join(",") ++
|
|
683
|
+
"\n---\n" ++
|
|
684
|
+
extraHashEntries->Array.join("\n") ++
|
|
685
|
+
"\n---\n" ++
|
|
686
|
+
loaderHash,
|
|
687
|
+
)
|
|
684
688
|
{code, sourceCodeHash}
|
|
685
689
|
}
|
|
@@ -9,27 +9,26 @@ let addUserToGroup = (
|
|
|
9
9
|
~groupName: string,
|
|
10
10
|
~userPoolId: string,
|
|
11
11
|
) =>
|
|
12
|
-
Effect.tryPromise(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
client->AdminAddUserToGroupCommand.Raw.send(addUserToGroupCommand)
|
|
25
|
-
},
|
|
26
|
-
)
|
|
12
|
+
Effect.tryPromise(~catch=Cognito_Error.classify, () => {
|
|
13
|
+
open CognitoIdentityServiceProvider
|
|
14
|
+
let client: CognitoIdentityServiceProvider.client = Raw.client(
|
|
15
|
+
~options={endpoint: Util_Cognito_Runtime.userPoolEndpoint(region, userPoolId), region},
|
|
16
|
+
)
|
|
17
|
+
let addUserToGroupCommand: AdminAddUserToGroupCommand.t = {
|
|
18
|
+
username: userName,
|
|
19
|
+
groupName,
|
|
20
|
+
userPoolId,
|
|
21
|
+
}->AdminAddUserToGroupCommand.make
|
|
22
|
+
client->AdminAddUserToGroupCommand.Raw.send(addUserToGroupCommand)
|
|
23
|
+
})
|
|
27
24
|
->Effect.map(_ => ())
|
|
28
25
|
->Effect.retry(Cognito_Error.retrySchedule)
|
|
29
26
|
->Effect.catchAll(err => {
|
|
30
27
|
let msg = Cognito_Error.message(err)
|
|
31
|
-
ReventlessCore.EffectLogger.logError(
|
|
32
|
-
|
|
28
|
+
ReventlessCore.EffectLogger.logError(
|
|
29
|
+
~comp=__MODULE__,
|
|
30
|
+
`addUserToGroup: ${msg}`,
|
|
31
|
+
)->Effect.flatMap(_ => Effect.fail(msg))
|
|
33
32
|
})
|
|
34
33
|
->Effect.runPromise
|
|
35
34
|
|
|
@@ -40,26 +39,25 @@ let removeUserFromGroup = (
|
|
|
40
39
|
~groupName: string,
|
|
41
40
|
~userPoolId: string,
|
|
42
41
|
) =>
|
|
43
|
-
Effect.tryPromise(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
client->AdminRemoveUserFromGroupCommand.Raw.send(removeUserFromGroupCommand)
|
|
56
|
-
},
|
|
57
|
-
)
|
|
42
|
+
Effect.tryPromise(~catch=Cognito_Error.classify, () => {
|
|
43
|
+
open CognitoIdentityServiceProvider
|
|
44
|
+
let client: CognitoIdentityServiceProvider.client = Raw.client(
|
|
45
|
+
~options={endpoint: Util_Cognito_Runtime.userPoolEndpoint(region, userPoolId), region},
|
|
46
|
+
)
|
|
47
|
+
let removeUserFromGroupCommand = AdminRemoveUserFromGroupCommand.make({
|
|
48
|
+
username: userName,
|
|
49
|
+
groupName,
|
|
50
|
+
userPoolId,
|
|
51
|
+
})
|
|
52
|
+
client->AdminRemoveUserFromGroupCommand.Raw.send(removeUserFromGroupCommand)
|
|
53
|
+
})
|
|
58
54
|
->Effect.map(_ => ())
|
|
59
55
|
->Effect.retry(Cognito_Error.retrySchedule)
|
|
60
56
|
->Effect.catchAll(err => {
|
|
61
57
|
let msg = Cognito_Error.message(err)
|
|
62
|
-
ReventlessCore.EffectLogger.logError(
|
|
63
|
-
|
|
58
|
+
ReventlessCore.EffectLogger.logError(
|
|
59
|
+
~comp=__MODULE__,
|
|
60
|
+
`removeUserFromGroup: ${msg}`,
|
|
61
|
+
)->Effect.flatMap(_ => Effect.fail(msg))
|
|
64
62
|
})
|
|
65
63
|
->Effect.runPromise
|
|
@@ -33,20 +33,24 @@ let signUp = (
|
|
|
33
33
|
/** sign up a user to a given userPool, if the user is not already present
|
|
34
34
|
NOTE: should be called in runtime
|
|
35
35
|
*/
|
|
36
|
-
// Intentionally silent on failure: user may already exist (idempotent sign-up).
|
|
37
|
-
|
|
36
|
+
let // Intentionally silent on failure: user may already exist (idempotent sign-up).
|
|
37
|
+
signUpIfMissing = (
|
|
38
38
|
~region: string,
|
|
39
39
|
~userPoolId: string,
|
|
40
40
|
~userPoolClientId: string,
|
|
41
41
|
~userName: string,
|
|
42
42
|
~password: string,
|
|
43
43
|
) =>
|
|
44
|
-
Effect.tryPromise(
|
|
45
|
-
~
|
|
46
|
-
() => signUp(~region, ~userPoolId, ~userPoolClientId, ~userName, ~password),
|
|
44
|
+
Effect.tryPromise(~catch=Cognito_Error.classify, () =>
|
|
45
|
+
signUp(~region, ~userPoolId, ~userPoolClientId, ~userName, ~password)
|
|
47
46
|
)
|
|
48
47
|
->Effect.flatMap(result =>
|
|
49
|
-
ReventlessCore.EffectLogger.logInfo(
|
|
48
|
+
ReventlessCore.EffectLogger.logInfo(
|
|
49
|
+
~comp=__MODULE__,
|
|
50
|
+
`Created User ${userName} ${result.userSub->Option.getOr("")}`,
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
->Effect.catchAll(err =>
|
|
54
|
+
ReventlessCore.EffectLogger.logInfo(~comp=__MODULE__, Cognito_Error.message(err))
|
|
50
55
|
)
|
|
51
|
-
->Effect.catchAll(err => ReventlessCore.EffectLogger.logInfo(~comp=__MODULE__, Cognito_Error.message(err)))
|
|
52
56
|
->Effect.runPromise
|
|
@@ -158,7 +158,12 @@ let handler = Lambda.Function.make(
|
|
|
158
158
|
memorySize: 128->Pulumi.Input.make,
|
|
159
159
|
timeout: 30->Pulumi.Input.make,
|
|
160
160
|
layers,
|
|
161
|
-
tags: AWS.Tags.make(
|
|
161
|
+
tags: AWS.Tags.make(
|
|
162
|
+
~name,
|
|
163
|
+
~kind=ReventlessCore.ComponentType.Plugin,
|
|
164
|
+
~role=DeadLetter,
|
|
165
|
+
~scope=Plugin,
|
|
166
|
+
),
|
|
162
167
|
environment: (
|
|
163
168
|
{
|
|
164
169
|
Lambda.Function.variables: Dict.fromArray([
|
|
@@ -176,7 +181,12 @@ let handler = Lambda.Function.make(
|
|
|
176
181
|
// kind, mechanism-agnostic resource — no-op unless a backend is registered.
|
|
177
182
|
let deadLetterResource = Util_Lambda.functionToResource(
|
|
178
183
|
handler,
|
|
179
|
-
~tags=AWS.Tags.make(
|
|
184
|
+
~tags=AWS.Tags.make(
|
|
185
|
+
~name,
|
|
186
|
+
~kind=ReventlessCore.ComponentType.Plugin,
|
|
187
|
+
~role=DeadLetter,
|
|
188
|
+
~scope=Plugin,
|
|
189
|
+
)->Pulumi.Output.fromInput,
|
|
180
190
|
)
|
|
181
191
|
|
|
182
192
|
ReventlessCore.Monitoring.notify(
|