@graphql-inspector/cli 6.0.4-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 → 6.0.4-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30

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.
Files changed (33) hide show
  1. package/cjs/core/src/diff/changes/argument.js +7 -1
  2. package/cjs/core/src/diff/changes/directive-usage.js +4 -4
  3. package/cjs/core/src/diff/changes/directive.js +14 -2
  4. package/cjs/core/src/diff/changes/enum.js +7 -5
  5. package/cjs/core/src/diff/changes/field.js +15 -4
  6. package/cjs/core/src/diff/changes/input.js +7 -3
  7. package/cjs/core/src/diff/changes/schema.js +6 -6
  8. package/cjs/core/src/diff/changes/type.js +8 -3
  9. package/cjs/core/src/diff/rules/safe-unreachable.js +1 -1
  10. package/cjs/core/src/diff/rules/suppress-removal-of-deprecated-field.js +4 -4
  11. package/cjs/core/src/diff/schema.js +9 -9
  12. package/esm/core/src/diff/changes/argument.js +8 -2
  13. package/esm/core/src/diff/changes/directive-usage.js +4 -4
  14. package/esm/core/src/diff/changes/directive.js +15 -3
  15. package/esm/core/src/diff/changes/enum.js +7 -5
  16. package/esm/core/src/diff/changes/field.js +15 -4
  17. package/esm/core/src/diff/changes/input.js +8 -4
  18. package/esm/core/src/diff/changes/schema.js +6 -6
  19. package/esm/core/src/diff/changes/type.js +8 -3
  20. package/esm/core/src/diff/rules/safe-unreachable.js +1 -1
  21. package/esm/core/src/diff/rules/suppress-removal-of-deprecated-field.js +4 -4
  22. package/esm/core/src/diff/schema.js +11 -11
  23. package/package.json +10 -10
  24. package/typings/core/src/diff/changes/directive-usage.d.cts +1 -1
  25. package/typings/core/src/diff/changes/directive-usage.d.ts +1 -1
  26. package/typings/core/src/diff/changes/schema.d.cts +3 -3
  27. package/typings/core/src/diff/changes/schema.d.ts +3 -3
  28. package/typings/core/src/diff/index.d.cts +1 -1
  29. package/typings/core/src/diff/index.d.ts +1 -1
  30. package/typings/core/src/diff/rules/types.d.cts +2 -2
  31. package/typings/core/src/diff/rules/types.d.ts +2 -2
  32. package/typings/core/src/diff/schema.d.cts +1 -1
  33. package/typings/core/src/diff/schema.d.ts +1 -1
@@ -10,7 +10,13 @@ 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
- return `Description for argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}' changed from '${args.oldDescription}' to '${args.newDescription}'`;
13
+ if (args.oldDescription === null && args.newDescription !== null) {
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 ?? '')}'`;
14
20
  }
15
21
  function fieldArgumentDescriptionChangedFromMeta(args) {
16
22
  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?.getQueryType()?.name || '',
579
+ schemaTypeName: payload.getQueryType()?.name || '',
580
580
  addedToNewType,
581
- directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
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?.getQueryType()?.name || '',
735
- directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
734
+ schemaTypeName: payload.getQueryType()?.name || '',
735
+ directiveRepeatedTimes: directiveRepeatTimes(payload.astNode?.directives ?? [], directive),
736
736
  },
737
737
  });
738
738
  }
@@ -78,7 +78,13 @@ function directiveAdded(directive) {
78
78
  });
79
79
  }
80
80
  function buildDirectiveDescriptionChangedMessage(args) {
81
- return `Directive '${args.directiveName}' description changed from '${args.oldDirectiveDescription ?? 'undefined'}' to '${args.newDirectiveDescription ?? 'undefined'}'`;
81
+ if (args.oldDirectiveDescription === null && args.newDirectiveDescription !== null) {
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 ?? '')}'`;
82
88
  }
83
89
  function directiveDescriptionChangedFromMeta(args) {
84
90
  return {
@@ -258,7 +264,13 @@ function directiveArgumentRemoved(directive, arg) {
258
264
  });
259
265
  }
260
266
  function buildDirectiveArgumentDescriptionChangedMessage(args) {
261
- return `Description for argument '${args.directiveArgumentName}' on directive '${args.directiveName}' changed from '${args.oldDirectiveArgumentDescription}' to '${args.newDirectiveArgumentDescription}'`;
267
+ if (args.oldDirectiveArgumentDescription === null && args.newDirectiveArgumentDescription !== null) {
268
+ return `Description '${(0, string_js_1.fmt)(args.newDirectiveArgumentDescription)}' was added to argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
269
+ }
270
+ if (args.newDirectiveArgumentDescription === null && args.oldDirectiveArgumentDescription !== null) {
271
+ return `Description '${(0, string_js_1.fmt)(args.oldDirectiveArgumentDescription)}' was removed from argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
272
+ }
273
+ 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 ?? '')}'`;
262
274
  }
