@aws-amplify/graphql-api-construct 1.4.1 → 1.4.3

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.
Files changed (152) hide show
  1. package/.jsii +384 -253
  2. package/API.md +16 -4
  3. package/CHANGELOG.md +12 -0
  4. package/lib/amplify-dynamodb-table-wrapper.js +1 -1
  5. package/lib/amplify-graphql-api.d.ts +1 -1
  6. package/lib/amplify-graphql-api.js +16 -5
  7. package/lib/amplify-graphql-definition.d.ts +4 -3
  8. package/lib/amplify-graphql-definition.js +8 -16
  9. package/lib/index.d.ts +3 -1
  10. package/lib/index.js +19 -2
  11. package/lib/internal/data-source-config.d.ts +21 -2
  12. package/lib/internal/data-source-config.js +72 -33
  13. package/lib/internal/model-type-name.d.ts +2 -2
  14. package/lib/internal/model-type-name.js +4 -4
  15. package/lib/model-datasource-strategy.d.ts +116 -0
  16. package/lib/model-datasource-strategy.js +10 -0
  17. package/lib/sql-model-datasource-strategy.d.ts +1 -1
  18. package/lib/sql-model-datasource-strategy.js +5 -1
  19. package/lib/types.d.ts +16 -124
  20. package/lib/types.js +1 -1
  21. package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +8 -0
  22. package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +10 -10
  23. package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +8 -0
  24. package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +7 -7
  25. package/node_modules/@aws-amplify/graphql-function-transformer/CHANGELOG.md +8 -0
  26. package/node_modules/@aws-amplify/graphql-function-transformer/package.json +6 -6
  27. package/node_modules/@aws-amplify/graphql-http-transformer/CHANGELOG.md +8 -0
  28. package/node_modules/@aws-amplify/graphql-http-transformer/package.json +6 -6
  29. package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +8 -0
  30. package/node_modules/@aws-amplify/graphql-index-transformer/package.json +7 -7
  31. package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +8 -0
  32. package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
  33. package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +10 -10
  34. package/node_modules/@aws-amplify/graphql-model-transformer/API.md +16 -0
  35. package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +12 -0
  36. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.d.ts +1 -0
  37. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.d.ts.map +1 -1
  38. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.js +3 -1
  39. package/node_modules/@aws-amplify/graphql-model-transformer/lib/index.js.map +1 -1
  40. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
  41. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
  42. package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
  43. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts +4 -2
  44. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.d.ts.map +1 -1
  45. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js +30 -86
  46. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resolvers/rds/resolver.js.map +1 -1
  47. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts +2 -3
  48. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.d.ts.map +1 -1
  49. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js +36 -18
  50. package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/rds-model-resource-generator.js.map +1 -1
  51. package/node_modules/@aws-amplify/graphql-model-transformer/package.json +6 -6
  52. package/node_modules/@aws-amplify/graphql-predictions-transformer/CHANGELOG.md +8 -0
  53. package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
  54. package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +6 -6
  55. package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +10 -0
  56. package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +8 -8
  57. package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +8 -0
  58. package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
  59. package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +7 -7
  60. package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +10 -0
  61. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.d.ts.map +1 -1
  62. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js +15 -1
  63. package/node_modules/@aws-amplify/graphql-sql-transformer/lib/graphql-sql-transformer.js.map +1 -1
  64. package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +7 -7
  65. package/node_modules/@aws-amplify/graphql-transformer/API.md +3 -1
  66. package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +10 -0
  67. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts +2 -1
  68. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.d.ts.map +1 -1
  69. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js +2 -1
  70. package/node_modules/@aws-amplify/graphql-transformer/lib/graphql-transformer.js.map +1 -1
  71. package/node_modules/@aws-amplify/graphql-transformer/package.json +15 -15
  72. package/node_modules/@aws-amplify/graphql-transformer/src/graphql-transformer.ts +4 -1
  73. package/node_modules/@aws-amplify/graphql-transformer-core/API.md +35 -5
  74. package/node_modules/@aws-amplify/graphql-transformer-core/CHANGELOG.md +12 -0
  75. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts +1 -1
  76. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.d.ts.map +1 -1
  77. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js +19 -13
  78. package/node_modules/@aws-amplify/graphql-transformer-core/lib/index.js.map +1 -1
  79. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.d.ts.map +1 -1
  80. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js +20 -2
  81. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/transform.js.map +1 -1
  82. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts +2 -1
  83. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformation/types.d.ts.map +1 -1
  84. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts +24 -6
  85. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.d.ts.map +1 -1
  86. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.js +16 -14
  87. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/index.js.map +1 -1
  88. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/stack-manager.d.ts.map +1 -1
  89. package/node_modules/@aws-amplify/graphql-transformer-core/lib/transformer-context/stack-manager.js.map +1 -1
  90. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.d.ts +14 -0
  91. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.d.ts.map +1 -0
  92. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.js +23 -0
  93. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/graphql-utils.js.map +1 -0
  94. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts +2 -0
  95. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.d.ts.map +1 -1
  96. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js +16 -0
  97. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/index.js.map +1 -1
  98. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.d.ts +11 -0
  99. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.d.ts.map +1 -0
  100. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.js +84 -0
  101. package/node_modules/@aws-amplify/graphql-transformer-core/lib/utils/model-datasource-strategy-utils.js.map +1 -0
  102. package/node_modules/@aws-amplify/graphql-transformer-core/package.json +4 -4
  103. package/node_modules/@aws-amplify/graphql-transformer-interfaces/API.md +89 -5
  104. package/node_modules/@aws-amplify/graphql-transformer-interfaces/CHANGELOG.md +6 -0
  105. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts +0 -17
  106. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.d.ts.map +1 -1
  107. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/graphql-api-provider.js.map +1 -1
  108. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts +2 -1
  109. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.d.ts.map +1 -1
  110. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.js +1 -0
  111. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/index.js.map +1 -1
  112. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.d.ts +2 -0
  113. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.d.ts.map +1 -0
  114. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.js +18 -0
  115. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/index.js.map +1 -0
  116. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts +55 -0
  117. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.d.ts.map +1 -0
  118. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js +3 -0
  119. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/model-datasource/types.js.map +1 -0
  120. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transform-host-provider.d.ts +2 -1
  121. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transform-host-provider.d.ts.map +1 -1
  122. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts +1 -1
  123. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/index.d.ts.map +1 -1
  124. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts +6 -4
  125. package/node_modules/@aws-amplify/graphql-transformer-interfaces/lib/transformer-context/transformer-context-provider.d.ts.map +1 -1
  126. package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +3 -2
  127. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/graphql-api-provider.ts +1 -41
  128. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/index.ts +1 -4
  129. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/model-datasource/index.ts +1 -0
  130. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/model-datasource/types.ts +163 -0
  131. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transform-host-provider.ts +1 -1
  132. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/index.ts +4 -3
  133. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-provider.ts +6 -7
  134. package/node_modules/@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-datasource-provider.ts +2 -2
  135. package/node_modules/@aws-amplify/graphql-transformer-interfaces/tsconfig.tsbuildinfo +1 -1
  136. package/node_modules/graphql-transformer-common/API.md +11 -4
  137. package/node_modules/graphql-transformer-common/CHANGELOG.md +6 -0
  138. package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts +11 -4
  139. package/node_modules/graphql-transformer-common/lib/ResourceConstants.d.ts.map +1 -1
  140. package/node_modules/graphql-transformer-common/lib/ResourceConstants.js +11 -4
  141. package/node_modules/graphql-transformer-common/lib/ResourceConstants.js.map +1 -1
  142. package/node_modules/graphql-transformer-common/package.json +2 -3
  143. package/package.json +17 -17
  144. package/src/amplify-graphql-api.ts +20 -5
  145. package/src/amplify-graphql-definition.ts +8 -15
  146. package/src/index.ts +3 -11
  147. package/src/internal/data-source-config.ts +89 -35
  148. package/src/internal/model-type-name.ts +3 -3
  149. package/src/model-datasource-strategy.ts +149 -0
  150. package/src/sql-model-datasource-strategy.ts +1 -1
  151. package/src/types.ts +17 -151
  152. /package/node_modules/{graphql-transformer-common → @aws-amplify/graphql-transformer-interfaces}/LICENSE +0 -0
