@aws-amplify/graphql-model-transformer 1.1.0-beta.3 → 1.1.0-beta.5

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 CHANGED
@@ -3,6 +3,28 @@
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.1.0-beta.5](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.8...@aws-amplify/graphql-model-transformer@1.1.0-beta.5) (2023-02-15)
7
+
8
+ ### Bug Fixes
9
+
10
+ - lock CDK v2 version ([#923](https://github.com/aws-amplify/amplify-category-api/issues/923)) ([2afe40c](https://github.com/aws-amplify/amplify-category-api/commit/2afe40cf13e7d1ee7db37988b9b3297768c7bd0a))
11
+ - preserve logical id patterns for dynamodb tables and search domain ([#894](https://github.com/aws-amplify/amplify-category-api/issues/894)) ([7530fc2](https://github.com/aws-amplify/amplify-category-api/commit/7530fc2e9254b621dc3782271318dd3f5c97d2b8))
12
+
13
+ ### Features
14
+
15
+ - migrate index and model transformers to CDK v2 ([#860](https://github.com/aws-amplify/amplify-category-api/issues/860)) ([886ab6c](https://github.com/aws-amplify/amplify-category-api/commit/886ab6c1eb699f9a09f273c76b3c419c73004f9b))
16
+
17
+ # [1.1.0-beta.4](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.7...@aws-amplify/graphql-model-transformer@1.1.0-beta.4) (2023-02-03)
18
+
19
+ ### Bug Fixes
20
+
21
+ - lock CDK v2 version ([#923](https://github.com/aws-amplify/amplify-category-api/issues/923)) ([2afe40c](https://github.com/aws-amplify/amplify-category-api/commit/2afe40cf13e7d1ee7db37988b9b3297768c7bd0a))
22
+ - preserve logical id patterns for dynamodb tables and search domain ([#894](https://github.com/aws-amplify/amplify-category-api/issues/894)) ([7530fc2](https://github.com/aws-amplify/amplify-category-api/commit/7530fc2e9254b621dc3782271318dd3f5c97d2b8))
23
+
24
+ ### Features
25
+
26
+ - migrate index and model transformers to CDK v2 ([#860](https://github.com/aws-amplify/amplify-category-api/issues/860)) ([886ab6c](https://github.com/aws-amplify/amplify-category-api/commit/886ab6c1eb699f9a09f273c76b3c419c73004f9b))
27
+
6
28
  # [1.1.0-beta.3](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.4...@aws-amplify/graphql-model-transformer@1.1.0-beta.3) (2022-12-27)
7
29
 
8
30
  ### Bug Fixes
@@ -53,6 +75,24 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
53
75
 
54
76
  - migrate index and model transformers to CDK v2 ([#860](https://github.com/aws-amplify/amplify-category-api/issues/860)) ([886ab6c](https://github.com/aws-amplify/amplify-category-api/commit/886ab6c1eb699f9a09f273c76b3c419c73004f9b))
55
77
 
78
+ ## [0.16.8](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.7...@aws-amplify/graphql-model-transformer@0.16.8) (2023-02-10)
79
+
80
+ ### Bug Fixes
81
+
82
+ - **transformer:** conflict detection respects to per model rule ([#1201](https://github.com/aws-amplify/amplify-category-api/issues/1201)) ([9fd7e16](https://github.com/aws-amplify/amplify-category-api/commit/9fd7e166c78c265c704653213adce47a5c8a55f7))
83
+
84
+ ## [0.16.7](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.6...@aws-amplify/graphql-model-transformer@0.16.7) (2023-01-26)
85
+
86
+ **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
87
+
88
+ ## [0.16.6](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.5...@aws-amplify/graphql-model-transformer@0.16.6) (2023-01-12)
89
+
90
+ **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
91
+
92
+ ## [0.16.5](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.4...@aws-amplify/graphql-model-transformer@0.16.5) (2023-01-12)
93
+
94
+ **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
95
+
56
96
  ## [0.16.4](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@0.16.3...@aws-amplify/graphql-model-transformer@0.16.4) (2022-12-03)
57
97
 
58
98
  **Note:** Version bump only for package @aws-amplify/graphql-model-transformer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/graphql-model-transformer",
3
- "version": "1.1.0-beta.3",
3
+ "version": "1.1.0-beta.5",
4
4
  "description": "Amplify graphql @model transformer",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,14 +29,14 @@
29
29
  "extract-api": "ts-node ../../scripts/extract-api.ts"
30
30
  },
31
31
  "dependencies": {
32
- "@aws-amplify/graphql-transformer-core": "1.1.0-beta.3",
33
- "@aws-amplify/graphql-transformer-interfaces": "2.1.0-beta.3",
32
+ "@aws-amplify/graphql-transformer-core": "1.1.0-beta.5",
33
+ "@aws-amplify/graphql-transformer-interfaces": "2.1.0-beta.5",
34
34
  "@aws-cdk/aws-appsync-alpha": "~2.53.0-alpha.0",
35
35
  "aws-cdk-lib": "~2.53.0",
36
36
  "constructs": "^10.0.5",
37
- "graphql": "^14.5.8",
38
- "graphql-mapping-template": "4.20.6-beta.0",
39
- "graphql-transformer-common": "4.24.1-beta.2"
37
+ "graphql": "^15.5.0",
38
+ "graphql-mapping-template": "4.20.8-beta.1",
39
+ "graphql-transformer-common": "4.24.5-beta.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^12.12.6"
@@ -59,5 +59,5 @@
59
59
  "overrides"
60
60
  ]
61
61
  },
62
- "gitHead": "dfde291d4b67660773fcc926718b966144fc9ac3"
62
+ "gitHead": "815c7a1f3f5ec7677f7234f2927ef75096ee1c98"
63
63
  }
@@ -1168,7 +1168,89 @@ describe('ModelTransformer: ', () => {
1168
1168
  },
1169
1169
  });
1170
1170
  });
1171
+ it("the conflict detection of per model rule should be respected", () => {
1172
+ const validSchema = `
1173
+ type Todo @model {
1174
+ name: String
1175
+ }
1176
+ type Author @model {
1177
+ name: String
1178
+ }
1179
+ `;
1180
+
1181
+ const transformer = new GraphQLTransform({
1182
+ transformConfig: {},
1183
+ resolverConfig: {
1184
+ project: {
1185
+ ConflictDetection: "VERSION",
1186
+ ConflictHandler: ConflictHandlerType.AUTOMERGE
1187
+ },
1188
+ models: {
1189
+ Todo: {
1190
+ ConflictDetection: "VERSION",
1191
+ ConflictHandler: ConflictHandlerType.LAMBDA,
1192
+ LambdaConflictHandler: {
1193
+ name: "myTodoConflictHandler"
1194
+ }
1195
+ },
1196
+ Author: {
1197
+ ConflictDetection: "VERSION",
1198
+ ConflictHandler: ConflictHandlerType.AUTOMERGE
1199
+ }
1200
+ }
1201
+ },
1202
+ sandboxModeEnabled: true,
1203
+ transformers: [new ModelTransformer()]
1204
+ });
1205
+ const out = transformer.transform(validSchema);
1206
+ expect(out).toBeDefined();
1207
+ const schema = parse(out.schema);
1208
+ validateModelSchema(schema);
1209
+ // nested stacks for models
1210
+ const todoStack = out.stacks["Todo"];
1211
+ const authorStack = out.stacks["Author"];
1212
+ // Todo stack should have lambda for conflict detect rather than auto merge
1213
+ Template.fromJSON(todoStack).hasResourceProperties(
1214
+ "AWS::AppSync::FunctionConfiguration",
1215
+ {
1216
+ SyncConfig: {
1217
+ ConflictDetection: "VERSION",
1218
+ ConflictHandler: "LAMBDA",
1219
+ }
1220
+ }
1221
+ );
1222
+ Template.fromJSON(todoStack).resourcePropertiesCountIs(
1223
+ "AWS::AppSync::FunctionConfiguration",
1224
+ {
1225
+ SyncConfig: {
1226
+ ConflictDetection: "VERSION",
1227
+ ConflictHandler: "AUTOMERGE",
1228
+ }
1229
+ },
1230
+ 0
1231
+ );
1232
+ // Author stack should have automerge for conflict detect rather than lambda
1233
+ Template.fromJSON(authorStack).resourcePropertiesCountIs(
1234
+ "AWS::AppSync::FunctionConfiguration",
1235
+ {
1236
+ SyncConfig: {
1237
+ ConflictDetection: "VERSION",
1238
+ ConflictHandler: "LAMBDA",
1239
+ }
1240
+ },
1241
+ 0
1242
+ );
1243
+ Template.fromJSON(authorStack).hasResourceProperties(
1244
+ "AWS::AppSync::FunctionConfiguration",
1245
+ {
1246
+ SyncConfig: {
1247
+ ConflictDetection: "VERSION",
1248
+ ConflictHandler: "AUTOMERGE",
1249
+ }
1250
+ }
1251
+ );
1171
1252
 
1253
+ });
1172
1254
  it('should add the model parameters at the root sack', () => {
1173
1255
  const modelParams = {
1174
1256
  DynamoDBModelTableReadIOPS: expect.objectContaining({
package/src/directive.ts CHANGED
@@ -11,7 +11,7 @@ export enum SubscriptionLevel {
11
11
  }
12
12
 
13
13
  /**
14
- * ModelDirectiveConfiguration
14
+ * ModelDirectiveConfiguration.
15
15
  */
16
16
  export type ModelDirectiveConfiguration = {
17
17
  queries?: Partial<{