@aws-amplify/graphql-api-construct 1.5.7 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.jsii +273 -212
- package/API.md +13 -5
- package/CHANGELOG.md +7 -0
- package/lib/amplify-dynamodb-table-wrapper.d.ts +6 -1
- package/lib/amplify-dynamodb-table-wrapper.js +9 -2
- package/lib/amplify-graphql-api.d.ts +2 -2
- package/lib/amplify-graphql-api.js +10 -7
- package/lib/amplify-graphql-definition.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/internal/construct-exports.js +13 -3
- package/lib/sql-model-datasource-strategy.js +1 -1
- package/lib/types.d.ts +17 -5
- package/lib/types.js +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js +0 -3
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/utils/validations.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js +3 -2
- package/node_modules/@aws-amplify/graphql-auth-transformer/lib/vtl-generator/rds/resolvers/query.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-auth-transformer/package.json +7 -7
- package/node_modules/@aws-amplify/graphql-default-value-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-default-value-transformer/package.json +3 -3
- package/node_modules/@aws-amplify/graphql-function-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-http-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-index-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-index-transformer/package.json +3 -3
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/lib/assets/mapping-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-maps-to-transformer/package.json +6 -6
- package/node_modules/@aws-amplify/graphql-model-transformer/CHANGELOG.md +6 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-notification-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/rds-patching-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.d.ts.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js +1 -0
- package/node_modules/@aws-amplify/graphql-model-transformer/lib/resources/amplify-dynamodb-table/amplify-dynamo-model-resource-generator.js.map +1 -1
- package/node_modules/@aws-amplify/graphql-model-transformer/package.json +2 -2
- package/node_modules/@aws-amplify/graphql-predictions-transformer/lib/predictionsLambdaFunction.zip +0 -0
- package/node_modules/@aws-amplify/graphql-predictions-transformer/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-relational-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-relational-transformer/package.json +4 -4
- package/node_modules/@aws-amplify/graphql-searchable-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/lib/streaming-lambda.zip +0 -0
- package/node_modules/@aws-amplify/graphql-searchable-transformer/package.json +3 -3
- package/node_modules/@aws-amplify/graphql-sql-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-sql-transformer/package.json +3 -3
- package/node_modules/@aws-amplify/graphql-transformer/CHANGELOG.md +4 -0
- package/node_modules/@aws-amplify/graphql-transformer/package.json +10 -10
- package/node_modules/@aws-amplify/graphql-transformer-core/package.json +1 -2
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/package.json +1 -2
- package/node_modules/graphql-mapping-template/package.json +1 -2
- package/node_modules/graphql-transformer-common/package.json +1 -2
- package/package.json +11 -11
- package/src/amplify-dynamodb-table-wrapper.ts +9 -1
- package/src/amplify-graphql-api.ts +15 -7
- package/src/index.ts +1 -0
- package/src/internal/construct-exports.ts +14 -4
- package/src/types.ts +19 -6
- package/node_modules/@aws-amplify/graphql-function-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-http-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-predictions-transformer/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-transformer-core/LICENSE +0 -201
- package/node_modules/@aws-amplify/graphql-transformer-interfaces/LICENSE +0 -201
- package/node_modules/graphql-mapping-template/LICENSE +0 -201
- package/node_modules/graphql-transformer-common/LICENSE +0 -201
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.4.1](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-relational-transformer@2.4.0...@aws-amplify/graphql-relational-transformer@2.4.1) (2024-03-13)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @aws-amplify/graphql-relational-transformer
|
9
|
+
|
6
10
|
# [2.4.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-relational-transformer@2.3.6...@aws-amplify/graphql-relational-transformer@2.4.0) (2024-02-28)
|
7
11
|
|
8
12
|
### Features
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/graphql-relational-transformer",
|
3
|
-
"version": "2.4.
|
3
|
+
"version": "2.4.1",
|
4
4
|
"description": "Amplify GraphQL relational modeling transformers",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -28,8 +28,8 @@
|
|
28
28
|
"extract-api": "ts-node ../../scripts/extract-api.ts"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@aws-amplify/graphql-index-transformer": "2.3.
|
32
|
-
"@aws-amplify/graphql-model-transformer": "2.
|
31
|
+
"@aws-amplify/graphql-index-transformer": "2.3.7",
|
32
|
+
"@aws-amplify/graphql-model-transformer": "2.6.0",
|
33
33
|
"@aws-amplify/graphql-transformer-core": "2.5.0",
|
34
34
|
"@aws-amplify/graphql-transformer-interfaces": "3.4.0",
|
35
35
|
"graphql": "^15.5.0",
|
@@ -78,5 +78,5 @@
|
|
78
78
|
"/__tests__/"
|
79
79
|
]
|
80
80
|
},
|
81
|
-
"gitHead": "
|
81
|
+
"gitHead": "9a0fb53d5df94e76811cbbdc4f3fc98fc6278c41"
|
82
82
|
}
|
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.6.1](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-searchable-transformer@2.6.0...@aws-amplify/graphql-searchable-transformer@2.6.1) (2024-03-13)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @aws-amplify/graphql-searchable-transformer
|
9
|
+
|
6
10
|
# [2.6.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-searchable-transformer@2.5.2...@aws-amplify/graphql-searchable-transformer@2.6.0) (2024-02-28)
|
7
11
|
|
8
12
|
### Features
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/graphql-searchable-transformer",
|
3
|
-
"version": "2.6.
|
3
|
+
"version": "2.6.1",
|
4
4
|
"description": "Amplfy GraphQL @searchable transformer",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"extract-api": "ts-node ../../scripts/extract-api.ts"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@aws-amplify/graphql-model-transformer": "2.
|
31
|
+
"@aws-amplify/graphql-model-transformer": "2.6.0",
|
32
32
|
"@aws-amplify/graphql-transformer-core": "2.5.0",
|
33
33
|
"@aws-amplify/graphql-transformer-interfaces": "3.4.0",
|
34
34
|
"graphql": "^15.5.0",
|
@@ -81,5 +81,5 @@
|
|
81
81
|
"/__tests__/"
|
82
82
|
]
|
83
83
|
},
|
84
|
-
"gitHead": "
|
84
|
+
"gitHead": "9a0fb53d5df94e76811cbbdc4f3fc98fc6278c41"
|
85
85
|
}
|
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [0.2.7](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-sql-transformer@0.2.6...@aws-amplify/graphql-sql-transformer@0.2.7) (2024-03-13)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @aws-amplify/graphql-sql-transformer
|
9
|
+
|
6
10
|
## [0.2.6](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-sql-transformer@0.2.5...@aws-amplify/graphql-sql-transformer@0.2.6) (2024-02-28)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @aws-amplify/graphql-sql-transformer
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/graphql-sql-transformer",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.7",
|
4
4
|
"description": "Amplify GraphQL @sql transformer",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"extract-api": "ts-node ../../scripts/extract-api.ts"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@aws-amplify/graphql-model-transformer": "2.
|
31
|
+
"@aws-amplify/graphql-model-transformer": "2.6.0",
|
32
32
|
"@aws-amplify/graphql-transformer-core": "2.5.0",
|
33
33
|
"@aws-amplify/graphql-transformer-interfaces": "3.4.0",
|
34
34
|
"graphql": "^15.5.0",
|
@@ -79,5 +79,5 @@
|
|
79
79
|
"/__tests__/"
|
80
80
|
]
|
81
81
|
},
|
82
|
-
"gitHead": "
|
82
|
+
"gitHead": "9a0fb53d5df94e76811cbbdc4f3fc98fc6278c41"
|
83
83
|
}
|
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.3.12](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-transformer@1.3.11...@aws-amplify/graphql-transformer@1.3.12) (2024-03-13)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @aws-amplify/graphql-transformer
|
9
|
+
|
6
10
|
## [1.3.11](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-transformer@1.3.10...@aws-amplify/graphql-transformer@1.3.11) (2024-02-28)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @aws-amplify/graphql-transformer
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/graphql-transformer",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.12",
|
4
4
|
"description": "Amplify GraphQL Transformer Root Package",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -28,17 +28,17 @@
|
|
28
28
|
"access": "public"
|
29
29
|
},
|
30
30
|
"dependencies": {
|
31
|
-
"@aws-amplify/graphql-auth-transformer": "3.4.
|
32
|
-
"@aws-amplify/graphql-default-value-transformer": "2.3.
|
31
|
+
"@aws-amplify/graphql-auth-transformer": "3.4.1",
|
32
|
+
"@aws-amplify/graphql-default-value-transformer": "2.3.1",
|
33
33
|
"@aws-amplify/graphql-function-transformer": "2.1.18",
|
34
34
|
"@aws-amplify/graphql-http-transformer": "2.1.18",
|
35
|
-
"@aws-amplify/graphql-index-transformer": "2.3.
|
36
|
-
"@aws-amplify/graphql-maps-to-transformer": "3.4.
|
37
|
-
"@aws-amplify/graphql-model-transformer": "2.
|
35
|
+
"@aws-amplify/graphql-index-transformer": "2.3.7",
|
36
|
+
"@aws-amplify/graphql-maps-to-transformer": "3.4.8",
|
37
|
+
"@aws-amplify/graphql-model-transformer": "2.6.0",
|
38
38
|
"@aws-amplify/graphql-predictions-transformer": "2.1.18",
|
39
|
-
"@aws-amplify/graphql-relational-transformer": "2.4.
|
40
|
-
"@aws-amplify/graphql-searchable-transformer": "2.6.
|
41
|
-
"@aws-amplify/graphql-sql-transformer": "0.2.
|
39
|
+
"@aws-amplify/graphql-relational-transformer": "2.4.1",
|
40
|
+
"@aws-amplify/graphql-searchable-transformer": "2.6.1",
|
41
|
+
"@aws-amplify/graphql-sql-transformer": "0.2.7",
|
42
42
|
"@aws-amplify/graphql-transformer-core": "2.5.0",
|
43
43
|
"@aws-amplify/graphql-transformer-interfaces": "3.4.0"
|
44
44
|
},
|
@@ -87,5 +87,5 @@
|
|
87
87
|
"/__tests__/"
|
88
88
|
]
|
89
89
|
},
|
90
|
-
"gitHead": "
|
90
|
+
"gitHead": "9a0fb53d5df94e76811cbbdc4f3fc98fc6278c41"
|
91
91
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@aws-amplify/graphql-api-construct",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.6.0",
|
4
4
|
"description": "AppSync GraphQL Api Construct using Amplify GraphQL Transformer.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -75,18 +75,18 @@
|
|
75
75
|
"dependencies": {
|
76
76
|
"@aws-amplify/backend-output-schemas": "^0.4.0",
|
77
77
|
"@aws-amplify/backend-output-storage": "^0.2.2",
|
78
|
-
"@aws-amplify/graphql-auth-transformer": "3.4.
|
79
|
-
"@aws-amplify/graphql-default-value-transformer": "2.3.
|
78
|
+
"@aws-amplify/graphql-auth-transformer": "3.4.1",
|
79
|
+
"@aws-amplify/graphql-default-value-transformer": "2.3.1",
|
80
80
|
"@aws-amplify/graphql-function-transformer": "2.1.18",
|
81
81
|
"@aws-amplify/graphql-http-transformer": "2.1.18",
|
82
|
-
"@aws-amplify/graphql-index-transformer": "2.3.
|
83
|
-
"@aws-amplify/graphql-maps-to-transformer": "3.4.
|
84
|
-
"@aws-amplify/graphql-model-transformer": "2.
|
82
|
+
"@aws-amplify/graphql-index-transformer": "2.3.7",
|
83
|
+
"@aws-amplify/graphql-maps-to-transformer": "3.4.8",
|
84
|
+
"@aws-amplify/graphql-model-transformer": "2.6.0",
|
85
85
|
"@aws-amplify/graphql-predictions-transformer": "2.1.18",
|
86
|
-
"@aws-amplify/graphql-relational-transformer": "2.4.
|
87
|
-
"@aws-amplify/graphql-searchable-transformer": "2.6.
|
88
|
-
"@aws-amplify/graphql-sql-transformer": "0.2.
|
89
|
-
"@aws-amplify/graphql-transformer": "1.3.
|
86
|
+
"@aws-amplify/graphql-relational-transformer": "2.4.1",
|
87
|
+
"@aws-amplify/graphql-searchable-transformer": "2.6.1",
|
88
|
+
"@aws-amplify/graphql-sql-transformer": "0.2.7",
|
89
|
+
"@aws-amplify/graphql-transformer": "1.3.12",
|
90
90
|
"@aws-amplify/graphql-transformer-core": "2.5.0",
|
91
91
|
"@aws-amplify/graphql-transformer-interfaces": "3.4.0",
|
92
92
|
"@aws-amplify/platform-core": "^0.2.0",
|
@@ -177,5 +177,5 @@
|
|
177
177
|
"/__tests__/"
|
178
178
|
]
|
179
179
|
},
|
180
|
-
"gitHead": "
|
180
|
+
"gitHead": "9a0fb53d5df94e76811cbbdc4f3fc98fc6278c41"
|
181
181
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CfnResource } from 'aws-cdk-lib';
|
1
|
+
import { CfnResource, RemovalPolicy } from 'aws-cdk-lib';
|
2
2
|
import { BillingMode, StreamViewType } from 'aws-cdk-lib/aws-dynamodb';
|
3
3
|
|
4
4
|
const AMPLIFY_DYNAMODB_TABLE_RESOURCE_TYPE = 'Custom::AmplifyDynamoDBTable';
|
@@ -110,6 +110,14 @@ export class AmplifyDynamoDbTableWrapper {
|
|
110
110
|
}
|
111
111
|
}
|
112
112
|
|
113
|
+
/**
|
114
|
+
* Set the deletion policy of the resource based on the removal policy specified.
|
115
|
+
* @param policy removal policy to set
|
116
|
+
*/
|
117
|
+
applyRemovalPolicy(policy: RemovalPolicy): void {
|
118
|
+
this.resource.applyRemovalPolicy(policy);
|
119
|
+
}
|
120
|
+
|
113
121
|
/**
|
114
122
|
* Specify how you are charged for read and write throughput and how you manage capacity.
|
115
123
|
*/
|
@@ -36,7 +36,7 @@ import type {
|
|
36
36
|
FunctionSlot,
|
37
37
|
IBackendOutputStorageStrategy,
|
38
38
|
AddFunctionProps,
|
39
|
-
|
39
|
+
DataStoreConfiguration,
|
40
40
|
IAmplifyGraphqlDefinition,
|
41
41
|
} from './types';
|
42
42
|
import {
|
@@ -120,9 +120,9 @@ export class AmplifyGraphqlApi extends Construct {
|
|
120
120
|
public readonly apiId: string;
|
121
121
|
|
122
122
|
/**
|
123
|
-
*
|
123
|
+
* DataStore conflict resolution setting
|
124
124
|
*/
|
125
|
-
private readonly
|
125
|
+
private readonly dataStoreConfiguration: DataStoreConfiguration | undefined;
|
126
126
|
|
127
127
|
/**
|
128
128
|
* Be very careful editing this value. This is the string that is used to identify graphql stacks in BI metrics
|
@@ -152,8 +152,17 @@ export class AmplifyGraphqlApi extends Construct {
|
|
152
152
|
translationBehavior,
|
153
153
|
functionNameMap,
|
154
154
|
outputStorageStrategy,
|
155
|
+
dataStoreConfiguration,
|
155
156
|
} = props;
|
156
157
|
|
158
|
+
if (conflictResolution && dataStoreConfiguration) {
|
159
|
+
throw new Error(
|
160
|
+
`conflictResolution is deprecated. conflictResolution and dataStoreConfiguration cannot be used together. Please use dataStoreConfiguration.`,
|
161
|
+
);
|
162
|
+
}
|
163
|
+
|
164
|
+
this.dataStoreConfiguration = dataStoreConfiguration || conflictResolution;
|
165
|
+
|
157
166
|
const dataSources = getMetadataDataSources(definition);
|
158
167
|
|
159
168
|
new AttributionMetadataStorage().storeAttributionMetadata(Stack.of(scope), this.stackType, path.join(__dirname, '..', 'package.json'), {
|
@@ -201,7 +210,7 @@ export class AmplifyGraphqlApi extends Construct {
|
|
201
210
|
},
|
202
211
|
authConfig,
|
203
212
|
stackMapping: stackMappings ?? {},
|
204
|
-
resolverConfig:
|
213
|
+
resolverConfig: this.dataStoreConfiguration ? convertToResolverConfig(this.dataStoreConfiguration) : undefined,
|
205
214
|
transformParameters: {
|
206
215
|
...defaultTranslationBehavior,
|
207
216
|
...(translationBehavior ?? {}),
|
@@ -217,7 +226,6 @@ export class AmplifyGraphqlApi extends Construct {
|
|
217
226
|
this.codegenAssets = new CodegenAssets(this, 'AmplifyCodegenAssets', { modelSchema: definition.schema });
|
218
227
|
|
219
228
|
this.resources = getGeneratedResources(this);
|
220
|
-
this.conflictResolution = conflictResolution;
|
221
229
|
this.generatedFunctionSlots = getGeneratedFunctionSlots(assetManager.resolverAssets);
|
222
230
|
this.storeOutput(outputStorageStrategy);
|
223
231
|
|
@@ -255,8 +263,8 @@ export class AmplifyGraphqlApi extends Construct {
|
|
255
263
|
output.payload.awsAppsyncAdditionalAuthenticationTypes = additionalAuthTypes;
|
256
264
|
}
|
257
265
|
|
258
|
-
if (this.
|
259
|
-
output.payload.awsAppsyncConflictResolutionMode = this.
|
266
|
+
if (this.dataStoreConfiguration?.project?.handlerType) {
|
267
|
+
output.payload.awsAppsyncConflictResolutionMode = this.dataStoreConfiguration?.project?.handlerType;
|
260
268
|
}
|
261
269
|
|
262
270
|
outputStorageStrategy.addBackendOutputEntry(graphqlOutputKey, output);
|
package/src/index.ts
CHANGED
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
CfnDataSource,
|
9
9
|
GraphqlApi,
|
10
10
|
} from 'aws-cdk-lib/aws-appsync';
|
11
|
-
import { CfnTable, Table } from 'aws-cdk-lib/aws-dynamodb';
|
11
|
+
import { CfnTable, Table, ITable } from 'aws-cdk-lib/aws-dynamodb';
|
12
12
|
import { CfnRole, Role } from 'aws-cdk-lib/aws-iam';
|
13
13
|
import { CfnResource, NestedStack } from 'aws-cdk-lib';
|
14
14
|
import { getResourceName } from '@aws-amplify/graphql-transformer-core';
|
@@ -17,6 +17,16 @@ import { AmplifyGraphqlApiResources, FunctionSlot } from '../types';
|
|
17
17
|
import { AmplifyDynamoDbTableWrapper } from '../amplify-dynamodb-table-wrapper';
|
18
18
|
import { walkAndProcessNodes } from './construct-tree';
|
19
19
|
|
20
|
+
/**
|
21
|
+
* Check if a resource is implementing table interface
|
22
|
+
* The required properties need to be present in the input
|
23
|
+
* https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ITable.html#properties
|
24
|
+
* @param table table resource
|
25
|
+
* @returns whether the resource is a ITable or not
|
26
|
+
*/
|
27
|
+
function isITable(table: any): table is ITable {
|
28
|
+
return 'env' in table && 'node' in table && 'stack' in table && 'tableArn' in table && 'tableName' in table;
|
29
|
+
}
|
20
30
|
/**
|
21
31
|
* Everything below here is intended to help us gather the
|
22
32
|
* output values and render out the L1 resources for access.
|
@@ -33,7 +43,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
33
43
|
const cfnResolvers: Record<string, CfnResolver> = {};
|
34
44
|
const cfnFunctionConfigurations: Record<string, CfnFunctionConfiguration> = {};
|
35
45
|
const cfnDataSources: Record<string, CfnDataSource> = {};
|
36
|
-
const tables: Record<string,
|
46
|
+
const tables: Record<string, ITable> = {};
|
37
47
|
const cfnTables: Record<string, CfnTable> = {};
|
38
48
|
const amplifyDynamoDbTables: Record<string, AmplifyDynamoDbTableWrapper> = {};
|
39
49
|
const roles: Record<string, Role> = {};
|
@@ -72,7 +82,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
72
82
|
cfnFunctionConfigurations[resourceName] = currentScope;
|
73
83
|
return;
|
74
84
|
}
|
75
|
-
if (currentScope instanceof Table) {
|
85
|
+
if (currentScope instanceof Table || isITable(currentScope)) {
|
76
86
|
tables[resourceName] = currentScope;
|
77
87
|
return;
|
78
88
|
}
|
@@ -123,7 +133,6 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
123
133
|
return {
|
124
134
|
graphqlApi: GraphqlApi.fromGraphqlApiAttributes(scope, 'L2GraphqlApi', { graphqlApiId: cfnGraphqlApi.attrApiId }),
|
125
135
|
tables,
|
126
|
-
amplifyDynamoDbTables,
|
127
136
|
roles,
|
128
137
|
functions,
|
129
138
|
nestedStacks,
|
@@ -135,6 +144,7 @@ export const getGeneratedResources = (scope: Construct): AmplifyGraphqlApiResour
|
|
135
144
|
cfnFunctionConfigurations,
|
136
145
|
cfnDataSources,
|
137
146
|
cfnTables,
|
147
|
+
amplifyDynamoDbTables,
|
138
148
|
cfnRoles,
|
139
149
|
cfnFunctions,
|
140
150
|
additionalCfnResources,
|
package/src/types.ts
CHANGED
@@ -234,8 +234,14 @@ export type ConflictResolutionStrategy =
|
|
234
234
|
|
235
235
|
/**
|
236
236
|
* Project level configuration for conflict resolution.
|
237
|
+
* @deprecated use DataStoreConfiguration instead.
|
237
238
|
*/
|
238
|
-
export interface ConflictResolution {
|
239
|
+
export interface ConflictResolution extends DataStoreConfiguration {}
|
240
|
+
|
241
|
+
/**
|
242
|
+
* Project level configuration for DataStore
|
243
|
+
*/
|
244
|
+
export interface DataStoreConfiguration {
|
239
245
|
/**
|
240
246
|
* Project-wide config for conflict resolution. Applies to all non-overridden models.
|
241
247
|
*/
|
@@ -636,6 +642,7 @@ export interface AmplifyGraphqlApiProps {
|
|
636
642
|
/**
|
637
643
|
* Configure conflict resolution on the Api, which is required to enable DataStore Api functionality.
|
638
644
|
* For more information, refer to https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js/
|
645
|
+
* @deprecated use dataStoreConfiguration instead.
|
639
646
|
*/
|
640
647
|
readonly conflictResolution?: ConflictResolution;
|
641
648
|
|
@@ -676,6 +683,12 @@ export interface AmplifyGraphqlApiProps {
|
|
676
683
|
* Strategy to store construct outputs. If no outputStorageStrategey is provided a default strategy will be used.
|
677
684
|
*/
|
678
685
|
readonly outputStorageStrategy?: IBackendOutputStorageStrategy;
|
686
|
+
|
687
|
+
/**
|
688
|
+
* Configure DataStore conflict resolution on the Api. Conflict resolution is required to enable DataStore Api functionality.
|
689
|
+
* For more information, refer to https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js/
|
690
|
+
*/
|
691
|
+
readonly dataStoreConfiguration?: DataStoreConfiguration;
|
679
692
|
}
|
680
693
|
|
681
694
|
/**
|
@@ -718,6 +731,11 @@ export interface AmplifyGraphqlApiCfnResources {
|
|
718
731
|
*/
|
719
732
|
readonly cfnTables: Record<string, CfnTable>;
|
720
733
|
|
734
|
+
/**
|
735
|
+
* The Generated Amplify DynamoDb Table L1 resource wrapper, keyed by model type name.
|
736
|
+
*/
|
737
|
+
readonly amplifyDynamoDbTables: Record<string, AmplifyDynamoDbTableWrapper>;
|
738
|
+
|
721
739
|
/**
|
722
740
|
* The Generated IAM Role L1 Resources, keyed by logicalId.
|
723
741
|
*/
|
@@ -749,11 +767,6 @@ export interface AmplifyGraphqlApiResources {
|
|
749
767
|
*/
|
750
768
|
readonly tables: Record<string, ITable>;
|
751
769
|
|
752
|
-
/**
|
753
|
-
* The Generated Amplify DynamoDb Table wrapped if produced, keyed by name.
|
754
|
-
*/
|
755
|
-
readonly amplifyDynamoDbTables: Record<string, AmplifyDynamoDbTableWrapper>;
|
756
|
-
|
757
770
|
/**
|
758
771
|
* The Generated IAM Role L2 Resources, keyed by logicalId.
|
759
772
|
*/
|