@@ -0,0 +1,149 @@
1
+ // #########################################################################################################################################
2
+ // These are the public-facing types used by customers to define their L3 CDK construct. Many of these have corresponding definitions in the
3
+ // transformer-interfaces package to define internal behavior.
4
+ //
5
+ // If you change types in this file (the customer-facing interface), be sure to make corresponding changes to
6
+ // amplify-graphql-transformer-interfaces/src/model-datasource (the internal implementation)
7
+ // #########################################################################################################################################
8
+
9
+ /**
10
+ * All known ModelDataSourceStrategies. Concrete strategies vary widely in their requirements and implementations.
11
+ * @experimental
12
+ */
13
+ export type ModelDataSourceStrategy =
14
+ | DefaultDynamoDbModelDataSourceStrategy
15
+ | AmplifyDynamoDbModelDataSourceStrategy
16
+ | SQLLambdaModelDataSourceStrategy;
17
+
18
+ // TODO: Make this the source of truth for database type definitions used throughout the construct & transformer
19
+ export type ModelDataSourceStrategyDbType = 'DYNAMODB';
20
+
21
+ /**
22
+ * Use default CloudFormation type 'AWS::DynamoDB::Table' to provision table.
23
+ * @experimental
24
+ */
25
+ export interface DefaultDynamoDbModelDataSourceStrategy {
26
+ readonly dbType: 'DYNAMODB';
27
+ readonly provisionStrategy: 'DEFAULT';
28
+ }
29
+
30
+ /**
31
+ * Use custom resource type 'Custom::AmplifyDynamoDBTable' to provision table.
32
+ * @experimental
33
+ */
34
+ export interface AmplifyDynamoDbModelDataSourceStrategy {
35
+ readonly dbType: 'DYNAMODB';
36
+ readonly provisionStrategy: 'AMPLIFY_TABLE';
37
+ }
38
+
39
+ /**
40
+ * A strategy that creates a Lambda to connect to a pre-existing SQL table to resolve model data.
41
+ *
42
+ * @experimental
43
+ */
44
+ export interface SQLLambdaModelDataSourceStrategy {
45
+ /**
46
+ * The name of the strategy. This will be used to name the AppSync DataSource itself, plus any associated resources like resolver Lambdas.
47
+ * This name must be unique across all schema definitions in a GraphQL API.
48
+ */
49
+ readonly name: string;
50
+
51
+ /**
52
+ * The type of the SQL database used to process model operations for this definition.
53
+ */
54
+ readonly dbType: 'MYSQL' | 'POSTGRES';
55
+
56
+ /**
57
+ * The parameters the Lambda data source will use to connect to the database.
58
+ */
59
+ readonly dbConnectionConfig: SqlModelDataSourceDbConnectionConfig;
60
+
61
+ /**
62
+ * The configuration of the VPC into which to install the Lambda.
63
+ */
64
+ readonly vpcConfiguration?: VpcConfig;
65
+
66
+ /**
67
+ * Custom SQL statements. The key is the value of the `references` attribute of the `@sql` directive in the `schema`; the value is the SQL
68
+ * to be executed.
69
+ */
70
+ readonly customSqlStatements?: Record<string, string>;
71
+
72
+ /**
73
+ * The configuration for the provisioned concurrency of the Lambda.
74
+ */
75
+ readonly sqlLambdaProvisionedConcurrencyConfig?: ProvisionedConcurrencyConfig;
76
+ }
77
+
78
+ /**
79
+ * Configuration of the VPC in which to install a Lambda to resolve queries against a SQL-based data source. The SQL Lambda will be deployed
80
+ * into the specified VPC, subnets, and security groups. The specified subnets and security groups must be in the same VPC. The VPC must
81
+ * have at least one subnet. The construct will also create VPC service endpoints in the specified subnets, as well as inbound security
82
+ * rules, to allow traffic on port 443 within each security group. This allows the Lambda to read database connection information from
83
+ * Secure Systems Manager.
84
+ * @experimental
85
+ */
86
+ export interface VpcConfig {
87
+ /** The VPC to install the Lambda data source in. */
88
+ readonly vpcId: string;
89
+
90
+ /** The security groups to install the Lambda data source in. */
91
+ readonly securityGroupIds: string[];
92
+
93
+ /** The subnets to install the Lambda data source in, one per availability zone. */
94
+ readonly subnetAvailabilityZoneConfig: SubnetAvailabilityZone[];
95
+ }
96
+
97
+ /**
98
+ * The configuration for the provisioned concurrency of the Lambda.
99
+ * @experimental
100
+ */
101
+ export interface ProvisionedConcurrencyConfig {
102
+ /** The amount of provisioned concurrency to allocate. **/
103
+ readonly provisionedConcurrentExecutions: number;
104
+ }
105
+
106
+ /**
107
+ * Subnet configuration for VPC endpoints used by a Lambda resolver for a SQL-based data source. Although it is possible to create multiple
108
+ * subnets in a single availability zone, VPC service endpoints may only be deployed to a single subnet in a given availability zone. This
109
+ * structure ensures that the Lambda function and VPC service endpoints are mutually consistent.
110
+ * @experimental
111
+ */
112
+ export interface SubnetAvailabilityZone {
113
+ /** The subnet ID to install the Lambda data source in. */
114
+ readonly subnetId: string;
115
+
116
+ /** The availability zone of the subnet. */
117
+ readonly availabilityZone: string;
118
+ }
119
+
120
+ /**
121
+ * The Secure Systems Manager parameter paths the Lambda data source will use to connect to the database.
122
+ *
123
+ * These parameters are retrieved from Secure Systems Manager in the same region as the Lambda.
124
+ * @experimental
125
+ */
126
+ export interface SqlModelDataSourceDbConnectionConfig {
127
+ /** The Secure Systems Manager parameter containing the hostname of the database. For RDS-based SQL data sources, this can be the hostname
128
+ * of a database proxy, cluster, or instance.
129
+ */
130
+ readonly hostnameSsmPath: string;
131
+
132
+ /** The Secure Systems Manager parameter containing the port number of the database proxy, cluster, or instance. */
133
+ readonly portSsmPath: string;
134
+
135
+ /** The Secure Systems Manager parameter containing the username to use when connecting to the database. */
136
+ readonly usernameSsmPath: string;
137
+
138
+ /** The Secure Systems Manager parameter containing the password to use when connecting to the database. */
139
+ readonly passwordSsmPath: string;
140
+
141
+ /** The Secure Systems Manager parameter containing the database name. */
142
+ readonly databaseNameSsmPath: string;
143
+ }
144
+
145
+ export interface CustomSqlDataSourceStrategy {
146
+ readonly typeName: 'Query' | 'Mutation';
147
+ readonly fieldName: string;
148
+ readonly strategy: SQLLambdaModelDataSourceStrategy;
149
+ }
@@ -1,6 +1,6 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
- import { SQLLambdaModelDataSourceStrategy, SqlModelDataSourceDbConnectionConfig } from './types';
3
+ import { SQLLambdaModelDataSourceStrategy, SqlModelDataSourceDbConnectionConfig } from './model-datasource-strategy';
4
4
 
