@graphql-inspector/core 4.0.2 → 4.0.3

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 (193) hide show
  1. package/cjs/ast/document.js +40 -0
  2. package/cjs/coverage/index.js +128 -0
  3. package/cjs/coverage/output/json.js +7 -0
  4. package/cjs/diff/argument.js +25 -0
  5. package/cjs/diff/changes/argument.js +48 -0
  6. package/cjs/diff/changes/change.js +75 -0
  7. package/cjs/diff/changes/directive.js +124 -0
  8. package/cjs/diff/changes/enum.js +75 -0
  9. package/cjs/diff/changes/field.js +166 -0
  10. package/cjs/diff/changes/input.js +98 -0
  11. package/cjs/diff/changes/object.js +28 -0
  12. package/cjs/diff/changes/schema.js +40 -0
  13. package/cjs/diff/changes/type.js +72 -0
  14. package/cjs/diff/changes/union.js +28 -0
  15. package/cjs/diff/directive.js +41 -0
  16. package/cjs/diff/enum.js +34 -0
  17. package/cjs/diff/field.js +54 -0
  18. package/cjs/diff/index.js +22 -0
  19. package/cjs/diff/input.js +47 -0
  20. package/cjs/diff/interface.js +20 -0
  21. package/cjs/diff/object.js +33 -0
  22. package/cjs/diff/onComplete/types.js +0 -0
  23. package/cjs/diff/rules/config.js +0 -0
  24. package/cjs/diff/rules/consider-usage.js +39 -0
  25. package/cjs/diff/rules/dangerous-breaking.js +13 -0
  26. package/cjs/diff/rules/ignore-description-changes.js +21 -0
  27. package/cjs/diff/rules/index.js +8 -0
  28. package/cjs/diff/rules/safe-unreachable.js +19 -0
  29. package/cjs/diff/rules/suppress-removal-of-deprecated-field.js +58 -0
  30. package/cjs/diff/rules/types.js +0 -0
  31. package/cjs/diff/schema.js +107 -0
  32. package/cjs/diff/union.js +18 -0
  33. package/cjs/index.js +27 -0
  34. package/cjs/package.json +1 -0
  35. package/cjs/similar/index.js +57 -0
  36. package/cjs/utils/apollo.js +21 -0
  37. package/cjs/utils/compare.js +91 -0
  38. package/cjs/utils/graphql.js +194 -0
  39. package/cjs/utils/is-deprecated.js +17 -0
  40. package/cjs/utils/path.js +7 -0
  41. package/cjs/utils/string.js +70 -0
  42. package/cjs/validate/alias-count.js +37 -0
  43. package/cjs/validate/complexity.js +39 -0
  44. package/cjs/validate/directive-count.js +37 -0
  45. package/cjs/validate/index.js +143 -0
  46. package/cjs/validate/query-depth.js +103 -0
  47. package/cjs/validate/token-count.js +55 -0
  48. package/esm/ast/document.js +36 -0
  49. package/esm/coverage/index.js +124 -0
  50. package/esm/coverage/output/json.js +3 -0
  51. package/esm/diff/argument.js +21 -0
  52. package/esm/diff/changes/argument.js +42 -0
  53. package/esm/diff/changes/change.js +72 -0
  54. package/esm/diff/changes/directive.js +111 -0
  55. package/esm/diff/changes/enum.js +66 -0
  56. package/esm/diff/changes/field.js +150 -0
  57. package/esm/diff/changes/input.js +88 -0
  58. package/esm/diff/changes/object.js +23 -0
  59. package/esm/diff/changes/schema.js +34 -0
  60. package/esm/diff/changes/type.js +63 -0
  61. package/esm/diff/changes/union.js +23 -0
  62. package/esm/diff/directive.js +37 -0
  63. package/esm/diff/enum.js +30 -0
  64. package/esm/diff/field.js +50 -0
  65. package/esm/diff/index.js +18 -0
  66. package/esm/diff/input.js +43 -0
  67. package/esm/diff/interface.js +16 -0
  68. package/esm/diff/object.js +29 -0
  69. package/esm/diff/onComplete/types.js +0 -0
  70. package/esm/diff/rules/config.js +0 -0
  71. package/esm/diff/rules/consider-usage.js +35 -0
  72. package/esm/diff/rules/dangerous-breaking.js +9 -0
  73. package/esm/diff/rules/ignore-description-changes.js +17 -0
  74. package/esm/diff/rules/index.js +5 -0
  75. package/esm/diff/rules/safe-unreachable.js +15 -0
  76. package/esm/diff/rules/suppress-removal-of-deprecated-field.js +54 -0
  77. package/esm/diff/rules/types.js +0 -0
  78. package/esm/diff/schema.js +103 -0
  79. package/esm/diff/union.js +14 -0
  80. package/esm/index.js +11 -0
  81. package/esm/similar/index.js +53 -0
  82. package/esm/utils/apollo.js +16 -0
  83. package/esm/utils/compare.js +82 -0
  84. package/esm/utils/graphql.js +181 -0
  85. package/esm/utils/is-deprecated.js +13 -0
  86. package/esm/utils/path.js +3 -0
  87. package/esm/utils/string.js +64 -0
  88. package/esm/validate/alias-count.js +32 -0
  89. package/esm/validate/complexity.js +34 -0
  90. package/esm/validate/directive-count.js +32 -0
  91. package/esm/validate/index.js +139 -0
  92. package/esm/validate/query-depth.js +97 -0
  93. package/esm/validate/token-count.js +50 -0
  94. package/package.json +30 -9
  95. package/typings/ast/document.d.ts +15 -0
  96. package/typings/coverage/index.d.ts +51 -0
  97. package/typings/coverage/output/json.d.cts +2 -0
  98. package/{coverage → typings/coverage}/output/json.d.ts +1 -1
  99. package/typings/diff/argument.d.cts +3 -0
  100. package/{diff → typings/diff}/argument.d.ts +1 -1
  101. package/typings/diff/changes/argument.d.cts +5 -0
  102. package/{diff → typings/diff}/changes/argument.d.ts +1 -1
  103. package/typings/diff/changes/change.d.ts +69 -0
  104. package/typings/diff/changes/directive.d.cts +12 -0
  105. package/{diff → typings/diff}/changes/directive.d.ts +1 -1
  106. package/typings/diff/changes/enum.d.cts +8 -0
  107. package/{diff → typings/diff}/changes/enum.d.ts +1 -1
  108. package/typings/diff/changes/field.d.cts +15 -0
  109. package/{diff → typings/diff}/changes/field.d.ts +1 -1
  110. package/typings/diff/changes/input.d.cts +9 -0
  111. package/{diff → typings/diff}/changes/input.d.ts +1 -1
  112. package/typings/diff/changes/object.d.cts +4 -0
  113. package/{diff → typings/diff}/changes/object.d.ts +1 -1
  114. package/typings/diff/changes/schema.d.cts +5 -0
  115. package/{diff → typings/diff}/changes/schema.d.ts +1 -1
  116. package/typings/diff/changes/type.d.cts +8 -0
  117. package/{diff → typings/diff}/changes/type.d.ts +1 -1
  118. package/typings/diff/changes/union.d.cts +4 -0
  119. package/{diff → typings/diff}/changes/union.d.ts +1 -1
  120. package/typings/diff/directive.d.cts +3 -0
  121. package/{diff → typings/diff}/directive.d.ts +1 -1
  122. package/typings/diff/enum.d.cts +3 -0
  123. package/{diff → typings/diff}/enum.d.ts +1 -1
  124. package/typings/diff/field.d.cts +3 -0
  125. package/{diff → typings/diff}/field.d.ts +1 -1
  126. package/typings/diff/index.d.cts +9 -0
  127. package/typings/diff/index.d.ts +9 -0
  128. package/typings/diff/input.d.cts +3 -0
  129. package/{diff → typings/diff}/input.d.ts +1 -1
  130. package/typings/diff/interface.d.cts +3 -0
  131. package/{diff → typings/diff}/interface.d.ts +1 -1
  132. package/typings/diff/object.d.cts +3 -0
  133. package/{diff → typings/diff}/object.d.ts +1 -1
  134. package/typings/diff/onComplete/types.d.cts +7 -0
  135. package/typings/diff/onComplete/types.d.ts +7 -0
  136. package/typings/diff/rules/config.d.cts +2 -0
  137. package/typings/diff/rules/config.d.ts +2 -0
  138. package/typings/diff/rules/consider-usage.d.cts +29 -0
  139. package/{diff → typings/diff}/rules/consider-usage.d.ts +2 -2
  140. package/typings/diff/rules/dangerous-breaking.d.cts +2 -0
  141. package/{diff → typings/diff}/rules/dangerous-breaking.d.ts +1 -1
  142. package/typings/diff/rules/ignore-description-changes.d.cts +2 -0
  143. package/{diff → typings/diff}/rules/ignore-description-changes.d.ts +1 -1
  144. package/typings/diff/rules/index.d.cts +5 -0
  145. package/typings/diff/rules/index.d.ts +5 -0
  146. package/typings/diff/rules/safe-unreachable.d.cts +2 -0
  147. package/{diff → typings/diff}/rules/safe-unreachable.d.ts +1 -1
  148. package/typings/diff/rules/suppress-removal-of-deprecated-field.d.cts +2 -0
  149. package/{diff → typings/diff}/rules/suppress-removal-of-deprecated-field.d.ts +1 -1
  150. package/typings/diff/rules/types.d.cts +8 -0
  151. package/{diff → typings/diff}/rules/types.d.ts +2 -2
  152. package/typings/diff/schema.d.cts +4 -0
  153. package/{diff → typings/diff}/schema.d.ts +2 -2
  154. package/typings/diff/union.d.cts +3 -0
  155. package/{diff → typings/diff}/union.d.ts +1 -1
  156. package/typings/index.d.cts +12 -0
  157. package/typings/index.d.ts +12 -0
  158. package/typings/similar/index.d.cts +6 -0
  159. package/{similar → typings/similar}/index.d.ts +1 -1
  160. package/typings/utils/apollo.d.ts +5 -0
  161. package/typings/utils/compare.d.ts +22 -0
  162. package/typings/utils/graphql.d.ts +11 -0
  163. package/typings/utils/is-deprecated.d.cts +2 -0
  164. package/{utils → typings/utils}/is-deprecated.d.ts +1 -1
  165. package/typings/utils/path.d.ts +1 -0
  166. package/typings/utils/string.d.ts +14 -0
  167. package/typings/validate/alias-count.d.ts +10 -0
  168. package/typings/validate/complexity.d.cts +16 -0
  169. package/{validate → typings/validate}/complexity.d.ts +1 -1
  170. package/typings/validate/directive-count.d.ts +10 -0
  171. package/typings/validate/index.d.ts +49 -0
  172. package/typings/validate/query-depth.d.ts +15 -0
  173. package/typings/validate/token-count.d.ts +12 -0
  174. package/diff/index.d.ts +0 -9
  175. package/diff/onComplete/types.d.ts +0 -7
  176. package/diff/rules/config.d.ts +0 -2
  177. package/diff/rules/index.d.ts +0 -5
  178. package/index.d.ts +0 -12
  179. package/index.js +0 -2075
  180. package/index.mjs +0 -2061
  181. /package/{ast/document.d.ts → typings/ast/document.d.cts} +0 -0
  182. /package/{coverage/index.d.ts → typings/coverage/index.d.cts} +0 -0
  183. /package/{diff/changes/change.d.ts → typings/diff/changes/change.d.cts} +0 -0
  184. /package/{utils/apollo.d.ts → typings/utils/apollo.d.cts} +0 -0
  185. /package/{utils/compare.d.ts → typings/utils/compare.d.cts} +0 -0
  186. /package/{utils/graphql.d.ts → typings/utils/graphql.d.cts} +0 -0
  187. /package/{utils/path.d.ts → typings/utils/path.d.cts} +0 -0
  188. /package/{utils/string.d.ts → typings/utils/string.d.cts} +0 -0
  189. /package/{validate/alias-count.d.ts → typings/validate/alias-count.d.cts} +0 -0
  190. /package/{validate/directive-count.d.ts → typings/validate/directive-count.d.cts} +0 -0
  191. /package/{validate/index.d.ts → typings/validate/index.d.cts} +0 -0
  192. /package/{validate/query-depth.d.ts → typings/validate/query-depth.d.cts} +0 -0
  193. /package/{validate/token-count.d.ts → typings/validate/token-count.d.cts} +0 -0
