@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
|
@@ -25,7 +25,10 @@ let defaultIntendedUse = "SingleUse"
|
|
|
25
25
|
|
|
26
26
|
/** Create a place index with framework attribution tags and config-driven
|
|
27
27
|
provider/retention settings. */
|
|
28
|
-
let make = (
|
|
28
|
+
let make = (
|
|
29
|
+
~name: string,
|
|
30
|
+
~opts: option<Pulumi.CustomResourceOptions.t>=?,
|
|
31
|
+
): ReventlessInfra.Platform.geocoderIndex => {
|
|
29
32
|
let dataSource = Util_LocalConfig.get("geocoderDataSource")->Option.getOr(defaultDataSource)
|
|
30
33
|
let intendedUse = Util_LocalConfig.get("geocoderIntendedUse")->Option.getOr(defaultIntendedUse)
|
|
31
34
|
|
|
@@ -80,8 +80,7 @@ let parseEmailProvider = (raw: string): emailProvider =>
|
|
|
80
80
|
| other =>
|
|
81
81
|
JsError.throwWithMessage(
|
|
82
82
|
`platform:${emailProviderKey} is "${other}", which is not an email provider.\n` ++
|
|
83
|
-
` Known values: "ses" (default — a verified SES identity) and "log" ` ++
|
|
84
|
-
`(writes each message to the log, sends nothing).`,
|
|
83
|
+
` Known values: "ses" (default — a verified SES identity) and "log" ` ++ `(writes each message to the log, sends nothing).`,
|
|
85
84
|
)
|
|
86
85
|
}
|
|
87
86
|
|
|
@@ -121,11 +120,11 @@ let make = (
|
|
|
121
120
|
// Asked for SES and named no address. Nothing is provisioned, and the deploy
|
|
122
121
|
// gate refuses this the moment a plugin declares it needs messaging — here
|
|
123
122
|
// rather than there because this module has no view of what the plugins want.
|
|
124
|
-
| (Ses, None) => {emailProvider: providerInput,
|
|
123
|
+
| (Ses, None) => {emailProvider: providerInput, ?smsSender}
|
|
125
124
|
| (Ses, Some(address)) => {
|
|
126
125
|
emailSender: Capability_Messaging_Ses.emailSender(~name, ~address, ~displayName, ~opts?),
|
|
127
126
|
emailProvider: providerInput,
|
|
128
|
-
|
|
127
|
+
?smsSender,
|
|
129
128
|
}
|
|
130
129
|
| (Log, address) => {
|
|
131
130
|
emailSender: Pulumi.Input.make(
|
|
@@ -135,7 +134,7 @@ let make = (
|
|
|
135
134
|
),
|
|
136
135
|
),
|
|
137
136
|
emailProvider: providerInput,
|
|
138
|
-
|
|
137
|
+
?smsSender,
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
140
|
}
|
|
@@ -39,6 +39,8 @@ let emailSender = (
|
|
|
39
39
|
): Pulumi.Input.t<string> => {
|
|
40
40
|
let identity = SES.EmailIdentity.make(~name, ~args={email: address}, ~opts?)
|
|
41
41
|
identity.email
|
|
42
|
-
->Pulumi.Output.apply(verified =>
|
|
42
|
+
->Pulumi.Output.apply(verified =>
|
|
43
|
+
Reventless.Messaging.fromHeader(~displayName, ~address=verified)
|
|
44
|
+
)
|
|
43
45
|
->Pulumi.Output.asInput
|
|
44
46
|
}
|
|
@@ -138,13 +138,7 @@ let make = (
|
|
|
138
138
|
corsRules: corsRules->Pulumi.Input.make,
|
|
139
139
|
forceDestroy: forceDestroy->Pulumi.Input.make,
|
|
140
140
|
lifecycleRules: lifecycleRules->Pulumi.Input.make,
|
|
141
|
-
tags: AWS.Tags.make(
|
|
142
|
-
~name,
|
|
143
|
-
~kind,
|
|
144
|
-
~role=Other("ObjectStore"),
|
|
145
|
-
~scope,
|
|
146
|
-
~plugin?,
|
|
147
|
-
),
|
|
141
|
+
tags: AWS.Tags.make(~name, ~kind, ~role=Other("ObjectStore"), ~scope, ~plugin?),
|
|
148
142
|
},
|
|
149
143
|
~opts,
|
|
150
144
|
)
|
|
@@ -45,13 +45,11 @@ let startSchemaCreation = (client: appSyncClient, input: startSchemaCreationInpu
|
|
|
45
45
|
// jittered exponential backoff so a losing call can wait for the in-progress
|
|
46
46
|
// schema to finish and try again. Permanent errors (e.g. invalid SDL) are not
|
|
47
47
|
// retried — see AppSync_Error.classify.
|
|
48
|
-
let startSchemaCreationRetrying = (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
~catch=AppSync_Error.classify,
|
|
54
|
-
() => startSchemaCreation(client, input)->Promise.then(_ => Promise.resolve()),
|
|
48
|
+
let startSchemaCreationRetrying = (client: appSyncClient, input: startSchemaCreationInput): promise<
|
|
49
|
+
unit,
|
|
50
|
+
> => {
|
|
51
|
+
Effect.tryPromise(~catch=AppSync_Error.classify, () =>
|
|
52
|
+
startSchemaCreation(client, input)->Promise.then(_ => Promise.resolve())
|
|
55
53
|
)
|
|
56
54
|
->Effect.retry(AppSync_Error.retrySchedule)
|
|
57
55
|
->Effect.runPromise
|
|
@@ -67,13 +65,13 @@ external makeGetSchemaCreationStatusCommand: getSchemaCreationStatusInput => get
|
|
|
67
65
|
"GetSchemaCreationStatusCommand"
|
|
68
66
|
|
|
69
67
|
@send
|
|
70
|
-
external sendGetStatus: (
|
|
71
|
-
|
|
68
|
+
external sendGetStatus: (
|
|
69
|
+
appSyncClient,
|
|
70
|
+
getSchemaCreationStatusCommand,
|
|
71
|
+
) => promise<getSchemaCreationStatusResult> = "send"
|
|
72
72
|
|
|
73
73
|
let rec waitForSchemaActive = async (client, apiId, ~maxAttempts=30, ~attempt=0) => {
|
|
74
|
-
let result = await client->sendGetStatus(
|
|
75
|
-
{apiId: apiId}->makeGetSchemaCreationStatusCommand,
|
|
76
|
-
)
|
|
74
|
+
let result = await client->sendGetStatus({apiId: apiId}->makeGetSchemaCreationStatusCommand)
|
|
77
75
|
switch result.status {
|
|
78
76
|
| "ACTIVE" | "SUCCESS" => ()
|
|
79
77
|
| "FAILED" =>
|
|
@@ -185,14 +183,32 @@ let rec waitForMergeSuccess = async (
|
|
|
185
183
|
// When both are present on the same field, the spec-level permission wins
|
|
186
184
|
// (it is more specific). `AllowGroups([g1, g2, ...])` emits
|
|
187
185
|
// `@aws_cognito_user_pools(cognito_groups: ["g1", "g2", ...])`.
|
|
188
|
-
// `AllowAuthenticated`
|
|
189
|
-
//
|
|
190
|
-
// any reaching request is already authenticated), but stated rather than left
|
|
186
|
+
// `AllowAuthenticated` emits the group-less `@aws_cognito_user_pools` — the same
|
|
187
|
+
// reachability an undirectived field already has, but stated rather than left
|
|
191
188
|
// implicit, so `assertGateable` can tell "deliberately open" from "nobody
|
|
192
189
|
// stamped this". `AllowGroups([])` and `DenyAll` emit a sentinel `__deny_all__`
|
|
193
190
|
// group that no Cognito user can belong to — effectively blocking the field at
|
|
194
191
|
// the API layer.
|
|
195
192
|
//
|
|
193
|
+
// `AllowAnonymous` is REFUSED at deploy time, and this used to be the bug:
|
|
194
|
+
// it shared `AllowAuthenticated`'s arm and emitted the same group-less
|
|
195
|
+
// directive, which on a Cognito-primary API means *any authenticated caller* —
|
|
196
|
+
// the opposite of what the spec says. AppSync has no anonymous mode to emit
|
|
197
|
+
// instead (`authenticationType` is API_KEY | AWS_IAM | AMAZON_COGNITO_USER_POOLS
|
|
198
|
+
// | OPENID_CONNECT, and this adapter provisions Cognito primary with AWS_IAM
|
|
199
|
+
// additional), so there is no directive that means "no auth". The old behaviour
|
|
200
|
+
// deployed green, passed `assertGateable`, worked on the local platform — whose
|
|
201
|
+
// resolvers call `Authorization.isAllowed` and honour the rule — and refused
|
|
202
|
+
// anonymous callers only on AWS. It failed CLOSED, which is why nothing
|
|
203
|
+
// surfaced it.
|
|
204
|
+
//
|
|
205
|
+
// Refusing follows `Auth_LoginIdentifier`'s rule for an unrecognised spelling:
|
|
206
|
+
// a silent contradiction of the source is worse than a stopped deploy, because
|
|
207
|
+
// only one of the two is discoverable. AppSync mutations have no runtime
|
|
208
|
+
// authorization check to fall back on — the only `Authorization.isAllowed` call
|
|
209
|
+
// in this package is on the Postgres query path — so the directive is the whole
|
|
210
|
+
// enforcement, and a directive that cannot say this must not pretend to.
|
|
211
|
+
//
|
|
196
212
|
// NOT `@aws_auth(...)`: that is the single-mode form, which AppSync ignores on a
|
|
197
213
|
// multi-auth API — which every API this adapter provisions is. See
|
|
198
214
|
// `AppSync_SdlDecorate.formatCognitoGroupsDirective` for the full rationale and
|
|
@@ -211,62 +227,13 @@ let rec waitForMergeSuccess = async (
|
|
|
211
227
|
// and a least-privilege deploy-role policy — see
|
|
212
228
|
// `docs/guides/appsync-iam-system-caller.md`.
|
|
213
229
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
| AllowAuthenticated | AllowAnonymous => None
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Both directive forms are defined once in the runtime-pure AppSync_SdlDecorate
|
|
225
|
-
// so this deploy path and the bundled AdminEventCollector Lambda's reactive push
|
|
226
|
-
// cannot drift. The Cognito-only arm carries the rationale for why it is
|
|
227
|
-
// `@aws_cognito_user_pools(...)` and never `@aws_auth(...)`.
|
|
228
|
-
let _formatGroupsDirective = AppSync_SdlDecorate.formatCognitoGroupsDirective
|
|
229
|
-
|
|
230
|
-
// Multi-auth directive for a field that must accept BOTH Cognito and IAM.
|
|
231
|
-
// `groups=Some([...])` preserves Cognito group gating; `groups=None` keeps the
|
|
232
|
-
// field open to any authenticated Cognito user. `@aws_iam` admits the
|
|
233
|
-
// deploy-time SigV4 system caller. See the dual-auth note above.
|
|
234
|
-
let _formatDualAuthDirective = AppSync_SdlDecorate.formatDualAuthDirective
|
|
235
|
-
|
|
236
|
-
// ── Type-level dual-auth ─────────────────────────────────────────────────────
|
|
237
|
-
// On a multi-auth API, object TYPES without auth directives are accessible only
|
|
238
|
-
// via the default auth mode — a field-level `@aws_iam` admits the system caller
|
|
239
|
-
// to the top-level field, but response shaping then walks the return types
|
|
240
|
-
// (`…Connection` → `…Edge` → node type → nested state types) and dies with
|
|
241
|
-
// "Not Authorized to access <field> on type <T>" one level in. Types reachable
|
|
242
|
-
// from a systemCallable field therefore carry the bare multi-auth pair: the
|
|
243
|
-
// group-less Cognito arm matches the pre-existing accessibility of an
|
|
244
|
-
// undirectived type (any authenticated user; entry gating stays on the fields),
|
|
245
|
-
// the IAM arm admits the traversal. Only `type` declarations take auth
|
|
246
|
-
// directives (inputs/enums/interfaces do not).
|
|
247
|
-
|
|
248
|
-
// The declared name of a `type …` SDL declaration; None for input/enum/union/etc.
|
|
249
|
-
let _typeDeclName = (decl: string): option<string> =>
|
|
250
|
-
if decl->String.startsWith("type ") {
|
|
251
|
-
let rest = decl->String.slice(~start=5, ~end=decl->String.length)
|
|
252
|
-
let end = switch rest->String.search(%re("/[\s{]/")) {
|
|
253
|
-
| -1 => rest->String.length
|
|
254
|
-
| i => i
|
|
255
|
-
}
|
|
256
|
-
Some(rest->String.slice(~start=0, ~end))
|
|
257
|
-
} else {
|
|
258
|
-
None
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Insert the multi-auth pair into a type declaration header (before its `{`).
|
|
262
|
-
let _stampTypeDualAuth = (decl: string): string =>
|
|
263
|
-
switch decl->String.indexOfOpt("{") {
|
|
264
|
-
| Some(i) =>
|
|
265
|
-
decl->String.slice(~start=0, ~end=i) ++
|
|
266
|
-
"@aws_cognito_user_pools @aws_iam " ++
|
|
267
|
-
decl->String.slice(~start=i, ~end=decl->String.length)
|
|
268
|
-
| None => decl
|
|
269
|
-
}
|
|
230
|
+
// Everything this file needs to decide what a directive says — the two directive
|
|
231
|
+
// formats, the permission → gate mapping, the `AllowAnonymous` refusal, the type
|
|
232
|
+
// header stampers and `typeDeclNameOf` — lives in the runtime-pure
|
|
233
|
+
// AppSync_SdlDecorate, so this deploy path and the bundled AdminEventCollector
|
|
234
|
+
// Lambda's reactive push cannot drift. The Cognito-only arm carries the rationale
|
|
235
|
+
// for why it is `@aws_cognito_user_pools(...)` and never `@aws_auth(...)`.
|
|
236
|
+
// This file is left with resource creation, which is what it is for.
|
|
270
237
|
|
|
271
238
|
// Shared traversal types every callable surface reaches — `PageInfo` (relay
|
|
272
239
|
// connections, injected by the stitcher) and the `CommandResult` members
|
|
@@ -301,6 +268,10 @@ let injectAwsAuth = (
|
|
|
301
268
|
let iamQueryFieldPrefixes: array<string> = []
|
|
302
269
|
let iamTypePrefixes: array<string> = []
|
|
303
270
|
|
|
271
|
+
// Collected across both entry kinds and refused once, so a deploy reports
|
|
272
|
+
// every offending field rather than the first one found.
|
|
273
|
+
let anonymousFields: array<string> = []
|
|
274
|
+
|
|
304
275
|
let mutationAuthMap: Dict.t<array<string>> = Dict.make()
|
|
305
276
|
mutationEntries->Array.forEach(entry => {
|
|
306
277
|
if entry.systemCallable->Option.getOr(false) {
|
|
@@ -308,9 +279,7 @@ let injectAwsAuth = (
|
|
|
308
279
|
}
|
|
309
280
|
switch entry.authorization {
|
|
310
281
|
| Some({group}) =>
|
|
311
|
-
entry.fieldNames->Array.forEach(fieldName =>
|
|
312
|
-
mutationAuthMap->Dict.set(fieldName, [group])
|
|
313
|
-
)
|
|
282
|
+
entry.fieldNames->Array.forEach(fieldName => mutationAuthMap->Dict.set(fieldName, [group]))
|
|
314
283
|
| None => ()
|
|
315
284
|
}
|
|
316
285
|
switch entry.fieldPermissions {
|
|
@@ -318,9 +287,10 @@ let injectAwsAuth = (
|
|
|
318
287
|
fp
|
|
319
288
|
->Dict.toArray
|
|
320
289
|
->Array.forEach(((fieldName, permission)) => {
|
|
321
|
-
switch
|
|
322
|
-
|
|
|
323
|
-
|
|
|
290
|
+
switch AppSync_SdlDecorate.permissionToGate(permission) {
|
|
291
|
+
| Groups(groups) => mutationAuthMap->Dict.set(fieldName, groups)
|
|
292
|
+
| AnyAuthenticated => mutationAuthMap->Dict.delete(fieldName)
|
|
293
|
+
| Anonymous => anonymousFields->Array.push(fieldName)
|
|
324
294
|
}
|
|
325
295
|
})
|
|
326
296
|
| None => ()
|
|
@@ -346,18 +316,28 @@ let injectAwsAuth = (
|
|
|
346
316
|
}
|
|
347
317
|
switch entry.permission {
|
|
348
318
|
| Some(permission) =>
|
|
349
|
-
switch
|
|
350
|
-
|
|
|
319
|
+
switch AppSync_SdlDecorate.permissionToGate(permission) {
|
|
320
|
+
| Groups(groups) =>
|
|
351
321
|
queryAuthMap->Dict.set(entry.singleFieldName, groups)
|
|
352
322
|
queryAuthMap->Dict.set(entry.listFieldName, groups)
|
|
353
|
-
|
|
|
323
|
+
| AnyAuthenticated =>
|
|
354
324
|
queryAuthMap->Dict.delete(entry.singleFieldName)
|
|
355
325
|
queryAuthMap->Dict.delete(entry.listFieldName)
|
|
326
|
+
| Anonymous =>
|
|
327
|
+
// Both derived field names, because the spec declares one permission and
|
|
328
|
+
// the generator emits two fields from it; naming only one would send the
|
|
329
|
+
// author looking for a second declaration that does not exist.
|
|
330
|
+
anonymousFields->Array.push(entry.singleFieldName)
|
|
331
|
+
anonymousFields->Array.push(entry.listFieldName)
|
|
356
332
|
}
|
|
357
333
|
| None => ()
|
|
358
334
|
}
|
|
359
335
|
})
|
|
360
336
|
|
|
337
|
+
if anonymousFields->Array.length > 0 {
|
|
338
|
+
AppSync_SdlDecorate.refuseAnonymousFields(anonymousFields)
|
|
339
|
+
}
|
|
340
|
+
|
|
361
341
|
// A field with no group restriction gets the group-less Cognito directive
|
|
362
342
|
// rather than no directive at all. Same reachability under `defaultAction:
|
|
363
343
|
// ALLOW`; the difference only shows once the default is DENY, where an
|
|
@@ -368,10 +348,10 @@ let injectAwsAuth = (
|
|
|
368
348
|
let fieldName = ReventlessCore.GraphQL_Stitcher.extractLeadingName(field)
|
|
369
349
|
let groups = mutationAuthMap->Dict.get(fieldName)
|
|
370
350
|
if iamFields->Dict.get(fieldName)->Option.getOr(false) {
|
|
371
|
-
`${field}\n ${
|
|
351
|
+
`${field}\n ${AppSync_SdlDecorate.formatDualAuthDirective(groups)}`
|
|
372
352
|
} else {
|
|
373
353
|
switch groups {
|
|
374
|
-
| Some(groups) => `${field}\n ${
|
|
354
|
+
| Some(groups) => `${field}\n ${AppSync_SdlDecorate.formatCognitoGroupsDirective(groups)}`
|
|
375
355
|
| None => `${field}\n ${openDirective}`
|
|
376
356
|
}
|
|
377
357
|
}
|
|
@@ -384,10 +364,10 @@ let injectAwsAuth = (
|
|
|
384
364
|
iamFields->Dict.get(fieldName)->Option.getOr(false) ||
|
|
385
365
|
iamQueryFieldPrefixes->Array.some(p => fieldName->String.startsWith(p))
|
|
386
366
|
if isIam {
|
|
387
|
-
`${field} ${
|
|
367
|
+
`${field} ${AppSync_SdlDecorate.formatDualAuthDirective(groups)}`
|
|
388
368
|
} else {
|
|
389
369
|
switch groups {
|
|
390
|
-
| Some(groups) => `${field} ${
|
|
370
|
+
| Some(groups) => `${field} ${AppSync_SdlDecorate.formatCognitoGroupsDirective(groups)}`
|
|
391
371
|
| None => `${field} ${openDirective}`
|
|
392
372
|
}
|
|
393
373
|
}
|
|
@@ -400,7 +380,7 @@ let injectAwsAuth = (
|
|
|
400
380
|
let augmentedSubscriptions = parts.subscriptions->Array.map(field => {
|
|
401
381
|
let fieldName = ReventlessCore.GraphQL_Stitcher.extractLeadingName(field)
|
|
402
382
|
switch mutationAuthMap->Dict.get(fieldName) {
|
|
403
|
-
| Some(groups) => `${field}\n ${
|
|
383
|
+
| Some(groups) => `${field}\n ${AppSync_SdlDecorate.formatCognitoGroupsDirective(groups)}`
|
|
404
384
|
| None => `${field}\n ${openDirective}`
|
|
405
385
|
}
|
|
406
386
|
})
|
|
@@ -409,9 +389,9 @@ let injectAwsAuth = (
|
|
|
409
389
|
// the node type, its Connection/Edge wrappers, and nested state types all
|
|
410
390
|
// share the entry's returnTypeName prefix.
|
|
411
391
|
let augmentedTypes = parts.types->Array.map(decl =>
|
|
412
|
-
switch
|
|
392
|
+
switch AppSync_SdlDecorate.typeDeclNameOf(decl) {
|
|
413
393
|
| Some(name) if iamTypePrefixes->Array.some(p => name->String.startsWith(p)) =>
|
|
414
|
-
|
|
394
|
+
AppSync_SdlDecorate.stampTypeDualAuth(decl)
|
|
415
395
|
| _ => decl
|
|
416
396
|
}
|
|
417
397
|
)
|
|
@@ -507,8 +487,7 @@ let _makeApiResourceWith = (
|
|
|
507
487
|
let iamRole = IAM.Role.make(
|
|
508
488
|
~name=`${name}-appsync-role`,
|
|
509
489
|
~args={
|
|
510
|
-
assumeRolePolicy: `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"appsync.amazonaws.com"},"Action":"sts:AssumeRole"}]}
|
|
511
|
-
->Pulumi.Input.make,
|
|
490
|
+
assumeRolePolicy: `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"appsync.amazonaws.com"},"Action":"sts:AssumeRole"}]}`->Pulumi.Input.make,
|
|
512
491
|
tags: AWS.Tags.make(
|
|
513
492
|
~name=`${name}-appsync-role`,
|
|
514
493
|
~kind=ReventlessCore.ComponentType.Platform,
|
|
@@ -562,15 +541,13 @@ let _makeApiResourceWith = (
|
|
|
562
541
|
let userPoolConfigOut = switch userPoolConfig {
|
|
563
542
|
| Some(config) => config
|
|
564
543
|
| None =>
|
|
565
|
-
Auth_Cognito.make(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
)
|
|
573
|
-
)
|
|
544
|
+
Auth_Cognito.make(
|
|
545
|
+
~name=`${name}-auth`,
|
|
546
|
+
)->Pulumi.Output.apply((c: Auth_Cognito.authConfig): AppSync.GraphQLApi.userPoolConfig => {
|
|
547
|
+
userPoolId: c.userPoolId,
|
|
548
|
+
awsRegion: c.region,
|
|
549
|
+
defaultAction: AppSync.GraphQLApi.ALLOW,
|
|
550
|
+
})
|
|
574
551
|
}
|
|
575
552
|
|
|
576
553
|
// Cognito as primary auth, AWS_IAM as additional provider for
|
|
@@ -588,12 +565,7 @@ let _makeApiResourceWith = (
|
|
|
588
565
|
]->Pulumi.Input.make,
|
|
589
566
|
schema: ?(schema->Option.map(Pulumi.Input.make)),
|
|
590
567
|
logConfig: appsyncLogConfig->Pulumi.Input.make,
|
|
591
|
-
tags: AWS.Tags.make(
|
|
592
|
-
~name,
|
|
593
|
-
~kind=ReventlessCore.ComponentType.Plugin,
|
|
594
|
-
~role=Api,
|
|
595
|
-
~scope=Plugin,
|
|
596
|
-
),
|
|
568
|
+
tags: AWS.Tags.make(~name, ~kind=ReventlessCore.ComponentType.Plugin, ~role=Api, ~scope=Plugin),
|
|
597
569
|
}
|
|
598
570
|
let graphQLApi = AppSync.GraphQLApi.make(~name, ~args=apiArgs, ~opts=Some(customOpts))
|
|
599
571
|
|
|
@@ -640,11 +612,10 @@ let _makeApiResourceWith = (
|
|
|
640
612
|
(graphQLApi->Pulumi.Output.make, iamRole->Pulumi.Output.make)
|
|
641
613
|
}
|
|
642
614
|
|
|
643
|
-
let makeApiResource = (
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
)
|
|
647
|
-
_makeApiResourceWith(~name, ~schema=None, ~userPoolConfig=None, ~opts)
|
|
615
|
+
let makeApiResource = (~name: string, ~opts: Pulumi.ComponentResource.options): (
|
|
616
|
+
Pulumi.Output.t<api>,
|
|
617
|
+
Pulumi.Output.t<role>,
|
|
618
|
+
) => _makeApiResourceWith(~name, ~schema=None, ~userPoolConfig=None, ~opts)
|
|
648
619
|
|
|
649
620
|
// Merged-mode source API: same auth shape as makeApiResource but with a
|
|
650
621
|
// DECLARATIVE inline schema — the provider runs StartSchemaCreation + poll
|
|
@@ -6,7 +6,6 @@ import * as Aws from "@pulumi/aws";
|
|
|
6
6
|
import * as Stdlib_Dict from "@rescript/runtime/lib/es6/Stdlib_Dict.js";
|
|
7
7
|
import * as Nodecrypto from "node:crypto";
|
|
8
8
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
9
|
-
import * as Stdlib_String from "@rescript/runtime/lib/es6/Stdlib_String.js";
|
|
10
9
|
import * as Effect$1 from "effect/Effect";
|
|
11
10
|
import * as Pulumi from "@pulumi/pulumi";
|
|
12
11
|
import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
|
|
@@ -107,49 +106,12 @@ async function waitForMergeSuccess(client, associationId, mergedApiIdentifier, m
|
|
|
107
106
|
return Stdlib_JsError.throwWithMessage(`Source API association ` + associationId + ` on ` + mergedApiIdentifier + ` failed to merge (` + status + `): ` + detail);
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
function _permissionToCognitoGroups(permission) {
|
|
111
|
-
if (typeof permission !== "object") {
|
|
112
|
-
switch (permission) {
|
|
113
|
-
case "AllowAuthenticated" :
|
|
114
|
-
case "AllowAnonymous" :
|
|
115
|
-
return;
|
|
116
|
-
case "DenyAll" :
|
|
117
|
-
return ["__deny_all__"];
|
|
118
|
-
}
|
|
119
|
-
} else {
|
|
120
|
-
let groups = permission._0;
|
|
121
|
-
if (groups.length !== 0) {
|
|
122
|
-
return groups;
|
|
123
|
-
} else {
|
|
124
|
-
return ["__deny_all__"];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function _typeDeclName(decl) {
|
|
130
|
-
if (!decl.startsWith("type ")) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
let rest = decl.slice(5, decl.length);
|
|
134
|
-
let i = rest.search(/[\s{]/);
|
|
135
|
-
let end = i !== -1 ? i : rest.length;
|
|
136
|
-
return rest.slice(0, end);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function _stampTypeDualAuth(decl) {
|
|
140
|
-
let i = Stdlib_String.indexOfOpt(decl, "{");
|
|
141
|
-
if (i !== undefined) {
|
|
142
|
-
return decl.slice(0, i) + "@aws_cognito_user_pools @aws_iam " + decl.slice(i, decl.length);
|
|
143
|
-
} else {
|
|
144
|
-
return decl;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
109
|
function injectAwsAuth(fragment, mutationEntries, queryEntries) {
|
|
149
110
|
let parts = GraphQL_Stitcher$ReventlessCore.decode(fragment);
|
|
150
111
|
let iamFields = {};
|
|
151
112
|
let iamQueryFieldPrefixes = [];
|
|
152
113
|
let iamTypePrefixes = [];
|
|
114
|
+
let anonymousFields = [];
|
|
153
115
|
let mutationAuthMap = {};
|
|
154
116
|
mutationEntries.forEach(entry => {
|
|
155
117
|
if (Stdlib_Option.getOr(entry.systemCallable, false)) {
|
|
@@ -168,12 +130,16 @@ function injectAwsAuth(fragment, mutationEntries, queryEntries) {
|
|
|
168
130
|
if (fp !== undefined) {
|
|
169
131
|
Object.entries(fp).forEach(param => {
|
|
170
132
|
let fieldName = param[0];
|
|
171
|
-
let groups =
|
|
172
|
-
if (groups !==
|
|
173
|
-
|
|
133
|
+
let groups = AppSync_SdlDecorate$ReventlessAws.permissionToGate(param[1]);
|
|
134
|
+
if (typeof groups !== "object") {
|
|
135
|
+
if (groups === "AnyAuthenticated") {
|
|
136
|
+
return Stdlib_Dict.$$delete(mutationAuthMap, fieldName);
|
|
137
|
+
}
|
|
138
|
+
anonymousFields.push(fieldName);
|
|
174
139
|
return;
|
|
175
140
|
} else {
|
|
176
|
-
|
|
141
|
+
mutationAuthMap[fieldName] = groups._0;
|
|
142
|
+
return;
|
|
177
143
|
}
|
|
178
144
|
});
|
|
179
145
|
return;
|
|
@@ -198,16 +164,25 @@ function injectAwsAuth(fragment, mutationEntries, queryEntries) {
|
|
|
198
164
|
if (permission === undefined) {
|
|
199
165
|
return;
|
|
200
166
|
}
|
|
201
|
-
let groups =
|
|
202
|
-
if (groups !==
|
|
203
|
-
|
|
204
|
-
|
|
167
|
+
let groups = AppSync_SdlDecorate$ReventlessAws.permissionToGate(permission);
|
|
168
|
+
if (typeof groups !== "object") {
|
|
169
|
+
if (groups === "AnyAuthenticated") {
|
|
170
|
+
Stdlib_Dict.$$delete(queryAuthMap, entry.singleFieldName);
|
|
171
|
+
return Stdlib_Dict.$$delete(queryAuthMap, entry.listFieldName);
|
|
172
|
+
}
|
|
173
|
+
anonymousFields.push(entry.singleFieldName);
|
|
174
|
+
anonymousFields.push(entry.listFieldName);
|
|
205
175
|
return;
|
|
206
176
|
} else {
|
|
207
|
-
|
|
208
|
-
|
|
177
|
+
let groups$1 = groups._0;
|
|
178
|
+
queryAuthMap[entry.singleFieldName] = groups$1;
|
|
179
|
+
queryAuthMap[entry.listFieldName] = groups$1;
|
|
180
|
+
return;
|
|
209
181
|
}
|
|
210
182
|
});
|
|
183
|
+
if (anonymousFields.length !== 0) {
|
|
184
|
+
AppSync_SdlDecorate$ReventlessAws.refuseAnonymousFields(anonymousFields);
|
|
185
|
+
}
|
|
211
186
|
let augmentedMutations = parts.mutations.map(field => {
|
|
212
187
|
let fieldName = GraphQL_Stitcher$ReventlessCore.extractLeadingName(field);
|
|
213
188
|
let groups = mutationAuthMap[fieldName];
|
|
@@ -241,9 +216,9 @@ function injectAwsAuth(fragment, mutationEntries, queryEntries) {
|
|
|
241
216
|
}
|
|
242
217
|
});
|
|
243
218
|
let augmentedTypes = parts.types.map(decl => {
|
|
244
|
-
let name =
|
|
219
|
+
let name = AppSync_SdlDecorate$ReventlessAws.typeDeclNameOf(decl);
|
|
245
220
|
if (name !== undefined && iamTypePrefixes.some(p => name.startsWith(p))) {
|
|
246
|
-
return
|
|
221
|
+
return AppSync_SdlDecorate$ReventlessAws.stampTypeDualAuth(decl);
|
|
247
222
|
} else {
|
|
248
223
|
return decl;
|
|
249
224
|
}
|
|
@@ -340,10 +315,6 @@ function generateFragment(mutationEntries, queryEntries) {
|
|
|
340
315
|
return injectAwsAuth(fragment, mutationEntries, queryEntries);
|
|
341
316
|
}
|
|
342
317
|
|
|
343
|
-
let _formatGroupsDirective = AppSync_SdlDecorate$ReventlessAws.formatCognitoGroupsDirective;
|
|
344
|
-
|
|
345
|
-
let _formatDualAuthDirective = AppSync_SdlDecorate$ReventlessAws.formatDualAuthDirective;
|
|
346
|
-
|
|
347
318
|
let stampSharedIamTypes = AppSync_SdlDecorate$ReventlessAws.stampSharedIamTypes;
|
|
348
319
|
|
|
349
320
|
let primaryAuthenticationType = "AMAZON_COGNITO_USER_POOLS";
|
|
@@ -357,11 +328,6 @@ export {
|
|
|
357
328
|
_client,
|
|
358
329
|
getClient,
|
|
359
330
|
waitForMergeSuccess,
|
|
360
|
-
_permissionToCognitoGroups,
|
|
361
|
-
_formatGroupsDirective,
|
|
362
|
-
_formatDualAuthDirective,
|
|
363
|
-
_typeDeclName,
|
|
364
|
-
_stampTypeDualAuth,
|
|
365
331
|
stampSharedIamTypes,
|
|
366
332
|
injectAwsAuth,
|
|
367
333
|
injectAwsAuthAll,
|