263
275
  function directiveArgumentDescriptionChangedFromMeta(args) {
264
276
  return {
@@ -72,11 +72,13 @@ function enumValueAdded(type, value, addedToNewType) {
72
72
  });
73
73
  }
74
74
  function buildEnumValueDescriptionChangedMessage(args) {
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}'`;
75
+ if (args.oldEnumValueDescription === null && args.newEnumValueDescription !== null) {
76
+ return `Description '${(0, string_js_1.fmt)(args.newEnumValueDescription)}' was added to enum value '${args.enumName}.${args.enumValueName}'`;
77
+ }
78
+ if (args.newEnumValueDescription === null && args.oldEnumValueDescription !== null) {
79
+ return `Description '${(0, string_js_1.fmt)(args.oldEnumValueDescription)}' was removed from enum value '${args.enumName}.${args.enumValueName}'`;
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 ?? '')}'`;
80
82
  }
81
83
  function enumValueDescriptionChangedFromMeta(args) {
82
84
  return {
@@ -28,6 +28,7 @@ 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");
31
32
  const change_js_1 = require("./change.js");
32
33
  function buildFieldRemovedMessage(args) {
33
34
  return `Field '${args.removedFieldName}' ${args.isRemovedFieldDeprecated ? '(deprecated) ' : ''}was removed from ${args.typeType} '${args.typeName}'`;
@@ -85,7 +86,13 @@ function fieldAdded(type, field) {
85
86
  });
86
87
  }
87
88
  function buildFieldDescriptionChangedMessage(args) {
88
- return `Field '${args.typeName}.${args.fieldName}' description changed from '${args.oldDescription}' to '${args.newDescription}'`;
89
+ if (!args.oldDescription && args.newDescription) {
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)}'`;
89
96
  }
90
97
  function fieldDescriptionChangedFromMeta(args) {
91
98
  return {
@@ -110,7 +117,8 @@ function fieldDescriptionChanged(type, oldField, newField) {
110
117
  });
111
118
  }
112
119
  function buildFieldDescriptionAddedMessage(args) {
113
- return `Field '${args.typeName}.${args.fieldName}' has description '${args.addedDescription}'`;
120
+ const desc = (0, string_js_1.fmt)(args.addedDescription);
121
+ return `Field '${args.typeName}.${args.fieldName}' has description '${desc}'`;
114
122
  }
115
123
  function fieldDescriptionAddedFromMeta(args) {
116
124
  return {
@@ -201,7 +209,9 @@ function fieldDeprecationRemoved(type, field) {
201
209
  });
202
210
  }
203
211
  function buildFieldDeprecationReasonChangedMessage(args) {
204
- return `Deprecation reason on field '${args.typeName}.${args.fieldName}' has changed from '${args.oldDeprecationReason}' to '${args.newDeprecationReason}'`;
212
+ const oldReason = (0, string_js_1.fmt)(args.oldDeprecationReason);
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}'`;
205
215
  }
206
216
  function fieldDeprecationReasonChangedFromMeta(args) {
207
217
  return {
@@ -226,7 +236,8 @@ function fieldDeprecationReasonChanged(type, oldField, newField) {
226
236
  });
227
237
  }
228
238
  function buildFieldDeprecationReasonAddedMessage(args) {
229
- return `Field '${args.typeName}.${args.fieldName}' has deprecation reason '${args.addedDeprecationReason}'`;
239
+ const reason = (0, string_js_1.fmt)(args.addedDeprecationReason);
240
+ return `Field '${args.typeName}.${args.fieldName}' has deprecation reason '${reason}'`;
230
241
  }
231
242
  function fieldDeprecationReasonAddedFromMeta(args) {
232
243
  return {
@@ -82,7 +82,8 @@ function inputFieldAdded(input, field, addedToNewType) {
82
82
  });
83
83
  }
84
84
  function buildInputFieldDescriptionAddedMessage(args) {
85
- return `Input field '${args.inputName}.${args.inputFieldName}' has description '${args.addedInputFieldDescription}'`;
85
+ const desc = (0, string_js_1.fmt)(args.addedInputFieldDescription);
86
+ return `Input field '${args.inputName}.${args.inputFieldName}' has description '${desc}'`;
86
87
  }
87
88
  function inputFieldDescriptionAddedFromMeta(args) {
88
89
  return {
@@ -106,7 +107,8 @@ function inputFieldDescriptionAdded(type, field) {
106
107
  });
107
108
  }
108
109
  function buildInputFieldDescriptionRemovedMessage(args) {
109
- return `Description '${args.removedDescription}' was removed from input field '${args.inputName}.${args.inputFieldName}'`;
110
+ const desc = (0, string_js_1.fmt)(args.removedDescription);
111
+ return `Description '${desc}' was removed from input field '${args.inputName}.${args.inputFieldName}'`;
110
112
  }
111
113
  function inputFieldDescriptionRemovedFromMeta(args) {
112
114
  return {
@@ -130,7 +132,9 @@ function inputFieldDescriptionRemoved(type, field) {
130
132
  });
131
133
  }