@@ -0,0 +1,15 @@
1
+ import { GraphQLArgument, GraphQLField, GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
+ import { Change } from './change.cjs';
3
+ export declare function fieldRemoved(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any, any>): Change;
4
+ export declare function fieldAdded(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any, any>): Change;
5
+ export declare function fieldDescriptionChanged(type: GraphQLObjectType | GraphQLInterfaceType, oldField: GraphQLField<any, any>, newField: GraphQLField<any, any>): Change;
6
+ export declare function fieldDescriptionAdded(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any>): Change;
7
+ export declare function fieldDescriptionRemoved(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any>): Change;
8
+ export declare function fieldDeprecationAdded(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any>): Change;
9
+ export declare function fieldDeprecationRemoved(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any>): Change;
10
+ export declare function fieldDeprecationReasonChanged(type: GraphQLObjectType | GraphQLInterfaceType, oldField: GraphQLField<any, any>, newField: GraphQLField<any, any>): Change;
11
+ export declare function fieldDeprecationReasonAdded(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any>): Change;
12
+ export declare function fieldDeprecationReasonRemoved(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any>): Change;
13
+ export declare function fieldTypeChanged(type: GraphQLObjectType | GraphQLInterfaceType, oldField: GraphQLField<any, any, any>, newField: GraphQLField<any, any, any>): Change;
14
+ export declare function fieldArgumentAdded(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any, any>, arg: GraphQLArgument): Change;
15
+ export declare function fieldArgumentRemoved(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any, any>, arg: GraphQLArgument): Change;
@@ -1,5 +1,5 @@
1
1
  import { GraphQLArgument, GraphQLField, GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
- import { Change } from './change';
2
+ import { Change } from './change.js';
3
3
  export declare function fieldRemoved(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any, any>): Change;
4
4
  export declare function fieldAdded(type: GraphQLObjectType | GraphQLInterfaceType, field: GraphQLField<any, any, any>): Change;
5
5
  export declare function fieldDescriptionChanged(type: GraphQLObjectType | GraphQLInterfaceType, oldField: GraphQLField<any, any>, newField: GraphQLField<any, any>): Change;
@@ -0,0 +1,9 @@
1
+ import { GraphQLInputField, GraphQLInputObjectType } from 'graphql';
2
+ import { Change } from './change.cjs';
3
+ export declare function inputFieldRemoved(input: GraphQLInputObjectType, field: GraphQLInputField): Change;
4
+ export declare function inputFieldAdded(input: GraphQLInputObjectType, field: GraphQLInputField): Change;
5
+ export declare function inputFieldDescriptionAdded(type: GraphQLInputObjectType, field: GraphQLInputField): Change;
6
+ export declare function inputFieldDescriptionRemoved(type: GraphQLInputObjectType, field: GraphQLInputField): Change;
7
+ export declare function inputFieldDescriptionChanged(input: GraphQLInputObjectType, oldField: GraphQLInputField, newField: GraphQLInputField): Change;
8
+ export declare function inputFieldDefaultValueChanged(input: GraphQLInputObjectType, oldField: GraphQLInputField, newField: GraphQLInputField): Change;
9
+ export declare function inputFieldTypeChanged(input: GraphQLInputObjectType, oldField: GraphQLInputField, newField: GraphQLInputField): Change;
@@ -1,5 +1,5 @@
1
1
  import { GraphQLInputField, GraphQLInputObjectType } from 'graphql';
2
- import { Change } from './change';
2
+ import { Change } from './change.js';
3
3
  export declare function inputFieldRemoved(input: GraphQLInputObjectType, field: GraphQLInputField): Change;
4
4
  export declare function inputFieldAdded(input: GraphQLInputObjectType, field: GraphQLInputField): Change;
5
5
  export declare function inputFieldDescriptionAdded(type: GraphQLInputObjectType, field: GraphQLInputField): Change;
@@ -0,0 +1,4 @@
1
+ import { GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
+ import { Change } from './change.cjs';
3
+ export declare function objectTypeInterfaceAdded(iface: GraphQLInterfaceType, type: GraphQLObjectType): Change;
4
+ export declare function objectTypeInterfaceRemoved(iface: GraphQLInterfaceType, type: GraphQLObjectType): Change;
@@ -1,4 +1,4 @@
1
1
  import { GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
- import { Change } from './change';
2
+ import { Change } from './change.js';
3
3
  export declare function objectTypeInterfaceAdded(iface: GraphQLInterfaceType, type: GraphQLObjectType): Change;
4
4
  export declare function objectTypeInterfaceRemoved(iface: GraphQLInterfaceType, type: GraphQLObjectType): Change;
@@ -0,0 +1,5 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { Change } from './change.cjs';
3
+ export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change;
4
+ export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change;
5
+ export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change;
@@ -1,5 +1,5 @@
1
1
  import { GraphQLSchema } from 'graphql';
2
- import { Change } from './change';
2
+ import { Change } from './change.js';
3
3
  export declare function schemaQueryTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change;
4
4
  export declare function schemaMutationTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change;
5
5
  export declare function schemaSubscriptionTypeChanged(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change;
@@ -0,0 +1,8 @@
1
+ import { GraphQLNamedType } from 'graphql';
2
+ import { Change } from './change.cjs';
3
+ export declare function typeRemoved(type: GraphQLNamedType): Change;
4
+ export declare function typeAdded(type: GraphQLNamedType): Change;
5
+ export declare function typeKindChanged(oldType: GraphQLNamedType, newType: GraphQLNamedType): Change;
6
+ export declare function typeDescriptionChanged(oldType: GraphQLNamedType, newType: GraphQLNamedType): Change;
7
+ export declare function typeDescriptionRemoved(type: GraphQLNamedType): Change;
8
+ export declare function typeDescriptionAdded(type: GraphQLNamedType): Change;
@@ -1,5 +1,5 @@
1
1
  import { GraphQLNamedType } from 'graphql';
2
- import { Change } from './change';
2
+ import { Change } from './change.js';
3
3
  export declare function typeRemoved(type: GraphQLNamedType): Change;
4
4
  export declare function typeAdded(type: GraphQLNamedType): Change;
5
5
  export declare function typeKindChanged(oldType: GraphQLNamedType, newType: GraphQLNamedType): Change;
@@ -0,0 +1,4 @@
1
+ import { GraphQLObjectType, GraphQLUnionType } from 'graphql';
2
+ import { Change } from './change.cjs';
3
+ export declare function unionMemberRemoved(union: GraphQLUnionType, type: GraphQLObjectType): Change;
4
+ export declare function unionMemberAdded(union: GraphQLUnionType, type: GraphQLObjectType): Change;
@@ -1,4 +1,4 @@
1
1
  import { GraphQLObjectType, GraphQLUnionType } from 'graphql';
2
- import { Change } from './change';
2
+ import { Change } from './change.js';
3
3
  export declare function unionMemberRemoved(union: GraphQLUnionType, type: GraphQLObjectType): Change;
4
4
  export declare function unionMemberAdded(union: GraphQLUnionType, type: GraphQLObjectType): Change;
@@ -0,0 +1,3 @@
1
+ import { GraphQLDirective } from 'graphql';
2
+ import { AddChange } from './schema.cjs';
3
+ export declare function changesInDirective(oldDirective: GraphQLDirective, newDirective: GraphQLDirective, addChange: AddChange): void;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLDirective } from 'graphql';
2
- import { AddChange } from './schema';
2
+ import { AddChange } from './schema.js';
3
3
  export declare function changesInDirective(oldDirective: GraphQLDirective, newDirective: GraphQLDirective, addChange: AddChange): void;
@@ -0,0 +1,3 @@
1
+ import { GraphQLEnumType } from 'graphql';
2
+ import { AddChange } from './schema.cjs';
3
+ export declare function changesInEnum(oldEnum: GraphQLEnumType, newEnum: GraphQLEnumType, addChange: AddChange): void;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLEnumType } from 'graphql';
2
- import { AddChange } from './schema';
2
+ import { AddChange } from './schema.js';
3
3
  export declare function changesInEnum(oldEnum: GraphQLEnumType, newEnum: GraphQLEnumType, addChange: AddChange): void;
@@ -0,0 +1,3 @@
1
+ import { GraphQLField, GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
+ import { AddChange } from './schema.cjs';
3
+ export declare function changesInField(type: GraphQLObjectType | GraphQLInterfaceType, oldField: GraphQLField<any, any>, newField: GraphQLField<any, any>, addChange: AddChange): void;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLField, GraphQLInterfaceType, GraphQLObjectType } from 'graphql';
2
- import { AddChange } from './schema';
2
+ import { AddChange } from './schema.js';
3
3
  export declare function changesInField(type: GraphQLObjectType | GraphQLInterfaceType, oldField: GraphQLField<any, any>, newField: GraphQLField<any, any>, addChange: AddChange): void;
@@ -0,0 +1,9 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { Change } from './changes/change.cjs';
3
+ import * as rules from './rules/index.cjs';
4
+ import { Rule } from './rules/types.cjs';
5
+ export * from './rules/types.cjs';
6
+ export declare const DiffRule: typeof rules;
7
+ export * from './onComplete/types.cjs';
8
+ export type { UsageHandler } from './rules/consider-usage.cjs';
9
+ export declare function diff(oldSchema: GraphQLSchema, newSchema: GraphQLSchema, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
@@ -0,0 +1,9 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { Change } from './changes/change.js';
3
+ import * as rules from './rules/index.js';
4
+ import { Rule } from './rules/types.js';
5
+ export * from './rules/types.js';
6
+ export declare const DiffRule: typeof rules;
7
+ export * from './onComplete/types.js';
8
+ export type { UsageHandler } from './rules/consider-usage.js';
9
+ export declare function diff(oldSchema: GraphQLSchema, newSchema: GraphQLSchema, rules?: Rule[], config?: rules.ConsiderUsageConfig): Promise<Change[]>;
@@ -0,0 +1,3 @@
1
+ import { GraphQLInputObjectType } from 'graphql';
2
+ import { AddChange } from './schema.cjs';
3
+ export declare function changesInInputObject(oldInput: GraphQLInputObjectType, newInput: GraphQLInputObjectType, addChange: AddChange): void;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLInputObjectType } from 'graphql';
2
- import { AddChange } from './schema';
2
+ import { AddChange } from './schema.js';
3
3
  export declare function changesInInputObject(oldInput: GraphQLInputObjectType, newInput: GraphQLInputObjectType, addChange: AddChange): void;
@@ -0,0 +1,3 @@
1
+ import { GraphQLInterfaceType } from 'graphql';
2
+ import { AddChange } from './schema.cjs';
3
+ export declare function changesInInterface(oldInterface: GraphQLInterfaceType, newInterface: GraphQLInterfaceType, addChange: AddChange): void;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLInterfaceType } from 'graphql';
2
- import { AddChange } from './schema';
2
+ import { AddChange } from './schema.js';
3
3
  export declare function changesInInterface(oldInterface: GraphQLInterfaceType, newInterface: GraphQLInterfaceType, addChange: AddChange): void;
@@ -0,0 +1,3 @@
1
+ import { GraphQLObjectType } from 'graphql';
2
+ import { AddChange } from './schema.cjs';
3
+ export declare function changesInObject(oldType: GraphQLObjectType, newType: GraphQLObjectType, addChange: AddChange): void;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLObjectType } from 'graphql';
2
- import { AddChange } from './schema';
2
+ import { AddChange } from './schema.js';
3
3
  export declare function changesInObject(oldType: GraphQLObjectType, newType: GraphQLObjectType, addChange: AddChange): void;
@@ -0,0 +1,7 @@
1
+ import { Change } from '../changes/change.cjs';
2
+ export type CompletionArgs = {
3
+ breakingChanges: Change[];
4
+ dangerousChanges: Change[];
5
+ nonBreakingChanges: Change[];
6
+ };
7
+ export type CompletionHandler = (args: CompletionArgs) => void;
@@ -0,0 +1,7 @@
1
+ import { Change } from '../changes/change.js';
2
+ export type CompletionArgs = {
3
+ breakingChanges: Change[];
4
+ dangerousChanges: Change[];
5
+ nonBreakingChanges: Change[];
6
+ };
7
+ export type CompletionHandler = (args: CompletionArgs) => void;
@@ -0,0 +1,2 @@
1
+ import { ConsiderUsageConfig } from './consider-usage.cjs';
2
+ export type Config = ConsiderUsageConfig;
@@ -0,0 +1,2 @@
1
+ import { ConsiderUsageConfig } from './consider-usage.js';
2
+ export type Config = ConsiderUsageConfig;
@@ -0,0 +1,29 @@
1
+ import { Rule } from './types.cjs';
2
+ export type UsageHandler = (input: Array<{
3
+ type: string;
4
+ field?: string;
5
+ argument?: string;
6
+ }>) => Promise<boolean[]>;
7
+ export interface ConsiderUsageConfig {
8
+ /**
9
+ * Checks if it's safe to introduce a breaking change on a field
10
+ *
11
+ * Because the function is async and resolves to a boolean value
12
+ * you can add pretty much anything here, many different conditions or
13
+ * even any source of data.
14
+ *
15
+ * In the CLI we use a GraphQL endpoint with a query
16
+ * that checks the usage and returns stats like:
17
+ * min/max count and min/max precentage
18
+ * So we know when to allow for a breaking change.
19
+ *
20
+ * Because it returns a boolean,
21
+ * we can't attach any data or even customize a message of an api change.
22
+ * This is the first iteration, we're going to improve it soon.
23
+ *
24
+ * true - NON_BREAKING
25
+ * false - BREAKING
26
+ */
27
+ checkUsage?: UsageHandler;
28
+ }
29
+ export declare const considerUsage: Rule<ConsiderUsageConfig>;
@@ -1,5 +1,5 @@
1
- import { Rule } from './types';
2
- export declare type UsageHandler = (input: Array<{
1
+ import { Rule } from './types.js';
2
+ export type UsageHandler = (input: Array<{
3
3
  type: string;
4
4
  field?: string;
5
5
  argument?: string;
@@ -0,0 +1,2 @@
1
+ import { Rule } from './types.cjs';
2
+ export declare const dangerousBreaking: Rule;
@@ -1,2 +1,2 @@
1
- import { Rule } from './types';
1
+ import { Rule } from './types.js';
2
2
  export declare const dangerousBreaking: Rule;
@@ -0,0 +1,2 @@
1
+ import { Rule } from './types.cjs';
2
+ export declare const ignoreDescriptionChanges: Rule;
@@ -1,2 +1,2 @@
1
- import { Rule } from './types';
1
+ import { Rule } from './types.js';
2
2
  export declare const ignoreDescriptionChanges: Rule;
@@ -0,0 +1,5 @@
1
+ export * from './consider-usage.cjs';
2
+ export * from './dangerous-breaking.cjs';
3
+ export * from './ignore-description-changes.cjs';
4
+ export * from './safe-unreachable.cjs';
5
+ export * from './suppress-removal-of-deprecated-field.cjs';
@@ -0,0 +1,5 @@
1
+ export * from './consider-usage.js';
2
+ export * from './dangerous-breaking.js';
3
+ export * from './ignore-description-changes.js';
4
+ export * from './safe-unreachable.js';
5
+ export * from './suppress-removal-of-deprecated-field.js';
@@ -0,0 +1,2 @@
1
+ import { Rule } from './types.cjs';
2
+ export declare const safeUnreachable: Rule;
@@ -1,2 +1,2 @@
1
- import { Rule } from './types';
1
+ import { Rule } from './types.js';
2
2
  export declare const safeUnreachable: Rule;
@@ -0,0 +1,2 @@
1
+ import { Rule } from './types.cjs';
2
+ export declare const suppressRemovalOfDeprecatedField: Rule;
@@ -1,2 +1,2 @@
1
- import { Rule } from './types';
1
+ import { Rule } from './types.js';
2
2
  export declare const suppressRemovalOfDeprecatedField: Rule;
@@ -0,0 +1,8 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { Change } from '../changes/change.cjs';
3
+ export type Rule<TConfig = any> = (input: {
4
+ changes: Change[];
5
+ oldSchema: GraphQLSchema;
6
+ newSchema: GraphQLSchema;
7
+ config: TConfig;
8
+ }) => Change[] | Promise<Change[]>;
@@ -1,6 +1,6 @@
1
1
  import { GraphQLSchema } from 'graphql';
2
- import { Change } from '../changes/change';
3
- export declare type Rule<TConfig = any> = (input: {
2
+ import { Change } from '../changes/change.js';
3
+ export type Rule<TConfig = any> = (input: {
4
4
  changes: Change[];
5
5
  oldSchema: GraphQLSchema;
6
6
  newSchema: GraphQLSchema;
@@ -0,0 +1,4 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { Change } from './changes/change.cjs';
3
+ export type AddChange = (change: Change) => void;
4
+ export declare function diffSchema(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change[];
@@ -1,4 +1,4 @@
1
1
  import { GraphQLSchema } from 'graphql';
2
- import { Change } from './changes/change';
3
- export declare type AddChange = (change: Change) => void;
2
+ import { Change } from './changes/change.js';
3
+ export type AddChange = (change: Change) => void;
4
4
  export declare function diffSchema(oldSchema: GraphQLSchema, newSchema: GraphQLSchema): Change[];
@@ -0,0 +1,3 @@
1
+ import { GraphQLUnionType } from 'graphql';
2
+ import { AddChange } from './schema.cjs';
3
+ export declare function changesInUnion(oldUnion: GraphQLUnionType, newUnion: GraphQLUnionType, addChange: AddChange): void;
@@ -1,3 +1,3 @@
1
1
  import { GraphQLUnionType } from 'graphql';
2
- import { AddChange } from './schema';
2
+ import { AddChange } from './schema.js';
3
3
  export declare function changesInUnion(oldUnion: GraphQLUnionType, newUnion: GraphQLUnionType, addChange: AddChange): void;
@@ -0,0 +1,12 @@
1
+ export * from './coverage/index.cjs';
2
+ export { CompletionArgs, CompletionHandler, diff, DiffRule, Rule, UsageHandler, } from './diff/index.cjs';
3
+ export { Change, ChangeType, Criticality, CriticalityLevel } from './diff/changes/change.cjs';
4
+ export { similar, SimilarMap } from './similar/index.cjs';
5
+ export { getTypePrefix } from './utils/graphql.cjs';
6
+ export { BestMatch, Rating, Target } from './utils/string.cjs';
7
+ export { InvalidDocument, validate } from './validate/index.cjs';
8
+ export { countAliases } from './validate/alias-count.cjs';
9
+ export { calculateOperationComplexity, CalculateOperationComplexityConfig, } from './validate/complexity.cjs';
10
+ export { countDirectives } from './validate/directive-count.cjs';
11
+ export { countDepth } from './validate/query-depth.cjs';
12
+ export { calculateTokenCount } from './validate/token-count.cjs';
@@ -0,0 +1,12 @@
1
+ export * from './coverage/index.js';
2
+ export { CompletionArgs, CompletionHandler, diff, DiffRule, Rule, UsageHandler, } from './diff/index.js';
3
+ export { Change, ChangeType, Criticality, CriticalityLevel } from './diff/changes/change.js';
4
+ export { similar, SimilarMap } from './similar/index.js';
5
+ export { getTypePrefix } from './utils/graphql.js';
6
+ export { BestMatch, Rating, Target } from './utils/string.js';
7
+ export { InvalidDocument, validate } from './validate/index.js';
8
+ export { countAliases } from './validate/alias-count.js';
9
+ export { calculateOperationComplexity, CalculateOperationComplexityConfig, } from './validate/complexity.js';
10
+ export { countDirectives } from './validate/directive-count.js';
11
+ export { countDepth } from './validate/query-depth.js';
12
+ export { calculateTokenCount } from './validate/token-count.js';
@@ -0,0 +1,6 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import { BestMatch } from '../utils/string.cjs';
3
+ export interface SimilarMap {
4
+ [name: string]: BestMatch;
5
+ }
6
+ export declare function similar(schema: GraphQLSchema, typeName: string | undefined, threshold?: number): SimilarMap;
@@ -1,5 +1,5 @@
1
1
  import { GraphQLSchema } from 'graphql';
2
- import { BestMatch } from '../utils/string';
2
+ import { BestMatch } from '../utils/string.js';
3
3
  export interface SimilarMap {
4
4
  [name: string]: BestMatch;
5
5
  }
@@ -0,0 +1,5 @@
1
+ import { DocumentNode, GraphQLSchema } from 'graphql';
2
+ export declare function transformDocumentWithApollo(doc: DocumentNode, { keepClientFields }: {
3
+ keepClientFields: boolean;
4
+ }): DocumentNode;
5
+ export declare function transformSchemaWithApollo(schema: GraphQLSchema): GraphQLSchema;
@@ -0,0 +1,22 @@
1
+ export declare function keyMap<T>(list: readonly T[], keyFn: (item: T) => string): Record<string, T>;
2
+ export declare function isEqual<T>(a: T, b: T): boolean;
3
+ export declare function isNotEqual<T>(a: T, b: T): boolean;
4
+ export declare function isVoid<T>(a: T): boolean;
5
+ export declare function diffArrays<T>(a: T[] | readonly T[], b: T[] | readonly T[]): T[];
6
+ export declare function compareLists<T extends {
7
+ name: string;
8
+ }>(oldList: readonly T[], newList: readonly T[], callbacks?: {
9
+ onAdded?(t: T): void;
10
+ onRemoved?(t: T): void;
11
+ onMutual?(t: {
12
+ newVersion: T;
13
+ oldVersion: T;
14
+ }): void;
15
+ }): {
16
+ added: T[];
17
+ removed: T[];
18
+ mutual: {
19
+ newVersion: T;
20
+ oldVersion: T;
21
+ }[];
22
+ };
@@ -0,0 +1,11 @@
1
+ import { DocumentNode, FieldNode, GraphQLError, GraphQLInputType, GraphQLNamedType, GraphQLOutputType, GraphQLSchema, KindEnum } from 'graphql';
2
+ export declare function safeChangeForField(oldType: GraphQLOutputType, newType: GraphQLOutputType): boolean;
3
+ export declare function safeChangeForInputValue(oldType: GraphQLInputType, newType: GraphQLInputType): boolean;
4
+ export declare function getKind(type: GraphQLNamedType): KindEnum;
5
+ export declare function getTypePrefix(type: GraphQLNamedType): string;
6
+ export declare function isPrimitive(type: GraphQLNamedType | string): boolean;
7
+ export declare function isForIntrospection(type: GraphQLNamedType | string): boolean;
8
+ export declare function findDeprecatedUsages(schema: GraphQLSchema, ast: DocumentNode): Array<GraphQLError>;
9
+ export declare function removeFieldIfDirectives(node: FieldNode, directiveNames: string[]): FieldNode | null;
10
+ export declare function removeDirectives(node: FieldNode, directiveNames: string[]): FieldNode;
11
+ export declare function getReachableTypes(schema: GraphQLSchema): Set<string>;
@@ -0,0 +1,2 @@
1
+ import { GraphQLEnumValue, GraphQLField, GraphQLInputField } from 'graphql';
2
+ export declare function isDeprecated(fieldOrEnumValue: GraphQLField<any, any> | GraphQLEnumValue | GraphQLInputField): unknown;
@@ -1,2 +1,2 @@
1
1
  import { GraphQLEnumValue, GraphQLField, GraphQLInputField } from 'graphql';
2
- export declare function isDeprecated(fieldOrEnumValue: GraphQLField<any, any> | GraphQLEnumValue | GraphQLInputField): boolean;
2
+ export declare function isDeprecated(fieldOrEnumValue: GraphQLField<any, any> | GraphQLEnumValue | GraphQLInputField): unknown;
@@ -0,0 +1 @@
1
+ export declare function parsePath(path: string): string[];
@@ -0,0 +1,14 @@
1
+ export interface Target {
2
+ typeId: string;
3
+ value: string;
4
+ }
5
+ export interface Rating {
6
+ target: Target;
7
+ rating: number;
8
+ }
9
+ export interface BestMatch {
10
+ ratings: Rating[];
11
+ bestMatch: Rating;
12
+ }
13
+ export declare function findBestMatch(mainString: string, targetStrings: Target[]): BestMatch;
14
+ export declare function safeString(obj: any): string;
@@ -0,0 +1,10 @@
1
+ import { DepGraph } from 'dependency-graph';
2
+ import type { DocumentNode, FieldNode, FragmentDefinitionNode, FragmentSpreadNode, InlineFragmentNode, OperationDefinitionNode, Source } from 'graphql';
3
+ import { GraphQLError } from 'graphql';
4
+ export declare function validateAliasCount({ source, doc, maxAliasCount, fragmentGraph, }: {
5
+ source: Source;
6
+ doc: DocumentNode;
7
+ maxAliasCount: number;
8
+ fragmentGraph: DepGraph<FragmentDefinitionNode>;
9
+ }): GraphQLError | void;
10
+ export declare function countAliases(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode | FragmentSpreadNode, getFragmentByName: (fragmentName: string) => FragmentDefinitionNode | undefined): number;
@@ -0,0 +1,16 @@
1
+ import { DepGraph } from 'dependency-graph';
2
+ import type { DocumentNode, FieldNode, FragmentDefinitionNode, FragmentSpreadNode, InlineFragmentNode, OperationDefinitionNode, Source } from 'graphql';
3
+ import { GraphQLError } from 'graphql';
4
+ export type CalculateOperationComplexityConfig = {
5
+ scalarCost: number;
6
+ objectCost: number;
7
+ depthCostFactor: number;
8
+ };
9
+ export declare function validateComplexity({ source, doc, maxComplexityScore, config, fragmentGraph, }: {
10
+ source: Source;
11
+ doc: DocumentNode;
12
+ maxComplexityScore: number;
13
+ config: CalculateOperationComplexityConfig;
14
+ fragmentGraph: DepGraph<FragmentDefinitionNode>;
15
+ }): GraphQLError | void;
16
+ export declare function calculateOperationComplexity(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode | FragmentSpreadNode, config: CalculateOperationComplexityConfig, getFragmentByName: (fragmentName: string) => FragmentDefinitionNode | undefined, depth?: number): number;
@@ -1,7 +1,7 @@
1
1
  import { DepGraph } from 'dependency-graph';
2
2
  import type { DocumentNode, FieldNode, FragmentDefinitionNode, FragmentSpreadNode, InlineFragmentNode, OperationDefinitionNode, Source } from 'graphql';
3
3
  import { GraphQLError } from 'graphql';
4
- export declare type CalculateOperationComplexityConfig = {
4
+ export type CalculateOperationComplexityConfig = {
5
5
  scalarCost: number;
6
6
  objectCost: number;
7
7
  depthCostFactor: number;
@@ -0,0 +1,10 @@
1
+ import { DepGraph } from 'dependency-graph';
2
+ import type { DocumentNode, FieldNode, FragmentDefinitionNode, FragmentSpreadNode, InlineFragmentNode, OperationDefinitionNode, Source } from 'graphql';
3
+ import { GraphQLError } from 'graphql';
4
+ export declare function validateDirectiveCount({ source, doc, maxDirectiveCount, fragmentGraph, }: {
5
+ source: Source;
6
+ doc: DocumentNode;
7
+ maxDirectiveCount: number;
8
+ fragmentGraph: DepGraph<FragmentDefinitionNode>;
9
+ }): GraphQLError | void;
10
+ export declare function countDirectives(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode | FragmentSpreadNode, getFragmentByName: (fragmentName: string) => FragmentDefinitionNode | undefined): number;
@@ -0,0 +1,49 @@
1
+ import { GraphQLError, GraphQLSchema, Source } from 'graphql';
2
+ export interface InvalidDocument {
3
+ source: Source;
4
+ errors: GraphQLError[];
5
+ deprecated: GraphQLError[];
6
+ }
7
+ export interface ValidateOptions {
8
+ /**
9
+ * Fails on duplicated fragment names
10
+ * @default true
11
+ */
12
+ strictFragments?: boolean;
13
+ /**
14
+ * Fails on deprecated usage
15
+ * @default true
16
+ */
17
+ strictDeprecated?: boolean;
18
+ /**
19
+ * Works only with combination of `apollo`
20
+ * @default false
21
+ */
22
+ keepClientFields?: boolean;
23
+ /**
24
+ * Supports Apollo directives (`@client` and `@connection`)
25
+ * @default false
26
+ */
27
+ apollo?: boolean;
28
+ /**
29
+ * Fails when operation depth exceeds maximum depth (including the referenced fragments).
30
+ * @default Infinity
31
+ */
32
+ maxDepth?: number;
33
+ /**
34
+ * Fails when alias count exceeds maximum count (including the referenced fragments).
35
+ * @default Infinity
36
+ */
37
+ maxAliasCount?: number;
38
+ /**
39
+ * Fails when the directive count exceeds maximum count for a single operation (including the referenced fragments).
40
+ * @default Infinity
41
+ */
42
+ maxDirectiveCount?: number;
43
+ /**
44
+ * Fails when the token count exceeds maximum count for a single operation (including the referenced fragments).
45
+ * @default Infinity
46
+ */
47
+ maxTokenCount?: number;
48
+ }
49
+ export declare function validate(schema: GraphQLSchema, sources: Source[], options?: ValidateOptions): InvalidDocument[];
@@ -0,0 +1,15 @@
1
+ import { DepGraph } from 'dependency-graph';
2
+ import { ASTNode, DocumentNode, FieldNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLError, InlineFragmentNode, OperationDefinitionNode, Source } from 'graphql';
3
+ export declare function validateQueryDepth({ source, doc, maxDepth, fragmentGraph, }: {
4
+ source: Source;
5
+ doc: DocumentNode;
6
+ maxDepth: number;
7
+ fragmentGraph: DepGraph<FragmentDefinitionNode>;
8
+ }): GraphQLError | void;
9
+ export declare function calculateDepth({ node, currentDepth, maxDepth, getFragment, }: {
10
+ node: ASTNode;
11
+ currentDepth: number;
12
+ maxDepth?: number;
13
+ getFragment: (fragmentName: string) => FragmentDefinitionNode;
14
+ }): number | never;
15
+ export declare function countDepth(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode | FragmentSpreadNode, parentDepth: number, getFragmentReference: (name: string) => FragmentDefinitionNode | undefined): number;
@@ -0,0 +1,12 @@
1
+ import type { Source } from 'graphql';
2
+ import { DocumentNode, GraphQLError } from 'graphql';
3
+ export declare function calculateTokenCount(args: {
4
+ source: Source | string;
5
+ getReferencedFragmentSource: (fragmentName: string) => Source | string | undefined;
6
+ }): number;
7
+ export declare function validateTokenCount(args: {
8
+ source: Source;
9
+ document: DocumentNode;
10
+ getReferencedFragmentSource: (fragmentName: string) => Source | string | undefined;
11
+ maxTokenCount: number;
12
+ }): GraphQLError | void;