@graphql-inspector/action 5.0.16 → 5.0.17
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/cjs/core/src/diff/changes/directive-usage.js +4 -4
- package/cjs/core/src/diff/changes/schema.js +30 -12
- package/cjs/core/src/diff/rules/safe-unreachable.js +1 -1
- package/cjs/core/src/diff/rules/suppress-removal-of-deprecated-field.js +4 -4
- package/cjs/core/src/diff/schema.js +9 -9
- package/cjs/patch/src/patches/schema.js +57 -36
- package/esm/core/src/diff/changes/directive-usage.js +4 -4
- package/esm/core/src/diff/changes/schema.js +30 -12
- package/esm/core/src/diff/rules/safe-unreachable.js +1 -1
- package/esm/core/src/diff/rules/suppress-removal-of-deprecated-field.js +4 -4
- package/esm/core/src/diff/schema.js +11 -11
- package/esm/patch/src/patches/schema.js +57 -36
- package/package.json +2 -2
- package/typings/core/src/diff/changes/change.d.cts +6 -6
- package/typings/core/src/diff/changes/change.d.ts +6 -6
- package/typings/core/src/diff/changes/directive-usage.d.cts +1 -1
- package/typings/core/src/diff/changes/directive-usage.d.ts +1 -1
- package/typings/core/src/diff/changes/schema.d.cts +9 -9
- package/typings/core/src/diff/changes/schema.d.ts +9 -9
- package/typings/core/src/diff/index.d.cts +1 -1
- package/typings/core/src/diff/index.d.ts +1 -1
- package/typings/core/src/diff/rules/types.d.cts +2 -2
- package/typings/core/src/diff/rules/types.d.ts +2 -2
- package/typings/core/src/diff/schema.d.cts +1 -1
- package/typings/core/src/diff/schema.d.ts +1 -1
|
@@ -576,9 +576,9 @@ function directiveUsageAdded(kind, directive, payload, addedToNewType) {
|
|
|
576
576
|
type: change_js_1.ChangeType.DirectiveUsageSchemaAdded,
|
|
577
577
|
meta: {
|
|
578
578
|
addedDirectiveName: directive.name.value,
|
|
579
|
-
schemaTypeName: payload
|
|
579
|
+
schemaTypeName: payload?.getQueryType()?.name || '',
|
|
580
580
|
addedToNewType,
|
|
581
|
-
directiveRepeatedTimes: directiveRepeatTimes(payload
|
|
581
|
+
directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
|
|
582
582
|
},
|
|
583
583
|
});
|
|
584
584
|
}
|
|
@@ -731,8 +731,8 @@ function directiveUsageRemoved(kind, directive, payload) {
|
|
|
731
731
|
type: change_js_1.ChangeType.DirectiveUsageSchemaRemoved,
|
|
732
732
|
meta: {
|
|
733
733
|
removedDirectiveName: directive.name.value,
|
|
734
|
-
schemaTypeName: payload
|
|
735
|
-
directiveRepeatedTimes: directiveRepeatTimes(payload
|
|
734
|
+
schemaTypeName: payload?.getQueryType()?.name || '',
|
|
735
|
+
directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
|
|
736
736
|
},
|
|
737
737
|
});
|
|
738
738
|
}
|
|
@@ -8,13 +8,19 @@ exports.schemaSubscriptionTypeChangedFromMeta = schemaSubscriptionTypeChangedFro
|
|
|
8
8
|
exports.schemaSubscriptionTypeChanged = schemaSubscriptionTypeChanged;
|
|
9
9
|
const change_js_1 = require("./change.js");
|
|
10
10
|
function buildSchemaQueryTypeChangedMessage(args) {
|
|
11
|
-
|
|
11
|
+
if (args.oldQueryTypeName === null) {
|
|
12
|
+
return `Schema query root type was set to '${args.newQueryTypeName}'.`;
|
|
13
|
+
}
|
|
14
|
+
if (args.newQueryTypeName === null) {
|
|
15
|
+
return `Schema query root type '${args.oldQueryTypeName}' was removed.`;
|
|
16
|
+
}
|
|
17
|
+
return `Schema query root type was changed from '${args.oldQueryTypeName}' to '${args.newQueryTypeName}'`;
|
|
12
18
|
}
|
|
13
19
|
function schemaQueryTypeChangedFromMeta(args) {
|
|
14
20
|
return {
|
|
15
21
|
type: change_js_1.ChangeType.SchemaQueryTypeChanged,
|
|
16
22
|
criticality: {
|
|
17
|
-
level: args.meta.oldQueryTypeName ===
|
|
23
|
+
level: args.meta.oldQueryTypeName === null
|
|
18
24
|
? change_js_1.CriticalityLevel.NonBreaking
|
|
19
25
|
: change_js_1.CriticalityLevel.Breaking,
|
|
20
26
|
},
|
|
@@ -23,8 +29,8 @@ function schemaQueryTypeChangedFromMeta(args) {
|
|
|
23
29
|
};
|
|
24
30
|
}
|
|
25
31
|
function schemaQueryTypeChanged(oldSchema, newSchema) {
|
|
26
|
-
const oldName =
|
|
27
|
-
const newName =
|
|
32
|
+
const oldName = oldSchema?.getQueryType()?.name || null;
|
|
33
|
+
const newName = newSchema?.getQueryType()?.name || null;
|
|
28
34
|
return schemaQueryTypeChangedFromMeta({
|
|
29
35
|
type: change_js_1.ChangeType.SchemaQueryTypeChanged,
|
|
30
36
|
meta: {
|
|
@@ -34,13 +40,19 @@ function schemaQueryTypeChanged(oldSchema, newSchema) {
|
|
|
34
40
|
});
|
|
35
41
|
}
|
|
36
42
|
function buildSchemaMutationTypeChangedMessage(args) {
|
|
37
|
-
|
|
43
|
+
if (args.oldMutationTypeName === null) {
|
|
44
|
+
return `Schema mutation type was set to '${args.newMutationTypeName}'.`;
|
|
45
|
+
}
|
|
46
|
+
if (args.newMutationTypeName === null) {
|
|
47
|
+
return `Schema mutation type '${args.oldMutationTypeName}' was removed.`;
|
|
48
|
+
}
|
|
49
|
+
return `Schema mutation type was changed from '${args.oldMutationTypeName}' to '${args.newMutationTypeName}'`;
|
|
38
50
|
}
|
|
39
51
|
function schemaMutationTypeChangedFromMeta(args) {
|
|
40
52
|
return {
|
|
41
53
|
type: change_js_1.ChangeType.SchemaMutationTypeChanged,
|
|
42
54
|
criticality: {
|
|
43
|
-
level: args.meta.oldMutationTypeName ===
|
|
55
|
+
level: args.meta.oldMutationTypeName === null
|
|
44
56
|
? change_js_1.CriticalityLevel.NonBreaking
|
|
45
57
|
: change_js_1.CriticalityLevel.Breaking,
|
|
46
58
|
},
|
|
@@ -49,8 +61,8 @@ function schemaMutationTypeChangedFromMeta(args) {
|
|
|
49
61
|
};
|
|
50
62
|
}
|
|
51
63
|
function schemaMutationTypeChanged(oldSchema, newSchema) {
|
|
52
|
-
const oldName =
|
|
53
|
-
const newName =
|
|
64
|
+
const oldName = oldSchema?.getMutationType()?.name || null;
|
|
65
|
+
const newName = newSchema?.getMutationType()?.name || null;
|
|
54
66
|
return schemaMutationTypeChangedFromMeta({
|
|
55
67
|
type: change_js_1.ChangeType.SchemaMutationTypeChanged,
|
|
56
68
|
meta: {
|
|
@@ -60,13 +72,19 @@ function schemaMutationTypeChanged(oldSchema, newSchema) {
|
|
|
60
72
|
});
|
|
61
73
|
}
|
|
62
74
|
function buildSchemaSubscriptionTypeChangedMessage(args) {
|
|
63
|
-
|
|
75
|
+
if (args.oldSubscriptionTypeName === null) {
|
|
76
|
+
return `Schema subscription type was set to '${args.newSubscriptionTypeName}'.`;
|
|
77
|
+
}
|
|
78
|
+
if (args.newSubscriptionTypeName === null) {
|
|
79
|
+
return `Schema subscription type '${args.oldSubscriptionTypeName}' was removed.`;
|
|
80
|
+
}
|
|
81
|
+
return `Schema subscription type was changed from '${args.oldSubscriptionTypeName}' to '${args.newSubscriptionTypeName}'`;
|
|
64
82
|
}
|
|
65
83
|
function schemaSubscriptionTypeChangedFromMeta(args) {
|
|
66
84
|
return {
|
|
67
85
|
type: change_js_1.ChangeType.SchemaSubscriptionTypeChanged,
|
|
68
86
|
criticality: {
|
|
69
|
-
level: args.meta.oldSubscriptionTypeName ===
|
|
87
|
+
level: args.meta.oldSubscriptionTypeName === null
|
|
70
88
|
? change_js_1.CriticalityLevel.NonBreaking
|
|
71
89
|
: change_js_1.CriticalityLevel.Breaking,
|
|
72
90
|
},
|
|
@@ -75,8 +93,8 @@ function schemaSubscriptionTypeChangedFromMeta(args) {
|
|
|
75
93
|
};
|
|
76
94
|
}
|
|
77
95
|
function schemaSubscriptionTypeChanged(oldSchema, newSchema) {
|
|
78
|
-
const oldName =
|
|
79
|
-
const newName =
|
|
96
|
+
const oldName = oldSchema?.getSubscriptionType()?.name || null;
|
|
97
|
+
const newName = newSchema?.getSubscriptionType()?.name || null;
|
|
80
98
|
return schemaSubscriptionTypeChangedFromMeta({
|
|
81
99
|
type: change_js_1.ChangeType.SchemaSubscriptionTypeChanged,
|
|
82
100
|
meta: {
|
|
@@ -5,7 +5,7 @@ const graphql_js_1 = require("../../utils/graphql.js");
|
|
|
5
5
|
const path_js_1 = require("../../utils/path.js");
|
|
6
6
|
const change_js_1 = require("../changes/change.js");
|
|
7
7
|
const safeUnreachable = ({ changes, oldSchema }) => {
|
|
8
|
-
const reachable = (0, graphql_js_1.getReachableTypes)(oldSchema);
|
|
8
|
+
const reachable = oldSchema ? (0, graphql_js_1.getReachableTypes)(oldSchema) : new Set();
|
|
9
9
|
return changes.map(change => {
|
|
10
10
|
if (change.criticality.level === change_js_1.CriticalityLevel.Breaking && change.path) {
|
|
11
11
|
const [typeName] = (0, path_js_1.parsePath)(change.path);
|
|
@@ -11,7 +11,7 @@ const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema }) =>
|
|
|
11
11
|
change.criticality.level === change_js_1.CriticalityLevel.Breaking &&
|
|
12
12
|
change.path) {
|
|
13
13
|
const [typeName, fieldName] = (0, path_js_1.parsePath)(change.path);
|
|
14
|
-
const type = oldSchema
|
|
14
|
+
const type = oldSchema?.getType(typeName);
|
|
15
15
|
if ((0, graphql_1.isObjectType)(type) || (0, graphql_1.isInterfaceType)(type)) {
|
|
16
16
|
const field = type.getFields()[fieldName];
|
|
17
17
|
if ((0, is_deprecated_js_1.isDeprecated)(field)) {
|
|
@@ -29,7 +29,7 @@ const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema }) =>
|
|
|
29
29
|
change.criticality.level === change_js_1.CriticalityLevel.Breaking &&
|
|
30
30
|
change.path) {
|
|
31
31
|
const [enumName, enumItem] = (0, path_js_1.parsePath)(change.path);
|
|
32
|
-
const type = oldSchema
|
|
32
|
+
const type = oldSchema?.getType(enumName);
|
|
33
33
|
if ((0, graphql_1.isEnumType)(type)) {
|
|
34
34
|
const item = type.getValue(enumItem);
|
|
35
35
|
if (item && (0, is_deprecated_js_1.isDeprecated)(item)) {
|
|
@@ -47,7 +47,7 @@ const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema }) =>
|
|
|
47
47
|
change.criticality.level === change_js_1.CriticalityLevel.Breaking &&
|
|
48
48
|
change.path) {
|
|
49
49
|
const [inputName, inputItem] = (0, path_js_1.parsePath)(change.path);
|
|
50
|
-
const type = oldSchema
|
|
50
|
+
const type = oldSchema?.getType(inputName);
|
|
51
51
|
if ((0, graphql_1.isInputObjectType)(type)) {
|
|
52
52
|
const item = type.getFields()[inputItem];
|
|
53
53
|
if (item && (0, is_deprecated_js_1.isDeprecated)(item)) {
|
|
@@ -65,7 +65,7 @@ const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema }) =>
|
|
|
65
65
|
change.criticality.level === change_js_1.CriticalityLevel.Breaking &&
|
|
66
66
|
change.path) {
|
|
67
67
|
const [typeName] = (0, path_js_1.parsePath)(change.path);
|
|
68
|
-
const type = newSchema
|
|
68
|
+
const type = newSchema?.getType(typeName);
|
|
69
69
|
if (!type) {
|
|
70
70
|
return {
|
|
71
71
|
...change,
|
|
@@ -21,7 +21,7 @@ function diffSchema(oldSchema, newSchema) {
|
|
|
21
21
|
changes.push(change);
|
|
22
22
|
}
|
|
23
23
|
changesInSchema(oldSchema, newSchema, addChange);
|
|
24
|
-
(0, compare_js_1.compareLists)(Object.values(oldSchema
|
|
24
|
+
(0, compare_js_1.compareLists)(Object.values(oldSchema?.getTypeMap() ?? {}).filter(t => !(0, graphql_js_1.isPrimitive)(t) && !(0, graphql_js_1.isForIntrospection)(t)), Object.values(newSchema?.getTypeMap() ?? {}).filter(t => !(0, graphql_js_1.isPrimitive)(t) && !(0, graphql_js_1.isForIntrospection)(t)), {
|
|
25
25
|
onAdded(type) {
|
|
26
26
|
addChange((0, type_js_1.typeAdded)(type));
|
|
27
27
|
changesInType(null, type, addChange);
|
|
@@ -33,7 +33,7 @@ function diffSchema(oldSchema, newSchema) {
|
|
|
33
33
|
changesInType(type.oldVersion, type.newVersion, addChange);
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
|
-
(0, compare_js_1.compareLists)(oldSchema
|
|
36
|
+
(0, compare_js_1.compareLists)((oldSchema?.getDirectives() ?? []).filter(t => !(0, graphql_1.isSpecifiedDirective)(t)), (newSchema?.getDirectives() ?? []).filter(t => !(0, graphql_1.isSpecifiedDirective)(t)), {
|
|
37
37
|
onAdded(directive) {
|
|
38
38
|
addChange((0, directive_js_1.directiveAdded)(directive));
|
|
39
39
|
(0, directive_js_2.changesInDirective)(null, directive, addChange);
|
|
@@ -45,7 +45,7 @@ function diffSchema(oldSchema, newSchema) {
|
|
|
45
45
|
(0, directive_js_2.changesInDirective)(directive.oldVersion, directive.newVersion, addChange);
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
|
-
(0, compare_js_1.compareDirectiveLists)(oldSchema
|
|
48
|
+
(0, compare_js_1.compareDirectiveLists)(oldSchema?.astNode?.directives || [], newSchema?.astNode?.directives || [], {
|
|
49
49
|
onAdded(directive) {
|
|
50
50
|
addChange((0, directive_usage_js_1.directiveUsageAdded)(graphql_1.Kind.SCHEMA_DEFINITION, directive, newSchema, false));
|
|
51
51
|
(0, directive_usage_js_1.directiveUsageChanged)(null, directive, addChange);
|
|
@@ -61,14 +61,14 @@ function diffSchema(oldSchema, newSchema) {
|
|
|
61
61
|
}
|
|
62
62
|
function changesInSchema(oldSchema, newSchema, addChange) {
|
|
63
63
|
const oldRoot = {
|
|
64
|
-
query: (oldSchema
|
|
65
|
-
mutation: (oldSchema
|
|
66
|
-
subscription: (oldSchema
|
|
64
|
+
query: (oldSchema?.getQueryType() || {}).name,
|
|
65
|
+
mutation: (oldSchema?.getMutationType() || {}).name,
|
|
66
|
+
subscription: (oldSchema?.getSubscriptionType() || {}).name,
|
|
67
67
|
};
|
|
68
68
|
const newRoot = {
|
|
69
|
-
query: (newSchema
|
|
70
|
-
mutation: (newSchema
|
|
71
|
-
subscription: (newSchema
|
|
69
|
+
query: (newSchema?.getQueryType() || {}).name,
|
|
70
|
+
mutation: (newSchema?.getMutationType() || {}).name,
|
|
71
|
+
subscription: (newSchema?.getSubscriptionType() || {}).name,
|
|
72
72
|
};
|
|
73
73
|
if ((0, compare_js_1.isNotEqual)(oldRoot.query, newRoot.query)) {
|
|
74
74
|
addChange((0, schema_js_1.schemaQueryTypeChanged)(oldSchema, newSchema));
|
|
@@ -11,25 +11,32 @@ function schemaMutationTypeChanged(change, schemaNodes, config, _context) {
|
|
|
11
11
|
for (const schemaNode of schemaNodes) {
|
|
12
12
|
const mutation = schemaNode.operationTypes?.find(({ operation }) => operation === graphql_1.OperationTypeNode.MUTATION);
|
|
13
13
|
if (!mutation) {
|
|
14
|
-
if (change.meta.oldMutationTypeName !==
|
|
15
|
-
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldMutationTypeName,
|
|
14
|
+
if (change.meta.oldMutationTypeName !== null) {
|
|
15
|
+
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldMutationTypeName, null), change);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
if (change.meta.newMutationTypeName) {
|
|
18
|
+
schemaNode.operationTypes = [
|
|
19
|
+
...(schemaNode.operationTypes ?? []),
|
|
20
|
+
{
|
|
21
|
+
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION,
|
|
22
|
+
operation: graphql_1.OperationTypeNode.MUTATION,
|
|
23
|
+
type: {
|
|
24
|
+
kind: graphql_1.Kind.NAMED_TYPE,
|
|
25
|
+
name: (0, node_templates_js_1.nameNode)(change.meta.newMutationTypeName),
|
|
26
|
+
},
|
|
25
27
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
];
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
else {
|
|
30
32
|
if (mutation.type.name.value !== change.meta.oldMutationTypeName) {
|
|
31
33
|
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldMutationTypeName, mutation?.type.name.value), change);
|
|
32
34
|
}
|
|
35
|
+
if (change.meta.newMutationTypeName === null) {
|
|
36
|
+
schemaNode.operationTypes =
|
|
37
|
+
schemaNode.operationTypes?.filter(({ operation }) => operation !== graphql_1.OperationTypeNode.MUTATION);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
33
40
|
mutation.type.name = (0, node_templates_js_1.nameNode)(change.meta.newMutationTypeName);
|
|
34
41
|
}
|
|
35
42
|
}
|
|
@@ -38,25 +45,32 @@ function schemaQueryTypeChanged(change, schemaNodes, config, _context) {
|
|
|
38
45
|
for (const schemaNode of schemaNodes) {
|
|
39
46
|
const query = schemaNode.operationTypes?.find(({ operation }) => operation === graphql_1.OperationTypeNode.MUTATION);
|
|
40
47
|
if (!query) {
|
|
41
|
-
if (change.meta.oldQueryTypeName !==
|
|
42
|
-
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldQueryTypeName,
|
|
48
|
+
if (change.meta.oldQueryTypeName !== null) {
|
|
49
|
+
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldQueryTypeName, null), change);
|
|
43
50
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
if (change.meta.newQueryTypeName) {
|
|
52
|
+
schemaNode.operationTypes = [
|
|
53
|
+
...(schemaNode.operationTypes ?? []),
|
|
54
|
+
{
|
|
55
|
+
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION,
|
|
56
|
+
operation: graphql_1.OperationTypeNode.QUERY,
|
|
57
|
+
type: {
|
|
58
|
+
kind: graphql_1.Kind.NAMED_TYPE,
|
|
59
|
+
name: (0, node_templates_js_1.nameNode)(change.meta.newQueryTypeName),
|
|
60
|
+
},
|
|
52
61
|
},
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
];
|
|
63
|
+
}
|
|
55
64
|
}
|
|
56
65
|
else {
|
|
57
66
|
if (query.type.name.value !== change.meta.oldQueryTypeName) {
|
|
58
67
|
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldQueryTypeName, query?.type.name.value), change);
|
|
59
68
|
}
|
|
69
|
+
if (change.meta.newQueryTypeName === null) {
|
|
70
|
+
schemaNode.operationTypes =
|
|
71
|
+
schemaNode.operationTypes?.filter(({ operation }) => operation !== graphql_1.OperationTypeNode.QUERY);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
60
74
|
query.type.name = (0, node_templates_js_1.nameNode)(change.meta.newQueryTypeName);
|
|
61
75
|
}
|
|
62
76
|
}
|
|
@@ -65,25 +79,32 @@ function schemaSubscriptionTypeChanged(change, schemaNodes, config, _context) {
|
|
|
65
79
|
for (const schemaNode of schemaNodes) {
|
|
66
80
|
const sub = schemaNode.operationTypes?.find(({ operation }) => operation === graphql_1.OperationTypeNode.SUBSCRIPTION);
|
|
67
81
|
if (!sub) {
|
|
68
|
-
if (change.meta.oldSubscriptionTypeName !==
|
|
69
|
-
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldSubscriptionTypeName,
|
|
82
|
+
if (change.meta.oldSubscriptionTypeName !== null) {
|
|
83
|
+
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldSubscriptionTypeName, null), change);
|
|
70
84
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
if (change.meta.newSubscriptionTypeName) {
|
|
86
|
+
schemaNode.operationTypes = [
|
|
87
|
+
...(schemaNode.operationTypes ?? []),
|
|
88
|
+
{
|
|
89
|
+
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION,
|
|
90
|
+
operation: graphql_1.OperationTypeNode.QUERY,
|
|
91
|
+
type: {
|
|
92
|
+
kind: graphql_1.Kind.NAMED_TYPE,
|
|
93
|
+
name: (0, node_templates_js_1.nameNode)(change.meta.newSubscriptionTypeName),
|
|
94
|
+
},
|
|
79
95
|
},
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
];
|
|
97
|
+
}
|
|
82
98
|
}
|
|
83
99
|
else {
|
|
84
100
|
if (sub.type.name.value !== change.meta.oldSubscriptionTypeName) {
|
|
85
101
|
config.onError(new errors_js_1.ValueMismatchError(graphql_1.Kind.SCHEMA_DEFINITION, change.meta.oldSubscriptionTypeName, sub?.type.name.value), change);
|
|
86
102
|
}
|
|
103
|
+
if (change.meta.newSubscriptionTypeName === null) {
|
|
104
|
+
schemaNode.operationTypes =
|
|
105
|
+
schemaNode.operationTypes?.filter(({ operation }) => operation !== graphql_1.OperationTypeNode.SUBSCRIPTION);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
87
108
|
sub.type.name = (0, node_templates_js_1.nameNode)(change.meta.newSubscriptionTypeName);
|
|
88
109
|
}
|
|
89
110
|
}
|
|
@@ -545,9 +545,9 @@ export function directiveUsageAdded(kind, directive, payload, addedToNewType) {
|
|
|
545
545
|
type: ChangeType.DirectiveUsageSchemaAdded,
|
|
546
546
|
meta: {
|
|
547
547
|
addedDirectiveName: directive.name.value,
|
|
548
|
-
schemaTypeName: payload
|
|
548
|
+
schemaTypeName: payload?.getQueryType()?.name || '',
|
|
549
549
|
addedToNewType,
|
|
550
|
-
directiveRepeatedTimes: directiveRepeatTimes(payload
|
|
550
|
+
directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
|
|
551
551
|
},
|
|
552
552
|
});
|
|
553
553
|
}
|
|
@@ -700,8 +700,8 @@ export function directiveUsageRemoved(kind, directive, payload) {
|
|
|
700
700
|
type: ChangeType.DirectiveUsageSchemaRemoved,
|
|
701
701
|
meta: {
|
|
702
702
|
removedDirectiveName: directive.name.value,
|
|
703
|
-
schemaTypeName: payload
|
|
704
|
-
directiveRepeatedTimes: directiveRepeatTimes(payload
|
|
703
|
+
schemaTypeName: payload?.getQueryType()?.name || '',
|
|
704
|
+
directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
|
|
705
705
|
},
|
|
706
706
|
});
|
|
707
707
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { ChangeType, CriticalityLevel, } from './change.js';
|
|
2
2
|
function buildSchemaQueryTypeChangedMessage(args) {
|
|
3
|
-
|
|
3
|
+
if (args.oldQueryTypeName === null) {
|
|
4
|
+
return `Schema query root type was set to '${args.newQueryTypeName}'.`;
|
|
5
|
+
}
|
|
6
|
+
if (args.newQueryTypeName === null) {
|
|
7
|
+
return `Schema query root type '${args.oldQueryTypeName}' was removed.`;
|
|
8
|
+
}
|
|
9
|
+
return `Schema query root type was changed from '${args.oldQueryTypeName}' to '${args.newQueryTypeName}'`;
|
|
4
10
|
}
|
|
5
11
|
export function schemaQueryTypeChangedFromMeta(args) {
|
|
6
12
|
return {
|
|
7
13
|
type: ChangeType.SchemaQueryTypeChanged,
|
|
8
14
|
criticality: {
|
|
9
|
-
level: args.meta.oldQueryTypeName ===
|
|
15
|
+
level: args.meta.oldQueryTypeName === null
|
|
10
16
|
? CriticalityLevel.NonBreaking
|
|
11
17
|
: CriticalityLevel.Breaking,
|
|
12
18
|
},
|
|
@@ -15,8 +21,8 @@ export function schemaQueryTypeChangedFromMeta(args) {
|
|
|
15
21
|
};
|
|
16
22
|
}
|
|
17
23
|
export function schemaQueryTypeChanged(oldSchema, newSchema) {
|
|
18
|
-
const oldName =
|
|
19
|
-
const newName =
|
|
24
|
+
const oldName = oldSchema?.getQueryType()?.name || null;
|
|
25
|
+
const newName = newSchema?.getQueryType()?.name || null;
|
|
20
26
|
return schemaQueryTypeChangedFromMeta({
|
|
21
27
|
type: ChangeType.SchemaQueryTypeChanged,
|
|
22
28
|
meta: {
|
|
@@ -26,13 +32,19 @@ export function schemaQueryTypeChanged(oldSchema, newSchema) {
|
|
|
26
32
|
});
|
|
27
33
|
}
|
|
28
34
|
function buildSchemaMutationTypeChangedMessage(args) {
|
|
29
|
-
|
|
35
|
+
if (args.oldMutationTypeName === null) {
|
|
36
|
+
return `Schema mutation type was set to '${args.newMutationTypeName}'.`;
|
|
37
|
+
}
|
|
38
|
+
if (args.newMutationTypeName === null) {
|
|
39
|
+
return `Schema mutation type '${args.oldMutationTypeName}' was removed.`;
|
|
40
|
+
}
|
|
41
|
+
return `Schema mutation type was changed from '${args.oldMutationTypeName}' to '${args.newMutationTypeName}'`;
|
|
30
42
|
}
|
|
31
43
|
export function schemaMutationTypeChangedFromMeta(args) {
|
|
32
44
|
return {
|
|
33
45
|
type: ChangeType.SchemaMutationTypeChanged,
|
|
34
46
|
criticality: {
|
|
35
|
-
level: args.meta.oldMutationTypeName ===
|
|
47
|
+
level: args.meta.oldMutationTypeName === null
|
|
36
48
|
? CriticalityLevel.NonBreaking
|
|
37
49
|
: CriticalityLevel.Breaking,
|
|
38
50
|
},
|
|
@@ -41,8 +53,8 @@ export function schemaMutationTypeChangedFromMeta(args) {
|
|
|
41
53
|
};
|
|
42
54
|
}
|
|
43
55
|
export function schemaMutationTypeChanged(oldSchema, newSchema) {
|
|
44
|
-
const oldName =
|
|
45
|
-
const newName =
|
|
56
|
+
const oldName = oldSchema?.getMutationType()?.name || null;
|
|
57
|
+
const newName = newSchema?.getMutationType()?.name || null;
|
|
46
58
|
return schemaMutationTypeChangedFromMeta({
|
|
47
59
|
type: ChangeType.SchemaMutationTypeChanged,
|
|
48
60
|
meta: {
|
|
@@ -52,13 +64,19 @@ export function schemaMutationTypeChanged(oldSchema, newSchema) {
|
|
|
52
64
|
});
|
|
53
65
|
}
|
|
54
66
|
function buildSchemaSubscriptionTypeChangedMessage(args) {
|
|
55
|
-
|
|
67
|
+
if (args.oldSubscriptionTypeName === null) {
|
|
68
|
+
return `Schema subscription type was set to '${args.newSubscriptionTypeName}'.`;
|
|
69
|
+
}
|
|
70
|
+
if (args.newSubscriptionTypeName === null) {
|
|
71
|
+
return `Schema subscription type '${args.oldSubscriptionTypeName}' was removed.`;
|
|
72
|
+
}
|
|
73
|
+
return `Schema subscription type was changed from '${args.oldSubscriptionTypeName}' to '${args.newSubscriptionTypeName}'`;
|
|
56
74
|
}
|
|
57
75
|
export function schemaSubscriptionTypeChangedFromMeta(args) {
|
|
58
76
|
return {
|
|
59
77
|
type: ChangeType.SchemaSubscriptionTypeChanged,
|
|
60
78
|
criticality: {
|
|
61
|
-
level: args.meta.oldSubscriptionTypeName ===
|
|
79
|
+
level: args.meta.oldSubscriptionTypeName === null
|
|
62
80
|
? CriticalityLevel.NonBreaking
|
|
63
81
|
: CriticalityLevel.Breaking,
|
|
64
82
|
},
|
|
@@ -67,8 +85,8 @@ export function schemaSubscriptionTypeChangedFromMeta(args) {
|
|
|
67
85
|
};
|
|
68
86
|
}
|
|
69
87
|
export function schemaSubscriptionTypeChanged(oldSchema, newSchema) {
|
|
70
|
-
const oldName =
|
|
71
|
-
const newName =
|
|
88
|
+
const oldName = oldSchema?.getSubscriptionType()?.name || null;
|
|
89
|
+
const newName = newSchema?.getSubscriptionType()?.name || null;
|
|
72
90
|
return schemaSubscriptionTypeChangedFromMeta({
|
|
73
91
|
type: ChangeType.SchemaSubscriptionTypeChanged,
|
|
74
92
|
meta: {
|
|
@@ -2,7 +2,7 @@ import { getReachableTypes } from '../../utils/graphql.js';
|
|
|
2
2
|
import { parsePath } from '../../utils/path.js';
|
|
3
3
|
import { CriticalityLevel } from '../changes/change.js';
|
|
4
4
|
export const safeUnreachable = ({ changes, oldSchema }) => {
|
|
5
|
-
const reachable = getReachableTypes(oldSchema);
|
|
5
|
+
const reachable = oldSchema ? getReachableTypes(oldSchema) : new Set();
|
|
6
6
|
return changes.map(change => {
|
|
7
7
|
if (change.criticality.level === CriticalityLevel.Breaking && change.path) {
|
|
8
8
|
const [typeName] = parsePath(change.path);
|
|
@@ -8,7 +8,7 @@ export const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema
|
|
|
8
8
|
change.criticality.level === CriticalityLevel.Breaking &&
|
|
9
9
|
change.path) {
|
|
10
10
|
const [typeName, fieldName] = parsePath(change.path);
|
|
11
|
-
const type = oldSchema
|
|
11
|
+
const type = oldSchema?.getType(typeName);
|
|
12
12
|
if (isObjectType(type) || isInterfaceType(type)) {
|
|
13
13
|
const field = type.getFields()[fieldName];
|
|
14
14
|
if (isDeprecated(field)) {
|
|
@@ -26,7 +26,7 @@ export const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema
|
|
|
26
26
|
change.criticality.level === CriticalityLevel.Breaking &&
|
|
27
27
|
change.path) {
|
|
28
28
|
const [enumName, enumItem] = parsePath(change.path);
|
|
29
|
-
const type = oldSchema
|
|
29
|
+
const type = oldSchema?.getType(enumName);
|
|
30
30
|
if (isEnumType(type)) {
|
|
31
31
|
const item = type.getValue(enumItem);
|
|
32
32
|
if (item && isDeprecated(item)) {
|
|
@@ -44,7 +44,7 @@ export const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema
|
|
|
44
44
|
change.criticality.level === CriticalityLevel.Breaking &&
|
|
45
45
|
change.path) {
|
|
46
46
|
const [inputName, inputItem] = parsePath(change.path);
|
|
47
|
-
const type = oldSchema
|
|
47
|
+
const type = oldSchema?.getType(inputName);
|
|
48
48
|
if (isInputObjectType(type)) {
|
|
49
49
|
const item = type.getFields()[inputItem];
|
|
50
50
|
if (item && isDeprecated(item)) {
|
|
@@ -62,7 +62,7 @@ export const suppressRemovalOfDeprecatedField = ({ changes, oldSchema, newSchema
|
|
|
62
62
|
change.criticality.level === CriticalityLevel.Breaking &&
|
|
63
63
|
change.path) {
|
|
64
64
|
const [typeName] = parsePath(change.path);
|
|
65
|
-
const type = newSchema
|
|
65
|
+
const type = newSchema?.getType(typeName);
|
|
66
66
|
if (!type) {
|
|
67
67
|
return {
|
|
68
68
|
...change,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isEnumType, isInputObjectType, isInterfaceType, isObjectType, isScalarType, isUnionType, Kind, } from 'graphql';
|
|
1
|
+
import { isEnumType, isInputObjectType, isInterfaceType, isObjectType, isScalarType, isSpecifiedDirective, isUnionType, Kind, } from 'graphql';
|
|
2
2
|
import { compareDirectiveLists, compareLists, isNotEqual, isVoid } from '../utils/compare.js';
|
|
3
|
-
import { isPrimitive } from '../utils/graphql.js';
|
|
3
|
+
import { isForIntrospection, isPrimitive } from '../utils/graphql.js';
|
|
4
4
|
import { directiveUsageAdded, directiveUsageChanged, directiveUsageRemoved, } from './changes/directive-usage.js';
|
|
5
5
|
import { directiveAdded, directiveRemoved } from './changes/directive.js';
|
|
6
6
|
import { schemaMutationTypeChanged, schemaQueryTypeChanged, schemaSubscriptionTypeChanged, } from './changes/schema.js';
|
|
@@ -18,7 +18,7 @@ export function diffSchema(oldSchema, newSchema) {
|
|
|
18
18
|
changes.push(change);
|
|
19
19
|
}
|
|
20
20
|
changesInSchema(oldSchema, newSchema, addChange);
|
|
21
|
-
compareLists(Object.values(oldSchema
|
|
21
|
+
compareLists(Object.values(oldSchema?.getTypeMap() ?? {}).filter(t => !isPrimitive(t) && !isForIntrospection(t)), Object.values(newSchema?.getTypeMap() ?? {}).filter(t => !isPrimitive(t) && !isForIntrospection(t)), {
|
|
22
22
|
onAdded(type) {
|
|
23
23
|
addChange(typeAdded(type));
|
|
24
24
|
changesInType(null, type, addChange);
|
|
@@ -30,7 +30,7 @@ export function diffSchema(oldSchema, newSchema) {
|
|
|
30
30
|
changesInType(type.oldVersion, type.newVersion, addChange);
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
|
-
compareLists(oldSchema
|
|
33
|
+
compareLists((oldSchema?.getDirectives() ?? []).filter(t => !isSpecifiedDirective(t)), (newSchema?.getDirectives() ?? []).filter(t => !isSpecifiedDirective(t)), {
|
|
34
34
|
onAdded(directive) {
|
|
35
35
|
addChange(directiveAdded(directive));
|
|
36
36
|
changesInDirective(null, directive, addChange);
|
|
@@ -42,7 +42,7 @@ export function diffSchema(oldSchema, newSchema) {
|
|
|
42
42
|
changesInDirective(directive.oldVersion, directive.newVersion, addChange);
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
|
-
compareDirectiveLists(oldSchema
|
|
45
|
+
compareDirectiveLists(oldSchema?.astNode?.directives || [], newSchema?.astNode?.directives || [], {
|
|
46
46
|
onAdded(directive) {
|
|
47
47
|
addChange(directiveUsageAdded(Kind.SCHEMA_DEFINITION, directive, newSchema, false));
|
|
48
48
|
directiveUsageChanged(null, directive, addChange);
|
|
@@ -58,14 +58,14 @@ export function diffSchema(oldSchema, newSchema) {
|
|
|
58
58
|
}
|
|
59
59
|
function changesInSchema(oldSchema, newSchema, addChange) {
|
|
60
60
|
const oldRoot = {
|
|
61
|
-
query: (oldSchema
|
|
62
|
-
mutation: (oldSchema
|
|
63
|
-
subscription: (oldSchema
|
|
61
|
+
query: (oldSchema?.getQueryType() || {}).name,
|
|
62
|
+
mutation: (oldSchema?.getMutationType() || {}).name,
|
|
63
|
+
subscription: (oldSchema?.getSubscriptionType() || {}).name,
|
|
64
64
|
};
|
|
65
65
|
const newRoot = {
|
|
66
|
-
query: (newSchema
|
|
67
|
-
mutation: (newSchema
|
|
68
|
-
subscription: (newSchema
|
|
66
|
+
query: (newSchema?.getQueryType() || {}).name,
|
|
67
|
+
mutation: (newSchema?.getMutationType() || {}).name,
|
|
68
|
+
subscription: (newSchema?.getSubscriptionType() || {}).name,
|
|
69
69
|
};
|
|
70
70
|
if (isNotEqual(oldRoot.query, newRoot.query)) {
|
|
71
71
|
addChange(schemaQueryTypeChanged(oldSchema, newSchema));
|
|
@@ -6,25 +6,32 @@ export function schemaMutationTypeChanged(change, schemaNodes, config, _context)
|
|
|
6
6
|
for (const schemaNode of schemaNodes) {
|
|
7
7
|
const mutation = schemaNode.operationTypes?.find(({ operation }) => operation === OperationTypeNode.MUTATION);
|
|
8
8
|
if (!mutation) {
|
|
9
|
-
if (change.meta.oldMutationTypeName !==
|
|
10
|
-
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldMutationTypeName,
|
|
9
|
+
if (change.meta.oldMutationTypeName !== null) {
|
|
10
|
+
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldMutationTypeName, null), change);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
if (change.meta.newMutationTypeName) {
|
|
13
|
+
schemaNode.operationTypes = [
|
|
14
|
+
...(schemaNode.operationTypes ?? []),
|
|
15
|
+
{
|
|
16
|
+
kind: Kind.OPERATION_TYPE_DEFINITION,
|
|
17
|
+
operation: OperationTypeNode.MUTATION,
|
|
18
|
+
type: {
|
|
19
|
+
kind: Kind.NAMED_TYPE,
|
|
20
|
+
name: nameNode(change.meta.newMutationTypeName),
|
|
21
|
+
},
|
|
20
22
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
];
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
else {
|
|
25
27
|
if (mutation.type.name.value !== change.meta.oldMutationTypeName) {
|
|
26
28
|
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldMutationTypeName, mutation?.type.name.value), change);
|
|
27
29
|
}
|
|
30
|
+
if (change.meta.newMutationTypeName === null) {
|
|
31
|
+
schemaNode.operationTypes =
|
|
32
|
+
schemaNode.operationTypes?.filter(({ operation }) => operation !== OperationTypeNode.MUTATION);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
28
35
|
mutation.type.name = nameNode(change.meta.newMutationTypeName);
|
|
29
36
|
}
|
|
30
37
|
}
|
|
@@ -33,25 +40,32 @@ export function schemaQueryTypeChanged(change, schemaNodes, config, _context) {
|
|
|
33
40
|
for (const schemaNode of schemaNodes) {
|
|
34
41
|
const query = schemaNode.operationTypes?.find(({ operation }) => operation === OperationTypeNode.MUTATION);
|
|
35
42
|
if (!query) {
|
|
36
|
-
if (change.meta.oldQueryTypeName !==
|
|
37
|
-
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldQueryTypeName,
|
|
43
|
+
if (change.meta.oldQueryTypeName !== null) {
|
|
44
|
+
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldQueryTypeName, null), change);
|
|
38
45
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
if (change.meta.newQueryTypeName) {
|
|
47
|
+
schemaNode.operationTypes = [
|
|
48
|
+
...(schemaNode.operationTypes ?? []),
|
|
49
|
+
{
|
|
50
|
+
kind: Kind.OPERATION_TYPE_DEFINITION,
|
|
51
|
+
operation: OperationTypeNode.QUERY,
|
|
52
|
+
type: {
|
|
53
|
+
kind: Kind.NAMED_TYPE,
|
|
54
|
+
name: nameNode(change.meta.newQueryTypeName),
|
|
55
|
+
},
|
|
47
56
|
},
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
];
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
60
|
else {
|
|
52
61
|
if (query.type.name.value !== change.meta.oldQueryTypeName) {
|
|
53
62
|
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldQueryTypeName, query?.type.name.value), change);
|
|
54
63
|
}
|
|
64
|
+
if (change.meta.newQueryTypeName === null) {
|
|
65
|
+
schemaNode.operationTypes =
|
|
66
|
+
schemaNode.operationTypes?.filter(({ operation }) => operation !== OperationTypeNode.QUERY);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
55
69
|
query.type.name = nameNode(change.meta.newQueryTypeName);
|
|
56
70
|
}
|
|
57
71
|
}
|
|
@@ -60,25 +74,32 @@ export function schemaSubscriptionTypeChanged(change, schemaNodes, config, _cont
|
|
|
60
74
|
for (const schemaNode of schemaNodes) {
|
|
61
75
|
const sub = schemaNode.operationTypes?.find(({ operation }) => operation === OperationTypeNode.SUBSCRIPTION);
|
|
62
76
|
if (!sub) {
|
|
63
|
-
if (change.meta.oldSubscriptionTypeName !==
|
|
64
|
-
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldSubscriptionTypeName,
|
|
77
|
+
if (change.meta.oldSubscriptionTypeName !== null) {
|
|
78
|
+
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldSubscriptionTypeName, null), change);
|
|
65
79
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
if (change.meta.newSubscriptionTypeName) {
|
|
81
|
+
schemaNode.operationTypes = [
|
|
82
|
+
...(schemaNode.operationTypes ?? []),
|
|
83
|
+
{
|
|
84
|
+
kind: Kind.OPERATION_TYPE_DEFINITION,
|
|
85
|
+
operation: OperationTypeNode.QUERY,
|
|
86
|
+
type: {
|
|
87
|
+
kind: Kind.NAMED_TYPE,
|
|
88
|
+
name: nameNode(change.meta.newSubscriptionTypeName),
|
|
89
|
+
},
|
|
74
90
|
},
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
];
|
|
92
|
+
}
|
|
77
93
|
}
|
|
78
94
|
else {
|
|
79
95
|
if (sub.type.name.value !== change.meta.oldSubscriptionTypeName) {
|
|
80
96
|
config.onError(new ValueMismatchError(Kind.SCHEMA_DEFINITION, change.meta.oldSubscriptionTypeName, sub?.type.name.value), change);
|
|
81
97
|
}
|
|
98
|
+
if (change.meta.newSubscriptionTypeName === null) {
|
|
99
|
+
schemaNode.operationTypes =
|
|
100
|
+
schemaNode.operationTypes?.filter(({ operation }) => operation !== OperationTypeNode.SUBSCRIPTION);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
82
103
|
sub.type.name = nameNode(change.meta.newSubscriptionTypeName);
|
|
83
104
|
}
|
|
84
105
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-inspector/action",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.17",
|
|
4
4
|
"description": "GraphQL Inspector functionality for GitHub Actions",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"dependencies": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"probot": "13.2.2",
|
|
12
12
|
"tslib": "2.6.2",
|
|
13
13
|
"@graphql-inspector/commands": "6.0.0",
|
|
14
|
-
"@graphql-inspector/core": "7.0
|
|
14
|
+
"@graphql-inspector/core": "7.1.0"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
@@ -491,22 +491,22 @@ export type ObjectTypeInterfaceRemovedChange = {
|
|
|
491
491
|
export type SchemaQueryTypeChangedChange = {
|
|
492
492
|
type: typeof ChangeType.SchemaQueryTypeChanged;
|
|
493
493
|
meta: {
|
|
494
|
-
oldQueryTypeName: string;
|
|
495
|
-
newQueryTypeName: string;
|
|
494
|
+
oldQueryTypeName: string | null;
|
|
495
|
+
newQueryTypeName: string | null;
|
|
496
496
|
};
|
|
497
497
|
};
|
|
498
498
|
export type SchemaMutationTypeChangedChange = {
|
|
499
499
|
type: typeof ChangeType.SchemaMutationTypeChanged;
|
|
500
500
|
meta: {
|
|
501
|
-
oldMutationTypeName: string;
|
|
502
|
-
newMutationTypeName: string;
|
|
501
|
+
oldMutationTypeName: string | null;
|
|
502
|
+
newMutationTypeName: string | null;
|
|
503
503
|
};
|
|
504
504
|
};
|
|
505
505
|
export type SchemaSubscriptionTypeChangedChange = {
|
|
506
506
|
type: typeof ChangeType.SchemaSubscriptionTypeChanged;
|
|
507
507
|
meta: {
|
|
508
|
-
oldSubscriptionTypeName: string;
|
|
509
|
-
newSubscriptionTypeName: string;
|
|
508
|
+
oldSubscriptionTypeName: string | null;
|
|
509
|
+
newSubscriptionTypeName: string | null;
|
|
510
510
|
};
|
|
511
511
|
};
|
|
512
512
|
export type TypeRemovedChange = {
|
|
@@ -491,22 +491,22 @@ export type ObjectTypeInterfaceRemovedChange = {
|
|
|
491
491
|
export type SchemaQueryTypeChangedChange = {
|
|
492
492
|
type: typeof ChangeType.SchemaQueryTypeChanged;
|
|
493
493
|
meta: {
|
|
494
|
-
oldQueryTypeName: string;
|
|
495
|
-
newQueryTypeName: string;
|
|
494
|
+
oldQueryTypeName: string | null;
|
|
495
|
+
newQueryTypeName: string | null;
|
|
496
496
|
};
|
|
497
497
|
};
|
|
498
498
|
export type SchemaMutationTypeChangedChange = {
|
|
499
499
|
type: typeof ChangeType.SchemaMutationTypeChanged;
|
|
500
500
|
meta: {
|
|
501
|
-
oldMutationTypeName: string;
|
|
502
|
-
newMutationTypeName: string;
|
|
501
|
+
oldMutationTypeName: string | null;
|
|
502
|
+
newMutationTypeName: string | null;
|
|
503
503
|
};
|
|
504
504
|
};
|
|
505
505
|
export type SchemaSubscriptionTypeChangedChange = {
|
|
506
506
|
type: typeof ChangeType.SchemaSubscriptionTypeChanged;
|
|
507
507
|
meta: {
|
|
508
|
-
oldSubscriptionTypeName: string;
|
|
509
|
-
newSubscriptionTypeName: string;
|
|
508
|
+
oldSubscriptionTypeName: string | null;
|
|
509
|
+
newSubscriptionTypeName: string | null;
|
|
510
510
|
};
|
|
511
511
|
};
|
|
512
512
|
export type TypeRemovedChange = {
|
|
@@ -32,7 +32,7 @@ type KindToPayload = {
|
|
|
32
32
|
change: DirectiveUsageEnumValueAddedChange | DirectiveUsageEnumValueRemovedChange;
|
|
33
33
|
};
|
|
34
34
|
[Kind.SCHEMA_DEFINITION]: {
|
|
35
|
-
input: GraphQLSchema;
|
|
35
|
+
input: GraphQLSchema | null;
|
|
36
36
|
change: DirectiveUsageSchemaAddedChange | DirectiveUsageSchemaRemovedChange;
|
|
37
37
|
};
|
|
38
38
|
[Kind.SCALAR_TYPE_DEFINITION]: {
|
|
@@ -32,7 +32,7 @@ type KindToPayload = {
|
|
|
32
32
|
change: DirectiveUsageEnumValueAddedChange | DirectiveUsageEnumValueRemovedChange;
|
|
33
33
|
};
|
|
34
34
|
[Kind.SCHEMA_DEFINITION]: {
|
|
35
|
-
input: GraphQLSchema;
|
|
35
|
+
input: GraphQLSchema | null;
|
|
36
36
|
change: DirectiveUsageSchemaAddedChange | DirectiveUsageSchemaRemovedChange;
|
|
37
37
|
};
|
|
38
38
|
[Kind.SCALAR_TYPE_DEFINITION]: {
|
|
@@ -7,11 +7,11 @@ export declare function schemaQueryTypeChangedFromMeta(args: SchemaQueryTypeChan
|
|
|
7
7
|
};
|
|
8
8
|
readonly message: string;
|
|
9
9
|
readonly meta: {
|
|
10
|
-
oldQueryTypeName: string;
|
|
11
|
-
newQueryTypeName: string;
|
|
10
|
+
oldQueryTypeName: string | null;
|
|
11
|
+
newQueryTypeName: string | null;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaQueryTypeChanged>;
|
|
14
|
+
export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaQueryTypeChanged>;
|
|
15
15
|
export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTypeChangedChange): {
|
|
16
16
|
readonly type: "SCHEMA_MUTATION_TYPE_CHANGED";
|
|
17
17
|
readonly criticality: {
|
|
@@ -19,11 +19,11 @@ export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTy
|
|
|
19
19
|
};
|
|
20
20
|
readonly message: string;
|
|
21
21
|
readonly meta: {
|
|
22
|
-
oldMutationTypeName: string;
|
|
23
|
-
newMutationTypeName: string;
|
|
22
|
+
oldMutationTypeName: string | null;
|
|
23
|
+
newMutationTypeName: string | null;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaMutationTypeChanged>;
|
|
26
|
+
export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaMutationTypeChanged>;
|
|
27
27
|
export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscriptionTypeChangedChange): {
|
|
28
28
|
readonly type: "SCHEMA_SUBSCRIPTION_TYPE_CHANGED";
|
|
29
29
|
readonly criticality: {
|
|
@@ -31,8 +31,8 @@ export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscr
|
|
|
31
31
|
};
|
|
32
32
|
readonly message: string;
|
|
33
33
|
readonly meta: {
|
|
34
|
-
oldSubscriptionTypeName: string;
|
|
35
|
-
newSubscriptionTypeName: string;
|
|
34
|
+
oldSubscriptionTypeName: string | null;
|
|
35
|
+
newSubscriptionTypeName: string | null;
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaSubscriptionTypeChanged>;
|
|
38
|
+
export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaSubscriptionTypeChanged>;
|
|
@@ -7,11 +7,11 @@ export declare function schemaQueryTypeChangedFromMeta(args: SchemaQueryTypeChan
|
|
|
7
7
|
};
|
|
8
8
|
readonly message: string;
|
|
9
9
|
readonly meta: {
|
|
10
|
-
oldQueryTypeName: string;
|
|
11
|
-
newQueryTypeName: string;
|
|
10
|
+
oldQueryTypeName: string | null;
|
|
11
|
+
newQueryTypeName: string | null;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaQueryTypeChanged>;
|
|
14
|
+
export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaQueryTypeChanged>;
|
|
15
15
|
export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTypeChangedChange): {
|
|
16
16
|
readonly type: "SCHEMA_MUTATION_TYPE_CHANGED";
|
|
17
17
|
readonly criticality: {
|
|
@@ -19,11 +19,11 @@ export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTy
|
|
|
19
19
|
};
|
|
20
20
|
readonly message: string;
|
|
21
21
|
readonly meta: {
|
|
22
|
-
oldMutationTypeName: string;
|
|
23
|
-
newMutationTypeName: string;
|
|
22
|
+
oldMutationTypeName: string | null;
|
|
23
|
+
newMutationTypeName: string | null;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaMutationTypeChanged>;
|
|
26
|
+
export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaMutationTypeChanged>;
|
|
27
27
|
export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscriptionTypeChangedChange): {
|
|
28
28
|
readonly type: "SCHEMA_SUBSCRIPTION_TYPE_CHANGED";
|
|
29
29
|
readonly criticality: {
|
|
@@ -31,8 +31,8 @@ export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscr
|
|
|
31
31
|
};
|
|
32
32
|
readonly message: string;
|
|
33
33
|
readonly meta: {
|
|
34
|
-
oldSubscriptionTypeName: string;
|
|
35
|
-
newSubscriptionTypeName: string;
|
|
34
|
+
oldSubscriptionTypeName: string | null;
|
|
35
|
+
newSubscriptionTypeName: string | null;
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaSubscriptionTypeChanged>;
|
|
38
|
+
export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaSubscriptionTypeChanged>;
|
|
@@ -6,4 +6,4 @@ export * from './rules/types.cjs';
|
|
|
6
6
|
export declare const DiffRule: typeof rules;
|
|
7
7
|
export * from './onComplete/types.cjs';
|
|
8
8
|
export type { UsageHandler } from './rules/consider-usage.cjs';
|
|
9
|
-
export declare function diff(oldSchema: GraphQLSchema, newSchema: GraphQLSchema, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
|
|
9
|
+
export declare function diff(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
|
|
@@ -6,4 +6,4 @@ export * from './rules/types.js';
|
|
|
6
6
|
export declare const DiffRule: typeof rules;
|
|
7
7
|
export * from './onComplete/types.js';
|
|
8
8
|
export type { UsageHandler } from './rules/consider-usage.js';
|
|
9
|
-
export declare function diff(oldSchema: GraphQLSchema, newSchema: GraphQLSchema, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
|
|
9
|
+
export declare function diff(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
|
|
@@ -2,7 +2,7 @@ import { GraphQLSchema } from 'graphql';
|
|
|
2
2
|
import { Change } from '../changes/change.cjs';
|
|
3
3
|
export type Rule<TConfig = any> = (input: {
|
|
4
4
|
changes: Change[];
|
|
5
|
-
oldSchema: GraphQLSchema;
|
|
6
|
-
newSchema: GraphQLSchema;
|
|
5
|
+
oldSchema: GraphQLSchema | null;
|
|
6
|
+
newSchema: GraphQLSchema | null;
|
|
7
7
|
config: TConfig;
|
|
8
8
|
}) => Change[] | Promise<Change[]>;
|
|
@@ -2,7 +2,7 @@ import { GraphQLSchema } from 'graphql';
|
|
|
2
2
|
import { Change } from '../changes/change.js';
|
|
3
3
|
export type Rule<TConfig = any> = (input: {
|
|
4
4
|
changes: Change[];
|
|
5
|
-
oldSchema: GraphQLSchema;
|
|
6
|
-
newSchema: GraphQLSchema;
|
|
5
|
+
oldSchema: GraphQLSchema | null;
|
|
6
|
+
newSchema: GraphQLSchema | null;
|
|
7
7
|
config: TConfig;
|
|
8
8
|
}) => Change[] | Promise<Change[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { Change } from './changes/change.cjs';
|
|
3
3
|
export type AddChange = (change: Change) => void;
|
|
4
|
-
export declare function diffSchema(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change[];
|
|
4
|
+
export declare function diffSchema(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import { Change } from './changes/change.js';
|
|
3
3
|
export type AddChange = (change: Change) => void;
|
|
4
|
-
export declare function diffSchema(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change[];
|
|
4
|
+
export declare function diffSchema(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change[];
|