132
134
  function buildInputFieldDescriptionChangedMessage(args) {
133
- return `Input field '${args.inputName}.${args.inputFieldName}' description changed from '${args.oldInputFieldDescription}' to '${args.newInputFieldDescription}'`;
135
+ const oldDesc = (0, string_js_1.fmt)(args.oldInputFieldDescription);
136
+ const newDesc = (0, string_js_1.fmt)(args.newInputFieldDescription);
137
+ return `Input field '${args.inputName}.${args.inputFieldName}' description changed from '${oldDesc}' to '${newDesc}'`;
134
138
  }
135
139
  function inputFieldDescriptionChangedFromMeta(args) {
136
140
  return {
@@ -23,8 +23,8 @@ function schemaQueryTypeChangedFromMeta(args) {
23
23
  };
24
24
  }
25
25
  function schemaQueryTypeChanged(oldSchema, newSchema) {
26
- const oldName = (oldSchema?.getQueryType() || {}).name || 'unknown';
27
- const newName = (newSchema?.getQueryType() || {}).name || 'unknown';
26
+ const oldName = (oldSchema.getQueryType() || {}).name || 'unknown';
27
+ const newName = (newSchema.getQueryType() || {}).name || 'unknown';
28
28
  return schemaQueryTypeChangedFromMeta({
29
29
  type: change_js_1.ChangeType.SchemaQueryTypeChanged,
30
30
  meta: {
@@ -49,8 +49,8 @@ function schemaMutationTypeChangedFromMeta(args) {
49
49
  };
50
50
  }
51
51
  function schemaMutationTypeChanged(oldSchema, newSchema) {
52
- const oldName = (oldSchema?.getMutationType() || {}).name || 'unknown';
53
- const newName = (newSchema?.getMutationType() || {}).name || 'unknown';
52
+ const oldName = (oldSchema.getMutationType() || {}).name || 'unknown';
53
+ const newName = (newSchema.getMutationType() || {}).name || 'unknown';
54
54
  return schemaMutationTypeChangedFromMeta({
55
55
  type: change_js_1.ChangeType.SchemaMutationTypeChanged,
56
56
  meta: {
@@ -75,8 +75,8 @@ function schemaSubscriptionTypeChangedFromMeta(args) {
75
75
  };
76
76
  }
77
77
  function schemaSubscriptionTypeChanged(oldSchema, newSchema) {
78
- const oldName = (oldSchema?.getSubscriptionType() || {}).name || 'unknown';
79
- const newName = (newSchema?.getSubscriptionType() || {}).name || 'unknown';
78
+ const oldName = (oldSchema.getSubscriptionType() || {}).name || 'unknown';
79
+ const newName = (newSchema.getSubscriptionType() || {}).name || 'unknown';
80
80
  return schemaSubscriptionTypeChangedFromMeta({
81
81
  type: change_js_1.ChangeType.SchemaSubscriptionTypeChanged,
82
82
  meta: {
@@ -14,6 +14,7 @@ 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");
17
18
  const change_js_1 = require("./change.js");
18
19
  function buildTypeRemovedMessage(type) {
19
20
  return `Type '${type.removedTypeName}' was removed`;
@@ -114,7 +115,9 @@ function typeKindChanged(oldType, newType) {
114
115
  });
115
116
  }
116
117
  function buildTypeDescriptionChangedMessage(args) {
117
- return `Description '${args.oldTypeDescription}' on type '${args.typeName}' has changed to '${args.newTypeDescription}'`;
118
+ const oldDesc = (0, string_js_1.fmt)(args.oldTypeDescription);
119
+ const newDesc = (0, string_js_1.fmt)(args.newTypeDescription);
120
+ return `Description '${oldDesc}' on type '${args.typeName}' has changed to '${newDesc}'`;
118
121
  }
119
122
  function typeDescriptionChangedFromMeta(args) {
120
123
  return {
@@ -138,7 +141,8 @@ function typeDescriptionChanged(oldType, newType) {
138
141
  });
139
142
  }
140
143
  function buildTypeDescriptionRemoved(args) {
141
- return `Description '${args.removedTypeDescription}' was removed from object type '${args.typeName}'`;
144
+ const desc = (0, string_js_1.fmt)(args.removedTypeDescription);
145
+ return `Description '${desc}' was removed from object type '${args.typeName}'`;
142
146
  }
143
147
  function typeDescriptionRemovedFromMeta(args) {
144
148
  return {
@@ -161,7 +165,8 @@ function typeDescriptionRemoved(type) {
161
165
  });
162
166
  }
163
167
  function buildTypeDescriptionAddedMessage(args) {
164
- return `Object type '${args.typeName}' has description '${args.addedTypeDescription}'`;
168
+ const desc = (0, string_js_1.fmt)(args.addedTypeDescription);
169
+ return `Object type '${args.typeName}' has description '${desc}'`;
165
170
  }
166
171
  function typeDescriptionAddedFromMeta(args) {
167
172
  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 = oldSchema ? (0, graphql_js_1.getReachableTypes)(oldSchema) : new Set();
8
+ const reachable = (0, graphql_js_1.getReachableTypes)(oldSchema);
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?.getType(typeName);
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?.getType(enumName);
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?.getType(inputName);
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?.getType(typeName);
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?.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)), {
24
+ (0, compare_js_1.compareLists)(Object.values(oldSchema.getTypeMap()).filter(t => !(0, graphql_js_1.isPrimitive)(t)), Object.values(newSchema.getTypeMap()).filter(t => !(0, graphql_js_1.isPrimitive)(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?.getDirectives() ?? []).filter(t => !(0, graphql_1.isSpecifiedDirective)(t)), (newSchema?.getDirectives() ?? []).filter(t => !(0, graphql_1.isSpecifiedDirective)(t)), {
36
+ (0, compare_js_1.compareLists)(oldSchema.getDirectives(), newSchema.getDirectives(), {
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?.astNode?.directives || [], newSchema?.astNode?.directives || [], {
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?.getQueryType() || {}).name,
65
- mutation: (oldSchema?.getMutationType() || {}).name,
66
- subscription: (oldSchema?.getSubscriptionType() || {}).name,
64
+ query: (oldSchema.getQueryType() || {}).name,
65
+ mutation: (oldSchema.getMutationType() || {}).name,
66
+ subscription: (oldSchema.getSubscriptionType() || {}).name,
67
67
  };
68
68
  const newRoot = {
69
- query: (newSchema?.getQueryType() || {}).name,
70
- mutation: (newSchema?.getMutationType() || {}).name,
71
- subscription: (newSchema?.getSubscriptionType() || {}).name,
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));
@@ -1,8 +1,14 @@
1
1
  import { safeChangeForInputValue } from '../../utils/graphql.js';
2
- import { safeString } from '../../utils/string.js';
2
+ import { fmt, safeString } from '../../utils/string.js';
3
3
  import { ChangeType, CriticalityLevel, } from './change.js';
4
4
  function buildFieldArgumentDescriptionChangedMessage(args) {
5
- return `Description for argument '${args.argumentName}' on field '${args.typeName}.${args.fieldName}' changed from '${args.oldDescription}' to '${args.newDescription}'`;
5
+ if (args.oldDescription === null && args.newDescription !== null) {
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 ?? '')}'`;
6
12
  }
7
13
  export function fieldArgumentDescriptionChangedFromMeta(args) {
8
14
  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?.getQueryType()?.name || '',
548
+ schemaTypeName: payload.getQueryType()?.name || '',
549
549
  addedToNewType,
550
- directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
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?.getQueryType()?.name || '',
704
- directiveRepeatedTimes: directiveRepeatTimes(payload?.astNode?.directives ?? [], directive),
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 { safeString } from '../../utils/string.js';
3
+ import { fmt, 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,7 +52,13 @@ export function directiveAdded(directive) {
52
52
  });
53
53
  }
54
54
  function buildDirectiveDescriptionChangedMessage(args) {
55
- return `Directive '${args.directiveName}' description changed from '${args.oldDirectiveDescription ?? 'undefined'}' to '${args.newDirectiveDescription ?? 'undefined'}'`;
55
+ if (args.oldDirectiveDescription === null && args.newDirectiveDescription !== null) {
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 ?? '')}'`;
56
62
  }
57
63
  export function directiveDescriptionChangedFromMeta(args) {
58
64
  return {
@@ -232,7 +238,13 @@ export function directiveArgumentRemoved(directive, arg) {
232
238
  });
233
239
  }
234
240
  function buildDirectiveArgumentDescriptionChangedMessage(args) {
235
- return `Description for argument '${args.directiveArgumentName}' on directive '${args.directiveName}' changed from '${args.oldDirectiveArgumentDescription}' to '${args.newDirectiveArgumentDescription}'`;
241
+ if (args.oldDirectiveArgumentDescription === null && args.newDirectiveArgumentDescription !== null) {
242
+ return `Description '${fmt(args.newDirectiveArgumentDescription)}' was added to argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
243
+ }
244
+ if (args.newDirectiveArgumentDescription === null && args.oldDirectiveArgumentDescription !== null) {
245
+ return `Description '${fmt(args.oldDirectiveArgumentDescription)}' was removed from argument '${args.directiveArgumentName}' on directive '${args.directiveName}'`;
246
+ }
247
+ return `Description for argument '${args.directiveArgumentName}' on directive '${args.directiveName}' changed from '${fmt(args.oldDirectiveArgumentDescription ?? '')}' to '${fmt(args.newDirectiveArgumentDescription ?? '')}'`;
236
248
  }
237
249
  export function directiveArgumentDescriptionChangedFromMeta(args) {
238
250
  return {
@@ -58,11 +58,13 @@ export function enumValueAdded(type, value, addedToNewType) {
58
58
  });
59
59
  }
60
60
  function buildEnumValueDescriptionChangedMessage(args) {
61
- const oldDesc = fmt(args.oldEnumValueDescription ?? 'undefined');
62
- const newDesc = fmt(args.newEnumValueDescription ?? 'undefined');
63
- return args.oldEnumValueDescription === null
64
- ? `Description '${newDesc}' was added to enum value '${args.enumName}.${args.enumValueName}'`
65
- : `Description for enum value '${args.enumName}.${args.enumValueName}' changed from '${oldDesc}' to '${newDesc}'`;
61
+ if (args.oldEnumValueDescription === null && args.newEnumValueDescription !== null) {
62
+ return `Description '${fmt(args.newEnumValueDescription)}' was added to enum value '${args.enumName}.${args.enumValueName}'`;
63
+ }
64
+ if (args.newEnumValueDescription === null && args.oldEnumValueDescription !== null) {
65
+ return `Description '${fmt(args.oldEnumValueDescription)}' was removed from enum value '${args.enumName}.${args.enumValueName}'`;
66
+ }
67
+ return `Description for enum value '${args.enumName}.${args.enumValueName}' changed from '${fmt(args.oldEnumValueDescription ?? '')}' to '${fmt(args.newEnumValueDescription ?? '')}'`;
66
68
  }
67
69
  export function enumValueDescriptionChangedFromMeta(args) {
68
70
  return {
@@ -1,5 +1,6 @@
1
1
  import { GraphQLDeprecatedDirective, isInterfaceType, isNonNullType, } from 'graphql';
2
2
  import { safeChangeForField } from '../../utils/graphql.js';
3
+ import { fmt } from '../../utils/string.js';
3
4
  import { ChangeType, CriticalityLevel, } from './change.js';
4
5
  function buildFieldRemovedMessage(args) {
5
6
  return `Field '${args.removedFieldName}' ${args.isRemovedFieldDeprecated ? '(deprecated) ' : ''}was removed from ${args.typeType} '${args.typeName}'`;
@@ -57,7 +58,13 @@ export function fieldAdded(type, field) {
57
58
  });
58
59
  }
59
60
  function buildFieldDescriptionChangedMessage(args) {
60
- return `Field '${args.typeName}.${args.fieldName}' description changed from '${args.oldDescription}' to '${args.newDescription}'`;
61
+ if (!args.oldDescription && args.newDescription) {
62
+ return `Field '${args.typeName}.${args.fieldName}' description '${fmt(args.newDescription)}' was added`;
63
+ }
64
+ if (!args.newDescription && args.oldDescription) {
65
+ return `Field '${args.typeName}.${args.fieldName}' description '${fmt(args.oldDescription)}' was removed`;
66
+ }
67
+ return `Field '${args.typeName}.${args.fieldName}' description changed from '${fmt(args.oldDescription)}' to '${fmt(args.newDescription)}'`;
61
68
  }
62
69
  export function fieldDescriptionChangedFromMeta(args) {
63
70
  return {
@@ -82,7 +89,8 @@ export function fieldDescriptionChanged(type, oldField, newField) {
82
89
  });
83
90
  }
84
91
  function buildFieldDescriptionAddedMessage(args) {
85
- return `Field '${args.typeName}.${args.fieldName}' has description '${args.addedDescription}'`;
92
+ const desc = fmt(args.addedDescription);
93
+ return `Field '${args.typeName}.${args.fieldName}' has description '${desc}'`;
86
94
  }
87
95
  export function fieldDescriptionAddedFromMeta(args) {
88
96
  return {
@@ -173,7 +181,9 @@ export function fieldDeprecationRemoved(type, field) {
173
181
  });
174
182
  }
175
183
  function buildFieldDeprecationReasonChangedMessage(args) {
176
- return `Deprecation reason on field '${args.typeName}.${args.fieldName}' has changed from '${args.oldDeprecationReason}' to '${args.newDeprecationReason}'`;
184
+ const oldReason = fmt(args.oldDeprecationReason);
185
+ const newReason = fmt(args.newDeprecationReason);
186
+ return `Deprecation reason on field '${args.typeName}.${args.fieldName}' has changed from '${oldReason}' to '${newReason}'`;
177
187
  }
178
188
  export function fieldDeprecationReasonChangedFromMeta(args) {
179
189
  return {
@@ -198,7 +208,8 @@ export function fieldDeprecationReasonChanged(type, oldField, newField) {
198
208
  });
199
209
  }
200
210
  function buildFieldDeprecationReasonAddedMessage(args) {
201
- return `Field '${args.typeName}.${args.fieldName}' has deprecation reason '${args.addedDeprecationReason}'`;
211
+ const reason = fmt(args.addedDeprecationReason);
212
+ return `Field '${args.typeName}.${args.fieldName}' has deprecation reason '${reason}'`;
202
213
  }
203
214
  export function fieldDeprecationReasonAddedFromMeta(args) {
204
215
  return {
@@ -1,7 +1,7 @@
1
1
  import { isNonNullType } from 'graphql';
2
2
  import { safeChangeForInputValue } from '../../utils/graphql.js';
3
3
  import { isDeprecated } from '../../utils/is-deprecated.js';
4
- import { safeString } from '../../utils/string.js';
4
+ import { fmt, safeString } from '../../utils/string.js';
5
5
  import { ChangeType, CriticalityLevel, } from './change.js';
6
6
  function buildInputFieldRemovedMessage(args) {
7
7
  return `Input field '${args.removedFieldName}' ${args.isInputFieldDeprecated ? '(deprecated) ' : ''}was removed from input object type '${args.inputName}'`;
@@ -65,7 +65,8 @@ export function inputFieldAdded(input, field, addedToNewType) {
65
65
  });
66
66
  }
67
67
  function buildInputFieldDescriptionAddedMessage(args) {
68
- return `Input field '${args.inputName}.${args.inputFieldName}' has description '${args.addedInputFieldDescription}'`;
68
+ const desc = fmt(args.addedInputFieldDescription);
69
+ return `Input field '${args.inputName}.${args.inputFieldName}' has description '${desc}'`;
69
70
  }
70
71
  export function inputFieldDescriptionAddedFromMeta(args) {
71
72
  return {
@@ -89,7 +90,8 @@ export function inputFieldDescriptionAdded(type, field) {
89
90
  });
90
91
  }
91
92
  function buildInputFieldDescriptionRemovedMessage(args) {
92
- return `Description '${args.removedDescription}' was removed from input field '${args.inputName}.${args.inputFieldName}'`;
93
+ const desc = fmt(args.removedDescription);
94
+ return `Description '${desc}' was removed from input field '${args.inputName}.${args.inputFieldName}'`;
93
95
  }
94
96
  export function inputFieldDescriptionRemovedFromMeta(args) {
95
97
  return {
@@ -113,7 +115,9 @@ export function inputFieldDescriptionRemoved(type, field) {
113
115
  });
114
116
  }
115
117
  function buildInputFieldDescriptionChangedMessage(args) {
116
- return `Input field '${args.inputName}.${args.inputFieldName}' description changed from '${args.oldInputFieldDescription}' to '${args.newInputFieldDescription}'`;
118
+ const oldDesc = fmt(args.oldInputFieldDescription);
119
+ const newDesc = fmt(args.newInputFieldDescription);
120
+ return `Input field '${args.inputName}.${args.inputFieldName}' description changed from '${oldDesc}' to '${newDesc}'`;
117
121
  }
118
122
  export function inputFieldDescriptionChangedFromMeta(args) {
119
123
  return {
@@ -15,8 +15,8 @@ export function schemaQueryTypeChangedFromMeta(args) {
15
15
  };
16
16
  }
17
17
  export function schemaQueryTypeChanged(oldSchema, newSchema) {
18
- const oldName = (oldSchema?.getQueryType() || {}).name || 'unknown';
19
- const newName = (newSchema?.getQueryType() || {}).name || 'unknown';
18
+ const oldName = (oldSchema.getQueryType() || {}).name || 'unknown';
19
+ const newName = (newSchema.getQueryType() || {}).name || 'unknown';
20
20
  return schemaQueryTypeChangedFromMeta({
21
21
  type: ChangeType.SchemaQueryTypeChanged,
22
22
  meta: {
@@ -41,8 +41,8 @@ export function schemaMutationTypeChangedFromMeta(args) {
41
41
  };
42
42
  }
43
43
  export function schemaMutationTypeChanged(oldSchema, newSchema) {
44
- const oldName = (oldSchema?.getMutationType() || {}).name || 'unknown';
45
- const newName = (newSchema?.getMutationType() || {}).name || 'unknown';
44
+ const oldName = (oldSchema.getMutationType() || {}).name || 'unknown';
45
+ const newName = (newSchema.getMutationType() || {}).name || 'unknown';
46
46
  return schemaMutationTypeChangedFromMeta({
47
47
  type: ChangeType.SchemaMutationTypeChanged,
48
48
  meta: {
@@ -67,8 +67,8 @@ export function schemaSubscriptionTypeChangedFromMeta(args) {
67
67
  };
68
68
  }
69
69
  export function schemaSubscriptionTypeChanged(oldSchema, newSchema) {
70
- const oldName = (oldSchema?.getSubscriptionType() || {}).name || 'unknown';
71
- const newName = (newSchema?.getSubscriptionType() || {}).name || 'unknown';
70
+ const oldName = (oldSchema.getSubscriptionType() || {}).name || 'unknown';
71
+ const newName = (newSchema.getSubscriptionType() || {}).name || 'unknown';
72
72
  return schemaSubscriptionTypeChangedFromMeta({
73
73
  type: ChangeType.SchemaSubscriptionTypeChanged,
74
74
  meta: {
@@ -1,5 +1,6 @@
1
1
  import { isEnumType, isInputObjectType, isInterfaceType, isObjectType, isUnionType, Kind, } from 'graphql';
2
2
  import { getKind } from '../../utils/graphql.js';
3
+ import { fmt } from '../../utils/string.js';
3
4
  import { ChangeType, CriticalityLevel, } from './change.js';
4
5
  function buildTypeRemovedMessage(type) {
5
6
  return `Type '${type.removedTypeName}' was removed`;
@@ -100,7 +101,9 @@ export function typeKindChanged(oldType, newType) {
100
101
  });
101
102
  }
102
103
  function buildTypeDescriptionChangedMessage(args) {
103
- return `Description '${args.oldTypeDescription}' on type '${args.typeName}' has changed to '${args.newTypeDescription}'`;
104
+ const oldDesc = fmt(args.oldTypeDescription);
105
+ const newDesc = fmt(args.newTypeDescription);
106
+ return `Description '${oldDesc}' on type '${args.typeName}' has changed to '${newDesc}'`;
104
107
  }
105
108
  export function typeDescriptionChangedFromMeta(args) {
106
109
  return {
@@ -124,7 +127,8 @@ export function typeDescriptionChanged(oldType, newType) {
124
127
  });
125
128
  }
126
129
  function buildTypeDescriptionRemoved(args) {
127
- return `Description '${args.removedTypeDescription}' was removed from object type '${args.typeName}'`;
130
+ const desc = fmt(args.removedTypeDescription);
131
+ return `Description '${desc}' was removed from object type '${args.typeName}'`;
128
132
  }
129
133
  export function typeDescriptionRemovedFromMeta(args) {
130
134
  return {
@@ -147,7 +151,8 @@ export function typeDescriptionRemoved(type) {
147
151
  });
148
152
  }
149
153
  function buildTypeDescriptionAddedMessage(args) {
150
- return `Object type '${args.typeName}' has description '${args.addedTypeDescription}'`;
154
+ const desc = fmt(args.addedTypeDescription);
155
+ return `Object type '${args.typeName}' has description '${desc}'`;
151
156
  }
152
157
  export function typeDescriptionAddedFromMeta(args) {
153
158
  return {
@@ -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 = oldSchema ? getReachableTypes(oldSchema) : new Set();
5
+ const reachable = getReachableTypes(oldSchema);
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?.getType(typeName);
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?.getType(enumName);
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?.getType(inputName);
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?.getType(typeName);
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, isSpecifiedDirective, isUnionType, Kind, } from 'graphql';
1
+ import { isEnumType, isInputObjectType, isInterfaceType, isObjectType, isScalarType, isUnionType, Kind, } from 'graphql';
2
2
  import { compareDirectiveLists, compareLists, isNotEqual, isVoid } from '../utils/compare.js';
3
- import { isForIntrospection, isPrimitive } from '../utils/graphql.js';
3
+ import { 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?.getTypeMap() ?? {}).filter(t => !isPrimitive(t) && !isForIntrospection(t)), Object.values(newSchema?.getTypeMap() ?? {}).filter(t => !isPrimitive(t) && !isForIntrospection(t)), {
21
+ compareLists(Object.values(oldSchema.getTypeMap()).filter(t => !isPrimitive(t)), Object.values(newSchema.getTypeMap()).filter(t => !isPrimitive(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?.getDirectives() ?? []).filter(t => !isSpecifiedDirective(t)), (newSchema?.getDirectives() ?? []).filter(t => !isSpecifiedDirective(t)), {
33
+ compareLists(oldSchema.getDirectives(), newSchema.getDirectives(), {
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?.astNode?.directives || [], newSchema?.astNode?.directives || [], {
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?.getQueryType() || {}).name,
62
- mutation: (oldSchema?.getMutationType() || {}).name,
63
- subscription: (oldSchema?.getSubscriptionType() || {}).name,
61
+ query: (oldSchema.getQueryType() || {}).name,
62
+ mutation: (oldSchema.getMutationType() || {}).name,
63
+ subscription: (oldSchema.getSubscriptionType() || {}).name,
64
64
  };
65
65
  const newRoot = {
66
- query: (newSchema?.getQueryType() || {}).name,
67
- mutation: (newSchema?.getMutationType() || {}).name,
68
- subscription: (newSchema?.getSubscriptionType() || {}).name,
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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-inspector/cli",
3
- "version": "6.0.4-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425",
3
+ "version": "6.0.4-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30",
4
4
  "description": "Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -10,23 +10,23 @@
10
10
  "@babel/core": "7.26.10",
11
11
  "tslib": "2.6.2",
12
12
  "yargs": "17.7.2",
13
- "@graphql-inspector/audit-command": "5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425",
13
+ "@graphql-inspector/audit-command": "5.0.16-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30",
14
14
  "@graphql-inspector/commands": "6.0.0",
15
15
  "@graphql-inspector/code-loader": "5.0.1",
16
16
  "@graphql-inspector/config": "4.0.2",
17
- "@graphql-inspector/coverage-command": "6.1.10-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425",
18
- "@graphql-inspector/diff-command": "6.0.4-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425",
17
+ "@graphql-inspector/coverage-command": "6.1.10-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30",
18
+ "@graphql-inspector/diff-command": "6.0.4-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30",
19
19
  "@graphql-inspector/docs-command": "5.0.5",
20
+ "@graphql-inspector/github-loader": "5.0.1",
20
21
  "@graphql-inspector/git-loader": "5.0.1",
21
22
  "@graphql-inspector/graphql-loader": "5.0.1",
22
- "@graphql-inspector/introspect-command": "5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425",
23
- "@graphql-inspector/json-loader": "5.0.1",
24
- "@graphql-inspector/serve-command": "5.0.7",
25
- "@graphql-inspector/github-loader": "5.0.1",
23
+ "@graphql-inspector/introspect-command": "5.0.16-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30",
26
24
  "@graphql-inspector/loaders": "4.1.0",
27
- "@graphql-inspector/similar-command": "5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425",
25
+ "@graphql-inspector/serve-command": "5.0.7",
26
+ "@graphql-inspector/similar-command": "5.0.16-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30",
28
27
  "@graphql-inspector/url-loader": "5.0.1",
29
- "@graphql-inspector/validate-command": "5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425"
28
+ "@graphql-inspector/json-loader": "5.0.1",
29
+ "@graphql-inspector/validate-command": "5.0.16-alpha-20251209220655-34aadc8b6d7b9eb674f5ab85c5fbad474e045e30"
30
30
  },
31
31
  "repository": {
32
32
  "type": "git",
@@ -32,7 +32,7 @@ type KindToPayload = {
32
32
  change: DirectiveUsageEnumValueAddedChange | DirectiveUsageEnumValueRemovedChange;
33
33
  };
34
34
  [Kind.SCHEMA_DEFINITION]: {
35
- input: GraphQLSchema | null;
35
+ input: GraphQLSchema;
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 | null;
35
+ input: GraphQLSchema;
36
36
  change: DirectiveUsageSchemaAddedChange | DirectiveUsageSchemaRemovedChange;
37
37
  };
38
38
  [Kind.SCALAR_TYPE_DEFINITION]: {
@@ -11,7 +11,7 @@ export declare function schemaQueryTypeChangedFromMeta(args: SchemaQueryTypeChan
11
11
  newQueryTypeName: string;
12
12
  };
13
13
  };
14
- export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaQueryTypeChanged>;
14
+ export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaQueryTypeChanged>;
15
15
  export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTypeChangedChange): {
16
16
  readonly type: "SCHEMA_MUTATION_TYPE_CHANGED";
17
17
  readonly criticality: {
@@ -23,7 +23,7 @@ export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTy
23
23
  newMutationTypeName: string;
24
24
  };
25
25
  };
26
- export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaMutationTypeChanged>;
26
+ export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaMutationTypeChanged>;
27
27
  export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscriptionTypeChangedChange): {
28
28
  readonly type: "SCHEMA_SUBSCRIPTION_TYPE_CHANGED";
29
29
  readonly criticality: {
@@ -35,4 +35,4 @@ export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscr
35
35
  newSubscriptionTypeName: string;
36
36
  };
37
37
  };
38
- export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaSubscriptionTypeChanged>;
38
+ export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaSubscriptionTypeChanged>;
@@ -11,7 +11,7 @@ export declare function schemaQueryTypeChangedFromMeta(args: SchemaQueryTypeChan
11
11
  newQueryTypeName: string;
12
12
  };
13
13
  };
14
- export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaQueryTypeChanged>;
14
+ export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaQueryTypeChanged>;
15
15
  export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTypeChangedChange): {
16
16
  readonly type: "SCHEMA_MUTATION_TYPE_CHANGED";
17
17
  readonly criticality: {
@@ -23,7 +23,7 @@ export declare function schemaMutationTypeChangedFromMeta(args: SchemaMutationTy
23
23
  newMutationTypeName: string;
24
24
  };
25
25
  };
26
- export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaMutationTypeChanged>;
26
+ export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change<typeof ChangeType.SchemaMutationTypeChanged>;
27
27
  export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscriptionTypeChangedChange): {
28
28
  readonly type: "SCHEMA_SUBSCRIPTION_TYPE_CHANGED";
29
29
  readonly criticality: {
@@ -35,4 +35,4 @@ export declare function schemaSubscriptionTypeChangedFromMeta(args: SchemaSubscr
35
35
  newSubscriptionTypeName: string;
36
36
  };
37
37
  };
38
- export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema | null, newSchema: GraphQLSchema | null): Change<typeof ChangeType.SchemaSubscriptionTypeChanged>;
38
+ export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): 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 | null, newSchema: GraphQLSchema | null, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
9
+ export declare function diff(oldSchema: GraphQLSchema, newSchema: GraphQLSchema, 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 | null, newSchema: GraphQLSchema | null, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
9
+ export declare function diff(oldSchema: GraphQLSchema, newSchema: GraphQLSchema, 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 | null;
6
- newSchema: GraphQLSchema | null;
5
+ oldSchema: GraphQLSchema;
6
+ newSchema: GraphQLSchema;
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 | null;
6
- newSchema: GraphQLSchema | null;
5
+ oldSchema: GraphQLSchema;
6
+ newSchema: GraphQLSchema;
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 | null, newSchema: GraphQLSchema | null): Change[];
4
+ export declare function diffSchema(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): 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 | null, newSchema: GraphQLSchema | null): Change[];
4
+ export declare function diffSchema(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change[];