@aws-amplify/graphql-model-transformer 0.16.7 → 0.16.8
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,12 @@
|
|
|
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.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)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **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))
|
|
11
|
+
|
|
6
12
|
## [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)
|
|
7
13
|
|
|
8
14
|
**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": "0.16.
|
|
3
|
+
"version": "0.16.8",
|
|
4
4
|
"description": "Amplify graphql @model transformer",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"extract-api": "ts-node ../../scripts/extract-api.ts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aws-amplify/graphql-transformer-core": "0.18.
|
|
32
|
+
"@aws-amplify/graphql-transformer-core": "0.18.4",
|
|
33
33
|
"@aws-amplify/graphql-transformer-interfaces": "1.14.12",
|
|
34
34
|
"@aws-cdk/aws-applicationautoscaling": "~1.172.0",
|
|
35
35
|
"@aws-cdk/aws-appsync": "~1.172.0",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"overrides"
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "f1a6a2b90de01421f8aa1b5de524533bcc76c5a0"
|
|
76
76
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
verifyInputCount,
|
|
14
14
|
verifyMatchingTypes,
|
|
15
15
|
} from './test-utils/helpers';
|
|
16
|
-
import { expect as cdkExpect, haveResource } from '@aws-cdk/assert';
|
|
16
|
+
import { expect as cdkExpect, haveResource, haveResourceLike } from '@aws-cdk/assert';
|
|
17
17
|
|
|
18
18
|
const featureFlags = {
|
|
19
19
|
getBoolean: jest.fn(),
|
|
@@ -1170,7 +1170,95 @@ describe('ModelTransformer: ', () => {
|
|
|
1170
1170
|
}),
|
|
1171
1171
|
);
|
|
1172
1172
|
});
|
|
1173
|
+
it("the conflict detection of per model rule should be respected", () => {
|
|
1174
|
+
const validSchema = `
|
|
1175
|
+
type Todo @model {
|
|
1176
|
+
name: String
|
|
1177
|
+
}
|
|
1178
|
+
type Author @model {
|
|
1179
|
+
name: String
|
|
1180
|
+
}
|
|
1181
|
+
`;
|
|
1182
|
+
|
|
1183
|
+
const transformer = new GraphQLTransform({
|
|
1184
|
+
transformConfig: {},
|
|
1185
|
+
resolverConfig: {
|
|
1186
|
+
project: {
|
|
1187
|
+
ConflictDetection: "VERSION",
|
|
1188
|
+
ConflictHandler: ConflictHandlerType.AUTOMERGE
|
|
1189
|
+
},
|
|
1190
|
+
models: {
|
|
1191
|
+
Todo: {
|
|
1192
|
+
ConflictDetection: "VERSION",
|
|
1193
|
+
ConflictHandler: ConflictHandlerType.LAMBDA,
|
|
1194
|
+
LambdaConflictHandler: {
|
|
1195
|
+
name: "myTodoConflictHandler"
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
Author: {
|
|
1199
|
+
ConflictDetection: "VERSION",
|
|
1200
|
+
ConflictHandler: ConflictHandlerType.AUTOMERGE
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
},
|
|
1204
|
+
sandboxModeEnabled: true,
|
|
1205
|
+
transformers: [new ModelTransformer()]
|
|
1206
|
+
});
|
|
1207
|
+
const out = transformer.transform(validSchema);
|
|
1208
|
+
expect(out).toBeDefined();
|
|
1209
|
+
const schema = parse(out.schema);
|
|
1210
|
+
validateModelSchema(schema);
|
|
1211
|
+
// nested stacks for models
|
|
1212
|
+
const todoStack = out.stacks["Todo"];
|
|
1213
|
+
const authorStack = out.stacks["Author"];
|
|
1214
|
+
// Todo stack should have lambda for conflict detect rather than auto merge
|
|
1215
|
+
cdkExpect(todoStack).to(
|
|
1216
|
+
haveResourceLike(
|
|
1217
|
+
"AWS::AppSync::FunctionConfiguration",
|
|
1218
|
+
{
|
|
1219
|
+
SyncConfig: {
|
|
1220
|
+
ConflictDetection: "VERSION",
|
|
1221
|
+
ConflictHandler: "LAMBDA",
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
)
|
|
1225
|
+
);
|
|
1226
|
+
cdkExpect(todoStack).notTo(
|
|
1227
|
+
haveResourceLike(
|
|
1228
|
+
"AWS::AppSync::FunctionConfiguration",
|
|
1229
|
+
{
|
|
1230
|
+
SyncConfig: {
|
|
1231
|
+
ConflictDetection: "VERSION",
|
|
1232
|
+
ConflictHandler: "AUTOMERGE",
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
)
|
|
1236
|
+
);
|
|
1237
|
+
// Author stack should have automerge for conflict detect rather than lambda
|
|
1238
|
+
cdkExpect(authorStack).notTo(
|
|
1239
|
+
haveResourceLike(
|
|
1240
|
+
"AWS::AppSync::FunctionConfiguration",
|
|
1241
|
+
{
|
|
1242
|
+
SyncConfig: {
|
|
1243
|
+
ConflictDetection: "VERSION",
|
|
1244
|
+
ConflictHandler: "LAMBDA",
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
)
|
|
1248
|
+
);
|
|
1249
|
+
cdkExpect(authorStack).to(
|
|
1250
|
+
haveResourceLike(
|
|
1251
|
+
"AWS::AppSync::FunctionConfiguration",
|
|
1252
|
+
{
|
|
1253
|
+
SyncConfig: {
|
|
1254
|
+
ConflictDetection: "VERSION",
|
|
1255
|
+
ConflictHandler: "AUTOMERGE",
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
)
|
|
1259
|
+
);
|
|
1173
1260
|
|
|
1261
|
+
});
|
|
1174
1262
|
it('should add the model parameters at the root sack', () => {
|
|
1175
1263
|
const modelParams = {
|
|
1176
1264
|
DynamoDBModelTableReadIOPS: expect.objectContaining({
|