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

Sign up to get free protection for your applications and to get access to all the features.
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,163 @@
1
+ import { DataSourceType } from '../transformer-context/transformer-datasource-provider';
2
+
3
+ // #########################################################################################################################################
4
+ // If you change types in this file (the internal implementation), be sure to make corresponding necessary changes to
5
+ // amplify-graphql-api-construct/src/model-datasource-strategy.ts (the customer-facing interface) and the adapter functions in this file.
6
+ // #########################################################################################################################################
7
+
8
+ /**
9
+ * All known ModelDataSourceStrategies. Concrete strategies vary widely in their requirements and implementations.
10
+ */
11
+ export type ModelDataSourceStrategy =
12
+ | DefaultDynamoDbModelDataSourceStrategy
13
+ | AmplifyDynamoDbModelDataSourceStrategy
14
+ | SQLLambdaModelDataSourceStrategy;
15
+
16
+ export interface ModelDataSourceStrategyBase {
17
+ dbType: ModelDataSourceStrategyDbType;
18
+ }
19
+
20
+ // TODO: Make this the source of truth for database type definitions used throughout the construct & transformer
21
+ export type ModelDataSourceStrategyDbType = 'DYNAMODB' | 'MYSQL' | 'POSTGRES';
22
+
23
+ /**
24
+ * Use default CloudFormation type 'AWS::DynamoDB::Table' to provision table.
25
+ */
26
+ export interface DefaultDynamoDbModelDataSourceStrategy extends ModelDataSourceStrategyBase {
27
+ readonly dbType: 'DYNAMODB';
28
+ readonly provisionStrategy: 'DEFAULT';
29
+ }
30
+
31
+ /**
32
+ * Use custom resource type 'Custom::AmplifyDynamoDBTable' to provision table.
33
+ */
34
+ export interface AmplifyDynamoDbModelDataSourceStrategy extends ModelDataSourceStrategyBase {
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
+ */
43
+ export interface SQLLambdaModelDataSourceStrategy extends ModelDataSourceStrategyBase {
44
+ /**
45
+ * The name of the strategy. This will be used to name the AppSync DataSource itself, plus any associated resources like resolver Lambdas.
46
+ * This name must be unique across all schema definitions in a GraphQL API.
47
+ */
48
+ readonly name: string;
49
+
50
+ /**
51
+ * The type of the SQL database used to process model operations for this definition.
52
+ */
53
+ readonly dbType: 'MYSQL' | 'POSTGRES';
54
+
55
+ /**
56
+ * The parameters the Lambda data source will use to connect to the database.
57
+ */
58
+ readonly dbConnectionConfig: SqlModelDataSourceDbConnectionConfig;
59
+
60
+ /**
61
+ * The configuration of the VPC into which to install the Lambda.
62
+ */
63
+ readonly vpcConfiguration?: VpcConfig;
64
+
65
+ /**
66
+ * Custom SQL statements. The key is the value of the `references` attribute of the `@sql` directive in the `schema`; the value is the SQL
67
+ * to be executed.
68
+ */
69
+ readonly customSqlStatements?: Record<string, string>;
70
+
71
+ /**
72
+ * The configuration for the provisioned concurrency of the Lambda.
73
+ */
74
+ readonly sqlLambdaProvisionedConcurrencyConfig?: ProvisionedConcurrencyConfig;
75
+ }
76
+
77
+ /**
78
+ * 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
79
+ * into the specified VPC, subnets, and security groups. The specified subnets and security groups must be in the same VPC. The VPC must
80
+ * have at least one subnet. The construct will also create VPC service endpoints in the specified subnets, as well as inbound security
81
+ * rules, to allow traffic on port 443 within each security group. This allows the Lambda to read database connection information from
82
+ * Secure Systems Manager.
83
+ */
84
+ export interface VpcConfig {
85
+ /** The VPC to install the Lambda data source in. */
86
+ readonly vpcId: string;
87
+
88
+ /** The security groups to install the Lambda data source in. */
89
+ readonly securityGroupIds: string[];
90
+
91
+ /** The subnets to install the Lambda data source in, one per availability zone. */
92
+ readonly subnetAvailabilityZoneConfig: SubnetAvailabilityZone[];
93
+ }
94
+
95
+ /**
96
+ * The configuration for the provisioned concurrency of the Lambda.
97
+ */
98
+ export interface ProvisionedConcurrencyConfig {
99
+ /** The amount of provisioned concurrency to allocate. **/
100
+ readonly provisionedConcurrentExecutions: number;
101
+ }
102
+
103
+ /**
104
+ * Subnet configuration for VPC endpoints used by a Lambda resolver for a SQL-based data source. Although it is possible to create multiple
105
+ * subnets in a single availability zone, VPC service endpoints may only be deployed to a single subnet in a given availability zone. This
106
+ * structure ensures that the Lambda function and VPC service endpoints are mutually consistent.
107
+ */
108
+ export interface SubnetAvailabilityZone {
109
+ /** The subnet ID to install the Lambda data source in. */
110
+ readonly subnetId: string;
111
+
112
+ /** The availability zone of the subnet. */
113
+ readonly availabilityZone: string;
114
+ }
115
+
116
+ /**
117
+ * The Secure Systems Manager parameter paths the Lambda data source will use to connect to the database.
118
+ *
119
+ * These parameters are retrieved from Secure Systems Manager in the same region as the Lambda.
120
+ */
121
+ export interface SqlModelDataSourceDbConnectionConfig {
122
+ /** The Secure Systems Manager parameter containing the hostname of the database. For RDS-based SQL data sources, this can be the hostname
123
+ * of a database proxy, cluster, or instance.
124
+ */
125
+ readonly hostnameSsmPath: string;
126
+
127
+ /** The Secure Systems Manager parameter containing the port number of the database proxy, cluster, or instance. */
128
+ readonly portSsmPath: string;
129
+
130
+ /** The Secure Systems Manager parameter containing the username to use when connecting to the database. */
131
+ readonly usernameSsmPath: string;
132
+
133
+ /** The Secure Systems Manager parameter containing the password to use when connecting to the database. */
134
+ readonly passwordSsmPath: string;
135
+
136
+ /** The Secure Systems Manager parameter containing the database name. */
137
+ readonly databaseNameSsmPath: string;
138
+ }
139
+
140
+ export interface CustomSqlDataSourceStrategy {
141
+ readonly typeName: 'Query' | 'Mutation';
142
+ readonly fieldName: string;
143
+ // TODO: Replace this when we support heterogeneous SQL data sources in a single API
144
+ readonly dataSourceType: DataSourceType;
145
+ }
146
+
147
+ export interface DataSourceStrategiesProvider {
148
+ /** Maps GraphQL model names to the ModelDataSourceStrategy used to resolve it. The key of the record is the GraphQL type name. */
149
+ // TODO: Add this back during combine feature
150
+ // dataSourceStrategies: Record<string, ModelDataSourceStrategy>;
151
+
152
+ /** Maps custom Query and Mutation fields to the ModelDataSourceStrategy used to resolve them. */
153
+ customSqlDataSourceStrategies: CustomSqlDataSourceStrategy[];
154
+ }
155
+
156
+ /**
157
+ * Maps a given AWS region to the SQL Lambda layer version ARN for that region. TODO: Rename to SQLLambdaLayerMapping
158
+ */
159
+ export interface RDSLayerMapping {
160
+ readonly [key: string]: {
161
+ layerRegion: string;
162
+ };
163
+ }
@@ -17,8 +17,8 @@ import {
17
17
  DataSourceOptions,
18
18
  SearchableDataSourceOptions,
19
19
  MappingTemplateProvider,
20
- VpcConfig,
21
20
  } from './graphql-api-provider';
21
+ import { VpcConfig } from './model-datasource';
22
22
 
23
23
  export interface DynamoDbDataSourceOptions extends DataSourceOptions {
24
24
  /**
@@ -15,13 +15,14 @@ export { TransformerProviderRegistry } from './transformer-provider-registry';
15
15
  export { TransformerResolverProvider, TransformerResolversManagerProvider } from './transformer-resolver-provider';
16
16
  export * from './resource-resource-provider';
17
17
  export {
18
- TransformerContextProvider,
19
- TransformerTransformSchemaStepContextProvider,
20
18
  TransformerBeforeStepContextProvider,
19
+ TransformerContextMetadataProvider,
20
+ TransformerContextProvider,
21
21
  TransformerPrepareStepContextProvider,
22
22
  TransformerSchemaVisitStepContextProvider,
23
- TransformerValidationStepContextProvider,
24
23
  TransformerSecrets,
24
+ TransformerTransformSchemaStepContextProvider,
25
+ TransformerValidationStepContextProvider,
25
26
  } from './transformer-context-provider';
26
27
  export { TransformerSchemaHelperProvider } from './schema-helper-provider';
27
28
  export { TransformerPreProcessContextProvider } from './transformer-preprocess-context-provider';
@@ -1,11 +1,6 @@
1
1
  import { DocumentNode } from 'graphql';
2
- import {
3
- AppSyncAuthConfiguration,
4
- GraphQLAPIProvider,
5
- RDSLayerMapping,
6
- VpcConfig,
7
- ProvisionedConcurrencyConfig,
8
- } from '../graphql-api-provider';
2
+ import { AppSyncAuthConfiguration, GraphQLAPIProvider } from '../graphql-api-provider';
3
+ import { CustomSqlDataSourceStrategy, ProvisionedConcurrencyConfig, RDSLayerMapping, VpcConfig } from '../model-datasource';
9
4
  import { TransformerDataSourceManagerProvider, DataSourceType } from './transformer-datasource-provider';
10
5
  import { TransformerProviderRegistry } from './transformer-provider-registry';
11
6
  import { TransformerContextOutputProvider } from './transformer-context-output-provider';
@@ -31,6 +26,7 @@ export interface TransformerContextProvider {
31
26
 
32
27
  inputDocument: DocumentNode;
33
28
  modelToDatasourceMap: Map<string, DataSourceType>;
29
+ customSqlDataSourceStrategies?: CustomSqlDataSourceStrategy[];
34
30
  datasourceSecretParameterLocations: Map<string, TransformerSecrets>;
35
31
  output: TransformerContextOutputProvider;
36
32
  stackManager: StackManagerProvider;
@@ -52,6 +48,7 @@ export type TransformerBeforeStepContextProvider = Pick<
52
48
  TransformerContextProvider,
53
49
  | 'inputDocument'
54
50
  | 'modelToDatasourceMap'
51
+ | 'customSqlDataSourceStrategies'
55
52
  | 'transformParameters'
56
53
  | 'isProjectUsingDataStore'
57
54
  | 'getResolverConfig'
@@ -64,6 +61,7 @@ export type TransformerSchemaVisitStepContextProvider = Pick<
64
61
  TransformerContextProvider,
65
62
  | 'inputDocument'
66
63
  | 'modelToDatasourceMap'
64
+ | 'customSqlDataSourceStrategies'
67
65
  | 'output'
68
66
  | 'providerRegistry'
69
67
  | 'transformParameters'
@@ -78,6 +76,7 @@ export type TransformerValidationStepContextProvider = Pick<
78
76
  TransformerContextProvider,
79
77
  | 'inputDocument'
80
78
  | 'modelToDatasourceMap'
79
+ | 'customSqlDataSourceStrategies'
81
80
  | 'output'
82
81
  | 'providerRegistry'
83
82
  | 'dataSources'
@@ -28,12 +28,12 @@ export interface TransformerDataSourceManagerProvider {
28
28
  export interface DataSourceProvider extends BackedDataSource {}
29
29
 
30
30
  /**
31
- * Supported transformable database types. TODO: Move this to amplify-graphql-api-construct
31
+ * Supported transformable database types. TODO: Remove this when we normalize database type handling throughout
32
32
  */
33
33
  export type DBType = 'DDB' | SQLDBType;
34
34
 
35
35
  /**
36
- * Supported transformable SQL database types. TODO: Move this to amplify-graphql-api-construct
36
+ * Supported transformable SQL database types. TODO: Remove this when we normalize database type handling throughout
37
37
  */
38
38
  export type SQLDBType = 'MySQL' | 'Postgres';
39
39