@graphql-inspector/action 5.0.16-alpha-20251209221244-ff89fd2707cf16b24ef14c13d056b38377608670 → 5.0.16-alpha-20251210214408-83e88e0012f7cbffde895b877242a59aee57ecc0
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/argument.js +1 -7
- package/cjs/core/src/diff/changes/directive-usage.js +4 -4
- package/cjs/core/src/diff/changes/directive.js +2 -16
- package/cjs/core/src/diff/changes/enum.js +5 -7
- package/cjs/core/src/diff/changes/field.js +4 -15
- package/cjs/core/src/diff/changes/input.js +3 -7
- package/cjs/core/src/diff/changes/schema.js +30 -12
- package/cjs/core/src/diff/changes/type.js +3 -8
- 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/argument.js +2 -8
- package/esm/core/src/diff/changes/directive-usage.js +4 -4
- package/esm/core/src/diff/changes/directive.js +3 -17
- package/esm/core/src/diff/changes/enum.js +5 -7
- package/esm/core/src/diff/changes/field.js +4 -15
- package/esm/core/src/diff/changes/input.js +4 -8
- package/esm/core/src/diff/changes/schema.js +30 -12
- package/esm/core/src/diff/changes/type.js +3 -8
- 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
|
@@ -10,13 +10,7 @@ const graphql_js_1 = require("../../utils/graphql.js");
|
|
|
10
10
|
const string_js_1 = require("../../utils/string.js");
|
|
11
11
|
const change_js_1 = require("./change.js");
|
|
12
12
|
function buildFieldArgumentDescriptionChangedMessage(args) {
|
|
13
|
-
|
|
14
|
-
return `Description '${(0, string_js_1.fmt)(args.newDescription)}' was added to argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}'`;
|
|
15
|
-
}
|
|
16
|
-
if (args.newDescription === null && args.oldDescription !== null) {
|
|
17
|
-
return `Description '${(0, string_js_1.fmt)(args.oldDescription)}' was removed from argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}'`;
|
|
18
|
-
}
|
|
19
|
-
return `Description for argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}' changed from '${(0, string_js_1.fmt)(args.oldDescription ?? '')}' to '${(0, string_js_1.fmt)(args.newDescription ?? '')}'`;
|
|
13
|
+
return `Description for argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}' changed from '${args.oldDescription}' to '${args.newDescription}'`;
|
|
20
14
|
}
|
|
21
15
|
function fieldArgumentDescriptionChangedFromMeta(args) {
|
|
22
16
|
return {
|
|
@@ -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
|
}
|
|
@@ -78,13 +78,7 @@ function directiveAdded(directive) {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
function buildDirectiveDescriptionChangedMessage(args) {
|
|
81
|
-
|
|
82
|
-
return `Directive '${args.directiveName}' description '${(0, string_js_1.fmt)(args.newDirectiveDescription)}' was added`;
|
|
83
|
-
}
|
|
84
|
-
if (args.newDirectiveDescription === null && args.oldDirectiveDescription !== null) {
|
|
85
|
-
return `Directive '${args.directiveName}' description '${(0, string_js_1.fmt)(args.oldDirectiveDescription)}' was removed`;
|
|
86
|
-
}
|
|
87
|
-
return `Directive '${args.directiveName}' description changed from '${(0, string_js_1.fmt)(args.oldDirectiveDescription ?? '')}' to '${(0, string_js_1.fmt)(args.newDirectiveDescription ?? '')}'`;
|
|
81
|
+
return `Directive '${args.directiveName}' description changed from '${args.oldDirectiveDescription ?? 'undefined'}' to '${args.newDirectiveDescription ?? 'undefined'}'`;
|
|
88
82
|
}
|
|
89
83
|
function directiveDescriptionChangedFromMeta(args) {
|
|
90
84
|
return {
|
|
@@ -264,15 +258,7 @@ function directiveArgumentRemoved(directive, arg) {
|
|
|
264
258
|
});
|
|
265
259
|
}
|
|
266
260
|
function buildDirectiveArgumentDescriptionChangedMessage(args) {
|
|
267
|
-
|
|
268
|
-
args.newDirectiveArgumentDescription !== null) {
|
|
269
|
-
return `Description '${(0, string_js_1.fmt)(args.newDirectiveArgumentDescription)}' was added to argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
|
|
270
|
-
}
|
|
271
|
-
if (args.newDirectiveArgumentDescription === null &&
|
|
272
|
-
args.oldDirectiveArgumentDescription !== null) {
|
|
273
|
-
return `Description '${(0, string_js_1.fmt)(args.oldDirectiveArgumentDescription)}' was removed from argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
|
|
274
|
-
}
|
|
275
|
-
return `Description for argument '${args.directiveArgumentName}' on directive '${args.directiveName}' changed from '${(0, string_js_1.fmt)(args.oldDirectiveArgumentDescription ?? '')}' to '${(0, string_js_1.fmt)(args.newDirectiveArgumentDescription ?? '')}'`;
|
|
261
|
+
return `Description for argument '${args.directiveArgumentName}' on directive '${args.directiveName}' changed from '${args.oldDirectiveArgumentDescription}' to '${args.newDirectiveArgumentDescription}'`;
|
|
276
262
|
}
|
|
277
263
|
function directiveArgumentDescriptionChangedFromMeta(args) {
|
|
278
264
|
return {
|
|
@@ -72,13 +72,11 @@ function enumValueAdded(type, value, addedToNewType) {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
function buildEnumValueDescriptionChangedMessage(args) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
return `Description for enum value '${args.enumName}.${args.enumValueName}' changed from '${(0, string_js_1.fmt)(args.oldEnumValueDescription ?? '')}' to '${(0, string_js_1.fmt)(args.newEnumValueDescription ?? '')}'`;
|
|
75
|
+
const oldDesc = (0, string_js_1.fmt)(args.oldEnumValueDescription ?? 'undefined');
|
|
76
|
+
const newDesc = (0, string_js_1.fmt)(args.newEnumValueDescription ?? 'undefined');
|
|
77
|
+
return args.oldEnumValueDescription === null
|
|
78
|
+
? `Description '${newDesc}' was added to enum value '${args.enumName}.${args.enumValueName}'`
|
|
79
|
+
: `Description for enum value '${args.enumName}.${args.enumValueName}' changed from '${oldDesc}' to '${newDesc}'`;
|
|
82
80
|
}
|
|
83
81
|
function enumValueDescriptionChangedFromMeta(args) {
|
|
84
82
|
return {
|
|
@@ -28,7 +28,6 @@ exports.fieldArgumentRemovedFromMeta = fieldArgumentRemovedFromMeta;
|
|
|
28
28
|
exports.fieldArgumentRemoved = fieldArgumentRemoved;
|
|
29
29
|
const graphql_1 = require("graphql");
|
|
30
30
|
const graphql_js_1 = require("../../utils/graphql.js");
|
|
31
|
-
const string_js_1 = require("../../utils/string.js");
|
|
32
31
|
const change_js_1 = require("./change.js");
|
|
33
32
|
function buildFieldRemovedMessage(args) {
|
|
34
33
|
return `Field '${args.removedFieldName}' ${args.isRemovedFieldDeprecated ? '(deprecated) ' : ''}was removed from ${args.typeType} '${args.typeName}'`;
|
|
@@ -86,13 +85,7 @@ function fieldAdded(type, field) {
|
|
|
86
85
|
});
|
|
87
86
|
}
|
|
88
87
|
function buildFieldDescriptionChangedMessage(args) {
|
|
89
|
-
|
|
90
|
-
return `Field '${args.typeName}.${args.fieldName}' description '${(0, string_js_1.fmt)(args.newDescription)}' was added`;
|
|
91
|
-
}
|
|
92
|
-
if (!args.newDescription && args.oldDescription) {
|
|
93
|
-
return `Field '${args.typeName}.${args.fieldName}' description '${(0, string_js_1.fmt)(args.oldDescription)}' was removed`;
|
|
94
|
-
}
|
|
95
|
-
return `Field '${args.typeName}.${args.fieldName}' description changed from '${(0, string_js_1.fmt)(args.oldDescription)}' to '${(0, string_js_1.fmt)(args.newDescription)}'`;
|
|
88
|
+
return `Field '${args.typeName}.${args.fieldName}' description changed from '${args.oldDescription}' to '${args.newDescription}'`;
|
|
96
89
|
}
|
|
97
90
|
function fieldDescriptionChangedFromMeta(args) {
|
|
98
91
|
return {
|
|
@@ -117,8 +110,7 @@ function fieldDescriptionChanged(type, oldField, newField) {
|
|
|
117
110
|
});
|
|
118
111
|
}
|
|
119
112
|
function buildFieldDescriptionAddedMessage(args) {
|
|
120
|
-
|
|
121
|
-
return `Field '${args.typeName}.${args.fieldName}' has description '${desc}'`;
|
|
113
|
+
return `Field '${args.typeName}.${args.fieldName}' has description '${args.addedDescription}'`;
|
|
122
114
|
}
|
|
123
115
|
function fieldDescriptionAddedFromMeta(args) {
|
|
124
116
|
return {
|
|
@@ -209,9 +201,7 @@ function fieldDeprecationRemoved(type, field) {
|
|
|
209
201
|
});
|
|
210
202
|
}
|
|
211
203
|
function buildFieldDeprecationReasonChangedMessage(args) {
|
|
212
|
-
|
|
213
|
-
const newReason = (0, string_js_1.fmt)(args.newDeprecationReason);
|
|
214
|
-
return `Deprecation reason on field '${args.typeName}.${args.fieldName}' has changed from '${oldReason}' to '${newReason}'`;
|
|
204
|
+
return `Deprecation reason on field '${args.typeName}.${args.fieldName}' has changed from '${args.oldDeprecationReason}' to '${args.newDeprecationReason}'`;
|
|
215
205
|
}
|
|
216
206
|
function fieldDeprecationReasonChangedFromMeta(args) {
|
|
217
207
|
return {
|
|
@@ -236,8 +226,7 @@ function fieldDeprecationReasonChanged(type, oldField, newField) {
|
|
|
236
226
|
});
|
|
237
227
|
}
|
|
238
228
|
function buildFieldDeprecationReasonAddedMessage(args) {
|
|
239
|
-
|
|
240
|
-
return `Field '${args.typeName}.${args.fieldName}' has deprecation reason '${reason}'`;
|
|
229
|
+
return `Field '${args.typeName}.${args.fieldName}' has deprecation reason '${args.addedDeprecationReason}'`;
|
|
241
230
|
}
|
|
242
231
|
function fieldDeprecationReasonAddedFromMeta(args) {
|
|
243
232
|
return {
|
|
@@ -82,8 +82,7 @@ function inputFieldAdded(input, field, addedToNewType) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
function buildInputFieldDescriptionAddedMessage(args) {
|
|
85
|
-
|
|
86
|
-
return `Input field '${args.inputName}.${args.inputFieldName}' has description '${desc}'`;
|
|
85
|
+
return `Input field '${args.inputName}.${args.inputFieldName}' has description '${args.addedInputFieldDescription}'`;
|
|
87
86
|
}
|
|
88
87
|
function inputFieldDescriptionAddedFromMeta(args) {
|
|
89
88
|
return {
|
|
@@ -107,8 +106,7 @@ function inputFieldDescriptionAdded(type, field) {
|
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
108
|
function buildInputFieldDescriptionRemovedMessage(args) {
|
|
110
|
-
|
|
111
|
-
return `Description '${desc}' was removed from input field '${args.inputName}.${args.inputFieldName}'`;
|
|
109
|
+
return `Description '${args.removedDescription}' was removed from input field '${args.inputName}.${args.inputFieldName}'`;
|
|
112
110
|
}
|
|
113
111
|
function inputFieldDescriptionRemovedFromMeta(args) {
|
|
114
112
|
return {
|
|
@@ -132,9 +130,7 @@ function inputFieldDescriptionRemoved(type, field) {
|
|
|
132
130
|
});
|
|
133
131
|
}
|
|
134
132
|
function buildInputFieldDescriptionChangedMessage(args) {
|
|
135
|
-
|
|
136
|
-
const newDesc = (0, string_js_1.fmt)(args.newInputFieldDescription);
|
|
137
|
-
return `Input field '${args.inputName}.${args.inputFieldName}' description changed from '${oldDesc}' to '${newDesc}'`;
|
|
133
|
+
return `Input field '${args.inputName}.${args.inputFieldName}' description changed from '${args.oldInputFieldDescription}' to '${args.newInputFieldDescription}'`;
|
|
138
134
|
}
|
|
139
135
|
function inputFieldDescriptionChangedFromMeta(args) {
|
|
140
136
|
return {
|
|
@@ -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: {
|
|
@@ -14,7 +14,6 @@ exports.typeDescriptionAddedFromMeta = typeDescriptionAddedFromMeta;
|
|
|
14
14
|
exports.typeDescriptionAdded = typeDescriptionAdded;
|
|
15
15
|
const graphql_1 = require("graphql");
|
|
16
16
|
const graphql_js_1 = require("../../utils/graphql.js");
|
|
17
|
-
const string_js_1 = require("../../utils/string.js");
|
|
18
17
|
const change_js_1 = require("./change.js");
|
|
19
18
|
function buildTypeRemovedMessage(type) {
|
|
20
19
|
return `Type '${type.removedTypeName}' was removed`;
|
|
@@ -115,9 +114,7 @@ function typeKindChanged(oldType, newType) {
|
|
|
115
114
|
});
|
|
116
115
|
}
|
|
117
116
|
function buildTypeDescriptionChangedMessage(args) {
|
|
118
|
-
|
|
119
|
-
const newDesc = (0, string_js_1.fmt)(args.newTypeDescription);
|
|
120
|
-
return `Description '${oldDesc}' on type '${args.typeName}' has changed to '${newDesc}'`;
|
|
117
|
+
return `Description '${args.oldTypeDescription}' on type '${args.typeName}' has changed to '${args.newTypeDescription}'`;
|
|
121
118
|
}
|
|
122
119
|
function typeDescriptionChangedFromMeta(args) {
|
|
123
120
|
return {
|
|
@@ -141,8 +138,7 @@ function typeDescriptionChanged(oldType, newType) {
|
|
|
141
138
|
});
|
|
142
139
|
}
|
|
143
140
|
function buildTypeDescriptionRemoved(args) {
|
|
144
|
-
|
|
145
|
-
return `Description '${desc}' was removed from object type '${args.typeName}'`;
|
|
141
|
+
return `Description '${args.removedTypeDescription}' was removed from object type '${args.typeName}'`;
|
|
146
142
|
}
|
|
147
143
|
function typeDescriptionRemovedFromMeta(args) {
|
|
148
144
|
return {
|
|
@@ -165,8 +161,7 @@ function typeDescriptionRemoved(type) {
|
|
|
165
161
|
});
|
|
166
162
|
}
|
|
167
163
|
function buildTypeDescriptionAddedMessage(args) {
|
|
168
|
-
|
|
169
|
-
return `Object type '${args.typeName}' has description '${desc}'`;
|
|
164
|
+
return `Object type '${args.typeName}' has description '${args.addedTypeDescription}'`;
|
|
170
165
|
}
|
|
171
166
|
function typeDescriptionAddedFromMeta(args) {
|
|
172
167
|
return {
|
|
@@ -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
|
}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { safeChangeForInputValue } from '../../utils/graphql.js';
|
|
2
|
-
import {
|
|
2
|
+
import { safeString } from '../../utils/string.js';
|
|
3
3
|
import { ChangeType, CriticalityLevel, } from './change.js';
|
|
4
4
|
function buildFieldArgumentDescriptionChangedMessage(args) {
|
|
5
|
-
|
|
6
|
-
return `Description '${fmt(args.newDescription)}' was added to argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}'`;
|
|
7
|
-
}
|
|
8
|
-
if (args.newDescription === null && args.oldDescription !== null) {
|
|
9
|
-
return `Description '${fmt(args.oldDescription)}' was removed from argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}'`;
|
|
10
|
-
}
|
|
11
|
-
return `Description for argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}' changed from '${fmt(args.oldDescription ?? '')}' to '${fmt(args.newDescription ?? '')}'`;
|
|
5
|
+
return `Description for argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}' changed from '${args.oldDescription}' to '${args.newDescription}'`;
|
|
12
6
|
}
|
|
13
7
|
export function fieldArgumentDescriptionChangedFromMeta(args) {
|
|
14
8
|
return {
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import { isNonNullType } from 'graphql';
|
|
2
2
|
import { safeChangeForInputValue } from '../../utils/graphql.js';
|
|
3
|
-
import {
|
|
3
|
+
import { safeString } from '../../utils/string.js';
|
|
4
4
|
import { ChangeType, CriticalityLevel, } from './change.js';
|
|
5
5
|
function buildDirectiveRemovedMessage(args) {
|
|
6
6
|
return `Directive '${args.removedDirectiveName}' was removed`;
|
|
@@ -52,13 +52,7 @@ export function directiveAdded(directive) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
function buildDirectiveDescriptionChangedMessage(args) {
|
|
55
|
-
|
|
56
|
-
return `Directive '${args.directiveName}' description '${fmt(args.newDirectiveDescription)}' was added`;
|
|
57
|
-
}
|
|
58
|
-
if (args.newDirectiveDescription === null && args.oldDirectiveDescription !== null) {
|
|
59
|
-
return `Directive '${args.directiveName}' description '${fmt(args.oldDirectiveDescription)}' was removed`;
|
|
60
|
-
}
|
|
61
|
-
return `Directive '${args.directiveName}' description changed from '${fmt(args.oldDirectiveDescription ?? '')}' to '${fmt(args.newDirectiveDescription ?? '')}'`;
|
|
55
|
+
return `Directive '${args.directiveName}' description changed from '${args.oldDirectiveDescription ?? 'undefined'}' to '${args.newDirectiveDescription ?? 'undefined'}'`;
|
|
62
56
|
}
|
|
63
57
|
export function directiveDescriptionChangedFromMeta(args) {
|
|
64
58
|
return {
|
|
@@ -238,15 +232,7 @@ export function directiveArgumentRemoved(directive, arg) {
|
|
|
238
232
|
});
|
|
239
233
|
}
|
|
240
234
|
function buildDirectiveArgumentDescriptionChangedMessage(args) {
|
|
241
|
-
|
|
242
|
-
args.newDirectiveArgumentDescription !== null) {
|
|
243
|
-
return `Description '${fmt(args.newDirectiveArgumentDescription)}' was added to argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
|
|
244
|
-
}
|
|
245
|
-
if (args.newDirectiveArgumentDescription === null &&
|
|
246
|
-
args.oldDirectiveArgumentDescription !== null) {
|
|
247
|
-
return `Description '${fmt(args.oldDirectiveArgumentDescription)}' was removed from argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
|
|
248
|
-
}
|
|
249
|
-
return `Description for argument '${args.directiveArgumentName}' on directive '${args.directiveName}' changed from '${fmt(args.oldDirectiveArgumentDescription ?? '')}' to '${fmt(args.newDirectiveArgumentDescription ?? '')}'`;
|
|
235
|
+
return `Description for argument '${args.directiveArgumentName}' on directive '${args.directiveName}' changed from '${args.oldDirectiveArgumentDescription}' to '${args.newDirectiveArgumentDescription}'`;
|
|
250
236
|
}
|
|
251
237
|
export function directiveArgumentDescriptionChangedFromMeta(args) {
|
|
252
238
|
return {
|