5
5
  /**
6
6
  * Type predicate that returns true if the object is a SQLLambdaModelDataSourceStrategy.
package/src/types.ts CHANGED
@@ -18,6 +18,7 @@ import { IUserPool } from 'aws-cdk-lib/aws-cognito';
18
18
  import { IFunction, CfnFunction } from 'aws-cdk-lib/aws-lambda';
19
19
  import { IBucket } from 'aws-cdk-lib/aws-s3';
20
20
  import { AmplifyDynamoDbTableWrapper } from './amplify-dynamodb-table-wrapper';
21
+ import { CustomSqlDataSourceStrategy, ModelDataSourceStrategy } from './model-datasource-strategy';
21
22
 
22
23
  /**
23
24
  * Configuration for IAM Authorization on the Graphql Api.
@@ -425,8 +426,9 @@ export interface TranslationBehavior {
425
426
 
426
427
  /**
427
428
  * This behavior will only come into effect when both "allowDestructiveGraphqlSchemaUpdates" and this value are set to true
428
- * When enabled, any GSI update operation will replace the table instead of iterative deployment, which will WIPE ALL EXISTING DATA but cost much less time for deployment
429
- * This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
429
+ *
430
+ * When enabled, any GSI update operation will replace the table instead of iterative deployment, which will WIPE ALL EXISTING DATA but
431
+ * cost much less time for deployment This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
430
432
  * @default false
431
433
  * @experimental
432
434
  */
@@ -526,8 +528,9 @@ export interface PartialTranslationBehavior {
526
528
 
527
529
  /**
528
530
  * This behavior will only come into effect when both "allowDestructiveGraphqlSchemaUpdates" and this value are set to true
529
- * When enabled, any global secondary index update operation will replace the table instead of iterative deployment, which will WIPE ALL EXISTING DATA but cost much less time for deployment
530
- * This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
531
+ *
532
+ * When enabled, any global secondary index update operation will replace the table instead of iterative deployment, which will WIPE ALL
533
+ * EXISTING DATA but cost much less time for deployment This will only affect DynamoDB tables with provision strategy "AMPLIFY_TABLE".
531
534
  * @default false
532
535
  * @experimental
533
536
  */
@@ -567,6 +570,16 @@ export interface IAmplifyGraphqlDefinition {
567
570
  * @returns datasource strategy mapping
568
571
  */
569
572
  readonly dataSourceStrategies: Record<string, ModelDataSourceStrategy>;
573
+
574
+ /**
575
+ * An array of custom Query or Mutation SQL commands to the data sources that resolves them.
576
+ *
577
+ * **NOTE** Explicitly specifying the 'customSqlDataSourceStrategies' configuration option is in preview and is not recommended to use
578
+ * with production systems. For production, use the static factory methods `fromString` or `fromFiles`.
579
+ * @experimental
580
+ * @returns a list of mappings from custom SQL commands to data sources
581
+ */
582
+ readonly customSqlDataSourceStrategies?: CustomSqlDataSourceStrategy[];
570
583
  }
571
584
 
572
585
  /**
@@ -820,150 +833,3 @@ export interface AddFunctionProps {
820
833
  */
821
834
  readonly code?: Code;
822
835
  }
823
-
824
- /**
825
- * All known ModelDataSourceStrategies. Concrete strategies vary widely in their requirements and implementations.
826
- * @experimental
827
- */
828
- export type ModelDataSourceStrategy =
829
- | DefaultDynamoDbModelDataSourceStrategy
830
- | AmplifyDynamoDbModelDataSourceStrategy
831
- | SQLLambdaModelDataSourceStrategy;
832
-
833
- // TODO: Make this the source of truth for database type definitions used throughout the construct & transformer
834
- export type ModelDataSourceStrategyDbType = 'DYNAMODB';
835
-
836
- /**
837
- * Use default CloudFormation type 'AWS::DynamoDB::Table' to provision table.
838
- * @experimental
839
- */
840
- export interface DefaultDynamoDbModelDataSourceStrategy {
841
- readonly dbType: 'DYNAMODB';
842
- readonly provisionStrategy: 'DEFAULT';
843
- }
844
-
845
- /**
846
- * Use custom resource type 'Custom::AmplifyDynamoDBTable' to provision table.
847
- * @experimental
848
- */
849
- export interface AmplifyDynamoDbModelDataSourceStrategy {
850
- readonly dbType: 'DYNAMODB';
851
- readonly provisionStrategy: 'AMPLIFY_TABLE';
852
- }
853
-
854
- /**
855
- * A strategy that creates a Lambda to connect to a pre-existing SQL table to resolve model data.
856
- *
857
- * @experimental
858
- */
859
- export interface SQLLambdaModelDataSourceStrategy {
860
- /**
861
- * The name of the strategy. This will be used to name the AppSync DataSource itself, plus any associated resources like resolver Lambdas.
862
- * This name must be unique across all schema definitions in a GraphQL API.
863
- */
864
- readonly name: string;
865
-
866
- /**
867
- * The type of the SQL database used to process model operations for this definition.
868
- */
869
- readonly dbType: 'MYSQL' | 'POSTGRES';
870
-
871
- /**
872
- * The parameters the Lambda data source will use to connect to the database.
873
- */
874
- readonly dbConnectionConfig: SqlModelDataSourceDbConnectionConfig;
875
-
876
- /**
877
- * The configuration of the VPC into which to install the Lambda.
878
- */
879
- readonly vpcConfiguration?: VpcConfig;
880
-
881
- /**
882
- * Custom SQL statements. The key is the value of the `references` attribute of the `@sql` directive in the `schema`; the value is the SQL
883
- * to be executed.
884
- */
885
- readonly customSqlStatements?: Record<string, string>;
886
-
887
- /**
888
- * An optional override for the default SQL Lambda Layer
889
- */
890
- readonly sqlLambdaLayerMapping?: SQLLambdaLayerMapping;
891
-
892
- /**
893
- * The configuration for the provisioned concurrency of the Lambda.
894
- */
895
- readonly sqlLambdaProvisionedConcurrencyConfig?: ProvisionedConcurrencyConfig;
896
- }
897
-
898
- /**
899
- * Configuration of the VPC in which to install a Lambda to resolve queries against a SQL-based data source. The SQL Lambda will be deployed
900
- * into the specified VPC, subnets, and security groups. The specified subnets and security groups must be in the same VPC. The VPC must
901
- * have at least one subnet. The construct will also create VPC service endpoints in the specified subnets, as well as inbound security
902
- * rules, to allow traffic on port 443 within each security group. This allows the Lambda to read database connection information from
903
- * Secure Systems Manager.
904
- * @experimental
905
- */
906
- export interface VpcConfig {
907
- /** The VPC to install the Lambda data source in. */
908
- readonly vpcId: string;
909
-
910
- /** The security groups to install the Lambda data source in. */
911
- readonly securityGroupIds: string[];
912
-
913
- /** The subnets to install the Lambda data source in, one per availability zone. */
914
- readonly subnetAvailabilityZoneConfig: SubnetAvailabilityZone[];
915
- }
916
-
917
- /**
918
- * The configuration for the provisioned concurrency of the Lambda.
919
- * @experimental
920
- */
921
- export interface ProvisionedConcurrencyConfig {
922
- /** The amount of provisioned concurrency to allocate. **/
923
- readonly provisionedConcurrentExecutions: number;
924
- }
925
-
926
- /**
927
- * Subnet configuration for VPC endpoints used by a Lambda resolver for a SQL-based data source. Although it is possible to create multiple
928
- * subnets in a single availability zone, VPC service endpoints may only be deployed to a single subnet in a given availability zone. This
929
- * structure ensures that the Lambda function and VPC service endpoints are mutually consistent.
930
- * @experimental
931
- */
932
- export interface SubnetAvailabilityZone {
933
- /** The subnet ID to install the Lambda data source in. */
934
- readonly subnetId: string;
935
-
936
- /** The availability zone of the subnet. */
937
- readonly availabilityZone: string;
938
- }
939
-
940
- /**
941
- * Maps a given AWS region to the SQL Lambda layer version ARN for that region. `key` is the region; the `value` is the Lambda Layer version
942
- * ARN
943
- */
944
- export type SQLLambdaLayerMapping = Record<string, string>;
945
-
946
- /**
947
- * The Secure Systems Manager parameter paths the Lambda data source will use to connect to the database.
948
- *
949
- * These parameters are retrieved from Secure Systems Manager in the same region as the Lambda.
950
- * @experimental
951
- */
952
- export interface SqlModelDataSourceDbConnectionConfig {
953
- /** The Secure Systems Manager parameter containing the hostname of the database. For RDS-based SQL data sources, this can be the hostname
954
- * of a database proxy, cluster, or instance.
955
- */
956
- readonly hostnameSsmPath: string;
957
-
958
- /** The Secure Systems Manager parameter containing the port number of the database proxy, cluster, or instance. */
959
- readonly portSsmPath: string;
960
-
961
- /** The Secure Systems Manager parameter containing the username to use when connecting to the database. */
962
- readonly usernameSsmPath: string;
963
-
964
- /** The Secure Systems Manager parameter containing the password to use when connecting to the database. */
965
- readonly passwordSsmPath: string;
966
-
967
- /** The Secure Systems Manager parameter containing the database name. */
968
- readonly databaseNameSsmPath: string;
969
- }